aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/Kbuild2
-rw-r--r--arch/alpha/include/asm/io.h12
-rw-r--r--arch/alpha/include/asm/sections.h7
-rw-r--r--arch/alpha/include/asm/unistd.h2
-rw-r--r--arch/alpha/include/uapi/asm/ioctls.h2
-rw-r--r--arch/alpha/include/uapi/asm/unistd.h3
-rw-r--r--arch/alpha/kernel/systbls.S3
-rw-r--r--arch/arc/include/asm/Kbuild1
-rw-r--r--arch/arc/mm/cache_arc700.c3
-rw-r--r--arch/arm/Kconfig23
-rw-r--r--arch/arm/Kconfig.debug80
-rw-r--r--arch/arm/Makefile3
-rw-r--r--arch/arm/boot/bootp/Makefile2
-rw-r--r--arch/arm/boot/compressed/Makefile2
-rw-r--r--arch/arm/boot/dts/Makefile35
-rw-r--r--arch/arm/boot/dts/am335x-bone-common.dtsi8
-rw-r--r--arch/arm/boot/dts/am335x-bone.dts5
-rw-r--r--arch/arm/boot/dts/am335x-boneblack.dts5
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi18
-rw-r--r--arch/arm/boot/dts/am4372.dtsi17
-rw-r--r--arch/arm/boot/dts/am437x-gp-evm.dts6
-rw-r--r--arch/arm/boot/dts/am43x-epos-evm.dts9
-rw-r--r--arch/arm/boot/dts/armada-370-db.dts6
-rw-r--r--arch/arm/boot/dts/armada-370-mirabox.dts6
-rw-r--r--arch/arm/boot/dts/armada-370-netgear-rn102.dts10
-rw-r--r--arch/arm/boot/dts/armada-370-netgear-rn104.dts12
-rw-r--r--arch/arm/boot/dts/armada-370-rd.dts47
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi4
-rw-r--r--arch/arm/boot/dts/armada-370.dtsi23
-rw-r--r--arch/arm/boot/dts/armada-375.dtsi6
-rw-r--r--arch/arm/boot/dts/armada-xp-netgear-rn2120.dts6
-rw-r--r--arch/arm/boot/dts/at91-sama5d4ek.dts260
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi12
-rw-r--r--arch/arm/boot/dts/at91sam9g20.dtsi5
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi47
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts4
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts2
-rw-r--r--arch/arm/boot/dts/at91sam9rl.dtsi4
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi4
-rw-r--r--arch/arm/boot/dts/bcm2835-rpi-b.dts8
-rw-r--r--arch/arm/boot/dts/bcm2835.dtsi1
-rw-r--r--arch/arm/boot/dts/bcm63138.dtsi134
-rw-r--r--arch/arm/boot/dts/bcm963138dvt.dts30
-rw-r--r--arch/arm/boot/dts/berlin2q-marvell-dmp.dts4
-rw-r--r--arch/arm/boot/dts/berlin2q.dtsi17
-rw-r--r--arch/arm/boot/dts/cros-adc-thermistors.dtsi44
-rw-r--r--arch/arm/boot/dts/da850-evm.dts72
-rw-r--r--arch/arm/boot/dts/da850.dtsi19
-rw-r--r--arch/arm/boot/dts/dra7-evm.dts76
-rw-r--r--arch/arm/boot/dts/dra7.dtsi41
-rw-r--r--arch/arm/boot/dts/dra72-evm.dts120
-rw-r--r--arch/arm/boot/dts/dra72x.dtsi5
-rw-r--r--arch/arm/boot/dts/dra74x.dtsi6
-rw-r--r--arch/arm/boot/dts/exynos4412-odroid-common.dtsi21
-rw-r--r--arch/arm/boot/dts/exynos4412-origen.dts8
-rw-r--r--arch/arm/boot/dts/exynos4412-trats2.dts8
-rw-r--r--arch/arm/boot/dts/exynos5250-arndale.dts22
-rw-r--r--arch/arm/boot/dts/exynos5250-cros-common.dtsi164
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts18
-rw-r--r--arch/arm/boot/dts/exynos5250-snow.dts195
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi15
-rw-r--r--arch/arm/boot/dts/exynos5260-xyref5260.dts18
-rw-r--r--arch/arm/boot/dts/exynos5410-smdk5410.dts18
-rw-r--r--arch/arm/boot/dts/exynos5420-arndale-octa.dts16
-rw-r--r--arch/arm/boot/dts/exynos5420-peach-pit.dts482
-rw-r--r--arch/arm/boot/dts/exynos5420-smdk5420.dts16
-rw-r--r--arch/arm/boot/dts/exynos5800-peach-pi.dts472
-rw-r--r--arch/arm/boot/dts/hip04-d01.dts32
-rw-r--r--arch/arm/boot/dts/hip04.dtsi267
-rw-r--r--arch/arm/boot/dts/imx1-ads.dts152
-rw-r--r--arch/arm/boot/dts/imx1-apf9328.dts129
-rw-r--r--arch/arm/boot/dts/imx1-pinfunc.h302
-rw-r--r--arch/arm/boot/dts/imx1.dtsi266
-rw-r--r--arch/arm/boot/dts/imx23-evk.dts4
-rw-r--r--arch/arm/boot/dts/imx25-pinfunc.h33
-rw-r--r--arch/arm/boot/dts/imx25.dtsi4
-rw-r--r--arch/arm/boot/dts/imx27-apf27dev.dts17
-rw-r--r--arch/arm/boot/dts/imx28-apf28dev.dts4
-rw-r--r--arch/arm/boot/dts/imx28-apx4devkit.dts4
-rw-r--r--arch/arm/boot/dts/imx28-cfa10049.dts4
-rw-r--r--arch/arm/boot/dts/imx28-cfa10055.dts4
-rw-r--r--arch/arm/boot/dts/imx28-cfa10056.dts4
-rw-r--r--arch/arm/boot/dts/imx28-cfa10057.dts4
-rw-r--r--arch/arm/boot/dts/imx28-cfa10058.dts4
-rw-r--r--arch/arm/boot/dts/imx28-evk.dts4
-rw-r--r--arch/arm/boot/dts/imx28-m28cu3.dts4
-rw-r--r--arch/arm/boot/dts/imx28-m28evk.dts4
-rw-r--r--arch/arm/boot/dts/imx28-tx28.dts107
-rw-r--r--arch/arm/boot/dts/imx28.dtsi43
-rw-r--r--arch/arm/boot/dts/imx35.dtsi1
-rw-r--r--arch/arm/boot/dts/imx50.dtsi2
-rw-r--r--arch/arm/boot/dts/imx51.dtsi3
-rw-r--r--arch/arm/boot/dts/imx53-qsrb.dts8
-rw-r--r--arch/arm/boot/dts/imx53-smd.dts2
-rw-r--r--arch/arm/boot/dts/imx53.dtsi22
-rw-r--r--arch/arm/boot/dts/imx6dl-gw552x.dts20
-rw-r--r--arch/arm/boot/dts/imx6dl-hummingboard.dts201
-rw-r--r--arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts3
-rw-r--r--arch/arm/boot/dts/imx6q-gw5400-a.dts203
-rw-r--r--arch/arm/boot/dts/imx6q-gw552x.dts24
-rw-r--r--arch/arm/boot/dts/imx6q-hummingboard.dts21
-rw-r--r--arch/arm/boot/dts/imx6qdl-cubox-i.dtsi19
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw51xx.dtsi192
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw52xx.dtsi314
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw53xx.dtsi338
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw54xx.dtsi278
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw552x.dtsi267
-rw-r--r--arch/arm/boot/dts/imx6qdl-hummingboard.dtsi200
-rw-r--r--arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi38
-rw-r--r--arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabresd.dtsi45
-rw-r--r--arch/arm/boot/dts/imx6qdl.dtsi24
-rw-r--r--arch/arm/boot/dts/imx6sl-evk.dts104
-rw-r--r--arch/arm/boot/dts/imx6sl.dtsi31
-rw-r--r--arch/arm/boot/dts/imx6sx-pinfunc.h26
-rw-r--r--arch/arm/boot/dts/imx6sx-sdb.dts93
-rw-r--r--arch/arm/boot/dts/imx6sx.dtsi9
-rw-r--r--arch/arm/boot/dts/k2e-clocks.dtsi6
-rw-r--r--arch/arm/boot/dts/k2e.dtsi13
-rw-r--r--arch/arm/boot/dts/k2hk.dtsi56
-rw-r--r--arch/arm/boot/dts/k2l.dtsi46
-rw-r--r--arch/arm/boot/dts/keystone.dtsi10
-rw-r--r--arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts16
-rw-r--r--arch/arm/boot/dts/kirkwood-rd88f6281-a.dts43
-rw-r--r--arch/arm/boot/dts/kirkwood-rd88f6281-a0.dts26
-rw-r--r--arch/arm/boot/dts/kirkwood-rd88f6281-z0.dts (renamed from arch/arm/boot/dts/kirkwood-rd88f6281-a1.dts)18
-rw-r--r--arch/arm/boot/dts/kirkwood-rd88f6281.dtsi27
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi4
-rw-r--r--arch/arm/boot/dts/meson.dtsi110
-rw-r--r--arch/arm/boot/dts/meson6-atv1200.dts66
-rw-r--r--arch/arm/boot/dts/meson6.dtsi78
-rw-r--r--arch/arm/boot/dts/mt6589-aquaris5.dts5
-rw-r--r--arch/arm/boot/dts/mt6589.dtsi4
-rw-r--r--arch/arm/boot/dts/omap2.dtsi1
-rw-r--r--arch/arm/boot/dts/omap2420-n810.dts7
-rw-r--r--arch/arm/boot/dts/omap2420-n8x0-common.dtsi6
-rw-r--r--arch/arm/boot/dts/omap2420.dtsi8
-rw-r--r--arch/arm/boot/dts/omap2430.dtsi4
-rw-r--r--arch/arm/boot/dts/omap3-beagle-xm.dts4
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts1
-rw-r--r--arch/arm/boot/dts/omap3-gta04.dtsi (renamed from arch/arm/boot/dts/omap3-gta04.dts)150
-rw-r--r--arch/arm/boot/dts/omap3-gta04a3.dts48
-rw-r--r--arch/arm/boot/dts/omap3-gta04a4.dts13
-rw-r--r--arch/arm/boot/dts/omap3-gta04a5.dts17
-rw-r--r--arch/arm/boot/dts/omap3-ha-common.dtsi88
-rw-r--r--arch/arm/boot/dts/omap3-ha-lcd.dts165
-rw-r--r--arch/arm/boot/dts/omap3-ha.dts28
-rw-r--r--arch/arm/boot/dts/omap3-ldp.dts5
-rw-r--r--arch/arm/boot/dts/omap3-n900.dts58
-rw-r--r--arch/arm/boot/dts/omap3-overo-common-peripherals.dtsi5
-rw-r--r--arch/arm/boot/dts/omap3-tao3530.dtsi337
-rw-r--r--arch/arm/boot/dts/omap3-thunder.dts129
-rw-r--r--arch/arm/boot/dts/omap3.dtsi8
-rw-r--r--arch/arm/boot/dts/omap3430-sdp.dts2
-rw-r--r--arch/arm/boot/dts/omap3xxx-clocks.dtsi1
-rw-r--r--arch/arm/boot/dts/omap4-panda-common.dtsi3
-rw-r--r--arch/arm/boot/dts/omap4-panda-es.dts5
-rw-r--r--arch/arm/boot/dts/omap4-panda.dts5
-rw-r--r--arch/arm/boot/dts/omap4.dtsi15
-rw-r--r--arch/arm/boot/dts/omap5-cm-t54.dts277
-rw-r--r--arch/arm/boot/dts/omap5-sbc-t54.dts8
-rw-r--r--arch/arm/boot/dts/omap5.dtsi46
-rw-r--r--arch/arm/boot/dts/omap54xx-clocks.dtsi16
-rw-r--r--arch/arm/boot/dts/pxa2xx.dtsi4
-rw-r--r--arch/arm/boot/dts/qcom-apq8064-ifc6410.dts43
-rw-r--r--arch/arm/boot/dts/qcom-apq8064.dtsi183
-rw-r--r--arch/arm/boot/dts/qcom-apq8074-dragonboard.dts21
-rw-r--r--arch/arm/boot/dts/qcom-apq8084-ifc6540.dts23
-rw-r--r--arch/arm/boot/dts/qcom-apq8084-mtp.dts6
-rw-r--r--arch/arm/boot/dts/qcom-apq8084.dtsi51
-rw-r--r--arch/arm/boot/dts/qcom-ipq8064-ap148.dts85
-rw-r--r--arch/arm/boot/dts/qcom-ipq8064-v1.0.dtsi1
-rw-r--r--arch/arm/boot/dts/qcom-ipq8064.dtsi250
-rw-r--r--arch/arm/boot/dts/qcom-msm8660-surf.dts42
-rw-r--r--arch/arm/boot/dts/qcom-msm8660.dtsi93
-rw-r--r--arch/arm/boot/dts/qcom-msm8960-cdp.dts27
-rw-r--r--arch/arm/boot/dts/qcom-msm8960.dtsi87
-rw-r--r--arch/arm/boot/dts/qcom-msm8974.dtsi15
-rw-r--r--arch/arm/boot/dts/r7s72100-genmai.dts4
-rw-r--r--arch/arm/boot/dts/r7s72100.dtsi10
-rw-r--r--arch/arm/boot/dts/r8a73a4.dtsi6
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts283
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva.dts276
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi220
-rw-r--r--arch/arm/boot/dts/r8a7778.dtsi6
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen.dts4
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi58
-rw-r--r--arch/arm/boot/dts/r8a7790-lager.dts44
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi159
-rw-r--r--arch/arm/boot/dts/r8a7791-henninger.dts35
-rw-r--r--arch/arm/boot/dts/r8a7791-koelsch.dts48
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi140
-rw-r--r--arch/arm/boot/dts/r8a7794-alt.dts47
-rw-r--r--arch/arm/boot/dts/r8a7794.dtsi531
-rw-r--r--arch/arm/boot/dts/rk3066a-bqcurie2.dts17
-rw-r--r--arch/arm/boot/dts/rk3066a.dtsi67
-rw-r--r--arch/arm/boot/dts/rk3188-radxarock.dts92
-rw-r--r--arch/arm/boot/dts/rk3188.dtsi91
-rw-r--r--arch/arm/boot/dts/rk3288-evb-act8846.dts10
-rw-r--r--arch/arm/boot/dts/rk3288-evb-rk808.dts132
-rw-r--r--arch/arm/boot/dts/rk3288-evb.dtsi87
-rw-r--r--arch/arm/boot/dts/rk3288.dtsi380
-rw-r--r--arch/arm/boot/dts/rk3xxx.dtsi126
-rw-r--r--arch/arm/boot/dts/sama5d3.dtsi37
-rw-r--r--arch/arm/boot/dts/sama5d3_can.dtsi2
-rw-r--r--arch/arm/boot/dts/sama5d3xcm.dtsi30
-rw-r--r--arch/arm/boot/dts/sama5d3xmb.dtsi4
-rw-r--r--arch/arm/boot/dts/sama5d4.dtsi1240
-rw-r--r--arch/arm/boot/dts/sh7372.dtsi1
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts8
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi36
-rw-r--r--arch/arm/boot/dts/socfpga.dtsi11
-rw-r--r--arch/arm/boot/dts/socfpga_arria5.dtsi11
-rw-r--r--arch/arm/boot/dts/socfpga_arria5_socdk.dts7
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5.dtsi13
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5_socdk.dts4
-rw-r--r--arch/arm/boot/dts/socfpga_vt.dts9
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi18
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi6
-rw-r--r--arch/arm/boot/dts/ste-snowball.dts1
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi19
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi17
-rw-r--r--arch/arm/boot/dts/sun5i-a13-hsg-h702.dts130
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi17
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi64
-rw-r--r--arch/arm/boot/dts/sun7i-a20-hummingbird.dts236
-rw-r--r--arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts137
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi102
-rw-r--r--arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts41
-rw-r--r--arch/arm/boot/dts/sun8i-a23.dtsi237
-rw-r--r--arch/arm/boot/dts/sunxi-common-regulators.dtsi7
-rw-r--r--arch/arm/boot/dts/tegra114.dtsi5
-rw-r--r--arch/arm/boot/dts/tegra124-jetson-tk1.dts98
-rw-r--r--arch/arm/boot/dts/tegra124-nyan-big.dts1136
-rw-r--r--arch/arm/boot/dts/tegra124-venice2.dts18
-rw-r--r--arch/arm/boot/dts/tegra124.dtsi100
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi5
-rw-r--r--arch/arm/boot/dts/tegra30-apalis.dtsi11
-rw-r--r--arch/arm/boot/dts/tegra30-colibri.dtsi11
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi5
-rw-r--r--arch/arm/boot/dts/twl6030.dtsi4
-rw-r--r--arch/arm/boot/dts/vexpress-v2m-rs1.dtsi36
-rw-r--r--arch/arm/boot/dts/vexpress-v2m.dtsi36
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts23
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca9.dts31
-rw-r--r--arch/arm/boot/dts/vf610-colibri-eval-v3.dts46
-rw-r--r--arch/arm/boot/dts/vf610-colibri.dtsi (renamed from arch/arm/boot/dts/vf610-colibri.dts)22
-rw-r--r--arch/arm/boot/dts/vf610-twr.dts28
-rw-r--r--arch/arm/boot/dts/vf610.dtsi60
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi19
-rw-r--r--arch/arm/boot/dts/zynq-parallella.dts27
-rw-r--r--arch/arm/boot/dts/zynq-zc702.dts18
-rw-r--r--arch/arm/boot/dts/zynq-zc706.dts12
-rw-r--r--arch/arm/boot/dts/zynq-zed.dts14
-rw-r--r--arch/arm/common/edma.c9
-rw-r--r--arch/arm/common/scoop.c10
-rw-r--r--arch/arm/configs/ape6evm_defconfig9
-rw-r--r--arch/arm/configs/at91_dt_defconfig35
-rw-r--r--arch/arm/configs/at91sam9260_9g20_defconfig13
-rw-r--r--arch/arm/configs/at91sam9261_9g10_defconfig5
-rw-r--r--arch/arm/configs/at91sam9263_defconfig13
-rw-r--r--arch/arm/configs/at91sam9g45_defconfig19
-rw-r--r--arch/arm/configs/at91sam9rl_defconfig19
-rw-r--r--arch/arm/configs/bcm2835_defconfig1
-rw-r--r--arch/arm/configs/bcm_defconfig1
-rw-r--r--arch/arm/configs/bockw_defconfig3
-rw-r--r--arch/arm/configs/clps711x_defconfig4
-rw-r--r--arch/arm/configs/ep93xx_defconfig1
-rw-r--r--arch/arm/configs/ezx_defconfig1
-rw-r--r--arch/arm/configs/hisi_defconfig (renamed from arch/arm/configs/hi3xxx_defconfig)13
-rw-r--r--arch/arm/configs/imote2_defconfig1
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig16
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig10
-rw-r--r--arch/arm/configs/koelsch_defconfig17
-rw-r--r--arch/arm/configs/kzm9g_defconfig1
-rw-r--r--arch/arm/configs/lager_defconfig8
-rw-r--r--arch/arm/configs/lpc32xx_defconfig2
-rw-r--r--arch/arm/configs/marzen_defconfig1
-rw-r--r--arch/arm/configs/multi_v7_defconfig40
-rw-r--r--arch/arm/configs/mvebu_v7_defconfig68
-rw-r--r--arch/arm/configs/omap2plus_defconfig79
-rw-r--r--arch/arm/configs/pxa3xx_defconfig1
-rw-r--r--arch/arm/configs/qcom_defconfig14
-rw-r--r--arch/arm/configs/sama5_defconfig19
-rw-r--r--arch/arm/configs/shmobile_defconfig16
-rw-r--r--arch/arm/configs/sunxi_defconfig4
-rw-r--r--arch/arm/configs/tegra_defconfig5
-rw-r--r--arch/arm/configs/versatile_defconfig1
-rw-r--r--arch/arm/crypto/sha1-armv7-neon.S39
-rw-r--r--arch/arm/include/asm/arch_timer.h25
-rw-r--r--arch/arm/include/asm/cacheflush.h2
-rw-r--r--arch/arm/include/asm/cputype.h3
-rw-r--r--arch/arm/include/asm/elf.h1
-rw-r--r--arch/arm/include/asm/ftrace.h2
-rw-r--r--arch/arm/include/asm/io.h1
-rw-r--r--arch/arm/include/asm/irq_work.h11
-rw-r--r--arch/arm/include/asm/kvm_emulate.h5
-rw-r--r--arch/arm/include/asm/kvm_host.h23
-rw-r--r--arch/arm/include/asm/kvm_mmu.h11
-rw-r--r--arch/arm/include/asm/mcpm.h5
-rw-r--r--arch/arm/include/asm/pgtable-2level.h2
-rw-r--r--arch/arm/include/asm/pgtable-3level.h15
-rw-r--r--arch/arm/include/asm/pgtable.h6
-rw-r--r--arch/arm/include/asm/smp.h6
-rw-r--r--arch/arm/include/asm/smp_plat.h15
-rw-r--r--arch/arm/include/asm/syscall.h8
-rw-r--r--arch/arm/include/asm/tlb.h38
-rw-r--r--arch/arm/include/asm/tls.h64
-rw-r--r--arch/arm/include/asm/uaccess.h48
-rw-r--r--arch/arm/include/asm/xen/page-coherent.h25
-rw-r--r--arch/arm/include/asm/xen/page.h9
-rw-r--r--arch/arm/include/debug/bcm63xx.S33
-rw-r--r--arch/arm/include/debug/meson.S35
-rw-r--r--arch/arm/include/uapi/asm/kvm.h2
-rw-r--r--arch/arm/kernel/armksyms.c8
-rw-r--r--arch/arm/kernel/atags_parse.c2
-rw-r--r--arch/arm/kernel/entry-armv.S108
-rw-r--r--arch/arm/kernel/entry-common.S2
-rw-r--r--arch/arm/kernel/entry-header.S92
-rw-r--r--arch/arm/kernel/fiq.c17
-rw-r--r--arch/arm/kernel/hibernate.c3
-rw-r--r--arch/arm/kernel/hw_breakpoint.c18
-rw-r--r--arch/arm/kernel/irq.c25
-rw-r--r--arch/arm/kernel/kprobes-test.c16
-rw-r--r--arch/arm/kernel/kprobes-test.h5
-rw-r--r--arch/arm/kernel/module.c1
-rw-r--r--arch/arm/kernel/perf_event_cpu.c18
-rw-r--r--arch/arm/kernel/process.c64
-rw-r--r--arch/arm/kernel/return_address.c9
-rw-r--r--arch/arm/kernel/setup.c8
-rw-r--r--arch/arm/kernel/smp.c16
-rw-r--r--arch/arm/kernel/swp_emulate.c15
-rw-r--r--arch/arm/kernel/thumbee.c2
-rw-r--r--arch/arm/kernel/traps.c43
-rw-r--r--arch/arm/kernel/unwind.c24
-rw-r--r--arch/arm/kernel/vmlinux.lds.S2
-rw-r--r--arch/arm/kvm/arm.c34
-rw-r--r--arch/arm/kvm/coproc.c2
-rw-r--r--arch/arm/kvm/guest.c2
-rw-r--r--arch/arm/kvm/handle_exit.c2
-rw-r--r--arch/arm/kvm/init.S4
-rw-r--r--arch/arm/kvm/mmu.c40
-rw-r--r--arch/arm/lib/getuser.S38
-rw-r--r--arch/arm/mach-at91/Kconfig49
-rw-r--r--arch/arm/mach-at91/Kconfig.non_dt18
-rw-r--r--arch/arm/mach-at91/Makefile9
-rw-r--r--arch/arm/mach-at91/at91_rstc.h53
-rw-r--r--arch/arm/mach-at91/at91_shdwc.h50
-rw-r--r--arch/arm/mach-at91/at91sam9260.c51
-rw-r--r--arch/arm/mach-at91/at91sam9261.c51
-rw-r--r--arch/arm/mach-at91/at91sam9263.c51
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c294
-rw-r--r--arch/arm/mach-at91/at91sam9_alt_reset.S40
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c55
-rw-r--r--arch/arm/mach-at91/at91sam9g45_reset.S45
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c51
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c4
-rw-r--r--arch/arm/mach-at91/board-cam60.c4
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c4
-rw-r--r--arch/arm/mach-at91/board-dt-rm9200.c18
-rw-r--r--arch/arm/mach-at91/board-dt-sam9.c23
-rw-r--r--arch/arm/mach-at91/board-dt-sama5.c60
-rw-r--r--arch/arm/mach-at91/board-flexibity.c4
-rw-r--r--arch/arm/mach-at91/board-foxg20.c272
-rw-r--r--arch/arm/mach-at91/board-gsia18s.c2
-rw-r--r--arch/arm/mach-at91/board-pcontrol-g20.c2
-rw-r--r--arch/arm/mach-at91/board-rsi-ews.c232
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c4
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c5
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c7
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c5
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c4
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c5
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c5
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c4
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c4
-rw-r--r--arch/arm/mach-at91/clock.c1
-rw-r--r--arch/arm/mach-at91/generic.h19
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pio.h6
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h22
-rw-r--r--arch/arm/mach-at91/include/mach/debug-macro.S5
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h23
-rw-r--r--arch/arm/mach-at91/include/mach/sama5d4.h33
-rw-r--r--arch/arm/mach-at91/include/mach/uncompress.h21
-rw-r--r--arch/arm/mach-at91/irq.c270
-rw-r--r--arch/arm/mach-at91/pm.c104
-rw-r--r--arch/arm/mach-at91/sama5d4.c64
-rw-r--r--arch/arm/mach-at91/setup.c273
-rw-r--r--arch/arm/mach-at91/soc.h7
-rw-r--r--arch/arm/mach-bcm/Kconfig17
-rw-r--r--arch/arm/mach-bcm/Makefile4
-rw-r--r--arch/arm/mach-bcm/bcm63xx.c (renamed from arch/arm/mach-bcm/brcmstb.h)18
-rw-r--r--arch/arm/mach-bcm/headsmp-brcmstb.S33
-rw-r--r--arch/arm/mach-bcm/platsmp-brcmstb.c363
-rw-r--r--arch/arm/mach-clps711x/board-edb7211.c37
-rw-r--r--arch/arm/mach-clps711x/common.c138
-rw-r--r--arch/arm/mach-clps711x/common.h5
-rw-r--r--arch/arm/mach-clps711x/devices.c52
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c1
-rw-r--r--arch/arm/mach-cns3xxx/core.c1
-rw-r--r--arch/arm/mach-cns3xxx/core.h6
-rw-r--r--arch/arm/mach-cns3xxx/pcie.c49
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c15
-rw-r--r--arch/arm/mach-davinci/da8xx-dt.c1
-rw-r--r--arch/arm/mach-exynos/exynos.c1
-rw-r--r--arch/arm/mach-exynos/include/mach/memory.h26
-rw-r--r--arch/arm/mach-exynos/mcpm-exynos.c1
-rw-r--r--arch/arm/mach-exynos/platsmp.c4
-rw-r--r--arch/arm/mach-exynos/pm_domains.c78
-rw-r--r--arch/arm/mach-hisi/Kconfig11
-rw-r--r--arch/arm/mach-hisi/Makefile3
-rw-r--r--arch/arm/mach-hisi/hisilicon.c9
-rw-r--r--arch/arm/mach-hisi/platmcpm.c386
-rw-r--r--arch/arm/mach-imx/Kconfig113
-rw-r--r--arch/arm/mach-imx/Makefile12
-rw-r--r--arch/arm/mach-imx/anatop.c13
-rw-r--r--arch/arm/mach-imx/avic.c2
-rw-r--r--arch/arm/mach-imx/board-pcm038.h36
-rw-r--r--arch/arm/mach-imx/clk-gate-exclusive.c94
-rw-r--r--arch/arm/mach-imx/clk-gate2.c6
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c109
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c103
-rw-r--r--arch/arm/mach-imx/clk-imx6sx.c63
-rw-r--r--arch/arm/mach-imx/clk-pllv3.c37
-rw-r--r--arch/arm/mach-imx/clk-vf610.c21
-rw-r--r--arch/arm/mach-imx/clk.h3
-rw-r--r--arch/arm/mach-imx/common.h2
-rw-r--r--arch/arm/mach-imx/cpuidle-imx6q.c4
-rw-r--r--arch/arm/mach-imx/eukrea-baseboards.h10
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx27-baseboard.c351
-rw-r--r--arch/arm/mach-imx/imx1-dt.c26
-rw-r--r--arch/arm/mach-imx/imx27-dt.c2
-rw-r--r--arch/arm/mach-imx/iomux-imx31.c7
-rw-r--r--arch/arm/mach-imx/iomux-v1.c2
-rw-r--r--arch/arm/mach-imx/iomux-v3.c2
-rw-r--r--arch/arm/mach-imx/mach-armadillo5x0.c2
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c321
-rw-r--r--arch/arm/mach-imx/mach-imx51.c2
-rw-r--r--arch/arm/mach-imx/mach-imx6sx.c3
-rw-r--r--arch/arm/mach-imx/mach-mx1ads.c154
-rw-r--r--arch/arm/mach-imx/mach-mx31_3ds.c4
-rw-r--r--arch/arm/mach-imx/mach-mx31lite.c2
-rw-r--r--arch/arm/mach-imx/mach-mxt_td60.c273
-rw-r--r--arch/arm/mach-imx/mach-pcm037.c4
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c358
-rw-r--r--arch/arm/mach-imx/mxc.h2
-rw-r--r--arch/arm/mach-imx/pcm970-baseboard.c231
-rw-r--r--arch/arm/mach-imx/platsmp.c10
-rw-r--r--arch/arm/mach-imx/suspend-imx6.S2
-rw-r--r--arch/arm/mach-imx/time.c31
-rw-r--r--arch/arm/mach-imx/tzic.c3
-rw-r--r--arch/arm/mach-integrator/impd1.c48
-rw-r--r--arch/arm/mach-integrator/pci_v3.c23
-rw-r--r--arch/arm/mach-lpc32xx/common.c29
-rw-r--r--arch/arm/mach-meson/Kconfig13
-rw-r--r--arch/arm/mach-meson/Makefile1
-rw-r--r--arch/arm/mach-meson/meson.c27
-rw-r--r--arch/arm/mach-msm/board-mahimahi.c83
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c2
-rw-r--r--arch/arm/mach-msm/board-trout-gpio.c2
-rw-r--r--arch/arm/mach-msm/board-trout.c2
-rw-r--r--arch/arm/mach-msm/io.c6
-rw-r--r--arch/arm/mach-mvebu/pmsu.c2
-rw-r--r--arch/arm/mach-omap2/Kconfig9
-rw-r--r--arch/arm/mach-omap2/Makefile15
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c1
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c1
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c2
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c1
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c1
-rw-r--r--arch/arm/mach-omap2/board-flash.c2
-rw-r--r--arch/arm/mach-omap2/board-generic.c44
-rw-r--r--arch/arm/mach-omap2/board-ldp.c1
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c26
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c1
-rw-r--r--arch/arm/mach-omap2/board-overo.c1
-rw-r--r--arch/arm/mach-omap2/board-rx51.c1
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h5
-rw-r--r--arch/arm/mach-omap2/common.h27
-rw-r--r--arch/arm/mach-omap2/display.c2
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c3
-rw-r--r--arch/arm/mach-omap2/gpmc.c16
-rw-r--r--arch/arm/mach-omap2/hdq1w.c4
-rw-r--r--arch/arm/mach-omap2/i2c.c2
-rw-r--r--arch/arm/mach-omap2/id.c2
-rw-r--r--arch/arm/mach-omap2/io.c23
-rw-r--r--arch/arm/mach-omap2/irq.c380
-rw-r--r--arch/arm/mach-omap2/msdi.c4
-rw-r--r--arch/arm/mach-omap2/mux.c2
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c106
-rw-r--r--arch/arm/mach-omap2/omap-secure.h1
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c20
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.h1
-rw-r--r--arch/arm/mach-omap2/omap4-common.c22
-rw-r--r--arch/arm/mach-omap2/omap_device.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c35
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c12
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_7xx_data.c22
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c27
-rw-r--r--arch/arm/mach-omap2/pm.c2
-rw-r--r--arch/arm/mach-omap2/pm.h1
-rw-r--r--arch/arm/mach-omap2/pm34xx.c2
-rw-r--r--arch/arm/mach-omap2/pm44xx.c57
-rw-r--r--arch/arm/mach-omap2/powerdomain.c79
-rw-r--r--arch/arm/mach-omap2/powerdomain.h4
-rw-r--r--arch/arm/mach-omap2/powerdomains54xx_data.c12
-rw-r--r--arch/arm/mach-omap2/powerdomains7xx_data.c14
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c57
-rw-r--r--arch/arm/mach-omap2/prm44xx.c90
-rw-r--r--arch/arm/mach-omap2/prm_common.c2
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c40
-rw-r--r--arch/arm/mach-omap2/prminst44xx.h3
-rw-r--r--arch/arm/mach-omap2/smartreflex-class3.c4
-rw-r--r--arch/arm/mach-omap2/soc.h6
-rw-r--r--arch/arm/mach-omap2/sr_device.c2
-rw-r--r--arch/arm/mach-omap2/sram.c39
-rw-r--r--arch/arm/mach-omap2/sram.h7
-rw-r--r--arch/arm/mach-omap2/timer.c6
-rw-r--r--arch/arm/mach-omap2/vc.c2
-rw-r--r--arch/arm/mach-omap2/voltage.c22
-rw-r--r--arch/arm/mach-omap2/wd_timer.c4
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c8
-rw-r--r--arch/arm/mach-orion5x/terastation_pro2-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c4
-rw-r--r--arch/arm/mach-pxa/devices.c42
-rw-r--r--arch/arm/mach-pxa/devices.h3
-rw-r--r--arch/arm/mach-pxa/generic.c2
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c14
-rw-r--r--arch/arm/mach-qcom/board.c2
-rw-r--r--arch/arm/mach-rockchip/Kconfig1
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig2
-rw-r--r--arch/arm/mach-s3c24xx/common.c4
-rw-r--r--arch/arm/mach-s3c24xx/common.h5
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h2
-rw-r--r--arch/arm/mach-s3c24xx/mach-amlm5900.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-anubis.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-at2440evb.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-bast.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-gta02.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-n30.c2
-rw-r--r--arch/arm/mach-s3c24xx/mach-nexcoder.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-otom.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-qt2410.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx3715.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-s3c2416-dt.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2410.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2413.c3
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2416.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2440.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2443.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-tct_hammer.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-vr1000.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-vstms.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c13
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c23
-rw-r--r--arch/arm/mach-s3c24xx/s3c2416.c8
-rw-r--r--arch/arm/mach-s3c24xx/s3c2443.c8
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c12
-rw-r--r--arch/arm/mach-s3c64xx/common.c5
-rw-r--r--arch/arm/mach-s3c64xx/common.h7
-rw-r--r--arch/arm/mach-s3c64xx/mach-anw6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-hmt.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-mini6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-ncp.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-real6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq5.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq7.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6400.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/pm.c7
-rw-r--r--arch/arm/mach-s5pv210/pm.c3
-rw-r--r--arch/arm/mach-s5pv210/regs-clock.h (renamed from arch/arm/mach-s5pv210/include/mach/regs-clock.h)3
-rw-r--r--arch/arm/mach-s5pv210/s5pv210.c2
-rw-r--r--arch/arm/mach-sa1100/Kconfig2
-rw-r--r--arch/arm/mach-sa1100/h3xxx.c15
-rw-r--r--arch/arm/mach-shmobile/Kconfig120
-rw-r--r--arch/arm/mach-shmobile/Makefile37
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot2
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm-reference.c4
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c3
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva-reference.c198
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c8
-rw-r--r--arch/arm/mach-shmobile/board-bockw-reference.c3
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c2
-rw-r--r--arch/arm/mach-shmobile/board-genmai-reference.c55
-rw-r--r--arch/arm/mach-shmobile/board-genmai.c161
-rw-r--r--arch/arm/mach-shmobile/board-koelsch-reference.c2
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c4
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c2
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c2
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c3
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c12
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c231
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7791.c2
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c2
-rw-r--r--arch/arm/mach-shmobile/common.h2
-rw-r--r--arch/arm/mach-shmobile/cpufreq.c2
-rw-r--r--arch/arm/mach-shmobile/dma-register.h4
-rw-r--r--arch/arm/mach-shmobile/intc.h5
-rw-r--r--arch/arm/mach-shmobile/irqs.h8
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7740.c17
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7779.c1
-rw-r--r--arch/arm/mach-shmobile/pm-rcar.c4
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c3
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.h4
-rw-r--r--arch/arm/mach-shmobile/r7s72100.h7
-rw-r--r--arch/arm/mach-shmobile/r8a73a4.h1
-rw-r--r--arch/arm/mach-shmobile/r8a7740.h5
-rw-r--r--arch/arm/mach-shmobile/r8a7779.h1
-rw-r--r--arch/arm/mach-shmobile/r8a7790.h1
-rw-r--r--arch/arm/mach-shmobile/r8a7791.h1
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c24
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c10
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c60
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c5
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c20
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c7
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c7
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7794.c33
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c6
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c21
-rw-r--r--arch/arm/mach-shmobile/timer.c30
-rw-r--r--arch/arm/mach-spear/Kconfig9
-rw-r--r--arch/arm/mach-sunxi/sunxi.c76
-rw-r--r--arch/arm/mach-tegra/flowctrl.c44
-rw-r--r--arch/arm/mach-tegra/flowctrl.h2
-rw-r--r--arch/arm/mach-tegra/tegra.c2
-rw-r--r--arch/arm/mach-vexpress/spc.c14
-rw-r--r--arch/arm/mach-vt8500/vt8500.c2
-rw-r--r--arch/arm/mach-zynq/Makefile3
-rw-r--r--arch/arm/mach-zynq/common.c13
-rw-r--r--arch/arm/mach-zynq/common.h16
-rw-r--r--arch/arm/mach-zynq/hotplug.c47
-rw-r--r--arch/arm/mach-zynq/platsmp.c41
-rw-r--r--arch/arm/mach-zynq/pm.c83
-rw-r--r--arch/arm/mach-zynq/slcr.c43
-rw-r--r--arch/arm/mm/abort-ev6.S6
-rw-r--r--arch/arm/mm/abort-ev7.S6
-rw-r--r--arch/arm/mm/alignment.c3
-rw-r--r--arch/arm/mm/cache-l2x0.c121
-rw-r--r--arch/arm/mm/dma-mapping.c210
-rw-r--r--arch/arm/mm/flush.c15
-rw-r--r--arch/arm/mm/idmap.c2
-rw-r--r--arch/arm/mm/init.c7
-rw-r--r--arch/arm/mm/mmu.c4
-rw-r--r--arch/arm/mm/proc-v7-3level.S5
-rw-r--r--arch/arm/mm/proc-v7.S2
-rw-r--r--arch/arm/net/bpf_jit_32.c37
-rw-r--r--arch/arm/net/bpf_jit_32.h14
-rw-r--r--arch/arm/plat-omap/Kconfig3
-rw-r--r--arch/arm/plat-omap/dma.c737
-rw-r--r--arch/arm/plat-orion/common.c2
-rw-r--r--arch/arm/plat-pxa/ssp.c1
-rw-r--r--arch/arm/xen/Makefile2
-rw-r--r--arch/arm/xen/enlighten.c6
-rw-r--r--arch/arm/xen/mm32.c202
-rw-r--r--arch/arm/xen/p2m.c66
-rw-r--r--arch/arm64/Kconfig40
-rw-r--r--arch/arm64/Kconfig.debug11
-rw-r--r--arch/arm64/Makefile3
-rw-r--r--arch/arm64/boot/dts/Makefile1
-rw-r--r--arch/arm64/boot/dts/apm-mustang.dts8
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi186
-rw-r--r--arch/arm64/boot/dts/thunder-88xx.dts67
-rw-r--r--arch/arm64/boot/dts/thunder-88xx.dtsi401
-rw-r--r--arch/arm64/configs/defconfig4
-rw-r--r--arch/arm64/crypto/sha2-ce-glue.c1
-rw-r--r--arch/arm64/include/asm/Kbuild3
-rw-r--r--arch/arm64/include/asm/arch_timer.h31
-rw-r--r--arch/arm64/include/asm/cacheflush.h4
-rw-r--r--arch/arm64/include/asm/cachetype.h20
-rw-r--r--arch/arm64/include/asm/cpu_ops.h7
-rw-r--r--arch/arm64/include/asm/cpuidle.h13
-rw-r--r--arch/arm64/include/asm/debug-monitors.h30
-rw-r--r--arch/arm64/include/asm/dma-mapping.h7
-rw-r--r--arch/arm64/include/asm/hardirq.h2
-rw-r--r--arch/arm64/include/asm/hw_breakpoint.h1
-rw-r--r--arch/arm64/include/asm/insn.h249
-rw-r--r--arch/arm64/include/asm/io.h5
-rw-r--r--arch/arm64/include/asm/irq_work.h11
-rw-r--r--arch/arm64/include/asm/kgdb.h2
-rw-r--r--arch/arm64/include/asm/kvm_arm.h13
-rw-r--r--arch/arm64/include/asm/kvm_emulate.h5
-rw-r--r--arch/arm64/include/asm/kvm_host.h24
-rw-r--r--arch/arm64/include/asm/kvm_mmu.h18
-rw-r--r--arch/arm64/include/asm/pci.h37
-rw-r--r--arch/arm64/include/asm/percpu.h4
-rw-r--r--arch/arm64/include/asm/pgtable.h56
-rw-r--r--arch/arm64/include/asm/proc-fns.h2
-rw-r--r--arch/arm64/include/asm/processor.h2
-rw-r--r--arch/arm64/include/asm/ptrace.h2
-rw-r--r--arch/arm64/include/asm/smp.h2
-rw-r--r--arch/arm64/include/asm/sparsemem.h2
-rw-r--r--arch/arm64/include/asm/suspend.h1
-rw-r--r--arch/arm64/include/asm/thread_info.h9
-rw-r--r--arch/arm64/include/asm/tlb.h20
-rw-r--r--arch/arm64/include/asm/unistd.h2
-rw-r--r--arch/arm64/include/asm/unistd32.h5
-rw-r--r--arch/arm64/include/uapi/asm/kvm.h2
-rw-r--r--arch/arm64/kernel/Makefile2
-rw-r--r--arch/arm64/kernel/cpuidle.c31
-rw-r--r--arch/arm64/kernel/cpuinfo.c30
-rw-r--r--arch/arm64/kernel/efi-stub.c16
-rw-r--r--arch/arm64/kernel/efi.c4
-rw-r--r--arch/arm64/kernel/entry.S1
-rw-r--r--arch/arm64/kernel/fpsimd.c1
-rw-r--r--arch/arm64/kernel/ftrace.c10
-rw-r--r--arch/arm64/kernel/head.S18
-rw-r--r--arch/arm64/kernel/insn.c671
-rw-r--r--arch/arm64/kernel/irq.c39
-rw-r--r--arch/arm64/kernel/kgdb.c4
-rw-r--r--arch/arm64/kernel/pci.c70
-rw-r--r--arch/arm64/kernel/perf_event.c2
-rw-r--r--arch/arm64/kernel/perf_regs.c6
-rw-r--r--arch/arm64/kernel/process.c48
-rw-r--r--arch/arm64/kernel/psci.c104
-rw-r--r--arch/arm64/kernel/ptrace.c17
-rw-r--r--arch/arm64/kernel/return_address.c3
-rw-r--r--arch/arm64/kernel/setup.c51
-rw-r--r--arch/arm64/kernel/sleep.S47
-rw-r--r--arch/arm64/kernel/smp.c2
-rw-r--r--arch/arm64/kernel/smp_spin_table.c22
-rw-r--r--arch/arm64/kernel/stacktrace.c3
-rw-r--r--arch/arm64/kernel/suspend.c48
-rw-r--r--arch/arm64/kernel/sys_compat.c6
-rw-r--r--arch/arm64/kernel/traps.c3
-rw-r--r--arch/arm64/kernel/vmlinux.lds.S2
-rw-r--r--arch/arm64/kvm/guest.c2
-rw-r--r--arch/arm64/kvm/handle_exit.c2
-rw-r--r--arch/arm64/kvm/hyp-init.S4
-rw-r--r--arch/arm64/kvm/sys_regs.c2
-rw-r--r--arch/arm64/mm/Makefile2
-rw-r--r--arch/arm64/mm/dma-mapping.c195
-rw-r--r--arch/arm64/mm/flush.c16
-rw-r--r--arch/arm64/mm/init.c11
-rw-r--r--arch/arm64/mm/mmap.c2
-rw-r--r--arch/arm64/mm/mmu.c2
-rw-r--r--arch/arm64/mm/pageattr.c97
-rw-r--r--arch/arm64/mm/proc.S15
-rw-r--r--arch/arm64/net/Makefile4
-rw-r--r--arch/arm64/net/bpf_jit.h169
-rw-r--r--arch/arm64/net/bpf_jit_comp.c679
-rw-r--r--arch/avr32/include/asm/Kbuild1
-rw-r--r--arch/blackfin/Kconfig2
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537e.c3
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537u.c3
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c3
-rw-r--r--arch/blackfin/mach-bf537/boards/tcm_bf537.c3
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c3
-rw-r--r--arch/blackfin/mach-common/ints-priority.c2
-rw-r--r--arch/c6x/include/asm/Kbuild1
-rw-r--r--arch/cris/include/asm/Kbuild2
-rw-r--r--arch/cris/include/asm/sections.h7
-rw-r--r--arch/frv/include/asm/Kbuild1
-rw-r--r--arch/frv/include/asm/processor.h19
-rw-r--r--arch/frv/kernel/irq-mb93091.c8
-rw-r--r--arch/frv/kernel/irq-mb93093.c1
-rw-r--r--arch/frv/kernel/irq-mb93493.c4
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/frv/kernel/time.c1
-rw-r--r--arch/hexagon/include/asm/Kbuild1
-rw-r--r--arch/hexagon/mm/cache.c1
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/configs/bigsur_defconfig13
-rw-r--r--arch/ia64/configs/generic_defconfig29
-rw-r--r--arch/ia64/configs/gensparse_defconfig23
-rw-r--r--arch/ia64/configs/sim_defconfig8
-rw-r--r--arch/ia64/configs/tiger_defconfig25
-rw-r--r--arch/ia64/configs/zx1_defconfig14
-rw-r--r--arch/ia64/include/asm/Kbuild1
-rw-r--r--arch/ia64/include/asm/kvm_host.h15
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/include/uapi/asm/unistd.h1
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/ia64/kernel/msi_ia64.c2
-rw-r--r--arch/ia64/kvm/kvm-ia64.c34
-rw-r--r--arch/ia64/pci/fixup.c24
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c4
-rw-r--r--arch/m32r/include/asm/Kbuild2
-rw-r--r--arch/m32r/include/asm/sections.h7
-rw-r--r--arch/m32r/kernel/time.c1
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68k/Kconfig.devices4
-rw-r--r--arch/m68k/atari/stram.c1
-rw-r--r--arch/m68k/include/asm/Kbuild1
-rw-r--r--arch/m68k/include/asm/io_mm.h9
-rw-r--r--arch/m68k/include/asm/unistd.h2
-rw-r--r--arch/m68k/include/uapi/asm/unistd.h2
-rw-r--r--arch/m68k/kernel/sys_m68k.c21
-rw-r--r--arch/m68k/kernel/syscalltable.S2
-rw-r--r--arch/m68k/mm/hwtest.c78
-rw-r--r--arch/metag/include/asm/Kbuild1
-rw-r--r--arch/microblaze/Kconfig6
-rw-r--r--arch/microblaze/include/asm/Kbuild1
-rw-r--r--arch/microblaze/include/asm/entry.h1
-rw-r--r--arch/microblaze/include/asm/uaccess.h4
-rw-r--r--arch/microblaze/include/asm/unistd.h2
-rw-r--r--arch/microblaze/include/uapi/asm/unistd.h3
-rw-r--r--arch/microblaze/kernel/syscall_table.S3
-rw-r--r--arch/mips/Kconfig5
-rw-r--r--arch/mips/Makefile11
-rw-r--r--arch/mips/alchemy/devboards/db1200.c6
-rw-r--r--arch/mips/bcm47xx/setup.c17
-rw-r--r--arch/mips/bcm63xx/irq.c4
-rw-r--r--arch/mips/boot/compressed/decompress.c1
-rw-r--r--arch/mips/cavium-octeon/Kconfig2
-rw-r--r--arch/mips/cavium-octeon/setup.c19
-rw-r--r--arch/mips/configs/gpr_defconfig1
-rw-r--r--arch/mips/configs/ip27_defconfig1
-rw-r--r--arch/mips/configs/jazz_defconfig1
-rw-r--r--arch/mips/configs/loongson3_defconfig1
-rw-r--r--arch/mips/configs/malta_defconfig1
-rw-r--r--arch/mips/configs/malta_kvm_defconfig1
-rw-r--r--arch/mips/configs/malta_kvm_guest_defconfig1
-rw-r--r--arch/mips/configs/mtx1_defconfig1
-rw-r--r--arch/mips/configs/nlm_xlp_defconfig1
-rw-r--r--arch/mips/configs/nlm_xlr_defconfig1
-rw-r--r--arch/mips/configs/rm200_defconfig1
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/cop2.h18
-rw-r--r--arch/mips/include/asm/eva.h43
-rw-r--r--arch/mips/include/asm/gic.h2
-rw-r--r--arch/mips/include/asm/irq.h2
-rw-r--r--arch/mips/include/asm/kvm_host.h16
-rw-r--r--arch/mips/include/asm/mach-ip28/spaces.h7
-rw-r--r--arch/mips/include/asm/mach-malta/kernel-entry-init.h22
-rw-r--r--arch/mips/include/asm/mach-netlogic/topology.h7
-rw-r--r--arch/mips/include/asm/page.h5
-rw-r--r--arch/mips/include/asm/pgtable.h8
-rw-r--r--arch/mips/include/asm/smp.h5
-rw-r--r--arch/mips/include/asm/suspend.h7
-rw-r--r--arch/mips/include/asm/switch_to.h4
-rw-r--r--arch/mips/include/asm/syscall.h8
-rw-r--r--arch/mips/include/asm/topology.h8
-rw-r--r--arch/mips/include/uapi/asm/ioctls.h2
-rw-r--r--arch/mips/include/uapi/asm/unistd.h18
-rw-r--r--arch/mips/kernel/cps-vec.S4
-rw-r--r--arch/mips/kernel/machine_kexec.c8
-rw-r--r--arch/mips/kernel/mcount.S12
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c2
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S14
-rw-r--r--arch/mips/kvm/mips.c40
-rw-r--r--arch/mips/lantiq/falcon/sysctrl.c2
-rw-r--r--arch/mips/lantiq/xway/sysctrl.c2
-rw-r--r--arch/mips/loongson/loongson-3/cop2-ex.c8
-rw-r--r--arch/mips/loongson/loongson-3/numa.c2
-rw-r--r--arch/mips/math-emu/cp1emu.c6
-rw-r--r--arch/mips/mm/cache.c27
-rw-r--r--arch/mips/mm/init.c1
-rw-r--r--arch/mips/mti-malta/malta-memory.c14
-rw-r--r--arch/mips/net/bpf_jit.c32
-rw-r--r--arch/mips/pci/msi-octeon.c6
-rw-r--r--arch/mips/pci/pci-lantiq.c2
-rw-r--r--arch/mips/pmcs-msp71xx/msp_irq.c2
-rw-r--r--arch/mips/power/cpu.c2
-rw-r--r--arch/mips/txx9/generic/setup.c4
-rw-r--r--arch/mn10300/Kconfig2
-rw-r--r--arch/mn10300/include/asm/Kbuild2
-rw-r--r--arch/mn10300/include/asm/sections.h1
-rw-r--r--arch/openrisc/Kconfig1
-rw-r--r--arch/openrisc/include/asm/Kbuild1
-rw-r--r--arch/openrisc/include/asm/irq.h1
-rw-r--r--arch/openrisc/kernel/irq.c12
-rw-r--r--arch/parisc/Kconfig16
-rw-r--r--arch/parisc/Makefile7
-rw-r--r--arch/parisc/configs/a500_defconfig1
-rw-r--r--arch/parisc/configs/c8000_defconfig1
-rw-r--r--arch/parisc/hpux/sys_hpux.c2
-rw-r--r--arch/parisc/include/asm/Kbuild1
-rw-r--r--arch/parisc/include/asm/seccomp.h16
-rw-r--r--arch/parisc/include/asm/thread_info.h5
-rw-r--r--arch/parisc/include/uapi/asm/ioctls.h2
-rw-r--r--arch/parisc/include/uapi/asm/unistd.h5
-rw-r--r--arch/parisc/kernel/ptrace.c4
-rw-r--r--arch/parisc/kernel/syscall.S233
-rw-r--r--arch/parisc/kernel/syscall_table.S3
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/boot/simpleboot.c2
-rw-r--r--arch/powerpc/configs/c2k_defconfig1
-rw-r--r--arch/powerpc/configs/cell_defconfig1
-rw-r--r--arch/powerpc/configs/celleb_defconfig1
-rw-r--r--arch/powerpc/configs/corenet64_smp_defconfig1
-rw-r--r--arch/powerpc/configs/g5_defconfig1
-rw-r--r--arch/powerpc/configs/maple_defconfig1
-rw-r--r--arch/powerpc/configs/pasemi_defconfig1
-rw-r--r--arch/powerpc/configs/pmac32_defconfig1
-rw-r--r--arch/powerpc/configs/ppc64_defconfig2
-rw-r--r--arch/powerpc/configs/ppc64e_defconfig2
-rw-r--r--arch/powerpc/configs/ps3_defconfig1
-rw-r--r--arch/powerpc/configs/pseries_defconfig2
-rw-r--r--arch/powerpc/configs/pseries_le_defconfig2
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h20
-rw-r--r--arch/powerpc/include/asm/kvm_booke.h7
-rw-r--r--arch/powerpc/include/asm/kvm_host.h24
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h13
-rw-r--r--arch/powerpc/include/asm/machdep.h2
-rw-r--r--arch/powerpc/include/asm/pgtable.h57
-rw-r--r--arch/powerpc/include/asm/pte-common.h5
-rw-r--r--arch/powerpc/include/asm/ptrace.h7
-rw-r--r--arch/powerpc/include/asm/reg_booke.h2
-rw-r--r--arch/powerpc/include/asm/systbl.h3
-rw-r--r--arch/powerpc/include/asm/unistd.h2
-rw-r--r--arch/powerpc/include/uapi/asm/kvm.h6
-rw-r--r--arch/powerpc/include/uapi/asm/unistd.h3
-rw-r--r--arch/powerpc/kernel/cpu_setup_fsl_booke.S12
-rw-r--r--arch/powerpc/kernel/cputable.c5
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S4
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S26
-rw-r--r--arch/powerpc/kernel/msi.c12
-rw-r--r--arch/powerpc/kernel/suspend.c4
-rw-r--r--arch/powerpc/kvm/book3s.c162
-rw-r--r--arch/powerpc/kvm/book3s.h3
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c8
-rw-r--r--arch/powerpc/kvm/book3s_hv.c47
-rw-r--r--arch/powerpc/kvm/book3s_hv_builtin.c12
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S3
-rw-r--r--arch/powerpc/kvm/book3s_pr.c6
-rw-r--r--arch/powerpc/kvm/booke.c287
-rw-r--r--arch/powerpc/kvm/booke.h40
-rw-r--r--arch/powerpc/kvm/booke_emulate.c163
-rw-r--r--arch/powerpc/kvm/bookehv_interrupts.S13
-rw-r--r--arch/powerpc/kvm/e500.h20
-rw-r--r--arch/powerpc/kvm/e500_emulate.c20
-rw-r--r--arch/powerpc/kvm/e500_mmu_host.c20
-rw-r--r--arch/powerpc/kvm/e500mc.c60
-rw-r--r--arch/powerpc/kvm/emulate.c17
-rw-r--r--arch/powerpc/kvm/emulate_loadstore.c2
-rw-r--r--arch/powerpc/kvm/powerpc.c134
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c5
-rw-r--r--arch/powerpc/perf/callchain.c2
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c3
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype6
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c9
-rw-r--r--arch/powerpc/platforms/powernv/opal-hmi.c3
-rw-r--r--arch/powerpc/platforms/powernv/opal.c2
-rw-r--r--arch/powerpc/platforms/powernv/pci.c19
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c40
-rw-r--r--arch/powerpc/platforms/pseries/msi.c44
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c12
-rw-r--r--arch/powerpc/sysdev/mpic_pasemi_msi.c11
-rw-r--r--arch/powerpc/sysdev/mpic_u3msi.c28
-rw-r--r--arch/powerpc/sysdev/ppc4xx_hsta_msi.c18
-rw-r--r--arch/powerpc/sysdev/ppc4xx_msi.c19
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/configs/default_defconfig1
-rw-r--r--arch/s390/configs/gcov_defconfig1
-rw-r--r--arch/s390/configs/performance_defconfig1
-rw-r--r--arch/s390/configs/zfcpdump_defconfig1
-rw-r--r--arch/s390/defconfig1
-rw-r--r--arch/s390/include/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/ipl.h8
-rw-r--r--arch/s390/include/asm/kvm_host.h34
-rw-r--r--arch/s390/include/asm/pgalloc.h8
-rw-r--r--arch/s390/include/asm/pgtable.h78
-rw-r--r--arch/s390/include/asm/tlb.h2
-rw-r--r--arch/s390/include/uapi/asm/kvm.h10
-rw-r--r--arch/s390/include/uapi/asm/unistd.h5
-rw-r--r--arch/s390/kernel/compat_wrapper.c3
-rw-r--r--arch/s390/kernel/ipl.c135
-rw-r--r--arch/s390/kernel/setup.c19
-rw-r--r--arch/s390/kernel/suspend.c6
-rw-r--r--arch/s390/kernel/syscalls.S3
-rw-r--r--arch/s390/kernel/vdso32/clock_gettime.S10
-rw-r--r--arch/s390/kernel/vdso64/clock_gettime.S10
-rw-r--r--arch/s390/kvm/diag.c28
-rw-r--r--arch/s390/kvm/gaccess.c3
-rw-r--r--arch/s390/kvm/interrupt.c152
-rw-r--r--arch/s390/kvm/kvm-s390.c192
-rw-r--r--arch/s390/kvm/kvm-s390.h6
-rw-r--r--arch/s390/kvm/priv.c11
-rw-r--r--arch/s390/mm/fault.c25
-rw-r--r--arch/s390/mm/init.c1
-rw-r--r--arch/s390/mm/pgtable.c705
-rw-r--r--arch/s390/mm/vmem.c2
-rw-r--r--arch/s390/net/bpf_jit_comp.c84
-rw-r--r--arch/score/Kconfig3
-rw-r--r--arch/score/include/asm/Kbuild3
-rw-r--r--arch/score/include/asm/sections.h6
-rw-r--r--arch/score/kernel/time.c2
-rw-r--r--arch/score/lib/checksum_copy.c1
-rw-r--r--arch/score/mm/cache.c2
-rw-r--r--arch/sh/Kconfig5
-rw-r--r--arch/sh/boards/mach-x3proto/gpio.c6
-rw-r--r--arch/sh/configs/sdk7780_defconfig1
-rw-r--r--arch/sh/configs/sh2007_defconfig1
-rw-r--r--arch/sh/include/asm/Kbuild1
-rw-r--r--arch/sh/include/asm/sections.h1
-rw-r--r--arch/sh/include/uapi/asm/ioctls.h2
-rw-r--r--arch/sh/mm/cache.c1
-rw-r--r--arch/sh/mm/gup.c2
-rw-r--r--arch/sparc/configs/sparc64_defconfig1
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/vio.h44
-rw-r--r--arch/sparc/include/uapi/asm/ioctls.h2
-rw-r--r--arch/sparc/kernel/ldc.c2
-rw-r--r--arch/sparc/kernel/viohs.c14
-rw-r--r--arch/sparc/net/bpf_jit_asm.S3
-rw-r--r--arch/sparc/net/bpf_jit_comp.c48
-rw-r--r--arch/sparc/power/hibernate.c4
-rw-r--r--arch/tile/Kconfig3
-rw-r--r--arch/tile/gxio/mpipe.c37
-rw-r--r--arch/tile/include/asm/Kbuild1
-rw-r--r--arch/tile/include/asm/sections.h3
-rw-r--r--arch/tile/include/asm/vdso.h20
-rw-r--r--arch/tile/include/uapi/arch/sim_def.h10
-rw-r--r--arch/tile/kernel/smp.c1
-rw-r--r--arch/tile/kernel/time.c61
-rw-r--r--arch/tile/kernel/traps.c2
-rw-r--r--arch/tile/kernel/vdso/vdso.lds.S2
-rw-r--r--arch/tile/kernel/vdso/vgettimeofday.c176
-rw-r--r--arch/tile/kernel/vmlinux.lds.S2
-rw-r--r--arch/tile/mm/init.c12
-rw-r--r--arch/um/include/asm/Kbuild1
-rw-r--r--arch/unicore32/include/asm/Kbuild1
-rw-r--r--arch/unicore32/include/mach/pm.h3
-rw-r--r--arch/unicore32/kernel/hibernate.c1
-rw-r--r--arch/unicore32/kernel/signal.c9
-rw-r--r--arch/x86/Kbuild4
-rw-r--r--arch/x86/Kconfig32
-rw-r--r--arch/x86/Makefile13
-rw-r--r--arch/x86/boot/Makefile7
-rw-r--r--arch/x86/boot/compressed/Makefile18
-rw-r--r--arch/x86/boot/compressed/aslr.c18
-rw-r--r--arch/x86/boot/compressed/early_serial_console.c4
-rw-r--r--arch/x86/boot/compressed/eboot.c62
-rw-r--r--arch/x86/boot/compressed/eboot.h16
-rw-r--r--arch/x86/boot/cpu.c68
-rw-r--r--arch/x86/configs/tiny.config1
-rw-r--r--arch/x86/crypto/Makefile1
-rw-r--r--arch/x86/crypto/aes_ctrby8_avx-x86_64.S20
-rw-r--r--arch/x86/crypto/sha-mb/Makefile11
-rw-r--r--arch/x86/crypto/sha-mb/sha1_mb.c935
-rw-r--r--arch/x86/crypto/sha-mb/sha1_mb_mgr_datastruct.S287
-rw-r--r--arch/x86/crypto/sha-mb/sha1_mb_mgr_flush_avx2.S327
-rw-r--r--arch/x86/crypto/sha-mb/sha1_mb_mgr_init_avx2.c64
-rw-r--r--arch/x86/crypto/sha-mb/sha1_mb_mgr_submit_avx2.S228
-rw-r--r--arch/x86/crypto/sha-mb/sha1_x8_avx2.S472
-rw-r--r--arch/x86/crypto/sha-mb/sha_mb_ctx.h136
-rw-r--r--arch/x86/crypto/sha-mb/sha_mb_mgr.h110
-rw-r--r--arch/x86/include/asm/bitops.h2
-rw-r--r--arch/x86/include/asm/cpufeature.h8
-rw-r--r--arch/x86/include/asm/efi.h24
-rw-r--r--arch/x86/include/asm/fixmap.h6
-rw-r--r--arch/x86/include/asm/io_apic.h3
-rw-r--r--arch/x86/include/asm/irq_work.h11
-rw-r--r--arch/x86/include/asm/kvm_host.h34
-rw-r--r--arch/x86/include/asm/kvm_para.h10
-rw-r--r--arch/x86/include/asm/pgtable.h9
-rw-r--r--arch/x86/include/asm/pgtable_64.h1
-rw-r--r--arch/x86/include/asm/pgtable_types.h14
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/apic/io_apic.c32
-rw-r--r--arch/x86/kernel/cpu/Makefile7
-rw-r--r--arch/x86/kernel/cpu/amd.c7
-rw-r--r--arch/x86/kernel/cpu/common.c4
-rw-r--r--arch/x86/kernel/crash.c6
-rw-r--r--arch/x86/kernel/entry_32.S2
-rw-r--r--arch/x86/kernel/irq_work.c2
-rw-r--r--arch/x86/kernel/irqinit.c2
-rw-r--r--arch/x86/kernel/kprobes/opt.c4
-rw-r--r--arch/x86/kernel/machine_kexec_64.c11
-rw-r--r--arch/x86/kernel/smpboot.c3
-rw-r--r--arch/x86/kernel/time.c2
-rw-r--r--arch/x86/kvm/cpuid.c31
-rw-r--r--arch/x86/kvm/cpuid.h10
-rw-r--r--arch/x86/kvm/emulate.c62
-rw-r--r--arch/x86/kvm/lapic.c34
-rw-r--r--arch/x86/kvm/mmu.c139
-rw-r--r--arch/x86/kvm/mmu.h5
-rw-r--r--arch/x86/kvm/paging_tmpl.h22
-rw-r--r--arch/x86/kvm/pmu.c24
-rw-r--r--arch/x86/kvm/svm.c40
-rw-r--r--arch/x86/kvm/trace.h41
-rw-r--r--arch/x86/kvm/vmx.c377
-rw-r--r--arch/x86/kvm/x86.c148
-rw-r--r--arch/x86/kvm/x86.h22
-rw-r--r--arch/x86/mm/dump_pagetables.c4
-rw-r--r--arch/x86/mm/mmap.c2
-rw-r--r--arch/x86/mm/tlb.c10
-rw-r--r--arch/x86/net/bpf_jit_comp.c129
-rw-r--r--arch/x86/pci/common.c20
-rw-r--r--arch/x86/pci/fixup.c24
-rw-r--r--arch/x86/pci/intel_mid_pci.c2
-rw-r--r--arch/x86/pci/irq.c2
-rw-r--r--arch/x86/pci/mmconfig-shared.c40
-rw-r--r--arch/x86/pci/pcbios.c8
-rw-r--r--arch/x86/power/hibernate_32.c4
-rw-r--r--arch/x86/power/hibernate_64.c4
-rw-r--r--arch/x86/purgatory/Makefile6
-rw-r--r--arch/x86/syscalls/syscall_32.tbl1
-rw-r--r--arch/x86/syscalls/syscall_64.tbl1
-rw-r--r--arch/x86/xen/mmu.c27
-rw-r--r--arch/xtensa/Kconfig92
-rw-r--r--arch/xtensa/Makefile7
-rw-r--r--arch/xtensa/boot/dts/kc705.dts5
-rw-r--r--arch/xtensa/configs/common_defconfig1
-rw-r--r--arch/xtensa/configs/iss_defconfig3
-rw-r--r--arch/xtensa/configs/s6105_defconfig1
-rw-r--r--arch/xtensa/include/asm/Kbuild1
-rw-r--r--arch/xtensa/include/asm/cacheflush.h2
-rw-r--r--arch/xtensa/include/asm/fixmap.h30
-rw-r--r--arch/xtensa/include/asm/highmem.h40
-rw-r--r--arch/xtensa/include/asm/page.h14
-rw-r--r--arch/xtensa/include/asm/pgtable.h7
-rw-r--r--arch/xtensa/include/asm/uaccess.h5
-rw-r--r--arch/xtensa/include/uapi/asm/ioctls.h21
-rw-r--r--arch/xtensa/include/uapi/asm/unistd.h5
-rw-r--r--arch/xtensa/kernel/align.S128
-rw-r--r--arch/xtensa/kernel/entry.S54
-rw-r--r--arch/xtensa/kernel/pci-dma.c12
-rw-r--r--arch/xtensa/kernel/smp.c1
-rw-r--r--arch/xtensa/kernel/traps.c5
-rw-r--r--arch/xtensa/kernel/vectors.S8
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S4
-rw-r--r--arch/xtensa/mm/cache.c77
-rw-r--r--arch/xtensa/mm/highmem.c41
-rw-r--r--arch/xtensa/mm/misc.S116
-rw-r--r--arch/xtensa/mm/mmu.c38
1141 files changed, 29270 insertions, 13151 deletions
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index e858aa0ad8af..25b49725df07 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -4,7 +4,9 @@ generic-y += clkdev.h
4generic-y += cputime.h 4generic-y += cputime.h
5generic-y += exec.h 5generic-y += exec.h
6generic-y += hash.h 6generic-y += hash.h
7generic-y += irq_work.h
7generic-y += mcs_spinlock.h 8generic-y += mcs_spinlock.h
8generic-y += preempt.h 9generic-y += preempt.h
9generic-y += scatterlist.h 10generic-y += scatterlist.h
11generic-y += sections.h
10generic-y += trace_clock.h 12generic-y += trace_clock.h
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index 5ebab5895edb..f05bdb4b1cb9 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -500,10 +500,14 @@ extern inline void writeq(u64 b, volatile void __iomem *addr)
500#define outb_p outb 500#define outb_p outb
501#define outw_p outw 501#define outw_p outw
502#define outl_p outl 502#define outl_p outl
503#define readb_relaxed(addr) __raw_readb(addr) 503#define readb_relaxed(addr) __raw_readb(addr)
504#define readw_relaxed(addr) __raw_readw(addr) 504#define readw_relaxed(addr) __raw_readw(addr)
505#define readl_relaxed(addr) __raw_readl(addr) 505#define readl_relaxed(addr) __raw_readl(addr)
506#define readq_relaxed(addr) __raw_readq(addr) 506#define readq_relaxed(addr) __raw_readq(addr)
507#define writeb_relaxed(b, addr) __raw_writeb(b, addr)
508#define writew_relaxed(b, addr) __raw_writew(b, addr)
509#define writel_relaxed(b, addr) __raw_writel(b, addr)
510#define writeq_relaxed(b, addr) __raw_writeq(b, addr)
507 511
508#define mmiowb() 512#define mmiowb()
509 513
diff --git a/arch/alpha/include/asm/sections.h b/arch/alpha/include/asm/sections.h
deleted file mode 100644
index 43b40edd6e44..000000000000
--- a/arch/alpha/include/asm/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ALPHA_SECTIONS_H
2#define _ALPHA_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7#endif
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index f2c94402e2c8..c509d306db45 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -3,7 +3,7 @@
3 3
4#include <uapi/asm/unistd.h> 4#include <uapi/asm/unistd.h>
5 5
6#define NR_SYSCALLS 508 6#define NR_SYSCALLS 511
7 7
8#define __ARCH_WANT_OLD_READDIR 8#define __ARCH_WANT_OLD_READDIR
9#define __ARCH_WANT_STAT64 9#define __ARCH_WANT_STAT64
diff --git a/arch/alpha/include/uapi/asm/ioctls.h b/arch/alpha/include/uapi/asm/ioctls.h
index 92c557be49fc..f30c94ae1bdb 100644
--- a/arch/alpha/include/uapi/asm/ioctls.h
+++ b/arch/alpha/include/uapi/asm/ioctls.h
@@ -90,6 +90,8 @@
90#define TIOCSBRK 0x5427 /* BSD compatibility */ 90#define TIOCSBRK 0x5427 /* BSD compatibility */
91#define TIOCCBRK 0x5428 /* BSD compatibility */ 91#define TIOCCBRK 0x5428 /* BSD compatibility */
92#define TIOCGSID 0x5429 /* Return the session ID of FD */ 92#define TIOCGSID 0x5429 /* Return the session ID of FD */
93#define TIOCGRS485 _IOR('T', 0x2E, struct serial_rs485)
94#define TIOCSRS485 _IOWR('T', 0x2F, struct serial_rs485)
93#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 95#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
94#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 96#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
95#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ 97#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
index 53ae7bb1bfd1..d214a0358100 100644
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ b/arch/alpha/include/uapi/asm/unistd.h
@@ -469,5 +469,8 @@
469#define __NR_process_vm_writev 505 469#define __NR_process_vm_writev 505
470#define __NR_kcmp 506 470#define __NR_kcmp 506
471#define __NR_finit_module 507 471#define __NR_finit_module 507
472#define __NR_sched_setattr 508
473#define __NR_sched_getattr 509
474#define __NR_renameat2 510
472 475
473#endif /* _UAPI_ALPHA_UNISTD_H */ 476#endif /* _UAPI_ALPHA_UNISTD_H */
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index dca9b3fb0071..24789713f1ea 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -526,6 +526,9 @@ sys_call_table:
526 .quad sys_process_vm_writev /* 505 */ 526 .quad sys_process_vm_writev /* 505 */
527 .quad sys_kcmp 527 .quad sys_kcmp
528 .quad sys_finit_module 528 .quad sys_finit_module
529 .quad sys_sched_setattr
530 .quad sys_sched_getattr
531 .quad sys_renameat2 /* 510 */
529 532
530 .size sys_call_table, . - sys_call_table 533 .size sys_call_table, . - sys_call_table
531 .type sys_call_table, @object 534 .type sys_call_table, @object
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index e76fd79f32b0..b8fffc1a2ac2 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -18,6 +18,7 @@ generic-y += ioctl.h
18generic-y += ioctls.h 18generic-y += ioctls.h
19generic-y += ipcbuf.h 19generic-y += ipcbuf.h
20generic-y += irq_regs.h 20generic-y += irq_regs.h
21generic-y += irq_work.h
21generic-y += kmap_types.h 22generic-y += kmap_types.h
22generic-y += kvm_para.h 23generic-y += kvm_para.h
23generic-y += local.h 24generic-y += local.h
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index 4670afc3b971..9e1142729fd1 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -427,7 +427,7 @@ struct ic_inv_args {
427 427
428static void __ic_line_inv_vaddr_helper(void *info) 428static void __ic_line_inv_vaddr_helper(void *info)
429{ 429{
430 struct ic_inv *ic_inv_args = (struct ic_inv_args *) info; 430 struct ic_inv_args *ic_inv = info;
431 431
432 __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz); 432 __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz);
433} 433}
@@ -581,6 +581,7 @@ void flush_icache_range(unsigned long kstart, unsigned long kend)
581 tot_sz -= sz; 581 tot_sz -= sz;
582 } 582 }
583} 583}
584EXPORT_SYMBOL(flush_icache_range);
584 585
585/* 586/*
586 * General purpose helper to make I and D cache lines consistent. 587 * General purpose helper to make I and D cache lines consistent.
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c49a775937db..18f392f8b744 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
14 select CLONE_BACKWARDS 14 select CLONE_BACKWARDS
15 select CPU_PM if (SUSPEND || CPU_IDLE) 15 select CPU_PM if (SUSPEND || CPU_IDLE)
16 select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS 16 select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
17 select GENERIC_ALLOCATOR
17 select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI) 18 select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI)
18 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 19 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
19 select GENERIC_IDLE_POLL_SETUP 20 select GENERIC_IDLE_POLL_SETUP
@@ -24,6 +25,7 @@ config ARM
24 select GENERIC_SMP_IDLE_THREAD 25 select GENERIC_SMP_IDLE_THREAD
25 select GENERIC_STRNCPY_FROM_USER 26 select GENERIC_STRNCPY_FROM_USER
26 select GENERIC_STRNLEN_USER 27 select GENERIC_STRNLEN_USER
28 select HANDLE_DOMAIN_IRQ
27 select HARDIRQS_SW_RESEND 29 select HARDIRQS_SW_RESEND
28 select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT) 30 select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
29 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 31 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
@@ -60,6 +62,7 @@ config ARM
60 select HAVE_PERF_EVENTS 62 select HAVE_PERF_EVENTS
61 select HAVE_PERF_REGS 63 select HAVE_PERF_REGS
62 select HAVE_PERF_USER_STACK_DUMP 64 select HAVE_PERF_USER_STACK_DUMP
65 select HAVE_RCU_TABLE_FREE if (SMP && ARM_LPAE)
63 select HAVE_REGS_AND_STACK_ACCESS_API 66 select HAVE_REGS_AND_STACK_ACCESS_API
64 select HAVE_SYSCALL_TRACEPOINTS 67 select HAVE_SYSCALL_TRACEPOINTS
65 select HAVE_UID16 68 select HAVE_UID16
@@ -387,6 +390,7 @@ config ARCH_CLPS711X
387 select CPU_ARM720T 390 select CPU_ARM720T
388 select GENERIC_CLOCKEVENTS 391 select GENERIC_CLOCKEVENTS
389 select MFD_SYSCON 392 select MFD_SYSCON
393 select SOC_BUS
390 help 394 help
391 Support for Cirrus Logic 711x/721x/731x based boards. 395 Support for Cirrus Logic 711x/721x/731x based boards.
392 396
@@ -650,6 +654,7 @@ config ARCH_SHMOBILE_LEGACY
650 select ARCH_SHMOBILE 654 select ARCH_SHMOBILE
651 select ARM_PATCH_PHYS_VIRT if MMU 655 select ARM_PATCH_PHYS_VIRT if MMU
652 select CLKDEV_LOOKUP 656 select CLKDEV_LOOKUP
657 select CPU_V7
653 select GENERIC_CLOCKEVENTS 658 select GENERIC_CLOCKEVENTS
654 select HAVE_ARM_SCU if SMP 659 select HAVE_ARM_SCU if SMP
655 select HAVE_ARM_TWD if SMP 660 select HAVE_ARM_TWD if SMP
@@ -660,6 +665,7 @@ config ARCH_SHMOBILE_LEGACY
660 select NO_IOPORT_MAP 665 select NO_IOPORT_MAP
661 select PINCTRL 666 select PINCTRL
662 select PM_GENERIC_DOMAINS if PM 667 select PM_GENERIC_DOMAINS if PM
668 select SH_CLK_CPG
663 select SPARSE_IRQ 669 select SPARSE_IRQ
664 help 670 help
665 Support for Renesas ARM SoC platforms using a non-multiplatform 671 Support for Renesas ARM SoC platforms using a non-multiplatform
@@ -888,6 +894,8 @@ source "arch/arm/mach-keystone/Kconfig"
888 894
889source "arch/arm/mach-ks8695/Kconfig" 895source "arch/arm/mach-ks8695/Kconfig"
890 896
897source "arch/arm/mach-meson/Kconfig"
898
891source "arch/arm/mach-msm/Kconfig" 899source "arch/arm/mach-msm/Kconfig"
892 900
893source "arch/arm/mach-moxart/Kconfig" 901source "arch/arm/mach-moxart/Kconfig"
@@ -1405,6 +1413,15 @@ config MCPM
1405 for (multi-)cluster based systems, such as big.LITTLE based 1413 for (multi-)cluster based systems, such as big.LITTLE based
1406 systems. 1414 systems.
1407 1415
1416config MCPM_QUAD_CLUSTER
1417 bool
1418 depends on MCPM
1419 help
1420 To avoid wasting resources unnecessarily, MCPM only supports up
1421 to 2 clusters by default.
1422 Platforms with 3 or 4 clusters that use MCPM must select this
1423 option to allow the additional clusters to be managed.
1424
1408config BIG_LITTLE 1425config BIG_LITTLE
1409 bool "big.LITTLE support (Experimental)" 1426 bool "big.LITTLE support (Experimental)"
1410 depends on CPU_V7 && SMP 1427 depends on CPU_V7 && SMP
@@ -1644,6 +1661,10 @@ config ARCH_SELECT_MEMORY_MODEL
1644config HAVE_ARCH_PFN_VALID 1661config HAVE_ARCH_PFN_VALID
1645 def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM 1662 def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM
1646 1663
1664config HAVE_GENERIC_RCU_GUP
1665 def_bool y
1666 depends on ARM_LPAE
1667
1647config HIGHMEM 1668config HIGHMEM
1648 bool "High Memory Support" 1669 bool "High Memory Support"
1649 depends on MMU 1670 depends on MMU
@@ -1983,8 +2004,6 @@ config XIP_PHYS_ADDR
1983config KEXEC 2004config KEXEC
1984 bool "Kexec system call (EXPERIMENTAL)" 2005 bool "Kexec system call (EXPERIMENTAL)"
1985 depends on (!SMP || PM_SLEEP_SMP) 2006 depends on (!SMP || PM_SLEEP_SMP)
1986 select CRYPTO
1987 select CRYPTO_SHA256
1988 help 2007 help
1989 kexec is a system call that implements the ability to shutdown your 2008 kexec is a system call that implements the ability to shutdown your
1990 current kernel, and to start another kernel. It is like a reboot 2009 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index b11ad54f8d17..03dc4c1a8736 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -101,6 +101,10 @@ choice
101 bool "Kernel low-level debugging on 9263 and 9g45" 101 bool "Kernel low-level debugging on 9263 and 9g45"
102 depends on HAVE_AT91_DBGU1 102 depends on HAVE_AT91_DBGU1
103 103
104 config AT91_DEBUG_LL_DBGU2
105 bool "Kernel low-level debugging on sama5d4"
106 depends on HAVE_AT91_DBGU2
107
104 config DEBUG_BCM2835 108 config DEBUG_BCM2835
105 bool "Kernel low-level debugging on BCM2835 PL011 UART" 109 bool "Kernel low-level debugging on BCM2835 PL011 UART"
106 depends on ARCH_BCM2835 110 depends on ARCH_BCM2835
@@ -122,6 +126,11 @@ choice
122 mobile SoCs in the Kona family of chips (e.g. bcm28155, 126 mobile SoCs in the Kona family of chips (e.g. bcm28155,
123 bcm11351, etc...) 127 bcm11351, etc...)
124 128
129 config DEBUG_BCM63XX
130 bool "Kernel low-level debugging on BCM63XX UART"
131 depends on ARCH_BCM_63XX
132 select DEBUG_UART_BCM63XX
133
125 config DEBUG_BERLIN_UART 134 config DEBUG_BERLIN_UART
126 bool "Marvell Berlin SoC Debug UART" 135 bool "Marvell Berlin SoC Debug UART"
127 depends on ARCH_BERLIN 136 depends on ARCH_BERLIN
@@ -147,7 +156,7 @@ choice
147 config DEBUG_CNS3XXX 156 config DEBUG_CNS3XXX
148 bool "Kernel Kernel low-level debugging on Cavium Networks CNS3xxx" 157 bool "Kernel Kernel low-level debugging on Cavium Networks CNS3xxx"
149 depends on ARCH_CNS3XXX 158 depends on ARCH_CNS3XXX
150 select DEBUG_UART_PL01X 159 select DEBUG_UART_8250
151 help 160 help
152 Say Y here if you want the debug print routines to direct 161 Say Y here if you want the debug print routines to direct
153 their output to the CNS3xxx UART0. 162 their output to the CNS3xxx UART0.
@@ -223,14 +232,6 @@ choice
223 Say Y here if you want kernel low-level debugging support 232 Say Y here if you want kernel low-level debugging support
224 on HI3716 UART. 233 on HI3716 UART.
225 234
226 config DEBUG_HIX5HD2_UART
227 bool "Hisilicon Hix5hd2 Debug UART"
228 depends on ARCH_HIX5HD2
229 select DEBUG_UART_PL01X
230 help
231 Say Y here if you want kernel low-level debugging support
232 on Hix5hd2 UART.
233
234 config DEBUG_HIGHBANK_UART 235 config DEBUG_HIGHBANK_UART
235 bool "Kernel low-level debugging messages via Highbank UART" 236 bool "Kernel low-level debugging messages via Highbank UART"
236 depends on ARCH_HIGHBANK 237 depends on ARCH_HIGHBANK
@@ -239,6 +240,22 @@ choice
239 Say Y here if you want the debug print routines to direct 240 Say Y here if you want the debug print routines to direct
240 their output to the UART on Highbank based devices. 241 their output to the UART on Highbank based devices.
241 242
243 config DEBUG_HIP04_UART
244 bool "Hisilicon HiP04 Debug UART"
245 depends on ARCH_HIP04
246 select DEBUG_UART_8250
247 help
248 Say Y here if you want kernel low-level debugging support
249 on HIP04 UART.
250
251 config DEBUG_HIX5HD2_UART
252 bool "Hisilicon Hix5hd2 Debug UART"
253 depends on ARCH_HIX5HD2
254 select DEBUG_UART_PL01X
255 help
256 Say Y here if you want kernel low-level debugging support
257 on Hix5hd2 UART.
258
242 config DEBUG_IMX1_UART 259 config DEBUG_IMX1_UART
243 bool "i.MX1 Debug UART" 260 bool "i.MX1 Debug UART"
244 depends on SOC_IMX1 261 depends on SOC_IMX1
@@ -348,6 +365,13 @@ choice
348 Say Y here if you want the debug print routines to direct 365 Say Y here if you want the debug print routines to direct
349 their output to UART1 serial port on KEYSTONE2 devices. 366 their output to UART1 serial port on KEYSTONE2 devices.
350 367
368 config DEBUG_MESON_UARTAO
369 bool "Kernel low-level debugging via Meson6 UARTAO"
370 depends on ARCH_MESON
371 help
372 Say Y here if you want kernel low-lever debugging support
373 on Amlogic Meson6 based platforms on the UARTAO.
374
351 config DEBUG_MMP_UART2 375 config DEBUG_MMP_UART2
352 bool "Kernel low-level debugging message via MMP UART2" 376 bool "Kernel low-level debugging message via MMP UART2"
353 depends on ARCH_MMP 377 depends on ARCH_MMP
@@ -834,6 +858,14 @@ choice
834 Say Y here if you want kernel low-level debugging support 858 Say Y here if you want kernel low-level debugging support
835 on Ux500 based platforms. 859 on Ux500 based platforms.
836 860
861 config DEBUG_MT6589_UART0
862 bool "Mediatek mt6589 UART0"
863 depends on ARCH_MEDIATEK
864 select DEBUG_UART_8250
865 help
866 Say Y here if you want kernel low-level debugging support
867 for Mediatek mt6589 based platforms on UART0.
868
837 config DEBUG_VEXPRESS_UART0_DETECT 869 config DEBUG_VEXPRESS_UART0_DETECT
838 bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" 870 bool "Autodetect UART0 on Versatile Express Cortex-A core tiles"
839 depends on ARCH_VEXPRESS && CPU_CP15_MMU 871 depends on ARCH_VEXPRESS && CPU_CP15_MMU
@@ -1011,6 +1043,7 @@ config DEBUG_LL_INCLUDE
1011 string 1043 string
1012 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 1044 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
1013 default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 1045 default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2
1046 default "debug/meson.S" if DEBUG_MESON_UARTAO
1014 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X 1047 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X
1015 default "debug/exynos.S" if DEBUG_EXYNOS_UART 1048 default "debug/exynos.S" if DEBUG_EXYNOS_UART
1016 default "debug/efm32.S" if DEBUG_LL_UART_EFM32 1049 default "debug/efm32.S" if DEBUG_LL_UART_EFM32
@@ -1038,6 +1071,7 @@ config DEBUG_LL_INCLUDE
1038 default "debug/vf.S" if DEBUG_VF_UART 1071 default "debug/vf.S" if DEBUG_VF_UART
1039 default "debug/vt8500.S" if DEBUG_VT8500_UART0 1072 default "debug/vt8500.S" if DEBUG_VT8500_UART0
1040 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1 1073 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
1074 default "debug/bcm63xx.S" if DEBUG_UART_BCM63XX
1041 default "mach/debug-macro.S" 1075 default "mach/debug-macro.S"
1042 1076
1043# Compatibility options for PL01x 1077# Compatibility options for PL01x
@@ -1057,6 +1091,10 @@ config DEBUG_UART_8250
1057 ARCH_IOP33X || ARCH_IXP4XX || \ 1091 ARCH_IOP33X || ARCH_IXP4XX || \
1058 ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC 1092 ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC
1059 1093
1094# Compatibility options for BCM63xx
1095config DEBUG_UART_BCM63XX
1096 def_bool ARCH_BCM_63XX
1097
1060config DEBUG_UART_PHYS 1098config DEBUG_UART_PHYS
1061 hex "Physical base address of debug UART" 1099 hex "Physical base address of debug UART"
1062 default 0x01c20000 if DEBUG_DAVINCI_DMx_UART0 1100 default 0x01c20000 if DEBUG_DAVINCI_DMx_UART0
@@ -1068,13 +1106,14 @@ config DEBUG_UART_PHYS
1068 default 0x02530c00 if DEBUG_KEYSTONE_UART0 1106 default 0x02530c00 if DEBUG_KEYSTONE_UART0
1069 default 0x02531000 if DEBUG_KEYSTONE_UART1 1107 default 0x02531000 if DEBUG_KEYSTONE_UART1
1070 default 0x03010fe0 if ARCH_RPC 1108 default 0x03010fe0 if ARCH_RPC
1071 default 0x10009000 if DEBUG_REALVIEW_STD_PORT || DEBUG_CNS3XXX || \ 1109 default 0x10009000 if DEBUG_REALVIEW_STD_PORT || \
1072 DEBUG_VEXPRESS_UART0_CA9 1110 DEBUG_VEXPRESS_UART0_CA9
1073 default 0x1010c000 if DEBUG_REALVIEW_PB1176_PORT 1111 default 0x1010c000 if DEBUG_REALVIEW_PB1176_PORT
1074 default 0x10124000 if DEBUG_RK3X_UART0 1112 default 0x10124000 if DEBUG_RK3X_UART0
1075 default 0x10126000 if DEBUG_RK3X_UART1 1113 default 0x10126000 if DEBUG_RK3X_UART1
1076 default 0x101f1000 if ARCH_VERSATILE 1114 default 0x101f1000 if ARCH_VERSATILE
1077 default 0x101fb000 if DEBUG_NOMADIK_UART 1115 default 0x101fb000 if DEBUG_NOMADIK_UART
1116 default 0x11006000 if DEBUG_MT6589_UART0
1078 default 0x16000000 if ARCH_INTEGRATOR 1117 default 0x16000000 if ARCH_INTEGRATOR
1079 default 0x18000300 if DEBUG_BCM_5301X 1118 default 0x18000300 if DEBUG_BCM_5301X
1080 default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1 1119 default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1
@@ -1093,7 +1132,9 @@ config DEBUG_UART_PHYS
1093 DEBUG_S3C2410_UART1) 1132 DEBUG_S3C2410_UART1)
1094 default 0x50008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \ 1133 default 0x50008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \
1095 DEBUG_S3C2410_UART2) 1134 DEBUG_S3C2410_UART2)
1135 default 0x78000000 if DEBUG_CNS3XXX
1096 default 0x7c0003f8 if FOOTBRIDGE 1136 default 0x7c0003f8 if FOOTBRIDGE
1137 default 0x78000000 if DEBUG_CNS3XXX
1097 default 0x80070000 if DEBUG_IMX23_UART 1138 default 0x80070000 if DEBUG_IMX23_UART
1098 default 0x80074000 if DEBUG_IMX28_UART 1139 default 0x80074000 if DEBUG_IMX28_UART
1099 default 0x80230000 if DEBUG_PICOXCELL_UART 1140 default 0x80230000 if DEBUG_PICOXCELL_UART
@@ -1106,9 +1147,11 @@ config DEBUG_UART_PHYS
1106 default 0xc8000003 if ARCH_IXP4XX && CPU_BIG_ENDIAN 1147 default 0xc8000003 if ARCH_IXP4XX && CPU_BIG_ENDIAN
1107 default 0xd0000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX 1148 default 0xd0000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX
1108 default 0xd0012000 if DEBUG_MVEBU_UART 1149 default 0xd0012000 if DEBUG_MVEBU_UART
1150 default 0xc81004c0 if DEBUG_MESON_UARTAO
1109 default 0xd4017000 if DEBUG_MMP_UART2 1151 default 0xd4017000 if DEBUG_MMP_UART2
1110 default 0xd4018000 if DEBUG_MMP_UART3 1152 default 0xd4018000 if DEBUG_MMP_UART3
1111 default 0xe0000000 if ARCH_SPEAR13XX 1153 default 0xe0000000 if ARCH_SPEAR13XX
1154 default 0xe4007000 if DEBUG_HIP04_UART
1112 default 0xf0000be0 if ARCH_EBSA110 1155 default 0xf0000be0 if ARCH_EBSA110
1113 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE 1156 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
1114 default 0xf1012000 if ARCH_DOVE || ARCH_MV78XX0 || \ 1157 default 0xf1012000 if ARCH_DOVE || ARCH_MV78XX0 || \
@@ -1122,21 +1165,23 @@ config DEBUG_UART_PHYS
1122 default 0xffc02000 if DEBUG_SOCFPGA_UART 1165 default 0xffc02000 if DEBUG_SOCFPGA_UART
1123 default 0xffd82340 if ARCH_IOP13XX 1166 default 0xffd82340 if ARCH_IOP13XX
1124 default 0xfff36000 if DEBUG_HIGHBANK_UART 1167 default 0xfff36000 if DEBUG_HIGHBANK_UART
1168 default 0xfffe8600 if DEBUG_UART_BCM63XX
1125 default 0xfffff700 if ARCH_IOP33X 1169 default 0xfffff700 if ARCH_IOP33X
1126 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1170 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1127 DEBUG_LL_UART_EFM32 || \ 1171 DEBUG_LL_UART_EFM32 || \
1128 DEBUG_UART_8250 || DEBUG_UART_PL01X || \ 1172 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
1129 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART 1173 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \
1174 DEBUG_UART_BCM63XX
1130 1175
1131config DEBUG_UART_VIRT 1176config DEBUG_UART_VIRT
1132 hex "Virtual base address of debug UART" 1177 hex "Virtual base address of debug UART"
1133 default 0xe0010fe0 if ARCH_RPC 1178 default 0xe0010fe0 if ARCH_RPC
1134 default 0xe1000000 if DEBUG_MSM_UART 1179 default 0xe1000000 if DEBUG_MSM_UART
1135 default 0xf0000be0 if ARCH_EBSA110 1180 default 0xf0000be0 if ARCH_EBSA110
1136 default 0xf0009000 if DEBUG_CNS3XXX
1137 default 0xf01fb000 if DEBUG_NOMADIK_UART 1181 default 0xf01fb000 if DEBUG_NOMADIK_UART
1138 default 0xf0201000 if DEBUG_BCM2835 1182 default 0xf0201000 if DEBUG_BCM2835
1139 default 0xf1000300 if DEBUG_BCM_5301X 1183 default 0xf1000300 if DEBUG_BCM_5301X
1184 default 0xf1006000 if DEBUG_MT6589_UART0
1140 default 0xf11f1000 if ARCH_VERSATILE 1185 default 0xf11f1000 if ARCH_VERSATILE
1141 default 0xf1600000 if ARCH_INTEGRATOR 1186 default 0xf1600000 if ARCH_INTEGRATOR
1142 default 0xf1c28000 if DEBUG_SUNXI_UART0 1187 default 0xf1c28000 if DEBUG_SUNXI_UART0
@@ -1152,16 +1197,20 @@ config DEBUG_UART_VIRT
1152 default 0xf7008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \ 1197 default 0xf7008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \
1153 DEBUG_S3C2410_UART2) 1198 DEBUG_S3C2410_UART2)
1154 default 0xf7fc9000 if DEBUG_BERLIN_UART 1199 default 0xf7fc9000 if DEBUG_BERLIN_UART
1200 default 0xf8007000 if DEBUG_HIP04_UART
1155 default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9 1201 default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9
1156 default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1 1202 default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1
1157 default 0xfa71e000 if DEBUG_QCOM_UARTDM 1203 default 0xfa71e000 if DEBUG_QCOM_UARTDM
1204 default 0xfb002000 if DEBUG_CNS3XXX
1158 default 0xfb009000 if DEBUG_REALVIEW_STD_PORT 1205 default 0xfb009000 if DEBUG_REALVIEW_STD_PORT
1159 default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT 1206 default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT
1207 default 0xfcfe8600 if DEBUG_UART_BCM63XX
1160 default 0xfd000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX 1208 default 0xfd000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX
1161 default 0xfd000000 if ARCH_SPEAR13XX 1209 default 0xfd000000 if ARCH_SPEAR13XX
1162 default 0xfd012000 if ARCH_MV78XX0 1210 default 0xfd012000 if ARCH_MV78XX0
1163 default 0xfde12000 if ARCH_DOVE 1211 default 0xfde12000 if ARCH_DOVE
1164 default 0xfe012000 if ARCH_ORION5X 1212 default 0xfe012000 if ARCH_ORION5X
1213 default 0xf31004c0 if DEBUG_MESON_UARTAO
1165 default 0xfe017000 if DEBUG_MMP_UART2 1214 default 0xfe017000 if DEBUG_MMP_UART2
1166 default 0xfe018000 if DEBUG_MMP_UART3 1215 default 0xfe018000 if DEBUG_MMP_UART3
1167 default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART 1216 default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART
@@ -1193,8 +1242,9 @@ config DEBUG_UART_VIRT
1193 default 0xff003000 if DEBUG_U300_UART 1242 default 0xff003000 if DEBUG_U300_UART
1194 default DEBUG_UART_PHYS if !MMU 1243 default DEBUG_UART_PHYS if !MMU
1195 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1244 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1196 DEBUG_UART_8250 || DEBUG_UART_PL01X || \ 1245 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
1197 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART 1246 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \
1247 DEBUG_UART_BCM63XX
1198 1248
1199config DEBUG_UART_8250_SHIFT 1249config DEBUG_UART_8250_SHIFT
1200 int "Register offset shift for the 8250 debug UART" 1250 int "Register offset shift for the 8250 debug UART"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0ce9d0f71f2a..dceb0441b1a6 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -157,6 +157,7 @@ machine-$(CONFIG_ARCH_EBSA110) += ebsa110
157machine-$(CONFIG_ARCH_EFM32) += efm32 157machine-$(CONFIG_ARCH_EFM32) += efm32
158machine-$(CONFIG_ARCH_EP93XX) += ep93xx 158machine-$(CONFIG_ARCH_EP93XX) += ep93xx
159machine-$(CONFIG_ARCH_EXYNOS) += exynos 159machine-$(CONFIG_ARCH_EXYNOS) += exynos
160machine-$(CONFIG_ARCH_FOOTBRIDGE) += footbridge
160machine-$(CONFIG_ARCH_GEMINI) += gemini 161machine-$(CONFIG_ARCH_GEMINI) += gemini
161machine-$(CONFIG_ARCH_HIGHBANK) += highbank 162machine-$(CONFIG_ARCH_HIGHBANK) += highbank
162machine-$(CONFIG_ARCH_HISI) += hisi 163machine-$(CONFIG_ARCH_HISI) += hisi
@@ -168,6 +169,7 @@ machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx
168machine-$(CONFIG_ARCH_KEYSTONE) += keystone 169machine-$(CONFIG_ARCH_KEYSTONE) += keystone
169machine-$(CONFIG_ARCH_KS8695) += ks8695 170machine-$(CONFIG_ARCH_KS8695) += ks8695
170machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx 171machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx
172machine-$(CONFIG_ARCH_MESON) += meson
171machine-$(CONFIG_ARCH_MMP) += mmp 173machine-$(CONFIG_ARCH_MMP) += mmp
172machine-$(CONFIG_ARCH_MOXART) += moxart 174machine-$(CONFIG_ARCH_MOXART) += moxart
173machine-$(CONFIG_ARCH_MSM) += msm 175machine-$(CONFIG_ARCH_MSM) += msm
@@ -205,7 +207,6 @@ machine-$(CONFIG_ARCH_VEXPRESS) += vexpress
205machine-$(CONFIG_ARCH_VT8500) += vt8500 207machine-$(CONFIG_ARCH_VT8500) += vt8500
206machine-$(CONFIG_ARCH_W90X900) += w90x900 208machine-$(CONFIG_ARCH_W90X900) += w90x900
207machine-$(CONFIG_ARCH_ZYNQ) += zynq 209machine-$(CONFIG_ARCH_ZYNQ) += zynq
208machine-$(CONFIG_FOOTBRIDGE) += footbridge
209machine-$(CONFIG_PLAT_SPEAR) += spear 210machine-$(CONFIG_PLAT_SPEAR) += spear
210 211
211# Platform directory name. This list is sorted alphanumerically 212# Platform directory name. This list is sorted alphanumerically
diff --git a/arch/arm/boot/bootp/Makefile b/arch/arm/boot/bootp/Makefile
index c394e305447c..5761f0039133 100644
--- a/arch/arm/boot/bootp/Makefile
+++ b/arch/arm/boot/bootp/Makefile
@@ -5,6 +5,8 @@
5# architecture-specific flags and dependencies. 5# architecture-specific flags and dependencies.
6# 6#
7 7
8GCOV_PROFILE := n
9
8LDFLAGS_bootp :=-p --no-undefined -X \ 10LDFLAGS_bootp :=-p --no-undefined -X \
9 --defsym initrd_phys=$(INITRD_PHYS) \ 11 --defsym initrd_phys=$(INITRD_PHYS) \
10 --defsym params_phys=$(PARAMS_PHYS) -T 12 --defsym params_phys=$(PARAMS_PHYS) -T
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 76a50ecae1c3..3ea230aa94b7 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -37,6 +37,8 @@ ifeq ($(CONFIG_ARM_VIRT_EXT),y)
37OBJS += hyp-stub.o 37OBJS += hyp-stub.o
38endif 38endif
39 39
40GCOV_PROFILE := n
41
40# 42#
41# Architecture dependencies 43# Architecture dependencies
42# 44#
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index b8c5cd3ddeb9..7c80af906897 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -48,11 +48,14 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb
48dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb 48dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb
49dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb 49dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
50dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb 50dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb
51# sama5d4
52dtb-$(CONFIG_ARCH_AT91) += at91-sama5d4ek.dtb
51 53
52dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb 54dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
53dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb 55dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
54dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 56dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
55dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb 57dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
58dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
56dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \ 59dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \
57 bcm21664-garnet.dtb 60 bcm21664-garnet.dtb
58dtb-$(CONFIG_ARCH_BERLIN) += \ 61dtb-$(CONFIG_ARCH_BERLIN) += \
@@ -90,6 +93,7 @@ dtb-$(CONFIG_ARCH_HI3xxx) += hi3620-hi4511.dtb
90dtb-$(CONFIG_ARCH_HIX5HD2) += hisi-x5hd2-dkb.dtb 93dtb-$(CONFIG_ARCH_HIX5HD2) += hisi-x5hd2-dkb.dtb
91dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ 94dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
92 ecx-2000.dtb 95 ecx-2000.dtb
96dtb-$(CONFIG_ARCH_HIP04) += hip04-d01.dtb
93dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ 97dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
94 integratorcp.dtb 98 integratorcp.dtb
95dtb-$(CONFIG_ARCH_KEYSTONE) += k2hk-evm.dtb \ 99dtb-$(CONFIG_ARCH_KEYSTONE) += k2hk-evm.dtb \
@@ -144,8 +148,8 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += kirkwood-b3.dtb \
144 kirkwood-openrd-client.dtb \ 148 kirkwood-openrd-client.dtb \
145 kirkwood-openrd-ultimate.dtb \ 149 kirkwood-openrd-ultimate.dtb \
146 kirkwood-rd88f6192.dtb \ 150 kirkwood-rd88f6192.dtb \
147 kirkwood-rd88f6281-a0.dtb \ 151 kirkwood-rd88f6281-z0.dtb \
148 kirkwood-rd88f6281-a1.dtb \ 152 kirkwood-rd88f6281-a.dtb \
149 kirkwood-rs212.dtb \ 153 kirkwood-rs212.dtb \
150 kirkwood-rs409.dtb \ 154 kirkwood-rs409.dtb \
151 kirkwood-rs411.dtb \ 155 kirkwood-rs411.dtb \
@@ -159,8 +163,11 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += kirkwood-b3.dtb \
159 kirkwood-ts419-6282.dtb 163 kirkwood-ts419-6282.dtb
160dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 164dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
161dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb 165dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
166dtb-$(CONFIG_MACH_MESON6) += meson6-atv1200.dtb
162dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb 167dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb
163dtb-$(CONFIG_ARCH_MXC) += \ 168dtb-$(CONFIG_ARCH_MXC) += \
169 imx1-ads.dtb \
170 imx1-apf9328.dtb \
164 imx25-eukrea-mbimxsd25-baseboard.dtb \ 171 imx25-eukrea-mbimxsd25-baseboard.dtb \
165 imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dtb \ 172 imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dtb \
166 imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dtb \ 173 imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dtb \
@@ -199,6 +206,7 @@ dtb-$(CONFIG_ARCH_MXC) += \
199 imx6dl-gw52xx.dtb \ 206 imx6dl-gw52xx.dtb \
200 imx6dl-gw53xx.dtb \ 207 imx6dl-gw53xx.dtb \
201 imx6dl-gw54xx.dtb \ 208 imx6dl-gw54xx.dtb \
209 imx6dl-gw552x.dtb \
202 imx6dl-hummingboard.dtb \ 210 imx6dl-hummingboard.dtb \
203 imx6dl-nitrogen6x.dtb \ 211 imx6dl-nitrogen6x.dtb \
204 imx6dl-phytec-pbab01.dtb \ 212 imx6dl-phytec-pbab01.dtb \
@@ -223,6 +231,8 @@ dtb-$(CONFIG_ARCH_MXC) += \
223 imx6q-gw53xx.dtb \ 231 imx6q-gw53xx.dtb \
224 imx6q-gw5400-a.dtb \ 232 imx6q-gw5400-a.dtb \
225 imx6q-gw54xx.dtb \ 233 imx6q-gw54xx.dtb \
234 imx6q-gw552x.dtb \
235 imx6q-hummingboard.dtb \
226 imx6q-nitrogen6x.dtb \ 236 imx6q-nitrogen6x.dtb \
227 imx6q-phytec-pbab01.dtb \ 237 imx6q-phytec-pbab01.dtb \
228 imx6q-rex-pro.dtb \ 238 imx6q-rex-pro.dtb \
@@ -240,7 +250,7 @@ dtb-$(CONFIG_ARCH_MXC) += \
240 imx6q-tx6q-1110.dtb \ 250 imx6q-tx6q-1110.dtb \
241 imx6sl-evk.dtb \ 251 imx6sl-evk.dtb \
242 imx6sx-sdb.dtb \ 252 imx6sx-sdb.dtb \
243 vf610-colibri.dtb \ 253 vf610-colibri-eval-v3.dtb \
244 vf610-cosmic.dtb \ 254 vf610-cosmic.dtb \
245 vf610-twr.dtb 255 vf610-twr.dtb
246dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \ 256dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
@@ -286,7 +296,11 @@ dtb-$(CONFIG_ARCH_OMAP3) += am3517-craneboard.dtb \
286 omap3-devkit8000.dtb \ 296 omap3-devkit8000.dtb \
287 omap3-evm.dtb \ 297 omap3-evm.dtb \
288 omap3-evm-37xx.dtb \ 298 omap3-evm-37xx.dtb \
289 omap3-gta04.dtb \ 299 omap3-gta04a3.dtb \
300 omap3-gta04a4.dtb \
301 omap3-gta04a5.dtb \
302 omap3-ha.dtb \
303 omap3-ha-lcd.dtb \
290 omap3-igep0020.dtb \ 304 omap3-igep0020.dtb \
291 omap3-igep0030.dtb \ 305 omap3-igep0030.dtb \
292 omap3-ldp.dtb \ 306 omap3-ldp.dtb \
@@ -309,6 +323,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += am3517-craneboard.dtb \
309 omap3-sbc-t3517.dtb \ 323 omap3-sbc-t3517.dtb \
310 omap3-sbc-t3530.dtb \ 324 omap3-sbc-t3530.dtb \
311 omap3-sbc-t3730.dtb \ 325 omap3-sbc-t3730.dtb \
326 omap3-thunder.dtb \
312 omap3-zoom3.dtb 327 omap3-zoom3.dtb
313dtb-$(CONFIG_SOC_AM33XX) += am335x-base0033.dtb \ 328dtb-$(CONFIG_SOC_AM33XX) += am335x-base0033.dtb \
314 am335x-bone.dtb \ 329 am335x-bone.dtb \
@@ -341,7 +356,9 @@ dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
341dtb-$(CONFIG_ARCH_QCOM) += \ 356dtb-$(CONFIG_ARCH_QCOM) += \
342 qcom-apq8064-ifc6410.dtb \ 357 qcom-apq8064-ifc6410.dtb \
343 qcom-apq8074-dragonboard.dtb \ 358 qcom-apq8074-dragonboard.dtb \
359 qcom-apq8084-ifc6540.dtb \
344 qcom-apq8084-mtp.dtb \ 360 qcom-apq8084-mtp.dtb \
361 qcom-ipq8064-ap148.dtb \
345 qcom-msm8660-surf.dtb \ 362 qcom-msm8660-surf.dtb \
346 qcom-msm8960-cdp.dtb 363 qcom-msm8960-cdp.dtb
347dtb-$(CONFIG_ARCH_ROCKCHIP) += \ 364dtb-$(CONFIG_ARCH_ROCKCHIP) += \
@@ -361,7 +378,6 @@ dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += r7s72100-genmai.dtb \
361 r8a7740-armadillo800eva.dtb \ 378 r8a7740-armadillo800eva.dtb \
362 r8a7778-bockw.dtb \ 379 r8a7778-bockw.dtb \
363 r8a7778-bockw-reference.dtb \ 380 r8a7778-bockw-reference.dtb \
364 r8a7740-armadillo800eva-reference.dtb \
365 r8a7779-marzen.dtb \ 381 r8a7779-marzen.dtb \
366 r8a7791-koelsch.dtb \ 382 r8a7791-koelsch.dtb \
367 r8a7790-lager.dtb \ 383 r8a7790-lager.dtb \
@@ -372,10 +388,12 @@ dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += r7s72100-genmai.dtb \
372 sh7372-mackerel.dtb 388 sh7372-mackerel.dtb
373dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \ 389dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
374 r7s72100-genmai.dtb \ 390 r7s72100-genmai.dtb \
391 r8a7740-armadillo800eva.dtb \
375 r8a7791-henninger.dtb \ 392 r8a7791-henninger.dtb \
376 r8a7791-koelsch.dtb \ 393 r8a7791-koelsch.dtb \
377 r8a7790-lager.dtb \ 394 r8a7790-lager.dtb \
378 r8a7779-marzen.dtb 395 r8a7779-marzen.dtb \
396 r8a7794-alt.dtb
379dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \ 397dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
380 socfpga_cyclone5_socdk.dtb \ 398 socfpga_cyclone5_socdk.dtb \
381 socfpga_cyclone5_sockit.dtb \ 399 socfpga_cyclone5_sockit.dtb \
@@ -406,6 +424,7 @@ dtb-$(CONFIG_MACH_SUN4I) += \
406dtb-$(CONFIG_MACH_SUN5I) += \ 424dtb-$(CONFIG_MACH_SUN5I) += \
407 sun5i-a10s-olinuxino-micro.dtb \ 425 sun5i-a10s-olinuxino-micro.dtb \
408 sun5i-a10s-r7-tv-dongle.dtb \ 426 sun5i-a10s-r7-tv-dongle.dtb \
427 sun5i-a13-hsg-h702.dtb \
409 sun5i-a13-olinuxino.dtb \ 428 sun5i-a13-olinuxino.dtb \
410 sun5i-a13-olinuxino-micro.dtb 429 sun5i-a13-olinuxino-micro.dtb
411dtb-$(CONFIG_MACH_SUN6I) += \ 430dtb-$(CONFIG_MACH_SUN6I) += \
@@ -416,7 +435,9 @@ dtb-$(CONFIG_MACH_SUN6I) += \
416dtb-$(CONFIG_MACH_SUN7I) += \ 435dtb-$(CONFIG_MACH_SUN7I) += \
417 sun7i-a20-cubieboard2.dtb \ 436 sun7i-a20-cubieboard2.dtb \
418 sun7i-a20-cubietruck.dtb \ 437 sun7i-a20-cubietruck.dtb \
438 sun7i-a20-hummingbird.dtb \
419 sun7i-a20-i12-tvbox.dtb \ 439 sun7i-a20-i12-tvbox.dtb \
440 sun7i-a20-olinuxino-lime.dtb \
420 sun7i-a20-olinuxino-micro.dtb \ 441 sun7i-a20-olinuxino-micro.dtb \
421 sun7i-a20-pcduino3.dtb 442 sun7i-a20-pcduino3.dtb
422dtb-$(CONFIG_MACH_SUN8I) += \ 443dtb-$(CONFIG_MACH_SUN8I) += \
@@ -440,6 +461,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
440 tegra114-roth.dtb \ 461 tegra114-roth.dtb \
441 tegra114-tn7.dtb \ 462 tegra114-tn7.dtb \
442 tegra124-jetson-tk1.dtb \ 463 tegra124-jetson-tk1.dtb \
464 tegra124-nyan-big.dtb \
443 tegra124-venice2.dtb 465 tegra124-venice2.dtb
444dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb 466dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb
445dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \ 467dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
@@ -491,6 +513,7 @@ dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \
491 dove-d2plug.dtb \ 513 dove-d2plug.dtb \
492 dove-d3plug.dtb \ 514 dove-d3plug.dtb \
493 dove-dove-db.dtb 515 dove-dove-db.dtb
516dtb-$(CONFIG_ARCH_MEDIATEK) += mt6589-aquaris5.dtb
494 517
495targets += dtbs dtbs_install 518targets += dtbs dtbs_install
496targets += $(dtb-y) 519targets += $(dtb-y)
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
index bde1777b62be..6cc25ed912ee 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -7,9 +7,6 @@
7 */ 7 */
8 8
9/ { 9/ {
10 model = "TI AM335x BeagleBone";
11 compatible = "ti,am335x-bone", "ti,am33xx";
12
13 cpus { 10 cpus {
14 cpu@0 { 11 cpu@0 {
15 cpu0-supply = <&dcdc2_reg>; 12 cpu0-supply = <&dcdc2_reg>;
@@ -227,6 +224,7 @@
227&tps { 224&tps {
228 regulators { 225 regulators {
229 dcdc1_reg: regulator@0 { 226 dcdc1_reg: regulator@0 {
227 regulator-name = "vdds_dpr";
230 regulator-always-on; 228 regulator-always-on;
231 }; 229 };
232 230
@@ -249,18 +247,22 @@
249 }; 247 };
250 248
251 ldo1_reg: regulator@3 { 249 ldo1_reg: regulator@3 {
250 regulator-name = "vio,vrtc,vdds";
252 regulator-always-on; 251 regulator-always-on;
253 }; 252 };
254 253
255 ldo2_reg: regulator@4 { 254 ldo2_reg: regulator@4 {
255 regulator-name = "vdd_3v3aux";
256 regulator-always-on; 256 regulator-always-on;
257 }; 257 };
258 258
259 ldo3_reg: regulator@5 { 259 ldo3_reg: regulator@5 {
260 regulator-name = "vdd_1v8";
260 regulator-always-on; 261 regulator-always-on;
261 }; 262 };
262 263
263 ldo4_reg: regulator@6 { 264 ldo4_reg: regulator@6 {
265 regulator-name = "vdd_3v3a";
264 regulator-always-on; 266 regulator-always-on;
265 }; 267 };
266 }; 268 };
diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index 94ee427a6db1..83d40f7655e5 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -10,6 +10,11 @@
10#include "am33xx.dtsi" 10#include "am33xx.dtsi"
11#include "am335x-bone-common.dtsi" 11#include "am335x-bone-common.dtsi"
12 12
13/ {
14 model = "TI AM335x BeagleBone";
15 compatible = "ti,am335x-bone", "ti,am33xx";
16};
17
13&ldo3_reg { 18&ldo3_reg {
14 regulator-min-microvolt = <1800000>; 19 regulator-min-microvolt = <1800000>;
15 regulator-max-microvolt = <3300000>; 20 regulator-max-microvolt = <3300000>;
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
index 305975d3f531..901739fcb85a 100644
--- a/arch/arm/boot/dts/am335x-boneblack.dts
+++ b/arch/arm/boot/dts/am335x-boneblack.dts
@@ -10,6 +10,11 @@
10#include "am33xx.dtsi" 10#include "am33xx.dtsi"
11#include "am335x-bone-common.dtsi" 11#include "am335x-bone-common.dtsi"
12 12
13/ {
14 model = "TI AM335x BeagleBone Black";
15 compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
16};
17
13&ldo3_reg { 18&ldo3_reg {
14 regulator-min-microvolt = <1800000>; 19 regulator-min-microvolt = <1800000>;
15 regulator-max-microvolt = <1800000>; 20 regulator-max-microvolt = <1800000>;
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 3a0a161342ba..831810583823 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -132,11 +132,15 @@
132 }; 132 };
133 }; 133 };
134 134
135 cm: syscon@44e10000 {
136 compatible = "ti,am33xx-controlmodule", "syscon";
137 reg = <0x44e10000 0x800>;
138 };
139
135 intc: interrupt-controller@48200000 { 140 intc: interrupt-controller@48200000 {
136 compatible = "ti,omap2-intc"; 141 compatible = "ti,am33xx-intc";
137 interrupt-controller; 142 interrupt-controller;
138 #interrupt-cells = <1>; 143 #interrupt-cells = <1>;
139 ti,intc-size = <128>;
140 reg = <0x48200000 0x1000>; 144 reg = <0x48200000 0x1000>;
141 }; 145 };
142 146
@@ -354,6 +358,10 @@
354 ti,hwmods = "mailbox"; 358 ti,hwmods = "mailbox";
355 ti,mbox-num-users = <4>; 359 ti,mbox-num-users = <4>;
356 ti,mbox-num-fifos = <8>; 360 ti,mbox-num-fifos = <8>;
361 mbox_wkupm3: wkup_m3 {
362 ti,mbox-tx = <0 0 0>;
363 ti,mbox-rx = <0 0 3>;
364 };
357 }; 365 };
358 366
359 timer1: timer@44e31000 { 367 timer1: timer@44e31000 {
@@ -696,6 +704,7 @@
696 */ 704 */
697 interrupts = <40 41 42 43>; 705 interrupts = <40 41 42 43>;
698 ranges; 706 ranges;
707 syscon = <&cm>;
699 status = "disabled"; 708 status = "disabled";
700 709
701 davinci_mdio: mdio@4a101000 { 710 davinci_mdio: mdio@4a101000 {
@@ -726,9 +735,8 @@
726 }; 735 };
727 736
728 ocmcram: ocmcram@40300000 { 737 ocmcram: ocmcram@40300000 {
729 compatible = "ti,am3352-ocmcram"; 738 compatible = "mmio-sram";
730 reg = <0x40300000 0x10000>; 739 reg = <0x40300000 0x10000>; /* 64k */
731 ti,hwmods = "ocmcram";
732 }; 740 };
733 741
734 wkup_m3: wkup_m3@44d00000 { 742 wkup_m3: wkup_m3@44d00000 {
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 9b3d2ba82f13..46660ffd2b65 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -58,10 +58,12 @@
58 }; 58 };
59 59
60 am43xx_pinmux: pinmux@44e10800 { 60 am43xx_pinmux: pinmux@44e10800 {
61 compatible = "pinctrl-single"; 61 compatible = "ti,am437-padconf", "pinctrl-single";
62 reg = <0x44e10800 0x31c>; 62 reg = <0x44e10800 0x31c>;
63 #address-cells = <1>; 63 #address-cells = <1>;
64 #size-cells = <0>; 64 #size-cells = <0>;
65 #interrupt-cells = <1>;
66 interrupt-controller;
65 pinctrl-single,register-width = <32>; 67 pinctrl-single,register-width = <32>;
66 pinctrl-single,function-mask = <0xffffffff>; 68 pinctrl-single,function-mask = <0xffffffff>;
67 }; 69 };
@@ -168,6 +170,10 @@
168 ti,hwmods = "mailbox"; 170 ti,hwmods = "mailbox";
169 ti,mbox-num-users = <4>; 171 ti,mbox-num-users = <4>;
170 ti,mbox-num-fifos = <8>; 172 ti,mbox-num-fifos = <8>;
173 mbox_wkupm3: wkup_m3 {
174 ti,mbox-tx = <0 0 0>;
175 ti,mbox-rx = <0 0 3>;
176 };
171 }; 177 };
172 178
173 timer1: timer@44e31000 { 179 timer1: timer@44e31000 {
@@ -804,7 +810,7 @@
804 810
805 usb1: usb@48390000 { 811 usb1: usb@48390000 {
806 compatible = "synopsys,dwc3"; 812 compatible = "synopsys,dwc3";
807 reg = <0x48390000 0x17000>; 813 reg = <0x48390000 0x10000>;
808 interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; 814 interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>;
809 phys = <&usb2_phy1>; 815 phys = <&usb2_phy1>;
810 phy-names = "usb2-phy"; 816 phy-names = "usb2-phy";
@@ -826,7 +832,7 @@
826 832
827 usb2: usb@483d0000 { 833 usb2: usb@483d0000 {
828 compatible = "synopsys,dwc3"; 834 compatible = "synopsys,dwc3";
829 reg = <0x483d0000 0x17000>; 835 reg = <0x483d0000 0x10000>;
830 interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; 836 interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
831 phys = <&usb2_phy2>; 837 phys = <&usb2_phy2>;
832 phy-names = "usb2-phy"; 838 phy-names = "usb2-phy";
@@ -885,6 +891,11 @@
885 clock-names = "fck"; 891 clock-names = "fck";
886 }; 892 };
887 }; 893 };
894
895 ocmcram: ocmcram@40300000 {
896 compatible = "mmio-sram";
897 reg = <0x40300000 0x40000>; /* 256k */
898 };
888 }; 899 };
889}; 900};
890 901
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
index 646a6eade788..e7ac47fa6615 100644
--- a/arch/arm/boot/dts/am437x-gp-evm.dts
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -260,7 +260,7 @@
260 status = "okay"; 260 status = "okay";
261 pinctrl-names = "default"; 261 pinctrl-names = "default";
262 pinctrl-0 = <&i2c0_pins>; 262 pinctrl-0 = <&i2c0_pins>;
263 clock-frequency = <400000>; 263 clock-frequency = <100000>;
264 264
265 tps65218: tps65218@24 { 265 tps65218: tps65218@24 {
266 reg = <0x24>; 266 reg = <0x24>;
@@ -424,7 +424,7 @@
424 ranges = <0 0 0 0x01000000>; /* minimum GPMC partition = 16MB */ 424 ranges = <0 0 0 0x01000000>; /* minimum GPMC partition = 16MB */
425 nand@0,0 { 425 nand@0,0 {
426 reg = <0 0 4>; /* device IO registers */ 426 reg = <0 0 4>; /* device IO registers */
427 ti,nand-ecc-opt = "bch8"; 427 ti,nand-ecc-opt = "bch16";
428 ti,elm-id = <&elm>; 428 ti,elm-id = <&elm>;
429 nand-bus-width = <8>; 429 nand-bus-width = <8>;
430 gpmc,device-width = <1>; 430 gpmc,device-width = <1>;
@@ -443,8 +443,6 @@
443 gpmc,rd-cycle-ns = <40>; 443 gpmc,rd-cycle-ns = <40>;
444 gpmc,wr-cycle-ns = <40>; 444 gpmc,wr-cycle-ns = <40>;
445 gpmc,wait-pin = <0>; 445 gpmc,wait-pin = <0>;
446 gpmc,wait-on-read;
447 gpmc,wait-on-write;
448 gpmc,bus-turnaround-ns = <0>; 446 gpmc,bus-turnaround-ns = <0>;
449 gpmc,cycle2cycle-delay-ns = <0>; 447 gpmc,cycle2cycle-delay-ns = <0>;
450 gpmc,clk-activation-ns = <0>; 448 gpmc,clk-activation-ns = <0>;
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
index ed7dd2395915..ac3e4859935f 100644
--- a/arch/arm/boot/dts/am43x-epos-evm.dts
+++ b/arch/arm/boot/dts/am43x-epos-evm.dts
@@ -435,13 +435,13 @@
435}; 435};
436 436
437&gpmc { 437&gpmc {
438 status = "okay"; 438 status = "okay"; /* Disable QSPI when enabling GPMC (NAND) */
439 pinctrl-names = "default"; 439 pinctrl-names = "default";
440 pinctrl-0 = <&nand_flash_x8>; 440 pinctrl-0 = <&nand_flash_x8>;
441 ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */ 441 ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */
442 nand@0,0 { 442 nand@0,0 {
443 reg = <0 0 0>; /* CS0, offset 0 */ 443 reg = <0 0 0>; /* CS0, offset 0 */
444 ti,nand-ecc-opt = "bch8"; 444 ti,nand-ecc-opt = "bch16";
445 ti,elm-id = <&elm>; 445 ti,elm-id = <&elm>;
446 nand-bus-width = <8>; 446 nand-bus-width = <8>;
447 gpmc,device-width = <1>; 447 gpmc,device-width = <1>;
@@ -459,8 +459,7 @@
459 gpmc,access-ns = <30>; /* tCEA + 4*/ 459 gpmc,access-ns = <30>; /* tCEA + 4*/
460 gpmc,rd-cycle-ns = <40>; 460 gpmc,rd-cycle-ns = <40>;
461 gpmc,wr-cycle-ns = <40>; 461 gpmc,wr-cycle-ns = <40>;
462 gpmc,wait-on-read = "true"; 462 gpmc,wait-pin = <0>;
463 gpmc,wait-on-write = "true";
464 gpmc,bus-turnaround-ns = <0>; 463 gpmc,bus-turnaround-ns = <0>;
465 gpmc,cycle2cycle-delay-ns = <0>; 464 gpmc,cycle2cycle-delay-ns = <0>;
466 gpmc,clk-activation-ns = <0>; 465 gpmc,clk-activation-ns = <0>;
@@ -557,7 +556,7 @@
557}; 556};
558 557
559&qspi { 558&qspi {
560 status = "okay"; 559 status = "disabled"; /* Disable GPMC (NAND) when enabling QSPI */
561 pinctrl-names = "default"; 560 pinctrl-names = "default";
562 pinctrl-0 = <&qspi1_default>; 561 pinctrl-0 = <&qspi1_default>;
563 562
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index 416f4e5a69c1..a495e5821ab8 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -43,6 +43,8 @@
43 }; 43 };
44 44
45 mdio { 45 mdio {
46 pinctrl-0 = <&mdio_pins>;
47 pinctrl-names = "default";
46 phy0: ethernet-phy@0 { 48 phy0: ethernet-phy@0 {
47 reg = <0>; 49 reg = <0>;
48 }; 50 };
@@ -53,11 +55,15 @@
53 }; 55 };
54 56
55 ethernet@70000 { 57 ethernet@70000 {
58 pinctrl-0 = <&ge0_rgmii_pins>;
59 pinctrl-names = "default";
56 status = "okay"; 60 status = "okay";
57 phy = <&phy0>; 61 phy = <&phy0>;
58 phy-mode = "rgmii-id"; 62 phy-mode = "rgmii-id";
59 }; 63 };
60 ethernet@74000 { 64 ethernet@74000 {
65 pinctrl-0 = <&ge1_rgmii_pins>;
66 pinctrl-names = "default";
61 status = "okay"; 67 status = "okay";
62 phy = <&phy1>; 68 phy = <&phy1>;
63 phy-mode = "rgmii-id"; 69 phy-mode = "rgmii-id";
diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts
index 097df7d8f0f6..2b6d24e0d1e8 100644
--- a/arch/arm/boot/dts/armada-370-mirabox.dts
+++ b/arch/arm/boot/dts/armada-370-mirabox.dts
@@ -91,6 +91,8 @@
91 }; 91 };
92 92
93 mdio { 93 mdio {
94 pinctrl-0 = <&mdio_pins>;
95 pinctrl-names = "default";
94 phy0: ethernet-phy@0 { 96 phy0: ethernet-phy@0 {
95 reg = <0>; 97 reg = <0>;
96 }; 98 };
@@ -100,11 +102,15 @@
100 }; 102 };
101 }; 103 };
102 ethernet@70000 { 104 ethernet@70000 {
105 pinctrl-0 = <&ge0_rgmii_pins>;
106 pinctrl-names = "default";
103 status = "okay"; 107 status = "okay";
104 phy = <&phy0>; 108 phy = <&phy0>;
105 phy-mode = "rgmii-id"; 109 phy-mode = "rgmii-id";
106 }; 110 };
107 ethernet@74000 { 111 ethernet@74000 {
112 pinctrl-0 = <&ge1_rgmii_pins>;
113 pinctrl-names = "default";
108 status = "okay"; 114 status = "okay";
109 phy = <&phy1>; 115 phy = <&phy1>;
110 phy-mode = "rgmii-id"; 116 phy-mode = "rgmii-id";
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn102.dts b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
index d6d572e5af32..3aebd93cc33c 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn102.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
@@ -101,12 +101,16 @@
101 }; 101 };
102 102
103 mdio { 103 mdio {
104 pinctrl-0 = <&mdio_pins>;
105 pinctrl-names = "default";
104 phy0: ethernet-phy@0 { /* Marvell 88E1318 */ 106 phy0: ethernet-phy@0 { /* Marvell 88E1318 */
105 reg = <0>; 107 reg = <0>;
106 }; 108 };
107 }; 109 };
108 110
109 ethernet@74000 { 111 ethernet@74000 {
112 pinctrl-0 = <&ge1_rgmii_pins>;
113 pinctrl-names = "default";
110 status = "okay"; 114 status = "okay";
111 phy = <&phy0>; 115 phy = <&phy0>;
112 phy-mode = "rgmii-id"; 116 phy-mode = "rgmii-id";
@@ -122,7 +126,7 @@
122 status = "okay"; 126 status = "okay";
123 127
124 isl12057: isl12057@68 { 128 isl12057: isl12057@68 {
125 compatible = "isl,isl12057"; 129 compatible = "isil,isl12057";
126 reg = <0x68>; 130 reg = <0x68>;
127 }; 131 };
128 132
@@ -143,6 +147,10 @@
143 marvell,nand-enable-arbiter; 147 marvell,nand-enable-arbiter;
144 nand-on-flash-bbt; 148 nand-on-flash-bbt;
145 149
150 /* Use Hardware BCH ECC */
151 nand-ecc-strength = <4>;
152 nand-ecc-step-size = <512>;
153
146 partition@0 { 154 partition@0 {
147 label = "u-boot"; 155 label = "u-boot";
148 reg = <0x0000000 0x180000>; /* 1.5MB */ 156 reg = <0x0000000 0x180000>; /* 1.5MB */
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
index c5fe8b5dcdc7..c2f414bb9aba 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn104.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
@@ -86,6 +86,8 @@
86 }; 86 };
87 87
88 mdio { 88 mdio {
89 pinctrl-0 = <&mdio_pins>;
90 pinctrl-names = "default";
89 phy0: ethernet-phy@0 { /* Marvell 88E1318 */ 91 phy0: ethernet-phy@0 { /* Marvell 88E1318 */
90 reg = <0>; 92 reg = <0>;
91 }; 93 };
@@ -96,12 +98,16 @@
96 }; 98 };
97 99
98 ethernet@70000 { 100 ethernet@70000 {
101 pinctrl-0 = <&ge0_rgmii_pins>;
102 pinctrl-names = "default";
99 status = "okay"; 103 status = "okay";
100 phy = <&phy0>; 104 phy = <&phy0>;
101 phy-mode = "rgmii-id"; 105 phy-mode = "rgmii-id";
102 }; 106 };
103 107
104 ethernet@74000 { 108 ethernet@74000 {
109 pinctrl-0 = <&ge1_rgmii_pins>;
110 pinctrl-names = "default";
105 status = "okay"; 111 status = "okay";
106 phy = <&phy1>; 112 phy = <&phy1>;
107 phy-mode = "rgmii-id"; 113 phy-mode = "rgmii-id";
@@ -117,7 +123,7 @@
117 status = "okay"; 123 status = "okay";
118 124
119 isl12057: isl12057@68 { 125 isl12057: isl12057@68 {
120 compatible = "isl,isl12057"; 126 compatible = "isil,isl12057";
121 reg = <0x68>; 127 reg = <0x68>;
122 }; 128 };
123 129
@@ -145,6 +151,10 @@
145 marvell,nand-enable-arbiter; 151 marvell,nand-enable-arbiter;
146 nand-on-flash-bbt; 152 nand-on-flash-bbt;
147 153
154 /* Use Hardware BCH ECC */
155 nand-ecc-strength = <4>;
156 nand-ecc-step-size = <512>;
157
148 partition@0 { 158 partition@0 {
149 label = "u-boot"; 159 label = "u-boot";
150 reg = <0x0000000 0x180000>; /* 1.5MB */ 160 reg = <0x0000000 0x180000>; /* 1.5MB */
diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
index 4169f4096ea3..f57a8f841498 100644
--- a/arch/arm/boot/dts/armada-370-rd.dts
+++ b/arch/arm/boot/dts/armada-370-rd.dts
@@ -9,6 +9,15 @@
9 * This file is licensed under the terms of the GNU General Public 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 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 *
13 * Note: this Device Tree assumes that the bootloader has remapped the
14 * internal registers to 0xf1000000 (instead of the default
15 * 0xd0000000). The 0xf1000000 is the default used by the recent,
16 * DT-capable, U-Boot bootloaders provided by Marvell. Some earlier
17 * boards were delivered with an older version of the bootloader that
18 * left internal registers mapped at 0xd0000000. If you are in this
19 * situation, you should either update your bootloader (preferred
20 * solution) or the below Device Tree should be adjusted.
12 */ 21 */
13 22
14/dts-v1/; 23/dts-v1/;
@@ -30,7 +39,7 @@
30 }; 39 };
31 40
32 soc { 41 soc {
33 ranges = <MBUS_ID(0xf0, 0x01) 0 0xd0000000 0x100000 42 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
34 MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000>; 43 MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000>;
35 44
36 pcie-controller { 45 pcie-controller {
@@ -50,6 +59,18 @@
50 }; 59 };
51 60
52 internal-regs { 61 internal-regs {
62 pinctrl {
63 fan_pins: fan-pins {
64 marvell,pins = "mpp8";
65 marvell,function = "gpio";
66 };
67
68 led_pins: led-pins {
69 marvell,pins = "mpp32";
70 marvell,function = "gpio";
71 };
72 };
73
53 serial@12000 { 74 serial@12000 {
54 status = "okay"; 75 status = "okay";
55 }; 76 };
@@ -59,6 +80,8 @@
59 }; 80 };
60 81
61 mdio { 82 mdio {
83 pinctrl-0 = <&mdio_pins>;
84 pinctrl-names = "default";
62 phy0: ethernet-phy@0 { 85 phy0: ethernet-phy@0 {
63 reg = <0>; 86 reg = <0>;
64 }; 87 };
@@ -74,6 +97,8 @@
74 phy-mode = "sgmii"; 97 phy-mode = "sgmii";
75 }; 98 };
76 ethernet@74000 { 99 ethernet@74000 {
100 pinctrl-0 = <&ge1_rgmii_pins>;
101 pinctrl-names = "default";
77 status = "okay"; 102 status = "okay";
78 phy = <&phy1>; 103 phy = <&phy1>;
79 phy-mode = "rgmii-id"; 104 phy-mode = "rgmii-id";
@@ -106,6 +131,26 @@
106 }; 131 };
107 }; 132 };
108 133
134 gpio-fan {
135 compatible = "gpio-fan";
136 gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
137 gpio-fan,speed-map = <0 0 3000 1>;
138 pinctrl-0 = <&fan_pins>;
139 pinctrl-names = "default";
140 };
141
142 gpio_leds {
143 compatible = "gpio-leds";
144 pinctrl-names = "default";
145 pinctrl-0 = <&led_pins>;
146
147 sw_led {
148 label = "370rd:green:sw";
149 gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
150 default-state = "keep";
151 };
152 };
153
109 nand@d0000 { 154 nand@d0000 {
110 status = "okay"; 155 status = "okay";
111 num-cs = <1>; 156 num-cs = <1>;
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 23227e0027ec..83286ec9702c 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -110,7 +110,7 @@
110 }; 110 };
111 111
112 spi0: spi@10600 { 112 spi0: spi@10600 {
113 compatible = "marvell,orion-spi"; 113 compatible = "marvell,armada-370-spi", "marvell,orion-spi";
114 reg = <0x10600 0x28>; 114 reg = <0x10600 0x28>;
115 #address-cells = <1>; 115 #address-cells = <1>;
116 #size-cells = <0>; 116 #size-cells = <0>;
@@ -121,7 +121,7 @@
121 }; 121 };
122 122
123 spi1: spi@10680 { 123 spi1: spi@10680 {
124 compatible = "marvell,orion-spi"; 124 compatible = "marvell,armada-370-spi", "marvell,orion-spi";
125 reg = <0x10680 0x28>; 125 reg = <0x10680 0x28>;
126 #address-cells = <1>; 126 #address-cells = <1>;
127 #size-cells = <0>; 127 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index 21b588b6f6bd..6b3c23b1e138 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -151,6 +151,25 @@
151 "mpp62", "mpp60", "mpp58"; 151 "mpp62", "mpp60", "mpp58";
152 marvell,function = "audio"; 152 marvell,function = "audio";
153 }; 153 };
154
155 mdio_pins: mdio-pins {
156 marvell,pins = "mpp17", "mpp18";
157 marvell,function = "ge";
158 };
159
160 ge0_rgmii_pins: ge0-rgmii-pins {
161 marvell,pins = "mpp5", "mpp6", "mpp7", "mpp8",
162 "mpp9", "mpp10", "mpp11", "mpp12",
163 "mpp13", "mpp14", "mpp15", "mpp16";
164 marvell,function = "ge0";
165 };
166
167 ge1_rgmii_pins: ge1-rgmii-pins {
168 marvell,pins = "mpp19", "mpp20", "mpp21", "mpp22",
169 "mpp23", "mpp24", "mpp25", "mpp26",
170 "mpp27", "mpp28", "mpp29", "mpp30";
171 marvell,function = "ge1";
172 };
154 }; 173 };
155 174
156 gpio0: gpio@18100 { 175 gpio0: gpio@18100 {
@@ -206,6 +225,10 @@
206 status = "okay"; 225 status = "okay";
207 }; 226 };
208 227
228 sscg@18330 {
229 reg = <0x18330 0x4>;
230 };
231
209 interrupt-controller@20000 { 232 interrupt-controller@20000 {
210 reg = <0x20a00 0x1d0>, <0x21870 0x58>; 233 reg = <0x20a00 0x1d0>, <0x21870 0x58>;
211 }; 234 };
diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index c1e49e7bf0fa..de6571445cef 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -185,6 +185,12 @@
185 }; 185 };
186 }; 186 };
187 187
188 rtc@10300 {
189 compatible = "marvell,orion-rtc";
190 reg = <0x10300 0x20>;
191 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
192 };
193
188 spi0: spi@10600 { 194 spi0: spi@10600 {
189 compatible = "marvell,orion-spi"; 195 compatible = "marvell,orion-spi";
190 reg = <0x10600 0x50>; 196 reg = <0x10600 0x50>;
diff --git a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
index 0cf999abc4ed..7d8f32873e82 100644
--- a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
+++ b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
@@ -174,7 +174,7 @@
174 status = "okay"; 174 status = "okay";
175 175
176 isl12057: isl12057@68 { 176 isl12057: isl12057@68 {
177 compatible = "isl,isl12057"; 177 compatible = "isil,isl12057";
178 reg = <0x68>; 178 reg = <0x68>;
179 }; 179 };
180 180
@@ -223,6 +223,10 @@
223 marvell,nand-enable-arbiter; 223 marvell,nand-enable-arbiter;
224 nand-on-flash-bbt; 224 nand-on-flash-bbt;
225 225
226 /* Use Hardware BCH ECC */
227 nand-ecc-strength = <4>;
228 nand-ecc-step-size = <512>;
229
226 partition@0 { 230 partition@0 {
227 label = "u-boot"; 231 label = "u-boot";
228 reg = <0x0000000 0x180000>; /* 1.5MB */ 232 reg = <0x0000000 0x180000>; /* 1.5MB */
diff --git a/arch/arm/boot/dts/at91-sama5d4ek.dts b/arch/arm/boot/dts/at91-sama5d4ek.dts
new file mode 100644
index 000000000000..b5b84006469e
--- /dev/null
+++ b/arch/arm/boot/dts/at91-sama5d4ek.dts
@@ -0,0 +1,260 @@
1/*
2 * at91-sama5d4ek.dts - Device Tree file for SAMA5D4 Evaluation Kit
3 *
4 * Copyright (C) 2014 Atmel,
5 * 2014 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * This file is dual-licensed: you can use it either under the terms
8 * of the GPL or the X11 license, at your option. Note that this dual
9 * licensing only applies to this file, and not this project as a
10 * whole.
11 *
12 * a) This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * Or, alternatively,
23 *
24 * b) Permission is hereby granted, free of charge, to any person
25 * obtaining a copy of this software and associated documentation
26 * files (the "Software"), to deal in the Software without
27 * restriction, including without limitation the rights to use,
28 * copy, modify, merge, publish, distribute, sublicense, and/or
29 * sell copies of the Software, and to permit persons to whom the
30 * Software is furnished to do so, subject to the following
31 * conditions:
32 *
33 * The above copyright notice and this permission notice shall be
34 * included in all copies or substantial portions of the Software.
35 *
36 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43 * OTHER DEALINGS IN THE SOFTWARE.
44 */
45/dts-v1/;
46#include "sama5d4.dtsi"
47
48/ {
49 model = "Atmel SAMA5D4-EK";
50 compatible = "atmel,sama5d4ek", "atmel,sama5d4", "atmel,sama5";
51
52 chosen {
53 bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk";
54 };
55
56 memory {
57 reg = <0x20000000 0x20000000>;
58 };
59
60 clocks {
61 #address-cells = <1>;
62 #size-cells = <1>;
63 ranges;
64
65 main_clock: clock@0 {
66 compatible = "atmel,osc", "fixed-clock";
67 clock-frequency = <12000000>;
68 };
69
70 slow_xtal {
71 clock-frequency = <32768>;
72 };
73
74 main_xtal {
75 clock-frequency = <12000000>;
76 };
77 };
78
79 ahb {
80 apb {
81 lcd_bus@f0000000 {
82 status = "okay";
83
84 lcd@f0000000 {
85 status = "okay";
86 };
87
88 lcdovl1@f0000140 {
89 status = "okay";
90 };
91
92 lcdovl2@f0000240 {
93 status = "okay";
94 };
95
96 lcdheo1@f0000340 {
97 status = "okay";
98 };
99 };
100
101 adc0: adc@fc034000 {
102 /* The vref depends on JP22 of EK. If connect 1-2 then use 3.3V. connect 2-3 use 3.0V */
103 atmel,adc-vref = <3300>;
104 /*atmel,adc-ts-wires = <4>;*/ /* Set up ADC touch screen */
105 status = "okay"; /* Enable ADC IIO support */
106 };
107
108 mmc0: mmc@f8000000 {
109 pinctrl-names = "default";
110 pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_cd>;
111 slot@1 {
112 reg = <1>;
113 bus-width = <4>;
114 cd-gpios = <&pioE 5 0>;
115 };
116 };
117
118 spi0: spi@f8010000 {
119 cs-gpios = <&pioC 3 0>, <0>, <0>, <0>;
120 status = "okay";
121 m25p80@0 {
122 compatible = "atmel,at25df321a";
123 spi-max-frequency = <50000000>;
124 reg = <0>;
125 };
126 };
127
128 i2c0: i2c@f8014000 {
129 status = "okay";
130 };
131
132 macb0: ethernet@f8020000 {
133 phy-mode = "rmii";
134 status = "okay";
135 };
136
137 mmc1: mmc@fc000000 {
138 pinctrl-names = "default";
139 pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3 &pinctrl_mmc1_cd>;
140 status = "okay";
141 slot@0 {
142 reg = <0>;
143 bus-width = <4>;
144 cd-gpios = <&pioE 6 0>;
145 };
146 };
147
148 usart2: serial@fc008000 {
149 status = "okay";
150 };
151
152 usart3: serial@fc00c000 {
153 status = "okay";
154 };
155
156 usart4: serial@fc010000 {
157 status = "okay";
158 };
159
160 watchdog@fc068640 {
161 status = "okay";
162 };
163
164 pinctrl@fc06a000 {
165 board {
166 pinctrl_mmc0_cd: mmc0_cd {
167 atmel,pins =
168 <AT91_PIOE 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
169 };
170 pinctrl_mmc1_cd: mmc1_cd {
171 atmel,pins =
172 <AT91_PIOE 6 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
173 };
174 pinctrl_usba_vbus: usba_vbus {
175 atmel,pins =
176 <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
177 };
178 pinctrl_key_gpio: key_gpio_0 {
179 atmel,pins =
180 <AT91_PIOE 13 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PE13 gpio */
181 };
182 };
183 };
184 };
185
186 usb0: gadget@00400000 {
187 atmel,vbus-gpio = <&pioE 31 GPIO_ACTIVE_HIGH>;
188 pinctrl-names = "default";
189 pinctrl-0 = <&pinctrl_usba_vbus>;
190 status = "okay";
191 };
192
193 usb1: ohci@00500000 {
194 num-ports = <3>;
195 atmel,vbus-gpio = <0 /* &pioE 10 GPIO_ACTIVE_LOW */
196 &pioE 11 GPIO_ACTIVE_LOW
197 &pioE 12 GPIO_ACTIVE_LOW
198 >;
199 status = "okay";
200 };
201
202 usb2: ehci@00600000 {
203 status = "okay";
204 };
205
206 nand0: nand@80000000 {
207 nand-bus-width = <8>;
208 nand-ecc-mode = "hw";
209 nand-on-flash-bbt;
210 atmel,has-pmecc;
211 status = "okay";
212
213 at91bootstrap@0 {
214 label = "at91bootstrap";
215 reg = <0x0 0x40000>;
216 };
217
218 bootloader@40000 {
219 label = "bootloader";
220 reg = <0x40000 0x80000>;
221 };
222
223 bootloaderenv@c0000 {
224 label = "bootloader env";
225 reg = <0xc0000 0xc0000>;
226 };
227
228 dtb@180000 {
229 label = "device tree";
230 reg = <0x180000 0x80000>;
231 };
232
233 kernel@200000 {
234 label = "kernel";
235 reg = <0x200000 0x600000>;
236 };
237
238 rootfs@800000 {
239 label = "rootfs";
240 reg = <0x800000 0x0f800000>;
241 };
242 };
243 };
244
245 gpio_keys {
246 compatible = "gpio-keys";
247 #address-cells = <1>;
248 #size-cells = <0>;
249
250 pinctrl-names = "default";
251 pinctrl-0 = <&pinctrl_key_gpio>;
252
253 pb_user1 {
254 label = "pb_user1";
255 gpios = <&pioE 13 GPIO_ACTIVE_HIGH>;
256 linux,code = <0x100>;
257 gpio-key,wakeup;
258 };
259 };
260};
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index 65ccf564b9a5..6c97d4af61ee 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -149,7 +149,7 @@
149 usb: usbck { 149 usb: usbck {
150 compatible = "atmel,at91rm9200-clk-usb"; 150 compatible = "atmel,at91rm9200-clk-usb";
151 #clock-cells = <0>; 151 #clock-cells = <0>;
152 atmel,clk-divisors = <1 2>; 152 atmel,clk-divisors = <1 2 0 0>;
153 clocks = <&pllb>; 153 clocks = <&pllb>;
154 }; 154 };
155 155
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index bb23c2d33cf8..d68b3c4862bc 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -345,10 +345,14 @@
345 }; 345 };
346 }; 346 };
347 347
348 ramc: ramc@ffffe200 { 348 ramc0: ramc@ffffe200 {
349 compatible = "atmel,at91sam9260-sdramc"; 349 compatible = "atmel,at91sam9260-sdramc";
350 reg = <0xffffe200 0x200 350 reg = <0xffffe200 0x200>;
351 0xffffe800 0x200>; 351 };
352
353 ramc1: ramc@ffffe800 {
354 compatible = "atmel,at91sam9260-sdramc";
355 reg = <0xffffe800 0x200>;
352 }; 356 };
353 357
354 pit: timer@fffffd30 { 358 pit: timer@fffffd30 {
@@ -834,6 +838,7 @@
834 compatible = "atmel,hsmci"; 838 compatible = "atmel,hsmci";
835 reg = <0xfff80000 0x600>; 839 reg = <0xfff80000 0x600>;
836 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>; 840 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>;
841 pinctrl-names = "default";
837 #address-cells = <1>; 842 #address-cells = <1>;
838 #size-cells = <0>; 843 #size-cells = <0>;
839 clocks = <&mci0_clk>; 844 clocks = <&mci0_clk>;
@@ -845,6 +850,7 @@
845 compatible = "atmel,hsmci"; 850 compatible = "atmel,hsmci";
846 reg = <0xfff84000 0x600>; 851 reg = <0xfff84000 0x600>;
847 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>; 852 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>;
853 pinctrl-names = "default";
848 #address-cells = <1>; 854 #address-cells = <1>;
849 #size-cells = <0>; 855 #size-cells = <0>;
850 clocks = <&mci1_clk>; 856 clocks = <&mci1_clk>;
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index 31f7652612fc..a50ee587a7af 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -22,6 +22,10 @@
22 compatible = "atmel,at91sam9g20-i2c"; 22 compatible = "atmel,at91sam9g20-i2c";
23 }; 23 };
24 24
25 ssc0: ssc@fffbc000 {
26 compatible = "atmel,at91sam9rl-ssc";
27 };
28
25 adc0: adc@fffe0000 { 29 adc0: adc@fffe0000 {
26 atmel,adc-startup-time = <40>; 30 atmel,adc-startup-time = <40>;
27 }; 31 };
@@ -40,6 +44,7 @@
40 }; 44 };
41 45
42 pllb: pllbck { 46 pllb: pllbck {
47 compatible = "atmel,at91sam9g20-clk-pllb";
43 atmel,clk-input-range = <2000000 32000000>; 48 atmel,clk-input-range = <2000000 32000000>;
44 atmel,pll-clk-output-ranges = <30000000 100000000 0 0>; 49 atmel,pll-clk-output-ranges = <30000000 100000000 0 0>;
45 }; 50 };
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 932a669156af..d3f65130a1f8 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -96,8 +96,14 @@
96 96
97 ramc0: ramc@ffffe400 { 97 ramc0: ramc@ffffe400 {
98 compatible = "atmel,at91sam9g45-ddramc"; 98 compatible = "atmel,at91sam9g45-ddramc";
99 reg = <0xffffe400 0x200 99 reg = <0xffffe400 0x200>;
100 0xffffe600 0x200>; 100 clocks = <&ddrck>;
101 clock-names = "ddrck";
102 };
103
104 ramc1: ramc@ffffe600 {
105 compatible = "atmel,at91sam9g45-ddramc";
106 reg = <0xffffe600 0x200>;
101 clocks = <&ddrck>; 107 clocks = <&ddrck>;
102 clock-names = "ddrck"; 108 clock-names = "ddrck";
103 }; 109 };
@@ -159,7 +165,7 @@
159 compatible = "atmel,at91rm9200-clk-master"; 165 compatible = "atmel,at91rm9200-clk-master";
160 #clock-cells = <0>; 166 #clock-cells = <0>;
161 interrupts-extended = <&pmc AT91_PMC_MCKRDY>; 167 interrupts-extended = <&pmc AT91_PMC_MCKRDY>;
162 clocks = <&slow_xtal>, <&main>, <&plladiv>, <&utmi>; 168 clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>;
163 atmel,clk-output-range = <0 133333333>; 169 atmel,clk-output-range = <0 133333333>;
164 atmel,clk-divisors = <1 2 4 3>; 170 atmel,clk-divisors = <1 2 4 3>;
165 }; 171 };
@@ -175,7 +181,7 @@
175 #address-cells = <1>; 181 #address-cells = <1>;
176 #size-cells = <0>; 182 #size-cells = <0>;
177 interrupt-parent = <&pmc>; 183 interrupt-parent = <&pmc>;
178 clocks = <&slow_xtal>, <&main>, <&plladiv>, <&utmi>, <&mck>; 184 clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>;
179 185
180 prog0: prog0 { 186 prog0: prog0 {
181 #clock-cells = <0>; 187 #clock-cells = <0>;
@@ -1159,6 +1165,39 @@
1159 atmel,can-isoc; 1165 atmel,can-isoc;
1160 }; 1166 };
1161 }; 1167 };
1168
1169 sckc@fffffd50 {
1170 compatible = "atmel,at91sam9x5-sckc";
1171 reg = <0xfffffd50 0x4>;
1172
1173 slow_osc: slow_osc {
1174 compatible = "atmel,at91sam9x5-clk-slow-osc";
1175 #clock-cells = <0>;
1176 atmel,startup-time-usec = <1200000>;
1177 clocks = <&slow_xtal>;
1178 };
1179
1180 slow_rc_osc: slow_rc_osc {
1181 compatible = "atmel,at91sam9x5-clk-slow-rc-osc";
1182 #clock-cells = <0>;
1183 atmel,startup-time-usec = <75>;
1184 clock-frequency = <32768>;
1185 clock-accuracy = <50000000>;
1186 };
1187
1188 clk32k: slck {
1189 compatible = "atmel,at91sam9x5-clk-slow";
1190 #clock-cells = <0>;
1191 clocks = <&slow_rc_osc &slow_osc>;
1192 };
1193 };
1194
1195 rtc@fffffdb0 {
1196 compatible = "atmel,at91rm9200-rtc";
1197 reg = <0xfffffdb0 0x30>;
1198 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
1199 status = "disabled";
1200 };
1162 }; 1201 };
1163 1202
1164 fb0: fb@0x00500000 { 1203 fb0: fb@0x00500000 {
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 96ccc7de4f0a..d8dd22651090 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -160,6 +160,10 @@
160 pinctrl-names = "default"; 160 pinctrl-names = "default";
161 pinctrl-0 = <&pinctrl_pwm_leds>; 161 pinctrl-0 = <&pinctrl_pwm_leds>;
162 }; 162 };
163
164 rtc@fffffdb0 {
165 status = "okay";
166 };
163 }; 167 };
164 168
165 fb0: fb@0x00500000 { 169 fb0: fb@0x00500000 {
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 2bfac310dbec..68eb9aded164 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -87,6 +87,8 @@
87 ramc0: ramc@ffffe800 { 87 ramc0: ramc@ffffe800 {
88 compatible = "atmel,at91sam9g45-ddramc"; 88 compatible = "atmel,at91sam9g45-ddramc";
89 reg = <0xffffe800 0x200>; 89 reg = <0xffffe800 0x200>;
90 clocks = <&ddrck>;
91 clock-names = "ddrck";
90 }; 92 };
91 93
92 pmc: pmc@fffffc00 { 94 pmc: pmc@fffffc00 {
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index 83d723711ae1..13bb24ea971a 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -136,6 +136,8 @@
136 }; 136 };
137 137
138 usb0: ohci@00500000 { 138 usb0: ohci@00500000 {
139 num-ports = <1>;
140 atmel,vbus-gpio = <&pioB 7 GPIO_ACTIVE_LOW>;
139 status = "okay"; 141 status = "okay";
140 }; 142 };
141 }; 143 };
diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi
index ab56c8b81dfa..f0b4352650ed 100644
--- a/arch/arm/boot/dts/at91sam9rl.dtsi
+++ b/arch/arm/boot/dts/at91sam9rl.dtsi
@@ -204,7 +204,7 @@
204 }; 204 };
205 205
206 ssc0: ssc@fffc0000 { 206 ssc0: ssc@fffc0000 {
207 compatible = "atmel,at91rm9200-ssc"; 207 compatible = "atmel,at91sam9rl-ssc";
208 reg = <0xfffc0000 0x4000>; 208 reg = <0xfffc0000 0x4000>;
209 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>; 209 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
210 pinctrl-names = "default"; 210 pinctrl-names = "default";
@@ -213,7 +213,7 @@
213 }; 213 };
214 214
215 ssc1: ssc@fffc4000 { 215 ssc1: ssc@fffc4000 {
216 compatible = "atmel,at91rm9200-ssc"; 216 compatible = "atmel,at91sam9rl-ssc";
217 reg = <0xfffc4000 0x4000>; 217 reg = <0xfffc4000 0x4000>;
218 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>; 218 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>;
219 pinctrl-names = "default"; 219 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index e1a5c70b885c..726274f7959b 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -95,6 +95,8 @@
95 ramc0: ramc@ffffe800 { 95 ramc0: ramc@ffffe800 {
96 compatible = "atmel,at91sam9g45-ddramc"; 96 compatible = "atmel,at91sam9g45-ddramc";
97 reg = <0xffffe800 0x200>; 97 reg = <0xffffe800 0x200>;
98 clocks = <&ddrck>;
99 clock-names = "ddrck";
98 }; 100 };
99 101
100 pmc: pmc@fffffc00 { 102 pmc: pmc@fffffc00 {
@@ -966,7 +968,7 @@
966 adc0: adc@f804c000 { 968 adc0: adc@f804c000 {
967 #address-cells = <1>; 969 #address-cells = <1>;
968 #size-cells = <0>; 970 #size-cells = <0>;
969 compatible = "atmel,at91sam9260-adc"; 971 compatible = "atmel,at91sam9x5-adc";
970 reg = <0xf804c000 0x100>; 972 reg = <0xf804c000 0x100>;
971 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 0>; 973 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 0>;
972 clocks = <&adc_clk>, 974 clocks = <&adc_clk>,
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index 2a3b1c1313a0..58a0d60b95f1 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -23,7 +23,7 @@
23 23
24&gpio { 24&gpio {
25 pinctrl-names = "default"; 25 pinctrl-names = "default";
26 pinctrl-0 = <&gpioout &alt0 &alt3>; 26 pinctrl-0 = <&gpioout &alt0 &alt2 &alt3>;
27 27
28 gpioout: gpioout { 28 gpioout: gpioout {
29 brcm,pins = <6>; 29 brcm,pins = <6>;
@@ -39,6 +39,12 @@
39 brcm,pins = <48 49 50 51 52 53>; 39 brcm,pins = <48 49 50 51 52 53>;
40 brcm,function = <7>; /* alt3 */ 40 brcm,function = <7>; /* alt3 */
41 }; 41 };
42
43 /* I2S interface */
44 alt2: alt2 {
45 brcm,pins = <28 29 30 31>;
46 brcm,function = <6>; /* alt2 */
47 };
42}; 48};
43 49
44&i2c0 { 50&i2c0 {
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index b8473c43e888..3342cb1407bc 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -99,6 +99,7 @@
99 dmas = <&dma 2>, 99 dmas = <&dma 2>,
100 <&dma 3>; 100 <&dma 3>;
101 dma-names = "tx", "rx"; 101 dma-names = "tx", "rx";
102 status = "disabled";
102 }; 103 };
103 104
104 spi: spi@7e204000 { 105 spi: spi@7e204000 {
diff --git a/arch/arm/boot/dts/bcm63138.dtsi b/arch/arm/boot/dts/bcm63138.dtsi
new file mode 100644
index 000000000000..f3bb2dd6269e
--- /dev/null
+++ b/arch/arm/boot/dts/bcm63138.dtsi
@@ -0,0 +1,134 @@
1/*
2 * Broadcom BCM63138 DSL SoCs Device Tree
3 */
4
5#include <dt-bindings/interrupt-controller/arm-gic.h>
6#include <dt-bindings/interrupt-controller/irq.h>
7
8#include "skeleton.dtsi"
9
10/ {
11 compatible = "brcm,bcm63138";
12 model = "Broadcom BCM63138 DSL SoC";
13 interrupt-parent = <&gic>;
14
15 aliases {
16 uart0 = &serial0;
17 uart1 = &serial1;
18 };
19
20 cpus {
21 #address-cells = <1>;
22 #size-cells = <0>;
23
24 cpu@0 {
25 device_type = "cpu";
26 compatible = "arm,cortex-a9";
27 next-level-cache = <&L2>;
28 reg = <0>;
29 };
30
31 cpu@1 {
32 device_type = "cpu";
33 compatible = "arm,cortex-a9";
34 next-level-cache = <&L2>;
35 reg = <1>;
36 };
37 };
38
39 clocks {
40 #address-cells = <1>;
41 #size-cells = <0>;
42
43 arm_timer_clk: arm_timer_clk {
44 #clock-cells = <0>;
45 compatible = "fixed-clock";
46 clock-frequency = <500000000>;
47 };
48
49 periph_clk: periph_clk {
50 #clock-cells = <0>;
51 compatible = "fixed-clock";
52 clock-frequency = <50000000>;
53 clock-output-names = "periph";
54 };
55 };
56
57 /* ARM bus */
58 axi@80000000 {
59 compatible = "simple-bus";
60 ranges = <0 0x80000000 0x784000>;
61 #address-cells = <1>;
62 #size-cells = <1>;
63
64 L2: cache-controller@1d000 {
65 compatible = "arm,pl310-cache";
66 reg = <0x1d000 0x1000>;
67 cache-unified;
68 cache-level = <2>;
69 cache-sets = <16>;
70 cache-size = <0x80000>;
71 interrupts = <GIC_PPI 0 IRQ_TYPE_LEVEL_HIGH>;
72 };
73
74 scu: scu@1e000 {
75 compatible = "arm,cortex-a9-scu";
76 reg = <0x1e000 0x100>;
77 };
78
79 gic: interrupt-controller@1e100 {
80 compatible = "arm,cortex-a9-gic";
81 reg = <0x1f000 0x1000
82 0x1e100 0x100>;
83 #interrupt-cells = <3>;
84 #address-cells = <0>;
85 interrupt-controller;
86 };
87
88 global_timer: timer@1e200 {
89 compatible = "arm,cortex-a9-global-timer";
90 reg = <0x1e200 0x20>;
91 interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
92 clocks = <&arm_timer_clk>;
93 };
94
95 local_timer: local-timer@1e600 {
96 compatible = "arm,cortex-a9-twd-timer";
97 reg = <0x1e600 0x20>;
98 interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
99 clocks = <&arm_timer_clk>;
100 };
101
102 twd_watchdog: watchdog@1e620 {
103 compatible = "arm,cortex-a9-twd-wdt";
104 reg = <0x1e620 0x20>;
105 interupts = <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>;
106 };
107 };
108
109 /* Legacy UBUS base */
110 ubus@fffe8000 {
111 compatible = "simple-bus";
112 #address-cells = <1>;
113 #size-cells = <1>;
114 ranges = <0 0xfffe8000 0x8100>;
115
116 serial0: serial@600 {
117 compatible = "brcm,bcm6345-uart";
118 reg = <0x600 0x1b>;
119 interrupts = <GIC_SPI 32 0>;
120 clocks = <&periph_clk>;
121 clock-names = "periph";
122 status = "disabled";
123 };
124
125 serial1: serial@620 {
126 compatible = "brcm,bcm6345-uart";
127 reg = <0x620 0x1b>;
128 interrupts = <GIC_SPI 33 0>;
129 clocks = <&periph_clk>;
130 clock-names = "periph";
131 status = "disabled";
132 };
133 };
134};
diff --git a/arch/arm/boot/dts/bcm963138dvt.dts b/arch/arm/boot/dts/bcm963138dvt.dts
new file mode 100644
index 000000000000..69c93395ecd2
--- /dev/null
+++ b/arch/arm/boot/dts/bcm963138dvt.dts
@@ -0,0 +1,30 @@
1/*
2 * Broadcom BCM63138 Reference Board DTS
3 */
4
5/dts-v1/;
6
7#include "bcm63138.dtsi"
8
9/ {
10 compatible = "brcm,BCM963138DVT", "brcm,bcm63138";
11 model = "Broadcom BCM963138DVT";
12
13 chosen {
14 bootargs = "console=ttyS0,115200";
15 stdout-path = &serial0;
16 };
17
18 memory {
19 reg = <0x0 0x08000000>;
20 };
21
22};
23
24&serial0 {
25 status = "okay";
26};
27
28&serial1 {
29 status = "okay";
30};
diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
index a357ce02a64e..ea1f99b8eed6 100644
--- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
+++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
@@ -45,3 +45,7 @@
45&uart0 { 45&uart0 {
46 status = "okay"; 46 status = "okay";
47}; 47};
48
49&eth0 {
50 status = "okay";
51};
diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index 400c40fceccc..891d56b03922 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -114,6 +114,23 @@
114 #interrupt-cells = <3>; 114 #interrupt-cells = <3>;
115 }; 115 };
116 116
117 eth0: ethernet@b90000 {
118 compatible = "marvell,pxa168-eth";
119 reg = <0xb90000 0x10000>;
120 clocks = <&chip CLKID_GETH0>;
121 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
122 /* set by bootloader */
123 local-mac-address = [00 00 00 00 00 00];
124 #address-cells = <1>;
125 #size-cells = <0>;
126 phy-handle = <&ethphy0>;
127 status = "disabled";
128
129 ethphy0: ethernet-phy@0 {
130 reg = <0>;
131 };
132 };
133
117 cpu-ctrl@dd0000 { 134 cpu-ctrl@dd0000 {
118 compatible = "marvell,berlin-cpu-ctrl"; 135 compatible = "marvell,berlin-cpu-ctrl";
119 reg = <0xdd0000 0x10000>; 136 reg = <0xdd0000 0x10000>;
diff --git a/arch/arm/boot/dts/cros-adc-thermistors.dtsi b/arch/arm/boot/dts/cros-adc-thermistors.dtsi
new file mode 100644
index 000000000000..acd4fe1833f2
--- /dev/null
+++ b/arch/arm/boot/dts/cros-adc-thermistors.dtsi
@@ -0,0 +1,44 @@
1/*
2 * Thermistor dts fragment for devices that use Thermistors as
3 * children of the IIO based ADC.
4 *
5 * Currently, used by Exynos5420 based Peach PIT and
6 * Exynos5800 based Peach PI.
7 *
8 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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&adc {
16 ncp15wb473@3 {
17 compatible = "murata,ncp15wb473";
18 pullup-uv = <1800000>;
19 pullup-ohm = <47000>;
20 pulldown-ohm = <0>;
21 io-channels = <&adc 3>;
22 };
23 ncp15wb473@4 {
24 compatible = "murata,ncp15wb473";
25 pullup-uv = <1800000>;
26 pullup-ohm = <47000>;
27 pulldown-ohm = <0>;
28 io-channels = <&adc 4>;
29 };
30 ncp15wb473@5 {
31 compatible = "murata,ncp15wb473";
32 pullup-uv = <1800000>;
33 pullup-ohm = <47000>;
34 pulldown-ohm = <0>;
35 io-channels = <&adc 5>;
36 };
37 ncp15wb473@6 {
38 compatible = "murata,ncp15wb473";
39 pullup-uv = <1800000>;
40 pullup-ohm = <47000>;
41 pulldown-ohm = <0>;
42 io-channels = <&adc 6>;
43 };
44};
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index 1e11e5a5f723..4f935ad9f27b 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -17,6 +17,18 @@
17 soc { 17 soc {
18 pmx_core: pinmux@1c14120 { 18 pmx_core: pinmux@1c14120 {
19 status = "okay"; 19 status = "okay";
20
21 mcasp0_pins: pinmux_mcasp0_pins {
22 pinctrl-single,bits = <
23 /*
24 * AHCLKX, ACLKX, AFSX, AHCLKR, ACLKR,
25 * AFSR, AMUTE
26 */
27 0x00 0x11111111 0xffffffff
28 /* AXR11, AXR12 */
29 0x04 0x00011000 0x000ff000
30 >;
31 };
20 }; 32 };
21 serial0: serial@1c42000 { 33 serial0: serial@1c42000 {
22 status = "okay"; 34 status = "okay";
@@ -39,6 +51,20 @@
39 tps: tps@48 { 51 tps: tps@48 {
40 reg = <0x48>; 52 reg = <0x48>;
41 }; 53 };
54 tlv320aic3106: tlv320aic3106@18 {
55 #sound-dai-cells = <0>;
56 compatible = "ti,tlv320aic3106";
57 reg = <0x18>;
58 status = "okay";
59
60 /* Regulators */
61 IOVDD-supply = <&vdcdc2_reg>;
62 /* Derived from VBAT: Baseboard 3.3V / 1.8V */
63 AVDD-supply = <&vbat>;
64 DRVDD-supply = <&vbat>;
65 DVDD-supply = <&vbat>;
66 };
67
42 }; 68 };
43 wdt: wdt@1c21000 { 69 wdt: wdt@1c21000 {
44 status = "okay"; 70 status = "okay";
@@ -117,6 +143,33 @@
117 regulator-max-microvolt = <5000000>; 143 regulator-max-microvolt = <5000000>;
118 regulator-boot-on; 144 regulator-boot-on;
119 }; 145 };
146
147 sound {
148 compatible = "simple-audio-card";
149 simple-audio-card,name = "DA850/OMAP-L138 EVM";
150 simple-audio-card,widgets =
151 "Line", "Line In",
152 "Line", "Line Out";
153 simple-audio-card,routing =
154 "LINE1L", "Line In",
155 "LINE1R", "Line In",
156 "Line Out", "LLOUT",
157 "Line Out", "RLOUT";
158 simple-audio-card,format = "dsp_b";
159 simple-audio-card,bitclock-master = <&link0_codec>;
160 simple-audio-card,frame-master = <&link0_codec>;
161 simple-audio-card,bitclock-inversion;
162
163 simple-audio-card,cpu {
164 sound-dai = <&mcasp0>;
165 system-clock-frequency = <24576000>;
166 };
167
168 link0_codec: simple-audio-card,codec {
169 sound-dai = <&tlv320aic3106>;
170 system-clock-frequency = <24576000>;
171 };
172 };
120}; 173};
121 174
122/include/ "tps6507x.dtsi" 175/include/ "tps6507x.dtsi"
@@ -170,3 +223,22 @@
170 }; 223 };
171 }; 224 };
172}; 225};
226
227&mcasp0 {
228 #sound-dai-cells = <0>;
229 status = "okay";
230 pinctrl-names = "default";
231 pinctrl-0 = <&mcasp0_pins>;
232
233 op-mode = <0>; /* MCASP_IIS_MODE */
234 tdm-slots = <2>;
235 /* 4 serializer */
236 serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
237 0 0 0 0
238 0 0 0 0
239 0 0 0 1
240 2 0 0 0
241 >;
242 tx-num-evt = <32>;
243 rx-num-evt = <32>;
244};
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index b695548dbb4e..0bd98cd00816 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -150,6 +150,12 @@
150 }; 150 };
151 151
152 }; 152 };
153 edma0: edma@01c00000 {
154 compatible = "ti,edma3";
155 reg = <0x0 0x10000>;
156 interrupts = <11 13 12>;
157 #dma-cells = <1>;
158 };
153 serial0: serial@1c42000 { 159 serial0: serial@1c42000 {
154 compatible = "ns16550a"; 160 compatible = "ns16550a";
155 reg = <0x42000 0x100>; 161 reg = <0x42000 0x100>;
@@ -270,6 +276,19 @@
270 ti,davinci-gpio-unbanked = <0>; 276 ti,davinci-gpio-unbanked = <0>;
271 status = "disabled"; 277 status = "disabled";
272 }; 278 };
279
280 mcasp0: mcasp@01d00000 {
281 compatible = "ti,da830-mcasp-audio";
282 reg = <0x100000 0x2000>,
283 <0x102000 0x400000>;
284 reg-names = "mpu", "dat";
285 interrupts = <54>;
286 interrupt-names = "common";
287 status = "disabled";
288 dmas = <&edma0 1>,
289 <&edma0 0>;
290 dma-names = "tx", "rx";
291 };
273 }; 292 };
274 nand_cs3@62000000 { 293 nand_cs3@62000000 {
275 compatible = "ti,davinci-nand"; 294 compatible = "ti,davinci-nand";
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index 50f8022905a1..c6ce6258434f 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -8,6 +8,7 @@
8/dts-v1/; 8/dts-v1/;
9 9
10#include "dra74x.dtsi" 10#include "dra74x.dtsi"
11#include <dt-bindings/gpio/gpio.h>
11 12
12/ { 13/ {
13 model = "TI DRA742"; 14 model = "TI DRA742";
@@ -24,9 +25,29 @@
24 regulator-min-microvolt = <3300000>; 25 regulator-min-microvolt = <3300000>;
25 regulator-max-microvolt = <3300000>; 26 regulator-max-microvolt = <3300000>;
26 }; 27 };
28
29 vtt_fixed: fixedregulator-vtt {
30 compatible = "regulator-fixed";
31 regulator-name = "vtt_fixed";
32 regulator-min-microvolt = <1350000>;
33 regulator-max-microvolt = <1350000>;
34 regulator-always-on;
35 regulator-boot-on;
36 enable-active-high;
37 gpio = <&gpio7 11 GPIO_ACTIVE_HIGH>;
38 };
27}; 39};
28 40
29&dra7_pmx_core { 41&dra7_pmx_core {
42 pinctrl-names = "default";
43 pinctrl-0 = <&vtt_pin>;
44
45 vtt_pin: pinmux_vtt_pin {
46 pinctrl-single,pins = <
47 0x3b4 (PIN_OUTPUT | MUX_MODE14) /* spi1_cs1.gpio7_11 */
48 >;
49 };
50
30 i2c1_pins: pinmux_i2c1_pins { 51 i2c1_pins: pinmux_i2c1_pins {
31 pinctrl-single,pins = < 52 pinctrl-single,pins = <
32 0x400 (PIN_INPUT | MUX_MODE0) /* i2c1_sda */ 53 0x400 (PIN_INPUT | MUX_MODE0) /* i2c1_sda */
@@ -43,20 +64,19 @@
43 64
44 i2c3_pins: pinmux_i2c3_pins { 65 i2c3_pins: pinmux_i2c3_pins {
45 pinctrl-single,pins = < 66 pinctrl-single,pins = <
46 0x410 (PIN_INPUT | MUX_MODE0) /* i2c3_sda */ 67 0x288 (PIN_INPUT | MUX_MODE9) /* gpio6_14.i2c3_sda */
47 0x414 (PIN_INPUT | MUX_MODE0) /* i2c3_scl */ 68 0x28c (PIN_INPUT | MUX_MODE9) /* gpio6_15.i2c3_scl */
48 >; 69 >;
49 }; 70 };
50 71
51 mcspi1_pins: pinmux_mcspi1_pins { 72 mcspi1_pins: pinmux_mcspi1_pins {
52 pinctrl-single,pins = < 73 pinctrl-single,pins = <
53 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi2_clk */ 74 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi1_sclk */
54 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi2_d1 */ 75 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi1_d1 */
55 0x3ac (PIN_INPUT | MUX_MODE0) /* spi2_d0 */ 76 0x3ac (PIN_INPUT | MUX_MODE0) /* spi1_d0 */
56 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs0 */ 77 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi1_cs0 */
57 0x3b4 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs1 */ 78 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi1_cs2.hdmi1_hpd */
58 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs2 */ 79 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi1_cs3.hdmi1_cec */
59 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs3 */
60 >; 80 >;
61 }; 81 };
62 82
@@ -284,7 +304,7 @@
284 status = "okay"; 304 status = "okay";
285 pinctrl-names = "default"; 305 pinctrl-names = "default";
286 pinctrl-0 = <&i2c3_pins>; 306 pinctrl-0 = <&i2c3_pins>;
287 clock-frequency = <3400000>; 307 clock-frequency = <400000>;
288}; 308};
289 309
290&mcspi1 { 310&mcspi1 {
@@ -303,6 +323,8 @@
303 status = "okay"; 323 status = "okay";
304 pinctrl-names = "default"; 324 pinctrl-names = "default";
305 pinctrl-0 = <&uart1_pins>; 325 pinctrl-0 = <&uart1_pins>;
326 interrupts-extended = <&gic GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>,
327 <&dra7_pmx_core 0x3e0>;
306}; 328};
307 329
308&uart2 { 330&uart2 {
@@ -427,22 +449,19 @@
427 gpmc,device-width = <2>; 449 gpmc,device-width = <2>;
428 gpmc,sync-clk-ps = <0>; 450 gpmc,sync-clk-ps = <0>;
429 gpmc,cs-on-ns = <0>; 451 gpmc,cs-on-ns = <0>;
430 gpmc,cs-rd-off-ns = <40>; 452 gpmc,cs-rd-off-ns = <80>;
431 gpmc,cs-wr-off-ns = <40>; 453 gpmc,cs-wr-off-ns = <80>;
432 gpmc,adv-on-ns = <0>; 454 gpmc,adv-on-ns = <0>;
433 gpmc,adv-rd-off-ns = <30>; 455 gpmc,adv-rd-off-ns = <60>;
434 gpmc,adv-wr-off-ns = <30>; 456 gpmc,adv-wr-off-ns = <60>;
435 gpmc,we-on-ns = <5>; 457 gpmc,we-on-ns = <10>;
436 gpmc,we-off-ns = <25>; 458 gpmc,we-off-ns = <50>;
437 gpmc,oe-on-ns = <2>; 459 gpmc,oe-on-ns = <4>;
438 gpmc,oe-off-ns = <20>; 460 gpmc,oe-off-ns = <40>;
439 gpmc,access-ns = <20>; 461 gpmc,access-ns = <40>;
440 gpmc,wr-access-ns = <40>; 462 gpmc,wr-access-ns = <80>;
441 gpmc,rd-cycle-ns = <40>; 463 gpmc,rd-cycle-ns = <80>;
442 gpmc,wr-cycle-ns = <40>; 464 gpmc,wr-cycle-ns = <80>;
443 gpmc,wait-pin = <0>;
444 gpmc,wait-on-read;
445 gpmc,wait-on-write;
446 gpmc,bus-turnaround-ns = <0>; 465 gpmc,bus-turnaround-ns = <0>;
447 gpmc,cycle2cycle-delay-ns = <0>; 466 gpmc,cycle2cycle-delay-ns = <0>;
448 gpmc,clk-activation-ns = <0>; 467 gpmc,clk-activation-ns = <0>;
@@ -483,7 +502,7 @@
483 reg = <0x001c0000 0x00020000>; 502 reg = <0x001c0000 0x00020000>;
484 }; 503 };
485 partition@7 { 504 partition@7 {
486 label = "NAND.u-boot-env"; 505 label = "NAND.u-boot-env.backup1";
487 reg = <0x001e0000 0x00020000>; 506 reg = <0x001e0000 0x00020000>;
488 }; 507 };
489 partition@8 { 508 partition@8 {
@@ -504,3 +523,8 @@
504&usb2_phy2 { 523&usb2_phy2 {
505 phy-supply = <&ldousb_reg>; 524 phy-supply = <&ldousb_reg>;
506}; 525};
526
527&gpio7 {
528 ti,no-reset-on-init;
529 ti,no-idle-on-init;
530};
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 97f603c4483d..9cc98436a982 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -89,6 +89,7 @@
89 prm: prm@4ae06000 { 89 prm: prm@4ae06000 {
90 compatible = "ti,dra7-prm"; 90 compatible = "ti,dra7-prm";
91 reg = <0x4ae06000 0x3000>; 91 reg = <0x4ae06000 0x3000>;
92 interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
92 93
93 prm_clocks: clocks { 94 prm_clocks: clocks {
94 #address-cells = <1>; 95 #address-cells = <1>;
@@ -217,10 +218,12 @@
217 }; 218 };
218 219
219 dra7_pmx_core: pinmux@4a003400 { 220 dra7_pmx_core: pinmux@4a003400 {
220 compatible = "pinctrl-single"; 221 compatible = "ti,dra7-padconf", "pinctrl-single";
221 reg = <0x4a003400 0x0464>; 222 reg = <0x4a003400 0x0464>;
222 #address-cells = <1>; 223 #address-cells = <1>;
223 #size-cells = <0>; 224 #size-cells = <0>;
225 #interrupt-cells = <1>;
226 interrupt-controller;
224 pinctrl-single,register-width = <32>; 227 pinctrl-single,register-width = <32>;
225 pinctrl-single,function-mask = <0x3fffffff>; 228 pinctrl-single,function-mask = <0x3fffffff>;
226 }; 229 };
@@ -245,7 +248,7 @@
245 gpio-controller; 248 gpio-controller;
246 #gpio-cells = <2>; 249 #gpio-cells = <2>;
247 interrupt-controller; 250 interrupt-controller;
248 #interrupt-cells = <1>; 251 #interrupt-cells = <2>;
249 }; 252 };
250 253
251 gpio2: gpio@48055000 { 254 gpio2: gpio@48055000 {
@@ -256,7 +259,7 @@
256 gpio-controller; 259 gpio-controller;
257 #gpio-cells = <2>; 260 #gpio-cells = <2>;
258 interrupt-controller; 261 interrupt-controller;
259 #interrupt-cells = <1>; 262 #interrupt-cells = <2>;
260 }; 263 };
261 264
262 gpio3: gpio@48057000 { 265 gpio3: gpio@48057000 {
@@ -267,7 +270,7 @@
267 gpio-controller; 270 gpio-controller;
268 #gpio-cells = <2>; 271 #gpio-cells = <2>;
269 interrupt-controller; 272 interrupt-controller;
270 #interrupt-cells = <1>; 273 #interrupt-cells = <2>;
271 }; 274 };
272 275
273 gpio4: gpio@48059000 { 276 gpio4: gpio@48059000 {
@@ -278,7 +281,7 @@
278 gpio-controller; 281 gpio-controller;
279 #gpio-cells = <2>; 282 #gpio-cells = <2>;
280 interrupt-controller; 283 interrupt-controller;
281 #interrupt-cells = <1>; 284 #interrupt-cells = <2>;
282 }; 285 };
283 286
284 gpio5: gpio@4805b000 { 287 gpio5: gpio@4805b000 {
@@ -289,7 +292,7 @@
289 gpio-controller; 292 gpio-controller;
290 #gpio-cells = <2>; 293 #gpio-cells = <2>;
291 interrupt-controller; 294 interrupt-controller;
292 #interrupt-cells = <1>; 295 #interrupt-cells = <2>;
293 }; 296 };
294 297
295 gpio6: gpio@4805d000 { 298 gpio6: gpio@4805d000 {
@@ -300,7 +303,7 @@
300 gpio-controller; 303 gpio-controller;
301 #gpio-cells = <2>; 304 #gpio-cells = <2>;
302 interrupt-controller; 305 interrupt-controller;
303 #interrupt-cells = <1>; 306 #interrupt-cells = <2>;
304 }; 307 };
305 308
306 gpio7: gpio@48051000 { 309 gpio7: gpio@48051000 {
@@ -311,7 +314,7 @@
311 gpio-controller; 314 gpio-controller;
312 #gpio-cells = <2>; 315 #gpio-cells = <2>;
313 interrupt-controller; 316 interrupt-controller;
314 #interrupt-cells = <1>; 317 #interrupt-cells = <2>;
315 }; 318 };
316 319
317 gpio8: gpio@48053000 { 320 gpio8: gpio@48053000 {
@@ -322,13 +325,13 @@
322 gpio-controller; 325 gpio-controller;
323 #gpio-cells = <2>; 326 #gpio-cells = <2>;
324 interrupt-controller; 327 interrupt-controller;
325 #interrupt-cells = <1>; 328 #interrupt-cells = <2>;
326 }; 329 };
327 330
328 uart1: serial@4806a000 { 331 uart1: serial@4806a000 {
329 compatible = "ti,omap4-uart"; 332 compatible = "ti,omap4-uart";
330 reg = <0x4806a000 0x100>; 333 reg = <0x4806a000 0x100>;
331 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; 334 interrupts-extended = <&gic GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
332 ti,hwmods = "uart1"; 335 ti,hwmods = "uart1";
333 clock-frequency = <48000000>; 336 clock-frequency = <48000000>;
334 status = "disabled"; 337 status = "disabled";
@@ -337,7 +340,7 @@
337 uart2: serial@4806c000 { 340 uart2: serial@4806c000 {
338 compatible = "ti,omap4-uart"; 341 compatible = "ti,omap4-uart";
339 reg = <0x4806c000 0x100>; 342 reg = <0x4806c000 0x100>;
340 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; 343 interrupts-extended = <&gic GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
341 ti,hwmods = "uart2"; 344 ti,hwmods = "uart2";
342 clock-frequency = <48000000>; 345 clock-frequency = <48000000>;
343 status = "disabled"; 346 status = "disabled";
@@ -346,7 +349,7 @@
346 uart3: serial@48020000 { 349 uart3: serial@48020000 {
347 compatible = "ti,omap4-uart"; 350 compatible = "ti,omap4-uart";
348 reg = <0x48020000 0x100>; 351 reg = <0x48020000 0x100>;
349 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; 352 interrupts-extended = <&gic GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
350 ti,hwmods = "uart3"; 353 ti,hwmods = "uart3";
351 clock-frequency = <48000000>; 354 clock-frequency = <48000000>;
352 status = "disabled"; 355 status = "disabled";
@@ -355,7 +358,7 @@
355 uart4: serial@4806e000 { 358 uart4: serial@4806e000 {
356 compatible = "ti,omap4-uart"; 359 compatible = "ti,omap4-uart";
357 reg = <0x4806e000 0x100>; 360 reg = <0x4806e000 0x100>;
358 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; 361 interrupts-extended = <&gic GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
359 ti,hwmods = "uart4"; 362 ti,hwmods = "uart4";
360 clock-frequency = <48000000>; 363 clock-frequency = <48000000>;
361 status = "disabled"; 364 status = "disabled";
@@ -364,7 +367,7 @@
364 uart5: serial@48066000 { 367 uart5: serial@48066000 {
365 compatible = "ti,omap4-uart"; 368 compatible = "ti,omap4-uart";
366 reg = <0x48066000 0x100>; 369 reg = <0x48066000 0x100>;
367 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>; 370 interrupts-extended = <&gic GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
368 ti,hwmods = "uart5"; 371 ti,hwmods = "uart5";
369 clock-frequency = <48000000>; 372 clock-frequency = <48000000>;
370 status = "disabled"; 373 status = "disabled";
@@ -373,7 +376,7 @@
373 uart6: serial@48068000 { 376 uart6: serial@48068000 {
374 compatible = "ti,omap4-uart"; 377 compatible = "ti,omap4-uart";
375 reg = <0x48068000 0x100>; 378 reg = <0x48068000 0x100>;
376 interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>; 379 interrupts-extended = <&gic GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
377 ti,hwmods = "uart6"; 380 ti,hwmods = "uart6";
378 clock-frequency = <48000000>; 381 clock-frequency = <48000000>;
379 status = "disabled"; 382 status = "disabled";
@@ -382,7 +385,7 @@
382 uart7: serial@48420000 { 385 uart7: serial@48420000 {
383 compatible = "ti,omap4-uart"; 386 compatible = "ti,omap4-uart";
384 reg = <0x48420000 0x100>; 387 reg = <0x48420000 0x100>;
385 interrupts = <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH>; 388 interrupts-extended = <&gic GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH>;
386 ti,hwmods = "uart7"; 389 ti,hwmods = "uart7";
387 clock-frequency = <48000000>; 390 clock-frequency = <48000000>;
388 status = "disabled"; 391 status = "disabled";
@@ -391,7 +394,7 @@
391 uart8: serial@48422000 { 394 uart8: serial@48422000 {
392 compatible = "ti,omap4-uart"; 395 compatible = "ti,omap4-uart";
393 reg = <0x48422000 0x100>; 396 reg = <0x48422000 0x100>;
394 interrupts = <GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH>; 397 interrupts-extended = <&gic GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH>;
395 ti,hwmods = "uart8"; 398 ti,hwmods = "uart8";
396 clock-frequency = <48000000>; 399 clock-frequency = <48000000>;
397 status = "disabled"; 400 status = "disabled";
@@ -400,7 +403,7 @@
400 uart9: serial@48424000 { 403 uart9: serial@48424000 {
401 compatible = "ti,omap4-uart"; 404 compatible = "ti,omap4-uart";
402 reg = <0x48424000 0x100>; 405 reg = <0x48424000 0x100>;
403 interrupts = <GIC_SPI 220 IRQ_TYPE_LEVEL_HIGH>; 406 interrupts-extended = <&gic GIC_SPI 220 IRQ_TYPE_LEVEL_HIGH>;
404 ti,hwmods = "uart9"; 407 ti,hwmods = "uart9";
405 clock-frequency = <48000000>; 408 clock-frequency = <48000000>;
406 status = "disabled"; 409 status = "disabled";
@@ -409,7 +412,7 @@
409 uart10: serial@4ae2b000 { 412 uart10: serial@4ae2b000 {
410 compatible = "ti,omap4-uart"; 413 compatible = "ti,omap4-uart";
411 reg = <0x4ae2b000 0x100>; 414 reg = <0x4ae2b000 0x100>;
412 interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>; 415 interrupts-extended = <&gic GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>;
413 ti,hwmods = "uart10"; 416 ti,hwmods = "uart10";
414 clock-frequency = <48000000>; 417 clock-frequency = <48000000>;
415 status = "disabled"; 418 status = "disabled";
diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts
index 514702348818..41074288adfa 100644
--- a/arch/arm/boot/dts/dra72-evm.dts
+++ b/arch/arm/boot/dts/dra72-evm.dts
@@ -19,6 +19,126 @@
19 }; 19 };
20}; 20};
21 21
22&dra7_pmx_core {
23 i2c1_pins: pinmux_i2c1_pins {
24 pinctrl-single,pins = <
25 0x400 (PIN_INPUT | MUX_MODE0) /* i2c1_sda.i2c1_sda */
26 0x404 (PIN_INPUT | MUX_MODE0) /* i2c1_scl.i2c1_scl */
27 >;
28 };
29};
30
31&i2c1 {
32 status = "okay";
33 pinctrl-names = "default";
34 pinctrl-0 = <&i2c1_pins>;
35 clock-frequency = <400000>;
36
37 tps65917: tps65917@58 {
38 compatible = "ti,tps65917";
39 reg = <0x58>;
40
41 interrupts = <GIC_SPI 2 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
42 interrupt-parent = <&gic>;
43 interrupt-controller;
44 #interrupt-cells = <2>;
45
46 ti,system-power-controller;
47
48 tps65917_pmic {
49 compatible = "ti,tps65917-pmic";
50
51 regulators {
52 smps1_reg: smps1 {
53 /* VDD_MPU */
54 regulator-name = "smps1";
55 regulator-min-microvolt = <850000>;
56 regulator-max-microvolt = <1250000>;
57 regulator-always-on;
58 regulator-boot-on;
59 };
60
61 smps2_reg: smps2 {
62 /* VDD_CORE */
63 regulator-name = "smps2";
64 regulator-min-microvolt = <850000>;
65 regulator-max-microvolt = <1030000>;
66 regulator-boot-on;
67 regulator-always-on;
68 };
69
70 smps3_reg: smps3 {
71 /* VDD_GPU IVA DSPEVE */
72 regulator-name = "smps3";
73 regulator-min-microvolt = <850000>;
74 regulator-max-microvolt = <1250000>;
75 regulator-boot-on;
76 regulator-always-on;
77 };
78
79 smps4_reg: smps4 {
80 /* VDDS1V8 */
81 regulator-name = "smps4";
82 regulator-min-microvolt = <1800000>;
83 regulator-max-microvolt = <1800000>;
84 regulator-always-on;
85 regulator-boot-on;
86 };
87
88 smps5_reg: smps5 {
89 /* VDD_DDR */
90 regulator-name = "smps5";
91 regulator-min-microvolt = <1350000>;
92 regulator-max-microvolt = <1350000>;
93 regulator-boot-on;
94 regulator-always-on;
95 };
96
97 ldo1_reg: ldo1 {
98 /* LDO1_OUT --> SDIO */
99 regulator-name = "ldo1";
100 regulator-min-microvolt = <1800000>;
101 regulator-max-microvolt = <3300000>;
102 regulator-boot-on;
103 };
104
105 ldo2_reg: ldo2 {
106 /* LDO2_OUT --> TP1017 (UNUSED) */
107 regulator-name = "ldo2";
108 regulator-min-microvolt = <1800000>;
109 regulator-max-microvolt = <3300000>;
110 };
111
112 ldo3_reg: ldo3 {
113 /* VDDA_1V8_PHY */
114 regulator-name = "ldo3";
115 regulator-min-microvolt = <1800000>;
116 regulator-max-microvolt = <1800000>;
117 regulator-boot-on;
118 regulator-always-on;
119 };
120
121 ldo5_reg: ldo5 {
122 /* VDDA_1V8_PLL */
123 regulator-name = "ldo5";
124 regulator-min-microvolt = <1800000>;
125 regulator-max-microvolt = <1800000>;
126 regulator-always-on;
127 regulator-boot-on;
128 };
129
130 ldo4_reg: ldo4 {
131 /* VDDA_3V_USB: VDDA_USBHS33 */
132 regulator-name = "ldo4";
133 regulator-min-microvolt = <3300000>;
134 regulator-max-microvolt = <3300000>;
135 regulator-boot-on;
136 };
137 };
138 };
139 };
140};
141
22&uart1 { 142&uart1 {
23 status = "okay"; 143 status = "okay";
24}; 144};
diff --git a/arch/arm/boot/dts/dra72x.dtsi b/arch/arm/boot/dts/dra72x.dtsi
index f1ec22f6ebf4..e5a3d23a3df1 100644
--- a/arch/arm/boot/dts/dra72x.dtsi
+++ b/arch/arm/boot/dts/dra72x.dtsi
@@ -22,4 +22,9 @@
22 reg = <0>; 22 reg = <0>;
23 }; 23 };
24 }; 24 };
25
26 pmu {
27 compatible = "arm,cortex-a15-pmu";
28 interrupts = <GIC_SPI DIRECT_IRQ(131) IRQ_TYPE_LEVEL_HIGH>;
29 };
25}; 30};
diff --git a/arch/arm/boot/dts/dra74x.dtsi b/arch/arm/boot/dts/dra74x.dtsi
index a4e8bb9f95c0..3be544c4891f 100644
--- a/arch/arm/boot/dts/dra74x.dtsi
+++ b/arch/arm/boot/dts/dra74x.dtsi
@@ -38,4 +38,10 @@
38 reg = <1>; 38 reg = <1>;
39 }; 39 };
40 }; 40 };
41
42 pmu {
43 compatible = "arm,cortex-a15-pmu";
44 interrupts = <GIC_SPI DIRECT_IRQ(131) IRQ_TYPE_LEVEL_HIGH>,
45 <GIC_SPI DIRECT_IRQ(132) IRQ_TYPE_LEVEL_HIGH>;
46 };
41}; 47};
diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index 6d6d23c83d30..c697ff01ae8d 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -54,17 +54,13 @@
54 status = "okay"; 54 status = "okay";
55 55
56 num-slots = <1>; 56 num-slots = <1>;
57 supports-highspeed;
58 broken-cd; 57 broken-cd;
59 card-detect-delay = <200>; 58 card-detect-delay = <200>;
60 samsung,dw-mshc-ciu-div = <3>; 59 samsung,dw-mshc-ciu-div = <3>;
61 samsung,dw-mshc-sdr-timing = <2 3>; 60 samsung,dw-mshc-sdr-timing = <2 3>;
62 samsung,dw-mshc-ddr-timing = <1 2>; 61 samsung,dw-mshc-ddr-timing = <1 2>;
63 62 bus-width = <8>;
64 slot@0 { 63 cap-mmc-highspeed;
65 reg = <0>;
66 bus-width = <8>;
67 };
68 }; 64 };
69 65
70 watchdog@10060000 { 66 watchdog@10060000 {
@@ -134,6 +130,8 @@
134 i2c@13860000 { 130 i2c@13860000 {
135 pinctrl-0 = <&i2c0_bus>; 131 pinctrl-0 = <&i2c0_bus>;
136 pinctrl-names = "default"; 132 pinctrl-names = "default";
133 samsung,i2c-sda-delay = <100>;
134 samsung,i2c-max-bus-freq = <400000>;
137 status = "okay"; 135 status = "okay";
138 136
139 usb3503: usb3503@08 { 137 usb3503: usb3503@08 {
@@ -148,6 +146,10 @@
148 146
149 max77686: pmic@09 { 147 max77686: pmic@09 {
150 compatible = "maxim,max77686"; 148 compatible = "maxim,max77686";
149 interrupt-parent = <&gpx3>;
150 interrupts = <2 0>;
151 pinctrl-names = "default";
152 pinctrl-0 = <&max77686_irq>;
151 reg = <0x09>; 153 reg = <0x09>;
152 #clock-cells = <1>; 154 #clock-cells = <1>;
153 155
@@ -368,4 +370,11 @@
368 samsung,pins = "gpx1-3"; 370 samsung,pins = "gpx1-3";
369 samsung,pin-pud = <0>; 371 samsung,pin-pud = <0>;
370 }; 372 };
373
374 max77686_irq: max77686-irq {
375 samsung,pins = "gpx3-2";
376 samsung,pin-function = <0>;
377 samsung,pin-pud = <0>;
378 samsung,pin-drv = <0>;
379 };
371}; 380};
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
index e925c9fbfb07..de15114fd07c 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -137,17 +137,13 @@
137 status = "okay"; 137 status = "okay";
138 138
139 num-slots = <1>; 139 num-slots = <1>;
140 supports-highspeed;
141 broken-cd; 140 broken-cd;
142 card-detect-delay = <200>; 141 card-detect-delay = <200>;
143 samsung,dw-mshc-ciu-div = <3>; 142 samsung,dw-mshc-ciu-div = <3>;
144 samsung,dw-mshc-sdr-timing = <2 3>; 143 samsung,dw-mshc-sdr-timing = <2 3>;
145 samsung,dw-mshc-ddr-timing = <1 2>; 144 samsung,dw-mshc-ddr-timing = <1 2>;
146 145 bus-width = <8>;
147 slot@0 { 146 cap-mmc-highspeed;
148 reg = <0>;
149 bus-width = <8>;
150 };
151 }; 147 };
152 148
153 codec@13400000 { 149 codec@13400000 {
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 11967f4561e0..5e066cd87f66 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -520,7 +520,6 @@
520 520
521 mmc@12550000 { 521 mmc@12550000 {
522 num-slots = <1>; 522 num-slots = <1>;
523 supports-highspeed;
524 broken-cd; 523 broken-cd;
525 non-removable; 524 non-removable;
526 card-detect-delay = <200>; 525 card-detect-delay = <200>;
@@ -532,11 +531,8 @@
532 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>; 531 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
533 pinctrl-names = "default"; 532 pinctrl-names = "default";
534 status = "okay"; 533 status = "okay";
535 534 bus-width = <8>;
536 slot@0 { 535 cap-mmc-highspeed;
537 reg = <0>;
538 bus-width = <8>;
539 };
540 }; 536 };
541 537
542 serial@13800000 { 538 serial@13800000 {
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index d0de1f50d15b..3acd97eb6630 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -401,7 +401,6 @@
401 mmc_0: mmc@12200000 { 401 mmc_0: mmc@12200000 {
402 status = "okay"; 402 status = "okay";
403 num-slots = <1>; 403 num-slots = <1>;
404 supports-highspeed;
405 broken-cd; 404 broken-cd;
406 card-detect-delay = <200>; 405 card-detect-delay = <200>;
407 samsung,dw-mshc-ciu-div = <3>; 406 samsung,dw-mshc-ciu-div = <3>;
@@ -410,17 +409,13 @@
410 vmmc-supply = <&mmc_reg>; 409 vmmc-supply = <&mmc_reg>;
411 pinctrl-names = "default"; 410 pinctrl-names = "default";
412 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>; 411 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
413 412 bus-width = <8>;
414 slot@0 { 413 cap-mmc-highspeed;
415 reg = <0>;
416 bus-width = <8>;
417 };
418 }; 414 };
419 415
420 mmc_2: mmc@12220000 { 416 mmc_2: mmc@12220000 {
421 status = "okay"; 417 status = "okay";
422 num-slots = <1>; 418 num-slots = <1>;
423 supports-highspeed;
424 card-detect-delay = <200>; 419 card-detect-delay = <200>;
425 samsung,dw-mshc-ciu-div = <3>; 420 samsung,dw-mshc-ciu-div = <3>;
426 samsung,dw-mshc-sdr-timing = <2 3>; 421 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -428,12 +423,9 @@
428 vmmc-supply = <&mmc_reg>; 423 vmmc-supply = <&mmc_reg>;
429 pinctrl-names = "default"; 424 pinctrl-names = "default";
430 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 425 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
431 426 bus-width = <4>;
432 slot@0 { 427 disable-wp;
433 reg = <0>; 428 cap-sd-highspeed;
434 bus-width = <4>;
435 disable-wp;
436 };
437 }; 429 };
438 430
439 i2s0: i2s@03830000 { 431 i2s0: i2s@03830000 {
@@ -570,8 +562,4 @@
570 connect-gpios = <&gpd1 7 1>; 562 connect-gpios = <&gpd1 7 1>;
571 }; 563 };
572 }; 564 };
573
574 usb@12110000 {
575 usb-phy = <&usb2_phy>;
576 };
577}; 565};
diff --git a/arch/arm/boot/dts/exynos5250-cros-common.dtsi b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
deleted file mode 100644
index e603e9c70142..000000000000
--- a/arch/arm/boot/dts/exynos5250-cros-common.dtsi
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * Common device tree include for all Exynos 5250 boards based off of Daisy.
3 *
4 * Copyright (c) 2012 Google, 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/ {
12 aliases {
13 };
14
15 memory {
16 reg = <0x40000000 0x80000000>;
17 };
18
19 chosen {
20 };
21
22 pinctrl@11400000 {
23 /*
24 * Disabled pullups since external part has its own pullups and
25 * double-pulling gets us out of spec in some cases.
26 */
27 i2c2_bus: i2c2-bus {
28 samsung,pin-pud = <0>;
29 };
30 };
31
32 i2c@12C60000 {
33 status = "okay";
34 samsung,i2c-sda-delay = <100>;
35 samsung,i2c-max-bus-freq = <378000>;
36 };
37
38 i2c@12C70000 {
39 status = "okay";
40 samsung,i2c-sda-delay = <100>;
41 samsung,i2c-max-bus-freq = <378000>;
42 };
43
44 i2c@12C80000 {
45 status = "okay";
46 samsung,i2c-sda-delay = <100>;
47 samsung,i2c-max-bus-freq = <66000>;
48
49 hdmiddc@50 {
50 compatible = "samsung,exynos4210-hdmiddc";
51 reg = <0x50>;
52 };
53 };
54
55 i2c@12C90000 {
56 status = "okay";
57 samsung,i2c-sda-delay = <100>;
58 samsung,i2c-max-bus-freq = <66000>;
59 };
60
61 i2c@12CA0000 {
62 status = "okay";
63 samsung,i2c-sda-delay = <100>;
64 samsung,i2c-max-bus-freq = <66000>;
65 };
66
67 i2c@12CB0000 {
68 status = "okay";
69 samsung,i2c-sda-delay = <100>;
70 samsung,i2c-max-bus-freq = <66000>;
71 };
72
73 i2c@12CD0000 {
74 status = "okay";
75 samsung,i2c-sda-delay = <100>;
76 samsung,i2c-max-bus-freq = <66000>;
77 };
78
79 i2c@12CE0000 {
80 status = "okay";
81 samsung,i2c-sda-delay = <100>;
82 samsung,i2c-max-bus-freq = <378000>;
83
84 hdmiphy: hdmiphy@38 {
85 compatible = "samsung,exynos4212-hdmiphy";
86 reg = <0x38>;
87 };
88 };
89
90 mmc@12200000 {
91 num-slots = <1>;
92 supports-highspeed;
93 broken-cd;
94 card-detect-delay = <200>;
95 samsung,dw-mshc-ciu-div = <3>;
96 samsung,dw-mshc-sdr-timing = <2 3>;
97 samsung,dw-mshc-ddr-timing = <1 2>;
98 pinctrl-names = "default";
99 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4 &sd0_bus8>;
100
101 slot@0 {
102 reg = <0>;
103 bus-width = <8>;
104 };
105 };
106
107 mmc@12220000 {
108 num-slots = <1>;
109 supports-highspeed;
110 card-detect-delay = <200>;
111 samsung,dw-mshc-ciu-div = <3>;
112 samsung,dw-mshc-sdr-timing = <2 3>;
113 samsung,dw-mshc-ddr-timing = <1 2>;
114 pinctrl-names = "default";
115 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
116
117 slot@0 {
118 reg = <0>;
119 bus-width = <4>;
120 wp-gpios = <&gpc2 1 0>;
121 };
122 };
123
124 mmc@12230000 {
125 num-slots = <1>;
126 supports-highspeed;
127 broken-cd;
128 card-detect-delay = <200>;
129 samsung,dw-mshc-ciu-div = <3>;
130 samsung,dw-mshc-sdr-timing = <2 3>;
131 samsung,dw-mshc-ddr-timing = <1 2>;
132 /* See board-specific dts files for pin setup */
133
134 slot@0 {
135 reg = <0>;
136 bus-width = <4>;
137 };
138 };
139
140 spi_1: spi@12d30000 {
141 status = "okay";
142 samsung,spi-src-clk = <0>;
143 num-cs = <1>;
144 };
145
146 hdmi {
147 hpd-gpio = <&gpx3 7 0>;
148 pinctrl-names = "default";
149 pinctrl-0 = <&hdmi_hpd_irq>;
150 phy = <&hdmiphy>;
151 ddc = <&i2c_2>;
152 };
153
154 gpio-keys {
155 compatible = "gpio-keys";
156
157 power {
158 label = "Power";
159 gpios = <&gpx1 3 1>;
160 linux,code = <116>; /* KEY_POWER */
161 gpio-key,wakeup;
162 };
163 };
164};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index b4b35adae565..6a0f4c0ff763 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -284,7 +284,6 @@
284 mmc@12200000 { 284 mmc@12200000 {
285 status = "okay"; 285 status = "okay";
286 num-slots = <1>; 286 num-slots = <1>;
287 supports-highspeed;
288 broken-cd; 287 broken-cd;
289 card-detect-delay = <200>; 288 card-detect-delay = <200>;
290 samsung,dw-mshc-ciu-div = <3>; 289 samsung,dw-mshc-ciu-div = <3>;
@@ -292,29 +291,22 @@
292 samsung,dw-mshc-ddr-timing = <1 2>; 291 samsung,dw-mshc-ddr-timing = <1 2>;
293 pinctrl-names = "default"; 292 pinctrl-names = "default";
294 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>; 293 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
295 294 bus-width = <8>;
296 slot@0 { 295 cap-mmc-highspeed;
297 reg = <0>;
298 bus-width = <8>;
299 };
300 }; 296 };
301 297
302 mmc@12220000 { 298 mmc@12220000 {
303 status = "okay"; 299 status = "okay";
304 num-slots = <1>; 300 num-slots = <1>;
305 supports-highspeed;
306 card-detect-delay = <200>; 301 card-detect-delay = <200>;
307 samsung,dw-mshc-ciu-div = <3>; 302 samsung,dw-mshc-ciu-div = <3>;
308 samsung,dw-mshc-sdr-timing = <2 3>; 303 samsung,dw-mshc-sdr-timing = <2 3>;
309 samsung,dw-mshc-ddr-timing = <1 2>; 304 samsung,dw-mshc-ddr-timing = <1 2>;
310 pinctrl-names = "default"; 305 pinctrl-names = "default";
311 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 306 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
312 307 bus-width = <4>;
313 slot@0 { 308 disable-wp;
314 reg = <0>; 309 cap-sd-highspeed;
315 bus-width = <4>;
316 disable-wp;
317 };
318 }; 310 };
319 311
320 spi_1: spi@12d30000 { 312 spi_1: spi@12d30000 {
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts
index f2b8c4116541..e51fcef884a4 100644
--- a/arch/arm/boot/dts/exynos5250-snow.dts
+++ b/arch/arm/boot/dts/exynos5250-snow.dts
@@ -9,8 +9,8 @@
9*/ 9*/
10 10
11/dts-v1/; 11/dts-v1/;
12#include <dt-bindings/gpio/gpio.h>
12#include "exynos5250.dtsi" 13#include "exynos5250.dtsi"
13#include "exynos5250-cros-common.dtsi"
14 14
15/ { 15/ {
16 model = "Google Snow"; 16 model = "Google Snow";
@@ -20,6 +20,13 @@
20 i2c104 = &i2c_104; 20 i2c104 = &i2c_104;
21 }; 21 };
22 22
23 memory {
24 reg = <0x40000000 0x80000000>;
25 };
26
27 chosen {
28 };
29
23 rtc@101E0000 { 30 rtc@101E0000 {
24 status = "okay"; 31 status = "okay";
25 }; 32 };
@@ -93,6 +100,13 @@
93 gpio-keys { 100 gpio-keys {
94 compatible = "gpio-keys"; 101 compatible = "gpio-keys";
95 102
103 power {
104 label = "Power";
105 gpios = <&gpx1 3 1>;
106 linux,code = <116>; /* KEY_POWER */
107 gpio-key,wakeup;
108 };
109
96 lid-switch { 110 lid-switch {
97 label = "Lid"; 111 label = "Lid";
98 gpios = <&gpx3 5 1>; 112 gpios = <&gpx3 5 1>;
@@ -181,7 +195,7 @@
181 dcdc3 { 195 dcdc3 {
182 ti,enable-ext-control; 196 ti,enable-ext-control;
183 }; 197 };
184 fet1 { 198 fet1: fet1 {
185 regulator-name = "vcd_led"; 199 regulator-name = "vcd_led";
186 ti,overcurrent-wait = <3>; 200 ti,overcurrent-wait = <3>;
187 }; 201 };
@@ -204,7 +218,7 @@
204 regulator-always-on; 218 regulator-always-on;
205 ti,overcurrent-wait = <3>; 219 ti,overcurrent-wait = <3>;
206 }; 220 };
207 fet6 { 221 fet6: fet6 {
208 regulator-name = "lcd_vdd"; 222 regulator-name = "lcd_vdd";
209 ti,overcurrent-wait = <3>; 223 ti,overcurrent-wait = <3>;
210 }; 224 };
@@ -226,26 +240,6 @@
226 }; 240 };
227 }; 241 };
228 242
229 mmc@12200000 {
230 status = "okay";
231 };
232
233 mmc@12220000 {
234 status = "okay";
235 };
236
237 /*
238 * On Snow we've got SIP WiFi and so can keep drive strengths low to
239 * reduce EMI.
240 */
241 mmc@12230000 {
242 status = "okay";
243 slot@0 {
244 pinctrl-names = "default";
245 pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_bus4>;
246 };
247 };
248
249 i2c@12CD0000 { 243 i2c@12CD0000 {
250 max98095: codec@11 { 244 max98095: codec@11 {
251 compatible = "maxim,max98095"; 245 compatible = "maxim,max98095";
@@ -253,6 +247,15 @@
253 pinctrl-0 = <&max98095_en>; 247 pinctrl-0 = <&max98095_en>;
254 pinctrl-names = "default"; 248 pinctrl-names = "default";
255 }; 249 };
250
251 ptn3460: lvds-bridge@20 {
252 compatible = "nxp,ptn3460";
253 reg = <0x20>;
254 powerdown-gpios = <&gpy2 5 GPIO_ACTIVE_HIGH>;
255 reset-gpios = <&gpx1 5 GPIO_ACTIVE_HIGH>;
256 edid-emulation = <5>;
257 panel = <&panel>;
258 };
256 }; 259 };
257 260
258 i2s0: i2s@03830000 { 261 i2s0: i2s@03830000 {
@@ -294,17 +297,24 @@
294 }; 297 };
295 298
296 hdmi { 299 hdmi {
300 hpd-gpio = <&gpx3 7 0>;
301 pinctrl-names = "default";
302 pinctrl-0 = <&hdmi_hpd_irq>;
303 phy = <&hdmiphy>;
304 ddc = <&i2c_2>;
297 hdmi-en-supply = <&tps65090_fet7>; 305 hdmi-en-supply = <&tps65090_fet7>;
298 vdd-supply = <&ldo8_reg>; 306 vdd-supply = <&ldo8_reg>;
299 vdd_osc-supply = <&ldo10_reg>; 307 vdd_osc-supply = <&ldo10_reg>;
300 vdd_pll-supply = <&ldo8_reg>; 308 vdd_pll-supply = <&ldo8_reg>;
301 }; 309 };
302 310
303 backlight { 311 backlight: backlight {
304 compatible = "pwm-backlight"; 312 compatible = "pwm-backlight";
305 pwms = <&pwm 0 1000000 0>; 313 pwms = <&pwm 0 1000000 0>;
306 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>; 314 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>;
307 default-brightness-level = <7>; 315 default-brightness-level = <7>;
316 enable-gpios = <&gpx3 0 GPIO_ACTIVE_HIGH>;
317 power-supply = <&fet1>;
308 pinctrl-0 = <&pwm0_out>; 318 pinctrl-0 = <&pwm0_out>;
309 pinctrl-names = "default"; 319 pinctrl-names = "default";
310 }; 320 };
@@ -314,6 +324,12 @@
314 samsung,invert-vclk; 324 samsung,invert-vclk;
315 }; 325 };
316 326
327 panel: panel {
328 compatible = "auo,b116xw03";
329 power-supply = <&fet6>;
330 backlight = <&backlight>;
331 };
332
317 dp-controller@145B0000 { 333 dp-controller@145B0000 {
318 status = "okay"; 334 status = "okay";
319 pinctrl-names = "default"; 335 pinctrl-names = "default";
@@ -325,26 +341,15 @@
325 samsung,link-rate = <0x0a>; 341 samsung,link-rate = <0x0a>;
326 samsung,lane-count = <2>; 342 samsung,lane-count = <2>;
327 samsung,hpd-gpio = <&gpx0 7 0>; 343 samsung,hpd-gpio = <&gpx0 7 0>;
328 344 bridge = <&ptn3460>;
329 display-timings {
330 native-mode = <&timing1>;
331
332 timing1: timing@1 {
333 clock-frequency = <70589280>;
334 hactive = <1366>;
335 vactive = <768>;
336 hfront-porch = <40>;
337 hback-porch = <40>;
338 hsync-len = <32>;
339 vback-porch = <10>;
340 vfront-porch = <12>;
341 vsync-len = <6>;
342 };
343 };
344 }; 345 };
345}; 346};
346 347
347&i2c_0 { 348&i2c_0 {
349 status = "okay";
350 samsung,i2c-sda-delay = <100>;
351 samsung,i2c-max-bus-freq = <378000>;
352
348 max77686@09 { 353 max77686@09 {
349 compatible = "maxim,max77686"; 354 compatible = "maxim,max77686";
350 interrupt-parent = <&gpx3>; 355 interrupt-parent = <&gpx3>;
@@ -491,6 +496,10 @@
491}; 496};
492 497
493&i2c_1 { 498&i2c_1 {
499 status = "okay";
500 samsung,i2c-sda-delay = <100>;
501 samsung,i2c-max-bus-freq = <378000>;
502
494 trackpad { 503 trackpad {
495 reg = <0x67>; 504 reg = <0x67>;
496 compatible = "cypress,cyapa"; 505 compatible = "cypress,cyapa";
@@ -500,6 +509,106 @@
500 }; 509 };
501}; 510};
502 511
512/*
513 * Disabled pullups since external part has its own pullups and
514 * double-pulling gets us out of spec in some cases.
515 */
516&i2c2_bus {
517 samsung,pin-pud = <0>;
518};
519
520&i2c_2 {
521 status = "okay";
522 samsung,i2c-sda-delay = <100>;
523 samsung,i2c-max-bus-freq = <66000>;
524
525 hdmiddc@50 {
526 compatible = "samsung,exynos4210-hdmiddc";
527 reg = <0x50>;
528 };
529};
530
531&i2c_3 {
532 status = "okay";
533 samsung,i2c-sda-delay = <100>;
534 samsung,i2c-max-bus-freq = <66000>;
535};
536
537&i2c_4 {
538 status = "okay";
539 samsung,i2c-sda-delay = <100>;
540 samsung,i2c-max-bus-freq = <66000>;
541};
542
543&i2c_5 {
544 status = "okay";
545 samsung,i2c-sda-delay = <100>;
546 samsung,i2c-max-bus-freq = <66000>;
547};
548
549&i2c_7 {
550 status = "okay";
551 samsung,i2c-sda-delay = <100>;
552 samsung,i2c-max-bus-freq = <66000>;
553};
554
555&i2c_8 {
556 status = "okay";
557 samsung,i2c-sda-delay = <100>;
558 samsung,i2c-max-bus-freq = <378000>;
559
560 hdmiphy: hdmiphy@38 {
561 compatible = "samsung,exynos4212-hdmiphy";
562 reg = <0x38>;
563 };
564};
565
566&mmc_0 {
567 status = "okay";
568 num-slots = <1>;
569 broken-cd;
570 card-detect-delay = <200>;
571 samsung,dw-mshc-ciu-div = <3>;
572 samsung,dw-mshc-sdr-timing = <2 3>;
573 samsung,dw-mshc-ddr-timing = <1 2>;
574 pinctrl-names = "default";
575 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4 &sd0_bus8>;
576 bus-width = <8>;
577 cap-mmc-highspeed;
578};
579
580&mmc_2 {
581 status = "okay";
582 num-slots = <1>;
583 card-detect-delay = <200>;
584 samsung,dw-mshc-ciu-div = <3>;
585 samsung,dw-mshc-sdr-timing = <2 3>;
586 samsung,dw-mshc-ddr-timing = <1 2>;
587 pinctrl-names = "default";
588 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
589 bus-width = <4>;
590 wp-gpios = <&gpc2 1 0>;
591 cap-sd-highspeed;
592};
593
594/*
595 * On Snow we've got SIP WiFi and so can keep drive strengths low to
596 * reduce EMI.
597 */
598&mmc_3 {
599 status = "okay";
600 num-slots = <1>;
601 broken-cd;
602 card-detect-delay = <200>;
603 samsung,dw-mshc-ciu-div = <3>;
604 samsung,dw-mshc-sdr-timing = <2 3>;
605 samsung,dw-mshc-ddr-timing = <1 2>;
606 pinctrl-names = "default";
607 pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_bus4>;
608 bus-width = <4>;
609 cap-sd-highspeed;
610};
611
503&pinctrl_0 { 612&pinctrl_0 {
504 max77686_irq: max77686-irq { 613 max77686_irq: max77686-irq {
505 samsung,pins = "gpx3-2"; 614 samsung,pins = "gpx3-2";
@@ -509,4 +618,10 @@
509 }; 618 };
510}; 619};
511 620
621&spi_1 {
622 status = "okay";
623 samsung,spi-src-clk = <0>;
624 num-cs = <1>;
625};
626
512#include "cros-ec-keyboard.dtsi" 627#include "cros-ec-keyboard.dtsi"
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 492e1eff37bd..f21b9aa00fbb 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -603,21 +603,6 @@
603 }; 603 };
604 }; 604 };
605 605
606 usb2_phy: usbphy@12130000 {
607 compatible = "samsung,exynos5250-usb2phy";
608 reg = <0x12130000 0x100>;
609 clocks = <&clock CLK_FIN_PLL>, <&clock CLK_USB2>;
610 clock-names = "ext_xtal", "usbhost";
611 #address-cells = <1>;
612 #size-cells = <1>;
613 ranges;
614
615 usbphy-sys {
616 reg = <0x10040704 0x8>,
617 <0x10050230 0x4>;
618 };
619 };
620
621 usb2_phy_gen: phy@12130000 { 606 usb2_phy_gen: phy@12130000 {
622 compatible = "samsung,exynos5250-usb2-phy"; 607 compatible = "samsung,exynos5250-usb2-phy";
623 reg = <0x12130000 0x100>; 608 reg = <0x12130000 0x100>;
diff --git a/arch/arm/boot/dts/exynos5260-xyref5260.dts b/arch/arm/boot/dts/exynos5260-xyref5260.dts
index 8c84ab27c19b..a803b605051b 100644
--- a/arch/arm/boot/dts/exynos5260-xyref5260.dts
+++ b/arch/arm/boot/dts/exynos5260-xyref5260.dts
@@ -69,7 +69,7 @@
69 num-slots = <1>; 69 num-slots = <1>;
70 broken-cd; 70 broken-cd;
71 bypass-smu; 71 bypass-smu;
72 supports-highspeed; 72 cap-mmc-highspeed;
73 supports-hs200-mode; /* 200 Mhz */ 73 supports-hs200-mode; /* 200 Mhz */
74 card-detect-delay = <200>; 74 card-detect-delay = <200>;
75 samsung,dw-mshc-ciu-div = <3>; 75 samsung,dw-mshc-ciu-div = <3>;
@@ -77,27 +77,19 @@
77 samsung,dw-mshc-ddr-timing = <0 2>; 77 samsung,dw-mshc-ddr-timing = <0 2>;
78 pinctrl-names = "default"; 78 pinctrl-names = "default";
79 pinctrl-0 = <&sd0_rdqs &sd0_clk &sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8>; 79 pinctrl-0 = <&sd0_rdqs &sd0_clk &sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8>;
80 80 bus-width = <8>;
81 slot@0 {
82 reg = <0>;
83 bus-width = <8>;
84 };
85}; 81};
86 82
87&mmc_2 { 83&mmc_2 {
88 status = "okay"; 84 status = "okay";
89 num-slots = <1>; 85 num-slots = <1>;
90 supports-highspeed; 86 cap-sd-highspeed;
91 card-detect-delay = <200>; 87 card-detect-delay = <200>;
92 samsung,dw-mshc-ciu-div = <3>; 88 samsung,dw-mshc-ciu-div = <3>;
93 samsung,dw-mshc-sdr-timing = <2 3>; 89 samsung,dw-mshc-sdr-timing = <2 3>;
94 samsung,dw-mshc-ddr-timing = <1 2>; 90 samsung,dw-mshc-ddr-timing = <1 2>;
95 pinctrl-names = "default"; 91 pinctrl-names = "default";
96 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus1 &sd2_bus4>; 92 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus1 &sd2_bus4>;
97 93 bus-width = <4>;
98 slot@0 { 94 disable-wp;
99 reg = <0>;
100 bus-width = <4>;
101 disable-wp;
102 };
103}; 95};
diff --git a/arch/arm/boot/dts/exynos5410-smdk5410.dts b/arch/arm/boot/dts/exynos5410-smdk5410.dts
index 7275bbd6fc4b..be3e02530b42 100644
--- a/arch/arm/boot/dts/exynos5410-smdk5410.dts
+++ b/arch/arm/boot/dts/exynos5410-smdk5410.dts
@@ -40,33 +40,25 @@
40&mmc_0 { 40&mmc_0 {
41 status = "okay"; 41 status = "okay";
42 num-slots = <1>; 42 num-slots = <1>;
43 supports-highspeed; 43 cap-mmc-highspeed;
44 broken-cd; 44 broken-cd;
45 card-detect-delay = <200>; 45 card-detect-delay = <200>;
46 samsung,dw-mshc-ciu-div = <3>; 46 samsung,dw-mshc-ciu-div = <3>;
47 samsung,dw-mshc-sdr-timing = <2 3>; 47 samsung,dw-mshc-sdr-timing = <2 3>;
48 samsung,dw-mshc-ddr-timing = <1 2>; 48 samsung,dw-mshc-ddr-timing = <1 2>;
49 49 bus-width = <8>;
50 slot@0 {
51 reg = <0>;
52 bus-width = <8>;
53 };
54}; 50};
55 51
56&mmc_2 { 52&mmc_2 {
57 status = "okay"; 53 status = "okay";
58 num-slots = <1>; 54 num-slots = <1>;
59 supports-highspeed; 55 cap-sd-highspeed;
60 card-detect-delay = <200>; 56 card-detect-delay = <200>;
61 samsung,dw-mshc-ciu-div = <3>; 57 samsung,dw-mshc-ciu-div = <3>;
62 samsung,dw-mshc-sdr-timing = <2 3>; 58 samsung,dw-mshc-sdr-timing = <2 3>;
63 samsung,dw-mshc-ddr-timing = <1 2>; 59 samsung,dw-mshc-ddr-timing = <1 2>;
64 60 bus-width = <4>;
65 slot@0 { 61 disable-wp;
66 reg = <0>;
67 bus-width = <4>;
68 disable-wp;
69 };
70}; 62};
71 63
72&uart0 { 64&uart0 {
diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
index 434fd9d3e09d..70a559cf1a3d 100644
--- a/arch/arm/boot/dts/exynos5420-arndale-octa.dts
+++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
@@ -50,7 +50,6 @@
50 mmc@12200000 { 50 mmc@12200000 {
51 status = "okay"; 51 status = "okay";
52 broken-cd; 52 broken-cd;
53 supports-highspeed;
54 card-detect-delay = <200>; 53 card-detect-delay = <200>;
55 samsung,dw-mshc-ciu-div = <3>; 54 samsung,dw-mshc-ciu-div = <3>;
56 samsung,dw-mshc-sdr-timing = <0 4>; 55 samsung,dw-mshc-sdr-timing = <0 4>;
@@ -58,16 +57,12 @@
58 pinctrl-names = "default"; 57 pinctrl-names = "default";
59 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>; 58 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
60 vmmc-supply = <&ldo10_reg>; 59 vmmc-supply = <&ldo10_reg>;
61 60 bus-width = <8>;
62 slot@0 { 61 cap-mmc-highspeed;
63 reg = <0>;
64 bus-width = <8>;
65 };
66 }; 62 };
67 63
68 mmc@12220000 { 64 mmc@12220000 {
69 status = "okay"; 65 status = "okay";
70 supports-highspeed;
71 card-detect-delay = <200>; 66 card-detect-delay = <200>;
72 samsung,dw-mshc-ciu-div = <3>; 67 samsung,dw-mshc-ciu-div = <3>;
73 samsung,dw-mshc-sdr-timing = <2 3>; 68 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -75,11 +70,8 @@
75 pinctrl-names = "default"; 70 pinctrl-names = "default";
76 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 71 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
77 vmmc-supply = <&ldo10_reg>; 72 vmmc-supply = <&ldo10_reg>;
78 73 bus-width = <4>;
79 slot@0 { 74 cap-sd-highspeed;
80 reg = <0>;
81 bus-width = <4>;
82 };
83 }; 75 };
84 76
85 hsi2c_4: i2c@12CA0000 { 77 hsi2c_4: i2c@12CA0000 {
diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
index 228a6b1e0aa1..9a233828539c 100644
--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
+++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
@@ -11,6 +11,7 @@
11/dts-v1/; 11/dts-v1/;
12#include <dt-bindings/input/input.h> 12#include <dt-bindings/input/input.h>
13#include <dt-bindings/gpio/gpio.h> 13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/interrupt-controller/irq.h>
14#include "exynos5420.dtsi" 15#include "exynos5420.dtsi"
15 16
16/ { 17/ {
@@ -30,11 +31,12 @@
30 i2c20 = "/spi@12d40000/cros-ec@0/i2c-tunnel"; 31 i2c20 = "/spi@12d40000/cros-ec@0/i2c-tunnel";
31 }; 32 };
32 33
33 backlight { 34 backlight: backlight {
34 compatible = "pwm-backlight"; 35 compatible = "pwm-backlight";
35 pwms = <&pwm 0 1000000 0>; 36 pwms = <&pwm 0 1000000 0>;
36 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>; 37 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>;
37 default-brightness-level = <7>; 38 default-brightness-level = <7>;
39 power-supply = <&tps65090_fet1>;
38 pinctrl-0 = <&pwm0_out>; 40 pinctrl-0 = <&pwm0_out>;
39 pinctrl-names = "default"; 41 pinctrl-names = "default";
40 }; 42 };
@@ -100,6 +102,17 @@
100 regulator-boot-on; 102 regulator-boot-on;
101 regulator-always-on; 103 regulator-always-on;
102 }; 104 };
105
106 panel: panel {
107 compatible = "auo,b116xw03";
108 power-supply = <&tps65090_fet6>;
109 backlight = <&backlight>;
110 };
111};
112
113&adc {
114 status = "okay";
115 vdd-supply = <&ldo9_reg>;
103}; 116};
104 117
105&dp { 118&dp {
@@ -113,22 +126,7 @@
113 samsung,link-rate = <0x06>; 126 samsung,link-rate = <0x06>;
114 samsung,lane-count = <2>; 127 samsung,lane-count = <2>;
115 samsung,hpd-gpio = <&gpx2 6 0>; 128 samsung,hpd-gpio = <&gpx2 6 0>;
116 129 bridge = <&ps8625>;
117 display-timings {
118 native-mode = <&timing1>;
119
120 timing1: timing@1 {
121 clock-frequency = <70589280>;
122 hactive = <1366>;
123 vactive = <768>;
124 hfront-porch = <40>;
125 hback-porch = <40>;
126 hsync-len = <32>;
127 vback-porch = <10>;
128 vfront-porch = <12>;
129 vsync-len = <6>;
130 };
131 };
132}; 130};
133 131
134&fimd { 132&fimd {
@@ -142,10 +140,348 @@
142 pinctrl-names = "default"; 140 pinctrl-names = "default";
143 pinctrl-0 = <&hdmi_hpd_irq>; 141 pinctrl-0 = <&hdmi_hpd_irq>;
144 ddc = <&i2c_2>; 142 ddc = <&i2c_2>;
143
144 hdmi-en-supply = <&tps65090_fet7>;
145 vdd-supply = <&ldo8_reg>;
146 vdd_osc-supply = <&ldo10_reg>;
147 vdd_pll-supply = <&ldo8_reg>;
148};
149
150&hsi2c_4 {
151 status = "okay";
152 clock-frequency = <400000>;
153
154 max77802-pmic@9 {
155 compatible = "maxim,max77802";
156 interrupt-parent = <&gpx3>;
157 interrupts = <1 IRQ_TYPE_NONE>;
158 pinctrl-names = "default";
159 pinctrl-0 = <&max77802_irq>, <&pmic_selb>,
160 <&pmic_dvs_1>, <&pmic_dvs_2>, <&pmic_dvs_3>;
161 wakeup-source;
162 reg = <0x9>;
163 #clock-cells = <1>;
164
165 inb1-supply = <&tps65090_dcdc2>;
166 inb2-supply = <&tps65090_dcdc1>;
167 inb3-supply = <&tps65090_dcdc2>;
168 inb4-supply = <&tps65090_dcdc2>;
169 inb5-supply = <&tps65090_dcdc1>;
170 inb6-supply = <&tps65090_dcdc2>;
171 inb7-supply = <&tps65090_dcdc1>;
172 inb8-supply = <&tps65090_dcdc1>;
173 inb9-supply = <&tps65090_dcdc1>;
174 inb10-supply = <&tps65090_dcdc1>;
175
176 inl1-supply = <&buck5_reg>;
177 inl2-supply = <&buck7_reg>;
178 inl3-supply = <&buck9_reg>;
179 inl4-supply = <&buck9_reg>;
180 inl5-supply = <&buck9_reg>;
181 inl6-supply = <&tps65090_dcdc2>;
182 inl7-supply = <&buck9_reg>;
183 inl9-supply = <&tps65090_dcdc2>;
184 inl10-supply = <&buck7_reg>;
185
186 regulators {
187 buck1_reg: BUCK1 {
188 regulator-name = "vdd_mif";
189 regulator-min-microvolt = <800000>;
190 regulator-max-microvolt = <1300000>;
191 regulator-always-on;
192 regulator-boot-on;
193 regulator-ramp-delay = <12500>;
194 };
195
196 buck2_reg: BUCK2 {
197 regulator-name = "vdd_arm";
198 regulator-min-microvolt = <800000>;
199 regulator-max-microvolt = <1500000>;
200 regulator-always-on;
201 regulator-boot-on;
202 regulator-ramp-delay = <12500>;
203 };
204
205 buck3_reg: BUCK3 {
206 regulator-name = "vdd_int";
207 regulator-min-microvolt = <800000>;
208 regulator-max-microvolt = <1400000>;
209 regulator-always-on;
210 regulator-boot-on;
211 regulator-ramp-delay = <12500>;
212 };
213
214 buck4_reg: BUCK4 {
215 regulator-name = "vdd_g3d";
216 regulator-min-microvolt = <700000>;
217 regulator-max-microvolt = <1400000>;
218 regulator-always-on;
219 regulator-boot-on;
220 regulator-ramp-delay = <12500>;
221 };
222
223 buck5_reg: BUCK5 {
224 regulator-name = "vdd_1v2";
225 regulator-min-microvolt = <1200000>;
226 regulator-max-microvolt = <1200000>;
227 regulator-always-on;
228 regulator-boot-on;
229 };
230
231 buck6_reg: BUCK6 {
232 regulator-name = "vdd_kfc";
233 regulator-min-microvolt = <800000>;
234 regulator-max-microvolt = <1500000>;
235 regulator-always-on;
236 regulator-boot-on;
237 regulator-ramp-delay = <12500>;
238 };
239
240 buck7_reg: BUCK7 {
241 regulator-name = "vdd_1v35";
242 regulator-min-microvolt = <1350000>;
243 regulator-max-microvolt = <1350000>;
244 regulator-always-on;
245 regulator-boot-on;
246 };
247
248 buck8_reg: BUCK8 {
249 regulator-name = "vdd_emmc";
250 regulator-min-microvolt = <2850000>;
251 regulator-max-microvolt = <2850000>;
252 regulator-always-on;
253 regulator-boot-on;
254 };
255
256 buck9_reg: BUCK9 {
257 regulator-name = "vdd_2v";
258 regulator-min-microvolt = <2000000>;
259 regulator-max-microvolt = <2000000>;
260 regulator-always-on;
261 regulator-boot-on;
262 };
263
264 buck10_reg: BUCK10 {
265 regulator-name = "vdd_1v8";
266 regulator-min-microvolt = <1800000>;
267 regulator-max-microvolt = <1800000>;
268 regulator-always-on;
269 regulator-boot-on;
270 };
271
272 ldo1_reg: LDO1 {
273 regulator-name = "vdd_1v0";
274 regulator-min-microvolt = <1000000>;
275 regulator-max-microvolt = <1000000>;
276 regulator-always-on;
277 };
278
279 ldo2_reg: LDO2 {
280 regulator-name = "vdd_1v2_2";
281 regulator-min-microvolt = <1200000>;
282 regulator-max-microvolt = <1200000>;
283 };
284
285 ldo3_reg: LDO3 {
286 regulator-name = "vdd_1v8_3";
287 regulator-min-microvolt = <1800000>;
288 regulator-max-microvolt = <1800000>;
289 regulator-always-on;
290 };
291
292 vqmmc_sdcard: ldo4_reg: LDO4 {
293 regulator-name = "vdd_sd";
294 regulator-min-microvolt = <1800000>;
295 regulator-max-microvolt = <2800000>;
296 regulator-always-on;
297 };
298
299 ldo5_reg: LDO5 {
300 regulator-name = "vdd_1v8_5";
301 regulator-min-microvolt = <1800000>;
302 regulator-max-microvolt = <1800000>;
303 regulator-always-on;
304 };
305
306 ldo6_reg: LDO6 {
307 regulator-name = "vdd_1v8_6";
308 regulator-min-microvolt = <1800000>;
309 regulator-max-microvolt = <1800000>;
310 regulator-always-on;
311 };
312
313 ldo7_reg: LDO7 {
314 regulator-name = "vdd_1v8_7";
315 regulator-min-microvolt = <1800000>;
316 regulator-max-microvolt = <1800000>;
317 };
318
319 ldo8_reg: LDO8 {
320 regulator-name = "vdd_ldo8";
321 regulator-min-microvolt = <1000000>;
322 regulator-max-microvolt = <1000000>;
323 regulator-always-on;
324 };
325
326 ldo9_reg: LDO9 {
327 regulator-name = "vdd_ldo9";
328 regulator-min-microvolt = <1800000>;
329 regulator-max-microvolt = <1800000>;
330 regulator-always-on;
331 };
332
333 ldo10_reg: LDO10 {
334 regulator-name = "vdd_ldo10";
335 regulator-min-microvolt = <1800000>;
336 regulator-max-microvolt = <1800000>;
337 regulator-always-on;
338 };
339
340 ldo11_reg: LDO11 {
341 regulator-name = "vdd_ldo11";
342 regulator-min-microvolt = <1800000>;
343 regulator-max-microvolt = <1800000>;
344 regulator-always-on;
345 };
346
347 ldo12_reg: LDO12 {
348 regulator-name = "vdd_ldo12";
349 regulator-min-microvolt = <3000000>;
350 regulator-max-microvolt = <3000000>;
351 regulator-always-on;
352 };
353
354 ldo13_reg: LDO13 {
355 regulator-name = "vdd_ldo13";
356 regulator-min-microvolt = <1800000>;
357 regulator-max-microvolt = <1800000>;
358 regulator-always-on;
359 };
360
361 ldo14_reg: LDO14 {
362 regulator-name = "vdd_ldo14";
363 regulator-min-microvolt = <1800000>;
364 regulator-max-microvolt = <1800000>;
365 regulator-always-on;
366 };
367
368 ldo15_reg: LDO15 {
369 regulator-name = "vdd_ldo15";
370 regulator-min-microvolt = <1000000>;
371 regulator-max-microvolt = <1000000>;
372 regulator-always-on;
373 };
374
375 ldo17_reg: LDO17 {
376 regulator-name = "vdd_g3ds";
377 regulator-min-microvolt = <900000>;
378 regulator-max-microvolt = <1400000>;
379 regulator-always-on;
380 };
381
382 ldo18_reg: LDO18 {
383 regulator-name = "ldo_18";
384 regulator-min-microvolt = <1800000>;
385 regulator-max-microvolt = <1800000>;
386 };
387
388 ldo19_reg: LDO19 {
389 regulator-name = "ldo_19";
390 regulator-min-microvolt = <1800000>;
391 regulator-max-microvolt = <1800000>;
392 };
393
394 ldo20_reg: LDO20 {
395 regulator-name = "ldo_20";
396 regulator-min-microvolt = <1800000>;
397 regulator-max-microvolt = <1800000>;
398 regulator-always-on;
399 };
400
401 ldo21_reg: LDO21 {
402 regulator-name = "ldo_21";
403 regulator-min-microvolt = <2800000>;
404 regulator-max-microvolt = <2800000>;
405 };
406
407 ldo23_reg: LDO23 {
408 regulator-name = "ldo_23";
409 regulator-min-microvolt = <3300000>;
410 regulator-max-microvolt = <3300000>;
411 };
412 ldo24_reg: LDO24 {
413 regulator-name = "ldo_24";
414 regulator-min-microvolt = <2800000>;
415 regulator-max-microvolt = <2800000>;
416 };
417
418 ldo25_reg: LDO25 {
419 regulator-name = "ldo_25";
420 regulator-min-microvolt = <3300000>;
421 regulator-max-microvolt = <3300000>;
422 };
423
424 ldo26_reg: LDO26 {
425 regulator-name = "ldo_26";
426 regulator-min-microvolt = <1200000>;
427 regulator-max-microvolt = <1200000>;
428 };
429
430 ldo27_reg: LDO27 {
431 regulator-name = "ldo_27";
432 regulator-min-microvolt = <1200000>;
433 regulator-max-microvolt = <1200000>;
434 };
435
436 ldo28_reg: LDO28 {
437 regulator-name = "ldo_28";
438 regulator-min-microvolt = <1800000>;
439 regulator-max-microvolt = <1800000>;
440 };
441
442 ldo29_reg: LDO29 {
443 regulator-name = "ldo_29";
444 regulator-min-microvolt = <1800000>;
445 regulator-max-microvolt = <1800000>;
446 };
447
448 ldo30_reg: LDO30 {
449 regulator-name = "vdd_mifs";
450 regulator-min-microvolt = <1000000>;
451 regulator-max-microvolt = <1000000>;
452 regulator-always-on;
453 };
454
455 ldo32_reg: LDO32 {
456 regulator-name = "ldo_32";
457 regulator-min-microvolt = <3000000>;
458 regulator-max-microvolt = <3000000>;
459 };
460
461 ldo33_reg: LDO33 {
462 regulator-name = "ldo_33";
463 regulator-min-microvolt = <2800000>;
464 regulator-max-microvolt = <2800000>;
465 };
466
467 ldo34_reg: LDO34 {
468 regulator-name = "ldo_34";
469 regulator-min-microvolt = <3000000>;
470 regulator-max-microvolt = <3000000>;
471 };
472
473 ldo35_reg: LDO35 {
474 regulator-name = "ldo_35";
475 regulator-min-microvolt = <1200000>;
476 regulator-max-microvolt = <1200000>;
477 };
478 };
479 };
145}; 480};
146 481
147&hsi2c_7 { 482&hsi2c_7 {
148 status = "okay"; 483 status = "okay";
484 clock-frequency = <400000>;
149 485
150 max98090: codec@10 { 486 max98090: codec@10 {
151 compatible = "maxim,max98090"; 487 compatible = "maxim,max98090";
@@ -155,6 +491,44 @@
155 pinctrl-names = "default"; 491 pinctrl-names = "default";
156 pinctrl-0 = <&max98090_irq>; 492 pinctrl-0 = <&max98090_irq>;
157 }; 493 };
494
495 light-sensor@44 {
496 compatible = "isil,isl29018";
497 reg = <0x44>;
498 vcc-supply = <&tps65090_fet5>;
499 };
500
501 ps8625: lvds-bridge@48 {
502 compatible = "parade,ps8625";
503 reg = <0x48>;
504 sleep-gpios = <&gpx3 5 GPIO_ACTIVE_HIGH>;
505 reset-gpios = <&gpy7 7 GPIO_ACTIVE_HIGH>;
506 lane-count = <2>;
507 panel = <&panel>;
508 use-external-pwm;
509 };
510};
511
512&hsi2c_8 {
513 status = "okay";
514 clock-frequency = <333000>;
515
516 /* Atmel mXT336S */
517 trackpad@4b {
518 compatible = "atmel,maxtouch";
519 reg = <0x4b>;
520 interrupt-parent = <&gpx1>;
521 interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
522 wakeup-source;
523 pinctrl-names = "default";
524 pinctrl-0 = <&trackpad_irq>;
525 linux,gpio-keymap = <KEY_RESERVED
526 KEY_RESERVED
527 KEY_RESERVED /* GPIO0 */
528 KEY_RESERVED /* GPIO1 */
529 KEY_RESERVED /* GPIO2 */
530 BTN_LEFT>; /* GPIO3 */
531 };
158}; 532};
159 533
160&hsi2c_9 { 534&hsi2c_9 {
@@ -187,7 +561,7 @@
187 num-slots = <1>; 561 num-slots = <1>;
188 broken-cd; 562 broken-cd;
189 caps2-mmc-hs200-1_8v; 563 caps2-mmc-hs200-1_8v;
190 supports-highspeed; 564 cap-mmc-highspeed;
191 non-removable; 565 non-removable;
192 card-detect-delay = <200>; 566 card-detect-delay = <200>;
193 clock-frequency = <400000000>; 567 clock-frequency = <400000000>;
@@ -196,17 +570,13 @@
196 samsung,dw-mshc-ddr-timing = <0 2>; 570 samsung,dw-mshc-ddr-timing = <0 2>;
197 pinctrl-names = "default"; 571 pinctrl-names = "default";
198 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>; 572 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
199 573 bus-width = <8>;
200 slot@0 {
201 reg = <0>;
202 bus-width = <8>;
203 };
204}; 574};
205 575
206&mmc_2 { 576&mmc_2 {
207 status = "okay"; 577 status = "okay";
208 num-slots = <1>; 578 num-slots = <1>;
209 supports-highspeed; 579 cap-sd-highspeed;
210 card-detect-delay = <200>; 580 card-detect-delay = <200>;
211 clock-frequency = <400000000>; 581 clock-frequency = <400000000>;
212 samsung,dw-mshc-ciu-div = <3>; 582 samsung,dw-mshc-ciu-div = <3>;
@@ -214,11 +584,7 @@
214 samsung,dw-mshc-ddr-timing = <1 2>; 584 samsung,dw-mshc-ddr-timing = <1 2>;
215 pinctrl-names = "default"; 585 pinctrl-names = "default";
216 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 586 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
217 587 bus-width = <4>;
218 slot@0 {
219 reg = <0>;
220 bus-width = <4>;
221 };
222}; 588};
223 589
224 590
@@ -249,6 +615,13 @@
249 samsung,pin-drv = <0>; 615 samsung,pin-drv = <0>;
250 }; 616 };
251 617
618 trackpad_irq: trackpad-irq {
619 samsung,pins = "gpx1-1";
620 samsung,pin-function = <0xf>;
621 samsung,pin-pud = <0>;
622 samsung,pin-drv = <0>;
623 };
624
252 power_key_irq: power-key-irq { 625 power_key_irq: power-key-irq {
253 samsung,pins = "gpx1-2"; 626 samsung,pins = "gpx1-2";
254 samsung,pin-function = <0>; 627 samsung,pin-function = <0>;
@@ -277,12 +650,42 @@
277 samsung,pin-drv = <0>; 650 samsung,pin-drv = <0>;
278 }; 651 };
279 652
653 max77802_irq: max77802-irq {
654 samsung,pins = "gpx3-1";
655 samsung,pin-function = <0>;
656 samsung,pin-pud = <0>;
657 samsung,pin-drv = <0>;
658 };
659
280 hdmi_hpd_irq: hdmi-hpd-irq { 660 hdmi_hpd_irq: hdmi-hpd-irq {
281 samsung,pins = "gpx3-7"; 661 samsung,pins = "gpx3-7";
282 samsung,pin-function = <0>; 662 samsung,pin-function = <0>;
283 samsung,pin-pud = <1>; 663 samsung,pin-pud = <1>;
284 samsung,pin-drv = <0>; 664 samsung,pin-drv = <0>;
285 }; 665 };
666
667 pmic_dvs_1: pmic-dvs-1 {
668 samsung,pins = "gpy7-6";
669 samsung,pin-function = <1>;
670 samsung,pin-pud = <0>;
671 samsung,pin-drv = <0>;
672 };
673};
674
675&pinctrl_2 {
676 pmic_dvs_2: pmic-dvs-2 {
677 samsung,pins = "gpj4-2";
678 samsung,pin-function = <1>;
679 samsung,pin-pud = <0>;
680 samsung,pin-drv = <0>;
681 };
682
683 pmic_dvs_3: pmic-dvs-3 {
684 samsung,pins = "gpj4-3";
685 samsung,pin-function = <1>;
686 samsung,pin-pud = <0>;
687 samsung,pin-drv = <0>;
688 };
286}; 689};
287 690
288&pinctrl_3 { 691&pinctrl_3 {
@@ -312,6 +715,14 @@
312 samsung,pin-pud = <0>; 715 samsung,pin-pud = <0>;
313 samsung,pin-drv = <0>; 716 samsung,pin-drv = <0>;
314 }; 717 };
718
719 pmic_selb: pmic-selb {
720 samsung,pins = "gph0-2", "gph0-3", "gph0-4", "gph0-5",
721 "gph0-6";
722 samsung,pin-function = <1>;
723 samsung,pin-pud = <0>;
724 samsung,pin-drv = <0>;
725 };
315}; 726};
316 727
317&rtc { 728&rtc {
@@ -365,12 +776,12 @@
365 vsys2-supply = <&vbat>; 776 vsys2-supply = <&vbat>;
366 vsys3-supply = <&vbat>; 777 vsys3-supply = <&vbat>;
367 infet1-supply = <&vbat>; 778 infet1-supply = <&vbat>;
368 infet2-supply = <&vbat>; 779 infet2-supply = <&tps65090_dcdc1>;
369 infet3-supply = <&vbat>; 780 infet3-supply = <&tps65090_dcdc2>;
370 infet4-supply = <&vbat>; 781 infet4-supply = <&tps65090_dcdc2>;
371 infet5-supply = <&vbat>; 782 infet5-supply = <&tps65090_dcdc2>;
372 infet6-supply = <&vbat>; 783 infet6-supply = <&tps65090_dcdc2>;
373 infet7-supply = <&vbat>; 784 infet7-supply = <&tps65090_dcdc1>;
374 vsys-l1-supply = <&vbat>; 785 vsys-l1-supply = <&vbat>;
375 vsys-l2-supply = <&vbat>; 786 vsys-l2-supply = <&vbat>;
376 787
@@ -445,3 +856,4 @@
445}; 856};
446 857
447#include "cros-ec-keyboard.dtsi" 858#include "cros-ec-keyboard.dtsi"
859#include "cros-adc-thermistors.dtsi"
diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts
index 6052aa9c5659..8be3d7b489ff 100644
--- a/arch/arm/boot/dts/exynos5420-smdk5420.dts
+++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts
@@ -76,34 +76,26 @@
76 mmc@12200000 { 76 mmc@12200000 {
77 status = "okay"; 77 status = "okay";
78 broken-cd; 78 broken-cd;
79 supports-highspeed;
80 card-detect-delay = <200>; 79 card-detect-delay = <200>;
81 samsung,dw-mshc-ciu-div = <3>; 80 samsung,dw-mshc-ciu-div = <3>;
82 samsung,dw-mshc-sdr-timing = <0 4>; 81 samsung,dw-mshc-sdr-timing = <0 4>;
83 samsung,dw-mshc-ddr-timing = <0 2>; 82 samsung,dw-mshc-ddr-timing = <0 2>;
84 pinctrl-names = "default"; 83 pinctrl-names = "default";
85 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>; 84 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
86 85 bus-width = <8>;
87 slot@0 { 86 cap-mmc-highspeed;
88 reg = <0>;
89 bus-width = <8>;
90 };
91 }; 87 };
92 88
93 mmc@12220000 { 89 mmc@12220000 {
94 status = "okay"; 90 status = "okay";
95 supports-highspeed;
96 card-detect-delay = <200>; 91 card-detect-delay = <200>;
97 samsung,dw-mshc-ciu-div = <3>; 92 samsung,dw-mshc-ciu-div = <3>;
98 samsung,dw-mshc-sdr-timing = <2 3>; 93 samsung,dw-mshc-sdr-timing = <2 3>;
99 samsung,dw-mshc-ddr-timing = <1 2>; 94 samsung,dw-mshc-ddr-timing = <1 2>;
100 pinctrl-names = "default"; 95 pinctrl-names = "default";
101 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 96 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
102 97 bus-width = <4>;
103 slot@0 { 98 cap-sd-highspeed;
104 reg = <0>;
105 bus-width = <4>;
106 };
107 }; 99 };
108 100
109 dp-controller@145B0000 { 101 dp-controller@145B0000 {
diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
index f3ee48bbe05f..1d31c8132558 100644
--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
@@ -11,6 +11,7 @@
11/dts-v1/; 11/dts-v1/;
12#include <dt-bindings/input/input.h> 12#include <dt-bindings/input/input.h>
13#include <dt-bindings/gpio/gpio.h> 13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/interrupt-controller/irq.h>
14#include "exynos5800.dtsi" 15#include "exynos5800.dtsi"
15 16
16/ { 17/ {
@@ -28,11 +29,13 @@
28 i2c20 = "/spi@12d40000/cros-ec@0/i2c-tunnel"; 29 i2c20 = "/spi@12d40000/cros-ec@0/i2c-tunnel";
29 }; 30 };
30 31
31 backlight { 32 backlight: backlight {
32 compatible = "pwm-backlight"; 33 compatible = "pwm-backlight";
33 pwms = <&pwm 0 1000000 0>; 34 pwms = <&pwm 0 1000000 0>;
34 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>; 35 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>;
35 default-brightness-level = <7>; 36 default-brightness-level = <7>;
37 enable-gpios = <&gpx2 2 GPIO_ACTIVE_HIGH>;
38 power-supply = <&tps65090_fet1>;
36 pinctrl-0 = <&pwm0_out>; 39 pinctrl-0 = <&pwm0_out>;
37 pinctrl-names = "default"; 40 pinctrl-names = "default";
38 }; 41 };
@@ -98,6 +101,17 @@
98 regulator-boot-on; 101 regulator-boot-on;
99 regulator-always-on; 102 regulator-always-on;
100 }; 103 };
104
105 panel: panel {
106 compatible = "auo,b133htn01";
107 power-supply = <&tps65090_fet6>;
108 backlight = <&backlight>;
109 };
110};
111
112&adc {
113 status = "okay";
114 vdd-supply = <&ldo9_reg>;
101}; 115};
102 116
103&dp { 117&dp {
@@ -111,22 +125,7 @@
111 samsung,link-rate = <0x0a>; 125 samsung,link-rate = <0x0a>;
112 samsung,lane-count = <2>; 126 samsung,lane-count = <2>;
113 samsung,hpd-gpio = <&gpx2 6 0>; 127 samsung,hpd-gpio = <&gpx2 6 0>;
114 128 panel = <&panel>;
115 display-timings {
116 native-mode = <&timing1>;
117
118 timing1: timing@1 {
119 clock-frequency = <150660000>;
120 hactive = <1920>;
121 vactive = <1080>;
122 hfront-porch = <60>;
123 hback-porch = <172>;
124 hsync-len = <80>;
125 vback-porch = <25>;
126 vfront-porch = <10>;
127 vsync-len = <10>;
128 };
129 };
130}; 129};
131 130
132&fimd { 131&fimd {
@@ -140,10 +139,348 @@
140 pinctrl-names = "default"; 139 pinctrl-names = "default";
141 pinctrl-0 = <&hdmi_hpd_irq>; 140 pinctrl-0 = <&hdmi_hpd_irq>;
142 ddc = <&i2c_2>; 141 ddc = <&i2c_2>;
142
143 hdmi-en-supply = <&tps65090_fet7>;
144 vdd-supply = <&ldo8_reg>;
145 vdd_osc-supply = <&ldo10_reg>;
146 vdd_pll-supply = <&ldo8_reg>;
147};
148
149&hsi2c_4 {
150 status = "okay";
151 clock-frequency = <400000>;
152
153 max77802-pmic@9 {
154 compatible = "maxim,max77802";
155 interrupt-parent = <&gpx3>;
156 interrupts = <1 IRQ_TYPE_NONE>;
157 pinctrl-names = "default";
158 pinctrl-0 = <&max77802_irq>, <&pmic_selb>,
159 <&pmic_dvs_1>, <&pmic_dvs_2>, <&pmic_dvs_3>;
160 wakeup-source;
161 reg = <0x9>;
162 #clock-cells = <1>;
163
164 inb1-supply = <&tps65090_dcdc2>;
165 inb2-supply = <&tps65090_dcdc1>;
166 inb3-supply = <&tps65090_dcdc2>;
167 inb4-supply = <&tps65090_dcdc2>;
168 inb5-supply = <&tps65090_dcdc1>;
169 inb6-supply = <&tps65090_dcdc2>;
170 inb7-supply = <&tps65090_dcdc1>;
171 inb8-supply = <&tps65090_dcdc1>;
172 inb9-supply = <&tps65090_dcdc1>;
173 inb10-supply = <&tps65090_dcdc1>;
174
175 inl1-supply = <&buck5_reg>;
176 inl2-supply = <&buck7_reg>;
177 inl3-supply = <&buck9_reg>;
178 inl4-supply = <&buck9_reg>;
179 inl5-supply = <&buck9_reg>;
180 inl6-supply = <&tps65090_dcdc2>;
181 inl7-supply = <&buck9_reg>;
182 inl9-supply = <&tps65090_dcdc2>;
183 inl10-supply = <&buck7_reg>;
184
185 regulators {
186 buck1_reg: BUCK1 {
187 regulator-name = "vdd_mif";
188 regulator-min-microvolt = <800000>;
189 regulator-max-microvolt = <1300000>;
190 regulator-always-on;
191 regulator-boot-on;
192 regulator-ramp-delay = <12500>;
193 };
194
195 buck2_reg: BUCK2 {
196 regulator-name = "vdd_arm";
197 regulator-min-microvolt = <800000>;
198 regulator-max-microvolt = <1500000>;
199 regulator-always-on;
200 regulator-boot-on;
201 regulator-ramp-delay = <12500>;
202 };
203
204 buck3_reg: BUCK3 {
205 regulator-name = "vdd_int";
206 regulator-min-microvolt = <800000>;
207 regulator-max-microvolt = <1400000>;
208 regulator-always-on;
209 regulator-boot-on;
210 regulator-ramp-delay = <12500>;
211 };
212
213 buck4_reg: BUCK4 {
214 regulator-name = "vdd_g3d";
215 regulator-min-microvolt = <700000>;
216 regulator-max-microvolt = <1400000>;
217 regulator-always-on;
218 regulator-boot-on;
219 regulator-ramp-delay = <12500>;
220 };
221
222 buck5_reg: BUCK5 {
223 regulator-name = "vdd_1v2";
224 regulator-min-microvolt = <1200000>;
225 regulator-max-microvolt = <1200000>;
226 regulator-always-on;
227 regulator-boot-on;
228 };
229
230 buck6_reg: BUCK6 {
231 regulator-name = "vdd_kfc";
232 regulator-min-microvolt = <800000>;
233 regulator-max-microvolt = <1500000>;
234 regulator-always-on;
235 regulator-boot-on;
236 regulator-ramp-delay = <12500>;
237 };
238
239 buck7_reg: BUCK7 {
240 regulator-name = "vdd_1v35";
241 regulator-min-microvolt = <1350000>;
242 regulator-max-microvolt = <1350000>;
243 regulator-always-on;
244 regulator-boot-on;
245 };
246
247 buck8_reg: BUCK8 {
248 regulator-name = "vdd_emmc";
249 regulator-min-microvolt = <2850000>;
250 regulator-max-microvolt = <2850000>;
251 regulator-always-on;
252 regulator-boot-on;
253 };
254
255 buck9_reg: BUCK9 {
256 regulator-name = "vdd_2v";
257 regulator-min-microvolt = <2000000>;
258 regulator-max-microvolt = <2000000>;
259 regulator-always-on;
260 regulator-boot-on;
261 };
262
263 buck10_reg: BUCK10 {
264 regulator-name = "vdd_1v8";
265 regulator-min-microvolt = <1800000>;
266 regulator-max-microvolt = <1800000>;
267 regulator-always-on;
268 regulator-boot-on;
269 };
270
271 ldo1_reg: LDO1 {
272 regulator-name = "vdd_1v0";
273 regulator-min-microvolt = <1000000>;
274 regulator-max-microvolt = <1000000>;
275 regulator-always-on;
276 };
277
278 ldo2_reg: LDO2 {
279 regulator-name = "vdd_1v2_2";
280 regulator-min-microvolt = <1200000>;
281 regulator-max-microvolt = <1200000>;
282 };
283
284 ldo3_reg: LDO3 {
285 regulator-name = "vdd_1v8_3";
286 regulator-min-microvolt = <1800000>;
287 regulator-max-microvolt = <1800000>;
288 regulator-always-on;
289 };
290
291 vqmmc_sdcard: ldo4_reg: LDO4 {
292 regulator-name = "vdd_sd";
293 regulator-min-microvolt = <1800000>;
294 regulator-max-microvolt = <2800000>;
295 regulator-always-on;
296 };
297
298 ldo5_reg: LDO5 {
299 regulator-name = "vdd_1v8_5";
300 regulator-min-microvolt = <1800000>;
301 regulator-max-microvolt = <1800000>;
302 regulator-always-on;
303 };
304
305 ldo6_reg: LDO6 {
306 regulator-name = "vdd_1v8_6";
307 regulator-min-microvolt = <1800000>;
308 regulator-max-microvolt = <1800000>;
309 regulator-always-on;
310 };
311
312 ldo7_reg: LDO7 {
313 regulator-name = "vdd_1v8_7";
314 regulator-min-microvolt = <1800000>;
315 regulator-max-microvolt = <1800000>;
316 };
317
318 ldo8_reg: LDO8 {
319 regulator-name = "vdd_ldo8";
320 regulator-min-microvolt = <1000000>;
321 regulator-max-microvolt = <1000000>;
322 regulator-always-on;
323 };
324
325 ldo9_reg: LDO9 {
326 regulator-name = "vdd_ldo9";
327 regulator-min-microvolt = <1800000>;
328 regulator-max-microvolt = <1800000>;
329 regulator-always-on;
330 };
331
332 ldo10_reg: LDO10 {
333 regulator-name = "vdd_ldo10";
334 regulator-min-microvolt = <1800000>;
335 regulator-max-microvolt = <1800000>;
336 regulator-always-on;
337 };
338
339 ldo11_reg: LDO11 {
340 regulator-name = "vdd_ldo11";
341 regulator-min-microvolt = <1800000>;
342 regulator-max-microvolt = <1800000>;
343 regulator-always-on;
344 };
345
346 ldo12_reg: LDO12 {
347 regulator-name = "vdd_ldo12";
348 regulator-min-microvolt = <3000000>;
349 regulator-max-microvolt = <3000000>;
350 regulator-always-on;
351 };
352
353 ldo13_reg: LDO13 {
354 regulator-name = "vdd_ldo13";
355 regulator-min-microvolt = <1800000>;
356 regulator-max-microvolt = <1800000>;
357 regulator-always-on;
358 };
359
360 ldo14_reg: LDO14 {
361 regulator-name = "vdd_ldo14";
362 regulator-min-microvolt = <1800000>;
363 regulator-max-microvolt = <1800000>;
364 regulator-always-on;
365 };
366
367 ldo15_reg: LDO15 {
368 regulator-name = "vdd_ldo15";
369 regulator-min-microvolt = <1000000>;
370 regulator-max-microvolt = <1000000>;
371 regulator-always-on;
372 };
373
374 ldo17_reg: LDO17 {
375 regulator-name = "vdd_g3ds";
376 regulator-min-microvolt = <900000>;
377 regulator-max-microvolt = <1400000>;
378 regulator-always-on;
379 };
380
381 ldo18_reg: LDO18 {
382 regulator-name = "ldo_18";
383 regulator-min-microvolt = <1800000>;
384 regulator-max-microvolt = <1800000>;
385 };
386
387 ldo19_reg: LDO19 {
388 regulator-name = "ldo_19";
389 regulator-min-microvolt = <1800000>;
390 regulator-max-microvolt = <1800000>;
391 };
392
393 ldo20_reg: LDO20 {
394 regulator-name = "ldo_20";
395 regulator-min-microvolt = <1800000>;
396 regulator-max-microvolt = <1800000>;
397 regulator-always-on;
398 };
399
400 ldo21_reg: LDO21 {
401 regulator-name = "ldo_21";
402 regulator-min-microvolt = <2800000>;
403 regulator-max-microvolt = <2800000>;
404 };
405
406 ldo23_reg: LDO23 {
407 regulator-name = "ldo_23";
408 regulator-min-microvolt = <3300000>;
409 regulator-max-microvolt = <3300000>;
410 };
411 ldo24_reg: LDO24 {
412 regulator-name = "ldo_24";
413 regulator-min-microvolt = <2800000>;
414 regulator-max-microvolt = <2800000>;
415 };
416
417 ldo25_reg: LDO25 {
418 regulator-name = "ldo_25";
419 regulator-min-microvolt = <3300000>;
420 regulator-max-microvolt = <3300000>;
421 };
422
423 ldo26_reg: LDO26 {
424 regulator-name = "ldo_26";
425 regulator-min-microvolt = <1200000>;
426 regulator-max-microvolt = <1200000>;
427 };
428
429 ldo27_reg: LDO27 {
430 regulator-name = "ldo_27";
431 regulator-min-microvolt = <1200000>;
432 regulator-max-microvolt = <1200000>;
433 };
434
435 ldo28_reg: LDO28 {
436 regulator-name = "ldo_28";
437 regulator-min-microvolt = <1800000>;
438 regulator-max-microvolt = <1800000>;
439 };
440
441 ldo29_reg: LDO29 {
442 regulator-name = "ldo_29";
443 regulator-min-microvolt = <1800000>;
444 regulator-max-microvolt = <1800000>;
445 };
446
447 ldo30_reg: LDO30 {
448 regulator-name = "vdd_mifs";
449 regulator-min-microvolt = <1000000>;
450 regulator-max-microvolt = <1000000>;
451 regulator-always-on;
452 };
453
454 ldo32_reg: LDO32 {
455 regulator-name = "ldo_32";
456 regulator-min-microvolt = <3000000>;
457 regulator-max-microvolt = <3000000>;
458 };
459
460 ldo33_reg: LDO33 {
461 regulator-name = "ldo_33";
462 regulator-min-microvolt = <2800000>;
463 regulator-max-microvolt = <2800000>;
464 };
465
466 ldo34_reg: LDO34 {
467 regulator-name = "ldo_34";
468 regulator-min-microvolt = <3000000>;
469 regulator-max-microvolt = <3000000>;
470 };
471
472 ldo35_reg: LDO35 {
473 regulator-name = "ldo_35";
474 regulator-min-microvolt = <1200000>;
475 regulator-max-microvolt = <1200000>;
476 };
477 };
478 };
143}; 479};
144 480
145&hsi2c_7 { 481&hsi2c_7 {
146 status = "okay"; 482 status = "okay";
483 clock-frequency = <400000>;
147 484
148 max98091: codec@10 { 485 max98091: codec@10 {
149 compatible = "maxim,max98091"; 486 compatible = "maxim,max98091";
@@ -153,6 +490,33 @@
153 pinctrl-names = "default"; 490 pinctrl-names = "default";
154 pinctrl-0 = <&max98091_irq>; 491 pinctrl-0 = <&max98091_irq>;
155 }; 492 };
493
494 light-sensor@44 {
495 compatible = "isil,isl29018";
496 reg = <0x44>;
497 vcc-supply = <&tps65090_fet5>;
498 };
499};
500
501&hsi2c_8 {
502 status = "okay";
503 clock-frequency = <333000>;
504 /* Atmel mXT540S */
505 trackpad@4b {
506 compatible = "atmel,maxtouch";
507 reg = <0x4b>;
508 interrupt-parent = <&gpx1>;
509 interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
510 wakeup-source;
511 pinctrl-names = "default";
512 pinctrl-0 = <&trackpad_irq>;
513 linux,gpio-keymap = <KEY_RESERVED
514 KEY_RESERVED
515 KEY_RESERVED /* GPIO 0 */
516 KEY_RESERVED /* GPIO 1 */
517 BTN_LEFT /* GPIO 2 */
518 KEY_RESERVED>; /* GPIO 3 */
519 };
156}; 520};
157 521
158&hsi2c_9 { 522&hsi2c_9 {
@@ -185,7 +549,7 @@
185 num-slots = <1>; 549 num-slots = <1>;
186 broken-cd; 550 broken-cd;
187 caps2-mmc-hs200-1_8v; 551 caps2-mmc-hs200-1_8v;
188 supports-highspeed; 552 cap-mmc-highspeed;
189 non-removable; 553 non-removable;
190 card-detect-delay = <200>; 554 card-detect-delay = <200>;
191 clock-frequency = <400000000>; 555 clock-frequency = <400000000>;
@@ -194,17 +558,13 @@
194 samsung,dw-mshc-ddr-timing = <0 2>; 558 samsung,dw-mshc-ddr-timing = <0 2>;
195 pinctrl-names = "default"; 559 pinctrl-names = "default";
196 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>; 560 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
197 561 bus-width = <8>;
198 slot@0 {
199 reg = <0>;
200 bus-width = <8>;
201 };
202}; 562};
203 563
204&mmc_2 { 564&mmc_2 {
205 status = "okay"; 565 status = "okay";
206 num-slots = <1>; 566 num-slots = <1>;
207 supports-highspeed; 567 cap-sd-highspeed;
208 card-detect-delay = <200>; 568 card-detect-delay = <200>;
209 clock-frequency = <400000000>; 569 clock-frequency = <400000000>;
210 samsung,dw-mshc-ciu-div = <3>; 570 samsung,dw-mshc-ciu-div = <3>;
@@ -212,11 +572,7 @@
212 samsung,dw-mshc-ddr-timing = <1 2>; 572 samsung,dw-mshc-ddr-timing = <1 2>;
213 pinctrl-names = "default"; 573 pinctrl-names = "default";
214 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 574 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
215 575 bus-width = <4>;
216 slot@0 {
217 reg = <0>;
218 bus-width = <4>;
219 };
220}; 576};
221 577
222 578
@@ -247,6 +603,13 @@
247 samsung,pin-drv = <0>; 603 samsung,pin-drv = <0>;
248 }; 604 };
249 605
606 trackpad_irq: trackpad-irq {
607 samsung,pins = "gpx1-1";
608 samsung,pin-function = <0xf>;
609 samsung,pin-pud = <0>;
610 samsung,pin-drv = <0>;
611 };
612
250 power_key_irq: power-key-irq { 613 power_key_irq: power-key-irq {
251 samsung,pins = "gpx1-2"; 614 samsung,pins = "gpx1-2";
252 samsung,pin-function = <0>; 615 samsung,pin-function = <0>;
@@ -275,12 +638,42 @@
275 samsung,pin-drv = <0>; 638 samsung,pin-drv = <0>;
276 }; 639 };
277 640
641 max77802_irq: max77802-irq {
642 samsung,pins = "gpx3-1";
643 samsung,pin-function = <0>;
644 samsung,pin-pud = <0>;
645 samsung,pin-drv = <0>;
646 };
647
278 hdmi_hpd_irq: hdmi-hpd-irq { 648 hdmi_hpd_irq: hdmi-hpd-irq {
279 samsung,pins = "gpx3-7"; 649 samsung,pins = "gpx3-7";
280 samsung,pin-function = <0>; 650 samsung,pin-function = <0>;
281 samsung,pin-pud = <1>; 651 samsung,pin-pud = <1>;
282 samsung,pin-drv = <0>; 652 samsung,pin-drv = <0>;
283 }; 653 };
654
655 pmic_dvs_1: pmic-dvs-1 {
656 samsung,pins = "gpy7-6";
657 samsung,pin-function = <1>;
658 samsung,pin-pud = <0>;
659 samsung,pin-drv = <0>;
660 };
661};
662
663&pinctrl_2 {
664 pmic_dvs_2: pmic-dvs-2 {
665 samsung,pins = "gpj4-2";
666 samsung,pin-function = <1>;
667 samsung,pin-pud = <0>;
668 samsung,pin-drv = <0>;
669 };
670
671 pmic_dvs_3: pmic-dvs-3 {
672 samsung,pins = "gpj4-3";
673 samsung,pin-function = <1>;
674 samsung,pin-pud = <0>;
675 samsung,pin-drv = <0>;
676 };
284}; 677};
285 678
286&pinctrl_3 { 679&pinctrl_3 {
@@ -310,6 +703,14 @@
310 samsung,pin-pud = <0>; 703 samsung,pin-pud = <0>;
311 samsung,pin-drv = <0>; 704 samsung,pin-drv = <0>;
312 }; 705 };
706
707 pmic_selb: pmic-selb {
708 samsung,pins = "gph0-2", "gph0-3", "gph0-4", "gph0-5",
709 "gph0-6";
710 samsung,pin-function = <1>;
711 samsung,pin-pud = <0>;
712 samsung,pin-drv = <0>;
713 };
313}; 714};
314 715
315&rtc { 716&rtc {
@@ -363,12 +764,12 @@
363 vsys2-supply = <&vbat>; 764 vsys2-supply = <&vbat>;
364 vsys3-supply = <&vbat>; 765 vsys3-supply = <&vbat>;
365 infet1-supply = <&vbat>; 766 infet1-supply = <&vbat>;
366 infet2-supply = <&vbat>; 767 infet2-supply = <&tps65090_dcdc1>;
367 infet3-supply = <&vbat>; 768 infet3-supply = <&tps65090_dcdc2>;
368 infet4-supply = <&vbat>; 769 infet4-supply = <&tps65090_dcdc2>;
369 infet5-supply = <&vbat>; 770 infet5-supply = <&tps65090_dcdc2>;
370 infet6-supply = <&vbat>; 771 infet6-supply = <&tps65090_dcdc2>;
371 infet7-supply = <&vbat>; 772 infet7-supply = <&tps65090_dcdc1>;
372 vsys-l1-supply = <&vbat>; 773 vsys-l1-supply = <&vbat>;
373 vsys-l2-supply = <&vbat>; 774 vsys-l2-supply = <&vbat>;
374 775
@@ -443,3 +844,4 @@
443}; 844};
444 845
445#include "cros-ec-keyboard.dtsi" 846#include "cros-ec-keyboard.dtsi"
847#include "cros-adc-thermistors.dtsi"
diff --git a/arch/arm/boot/dts/hip04-d01.dts b/arch/arm/boot/dts/hip04-d01.dts
new file mode 100644
index 000000000000..40a9e33c2654
--- /dev/null
+++ b/arch/arm/boot/dts/hip04-d01.dts
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2013-2014 Linaro Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
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 * publishhed by the Free Software Foundation.
8 */
9
10/dts-v1/;
11
12#include "hip04.dtsi"
13
14/ {
15 /* memory bus is 64-bit */
16 #address-cells = <2>;
17 #size-cells = <2>;
18 model = "Hisilicon D01 Development Board";
19 compatible = "hisilicon,hip04-d01";
20
21 memory@00000000,10000000 {
22 device_type = "memory";
23 reg = <0x00000000 0x10000000 0x00000000 0xc0000000>,
24 <0x00000004 0xc0000000 0x00000003 0x40000000>;
25 };
26
27 soc {
28 uart0: uart@4007000 {
29 status = "ok";
30 };
31 };
32};
diff --git a/arch/arm/boot/dts/hip04.dtsi b/arch/arm/boot/dts/hip04.dtsi
new file mode 100644
index 000000000000..93b6c909e991
--- /dev/null
+++ b/arch/arm/boot/dts/hip04.dtsi
@@ -0,0 +1,267 @@
1/*
2 * Hisilicon Ltd. HiP04 SoC
3 *
4 * Copyright (C) 2013-2014 Hisilicon Ltd.
5 * Copyright (C) 2013-2014 Linaro Ltd.
6 *
7 * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
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/ {
15 /* memory bus is 64-bit */
16 #address-cells = <2>;
17 #size-cells = <2>;
18
19 aliases {
20 serial0 = &uart0;
21 };
22
23 bootwrapper {
24 compatible = "hisilicon,hip04-bootwrapper";
25 boot-method = <0x10c00000 0x10000>, <0xe0000100 0x1000>;
26 };
27
28 cpus {
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 cpu-map {
33 cluster0 {
34 core0 {
35 cpu = <&CPU0>;
36 };
37 core1 {
38 cpu = <&CPU1>;
39 };
40 core2 {
41 cpu = <&CPU2>;
42 };
43 core3 {
44 cpu = <&CPU3>;
45 };
46 };
47 cluster1 {
48 core0 {
49 cpu = <&CPU4>;
50 };
51 core1 {
52 cpu = <&CPU5>;
53 };
54 core2 {
55 cpu = <&CPU6>;
56 };
57 core3 {
58 cpu = <&CPU7>;
59 };
60 };
61 cluster2 {
62 core0 {
63 cpu = <&CPU8>;
64 };
65 core1 {
66 cpu = <&CPU9>;
67 };
68 core2 {
69 cpu = <&CPU10>;
70 };
71 core3 {
72 cpu = <&CPU11>;
73 };
74 };
75 cluster3 {
76 core0 {
77 cpu = <&CPU12>;
78 };
79 core1 {
80 cpu = <&CPU13>;
81 };
82 core2 {
83 cpu = <&CPU14>;
84 };
85 core3 {
86 cpu = <&CPU15>;
87 };
88 };
89 };
90 CPU0: cpu@0 {
91 device_type = "cpu";
92 compatible = "arm,cortex-a15";
93 reg = <0>;
94 };
95 CPU1: cpu@1 {
96 device_type = "cpu";
97 compatible = "arm,cortex-a15";
98 reg = <1>;
99 };
100 CPU2: cpu@2 {
101 device_type = "cpu";
102 compatible = "arm,cortex-a15";
103 reg = <2>;
104 };
105 CPU3: cpu@3 {
106 device_type = "cpu";
107 compatible = "arm,cortex-a15";
108 reg = <3>;
109 };
110 CPU4: cpu@100 {
111 device_type = "cpu";
112 compatible = "arm,cortex-a15";
113 reg = <0x100>;
114 };
115 CPU5: cpu@101 {
116 device_type = "cpu";
117 compatible = "arm,cortex-a15";
118 reg = <0x101>;
119 };
120 CPU6: cpu@102 {
121 device_type = "cpu";
122 compatible = "arm,cortex-a15";
123 reg = <0x102>;
124 };
125 CPU7: cpu@103 {
126 device_type = "cpu";
127 compatible = "arm,cortex-a15";
128 reg = <0x103>;
129 };
130 CPU8: cpu@200 {
131 device_type = "cpu";
132 compatible = "arm,cortex-a15";
133 reg = <0x200>;
134 };
135 CPU9: cpu@201 {
136 device_type = "cpu";
137 compatible = "arm,cortex-a15";
138 reg = <0x201>;
139 };
140 CPU10: cpu@202 {
141 device_type = "cpu";
142 compatible = "arm,cortex-a15";
143 reg = <0x202>;
144 };
145 CPU11: cpu@203 {
146 device_type = "cpu";
147 compatible = "arm,cortex-a15";
148 reg = <0x203>;
149 };
150 CPU12: cpu@300 {
151 device_type = "cpu";
152 compatible = "arm,cortex-a15";
153 reg = <0x300>;
154 };
155 CPU13: cpu@301 {
156 device_type = "cpu";
157 compatible = "arm,cortex-a15";
158 reg = <0x301>;
159 };
160 CPU14: cpu@302 {
161 device_type = "cpu";
162 compatible = "arm,cortex-a15";
163 reg = <0x302>;
164 };
165 CPU15: cpu@303 {
166 device_type = "cpu";
167 compatible = "arm,cortex-a15";
168 reg = <0x303>;
169 };
170 };
171
172 timer {
173 compatible = "arm,armv7-timer";
174 interrupt-parent = <&gic>;
175 interrupts = <1 13 0xf08>,
176 <1 14 0xf08>,
177 <1 11 0xf08>,
178 <1 10 0xf08>;
179 };
180
181 clk_50m: clk_50m {
182 #clock-cells = <0>;
183 compatible = "fixed-clock";
184 clock-frequency = <50000000>;
185 };
186
187 clk_168m: clk_168m {
188 #clock-cells = <0>;
189 compatible = "fixed-clock";
190 clock-frequency = <168000000>;
191 };
192
193 soc {
194 /* It's a 32-bit SoC. */
195 #address-cells = <1>;
196 #size-cells = <1>;
197 compatible = "simple-bus";
198 interrupt-parent = <&gic>;
199 ranges = <0 0 0xe0000000 0x10000000>;
200
201 gic: interrupt-controller@c01000 {
202 compatible = "hisilicon,hip04-intc";
203 #interrupt-cells = <3>;
204 #address-cells = <0>;
205 interrupt-controller;
206 interrupts = <1 9 0xf04>;
207
208 reg = <0xc01000 0x1000>, <0xc02000 0x1000>,
209 <0xc04000 0x2000>, <0xc06000 0x2000>;
210 };
211
212 sysctrl: sysctrl {
213 compatible = "hisilicon,sysctrl";
214 reg = <0x3e00000 0x00100000>;
215 };
216
217 fabric: fabric {
218 compatible = "hisilicon,hip04-fabric";
219 reg = <0x302a000 0x1000>;
220 };
221
222 dual_timer0: dual_timer@3000000 {
223 compatible = "arm,sp804", "arm,primecell";
224 reg = <0x3000000 0x1000>;
225 interrupts = <0 224 4>;
226 clocks = <&clk_50m>, <&clk_50m>;
227 clock-names = "apb_pclk";
228 };
229
230 arm-pmu {
231 compatible = "arm,cortex-a15-pmu";
232 interrupts = <0 64 4>,
233 <0 65 4>,
234 <0 66 4>,
235 <0 67 4>,
236 <0 68 4>,
237 <0 69 4>,
238 <0 70 4>,
239 <0 71 4>,
240 <0 72 4>,
241 <0 73 4>,
242 <0 74 4>,
243 <0 75 4>,
244 <0 76 4>,
245 <0 77 4>,
246 <0 78 4>,
247 <0 79 4>;
248 };
249
250 uart0: uart@4007000 {
251 compatible = "snps,dw-apb-uart";
252 reg = <0x4007000 0x1000>;
253 interrupts = <0 381 4>;
254 clocks = <&clk_168m>;
255 clock-names = "uartclk";
256 reg-shift = <2>;
257 status = "disabled";
258 };
259
260 sata0: sata@a000000 {
261 compatible = "hisilicon,hisi-ahci";
262 reg = <0xa000000 0x1000000>;
263 interrupts = <0 372 4>;
264 };
265
266 };
267};
diff --git a/arch/arm/boot/dts/imx1-ads.dts b/arch/arm/boot/dts/imx1-ads.dts
new file mode 100644
index 000000000000..af4eee5794aa
--- /dev/null
+++ b/arch/arm/boot/dts/imx1-ads.dts
@@ -0,0 +1,152 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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/dts-v1/;
13#include "imx1.dtsi"
14
15/ {
16 model = "Freescale MX1 ADS";
17 compatible = "fsl,imx1ads", "fsl,imx1";
18
19 chosen {
20 stdout-path = &uart1;
21 };
22
23 memory {
24 reg = <0x08000000 0x04000000>;
25 };
26
27 clocks {
28 #address-cells = <1>;
29 #size-cells = <0>;
30
31 clk32 {
32 compatible = "fsl,imx-clk32", "fixed-clock";
33 #clock-cells = <0>;
34 clock-frequency = <32000>;
35 };
36 };
37};
38
39&cspi1 {
40 pinctrl-0 = <&pinctrl_cspi1>;
41 fsl,spi-num-chipselects = <1>;
42 cs-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
43 status = "okay";
44};
45
46&i2c {
47 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_i2c>;
49 status = "okay";
50
51 extgpio0: pcf8575@22 {
52 compatible = "nxp,pcf8575";
53 reg = <0x22>;
54 gpio-controller;
55 #gpio-cells = <2>;
56 };
57
58 extgpio1: pcf8575@24 {
59 compatible = "nxp,pcf8575";
60 reg = <0x24>;
61 gpio-controller;
62 #gpio-cells = <2>;
63 };
64};
65
66&uart1 {
67 pinctrl-names = "default";
68 pinctrl-0 = <&pinctrl_uart1>;
69 fsl,uart-has-rtscts;
70 status = "okay";
71};
72
73&uart2 {
74 pinctrl-names = "default";
75 pinctrl-0 = <&pinctrl_uart2>;
76 fsl,uart-has-rtscts;
77 status = "okay";
78};
79
80&weim {
81 pinctrl-names = "default";
82 pinctrl-0 = <&pinctrl_weim>;
83 status = "okay";
84
85 nor: nor@0,0 {
86 compatible = "cfi-flash";
87 reg = <0 0x00000000 0x02000000>;
88 bank-width = <4>;
89 fsl,weim-cs-timing = <0x00003e00 0x00000801>;
90 #address-cells = <1>;
91 #size-cells = <1>;
92 };
93};
94
95&iomuxc {
96 imx1-ads {
97 pinctrl_cspi1: cspi1grp {
98 fsl,pins = <
99 MX1_PAD_SPI1_MISO__SPI1_MISO 0x0
100 MX1_PAD_SPI1_MOSI__SPI1_MOSI 0x0
101 MX1_PAD_SPI1_RDY__SPI1_RDY 0x0
102 MX1_PAD_SPI1_SCLK__SPI1_SCLK 0x0
103 MX1_PAD_SPI1_SS__GPIO3_15 0x0
104 >;
105 };
106
107 pinctrl_i2c: i2cgrp {
108 fsl,pins = <
109 MX1_PAD_I2C_SCL__I2C_SCL 0x0
110 MX1_PAD_I2C_SDA__I2C_SDA 0x0
111 >;
112 };
113
114 pinctrl_uart1: uart1grp {
115 fsl,pins = <
116 MX1_PAD_UART1_TXD__UART1_TXD 0x0
117 MX1_PAD_UART1_RXD__UART1_RXD 0x0
118 MX1_PAD_UART1_CTS__UART1_CTS 0x0
119 MX1_PAD_UART1_RTS__UART1_RTS 0x0
120 >;
121 };
122
123 pinctrl_uart2: uart2grp {
124 fsl,pins = <
125 MX1_PAD_UART2_TXD__UART2_TXD 0x0
126 MX1_PAD_UART2_RXD__UART2_RXD 0x0
127 MX1_PAD_UART2_CTS__UART2_CTS 0x0
128 MX1_PAD_UART2_RTS__UART2_RTS 0x0
129 >;
130 };
131
132 pinctrl_weim: weimgrp {
133 fsl,pins = <
134 MX1_PAD_A0__A0 0x0
135 MX1_PAD_A16__A16 0x0
136 MX1_PAD_A17__A17 0x0
137 MX1_PAD_A18__A18 0x0
138 MX1_PAD_A19__A19 0x0
139 MX1_PAD_A20__A20 0x0
140 MX1_PAD_A21__A21 0x0
141 MX1_PAD_A22__A22 0x0
142 MX1_PAD_A23__A23 0x0
143 MX1_PAD_A24__A24 0x0
144 MX1_PAD_BCLK__BCLK 0x0
145 MX1_PAD_CS4__CS4 0x0
146 MX1_PAD_DTACK__DTACK 0x0
147 MX1_PAD_ECB__ECB 0x0
148 MX1_PAD_LBA__LBA 0x0
149 >;
150 };
151 };
152};
diff --git a/arch/arm/boot/dts/imx1-apf9328.dts b/arch/arm/boot/dts/imx1-apf9328.dts
new file mode 100644
index 000000000000..07d92fb40e6f
--- /dev/null
+++ b/arch/arm/boot/dts/imx1-apf9328.dts
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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/dts-v1/;
13#include "imx1.dtsi"
14
15/ {
16 model = "Armadeus APF9328";
17 compatible = "armadeus,imx1-apf9328", "fsl,imx1";
18
19 chosen {
20 stdout-path = &uart1;
21 };
22
23 memory {
24 reg = <0x08000000 0x00800000>;
25 };
26};
27
28&i2c {
29 pinctrl-names = "default";
30 pinctrl-0 = <&pinctrl_i2c>;
31 status = "okay";
32};
33
34&uart1 {
35 pinctrl-names = "default";
36 pinctrl-0 = <&pinctrl_uart1>;
37 fsl,uart-has-rtscts;
38 status = "okay";
39};
40
41&uart2 {
42 pinctrl-names = "default";
43 pinctrl-0 = <&pinctrl_uart2>;
44 fsl,uart-has-rtscts;
45 status = "okay";
46};
47
48&weim {
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_weim>;
51 status = "okay";
52
53 nor: nor@0,0 {
54 compatible = "cfi-flash";
55 reg = <0 0x00000000 0x02000000>;
56 bank-width = <2>;
57 fsl,weim-cs-timing = <0x00330e04 0x00000d01>;
58 #address-cells = <1>;
59 #size-cells = <1>;
60 };
61
62 eth: eth@4,c00000 {
63 pinctrl-names = "default";
64 pinctrl-0 = <&pinctrl_eth>;
65 compatible = "davicom,dm9000";
66 reg = <
67 4 0x00c00000 0x2
68 4 0x00c00002 0x2
69 >;
70 interrupt-parent = <&gpio2>;
71 interrupts = <14 IRQ_TYPE_LEVEL_LOW>;
72 fsl,weim-cs-timing = <0x0000c700 0x19190d01>;
73 };
74};
75
76&iomuxc {
77 imx1-apf9328 {
78 pinctrl_eth: ethgrp {
79 fsl,pins = <
80 MX1_PAD_SIM_SVEN__GPIO2_14 0x0
81 >;
82 };
83
84 pinctrl_i2c: i2cgrp {
85 fsl,pins = <
86 MX1_PAD_I2C_SCL__I2C_SCL 0x0
87 MX1_PAD_I2C_SDA__I2C_SDA 0x0
88 >;
89 };
90
91 pinctrl_uart1: uart1grp {
92 fsl,pins = <
93 MX1_PAD_UART1_TXD__UART1_TXD 0x0
94 MX1_PAD_UART1_RXD__UART1_RXD 0x0
95 MX1_PAD_UART1_CTS__UART1_CTS 0x0
96 MX1_PAD_UART1_RTS__UART1_RTS 0x0
97 >;
98 };
99
100 pinctrl_uart2: uart2grp {
101 fsl,pins = <
102 MX1_PAD_UART2_TXD__UART2_TXD 0x0
103 MX1_PAD_UART2_RXD__UART2_RXD 0x0
104 MX1_PAD_UART2_CTS__UART2_CTS 0x0
105 MX1_PAD_UART2_RTS__UART2_RTS 0x0
106 >;
107 };
108
109 pinctrl_weim: weimgrp {
110 fsl,pins = <
111 MX1_PAD_A0__A0 0x0
112 MX1_PAD_A16__A16 0x0
113 MX1_PAD_A17__A17 0x0
114 MX1_PAD_A18__A18 0x0
115 MX1_PAD_A19__A19 0x0
116 MX1_PAD_A20__A20 0x0
117 MX1_PAD_A21__A21 0x0
118 MX1_PAD_A22__A22 0x0
119 MX1_PAD_A23__A23 0x0
120 MX1_PAD_A24__A24 0x0
121 MX1_PAD_BCLK__BCLK 0x0
122 MX1_PAD_CS4__CS4 0x0
123 MX1_PAD_DTACK__DTACK 0x0
124 MX1_PAD_ECB__ECB 0x0
125 MX1_PAD_LBA__LBA 0x0
126 >;
127 };
128 };
129};
diff --git a/arch/arm/boot/dts/imx1-pinfunc.h b/arch/arm/boot/dts/imx1-pinfunc.h
new file mode 100644
index 000000000000..22bec8b87680
--- /dev/null
+++ b/arch/arm/boot/dts/imx1-pinfunc.h
@@ -0,0 +1,302 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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#ifndef __DTS_IMX1_PINFUNC_H
13#define __DTS_IMX1_PINFUNC_H
14
15/*
16 * The pin function ID is a tuple of
17 * <pin mux_id>
18 * mux_id consists of
19 * function + (direction << 2) + (gpio_oconf << 4) + (gpio_iconfa << 8) + (gpio_iconfb << 10)
20 *
21 * function: 0 - Primary function
22 * 1 - Alternate function
23 * 2 - GPIO
24 * direction: 0 - Input
25 * 1 - Output
26 * gpio_oconf: 0 - A_IN
27 * 1 - B_IN
28 * 2 - A_OUT
29 * 3 - Data Register
30 * gpio_iconfa/b: 0 - GPIO_IN
31 * 1 - Interrupt Status Register
32 * 2 - 0
33 * 3 - 1
34 *
35 * 'pin' is an integer between 0 and 0xbf. i.MX1 has 4 ports with 32 configurable
36 * configurable pins each. 'pin' is PORT * 32 + PORT_PIN, PORT_PIN is the pin
37 * number on the specific port (between 0 and 31).
38 */
39
40#define MX1_PAD_A24__A24 0x00 0x004
41#define MX1_PAD_A24__GPIO1_0 0x00 0x032
42#define MX1_PAD_A24__SPI2_CLK 0x00 0x006
43#define MX1_PAD_TIN__TIN 0x01 0x000
44#define MX1_PAD_TIN__GPIO1_1 0x01 0x032
45#define MX1_PAD_TIN__SPI2_RXD 0x01 0x022
46#define MX1_PAD_PWMO__PWMO 0x02 0x004
47#define MX1_PAD_PWMO__GPIO1_2 0x02 0x032
48#define MX1_PAD_CSI_MCLK__CSI_MCLK 0x03 0x004
49#define MX1_PAD_CSI_MCLK__GPIO1_3 0x03 0x032
50#define MX1_PAD_CSI_D0__CSI_D0 0x04 0x000
51#define MX1_PAD_CSI_D0__GPIO1_4 0x04 0x032
52#define MX1_PAD_CSI_D1__CSI_D1 0x05 0x000
53#define MX1_PAD_CSI_D1__GPIO1_5 0x05 0x032
54#define MX1_PAD_CSI_D2__CSI_D2 0x06 0x000
55#define MX1_PAD_CSI_D2__GPIO1_6 0x06 0x032
56#define MX1_PAD_CSI_D3__CSI_D3 0x07 0x000
57#define MX1_PAD_CSI_D3__GPIO1_7 0x07 0x032
58#define MX1_PAD_CSI_D4__CSI_D4 0x08 0x000
59#define MX1_PAD_CSI_D4__GPIO1_8 0x08 0x032
60#define MX1_PAD_CSI_D5__CSI_D5 0x09 0x000
61#define MX1_PAD_CSI_D5__GPIO1_9 0x09 0x032
62#define MX1_PAD_CSI_D6__CSI_D6 0x0a 0x000
63#define MX1_PAD_CSI_D6__GPIO1_10 0x0a 0x032
64#define MX1_PAD_CSI_D7__CSI_D7 0x0b 0x000
65#define MX1_PAD_CSI_D7__GPIO1_11 0x0b 0x032
66#define MX1_PAD_CSI_VSYNC__CSI_VSYNC 0x0c 0x000
67#define MX1_PAD_CSI_VSYNC__GPIO1_12 0x0c 0x032
68#define MX1_PAD_CSI_HSYNC__CSI_HSYNC 0x0d 0x000
69#define MX1_PAD_CSI_HSYNC__GPIO1_13 0x0d 0x032
70#define MX1_PAD_CSI_PIXCLK__CSI_PIXCLK 0x0e 0x000
71#define MX1_PAD_CSI_PIXCLK__GPIO1_14 0x0e 0x032
72#define MX1_PAD_I2C_SDA__I2C_SDA 0x0f 0x000
73#define MX1_PAD_I2C_SDA__GPIO1_15 0x0f 0x032
74#define MX1_PAD_I2C_SCL__I2C_SCL 0x10 0x004
75#define MX1_PAD_I2C_SCL__GPIO1_16 0x10 0x032
76#define MX1_PAD_DTACK__DTACK 0x11 0x000
77#define MX1_PAD_DTACK__GPIO1_17 0x11 0x032
78#define MX1_PAD_DTACK__SPI2_SS 0x11 0x002
79#define MX1_PAD_DTACK__A25 0x11 0x016
80#define MX1_PAD_BCLK__BCLK 0x12 0x004
81#define MX1_PAD_BCLK__GPIO1_18 0x12 0x032
82#define MX1_PAD_LBA__LBA 0x13 0x004
83#define MX1_PAD_LBA__GPIO1_19 0x13 0x032
84#define MX1_PAD_ECB__ECB 0x14 0x000
85#define MX1_PAD_ECB__GPIO1_20 0x14 0x032
86#define MX1_PAD_A0__A0 0x15 0x004
87#define MX1_PAD_A0__GPIO1_21 0x15 0x032
88#define MX1_PAD_CS4__CS4 0x16 0x004
89#define MX1_PAD_CS4__GPIO1_22 0x16 0x032
90#define MX1_PAD_CS5__CS5 0x17 0x004
91#define MX1_PAD_CS5__GPIO1_23 0x17 0x032
92#define MX1_PAD_A16__A16 0x18 0x004
93#define MX1_PAD_A16__GPIO1_24 0x18 0x032
94#define MX1_PAD_A17__A17 0x19 0x004
95#define MX1_PAD_A17__GPIO1_25 0x19 0x032
96#define MX1_PAD_A18__A18 0x1a 0x004
97#define MX1_PAD_A18__GPIO1_26 0x1a 0x032
98#define MX1_PAD_A19__A19 0x1b 0x004
99#define MX1_PAD_A19__GPIO1_27 0x1b 0x032
100#define MX1_PAD_A20__A20 0x1c 0x004
101#define MX1_PAD_A20__GPIO1_28 0x1c 0x032
102#define MX1_PAD_A21__A21 0x1d 0x004
103#define MX1_PAD_A21__GPIO1_29 0x1d 0x032
104#define MX1_PAD_A22__A22 0x1e 0x004
105#define MX1_PAD_A22__GPIO1_30 0x1e 0x032
106#define MX1_PAD_A23__A23 0x1f 0x004
107#define MX1_PAD_A23__GPIO1_31 0x1f 0x032
108#define MX1_PAD_SD_DAT0__SD_DAT0 0x28 0x000
109#define MX1_PAD_SD_DAT0__MS_PI0 0x28 0x001
110#define MX1_PAD_SD_DAT0__GPIO2_8 0x28 0x032
111#define MX1_PAD_SD_DAT1__SD_DAT1 0x29 0x000
112#define MX1_PAD_SD_DAT1__MS_PI1 0x29 0x001
113#define MX1_PAD_SD_DAT1__GPIO2_9 0x29 0x032
114#define MX1_PAD_SD_DAT2__SD_DAT2 0x2a 0x000
115#define MX1_PAD_SD_DAT2__MS_SCLKI 0x2a 0x001
116#define MX1_PAD_SD_DAT2__GPIO2_10 0x2a 0x032
117#define MX1_PAD_SD_DAT3__SD_DAT3 0x2b 0x000
118#define MX1_PAD_SD_DAT3__MS_SDIO 0x2b 0x001
119#define MX1_PAD_SD_DAT3__GPIO2_11 0x2b 0x032
120#define MX1_PAD_SD_SCLK__SD_SCLK 0x2c 0x004
121#define MX1_PAD_SD_SCLK__MS_SCLKO 0x2c 0x005
122#define MX1_PAD_SD_SCLK__GPIO2_12 0x2c 0x032
123#define MX1_PAD_SD_CMD__SD_CMD 0x2d 0x000
124#define MX1_PAD_SD_CMD__MS_BS 0x2d 0x005
125#define MX1_PAD_SD_CMD__GPIO2_13 0x2d 0x032
126#define MX1_PAD_SIM_SVEN__SIM_SVEN 0x2e 0x004
127#define MX1_PAD_SIM_SVEN__SSI_RXFS 0x2e 0x001
128#define MX1_PAD_SIM_SVEN__GPIO2_14 0x2e 0x032
129#define MX1_PAD_SIM_PD__SIM_PD 0x2f 0x000
130#define MX1_PAD_SIM_PD__SSI_RXCLK 0x2f 0x001
131#define MX1_PAD_SIM_PD__GPIO2_15 0x2f 0x032
132#define MX1_PAD_SIM_TX__SIM_TX 0x30 0x000
133#define MX1_PAD_SIM_TX__SSI_RXDAT 0x30 0x001
134#define MX1_PAD_SIM_TX__GPIO2_16 0x30 0x032
135#define MX1_PAD_SIM_RX__SIM_RX 0x31 0x000
136#define MX1_PAD_SIM_RX__SSI_TXDAT 0x31 0x005
137#define MX1_PAD_SIM_RX__GPIO2_17 0x31 0x032
138#define MX1_PAD_SIM_RST__SIM_RST 0x32 0x004
139#define MX1_PAD_SIM_RST__SSI_TXFS 0x32 0x001
140#define MX1_PAD_SIM_RST__GPIO2_18 0x32 0x032
141#define MX1_PAD_SIM_CLK__SIM_CLK 0x33 0x004
142#define MX1_PAD_SIM_CLK__SSI_TXCLK 0x33 0x001
143#define MX1_PAD_SIM_CLK__GPIO2_19 0x33 0x032
144#define MX1_PAD_USBD_AFE__USBD_AFE 0x34 0x004
145#define MX1_PAD_USBD_AFE__GPIO2_20 0x34 0x032
146#define MX1_PAD_USBD_OE__USBD_OE 0x35 0x004
147#define MX1_PAD_USBD_OE__GPIO2_21 0x35 0x032
148#define MX1_PAD_USBD_RCV__USBD_RCV 0x36 0x000
149#define MX1_PAD_USBD_RCV__GPIO2_22 0x36 0x032
150#define MX1_PAD_USBD_SUSPND__USBD_SUSPND 0x37 0x004
151#define MX1_PAD_USBD_SUSPND__GPIO2_23 0x37 0x032
152#define MX1_PAD_USBD_VP__USBD_VP 0x38 0x000
153#define MX1_PAD_USBD_VP__GPIO2_24 0x38 0x032
154#define MX1_PAD_USBD_VM__USBD_VM 0x39 0x000
155#define MX1_PAD_USBD_VM__GPIO2_25 0x39 0x032
156#define MX1_PAD_USBD_VPO__USBD_VPO 0x3a 0x004
157#define MX1_PAD_USBD_VPO__GPIO2_26 0x3a 0x032
158#define MX1_PAD_USBD_VMO__USBD_VMO 0x3b 0x004
159#define MX1_PAD_USBD_VMO__GPIO2_27 0x3b 0x032
160#define MX1_PAD_UART2_CTS__UART2_CTS 0x3c 0x004
161#define MX1_PAD_UART2_CTS__GPIO2_28 0x3c 0x032
162#define MX1_PAD_UART2_RTS__UART2_RTS 0x3d 0x000
163#define MX1_PAD_UART2_RTS__GPIO2_29 0x3d 0x032
164#define MX1_PAD_UART2_TXD__UART2_TXD 0x3e 0x004
165#define MX1_PAD_UART2_TXD__GPIO2_30 0x3e 0x032
166#define MX1_PAD_UART2_RXD__UART2_RXD 0x3f 0x000
167#define MX1_PAD_UART2_RXD__GPIO2_31 0x3f 0x032
168#define MX1_PAD_SSI_RXFS__SSI_RXFS 0x43 0x000
169#define MX1_PAD_SSI_RXFS__GPIO3_3 0x43 0x032
170#define MX1_PAD_SSI_RXCLK__SSI_RXCLK 0x44 0x000
171#define MX1_PAD_SSI_RXCLK__GPIO3_4 0x44 0x032
172#define MX1_PAD_SSI_RXDAT__SSI_RXDAT 0x45 0x000
173#define MX1_PAD_SSI_RXDAT__GPIO3_5 0x45 0x032
174#define MX1_PAD_SSI_TXDAT__SSI_TXDAT 0x46 0x004
175#define MX1_PAD_SSI_TXDAT__GPIO3_6 0x46 0x032
176#define MX1_PAD_SSI_TXFS__SSI_TXFS 0x47 0x000
177#define MX1_PAD_SSI_TXFS__GPIO3_7 0x47 0x032
178#define MX1_PAD_SSI_TXCLK__SSI_TXCLK 0x48 0x000
179#define MX1_PAD_SSI_TXCLK__GPIO3_8 0x48 0x032
180#define MX1_PAD_UART1_CTS__UART1_CTS 0x49 0x004
181#define MX1_PAD_UART1_CTS__GPIO3_9 0x49 0x032
182#define MX1_PAD_UART1_RTS__UART1_RTS 0x4a 0x000
183#define MX1_PAD_UART1_RTS__GPIO3_10 0x4a 0x032
184#define MX1_PAD_UART1_TXD__UART1_TXD 0x4b 0x004
185#define MX1_PAD_UART1_TXD__GPIO3_11 0x4b 0x032
186#define MX1_PAD_UART1_RXD__UART1_RXD 0x4c 0x000
187#define MX1_PAD_UART1_RXD__GPIO3_12 0x4c 0x032
188#define MX1_PAD_SPI1_RDY__SPI1_RDY 0x4d 0x000
189#define MX1_PAD_SPI1_RDY__GPIO3_13 0x4d 0x032
190#define MX1_PAD_SPI1_SCLK__SPI1_SCLK 0x4e 0x004
191#define MX1_PAD_SPI1_SCLK__GPIO3_14 0x4e 0x032
192#define MX1_PAD_SPI1_SS__SPI1_SS 0x4f 0x000
193#define MX1_PAD_SPI1_SS__GPIO3_15 0x4f 0x032
194#define MX1_PAD_SPI1_MISO__SPI1_MISO 0x50 0x000
195#define MX1_PAD_SPI1_MISO__GPIO3_16 0x50 0x032
196#define MX1_PAD_SPI1_MOSI__SPI1_MOSI 0x51 0x004
197#define MX1_PAD_SPI1_MOSI__GPIO3_17 0x51 0x032
198#define MX1_PAD_BT13__BT13 0x53 0x004
199#define MX1_PAD_BT13__SSI2_RXCLK 0x53 0x001
200#define MX1_PAD_BT13__GPIO3_19 0x53 0x032
201#define MX1_PAD_BT12__BT12 0x54 0x004
202#define MX1_PAD_BT12__SSI2_TXFS 0x54 0x001
203#define MX1_PAD_BT12__GPIO3_20 0x54 0x032
204#define MX1_PAD_BT11__BT11 0x55 0x004
205#define MX1_PAD_BT11__SSI2_TXCLK 0x55 0x001
206#define MX1_PAD_BT11__GPIO3_21 0x55 0x032
207#define MX1_PAD_BT10__BT10 0x56 0x004
208#define MX1_PAD_BT10__SSI2_TX 0x56 0x001
209#define MX1_PAD_BT10__GPIO3_22 0x56 0x032
210#define MX1_PAD_BT9__BT9 0x57 0x004
211#define MX1_PAD_BT9__SSI2_RX 0x57 0x001
212#define MX1_PAD_BT9__GPIO3_23 0x57 0x032
213#define MX1_PAD_BT8__BT8 0x58 0x004
214#define MX1_PAD_BT8__SSI2_RXFS 0x58 0x001
215#define MX1_PAD_BT8__GPIO3_24 0x58 0x032
216#define MX1_PAD_BT8__UART3_RI 0x58 0x016
217#define MX1_PAD_BT7__BT7 0x59 0x004
218#define MX1_PAD_BT7__GPIO3_25 0x59 0x032
219#define MX1_PAD_BT7__UART3_DSR 0x59 0x016
220#define MX1_PAD_BT6__BT6 0x5a 0x004
221#define MX1_PAD_BT6__GPIO3_26 0x5a 0x032
222#define MX1_PAD_BT6__SPI2_SS3 0x5a 0x016
223#define MX1_PAD_BT6__UART3_DTR 0x5a 0x022
224#define MX1_PAD_BT5__BT5 0x5b 0x000
225#define MX1_PAD_BT5__GPIO3_27 0x5b 0x032
226#define MX1_PAD_BT5__UART3_DCD 0x5b 0x016
227#define MX1_PAD_BT4__BT4 0x5c 0x000
228#define MX1_PAD_BT4__GPIO3_28 0x5c 0x032
229#define MX1_PAD_BT4__UART3_CTS 0x5c 0x016
230#define MX1_PAD_BT3__BT3 0x5d 0x000
231#define MX1_PAD_BT3__GPIO3_29 0x5d 0x032
232#define MX1_PAD_BT3__UART3_RTS 0x5d 0x022
233#define MX1_PAD_BT2__BT2 0x5e 0x004
234#define MX1_PAD_BT2__GPIO3_30 0x5e 0x032
235#define MX1_PAD_BT2__UART3_TX 0x5e 0x016
236#define MX1_PAD_BT1__BT1 0x5f 0x000
237#define MX1_PAD_BT1__GPIO3_31 0x5f 0x032
238#define MX1_PAD_BT1__UART3_RX 0x5f 0x022
239#define MX1_PAD_LSCLK__LSCLK 0x66 0x004
240#define MX1_PAD_LSCLK__GPIO4_6 0x66 0x032
241#define MX1_PAD_REV__REV 0x67 0x004
242#define MX1_PAD_REV__UART2_DTR 0x67 0x001
243#define MX1_PAD_REV__GPIO4_7 0x67 0x032
244#define MX1_PAD_REV__SPI2_CLK 0x67 0x006
245#define MX1_PAD_CLS__CLS 0x68 0x004
246#define MX1_PAD_CLS__UART2_DCD 0x68 0x005
247#define MX1_PAD_CLS__GPIO4_8 0x68 0x032
248#define MX1_PAD_CLS__SPI2_SS 0x68 0x002
249#define MX1_PAD_PS__PS 0x69 0x004
250#define MX1_PAD_PS__UART2_RI 0x69 0x005
251#define MX1_PAD_PS__GPIO4_9 0x69 0x032
252#define MX1_PAD_PS__SPI2_RXD 0x69 0x022
253#define MX1_PAD_SPL_SPR__SPL_SPR 0x6a 0x004
254#define MX1_PAD_SPL_SPR__UART2_DSR 0x6a 0x005
255#define MX1_PAD_SPL_SPR__GPIO4_10 0x6a 0x032
256#define MX1_PAD_SPL_SPR__SPI2_TXD 0x6a 0x006
257#define MX1_PAD_CONTRAST__CONTRAST 0x6b 0x004
258#define MX1_PAD_CONTRAST__GPIO4_11 0x6b 0x032
259#define MX1_PAD_CONTRAST__SPI2_SS2 0x6b 0x012
260#define MX1_PAD_ACD_OE__ACD_OE 0x6c 0x004
261#define MX1_PAD_ACD_OE__GPIO4_12 0x6c 0x032
262#define MX1_PAD_LP_HSYNC__LP_HSYNC 0x6d 0x004
263#define MX1_PAD_LP_HSYNC__GPIO4_13 0x6d 0x032
264#define MX1_PAD_FLM_VSYNC__FLM_VSYNC 0x6e 0x004
265#define MX1_PAD_FLM_VSYNC__GPIO4_14 0x6e 0x032
266#define MX1_PAD_LD0__LD0 0x6f 0x004
267#define MX1_PAD_LD0__GPIO4_15 0x6f 0x032
268#define MX1_PAD_LD1__LD1 0x70 0x004
269#define MX1_PAD_LD1__GPIO4_16 0x70 0x032
270#define MX1_PAD_LD2__LD2 0x71 0x004
271#define MX1_PAD_LD2__GPIO4_17 0x71 0x032
272#define MX1_PAD_LD3__LD3 0x72 0x004
273#define MX1_PAD_LD3__GPIO4_18 0x72 0x032
274#define MX1_PAD_LD4__LD4 0x73 0x004
275#define MX1_PAD_LD4__GPIO4_19 0x73 0x032
276#define MX1_PAD_LD5__LD5 0x74 0x004
277#define MX1_PAD_LD5__GPIO4_20 0x74 0x032
278#define MX1_PAD_LD6__LD6 0x75 0x004
279#define MX1_PAD_LD6__GPIO4_21 0x75 0x032
280#define MX1_PAD_LD7__LD7 0x76 0x004
281#define MX1_PAD_LD7__GPIO4_22 0x76 0x032
282#define MX1_PAD_LD8__LD8 0x77 0x004
283#define MX1_PAD_LD8__GPIO4_23 0x77 0x032
284#define MX1_PAD_LD9__LD9 0x78 0x004
285#define MX1_PAD_LD9__GPIO4_24 0x78 0x032
286#define MX1_PAD_LD10__LD10 0x79 0x004
287#define MX1_PAD_LD10__GPIO4_25 0x79 0x032
288#define MX1_PAD_LD11__LD11 0x7a 0x004
289#define MX1_PAD_LD11__GPIO4_26 0x7a 0x032
290#define MX1_PAD_LD12__LD12 0x7b 0x004
291#define MX1_PAD_LD12__GPIO4_27 0x7b 0x032
292#define MX1_PAD_LD13__LD13 0x7c 0x004
293#define MX1_PAD_LD13__GPIO4_28 0x7c 0x032
294#define MX1_PAD_LD14__LD14 0x7d 0x004
295#define MX1_PAD_LD14__GPIO4_29 0x7d 0x032
296#define MX1_PAD_LD15__LD15 0x7e 0x004
297#define MX1_PAD_LD15__GPIO4_30 0x7e 0x032
298#define MX1_PAD_TMR2OUT__TMR2OUT 0x7f 0x000
299#define MX1_PAD_TMR2OUT__GPIO4_31 0x7f 0x032
300#define MX1_PAD_TMR2OUT__SPI2_TXD 0x7f 0x006
301
302#endif
diff --git a/arch/arm/boot/dts/imx1.dtsi b/arch/arm/boot/dts/imx1.dtsi
new file mode 100644
index 000000000000..22f5d1db5b31
--- /dev/null
+++ b/arch/arm/boot/dts/imx1.dtsi
@@ -0,0 +1,266 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include "skeleton.dtsi"
13#include "imx1-pinfunc.h"
14
15#include <dt-bindings/clock/imx1-clock.h>
16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/interrupt-controller/irq.h>
18
19/ {
20 aliases {
21 gpio0 = &gpio1;
22 gpio1 = &gpio2;
23 gpio2 = &gpio3;
24 gpio3 = &gpio4;
25 i2c0 = &i2c;
26 serial0 = &uart1;
27 serial1 = &uart2;
28 serial2 = &uart3;
29 spi0 = &cspi1;
30 spi1 = &cspi2;
31 };
32
33 aitc: aitc-interrupt-controller@00223000 {
34 compatible = "fsl,imx1-aitc", "fsl,avic";
35 interrupt-controller;
36 #interrupt-cells = <1>;
37 reg = <0x00223000 0x1000>;
38 };
39
40 cpus {
41 #size-cells = <0>;
42 #address-cells = <1>;
43
44 cpu: cpu@0 {
45 device_type = "cpu";
46 compatible = "arm,arm920t";
47 operating-points = <200000 1900000>;
48 clock-latency = <62500>;
49 clocks = <&clks IMX1_CLK_MCU>;
50 voltage-tolerance = <5>;
51 };
52 };
53
54 soc {
55 #address-cells = <1>;
56 #size-cells = <1>;
57 compatible = "simple-bus";
58 interrupt-parent = <&aitc>;
59 ranges;
60
61 aipi@00200000 {
62 compatible = "fsl,aipi-bus", "simple-bus";
63 #address-cells = <1>;
64 #size-cells = <1>;
65 reg = <0x00200000 0x10000>;
66 ranges;
67
68 gpt1: timer@00202000 {
69 compatible = "fsl,imx1-gpt";
70 reg = <0x00202000 0x1000>;
71 interrupts = <59>;
72 clocks = <&clks IMX1_CLK_HCLK>,
73 <&clks IMX1_CLK_PER1>;
74 clock-names = "ipg", "per";
75 };
76
77 gpt2: timer@00203000 {
78 compatible = "fsl,imx1-gpt";
79 reg = <0x00203000 0x1000>;
80 interrupts = <58>;
81 clocks = <&clks IMX1_CLK_HCLK>,
82 <&clks IMX1_CLK_PER1>;
83 clock-names = "ipg", "per";
84 };
85
86 fb: fb@00205000 {
87 compatible = "fsl,imx1-fb";
88 reg = <0x00205000 0x1000>;
89 interrupts = <14>;
90 clocks = <&clks IMX1_CLK_DUMMY>,
91 <&clks IMX1_CLK_DUMMY>,
92 <&clks IMX1_CLK_PER2>;
93 clock-names = "ipg", "ahb", "per";
94 status = "disabled";
95 };
96
97 uart1: serial@00206000 {
98 compatible = "fsl,imx1-uart";
99 reg = <0x00206000 0x1000>;
100 interrupts = <30 29 26>;
101 clocks = <&clks IMX1_CLK_HCLK>,
102 <&clks IMX1_CLK_PER1>;
103 clock-names = "ipg", "per";
104 status = "disabled";
105 };
106
107 uart2: serial@00207000 {
108 compatible = "fsl,imx1-uart";
109 reg = <0x00207000 0x1000>;
110 interrupts = <24 23 20>;
111 clocks = <&clks IMX1_CLK_HCLK>,
112 <&clks IMX1_CLK_PER1>;
113 clock-names = "ipg", "per";
114 status = "disabled";
115 };
116
117 pwm: pwm@00208000 {
118 #pwm-cells = <2>;
119 compatible = "fsl,imx1-pwm";
120 reg = <0x00208000 0x1000>;
121 interrupts = <34>;
122 clocks = <&clks IMX1_CLK_DUMMY>,
123 <&clks IMX1_CLK_PER1>;
124 clock-names = "ipg", "per";
125 };
126
127 dma: dma@00209000 {
128 compatible = "fsl,imx1-dma";
129 reg = <0x00209000 0x1000>;
130 interrupts = <61 60>;
131 clocks = <&clks IMX1_CLK_HCLK>,
132 <&clks IMX1_CLK_DMA_GATE>;
133 clock-names = "ipg", "ahb";
134 #dma-cells = <1>;
135 };
136
137 uart3: serial@0020a000 {
138 compatible = "fsl,imx1-uart";
139 reg = <0x0020a000 0x1000>;
140 interrupts = <54 4 1>;
141 clocks = <&clks IMX1_CLK_UART3_GATE>,
142 <&clks IMX1_CLK_PER1>;
143 clock-names = "ipg", "per";
144 status = "disabled";
145 };
146 };
147
148 aipi@00210000 {
149 compatible = "fsl,aipi-bus", "simple-bus";
150 #address-cells = <1>;
151 #size-cells = <1>;
152 reg = <0x00210000 0x10000>;
153 ranges;
154
155 cspi1: cspi@00213000 {
156 #address-cells = <1>;
157 #size-cells = <0>;
158 compatible = "fsl,imx1-cspi";
159 reg = <0x00213000 0x1000>;
160 interrupts = <41>;
161 clocks = <&clks IMX1_CLK_DUMMY>,
162 <&clks IMX1_CLK_PER1>;
163 clock-names = "ipg", "per";
164 status = "disabled";
165 };
166
167 i2c: i2c@00217000 {
168 #address-cells = <1>;
169 #size-cells = <0>;
170 compatible = "fsl,imx1-i2c";
171 reg = <0x00217000 0x1000>;
172 interrupts = <39>;
173 clocks = <&clks IMX1_CLK_HCLK>;
174 status = "disabled";
175 };
176
177 cspi2: cspi@00219000 {
178 #address-cells = <1>;
179 #size-cells = <0>;
180 compatible = "fsl,imx1-cspi";
181 reg = <0x00219000 0x1000>;
182 interrupts = <40>;
183 clocks = <&clks IMX1_CLK_DUMMY>,
184 <&clks IMX1_CLK_PER1>;
185 clock-names = "ipg", "per";
186 status = "disabled";
187 };
188
189 clks: ccm@0021b000 {
190 compatible = "fsl,imx1-ccm";
191 reg = <0x0021b000 0x1000>;
192 #clock-cells = <1>;
193 };
194
195 iomuxc: iomuxc@0021c000 {
196 compatible = "fsl,imx1-iomuxc";
197 reg = <0x0021c000 0x1000>;
198 #address-cells = <1>;
199 #size-cells = <1>;
200 ranges;
201
202 gpio1: gpio@0021c000 {
203 compatible = "fsl,imx1-gpio";
204 reg = <0x0021c000 0x100>;
205 interrupts = <11>;
206 gpio-controller;
207 #gpio-cells = <2>;
208 interrupt-controller;
209 #interrupt-cells = <2>;
210 };
211
212 gpio2: gpio@0021c100 {
213 compatible = "fsl,imx1-gpio";
214 reg = <0x0021c100 0x100>;
215 interrupts = <12>;
216 gpio-controller;
217 #gpio-cells = <2>;
218 interrupt-controller;
219 #interrupt-cells = <2>;
220 };
221
222 gpio3: gpio@0021c200 {
223 compatible = "fsl,imx1-gpio";
224 reg = <0x0021c200 0x100>;
225 interrupts = <13>;
226 gpio-controller;
227 #gpio-cells = <2>;
228 interrupt-controller;
229 #interrupt-cells = <2>;
230 };
231
232 gpio4: gpio@0021c300 {
233 compatible = "fsl,imx1-gpio";
234 reg = <0x0021c300 0x100>;
235 interrupts = <62>;
236 gpio-controller;
237 #gpio-cells = <2>;
238 interrupt-controller;
239 #interrupt-cells = <2>;
240 };
241 };
242 };
243
244 weim: weim@00220000 {
245 #address-cells = <2>;
246 #size-cells = <1>;
247 compatible = "fsl,imx1-weim";
248 reg = <0x00220000 0x1000>;
249 clocks = <&clks IMX1_CLK_DUMMY>;
250 ranges = <
251 0 0 0x10000000 0x02000000
252 1 0 0x12000000 0x01000000
253 2 0 0x13000000 0x01000000
254 3 0 0x14000000 0x01000000
255 4 0 0x15000000 0x01000000
256 5 0 0x16000000 0x01000000
257 >;
258 status = "disabled";
259 };
260
261 esram: esram@00300000 {
262 compatible = "mmio-sram";
263 reg = <0x00300000 0x20000>;
264 };
265 };
266};
diff --git a/arch/arm/boot/dts/imx23-evk.dts b/arch/arm/boot/dts/imx23-evk.dts
index a33f66c11b73..57e29977ba06 100644
--- a/arch/arm/boot/dts/imx23-evk.dts
+++ b/arch/arm/boot/dts/imx23-evk.dts
@@ -60,10 +60,10 @@
60 pinctrl-names = "default"; 60 pinctrl-names = "default";
61 pinctrl-0 = <&lcdif_24bit_pins_a>; 61 pinctrl-0 = <&lcdif_24bit_pins_a>;
62 lcd-supply = <&reg_lcd_3v3>; 62 lcd-supply = <&reg_lcd_3v3>;
63 display = <&display>; 63 display = <&display0>;
64 status = "okay"; 64 status = "okay";
65 65
66 display: display { 66 display0: display0 {
67 bits-per-pixel = <32>; 67 bits-per-pixel = <32>;
68 bus-width = <24>; 68 bus-width = <24>;
69 69
diff --git a/arch/arm/boot/dts/imx25-pinfunc.h b/arch/arm/boot/dts/imx25-pinfunc.h
index 9238a95d8e62..88eebb15da6a 100644
--- a/arch/arm/boot/dts/imx25-pinfunc.h
+++ b/arch/arm/boot/dts/imx25-pinfunc.h
@@ -247,6 +247,7 @@
247#define MX25_PAD_OE_ACD__GPIO_1_25 0x114 0x30c 0x000 0x15 0x000 247#define MX25_PAD_OE_ACD__GPIO_1_25 0x114 0x30c 0x000 0x15 0x000
248 248
249#define MX25_PAD_CONTRAST__CONTRAST 0x118 0x310 0x000 0x10 0x000 249#define MX25_PAD_CONTRAST__CONTRAST 0x118 0x310 0x000 0x10 0x000
250#define MX25_PAD_CONTRAST__CC4 0x118 0x310 0x000 0x11 0x000
250#define MX25_PAD_CONTRAST__PWM4_PWMO 0x118 0x310 0x000 0x14 0x000 251#define MX25_PAD_CONTRAST__PWM4_PWMO 0x118 0x310 0x000 0x14 0x000
251#define MX25_PAD_CONTRAST__FEC_CRS 0x118 0x310 0x508 0x15 0x001 252#define MX25_PAD_CONTRAST__FEC_CRS 0x118 0x310 0x508 0x15 0x001
252 253
@@ -260,6 +261,7 @@
260#define MX25_PAD_CSI_D2__CSPI3_MOSI 0x120 0x318 0x000 0x17 0x000 261#define MX25_PAD_CSI_D2__CSPI3_MOSI 0x120 0x318 0x000 0x17 0x000
261 262
262#define MX25_PAD_CSI_D3__CSI_D3 0x124 0x31c 0x000 0x10 0x000 263#define MX25_PAD_CSI_D3__CSI_D3 0x124 0x31c 0x000 0x10 0x000
264#define MX25_PAD_CSI_D3__UART5_TXD_MUX 0x124 0x31c 0x000 0x11 0x000
263#define MX25_PAD_CSI_D3__GPIO_1_28 0x124 0x31c 0x000 0x15 0x000 265#define MX25_PAD_CSI_D3__GPIO_1_28 0x124 0x31c 0x000 0x15 0x000
264#define MX25_PAD_CSI_D3__CSPI3_MISO 0x124 0x31c 0x4b4 0x17 0x001 266#define MX25_PAD_CSI_D3__CSPI3_MISO 0x124 0x31c 0x4b4 0x17 0x001
265 267
@@ -269,31 +271,46 @@
269#define MX25_PAD_CSI_D4__CSPI3_SCLK 0x128 0x320 0x000 0x17 0x000 271#define MX25_PAD_CSI_D4__CSPI3_SCLK 0x128 0x320 0x000 0x17 0x000
270 272
271#define MX25_PAD_CSI_D5__CSI_D5 0x12c 0x324 0x000 0x10 0x000 273#define MX25_PAD_CSI_D5__CSI_D5 0x12c 0x324 0x000 0x10 0x000
274#define MX25_PAD_CSI_D5__UART5_CTS 0x12c 0x324 0x000 0x11 0x001
272#define MX25_PAD_CSI_D5__GPIO_1_30 0x12c 0x324 0x000 0x15 0x000 275#define MX25_PAD_CSI_D5__GPIO_1_30 0x12c 0x324 0x000 0x15 0x000
273#define MX25_PAD_CSI_D5__CSPI3_RDY 0x12c 0x324 0x000 0x17 0x000 276#define MX25_PAD_CSI_D5__CSPI3_RDY 0x12c 0x324 0x000 0x17 0x000
274 277
275#define MX25_PAD_CSI_D6__CSI_D6 0x130 0x328 0x000 0x10 0x000 278#define MX25_PAD_CSI_D6__CSI_D6 0x130 0x328 0x000 0x10 0x000
279#define MX25_PAD_CSI_D6__SDHC2_CMD 0x130 0x328 0x4e0 0x12 0x001
276#define MX25_PAD_CSI_D6__GPIO_1_31 0x130 0x328 0x000 0x15 0x000 280#define MX25_PAD_CSI_D6__GPIO_1_31 0x130 0x328 0x000 0x15 0x000
277 281
278#define MX25_PAD_CSI_D7__CSI_D7 0x134 0x32c 0x000 0x10 0x000 282#define MX25_PAD_CSI_D7__CSI_D7 0x134 0x32c 0x000 0x10 0x000
283#define MX25_PAD_CSI_D7__SDHC2_DAT_CLK 0x134 0x32C 0x4dc 0x12 0x001
279#define MX25_PAD_CSI_D7__GPIO_1_6 0x134 0x32c 0x000 0x15 0x000 284#define MX25_PAD_CSI_D7__GPIO_1_6 0x134 0x32c 0x000 0x15 0x000
280 285
281#define MX25_PAD_CSI_D8__CSI_D8 0x138 0x330 0x000 0x10 0x000 286#define MX25_PAD_CSI_D8__CSI_D8 0x138 0x330 0x000 0x10 0x000
287#define MX25_PAD_CSI_D8__AUD6_RXC 0x138 0x330 0x000 0x12 0x001
282#define MX25_PAD_CSI_D8__GPIO_1_7 0x138 0x330 0x000 0x15 0x000 288#define MX25_PAD_CSI_D8__GPIO_1_7 0x138 0x330 0x000 0x15 0x000
289#define MX25_PAD_CSI_D8__CSPI3_SS2 0x138 0x330 0x4c4 0x17 0x000
283 290
284#define MX25_PAD_CSI_D9__CSI_D9 0x13c 0x334 0x000 0x10 0x000 291#define MX25_PAD_CSI_D9__CSI_D9 0x13c 0x334 0x000 0x10 0x000
292#define MX25_PAD_CSI_D9__AUD6_RXFS 0x13c 0x334 0x000 0x12 0x001
285#define MX25_PAD_CSI_D9__GPIO_4_21 0x13c 0x334 0x000 0x15 0x000 293#define MX25_PAD_CSI_D9__GPIO_4_21 0x13c 0x334 0x000 0x15 0x000
294#define MX25_PAD_CSI_D9__CSPI3_SS3 0x13c 0x334 0x4c8 0x17 0x000
286 295
287#define MX25_PAD_CSI_MCLK__CSI_MCLK 0x140 0x338 0x000 0x10 0x000 296#define MX25_PAD_CSI_MCLK__CSI_MCLK 0x140 0x338 0x000 0x10 0x000
297#define MX25_PAD_CSI_MCLK__AUD6_TXD 0x140 0x338 0x000 0x11 0x001
298#define MX25_PAD_CSI_MCLK__SDHC2_DAT0 0x140 0x338 0x4e4 0x12 0x001
288#define MX25_PAD_CSI_MCLK__GPIO_1_8 0x140 0x338 0x000 0x15 0x000 299#define MX25_PAD_CSI_MCLK__GPIO_1_8 0x140 0x338 0x000 0x15 0x000
289 300
290#define MX25_PAD_CSI_VSYNC__CSI_VSYNC 0x144 0x33c 0x000 0x10 0x000 301#define MX25_PAD_CSI_VSYNC__CSI_VSYNC 0x144 0x33c 0x000 0x10 0x000
302#define MX25_PAD_CSI_VSYNC__AUD6_RXD 0x144 0x33c 0x000 0x11 0x001
303#define MX25_PAD_CSI_VSYNC__SDHC2_DAT1 0x144 0x33c 0x4e8 0x12 0x001
291#define MX25_PAD_CSI_VSYNC__GPIO_1_9 0x144 0x33c 0x000 0x15 0x000 304#define MX25_PAD_CSI_VSYNC__GPIO_1_9 0x144 0x33c 0x000 0x15 0x000
292 305
293#define MX25_PAD_CSI_HSYNC__CSI_HSYNC 0x148 0x340 0x000 0x10 0x000 306#define MX25_PAD_CSI_HSYNC__CSI_HSYNC 0x148 0x340 0x000 0x10 0x000
307#define MX25_PAD_CSI_HSYNC__AUD6_TXC 0x148 0x340 0x000 0x11 0x001
308#define MX25_PAD_CSI_HSYNC__SDHC2_DAT2 0x148 0x340 0x4ec 0x12 0x001
294#define MX25_PAD_CSI_HSYNC__GPIO_1_10 0x148 0x340 0x000 0x15 0x000 309#define MX25_PAD_CSI_HSYNC__GPIO_1_10 0x148 0x340 0x000 0x15 0x000
295 310
296#define MX25_PAD_CSI_PIXCLK__CSI_PIXCLK 0x14c 0x344 0x000 0x10 0x000 311#define MX25_PAD_CSI_PIXCLK__CSI_PIXCLK 0x14c 0x344 0x000 0x10 0x000
312#define MX25_PAD_CSI_PIXCLK__AUD6_TXFS 0x14c 0x344 0x000 0x11 0x001
313#define MX25_PAD_CSI_PIXCLK__SDHC2_DAT3 0x14c 0x344 0x4f0 0x12 0x001
297#define MX25_PAD_CSI_PIXCLK__GPIO_1_11 0x14c 0x344 0x000 0x15 0x000 314#define MX25_PAD_CSI_PIXCLK__GPIO_1_11 0x14c 0x344 0x000 0x15 0x000
298 315
299#define MX25_PAD_I2C1_CLK__I2C1_CLK 0x150 0x348 0x000 0x10 0x000 316#define MX25_PAD_I2C1_CLK__I2C1_CLK 0x150 0x348 0x000 0x10 0x000
@@ -303,18 +320,24 @@
303#define MX25_PAD_I2C1_DAT__GPIO_1_13 0x154 0x34c 0x000 0x15 0x000 320#define MX25_PAD_I2C1_DAT__GPIO_1_13 0x154 0x34c 0x000 0x15 0x000
304 321
305#define MX25_PAD_CSPI1_MOSI__CSPI1_MOSI 0x158 0x350 0x000 0x10 0x000 322#define MX25_PAD_CSPI1_MOSI__CSPI1_MOSI 0x158 0x350 0x000 0x10 0x000
323#define MX25_PAD_CSPI1_MOSI__UART3_RXD 0x158 0x350 0x000 0x12 0x000
306#define MX25_PAD_CSPI1_MOSI__GPIO_1_14 0x158 0x350 0x000 0x15 0x000 324#define MX25_PAD_CSPI1_MOSI__GPIO_1_14 0x158 0x350 0x000 0x15 0x000
307 325
308#define MX25_PAD_CSPI1_MISO__CSPI1_MISO 0x15c 0x354 0x000 0x10 0x000 326#define MX25_PAD_CSPI1_MISO__CSPI1_MISO 0x15c 0x354 0x000 0x10 0x000
327#define MX25_PAD_CSPI1_MISO__UART3_TXD 0x15c 0x354 0x000 0x12 0x000
309#define MX25_PAD_CSPI1_MISO__GPIO_1_15 0x15c 0x354 0x000 0x15 0x000 328#define MX25_PAD_CSPI1_MISO__GPIO_1_15 0x15c 0x354 0x000 0x15 0x000
310 329
311#define MX25_PAD_CSPI1_SS0__CSPI1_SS0 0x160 0x358 0x000 0x10 0x000 330#define MX25_PAD_CSPI1_SS0__CSPI1_SS0 0x160 0x358 0x000 0x10 0x000
331#define MX25_PAD_CSPI1_SS0__PWM2_PWMO 0x160 0x358 0x000 0x12 0x000
312#define MX25_PAD_CSPI1_SS0__GPIO_1_16 0x160 0x358 0x000 0x15 0x000 332#define MX25_PAD_CSPI1_SS0__GPIO_1_16 0x160 0x358 0x000 0x15 0x000
313 333
314#define MX25_PAD_CSPI1_SS1__CSPI1_SS1 0x164 0x35c 0x000 0x10 0x000 334#define MX25_PAD_CSPI1_SS1__CSPI1_SS1 0x164 0x35c 0x000 0x10 0x000
335#define MX25_PAD_CSPI1_SS1__I2C3_DAT 0x164 0x35C 0x528 0x11 0x001
336#define MX25_PAD_CSPI1_SS1__UART3_RTS 0x164 0x35c 0x000 0x12 0x000
315#define MX25_PAD_CSPI1_SS1__GPIO_1_17 0x164 0x35c 0x000 0x15 0x000 337#define MX25_PAD_CSPI1_SS1__GPIO_1_17 0x164 0x35c 0x000 0x15 0x000
316 338
317#define MX25_PAD_CSPI1_SCLK__CSPI1_SCLK 0x168 0x360 0x000 0x10 0x000 339#define MX25_PAD_CSPI1_SCLK__CSPI1_SCLK 0x168 0x360 0x000 0x10 0x000
340#define MX25_PAD_CSPI1_SCLK__UART3_CTS 0x168 0x360 0x000 0x12 0x000
318#define MX25_PAD_CSPI1_SCLK__GPIO_1_18 0x168 0x360 0x000 0x15 0x000 341#define MX25_PAD_CSPI1_SCLK__GPIO_1_18 0x168 0x360 0x000 0x15 0x000
319 342
320#define MX25_PAD_CSPI1_RDY__CSPI1_RDY 0x16c 0x364 0x000 0x10 0x000 343#define MX25_PAD_CSPI1_RDY__CSPI1_RDY 0x16c 0x364 0x000 0x10 0x000
@@ -328,6 +351,7 @@
328 351
329#define MX25_PAD_UART1_RTS__UART1_RTS 0x178 0x370 0x000 0x10 0x000 352#define MX25_PAD_UART1_RTS__UART1_RTS 0x178 0x370 0x000 0x10 0x000
330#define MX25_PAD_UART1_RTS__CSI_D0 0x178 0x370 0x488 0x11 0x001 353#define MX25_PAD_UART1_RTS__CSI_D0 0x178 0x370 0x488 0x11 0x001
354#define MX25_PAD_UART1_RTS__CC3 0x178 0x370 0x000 0x12 0x000
331#define MX25_PAD_UART1_RTS__GPIO_4_24 0x178 0x370 0x000 0x15 0x000 355#define MX25_PAD_UART1_RTS__GPIO_4_24 0x178 0x370 0x000 0x15 0x000
332 356
333#define MX25_PAD_UART1_CTS__UART1_CTS 0x17c 0x374 0x000 0x10 0x000 357#define MX25_PAD_UART1_CTS__UART1_CTS 0x17c 0x374 0x000 0x10 0x000
@@ -342,6 +366,7 @@
342 366
343#define MX25_PAD_UART2_RTS__UART2_RTS 0x188 0x380 0x000 0x10 0x000 367#define MX25_PAD_UART2_RTS__UART2_RTS 0x188 0x380 0x000 0x10 0x000
344#define MX25_PAD_UART2_RTS__FEC_COL 0x188 0x380 0x504 0x12 0x002 368#define MX25_PAD_UART2_RTS__FEC_COL 0x188 0x380 0x504 0x12 0x002
369#define MX25_PAD_UART2_RTS__CC1 0x188 0x380 0x000 0x13 0x000
345#define MX25_PAD_UART2_RTS__GPIO_4_28 0x188 0x380 0x000 0x15 0x000 370#define MX25_PAD_UART2_RTS__GPIO_4_28 0x188 0x380 0x000 0x15 0x000
346 371
347#define MX25_PAD_UART2_CTS__FEC_RX_ER 0x18c 0x384 0x518 0x12 0x002 372#define MX25_PAD_UART2_CTS__FEC_RX_ER 0x18c 0x384 0x518 0x12 0x002
@@ -349,14 +374,17 @@
349#define MX25_PAD_UART2_CTS__GPIO_4_29 0x18c 0x384 0x000 0x15 0x000 374#define MX25_PAD_UART2_CTS__GPIO_4_29 0x18c 0x384 0x000 0x15 0x000
350 375
351#define MX25_PAD_SD1_CMD__SD1_CMD 0x190 0x388 0x000 0x10 0x000 376#define MX25_PAD_SD1_CMD__SD1_CMD 0x190 0x388 0x000 0x10 0x000
377#define MX25_PAD_SD1_CMD__CSPI2_MOSI 0x190 0x388 0x4a0 0x11 0x001
352#define MX25_PAD_SD1_CMD__FEC_RDATA2 0x190 0x388 0x50c 0x12 0x002 378#define MX25_PAD_SD1_CMD__FEC_RDATA2 0x190 0x388 0x50c 0x12 0x002
353#define MX25_PAD_SD1_CMD__GPIO_2_23 0x190 0x388 0x000 0x15 0x000 379#define MX25_PAD_SD1_CMD__GPIO_2_23 0x190 0x388 0x000 0x15 0x000
354 380
355#define MX25_PAD_SD1_CLK__SD1_CLK 0x194 0x38c 0x000 0x10 0x000 381#define MX25_PAD_SD1_CLK__SD1_CLK 0x194 0x38c 0x000 0x10 0x000
382#define MX25_PAD_SD1_CLK__CSPI2_MISO 0x194 0x38c 0x49c 0x11 0x001
356#define MX25_PAD_SD1_CLK__FEC_RDATA3 0x194 0x38c 0x510 0x12 0x002 383#define MX25_PAD_SD1_CLK__FEC_RDATA3 0x194 0x38c 0x510 0x12 0x002
357#define MX25_PAD_SD1_CLK__GPIO_2_24 0x194 0x38c 0x000 0x15 0x000 384#define MX25_PAD_SD1_CLK__GPIO_2_24 0x194 0x38c 0x000 0x15 0x000
358 385
359#define MX25_PAD_SD1_DATA0__SD1_DATA0 0x198 0x390 0x000 0x10 0x000 386#define MX25_PAD_SD1_DATA0__SD1_DATA0 0x198 0x390 0x000 0x10 0x000
387#define MX25_PAD_SD1_DATA0__CSPI2_SCLK 0x198 0x390 0x494 0x11 0x001
360#define MX25_PAD_SD1_DATA0__GPIO_2_25 0x198 0x390 0x000 0x15 0x000 388#define MX25_PAD_SD1_DATA0__GPIO_2_25 0x198 0x390 0x000 0x15 0x000
361 389
362#define MX25_PAD_SD1_DATA1__SD1_DATA1 0x19c 0x394 0x000 0x10 0x000 390#define MX25_PAD_SD1_DATA1__SD1_DATA1 0x19c 0x394 0x000 0x10 0x000
@@ -457,14 +485,15 @@
457#define MX25_PAD_GPIO_C__CAN2_TX 0x1fc 0x3f8 0x000 0x16 0x000 485#define MX25_PAD_GPIO_C__CAN2_TX 0x1fc 0x3f8 0x000 0x16 0x000
458 486
459#define MX25_PAD_GPIO_D__GPIO_D 0x200 0x3fc 0x000 0x10 0x000 487#define MX25_PAD_GPIO_D__GPIO_D 0x200 0x3fc 0x000 0x10 0x000
460#define MX25_PAD_GPIO_E__LD16 0x204 0x400 0x000 0x02 0x000
461#define MX25_PAD_GPIO_D__CAN2_RX 0x200 0x3fc 0x484 0x16 0x001 488#define MX25_PAD_GPIO_D__CAN2_RX 0x200 0x3fc 0x484 0x16 0x001
462 489
463#define MX25_PAD_GPIO_E__GPIO_E 0x204 0x400 0x000 0x10 0x000 490#define MX25_PAD_GPIO_E__GPIO_E 0x204 0x400 0x000 0x10 0x000
464#define MX25_PAD_GPIO_F__LD17 0x208 0x404 0x000 0x02 0x000 491#define MX25_PAD_GPIO_E__I2C3_CLK 0x204 0x400 0x524 0x11 0x002
492#define MX25_PAD_GPIO_E__LD16 0x204 0x400 0x000 0x12 0x000
465#define MX25_PAD_GPIO_E__AUD7_TXD 0x204 0x400 0x000 0x14 0x000 493#define MX25_PAD_GPIO_E__AUD7_TXD 0x204 0x400 0x000 0x14 0x000
466 494
467#define MX25_PAD_GPIO_F__GPIO_F 0x208 0x404 0x000 0x10 0x000 495#define MX25_PAD_GPIO_F__GPIO_F 0x208 0x404 0x000 0x10 0x000
496#define MX25_PAD_GPIO_F__LD17 0x208 0x404 0x000 0x12 0x000
468#define MX25_PAD_GPIO_F__AUD7_TXC 0x208 0x404 0x000 0x14 0x000 497#define MX25_PAD_GPIO_F__AUD7_TXC 0x208 0x404 0x000 0x14 0x000
469 498
470#define MX25_PAD_EXT_ARMCLK__EXT_ARMCLK 0x20c 0x000 0x000 0x10 0x000 499#define MX25_PAD_EXT_ARMCLK__EXT_ARMCLK 0x20c 0x000 0x000 0x10 0x000
diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
index c1740396b2c9..58d3c3cf2923 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -239,6 +239,7 @@
239 }; 239 };
240 240
241 ssi2: ssi@50014000 { 241 ssi2: ssi@50014000 {
242 #sound-dai-cells = <0>;
242 compatible = "fsl,imx25-ssi", "fsl,imx21-ssi"; 243 compatible = "fsl,imx25-ssi", "fsl,imx21-ssi";
243 reg = <0x50014000 0x4000>; 244 reg = <0x50014000 0x4000>;
244 interrupts = <11>; 245 interrupts = <11>;
@@ -274,6 +275,7 @@
274 }; 275 };
275 276
276 ssi1: ssi@50034000 { 277 ssi1: ssi@50034000 {
278 #sound-dai-cells = <0>;
277 compatible = "fsl,imx25-ssi", "fsl,imx21-ssi"; 279 compatible = "fsl,imx25-ssi", "fsl,imx21-ssi";
278 reg = <0x50034000 0x4000>; 280 reg = <0x50034000 0x4000>;
279 interrupts = <12>; 281 interrupts = <12>;
@@ -453,7 +455,7 @@
453 }; 455 };
454 456
455 sdma: sdma@53fd4000 { 457 sdma: sdma@53fd4000 {
456 compatible = "fsl,imx25-sdma", "fsl,imx35-sdma"; 458 compatible = "fsl,imx25-sdma";
457 reg = <0x53fd4000 0x4000>; 459 reg = <0x53fd4000 0x4000>;
458 clocks = <&clks 112>, <&clks 68>; 460 clocks = <&clks 112>, <&clks 68>;
459 clock-names = "ipg", "ahb"; 461 clock-names = "ipg", "ahb";
diff --git a/arch/arm/boot/dts/imx27-apf27dev.dts b/arch/arm/boot/dts/imx27-apf27dev.dts
index 2b6d489dae69..da306c5dd678 100644
--- a/arch/arm/boot/dts/imx27-apf27dev.dts
+++ b/arch/arm/boot/dts/imx27-apf27dev.dts
@@ -67,6 +67,16 @@
67 pinctrl-names = "default"; 67 pinctrl-names = "default";
68 pinctrl-0 = <&pinctrl_cspi1 &pinctrl_cspi1_cs>; 68 pinctrl-0 = <&pinctrl_cspi1 &pinctrl_cspi1_cs>;
69 status = "okay"; 69 status = "okay";
70
71 adc@0 {
72 compatible = "maxim,max1027";
73 reg = <0>;
74 interrupt-parent = <&gpio5>;
75 interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
76 pinctrl-names = "default";
77 pinctrl-0 = <&pinctrl_max1027>;
78 spi-max-frequency = <10000000>;
79 };
70}; 80};
71 81
72&cspi2 { 82&cspi2 {
@@ -189,6 +199,13 @@
189 >; 199 >;
190 }; 200 };
191 201
202 pinctrl_max1027: max1027 {
203 fsl,pins = <
204 MX27_PAD_UART1_CTS__GPIO5_14 0x0 /* CNVST */
205 MX27_PAD_UART1_RTS__GPIO5_15 0x0 /* EOC */
206 >;
207 };
208
192 pinctrl_pwm: pwmgrp { 209 pinctrl_pwm: pwmgrp {
193 fsl,pins = < 210 fsl,pins = <
194 MX27_PAD_PWMO__PWMO 0x0 211 MX27_PAD_PWMO__PWMO 0x0
diff --git a/arch/arm/boot/dts/imx28-apf28dev.dts b/arch/arm/boot/dts/imx28-apf28dev.dts
index 221cac4fb2cd..1f38a052ad4b 100644
--- a/arch/arm/boot/dts/imx28-apf28dev.dts
+++ b/arch/arm/boot/dts/imx28-apf28dev.dts
@@ -83,10 +83,10 @@
83 pinctrl-names = "default"; 83 pinctrl-names = "default";
84 pinctrl-0 = <&lcdif_16bit_pins_a 84 pinctrl-0 = <&lcdif_16bit_pins_a
85 &lcdif_pins_apf28dev>; 85 &lcdif_pins_apf28dev>;
86 display = <&display>; 86 display = <&display0>;
87 status = "okay"; 87 status = "okay";
88 88
89 display: display { 89 display0: display0 {
90 bits-per-pixel = <16>; 90 bits-per-pixel = <16>;
91 bus-width = <16>; 91 bus-width = <16>;
92 92
diff --git a/arch/arm/boot/dts/imx28-apx4devkit.dts b/arch/arm/boot/dts/imx28-apx4devkit.dts
index e1ce9179db63..1092b761d7ac 100644
--- a/arch/arm/boot/dts/imx28-apx4devkit.dts
+++ b/arch/arm/boot/dts/imx28-apx4devkit.dts
@@ -94,10 +94,10 @@
94 pinctrl-names = "default"; 94 pinctrl-names = "default";
95 pinctrl-0 = <&lcdif_24bit_pins_a 95 pinctrl-0 = <&lcdif_24bit_pins_a
96 &lcdif_pins_apx4>; 96 &lcdif_pins_apx4>;
97 display = <&display>; 97 display = <&display0>;
98 status = "okay"; 98 status = "okay";
99 99
100 display: display { 100 display0: display0 {
101 bits-per-pixel = <32>; 101 bits-per-pixel = <32>;
102 bus-width = <24>; 102 bus-width = <24>;
103 103
diff --git a/arch/arm/boot/dts/imx28-cfa10049.dts b/arch/arm/boot/dts/imx28-cfa10049.dts
index 7d51459de5e8..ef944b6d4f01 100644
--- a/arch/arm/boot/dts/imx28-cfa10049.dts
+++ b/arch/arm/boot/dts/imx28-cfa10049.dts
@@ -177,10 +177,10 @@
177 pinctrl-0 = <&lcdif_18bit_pins_cfa10049 177 pinctrl-0 = <&lcdif_18bit_pins_cfa10049
178 &lcdif_pins_cfa10049 178 &lcdif_pins_cfa10049
179 &lcdif_pins_cfa10049_pullup>; 179 &lcdif_pins_cfa10049_pullup>;
180 display = <&display>; 180 display = <&display0>;
181 status = "okay"; 181 status = "okay";
182 182
183 display: display { 183 display0: display0 {
184 bits-per-pixel = <32>; 184 bits-per-pixel = <32>;
185 bus-width = <18>; 185 bus-width = <18>;
186 186
diff --git a/arch/arm/boot/dts/imx28-cfa10055.dts b/arch/arm/boot/dts/imx28-cfa10055.dts
index c3900e7ba331..6a34114bec29 100644
--- a/arch/arm/boot/dts/imx28-cfa10055.dts
+++ b/arch/arm/boot/dts/imx28-cfa10055.dts
@@ -92,10 +92,10 @@
92 pinctrl-0 = <&lcdif_18bit_pins_cfa10055 92 pinctrl-0 = <&lcdif_18bit_pins_cfa10055
93 &lcdif_pins_cfa10055 93 &lcdif_pins_cfa10055
94 &lcdif_pins_cfa10055_pullup>; 94 &lcdif_pins_cfa10055_pullup>;
95 display = <&display>; 95 display = <&display0>;
96 status = "okay"; 96 status = "okay";
97 97
98 display: display { 98 display0: display0 {
99 bits-per-pixel = <32>; 99 bits-per-pixel = <32>;
100 bus-width = <18>; 100 bus-width = <18>;
101 101
diff --git a/arch/arm/boot/dts/imx28-cfa10056.dts b/arch/arm/boot/dts/imx28-cfa10056.dts
index cef959a97219..ba6495ca44d2 100644
--- a/arch/arm/boot/dts/imx28-cfa10056.dts
+++ b/arch/arm/boot/dts/imx28-cfa10056.dts
@@ -64,10 +64,10 @@
64 pinctrl-0 = <&lcdif_24bit_pins_a 64 pinctrl-0 = <&lcdif_24bit_pins_a
65 &lcdif_pins_cfa10056 65 &lcdif_pins_cfa10056
66 &lcdif_pins_cfa10056_pullup >; 66 &lcdif_pins_cfa10056_pullup >;
67 display = <&display>; 67 display = <&display0>;
68 status = "okay"; 68 status = "okay";
69 69
70 display: display { 70 display0: display0 {
71 bits-per-pixel = <32>; 71 bits-per-pixel = <32>;
72 bus-width = <24>; 72 bus-width = <24>;
73 73
diff --git a/arch/arm/boot/dts/imx28-cfa10057.dts b/arch/arm/boot/dts/imx28-cfa10057.dts
index c4e00ce4b6da..5df0b24eaf59 100644
--- a/arch/arm/boot/dts/imx28-cfa10057.dts
+++ b/arch/arm/boot/dts/imx28-cfa10057.dts
@@ -78,10 +78,10 @@
78 pinctrl-names = "default"; 78 pinctrl-names = "default";
79 pinctrl-0 = <&lcdif_18bit_pins_cfa10057 79 pinctrl-0 = <&lcdif_18bit_pins_cfa10057
80 &lcdif_pins_cfa10057>; 80 &lcdif_pins_cfa10057>;
81 display = <&display>; 81 display = <&display0>;
82 status = "okay"; 82 status = "okay";
83 83
84 display: display { 84 display0: display0 {
85 bits-per-pixel = <32>; 85 bits-per-pixel = <32>;
86 bus-width = <18>; 86 bus-width = <18>;
87 87
diff --git a/arch/arm/boot/dts/imx28-cfa10058.dts b/arch/arm/boot/dts/imx28-cfa10058.dts
index 7c9cc783f0d1..f5c6dce34abe 100644
--- a/arch/arm/boot/dts/imx28-cfa10058.dts
+++ b/arch/arm/boot/dts/imx28-cfa10058.dts
@@ -51,10 +51,10 @@
51 pinctrl-names = "default"; 51 pinctrl-names = "default";
52 pinctrl-0 = <&lcdif_24bit_pins_a 52 pinctrl-0 = <&lcdif_24bit_pins_a
53 &lcdif_pins_cfa10058>; 53 &lcdif_pins_cfa10058>;
54 display = <&display>; 54 display = <&display0>;
55 status = "okay"; 55 status = "okay";
56 56
57 display: display { 57 display0: display0 {
58 bits-per-pixel = <32>; 58 bits-per-pixel = <32>;
59 bus-width = <24>; 59 bus-width = <24>;
60 60
diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts
index e4cc44c98585..09664fcf5afb 100644
--- a/arch/arm/boot/dts/imx28-evk.dts
+++ b/arch/arm/boot/dts/imx28-evk.dts
@@ -124,10 +124,10 @@
124 pinctrl-0 = <&lcdif_24bit_pins_a 124 pinctrl-0 = <&lcdif_24bit_pins_a
125 &lcdif_pins_evk>; 125 &lcdif_pins_evk>;
126 lcd-supply = <&reg_lcd_3v3>; 126 lcd-supply = <&reg_lcd_3v3>;
127 display = <&display>; 127 display = <&display0>;
128 status = "okay"; 128 status = "okay";
129 129
130 display: display { 130 display0: display0 {
131 bits-per-pixel = <32>; 131 bits-per-pixel = <32>;
132 bus-width = <24>; 132 bus-width = <24>;
133 133
diff --git a/arch/arm/boot/dts/imx28-m28cu3.dts b/arch/arm/boot/dts/imx28-m28cu3.dts
index 9348ce59dda4..2df63bee6f4e 100644
--- a/arch/arm/boot/dts/imx28-m28cu3.dts
+++ b/arch/arm/boot/dts/imx28-m28cu3.dts
@@ -115,10 +115,10 @@
115 pinctrl-names = "default"; 115 pinctrl-names = "default";
116 pinctrl-0 = <&lcdif_24bit_pins_a 116 pinctrl-0 = <&lcdif_24bit_pins_a
117 &lcdif_pins_m28>; 117 &lcdif_pins_m28>;
118 display = <&display>; 118 display = <&display0>;
119 status = "okay"; 119 status = "okay";
120 120
121 display: display0 { 121 display0: display0 {
122 bits-per-pixel = <32>; 122 bits-per-pixel = <32>;
123 bus-width = <24>; 123 bus-width = <24>;
124 124
diff --git a/arch/arm/boot/dts/imx28-m28evk.dts b/arch/arm/boot/dts/imx28-m28evk.dts
index b3c09ae3b928..e35cc6ba3ca6 100644
--- a/arch/arm/boot/dts/imx28-m28evk.dts
+++ b/arch/arm/boot/dts/imx28-m28evk.dts
@@ -81,10 +81,10 @@
81 pinctrl-names = "default"; 81 pinctrl-names = "default";
82 pinctrl-0 = <&lcdif_24bit_pins_a 82 pinctrl-0 = <&lcdif_24bit_pins_a
83 &lcdif_pins_m28>; 83 &lcdif_pins_m28>;
84 display = <&display>; 84 display = <&display0>;
85 status = "okay"; 85 status = "okay";
86 86
87 display: display { 87 display0: display0 {
88 bits-per-pixel = <16>; 88 bits-per-pixel = <16>;
89 bus-width = <18>; 89 bus-width = <18>;
90 90
diff --git a/arch/arm/boot/dts/imx28-tx28.dts b/arch/arm/boot/dts/imx28-tx28.dts
index e14bd86f3e99..a5b27c85a91c 100644
--- a/arch/arm/boot/dts/imx28-tx28.dts
+++ b/arch/arm/boot/dts/imx28-tx28.dts
@@ -21,12 +21,15 @@
21 aliases { 21 aliases {
22 can0 = &can0; 22 can0 = &can0;
23 can1 = &can1; 23 can1 = &can1;
24 display = &display; 24 display = &display0;
25 ds1339 = &ds1339; 25 ds1339 = &ds1339;
26 gpio5 = &gpio5; 26 gpio5 = &gpio5;
27 lcdif = &lcdif; 27 lcdif = &lcdif;
28 lcdif_23bit_pins = &tx28_lcdif_23bit_pins; 28 lcdif_23bit_pins = &tx28_lcdif_23bit_pins;
29 lcdif_24bit_pins = &lcdif_24bit_pins_a; 29 lcdif_24bit_pins = &lcdif_24bit_pins_a;
30 reg_can_xcvr = &reg_can_xcvr;
31 spi_gpio = &spi_gpio;
32 spi_mxs = &ssp3;
30 stk5led = &user_led; 33 stk5led = &user_led;
31 usbotg = &usb0; 34 usbotg = &usb0;
32 }; 35 };
@@ -37,7 +40,7 @@
37 40
38 onewire { 41 onewire {
39 compatible = "w1-gpio"; 42 compatible = "w1-gpio";
40 gpios = <&gpio2 7 0>; 43 gpios = <&gpio2 7 GPIO_ACTIVE_HIGH>;
41 status = "disabled"; 44 status = "disabled";
42 }; 45 };
43 46
@@ -52,7 +55,7 @@
52 regulator-name = "usb0_vbus"; 55 regulator-name = "usb0_vbus";
53 regulator-min-microvolt = <5000000>; 56 regulator-min-microvolt = <5000000>;
54 regulator-max-microvolt = <5000000>; 57 regulator-max-microvolt = <5000000>;
55 gpio = <&gpio0 18 0>; 58 gpio = <&gpio0 18 GPIO_ACTIVE_HIGH>;
56 enable-active-high; 59 enable-active-high;
57 }; 60 };
58 61
@@ -62,7 +65,7 @@
62 regulator-name = "usb1_vbus"; 65 regulator-name = "usb1_vbus";
63 regulator-min-microvolt = <5000000>; 66 regulator-min-microvolt = <5000000>;
64 regulator-max-microvolt = <5000000>; 67 regulator-max-microvolt = <5000000>;
65 gpio = <&gpio3 27 0>; 68 gpio = <&gpio3 27 GPIO_ACTIVE_HIGH>;
66 enable-active-high; 69 enable-active-high;
67 }; 70 };
68 71
@@ -90,7 +93,7 @@
90 regulator-name = "CAN XCVR"; 93 regulator-name = "CAN XCVR";
91 regulator-min-microvolt = <3300000>; 94 regulator-min-microvolt = <3300000>;
92 regulator-max-microvolt = <3300000>; 95 regulator-max-microvolt = <3300000>;
93 gpio = <&gpio1 0 0>; 96 gpio = <&gpio1 0 GPIO_ACTIVE_HIGH>;
94 pinctrl-names = "default"; 97 pinctrl-names = "default";
95 pinctrl-0 = <&tx28_flexcan_xcvr_pins>; 98 pinctrl-0 = <&tx28_flexcan_xcvr_pins>;
96 }; 99 };
@@ -101,7 +104,7 @@
101 regulator-name = "LCD POWER"; 104 regulator-name = "LCD POWER";
102 regulator-min-microvolt = <3300000>; 105 regulator-min-microvolt = <3300000>;
103 regulator-max-microvolt = <3300000>; 106 regulator-max-microvolt = <3300000>;
104 gpio = <&gpio1 31 0>; 107 gpio = <&gpio1 31 GPIO_ACTIVE_HIGH>;
105 enable-active-high; 108 enable-active-high;
106 }; 109 };
107 110
@@ -111,7 +114,7 @@
111 regulator-name = "LCD RESET"; 114 regulator-name = "LCD RESET";
112 regulator-min-microvolt = <3300000>; 115 regulator-min-microvolt = <3300000>;
113 regulator-max-microvolt = <3300000>; 116 regulator-max-microvolt = <3300000>;
114 gpio = <&gpio3 30 0>; 117 gpio = <&gpio3 30 GPIO_ACTIVE_HIGH>;
115 startup-delay-us = <300000>; 118 startup-delay-us = <300000>;
116 enable-active-high; 119 enable-active-high;
117 regulator-always-on; 120 regulator-always-on;
@@ -143,7 +146,7 @@
143 146
144 user_led: user { 147 user_led: user {
145 label = "Heartbeat"; 148 label = "Heartbeat";
146 gpios = <&gpio4 10 0>; 149 gpios = <&gpio4 10 GPIO_ACTIVE_HIGH>;
147 linux,default-trigger = "heartbeat"; 150 linux,default-trigger = "heartbeat";
148 }; 151 };
149 }; 152 };
@@ -172,16 +175,16 @@
172 matrix_keypad: matrix-keypad@0 { 175 matrix_keypad: matrix-keypad@0 {
173 compatible = "gpio-matrix-keypad"; 176 compatible = "gpio-matrix-keypad";
174 col-gpios = < 177 col-gpios = <
175 &gpio5 0 0 178 &gpio5 0 GPIO_ACTIVE_HIGH
176 &gpio5 1 0 179 &gpio5 1 GPIO_ACTIVE_HIGH
177 &gpio5 2 0 180 &gpio5 2 GPIO_ACTIVE_HIGH
178 &gpio5 3 0 181 &gpio5 3 GPIO_ACTIVE_HIGH
179 >; 182 >;
180 row-gpios = < 183 row-gpios = <
181 &gpio5 4 0 184 &gpio5 4 GPIO_ACTIVE_HIGH
182 &gpio5 5 0 185 &gpio5 5 GPIO_ACTIVE_HIGH
183 &gpio5 6 0 186 &gpio5 6 GPIO_ACTIVE_HIGH
184 &gpio5 7 0 187 &gpio5 7 GPIO_ACTIVE_HIGH
185 >; 188 >;
186 /* sample keymap */ 189 /* sample keymap */
187 linux,keymap = < 190 linux,keymap = <
@@ -203,6 +206,44 @@
203 col-scan-delay-us = <5000>; 206 col-scan-delay-us = <5000>;
204 linux,no-autorepeat; 207 linux,no-autorepeat;
205 }; 208 };
209
210 spi_gpio: spi-gpio {
211 compatible = "spi-gpio";
212 #address-cells = <1>;
213 #size-cells = <0>;
214 pinctrl-names = "default";
215 pinctrl-0 = <&tx28_spi_gpio_pins>;
216
217 gpio-sck = <&gpio2 24 GPIO_ACTIVE_HIGH>;
218 gpio-mosi = <&gpio2 25 GPIO_ACTIVE_HIGH>;
219 gpio-miso = <&gpio2 26 GPIO_ACTIVE_HIGH>;
220 num-chipselects = <3>;
221 cs-gpios = <
222 &gpio2 27 GPIO_ACTIVE_LOW
223 &gpio3 8 GPIO_ACTIVE_LOW
224 &gpio3 9 GPIO_ACTIVE_LOW
225 >;
226 /* enable this and disable ssp3 below, if you need full duplex SPI transfer */
227 status = "disabled";
228
229 spi@0 {
230 compatible = "spidev";
231 reg = <0>;
232 spi-max-frequency = <57600000>;
233 };
234
235 spi@1 {
236 compatible = "spidev";
237 reg = <1>;
238 spi-max-frequency = <57600000>;
239 };
240
241 spi@2 {
242 compatible = "spidev";
243 reg = <2>;
244 spi-max-frequency = <57600000>;
245 };
246 };
206}; 247};
207 248
208/* 2nd TX-Std UART - (A)UART1 */ 249/* 2nd TX-Std UART - (A)UART1 */
@@ -284,8 +325,8 @@
284 pinctrl-0 = <&tx28_edt_ft5x06_pins>; 325 pinctrl-0 = <&tx28_edt_ft5x06_pins>;
285 interrupt-parent = <&gpio2>; 326 interrupt-parent = <&gpio2>;
286 interrupts = <5 0>; 327 interrupts = <5 0>;
287 reset-gpios = <&gpio2 6 1>; 328 reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
288 wake-gpios = <&gpio4 9 0>; 329 wake-gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
289 }; 330 };
290 331
291 touchscreen: tsc2007@48 { 332 touchscreen: tsc2007@48 {
@@ -295,7 +336,7 @@
295 pinctrl-0 = <&tx28_tsc2007_pins>; 336 pinctrl-0 = <&tx28_tsc2007_pins>;
296 interrupt-parent = <&gpio3>; 337 interrupt-parent = <&gpio3>;
297 interrupts = <20 0>; 338 interrupts = <20 0>;
298 pendown-gpio = <&gpio3 20 1>; 339 pendown-gpio = <&gpio3 20 GPIO_ACTIVE_LOW>;
299 ti,x-plate-ohms = /bits/ 16 <660>; 340 ti,x-plate-ohms = /bits/ 16 <660>;
300 }; 341 };
301 342
@@ -309,10 +350,10 @@
309 pinctrl-names = "default"; 350 pinctrl-names = "default";
310 pinctrl-0 = <&lcdif_24bit_pins_a &lcdif_sync_pins_a &tx28_lcdif_ctrl_pins>; 351 pinctrl-0 = <&lcdif_24bit_pins_a &lcdif_sync_pins_a &tx28_lcdif_ctrl_pins>;
311 lcd-supply = <&reg_lcd>; 352 lcd-supply = <&reg_lcd>;
312 display = <&display>; 353 display = <&display0>;
313 status = "okay"; 354 status = "okay";
314 355
315 display: display@0 { 356 display0: display0 {
316 bits-per-pixel = <32>; 357 bits-per-pixel = <32>;
317 bus-width = <24>; 358 bus-width = <24>;
318 display-timings { 359 display-timings {
@@ -558,6 +599,20 @@
558 fsl,pull-up = <MXS_PULL_DISABLE>; 599 fsl,pull-up = <MXS_PULL_DISABLE>;
559 }; 600 };
560 601
602 tx28_spi_gpio_pins: spi-gpiogrp {
603 fsl,pinmux-ids = <
604 MX28_PAD_AUART2_RX__GPIO_3_8
605 MX28_PAD_AUART2_TX__GPIO_3_9
606 MX28_PAD_SSP3_SCK__GPIO_2_24
607 MX28_PAD_SSP3_MOSI__GPIO_2_25
608 MX28_PAD_SSP3_MISO__GPIO_2_26
609 MX28_PAD_SSP3_SS0__GPIO_2_27
610 >;
611 fsl,drive-strength = <MXS_DRIVE_8mA>;
612 fsl,voltage = <MXS_VOLTAGE_HIGH>;
613 fsl,pull-up = <MXS_PULL_DISABLE>;
614 };
615
561 tx28_tsc2007_pins: tx28-tsc2007-pins { 616 tx28_tsc2007_pins: tx28-tsc2007-pins {
562 fsl,pinmux-ids = < 617 fsl,pinmux-ids = <
563 MX28_PAD_SAIF0_MCLK__GPIO_3_20 /* TSC2007 IRQ */ 618 MX28_PAD_SAIF0_MCLK__GPIO_3_20 /* TSC2007 IRQ */
@@ -619,17 +674,23 @@
619 clock-frequency = <57600000>; 674 clock-frequency = <57600000>;
620 status = "okay"; 675 status = "okay";
621 676
622 spidev0: spi@0 { 677 spi@0 {
623 compatible = "spidev"; 678 compatible = "spidev";
624 reg = <0>; 679 reg = <0>;
625 spi-max-frequency = <57600000>; 680 spi-max-frequency = <57600000>;
626 }; 681 };
627 682
628 spidev1: spi@1 { 683 spi@1 {
629 compatible = "spidev"; 684 compatible = "spidev";
630 reg = <1>; 685 reg = <1>;
631 spi-max-frequency = <57600000>; 686 spi-max-frequency = <57600000>;
632 }; 687 };
688
689 spi@2 {
690 compatible = "spidev";
691 reg = <2>;
692 spi-max-frequency = <57600000>;
693 };
633}; 694};
634 695
635&usb0 { 696&usb0 {
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index a95cc5358ff4..47f68ac868d4 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -489,6 +489,38 @@
489 fsl,pull-up = <MXS_PULL_DISABLE>; 489 fsl,pull-up = <MXS_PULL_DISABLE>;
490 }; 490 };
491 491
492 mmc1_4bit_pins_a: mmc1-4bit@0 {
493 reg = <0>;
494 fsl,pinmux-ids = <
495 MX28_PAD_GPMI_D00__SSP1_D0
496 MX28_PAD_GPMI_D01__SSP1_D1
497 MX28_PAD_GPMI_D02__SSP1_D2
498 MX28_PAD_GPMI_D03__SSP1_D3
499 MX28_PAD_GPMI_RDY1__SSP1_CMD
500 MX28_PAD_GPMI_RDY0__SSP1_CARD_DETECT
501 MX28_PAD_GPMI_WRN__SSP1_SCK
502 >;
503 fsl,drive-strength = <MXS_DRIVE_8mA>;
504 fsl,voltage = <MXS_VOLTAGE_HIGH>;
505 fsl,pull-up = <MXS_PULL_ENABLE>;
506 };
507
508 mmc1_cd_cfg: mmc1-cd-cfg {
509 fsl,pinmux-ids = <
510 MX28_PAD_GPMI_RDY0__SSP1_CARD_DETECT
511 >;
512 fsl,pull-up = <MXS_PULL_DISABLE>;
513 };
514
515 mmc1_sck_cfg: mmc1-sck-cfg {
516 fsl,pinmux-ids = <
517 MX28_PAD_GPMI_WRN__SSP1_SCK
518 >;
519 fsl,drive-strength = <MXS_DRIVE_12mA>;
520 fsl,pull-up = <MXS_PULL_DISABLE>;
521 };
522
523
492 mmc2_4bit_pins_a: mmc2-4bit@0 { 524 mmc2_4bit_pins_a: mmc2-4bit@0 {
493 reg = <0>; 525 reg = <0>;
494 fsl,pinmux-ids = < 526 fsl,pinmux-ids = <
@@ -553,6 +585,17 @@
553 fsl,pull-up = <MXS_PULL_ENABLE>; 585 fsl,pull-up = <MXS_PULL_ENABLE>;
554 }; 586 };
555 587
588 i2c1_pins_b: i2c1@1 {
589 reg = <1>;
590 fsl,pinmux-ids = <
591 MX28_PAD_AUART2_CTS__I2C1_SCL
592 MX28_PAD_AUART2_RTS__I2C1_SDA
593 >;
594 fsl,drive-strength = <MXS_DRIVE_8mA>;
595 fsl,voltage = <MXS_VOLTAGE_HIGH>;
596 fsl,pull-up = <MXS_PULL_ENABLE>;
597 };
598
556 saif0_pins_a: saif0@0 { 599 saif0_pins_a: saif0@0 {
557 reg = <0>; 600 reg = <0>;
558 fsl,pinmux-ids = < 601 fsl,pinmux-ids = <
diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
index 442e216ca9d9..6932928f3b45 100644
--- a/arch/arm/boot/dts/imx35.dtsi
+++ b/arch/arm/boot/dts/imx35.dtsi
@@ -114,6 +114,7 @@
114 }; 114 };
115 115
116 ssi1: ssi@43fa0000 { 116 ssi1: ssi@43fa0000 {
117 #sound-dai-cells = <0>;
117 compatible = "fsl,imx35-ssi", "fsl,imx21-ssi"; 118 compatible = "fsl,imx35-ssi", "fsl,imx21-ssi";
118 reg = <0x43fa0000 0x4000>; 119 reg = <0x43fa0000 0x4000>;
119 interrupts = <11>; 120 interrupts = <11>;
diff --git a/arch/arm/boot/dts/imx50.dtsi b/arch/arm/boot/dts/imx50.dtsi
index c0e0f60ab6b2..620b0f030591 100644
--- a/arch/arm/boot/dts/imx50.dtsi
+++ b/arch/arm/boot/dts/imx50.dtsi
@@ -145,6 +145,7 @@
145 }; 145 };
146 146
147 ssi2: ssi@50014000 { 147 ssi2: ssi@50014000 {
148 #sound-dai-cells = <0>;
148 compatible = "fsl,imx50-ssi", 149 compatible = "fsl,imx50-ssi",
149 "fsl,imx51-ssi", 150 "fsl,imx51-ssi",
150 "fsl,imx21-ssi"; 151 "fsl,imx21-ssi";
@@ -454,6 +455,7 @@
454 }; 455 };
455 456
456 ssi1: ssi@63fcc000 { 457 ssi1: ssi@63fcc000 {
458 #sound-dai-cells = <0>;
457 compatible = "fsl,imx50-ssi", "fsl,imx51-ssi", 459 compatible = "fsl,imx50-ssi", "fsl,imx51-ssi",
458 "fsl,imx21-ssi"; 460 "fsl,imx21-ssi";
459 reg = <0x63fcc000 0x4000>; 461 reg = <0x63fcc000 0x4000>;
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 17c05a6fa776..92660e1fe1fc 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -210,6 +210,7 @@
210 }; 210 };
211 211
212 ssi2: ssi@70014000 { 212 ssi2: ssi@70014000 {
213 #sound-dai-cells = <0>;
213 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 214 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
214 reg = <0x70014000 0x4000>; 215 reg = <0x70014000 0x4000>;
215 interrupts = <30>; 216 interrupts = <30>;
@@ -499,6 +500,7 @@
499 }; 500 };
500 501
501 ssi1: ssi@83fcc000 { 502 ssi1: ssi@83fcc000 {
503 #sound-dai-cells = <0>;
502 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 504 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
503 reg = <0x83fcc000 0x4000>; 505 reg = <0x83fcc000 0x4000>;
504 interrupts = <29>; 506 interrupts = <29>;
@@ -554,6 +556,7 @@
554 }; 556 };
555 557
556 ssi3: ssi@83fe8000 { 558 ssi3: ssi@83fe8000 {
559 #sound-dai-cells = <0>;
557 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 560 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
558 reg = <0x83fe8000 0x4000>; 561 reg = <0x83fe8000 0x4000>;
559 interrupts = <96>; 562 interrupts = <96>;
diff --git a/arch/arm/boot/dts/imx53-qsrb.dts b/arch/arm/boot/dts/imx53-qsrb.dts
index f1bbf9a32991..82d623d05915 100644
--- a/arch/arm/boot/dts/imx53-qsrb.dts
+++ b/arch/arm/boot/dts/imx53-qsrb.dts
@@ -28,6 +28,12 @@
28 MX53_PAD_CSI0_DAT9__I2C1_SCL 0x400001ec 28 MX53_PAD_CSI0_DAT9__I2C1_SCL 0x400001ec
29 >; 29 >;
30 }; 30 };
31
32 pinctrl_pmic: pmicgrp {
33 fsl,pins = <
34 MX53_PAD_CSI0_DAT5__GPIO5_23 0x1e4 /* IRQ */
35 >;
36 };
31 }; 37 };
32}; 38};
33 39
@@ -38,6 +44,8 @@
38 44
39 pmic: mc34708@8 { 45 pmic: mc34708@8 {
40 compatible = "fsl,mc34708"; 46 compatible = "fsl,mc34708";
47 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_pmic>;
41 reg = <0x08>; 49 reg = <0x08>;
42 interrupt-parent = <&gpio5>; 50 interrupt-parent = <&gpio5>;
43 interrupts = <23 0x8>; 51 interrupts = <23 0x8>;
diff --git a/arch/arm/boot/dts/imx53-smd.dts b/arch/arm/boot/dts/imx53-smd.dts
index 5ec1590ff7bc..1d325576bcc0 100644
--- a/arch/arm/boot/dts/imx53-smd.dts
+++ b/arch/arm/boot/dts/imx53-smd.dts
@@ -265,7 +265,7 @@
265 }; 265 };
266 266
267 pmic: dialog@48 { 267 pmic: dialog@48 {
268 compatible = "dialog,da9053", "dialog,da9052"; 268 compatible = "dlg,da9053", "dlg,da9052";
269 reg = <0x48>; 269 reg = <0x48>;
270 }; 270 };
271}; 271};
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 64fa27b36be0..f91725b2e8ab 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -221,6 +221,7 @@
221 }; 221 };
222 222
223 ssi2: ssi@50014000 { 223 ssi2: ssi@50014000 {
224 #sound-dai-cells = <0>;
224 compatible = "fsl,imx53-ssi", 225 compatible = "fsl,imx53-ssi",
225 "fsl,imx51-ssi", 226 "fsl,imx51-ssi",
226 "fsl,imx21-ssi"; 227 "fsl,imx21-ssi";
@@ -423,10 +424,14 @@
423 status = "disabled"; 424 status = "disabled";
424 425
425 lvds-channel@0 { 426 lvds-channel@0 {
427 #address-cells = <1>;
428 #size-cells = <0>;
426 reg = <0>; 429 reg = <0>;
427 status = "disabled"; 430 status = "disabled";
428 431
429 port { 432 port@0 {
433 reg = <0>;
434
430 lvds0_in: endpoint { 435 lvds0_in: endpoint {
431 remote-endpoint = <&ipu_di0_lvds0>; 436 remote-endpoint = <&ipu_di0_lvds0>;
432 }; 437 };
@@ -434,10 +439,14 @@
434 }; 439 };
435 440
436 lvds-channel@1 { 441 lvds-channel@1 {
442 #address-cells = <1>;
443 #size-cells = <0>;
437 reg = <1>; 444 reg = <1>;
438 status = "disabled"; 445 status = "disabled";
439 446
440 port { 447 port@1 {
448 reg = <1>;
449
441 lvds1_in: endpoint { 450 lvds1_in: endpoint {
442 remote-endpoint = <&ipu_di1_lvds1>; 451 remote-endpoint = <&ipu_di1_lvds1>;
443 }; 452 };
@@ -661,6 +670,7 @@
661 }; 670 };
662 671
663 ssi1: ssi@63fcc000 { 672 ssi1: ssi@63fcc000 {
673 #sound-dai-cells = <0>;
664 compatible = "fsl,imx53-ssi", "fsl,imx51-ssi", 674 compatible = "fsl,imx53-ssi", "fsl,imx51-ssi",
665 "fsl,imx21-ssi"; 675 "fsl,imx21-ssi";
666 reg = <0x63fcc000 0x4000>; 676 reg = <0x63fcc000 0x4000>;
@@ -688,6 +698,7 @@
688 }; 698 };
689 699
690 ssi3: ssi@63fe8000 { 700 ssi3: ssi@63fe8000 {
701 #sound-dai-cells = <0>;
691 compatible = "fsl,imx53-ssi", "fsl,imx51-ssi", 702 compatible = "fsl,imx53-ssi", "fsl,imx51-ssi",
692 "fsl,imx21-ssi"; 703 "fsl,imx21-ssi";
693 reg = <0x63fe8000 0x4000>; 704 reg = <0x63fe8000 0x4000>;
@@ -731,7 +742,7 @@
731 compatible = "fsl,imx53-vpu"; 742 compatible = "fsl,imx53-vpu";
732 reg = <0x63ff4000 0x1000>; 743 reg = <0x63ff4000 0x1000>;
733 interrupts = <9>; 744 interrupts = <9>;
734 clocks = <&clks IMX5_CLK_VPU_GATE>, 745 clocks = <&clks IMX5_CLK_VPU_REFERENCE_GATE>,
735 <&clks IMX5_CLK_VPU_GATE>; 746 <&clks IMX5_CLK_VPU_GATE>;
736 clock-names = "per", "ahb"; 747 clock-names = "per", "ahb";
737 resets = <&src 1>; 748 resets = <&src 1>;
@@ -744,5 +755,10 @@
744 reg = <0xf8000000 0x20000>; 755 reg = <0xf8000000 0x20000>;
745 clocks = <&clks IMX5_CLK_OCRAM>; 756 clocks = <&clks IMX5_CLK_OCRAM>;
746 }; 757 };
758
759 pmu {
760 compatible = "arm,cortex-a8-pmu";
761 interrupts = <77>;
762 };
747 }; 763 };
748}; 764};
diff --git a/arch/arm/boot/dts/imx6dl-gw552x.dts b/arch/arm/boot/dts/imx6dl-gw552x.dts
new file mode 100644
index 000000000000..a4b700cef188
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-gw552x.dts
@@ -0,0 +1,20 @@
1/*
2 * Copyright 2014 Gateworks Corporation
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/dts-v1/;
13
14#include "imx6dl.dtsi"
15#include "imx6qdl-gw552x.dtsi"
16
17/ {
18 model = "Gateworks Ventana i.MX6 DualLite/Solo GW552X";
19 compatible = "gw,imx6dl-gw552x", "gw,ventana", "fsl,imx6dl";
20};
diff --git a/arch/arm/boot/dts/imx6dl-hummingboard.dts b/arch/arm/boot/dts/imx6dl-hummingboard.dts
index c8e51dd41b8f..44a0e6736bb1 100644
--- a/arch/arm/boot/dts/imx6dl-hummingboard.dts
+++ b/arch/arm/boot/dts/imx6dl-hummingboard.dts
@@ -1,204 +1,13 @@
1/* 1/*
2 * Copyright (C) 2013,2014 Russell King 2 * Copyright (C) 2014 Rabeeh Khoury (rabeeh@solid-run.com)
3 * Based on dt work by Russell King
3 */ 4 */
4/dts-v1/; 5/dts-v1/;
5 6
6#include "imx6dl.dtsi" 7#include "imx6dl.dtsi"
7#include "imx6qdl-microsom.dtsi" 8#include "imx6qdl-hummingboard.dtsi"
8#include "imx6qdl-microsom-ar8035.dtsi"
9 9
10/ { 10/ {
11 model = "SolidRun HummingBoard DL/Solo"; 11 model = "SolidRun HummingBoard Solo/DualLite";
12 compatible = "solidrun,hummingboard", "fsl,imx6dl"; 12 compatible = "solidrun,hummingboard/dl", "fsl,imx6dl";
13
14 chosen {
15 stdout-path = &uart1;
16 };
17
18 ir_recv: ir-receiver {
19 compatible = "gpio-ir-receiver";
20 gpios = <&gpio1 2 1>;
21 pinctrl-names = "default";
22 pinctrl-0 = <&pinctrl_hummingboard_gpio1_2>;
23 };
24
25 regulators {
26 compatible = "simple-bus";
27
28 reg_3p3v: 3p3v {
29 compatible = "regulator-fixed";
30 regulator-name = "3P3V";
31 regulator-min-microvolt = <3300000>;
32 regulator-max-microvolt = <3300000>;
33 regulator-always-on;
34 };
35
36 reg_usbh1_vbus: usb-h1-vbus {
37 compatible = "regulator-fixed";
38 enable-active-high;
39 gpio = <&gpio1 0 0>;
40 pinctrl-names = "default";
41 pinctrl-0 = <&pinctrl_hummingboard_usbh1_vbus>;
42 regulator-name = "usb_h1_vbus";
43 regulator-min-microvolt = <5000000>;
44 regulator-max-microvolt = <5000000>;
45 };
46
47 reg_usbotg_vbus: usb-otg-vbus {
48 compatible = "regulator-fixed";
49 enable-active-high;
50 gpio = <&gpio3 22 0>;
51 pinctrl-names = "default";
52 pinctrl-0 = <&pinctrl_hummingboard_usbotg_vbus>;
53 regulator-name = "usb_otg_vbus";
54 regulator-min-microvolt = <5000000>;
55 regulator-max-microvolt = <5000000>;
56 };
57 };
58
59 sound-spdif {
60 compatible = "fsl,imx-audio-spdif";
61 model = "imx-spdif";
62 /* IMX6 doesn't implement this yet */
63 spdif-controller = <&spdif>;
64 spdif-out;
65 };
66};
67
68&can1 {
69 pinctrl-names = "default";
70 pinctrl-0 = <&pinctrl_hummingboard_flexcan1>;
71 status = "okay";
72};
73
74&hdmi {
75 pinctrl-names = "default";
76 pinctrl-0 = <&pinctrl_hummingboard_hdmi>;
77 ddc-i2c-bus = <&i2c2>;
78 status = "okay";
79};
80
81&i2c1 {
82 pinctrl-names = "default";
83 pinctrl-0 = <&pinctrl_hummingboard_i2c1>;
84
85 /*
86 * Not fitted on Carrier-1 board... yet
87 status = "okay";
88
89 rtc: pcf8523@68 {
90 compatible = "nxp,pcf8523";
91 reg = <0x68>;
92 };
93 */
94};
95
96&i2c2 {
97 clock-frequency = <100000>;
98 pinctrl-names = "default";
99 pinctrl-0 = <&pinctrl_hummingboard_i2c2>;
100 status = "okay";
101};
102
103&iomuxc {
104 hummingboard {
105 pinctrl_hummingboard_flexcan1: hummingboard-flexcan1 {
106 fsl,pins = <
107 MX6QDL_PAD_SD3_CLK__FLEXCAN1_RX 0x80000000
108 MX6QDL_PAD_SD3_CMD__FLEXCAN1_TX 0x80000000
109 >;
110 };
111
112 pinctrl_hummingboard_gpio1_2: hummingboard-gpio1_2 {
113 fsl,pins = <
114 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000
115 >;
116 };
117
118 pinctrl_hummingboard_hdmi: hummingboard-hdmi {
119 fsl,pins = <
120 MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x1f8b0
121 >;
122 };
123
124 pinctrl_hummingboard_i2c1: hummingboard-i2c1 {
125 fsl,pins = <
126 MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
127 MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
128 >;
129 };
130
131 pinctrl_hummingboard_i2c2: hummingboard-i2c2 {
132 fsl,pins = <
133 MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
134 MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
135 >;
136 };
137
138 pinctrl_hummingboard_spdif: hummingboard-spdif {
139 fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>;
140 };
141
142 pinctrl_hummingboard_usbh1_vbus: hummingboard-usbh1-vbus {
143 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>;
144 };
145
146 pinctrl_hummingboard_usbotg_id: hummingboard-usbotg-id {
147 /*
148 * Similar to pinctrl_usbotg_2, but we want it
149 * pulled down for a fixed host connection.
150 */
151 fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>;
152 };
153
154 pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus {
155 fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>;
156 };
157
158 pinctrl_hummingboard_usdhc2_aux: hummingboard-usdhc2-aux {
159 fsl,pins = <
160 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1f071
161 >;
162 };
163
164 pinctrl_hummingboard_usdhc2: hummingboard-usdhc2 {
165 fsl,pins = <
166 MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
167 MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
168 MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
169 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
170 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
171 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x13059
172 >;
173 };
174 };
175};
176
177&spdif {
178 pinctrl-names = "default";
179 pinctrl-0 = <&pinctrl_hummingboard_spdif>;
180 status = "okay";
181};
182
183&usbh1 {
184 vbus-supply = <&reg_usbh1_vbus>;
185 status = "okay";
186};
187
188&usbotg {
189 pinctrl-names = "default";
190 pinctrl-0 = <&pinctrl_hummingboard_usbotg_id>;
191 vbus-supply = <&reg_usbotg_vbus>;
192 status = "okay";
193};
194
195&usdhc2 {
196 pinctrl-names = "default";
197 pinctrl-0 = <
198 &pinctrl_hummingboard_usdhc2_aux
199 &pinctrl_hummingboard_usdhc2
200 >;
201 vmmc-supply = <&reg_3p3v>;
202 cd-gpios = <&gpio1 4 0>;
203 status = "okay";
204}; 13};
diff --git a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
index 8c1cb53464a0..4fa254347798 100644
--- a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
+++ b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
@@ -119,7 +119,7 @@
119 pinctrl-names = "default"; 119 pinctrl-names = "default";
120 pinctrl-0 = <&pinctrl_enet>; 120 pinctrl-0 = <&pinctrl_enet>;
121 phy-mode = "rgmii"; 121 phy-mode = "rgmii";
122 phy-reset-gpios = <&gpio3 23 0>; 122 phy-reset-gpios = <&gpio1 25 0>;
123 phy-supply = <&vgen2_1v2_eth>; 123 phy-supply = <&vgen2_1v2_eth>;
124 status = "okay"; 124 status = "okay";
125}; 125};
@@ -339,6 +339,7 @@
339 MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 339 MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
340 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 340 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
341 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 341 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
342 MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x1b0b0
342 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 343 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
343 >; 344 >;
344 }; 345 };
diff --git a/arch/arm/boot/dts/imx6q-gw5400-a.dts b/arch/arm/boot/dts/imx6q-gw5400-a.dts
index 22e6f8e657d2..822ffb231c57 100644
--- a/arch/arm/boot/dts/imx6q-gw5400-a.dts
+++ b/arch/arm/boot/dts/imx6q-gw5400-a.dts
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include <dt-bindings/gpio/gpio.h>
13#include "imx6q.dtsi" 14#include "imx6q.dtsi"
14 15
15/ { 16/ {
@@ -18,7 +19,6 @@
18 19
19 /* these are used by bootloader for disabling nodes */ 20 /* these are used by bootloader for disabling nodes */
20 aliases { 21 aliases {
21 ethernet0 = &fec;
22 ethernet1 = &eth1; 22 ethernet1 = &eth1;
23 i2c0 = &i2c1; 23 i2c0 = &i2c1;
24 i2c1 = &i2c2; 24 i2c1 = &i2c2;
@@ -26,12 +26,10 @@
26 led0 = &led0; 26 led0 = &led0;
27 led1 = &led1; 27 led1 = &led1;
28 led2 = &led2; 28 led2 = &led2;
29 sky2 = &eth1;
30 ssi0 = &ssi1; 29 ssi0 = &ssi1;
31 spi0 = &ecspi1; 30 spi0 = &ecspi1;
32 usb0 = &usbh1; 31 usb0 = &usbh1;
33 usb1 = &usbotg; 32 usb1 = &usbotg;
34 usdhc2 = &usdhc3;
35 }; 33 };
36 34
37 chosen { 35 chosen {
@@ -40,23 +38,25 @@
40 38
41 leds { 39 leds {
42 compatible = "gpio-leds"; 40 compatible = "gpio-leds";
41 pinctrl-names = "default";
42 pinctrl-0 = <&pinctrl_gpio_leds>;
43 43
44 led0: user1 { 44 led0: user1 {
45 label = "user1"; 45 label = "user1";
46 gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */ 46 gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* 102 -> MX6_PANLEDG */
47 default-state = "on"; 47 default-state = "on";
48 linux,default-trigger = "heartbeat"; 48 linux,default-trigger = "heartbeat";
49 }; 49 };
50 50
51 led1: user2 { 51 led1: user2 {
52 label = "user2"; 52 label = "user2";
53 gpios = <&gpio4 10 0>; /* 106 -> MX6_PANLEDR */ 53 gpios = <&gpio4 10 GPIO_ACTIVE_HIGH>; /* 106 -> MX6_PANLEDR */
54 default-state = "off"; 54 default-state = "off";
55 }; 55 };
56 56
57 led2: user3 { 57 led2: user3 {
58 label = "user3"; 58 label = "user3";
59 gpios = <&gpio4 15 1>; /* 111 -> MX6_LOCLED# */ 59 gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* 111 -> MX6_LOCLED# */
60 default-state = "off"; 60 default-state = "off";
61 }; 61 };
62 }; 62 };
@@ -67,7 +67,9 @@
67 67
68 pps { 68 pps {
69 compatible = "pps-gpio"; 69 compatible = "pps-gpio";
70 gpios = <&gpio1 5 0>; 70 pinctrl-names = "default";
71 pinctrl-0 = <&pinctrl_gpio_leds>;
72 gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
71 status = "okay"; 73 status = "okay";
72 }; 74 };
73 75
@@ -109,7 +111,7 @@
109 regulator-name = "usb_otg_vbus"; 111 regulator-name = "usb_otg_vbus";
110 regulator-min-microvolt = <5000000>; 112 regulator-min-microvolt = <5000000>;
111 regulator-max-microvolt = <5000000>; 113 regulator-max-microvolt = <5000000>;
112 gpio = <&gpio3 22 0>; 114 gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
113 enable-active-high; 115 enable-active-high;
114 }; 116 };
115 }; 117 };
@@ -137,7 +139,7 @@
137 139
138&ecspi1 { 140&ecspi1 {
139 fsl,spi-num-chipselects = <1>; 141 fsl,spi-num-chipselects = <1>;
140 cs-gpios = <&gpio3 19 0>; 142 cs-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
141 pinctrl-names = "default"; 143 pinctrl-names = "default";
142 pinctrl-0 = <&pinctrl_ecspi1>; 144 pinctrl-0 = <&pinctrl_ecspi1>;
143 status = "okay"; 145 status = "okay";
@@ -153,7 +155,7 @@
153 pinctrl-names = "default"; 155 pinctrl-names = "default";
154 pinctrl-0 = <&pinctrl_enet>; 156 pinctrl-0 = <&pinctrl_enet>;
155 phy-mode = "rgmii"; 157 phy-mode = "rgmii";
156 phy-reset-gpios = <&gpio1 30 0>; 158 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
157 status = "okay"; 159 status = "okay";
158}; 160};
159 161
@@ -199,11 +201,6 @@
199 #gpio-cells = <2>; 201 #gpio-cells = <2>;
200 }; 202 };
201 203
202 hwmon: gsc@29 {
203 compatible = "gw,gsp";
204 reg = <0x29>;
205 };
206
207 rtc: ds1672@68 { 204 rtc: ds1672@68 {
208 compatible = "dallas,ds1672"; 205 compatible = "dallas,ds1672";
209 reg = <0x68>; 206 reg = <0x68>;
@@ -314,16 +311,6 @@
314 }; 311 };
315 }; 312 };
316 }; 313 };
317
318 pciswitch: pex8609@3f {
319 compatible = "plx,pex8609";
320 reg = <0x3f>;
321 };
322
323 pciclkgen: si52147@6b {
324 compatible = "sil,si52147";
325 reg = <0x6b>;
326 };
327}; 314};
328 315
329&i2c3 { 316&i2c3 {
@@ -345,51 +332,73 @@
345 VDDIO-supply = <&reg_3p3v>; 332 VDDIO-supply = <&reg_3p3v>;
346 }; 333 };
347 334
348 hdmiin: adv7611@4c {
349 compatible = "adi,adv7611";
350 reg = <0x4c>;
351 };
352
353 touchscreen: egalax_ts@04 { 335 touchscreen: egalax_ts@04 {
354 compatible = "eeti,egalax_ts"; 336 compatible = "eeti,egalax_ts";
355 reg = <0x04>; 337 reg = <0x04>;
356 interrupt-parent = <&gpio7>; 338 interrupt-parent = <&gpio7>;
357 interrupts = <12 2>; /* gpio7_12 active low */ 339 interrupts = <12 2>;
358 wakeup-gpios = <&gpio7 12 0>; 340 wakeup-gpios = <&gpio7 12 GPIO_ACTIVE_LOW>;
359 }; 341 };
342};
360 343
361 videoout: adv7393@2a { 344&ldb {
362 compatible = "adi,adv7393"; 345 status = "okay";
363 reg = <0x2a>; 346};
364 }; 347
348&pcie {
349 reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
350 status = "okay";
365 351
366 videoin: adv7180@20 { 352 eth1: sky2@8 { /* MAC/PHY on bus 8 */
367 compatible = "adi,adv7180"; 353 compatible = "marvell,sky2";
368 reg = <0x20>;
369 }; 354 };
370}; 355};
371 356
372&iomuxc { 357&ssi1 {
358 status = "okay";
359};
360
361&uart1 {
362 pinctrl-names = "default";
363 pinctrl-0 = <&pinctrl_uart1>;
364 status = "okay";
365};
366
367&uart2 {
368 pinctrl-names = "default";
369 pinctrl-0 = <&pinctrl_uart2>;
370 status = "okay";
371};
372
373&uart5 {
374 pinctrl-names = "default";
375 pinctrl-0 = <&pinctrl_uart5>;
376 status = "okay";
377};
378
379&usbotg {
380 vbus-supply = <&reg_usb_otg_vbus>;
381 pinctrl-names = "default";
382 pinctrl-0 = <&pinctrl_usbotg>;
383 disable-over-current;
384 status = "okay";
385};
386
387&usbh1 {
388 vbus-supply = <&reg_usb_h1_vbus>;
389 status = "okay";
390};
391
392&usdhc3 {
373 pinctrl-names = "default"; 393 pinctrl-names = "default";
374 pinctrl-0 = <&pinctrl_hog>; 394 pinctrl-0 = <&pinctrl_usdhc3>;
395 cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
396 vmmc-supply = <&reg_3p3v>;
397 status = "okay";
398};
375 399
400&iomuxc {
376 imx6q-gw5400-a { 401 imx6q-gw5400-a {
377 pinctrl_hog: hoggrp {
378 fsl,pins = <
379 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 /* OTG_PWR_EN */
380 MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x80000000 /* SPINOR_CS0# */
381 MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x80000000 /* PCIE IRQ */
382 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* PCIE RST */
383 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x000130b0 /* AUD4_MCK */
384 MX6QDL_PAD_GPIO_5__GPIO1_IO05 0x80000000 /* GPS_PPS */
385 MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 /* TOUCH_IRQ# */
386 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x80000000 /* user1 led */
387 MX6QDL_PAD_KEY_COL2__GPIO4_IO10 0x80000000 /* user2 led */
388 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x80000000 /* user3 led */
389 MX6QDL_PAD_SD1_DAT0__GPIO1_IO16 0x80000000 /* USBHUB_RST# */
390 MX6QDL_PAD_SD1_DAT3__GPIO1_IO21 0x80000000 /* MIPI_DIO */
391 >;
392 };
393 402
394 pinctrl_audmux: audmuxgrp { 403 pinctrl_audmux: audmuxgrp {
395 fsl,pins = < 404 fsl,pins = <
@@ -397,6 +406,7 @@
397 MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0 406 MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0
398 MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0 407 MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0
399 MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0 408 MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0
409 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* AUD4_MCK */
400 >; 410 >;
401 }; 411 };
402 412
@@ -405,6 +415,7 @@
405 MX6QDL_PAD_EIM_D17__ECSPI1_MISO 0x100b1 415 MX6QDL_PAD_EIM_D17__ECSPI1_MISO 0x100b1
406 MX6QDL_PAD_EIM_D18__ECSPI1_MOSI 0x100b1 416 MX6QDL_PAD_EIM_D18__ECSPI1_MOSI 0x100b1
407 MX6QDL_PAD_EIM_D16__ECSPI1_SCLK 0x100b1 417 MX6QDL_PAD_EIM_D16__ECSPI1_SCLK 0x100b1
418 MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x1b0b0 /* SPINOR_CS0# */
408 >; 419 >;
409 }; 420 };
410 421
@@ -429,6 +440,14 @@
429 >; 440 >;
430 }; 441 };
431 442
443 pinctrl_gpio_leds: gpioledsgrp {
444 fsl,pins = <
445 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x1b0b0 /* user1 led */
446 MX6QDL_PAD_KEY_COL2__GPIO4_IO10 0x1b0b0 /* user2 led */
447 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x1b0b0 /* user3 led */
448 >;
449 };
450
432 pinctrl_i2c1: i2c1grp { 451 pinctrl_i2c1: i2c1grp {
433 fsl,pins = < 452 fsl,pins = <
434 MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1 453 MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
@@ -450,6 +469,19 @@
450 >; 469 >;
451 }; 470 };
452 471
472 pinctrl_pcie: pciegrp {
473 fsl,pins = <
474 MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x1b0b0 /* PCIE IRQ */
475 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x1b0b0 /* PCIE RST */
476 >;
477 };
478
479 pinctrl_pps: ppsgrp {
480 fsl,pins = <
481 MX6QDL_PAD_GPIO_5__GPIO1_IO05 0x1b0b0 /* GPS_PPS */
482 >;
483 };
484
453 pinctrl_uart1: uart1grp { 485 pinctrl_uart1: uart1grp {
454 fsl,pins = < 486 fsl,pins = <
455 MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1 487 MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1
@@ -474,6 +506,7 @@
474 pinctrl_usbotg: usbotggrp { 506 pinctrl_usbotg: usbotggrp {
475 fsl,pins = < 507 fsl,pins = <
476 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059 508 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
509 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0 /* OTG_PWR_EN */
477 >; 510 >;
478 }; 511 };
479 512
@@ -489,59 +522,3 @@
489 }; 522 };
490 }; 523 };
491}; 524};
492
493&ldb {
494 status = "okay";
495};
496
497&pcie {
498 reset-gpio = <&gpio1 29 0>;
499 status = "okay";
500
501 eth1: sky2@8 { /* MAC/PHY on bus 8 */
502 compatible = "marvell,sky2";
503 };
504};
505
506&ssi1 {
507 status = "okay";
508};
509
510&uart1 {
511 pinctrl-names = "default";
512 pinctrl-0 = <&pinctrl_uart1>;
513 status = "okay";
514};
515
516&uart2 {
517 pinctrl-names = "default";
518 pinctrl-0 = <&pinctrl_uart2>;
519 status = "okay";
520};
521
522&uart5 {
523 pinctrl-names = "default";
524 pinctrl-0 = <&pinctrl_uart5>;
525 status = "okay";
526};
527
528&usbotg {
529 vbus-supply = <&reg_usb_otg_vbus>;
530 pinctrl-names = "default";
531 pinctrl-0 = <&pinctrl_usbotg>;
532 disable-over-current;
533 status = "okay";
534};
535
536&usbh1 {
537 vbus-supply = <&reg_usb_h1_vbus>;
538 status = "okay";
539};
540
541&usdhc3 {
542 pinctrl-names = "default";
543 pinctrl-0 = <&pinctrl_usdhc3>;
544 cd-gpios = <&gpio7 0 0>;
545 vmmc-supply = <&reg_3p3v>;
546 status = "okay";
547};
diff --git a/arch/arm/boot/dts/imx6q-gw552x.dts b/arch/arm/boot/dts/imx6q-gw552x.dts
new file mode 100644
index 000000000000..f87a8fa6e04d
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-gw552x.dts
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2014 Gateworks Corporation
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/dts-v1/;
13
14#include "imx6q.dtsi"
15#include "imx6qdl-gw552x.dtsi"
16
17/ {
18 model = "Gateworks Ventana i.MX6 Dual/Quad GW552X";
19 compatible = "gw,imx6q-gw552x", "gw,ventana", "fsl,imx6q";
20};
21
22&sata {
23 status = "okay";
24};
diff --git a/arch/arm/boot/dts/imx6q-hummingboard.dts b/arch/arm/boot/dts/imx6q-hummingboard.dts
new file mode 100644
index 000000000000..c2bf8476ce45
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-hummingboard.dts
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2014 Rabeeh Khoury (rabeeh@solid-run.com)
3 * Based on dt work by Russell King
4 */
5/dts-v1/;
6
7#include "imx6q.dtsi"
8#include "imx6qdl-hummingboard.dtsi"
9
10/ {
11 model = "SolidRun HummingBoard Dual/Quad";
12 compatible = "solidrun,hummingboard/q", "fsl,imx6q";
13};
14
15&sata {
16 status = "okay";
17 fsl,transmit-level-mV = <1025>;
18 fsl,transmit-boost-mdB = <3330>;
19 fsl,transmit-atten-16ths = <9>;
20 fsl,receive-eq-mdB = <3000>;
21};
diff --git a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
index e8e781656b3f..6a524ca011e7 100644
--- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
@@ -61,7 +61,7 @@
61 61
62 sound-spdif { 62 sound-spdif {
63 compatible = "fsl,imx-audio-spdif"; 63 compatible = "fsl,imx-audio-spdif";
64 model = "imx-spdif"; 64 model = "Integrated SPDIF";
65 /* IMX6 doesn't implement this yet */ 65 /* IMX6 doesn't implement this yet */
66 spdif-controller = <&spdif>; 66 spdif-controller = <&spdif>;
67 spdif-out; 67 spdif-out;
@@ -130,16 +130,23 @@
130 fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; 130 fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>;
131 }; 131 };
132 132
133 pinctrl_cubox_i_usbh1: cubox-i-usbh1 {
134 fsl,pins = <MX6QDL_PAD_GPIO_3__USB_H1_OC 0x1b0b0>;
135 };
136
133 pinctrl_cubox_i_usbh1_vbus: cubox-i-usbh1-vbus { 137 pinctrl_cubox_i_usbh1_vbus: cubox-i-usbh1-vbus {
134 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; 138 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>;
135 }; 139 };
136 140
137 pinctrl_cubox_i_usbotg_id: cubox-i-usbotg-id { 141 pinctrl_cubox_i_usbotg: cubox-i-usbotg {
138 /* 142 /*
139 * The Cubox-i pulls this low, but as it's pointless 143 * The Cubox-i pulls ID low, but as it's pointless
140 * leaving it as a pull-up, even if it is just 10uA. 144 * leaving it as a pull-up, even if it is just 10uA.
141 */ 145 */
142 fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; 146 fsl,pins = <
147 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059
148 MX6QDL_PAD_KEY_COL4__USB_OTG_OC 0x1b0b0
149 >;
143 }; 150 };
144 151
145 pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { 152 pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus {
@@ -173,13 +180,15 @@
173}; 180};
174 181
175&usbh1 { 182&usbh1 {
183 pinctrl-names = "default";
184 pinctrl-0 = <&pinctrl_cubox_i_usbh1>;
176 vbus-supply = <&reg_usbh1_vbus>; 185 vbus-supply = <&reg_usbh1_vbus>;
177 status = "okay"; 186 status = "okay";
178}; 187};
179 188
180&usbotg { 189&usbotg {
181 pinctrl-names = "default"; 190 pinctrl-names = "default";
182 pinctrl-0 = <&pinctrl_cubox_i_usbotg_id>; 191 pinctrl-0 = <&pinctrl_cubox_i_usbotg>;
183 vbus-supply = <&reg_usbotg_vbus>; 192 vbus-supply = <&reg_usbotg_vbus>;
184 status = "okay"; 193 status = "okay";
185}; 194};
diff --git a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
index 0db15af41cb1..f2867c4b34a8 100644
--- a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
@@ -9,11 +9,11 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12#include <dt-bindings/gpio/gpio.h>
13
12/ { 14/ {
13 /* these are used by bootloader for disabling nodes */ 15 /* these are used by bootloader for disabling nodes */
14 aliases { 16 aliases {
15 can0 = &can1;
16 ethernet0 = &fec;
17 led0 = &led0; 17 led0 = &led0;
18 led1 = &led1; 18 led1 = &led1;
19 nand = &gpmi; 19 nand = &gpmi;
@@ -27,17 +27,19 @@
27 27
28 leds { 28 leds {
29 compatible = "gpio-leds"; 29 compatible = "gpio-leds";
30 pinctrl-names = "default";
31 pinctrl-0 = <&pinctrl_gpio_leds>;
30 32
31 led0: user1 { 33 led0: user1 {
32 label = "user1"; 34 label = "user1";
33 gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */ 35 gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
34 default-state = "on"; 36 default-state = "on";
35 linux,default-trigger = "heartbeat"; 37 linux,default-trigger = "heartbeat";
36 }; 38 };
37 39
38 led1: user2 { 40 led1: user2 {
39 label = "user2"; 41 label = "user2";
40 gpios = <&gpio4 7 0>; /* 103 -> MX6_PANLEDR */ 42 gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
41 default-state = "off"; 43 default-state = "off";
42 }; 44 };
43 }; 45 };
@@ -48,7 +50,9 @@
48 50
49 pps { 51 pps {
50 compatible = "pps-gpio"; 52 compatible = "pps-gpio";
51 gpios = <&gpio1 26 0>; 53 pinctrl-names = "default";
54 pinctrl-0 = <&pinctrl_pps>;
55 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
52 status = "okay"; 56 status = "okay";
53 }; 57 };
54 58
@@ -81,7 +85,7 @@
81 regulator-name = "usb_otg_vbus"; 85 regulator-name = "usb_otg_vbus";
82 regulator-min-microvolt = <5000000>; 86 regulator-min-microvolt = <5000000>;
83 regulator-max-microvolt = <5000000>; 87 regulator-max-microvolt = <5000000>;
84 gpio = <&gpio3 22 0>; 88 gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
85 enable-active-high; 89 enable-active-high;
86 }; 90 };
87 }; 91 };
@@ -91,7 +95,7 @@
91 pinctrl-names = "default"; 95 pinctrl-names = "default";
92 pinctrl-0 = <&pinctrl_enet>; 96 pinctrl-0 = <&pinctrl_enet>;
93 phy-mode = "rgmii"; 97 phy-mode = "rgmii";
94 phy-reset-gpios = <&gpio1 30 0>; 98 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
95 status = "okay"; 99 status = "okay";
96}; 100};
97 101
@@ -143,11 +147,6 @@
143 #gpio-cells = <2>; 147 #gpio-cells = <2>;
144 }; 148 };
145 149
146 hwmon: gsc@29 {
147 compatible = "gw,gsp";
148 reg = <0x29>;
149 };
150
151 rtc: ds1672@68 { 150 rtc: ds1672@68 {
152 compatible = "dallas,ds1672"; 151 compatible = "dallas,ds1672";
153 reg = <0x68>; 152 reg = <0x68>;
@@ -159,53 +158,6 @@
159 pinctrl-names = "default"; 158 pinctrl-names = "default";
160 pinctrl-0 = <&pinctrl_i2c2>; 159 pinctrl-0 = <&pinctrl_i2c2>;
161 status = "okay"; 160 status = "okay";
162
163 pmic: ltc3676@3c {
164 compatible = "lltc,ltc3676";
165 reg = <0x3c>;
166
167 regulators {
168 sw1_reg: ltc3676__sw1 {
169 regulator-min-microvolt = <1175000>;
170 regulator-max-microvolt = <1175000>;
171 regulator-boot-on;
172 regulator-always-on;
173 };
174
175 sw2_reg: ltc3676__sw2 {
176 regulator-min-microvolt = <1800000>;
177 regulator-max-microvolt = <1800000>;
178 regulator-boot-on;
179 regulator-always-on;
180 };
181
182 sw3_reg: ltc3676__sw3 {
183 regulator-min-microvolt = <1175000>;
184 regulator-max-microvolt = <1175000>;
185 regulator-boot-on;
186 regulator-always-on;
187 };
188
189 sw4_reg: ltc3676__sw4 {
190 regulator-min-microvolt = <1500000>;
191 regulator-max-microvolt = <1500000>;
192 regulator-boot-on;
193 regulator-always-on;
194 };
195
196 ldo2_reg: ltc3676__ldo2 {
197 regulator-min-microvolt = <2500000>;
198 regulator-max-microvolt = <2500000>;
199 regulator-boot-on;
200 regulator-always-on;
201 };
202
203 ldo4_reg: ltc3676__ldo4 {
204 regulator-min-microvolt = <3000000>;
205 regulator-max-microvolt = <3000000>;
206 };
207 };
208 };
209}; 161};
210 162
211&i2c3 { 163&i2c3 {
@@ -213,31 +165,53 @@
213 pinctrl-names = "default"; 165 pinctrl-names = "default";
214 pinctrl-0 = <&pinctrl_i2c3>; 166 pinctrl-0 = <&pinctrl_i2c3>;
215 status = "okay"; 167 status = "okay";
168};
216 169
217 videoin: adv7180@20 { 170&pcie {
218 compatible = "adi,adv7180"; 171 pinctrl-names = "default";
219 reg = <0x20>; 172 pinctrl-0 = <&pinctrl_pcie>;
220 }; 173 reset-gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
174 status = "okay";
221}; 175};
222 176
223&iomuxc { 177&uart1 {
224 pinctrl-names = "default"; 178 pinctrl-names = "default";
225 pinctrl-0 = <&pinctrl_hog>; 179 pinctrl-0 = <&pinctrl_uart1>;
180 status = "okay";
181};
226 182
227 imx6qdl-gw51xx { 183&uart2 {
228 pinctrl_hog: hoggrp { 184 pinctrl-names = "default";
229 fsl,pins = < 185 pinctrl-0 = <&pinctrl_uart2>;
230 MX6QDL_PAD_EIM_A19__GPIO2_IO19 0x80000000 /* MEZZ_DIO0 */ 186 status = "okay";
231 MX6QDL_PAD_EIM_A20__GPIO2_IO18 0x80000000 /* MEZZ_DIO1 */ 187};
232 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 /* OTG_PWR_EN */
233 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* GPS_PPS */
234 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* PHY Reset */
235 MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x80000000 /* PCIE_RST# */
236 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x80000000 /* user1 led */
237 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x80000000 /* user2 led */
238 >;
239 };
240 188
189&uart3 {
190 pinctrl-names = "default";
191 pinctrl-0 = <&pinctrl_uart3>;
192 status = "okay";
193};
194
195&uart5 {
196 pinctrl-names = "default";
197 pinctrl-0 = <&pinctrl_uart5>;
198 status = "okay";
199};
200
201&usbotg {
202 vbus-supply = <&reg_usb_otg_vbus>;
203 pinctrl-names = "default";
204 pinctrl-0 = <&pinctrl_usbotg>;
205 disable-over-current;
206 status = "okay";
207};
208
209&usbh1 {
210 status = "okay";
211};
212
213&iomuxc {
214 imx6qdl-gw51xx {
241 pinctrl_enet: enetgrp { 215 pinctrl_enet: enetgrp {
242 fsl,pins = < 216 fsl,pins = <
243 MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0 217 MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
@@ -256,6 +230,14 @@
256 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 230 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
257 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 231 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
258 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 232 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
233 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x1b0b0 /* PHY Reset */
234 >;
235 };
236
237 pinctrl_gpio_leds: gpioledsgrp {
238 fsl,pins = <
239 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x1b0b0
240 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x1b0b0
259 >; 241 >;
260 }; 242 };
261 243
@@ -301,6 +283,18 @@
301 >; 283 >;
302 }; 284 };
303 285
286 pinctrl_pcie: pciegrp {
287 fsl,pins = <
288 MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0
289 >;
290 };
291
292 pinctrl_pps: ppsgrp {
293 fsl,pins = <
294 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x1b0b1
295 >;
296 };
297
304 pinctrl_uart1: uart1grp { 298 pinctrl_uart1: uart1grp {
305 fsl,pins = < 299 fsl,pins = <
306 MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1 300 MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1
@@ -332,48 +326,8 @@
332 pinctrl_usbotg: usbotggrp { 326 pinctrl_usbotg: usbotggrp {
333 fsl,pins = < 327 fsl,pins = <
334 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059 328 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
329 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0 /* OTG_PWR_EN */
335 >; 330 >;
336 }; 331 };
337 }; 332 };
338}; 333};
339
340&pcie {
341 reset-gpio = <&gpio1 0 0>;
342 status = "okay";
343};
344
345&uart1 {
346 pinctrl-names = "default";
347 pinctrl-0 = <&pinctrl_uart1>;
348 status = "okay";
349};
350
351&uart2 {
352 pinctrl-names = "default";
353 pinctrl-0 = <&pinctrl_uart2>;
354 status = "okay";
355};
356
357&uart3 {
358 pinctrl-names = "default";
359 pinctrl-0 = <&pinctrl_uart3>;
360 status = "okay";
361};
362
363&uart5 {
364 pinctrl-names = "default";
365 pinctrl-0 = <&pinctrl_uart5>;
366 status = "okay";
367};
368
369&usbotg {
370 vbus-supply = <&reg_usb_otg_vbus>;
371 pinctrl-names = "default";
372 pinctrl-0 = <&pinctrl_usbotg>;
373 disable-over-current;
374 status = "okay";
375};
376
377&usbh1 {
378 status = "okay";
379};
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
index 234e7b755232..d3c0bf5c84e3 100644
--- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
@@ -9,10 +9,11 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12#include <dt-bindings/gpio/gpio.h>
13
12/ { 14/ {
13 /* these are used by bootloader for disabling nodes */ 15 /* these are used by bootloader for disabling nodes */
14 aliases { 16 aliases {
15 ethernet0 = &fec;
16 led0 = &led0; 17 led0 = &led0;
17 led1 = &led1; 18 led1 = &led1;
18 led2 = &led2; 19 led2 = &led2;
@@ -20,7 +21,6 @@
20 ssi0 = &ssi1; 21 ssi0 = &ssi1;
21 usb0 = &usbh1; 22 usb0 = &usbh1;
22 usb1 = &usbotg; 23 usb1 = &usbotg;
23 usdhc2 = &usdhc3;
24 }; 24 };
25 25
26 chosen { 26 chosen {
@@ -36,23 +36,25 @@
36 36
37 leds { 37 leds {
38 compatible = "gpio-leds"; 38 compatible = "gpio-leds";
39 pinctrl-names = "default";
40 pinctrl-0 = <&pinctrl_gpio_leds>;
39 41
40 led0: user1 { 42 led0: user1 {
41 label = "user1"; 43 label = "user1";
42 gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */ 44 gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
43 default-state = "on"; 45 default-state = "on";
44 linux,default-trigger = "heartbeat"; 46 linux,default-trigger = "heartbeat";
45 }; 47 };
46 48
47 led1: user2 { 49 led1: user2 {
48 label = "user2"; 50 label = "user2";
49 gpios = <&gpio4 7 0>; /* 103 -> MX6_PANLEDR */ 51 gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
50 default-state = "off"; 52 default-state = "off";
51 }; 53 };
52 54
53 led2: user3 { 55 led2: user3 {
54 label = "user3"; 56 label = "user3";
55 gpios = <&gpio4 15 1>; /* 111 - MX6_LOCLED# */ 57 gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
56 default-state = "off"; 58 default-state = "off";
57 }; 59 };
58 }; 60 };
@@ -63,7 +65,9 @@
63 65
64 pps { 66 pps {
65 compatible = "pps-gpio"; 67 compatible = "pps-gpio";
66 gpios = <&gpio1 26 0>; 68 pinctrl-names = "default";
69 pinctrl-0 = <&pinctrl_pps>;
70 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
67 status = "okay"; 71 status = "okay";
68 }; 72 };
69 73
@@ -115,7 +119,7 @@
115 regulator-name = "usb_otg_vbus"; 119 regulator-name = "usb_otg_vbus";
116 regulator-min-microvolt = <5000000>; 120 regulator-min-microvolt = <5000000>;
117 regulator-max-microvolt = <5000000>; 121 regulator-max-microvolt = <5000000>;
118 gpio = <&gpio3 22 0>; 122 gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
119 enable-active-high; 123 enable-active-high;
120 }; 124 };
121 }; 125 };
@@ -141,11 +145,17 @@
141 status = "okay"; 145 status = "okay";
142}; 146};
143 147
148&can1 {
149 pinctrl-names = "default";
150 pinctrl-0 = <&pinctrl_flexcan1>;
151 status = "okay";
152};
153
144&fec { 154&fec {
145 pinctrl-names = "default"; 155 pinctrl-names = "default";
146 pinctrl-0 = <&pinctrl_enet>; 156 pinctrl-0 = <&pinctrl_enet>;
147 phy-mode = "rgmii"; 157 phy-mode = "rgmii";
148 phy-reset-gpios = <&gpio1 30 0>; 158 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
149 status = "okay"; 159 status = "okay";
150}; 160};
151 161
@@ -197,11 +207,6 @@
197 #gpio-cells = <2>; 207 #gpio-cells = <2>;
198 }; 208 };
199 209
200 hwmon: gsc@29 {
201 compatible = "gw,gsp";
202 reg = <0x29>;
203 };
204
205 rtc: ds1672@68 { 210 rtc: ds1672@68 {
206 compatible = "dallas,ds1672"; 211 compatible = "dallas,ds1672";
207 reg = <0x68>; 212 reg = <0x68>;
@@ -213,65 +218,6 @@
213 pinctrl-names = "default"; 218 pinctrl-names = "default";
214 pinctrl-0 = <&pinctrl_i2c2>; 219 pinctrl-0 = <&pinctrl_i2c2>;
215 status = "okay"; 220 status = "okay";
216
217 pciswitch: pex8609@3f {
218 compatible = "plx,pex8609";
219 reg = <0x3f>;
220 };
221
222 pmic: ltc3676@3c {
223 compatible = "lltc,ltc3676";
224 reg = <0x3c>;
225
226 regulators {
227 sw1_reg: ltc3676__sw1 {
228 regulator-min-microvolt = <1175000>;
229 regulator-max-microvolt = <1175000>;
230 regulator-boot-on;
231 regulator-always-on;
232 };
233
234 sw2_reg: ltc3676__sw2 {
235 regulator-min-microvolt = <1800000>;
236 regulator-max-microvolt = <1800000>;
237 regulator-boot-on;
238 regulator-always-on;
239 };
240
241 sw3_reg: ltc3676__sw3 {
242 regulator-min-microvolt = <1175000>;
243 regulator-max-microvolt = <1175000>;
244 regulator-boot-on;
245 regulator-always-on;
246 };
247
248 sw4_reg: ltc3676__sw4 {
249 regulator-min-microvolt = <1500000>;
250 regulator-max-microvolt = <1500000>;
251 regulator-boot-on;
252 regulator-always-on;
253 };
254
255 ldo2_reg: ltc3676__ldo2 {
256 regulator-min-microvolt = <2500000>;
257 regulator-max-microvolt = <2500000>;
258 regulator-boot-on;
259 regulator-always-on;
260 };
261
262 ldo3_reg: ltc3676__ldo3 {
263 regulator-min-microvolt = <1800000>;
264 regulator-max-microvolt = <1800000>;
265 regulator-boot-on;
266 regulator-always-on;
267 };
268
269 ldo4_reg: ltc3676__ldo4 {
270 regulator-min-microvolt = <3000000>;
271 regulator-max-microvolt = <3000000>;
272 };
273 };
274 };
275}; 221};
276 222
277&i2c3 { 223&i2c3 {
@@ -280,11 +226,6 @@
280 pinctrl-0 = <&pinctrl_i2c3>; 226 pinctrl-0 = <&pinctrl_i2c3>;
281 status = "okay"; 227 status = "okay";
282 228
283 accelerometer: fxos8700@1e {
284 compatible = "fsl,fxos8700";
285 reg = <0x13>;
286 };
287
288 codec: sgtl5000@0a { 229 codec: sgtl5000@0a {
289 compatible = "fsl,sgtl5000"; 230 compatible = "fsl,sgtl5000";
290 reg = <0x0a>; 231 reg = <0x0a>;
@@ -297,49 +238,101 @@
297 compatible = "eeti,egalax_ts"; 238 compatible = "eeti,egalax_ts";
298 reg = <0x04>; 239 reg = <0x04>;
299 interrupt-parent = <&gpio7>; 240 interrupt-parent = <&gpio7>;
300 interrupts = <12 2>; /* gpio7_12 active low */ 241 interrupts = <12 2>;
301 wakeup-gpios = <&gpio7 12 0>; 242 wakeup-gpios = <&gpio7 12 GPIO_ACTIVE_LOW>;
302 }; 243 };
244};
245
246&ldb {
247 status = "okay";
303 248
304 videoin: adv7180@20 { 249 lvds-channel@0 {
305 compatible = "adi,adv7180"; 250 fsl,data-mapping = "spwg";
306 reg = <0x20>; 251 fsl,data-width = <18>;
252 status = "okay";
253
254 display-timings {
255 native-mode = <&timing0>;
256 timing0: hsd100pxn1 {
257 clock-frequency = <65000000>;
258 hactive = <1024>;
259 vactive = <768>;
260 hback-porch = <220>;
261 hfront-porch = <40>;
262 vback-porch = <21>;
263 vfront-porch = <7>;
264 hsync-len = <60>;
265 vsync-len = <10>;
266 };
267 };
307 }; 268 };
308}; 269};
309 270
310&iomuxc { 271&pcie {
311 pinctrl-names = "default"; 272 pinctrl-names = "default";
312 pinctrl-0 = <&pinctrl_hog>; 273 pinctrl-0 = <&pinctrl_pcie>;
274 reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
275 status = "okay";
276};
313 277
314 imx6qdl-gw52xx { 278&pwm4 {
315 pinctrl_hog: hoggrp { 279 pinctrl-names = "default";
316 fsl,pins = < 280 pinctrl-0 = <&pinctrl_pwm4>;
317 MX6QDL_PAD_EIM_A19__GPIO2_IO19 0x80000000 /* MEZZ_DIO0 */ 281 status = "okay";
318 MX6QDL_PAD_EIM_A20__GPIO2_IO18 0x80000000 /* MEZZ_DIO1 */ 282};
319 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 /* OTG_PWR_EN */ 283
320 MX6QDL_PAD_EIM_D31__GPIO3_IO31 0x80000000 /* VIDDEC_PDN# */ 284&ssi1 {
321 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* PHY Reset */ 285 fsl,mode = "i2s-slave";
322 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* PCIE_RST# */ 286 status = "okay";
323 MX6QDL_PAD_ENET_RXD0__GPIO1_IO27 0x80000000 /* GPS_PWDN */ 287};
324 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* GPS_PPS */ 288
325 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x000130b0 /* AUD4_MCK */ 289&uart1 {
326 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* USB_SEL_PCI */ 290 pinctrl-names = "default";
327 MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 /* TOUCH_IRQ# */ 291 pinctrl-0 = <&pinctrl_uart1>;
328 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x80000000 /* user1 led */ 292 status = "okay";
329 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x80000000 /* user2 led */ 293};
330 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x80000000 /* user3 led */ 294
331 MX6QDL_PAD_SD2_CMD__GPIO1_IO11 0x80000000 /* LVDS_TCH# */ 295&uart2 {
332 MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000 /* SD3_CD# */ 296 pinctrl-names = "default";
333 MX6QDL_PAD_SD4_DAT3__GPIO2_IO11 0x80000000 /* UART2_EN# */ 297 pinctrl-0 = <&pinctrl_uart2>;
334 >; 298 status = "okay";
335 }; 299};
300
301&uart5 {
302 pinctrl-names = "default";
303 pinctrl-0 = <&pinctrl_uart5>;
304 status = "okay";
305};
306
307&usbotg {
308 vbus-supply = <&reg_usb_otg_vbus>;
309 pinctrl-names = "default";
310 pinctrl-0 = <&pinctrl_usbotg>;
311 disable-over-current;
312 status = "okay";
313};
314
315&usbh1 {
316 status = "okay";
317};
318
319&usdhc3 {
320 pinctrl-names = "default";
321 pinctrl-0 = <&pinctrl_usdhc3>;
322 cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
323 vmmc-supply = <&reg_3p3v>;
324 status = "okay";
325};
336 326
327&iomuxc {
328 imx6qdl-gw52xx {
337 pinctrl_audmux: audmuxgrp { 329 pinctrl_audmux: audmuxgrp {
338 fsl,pins = < 330 fsl,pins = <
339 MX6QDL_PAD_SD2_DAT0__AUD4_RXD 0x130b0 331 MX6QDL_PAD_SD2_DAT0__AUD4_RXD 0x130b0
340 MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0 332 MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0
341 MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0 333 MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0
342 MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0 334 MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0
335 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* AUD4_MCK */
343 >; 336 >;
344 }; 337 };
345 338
@@ -361,6 +354,23 @@
361 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 354 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
362 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 355 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
363 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 356 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
357 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x1b0b0 /* PHY Reset */
358 >;
359 };
360
361 pinctrl_flexcan1: flexcan1grp {
362 fsl,pins = <
363 MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x1b0b1
364 MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x1b0b1
365 MX6QDL_PAD_GPIO_9__GPIO1_IO09 0x4001b0b0 /* CAN_STBY */
366 >;
367 };
368
369 pinctrl_gpio_leds: gpioledsgrp {
370 fsl,pins = <
371 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x1b0b0
372 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x1b0b0
373 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x1b0b0
364 >; 374 >;
365 }; 375 };
366 376
@@ -406,6 +416,18 @@
406 >; 416 >;
407 }; 417 };
408 418
419 pinctrl_pcie: pciegrp {
420 fsl,pins = <
421 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x1b0b0 /* PCIE_RST# */
422 >;
423 };
424
425 pinctrl_pps: ppsgrp {
426 fsl,pins = <
427 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x1b0b1
428 >;
429 };
430
409 pinctrl_pwm4: pwm4grp { 431 pinctrl_pwm4: pwm4grp {
410 fsl,pins = < 432 fsl,pins = <
411 MX6QDL_PAD_SD1_CMD__PWM4_OUT 0x1b0b1 433 MX6QDL_PAD_SD1_CMD__PWM4_OUT 0x1b0b1
@@ -436,6 +458,7 @@
436 pinctrl_usbotg: usbotggrp { 458 pinctrl_usbotg: usbotggrp {
437 fsl,pins = < 459 fsl,pins = <
438 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059 460 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
461 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0 /* OTG_PWR_EN */
439 >; 462 >;
440 }; 463 };
441 464
@@ -447,85 +470,8 @@
447 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 470 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
448 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 471 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
449 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 472 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
473 MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x1b0b0 /* CD */
450 >; 474 >;
451 }; 475 };
452 }; 476 };
453}; 477};
454
455&ldb {
456 status = "okay";
457
458 lvds-channel@0 {
459 fsl,data-mapping = "spwg";
460 fsl,data-width = <18>;
461 status = "okay";
462
463 display-timings {
464 native-mode = <&timing0>;
465 timing0: hsd100pxn1 {
466 clock-frequency = <65000000>;
467 hactive = <1024>;
468 vactive = <768>;
469 hback-porch = <220>;
470 hfront-porch = <40>;
471 vback-porch = <21>;
472 vfront-porch = <7>;
473 hsync-len = <60>;
474 vsync-len = <10>;
475 };
476 };
477 };
478};
479
480&pcie {
481 reset-gpio = <&gpio1 29 0>;
482 status = "okay";
483};
484
485&pwm4 {
486 pinctrl-names = "default";
487 pinctrl-0 = <&pinctrl_pwm4>;
488 status = "okay";
489};
490
491&ssi1 {
492 status = "okay";
493};
494
495&uart1 {
496 pinctrl-names = "default";
497 pinctrl-0 = <&pinctrl_uart1>;
498 status = "okay";
499};
500
501&uart2 {
502 pinctrl-names = "default";
503 pinctrl-0 = <&pinctrl_uart2>;
504 status = "okay";
505};
506
507&uart5 {
508 pinctrl-names = "default";
509 pinctrl-0 = <&pinctrl_uart5>;
510 status = "okay";
511};
512
513&usbotg {
514 vbus-supply = <&reg_usb_otg_vbus>;
515 pinctrl-names = "default";
516 pinctrl-0 = <&pinctrl_usbotg>;
517 disable-over-current;
518 status = "okay";
519};
520
521&usbh1 {
522 status = "okay";
523};
524
525&usdhc3 {
526 pinctrl-names = "default";
527 pinctrl-0 = <&pinctrl_usdhc3>;
528 cd-gpios = <&gpio7 0 0>;
529 vmmc-supply = <&reg_3p3v>;
530 status = "okay";
531};
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
index 143f84f7812c..cade1bdc97e9 100644
--- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
@@ -9,21 +9,19 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12#include <dt-bindings/gpio/gpio.h>
13
12/ { 14/ {
13 /* these are used by bootloader for disabling nodes */ 15 /* these are used by bootloader for disabling nodes */
14 aliases { 16 aliases {
15 can0 = &can1;
16 ethernet0 = &fec;
17 ethernet1 = &eth1; 17 ethernet1 = &eth1;
18 led0 = &led0; 18 led0 = &led0;
19 led1 = &led1; 19 led1 = &led1;
20 led2 = &led2; 20 led2 = &led2;
21 nand = &gpmi; 21 nand = &gpmi;
22 sky2 = &eth1;
23 ssi0 = &ssi1; 22 ssi0 = &ssi1;
24 usb0 = &usbh1; 23 usb0 = &usbh1;
25 usb1 = &usbotg; 24 usb1 = &usbotg;
26 usdhc2 = &usdhc3;
27 }; 25 };
28 26
29 chosen { 27 chosen {
@@ -39,23 +37,25 @@
39 37
40 leds { 38 leds {
41 compatible = "gpio-leds"; 39 compatible = "gpio-leds";
40 pinctrl-names = "default";
41 pinctrl-0 = <&pinctrl_gpio_leds>;
42 42
43 led0: user1 { 43 led0: user1 {
44 label = "user1"; 44 label = "user1";
45 gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */ 45 gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
46 default-state = "on"; 46 default-state = "on";
47 linux,default-trigger = "heartbeat"; 47 linux,default-trigger = "heartbeat";
48 }; 48 };
49 49
50 led1: user2 { 50 led1: user2 {
51 label = "user2"; 51 label = "user2";
52 gpios = <&gpio4 7 0>; /* 103 -> MX6_PANLEDR */ 52 gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
53 default-state = "off"; 53 default-state = "off";
54 }; 54 };
55 55
56 led2: user3 { 56 led2: user3 {
57 label = "user3"; 57 label = "user3";
58 gpios = <&gpio4 15 1>; /* 111 -> MX6_LOCLED# */ 58 gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
59 default-state = "off"; 59 default-state = "off";
60 }; 60 };
61 }; 61 };
@@ -66,7 +66,9 @@
66 66
67 pps { 67 pps {
68 compatible = "pps-gpio"; 68 compatible = "pps-gpio";
69 gpios = <&gpio1 26 0>; 69 pinctrl-names = "default";
70 pinctrl-0 = <&pinctrl_pps>;
71 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
70 status = "okay"; 72 status = "okay";
71 }; 73 };
72 74
@@ -118,7 +120,7 @@
118 regulator-name = "usb_otg_vbus"; 120 regulator-name = "usb_otg_vbus";
119 regulator-min-microvolt = <5000000>; 121 regulator-min-microvolt = <5000000>;
120 regulator-max-microvolt = <5000000>; 122 regulator-max-microvolt = <5000000>;
121 gpio = <&gpio3 22 0>; 123 gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
122 enable-active-high; 124 enable-active-high;
123 }; 125 };
124 }; 126 };
@@ -154,7 +156,7 @@
154 pinctrl-names = "default"; 156 pinctrl-names = "default";
155 pinctrl-0 = <&pinctrl_enet>; 157 pinctrl-0 = <&pinctrl_enet>;
156 phy-mode = "rgmii"; 158 phy-mode = "rgmii";
157 phy-reset-gpios = <&gpio1 30 0>; 159 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
158 status = "okay"; 160 status = "okay";
159}; 161};
160 162
@@ -206,11 +208,6 @@
206 #gpio-cells = <2>; 208 #gpio-cells = <2>;
207 }; 209 };
208 210
209 hwmon: gsc@29 {
210 compatible = "gw,gsp";
211 reg = <0x29>;
212 };
213
214 rtc: ds1672@68 { 211 rtc: ds1672@68 {
215 compatible = "dallas,ds1672"; 212 compatible = "dallas,ds1672";
216 reg = <0x68>; 213 reg = <0x68>;
@@ -222,77 +219,6 @@
222 pinctrl-names = "default"; 219 pinctrl-names = "default";
223 pinctrl-0 = <&pinctrl_i2c2>; 220 pinctrl-0 = <&pinctrl_i2c2>;
224 status = "okay"; 221 status = "okay";
225
226 pciclkgen: si53156@6b {
227 compatible = "sil,si53156";
228 reg = <0x6b>;
229 };
230
231 pciswitch: pex8606@3f {
232 compatible = "plx,pex8606";
233 reg = <0x3f>;
234 };
235
236 pmic: ltc3676@3c {
237 compatible = "lltc,ltc3676";
238 reg = <0x3c>;
239
240 regulators {
241 /* VDD_SOC */
242 sw1_reg: ltc3676__sw1 {
243 regulator-min-microvolt = <1175000>;
244 regulator-max-microvolt = <1175000>;
245 regulator-boot-on;
246 regulator-always-on;
247 };
248
249 /* VDD_1P8 */
250 sw2_reg: ltc3676__sw2 {
251 regulator-min-microvolt = <1800000>;
252 regulator-max-microvolt = <1800000>;
253 regulator-boot-on;
254 regulator-always-on;
255 };
256
257 /* VDD_ARM */
258 sw3_reg: ltc3676__sw3 {
259 regulator-min-microvolt = <1175000>;
260 regulator-max-microvolt = <1175000>;
261 regulator-boot-on;
262 regulator-always-on;
263 };
264
265 /* VDD_DDR */
266 sw4_reg: ltc3676__sw4 {
267 regulator-min-microvolt = <1500000>;
268 regulator-max-microvolt = <1500000>;
269 regulator-boot-on;
270 regulator-always-on;
271 };
272
273 /* VDD_2P5 */
274 ldo2_reg: ltc3676__ldo2 {
275 regulator-min-microvolt = <2500000>;
276 regulator-max-microvolt = <2500000>;
277 regulator-boot-on;
278 regulator-always-on;
279 };
280
281 /* VDD_1P8 */
282 ldo3_reg: ltc3676__ldo3 {
283 regulator-min-microvolt = <1800000>;
284 regulator-max-microvolt = <1800000>;
285 regulator-boot-on;
286 regulator-always-on;
287 };
288
289 /* VDD_HIGH */
290 ldo4_reg: ltc3676__ldo4 {
291 regulator-min-microvolt = <3000000>;
292 regulator-max-microvolt = <3000000>;
293 };
294 };
295 };
296}; 222};
297 223
298&i2c3 { 224&i2c3 {
@@ -301,11 +227,6 @@
301 pinctrl-0 = <&pinctrl_i2c3>; 227 pinctrl-0 = <&pinctrl_i2c3>;
302 status = "okay"; 228 status = "okay";
303 229
304 accelerometer: fxos8700@1e {
305 compatible = "fsl,fxos8700";
306 reg = <0x1e>;
307 };
308
309 codec: sgtl5000@0a { 230 codec: sgtl5000@0a {
310 compatible = "fsl,sgtl5000"; 231 compatible = "fsl,sgtl5000";
311 reg = <0x0a>; 232 reg = <0x0a>;
@@ -314,65 +235,110 @@
314 VDDIO-supply = <&reg_3p3v>; 235 VDDIO-supply = <&reg_3p3v>;
315 }; 236 };
316 237
317 hdmiin: adv7611@4c {
318 compatible = "adi,adv7611";
319 reg = <0x4c>;
320 };
321
322 touchscreen: egalax_ts@04 { 238 touchscreen: egalax_ts@04 {
323 compatible = "eeti,egalax_ts"; 239 compatible = "eeti,egalax_ts";
324 reg = <0x04>; 240 reg = <0x04>;
325 interrupt-parent = <&gpio1>; 241 interrupt-parent = <&gpio1>;
326 interrupts = <11 2>; /* gpio1_11 active low */ 242 interrupts = <11 2>;
327 wakeup-gpios = <&gpio1 11 0>; 243 wakeup-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
328 }; 244 };
245};
329 246
330 videoout: adv7393@2a { 247&ldb {
331 compatible = "adi,adv7393"; 248 status = "okay";
332 reg = <0x2a>; 249
250 lvds-channel@1 {
251 fsl,data-mapping = "spwg";
252 fsl,data-width = <18>;
253 status = "okay";
254
255 display-timings {
256 native-mode = <&timing0>;
257 timing0: hsd100pxn1 {
258 clock-frequency = <65000000>;
259 hactive = <1024>;
260 vactive = <768>;
261 hback-porch = <220>;
262 hfront-porch = <40>;
263 vback-porch = <21>;
264 vfront-porch = <7>;
265 hsync-len = <60>;
266 vsync-len = <10>;
267 };
268 };
333 }; 269 };
270};
334 271
335 videoin: adv7180@20 { 272&pcie {
336 compatible = "adi,adv7180"; 273 pinctrl-names = "default";
337 reg = <0x20>; 274 pinctrl-0 = <&pinctrl_pcie>;
275 reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
276 status = "okay";
277
278 eth1: sky2@8 { /* MAC/PHY on bus 8 */
279 compatible = "marvell,sky2";
338 }; 280 };
339}; 281};
340 282
341&iomuxc { 283&pwm4 {
342 pinctrl-names = "default"; 284 pinctrl-names = "default";
343 pinctrl-0 = <&pinctrl_hog>; 285 pinctrl-0 = <&pinctrl_pwm4>;
286 status = "okay";
287};
344 288
345 imx6qdl-gw53xx { 289&ssi1 {
346 pinctrl_hog: hoggrp { 290 fsl,mode = "i2s-slave";
347 fsl,pins = < 291 status = "okay";
348 MX6QDL_PAD_EIM_A19__GPIO2_IO19 0x80000000 /* PCIE6EXP_DIO0 */ 292};
349 MX6QDL_PAD_EIM_A20__GPIO2_IO18 0x80000000 /* PCIE6EXP_DIO1 */ 293
350 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 /* OTG_PWR_EN */ 294&uart1 {
351 MX6QDL_PAD_ENET_RXD0__GPIO1_IO27 0x80000000 /* GPS_SHDN */ 295 pinctrl-names = "default";
352 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* GPS_PPS */ 296 pinctrl-0 = <&pinctrl_uart1>;
353 MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x80000000 /* PCIE IRQ */ 297 status = "okay";
354 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* PCIE RST */ 298};
355 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x000130b0 /* AUD4_MCK */ 299
356 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* CAN_STBY */ 300&uart2 {
357 MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x80000000 /* PMIC_IRQ# */ 301 pinctrl-names = "default";
358 MX6QDL_PAD_GPIO_9__GPIO1_IO09 0x80000000 /* HUB_RST# */ 302 pinctrl-0 = <&pinctrl_uart2>;
359 MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 /* PCIE_WDIS# */ 303 status = "okay";
360 MX6QDL_PAD_GPIO_19__GPIO4_IO05 0x80000000 /* ACCEL_IRQ# */ 304};
361 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x80000000 /* user1 led */
362 MX6QDL_PAD_KEY_COL4__GPIO4_IO14 0x80000000 /* USBOTG_OC# */
363 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x80000000 /* user2 led */
364 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x80000000 /* user3 led */
365 MX6QDL_PAD_SD2_CMD__GPIO1_IO11 0x80000000 /* TOUCH_IRQ# */
366 MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000 /* SD3_DET# */
367 >;
368 };
369 305
306&uart5 {
307 pinctrl-names = "default";
308 pinctrl-0 = <&pinctrl_uart5>;
309 status = "okay";
310};
311
312&usbotg {
313 vbus-supply = <&reg_usb_otg_vbus>;
314 pinctrl-names = "default";
315 pinctrl-0 = <&pinctrl_usbotg>;
316 disable-over-current;
317 status = "okay";
318};
319
320&usbh1 {
321 vbus-supply = <&reg_usb_h1_vbus>;
322 status = "okay";
323};
324
325&usdhc3 {
326 pinctrl-names = "default";
327 pinctrl-0 = <&pinctrl_usdhc3>;
328 cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
329 vmmc-supply = <&reg_3p3v>;
330 status = "okay";
331};
332
333&iomuxc {
334 imx6qdl-gw53xx {
370 pinctrl_audmux: audmuxgrp { 335 pinctrl_audmux: audmuxgrp {
371 fsl,pins = < 336 fsl,pins = <
372 MX6QDL_PAD_SD2_DAT0__AUD4_RXD 0x130b0 337 MX6QDL_PAD_SD2_DAT0__AUD4_RXD 0x130b0
373 MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0 338 MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0
374 MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0 339 MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0
375 MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0 340 MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0
341 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* AUD4_MCK */
376 >; 342 >;
377 }; 343 };
378 344
@@ -399,8 +365,17 @@
399 365
400 pinctrl_flexcan1: flexcan1grp { 366 pinctrl_flexcan1: flexcan1grp {
401 fsl,pins = < 367 fsl,pins = <
402 MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x80000000 368 MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x1b0b1
403 MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x80000000 369 MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x1b0b1
370 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x4001b0b0 /* CAN_STBY */
371 >;
372 };
373
374 pinctrl_gpio_leds: gpioledsgrp {
375 fsl,pins = <
376 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x1b0b0
377 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x1b0b0
378 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x1b0b0
404 >; 379 >;
405 }; 380 };
406 381
@@ -446,6 +421,19 @@
446 >; 421 >;
447 }; 422 };
448 423
424 pinctrl_pcie: pciegrp {
425 fsl,pins = <
426 MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x1b0b0 /* PCIE IRQ */
427 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x1b0b0 /* PCIE RST */
428 >;
429 };
430
431 pinctrl_pps: ppsgrp {
432 fsl,pins = <
433 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x1b0b1
434 >;
435 };
436
449 pinctrl_pwm4: pwm4grp { 437 pinctrl_pwm4: pwm4grp {
450 fsl,pins = < 438 fsl,pins = <
451 MX6QDL_PAD_SD1_CMD__PWM4_OUT 0x1b0b1 439 MX6QDL_PAD_SD1_CMD__PWM4_OUT 0x1b0b1
@@ -476,6 +464,8 @@
476 pinctrl_usbotg: usbotggrp { 464 pinctrl_usbotg: usbotggrp {
477 fsl,pins = < 465 fsl,pins = <
478 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059 466 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
467 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0 /* PWR_EN */
468 MX6QDL_PAD_KEY_COL4__GPIO4_IO14 0x1b0b0 /* OC */
479 >; 469 >;
480 }; 470 };
481 471
@@ -487,90 +477,8 @@
487 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 477 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
488 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 478 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
489 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 479 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
480 MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x1b0b0 /* CD */
490 >; 481 >;
491 }; 482 };
492 }; 483 };
493}; 484};
494
495&ldb {
496 status = "okay";
497
498 lvds-channel@1 {
499 fsl,data-mapping = "spwg";
500 fsl,data-width = <18>;
501 status = "okay";
502
503 display-timings {
504 native-mode = <&timing0>;
505 timing0: hsd100pxn1 {
506 clock-frequency = <65000000>;
507 hactive = <1024>;
508 vactive = <768>;
509 hback-porch = <220>;
510 hfront-porch = <40>;
511 vback-porch = <21>;
512 vfront-porch = <7>;
513 hsync-len = <60>;
514 vsync-len = <10>;
515 };
516 };
517 };
518};
519
520&pcie {
521 reset-gpio = <&gpio1 29 0>;
522 status = "okay";
523
524 eth1: sky2@8 { /* MAC/PHY on bus 8 */
525 compatible = "marvell,sky2";
526 };
527};
528
529&pwm4 {
530 pinctrl-names = "default";
531 pinctrl-0 = <&pinctrl_pwm4>;
532 status = "okay";
533};
534
535&ssi1 {
536 status = "okay";
537};
538
539&uart1 {
540 pinctrl-names = "default";
541 pinctrl-0 = <&pinctrl_uart1>;
542 status = "okay";
543};
544
545&uart2 {
546 pinctrl-names = "default";
547 pinctrl-0 = <&pinctrl_uart2>;
548 status = "okay";
549};
550
551&uart5 {
552 pinctrl-names = "default";
553 pinctrl-0 = <&pinctrl_uart5>;
554 status = "okay";
555};
556
557&usbotg {
558 vbus-supply = <&reg_usb_otg_vbus>;
559 pinctrl-names = "default";
560 pinctrl-0 = <&pinctrl_usbotg>;
561 disable-over-current;
562 status = "okay";
563};
564
565&usbh1 {
566 vbus-supply = <&reg_usb_h1_vbus>;
567 status = "okay";
568};
569
570&usdhc3 {
571 pinctrl-names = "default";
572 pinctrl-0 = <&pinctrl_usdhc3>;
573 cd-gpios = <&gpio7 0 0>;
574 vmmc-supply = <&reg_3p3v>;
575 status = "okay";
576};
diff --git a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
index 16e7ad3d98ad..cf13239a1619 100644
--- a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
@@ -9,21 +9,19 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12#include <dt-bindings/gpio/gpio.h>
13
12/ { 14/ {
13 /* these are used by bootloader for disabling nodes */ 15 /* these are used by bootloader for disabling nodes */
14 aliases { 16 aliases {
15 can0 = &can1;
16 ethernet0 = &fec;
17 ethernet1 = &eth1; 17 ethernet1 = &eth1;
18 led0 = &led0; 18 led0 = &led0;
19 led1 = &led1; 19 led1 = &led1;
20 led2 = &led2; 20 led2 = &led2;
21 nand = &gpmi; 21 nand = &gpmi;
22 sky2 = &eth1;
23 ssi0 = &ssi1; 22 ssi0 = &ssi1;
24 usb0 = &usbh1; 23 usb0 = &usbh1;
25 usb1 = &usbotg; 24 usb1 = &usbotg;
26 usdhc2 = &usdhc3;
27 }; 25 };
28 26
29 chosen { 27 chosen {
@@ -39,23 +37,25 @@
39 37
40 leds { 38 leds {
41 compatible = "gpio-leds"; 39 compatible = "gpio-leds";
40 pinctrl-names = "default";
41 pinctrl-0 = <&pinctrl_gpio_leds>;
42 42
43 led0: user1 { 43 led0: user1 {
44 label = "user1"; 44 label = "user1";
45 gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */ 45 gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
46 default-state = "on"; 46 default-state = "on";
47 linux,default-trigger = "heartbeat"; 47 linux,default-trigger = "heartbeat";
48 }; 48 };
49 49
50 led1: user2 { 50 led1: user2 {
51 label = "user2"; 51 label = "user2";
52 gpios = <&gpio4 7 0>; /* 103 -> MX6_PANLEDR */ 52 gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
53 default-state = "off"; 53 default-state = "off";
54 }; 54 };
55 55
56 led2: user3 { 56 led2: user3 {
57 label = "user3"; 57 label = "user3";
58 gpios = <&gpio4 15 1>; /* 111 -> MX6_LOCLED# */ 58 gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
59 default-state = "off"; 59 default-state = "off";
60 }; 60 };
61 }; 61 };
@@ -66,7 +66,9 @@
66 66
67 pps { 67 pps {
68 compatible = "pps-gpio"; 68 compatible = "pps-gpio";
69 gpios = <&gpio1 26 0>; 69 pinctrl-names = "default";
70 pinctrl-0 = <&pinctrl_pps>;
71 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
70 status = "okay"; 72 status = "okay";
71 }; 73 };
72 74
@@ -108,7 +110,7 @@
108 regulator-name = "usb_otg_vbus"; 110 regulator-name = "usb_otg_vbus";
109 regulator-min-microvolt = <5000000>; 111 regulator-min-microvolt = <5000000>;
110 regulator-max-microvolt = <5000000>; 112 regulator-max-microvolt = <5000000>;
111 gpio = <&gpio3 22 0>; 113 gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
112 enable-active-high; 114 enable-active-high;
113 }; 115 };
114 }; 116 };
@@ -144,7 +146,7 @@
144 pinctrl-names = "default"; 146 pinctrl-names = "default";
145 pinctrl-0 = <&pinctrl_enet>; 147 pinctrl-0 = <&pinctrl_enet>;
146 phy-mode = "rgmii"; 148 phy-mode = "rgmii";
147 phy-reset-gpios = <&gpio1 30 0>; 149 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
148 status = "okay"; 150 status = "okay";
149}; 151};
150 152
@@ -196,11 +198,6 @@
196 #gpio-cells = <2>; 198 #gpio-cells = <2>;
197 }; 199 };
198 200
199 hwmon: gsc@29 {
200 compatible = "gw,gsp";
201 reg = <0x29>;
202 };
203
204 rtc: ds1672@68 { 201 rtc: ds1672@68 {
205 compatible = "dallas,ds1672"; 202 compatible = "dallas,ds1672";
206 reg = <0x68>; 203 reg = <0x68>;
@@ -311,16 +308,6 @@
311 }; 308 };
312 }; 309 };
313 }; 310 };
314
315 pciswitch: pex8609@3f {
316 compatible = "plx,pex8609";
317 reg = <0x3f>;
318 };
319
320 pciclkgen: si52147@6b {
321 compatible = "sil,si52147";
322 reg = <0x6b>;
323 };
324}; 311};
325 312
326&i2c3 { 313&i2c3 {
@@ -329,11 +316,6 @@
329 pinctrl-0 = <&pinctrl_i2c3>; 316 pinctrl-0 = <&pinctrl_i2c3>;
330 status = "okay"; 317 status = "okay";
331 318
332 accelerometer: fxos8700@1e {
333 compatible = "fsl,fxos8700";
334 reg = <0x1e>;
335 };
336
337 codec: sgtl5000@0a { 319 codec: sgtl5000@0a {
338 compatible = "fsl,sgtl5000"; 320 compatible = "fsl,sgtl5000";
339 reg = <0x0a>; 321 reg = <0x0a>;
@@ -342,59 +324,115 @@
342 VDDIO-supply = <&reg_3p3v>; 324 VDDIO-supply = <&reg_3p3v>;
343 }; 325 };
344 326
345 hdmiin: adv7611@4c {
346 compatible = "adi,adv7611";
347 reg = <0x4c>;
348 };
349
350 touchscreen: egalax_ts@04 { 327 touchscreen: egalax_ts@04 {
351 compatible = "eeti,egalax_ts"; 328 compatible = "eeti,egalax_ts";
352 reg = <0x04>; 329 reg = <0x04>;
353 interrupt-parent = <&gpio7>; 330 interrupt-parent = <&gpio7>;
354 interrupts = <12 2>; /* gpio7_12 active low */ 331 interrupts = <12 2>;
355 wakeup-gpios = <&gpio7 12 0>; 332 wakeup-gpios = <&gpio7 12 GPIO_ACTIVE_LOW>;
356 }; 333 };
334};
357 335
358 videoout: adv7393@2a { 336&ldb {
359 compatible = "adi,adv7393"; 337 status = "okay";
360 reg = <0x2a>; 338
339 lvds-channel@1 {
340 fsl,data-mapping = "spwg";
341 fsl,data-width = <18>;
342 status = "okay";
343
344 display-timings {
345 native-mode = <&timing0>;
346 timing0: hsd100pxn1 {
347 clock-frequency = <65000000>;
348 hactive = <1024>;
349 vactive = <768>;
350 hback-porch = <220>;
351 hfront-porch = <40>;
352 vback-porch = <21>;
353 vfront-porch = <7>;
354 hsync-len = <60>;
355 vsync-len = <10>;
356 };
357 };
361 }; 358 };
359};
360
361&pcie {
362 pinctrl-names = "default";
363 pinctrl-0 = <&pinctrl_pcie>;
364 reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
365 status = "okay";
362 366
363 videoin: adv7180@20 { 367 eth1: sky2@8 { /* MAC/PHY on bus 8 */
364 compatible = "adi,adv7180"; 368 compatible = "marvell,sky2";
365 reg = <0x20>;
366 }; 369 };
367}; 370};
368 371
369&iomuxc { 372&pwm4 {
370 pinctrl-names = "default"; 373 pinctrl-names = "default";
371 pinctrl-0 = <&pinctrl_hog>; 374 pinctrl-0 = <&pinctrl_pwm4>;
375 status = "okay";
376};
372 377
373 imx6qdl-gw54xx { 378&ssi1 {
374 pinctrl_hog: hoggrp { 379 fsl,mode = "i2s-slave";
375 fsl,pins = < 380 status = "okay";
376 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 /* OTG_PWR_EN */ 381};
377 MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x80000000 /* SPINOR_CS0# */ 382
378 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* GPS_PPS */ 383&ssi2 {
379 MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x80000000 /* PCIE IRQ */ 384 fsl,mode = "i2s-slave";
380 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* PCIE RST */ 385 status = "okay";
381 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x000130b0 /* AUD4_MCK */ 386};
382 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* CAN_STBY */ 387
383 MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 /* TOUCH_IRQ# */ 388&uart1 {
384 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x80000000 /* user1 led */ 389 pinctrl-names = "default";
385 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x80000000 /* user2 led */ 390 pinctrl-0 = <&pinctrl_uart1>;
386 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x80000000 /* user3 led */ 391 status = "okay";
387 MX6QDL_PAD_SD1_DAT0__GPIO1_IO16 0x80000000 /* USBHUB_RST# */ 392};
388 MX6QDL_PAD_SD1_DAT3__GPIO1_IO21 0x80000000 /* MIPI_DIO */ 393
389 >; 394&uart2 {
390 }; 395 pinctrl-names = "default";
396 pinctrl-0 = <&pinctrl_uart2>;
397 status = "okay";
398};
399
400&uart5 {
401 pinctrl-names = "default";
402 pinctrl-0 = <&pinctrl_uart5>;
403 status = "okay";
404};
405
406&usbotg {
407 vbus-supply = <&reg_usb_otg_vbus>;
408 pinctrl-names = "default";
409 pinctrl-0 = <&pinctrl_usbotg>;
410 disable-over-current;
411 status = "okay";
412};
413
414&usbh1 {
415 vbus-supply = <&reg_usb_h1_vbus>;
416 status = "okay";
417};
418
419&usdhc3 {
420 pinctrl-names = "default";
421 pinctrl-0 = <&pinctrl_usdhc3>;
422 cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
423 vmmc-supply = <&reg_3p3v>;
424 status = "okay";
425};
391 426
427&iomuxc {
428 imx6qdl-gw54xx {
392 pinctrl_audmux: audmuxgrp { 429 pinctrl_audmux: audmuxgrp {
393 fsl,pins = < 430 fsl,pins = <
394 MX6QDL_PAD_SD2_DAT0__AUD4_RXD 0x130b0 431 MX6QDL_PAD_SD2_DAT0__AUD4_RXD 0x130b0
395 MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0 432 MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0
396 MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0 433 MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0
397 MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0 434 MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0
435 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* AUD4_MCK */
398 >; 436 >;
399 }; 437 };
400 438
@@ -421,8 +459,17 @@
421 459
422 pinctrl_flexcan1: flexcan1grp { 460 pinctrl_flexcan1: flexcan1grp {
423 fsl,pins = < 461 fsl,pins = <
424 MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x80000000 462 MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x1b0b1
425 MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x80000000 463 MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x1b0b1
464 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x4001b0b0 /* CAN_STBY */
465 >;
466 };
467
468 pinctrl_gpio_leds: gpioledsgrp {
469 fsl,pins = <
470 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x1b0b0
471 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x1b0b0
472 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x1b0b0
426 >; 473 >;
427 }; 474 };
428 475
@@ -468,6 +515,19 @@
468 >; 515 >;
469 }; 516 };
470 517
518 pinctrl_pcie: pciegrp {
519 fsl,pins = <
520 MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x1b0b0 /* PCIE IRQ */
521 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x1b0b0 /* PCIE RST */
522 >;
523 };
524
525 pinctrl_pps: ppsgrp {
526 fsl,pins = <
527 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x1b0b1
528 >;
529 };
530
471 pinctrl_pwm4: pwm4grp { 531 pinctrl_pwm4: pwm4grp {
472 fsl,pins = < 532 fsl,pins = <
473 MX6QDL_PAD_SD1_CMD__PWM4_OUT 0x1b0b1 533 MX6QDL_PAD_SD1_CMD__PWM4_OUT 0x1b0b1
@@ -498,6 +558,7 @@
498 pinctrl_usbotg: usbotggrp { 558 pinctrl_usbotg: usbotggrp {
499 fsl,pins = < 559 fsl,pins = <
500 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059 560 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
561 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0 /* PWR_EN */
501 >; 562 >;
502 }; 563 };
503 564
@@ -513,90 +574,3 @@
513 }; 574 };
514 }; 575 };
515}; 576};
516
517&ldb {
518 status = "okay";
519
520 lvds-channel@1 {
521 fsl,data-mapping = "spwg";
522 fsl,data-width = <18>;
523 status = "okay";
524
525 display-timings {
526 native-mode = <&timing0>;
527 timing0: hsd100pxn1 {
528 clock-frequency = <65000000>;
529 hactive = <1024>;
530 vactive = <768>;
531 hback-porch = <220>;
532 hfront-porch = <40>;
533 vback-porch = <21>;
534 vfront-porch = <7>;
535 hsync-len = <60>;
536 vsync-len = <10>;
537 };
538 };
539 };
540};
541
542&pcie {
543 reset-gpio = <&gpio1 29 0>;
544 status = "okay";
545
546 eth1: sky2@8 { /* MAC/PHY on bus 8 */
547 compatible = "marvell,sky2";
548 };
549};
550
551&pwm4 {
552 pinctrl-names = "default";
553 pinctrl-0 = <&pinctrl_pwm4>;
554 status = "okay";
555};
556
557&ssi1 {
558 status = "okay";
559};
560
561&ssi2 {
562 status = "okay";
563};
564
565&uart1 {
566 pinctrl-names = "default";
567 pinctrl-0 = <&pinctrl_uart1>;
568 status = "okay";
569};
570
571&uart2 {
572 pinctrl-names = "default";
573 pinctrl-0 = <&pinctrl_uart2>;
574 status = "okay";
575};
576
577&uart5 {
578 pinctrl-names = "default";
579 pinctrl-0 = <&pinctrl_uart5>;
580 status = "okay";
581};
582
583&usbotg {
584 vbus-supply = <&reg_usb_otg_vbus>;
585 pinctrl-names = "default";
586 pinctrl-0 = <&pinctrl_usbotg>;
587 disable-over-current;
588 status = "okay";
589};
590
591&usbh1 {
592 vbus-supply = <&reg_usb_h1_vbus>;
593 status = "okay";
594};
595
596&usdhc3 {
597 pinctrl-names = "default";
598 pinctrl-0 = <&pinctrl_usdhc3>;
599 cd-gpios = <&gpio7 0 0>;
600 vmmc-supply = <&reg_3p3v>;
601 status = "okay";
602};
diff --git a/arch/arm/boot/dts/imx6qdl-gw552x.dtsi b/arch/arm/boot/dts/imx6qdl-gw552x.dtsi
new file mode 100644
index 000000000000..5c6587f6c420
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-gw552x.dtsi
@@ -0,0 +1,267 @@
1/*
2 * Copyright 2014 Gateworks Corporation
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include <dt-bindings/gpio/gpio.h>
13
14/ {
15 /* these are used by bootloader for disabling nodes */
16 aliases {
17 led0 = &led0;
18 led1 = &led1;
19 led2 = &led2;
20 nand = &gpmi;
21 usb0 = &usbh1;
22 usb1 = &usbotg;
23 };
24
25 chosen {
26 bootargs = "console=ttymxc1,115200";
27 };
28
29 leds {
30 compatible = "gpio-leds";
31 pinctrl-names = "default";
32 pinctrl-0 = <&pinctrl_gpio_leds>;
33
34 led0: user1 {
35 label = "user1";
36 gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
37 default-state = "on";
38 linux,default-trigger = "heartbeat";
39 };
40
41 led1: user2 {
42 label = "user2";
43 gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
44 default-state = "off";
45 };
46
47 led2: user3 {
48 label = "user3";
49 gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
50 default-state = "off";
51 };
52 };
53
54 memory {
55 reg = <0x10000000 0x20000000>;
56 };
57
58 regulators {
59 compatible = "simple-bus";
60 #address-cells = <1>;
61 #size-cells = <0>;
62
63 reg_1p0v: regulator@0 {
64 compatible = "regulator-fixed";
65 reg = <0>;
66 regulator-name = "1P0V";
67 regulator-min-microvolt = <1000000>;
68 regulator-max-microvolt = <1000000>;
69 regulator-always-on;
70 };
71
72 reg_3p3v: regulator@2 {
73 compatible = "regulator-fixed";
74 reg = <2>;
75 regulator-name = "3P3V";
76 regulator-min-microvolt = <3300000>;
77 regulator-max-microvolt = <3300000>;
78 regulator-always-on;
79 };
80
81 reg_5p0v: regulator@3 {
82 compatible = "regulator-fixed";
83 reg = <3>;
84 regulator-name = "5P0V";
85 regulator-min-microvolt = <5000000>;
86 regulator-max-microvolt = <5000000>;
87 regulator-always-on;
88 };
89 };
90};
91
92&gpmi {
93 pinctrl-names = "default";
94 pinctrl-0 = <&pinctrl_gpmi_nand>;
95 status = "okay";
96};
97
98&hdmi {
99 ddc-i2c-bus = <&i2c3>;
100 status = "okay";
101};
102
103&i2c1 {
104 clock-frequency = <100000>;
105 pinctrl-names = "default";
106 pinctrl-0 = <&pinctrl_i2c1>;
107 status = "okay";
108
109 eeprom1: eeprom@50 {
110 compatible = "atmel,24c02";
111 reg = <0x50>;
112 pagesize = <16>;
113 };
114
115 eeprom2: eeprom@51 {
116 compatible = "atmel,24c02";
117 reg = <0x51>;
118 pagesize = <16>;
119 };
120
121 eeprom3: eeprom@52 {
122 compatible = "atmel,24c02";
123 reg = <0x52>;
124 pagesize = <16>;
125 };
126
127 eeprom4: eeprom@53 {
128 compatible = "atmel,24c02";
129 reg = <0x53>;
130 pagesize = <16>;
131 };
132
133 gpio: pca9555@23 {
134 compatible = "nxp,pca9555";
135 reg = <0x23>;
136 gpio-controller;
137 #gpio-cells = <2>;
138 };
139
140 rtc: ds1672@68 {
141 compatible = "dallas,ds1672";
142 reg = <0x68>;
143 };
144};
145
146&i2c2 {
147 clock-frequency = <100000>;
148 pinctrl-names = "default";
149 pinctrl-0 = <&pinctrl_i2c2>;
150 status = "okay";
151};
152
153&i2c3 {
154 clock-frequency = <100000>;
155 pinctrl-names = "default";
156 pinctrl-0 = <&pinctrl_i2c3>;
157 status = "okay";
158};
159
160&pcie {
161 pinctrl-names = "default";
162 pinctrl-0 = <&pinctrl_pcie>;
163 reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
164 status = "okay";
165};
166
167&uart2 {
168 pinctrl-names = "default";
169 pinctrl-0 = <&pinctrl_uart2>;
170 status = "okay";
171};
172
173&uart3 {
174 pinctrl-names = "default";
175 pinctrl-0 = <&pinctrl_uart3>;
176 status = "okay";
177};
178
179&uart5 {
180 pinctrl-names = "default";
181 pinctrl-0 = <&pinctrl_uart5>;
182 status = "okay"; };
183
184&usbh1 {
185 status = "okay";
186};
187
188&iomuxc {
189 imx6qdl-gw552x {
190 pinctrl_gpio_leds: gpioledsgrp {
191 fsl,pins = <
192 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x1b0b0
193 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x1b0b0
194 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x1b0b0
195 >;
196 };
197
198 pinctrl_gpmi_nand: gpminandgrp {
199 fsl,pins = <
200 MX6QDL_PAD_NANDF_CLE__NAND_CLE 0xb0b1
201 MX6QDL_PAD_NANDF_ALE__NAND_ALE 0xb0b1
202 MX6QDL_PAD_NANDF_WP_B__NAND_WP_B 0xb0b1
203 MX6QDL_PAD_NANDF_RB0__NAND_READY_B 0xb000
204 MX6QDL_PAD_NANDF_CS0__NAND_CE0_B 0xb0b1
205 MX6QDL_PAD_NANDF_CS1__NAND_CE1_B 0xb0b1
206 MX6QDL_PAD_SD4_CMD__NAND_RE_B 0xb0b1
207 MX6QDL_PAD_SD4_CLK__NAND_WE_B 0xb0b1
208 MX6QDL_PAD_NANDF_D0__NAND_DATA00 0xb0b1
209 MX6QDL_PAD_NANDF_D1__NAND_DATA01 0xb0b1
210 MX6QDL_PAD_NANDF_D2__NAND_DATA02 0xb0b1
211 MX6QDL_PAD_NANDF_D3__NAND_DATA03 0xb0b1
212 MX6QDL_PAD_NANDF_D4__NAND_DATA04 0xb0b1
213 MX6QDL_PAD_NANDF_D5__NAND_DATA05 0xb0b1
214 MX6QDL_PAD_NANDF_D6__NAND_DATA06 0xb0b1
215 MX6QDL_PAD_NANDF_D7__NAND_DATA07 0xb0b1
216 >;
217 };
218
219 pinctrl_i2c1: i2c1grp {
220 fsl,pins = <
221 MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
222 MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
223 >;
224 };
225
226 pinctrl_i2c2: i2c2grp {
227 fsl,pins = <
228 MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
229 MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
230 >;
231 };
232
233 pinctrl_i2c3: i2c3grp {
234 fsl,pins = <
235 MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1
236 MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1
237 >;
238 };
239
240 pinctrl_pcie: pciegrp {
241 fsl,pins = <
242 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x1b0b0
243 >;
244 };
245
246 pinctrl_uart2: uart2grp {
247 fsl,pins = <
248 MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA 0x1b0b1
249 MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA 0x1b0b1
250 >;
251 };
252
253 pinctrl_uart3: uart3grp {
254 fsl,pins = <
255 MX6QDL_PAD_EIM_D24__UART3_TX_DATA 0x1b0b1
256 MX6QDL_PAD_EIM_D25__UART3_RX_DATA 0x1b0b1
257 >;
258 };
259
260 pinctrl_uart5: uart5grp {
261 fsl,pins = <
262 MX6QDL_PAD_KEY_COL1__UART5_TX_DATA 0x1b0b1
263 MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA 0x1b0b1
264 >;
265 };
266 };
267};
diff --git a/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi b/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi
new file mode 100644
index 000000000000..62841e85a91e
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi
@@ -0,0 +1,200 @@
1/*
2 * Copyright (C) 2013,2014 Russell King
3 */
4#include "imx6qdl-microsom.dtsi"
5#include "imx6qdl-microsom-ar8035.dtsi"
6
7/ {
8 chosen {
9 stdout-path = &uart1;
10 };
11
12 ir_recv: ir-receiver {
13 compatible = "gpio-ir-receiver";
14 gpios = <&gpio3 5 1>;
15 pinctrl-names = "default";
16 pinctrl-0 = <&pinctrl_hummingboard_gpio3_5>;
17 };
18
19 regulators {
20 compatible = "simple-bus";
21
22 reg_3p3v: 3p3v {
23 compatible = "regulator-fixed";
24 regulator-name = "3P3V";
25 regulator-min-microvolt = <3300000>;
26 regulator-max-microvolt = <3300000>;
27 regulator-always-on;
28 };
29
30 reg_usbh1_vbus: usb-h1-vbus {
31 compatible = "regulator-fixed";
32 enable-active-high;
33 gpio = <&gpio1 0 0>;
34 pinctrl-names = "default";
35 pinctrl-0 = <&pinctrl_hummingboard_usbh1_vbus>;
36 regulator-name = "usb_h1_vbus";
37 regulator-min-microvolt = <5000000>;
38 regulator-max-microvolt = <5000000>;
39 };
40
41 reg_usbotg_vbus: usb-otg-vbus {
42 compatible = "regulator-fixed";
43 enable-active-high;
44 gpio = <&gpio3 22 0>;
45 pinctrl-names = "default";
46 pinctrl-0 = <&pinctrl_hummingboard_usbotg_vbus>;
47 regulator-name = "usb_otg_vbus";
48 regulator-min-microvolt = <5000000>;
49 regulator-max-microvolt = <5000000>;
50 };
51 };
52
53 sound-spdif {
54 compatible = "fsl,imx-audio-spdif";
55 model = "On-board SPDIF";
56 /* IMX6 doesn't implement this yet */
57 spdif-controller = <&spdif>;
58 spdif-out;
59 };
60};
61
62&can1 {
63 pinctrl-names = "default";
64 pinctrl-0 = <&pinctrl_hummingboard_flexcan1>;
65 status = "okay";
66};
67
68&hdmi {
69 pinctrl-names = "default";
70 pinctrl-0 = <&pinctrl_hummingboard_hdmi>;
71 ddc-i2c-bus = <&i2c2>;
72 status = "okay";
73};
74
75&i2c1 {
76 pinctrl-names = "default";
77 pinctrl-0 = <&pinctrl_hummingboard_i2c1>;
78
79 /*
80 * Not fitted on Carrier-1 board... yet
81 status = "okay";
82
83 rtc: pcf8523@68 {
84 compatible = "nxp,pcf8523";
85 reg = <0x68>;
86 };
87 */
88};
89
90&i2c2 {
91 clock-frequency = <100000>;
92 pinctrl-names = "default";
93 pinctrl-0 = <&pinctrl_hummingboard_i2c2>;
94 status = "okay";
95};
96
97&iomuxc {
98 hummingboard {
99 pinctrl_hummingboard_flexcan1: hummingboard-flexcan1 {
100 fsl,pins = <
101 MX6QDL_PAD_SD3_CLK__FLEXCAN1_RX 0x80000000
102 MX6QDL_PAD_SD3_CMD__FLEXCAN1_TX 0x80000000
103 >;
104 };
105
106 pinctrl_hummingboard_gpio3_5: hummingboard-gpio3_5 {
107 fsl,pins = <
108 MX6QDL_PAD_EIM_DA5__GPIO3_IO05 0x1b0b1
109 >;
110 };
111
112 pinctrl_hummingboard_hdmi: hummingboard-hdmi {
113 fsl,pins = <
114 MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x1f8b0
115 >;
116 };
117
118 pinctrl_hummingboard_i2c1: hummingboard-i2c1 {
119 fsl,pins = <
120 MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
121 MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
122 >;
123 };
124
125 pinctrl_hummingboard_i2c2: hummingboard-i2c2 {
126 fsl,pins = <
127 MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
128 MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
129 >;
130 };
131
132 pinctrl_hummingboard_spdif: hummingboard-spdif {
133 fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>;
134 };
135
136 pinctrl_hummingboard_usbh1_vbus: hummingboard-usbh1-vbus {
137 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>;
138 };
139
140 pinctrl_hummingboard_usbotg_id: hummingboard-usbotg-id {
141 /*
142 * Similar to pinctrl_usbotg_2, but we want it
143 * pulled down for a fixed host connection.
144 */
145 fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>;
146 };
147
148 pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus {
149 fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>;
150 };
151
152 pinctrl_hummingboard_usdhc2_aux: hummingboard-usdhc2-aux {
153 fsl,pins = <
154 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1f071
155 >;
156 };
157
158 pinctrl_hummingboard_usdhc2: hummingboard-usdhc2 {
159 fsl,pins = <
160 MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
161 MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
162 MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
163 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
164 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
165 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x13059
166 >;
167 };
168 };
169};
170
171&spdif {
172 pinctrl-names = "default";
173 pinctrl-0 = <&pinctrl_hummingboard_spdif>;
174 status = "okay";
175};
176
177&usbh1 {
178 disable-over-current;
179 vbus-supply = <&reg_usbh1_vbus>;
180 status = "okay";
181};
182
183&usbotg {
184 disable-over-current;
185 pinctrl-names = "default";
186 pinctrl-0 = <&pinctrl_hummingboard_usbotg_id>;
187 vbus-supply = <&reg_usbotg_vbus>;
188 status = "okay";
189};
190
191&usdhc2 {
192 pinctrl-names = "default";
193 pinctrl-0 = <
194 &pinctrl_hummingboard_usdhc2_aux
195 &pinctrl_hummingboard_usdhc2
196 >;
197 vmmc-supply = <&reg_3p3v>;
198 cd-gpios = <&gpio1 4 0>;
199 status = "okay";
200};
diff --git a/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi b/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi
index d16066608e21..db9f45b2c573 100644
--- a/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi
@@ -17,7 +17,7 @@
17 enet { 17 enet {
18 pinctrl_microsom_enet_ar8035: microsom-enet-ar8035 { 18 pinctrl_microsom_enet_ar8035: microsom-enet-ar8035 {
19 fsl,pins = < 19 fsl,pins = <
20 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 20 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b8b0
21 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 21 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
22 /* AR8035 reset */ 22 /* AR8035 reset */
23 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x130b0 23 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x130b0
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
index 42ff525ebe13..08218120e770 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
@@ -174,6 +174,11 @@
174 status = "okay"; 174 status = "okay";
175}; 175};
176 176
177&hdmi {
178 ddc-i2c-bus = <&i2c2>;
179 status = "okay";
180};
181
177&i2c1 { 182&i2c1 {
178 clock-frequency = <100000>; 183 clock-frequency = <100000>;
179 pinctrl-names = "default"; 184 pinctrl-names = "default";
@@ -187,6 +192,25 @@
187 VDDA-supply = <&reg_2p5v>; 192 VDDA-supply = <&reg_2p5v>;
188 VDDIO-supply = <&reg_3p3v>; 193 VDDIO-supply = <&reg_3p3v>;
189 }; 194 };
195
196 rtc: rtc@6f {
197 compatible = "isil,isl1208";
198 reg = <0x6f>;
199 };
200};
201
202&i2c2 {
203 clock-frequency = <100000>;
204 pinctrl-names = "default";
205 pinctrl-0 = <&pinctrl_i2c2>;
206 status = "okay";
207};
208
209&i2c3 {
210 clock-frequency = <100000>;
211 pinctrl-names = "default";
212 pinctrl-0 = <&pinctrl_i2c3>;
213 status = "okay";
190}; 214};
191 215
192&iomuxc { 216&iomuxc {
@@ -266,6 +290,20 @@
266 >; 290 >;
267 }; 291 };
268 292
293 pinctrl_i2c2: i2c2grp {
294 fsl,pins = <
295 MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
296 MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
297 >;
298 };
299
300 pinctrl_i2c3: i2c3grp {
301 fsl,pins = <
302 MX6QDL_PAD_GPIO_5__I2C3_SCL 0x4001b8b1
303 MX6QDL_PAD_GPIO_16__I2C3_SDA 0x4001b8b1
304 >;
305 };
306
269 pinctrl_pwm1: pwm1grp { 307 pinctrl_pwm1: pwm1grp {
270 fsl,pins = < 308 fsl,pins = <
271 MX6QDL_PAD_SD1_DAT3__PWM1_OUT 0x1b0b1 309 MX6QDL_PAD_SD1_DAT3__PWM1_OUT 0x1b0b1
diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
index 2694aa84e187..0e50bb0a6b94 100644
--- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
@@ -83,7 +83,7 @@
83 }; 83 };
84 84
85 pmic@58 { 85 pmic@58 {
86 compatible = "dialog,da9063"; 86 compatible = "dlg,da9063";
87 reg = <0x58>; 87 reg = <0x58>;
88 interrupt-parent = <&gpio4>; 88 interrupt-parent = <&gpio4>;
89 interrupts = <17 0x8>; /* active-low GPIO4_17 */ 89 interrupts = <17 0x8>; /* active-low GPIO4_17 */
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index ec43dde78525..baf2f00d519a 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -54,6 +54,19 @@
54 gpio = <&gpio4 10 0>; 54 gpio = <&gpio4 10 0>;
55 enable-active-high; 55 enable-active-high;
56 }; 56 };
57
58 reg_pcie: regulator@3 {
59 compatible = "regulator-fixed";
60 reg = <3>;
61 pinctrl-names = "default";
62 pinctrl-0 = <&pinctrl_pcie_reg>;
63 regulator-name = "MPCIE_3V3";
64 regulator-min-microvolt = <3300000>;
65 regulator-max-microvolt = <3300000>;
66 gpio = <&gpio3 19 0>;
67 regulator-always-on;
68 enable-active-high;
69 };
57 }; 70 };
58 71
59 gpio-keys { 72 gpio-keys {
@@ -314,15 +327,15 @@
314 imx6qdl-sabresd { 327 imx6qdl-sabresd {
315 pinctrl_hog: hoggrp { 328 pinctrl_hog: hoggrp {
316 fsl,pins = < 329 fsl,pins = <
317 MX6QDL_PAD_NANDF_D0__GPIO2_IO00 0x80000000 330 MX6QDL_PAD_NANDF_D0__GPIO2_IO00 0x1b0b0
318 MX6QDL_PAD_NANDF_D1__GPIO2_IO01 0x80000000 331 MX6QDL_PAD_NANDF_D1__GPIO2_IO01 0x1b0b0
319 MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x80000000 332 MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x1b0b0
320 MX6QDL_PAD_NANDF_D3__GPIO2_IO03 0x80000000 333 MX6QDL_PAD_NANDF_D3__GPIO2_IO03 0x1b0b0
321 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 334 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0
322 MX6QDL_PAD_NANDF_CLE__GPIO6_IO07 0x80000000 335 MX6QDL_PAD_NANDF_CLE__GPIO6_IO07 0x1b0b0
323 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 336 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x1b0b0
324 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 337 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0
325 MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x80000000 338 MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x1b0b0
326 >; 339 >;
327 }; 340 };
328 341
@@ -367,9 +380,9 @@
367 380
368 pinctrl_gpio_keys: gpio_keysgrp { 381 pinctrl_gpio_keys: gpio_keysgrp {
369 fsl,pins = < 382 fsl,pins = <
370 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x80000000 383 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x1b0b0
371 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x80000000 384 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1b0b0
372 MX6QDL_PAD_GPIO_5__GPIO1_IO05 0x80000000 385 MX6QDL_PAD_GPIO_5__GPIO1_IO05 0x1b0b0
373 >; 386 >;
374 }; 387 };
375 388
@@ -396,7 +409,13 @@
396 409
397 pinctrl_pcie: pciegrp { 410 pinctrl_pcie: pciegrp {
398 fsl,pins = < 411 fsl,pins = <
399 MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 412 MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x1b0b0
413 >;
414 };
415
416 pinctrl_pcie_reg: pciereggrp {
417 fsl,pins = <
418 MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x1b0b0
400 >; 419 >;
401 }; 420 };
402 421
@@ -468,7 +487,7 @@
468 gpio_leds { 487 gpio_leds {
469 pinctrl_gpio_leds: gpioledsgrp { 488 pinctrl_gpio_leds: gpioledsgrp {
470 fsl,pins = < 489 fsl,pins = <
471 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 490 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x1b0b0
472 >; 491 >;
473 }; 492 };
474 }; 493 };
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index c701af958006..9596ed5867e6 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -137,7 +137,9 @@
137 137
138 pcie: pcie@0x01000000 { 138 pcie: pcie@0x01000000 {
139 compatible = "fsl,imx6q-pcie", "snps,dw-pcie"; 139 compatible = "fsl,imx6q-pcie", "snps,dw-pcie";
140 reg = <0x01ffc000 0x4000>; /* DBI */ 140 reg = <0x01ffc000 0x04000>,
141 <0x01f00000 0x80000>;
142 reg-names = "dbi", "config";
141 #address-cells = <3>; 143 #address-cells = <3>;
142 #size-cells = <2>; 144 #size-cells = <2>;
143 device_type = "pci"; 145 device_type = "pci";
@@ -273,11 +275,14 @@
273 }; 275 };
274 276
275 ssi1: ssi@02028000 { 277 ssi1: ssi@02028000 {
278 #sound-dai-cells = <0>;
276 compatible = "fsl,imx6q-ssi", 279 compatible = "fsl,imx6q-ssi",
277 "fsl,imx51-ssi"; 280 "fsl,imx51-ssi";
278 reg = <0x02028000 0x4000>; 281 reg = <0x02028000 0x4000>;
279 interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>; 282 interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>;
280 clocks = <&clks IMX6QDL_CLK_SSI1_IPG>; 283 clocks = <&clks IMX6QDL_CLK_SSI1_IPG>,
284 <&clks IMX6QDL_CLK_SSI1>;
285 clock-names = "ipg", "baud";
281 dmas = <&sdma 37 1 0>, 286 dmas = <&sdma 37 1 0>,
282 <&sdma 38 1 0>; 287 <&sdma 38 1 0>;
283 dma-names = "rx", "tx"; 288 dma-names = "rx", "tx";
@@ -286,11 +291,14 @@
286 }; 291 };
287 292
288 ssi2: ssi@0202c000 { 293 ssi2: ssi@0202c000 {
294 #sound-dai-cells = <0>;
289 compatible = "fsl,imx6q-ssi", 295 compatible = "fsl,imx6q-ssi",
290 "fsl,imx51-ssi"; 296 "fsl,imx51-ssi";
291 reg = <0x0202c000 0x4000>; 297 reg = <0x0202c000 0x4000>;
292 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>; 298 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>;
293 clocks = <&clks IMX6QDL_CLK_SSI2_IPG>; 299 clocks = <&clks IMX6QDL_CLK_SSI2_IPG>,
300 <&clks IMX6QDL_CLK_SSI2>;
301 clock-names = "ipg", "baud";
294 dmas = <&sdma 41 1 0>, 302 dmas = <&sdma 41 1 0>,
295 <&sdma 42 1 0>; 303 <&sdma 42 1 0>;
296 dma-names = "rx", "tx"; 304 dma-names = "rx", "tx";
@@ -299,11 +307,14 @@
299 }; 307 };
300 308
301 ssi3: ssi@02030000 { 309 ssi3: ssi@02030000 {
310 #sound-dai-cells = <0>;
302 compatible = "fsl,imx6q-ssi", 311 compatible = "fsl,imx6q-ssi",
303 "fsl,imx51-ssi"; 312 "fsl,imx51-ssi";
304 reg = <0x02030000 0x4000>; 313 reg = <0x02030000 0x4000>;
305 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>; 314 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
306 clocks = <&clks IMX6QDL_CLK_SSI3_IPG>; 315 clocks = <&clks IMX6QDL_CLK_SSI3_IPG>,
316 <&clks IMX6QDL_CLK_SSI3>;
317 clock-names = "ipg", "baud";
307 dmas = <&sdma 45 1 0>, 318 dmas = <&sdma 45 1 0>,
308 <&sdma 46 1 0>; 319 <&sdma 46 1 0>;
309 dma-names = "rx", "tx"; 320 dma-names = "rx", "tx";
@@ -396,8 +407,9 @@
396 reg = <0x02098000 0x4000>; 407 reg = <0x02098000 0x4000>;
397 interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>; 408 interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>;
398 clocks = <&clks IMX6QDL_CLK_GPT_IPG>, 409 clocks = <&clks IMX6QDL_CLK_GPT_IPG>,
399 <&clks IMX6QDL_CLK_GPT_IPG_PER>; 410 <&clks IMX6QDL_CLK_GPT_IPG_PER>,
400 clock-names = "ipg", "per"; 411 <&clks IMX6QDL_CLK_GPT_3M>;
412 clock-names = "ipg", "per", "osc_per";
401 }; 413 };
402 414
403 gpio1: gpio@0209c000 { 415 gpio1: gpio@0209c000 {
diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
index 3f9e041c0252..898d14fd765f 100644
--- a/arch/arm/boot/dts/imx6sl-evk.dts
+++ b/arch/arm/boot/dts/imx6sl-evk.dts
@@ -20,6 +20,13 @@
20 reg = <0x80000000 0x40000000>; 20 reg = <0x80000000 0x40000000>;
21 }; 21 };
22 22
23 backlight {
24 compatible = "pwm-backlight";
25 pwms = <&pwm1 0 5000000>;
26 brightness-levels = <0 4 8 16 32 64 128 255>;
27 default-brightness-level = <6>;
28 };
29
23 leds { 30 leds {
24 compatible = "gpio-leds"; 31 compatible = "gpio-leds";
25 pinctrl-names = "default"; 32 pinctrl-names = "default";
@@ -74,6 +81,14 @@
74 regulator-max-microvolt = <4325000>; 81 regulator-max-microvolt = <4325000>;
75 regulator-boot-on; 82 regulator-boot-on;
76 }; 83 };
84
85 reg_lcd_3v3: regulator@4 {
86 compatible = "regulator-fixed";
87 reg = <4>;
88 regulator-name = "lcd-3v3";
89 gpio = <&gpio4 3 0>;
90 enable-active-high;
91 };
77 }; 92 };
78 93
79 sound { 94 sound {
@@ -329,12 +344,6 @@
329 >; 344 >;
330 }; 345 };
331 346
332 pinctrl_led: ledgrp {
333 fsl,pins = <
334 MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0x17059
335 >;
336 };
337
338 pinctrl_kpp: kppgrp { 347 pinctrl_kpp: kppgrp {
339 fsl,pins = < 348 fsl,pins = <
340 MX6SL_PAD_KEY_ROW0__KEY_ROW0 0x1b010 349 MX6SL_PAD_KEY_ROW0__KEY_ROW0 0x1b010
@@ -346,6 +355,51 @@
346 >; 355 >;
347 }; 356 };
348 357
358 pinctrl_lcd: lcdgrp {
359 fsl,pins = <
360 MX6SL_PAD_LCD_DAT0__LCD_DATA00 0x1b0b0
361 MX6SL_PAD_LCD_DAT1__LCD_DATA01 0x1b0b0
362 MX6SL_PAD_LCD_DAT2__LCD_DATA02 0x1b0b0
363 MX6SL_PAD_LCD_DAT3__LCD_DATA03 0x1b0b0
364 MX6SL_PAD_LCD_DAT4__LCD_DATA04 0x1b0b0
365 MX6SL_PAD_LCD_DAT5__LCD_DATA05 0x1b0b0
366 MX6SL_PAD_LCD_DAT6__LCD_DATA06 0x1b0b0
367 MX6SL_PAD_LCD_DAT7__LCD_DATA07 0x1b0b0
368 MX6SL_PAD_LCD_DAT8__LCD_DATA08 0x1b0b0
369 MX6SL_PAD_LCD_DAT9__LCD_DATA09 0x1b0b0
370 MX6SL_PAD_LCD_DAT10__LCD_DATA10 0x1b0b0
371 MX6SL_PAD_LCD_DAT11__LCD_DATA11 0x1b0b0
372 MX6SL_PAD_LCD_DAT12__LCD_DATA12 0x1b0b0
373 MX6SL_PAD_LCD_DAT13__LCD_DATA13 0x1b0b0
374 MX6SL_PAD_LCD_DAT14__LCD_DATA14 0x1b0b0
375 MX6SL_PAD_LCD_DAT15__LCD_DATA15 0x1b0b0
376 MX6SL_PAD_LCD_DAT16__LCD_DATA16 0x1b0b0
377 MX6SL_PAD_LCD_DAT17__LCD_DATA17 0x1b0b0
378 MX6SL_PAD_LCD_DAT18__LCD_DATA18 0x1b0b0
379 MX6SL_PAD_LCD_DAT19__LCD_DATA19 0x1b0b0
380 MX6SL_PAD_LCD_DAT20__LCD_DATA20 0x1b0b0
381 MX6SL_PAD_LCD_DAT21__LCD_DATA21 0x1b0b0
382 MX6SL_PAD_LCD_DAT22__LCD_DATA22 0x1b0b0
383 MX6SL_PAD_LCD_DAT23__LCD_DATA23 0x1b0b0
384 MX6SL_PAD_LCD_CLK__LCD_CLK 0x1b0b0
385 MX6SL_PAD_LCD_ENABLE__LCD_ENABLE 0x1b0b0
386 MX6SL_PAD_LCD_HSYNC__LCD_HSYNC 0x1b0b0
387 MX6SL_PAD_LCD_VSYNC__LCD_VSYNC 0x1b0b0
388 >;
389 };
390
391 pinctrl_led: ledgrp {
392 fsl,pins = <
393 MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0x17059
394 >;
395 };
396
397 pinctrl_pwm1: pwmgrp {
398 fsl,pins = <
399 MX6SL_PAD_PWM1__PWM1_OUT 0x110b0
400 >;
401 };
402
349 pinctrl_uart1: uart1grp { 403 pinctrl_uart1: uart1grp {
350 fsl,pins = < 404 fsl,pins = <
351 MX6SL_PAD_UART1_RXD__UART1_RX_DATA 0x1b0b1 405 MX6SL_PAD_UART1_RXD__UART1_RX_DATA 0x1b0b1
@@ -488,6 +542,44 @@
488 status = "okay"; 542 status = "okay";
489}; 543};
490 544
545&lcdif {
546 pinctrl-names = "default";
547 pinctrl-0 = <&pinctrl_lcd>;
548 lcd-supply = <&reg_lcd_3v3>;
549 display = <&display0>;
550 status = "okay";
551
552 display0: display0 {
553 bits-per-pixel = <32>;
554 bus-width = <24>;
555
556 display-timings {
557 native-mode = <&timing0>;
558 timing0: timing0 {
559 clock-frequency = <33500000>;
560 hactive = <800>;
561 vactive = <480>;
562 hback-porch = <89>;
563 hfront-porch = <164>;
564 vback-porch = <23>;
565 vfront-porch = <10>;
566 hsync-len = <10>;
567 vsync-len = <10>;
568 hsync-active = <0>;
569 vsync-active = <0>;
570 de-active = <1>;
571 pixelclk-active = <0>;
572 };
573 };
574 };
575};
576
577&pwm1 {
578 pinctrl-names = "default";
579 pinctrl-0 = <&pinctrl_pwm1>;
580 status = "okay";
581};
582
491&ssi2 { 583&ssi2 {
492 status = "okay"; 584 status = "okay";
493}; 585};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index c75800ca8b35..dfd83e6d8087 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -226,11 +226,14 @@
226 }; 226 };
227 227
228 ssi1: ssi@02028000 { 228 ssi1: ssi@02028000 {
229 #sound-dai-cells = <0>;
229 compatible = "fsl,imx6sl-ssi", 230 compatible = "fsl,imx6sl-ssi",
230 "fsl,imx51-ssi"; 231 "fsl,imx51-ssi";
231 reg = <0x02028000 0x4000>; 232 reg = <0x02028000 0x4000>;
232 interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>; 233 interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>;
233 clocks = <&clks IMX6SL_CLK_SSI1>; 234 clocks = <&clks IMX6SL_CLK_SSI1_IPG>,
235 <&clks IMX6SL_CLK_SSI1>;
236 clock-names = "ipg", "baud";
234 dmas = <&sdma 37 1 0>, 237 dmas = <&sdma 37 1 0>,
235 <&sdma 38 1 0>; 238 <&sdma 38 1 0>;
236 dma-names = "rx", "tx"; 239 dma-names = "rx", "tx";
@@ -239,11 +242,14 @@
239 }; 242 };
240 243
241 ssi2: ssi@0202c000 { 244 ssi2: ssi@0202c000 {
245 #sound-dai-cells = <0>;
242 compatible = "fsl,imx6sl-ssi", 246 compatible = "fsl,imx6sl-ssi",
243 "fsl,imx51-ssi"; 247 "fsl,imx51-ssi";
244 reg = <0x0202c000 0x4000>; 248 reg = <0x0202c000 0x4000>;
245 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>; 249 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>;
246 clocks = <&clks IMX6SL_CLK_SSI2>; 250 clocks = <&clks IMX6SL_CLK_SSI2_IPG>,
251 <&clks IMX6SL_CLK_SSI2>;
252 clock-names = "ipg", "baud";
247 dmas = <&sdma 41 1 0>, 253 dmas = <&sdma 41 1 0>,
248 <&sdma 42 1 0>; 254 <&sdma 42 1 0>;
249 dma-names = "rx", "tx"; 255 dma-names = "rx", "tx";
@@ -252,11 +258,14 @@
252 }; 258 };
253 259
254 ssi3: ssi@02030000 { 260 ssi3: ssi@02030000 {
261 #sound-dai-cells = <0>;
255 compatible = "fsl,imx6sl-ssi", 262 compatible = "fsl,imx6sl-ssi",
256 "fsl,imx51-ssi"; 263 "fsl,imx51-ssi";
257 reg = <0x02030000 0x4000>; 264 reg = <0x02030000 0x4000>;
258 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>; 265 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
259 clocks = <&clks IMX6SL_CLK_SSI3>; 266 clocks = <&clks IMX6SL_CLK_SSI3_IPG>,
267 <&clks IMX6SL_CLK_SSI3>;
268 clock-names = "ipg", "baud";
260 dmas = <&sdma 45 1 0>, 269 dmas = <&sdma 45 1 0>,
261 <&sdma 46 1 0>; 270 <&sdma 46 1 0>;
262 dma-names = "rx", "tx"; 271 dma-names = "rx", "tx";
@@ -529,6 +538,14 @@
529 }; 538 };
530 }; 539 };
531 540
541 tempmon: tempmon {
542 compatible = "fsl,imx6q-tempmon";
543 interrupts = <0 49 IRQ_TYPE_LEVEL_HIGH>;
544 fsl,tempmon = <&anatop>;
545 fsl,tempmon-data = <&ocotp>;
546 clocks = <&clks IMX6SL_CLK_PLL3_USB_OTG>;
547 };
548
532 usbphy1: usbphy@020c9000 { 549 usbphy1: usbphy@020c9000 {
533 compatible = "fsl,imx6sl-usbphy", "fsl,imx23-usbphy"; 550 compatible = "fsl,imx6sl-usbphy", "fsl,imx23-usbphy";
534 reg = <0x020c9000 0x1000>; 551 reg = <0x020c9000 0x1000>;
@@ -627,8 +644,14 @@
627 }; 644 };
628 645
629 lcdif: lcdif@020f8000 { 646 lcdif: lcdif@020f8000 {
647 compatible = "fsl,imx6sl-lcdif", "fsl,imx28-lcdif";
630 reg = <0x020f8000 0x4000>; 648 reg = <0x020f8000 0x4000>;
631 interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>; 649 interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>;
650 clocks = <&clks IMX6SL_CLK_LCDIF_PIX>,
651 <&clks IMX6SL_CLK_LCDIF_AXI>,
652 <&clks IMX6SL_CLK_DUMMY>;
653 clock-names = "pix", "axi", "disp_axi";
654 status = "disabled";
632 }; 655 };
633 656
634 dcp: dcp@020fc000 { 657 dcp: dcp@020fc000 {
@@ -784,7 +807,7 @@
784 }; 807 };
785 808
786 ocotp: ocotp@021bc000 { 809 ocotp: ocotp@021bc000 {
787 compatible = "fsl,imx6sl-ocotp"; 810 compatible = "fsl,imx6sl-ocotp", "syscon";
788 reg = <0x021bc000 0x4000>; 811 reg = <0x021bc000 0x4000>;
789 }; 812 };
790 813
diff --git a/arch/arm/boot/dts/imx6sx-pinfunc.h b/arch/arm/boot/dts/imx6sx-pinfunc.h
index 3e0b816dac08..bb9c6b78cb97 100644
--- a/arch/arm/boot/dts/imx6sx-pinfunc.h
+++ b/arch/arm/boot/dts/imx6sx-pinfunc.h
@@ -78,7 +78,7 @@
78#define MX6SX_PAD_GPIO1_IO07__USDHC2_WP 0x0030 0x0378 0x0870 0x1 0x1 78#define MX6SX_PAD_GPIO1_IO07__USDHC2_WP 0x0030 0x0378 0x0870 0x1 0x1
79#define MX6SX_PAD_GPIO1_IO07__ENET2_MDIO 0x0030 0x0378 0x0770 0x2 0x0 79#define MX6SX_PAD_GPIO1_IO07__ENET2_MDIO 0x0030 0x0378 0x0770 0x2 0x0
80#define MX6SX_PAD_GPIO1_IO07__AUDMUX_MCLK 0x0030 0x0378 0x0000 0x3 0x0 80#define MX6SX_PAD_GPIO1_IO07__AUDMUX_MCLK 0x0030 0x0378 0x0000 0x3 0x0
81#define MX6SX_PAD_GPIO1_IO07__UART1_CTS_B 0x0030 0x0378 0x082C 0x4 0x1 81#define MX6SX_PAD_GPIO1_IO07__UART1_CTS_B 0x0030 0x0378 0x0000 0x4 0x0
82#define MX6SX_PAD_GPIO1_IO07__GPIO1_IO_7 0x0030 0x0378 0x0000 0x5 0x0 82#define MX6SX_PAD_GPIO1_IO07__GPIO1_IO_7 0x0030 0x0378 0x0000 0x5 0x0
83#define MX6SX_PAD_GPIO1_IO07__SRC_EARLY_RESET 0x0030 0x0378 0x0000 0x6 0x0 83#define MX6SX_PAD_GPIO1_IO07__SRC_EARLY_RESET 0x0030 0x0378 0x0000 0x6 0x0
84#define MX6SX_PAD_GPIO1_IO07__DCIC2_OUT 0x0030 0x0378 0x0000 0x7 0x0 84#define MX6SX_PAD_GPIO1_IO07__DCIC2_OUT 0x0030 0x0378 0x0000 0x7 0x0
@@ -96,7 +96,7 @@
96#define MX6SX_PAD_GPIO1_IO09__WDOG2_WDOG_B 0x0038 0x0380 0x0000 0x1 0x0 96#define MX6SX_PAD_GPIO1_IO09__WDOG2_WDOG_B 0x0038 0x0380 0x0000 0x1 0x0
97#define MX6SX_PAD_GPIO1_IO09__SDMA_EXT_EVENT_1 0x0038 0x0380 0x0820 0x2 0x0 97#define MX6SX_PAD_GPIO1_IO09__SDMA_EXT_EVENT_1 0x0038 0x0380 0x0820 0x2 0x0
98#define MX6SX_PAD_GPIO1_IO09__CCM_OUT0 0x0038 0x0380 0x0000 0x3 0x0 98#define MX6SX_PAD_GPIO1_IO09__CCM_OUT0 0x0038 0x0380 0x0000 0x3 0x0
99#define MX6SX_PAD_GPIO1_IO09__UART2_CTS_B 0x0038 0x0380 0x0834 0x4 0x1 99#define MX6SX_PAD_GPIO1_IO09__UART2_CTS_B 0x0038 0x0380 0x0000 0x4 0x0
100#define MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x0038 0x0380 0x0000 0x5 0x0 100#define MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x0038 0x0380 0x0000 0x5 0x0
101#define MX6SX_PAD_GPIO1_IO09__SRC_INT_BOOT 0x0038 0x0380 0x0000 0x6 0x0 101#define MX6SX_PAD_GPIO1_IO09__SRC_INT_BOOT 0x0038 0x0380 0x0000 0x6 0x0
102#define MX6SX_PAD_GPIO1_IO09__OBSERVE_MUX_OUT_4 0x0038 0x0380 0x0000 0x7 0x0 102#define MX6SX_PAD_GPIO1_IO09__OBSERVE_MUX_OUT_4 0x0038 0x0380 0x0000 0x7 0x0
@@ -213,7 +213,7 @@
213#define MX6SX_PAD_CSI_DATA07__ESAI_TX3_RX2 0x0068 0x03B0 0x079C 0x1 0x1 213#define MX6SX_PAD_CSI_DATA07__ESAI_TX3_RX2 0x0068 0x03B0 0x079C 0x1 0x1
214#define MX6SX_PAD_CSI_DATA07__I2C4_SDA 0x0068 0x03B0 0x07C4 0x2 0x2 214#define MX6SX_PAD_CSI_DATA07__I2C4_SDA 0x0068 0x03B0 0x07C4 0x2 0x2
215#define MX6SX_PAD_CSI_DATA07__KPP_ROW_7 0x0068 0x03B0 0x07DC 0x3 0x0 215#define MX6SX_PAD_CSI_DATA07__KPP_ROW_7 0x0068 0x03B0 0x07DC 0x3 0x0
216#define MX6SX_PAD_CSI_DATA07__UART6_CTS_B 0x0068 0x03B0 0x0854 0x4 0x1 216#define MX6SX_PAD_CSI_DATA07__UART6_CTS_B 0x0068 0x03B0 0x0000 0x4 0x0
217#define MX6SX_PAD_CSI_DATA07__GPIO1_IO_21 0x0068 0x03B0 0x0000 0x5 0x0 217#define MX6SX_PAD_CSI_DATA07__GPIO1_IO_21 0x0068 0x03B0 0x0000 0x5 0x0
218#define MX6SX_PAD_CSI_DATA07__WEIM_DATA_16 0x0068 0x03B0 0x0000 0x6 0x0 218#define MX6SX_PAD_CSI_DATA07__WEIM_DATA_16 0x0068 0x03B0 0x0000 0x6 0x0
219#define MX6SX_PAD_CSI_DATA07__DCIC1_OUT 0x0068 0x03B0 0x0000 0x7 0x0 219#define MX6SX_PAD_CSI_DATA07__DCIC1_OUT 0x0068 0x03B0 0x0000 0x7 0x0
@@ -254,7 +254,7 @@
254#define MX6SX_PAD_CSI_VSYNC__CSI1_VSYNC 0x0078 0x03C0 0x0708 0x0 0x0 254#define MX6SX_PAD_CSI_VSYNC__CSI1_VSYNC 0x0078 0x03C0 0x0708 0x0 0x0
255#define MX6SX_PAD_CSI_VSYNC__ESAI_TX5_RX0 0x0078 0x03C0 0x07A4 0x1 0x1 255#define MX6SX_PAD_CSI_VSYNC__ESAI_TX5_RX0 0x0078 0x03C0 0x07A4 0x1 0x1
256#define MX6SX_PAD_CSI_VSYNC__AUDMUX_AUD6_RXD 0x0078 0x03C0 0x0674 0x2 0x1 256#define MX6SX_PAD_CSI_VSYNC__AUDMUX_AUD6_RXD 0x0078 0x03C0 0x0674 0x2 0x1
257#define MX6SX_PAD_CSI_VSYNC__UART4_CTS_B 0x0078 0x03C0 0x0844 0x3 0x3 257#define MX6SX_PAD_CSI_VSYNC__UART4_CTS_B 0x0078 0x03C0 0x0000 0x3 0x0
258#define MX6SX_PAD_CSI_VSYNC__MQS_RIGHT 0x0078 0x03C0 0x0000 0x4 0x0 258#define MX6SX_PAD_CSI_VSYNC__MQS_RIGHT 0x0078 0x03C0 0x0000 0x4 0x0
259#define MX6SX_PAD_CSI_VSYNC__GPIO1_IO_25 0x0078 0x03C0 0x0000 0x5 0x0 259#define MX6SX_PAD_CSI_VSYNC__GPIO1_IO_25 0x0078 0x03C0 0x0000 0x5 0x0
260#define MX6SX_PAD_CSI_VSYNC__WEIM_DATA_24 0x0078 0x03C0 0x0000 0x6 0x0 260#define MX6SX_PAD_CSI_VSYNC__WEIM_DATA_24 0x0078 0x03C0 0x0000 0x6 0x0
@@ -352,7 +352,7 @@
352#define MX6SX_PAD_ENET2_TX_CLK__ENET2_TX_CLK 0x00A0 0x03E8 0x0000 0x0 0x0 352#define MX6SX_PAD_ENET2_TX_CLK__ENET2_TX_CLK 0x00A0 0x03E8 0x0000 0x0 0x0
353#define MX6SX_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x00A0 0x03E8 0x076C 0x1 0x1 353#define MX6SX_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x00A0 0x03E8 0x076C 0x1 0x1
354#define MX6SX_PAD_ENET2_TX_CLK__I2C3_SDA 0x00A0 0x03E8 0x07BC 0x2 0x1 354#define MX6SX_PAD_ENET2_TX_CLK__I2C3_SDA 0x00A0 0x03E8 0x07BC 0x2 0x1
355#define MX6SX_PAD_ENET2_TX_CLK__UART1_CTS_B 0x00A0 0x03E8 0x082C 0x3 0x3 355#define MX6SX_PAD_ENET2_TX_CLK__UART1_CTS_B 0x00A0 0x03E8 0x0000 0x3 0x0
356#define MX6SX_PAD_ENET2_TX_CLK__MLB_CLK 0x00A0 0x03E8 0x07E8 0x4 0x1 356#define MX6SX_PAD_ENET2_TX_CLK__MLB_CLK 0x00A0 0x03E8 0x07E8 0x4 0x1
357#define MX6SX_PAD_ENET2_TX_CLK__GPIO2_IO_9 0x00A0 0x03E8 0x0000 0x5 0x0 357#define MX6SX_PAD_ENET2_TX_CLK__GPIO2_IO_9 0x00A0 0x03E8 0x0000 0x5 0x0
358#define MX6SX_PAD_ENET2_TX_CLK__USB_OTG2_PWR 0x00A0 0x03E8 0x0000 0x6 0x0 358#define MX6SX_PAD_ENET2_TX_CLK__USB_OTG2_PWR 0x00A0 0x03E8 0x0000 0x6 0x0
@@ -404,7 +404,7 @@
404#define MX6SX_PAD_KEY_COL4__SAI2_RX_BCLK 0x00B4 0x03FC 0x0808 0x7 0x0 404#define MX6SX_PAD_KEY_COL4__SAI2_RX_BCLK 0x00B4 0x03FC 0x0808 0x7 0x0
405#define MX6SX_PAD_KEY_ROW0__KPP_ROW_0 0x00B8 0x0400 0x0000 0x0 0x0 405#define MX6SX_PAD_KEY_ROW0__KPP_ROW_0 0x00B8 0x0400 0x0000 0x0 0x0
406#define MX6SX_PAD_KEY_ROW0__USDHC3_WP 0x00B8 0x0400 0x0000 0x1 0x0 406#define MX6SX_PAD_KEY_ROW0__USDHC3_WP 0x00B8 0x0400 0x0000 0x1 0x0
407#define MX6SX_PAD_KEY_ROW0__UART6_CTS_B 0x00B8 0x0400 0x0854 0x2 0x3 407#define MX6SX_PAD_KEY_ROW0__UART6_CTS_B 0x00B8 0x0400 0x0000 0x2 0x0
408#define MX6SX_PAD_KEY_ROW0__ECSPI1_MOSI 0x00B8 0x0400 0x0718 0x3 0x0 408#define MX6SX_PAD_KEY_ROW0__ECSPI1_MOSI 0x00B8 0x0400 0x0718 0x3 0x0
409#define MX6SX_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x00B8 0x0400 0x0660 0x4 0x0 409#define MX6SX_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x00B8 0x0400 0x0660 0x4 0x0
410#define MX6SX_PAD_KEY_ROW0__GPIO2_IO_15 0x00B8 0x0400 0x0000 0x5 0x0 410#define MX6SX_PAD_KEY_ROW0__GPIO2_IO_15 0x00B8 0x0400 0x0000 0x5 0x0
@@ -423,7 +423,7 @@
423#define MX6SX_PAD_KEY_ROW1__M4_NMI 0x00BC 0x0404 0x0000 0x8 0x0 423#define MX6SX_PAD_KEY_ROW1__M4_NMI 0x00BC 0x0404 0x0000 0x8 0x0
424#define MX6SX_PAD_KEY_ROW2__KPP_ROW_2 0x00C0 0x0408 0x0000 0x0 0x0 424#define MX6SX_PAD_KEY_ROW2__KPP_ROW_2 0x00C0 0x0408 0x0000 0x0 0x0
425#define MX6SX_PAD_KEY_ROW2__USDHC4_WP 0x00C0 0x0408 0x0878 0x1 0x1 425#define MX6SX_PAD_KEY_ROW2__USDHC4_WP 0x00C0 0x0408 0x0878 0x1 0x1
426#define MX6SX_PAD_KEY_ROW2__UART5_CTS_B 0x00C0 0x0408 0x084C 0x2 0x3 426#define MX6SX_PAD_KEY_ROW2__UART5_CTS_B 0x00C0 0x0408 0x0000 0x2 0x0
427#define MX6SX_PAD_KEY_ROW2__CAN1_RX 0x00C0 0x0408 0x068C 0x3 0x1 427#define MX6SX_PAD_KEY_ROW2__CAN1_RX 0x00C0 0x0408 0x068C 0x3 0x1
428#define MX6SX_PAD_KEY_ROW2__CANFD_RX1 0x00C0 0x0408 0x0694 0x4 0x1 428#define MX6SX_PAD_KEY_ROW2__CANFD_RX1 0x00C0 0x0408 0x0694 0x4 0x1
429#define MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x00C0 0x0408 0x0000 0x5 0x0 429#define MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x00C0 0x0408 0x0000 0x5 0x0
@@ -815,7 +815,7 @@
815#define MX6SX_PAD_NAND_DATA05__RAWNAND_DATA05 0x0164 0x04AC 0x0000 0x0 0x0 815#define MX6SX_PAD_NAND_DATA05__RAWNAND_DATA05 0x0164 0x04AC 0x0000 0x0 0x0
816#define MX6SX_PAD_NAND_DATA05__USDHC2_DATA5 0x0164 0x04AC 0x0000 0x1 0x0 816#define MX6SX_PAD_NAND_DATA05__USDHC2_DATA5 0x0164 0x04AC 0x0000 0x1 0x0
817#define MX6SX_PAD_NAND_DATA05__QSPI2_B_DQS 0x0164 0x04AC 0x0000 0x2 0x0 817#define MX6SX_PAD_NAND_DATA05__QSPI2_B_DQS 0x0164 0x04AC 0x0000 0x2 0x0
818#define MX6SX_PAD_NAND_DATA05__UART3_CTS_B 0x0164 0x04AC 0x083C 0x3 0x1 818#define MX6SX_PAD_NAND_DATA05__UART3_CTS_B 0x0164 0x04AC 0x0000 0x3 0x0
819#define MX6SX_PAD_NAND_DATA05__AUDMUX_AUD4_RXC 0x0164 0x04AC 0x064C 0x4 0x0 819#define MX6SX_PAD_NAND_DATA05__AUDMUX_AUD4_RXC 0x0164 0x04AC 0x064C 0x4 0x0
820#define MX6SX_PAD_NAND_DATA05__GPIO4_IO_9 0x0164 0x04AC 0x0000 0x5 0x0 820#define MX6SX_PAD_NAND_DATA05__GPIO4_IO_9 0x0164 0x04AC 0x0000 0x5 0x0
821#define MX6SX_PAD_NAND_DATA05__WEIM_AD_5 0x0164 0x04AC 0x0000 0x6 0x0 821#define MX6SX_PAD_NAND_DATA05__WEIM_AD_5 0x0164 0x04AC 0x0000 0x6 0x0
@@ -957,7 +957,7 @@
957#define MX6SX_PAD_QSPI1A_SS1_B__SIM_M_HADDR_12 0x019C 0x04E4 0x0000 0x7 0x0 957#define MX6SX_PAD_QSPI1A_SS1_B__SIM_M_HADDR_12 0x019C 0x04E4 0x0000 0x7 0x0
958#define MX6SX_PAD_QSPI1A_SS1_B__SDMA_DEBUG_PC_3 0x019C 0x04E4 0x0000 0x9 0x0 958#define MX6SX_PAD_QSPI1A_SS1_B__SDMA_DEBUG_PC_3 0x019C 0x04E4 0x0000 0x9 0x0
959#define MX6SX_PAD_QSPI1B_DATA0__QSPI1_B_DATA_0 0x01A0 0x04E8 0x0000 0x0 0x0 959#define MX6SX_PAD_QSPI1B_DATA0__QSPI1_B_DATA_0 0x01A0 0x04E8 0x0000 0x0 0x0
960#define MX6SX_PAD_QSPI1B_DATA0__UART3_CTS_B 0x01A0 0x04E8 0x083C 0x1 0x4 960#define MX6SX_PAD_QSPI1B_DATA0__UART3_CTS_B 0x01A0 0x04E8 0x0000 0x1 0x0
961#define MX6SX_PAD_QSPI1B_DATA0__ECSPI3_MOSI 0x01A0 0x04E8 0x0738 0x2 0x1 961#define MX6SX_PAD_QSPI1B_DATA0__ECSPI3_MOSI 0x01A0 0x04E8 0x0738 0x2 0x1
962#define MX6SX_PAD_QSPI1B_DATA0__ESAI_RX_FS 0x01A0 0x04E8 0x0778 0x3 0x2 962#define MX6SX_PAD_QSPI1B_DATA0__ESAI_RX_FS 0x01A0 0x04E8 0x0778 0x3 0x2
963#define MX6SX_PAD_QSPI1B_DATA0__CSI1_DATA_22 0x01A0 0x04E8 0x06F4 0x4 0x1 963#define MX6SX_PAD_QSPI1B_DATA0__CSI1_DATA_22 0x01A0 0x04E8 0x06F4 0x4 0x1
@@ -1236,7 +1236,7 @@
1236#define MX6SX_PAD_SD1_DATA2__AUDMUX_AUD5_TXFS 0x0230 0x0578 0x0670 0x1 0x1 1236#define MX6SX_PAD_SD1_DATA2__AUDMUX_AUD5_TXFS 0x0230 0x0578 0x0670 0x1 0x1
1237#define MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x0230 0x0578 0x0000 0x2 0x0 1237#define MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x0230 0x0578 0x0000 0x2 0x0
1238#define MX6SX_PAD_SD1_DATA2__GPT_COMPARE2 0x0230 0x0578 0x0000 0x3 0x0 1238#define MX6SX_PAD_SD1_DATA2__GPT_COMPARE2 0x0230 0x0578 0x0000 0x3 0x0
1239#define MX6SX_PAD_SD1_DATA2__UART2_CTS_B 0x0230 0x0578 0x0834 0x4 0x2 1239#define MX6SX_PAD_SD1_DATA2__UART2_CTS_B 0x0230 0x0578 0x0000 0x4 0x0
1240#define MX6SX_PAD_SD1_DATA2__GPIO6_IO_4 0x0230 0x0578 0x0000 0x5 0x0 1240#define MX6SX_PAD_SD1_DATA2__GPIO6_IO_4 0x0230 0x0578 0x0000 0x5 0x0
1241#define MX6SX_PAD_SD1_DATA2__ECSPI4_RDY 0x0230 0x0578 0x0000 0x6 0x0 1241#define MX6SX_PAD_SD1_DATA2__ECSPI4_RDY 0x0230 0x0578 0x0000 0x6 0x0
1242#define MX6SX_PAD_SD1_DATA2__CCM_OUT0 0x0230 0x0578 0x0000 0x7 0x0 1242#define MX6SX_PAD_SD1_DATA2__CCM_OUT0 0x0230 0x0578 0x0000 0x7 0x0
@@ -1315,7 +1315,7 @@
1315#define MX6SX_PAD_SD2_DATA3__VADC_CLAMP_CURRENT_3 0x024C 0x0594 0x0000 0x8 0x0 1315#define MX6SX_PAD_SD2_DATA3__VADC_CLAMP_CURRENT_3 0x024C 0x0594 0x0000 0x8 0x0
1316#define MX6SX_PAD_SD2_DATA3__MMDC_DEBUG_31 0x024C 0x0594 0x0000 0x9 0x0 1316#define MX6SX_PAD_SD2_DATA3__MMDC_DEBUG_31 0x024C 0x0594 0x0000 0x9 0x0
1317#define MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x0250 0x0598 0x0000 0x0 0x0 1317#define MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x0250 0x0598 0x0000 0x0 0x0
1318#define MX6SX_PAD_SD3_CLK__UART4_CTS_B 0x0250 0x0598 0x0844 0x1 0x0 1318#define MX6SX_PAD_SD3_CLK__UART4_CTS_B 0x0250 0x0598 0x0000 0x1 0x0
1319#define MX6SX_PAD_SD3_CLK__ECSPI4_SCLK 0x0250 0x0598 0x0740 0x2 0x0 1319#define MX6SX_PAD_SD3_CLK__ECSPI4_SCLK 0x0250 0x0598 0x0740 0x2 0x0
1320#define MX6SX_PAD_SD3_CLK__AUDMUX_AUD6_RXFS 0x0250 0x0598 0x0680 0x3 0x0 1320#define MX6SX_PAD_SD3_CLK__AUDMUX_AUD6_RXFS 0x0250 0x0598 0x0680 0x3 0x0
1321#define MX6SX_PAD_SD3_CLK__LCDIF2_VSYNC 0x0250 0x0598 0x0000 0x4 0x0 1321#define MX6SX_PAD_SD3_CLK__LCDIF2_VSYNC 0x0250 0x0598 0x0000 0x4 0x0
@@ -1409,7 +1409,7 @@
1409#define MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x0274 0x05BC 0x0000 0x0 0x0 1409#define MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x0274 0x05BC 0x0000 0x0 0x0
1410#define MX6SX_PAD_SD3_DATA7__CAN1_RX 0x0274 0x05BC 0x068C 0x1 0x0 1410#define MX6SX_PAD_SD3_DATA7__CAN1_RX 0x0274 0x05BC 0x068C 0x1 0x0
1411#define MX6SX_PAD_SD3_DATA7__CANFD_RX1 0x0274 0x05BC 0x0694 0x2 0x0 1411#define MX6SX_PAD_SD3_DATA7__CANFD_RX1 0x0274 0x05BC 0x0694 0x2 0x0
1412#define MX6SX_PAD_SD3_DATA7__UART3_CTS_B 0x0274 0x05BC 0x083C 0x3 0x3 1412#define MX6SX_PAD_SD3_DATA7__UART3_CTS_B 0x0274 0x05BC 0x0000 0x3 0x0
1413#define MX6SX_PAD_SD3_DATA7__LCDIF2_DATA_5 0x0274 0x05BC 0x0000 0x4 0x0 1413#define MX6SX_PAD_SD3_DATA7__LCDIF2_DATA_5 0x0274 0x05BC 0x0000 0x4 0x0
1414#define MX6SX_PAD_SD3_DATA7__GPIO7_IO_9 0x0274 0x05BC 0x0000 0x5 0x0 1414#define MX6SX_PAD_SD3_DATA7__GPIO7_IO_9 0x0274 0x05BC 0x0000 0x5 0x0
1415#define MX6SX_PAD_SD3_DATA7__ENET1_1588_EVENT0_IN 0x0274 0x05BC 0x0000 0x6 0x0 1415#define MX6SX_PAD_SD3_DATA7__ENET1_1588_EVENT0_IN 0x0274 0x05BC 0x0000 0x6 0x0
@@ -1510,7 +1510,7 @@
1510#define MX6SX_PAD_SD4_DATA6__SDMA_DEBUG_EVENT_CHANNEL_1 0x0298 0x05E0 0x0000 0x9 0x0 1510#define MX6SX_PAD_SD4_DATA6__SDMA_DEBUG_EVENT_CHANNEL_1 0x0298 0x05E0 0x0000 0x9 0x0
1511#define MX6SX_PAD_SD4_DATA7__USDHC4_DATA7 0x029C 0x05E4 0x0000 0x0 0x0 1511#define MX6SX_PAD_SD4_DATA7__USDHC4_DATA7 0x029C 0x05E4 0x0000 0x0 0x0
1512#define MX6SX_PAD_SD4_DATA7__RAWNAND_DATA08 0x029C 0x05E4 0x0000 0x1 0x0 1512#define MX6SX_PAD_SD4_DATA7__RAWNAND_DATA08 0x029C 0x05E4 0x0000 0x1 0x0
1513#define MX6SX_PAD_SD4_DATA7__UART5_CTS_B 0x029C 0x05E4 0x084C 0x2 0x1 1513#define MX6SX_PAD_SD4_DATA7__UART5_CTS_B 0x029C 0x05E4 0x0000 0x2 0x0
1514#define MX6SX_PAD_SD4_DATA7__ECSPI3_SS0 0x029C 0x05E4 0x073C 0x3 0x0 1514#define MX6SX_PAD_SD4_DATA7__ECSPI3_SS0 0x029C 0x05E4 0x073C 0x3 0x0
1515#define MX6SX_PAD_SD4_DATA7__LCDIF2_DATA_15 0x029C 0x05E4 0x0000 0x4 0x0 1515#define MX6SX_PAD_SD4_DATA7__LCDIF2_DATA_15 0x029C 0x05E4 0x0000 0x4 0x0
1516#define MX6SX_PAD_SD4_DATA7__GPIO6_IO_21 0x029C 0x05E4 0x0000 0x5 0x0 1516#define MX6SX_PAD_SD4_DATA7__GPIO6_IO_21 0x029C 0x05E4 0x0000 0x5 0x0
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
index a3980d970590..82d6b34527b7 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -24,6 +24,13 @@
24 reg = <0x80000000 0x40000000>; 24 reg = <0x80000000 0x40000000>;
25 }; 25 };
26 26
27 backlight {
28 compatible = "pwm-backlight";
29 pwms = <&pwm3 0 5000000>;
30 brightness-levels = <0 4 8 16 32 64 128 255>;
31 default-brightness-level = <6>;
32 };
33
27 gpio-keys { 34 gpio-keys {
28 compatible = "gpio-keys"; 35 compatible = "gpio-keys";
29 pinctrl-names = "default"; 36 pinctrl-names = "default";
@@ -90,6 +97,14 @@
90 regulator-min-microvolt = <5000000>; 97 regulator-min-microvolt = <5000000>;
91 regulator-max-microvolt = <5000000>; 98 regulator-max-microvolt = <5000000>;
92 }; 99 };
100
101 reg_lcd_3v3: regulator@4 {
102 compatible = "regulator-fixed";
103 reg = <4>;
104 regulator-name = "lcd-3v3";
105 gpio = <&gpio3 27 0>;
106 enable-active-high;
107 };
93 }; 108 };
94 109
95 sound { 110 sound {
@@ -251,6 +266,44 @@
251 }; 266 };
252}; 267};
253 268
269&lcdif1 {
270 pinctrl-names = "default";
271 pinctrl-0 = <&pinctrl_lcd>;
272 lcd-supply = <&reg_lcd_3v3>;
273 display = <&display0>;
274 status = "okay";
275
276 display0: display0 {
277 bits-per-pixel = <16>;
278 bus-width = <24>;
279
280 display-timings {
281 native-mode = <&timing0>;
282 timing0: timing0 {
283 clock-frequency = <33500000>;
284 hactive = <800>;
285 vactive = <480>;
286 hback-porch = <89>;
287 hfront-porch = <164>;
288 vback-porch = <23>;
289 vfront-porch = <10>;
290 hsync-len = <10>;
291 vsync-len = <10>;
292 hsync-active = <0>;
293 vsync-active = <0>;
294 de-active = <1>;
295 pixelclk-active = <0>;
296 };
297 };
298 };
299};
300
301&pwm3 {
302 pinctrl-names = "default";
303 pinctrl-0 = <&pinctrl_pwm3>;
304 status = "okay";
305};
306
254&ssi2 { 307&ssi2 {
255 status = "okay"; 308 status = "okay";
256}; 309};
@@ -365,6 +418,46 @@
365 >; 418 >;
366 }; 419 };
367 420
421 pinctrl_lcd: lcdgrp {
422 fsl,pins = <
423 MX6SX_PAD_LCD1_DATA00__LCDIF1_DATA_0 0x4001b0b0
424 MX6SX_PAD_LCD1_DATA01__LCDIF1_DATA_1 0x4001b0b0
425 MX6SX_PAD_LCD1_DATA02__LCDIF1_DATA_2 0x4001b0b0
426 MX6SX_PAD_LCD1_DATA03__LCDIF1_DATA_3 0x4001b0b0
427 MX6SX_PAD_LCD1_DATA04__LCDIF1_DATA_4 0x4001b0b0
428 MX6SX_PAD_LCD1_DATA05__LCDIF1_DATA_5 0x4001b0b0
429 MX6SX_PAD_LCD1_DATA06__LCDIF1_DATA_6 0x4001b0b0
430 MX6SX_PAD_LCD1_DATA07__LCDIF1_DATA_7 0x4001b0b0
431 MX6SX_PAD_LCD1_DATA08__LCDIF1_DATA_8 0x4001b0b0
432 MX6SX_PAD_LCD1_DATA09__LCDIF1_DATA_9 0x4001b0b0
433 MX6SX_PAD_LCD1_DATA10__LCDIF1_DATA_10 0x4001b0b0
434 MX6SX_PAD_LCD1_DATA11__LCDIF1_DATA_11 0x4001b0b0
435 MX6SX_PAD_LCD1_DATA12__LCDIF1_DATA_12 0x4001b0b0
436 MX6SX_PAD_LCD1_DATA13__LCDIF1_DATA_13 0x4001b0b0
437 MX6SX_PAD_LCD1_DATA14__LCDIF1_DATA_14 0x4001b0b0
438 MX6SX_PAD_LCD1_DATA15__LCDIF1_DATA_15 0x4001b0b0
439 MX6SX_PAD_LCD1_DATA16__LCDIF1_DATA_16 0x4001b0b0
440 MX6SX_PAD_LCD1_DATA17__LCDIF1_DATA_17 0x4001b0b0
441 MX6SX_PAD_LCD1_DATA18__LCDIF1_DATA_18 0x4001b0b0
442 MX6SX_PAD_LCD1_DATA19__LCDIF1_DATA_19 0x4001b0b0
443 MX6SX_PAD_LCD1_DATA20__LCDIF1_DATA_20 0x4001b0b0
444 MX6SX_PAD_LCD1_DATA21__LCDIF1_DATA_21 0x4001b0b0
445 MX6SX_PAD_LCD1_DATA22__LCDIF1_DATA_22 0x4001b0b0
446 MX6SX_PAD_LCD1_DATA23__LCDIF1_DATA_23 0x4001b0b0
447 MX6SX_PAD_LCD1_CLK__LCDIF1_CLK 0x4001b0b0
448 MX6SX_PAD_LCD1_ENABLE__LCDIF1_ENABLE 0x4001b0b0
449 MX6SX_PAD_LCD1_VSYNC__LCDIF1_VSYNC 0x4001b0b0
450 MX6SX_PAD_LCD1_HSYNC__LCDIF1_HSYNC 0x4001b0b0
451 MX6SX_PAD_LCD1_RESET__GPIO3_IO_27 0x4001b0b0
452 >;
453 };
454
455 pinctrl_pwm3: pwm3grp-1 {
456 fsl,pins = <
457 MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x110b0
458 >;
459 };
460
368 pinctrl_vcc_sd3: vccsd3grp { 461 pinctrl_vcc_sd3: vccsd3grp {
369 fsl,pins = < 462 fsl,pins = <
370 MX6SX_PAD_KEY_COL1__GPIO2_IO_11 0x17059 463 MX6SX_PAD_KEY_COL1__GPIO2_IO_11 0x17059
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index f4b9da65bc0f..f3e88c03b1e4 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -298,6 +298,7 @@
298 }; 298 };
299 299
300 ssi1: ssi@02028000 { 300 ssi1: ssi@02028000 {
301 #sound-dai-cells = <0>;
301 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi"; 302 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi";
302 reg = <0x02028000 0x4000>; 303 reg = <0x02028000 0x4000>;
303 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; 304 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
@@ -311,6 +312,7 @@
311 }; 312 };
312 313
313 ssi2: ssi@0202c000 { 314 ssi2: ssi@0202c000 {
315 #sound-dai-cells = <0>;
314 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi"; 316 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi";
315 reg = <0x0202c000 0x4000>; 317 reg = <0x0202c000 0x4000>;
316 interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>; 318 interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
@@ -324,6 +326,7 @@
324 }; 326 };
325 327
326 ssi3: ssi@02030000 { 328 ssi3: ssi@02030000 {
329 #sound-dai-cells = <0>;
327 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi"; 330 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi";
328 reg = <0x02030000 0x4000>; 331 reg = <0x02030000 0x4000>;
329 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; 332 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
@@ -418,7 +421,7 @@
418 reg = <0x02098000 0x4000>; 421 reg = <0x02098000 0x4000>;
419 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; 422 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
420 clocks = <&clks IMX6SX_CLK_GPT_BUS>, 423 clocks = <&clks IMX6SX_CLK_GPT_BUS>,
421 <&clks IMX6SX_CLK_GPT_SERIAL>; 424 <&clks IMX6SX_CLK_GPT_3M>;
422 clock-names = "ipg", "per"; 425 clock-names = "ipg", "per";
423 }; 426 };
424 427
@@ -776,6 +779,8 @@
776 <&clks IMX6SX_CLK_ENET_PTP>; 779 <&clks IMX6SX_CLK_ENET_PTP>;
777 clock-names = "ipg", "ahb", "ptp", 780 clock-names = "ipg", "ahb", "ptp",
778 "enet_clk_ref", "enet_out"; 781 "enet_clk_ref", "enet_out";
782 fsl,num-tx-queues=<3>;
783 fsl,num-rx-queues=<3>;
779 status = "disabled"; 784 status = "disabled";
780 }; 785 };
781 786
@@ -1062,6 +1067,7 @@
1062 }; 1067 };
1063 1068
1064 lcdif1: lcdif@02220000 { 1069 lcdif1: lcdif@02220000 {
1070 compatible = "fsl,imx6sx-lcdif", "fsl,imx28-lcdif";
1065 reg = <0x02220000 0x4000>; 1071 reg = <0x02220000 0x4000>;
1066 interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>; 1072 interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
1067 clocks = <&clks IMX6SX_CLK_LCDIF1_PIX>, 1073 clocks = <&clks IMX6SX_CLK_LCDIF1_PIX>,
@@ -1072,6 +1078,7 @@
1072 }; 1078 };
1073 1079
1074 lcdif2: lcdif@02224000 { 1080 lcdif2: lcdif@02224000 {
1081 compatible = "fsl,imx6sx-lcdif", "fsl,imx28-lcdif";
1075 reg = <0x02224000 0x4000>; 1082 reg = <0x02224000 0x4000>;
1076 interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>; 1083 interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
1077 clocks = <&clks IMX6SX_CLK_LCDIF2_PIX>, 1084 clocks = <&clks IMX6SX_CLK_LCDIF2_PIX>,
diff --git a/arch/arm/boot/dts/k2e-clocks.dtsi b/arch/arm/boot/dts/k2e-clocks.dtsi
index 598afe91c676..4773d6af66a0 100644
--- a/arch/arm/boot/dts/k2e-clocks.dtsi
+++ b/arch/arm/boot/dts/k2e-clocks.dtsi
@@ -40,7 +40,7 @@ clocks {
40 #clock-cells = <0>; 40 #clock-cells = <0>;
41 compatible = "ti,keystone,psc-clock"; 41 compatible = "ti,keystone,psc-clock";
42 clocks = <&chipclk16>; 42 clocks = <&chipclk16>;
43 clock-output-names = "usb"; 43 clock-output-names = "usb1";
44 reg = <0x02350004 0xb00>, <0x02350000 0x400>; 44 reg = <0x02350004 0xb00>, <0x02350000 0x400>;
45 reg-names = "control", "domain"; 45 reg-names = "control", "domain";
46 domain-id = <0>; 46 domain-id = <0>;
@@ -60,8 +60,8 @@ clocks {
60 #clock-cells = <0>; 60 #clock-cells = <0>;
61 compatible = "ti,keystone,psc-clock"; 61 compatible = "ti,keystone,psc-clock";
62 clocks = <&chipclk12>; 62 clocks = <&chipclk12>;
63 clock-output-names = "pcie"; 63 clock-output-names = "pcie1";
64 reg = <0x0235006c 0xb00>, <0x02350000 0x400>; 64 reg = <0x0235006c 0xb00>, <0x02350048 0x400>;
65 reg-names = "control", "domain"; 65 reg-names = "control", "domain";
66 domain-id = <18>; 66 domain-id = <18>;
67 }; 67 };
diff --git a/arch/arm/boot/dts/k2e.dtsi b/arch/arm/boot/dts/k2e.dtsi
index 03d01909525b..c358b4b9a073 100644
--- a/arch/arm/boot/dts/k2e.dtsi
+++ b/arch/arm/boot/dts/k2e.dtsi
@@ -67,6 +67,8 @@
67 clock-names = "usb"; 67 clock-names = "usb";
68 interrupts = <GIC_SPI 414 IRQ_TYPE_EDGE_RISING>; 68 interrupts = <GIC_SPI 414 IRQ_TYPE_EDGE_RISING>;
69 ranges; 69 ranges;
70 dma-coherent;
71 dma-ranges;
70 status = "disabled"; 72 status = "disabled";
71 73
72 dwc3@25010000 { 74 dwc3@25010000 {
@@ -76,5 +78,16 @@
76 usb-phy = <&usb1_phy>, <&usb1_phy>; 78 usb-phy = <&usb1_phy>, <&usb1_phy>;
77 }; 79 };
78 }; 80 };
81
82 dspgpio0: keystone_dsp_gpio@02620240 {
83 compatible = "ti,keystone-dsp-gpio";
84 gpio-controller;
85 #gpio-cells = <2>;
86 gpio,syscon-dev = <&devctrl 0x240>;
87 };
79 }; 88 };
80}; 89};
90
91&mdio {
92 reg = <0x24200f00 0x100>;
93};
diff --git a/arch/arm/boot/dts/k2hk.dtsi b/arch/arm/boot/dts/k2hk.dtsi
index c73899c73118..d721f4b737f7 100644
--- a/arch/arm/boot/dts/k2hk.dtsi
+++ b/arch/arm/boot/dts/k2hk.dtsi
@@ -42,5 +42,61 @@
42 42
43 soc { 43 soc {
44 /include/ "k2hk-clocks.dtsi" 44 /include/ "k2hk-clocks.dtsi"
45
46 dspgpio0: keystone_dsp_gpio@02620240 {
47 compatible = "ti,keystone-dsp-gpio";
48 gpio-controller;
49 #gpio-cells = <2>;
50 gpio,syscon-dev = <&devctrl 0x240>;
51 };
52
53 dspgpio1: keystone_dsp_gpio@2620244 {
54 compatible = "ti,keystone-dsp-gpio";
55 gpio-controller;
56 #gpio-cells = <2>;
57 gpio,syscon-dev = <&devctrl 0x244>;
58 };
59
60 dspgpio2: keystone_dsp_gpio@2620248 {
61 compatible = "ti,keystone-dsp-gpio";
62 gpio-controller;
63 #gpio-cells = <2>;
64 gpio,syscon-dev = <&devctrl 0x248>;
65 };
66
67 dspgpio3: keystone_dsp_gpio@262024c {
68 compatible = "ti,keystone-dsp-gpio";
69 gpio-controller;
70 #gpio-cells = <2>;
71 gpio,syscon-dev = <&devctrl 0x24c>;
72 };
73
74 dspgpio4: keystone_dsp_gpio@2620250 {
75 compatible = "ti,keystone-dsp-gpio";
76 gpio-controller;
77 #gpio-cells = <2>;
78 gpio,syscon-dev = <&devctrl 0x250>;
79 };
80
81 dspgpio5: keystone_dsp_gpio@2620254 {
82 compatible = "ti,keystone-dsp-gpio";
83 gpio-controller;
84 #gpio-cells = <2>;
85 gpio,syscon-dev = <&devctrl 0x254>;
86 };
87
88 dspgpio6: keystone_dsp_gpio@2620258 {
89 compatible = "ti,keystone-dsp-gpio";
90 gpio-controller;
91 #gpio-cells = <2>;
92 gpio,syscon-dev = <&devctrl 0x258>;
93 };
94
95 dspgpio7: keystone_dsp_gpio@262025c {
96 compatible = "ti,keystone-dsp-gpio";
97 gpio-controller;
98 #gpio-cells = <2>;
99 gpio,syscon-dev = <&devctrl 0x25c>;
100 };
45 }; 101 };
46}; 102};
diff --git a/arch/arm/boot/dts/k2l.dtsi b/arch/arm/boot/dts/k2l.dtsi
index 1f7f479589e1..e32c3baa77b8 100644
--- a/arch/arm/boot/dts/k2l.dtsi
+++ b/arch/arm/boot/dts/k2l.dtsi
@@ -51,5 +51,51 @@
51 clocks = <&clkuart3>; 51 clocks = <&clkuart3>;
52 interrupts = <GIC_SPI 435 IRQ_TYPE_EDGE_RISING>; 52 interrupts = <GIC_SPI 435 IRQ_TYPE_EDGE_RISING>;
53 }; 53 };
54
55 dspgpio0: keystone_dsp_gpio@02620240 {
56 compatible = "ti,keystone-dsp-gpio";
57 gpio-controller;
58 #gpio-cells = <2>;
59 gpio,syscon-dev = <&devctrl 0x240>;
60 };
61
62 dspgpio1: keystone_dsp_gpio@2620244 {
63 compatible = "ti,keystone-dsp-gpio";
64 gpio-controller;
65 #gpio-cells = <2>;
66 gpio,syscon-dev = <&devctrl 0x244>;
67 };
68
69 dspgpio2: keystone_dsp_gpio@2620248 {
70 compatible = "ti,keystone-dsp-gpio";
71 gpio-controller;
72 #gpio-cells = <2>;
73 gpio,syscon-dev = <&devctrl 0x248>;
74 };
75
76 dspgpio3: keystone_dsp_gpio@262024c {
77 compatible = "ti,keystone-dsp-gpio";
78 gpio-controller;
79 #gpio-cells = <2>;
80 gpio,syscon-dev = <&devctrl 0x24c>;
81 };
54 }; 82 };
55}; 83};
84
85&spi0 {
86 ti,davinci-spi-num-cs = <5>;
87};
88
89&spi1 {
90 ti,davinci-spi-num-cs = <3>;
91};
92
93&spi2 {
94 ti,davinci-spi-num-cs = <5>;
95 /* Pin muxed. Enabled and configured by Bootloader */
96 status = "disabled";
97};
98
99&mdio {
100 reg = <0x26200f00 0x100>;
101};
diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi
index 9e31fe7d31f8..5d3e83fa2242 100644
--- a/arch/arm/boot/dts/keystone.dtsi
+++ b/arch/arm/boot/dts/keystone.dtsi
@@ -172,7 +172,7 @@
172 compatible = "ti,keystone-usbphy"; 172 compatible = "ti,keystone-usbphy";
173 #address-cells = <1>; 173 #address-cells = <1>;
174 #size-cells = <1>; 174 #size-cells = <1>;
175 reg = <0x2620738 32>; 175 reg = <0x2620738 24>;
176 status = "disabled"; 176 status = "disabled";
177 }; 177 };
178 178
@@ -277,5 +277,13 @@
277 clock-names = "fck"; 277 clock-names = "fck";
278 bus_freq = <2500000>; 278 bus_freq = <2500000>;
279 }; 279 };
280
281 kirq0: keystone_irq@26202a0 {
282 compatible = "ti,keystone-irq";
283 interrupts = <GIC_SPI 4 IRQ_TYPE_EDGE_RISING>;
284 interrupt-controller;
285 #interrupt-cells = <1>;
286 ti,syscon-dev = <&devctrl 0x2a0>;
287 };
280 }; 288 };
281}; 289};
diff --git a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
index 8f76d28759a3..f82827d6fcff 100644
--- a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
+++ b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
@@ -123,11 +123,11 @@
123 123
124 dsa@0 { 124 dsa@0 {
125 compatible = "marvell,dsa"; 125 compatible = "marvell,dsa";
126 #address-cells = <2>; 126 #address-cells = <1>;
127 #size-cells = <0>; 127 #size-cells = <0>;
128 128
129 dsa,ethernet = <&eth0>; 129 dsa,ethernet = <&eth0port>;
130 dsa,mii-bus = <&ethphy0>; 130 dsa,mii-bus = <&mdio>;
131 131
132 switch@0 { 132 switch@0 {
133 #address-cells = <1>; 133 #address-cells = <1>;
@@ -169,17 +169,13 @@
169 169
170&mdio { 170&mdio {
171 status = "okay"; 171 status = "okay";
172
173 ethphy0: ethernet-phy@ff {
174 reg = <0xff>; /* No phy attached */
175 speed = <1000>;
176 duplex = <1>;
177 };
178}; 172};
179 173
180&eth0 { 174&eth0 {
181 status = "okay"; 175 status = "okay";
176
182 ethernet0-port@0 { 177 ethernet0-port@0 {
183 phy-handle = <&ethphy0>; 178 speed = <1000>;
179 duplex = <1>;
184 }; 180 };
185}; 181};
diff --git a/arch/arm/boot/dts/kirkwood-rd88f6281-a.dts b/arch/arm/boot/dts/kirkwood-rd88f6281-a.dts
new file mode 100644
index 000000000000..f2e08b3b33ea
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-rd88f6281-a.dts
@@ -0,0 +1,43 @@
1/*
2 * Marvell RD88F6181 A Board descrition
3 *
4 * Andrew Lunn <andrew@lunn.ch>
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 * This file contains the definitions for the board with the A0 or
11 * higher stepping of the SoC. The ethernet switch does not have a
12 * "wan" port.
13 */
14
15/dts-v1/;
16#include "kirkwood-rd88f6281.dtsi"
17
18/ {
19 model = "Marvell RD88f6281 Reference design, with A0 or higher SoC";
20 compatible = "marvell,rd88f6281-a", "marvell,rd88f6281","marvell,kirkwood-88f6281", "marvell,kirkwood";
21
22 dsa@0 {
23 switch@0 {
24 reg = <10 0>; /* MDIO address 10, switch 0 in tree */
25 };
26 };
27};
28
29&mdio {
30 status = "okay";
31
32 ethphy1: ethernet-phy@11 {
33 reg = <11>;
34 };
35};
36
37&eth1 {
38 status = "okay";
39
40 ethernet1-port@0 {
41 phy-handle = <&ethphy1>;
42 };
43};
diff --git a/arch/arm/boot/dts/kirkwood-rd88f6281-a0.dts b/arch/arm/boot/dts/kirkwood-rd88f6281-a0.dts
deleted file mode 100644
index a803bbb70bc8..000000000000
--- a/arch/arm/boot/dts/kirkwood-rd88f6281-a0.dts
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Marvell RD88F6181 A0 Board descrition
3 *
4 * Andrew Lunn <andrew@lunn.ch>
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 * This file contains the definitions for the board with the A0 variant of
11 * the SoC. The ethernet switch does not have a "wan" port.
12 */
13
14/dts-v1/;
15#include "kirkwood-rd88f6281.dtsi"
16
17/ {
18 model = "Marvell RD88f6281 Reference design, with A0 SoC";
19 compatible = "marvell,rd88f6281-a0", "marvell,rd88f6281","marvell,kirkwood-88f6281", "marvell,kirkwood";
20
21 dsa@0 {
22 switch@0 {
23 reg = <10 0>; /* MDIO address 10, switch 0 in tree */
24 };
25 };
26}; \ No newline at end of file
diff --git a/arch/arm/boot/dts/kirkwood-rd88f6281-a1.dts b/arch/arm/boot/dts/kirkwood-rd88f6281-z0.dts
index baeebbf1d8c7..f4272b64ed7f 100644
--- a/arch/arm/boot/dts/kirkwood-rd88f6281-a1.dts
+++ b/arch/arm/boot/dts/kirkwood-rd88f6281-z0.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * Marvell RD88F6181 A1 Board descrition 2 * Marvell RD88F6181 Z0 stepping descrition
3 * 3 *
4 * Andrew Lunn <andrew@lunn.ch> 4 * Andrew Lunn <andrew@lunn.ch>
5 * 5 *
@@ -7,17 +7,17 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 * 9 *
10 * This file contains the definitions for the board with the A1 variant of 10 * This file contains the definitions for the board using the Z0
11 * the SoC. The ethernet switch has a "wan" port. 11 * stepping of the SoC. The ethernet switch has a "wan" port.
12 */ 12*/
13 13
14/dts-v1/; 14/dts-v1/;
15 15
16#include "kirkwood-rd88f6281.dtsi" 16#include "kirkwood-rd88f6281.dtsi"
17 17
18/ { 18/ {
19 model = "Marvell RD88f6281 Reference design, with A1 SoC"; 19 model = "Marvell RD88f6281 Reference design, with Z0 SoC";
20 compatible = "marvell,rd88f6281-a1", "marvell,rd88f6281","marvell,kirkwood-88f6281", "marvell,kirkwood"; 20 compatible = "marvell,rd88f6281-z0", "marvell,rd88f6281","marvell,kirkwood-88f6281", "marvell,kirkwood";
21 21
22 dsa@0 { 22 dsa@0 {
23 switch@0 { 23 switch@0 {
@@ -28,4 +28,8 @@
28 }; 28 };
29 }; 29 };
30 }; 30 };
31}; \ No newline at end of file 31};
32
33&eth1 {
34 status = "disabled";
35};
diff --git a/arch/arm/boot/dts/kirkwood-rd88f6281.dtsi b/arch/arm/boot/dts/kirkwood-rd88f6281.dtsi
index 26cf0e0ccefd..d195e884b3b5 100644
--- a/arch/arm/boot/dts/kirkwood-rd88f6281.dtsi
+++ b/arch/arm/boot/dts/kirkwood-rd88f6281.dtsi
@@ -37,7 +37,6 @@
37 37
38 ocp@f1000000 { 38 ocp@f1000000 {
39 pinctrl: pin-controller@10000 { 39 pinctrl: pin-controller@10000 {
40 pinctrl-0 = <&pmx_sdio_cd>;
41 pinctrl-names = "default"; 40 pinctrl-names = "default";
42 41
43 pmx_sdio_cd: pmx-sdio-cd { 42 pmx_sdio_cd: pmx-sdio-cd {
@@ -69,8 +68,8 @@
69 #address-cells = <2>; 68 #address-cells = <2>;
70 #size-cells = <0>; 69 #size-cells = <0>;
71 70
72 dsa,ethernet = <&eth0>; 71 dsa,ethernet = <&eth0port>;
73 dsa,mii-bus = <&ethphy1>; 72 dsa,mii-bus = <&mdio>;
74 73
75 switch@0 { 74 switch@0 {
76 #address-cells = <1>; 75 #address-cells = <1>;
@@ -119,35 +118,19 @@
119 }; 118 };
120 119
121 partition@300000 { 120 partition@300000 {
122 label = "data"; 121 label = "rootfs";
123 reg = <0x0300000 0x500000>; 122 reg = <0x0300000 0x500000>;
124 }; 123 };
125}; 124};
126 125
127&mdio { 126&mdio {
128 status = "okay"; 127 status = "okay";
129
130 ethphy0: ethernet-phy@0 {
131 reg = <0>;
132 };
133
134 ethphy1: ethernet-phy@ff {
135 reg = <0xff>; /* No PHY attached */
136 speed = <1000>;
137 duple = <1>;
138 };
139}; 128};
140 129
141&eth0 { 130&eth0 {
142 status = "okay"; 131 status = "okay";
143 ethernet0-port@0 { 132 ethernet0-port@0 {
144 phy-handle = <&ethphy0>; 133 speed = <1000>;
145 }; 134 duplex = <1>;
146};
147
148&eth1 {
149 status = "okay";
150 ethernet1-port@0 {
151 phy-handle = <&ethphy1>;
152 }; 135 };
153}; 136};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index afc640cd80c5..464f09a1a4a5 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -309,7 +309,7 @@
309 marvell,tx-checksum-limit = <1600>; 309 marvell,tx-checksum-limit = <1600>;
310 status = "disabled"; 310 status = "disabled";
311 311
312 ethernet0-port@0 { 312 eth0port: ethernet0-port@0 {
313 compatible = "marvell,kirkwood-eth-port"; 313 compatible = "marvell,kirkwood-eth-port";
314 reg = <0>; 314 reg = <0>;
315 interrupts = <11>; 315 interrupts = <11>;
@@ -342,7 +342,7 @@
342 pinctrl-names = "default"; 342 pinctrl-names = "default";
343 status = "disabled"; 343 status = "disabled";
344 344
345 ethernet1-port@0 { 345 eth1port: ethernet1-port@0 {
346 compatible = "marvell,kirkwood-eth-port"; 346 compatible = "marvell,kirkwood-eth-port";
347 reg = <0>; 347 reg = <0>;
348 interrupts = <15>; 348 interrupts = <15>;
diff --git a/arch/arm/boot/dts/meson.dtsi b/arch/arm/boot/dts/meson.dtsi
new file mode 100644
index 000000000000..e6539ea5a711
--- /dev/null
+++ b/arch/arm/boot/dts/meson.dtsi
@@ -0,0 +1,110 @@
1/*
2 * Copyright 2014 Carlo Caione <carlo@caione.org>
3 *
4 * This file is dual-licensed: you can use it either under the terms
5 * of the GPL or the X11 license, at your option. Note that this dual
6 * licensing only applies to this file, and not this project as a
7 * whole.
8 *
9 * a) This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this library; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 * MA 02110-1301 USA
23 *
24 * Or, alternatively,
25 *
26 * b) Permission is hereby granted, free of charge, to any person
27 * obtaining a copy of this software and associated documentation
28 * files (the "Software"), to deal in the Software without
29 * restriction, including without limitation the rights to use,
30 * copy, modify, merge, publish, distribute, sublicense, and/or
31 * sell copies of the Software, and to permit persons to whom the
32 * Software is furnished to do so, subject to the following
33 * conditions:
34 *
35 * The above copyright notice and this permission notice shall be
36 * included in all copies or substantial portions of the Software.
37 *
38 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
39 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
40 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
41 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
42 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
44 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45 * OTHER DEALINGS IN THE SOFTWARE.
46 */
47
48/include/ "skeleton.dtsi"
49
50/ {
51 interrupt-parent = <&gic>;
52
53 gic: interrupt-controller@c4301000 {
54 compatible = "arm,cortex-a9-gic";
55 reg = <0xc4301000 0x1000>,
56 <0xc4300100 0x0100>;
57 interrupt-controller;
58 #interrupt-cells = <3>;
59 };
60
61 timer@c1109940 {
62 compatible = "amlogic,meson6-timer";
63 reg = <0xc1109940 0x14>;
64 interrupts = <0 10 1>;
65 };
66
67 soc {
68 compatible = "simple-bus";
69 #address-cells = <1>;
70 #size-cells = <1>;
71 ranges;
72
73 wdt: watchdog@c1109900 {
74 compatible = "amlogic,meson6-wdt";
75 reg = <0xc1109900 0x8>;
76 };
77
78 uart_AO: serial@c81004c0 {
79 compatible = "amlogic,meson-uart";
80 reg = <0xc81004c0 0x14>;
81 interrupts = <0 90 1>;
82 clocks = <&clk81>;
83 status = "disabled";
84 };
85
86 uart_A: serial@c81084c0 {
87 compatible = "amlogic,meson-uart";
88 reg = <0xc81084c0 0x14>;
89 interrupts = <0 90 1>;
90 clocks = <&clk81>;
91 status = "disabled";
92 };
93
94 uart_B: serial@c81084dc {
95 compatible = "amlogic,meson-uart";
96 reg = <0xc81084dc 0x14>;
97 interrupts = <0 90 1>;
98 clocks = <&clk81>;
99 status = "disabled";
100 };
101
102 uart_C: serial@c8108700 {
103 compatible = "amlogic,meson-uart";
104 reg = <0xc8108700 0x14>;
105 interrupts = <0 90 1>;
106 clocks = <&clk81>;
107 status = "disabled";
108 };
109 };
110}; /* end of / */
diff --git a/arch/arm/boot/dts/meson6-atv1200.dts b/arch/arm/boot/dts/meson6-atv1200.dts
new file mode 100644
index 000000000000..dc2541faf1ec
--- /dev/null
+++ b/arch/arm/boot/dts/meson6-atv1200.dts
@@ -0,0 +1,66 @@
1/*
2 * Copyright 2014 Carlo Caione <carlo@caione.org>
3 *
4 * This file is dual-licensed: you can use it either under the terms
5 * of the GPL or the X11 license, at your option. Note that this dual
6 * licensing only applies to this file, and not this project as a
7 * whole.
8 *
9 * a) This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this library; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 * MA 02110-1301 USA
23 *
24 * Or, alternatively,
25 *
26 * b) Permission is hereby granted, free of charge, to any person
27 * obtaining a copy of this software and associated documentation
28 * files (the "Software"), to deal in the Software without
29 * restriction, including without limitation the rights to use,
30 * copy, modify, merge, publish, distribute, sublicense, and/or
31 * sell copies of the Software, and to permit persons to whom the
32 * Software is furnished to do so, subject to the following
33 * conditions:
34 *
35 * The above copyright notice and this permission notice shall be
36 * included in all copies or substantial portions of the Software.
37 *
38 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
39 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
40 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
41 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
42 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
44 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45 * OTHER DEALINGS IN THE SOFTWARE.
46 */
47
48/dts-v1/;
49/include/ "meson6.dtsi"
50
51/ {
52 model = "Geniatech ATV1200";
53 compatible = "geniatech,atv1200";
54
55 aliases {
56 serial0 = &uart_AO;
57 };
58
59 memory {
60 reg = <0x40000000 0x80000000>;
61 };
62};
63
64&uart_AO {
65 status = "okay";
66};
diff --git a/arch/arm/boot/dts/meson6.dtsi b/arch/arm/boot/dts/meson6.dtsi
new file mode 100644
index 000000000000..4ba49127779f
--- /dev/null
+++ b/arch/arm/boot/dts/meson6.dtsi
@@ -0,0 +1,78 @@
1/*
2 * Copyright 2014 Carlo Caione <carlo@caione.org>
3 *
4 * This file is dual-licensed: you can use it either under the terms
5 * of the GPL or the X11 license, at your option. Note that this dual
6 * licensing only applies to this file, and not this project as a
7 * whole.
8 *
9 * a) This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this library; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 * MA 02110-1301 USA
23 *
24 * Or, alternatively,
25 *
26 * b) Permission is hereby granted, free of charge, to any person
27 * obtaining a copy of this software and associated documentation
28 * files (the "Software"), to deal in the Software without
29 * restriction, including without limitation the rights to use,
30 * copy, modify, merge, publish, distribute, sublicense, and/or
31 * sell copies of the Software, and to permit persons to whom the
32 * Software is furnished to do so, subject to the following
33 * conditions:
34 *
35 * The above copyright notice and this permission notice shall be
36 * included in all copies or substantial portions of the Software.
37 *
38 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
39 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
40 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
41 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
42 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
44 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45 * OTHER DEALINGS IN THE SOFTWARE.
46 */
47
48/include/ "meson.dtsi"
49
50/ {
51 model = "Amlogic Meson6 SoC";
52 compatible = "amlogic,meson6";
53
54 interrupt-parent = <&gic>;
55
56 cpus {
57 #address-cells = <1>;
58 #size-cells = <0>;
59
60 cpu@200 {
61 device_type = "cpu";
62 compatible = "arm,cortex-a9";
63 reg = <0x200>;
64 };
65
66 cpu@201 {
67 device_type = "cpu";
68 compatible = "arm,cortex-a9";
69 reg = <0x201>;
70 };
71 };
72
73 clk81: clk@0 {
74 #clock-cells = <0>;
75 compatible = "fixed-clock";
76 clock-frequency = <200000000>;
77 };
78}; /* end of / */
diff --git a/arch/arm/boot/dts/mt6589-aquaris5.dts b/arch/arm/boot/dts/mt6589-aquaris5.dts
index 443b4467de15..0da047013120 100644
--- a/arch/arm/boot/dts/mt6589-aquaris5.dts
+++ b/arch/arm/boot/dts/mt6589-aquaris5.dts
@@ -18,6 +18,11 @@
18 18
19/ { 19/ {
20 model = "bq Aquaris5"; 20 model = "bq Aquaris5";
21 compatible = "mundoreader,bq-aquaris5", "mediatek,mt6589";
22
23 chosen {
24 bootargs = "earlyprintk";
25 };
21 26
22 memory { 27 memory {
23 reg = <0x80000000 0x40000000>; 28 reg = <0x80000000 0x40000000>;
diff --git a/arch/arm/boot/dts/mt6589.dtsi b/arch/arm/boot/dts/mt6589.dtsi
index d0297a051549..e3c7600ddb38 100644
--- a/arch/arm/boot/dts/mt6589.dtsi
+++ b/arch/arm/boot/dts/mt6589.dtsi
@@ -81,8 +81,8 @@
81 clock-names = "system-clk", "rtc-clk"; 81 clock-names = "system-clk", "rtc-clk";
82 }; 82 };
83 83
84 gic: interrupt-controller@10212000 { 84 gic: interrupt-controller@10211000 {
85 compatible = "arm,cortex-a15-gic"; 85 compatible = "arm,cortex-a7-gic";
86 interrupt-controller; 86 interrupt-controller;
87 #interrupt-cells = <3>; 87 #interrupt-cells = <3>;
88 reg = <0x10211000 0x1000>, 88 reg = <0x10211000 0x1000>,
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi
index 8f8c07da4ac1..59d1c297bb30 100644
--- a/arch/arm/boot/dts/omap2.dtsi
+++ b/arch/arm/boot/dts/omap2.dtsi
@@ -75,7 +75,6 @@
75 compatible = "ti,omap2-intc"; 75 compatible = "ti,omap2-intc";
76 interrupt-controller; 76 interrupt-controller;
77 #interrupt-cells = <1>; 77 #interrupt-cells = <1>;
78 ti,intc-size = <96>;
79 reg = <0x480FE000 0x1000>; 78 reg = <0x480FE000 0x1000>;
80 }; 79 };
81 80
diff --git a/arch/arm/boot/dts/omap2420-n810.dts b/arch/arm/boot/dts/omap2420-n810.dts
index 21baec154b78..b604d26bd48c 100644
--- a/arch/arm/boot/dts/omap2420-n810.dts
+++ b/arch/arm/boot/dts/omap2420-n810.dts
@@ -6,3 +6,10 @@
6 model = "Nokia N810"; 6 model = "Nokia N810";
7 compatible = "nokia,n810", "nokia,n8x0", "ti,omap2420", "ti,omap2"; 7 compatible = "nokia,n810", "nokia,n8x0", "ti,omap2420", "ti,omap2";
8}; 8};
9
10&i2c2 {
11 aic3x@18 {
12 compatible = "tlv320aic3x";
13 reg = <0x18>;
14 };
15};
diff --git a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
index 89608b206519..24c50db2a478 100644
--- a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
+++ b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
@@ -27,6 +27,12 @@
27 27
28&i2c1 { 28&i2c1 {
29 clock-frequency = <400000>; 29 clock-frequency = <400000>;
30
31 pmic@72 {
32 compatible = "menelaus";
33 reg = <0x72>;
34 interrupts = <7 IRQ_TYPE_EDGE_RISING>;
35 };
30}; 36};
31 37
32&i2c2 { 38&i2c2 {
diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
index 9be3c1266378..ae89aad01595 100644
--- a/arch/arm/boot/dts/omap2420.dtsi
+++ b/arch/arm/boot/dts/omap2420.dtsi
@@ -159,6 +159,14 @@
159 ti,hwmods = "mailbox"; 159 ti,hwmods = "mailbox";
160 ti,mbox-num-users = <4>; 160 ti,mbox-num-users = <4>;
161 ti,mbox-num-fifos = <6>; 161 ti,mbox-num-fifos = <6>;
162 mbox_dsp: dsp {
163 ti,mbox-tx = <0 0 0>;
164 ti,mbox-rx = <1 0 0>;
165 };
166 mbox_iva: iva {
167 ti,mbox-tx = <2 1 3>;
168 ti,mbox-rx = <3 1 3>;
169 };
162 }; 170 };
163 171
164 timer1: timer@48028000 { 172 timer1: timer@48028000 {
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index 1a00f15d9096..b56d71611026 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -249,6 +249,10 @@
249 ti,hwmods = "mailbox"; 249 ti,hwmods = "mailbox";
250 ti,mbox-num-users = <4>; 250 ti,mbox-num-users = <4>;
251 ti,mbox-num-fifos = <6>; 251 ti,mbox-num-fifos = <6>;
252 mbox_dsp: dsp {
253 ti,mbox-tx = <0 0 0>;
254 ti,mbox-rx = <1 0 0>;
255 };
252 }; 256 };
253 257
254 timer1: timer@49018000 { 258 timer1: timer@49018000 {
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index 1becefce821b..06a8aec4e6ea 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -174,8 +174,8 @@
174 174
175 uart3_pins: pinmux_uart3_pins { 175 uart3_pins: pinmux_uart3_pins {
176 pinctrl-single,pins = < 176 pinctrl-single,pins = <
177 0x16e (PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */ 177 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
178 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx OUTPUT | MODE0 */ 178 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx OUTPUT | MODE0 */
179 >; 179 >;
180 }; 180 };
181 181
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index 3c3e6da1deac..a9aae88b74f5 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -292,6 +292,7 @@
292&uart3 { 292&uart3 {
293 pinctrl-names = "default"; 293 pinctrl-names = "default";
294 pinctrl-0 = <&uart3_pins>; 294 pinctrl-0 = <&uart3_pins>;
295 interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
295}; 296};
296 297
297&gpio1 { 298&gpio1 {
diff --git a/arch/arm/boot/dts/omap3-gta04.dts b/arch/arm/boot/dts/omap3-gta04.dtsi
index 021311f7964b..fd34f913ace3 100644
--- a/arch/arm/boot/dts/omap3-gta04.dts
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -26,6 +26,10 @@
26 reg = <0x80000000 0x20000000>; /* 512 MB */ 26 reg = <0x80000000 0x20000000>; /* 512 MB */
27 }; 27 };
28 28
29 aliases {
30 display0 = &lcd;
31 };
32
29 gpio-keys { 33 gpio-keys {
30 compatible = "gpio-keys"; 34 compatible = "gpio-keys";
31 35
@@ -74,9 +78,30 @@
74 }; 78 };
75 }; 79 };
76 }; 80 };
81
82 hsusb2_phy: hsusb2_phy {
83 compatible = "usb-nop-xceiv";
84 reset-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
85 };
77}; 86};
78 87
79&omap3_pmx_core { 88&omap3_pmx_core {
89 pinctrl-names = "default";
90 pinctrl-0 = <
91 &hsusb2_pins
92 >;
93
94 hsusb2_pins: pinmux_hsusb2_pins {
95 pinctrl-single,pins = <
96 OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */
97 OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */
98 OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */
99 OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */
100 OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */
101 OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */
102 >;
103 };
104
80 uart1_pins: pinmux_uart1_pins { 105 uart1_pins: pinmux_uart1_pins {
81 pinctrl-single,pins = < 106 pinctrl-single,pins = <
82 0x152 (PIN_INPUT | MUX_MODE0) /* uart1_rx.uart1_rx */ 107 0x152 (PIN_INPUT | MUX_MODE0) /* uart1_rx.uart1_rx */
@@ -141,12 +166,31 @@
141 0x0da (PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */ 166 0x0da (PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */
142 >; 167 >;
143 }; 168 };
169};
170
171&omap3_pmx_core2 {
172 pinctrl-names = "default";
173 pinctrl-0 = <
174 &hsusb2_2_pins
175 >;
176
177 hsusb2_2_pins: pinmux_hsusb2_2_pins {
178 pinctrl-single,pins = <
179 OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
180 OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
181 OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
182 OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
183 OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
184 OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
185 >;
186 };
144 187
145 spi_gpio_pins: spi_gpio_pinmux { 188 spi_gpio_pins: spi_gpio_pinmux {
146 pinctrl-single,pins = <0x5a8 (PIN_OUTPUT | MUX_MODE4) /* clk */ 189 pinctrl-single,pins = <
147 0x5b6 (PIN_OUTPUT | MUX_MODE4) /* cs */ 190 OMAP3630_CORE2_IOPAD(0x25d8, PIN_OUTPUT | MUX_MODE4) /* clk */
148 0x5b8 (PIN_OUTPUT | MUX_MODE4) /* tx */ 191 OMAP3630_CORE2_IOPAD(0x25e6, PIN_OUTPUT | MUX_MODE4) /* cs */
149 0x5b4 (PIN_INPUT | MUX_MODE4) /* rx */ 192 OMAP3630_CORE2_IOPAD(0x25e8, PIN_OUTPUT | MUX_MODE4) /* tx */
193 OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT | MUX_MODE4) /* rx */
150 >; 194 >;
151 }; 195 };
152}; 196};
@@ -196,6 +240,9 @@
196 #size-cells = <0>; 240 #size-cells = <0>;
197 reg = <0x45>; 241 reg = <0x45>;
198 242
243 gpio-controller;
244 #gpio-cells = <2>;
245
199 gta04_led0: red_aux@0 { 246 gta04_led0: red_aux@0 {
200 label = "gta04:red:aux"; 247 label = "gta04:red:aux";
201 reg = <0x0>; 248 reg = <0x0>;
@@ -216,11 +263,16 @@
216 label = "gta04:green:power"; 263 label = "gta04:green:power";
217 reg = <0x4>; 264 reg = <0x4>;
218 }; 265 };
266
267 wifi_reset: wifi_reset@6 {
268 reg = <0x6>;
269 compatible = "gpio";
270 };
219 }; 271 };
220 272
221 /* compass aka magnetometer */ 273 /* compass aka magnetometer */
222 hmc5843@1e { 274 hmc5843@1e {
223 compatible = "honeywell,hmc5843"; 275 compatible = "honeywell,hmc5883l";
224 reg = <0x1e>; 276 reg = <0x1e>;
225 }; 277 };
226 278
@@ -248,6 +300,14 @@
248 power = <50>; 300 power = <50>;
249}; 301};
250 302
303&usbhshost {
304 port2-mode = "ehci-phy";
305};
306
307&usbhsehci {
308 phys = <0 &hsusb2_phy>;
309};
310
251&mmc1 { 311&mmc1 {
252 pinctrl-names = "default"; 312 pinctrl-names = "default";
253 pinctrl-0 = <&mmc1_pins>; 313 pinctrl-0 = <&mmc1_pins>;
@@ -286,11 +346,37 @@
286 bb_uamp = <150>; 346 bb_uamp = <150>;
287}; 347};
288 348
349/* spare */
350&vaux1 {
351 regulator-min-microvolt = <2500000>;
352 regulator-max-microvolt = <3000000>;
353};
354
355/* sensors */
356&vaux2 {
357 regulator-min-microvolt = <2800000>;
358 regulator-max-microvolt = <2800000>;
359 regulator-always-on;
360};
361
362/* camera */
363&vaux3 {
364 regulator-min-microvolt = <2500000>;
365 regulator-max-microvolt = <2500000>;
366};
367
368/* WLAN/BT */
289&vaux4 { 369&vaux4 {
290 regulator-min-microvolt = <2800000>; 370 regulator-min-microvolt = <2800000>;
291 regulator-max-microvolt = <3150000>; 371 regulator-max-microvolt = <3150000>;
292}; 372};
293 373
374/* GPS LNA */
375&vsim {
376 regulator-min-microvolt = <2800000>;
377 regulator-max-microvolt = <3150000>;
378};
379
294/* Needed to power the DPI pins */ 380/* Needed to power the DPI pins */
295&vpll2 { 381&vpll2 {
296 regulator-always-on; 382 regulator-always-on;
@@ -309,3 +395,57 @@
309 }; 395 };
310 }; 396 };
311}; 397};
398
399&gpmc {
400 ranges = <0 0 0x30000000 0x04>; /* CS0: NAND */
401
402 nand@0,0 {
403 reg = <0 0 0>; /* CS0, offset 0 */
404 nand-bus-width = <16>;
405 ti,nand-ecc-opt = "bch8";
406
407 gpmc,sync-clk-ps = <0>;
408 gpmc,cs-on-ns = <0>;
409 gpmc,cs-rd-off-ns = <44>;
410 gpmc,cs-wr-off-ns = <44>;
411 gpmc,adv-on-ns = <6>;
412 gpmc,adv-rd-off-ns = <34>;
413 gpmc,adv-wr-off-ns = <44>;
414 gpmc,we-off-ns = <40>;
415 gpmc,oe-off-ns = <54>;
416 gpmc,access-ns = <64>;
417 gpmc,rd-cycle-ns = <82>;
418 gpmc,wr-cycle-ns = <82>;
419 gpmc,wr-access-ns = <40>;
420 gpmc,wr-data-mux-bus-ns = <0>;
421 gpmc,device-width = <2>;
422
423 #address-cells = <1>;
424 #size-cells = <1>;
425
426 x-loader@0 {
427 label = "X-Loader";
428 reg = <0 0x80000>;
429 };
430
431 bootloaders@80000 {
432 label = "U-Boot";
433 reg = <0x80000 0x1e0000>;
434 };
435
436 bootloaders_env@260000 {
437 label = "U-Boot Env";
438 reg = <0x260000 0x20000>;
439 };
440
441 kernel@280000 {
442 label = "Kernel";
443 reg = <0x280000 0x400000>;
444 };
445
446 filesystem@680000 {
447 label = "File System";
448 reg = <0x680000 0xf980000>;
449 };
450 };
451};
diff --git a/arch/arm/boot/dts/omap3-gta04a3.dts b/arch/arm/boot/dts/omap3-gta04a3.dts
new file mode 100644
index 000000000000..3099a892cf50
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-gta04a3.dts
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2014 H. Nikolaus Schaller <hns@goldelico.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#include "omap3-gta04.dtsi"
10
11/ {
12 model = "Goldelico GTA04A3";
13};
14
15&i2c2 {
16
17 /* alternate accelerometer that might be installed on some GTA04A3 boards */
18 lis302@1d {
19 compatible = "st,lis331dlh", "st,lis3lv02d";
20 reg = <0x1d>;
21 interrupt-parent = <&gpio3>;
22 interrupts = <18 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
23 Vdd-supply = <&vaux2>;
24 Vdd_IO-supply = <&vaux2>;
25
26 st,click-single-x;
27 st,click-single-y;
28 st,click-single-z;
29 st,click-thresh-x = <8>;
30 st,click-thresh-y = <8>;
31 st,click-thresh-z = <10>;
32 st,click-click-time-limit = <9>;
33 st,click-latency = <50>;
34 st,irq1-click;
35 st,wakeup-x-lo;
36 st,wakeup-x-hi;
37 st,wakeup-y-lo;
38 st,wakeup-y-hi;
39 st,wakeup-z-lo;
40 st,wakeup-z-hi;
41 st,min-limit-x = <32>;
42 st,min-limit-y = <3>;
43 st,min-limit-z = <3>;
44 st,max-limit-x = <3>;
45 st,max-limit-y = <32>;
46 st,max-limit-z = <32>;
47 };
48};
diff --git a/arch/arm/boot/dts/omap3-gta04a4.dts b/arch/arm/boot/dts/omap3-gta04a4.dts
new file mode 100644
index 000000000000..c918bb1f0529
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-gta04a4.dts
@@ -0,0 +1,13 @@
1/*
2 * Copyright (C) 2014 Marek Belisko <marek@goldelico.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#include "omap3-gta04.dtsi"
10
11/ {
12 model = "Goldelico GTA04A4";
13};
diff --git a/arch/arm/boot/dts/omap3-gta04a5.dts b/arch/arm/boot/dts/omap3-gta04a5.dts
new file mode 100644
index 000000000000..52b386f6865b
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-gta04a5.dts
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2014 H. Nikolaus Schaller <hns@goldelico.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#include "omap3-gta04.dtsi"
10
11/ {
12 model = "Goldelico GTA04A5";
13
14 sound {
15 ti,jack-det-gpio = <&twl_gpio 2 0>; /* GTA04A5 only */
16 };
17};
diff --git a/arch/arm/boot/dts/omap3-ha-common.dtsi b/arch/arm/boot/dts/omap3-ha-common.dtsi
new file mode 100644
index 000000000000..bd66545ef954
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-ha-common.dtsi
@@ -0,0 +1,88 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 * Copyright (C) 2014 Stefan Roese <sr@denx.de>
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 "omap3-tao3530.dtsi"
11
12/ {
13 gpio_poweroff {
14 pinctrl-names = "default";
15 pinctrl-0 = <&poweroff_pins>;
16
17 compatible = "gpio-poweroff";
18 gpios = <&gpio6 8 GPIO_ACTIVE_LOW>; /* GPIO 168 */
19 };
20};
21
22&omap3_pmx_core {
23 sound2_pins: pinmux_sound2_pins {
24 pinctrl-single,pins = <
25 OMAP3_CORE1_IOPAD(0x209e, PIN_OUTPUT | MUX_MODE4) /* gpmc_d8 gpio_44 */
26 >;
27 };
28
29 led_blue_pins: pinmux_led_blue_pins {
30 pinctrl-single,pins = <
31 OMAP3_CORE1_IOPAD(0x2110, PIN_OUTPUT | MUX_MODE4) /* cam_xclka gpio_96, LED blue */
32 >;
33 };
34
35 led_green_pins: pinmux_led_green_pins {
36 pinctrl-single,pins = <
37 OMAP3_CORE1_IOPAD(0x2126, PIN_OUTPUT | MUX_MODE4) /* cam_d8 gpio_107, LED green */
38 >;
39 };
40
41 led_red_pins: pinmux_led_red_pins {
42 pinctrl-single,pins = <
43 OMAP3_CORE1_IOPAD(0x212e, PIN_OUTPUT_PULLUP | MUX_MODE4) /* cam_xclkb gpio_111, LED red */
44 >;
45 };
46
47 poweroff_pins: pinmux_poweroff_pins {
48 pinctrl-single,pins = <
49 OMAP3_CORE1_IOPAD(0x21be, PIN_OUTPUT_PULLUP | MUX_MODE4) /* i2c2_scl gpio_168 */
50 >;
51 };
52
53 powerdown_input_pins: pinmux_powerdown_input_pins {
54 pinctrl-single,pins = <
55 OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT_PULLUP | MUX_MODE4) /* i2c2_sda gpio_183 */
56 >;
57 };
58
59 fpga_boot0_pins: fpga_boot0_pins {
60 pinctrl-single,pins = <
61 OMAP3_CORE1_IOPAD(0x211a, PIN_INPUT | MUX_MODE4) /* cam_d2 gpio_101 */
62 OMAP3_CORE1_IOPAD(0x211c, PIN_OUTPUT | MUX_MODE4) /* cam_d3 gpio_102 */
63 OMAP3_CORE1_IOPAD(0x211e, PIN_OUTPUT | MUX_MODE4) /* cam_d4 gpio_103 */
64 OMAP3_CORE1_IOPAD(0x2120, PIN_INPUT_PULLUP | MUX_MODE4) /* cam_d5 gpio_104 */
65 >;
66 };
67
68 fpga_boot1_pins: fpga_boot1_pins {
69 pinctrl-single,pins = <
70 OMAP3_CORE1_IOPAD(0x20a2, PIN_INPUT | MUX_MODE4) /* gpmc_d10 gpio_46 */
71 OMAP3_CORE1_IOPAD(0x20a4, PIN_OUTPUT | MUX_MODE4) /* gpmc_d11 gpio_47 */
72 OMAP3_CORE1_IOPAD(0x20a6, PIN_OUTPUT | MUX_MODE4) /* gpmc_d12 gpio_48 */
73 OMAP3_CORE1_IOPAD(0x20a8, PIN_INPUT_PULLUP | MUX_MODE4) /* gpmc_d13 gpio_49 */
74 >;
75 };
76};
77
78/* I2C2: mux'ed with GPIO168 which is connected to nKILL_POWER */
79&i2c2 {
80 status = "disabled";
81};
82
83&i2c3 {
84 clock-frequency = <100000>;
85
86 pinctrl-names = "default";
87 pinctrl-0 = <&i2c3_pins>;
88};
diff --git a/arch/arm/boot/dts/omap3-ha-lcd.dts b/arch/arm/boot/dts/omap3-ha-lcd.dts
new file mode 100644
index 000000000000..11aa28d73f3a
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-ha-lcd.dts
@@ -0,0 +1,165 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 * Copyright (C) 2014 Stefan Roese <sr@denx.de>
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 "omap3-ha-common.dtsi"
11
12/ {
13 model = "TI OMAP3 HEAD acoustics LCD-baseboard with TAO3530 SOM";
14 compatible = "headacoustics,omap3-ha-lcd", "technexion,omap3-tao3530", "ti,omap34xx", "ti,omap3";
15};
16
17&omap3_pmx_core {
18 pinctrl-names = "default";
19 pinctrl-0 = <
20 &hsusbb2_pins
21 &powerdown_input_pins
22 &fpga_boot0_pins
23 &fpga_boot1_pins
24 &led_blue_pins
25 &led_green_pins
26 &led_red_pins
27 &touchscreen_wake_pins
28 >;
29
30 touchscreen_irq_pins: pinmux_touchscreen_irq_pins {
31 pinctrl-single,pins = <
32 OMAP3_CORE1_IOPAD(0x2164, PIN_INPUT_PULLUP | MUX_MODE4) /* gpio_136, Touchscreen IRQ */
33 >;
34 };
35
36 touchscreen_wake_pins: pinmux_touchscreen_wake_pins {
37 pinctrl-single,pins = <
38 OMAP3_CORE1_IOPAD(0x212c, PIN_OUTPUT_PULLUP | MUX_MODE4) /* gpio_110, Touchscreen Wake */
39 >;
40 };
41
42 dss_dpi_pins: pinmux_dss_dpi_pins {
43 pinctrl-single,pins = <
44 OMAP3_CORE1_IOPAD(0x20d4, PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */
45 OMAP3_CORE1_IOPAD(0x20d6, PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */
46 OMAP3_CORE1_IOPAD(0x20d8, PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */
47 OMAP3_CORE1_IOPAD(0x20da, PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */
48 OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */
49 OMAP3_CORE1_IOPAD(0x20de, PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */
50 OMAP3_CORE1_IOPAD(0x20e0, PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */
51 OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */
52 OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */
53 OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */
54 OMAP3_CORE1_IOPAD(0x20e8, PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */
55 OMAP3_CORE1_IOPAD(0x20ea, PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */
56 OMAP3_CORE1_IOPAD(0x20ec, PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */
57 OMAP3_CORE1_IOPAD(0x20ee, PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */
58 OMAP3_CORE1_IOPAD(0x20f0, PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */
59 OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */
60 OMAP3_CORE1_IOPAD(0x20f4, PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */
61 OMAP3_CORE1_IOPAD(0x20f6, PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */
62 OMAP3_CORE1_IOPAD(0x20f8, PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */
63 OMAP3_CORE1_IOPAD(0x20fa, PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */
64 OMAP3_CORE1_IOPAD(0x20fc, PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */
65 OMAP3_CORE1_IOPAD(0x20fe, PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */
66 OMAP3_CORE1_IOPAD(0x2100, PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */
67 OMAP3_CORE1_IOPAD(0x2102, PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */
68 OMAP3_CORE1_IOPAD(0x2104, PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */
69 OMAP3_CORE1_IOPAD(0x2106, PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */
70 OMAP3_CORE1_IOPAD(0x2108, PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */
71 OMAP3_CORE1_IOPAD(0x210a, PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */
72 >;
73 };
74
75 lte430_pins: pinmux_lte430_pins {
76 pinctrl-single,pins = <
77 OMAP3_CORE1_IOPAD(0x2168, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat6.gpio_138 */
78 >;
79 };
80
81 backlight_pins: pinmux_backlight_pins {
82 pinctrl-single,pins = <
83 OMAP3_CORE1_IOPAD(0x216a, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 */
84 >;
85 };
86};
87
88/* I2C2: mux'ed with GPIO168 which is connected to nKILL_POWER */
89&i2c2 {
90 status = "disabled";
91};
92
93&i2c3 {
94 clock-frequency = <100000>;
95
96 pinctrl-names = "default";
97 pinctrl-0 = <&i2c3_pins>;
98};
99
100/* Needed to power the DPI pins */
101&vpll2 {
102 regulator-always-on;
103};
104
105&dss {
106 status = "ok";
107
108 pinctrl-names = "default";
109 pinctrl-0 = <&dss_dpi_pins>;
110
111 port {
112 dpi_out: endpoint {
113 remote-endpoint = <&lcd_in>;
114 data-lines = <24>;
115 };
116 };
117};
118
119/ {
120 aliases {
121 display0 = &lcd0;
122 };
123
124 lcd0: display@0 {
125 compatible = "panel-dpi";
126 label = "lcd";
127
128 pinctrl-names = "default";
129 pinctrl-0 = <&lte430_pins>;
130 enable-gpios = <&gpio5 10 GPIO_ACTIVE_LOW>; /* gpio_138 */
131
132 port {
133 lcd_in: endpoint {
134 remote-endpoint = <&dpi_out>;
135 };
136 };
137
138 panel-timing {
139 clock-frequency = <31250000>;
140 hactive = <800>;
141 vactive = <480>;
142 hfront-porch = <40>;
143 hback-porch = <86>;
144 hsync-len = <1>;
145 vback-porch = <30>;
146 vfront-porch = <13>;
147 vsync-len = <3>;
148
149 hsync-active = <0>;
150 vsync-active = <0>;
151 de-active = <1>;
152 pixelclk-active = <1>;
153 };
154 };
155
156 backlight {
157 compatible = "gpio-backlight";
158
159 pinctrl-names = "default";
160 pinctrl-0 = <&backlight_pins>;
161 gpios = <&gpio5 11 GPIO_ACTIVE_HIGH>; /* gpio_139 */
162
163 default-on;
164 };
165};
diff --git a/arch/arm/boot/dts/omap3-ha.dts b/arch/arm/boot/dts/omap3-ha.dts
new file mode 100644
index 000000000000..fde325688fb9
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-ha.dts
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 * Copyright (C) 2014 Stefan Roese <sr@denx.de>
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 "omap3-ha-common.dtsi"
11
12/ {
13 model = "TI OMAP3 HEAD acoustics baseboard with TAO3530 SOM";
14 compatible = "headacoustics,omap3-ha", "technexion,omap3-tao3530", "ti,omap34xx", "ti,omap3";
15};
16
17&omap3_pmx_core {
18 pinctrl-names = "default";
19 pinctrl-0 = <
20 &hsusbb2_pins
21 &powerdown_input_pins
22 &fpga_boot0_pins
23 &fpga_boot1_pins
24 &led_blue_pins
25 &led_green_pins
26 &led_red_pins
27 >;
28};
diff --git a/arch/arm/boot/dts/omap3-ldp.dts b/arch/arm/boot/dts/omap3-ldp.dts
index af272c156e21..72dca0b7904d 100644
--- a/arch/arm/boot/dts/omap3-ldp.dts
+++ b/arch/arm/boot/dts/omap3-ldp.dts
@@ -159,6 +159,11 @@
159 reg = <0x48>; 159 reg = <0x48>;
160 interrupts = <7>; /* SYS_NIRQ cascaded to intc */ 160 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
161 interrupt-parent = <&intc>; 161 interrupt-parent = <&intc>;
162
163 twl_power: power {
164 compatible = "ti,twl4030-power-idle";
165 ti,use_poweroff;
166 };
162 }; 167 };
163}; 168};
164 169
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index b15f1a77d684..9b0494a8ab45 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -93,7 +93,7 @@
93 }; 93 };
94 94
95 tv: connector { 95 tv: connector {
96 compatible = "composite-connector"; 96 compatible = "composite-video-connector";
97 label = "tv"; 97 label = "tv";
98 98
99 port { 99 port {
@@ -134,24 +134,32 @@
134 >; 134 >;
135 }; 135 };
136 136
137 ethernet_pins: pinmux_ethernet_pins {
138 pinctrl-single,pins = <
139 OMAP3_CORE1_IOPAD(0x20b4, PIN_INPUT_PULLDOWN | MUX_MODE4) /* gpmc_ncs3.gpio_54 */
140 OMAP3_CORE1_IOPAD(0x20fc, PIN_OUTPUT | MUX_MODE4) /* dss_data16.gpio_86 */
141 OMAP3_CORE1_IOPAD(0x219c, PIN_OUTPUT | MUX_MODE4) /* uart3_rts_sd.gpio_164 */
142 >;
143 };
144
137 i2c1_pins: pinmux_i2c1_pins { 145 i2c1_pins: pinmux_i2c1_pins {
138 pinctrl-single,pins = < 146 pinctrl-single,pins = <
139 0x18a (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */ 147 0x18a (PIN_INPUT | MUX_MODE0) /* i2c1_scl */
140 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */ 148 0x18c (PIN_INPUT | MUX_MODE0) /* i2c1_sda */
141 >; 149 >;
142 }; 150 };
143 151
144 i2c2_pins: pinmux_i2c2_pins { 152 i2c2_pins: pinmux_i2c2_pins {
145 pinctrl-single,pins = < 153 pinctrl-single,pins = <
146 0x18e (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_scl */ 154 0x18e (PIN_INPUT | MUX_MODE0) /* i2c2_scl */
147 0x190 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_sda */ 155 0x190 (PIN_INPUT | MUX_MODE0) /* i2c2_sda */
148 >; 156 >;
149 }; 157 };
150 158
151 i2c3_pins: pinmux_i2c3_pins { 159 i2c3_pins: pinmux_i2c3_pins {
152 pinctrl-single,pins = < 160 pinctrl-single,pins = <
153 0x192 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl */ 161 0x192 (PIN_INPUT | MUX_MODE0) /* i2c3_scl */
154 0x194 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda */ 162 0x194 (PIN_INPUT | MUX_MODE0) /* i2c3_sda */
155 >; 163 >;
156 }; 164 };
157 165
@@ -353,7 +361,7 @@
353 }; 361 };
354 362
355 twl_power: power { 363 twl_power: power {
356 compatible = "ti,twl4030-power-n900"; 364 compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off";
357 ti,use_poweroff; 365 ti,use_poweroff;
358 }; 366 };
359}; 367};
@@ -578,6 +586,8 @@
578 586
579&gpmc { 587&gpmc {
580 ranges = <0 0 0x04000000 0x10000000>; /* 256MB */ 588 ranges = <0 0 0x04000000 0x10000000>; /* 256MB */
589 ranges = <0 0 0x01000000 0x01000000>, /* 16 MB for OneNAND */
590 <1 0 0x02000000 0x01000000>; /* 16 MB for smc91c96 */
581 591
582 /* gpio-irq for dma: 65 */ 592 /* gpio-irq for dma: 65 */
583 593
@@ -646,6 +656,38 @@
646 reg = <0x004c0000 0x0fb40000>; 656 reg = <0x004c0000 0x0fb40000>;
647 }; 657 };
648 }; 658 };
659
660 ethernet@gpmc {
661 compatible = "smsc,lan91c94";
662 interrupt-parent = <&gpio2>;
663 interrupts = <22 IRQ_TYPE_LEVEL_HIGH>; /* gpio54 */
664 reg = <1 0x300 0xf>; /* 16 byte IO range at offset 0x300 */
665 bank-width = <2>;
666 pinctrl-names = "default";
667 pinctrl-0 = <&ethernet_pins>;
668 gpmc,device-width = <2>;
669 gpmc,sync-clk-ps = <0>;
670 gpmc,cs-on-ns = <0>;
671 gpmc,cs-rd-off-ns = <48>;
672 gpmc,cs-wr-off-ns = <24>;
673 gpmc,adv-on-ns = <0>;
674 gpmc,adv-rd-off-ns = <0>;
675 gpmc,adv-wr-off-ns = <0>;
676 gpmc,we-on-ns = <12>;
677 gpmc,we-off-ns = <18>;
678 gpmc,oe-on-ns = <12>;
679 gpmc,oe-off-ns = <48>;
680 gpmc,page-burst-access-ns = <0>;
681 gpmc,access-ns = <42>;
682 gpmc,rd-cycle-ns = <180>;
683 gpmc,wr-cycle-ns = <180>;
684 gpmc,bus-turnaround-ns = <0>;
685 gpmc,cycle2cycle-delay-ns = <0>;
686 gpmc,wait-monitoring-ns = <0>;
687 gpmc,clk-activation-ns = <0>;
688 gpmc,wr-access-ns = <0>;
689 gpmc,wr-data-mux-bus-ns = <12>;
690 };
649}; 691};
650 692
651&mcspi1 { 693&mcspi1 {
diff --git a/arch/arm/boot/dts/omap3-overo-common-peripherals.dtsi b/arch/arm/boot/dts/omap3-overo-common-peripherals.dtsi
index 5831bcc52966..520453d95704 100644
--- a/arch/arm/boot/dts/omap3-overo-common-peripherals.dtsi
+++ b/arch/arm/boot/dts/omap3-overo-common-peripherals.dtsi
@@ -36,8 +36,8 @@
36 36
37 uart3_pins: pinmux_uart3_pins { 37 uart3_pins: pinmux_uart3_pins {
38 pinctrl-single,pins = < 38 pinctrl-single,pins = <
39 OMAP3_CORE1_IOPAD(0x219e, PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */ 39 OMAP3_CORE1_IOPAD(0x219e, PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
40 OMAP3_CORE1_IOPAD(0x21a0, PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */ 40 OMAP3_CORE1_IOPAD(0x21a0, PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
41 >; 41 >;
42 }; 42 };
43}; 43};
@@ -88,6 +88,7 @@
88}; 88};
89 89
90&uart3 { 90&uart3 {
91 interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
91 pinctrl-names = "default"; 92 pinctrl-names = "default";
92 pinctrl-0 = <&uart3_pins>; 93 pinctrl-0 = <&uart3_pins>;
93}; 94};
diff --git a/arch/arm/boot/dts/omap3-tao3530.dtsi b/arch/arm/boot/dts/omap3-tao3530.dtsi
new file mode 100644
index 000000000000..b30f387d3a83
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-tao3530.dtsi
@@ -0,0 +1,337 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 * Copyright (C) 2014 Stefan Roese <sr@denx.de>
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/dts-v1/;
10
11#include "omap34xx-hs.dtsi"
12
13/ {
14 cpus {
15 cpu@0 {
16 cpu0-supply = <&vcc>;
17 };
18 };
19
20 memory {
21 device_type = "memory";
22 reg = <0x80000000 0x10000000>; /* 256 MB */
23 };
24
25 /* HS USB Port 2 Power */
26 hsusb2_power: hsusb2_power_reg {
27 compatible = "regulator-fixed";
28 regulator-name = "hsusb2_vbus";
29 regulator-min-microvolt = <3300000>;
30 regulator-max-microvolt = <3300000>;
31 gpio = <&twl_gpio 18 0>; /* GPIO LEDA */
32 startup-delay-us = <70000>;
33 };
34
35 /* HS USB Host PHY on PORT 2 */
36 hsusb2_phy: hsusb2_phy {
37 compatible = "usb-nop-xceiv";
38 reset-gpios = <&gpio6 2 GPIO_ACTIVE_LOW>; /* gpio_162 */
39 vcc-supply = <&hsusb2_power>;
40 };
41
42 sound {
43 compatible = "ti,omap-twl4030";
44 ti,model = "omap3beagle";
45
46 /* McBSP2 is used for onboard sound, same as on beagle */
47 ti,mcbsp = <&mcbsp2>;
48 ti,codec = <&twl_audio>;
49 };
50
51 /* Regulator to enable/switch the vcc of the Wifi module */
52 mmc2_sdio_poweron: regulator-mmc2-sdio-poweron {
53 compatible = "regulator-fixed";
54 regulator-name = "regulator-mmc2-sdio-poweron";
55 regulator-min-microvolt = <3150000>;
56 regulator-max-microvolt = <3150000>;
57 gpio = <&gpio5 29 GPIO_ACTIVE_LOW>; /* gpio_157 */
58 enable-active-low;
59 startup-delay-us = <10000>;
60 };
61};
62
63&omap3_pmx_core {
64 hsusbb2_pins: pinmux_hsusbb2_pins {
65 pinctrl-single,pins = <
66 OMAP3_CORE1_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
67 OMAP3_CORE1_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
68 OMAP3_CORE1_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
69 OMAP3_CORE1_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
70 OMAP3_CORE1_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
71 OMAP3_CORE1_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
72 OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */
73 OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */
74 OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */
75 OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */
76 OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */
77 OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */
78 >;
79 };
80
81 mmc1_pins: pinmux_mmc1_pins {
82 pinctrl-single,pins = <
83 OMAP3_CORE1_IOPAD(0x2144, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
84 OMAP3_CORE1_IOPAD(0x2146, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
85 OMAP3_CORE1_IOPAD(0x2148, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
86 OMAP3_CORE1_IOPAD(0x214a, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
87 OMAP3_CORE1_IOPAD(0x214c, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
88 OMAP3_CORE1_IOPAD(0x214e, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
89 OMAP3_CORE1_IOPAD(0x2150, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat4.sdmmc1_dat4 */
90 OMAP3_CORE1_IOPAD(0x2152, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat5.sdmmc1_dat5 */
91 OMAP3_CORE1_IOPAD(0x2154, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat6.sdmmc1_dat6 */
92 OMAP3_CORE1_IOPAD(0x2156, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat7.sdmmc1_dat7 */
93 >;
94 };
95
96 mmc2_pins: pinmux_mmc2_pins {
97 pinctrl-single,pins = <
98 OMAP3_CORE1_IOPAD(0x2158, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk.sdmmc2_clk */
99 OMAP3_CORE1_IOPAD(0x215a, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd.sdmmc2_cmd */
100 OMAP3_CORE1_IOPAD(0x215c, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0.sdmmc2_dat0 */
101 OMAP3_CORE1_IOPAD(0x215e, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1.sdmmc2_dat1 */
102 OMAP3_CORE1_IOPAD(0x2160, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2.sdmmc2_dat2 */
103 OMAP3_CORE1_IOPAD(0x2162, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3.sdmmc2_dat3 */
104 >;
105 };
106
107 /* wlan GPIO output for WLAN_EN */
108 wlan_gpio: pinmux_wlan_gpio {
109 pinctrl-single,pins = <
110 OMAP3_CORE1_IOPAD(0x218e, PIN_OUTPUT | MUX_MODE4) /* mcbsp1_fsr gpio_157 */
111 >;
112 };
113
114 uart3_pins: pinmux_uart3_pins {
115 pinctrl-single,pins = <
116 OMAP3_CORE1_IOPAD(0x219e, PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
117 OMAP3_CORE1_IOPAD(0x21a0, PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
118 >;
119 };
120
121 i2c3_pins: pinmux_i2c3_pins {
122 pinctrl-single,pins = <
123 OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl.i2c3_scl */
124 OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda.i2c3_sda */
125 >;
126 };
127
128 mcspi1_pins: pinmux_mcspi1_pins {
129 pinctrl-single,pins = <
130 OMAP3_CORE1_IOPAD(0x21c8, PIN_INPUT | MUX_MODE0) /* mcspi1_clk.mcspi1_clk */
131 OMAP3_CORE1_IOPAD(0x21ca, PIN_OUTPUT | MUX_MODE0) /* mcspi1_simo.mcspi1_simo */
132 OMAP3_CORE1_IOPAD(0x21cc, PIN_INPUT_PULLUP | MUX_MODE0) /* mcspi1_somi.mcspi1_somi */
133 OMAP3_CORE1_IOPAD(0x21ce, PIN_OUTPUT | MUX_MODE0) /* mcspi1_cs0.mcspi1_cs0 */
134 >;
135 };
136
137 mcspi3_pins: pinmux_mcspi3_pins {
138 pinctrl-single,pins = <
139 OMAP3_CORE1_IOPAD(0x25dc, PIN_OUTPUT | MUX_MODE1) /* etk_d0.mcspi3_simo gpio14 INPUT | MODE1 */
140 OMAP3_CORE1_IOPAD(0x25de, PIN_INPUT_PULLUP | MUX_MODE1) /* etk_d1.mcspi3_somi gpio15 INPUT | MODE1 */
141 OMAP3_CORE1_IOPAD(0x25e0, PIN_OUTPUT | MUX_MODE1) /* etk_d2.mcspi3_cs0 gpio16 INPUT | MODE1 */
142 OMAP3_CORE1_IOPAD(0x25e2, PIN_INPUT | MUX_MODE1) /* etk_d3.mcspi3_clk gpio17 INPUT | MODE1 */
143 >;
144 };
145
146 mcbsp3_pins: pinmux_mcbsp3_pins {
147 pinctrl-single,pins = <
148 OMAP3_CORE1_IOPAD(0x216c, PIN_OUTPUT | MUX_MODE0) /* mcbsp3_dx.uart2_cts */
149 OMAP3_CORE1_IOPAD(0x216e, PIN_INPUT | MUX_MODE0) /* mcbsp3_dr.uart2_rts */
150 OMAP3_CORE1_IOPAD(0x2170, PIN_INPUT | MUX_MODE0) /* mcbsp3_clk.uart2_tx */
151 OMAP3_CORE1_IOPAD(0x2172, PIN_INPUT | MUX_MODE0) /* mcbsp3_fsx.uart2_rx */
152 >;
153 };
154};
155
156/* McBSP1: mux'ed with GPIO158 as clock for HA-DSP */
157&mcbsp1 {
158 status = "disabled";
159};
160
161&mcbsp2 {
162 status = "okay";
163};
164
165&i2c1 {
166 clock-frequency = <2600000>;
167
168 twl: twl@48 {
169 reg = <0x48>;
170 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
171 interrupt-parent = <&intc>;
172
173 twl_audio: audio {
174 compatible = "ti,twl4030-audio";
175 codec {
176 };
177 };
178 };
179};
180
181&i2c3 {
182 clock-frequency = <100000>;
183
184 pinctrl-names = "default";
185 pinctrl-0 = <&i2c3_pins>;
186};
187
188&mcspi1 {
189 pinctrl-names = "default";
190 pinctrl-0 = <&mcspi1_pins>;
191
192 spidev@0 {
193 compatible = "spidev";
194 spi-max-frequency = <48000000>;
195 reg = <0>;
196 spi-cpha;
197 };
198};
199
200&mcspi3 {
201 pinctrl-names = "default";
202 pinctrl-0 = <&mcspi3_pins>;
203
204 spidev@0 {
205 compatible = "spidev";
206 spi-max-frequency = <48000000>;
207 reg = <0>;
208 spi-cpha;
209 };
210};
211
212#include "twl4030.dtsi"
213#include "twl4030_omap3.dtsi"
214
215&mmc1 {
216 pinctrl-names = "default";
217 pinctrl-0 = <&mmc1_pins>;
218 vmmc-supply = <&vmmc1>;
219 vmmc_aux-supply = <&vsim>;
220 cd-gpios = <&twl_gpio 0 0>;
221 bus-width = <8>;
222};
223
224// WiFi (Marvell 88W8686) on MMC2/SDIO
225&mmc2 {
226 pinctrl-names = "default";
227 pinctrl-0 = <&mmc2_pins>;
228 vmmc-supply = <&mmc2_sdio_poweron>;
229 non-removable;
230 bus-width = <4>;
231 cap-power-off-card;
232};
233
234&mmc3 {
235 status = "disabled";
236};
237
238&usbhshost {
239 port2-mode = "ehci-phy";
240};
241
242&usbhsehci {
243 phys = <0 &hsusb2_phy>;
244};
245
246&twl_gpio {
247 ti,use-leds;
248 /* pullups: BIT(1) */
249 ti,pullups = <0x000002>;
250 /*
251 * pulldowns:
252 * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13)
253 * BIT(15), BIT(16), BIT(17)
254 */
255 ti,pulldowns = <0x03a1c4>;
256};
257
258&uart3 {
259 pinctrl-names = "default";
260 pinctrl-0 = <&uart3_pins>;
261};
262
263&mcbsp3 {
264 status = "okay";
265 pinctrl-names = "default";
266 pinctrl-0 = <&mcbsp3_pins>;
267};
268
269&gpmc {
270 ranges = <0 0 0x00000000 0x01000000>;
271
272 nand@0,0 {
273 reg = <0 0 0>; /* CS0, offset 0 */
274 nand-bus-width = <16>;
275 gpmc,device-width = <2>; /* GPMC_DEVWIDTH_16BIT */
276 ti,nand-ecc-opt = "sw";
277
278 gpmc,cs-on-ns = <0>;
279 gpmc,cs-rd-off-ns = <36>;
280 gpmc,cs-wr-off-ns = <36>;
281 gpmc,adv-on-ns = <6>;
282 gpmc,adv-rd-off-ns = <24>;
283 gpmc,adv-wr-off-ns = <36>;
284 gpmc,oe-on-ns = <6>;
285 gpmc,oe-off-ns = <48>;
286 gpmc,we-on-ns = <6>;
287 gpmc,we-off-ns = <30>;
288 gpmc,rd-cycle-ns = <72>;
289 gpmc,wr-cycle-ns = <72>;
290 gpmc,access-ns = <54>;
291 gpmc,wr-access-ns = <30>;
292
293 #address-cells = <1>;
294 #size-cells = <1>;
295
296 x-loader@0 {
297 label = "X-Loader";
298 reg = <0 0x80000>;
299 };
300
301 bootloaders@80000 {
302 label = "U-Boot";
303 reg = <0x80000 0x1e0000>;
304 };
305
306 bootloaders_env@260000 {
307 label = "U-Boot Env";
308 reg = <0x260000 0x20000>;
309 };
310
311 kernel@280000 {
312 label = "Kernel";
313 reg = <0x280000 0x400000>;
314 };
315
316 filesystem@680000 {
317 label = "File System";
318 reg = <0x680000 0xf980000>;
319 };
320 };
321};
322
323&usb_otg_hs {
324 interface-type = <0>;
325 usb-phy = <&usb2_phy>;
326 phys = <&usb2_phy>;
327 phy-names = "usb2-phy";
328 mode = <3>;
329 power = <50>;
330};
331
332&vaux2 {
333 regulator-name = "vdd_ehci";
334 regulator-min-microvolt = <1800000>;
335 regulator-max-microvolt = <1800000>;
336 regulator-always-on;
337};
diff --git a/arch/arm/boot/dts/omap3-thunder.dts b/arch/arm/boot/dts/omap3-thunder.dts
new file mode 100644
index 000000000000..d659515ab9b8
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-thunder.dts
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 * Copyright (C) 2014 Stefan Roese <sr@denx.de>
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 "omap3-tao3530.dtsi"
11
12/ {
13 model = "TI OMAP3 Thunder baseboard with TAO3530 SOM";
14 compatible = "technexion,omap3-thunder", "technexion,omap3-tao3530", "ti,omap34xx", "ti,omap3";
15};
16
17&omap3_pmx_core {
18 dss_dpi_pins: pinmux_dss_dpi_pins {
19 pinctrl-single,pins = <
20 OMAP3_CORE1_IOPAD(0x20d4, PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */
21 OMAP3_CORE1_IOPAD(0x20d6, PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */
22 OMAP3_CORE1_IOPAD(0x20d8, PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */
23 OMAP3_CORE1_IOPAD(0x20da, PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */
24 OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */
25 OMAP3_CORE1_IOPAD(0x20de, PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */
26 OMAP3_CORE1_IOPAD(0x20e0, PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */
27 OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */
28 OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */
29 OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */
30 OMAP3_CORE1_IOPAD(0x20e8, PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */
31 OMAP3_CORE1_IOPAD(0x20ea, PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */
32 OMAP3_CORE1_IOPAD(0x20ec, PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */
33 OMAP3_CORE1_IOPAD(0x20ee, PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */
34 OMAP3_CORE1_IOPAD(0x20f0, PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */
35 OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */
36 OMAP3_CORE1_IOPAD(0x20f4, PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */
37 OMAP3_CORE1_IOPAD(0x20f6, PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */
38 OMAP3_CORE1_IOPAD(0x20f8, PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */
39 OMAP3_CORE1_IOPAD(0x20fa, PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */
40 OMAP3_CORE1_IOPAD(0x20fc, PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */
41 OMAP3_CORE1_IOPAD(0x20fe, PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */
42 OMAP3_CORE1_IOPAD(0x2100, PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */
43 OMAP3_CORE1_IOPAD(0x2102, PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */
44 OMAP3_CORE1_IOPAD(0x2104, PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */
45 OMAP3_CORE1_IOPAD(0x2106, PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */
46 OMAP3_CORE1_IOPAD(0x2108, PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */
47 OMAP3_CORE1_IOPAD(0x210a, PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */
48 >;
49 };
50
51 lte430_pins: pinmux_lte430_pins {
52 pinctrl-single,pins = <
53 OMAP3_CORE1_IOPAD(0x2168, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat6.gpio_138 */
54 >;
55 };
56
57 backlight_pins: pinmux_backlight_pins {
58 pinctrl-single,pins = <
59 OMAP3_CORE1_IOPAD(0x216a, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 */
60 >;
61 };
62};
63
64/* Needed to power the DPI pins */
65&vpll2 {
66 regulator-always-on;
67};
68
69&dss {
70 status = "ok";
71
72 pinctrl-names = "default";
73 pinctrl-0 = <&dss_dpi_pins>;
74
75 port {
76 dpi_out: endpoint {
77 remote-endpoint = <&lcd_in>;
78 data-lines = <24>;
79 };
80 };
81};
82
83/ {
84 aliases {
85 display0 = &lcd0;
86 };
87
88 lcd0: display@0 {
89 compatible = "samsung,lte430wq-f0c", "panel-dpi";
90 label = "lcd";
91
92 pinctrl-names = "default";
93 pinctrl-0 = <&lte430_pins>;
94 enable-gpios = <&gpio5 10 GPIO_ACTIVE_LOW>; /* gpio_138 */
95
96 port {
97 lcd_in: endpoint {
98 remote-endpoint = <&dpi_out>;
99 };
100 };
101
102 panel-timing {
103 clock-frequency = <9000000>;
104 hactive = <480>;
105 vactive = <272>;
106 hfront-porch = <3>;
107 hback-porch = <2>;
108 hsync-len = <42>;
109 vback-porch = <2>;
110 vfront-porch = <3>;
111 vsync-len = <11>;
112
113 hsync-active = <0>;
114 vsync-active = <0>;
115 de-active = <1>;
116 pixelclk-active = <1>;
117 };
118 };
119
120 backlight {
121 compatible = "gpio-backlight";
122
123 pinctrl-names = "default";
124 pinctrl-0 = <&backlight_pins>;
125 gpios = <&gpio5 11 GPIO_ACTIVE_HIGH>; /* gpio_139 */
126
127 default-on;
128 };
129};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 575a49bf968d..d0e884d3a737 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -97,6 +97,7 @@
97 prm: prm@48306000 { 97 prm: prm@48306000 {
98 compatible = "ti,omap3-prm"; 98 compatible = "ti,omap3-prm";
99 reg = <0x48306000 0x4000>; 99 reg = <0x48306000 0x4000>;
100 interrupts = <11>;
100 101
101 prm_clocks: clocks { 102 prm_clocks: clocks {
102 #address-cells = <1>; 103 #address-cells = <1>;
@@ -140,10 +141,9 @@
140 }; 141 };
141 142
142 intc: interrupt-controller@48200000 { 143 intc: interrupt-controller@48200000 {
143 compatible = "ti,omap2-intc"; 144 compatible = "ti,omap3-intc";
144 interrupt-controller; 145 interrupt-controller;
145 #interrupt-cells = <1>; 146 #interrupt-cells = <1>;
146 ti,intc-size = <96>;
147 reg = <0x48200000 0x1000>; 147 reg = <0x48200000 0x1000>;
148 }; 148 };
149 149
@@ -334,6 +334,10 @@
334 interrupts = <26>; 334 interrupts = <26>;
335 ti,mbox-num-users = <2>; 335 ti,mbox-num-users = <2>;
336 ti,mbox-num-fifos = <2>; 336 ti,mbox-num-fifos = <2>;
337 mbox_dsp: dsp {
338 ti,mbox-tx = <0 0 0>;
339 ti,mbox-rx = <1 0 0>;
340 };
337 }; 341 };
338 342
339 mcspi1: spi@48098000 { 343 mcspi1: spi@48098000 {
diff --git a/arch/arm/boot/dts/omap3430-sdp.dts b/arch/arm/boot/dts/omap3430-sdp.dts
index 02f69f4a8fd3..9bad94efe1c8 100644
--- a/arch/arm/boot/dts/omap3430-sdp.dts
+++ b/arch/arm/boot/dts/omap3430-sdp.dts
@@ -107,7 +107,7 @@
107 #address-cells = <1>; 107 #address-cells = <1>;
108 #size-cells = <1>; 108 #size-cells = <1>;
109 reg = <1 0 0x08000000>; 109 reg = <1 0 0x08000000>;
110 ti,nand-ecc-opt = "ham1"; 110 ti,nand-ecc-opt = "sw";
111 nand-bus-width = <8>; 111 nand-bus-width = <8>;
112 gpmc,cs-on-ns = <0>; 112 gpmc,cs-on-ns = <0>;
113 gpmc,cs-rd-off-ns = <36>; 113 gpmc,cs-rd-off-ns = <36>;
diff --git a/arch/arm/boot/dts/omap3xxx-clocks.dtsi b/arch/arm/boot/dts/omap3xxx-clocks.dtsi
index e47ff69dcf70..5c375003bad1 100644
--- a/arch/arm/boot/dts/omap3xxx-clocks.dtsi
+++ b/arch/arm/boot/dts/omap3xxx-clocks.dtsi
@@ -467,6 +467,7 @@
467 ti,bit-shift = <0x1e>; 467 ti,bit-shift = <0x1e>;
468 reg = <0x0d00>; 468 reg = <0x0d00>;
469 ti,set-bit-to-disable; 469 ti,set-bit-to-disable;
470 ti,set-rate-parent;
470 }; 471 };
471 472
472 dpll4_m6_ck: dpll4_m6_ck { 473 dpll4_m6_ck: dpll4_m6_ck {
diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi
index 8cfa3c8a72b0..150513506c19 100644
--- a/arch/arm/boot/dts/omap4-panda-common.dtsi
+++ b/arch/arm/boot/dts/omap4-panda-common.dtsi
@@ -8,9 +8,6 @@
8#include "elpida_ecb240abacn.dtsi" 8#include "elpida_ecb240abacn.dtsi"
9 9
10/ { 10/ {
11 model = "TI OMAP4 PandaBoard";
12 compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4";
13
14 memory { 11 memory {
15 device_type = "memory"; 12 device_type = "memory";
16 reg = <0x80000000 0x40000000>; /* 1 GB */ 13 reg = <0x80000000 0x40000000>; /* 1 GB */
diff --git a/arch/arm/boot/dts/omap4-panda-es.dts b/arch/arm/boot/dts/omap4-panda-es.dts
index 816d1c95b592..2f1dabcc6adf 100644
--- a/arch/arm/boot/dts/omap4-panda-es.dts
+++ b/arch/arm/boot/dts/omap4-panda-es.dts
@@ -10,6 +10,11 @@
10#include "omap4460.dtsi" 10#include "omap4460.dtsi"
11#include "omap4-panda-common.dtsi" 11#include "omap4-panda-common.dtsi"
12 12
13/ {
14 model = "TI OMAP4 PandaBoard-ES";
15 compatible = "ti,omap4-panda-es", "ti,omap4-panda", "ti,omap4460", "ti,omap4430", "ti,omap4";
16};
17
13/* Audio routing is differnet between PandaBoard4430 and PandaBoardES */ 18/* Audio routing is differnet between PandaBoard4430 and PandaBoardES */
14&sound { 19&sound {
15 ti,model = "PandaBoardES"; 20 ti,model = "PandaBoardES";
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 6189a8b77d7f..a0e28b2e254e 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -9,3 +9,8 @@
9 9
10#include "omap443x.dtsi" 10#include "omap443x.dtsi"
11#include "omap4-panda-common.dtsi" 11#include "omap4-panda-common.dtsi"
12
13/ {
14 model = "TI OMAP4 PandaBoard";
15 compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4";
16};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 69408b53200d..878c979203d0 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -81,6 +81,7 @@
81 mpu { 81 mpu {
82 compatible = "ti,omap4-mpu"; 82 compatible = "ti,omap4-mpu";
83 ti,hwmods = "mpu"; 83 ti,hwmods = "mpu";
84 sram = <&ocmcram>;
84 }; 85 };
85 86
86 dsp { 87 dsp {
@@ -129,6 +130,7 @@
129 prm: prm@4a306000 { 130 prm: prm@4a306000 {
130 compatible = "ti,omap4-prm"; 131 compatible = "ti,omap4-prm";
131 reg = <0x4a306000 0x3000>; 132 reg = <0x4a306000 0x3000>;
133 interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
132 134
133 prm_clocks: clocks { 135 prm_clocks: clocks {
134 #address-cells = <1>; 136 #address-cells = <1>;
@@ -208,6 +210,11 @@
208 }; 210 };
209 }; 211 };
210 212
213 ocmcram: ocmcram@40304000 {
214 compatible = "mmio-sram";
215 reg = <0x40304000 0xa000>; /* 40k */
216 };
217
211 sdma: dma-controller@4a056000 { 218 sdma: dma-controller@4a056000 {
212 compatible = "ti,omap4430-sdma"; 219 compatible = "ti,omap4430-sdma";
213 reg = <0x4a056000 0x1000>; 220 reg = <0x4a056000 0x1000>;
@@ -656,6 +663,14 @@
656 ti,hwmods = "mailbox"; 663 ti,hwmods = "mailbox";
657 ti,mbox-num-users = <3>; 664 ti,mbox-num-users = <3>;
658 ti,mbox-num-fifos = <8>; 665 ti,mbox-num-fifos = <8>;
666 mbox_ipu: mbox_ipu {
667 ti,mbox-tx = <0 0 0>;
668 ti,mbox-rx = <1 0 0>;
669 };
670 mbox_dsp: mbox_dsp {
671 ti,mbox-tx = <3 0 0>;
672 ti,mbox-rx = <2 0 0>;
673 };
659 }; 674 };
660 675
661 timer1: timer@4a318000 { 676 timer1: timer@4a318000 {
diff --git a/arch/arm/boot/dts/omap5-cm-t54.dts b/arch/arm/boot/dts/omap5-cm-t54.dts
index b8698ca68647..b54b271e153b 100644
--- a/arch/arm/boot/dts/omap5-cm-t54.dts
+++ b/arch/arm/boot/dts/omap5-cm-t54.dts
@@ -16,6 +16,12 @@
16 reg = <0x80000000 0x7F000000>; /* 2048 MB */ 16 reg = <0x80000000 0x7F000000>; /* 2048 MB */
17 }; 17 };
18 18
19 aliases {
20 display0 = &hdmi0;
21 display1 = &dvi0;
22 display2 = &lcd0;
23 };
24
19 vmmcsd_fixed: fixed-regulator-mmcsd { 25 vmmcsd_fixed: fixed-regulator-mmcsd {
20 compatible = "regulator-fixed"; 26 compatible = "regulator-fixed";
21 regulator-name = "vmmcsd_fixed"; 27 regulator-name = "vmmcsd_fixed";
@@ -45,6 +51,13 @@
45 enable-active-high; 51 enable-active-high;
46 }; 52 };
47 53
54 ads7846reg: ads7846-reg {
55 compatible = "regulator-fixed";
56 regulator-name = "ads7846-reg";
57 regulator-min-microvolt = <3300000>;
58 regulator-max-microvolt = <3300000>;
59 };
60
48 /* HS USB Host PHY on PORT 2 */ 61 /* HS USB Host PHY on PORT 2 */
49 hsusb2_phy: hsusb2_phy { 62 hsusb2_phy: hsusb2_phy {
50 compatible = "usb-nop-xceiv"; 63 compatible = "usb-nop-xceiv";
@@ -66,6 +79,105 @@
66 default-state = "off"; 79 default-state = "off";
67 }; 80 };
68 }; 81 };
82
83 lcd0: display {
84 compatible = "startek,startek-kd050c", "panel-dpi";
85 label = "lcd";
86
87 pinctrl-names = "default";
88 pinctrl-0 = <&lcd_pins>;
89
90 enable-gpios = <&gpio8 3 GPIO_ACTIVE_HIGH>;
91
92 panel-timing {
93 clock-frequency = <33000000>;
94 hactive = <800>;
95 vactive = <480>;
96 hfront-porch = <40>;
97 hback-porch = <40>;
98 hsync-len = <43>;
99 vback-porch = <29>;
100 vfront-porch = <13>;
101 vsync-len = <3>;
102 hsync-active = <0>;
103 vsync-active = <0>;
104 de-active = <1>;
105 pixelclk-active = <1>;
106 };
107
108 port {
109 lcd_in: endpoint {
110 remote-endpoint = <&dpi_lcd_out>;
111 };
112 };
113 };
114
115 hdmi0: connector@0 {
116 compatible = "hdmi-connector";
117 label = "hdmi";
118
119 type = "a";
120
121 pinctrl-names = "default";
122 pinctrl-0 = <&hdmi_conn_pins>;
123
124 hpd-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>; /* GPIO 193, HPD */
125
126 port {
127 hdmi_connector_in: endpoint {
128 remote-endpoint = <&hdmi_out>;
129 };
130 };
131 };
132
133 tfp410: encoder@0 {
134 compatible = "ti,tfp410";
135
136 ports {
137 #address-cells = <1>;
138 #size-cells = <0>;
139
140 port@0 {
141 reg = <0>;
142
143 tfp410_in: endpoint@0 {
144 remote-endpoint = <&dpi_dvi_out>;
145 };
146 };
147
148 port@1 {
149 reg = <1>;
150
151 tfp410_out: endpoint@0 {
152 remote-endpoint = <&dvi_connector_in>;
153 };
154 };
155 };
156 };
157
158 dvi0: connector@1 {
159 compatible = "dvi-connector";
160 label = "dvi";
161
162 digital;
163
164 ddc-i2c-bus = <&i2c2>;
165
166 port {
167 dvi_connector_in: endpoint {
168 remote-endpoint = <&tfp410_out>;
169 };
170 };
171 };
172};
173
174&omap5_pmx_wkup {
175
176 ads7846_pins: pinmux_ads7846_pins {
177 pinctrl-single,pins = <
178 0x02 (PIN_INPUT_PULLDOWN | MUX_MODE6) /* llib_wakereqin.gpio1_wk15 */
179 >;
180 };
69}; 181};
70 182
71&omap5_pmx_core { 183&omap5_pmx_core {
@@ -88,6 +200,13 @@
88 >; 200 >;
89 }; 201 };
90 202
203 i2c2_pins: pinmux_i2c2_pins {
204 pinctrl-single,pins = <
205 OMAP5_IOPAD(0x01b8, PIN_INPUT | MUX_MODE0) /* i2c2_scl */
206 OMAP5_IOPAD(0x01ba, PIN_INPUT | MUX_MODE0) /* i2c2_sda */
207 >;
208 };
209
91 mmc1_pins: pinmux_mmc1_pins { 210 mmc1_pins: pinmux_mmc1_pins {
92 pinctrl-single,pins = < 211 pinctrl-single,pins = <
93 OMAP5_IOPAD(0x01e2, PIN_INPUT_PULLUP | MUX_MODE0) /* sdcard_clk */ 212 OMAP5_IOPAD(0x01e2, PIN_INPUT_PULLUP | MUX_MODE0) /* sdcard_clk */
@@ -127,8 +246,8 @@
127 246
128 wlan_gpios_pins: pinmux_wlan_gpios_pins { 247 wlan_gpios_pins: pinmux_wlan_gpios_pins {
129 pinctrl-single,pins = < 248 pinctrl-single,pins = <
130 OMAP5_IOPAD(0x019c, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpio4_109 */ 249 OMAP5_IOPAD(0x019c, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* abemcpdm_ul_data.gpio4_109 */
131 OMAP5_IOPAD(0x019e, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpio4_110 */ 250 OMAP5_IOPAD(0x019e, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* abemcpdm_dl_data.gpio4_110 */
132 >; 251 >;
133 }; 252 };
134 253
@@ -144,6 +263,104 @@
144 OMAP5_IOPAD(0x00b6, PIN_OUTPUT | MUX_MODE6) /* hsi2_acdata.gpio3_83 */ 263 OMAP5_IOPAD(0x00b6, PIN_OUTPUT | MUX_MODE6) /* hsi2_acdata.gpio3_83 */
145 >; 264 >;
146 }; 265 };
266
267 dss_hdmi_pins: pinmux_dss_hdmi_pins {
268 pinctrl-single,pins = <
269 OMAP5_IOPAD(0x013c, PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec */
270 OMAP5_IOPAD(0x0140, PIN_INPUT | MUX_MODE0) /* hdmi_ddc_scl */
271 OMAP5_IOPAD(0x0142, PIN_INPUT | MUX_MODE0) /* hdmi_ddc_sda */
272 >;
273 };
274
275 lcd_pins: pinmux_lcd_pins {
276 pinctrl-single,pins = <
277 OMAP5_IOPAD(0x0172, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* timer11_pwm_evt.gpio8_227 */
278 >;
279 };
280
281 hdmi_conn_pins: pinmux_hdmi_conn_pins {
282 pinctrl-single,pins = <
283 OMAP5_IOPAD(0x013e, PIN_INPUT | MUX_MODE6) /* hdmi_hpd.gpio7_193 */
284 >;
285 };
286
287 dss_dpi_pins: pinmux_dss_dpi_pins {
288 pinctrl-single,pins = <
289 OMAP5_IOPAD(0x0104, PIN_OUTPUT | MUX_MODE3) /* rfbi_data15.dispc_data15 */
290 OMAP5_IOPAD(0x0106, PIN_OUTPUT | MUX_MODE3) /* rfbi_data14.dispc_data14 */
291 OMAP5_IOPAD(0x0108, PIN_OUTPUT | MUX_MODE3) /* rfbi_data13.dispc_data13 */
292 OMAP5_IOPAD(0x010a, PIN_OUTPUT | MUX_MODE3) /* rfbi_data12.dispc_data12 */
293 OMAP5_IOPAD(0x010c, PIN_OUTPUT | MUX_MODE3) /* rfbi_data11.dispc_data11 */
294 OMAP5_IOPAD(0x010e, PIN_OUTPUT | MUX_MODE3) /* rfbi_data10.dispc_data10 */
295 OMAP5_IOPAD(0x0110, PIN_OUTPUT | MUX_MODE3) /* rfbi_data9.dispc_data9 */
296 OMAP5_IOPAD(0x0112, PIN_OUTPUT | MUX_MODE3) /* rfbi_data8.dispc_data8 */
297 OMAP5_IOPAD(0x0114, PIN_OUTPUT | MUX_MODE3) /* rfbi_data7.dispc_data7 */
298 OMAP5_IOPAD(0x0116, PIN_OUTPUT | MUX_MODE3) /* rfbi_data6.dispc_data6 */
299 OMAP5_IOPAD(0x0118, PIN_OUTPUT | MUX_MODE3) /* rfbi_data5.dispc_data5 */
300 OMAP5_IOPAD(0x011a, PIN_OUTPUT | MUX_MODE3) /* rfbi_data4.dispc_data4 */
301 OMAP5_IOPAD(0x011c, PIN_OUTPUT | MUX_MODE3) /* rfbi_data3.dispc_data3 */
302 OMAP5_IOPAD(0x011e, PIN_OUTPUT | MUX_MODE3) /* rfbi_data2.dispc_data2 */
303 OMAP5_IOPAD(0x0120, PIN_OUTPUT | MUX_MODE3) /* rfbi_data1.dispc_data1 */
304 OMAP5_IOPAD(0x0122, PIN_OUTPUT | MUX_MODE3) /* rfbi_data0.dispc_data0 */
305 OMAP5_IOPAD(0x0124, PIN_OUTPUT | MUX_MODE3) /* rfbi_we.dispc_vsync */
306 OMAP5_IOPAD(0x0126, PIN_OUTPUT | MUX_MODE3) /* rfbi_cs0.dispc_hsync */
307 OMAP5_IOPAD(0x0128, PIN_OUTPUT | MUX_MODE3) /* rfbi_a0.dispc_de */
308 OMAP5_IOPAD(0x012a, PIN_OUTPUT | MUX_MODE3) /* rfbi_re.dispc_pclk */
309 OMAP5_IOPAD(0x012c, PIN_OUTPUT | MUX_MODE3) /* rfbi_hsync0.dispc_data17 */
310 OMAP5_IOPAD(0x012e, PIN_OUTPUT | MUX_MODE3) /* rfbi_te_vsync0.dispc_data16 */
311 OMAP5_IOPAD(0x0130, PIN_OUTPUT | MUX_MODE3) /* gpio6_182.dispc_data18 */
312 OMAP5_IOPAD(0x0132, PIN_OUTPUT | MUX_MODE3) /* gpio6_183.dispc_data19 */
313 OMAP5_IOPAD(0x0134, PIN_OUTPUT | MUX_MODE3) /* gpio6_184.dispc_data20 */
314 OMAP5_IOPAD(0x0136, PIN_OUTPUT | MUX_MODE3) /* gpio6_185.dispc_data21 */
315 OMAP5_IOPAD(0x0138, PIN_OUTPUT | MUX_MODE3) /* gpio6_186.dispc_data22 */
316 OMAP5_IOPAD(0x013a, PIN_OUTPUT | MUX_MODE3) /* gpio6_187.dispc_data23 */
317 >;
318 };
319
320 mcspi2_pins: pinmux_mcspi1_pins {
321 pinctrl-single,pins = <
322 OMAP5_IOPAD(0x00fc, PIN_INPUT | MUX_MODE0) /* mcspi2_clk */
323 OMAP5_IOPAD(0x00fe, PIN_INPUT | MUX_MODE0) /* mcspi2_simo */
324 OMAP5_IOPAD(0x0100, PIN_INPUT | MUX_MODE0) /* mcspi2_somi */
325 OMAP5_IOPAD(0x0102, PIN_INPUT | MUX_MODE0) /* mcspi2_cs0 */
326 >;
327 };
328};
329
330&mcspi2 {
331 pinctrl-names = "default";
332 pinctrl-0 = <&mcspi2_pins>;
333
334 /* touch controller */
335 ads7846@0 {
336 pinctrl-names = "default";
337 pinctrl-0 = <&ads7846_pins>;
338
339 compatible = "ti,ads7846";
340 vcc-supply = <&ads7846reg>;
341
342 reg = <0>; /* CS0 */
343 spi-max-frequency = <1500000>;
344
345 interrupt-parent = <&gpio1>;
346 interrupts = <15 0>; /* gpio1_wk15 */
347 pendown-gpio = <&gpio1 15 0>;
348
349
350 ti,x-min = /bits/ 16 <0x0>;
351 ti,x-max = /bits/ 16 <0x0fff>;
352 ti,y-min = /bits/ 16 <0x0>;
353 ti,y-max = /bits/ 16 <0x0fff>;
354
355 ti,x-plate-ohms = /bits/ 16 <180>;
356 ti,pressure-max = /bits/ 16 <255>;
357
358 ti,debounce-max = /bits/ 16 <30>;
359 ti,debounce-tol = /bits/ 16 <10>;
360 ti,debounce-rep = /bits/ 16 <1>;
361
362 linux,wakeup;
363 };
147}; 364};
148 365
149&mmc1 { 366&mmc1 {
@@ -353,13 +570,12 @@
353 }; 570 };
354 571
355 ldo8_reg: ldo8 { 572 ldo8_reg: ldo8 {
356 /* VDD_3v0: Does not go anywhere */ 573 /* VDD_3V_GP: act led/serial console */
357 regulator-name = "ldo8"; 574 regulator-name = "ldo8";
358 regulator-min-microvolt = <3000000>; 575 regulator-min-microvolt = <3000000>;
359 regulator-max-microvolt = <3000000>; 576 regulator-max-microvolt = <3000000>;
577 regulator-always-on;
360 regulator-boot-on; 578 regulator-boot-on;
361 /* Unused */
362 status = "disabled";
363 }; 579 };
364 580
365 ldo9_reg: ldo9 { 581 ldo9_reg: ldo9 {
@@ -399,6 +615,13 @@
399 }; 615 };
400}; 616};
401 617
618&i2c2 {
619 pinctrl-names = "default";
620 pinctrl-0 = <&i2c2_pins>;
621
622 clock-frequency = <100000>;
623};
624
402&usbhshost { 625&usbhshost {
403 port2-mode = "ehci-hsic"; 626 port2-mode = "ehci-hsic";
404 port3-mode = "ehci-hsic"; 627 port3-mode = "ehci-hsic";
@@ -408,6 +631,50 @@
408 phys = <0 &hsusb2_phy &hsusb3_phy>; 631 phys = <0 &hsusb2_phy &hsusb3_phy>;
409}; 632};
410 633
634&usb3 {
635 extcon = <&extcon_usb3>;
636 vbus-supply = <&smps10_out1_reg>;
637};
638
411&cpu0 { 639&cpu0 {
412 cpu0-supply = <&smps123_reg>; 640 cpu0-supply = <&smps123_reg>;
413}; 641};
642
643&dss {
644 status = "ok";
645
646 pinctrl-names = "default";
647 pinctrl-0 = <&dss_dpi_pins>;
648
649 port {
650 dpi_dvi_out: endpoint@0 {
651 remote-endpoint = <&tfp410_in>;
652 data-lines = <24>;
653 };
654
655 dpi_lcd_out: endpoint@1 {
656 remote-endpoint = <&lcd_in>;
657 data-lines = <24>;
658 };
659 };
660};
661
662&dsi2 {
663 status = "ok";
664 vdd-supply = <&ldo4_reg>;
665};
666
667&hdmi {
668 status = "ok";
669 vdda-supply = <&ldo4_reg>;
670
671 pinctrl-names = "default";
672 pinctrl-0 = <&dss_hdmi_pins>;
673
674 port {
675 hdmi_out: endpoint {
676 remote-endpoint = <&hdmi_connector_in>;
677 lanes = <1 0 3 2 5 4 7 6>;
678 };
679 };
680};
diff --git a/arch/arm/boot/dts/omap5-sbc-t54.dts b/arch/arm/boot/dts/omap5-sbc-t54.dts
index aa98fea3f2b3..337bbbc01a35 100644
--- a/arch/arm/boot/dts/omap5-sbc-t54.dts
+++ b/arch/arm/boot/dts/omap5-sbc-t54.dts
@@ -1,11 +1,11 @@
1/* 1/*
2 * Suppport for CompuLab SBC-T54 with CM-T54 2 * Suppport for CompuLab CM-T54 on SB-T54 baseboard
3 */ 3 */
4 4
5#include "omap5-cm-t54.dts" 5#include "omap5-cm-t54.dts"
6 6
7/ { 7/ {
8 model = "CompuLab SBC-T54 with CM-T54"; 8 model = "CompuLab CM-T54 on SB-T54";
9 compatible = "compulab,omap5-sbc-t54", "compulab,omap5-cm-t54", "ti,omap5"; 9 compatible = "compulab,omap5-sbc-t54", "compulab,omap5-cm-t54", "ti,omap5";
10}; 10};
11 11
@@ -19,8 +19,8 @@
19 19
20 mmc1_aux_pins: pinmux_mmc1_aux_pins { 20 mmc1_aux_pins: pinmux_mmc1_aux_pins {
21 pinctrl-single,pins = < 21 pinctrl-single,pins = <
22 OMAP5_IOPAD(0x0174, PIN_INPUT_PULLUP | MUX_MODE6) /* gpio8_228 */ 22 OMAP5_IOPAD(0x0174, PIN_INPUT_PULLUP | MUX_MODE6) /* timer5_pwm_evt.gpio8_228 */
23 OMAP5_IOPAD(0x0176, PIN_INPUT_PULLUP | MUX_MODE6) /* gpio8_229 */ 23 OMAP5_IOPAD(0x0176, PIN_INPUT_PULLUP | MUX_MODE6) /* timer6_pwm_evt.gpio8_229 */
24 >; 24 >;
25 }; 25 };
26}; 26};
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index fc8df1739f39..256b7f69e45b 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -104,8 +104,9 @@
104 soc { 104 soc {
105 compatible = "ti,omap-infra"; 105 compatible = "ti,omap-infra";
106 mpu { 106 mpu {
107 compatible = "ti,omap5-mpu"; 107 compatible = "ti,omap4-mpu";
108 ti,hwmods = "mpu"; 108 ti,hwmods = "mpu";
109 sram = <&ocmcram>;
109 }; 110 };
110 }; 111 };
111 112
@@ -131,6 +132,7 @@
131 prm: prm@4ae06000 { 132 prm: prm@4ae06000 {
132 compatible = "ti,omap5-prm"; 133 compatible = "ti,omap5-prm";
133 reg = <0x4ae06000 0x3000>; 134 reg = <0x4ae06000 0x3000>;
135 interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
134 136
135 prm_clocks: clocks { 137 prm_clocks: clocks {
136 #address-cells = <1>; 138 #address-cells = <1>;
@@ -187,18 +189,22 @@
187 }; 189 };
188 190
189 omap5_pmx_core: pinmux@4a002840 { 191 omap5_pmx_core: pinmux@4a002840 {
190 compatible = "ti,omap4-padconf", "pinctrl-single"; 192 compatible = "ti,omap5-padconf", "pinctrl-single";
191 reg = <0x4a002840 0x01b6>; 193 reg = <0x4a002840 0x01b6>;
192 #address-cells = <1>; 194 #address-cells = <1>;
193 #size-cells = <0>; 195 #size-cells = <0>;
196 #interrupt-cells = <1>;
197 interrupt-controller;
194 pinctrl-single,register-width = <16>; 198 pinctrl-single,register-width = <16>;
195 pinctrl-single,function-mask = <0x7fff>; 199 pinctrl-single,function-mask = <0x7fff>;
196 }; 200 };
197 omap5_pmx_wkup: pinmux@4ae0c840 { 201 omap5_pmx_wkup: pinmux@4ae0c840 {
198 compatible = "ti,omap4-padconf", "pinctrl-single"; 202 compatible = "ti,omap5-padconf", "pinctrl-single";
199 reg = <0x4ae0c840 0x0038>; 203 reg = <0x4ae0c840 0x0038>;
200 #address-cells = <1>; 204 #address-cells = <1>;
201 #size-cells = <0>; 205 #size-cells = <0>;
206 #interrupt-cells = <1>;
207 interrupt-controller;
202 pinctrl-single,register-width = <16>; 208 pinctrl-single,register-width = <16>;
203 pinctrl-single,function-mask = <0x7fff>; 209 pinctrl-single,function-mask = <0x7fff>;
204 }; 210 };
@@ -219,6 +225,11 @@
219 }; 225 };
220 }; 226 };
221 227
228 ocmcram: ocmcram@40300000 {
229 compatible = "mmio-sram";
230 reg = <0x40300000 0x20000>; /* 128k */
231 };
232
222 sdma: dma-controller@4a056000 { 233 sdma: dma-controller@4a056000 {
223 compatible = "ti,omap4430-sdma"; 234 compatible = "ti,omap4430-sdma";
224 reg = <0x4a056000 0x1000>; 235 reg = <0x4a056000 0x1000>;
@@ -447,7 +458,7 @@
447 uart1: serial@4806a000 { 458 uart1: serial@4806a000 {
448 compatible = "ti,omap4-uart"; 459 compatible = "ti,omap4-uart";
449 reg = <0x4806a000 0x100>; 460 reg = <0x4806a000 0x100>;
450 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; 461 interrupts-extended = <&gic GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
451 ti,hwmods = "uart1"; 462 ti,hwmods = "uart1";
452 clock-frequency = <48000000>; 463 clock-frequency = <48000000>;
453 }; 464 };
@@ -455,7 +466,7 @@
455 uart2: serial@4806c000 { 466 uart2: serial@4806c000 {
456 compatible = "ti,omap4-uart"; 467 compatible = "ti,omap4-uart";
457 reg = <0x4806c000 0x100>; 468 reg = <0x4806c000 0x100>;
458 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; 469 interrupts-extended = <&gic GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
459 ti,hwmods = "uart2"; 470 ti,hwmods = "uart2";
460 clock-frequency = <48000000>; 471 clock-frequency = <48000000>;
461 }; 472 };
@@ -463,7 +474,7 @@
463 uart3: serial@48020000 { 474 uart3: serial@48020000 {
464 compatible = "ti,omap4-uart"; 475 compatible = "ti,omap4-uart";
465 reg = <0x48020000 0x100>; 476 reg = <0x48020000 0x100>;
466 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; 477 interrupts-extended = <&gic GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
467 ti,hwmods = "uart3"; 478 ti,hwmods = "uart3";
468 clock-frequency = <48000000>; 479 clock-frequency = <48000000>;
469 }; 480 };
@@ -471,7 +482,7 @@
471 uart4: serial@4806e000 { 482 uart4: serial@4806e000 {
472 compatible = "ti,omap4-uart"; 483 compatible = "ti,omap4-uart";
473 reg = <0x4806e000 0x100>; 484 reg = <0x4806e000 0x100>;
474 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; 485 interrupts-extended = <&gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
475 ti,hwmods = "uart4"; 486 ti,hwmods = "uart4";
476 clock-frequency = <48000000>; 487 clock-frequency = <48000000>;
477 }; 488 };
@@ -479,7 +490,7 @@
479 uart5: serial@48066000 { 490 uart5: serial@48066000 {
480 compatible = "ti,omap4-uart"; 491 compatible = "ti,omap4-uart";
481 reg = <0x48066000 0x100>; 492 reg = <0x48066000 0x100>;
482 interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>; 493 interrupts-extended = <&gic GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
483 ti,hwmods = "uart5"; 494 ti,hwmods = "uart5";
484 clock-frequency = <48000000>; 495 clock-frequency = <48000000>;
485 }; 496 };
@@ -487,7 +498,7 @@
487 uart6: serial@48068000 { 498 uart6: serial@48068000 {
488 compatible = "ti,omap4-uart"; 499 compatible = "ti,omap4-uart";
489 reg = <0x48068000 0x100>; 500 reg = <0x48068000 0x100>;
490 interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; 501 interrupts-extended = <&gic GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
491 ti,hwmods = "uart6"; 502 ti,hwmods = "uart6";
492 clock-frequency = <48000000>; 503 clock-frequency = <48000000>;
493 }; 504 };
@@ -642,6 +653,14 @@
642 ti,hwmods = "mailbox"; 653 ti,hwmods = "mailbox";
643 ti,mbox-num-users = <3>; 654 ti,mbox-num-users = <3>;
644 ti,mbox-num-fifos = <8>; 655 ti,mbox-num-fifos = <8>;
656 mbox_ipu: mbox_ipu {
657 ti,mbox-tx = <0 0 0>;
658 ti,mbox-rx = <1 0 0>;
659 };
660 mbox_dsp: mbox_dsp {
661 ti,mbox-tx = <3 0 0>;
662 ti,mbox-rx = <2 0 0>;
663 };
645 }; 664 };
646 665
647 timer1: timer@4ae18000 { 666 timer1: timer@4ae18000 {
@@ -945,6 +964,15 @@
945 clock-names = "fck"; 964 clock-names = "fck";
946 }; 965 };
947 966
967 rfbi: encoder@58002000 {
968 compatible = "ti,omap5-rfbi";
969 reg = <0x58002000 0x100>;
970 status = "disabled";
971 ti,hwmods = "dss_rfbi";
972 clocks = <&dss_dss_clk>, <&l3_iclk_div>;
973 clock-names = "fck", "ick";
974 };
975
948 dsi1: encoder@58004000 { 976 dsi1: encoder@58004000 {
949 compatible = "ti,omap5-dsi"; 977 compatible = "ti,omap5-dsi";
950 reg = <0x58004000 0x200>, 978 reg = <0x58004000 0x200>,
diff --git a/arch/arm/boot/dts/omap54xx-clocks.dtsi b/arch/arm/boot/dts/omap54xx-clocks.dtsi
index e67a23b5d788..58c27466f012 100644
--- a/arch/arm/boot/dts/omap54xx-clocks.dtsi
+++ b/arch/arm/boot/dts/omap54xx-clocks.dtsi
@@ -367,10 +367,12 @@
367 367
368 l3_iclk_div: l3_iclk_div { 368 l3_iclk_div: l3_iclk_div {
369 #clock-cells = <0>; 369 #clock-cells = <0>;
370 compatible = "fixed-factor-clock"; 370 compatible = "ti,divider-clock";
371 ti,max-div = <2>;
372 ti,bit-shift = <4>;
373 reg = <0x100>;
371 clocks = <&dpll_core_h12x2_ck>; 374 clocks = <&dpll_core_h12x2_ck>;
372 clock-mult = <1>; 375 ti,index-power-of-two;
373 clock-div = <1>;
374 }; 376 };
375 377
376 gpu_l3_iclk: gpu_l3_iclk { 378 gpu_l3_iclk: gpu_l3_iclk {
@@ -383,10 +385,12 @@
383 385
384 l4_root_clk_div: l4_root_clk_div { 386 l4_root_clk_div: l4_root_clk_div {
385 #clock-cells = <0>; 387 #clock-cells = <0>;
386 compatible = "fixed-factor-clock"; 388 compatible = "ti,divider-clock";
389 ti,max-div = <2>;
390 ti,bit-shift = <8>;
391 reg = <0x100>;
387 clocks = <&l3_iclk_div>; 392 clocks = <&l3_iclk_div>;
388 clock-mult = <1>; 393 ti,index-power-of-two;
389 clock-div = <1>;
390 }; 394 };
391 395
392 slimbus1_slimbus_clk: slimbus1_slimbus_clk { 396 slimbus1_slimbus_clk: slimbus1_slimbus_clk {
diff --git a/arch/arm/boot/dts/pxa2xx.dtsi b/arch/arm/boot/dts/pxa2xx.dtsi
index a5e90f078aa9..c08f84629aa9 100644
--- a/arch/arm/boot/dts/pxa2xx.dtsi
+++ b/arch/arm/boot/dts/pxa2xx.dtsi
@@ -113,14 +113,14 @@
113 }; 113 };
114 114
115 usb0: ohci@4c000000 { 115 usb0: ohci@4c000000 {
116 compatible = "mrvl,pxa-ohci"; 116 compatible = "marvell,pxa-ohci";
117 reg = <0x4c000000 0x10000>; 117 reg = <0x4c000000 0x10000>;
118 interrupts = <3>; 118 interrupts = <3>;
119 status = "disabled"; 119 status = "disabled";
120 }; 120 };
121 121
122 mmc0: mmc@41100000 { 122 mmc0: mmc@41100000 {
123 compatible = "mrvl,pxa-mmc"; 123 compatible = "marvell,pxa-mmc";
124 reg = <0x41100000 0x1000>; 124 reg = <0x41100000 0x1000>;
125 interrupts = <23>; 125 interrupts = <23>;
126 status = "disabled"; 126 status = "disabled";
diff --git a/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts b/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts
index 7c2441d526bc..b396c8311b27 100644
--- a/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts
+++ b/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts
@@ -5,6 +5,33 @@
5 compatible = "qcom,apq8064-ifc6410", "qcom,apq8064"; 5 compatible = "qcom,apq8064-ifc6410", "qcom,apq8064";
6 6
7 soc { 7 soc {
8 pinctrl@800000 {
9 i2c1_pins: i2c1 {
10 mux {
11 pins = "gpio20", "gpio21";
12 function = "gsbi1";
13 };
14 };
15 };
16
17 gsbi@12440000 {
18 status = "okay";
19 qcom,mode = <GSBI_PROT_I2C>;
20
21 i2c@12460000 {
22 status = "okay";
23 clock-frequency = <200000>;
24 pinctrl-0 = <&i2c1_pins>;
25 pinctrl-names = "default";
26
27 eeprom: eeprom@52 {
28 compatible = "atmel,24c128";
29 reg = <0x52>;
30 pagesize = <32>;
31 };
32 };
33 };
34
8 gsbi@16600000 { 35 gsbi@16600000 {
9 status = "ok"; 36 status = "ok";
10 qcom,mode = <GSBI_PROT_I2C_UART>; 37 qcom,mode = <GSBI_PROT_I2C_UART>;
@@ -12,5 +39,21 @@
12 status = "ok"; 39 status = "ok";
13 }; 40 };
14 }; 41 };
42
43 amba {
44 /* eMMC */
45 sdcc1: sdcc@12400000 {
46 status = "okay";
47 };
48
49 /* External micro SD card */
50 sdcc3: sdcc@12180000 {
51 status = "okay";
52 };
53 /* WLAN */
54 sdcc4: sdcc@121c0000 {
55 status = "okay";
56 };
57 };
15 }; 58 };
16}; 59};
diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index 92bf793622c3..b3154c071652 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -2,7 +2,9 @@
2 2
3#include "skeleton.dtsi" 3#include "skeleton.dtsi"
4#include <dt-bindings/clock/qcom,gcc-msm8960.h> 4#include <dt-bindings/clock/qcom,gcc-msm8960.h>
5#include <dt-bindings/clock/qcom,mmcc-msm8960.h>
5#include <dt-bindings/soc/qcom,gsbi.h> 6#include <dt-bindings/soc/qcom,gsbi.h>
7#include <dt-bindings/interrupt-controller/arm-gic.h>
6 8
7/ { 9/ {
8 model = "Qualcomm APQ8064"; 10 model = "Qualcomm APQ8064";
@@ -70,6 +72,34 @@
70 ranges; 72 ranges;
71 compatible = "simple-bus"; 73 compatible = "simple-bus";
72 74
75 tlmm_pinmux: pinctrl@800000 {
76 compatible = "qcom,apq8064-pinctrl";
77 reg = <0x800000 0x4000>;
78
79 gpio-controller;
80 #gpio-cells = <2>;
81 interrupt-controller;
82 #interrupt-cells = <2>;
83 interrupts = <0 16 IRQ_TYPE_LEVEL_HIGH>;
84
85 pinctrl-names = "default";
86 pinctrl-0 = <&ps_hold>;
87
88 sdc4_gpios: sdc4-gpios {
89 pios {
90 pins = "gpio63", "gpio64", "gpio65", "gpio66", "gpio67", "gpio68";
91 function = "sdc4";
92 };
93 };
94
95 ps_hold: ps_hold {
96 mux {
97 pins = "gpio78";
98 function = "ps_hold";
99 };
100 };
101 };
102
73 intc: interrupt-controller@2000000 { 103 intc: interrupt-controller@2000000 {
74 compatible = "qcom,msm-qgic2"; 104 compatible = "qcom,msm-qgic2";
75 interrupt-controller; 105 interrupt-controller;
@@ -133,6 +163,48 @@
133 regulator; 163 regulator;
134 }; 164 };
135 165
166 gsbi1: gsbi@12440000 {
167 status = "disabled";
168 compatible = "qcom,gsbi-v1.0.0";
169 reg = <0x12440000 0x100>;
170 clocks = <&gcc GSBI1_H_CLK>;
171 clock-names = "iface";
172 #address-cells = <1>;
173 #size-cells = <1>;
174 ranges;
175
176 i2c1: i2c@12460000 {
177 compatible = "qcom,i2c-qup-v1.1.1";
178 reg = <0x12460000 0x1000>;
179 interrupts = <0 194 IRQ_TYPE_NONE>;
180 clocks = <&gcc GSBI1_QUP_CLK>, <&gcc GSBI1_H_CLK>;
181 clock-names = "core", "iface";
182 #address-cells = <1>;
183 #size-cells = <0>;
184 };
185 };
186
187 gsbi2: gsbi@12480000 {
188 status = "disabled";
189 compatible = "qcom,gsbi-v1.0.0";
190 reg = <0x12480000 0x100>;
191 clocks = <&gcc GSBI2_H_CLK>;
192 clock-names = "iface";
193 #address-cells = <1>;
194 #size-cells = <1>;
195 ranges;
196
197 i2c2: i2c@124a0000 {
198 compatible = "qcom,i2c-qup-v1.1.1";
199 reg = <0x124a0000 0x1000>;
200 interrupts = <0 196 IRQ_TYPE_NONE>;
201 clocks = <&gcc GSBI2_QUP_CLK>, <&gcc GSBI2_H_CLK>;
202 clock-names = "core", "iface";
203 #address-cells = <1>;
204 #size-cells = <0>;
205 };
206 };
207
136 gsbi7: gsbi@16600000 { 208 gsbi7: gsbi@16600000 {
137 status = "disabled"; 209 status = "disabled";
138 compatible = "qcom,gsbi-v1.0.0"; 210 compatible = "qcom,gsbi-v1.0.0";
@@ -166,5 +238,116 @@
166 #clock-cells = <1>; 238 #clock-cells = <1>;
167 #reset-cells = <1>; 239 #reset-cells = <1>;
168 }; 240 };
241
242 mmcc: clock-controller@4000000 {
243 compatible = "qcom,mmcc-apq8064";
244 reg = <0x4000000 0x1000>;
245 #clock-cells = <1>;
246 #reset-cells = <1>;
247 };
248
249 /* Temporary fixed regulator */
250 vsdcc_fixed: vsdcc-regulator {
251 compatible = "regulator-fixed";
252 regulator-name = "SDCC Power";
253 regulator-min-microvolt = <2700000>;
254 regulator-max-microvolt = <2700000>;
255 regulator-always-on;
256 };
257
258 sdcc1bam:dma@12402000{
259 compatible = "qcom,bam-v1.3.0";
260 reg = <0x12402000 0x8000>;
261 interrupts = <0 98 0>;
262 clocks = <&gcc SDC1_H_CLK>;
263 clock-names = "bam_clk";
264 #dma-cells = <1>;
265 qcom,ee = <0>;
266 };
267
268 sdcc3bam:dma@12182000{
269 compatible = "qcom,bam-v1.3.0";
270 reg = <0x12182000 0x8000>;
271 interrupts = <0 96 0>;
272 clocks = <&gcc SDC3_H_CLK>;
273 clock-names = "bam_clk";
274 #dma-cells = <1>;
275 qcom,ee = <0>;
276 };
277
278 sdcc4bam:dma@121c2000{
279 compatible = "qcom,bam-v1.3.0";
280 reg = <0x121c2000 0x8000>;
281 interrupts = <0 95 0>;
282 clocks = <&gcc SDC4_H_CLK>;
283 clock-names = "bam_clk";
284 #dma-cells = <1>;
285 qcom,ee = <0>;
286 };
287
288 amba {
289 compatible = "arm,amba-bus";
290 #address-cells = <1>;
291 #size-cells = <1>;
292 ranges;
293 sdcc1: sdcc@12400000 {
294 status = "disabled";
295 compatible = "arm,pl18x", "arm,primecell";
296 arm,primecell-periphid = <0x00051180>;
297 reg = <0x12400000 0x2000>;
298 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
299 interrupt-names = "cmd_irq";
300 clocks = <&gcc SDC1_CLK>, <&gcc SDC1_H_CLK>;
301 clock-names = "mclk", "apb_pclk";
302 bus-width = <8>;
303 max-frequency = <96000000>;
304 non-removable;
305 cap-sd-highspeed;
306 cap-mmc-highspeed;
307 vmmc-supply = <&vsdcc_fixed>;
308 dmas = <&sdcc1bam 2>, <&sdcc1bam 1>;
309 dma-names = "tx", "rx";
310 };
311
312 sdcc3: sdcc@12180000 {
313 compatible = "arm,pl18x", "arm,primecell";
314 arm,primecell-periphid = <0x00051180>;
315 status = "disabled";
316 reg = <0x12180000 0x2000>;
317 interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
318 interrupt-names = "cmd_irq";
319 clocks = <&gcc SDC3_CLK>, <&gcc SDC3_H_CLK>;
320 clock-names = "mclk", "apb_pclk";
321 bus-width = <4>;
322 cap-sd-highspeed;
323 cap-mmc-highspeed;
324 max-frequency = <192000000>;
325 no-1-8-v;
326 vmmc-supply = <&vsdcc_fixed>;
327 dmas = <&sdcc3bam 2>, <&sdcc3bam 1>;
328 dma-names = "tx", "rx";
329 };
330
331 sdcc4: sdcc@121c0000 {
332 compatible = "arm,pl18x", "arm,primecell";
333 arm,primecell-periphid = <0x00051180>;
334 status = "disabled";
335 reg = <0x121c0000 0x2000>;
336 interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
337 interrupt-names = "cmd_irq";
338 clocks = <&gcc SDC4_CLK>, <&gcc SDC4_H_CLK>;
339 clock-names = "mclk", "apb_pclk";
340 bus-width = <4>;
341 cap-sd-highspeed;
342 cap-mmc-highspeed;
343 max-frequency = <48000000>;
344 vmmc-supply = <&vsdcc_fixed>;
345 vqmmc-supply = <&vsdcc_fixed>;
346 dmas = <&sdcc4bam 2>, <&sdcc4bam 1>;
347 dma-names = "tx", "rx";
348 pinctrl-names = "default";
349 pinctrl-0 = <&sdc4_gpios>;
350 };
351 };
169 }; 352 };
170}; 353};
diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
index b4dfb01fe6fb..47370494d0f8 100644
--- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
@@ -22,6 +22,13 @@
22 22
23 23
24 pinctrl@fd510000 { 24 pinctrl@fd510000 {
25 i2c11_pins: i2c11 {
26 mux {
27 pins = "gpio83", "gpio84";
28 function = "blsp_i2c11";
29 };
30 };
31
25 spi8_default: spi8_default { 32 spi8_default: spi8_default {
26 mosi { 33 mosi {
27 pins = "gpio45"; 34 pins = "gpio45";
@@ -41,5 +48,19 @@
41 }; 48 };
42 }; 49 };
43 }; 50 };
51
52 i2c@f9967000 {
53 status = "okay";
54 clock-frequency = <200000>;
55 pinctrl-0 = <&i2c11_pins>;
56 pinctrl-names = "default";
57
58 eeprom: eeprom@52 {
59 compatible = "atmel,24c128";
60 reg = <0x52>;
61 pagesize = <32>;
62 read-only;
63 };
64 };
44 }; 65 };
45}; 66};
diff --git a/arch/arm/boot/dts/qcom-apq8084-ifc6540.dts b/arch/arm/boot/dts/qcom-apq8084-ifc6540.dts
new file mode 100644
index 000000000000..c9ff10821ad9
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-apq8084-ifc6540.dts
@@ -0,0 +1,23 @@
1#include "qcom-apq8084.dtsi"
2
3/ {
4 model = "Qualcomm APQ8084/IFC6540";
5 compatible = "qcom,apq8084-ifc6540", "qcom,apq8084";
6
7 soc {
8 serial@f995e000 {
9 status = "okay";
10 };
11
12 sdhci@f9824900 {
13 bus-width = <8>;
14 non-removable;
15 status = "okay";
16 };
17
18 sdhci@f98a4900 {
19 cd-gpios = <&tlmm 122 GPIO_ACTIVE_LOW>;
20 bus-width = <4>;
21 };
22 };
23};
diff --git a/arch/arm/boot/dts/qcom-apq8084-mtp.dts b/arch/arm/boot/dts/qcom-apq8084-mtp.dts
index 9dae3878b71d..8ecec58a9ff6 100644
--- a/arch/arm/boot/dts/qcom-apq8084-mtp.dts
+++ b/arch/arm/boot/dts/qcom-apq8084-mtp.dts
@@ -3,4 +3,10 @@
3/ { 3/ {
4 model = "Qualcomm APQ 8084-MTP"; 4 model = "Qualcomm APQ 8084-MTP";
5 compatible = "qcom,apq8084-mtp", "qcom,apq8084"; 5 compatible = "qcom,apq8084-mtp", "qcom,apq8084";
6
7 soc {
8 serial@f995e000 {
9 status = "okay";
10 };
11 };
6}; 12};
diff --git a/arch/arm/boot/dts/qcom-apq8084.dtsi b/arch/arm/boot/dts/qcom-apq8084.dtsi
index e3e009a5912b..1f130bc16858 100644
--- a/arch/arm/boot/dts/qcom-apq8084.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8084.dtsi
@@ -2,6 +2,9 @@
2 2
3#include "skeleton.dtsi" 3#include "skeleton.dtsi"
4 4
5#include <dt-bindings/clock/qcom,gcc-apq8084.h>
6#include <dt-bindings/gpio/gpio.h>
7
5/ { 8/ {
6 model = "Qualcomm APQ 8084"; 9 model = "Qualcomm APQ 8084";
7 compatible = "qcom,apq8084"; 10 compatible = "qcom,apq8084";
@@ -175,5 +178,53 @@
175 compatible = "qcom,pshold"; 178 compatible = "qcom,pshold";
176 reg = <0xfc4ab000 0x4>; 179 reg = <0xfc4ab000 0x4>;
177 }; 180 };
181
182 gcc: clock-controller@fc400000 {
183 compatible = "qcom,gcc-apq8084";
184 #clock-cells = <1>;
185 #reset-cells = <1>;
186 reg = <0xfc400000 0x4000>;
187 };
188
189 tlmm: pinctrl@fd510000 {
190 compatible = "qcom,apq8084-pinctrl";
191 reg = <0xfd510000 0x4000>;
192 gpio-controller;
193 #gpio-cells = <2>;
194 interrupt-controller;
195 #interrupt-cells = <2>;
196 interrupts = <0 208 0>;
197 };
198
199 serial@f995e000 {
200 compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
201 reg = <0xf995e000 0x1000>;
202 interrupts = <0 114 0x0>;
203 clocks = <&gcc GCC_BLSP2_UART2_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>;
204 clock-names = "core", "iface";
205 status = "disabled";
206 };
207
208 sdhci@f9824900 {
209 compatible = "qcom,sdhci-msm-v4";
210 reg = <0xf9824900 0x11c>, <0xf9824000 0x800>;
211 reg-names = "hc_mem", "core_mem";
212 interrupts = <0 123 0>, <0 138 0>;
213 interrupt-names = "hc_irq", "pwr_irq";
214 clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>;
215 clock-names = "core", "iface";
216 status = "disabled";
217 };
218
219 sdhci@f98a4900 {
220 compatible = "qcom,sdhci-msm-v4";
221 reg = <0xf98a4900 0x11c>, <0xf98a4000 0x800>;
222 reg-names = "hc_mem", "core_mem";
223 interrupts = <0 125 0>, <0 221 0>;
224 interrupt-names = "hc_irq", "pwr_irq";
225 clocks = <&gcc GCC_SDCC2_APPS_CLK>, <&gcc GCC_SDCC2_AHB_CLK>;
226 clock-names = "core", "iface";
227 status = "disabled";
228 };
178 }; 229 };
179}; 230};
diff --git a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
new file mode 100644
index 000000000000..95e64955fb8e
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
@@ -0,0 +1,85 @@
1#include "qcom-ipq8064-v1.0.dtsi"
2
3/ {
4 model = "Qualcomm IPQ8064/AP148";
5 compatible = "qcom,ipq8064-ap148", "qcom,ipq8064";
6
7 reserved-memory {
8 #address-cells = <1>;
9 #size-cells = <1>;
10 ranges;
11 rsvd@41200000 {
12 reg = <0x41200000 0x300000>;
13 no-map;
14 };
15 };
16
17 soc {
18 pinmux@800000 {
19 i2c4_pins: i2c4_pinmux {
20 pins = "gpio12", "gpio13";
21 function = "gsbi4";
22 bias-disable;
23 };
24
25 spi_pins: spi_pins {
26 mux {
27 pins = "gpio18", "gpio19", "gpio21";
28 function = "gsbi5";
29 drive-strength = <10>;
30 bias-none;
31 };
32 };
33 };
34
35 gsbi@16300000 {
36 qcom,mode = <GSBI_PROT_I2C_UART>;
37 status = "ok";
38 serial@16340000 {
39 status = "ok";
40 };
41
42 i2c4: i2c@16380000 {
43 status = "ok";
44
45 clock-frequency = <200000>;
46
47 pinctrl-0 = <&i2c4_pins>;
48 pinctrl-names = "default";
49 };
50 };
51
52 gsbi5: gsbi@1a200000 {
53 qcom,mode = <GSBI_PROT_SPI>;
54 status = "ok";
55
56 spi4: spi@1a280000 {
57 status = "ok";
58 spi-max-frequency = <50000000>;
59
60 pinctrl-0 = <&spi_pins>;
61 pinctrl-names = "default";
62
63 cs-gpios = <&qcom_pinmux 20 0>;
64
65 flash: m25p80@0 {
66 compatible = "s25fl256s1";
67 #address-cells = <1>;
68 #size-cells = <1>;
69 spi-max-frequency = <50000000>;
70 reg = <0>;
71
72 partition@0 {
73 label = "rootfs";
74 reg = <0x0 0x1000000>;
75 };
76
77 partition@1 {
78 label = "scratch";
79 reg = <0x1000000 0x1000000>;
80 };
81 };
82 };
83 };
84 };
85};
diff --git a/arch/arm/boot/dts/qcom-ipq8064-v1.0.dtsi b/arch/arm/boot/dts/qcom-ipq8064-v1.0.dtsi
new file mode 100644
index 000000000000..7093b075e408
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-ipq8064-v1.0.dtsi
@@ -0,0 +1 @@
#include "qcom-ipq8064.dtsi"
diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi
new file mode 100644
index 000000000000..244f857f0e6f
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
@@ -0,0 +1,250 @@
1/dts-v1/;
2
3#include "skeleton.dtsi"
4#include <dt-bindings/clock/qcom,gcc-ipq806x.h>
5#include <dt-bindings/soc/qcom,gsbi.h>
6
7/ {
8 model = "Qualcomm IPQ8064";
9 compatible = "qcom,ipq8064";
10 interrupt-parent = <&intc>;
11
12 cpus {
13 #address-cells = <1>;
14 #size-cells = <0>;
15
16 cpu@0 {
17 compatible = "qcom,krait";
18 enable-method = "qcom,kpss-acc-v1";
19 device_type = "cpu";
20 reg = <0>;
21 next-level-cache = <&L2>;
22 qcom,acc = <&acc0>;
23 qcom,saw = <&saw0>;
24 };
25
26 cpu@1 {
27 compatible = "qcom,krait";
28 enable-method = "qcom,kpss-acc-v1";
29 device_type = "cpu";
30 reg = <1>;
31 next-level-cache = <&L2>;
32 qcom,acc = <&acc1>;
33 qcom,saw = <&saw1>;
34 };
35
36 L2: l2-cache {
37 compatible = "cache";
38 cache-level = <2>;
39 };
40 };
41
42 cpu-pmu {
43 compatible = "qcom,krait-pmu";
44 interrupts = <1 10 0x304>;
45 };
46
47 reserved-memory {
48 #address-cells = <1>;
49 #size-cells = <1>;
50 ranges;
51
52 nss@40000000 {
53 reg = <0x40000000 0x1000000>;
54 no-map;
55 };
56
57 smem@41000000 {
58 reg = <0x41000000 0x200000>;
59 no-map;
60 };
61 };
62
63 soc: soc {
64 #address-cells = <1>;
65 #size-cells = <1>;
66 ranges;
67 compatible = "simple-bus";
68
69 qcom_pinmux: pinmux@800000 {
70 compatible = "qcom,ipq8064-pinctrl";
71 reg = <0x800000 0x4000>;
72
73 gpio-controller;
74 #gpio-cells = <2>;
75 interrupt-controller;
76 #interrupt-cells = <2>;
77 interrupts = <0 32 0x4>;
78 };
79
80 intc: interrupt-controller@2000000 {
81 compatible = "qcom,msm-qgic2";
82 interrupt-controller;
83 #interrupt-cells = <3>;
84 reg = <0x02000000 0x1000>,
85 <0x02002000 0x1000>;
86 };
87
88 timer@200a000 {
89 compatible = "qcom,kpss-timer", "qcom,msm-timer";
90 interrupts = <1 1 0x301>,
91 <1 2 0x301>,
92 <1 3 0x301>;
93 reg = <0x0200a000 0x100>;
94 clock-frequency = <25000000>,
95 <32768>;
96 cpu-offset = <0x80000>;
97 };
98
99 acc0: clock-controller@2088000 {
100 compatible = "qcom,kpss-acc-v1";
101 reg = <0x02088000 0x1000>, <0x02008000 0x1000>;
102 };
103
104 acc1: clock-controller@2098000 {
105 compatible = "qcom,kpss-acc-v1";
106 reg = <0x02098000 0x1000>, <0x02008000 0x1000>;
107 };
108
109 saw0: regulator@2089000 {
110 compatible = "qcom,saw2";
111 reg = <0x02089000 0x1000>, <0x02009000 0x1000>;
112 regulator;
113 };
114
115 saw1: regulator@2099000 {
116 compatible = "qcom,saw2";
117 reg = <0x02099000 0x1000>, <0x02009000 0x1000>;
118 regulator;
119 };
120
121 gsbi2: gsbi@12480000 {
122 compatible = "qcom,gsbi-v1.0.0";
123 reg = <0x12480000 0x100>;
124 clocks = <&gcc GSBI2_H_CLK>;
125 clock-names = "iface";
126 #address-cells = <1>;
127 #size-cells = <1>;
128 ranges;
129 status = "disabled";
130
131 serial@12490000 {
132 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm";
133 reg = <0x12490000 0x1000>,
134 <0x12480000 0x1000>;
135 interrupts = <0 195 0x0>;
136 clocks = <&gcc GSBI2_UART_CLK>, <&gcc GSBI2_H_CLK>;
137 clock-names = "core", "iface";
138 status = "disabled";
139 };
140
141 i2c@124a0000 {
142 compatible = "qcom,i2c-qup-v1.1.1";
143 reg = <0x124a0000 0x1000>;
144 interrupts = <0 196 0>;
145
146 clocks = <&gcc GSBI2_QUP_CLK>, <&gcc GSBI2_H_CLK>;
147 clock-names = "core", "iface";
148 status = "disabled";
149
150 #address-cells = <1>;
151 #size-cells = <0>;
152 };
153
154 };
155
156 gsbi4: gsbi@16300000 {
157 compatible = "qcom,gsbi-v1.0.0";
158 reg = <0x16300000 0x100>;
159 clocks = <&gcc GSBI4_H_CLK>;
160 clock-names = "iface";
161 #address-cells = <1>;
162 #size-cells = <1>;
163 ranges;
164 status = "disabled";
165
166 serial@16340000 {
167 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm";
168 reg = <0x16340000 0x1000>,
169 <0x16300000 0x1000>;
170 interrupts = <0 152 0x0>;
171 clocks = <&gcc GSBI4_UART_CLK>, <&gcc GSBI4_H_CLK>;
172 clock-names = "core", "iface";
173 status = "disabled";
174 };
175
176 i2c@16380000 {
177 compatible = "qcom,i2c-qup-v1.1.1";
178 reg = <0x16380000 0x1000>;
179 interrupts = <0 153 0>;
180
181 clocks = <&gcc GSBI4_QUP_CLK>, <&gcc GSBI4_H_CLK>;
182 clock-names = "core", "iface";
183 status = "disabled";
184
185 #address-cells = <1>;
186 #size-cells = <0>;
187 };
188 };
189
190 gsbi5: gsbi@1a200000 {
191 compatible = "qcom,gsbi-v1.0.0";
192 reg = <0x1a200000 0x100>;
193 clocks = <&gcc GSBI5_H_CLK>;
194 clock-names = "iface";
195 #address-cells = <1>;
196 #size-cells = <1>;
197 ranges;
198 status = "disabled";
199
200 serial@1a240000 {
201 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm";
202 reg = <0x1a240000 0x1000>,
203 <0x1a200000 0x1000>;
204 interrupts = <0 154 0x0>;
205 clocks = <&gcc GSBI5_UART_CLK>, <&gcc GSBI5_H_CLK>;
206 clock-names = "core", "iface";
207 status = "disabled";
208 };
209
210 i2c@1a280000 {
211 compatible = "qcom,i2c-qup-v1.1.1";
212 reg = <0x1a280000 0x1000>;
213 interrupts = <0 155 0>;
214
215 clocks = <&gcc GSBI5_QUP_CLK>, <&gcc GSBI5_H_CLK>;
216 clock-names = "core", "iface";
217 status = "disabled";
218
219 #address-cells = <1>;
220 #size-cells = <0>;
221 };
222
223 spi@1a280000 {
224 compatible = "qcom,spi-qup-v1.1.1";
225 reg = <0x1a280000 0x1000>;
226 interrupts = <0 155 0>;
227
228 clocks = <&gcc GSBI5_QUP_CLK>, <&gcc GSBI5_H_CLK>;
229 clock-names = "core", "iface";
230 status = "disabled";
231
232 #address-cells = <1>;
233 #size-cells = <0>;
234 };
235 };
236
237 qcom,ssbi@500000 {
238 compatible = "qcom,ssbi";
239 reg = <0x00500000 0x1000>;
240 qcom,controller-type = "pmic-arbiter";
241 };
242
243 gcc: clock-controller@900000 {
244 compatible = "qcom,gcc-ipq8064";
245 reg = <0x00900000 0x4000>;
246 #clock-cells = <1>;
247 #reset-cells = <1>;
248 };
249 };
250};
diff --git a/arch/arm/boot/dts/qcom-msm8660-surf.dts b/arch/arm/boot/dts/qcom-msm8660-surf.dts
index 45180adfadf1..e0883c376248 100644
--- a/arch/arm/boot/dts/qcom-msm8660-surf.dts
+++ b/arch/arm/boot/dts/qcom-msm8660-surf.dts
@@ -1,3 +1,5 @@
1#include <dt-bindings/input/input.h>
2
1#include "qcom-msm8660.dtsi" 3#include "qcom-msm8660.dtsi"
2 4
3/ { 5/ {
@@ -12,5 +14,45 @@
12 status = "ok"; 14 status = "ok";
13 }; 15 };
14 }; 16 };
17
18 amba {
19 /* eMMC */
20 sdcc1: sdcc@12400000 {
21 status = "okay";
22 };
23
24 /* External micro SD card */
25 sdcc3: sdcc@12180000 {
26 status = "okay";
27 };
28 };
29 };
30};
31
32&pmicintc {
33 keypad@148 {
34 linux,keymap = <
35 MATRIX_KEY(0, 0, KEY_FN_F1)
36 MATRIX_KEY(0, 1, KEY_UP)
37 MATRIX_KEY(0, 2, KEY_LEFT)
38 MATRIX_KEY(0, 3, KEY_VOLUMEUP)
39 MATRIX_KEY(1, 0, KEY_FN_F2)
40 MATRIX_KEY(1, 1, KEY_RIGHT)
41 MATRIX_KEY(1, 2, KEY_DOWN)
42 MATRIX_KEY(1, 3, KEY_VOLUMEDOWN)
43 MATRIX_KEY(2, 3, KEY_ENTER)
44 MATRIX_KEY(4, 0, KEY_CAMERA_FOCUS)
45 MATRIX_KEY(4, 1, KEY_UP)
46 MATRIX_KEY(4, 2, KEY_LEFT)
47 MATRIX_KEY(4, 3, KEY_HOME)
48 MATRIX_KEY(4, 4, KEY_FN_F3)
49 MATRIX_KEY(5, 0, KEY_CAMERA)
50 MATRIX_KEY(5, 1, KEY_RIGHT)
51 MATRIX_KEY(5, 2, KEY_DOWN)
52 MATRIX_KEY(5, 3, KEY_BACK)
53 MATRIX_KEY(5, 4, KEY_MENU)
54 >;
55 keypad,num-rows = <6>;
56 keypad,num-columns = <5>;
15 }; 57 };
16}; 58};
diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi
index 53837aaa2f72..0affd6193f56 100644
--- a/arch/arm/boot/dts/qcom-msm8660.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8660.dtsi
@@ -2,6 +2,7 @@
2 2
3/include/ "skeleton.dtsi" 3/include/ "skeleton.dtsi"
4 4
5#include <dt-bindings/interrupt-controller/arm-gic.h>
5#include <dt-bindings/clock/qcom,gcc-msm8660.h> 6#include <dt-bindings/clock/qcom,gcc-msm8660.h>
6#include <dt-bindings/soc/qcom,gsbi.h> 7#include <dt-bindings/soc/qcom,gsbi.h>
7 8
@@ -103,6 +104,98 @@
103 compatible = "qcom,ssbi"; 104 compatible = "qcom,ssbi";
104 reg = <0x500000 0x1000>; 105 reg = <0x500000 0x1000>;
105 qcom,controller-type = "pmic-arbiter"; 106 qcom,controller-type = "pmic-arbiter";
107
108 pmicintc: pmic@0 {
109 compatible = "qcom,pm8058";
110 interrupt-parent = <&msmgpio>;
111 interrupts = <88 8>;
112 #interrupt-cells = <2>;
113 interrupt-controller;
114 #address-cells = <1>;
115 #size-cells = <0>;
116
117 pwrkey@1c {
118 compatible = "qcom,pm8058-pwrkey";
119 reg = <0x1c>;
120 interrupt-parent = <&pmicintc>;
121 interrupts = <50 1>, <51 1>;
122 debounce = <15625>;
123 pull-up;
124 };
125
126 keypad@148 {
127 compatible = "qcom,pm8058-keypad";
128 reg = <0x148>;
129 interrupt-parent = <&pmicintc>;
130 interrupts = <74 1>, <75 1>;
131 debounce = <15>;
132 scan-delay = <32>;
133 row-hold = <91500>;
134 };
135
136 rtc@11d {
137 compatible = "qcom,pm8058-rtc";
138 interrupt-parent = <&pmicintc>;
139 interrupts = <39 1>;
140 reg = <0x11d>;
141 allow-set-time;
142 };
143
144 vibrator@4a {
145 compatible = "qcom,pm8058-vib";
146 reg = <0x4a>;
147 };
148 };
149 };
150
151 /* Temporary fixed regulator */
152 vsdcc_fixed: vsdcc-regulator {
153 compatible = "regulator-fixed";
154 regulator-name = "SDCC Power";
155 regulator-min-microvolt = <2700000>;
156 regulator-max-microvolt = <2700000>;
157 regulator-always-on;
158 };
159
160 amba {
161 compatible = "arm,amba-bus";
162 #address-cells = <1>;
163 #size-cells = <1>;
164 ranges;
165 sdcc1: sdcc@12400000 {
166 status = "disabled";
167 compatible = "arm,pl18x", "arm,primecell";
168 arm,primecell-periphid = <0x00051180>;
169 reg = <0x12400000 0x8000>;
170 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
171 interrupt-names = "cmd_irq";
172 clocks = <&gcc SDC1_CLK>, <&gcc SDC1_H_CLK>;
173 clock-names = "mclk", "apb_pclk";
174 bus-width = <8>;
175 max-frequency = <48000000>;
176 non-removable;
177 cap-sd-highspeed;
178 cap-mmc-highspeed;
179 vmmc-supply = <&vsdcc_fixed>;
180 };
181
182 sdcc3: sdcc@12180000 {
183 compatible = "arm,pl18x", "arm,primecell";
184 arm,primecell-periphid = <0x00051180>;
185 status = "disabled";
186 reg = <0x12180000 0x8000>;
187 interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
188 interrupt-names = "cmd_irq";
189 clocks = <&gcc SDC3_CLK>, <&gcc SDC3_H_CLK>;
190 clock-names = "mclk", "apb_pclk";
191 bus-width = <4>;
192 cap-sd-highspeed;
193 cap-mmc-highspeed;
194 max-frequency = <48000000>;
195 no-1-8-v;
196 vmmc-supply = <&vsdcc_fixed>;
197 };
106 }; 198 };
107 }; 199 };
200
108}; 201};
diff --git a/arch/arm/boot/dts/qcom-msm8960-cdp.dts b/arch/arm/boot/dts/qcom-msm8960-cdp.dts
index 8f75cc4c8340..7f70fae90959 100644
--- a/arch/arm/boot/dts/qcom-msm8960-cdp.dts
+++ b/arch/arm/boot/dts/qcom-msm8960-cdp.dts
@@ -1,3 +1,5 @@
1#include <dt-bindings/input/input.h>
2
1#include "qcom-msm8960.dtsi" 3#include "qcom-msm8960.dtsi"
2 4
3/ { 5/ {
@@ -12,5 +14,30 @@
12 status = "ok"; 14 status = "ok";
13 }; 15 };
14 }; 16 };
17
18 amba {
19 /* eMMC */
20 sdcc1: sdcc@12400000 {
21 status = "okay";
22 };
23
24 /* External micro SD card */
25 sdcc3: sdcc@12180000 {
26 status = "okay";
27 };
28 };
29 };
30};
31
32&pmicintc {
33 keypad@148 {
34 linux,keymap = <
35 MATRIX_KEY(0, 0, KEY_VOLUMEUP)
36 MATRIX_KEY(0, 1, KEY_VOLUMEDOWN)
37 MATRIX_KEY(0, 2, KEY_CAMERA_FOCUS)
38 MATRIX_KEY(0, 3, KEY_CAMERA)
39 >;
40 keypad,num-rows = <1>;
41 keypad,num-columns = <5>;
15 }; 42 };
16}; 43};
diff --git a/arch/arm/boot/dts/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom-msm8960.dtsi
index 5303e53e34dc..e1b0d5cd9e3c 100644
--- a/arch/arm/boot/dts/qcom-msm8960.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8960.dtsi
@@ -2,6 +2,7 @@
2 2
3/include/ "skeleton.dtsi" 3/include/ "skeleton.dtsi"
4 4
5#include <dt-bindings/interrupt-controller/arm-gic.h>
5#include <dt-bindings/clock/qcom,gcc-msm8960.h> 6#include <dt-bindings/clock/qcom,gcc-msm8960.h>
6#include <dt-bindings/soc/qcom,gsbi.h> 7#include <dt-bindings/soc/qcom,gsbi.h>
7 8
@@ -143,6 +144,43 @@
143 compatible = "qcom,ssbi"; 144 compatible = "qcom,ssbi";
144 reg = <0x500000 0x1000>; 145 reg = <0x500000 0x1000>;
145 qcom,controller-type = "pmic-arbiter"; 146 qcom,controller-type = "pmic-arbiter";
147
148 pmicintc: pmic@0 {
149 compatible = "qcom,pm8921";
150 interrupt-parent = <&msmgpio>;
151 interrupts = <104 8>;
152 #interrupt-cells = <2>;
153 interrupt-controller;
154 #address-cells = <1>;
155 #size-cells = <0>;
156
157 pwrkey@1c {
158 compatible = "qcom,pm8921-pwrkey";
159 reg = <0x1c>;
160 interrupt-parent = <&pmicintc>;
161 interrupts = <50 1>, <51 1>;
162 debounce = <15625>;
163 pull-up;
164 };
165
166 keypad@148 {
167 compatible = "qcom,pm8921-keypad";
168 reg = <0x148>;
169 interrupt-parent = <&pmicintc>;
170 interrupts = <74 1>, <75 1>;
171 debounce = <15>;
172 scan-delay = <32>;
173 row-hold = <91500>;
174 };
175
176 rtc@11d {
177 compatible = "qcom,pm8921-rtc";
178 interrupt-parent = <&pmicintc>;
179 interrupts = <39 1>;
180 reg = <0x11d>;
181 allow-set-time;
182 };
183 };
146 }; 184 };
147 185
148 rng@1a500000 { 186 rng@1a500000 {
@@ -151,5 +189,54 @@
151 clocks = <&gcc PRNG_CLK>; 189 clocks = <&gcc PRNG_CLK>;
152 clock-names = "core"; 190 clock-names = "core";
153 }; 191 };
192
193 /* Temporary fixed regulator */
194 vsdcc_fixed: vsdcc-regulator {
195 compatible = "regulator-fixed";
196 regulator-name = "SDCC Power";
197 regulator-min-microvolt = <2700000>;
198 regulator-max-microvolt = <2700000>;
199 regulator-always-on;
200 };
201
202 amba {
203 compatible = "arm,amba-bus";
204 #address-cells = <1>;
205 #size-cells = <1>;
206 ranges;
207 sdcc1: sdcc@12400000 {
208 status = "disabled";
209 compatible = "arm,pl18x", "arm,primecell";
210 arm,primecell-periphid = <0x00051180>;
211 reg = <0x12400000 0x8000>;
212 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
213 interrupt-names = "cmd_irq";
214 clocks = <&gcc SDC1_CLK>, <&gcc SDC1_H_CLK>;
215 clock-names = "mclk", "apb_pclk";
216 bus-width = <8>;
217 max-frequency = <96000000>;
218 non-removable;
219 cap-sd-highspeed;
220 cap-mmc-highspeed;
221 vmmc-supply = <&vsdcc_fixed>;
222 };
223
224 sdcc3: sdcc@12180000 {
225 compatible = "arm,pl18x", "arm,primecell";
226 arm,primecell-periphid = <0x00051180>;
227 status = "disabled";
228 reg = <0x12180000 0x8000>;
229 interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
230 interrupt-names = "cmd_irq";
231 clocks = <&gcc SDC3_CLK>, <&gcc SDC3_H_CLK>;
232 clock-names = "mclk", "apb_pclk";
233 bus-width = <4>;
234 cap-sd-highspeed;
235 cap-mmc-highspeed;
236 max-frequency = <192000000>;
237 no-1-8-v;
238 vmmc-supply = <&vsdcc_fixed>;
239 };
240 };
154 }; 241 };
155}; 242};
diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
index 69dca2aca25a..e265ec16a787 100644
--- a/arch/arm/boot/dts/qcom-msm8974.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
@@ -1,8 +1,8 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include "skeleton.dtsi" 3#include <dt-bindings/interrupt-controller/irq.h>
4
5#include <dt-bindings/clock/qcom,gcc-msm8974.h> 4#include <dt-bindings/clock/qcom,gcc-msm8974.h>
5#include "skeleton.dtsi"
6 6
7/ { 7/ {
8 model = "Qualcomm MSM8974"; 8 model = "Qualcomm MSM8974";
@@ -236,5 +236,16 @@
236 #interrupt-cells = <2>; 236 #interrupt-cells = <2>;
237 interrupts = <0 208 0>; 237 interrupts = <0 208 0>;
238 }; 238 };
239
240 blsp_i2c11: i2c@f9967000 {
241 status = "disable";
242 compatible = "qcom,i2c-qup-v2.1.1";
243 reg = <0xf9967000 0x1000>;
244 interrupts = <0 105 IRQ_TYPE_NONE>;
245 clocks = <&gcc GCC_BLSP2_QUP5_I2C_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>;
246 clock-names = "core", "iface";
247 #address-cells = <1>;
248 #size-cells = <0>;
249 };
239 }; 250 };
240}; 251};
diff --git a/arch/arm/boot/dts/r7s72100-genmai.dts b/arch/arm/boot/dts/r7s72100-genmai.dts
index 20705467f4c9..a3ed23c0a8f5 100644
--- a/arch/arm/boot/dts/r7s72100-genmai.dts
+++ b/arch/arm/boot/dts/r7s72100-genmai.dts
@@ -43,6 +43,10 @@
43 clock-frequency = <48000000>; 43 clock-frequency = <48000000>;
44}; 44};
45 45
46&mtu2 {
47 status = "ok";
48};
49
46&i2c2 { 50&i2c2 {
47 status = "okay"; 51 status = "okay";
48 clock-frequency = <400000>; 52 clock-frequency = <400000>;
diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index bdee22541189..801a556e264b 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -229,6 +229,16 @@
229 status = "disabled"; 229 status = "disabled";
230 }; 230 };
231 231
232 mtu2: timer@fcff0000 {
233 compatible = "renesas,mtu2-r7s72100", "renesas,mtu2";
234 reg = <0xfcff0000 0x400>;
235 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
236 interrupt-names = "tgi0a";
237 clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
238 clock-names = "fck";
239 status = "disabled";
240 };
241
232 scif0: serial@e8007000 { 242 scif0: serial@e8007000 {
233 compatible = "renesas,scif-r7s72100", "renesas,scif"; 243 compatible = "renesas,scif-r7s72100", "renesas,scif";
234 reg = <0xe8007000 64>; 244 reg = <0xe8007000 64>;
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index d8ec5058c351..ef152e384822 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -51,7 +51,7 @@
51 }; 51 };
52 52
53 irqc0: interrupt-controller@e61c0000 { 53 irqc0: interrupt-controller@e61c0000 {
54 compatible = "renesas,irqc"; 54 compatible = "renesas,irqc-r8a73a4", "renesas,irqc";
55 #interrupt-cells = <2>; 55 #interrupt-cells = <2>;
56 interrupt-controller; 56 interrupt-controller;
57 reg = <0 0xe61c0000 0 0x200>; 57 reg = <0 0xe61c0000 0 0x200>;
@@ -90,7 +90,7 @@
90 }; 90 };
91 91
92 irqc1: interrupt-controller@e61c0200 { 92 irqc1: interrupt-controller@e61c0200 {
93 compatible = "renesas,irqc"; 93 compatible = "renesas,irqc-r8a73a4", "renesas,irqc";
94 #interrupt-cells = <2>; 94 #interrupt-cells = <2>;
95 interrupt-controller; 95 interrupt-controller;
96 reg = <0 0xe61c0200 0 0x200>; 96 reg = <0 0xe61c0200 0 0x200>;
@@ -165,7 +165,7 @@
165 }; 165 };
166 166
167 thermal@e61f0000 { 167 thermal@e61f0000 {
168 compatible = "renesas,rcar-thermal"; 168 compatible = "renesas,thermal-r8a73a4", "renesas,rcar-thermal";
169 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>, 169 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>,
170 <0 0xe61f0200 0 0x38>, <0 0xe61f0300 0 0x38>; 170 <0 0xe61f0200 0 0x38>, <0 0xe61f0300 0 0x38>;
171 interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>; 171 interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
deleted file mode 100644
index ee9e7d5c97a9..000000000000
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+++ /dev/null
@@ -1,283 +0,0 @@
1/*
2 * Reference Device Tree Source for the armadillo 800 eva board
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/dts-v1/;
12#include "r8a7740.dtsi"
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/input/input.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/pwm/pwm.h>
17
18/ {
19 model = "armadillo 800 eva reference";
20 compatible = "renesas,armadillo800eva-reference", "renesas,r8a7740";
21
22 aliases {
23 serial1 = &scifa1;
24 };
25
26 chosen {
27 bootargs = "console=tty0 console=ttySC1,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
28 };
29
30 memory {
31 device_type = "memory";
32 reg = <0x40000000 0x20000000>;
33 };
34
35 reg_3p3v: regulator@0 {
36 compatible = "regulator-fixed";
37 regulator-name = "fixed-3.3V";
38 regulator-min-microvolt = <3300000>;
39 regulator-max-microvolt = <3300000>;
40 regulator-always-on;
41 regulator-boot-on;
42 };
43
44 vcc_sdhi0: regulator@1 {
45 compatible = "regulator-fixed";
46
47 regulator-name = "SDHI0 Vcc";
48 regulator-min-microvolt = <3300000>;
49 regulator-max-microvolt = <3300000>;
50
51 gpio = <&pfc 75 GPIO_ACTIVE_HIGH>;
52 enable-active-high;
53 };
54
55 vccq_sdhi0: regulator@2 {
56 compatible = "regulator-gpio";
57
58 regulator-name = "SDHI0 VccQ";
59 regulator-min-microvolt = <1800000>;
60 regulator-max-microvolt = <3300000>;
61 vin-supply = <&vcc_sdhi0>;
62
63 enable-gpio = <&pfc 74 GPIO_ACTIVE_HIGH>;
64 gpios = <&pfc 17 GPIO_ACTIVE_HIGH>;
65 states = <3300000 0
66 1800000 1>;
67
68 enable-active-high;
69 };
70
71 reg_5p0v: regulator@3 {
72 compatible = "regulator-fixed";
73 regulator-name = "fixed-5.0V";
74 regulator-min-microvolt = <5000000>;
75 regulator-max-microvolt = <5000000>;
76 regulator-always-on;
77 regulator-boot-on;
78 };
79
80 gpio-keys {
81 compatible = "gpio-keys";
82
83 power-key {
84 gpios = <&pfc 99 GPIO_ACTIVE_LOW>;
85 linux,code = <KEY_POWER>;
86 label = "SW3";
87 gpio-key,wakeup;
88 };
89
90 back-key {
91 gpios = <&pfc 100 GPIO_ACTIVE_LOW>;
92 linux,code = <KEY_BACK>;
93 label = "SW4";
94 };
95
96 menu-key {
97 gpios = <&pfc 97 GPIO_ACTIVE_LOW>;
98 linux,code = <KEY_MENU>;
99 label = "SW5";
100 };
101
102 home-key {
103 gpios = <&pfc 98 GPIO_ACTIVE_LOW>;
104 linux,code = <KEY_HOME>;
105 label = "SW6";
106 };
107 };
108
109 leds {
110 compatible = "gpio-leds";
111 led3 {
112 gpios = <&pfc 102 GPIO_ACTIVE_HIGH>;
113 label = "LED3";
114 };
115 led4 {
116 gpios = <&pfc 111 GPIO_ACTIVE_HIGH>;
117 label = "LED4";
118 };
119 led5 {
120 gpios = <&pfc 110 GPIO_ACTIVE_HIGH>;
121 label = "LED5";
122 };
123 led6 {
124 gpios = <&pfc 177 GPIO_ACTIVE_HIGH>;
125 label = "LED6";
126 };
127 };
128
129 i2c2: i2c@2 {
130 #address-cells = <1>;
131 #size-cells = <0>;
132 compatible = "i2c-gpio";
133 gpios = <&pfc 208 GPIO_ACTIVE_HIGH /* sda */
134 &pfc 91 GPIO_ACTIVE_HIGH /* scl */
135 >;
136 i2c-gpio,delay-us = <5>;
137 };
138
139 backlight {
140 compatible = "pwm-backlight";
141 pwms = <&tpu 2 33333 PWM_POLARITY_INVERTED>;
142 brightness-levels = <0 1 2 4 8 16 32 64 128 255>;
143 default-brightness-level = <9>;
144 pinctrl-0 = <&backlight_pins>;
145 pinctrl-names = "default";
146 power-supply = <&reg_5p0v>;
147 enable-gpios = <&pfc 61 GPIO_ACTIVE_HIGH>;
148 };
149
150 sound {
151 compatible = "simple-audio-card";
152
153 simple-audio-card,format = "i2s";
154
155 simple-audio-card,cpu {
156 sound-dai = <&sh_fsi2 0>;
157 bitclock-inversion;
158 };
159
160 simple-audio-card,codec {
161 sound-dai = <&wm8978>;
162 bitclock-master;
163 frame-master;
164 system-clock-frequency = <12288000>;
165 };
166 };
167};
168
169&ether {
170 pinctrl-0 = <&ether_pins>;
171 pinctrl-names = "default";
172
173 phy-handle = <&phy0>;
174 status = "ok";
175
176 phy0: ethernet-phy@0 {
177 reg = <0>;
178 };
179};
180
181&i2c0 {
182 status = "okay";
183 touchscreen@55 {
184 compatible = "sitronix,st1232";
185 reg = <0x55>;
186 interrupt-parent = <&irqpin1>;
187 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
188 pinctrl-0 = <&st1232_pins>;
189 pinctrl-names = "default";
190 gpios = <&pfc 166 GPIO_ACTIVE_LOW>;
191 };
192
193 wm8978: wm8978@1a {
194 #sound-dai-cells = <0>;
195 compatible = "wlf,wm8978";
196 reg = <0x1a>;
197 };
198};
199
200&i2c2 {
201 status = "okay";
202 rtc@30 {
203 compatible = "sii,s35390a";
204 reg = <0x30>;
205 };
206};
207
208&pfc {
209 ether_pins: ether {
210 renesas,groups = "gether_mii", "gether_int";
211 renesas,function = "gether";
212 };
213
214 scifa1_pins: serial1 {
215 renesas,groups = "scifa1_data";
216 renesas,function = "scifa1";
217 };
218
219 st1232_pins: touchscreen {
220 renesas,groups = "intc_irq10";
221 renesas,function = "intc";
222 };
223
224 backlight_pins: backlight {
225 renesas,groups = "tpu0_to2_1";
226 renesas,function = "tpu0";
227 };
228
229 mmc0_pins: mmc0 {
230 renesas,groups = "mmc0_data8_1", "mmc0_ctrl_1";
231 renesas,function = "mmc0";
232 };
233
234 sdhi0_pins: sd0 {
235 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_wp";
236 renesas,function = "sdhi0";
237 };
238
239 fsia_pins: sounda {
240 renesas,groups = "fsia_sclk_in", "fsia_mclk_out",
241 "fsia_data_in_1", "fsia_data_out_0";
242 renesas,function = "fsia";
243 };
244};
245
246&tpu {
247 status = "okay";
248};
249
250&mmcif0 {
251 pinctrl-0 = <&mmc0_pins>;
252 pinctrl-names = "default";
253
254 vmmc-supply = <&reg_3p3v>;
255 bus-width = <8>;
256 non-removable;
257 status = "okay";
258};
259
260&scifa1 {
261 pinctrl-0 = <&scifa1_pins>;
262 pinctrl-names = "default";
263
264 status = "okay";
265};
266
267&sdhi0 {
268 pinctrl-0 = <&sdhi0_pins>;
269 pinctrl-names = "default";
270
271 vmmc-supply = <&vcc_sdhi0>;
272 vqmmc-supply = <&vccq_sdhi0>;
273 bus-width = <4>;
274 cd-gpios = <&pfc 167 GPIO_ACTIVE_LOW>;
275 status = "okay";
276};
277
278&sh_fsi2 {
279 pinctrl-0 = <&fsia_pins>;
280 pinctrl-names = "default";
281
282 status = "okay";
283};
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
index a06a11e1a840..effb7b46f131 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
@@ -10,10 +10,18 @@
10 10
11/dts-v1/; 11/dts-v1/;
12#include "r8a7740.dtsi" 12#include "r8a7740.dtsi"
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/input/input.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/pwm/pwm.h>
13 17
14/ { 18/ {
15 model = "armadillo 800 eva"; 19 model = "armadillo 800 eva";
16 compatible = "renesas,armadillo800eva"; 20 compatible = "renesas,armadillo800eva", "renesas,r8a7740";
21
22 aliases {
23 serial1 = &scifa1;
24 };
17 25
18 chosen { 26 chosen {
19 bootargs = "console=tty0 console=ttySC1,115200 earlyprintk=sh-sci.1,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw"; 27 bootargs = "console=tty0 console=ttySC1,115200 earlyprintk=sh-sci.1,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
@@ -23,4 +31,270 @@
23 device_type = "memory"; 31 device_type = "memory";
24 reg = <0x40000000 0x20000000>; 32 reg = <0x40000000 0x20000000>;
25 }; 33 };
34
35 reg_3p3v: regulator@0 {
36 compatible = "regulator-fixed";
37 regulator-name = "fixed-3.3V";
38 regulator-min-microvolt = <3300000>;
39 regulator-max-microvolt = <3300000>;
40 regulator-always-on;
41 regulator-boot-on;
42 };
43
44 vcc_sdhi0: regulator@1 {
45 compatible = "regulator-fixed";
46
47 regulator-name = "SDHI0 Vcc";
48 regulator-min-microvolt = <3300000>;
49 regulator-max-microvolt = <3300000>;
50
51 gpio = <&pfc 75 GPIO_ACTIVE_HIGH>;
52 enable-active-high;
53 };
54
55 vccq_sdhi0: regulator@2 {
56 compatible = "regulator-gpio";
57
58 regulator-name = "SDHI0 VccQ";
59 regulator-min-microvolt = <1800000>;
60 regulator-max-microvolt = <3300000>;
61 vin-supply = <&vcc_sdhi0>;
62
63 enable-gpio = <&pfc 74 GPIO_ACTIVE_HIGH>;
64 gpios = <&pfc 17 GPIO_ACTIVE_HIGH>;
65 states = <3300000 0
66 1800000 1>;
67
68 enable-active-high;
69 };
70
71 reg_5p0v: regulator@3 {
72 compatible = "regulator-fixed";
73 regulator-name = "fixed-5.0V";
74 regulator-min-microvolt = <5000000>;
75 regulator-max-microvolt = <5000000>;
76 regulator-always-on;
77 regulator-boot-on;
78 };
79
80 gpio-keys {
81 compatible = "gpio-keys";
82
83 power-key {
84 gpios = <&pfc 99 GPIO_ACTIVE_LOW>;
85 linux,code = <KEY_POWER>;
86 label = "SW3";
87 gpio-key,wakeup;
88 };
89
90 back-key {
91 gpios = <&pfc 100 GPIO_ACTIVE_LOW>;
92 linux,code = <KEY_BACK>;
93 label = "SW4";
94 };
95
96 menu-key {
97 gpios = <&pfc 97 GPIO_ACTIVE_LOW>;
98 linux,code = <KEY_MENU>;
99 label = "SW5";
100 };
101
102 home-key {
103 gpios = <&pfc 98 GPIO_ACTIVE_LOW>;
104 linux,code = <KEY_HOME>;
105 label = "SW6";
106 };
107 };
108
109 leds {
110 compatible = "gpio-leds";
111 led3 {
112 gpios = <&pfc 102 GPIO_ACTIVE_HIGH>;
113 label = "LED3";
114 };
115 led4 {
116 gpios = <&pfc 111 GPIO_ACTIVE_HIGH>;
117 label = "LED4";
118 };
119 led5 {
120 gpios = <&pfc 110 GPIO_ACTIVE_HIGH>;
121 label = "LED5";
122 };
123 led6 {
124 gpios = <&pfc 177 GPIO_ACTIVE_HIGH>;
125 label = "LED6";
126 };
127 };
128
129 i2c2: i2c@2 {
130 #address-cells = <1>;
131 #size-cells = <0>;
132 compatible = "i2c-gpio";
133 gpios = <&pfc 208 GPIO_ACTIVE_HIGH /* sda */
134 &pfc 91 GPIO_ACTIVE_HIGH /* scl */
135 >;
136 i2c-gpio,delay-us = <5>;
137 };
138
139 backlight {
140 compatible = "pwm-backlight";
141 pwms = <&tpu 2 33333 PWM_POLARITY_INVERTED>;
142 brightness-levels = <0 1 2 4 8 16 32 64 128 255>;
143 default-brightness-level = <9>;
144 pinctrl-0 = <&backlight_pins>;
145 pinctrl-names = "default";
146 power-supply = <&reg_5p0v>;
147 enable-gpios = <&pfc 61 GPIO_ACTIVE_HIGH>;
148 };
149
150 sound {
151 compatible = "simple-audio-card";
152
153 simple-audio-card,format = "i2s";
154
155 simple-audio-card,cpu {
156 sound-dai = <&sh_fsi2 0>;
157 bitclock-inversion;
158 };
159
160 simple-audio-card,codec {
161 sound-dai = <&wm8978>;
162 bitclock-master;
163 frame-master;
164 system-clock-frequency = <12288000>;
165 };
166 };
167};
168
169&ether {
170 pinctrl-0 = <&ether_pins>;
171 pinctrl-names = "default";
172
173 phy-handle = <&phy0>;
174 status = "ok";
175
176 phy0: ethernet-phy@0 {
177 reg = <0>;
178 };
179};
180
181&extal1_clk {
182 clock-frequency = <25000000>;
183};
184&extal2_clk {
185 clock-frequency = <48000000>;
186};
187&fsibck_clk {
188 clock-frequency = <12288000>;
189};
190&cpg_clocks {
191 renesas,mode = <0x05>; /* MD_CK0 | MD_CK2 */
192};
193
194&cmt1 {
195 status = "ok";
196};
197
198&i2c0 {
199 status = "okay";
200 touchscreen@55 {
201 compatible = "sitronix,st1232";
202 reg = <0x55>;
203 interrupt-parent = <&irqpin1>;
204 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
205 pinctrl-0 = <&st1232_pins>;
206 pinctrl-names = "default";
207 gpios = <&pfc 166 GPIO_ACTIVE_LOW>;
208 };
209
210 wm8978: wm8978@1a {
211 #sound-dai-cells = <0>;
212 compatible = "wlf,wm8978";
213 reg = <0x1a>;
214 };
215};
216
217&i2c2 {
218 status = "okay";
219 rtc@30 {
220 compatible = "sii,s35390a";
221 reg = <0x30>;
222 };
223};
224
225&pfc {
226 ether_pins: ether {
227 renesas,groups = "gether_mii", "gether_int";
228 renesas,function = "gether";
229 };
230
231 scifa1_pins: serial1 {
232 renesas,groups = "scifa1_data";
233 renesas,function = "scifa1";
234 };
235
236 st1232_pins: touchscreen {
237 renesas,groups = "intc_irq10";
238 renesas,function = "intc";
239 };
240
241 backlight_pins: backlight {
242 renesas,groups = "tpu0_to2_1";
243 renesas,function = "tpu0";
244 };
245
246 mmc0_pins: mmc0 {
247 renesas,groups = "mmc0_data8_1", "mmc0_ctrl_1";
248 renesas,function = "mmc0";
249 };
250
251 sdhi0_pins: sd0 {
252 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_wp";
253 renesas,function = "sdhi0";
254 };
255
256 fsia_pins: sounda {
257 renesas,groups = "fsia_sclk_in", "fsia_mclk_out",
258 "fsia_data_in_1", "fsia_data_out_0";
259 renesas,function = "fsia";
260 };
261};
262
263&tpu {
264 status = "okay";
265};
266
267&mmcif0 {
268 pinctrl-0 = <&mmc0_pins>;
269 pinctrl-names = "default";
270
271 vmmc-supply = <&reg_3p3v>;
272 bus-width = <8>;
273 non-removable;
274 status = "okay";
275};
276
277&scifa1 {
278 pinctrl-0 = <&scifa1_pins>;
279 pinctrl-names = "default";
280
281 status = "okay";
282};
283
284&sdhi0 {
285 pinctrl-0 = <&sdhi0_pins>;
286 pinctrl-names = "default";
287
288 vmmc-supply = <&vcc_sdhi0>;
289 vqmmc-supply = <&vccq_sdhi0>;
290 bus-width = <4>;
291 cd-gpios = <&pfc 167 GPIO_ACTIVE_LOW>;
292 status = "okay";
293};
294
295&sh_fsi2 {
296 pinctrl-0 = <&fsia_pins>;
297 pinctrl-names = "default";
298
299 status = "okay";
26}; 300};
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index bda18fb3d9e5..d46c213a17ad 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -10,6 +10,7 @@
10 10
11/include/ "skeleton.dtsi" 11/include/ "skeleton.dtsi"
12 12
13#include <dt-bindings/clock/r8a7740-clock.h>
13#include <dt-bindings/interrupt-controller/irq.h> 14#include <dt-bindings/interrupt-controller/irq.h>
14 15
15/ { 16/ {
@@ -40,6 +41,18 @@
40 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>; 41 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>;
41 }; 42 };
42 43
44 cmt1: timer@e6138000 {
45 compatible = "renesas,cmt-48-r8a7740", "renesas,cmt-48";
46 reg = <0xe6138000 0x170>;
47 interrupts = <0 58 IRQ_TYPE_LEVEL_HIGH>;
48 clocks = <&mstp3_clks R8A7740_CLK_CMT1>;
49 clock-names = "fck";
50
51 renesas,channels-mask = <0x3f>;
52
53 status = "disabled";
54 };
55
43 /* irqpin0: IRQ0 - IRQ7 */ 56 /* irqpin0: IRQ0 - IRQ7 */
44 irqpin0: irqpin@e6900000 { 57 irqpin0: irqpin@e6900000 {
45 compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin"; 58 compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
@@ -125,7 +138,7 @@
125 reg = <0xe9a00000 0x800>, 138 reg = <0xe9a00000 0x800>,
126 <0xe9a01800 0x800>; 139 <0xe9a01800 0x800>;
127 interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>; 140 interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
128 /* clocks = <&mstp3_clks R8A7740_CLK_GETHER>; */ 141 clocks = <&mstp3_clks R8A7740_CLK_GETHER>;
129 phy-mode = "mii"; 142 phy-mode = "mii";
130 #address-cells = <1>; 143 #address-cells = <1>;
131 #size-cells = <0>; 144 #size-cells = <0>;
@@ -141,6 +154,7 @@
141 0 202 IRQ_TYPE_LEVEL_HIGH 154 0 202 IRQ_TYPE_LEVEL_HIGH
142 0 203 IRQ_TYPE_LEVEL_HIGH 155 0 203 IRQ_TYPE_LEVEL_HIGH
143 0 204 IRQ_TYPE_LEVEL_HIGH>; 156 0 204 IRQ_TYPE_LEVEL_HIGH>;
157 clocks = <&mstp1_clks R8A7740_CLK_IIC0>;
144 status = "disabled"; 158 status = "disabled";
145 }; 159 };
146 160
@@ -153,6 +167,7 @@
153 0 71 IRQ_TYPE_LEVEL_HIGH 167 0 71 IRQ_TYPE_LEVEL_HIGH
154 0 72 IRQ_TYPE_LEVEL_HIGH 168 0 72 IRQ_TYPE_LEVEL_HIGH
155 0 73 IRQ_TYPE_LEVEL_HIGH>; 169 0 73 IRQ_TYPE_LEVEL_HIGH>;
170 clocks = <&mstp3_clks R8A7740_CLK_IIC1>;
156 status = "disabled"; 171 status = "disabled";
157 }; 172 };
158 173
@@ -160,6 +175,8 @@
160 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 175 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
161 reg = <0xe6c40000 0x100>; 176 reg = <0xe6c40000 0x100>;
162 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>; 177 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
178 clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
179 clock-names = "sci_ick";
163 status = "disabled"; 180 status = "disabled";
164 }; 181 };
165 182
@@ -167,6 +184,8 @@
167 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 184 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
168 reg = <0xe6c50000 0x100>; 185 reg = <0xe6c50000 0x100>;
169 interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>; 186 interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
187 clocks = <&mstp2_clks R8A7740_CLK_SCIFA1>;
188 clock-names = "sci_ick";
170 status = "disabled"; 189 status = "disabled";
171 }; 190 };
172 191
@@ -174,6 +193,8 @@
174 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 193 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
175 reg = <0xe6c60000 0x100>; 194 reg = <0xe6c60000 0x100>;
176 interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>; 195 interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
196 clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>;
197 clock-names = "sci_ick";
177 status = "disabled"; 198 status = "disabled";
178 }; 199 };
179 200
@@ -181,6 +202,8 @@
181 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 202 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
182 reg = <0xe6c70000 0x100>; 203 reg = <0xe6c70000 0x100>;
183 interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>; 204 interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
205 clocks = <&mstp2_clks R8A7740_CLK_SCIFA3>;
206 clock-names = "sci_ick";
184 status = "disabled"; 207 status = "disabled";
185 }; 208 };
186 209
@@ -188,6 +211,8 @@
188 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 211 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
189 reg = <0xe6c80000 0x100>; 212 reg = <0xe6c80000 0x100>;
190 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>; 213 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
214 clocks = <&mstp2_clks R8A7740_CLK_SCIFA4>;
215 clock-names = "sci_ick";
191 status = "disabled"; 216 status = "disabled";
192 }; 217 };
193 218
@@ -195,6 +220,8 @@
195 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 220 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
196 reg = <0xe6cb0000 0x100>; 221 reg = <0xe6cb0000 0x100>;
197 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>; 222 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
223 clocks = <&mstp2_clks R8A7740_CLK_SCIFA5>;
224 clock-names = "sci_ick";
198 status = "disabled"; 225 status = "disabled";
199 }; 226 };
200 227
@@ -202,6 +229,8 @@
202 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 229 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
203 reg = <0xe6cc0000 0x100>; 230 reg = <0xe6cc0000 0x100>;
204 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>; 231 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
232 clocks = <&mstp2_clks R8A7740_CLK_SCIFA6>;
233 clock-names = "sci_ick";
205 status = "disabled"; 234 status = "disabled";
206 }; 235 };
207 236
@@ -209,6 +238,8 @@
209 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 238 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
210 reg = <0xe6cd0000 0x100>; 239 reg = <0xe6cd0000 0x100>;
211 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>; 240 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
241 clocks = <&mstp2_clks R8A7740_CLK_SCIFA7>;
242 clock-names = "sci_ick";
212 status = "disabled"; 243 status = "disabled";
213 }; 244 };
214 245
@@ -216,6 +247,8 @@
216 compatible = "renesas,scifb-r8a7740", "renesas,scifb"; 247 compatible = "renesas,scifb-r8a7740", "renesas,scifb";
217 reg = <0xe6c30000 0x100>; 248 reg = <0xe6c30000 0x100>;
218 interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>; 249 interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
250 clocks = <&mstp2_clks R8A7740_CLK_SCIFB>;
251 clock-names = "sci_ick";
219 status = "disabled"; 252 status = "disabled";
220 }; 253 };
221 254
@@ -239,6 +272,7 @@
239 tpu: pwm@e6600000 { 272 tpu: pwm@e6600000 {
240 compatible = "renesas,tpu-r8a7740", "renesas,tpu"; 273 compatible = "renesas,tpu-r8a7740", "renesas,tpu";
241 reg = <0xe6600000 0x100>; 274 reg = <0xe6600000 0x100>;
275 clocks = <&mstp3_clks R8A7740_CLK_TPU0>;
242 status = "disabled"; 276 status = "disabled";
243 #pwm-cells = <3>; 277 #pwm-cells = <3>;
244 }; 278 };
@@ -248,6 +282,7 @@
248 reg = <0xe6bd0000 0x100>; 282 reg = <0xe6bd0000 0x100>;
249 interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH 283 interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH
250 0 57 IRQ_TYPE_LEVEL_HIGH>; 284 0 57 IRQ_TYPE_LEVEL_HIGH>;
285 clocks = <&mstp3_clks R8A7740_CLK_MMC>;
251 status = "disabled"; 286 status = "disabled";
252 }; 287 };
253 288
@@ -257,6 +292,7 @@
257 interrupts = <0 117 IRQ_TYPE_LEVEL_HIGH 292 interrupts = <0 117 IRQ_TYPE_LEVEL_HIGH
258 0 118 IRQ_TYPE_LEVEL_HIGH 293 0 118 IRQ_TYPE_LEVEL_HIGH
259 0 119 IRQ_TYPE_LEVEL_HIGH>; 294 0 119 IRQ_TYPE_LEVEL_HIGH>;
295 clocks = <&mstp3_clks R8A7740_CLK_SDHI0>;
260 cap-sd-highspeed; 296 cap-sd-highspeed;
261 cap-sdio-irq; 297 cap-sdio-irq;
262 status = "disabled"; 298 status = "disabled";
@@ -268,6 +304,7 @@
268 interrupts = <0 121 IRQ_TYPE_LEVEL_HIGH 304 interrupts = <0 121 IRQ_TYPE_LEVEL_HIGH
269 0 122 IRQ_TYPE_LEVEL_HIGH 305 0 122 IRQ_TYPE_LEVEL_HIGH
270 0 123 IRQ_TYPE_LEVEL_HIGH>; 306 0 123 IRQ_TYPE_LEVEL_HIGH>;
307 clocks = <&mstp3_clks R8A7740_CLK_SDHI1>;
271 cap-sd-highspeed; 308 cap-sd-highspeed;
272 cap-sdio-irq; 309 cap-sdio-irq;
273 status = "disabled"; 310 status = "disabled";
@@ -279,6 +316,7 @@
279 interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH 316 interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH
280 0 126 IRQ_TYPE_LEVEL_HIGH 317 0 126 IRQ_TYPE_LEVEL_HIGH
281 0 127 IRQ_TYPE_LEVEL_HIGH>; 318 0 127 IRQ_TYPE_LEVEL_HIGH>;
319 clocks = <&mstp4_clks R8A7740_CLK_SDHI2>;
282 cap-sd-highspeed; 320 cap-sd-highspeed;
283 cap-sdio-irq; 321 cap-sdio-irq;
284 status = "disabled"; 322 status = "disabled";
@@ -289,6 +327,186 @@
289 compatible = "renesas,fsi2-r8a7740", "renesas,sh_fsi2"; 327 compatible = "renesas,fsi2-r8a7740", "renesas,sh_fsi2";
290 reg = <0xfe1f0000 0x400>; 328 reg = <0xfe1f0000 0x400>;
291 interrupts = <0 9 0x4>; 329 interrupts = <0 9 0x4>;
330 clocks = <&mstp3_clks R8A7740_CLK_FSI>;
292 status = "disabled"; 331 status = "disabled";
293 }; 332 };
333
334 clocks {
335 #address-cells = <1>;
336 #size-cells = <1>;
337 ranges;
338
339 /* External root clock */
340 extalr_clk: extalr_clk {
341 compatible = "fixed-clock";
342 #clock-cells = <0>;
343 clock-frequency = <32768>;
344 clock-output-names = "extalr";
345 };
346 extal1_clk: extal1_clk {
347 compatible = "fixed-clock";
348 #clock-cells = <0>;
349 clock-frequency = <0>;
350 clock-output-names = "extal1";
351 };
352 extal2_clk: extal2_clk {
353 compatible = "fixed-clock";
354 #clock-cells = <0>;
355 clock-frequency = <0>;
356 clock-output-names = "extal2";
357 };
358 dv_clk: dv_clk {
359 compatible = "fixed-clock";
360 #clock-cells = <0>;
361 clock-frequency = <27000000>;
362 clock-output-names = "dv";
363 };
364 fsiack_clk: fsiack_clk {
365 compatible = "fixed-clock";
366 #clock-cells = <0>;
367 clock-frequency = <0>;
368 clock-output-names = "fsiack";
369 };
370 fsibck_clk: fsibck_clk {
371 compatible = "fixed-clock";
372 #clock-cells = <0>;
373 clock-frequency = <0>;
374 clock-output-names = "fsibck";
375 };
376
377 /* Special CPG clocks */
378 cpg_clocks: cpg_clocks@e6150000 {
379 compatible = "renesas,r8a7740-cpg-clocks";
380 reg = <0xe6150000 0x10000>;
381 clocks = <&extal1_clk>, <&extalr_clk>;
382 #clock-cells = <1>;
383 clock-output-names = "system", "pllc0", "pllc1",
384 "pllc2", "r",
385 "usb24s",
386 "i", "zg", "b", "m1", "hp",
387 "hpp", "usbp", "s", "zb", "m3",
388 "cp";
389 };
390
391 /* Variable factor clocks (DIV6) */
392 sub_clk: sub_clk@e6150080 {
393 compatible = "renesas,r8a7740-div6-clock", "renesas,cpg-div6-clock";
394 reg = <0xe6150080 4>;
395 clocks = <&pllc1_div2_clk>;
396 #clock-cells = <0>;
397 clock-output-names = "sub";
398 };
399
400 /* Fixed factor clocks */
401 pllc1_div2_clk: pllc1_div2_clk {
402 compatible = "fixed-factor-clock";
403 clocks = <&cpg_clocks R8A7740_CLK_PLLC1>;
404 #clock-cells = <0>;
405 clock-div = <2>;
406 clock-mult = <1>;
407 clock-output-names = "pllc1_div2";
408 };
409 extal1_div2_clk: extal1_div2_clk {
410 compatible = "fixed-factor-clock";
411 clocks = <&extal1_clk>;
412 #clock-cells = <0>;
413 clock-div = <2>;
414 clock-mult = <1>;
415 clock-output-names = "extal1_div2";
416 };
417
418 /* Gate clocks */
419 subck_clks: subck_clks@e6150080 {
420 compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
421 reg = <0xe6150080 4>;
422 clocks = <&sub_clk>, <&sub_clk>;
423 #clock-cells = <1>;
424 renesas,clock-indices = <
425 R8A7740_CLK_SUBCK R8A7740_CLK_SUBCK2
426 >;
427 clock-output-names =
428 "subck", "subck2";
429 };
430 mstp1_clks: mstp1_clks@e6150134 {
431 compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
432 reg = <0xe6150134 4>, <0xe6150038 4>;
433 clocks = <&cpg_clocks R8A7740_CLK_S>,
434 <&cpg_clocks R8A7740_CLK_S>, <&sub_clk>,
435 <&cpg_clocks R8A7740_CLK_B>,
436 <&sub_clk>, <&sub_clk>,
437 <&cpg_clocks R8A7740_CLK_B>;
438 #clock-cells = <1>;
439 renesas,clock-indices = <
440 R8A7740_CLK_CEU21 R8A7740_CLK_CEU20 R8A7740_CLK_TMU0
441 R8A7740_CLK_LCDC1 R8A7740_CLK_IIC0 R8A7740_CLK_TMU1
442 R8A7740_CLK_LCDC0
443 >;
444 clock-output-names =
445 "ceu21", "ceu20", "tmu0", "lcdc1", "iic0",
446 "tmu1", "lcdc0";
447 };
448 mstp2_clks: mstp2_clks@e6150138 {
449 compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
450 reg = <0xe6150138 4>, <0xe6150040 4>;
451 clocks = <&sub_clk>, <&sub_clk>,
452 <&cpg_clocks R8A7740_CLK_HP>,
453 <&cpg_clocks R8A7740_CLK_HP>,
454 <&cpg_clocks R8A7740_CLK_HP>,
455 <&cpg_clocks R8A7740_CLK_HP>,
456 <&sub_clk>, <&sub_clk>, <&sub_clk>,
457 <&sub_clk>, <&sub_clk>, <&sub_clk>,
458 <&sub_clk>;
459 #clock-cells = <1>;
460 renesas,clock-indices = <
461 R8A7740_CLK_SCIFA6 R8A7740_CLK_SCIFA7
462 R8A7740_CLK_DMAC1 R8A7740_CLK_DMAC2
463 R8A7740_CLK_DMAC3 R8A7740_CLK_USBDMAC
464 R8A7740_CLK_SCIFA5 R8A7740_CLK_SCIFB
465 R8A7740_CLK_SCIFA0 R8A7740_CLK_SCIFA1
466 R8A7740_CLK_SCIFA2 R8A7740_CLK_SCIFA3
467 R8A7740_CLK_SCIFA4
468 >;
469 clock-output-names =
470 "scifa6", "scifa7", "dmac1", "dmac2", "dmac3",
471 "usbdmac", "scifa5", "scifb", "scifa0", "scifa1",
472 "scifa2", "scifa3", "scifa4";
473 };
474 mstp3_clks: mstp3_clks@e615013c {
475 compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
476 reg = <0xe615013c 4>, <0xe6150048 4>;
477 clocks = <&cpg_clocks R8A7740_CLK_R>,
478 <&cpg_clocks R8A7740_CLK_HP>,
479 <&sub_clk>,
480 <&cpg_clocks R8A7740_CLK_HP>,
481 <&cpg_clocks R8A7740_CLK_HP>,
482 <&cpg_clocks R8A7740_CLK_HP>,
483 <&cpg_clocks R8A7740_CLK_HP>,
484 <&cpg_clocks R8A7740_CLK_HP>,
485 <&cpg_clocks R8A7740_CLK_HP>;
486 #clock-cells = <1>;
487 renesas,clock-indices = <
488 R8A7740_CLK_CMT1 R8A7740_CLK_FSI R8A7740_CLK_IIC1
489 R8A7740_CLK_USBF R8A7740_CLK_SDHI0 R8A7740_CLK_SDHI1
490 R8A7740_CLK_MMC R8A7740_CLK_GETHER R8A7740_CLK_TPU0
491 >;
492 clock-output-names =
493 "cmt1", "fsi", "iic1", "usbf", "sdhi0", "sdhi1",
494 "mmc", "gether", "tpu0";
495 };
496 mstp4_clks: mstp4_clks@e6150140 {
497 compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
498 reg = <0xe6150140 4>, <0xe615004c 4>;
499 clocks = <&cpg_clocks R8A7740_CLK_HP>,
500 <&cpg_clocks R8A7740_CLK_HP>,
501 <&cpg_clocks R8A7740_CLK_HP>,
502 <&cpg_clocks R8A7740_CLK_HP>;
503 #clock-cells = <1>;
504 renesas,clock-indices = <
505 R8A7740_CLK_USBH R8A7740_CLK_SDHI2
506 R8A7740_CLK_USBFUNC R8A7740_CLK_USBPHY
507 >;
508 clock-output-names =
509 "usbhost", "sdhi2", "usbfunc", "usphy";
510 };
511 };
294}; 512};
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index ecfdf4b01b5a..315ec62cb96b 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -23,8 +23,14 @@
23 interrupt-parent = <&gic>; 23 interrupt-parent = <&gic>;
24 24
25 cpus { 25 cpus {
26 #address-cells = <1>;
27 #size-cells = <0>;
28
26 cpu@0 { 29 cpu@0 {
30 device_type = "cpu";
27 compatible = "arm,cortex-a9"; 31 compatible = "arm,cortex-a9";
32 reg = <0>;
33 clock-frequency = <800000000>;
28 }; 34 };
29 }; 35 };
30 36
diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
index 5745555df943..c160404e4d40 100644
--- a/arch/arm/boot/dts/r8a7779-marzen.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen.dts
@@ -78,6 +78,10 @@
78 clock-frequency = <31250000>; 78 clock-frequency = <31250000>;
79}; 79};
80 80
81&tmu0 {
82 status = "okay";
83};
84
81&pfc { 85&pfc {
82 lan0_pins: lan0 { 86 lan0_pins: lan0 {
83 intc { 87 intc {
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 58d0d952d60e..7cfba9aa1b41 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -199,7 +199,6 @@
199 scif0: serial@ffe40000 { 199 scif0: serial@ffe40000 {
200 compatible = "renesas,scif-r8a7779", "renesas,scif"; 200 compatible = "renesas,scif-r8a7779", "renesas,scif";
201 reg = <0xffe40000 0x100>; 201 reg = <0xffe40000 0x100>;
202 interrupt-parent = <&gic>;
203 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>; 202 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
204 clocks = <&cpg_clocks R8A7779_CLK_P>; 203 clocks = <&cpg_clocks R8A7779_CLK_P>;
205 clock-names = "sci_ick"; 204 clock-names = "sci_ick";
@@ -209,7 +208,6 @@
209 scif1: serial@ffe41000 { 208 scif1: serial@ffe41000 {
210 compatible = "renesas,scif-r8a7779", "renesas,scif"; 209 compatible = "renesas,scif-r8a7779", "renesas,scif";
211 reg = <0xffe41000 0x100>; 210 reg = <0xffe41000 0x100>;
212 interrupt-parent = <&gic>;
213 interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>; 211 interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
214 clocks = <&cpg_clocks R8A7779_CLK_P>; 212 clocks = <&cpg_clocks R8A7779_CLK_P>;
215 clock-names = "sci_ick"; 213 clock-names = "sci_ick";
@@ -219,7 +217,6 @@
219 scif2: serial@ffe42000 { 217 scif2: serial@ffe42000 {
220 compatible = "renesas,scif-r8a7779", "renesas,scif"; 218 compatible = "renesas,scif-r8a7779", "renesas,scif";
221 reg = <0xffe42000 0x100>; 219 reg = <0xffe42000 0x100>;
222 interrupt-parent = <&gic>;
223 interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>; 220 interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>;
224 clocks = <&cpg_clocks R8A7779_CLK_P>; 221 clocks = <&cpg_clocks R8A7779_CLK_P>;
225 clock-names = "sci_ick"; 222 clock-names = "sci_ick";
@@ -229,7 +226,6 @@
229 scif3: serial@ffe43000 { 226 scif3: serial@ffe43000 {
230 compatible = "renesas,scif-r8a7779", "renesas,scif"; 227 compatible = "renesas,scif-r8a7779", "renesas,scif";
231 reg = <0xffe43000 0x100>; 228 reg = <0xffe43000 0x100>;
232 interrupt-parent = <&gic>;
233 interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>; 229 interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>;
234 clocks = <&cpg_clocks R8A7779_CLK_P>; 230 clocks = <&cpg_clocks R8A7779_CLK_P>;
235 clock-names = "sci_ick"; 231 clock-names = "sci_ick";
@@ -239,7 +235,6 @@
239 scif4: serial@ffe44000 { 235 scif4: serial@ffe44000 {
240 compatible = "renesas,scif-r8a7779", "renesas,scif"; 236 compatible = "renesas,scif-r8a7779", "renesas,scif";
241 reg = <0xffe44000 0x100>; 237 reg = <0xffe44000 0x100>;
242 interrupt-parent = <&gic>;
243 interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>; 238 interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
244 clocks = <&cpg_clocks R8A7779_CLK_P>; 239 clocks = <&cpg_clocks R8A7779_CLK_P>;
245 clock-names = "sci_ick"; 240 clock-names = "sci_ick";
@@ -249,7 +244,6 @@
249 scif5: serial@ffe45000 { 244 scif5: serial@ffe45000 {
250 compatible = "renesas,scif-r8a7779", "renesas,scif"; 245 compatible = "renesas,scif-r8a7779", "renesas,scif";
251 reg = <0xffe45000 0x100>; 246 reg = <0xffe45000 0x100>;
252 interrupt-parent = <&gic>;
253 interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>; 247 interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
254 clocks = <&cpg_clocks R8A7779_CLK_P>; 248 clocks = <&cpg_clocks R8A7779_CLK_P>;
255 clock-names = "sci_ick"; 249 clock-names = "sci_ick";
@@ -262,10 +256,52 @@
262 }; 256 };
263 257
264 thermal@ffc48000 { 258 thermal@ffc48000 {
265 compatible = "renesas,rcar-thermal"; 259 compatible = "renesas,thermal-r8a7779", "renesas,rcar-thermal";
266 reg = <0xffc48000 0x38>; 260 reg = <0xffc48000 0x38>;
267 }; 261 };
268 262
263 tmu0: timer@ffd80000 {
264 compatible = "renesas,tmu-r8a7779", "renesas,tmu";
265 reg = <0xffd80000 0x30>;
266 interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>,
267 <0 33 IRQ_TYPE_LEVEL_HIGH>,
268 <0 34 IRQ_TYPE_LEVEL_HIGH>;
269 clocks = <&mstp0_clks R8A7779_CLK_TMU0>;
270 clock-names = "fck";
271
272 #renesas,channels = <3>;
273
274 status = "disabled";
275 };
276
277 tmu1: timer@ffd81000 {
278 compatible = "renesas,tmu-r8a7779", "renesas,tmu";
279 reg = <0xffd81000 0x30>;
280 interrupts = <0 36 IRQ_TYPE_LEVEL_HIGH>,
281 <0 37 IRQ_TYPE_LEVEL_HIGH>,
282 <0 38 IRQ_TYPE_LEVEL_HIGH>;
283 clocks = <&mstp0_clks R8A7779_CLK_TMU1>;
284 clock-names = "fck";
285
286 #renesas,channels = <3>;
287
288 status = "disabled";
289 };
290
291 tmu2: timer@ffd82000 {
292 compatible = "renesas,tmu-r8a7779", "renesas,tmu";
293 reg = <0xffd82000 0x30>;
294 interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>,
295 <0 41 IRQ_TYPE_LEVEL_HIGH>,
296 <0 42 IRQ_TYPE_LEVEL_HIGH>;
297 clocks = <&mstp0_clks R8A7779_CLK_TMU2>;
298 clock-names = "fck";
299
300 #renesas,channels = <3>;
301
302 status = "disabled";
303 };
304
269 sata: sata@fc600000 { 305 sata: sata@fc600000 {
270 compatible = "renesas,rcar-sata"; 306 compatible = "renesas,rcar-sata";
271 reg = <0xfc600000 0x2000>; 307 reg = <0xfc600000 0x2000>;
@@ -404,10 +440,10 @@
404 /* Gate clocks */ 440 /* Gate clocks */
405 mstp0_clks: clocks@ffc80030 { 441 mstp0_clks: clocks@ffc80030 {
406 compatible = "renesas,r8a7779-mstp-clocks", 442 compatible = "renesas,r8a7779-mstp-clocks",
407 "renesas,cpg-mstp-clocks"; 443 "renesas,cpg-mstp-clocks";
408 reg = <0xffc80030 4>; 444 reg = <0xffc80030 4>;
409 clocks = <&cpg_clocks R8A7779_CLK_S>, 445 clocks = <&cpg_clocks R8A7779_CLK_S>,
410 <&cpg_clocks R8A7779_CLK_P>, 446 <&cpg_clocks R8A7779_CLK_P>,
411 <&cpg_clocks R8A7779_CLK_P>, 447 <&cpg_clocks R8A7779_CLK_P>,
412 <&cpg_clocks R8A7779_CLK_P>, 448 <&cpg_clocks R8A7779_CLK_P>,
413 <&cpg_clocks R8A7779_CLK_S>, 449 <&cpg_clocks R8A7779_CLK_S>,
@@ -441,7 +477,7 @@
441 }; 477 };
442 mstp1_clks: clocks@ffc80034 { 478 mstp1_clks: clocks@ffc80034 {
443 compatible = "renesas,r8a7779-mstp-clocks", 479 compatible = "renesas,r8a7779-mstp-clocks",
444 "renesas,cpg-mstp-clocks"; 480 "renesas,cpg-mstp-clocks";
445 reg = <0xffc80034 4>, <0xffc80044 4>; 481 reg = <0xffc80034 4>, <0xffc80044 4>;
446 clocks = <&cpg_clocks R8A7779_CLK_P>, 482 clocks = <&cpg_clocks R8A7779_CLK_P>,
447 <&cpg_clocks R8A7779_CLK_P>, 483 <&cpg_clocks R8A7779_CLK_P>,
@@ -470,7 +506,7 @@
470 }; 506 };
471 mstp3_clks: clocks@ffc8003c { 507 mstp3_clks: clocks@ffc8003c {
472 compatible = "renesas,r8a7779-mstp-clocks", 508 compatible = "renesas,r8a7779-mstp-clocks",
473 "renesas,cpg-mstp-clocks"; 509 "renesas,cpg-mstp-clocks";
474 reg = <0xffc8003c 4>; 510 reg = <0xffc8003c 4>;
475 clocks = <&s4_clk>, <&s4_clk>, <&s4_clk>, <&s4_clk>, 511 clocks = <&s4_clk>, <&s4_clk>, <&s4_clk>, <&s4_clk>,
476 <&s4_clk>, <&s4_clk>; 512 <&s4_clk>, <&s4_clk>;
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 856b4236b674..69098b906b39 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -32,7 +32,7 @@
32 reg = <0 0x40000000 0 0x40000000>; 32 reg = <0 0x40000000 0 0x40000000>;
33 }; 33 };
34 34
35 memory@180000000 { 35 memory@140000000 {
36 device_type = "memory"; 36 device_type = "memory";
37 reg = <1 0x40000000 0 0xc0000000>; 37 reg = <1 0x40000000 0 0xc0000000>;
38 }; 38 };
@@ -234,6 +234,11 @@
234 renesas,groups = "usb2"; 234 renesas,groups = "usb2";
235 renesas,function = "usb2"; 235 renesas,function = "usb2";
236 }; 236 };
237
238 vin1_pins: vin {
239 renesas,groups = "vin1_data8", "vin1_clk";
240 renesas,function = "vin1";
241 };
237}; 242};
238 243
239&ether { 244&ether {
@@ -252,6 +257,10 @@
252 }; 257 };
253}; 258};
254 259
260&cmt0 {
261 status = "ok";
262};
263
255&mmcif1 { 264&mmcif1 {
256 pinctrl-0 = <&mmc1_pins>; 265 pinctrl-0 = <&mmc1_pins>;
257 pinctrl-names = "default"; 266 pinctrl-names = "default";
@@ -366,6 +375,19 @@
366 status = "ok"; 375 status = "ok";
367 pinctrl-0 = <&iic2_pins>; 376 pinctrl-0 = <&iic2_pins>;
368 pinctrl-names = "default"; 377 pinctrl-names = "default";
378
379 composite-in@20 {
380 compatible = "adi,adv7180";
381 reg = <0x20>;
382 remote = <&vin1>;
383
384 port {
385 adv7180: endpoint {
386 bus-width = <8>;
387 remote-endpoint = <&vin1ep0>;
388 };
389 };
390 };
369}; 391};
370 392
371&iic3 { 393&iic3 {
@@ -374,7 +396,7 @@
374 status = "okay"; 396 status = "okay";
375 397
376 vdd_dvfs: regulator@68 { 398 vdd_dvfs: regulator@68 {
377 compatible = "diasemi,da9210"; 399 compatible = "dlg,da9210";
378 reg = <0x68>; 400 reg = <0x68>;
379 401
380 regulator-min-microvolt = <1000000>; 402 regulator-min-microvolt = <1000000>;
@@ -401,3 +423,21 @@
401 pinctrl-0 = <&usb2_pins>; 423 pinctrl-0 = <&usb2_pins>;
402 pinctrl-names = "default"; 424 pinctrl-names = "default";
403}; 425};
426
427/* composite video input */
428&vin1 {
429 pinctrl-0 = <&vin1_pins>;
430 pinctrl-names = "default";
431
432 status = "ok";
433
434 port {
435 #address-cells = <1>;
436 #size-cells = <0>;
437
438 vin1ep0: endpoint {
439 remote-endpoint = <&adv7180>;
440 bus-width = <8>;
441 };
442 };
443};
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index d9ddecbb859c..d0e17733dc1a 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -33,6 +33,10 @@
33 spi2 = &msiof1; 33 spi2 = &msiof1;
34 spi3 = &msiof2; 34 spi3 = &msiof2;
35 spi4 = &msiof3; 35 spi4 = &msiof3;
36 vin0 = &vin0;
37 vin1 = &vin1;
38 vin2 = &vin2;
39 vin3 = &vin3;
36 }; 40 };
37 41
38 cpus { 42 cpus {
@@ -206,6 +210,38 @@
206 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 210 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
207 }; 211 };
208 212
213 cmt0: timer@ffca0000 {
214 compatible = "renesas,cmt-48-r8a7790", "renesas,cmt-48-gen2";
215 reg = <0 0xffca0000 0 0x1004>;
216 interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>,
217 <0 143 IRQ_TYPE_LEVEL_HIGH>;
218 clocks = <&mstp1_clks R8A7790_CLK_CMT0>;
219 clock-names = "fck";
220
221 renesas,channels-mask = <0x60>;
222
223 status = "disabled";
224 };
225
226 cmt1: timer@e6130000 {
227 compatible = "renesas,cmt-48-r8a7790", "renesas,cmt-48-gen2";
228 reg = <0 0xe6130000 0 0x1004>;
229 interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>,
230 <0 121 IRQ_TYPE_LEVEL_HIGH>,
231 <0 122 IRQ_TYPE_LEVEL_HIGH>,
232 <0 123 IRQ_TYPE_LEVEL_HIGH>,
233 <0 124 IRQ_TYPE_LEVEL_HIGH>,
234 <0 125 IRQ_TYPE_LEVEL_HIGH>,
235 <0 126 IRQ_TYPE_LEVEL_HIGH>,
236 <0 127 IRQ_TYPE_LEVEL_HIGH>;
237 clocks = <&mstp3_clks R8A7790_CLK_CMT1>;
238 clock-names = "fck";
239
240 renesas,channels-mask = <0xff>;
241
242 status = "disabled";
243 };
244
209 irqc0: interrupt-controller@e61c0000 { 245 irqc0: interrupt-controller@e61c0000 {
210 compatible = "renesas,irqc-r8a7790", "renesas,irqc"; 246 compatible = "renesas,irqc-r8a7790", "renesas,irqc";
211 #interrupt-cells = <2>; 247 #interrupt-cells = <2>;
@@ -217,6 +253,65 @@
217 <0 3 IRQ_TYPE_LEVEL_HIGH>; 253 <0 3 IRQ_TYPE_LEVEL_HIGH>;
218 }; 254 };
219 255
256 dmac0: dma-controller@e6700000 {
257 compatible = "renesas,rcar-dmac";
258 reg = <0 0xe6700000 0 0x20000>;
259 interrupts = <0 197 IRQ_TYPE_LEVEL_HIGH
260 0 200 IRQ_TYPE_LEVEL_HIGH
261 0 201 IRQ_TYPE_LEVEL_HIGH
262 0 202 IRQ_TYPE_LEVEL_HIGH
263 0 203 IRQ_TYPE_LEVEL_HIGH
264 0 204 IRQ_TYPE_LEVEL_HIGH
265 0 205 IRQ_TYPE_LEVEL_HIGH
266 0 206 IRQ_TYPE_LEVEL_HIGH
267 0 207 IRQ_TYPE_LEVEL_HIGH
268 0 208 IRQ_TYPE_LEVEL_HIGH
269 0 209 IRQ_TYPE_LEVEL_HIGH
270 0 210 IRQ_TYPE_LEVEL_HIGH
271 0 211 IRQ_TYPE_LEVEL_HIGH
272 0 212 IRQ_TYPE_LEVEL_HIGH
273 0 213 IRQ_TYPE_LEVEL_HIGH
274 0 214 IRQ_TYPE_LEVEL_HIGH>;
275 interrupt-names = "error",
276 "ch0", "ch1", "ch2", "ch3",
277 "ch4", "ch5", "ch6", "ch7",
278 "ch8", "ch9", "ch10", "ch11",
279 "ch12", "ch13", "ch14";
280 clocks = <&mstp2_clks R8A7790_CLK_SYS_DMAC0>;
281 clock-names = "fck";
282 #dma-cells = <1>;
283 dma-channels = <15>;
284 };
285
286 dmac1: dma-controller@e6720000 {
287 compatible = "renesas,rcar-dmac";
288 reg = <0 0xe6720000 0 0x20000>;
289 interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH
290 0 216 IRQ_TYPE_LEVEL_HIGH
291 0 217 IRQ_TYPE_LEVEL_HIGH
292 0 218 IRQ_TYPE_LEVEL_HIGH
293 0 219 IRQ_TYPE_LEVEL_HIGH
294 0 308 IRQ_TYPE_LEVEL_HIGH
295 0 309 IRQ_TYPE_LEVEL_HIGH
296 0 310 IRQ_TYPE_LEVEL_HIGH
297 0 311 IRQ_TYPE_LEVEL_HIGH
298 0 312 IRQ_TYPE_LEVEL_HIGH
299 0 313 IRQ_TYPE_LEVEL_HIGH
300 0 314 IRQ_TYPE_LEVEL_HIGH
301 0 315 IRQ_TYPE_LEVEL_HIGH
302 0 316 IRQ_TYPE_LEVEL_HIGH
303 0 317 IRQ_TYPE_LEVEL_HIGH
304 0 318 IRQ_TYPE_LEVEL_HIGH>;
305 interrupt-names = "error",
306 "ch0", "ch1", "ch2", "ch3",
307 "ch4", "ch5", "ch6", "ch7",
308 "ch8", "ch9", "ch10", "ch11",
309 "ch12", "ch13", "ch14";
310 clocks = <&mstp2_clks R8A7790_CLK_SYS_DMAC1>;
311 clock-names = "fck";
312 #dma-cells = <1>;
313 dma-channels = <15>;
314 };
220 i2c0: i2c@e6508000 { 315 i2c0: i2c@e6508000 {
221 #address-cells = <1>; 316 #address-cells = <1>;
222 #size-cells = <0>; 317 #size-cells = <0>;
@@ -473,6 +568,38 @@
473 status = "disabled"; 568 status = "disabled";
474 }; 569 };
475 570
571 vin0: video@e6ef0000 {
572 compatible = "renesas,vin-r8a7790";
573 clocks = <&mstp8_clks R8A7790_CLK_VIN0>;
574 reg = <0 0xe6ef0000 0 0x1000>;
575 interrupts = <0 188 IRQ_TYPE_LEVEL_HIGH>;
576 status = "disabled";
577 };
578
579 vin1: video@e6ef1000 {
580 compatible = "renesas,vin-r8a7790";
581 clocks = <&mstp8_clks R8A7790_CLK_VIN1>;
582 reg = <0 0xe6ef1000 0 0x1000>;
583 interrupts = <0 189 IRQ_TYPE_LEVEL_HIGH>;
584 status = "disabled";
585 };
586
587 vin2: video@e6ef2000 {
588 compatible = "renesas,vin-r8a7790";
589 clocks = <&mstp8_clks R8A7790_CLK_VIN2>;
590 reg = <0 0xe6ef2000 0 0x1000>;
591 interrupts = <0 190 IRQ_TYPE_LEVEL_HIGH>;
592 status = "disabled";
593 };
594
595 vin3: video@e6ef3000 {
596 compatible = "renesas,vin-r8a7790";
597 clocks = <&mstp8_clks R8A7790_CLK_VIN3>;
598 reg = <0 0xe6ef3000 0 0x1000>;
599 interrupts = <0 191 IRQ_TYPE_LEVEL_HIGH>;
600 status = "disabled";
601 };
602
476 clocks { 603 clocks {
477 #address-cells = <2>; 604 #address-cells = <2>;
478 #size-cells = <2>; 605 #size-cells = <2>;
@@ -741,33 +868,36 @@
741 mstp1_clks: mstp1_clks@e6150134 { 868 mstp1_clks: mstp1_clks@e6150134 {
742 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; 869 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
743 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>; 870 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
744 clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>, 871 clocks = <&m2_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>,
745 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>, 872 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>,
746 <&zs_clk>; 873 <&zs_clk>;
747 #clock-cells = <1>; 874 #clock-cells = <1>;
748 renesas,clock-indices = < 875 renesas,clock-indices = <
749 R8A7790_CLK_TMU1 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2 876 R8A7790_CLK_JPU R8A7790_CLK_TMU1 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2
750 R8A7790_CLK_CMT0 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1 877 R8A7790_CLK_CMT0 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1
751 R8A7790_CLK_VSP1_DU0 R8A7790_CLK_VSP1_R R8A7790_CLK_VSP1_S 878 R8A7790_CLK_VSP1_DU0 R8A7790_CLK_VSP1_R R8A7790_CLK_VSP1_S
752 >; 879 >;
753 clock-output-names = 880 clock-output-names =
754 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1", 881 "jpu", "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
755 "vsp1-du0", "vsp1-rt", "vsp1-sy"; 882 "vsp1-du0", "vsp1-rt", "vsp1-sy";
756 }; 883 };
757 mstp2_clks: mstp2_clks@e6150138 { 884 mstp2_clks: mstp2_clks@e6150138 {
758 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; 885 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
759 reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>; 886 reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>;
760 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, 887 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>,
761 <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>; 888 <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&zs_clk>,
889 <&zs_clk>;
762 #clock-cells = <1>; 890 #clock-cells = <1>;
763 renesas,clock-indices = < 891 renesas,clock-indices = <
764 R8A7790_CLK_SCIFA2 R8A7790_CLK_SCIFA1 R8A7790_CLK_SCIFA0 892 R8A7790_CLK_SCIFA2 R8A7790_CLK_SCIFA1 R8A7790_CLK_SCIFA0
765 R8A7790_CLK_MSIOF2 R8A7790_CLK_SCIFB0 R8A7790_CLK_SCIFB1 893 R8A7790_CLK_MSIOF2 R8A7790_CLK_SCIFB0 R8A7790_CLK_SCIFB1
766 R8A7790_CLK_MSIOF1 R8A7790_CLK_MSIOF3 R8A7790_CLK_SCIFB2 894 R8A7790_CLK_MSIOF1 R8A7790_CLK_MSIOF3 R8A7790_CLK_SCIFB2
895 R8A7790_CLK_SYS_DMAC1 R8A7790_CLK_SYS_DMAC0
767 >; 896 >;
768 clock-output-names = 897 clock-output-names =
769 "scifa2", "scifa1", "scifa0", "msiof2", "scifb0", 898 "scifa2", "scifa1", "scifa0", "msiof2", "scifb0",
770 "scifb1", "msiof1", "msiof3", "scifb2"; 899 "scifb1", "msiof1", "msiof3", "scifb2",
900 "sys-dmac1", "sys-dmac0";
771 }; 901 };
772 mstp3_clks: mstp3_clks@e615013c { 902 mstp3_clks: mstp3_clks@e615013c {
773 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; 903 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
@@ -884,6 +1014,8 @@
884 reg = <0 0xe6b10000 0 0x2c>; 1014 reg = <0 0xe6b10000 0 0x2c>;
885 interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>; 1015 interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
886 clocks = <&mstp9_clks R8A7790_CLK_QSPI_MOD>; 1016 clocks = <&mstp9_clks R8A7790_CLK_QSPI_MOD>;
1017 dmas = <&dmac0 0x17>, <&dmac0 0x18>;
1018 dma-names = "tx", "rx";
887 num-cs = <1>; 1019 num-cs = <1>;
888 #address-cells = <1>; 1020 #address-cells = <1>;
889 #size-cells = <0>; 1021 #size-cells = <0>;
@@ -892,9 +1024,11 @@
892 1024
893 msiof0: spi@e6e20000 { 1025 msiof0: spi@e6e20000 {
894 compatible = "renesas,msiof-r8a7790"; 1026 compatible = "renesas,msiof-r8a7790";
895 reg = <0 0xe6e20000 0 0x0064>; 1027 reg = <0 0xe6e20000 0 0x0064>, <0 0xe7e20000 0 0x0064>;
896 interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>; 1028 interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
897 clocks = <&mstp0_clks R8A7790_CLK_MSIOF0>; 1029 clocks = <&mstp0_clks R8A7790_CLK_MSIOF0>;
1030 dmas = <&dmac0 0x51>, <&dmac0 0x52>;
1031 dma-names = "tx", "rx";
898 #address-cells = <1>; 1032 #address-cells = <1>;
899 #size-cells = <0>; 1033 #size-cells = <0>;
900 status = "disabled"; 1034 status = "disabled";
@@ -902,9 +1036,11 @@
902 1036
903 msiof1: spi@e6e10000 { 1037 msiof1: spi@e6e10000 {
904 compatible = "renesas,msiof-r8a7790"; 1038 compatible = "renesas,msiof-r8a7790";
905 reg = <0 0xe6e10000 0 0x0064>; 1039 reg = <0 0xe6e10000 0 0x0064>, <0 0xe7e10000 0 0x0064>;
906 interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>; 1040 interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>;
907 clocks = <&mstp2_clks R8A7790_CLK_MSIOF1>; 1041 clocks = <&mstp2_clks R8A7790_CLK_MSIOF1>;
1042 dmas = <&dmac0 0x55>, <&dmac0 0x56>;
1043 dma-names = "tx", "rx";
908 #address-cells = <1>; 1044 #address-cells = <1>;
909 #size-cells = <0>; 1045 #size-cells = <0>;
910 status = "disabled"; 1046 status = "disabled";
@@ -912,9 +1048,11 @@
912 1048
913 msiof2: spi@e6e00000 { 1049 msiof2: spi@e6e00000 {
914 compatible = "renesas,msiof-r8a7790"; 1050 compatible = "renesas,msiof-r8a7790";
915 reg = <0 0xe6e00000 0 0x0064>; 1051 reg = <0 0xe6e00000 0 0x0064>, <0 0xe7e00000 0 0x0064>;
916 interrupts = <0 158 IRQ_TYPE_LEVEL_HIGH>; 1052 interrupts = <0 158 IRQ_TYPE_LEVEL_HIGH>;
917 clocks = <&mstp2_clks R8A7790_CLK_MSIOF2>; 1053 clocks = <&mstp2_clks R8A7790_CLK_MSIOF2>;
1054 dmas = <&dmac0 0x41>, <&dmac0 0x42>;
1055 dma-names = "tx", "rx";
918 #address-cells = <1>; 1056 #address-cells = <1>;
919 #size-cells = <0>; 1057 #size-cells = <0>;
920 status = "disabled"; 1058 status = "disabled";
@@ -922,9 +1060,11 @@
922 1060
923 msiof3: spi@e6c90000 { 1061 msiof3: spi@e6c90000 {
924 compatible = "renesas,msiof-r8a7790"; 1062 compatible = "renesas,msiof-r8a7790";
925 reg = <0 0xe6c90000 0 0x0064>; 1063 reg = <0 0xe6c90000 0 0x0064>, <0 0xe7c90000 0 0x0064>;
926 interrupts = <0 159 IRQ_TYPE_LEVEL_HIGH>; 1064 interrupts = <0 159 IRQ_TYPE_LEVEL_HIGH>;
927 clocks = <&mstp2_clks R8A7790_CLK_MSIOF3>; 1065 clocks = <&mstp2_clks R8A7790_CLK_MSIOF3>;
1066 dmas = <&dmac0 0x45>, <&dmac0 0x46>;
1067 dma-names = "tx", "rx";
928 #address-cells = <1>; 1068 #address-cells = <1>;
929 #size-cells = <0>; 1069 #size-cells = <0>;
930 status = "disabled"; 1070 status = "disabled";
@@ -1018,7 +1158,6 @@
1018 rcar_sound: rcar_sound@0xec500000 { 1158 rcar_sound: rcar_sound@0xec500000 {
1019 #sound-dai-cells = <1>; 1159 #sound-dai-cells = <1>;
1020 compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound"; 1160 compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
1021 interrupt-parent = <&gic>;
1022 reg = <0 0xec500000 0 0x1000>, /* SCU */ 1161 reg = <0 0xec500000 0 0x1000>, /* SCU */
1023 <0 0xec5a0000 0 0x100>, /* ADG */ 1162 <0 0xec5a0000 0 0x100>, /* ADG */
1024 <0 0xec540000 0 0x1000>, /* SSIU */ 1163 <0 0xec540000 0 0x1000>, /* SSIU */
diff --git a/arch/arm/boot/dts/r8a7791-henninger.dts b/arch/arm/boot/dts/r8a7791-henninger.dts
index 3a2ef0a2a137..f1b56de10205 100644
--- a/arch/arm/boot/dts/r8a7791-henninger.dts
+++ b/arch/arm/boot/dts/r8a7791-henninger.dts
@@ -135,6 +135,11 @@
135 renesas,groups = "usb1"; 135 renesas,groups = "usb1";
136 renesas,function = "usb1"; 136 renesas,function = "usb1";
137 }; 137 };
138
139 vin0_pins: vin0 {
140 renesas,groups = "vin0_data8", "vin0_clk";
141 renesas,function = "vin0";
142 };
138}; 143};
139 144
140&scif0 { 145&scif0 {
@@ -191,6 +196,19 @@
191 196
192 status = "okay"; 197 status = "okay";
193 clock-frequency = <400000>; 198 clock-frequency = <400000>;
199
200 composite-in@20 {
201 compatible = "adi,adv7180";
202 reg = <0x20>;
203 remote = <&vin0>;
204
205 port {
206 adv7180: endpoint {
207 bus-width = <8>;
208 remote-endpoint = <&vin0ep>;
209 };
210 };
211 };
194}; 212};
195 213
196&qspi { 214&qspi {
@@ -260,3 +278,20 @@
260&pciec { 278&pciec {
261 status = "okay"; 279 status = "okay";
262}; 280};
281
282/* composite video input */
283&vin0 {
284 status = "ok";
285 pinctrl-0 = <&vin0_pins>;
286 pinctrl-names = "default";
287
288 port {
289 #address-cells = <1>;
290 #size-cells = <0>;
291
292 vin0ep: endpoint {
293 remote-endpoint = <&adv7180>;
294 bus-width = <8>;
295 };
296 };
297};
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 23486c081a69..07550e775e80 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -275,11 +275,6 @@
275 renesas,function = "msiof0"; 275 renesas,function = "msiof0";
276 }; 276 };
277 277
278 i2c6_pins: i2c6 {
279 renesas,groups = "i2c6";
280 renesas,function = "i2c6";
281 };
282
283 usb0_pins: usb0 { 278 usb0_pins: usb0 {
284 renesas,groups = "usb0"; 279 renesas,groups = "usb0";
285 renesas,function = "usb0"; 280 renesas,function = "usb0";
@@ -289,6 +284,11 @@
289 renesas,groups = "usb1"; 284 renesas,groups = "usb1";
290 renesas,function = "usb1"; 285 renesas,function = "usb1";
291 }; 286 };
287
288 vin1_pins: vin1 {
289 renesas,groups = "vin1_data8", "vin1_clk";
290 renesas,function = "vin1";
291 };
292}; 292};
293 293
294&ether { 294&ether {
@@ -307,6 +307,10 @@
307 }; 307 };
308}; 308};
309 309
310&cmt0 {
311 status = "ok";
312};
313
310&sata0 { 314&sata0 {
311 status = "okay"; 315 status = "okay";
312}; 316};
@@ -412,6 +416,19 @@
412 status = "okay"; 416 status = "okay";
413 clock-frequency = <400000>; 417 clock-frequency = <400000>;
414 418
419 composite-in@20 {
420 compatible = "adi,adv7180";
421 reg = <0x20>;
422 remote = <&vin1>;
423
424 port {
425 adv7180: endpoint {
426 bus-width = <8>;
427 remote-endpoint = <&vin1ep>;
428 };
429 };
430 };
431
415 eeprom@50 { 432 eeprom@50 {
416 compatible = "renesas,24c02"; 433 compatible = "renesas,24c02";
417 reg = <0x50>; 434 reg = <0x50>;
@@ -420,13 +437,11 @@
420}; 437};
421 438
422&i2c6 { 439&i2c6 {
423 pinctrl-names = "default";
424 pinctrl-0 = <&i2c6_pins>;
425 status = "okay"; 440 status = "okay";
426 clock-frequency = <100000>; 441 clock-frequency = <100000>;
427 442
428 vdd_dvfs: regulator@68 { 443 vdd_dvfs: regulator@68 {
429 compatible = "diasemi,da9210"; 444 compatible = "dlg,da9210";
430 reg = <0x68>; 445 reg = <0x68>;
431 446
432 regulator-min-microvolt = <1000000>; 447 regulator-min-microvolt = <1000000>;
@@ -459,3 +474,20 @@
459&cpu0 { 474&cpu0 {
460 cpu0-supply = <&vdd_dvfs>; 475 cpu0-supply = <&vdd_dvfs>;
461}; 476};
477
478/* composite video input */
479&vin1 {
480 status = "ok";
481 pinctrl-0 = <&vin1_pins>;
482 pinctrl-names = "default";
483
484 port {
485 #address-cells = <1>;
486 #size-cells = <0>;
487
488 vin1ep: endpoint {
489 remote-endpoint = <&adv7180>;
490 bus-width = <8>;
491 };
492 };
493};
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 0d82a4b3c650..e06c11fa8698 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -34,6 +34,9 @@
34 spi1 = &msiof0; 34 spi1 = &msiof0;
35 spi2 = &msiof1; 35 spi2 = &msiof1;
36 spi3 = &msiof2; 36 spi3 = &msiof2;
37 vin0 = &vin0;
38 vin1 = &vin1;
39 vin2 = &vin2;
37 }; 40 };
38 41
39 cpus { 42 cpus {
@@ -189,6 +192,38 @@
189 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 192 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
190 }; 193 };
191 194
195 cmt0: timer@ffca0000 {
196 compatible = "renesas,cmt-48-r8a7791", "renesas,cmt-48-gen2";
197 reg = <0 0xffca0000 0 0x1004>;
198 interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>,
199 <0 143 IRQ_TYPE_LEVEL_HIGH>;
200 clocks = <&mstp1_clks R8A7791_CLK_CMT0>;
201 clock-names = "fck";
202
203 renesas,channels-mask = <0x60>;
204
205 status = "disabled";
206 };
207
208 cmt1: timer@e6130000 {
209 compatible = "renesas,cmt-48-r8a7791", "renesas,cmt-48-gen2";
210 reg = <0 0xe6130000 0 0x1004>;
211 interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>,
212 <0 121 IRQ_TYPE_LEVEL_HIGH>,
213 <0 122 IRQ_TYPE_LEVEL_HIGH>,
214 <0 123 IRQ_TYPE_LEVEL_HIGH>,
215 <0 124 IRQ_TYPE_LEVEL_HIGH>,
216 <0 125 IRQ_TYPE_LEVEL_HIGH>,
217 <0 126 IRQ_TYPE_LEVEL_HIGH>,
218 <0 127 IRQ_TYPE_LEVEL_HIGH>;
219 clocks = <&mstp3_clks R8A7791_CLK_CMT1>;
220 clock-names = "fck";
221
222 renesas,channels-mask = <0xff>;
223
224 status = "disabled";
225 };
226
192 irqc0: interrupt-controller@e61c0000 { 227 irqc0: interrupt-controller@e61c0000 {
193 compatible = "renesas,irqc-r8a7791", "renesas,irqc"; 228 compatible = "renesas,irqc-r8a7791", "renesas,irqc";
194 #interrupt-cells = <2>; 229 #interrupt-cells = <2>;
@@ -206,6 +241,66 @@
206 <0 17 IRQ_TYPE_LEVEL_HIGH>; 241 <0 17 IRQ_TYPE_LEVEL_HIGH>;
207 }; 242 };
208 243
244 dmac0: dma-controller@e6700000 {
245 compatible = "renesas,rcar-dmac";
246 reg = <0 0xe6700000 0 0x20000>;
247 interrupts = <0 197 IRQ_TYPE_LEVEL_HIGH
248 0 200 IRQ_TYPE_LEVEL_HIGH
249 0 201 IRQ_TYPE_LEVEL_HIGH
250 0 202 IRQ_TYPE_LEVEL_HIGH
251 0 203 IRQ_TYPE_LEVEL_HIGH
252 0 204 IRQ_TYPE_LEVEL_HIGH
253 0 205 IRQ_TYPE_LEVEL_HIGH
254 0 206 IRQ_TYPE_LEVEL_HIGH
255 0 207 IRQ_TYPE_LEVEL_HIGH
256 0 208 IRQ_TYPE_LEVEL_HIGH
257 0 209 IRQ_TYPE_LEVEL_HIGH
258 0 210 IRQ_TYPE_LEVEL_HIGH
259 0 211 IRQ_TYPE_LEVEL_HIGH
260 0 212 IRQ_TYPE_LEVEL_HIGH
261 0 213 IRQ_TYPE_LEVEL_HIGH
262 0 214 IRQ_TYPE_LEVEL_HIGH>;
263 interrupt-names = "error",
264 "ch0", "ch1", "ch2", "ch3",
265 "ch4", "ch5", "ch6", "ch7",
266 "ch8", "ch9", "ch10", "ch11",
267 "ch12", "ch13", "ch14";
268 clocks = <&mstp2_clks R8A7791_CLK_SYS_DMAC0>;
269 clock-names = "fck";
270 #dma-cells = <1>;
271 dma-channels = <15>;
272 };
273
274 dmac1: dma-controller@e6720000 {
275 compatible = "renesas,rcar-dmac";
276 reg = <0 0xe6720000 0 0x20000>;
277 interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH
278 0 216 IRQ_TYPE_LEVEL_HIGH
279 0 217 IRQ_TYPE_LEVEL_HIGH
280 0 218 IRQ_TYPE_LEVEL_HIGH
281 0 219 IRQ_TYPE_LEVEL_HIGH
282 0 308 IRQ_TYPE_LEVEL_HIGH
283 0 309 IRQ_TYPE_LEVEL_HIGH
284 0 310 IRQ_TYPE_LEVEL_HIGH
285 0 311 IRQ_TYPE_LEVEL_HIGH
286 0 312 IRQ_TYPE_LEVEL_HIGH
287 0 313 IRQ_TYPE_LEVEL_HIGH
288 0 314 IRQ_TYPE_LEVEL_HIGH
289 0 315 IRQ_TYPE_LEVEL_HIGH
290 0 316 IRQ_TYPE_LEVEL_HIGH
291 0 317 IRQ_TYPE_LEVEL_HIGH
292 0 318 IRQ_TYPE_LEVEL_HIGH>;
293 interrupt-names = "error",
294 "ch0", "ch1", "ch2", "ch3",
295 "ch4", "ch5", "ch6", "ch7",
296 "ch8", "ch9", "ch10", "ch11",
297 "ch12", "ch13", "ch14";
298 clocks = <&mstp2_clks R8A7791_CLK_SYS_DMAC1>;
299 clock-names = "fck";
300 #dma-cells = <1>;
301 dma-channels = <15>;
302 };
303
209 /* The memory map in the User's Manual maps the cores to bus numbers */ 304 /* The memory map in the User's Manual maps the cores to bus numbers */
210 i2c0: i2c@e6508000 { 305 i2c0: i2c@e6508000 {
211 #address-cells = <1>; 306 #address-cells = <1>;
@@ -518,6 +613,30 @@
518 status = "disabled"; 613 status = "disabled";
519 }; 614 };
520 615
616 vin0: video@e6ef0000 {
617 compatible = "renesas,vin-r8a7791";
618 clocks = <&mstp8_clks R8A7791_CLK_VIN0>;
619 reg = <0 0xe6ef0000 0 0x1000>;
620 interrupts = <0 188 IRQ_TYPE_LEVEL_HIGH>;
621 status = "disabled";
622 };
623
624 vin1: video@e6ef1000 {
625 compatible = "renesas,vin-r8a7791";
626 clocks = <&mstp8_clks R8A7791_CLK_VIN1>;
627 reg = <0 0xe6ef1000 0 0x1000>;
628 interrupts = <0 189 IRQ_TYPE_LEVEL_HIGH>;
629 status = "disabled";
630 };
631
632 vin2: video@e6ef2000 {
633 compatible = "renesas,vin-r8a7791";
634 clocks = <&mstp8_clks R8A7791_CLK_VIN2>;
635 reg = <0 0xe6ef2000 0 0x1000>;
636 interrupts = <0 190 IRQ_TYPE_LEVEL_HIGH>;
637 status = "disabled";
638 };
639
521 clocks { 640 clocks {
522 #address-cells = <2>; 641 #address-cells = <2>;
523 #size-cells = <2>; 642 #size-cells = <2>;
@@ -770,16 +889,16 @@
770 mstp1_clks: mstp1_clks@e6150134 { 889 mstp1_clks: mstp1_clks@e6150134 {
771 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 890 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
772 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>; 891 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
773 clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>, 892 clocks = <&m2_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>,
774 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>; 893 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>;
775 #clock-cells = <1>; 894 #clock-cells = <1>;
776 renesas,clock-indices = < 895 renesas,clock-indices = <
777 R8A7791_CLK_TMU1 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2 896 R8A7791_CLK_JPU R8A7791_CLK_TMU1 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2
778 R8A7791_CLK_CMT0 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1 897 R8A7791_CLK_CMT0 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1
779 R8A7791_CLK_VSP1_DU0 R8A7791_CLK_VSP1_S 898 R8A7791_CLK_VSP1_DU0 R8A7791_CLK_VSP1_S
780 >; 899 >;
781 clock-output-names = 900 clock-output-names =
782 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1", 901 "jpu", "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
783 "vsp1-du0", "vsp1-sy"; 902 "vsp1-du0", "vsp1-sy";
784 }; 903 };
785 mstp2_clks: mstp2_clks@e6150138 { 904 mstp2_clks: mstp2_clks@e6150138 {
@@ -925,6 +1044,8 @@
925 reg = <0 0xe6b10000 0 0x2c>; 1044 reg = <0 0xe6b10000 0 0x2c>;
926 interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>; 1045 interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
927 clocks = <&mstp9_clks R8A7791_CLK_QSPI_MOD>; 1046 clocks = <&mstp9_clks R8A7791_CLK_QSPI_MOD>;
1047 dmas = <&dmac0 0x17>, <&dmac0 0x18>;
1048 dma-names = "tx", "rx";
928 num-cs = <1>; 1049 num-cs = <1>;
929 #address-cells = <1>; 1050 #address-cells = <1>;
930 #size-cells = <0>; 1051 #size-cells = <0>;
@@ -933,9 +1054,11 @@
933 1054
934 msiof0: spi@e6e20000 { 1055 msiof0: spi@e6e20000 {
935 compatible = "renesas,msiof-r8a7791"; 1056 compatible = "renesas,msiof-r8a7791";
936 reg = <0 0xe6e20000 0 0x0064>; 1057 reg = <0 0xe6e20000 0 0x0064>, <0 0xe7e20000 0 0x0064>;
937 interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>; 1058 interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
938 clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>; 1059 clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>;
1060 dmas = <&dmac0 0x51>, <&dmac0 0x52>;
1061 dma-names = "tx", "rx";
939 #address-cells = <1>; 1062 #address-cells = <1>;
940 #size-cells = <0>; 1063 #size-cells = <0>;
941 status = "disabled"; 1064 status = "disabled";
@@ -943,9 +1066,11 @@
943 1066
944 msiof1: spi@e6e10000 { 1067 msiof1: spi@e6e10000 {
945 compatible = "renesas,msiof-r8a7791"; 1068 compatible = "renesas,msiof-r8a7791";
946 reg = <0 0xe6e10000 0 0x0064>; 1069 reg = <0 0xe6e10000 0 0x0064>, <0 0xe7e10000 0 0x0064>;
947 interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>; 1070 interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>;
948 clocks = <&mstp2_clks R8A7791_CLK_MSIOF1>; 1071 clocks = <&mstp2_clks R8A7791_CLK_MSIOF1>;
1072 dmas = <&dmac0 0x55>, <&dmac0 0x56>;
1073 dma-names = "tx", "rx";
949 #address-cells = <1>; 1074 #address-cells = <1>;
950 #size-cells = <0>; 1075 #size-cells = <0>;
951 status = "disabled"; 1076 status = "disabled";
@@ -953,9 +1078,11 @@
953 1078
954 msiof2: spi@e6e00000 { 1079 msiof2: spi@e6e00000 {
955 compatible = "renesas,msiof-r8a7791"; 1080 compatible = "renesas,msiof-r8a7791";
956 reg = <0 0xe6e00000 0 0x0064>; 1081 reg = <0 0xe6e00000 0 0x0064>, <0 0xe7e00000 0 0x0064>;
957 interrupts = <0 158 IRQ_TYPE_LEVEL_HIGH>; 1082 interrupts = <0 158 IRQ_TYPE_LEVEL_HIGH>;
958 clocks = <&mstp2_clks R8A7791_CLK_MSIOF2>; 1083 clocks = <&mstp2_clks R8A7791_CLK_MSIOF2>;
1084 dmas = <&dmac0 0x41>, <&dmac0 0x42>;
1085 dma-names = "tx", "rx";
959 #address-cells = <1>; 1086 #address-cells = <1>;
960 #size-cells = <0>; 1087 #size-cells = <0>;
961 status = "disabled"; 1088 status = "disabled";
@@ -1029,7 +1156,6 @@
1029 rcar_sound: rcar_sound@0xec500000 { 1156 rcar_sound: rcar_sound@0xec500000 {
1030 #sound-dai-cells = <1>; 1157 #sound-dai-cells = <1>;
1031 compatible = "renesas,rcar_sound-r8a7791", "renesas,rcar_sound-gen2", "renesas,rcar_sound"; 1158 compatible = "renesas,rcar_sound-r8a7791", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
1032 interrupt-parent = <&gic>;
1033 reg = <0 0xec500000 0 0x1000>, /* SCU */ 1159 reg = <0 0xec500000 0 0x1000>, /* SCU */
1034 <0 0xec5a0000 0 0x100>, /* ADG */ 1160 <0 0xec5a0000 0 0x100>, /* ADG */
1035 <0 0xec540000 0 0x1000>, /* SSIU */ 1161 <0 0xec540000 0 0x1000>, /* SSIU */
diff --git a/arch/arm/boot/dts/r8a7794-alt.dts b/arch/arm/boot/dts/r8a7794-alt.dts
new file mode 100644
index 000000000000..79d06ef017a0
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7794-alt.dts
@@ -0,0 +1,47 @@
1/*
2 * Device Tree Source for the Alt board
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/dts-v1/;
12#include "r8a7794.dtsi"
13
14/ {
15 model = "Alt";
16 compatible = "renesas,alt", "renesas,r8a7794";
17
18 aliases {
19 serial0 = &scif2;
20 };
21
22 chosen {
23 bootargs = "console=ttySC0,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp";
24 };
25
26 memory@40000000 {
27 device_type = "memory";
28 reg = <0 0x40000000 0 0x40000000>;
29 };
30
31 lbsc {
32 #address-cells = <1>;
33 #size-cells = <1>;
34 };
35};
36
37&extal_clk {
38 clock-frequency = <20000000>;
39};
40
41&cmt0 {
42 status = "ok";
43};
44
45&scif2 {
46 status = "ok";
47};
diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
new file mode 100644
index 000000000000..d4e8bce1e0b7
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -0,0 +1,531 @@
1/*
2 * Device Tree Source for the r8a7794 SoC
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 * Copyright (C) 2014 Ulrich Hecht
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 <dt-bindings/clock/r8a7794-clock.h>
13#include <dt-bindings/interrupt-controller/arm-gic.h>
14#include <dt-bindings/interrupt-controller/irq.h>
15
16/ {
17 compatible = "renesas,r8a7794";
18 interrupt-parent = <&gic>;
19 #address-cells = <2>;
20 #size-cells = <2>;
21
22 cpus {
23 #address-cells = <1>;
24 #size-cells = <0>;
25
26 cpu0: cpu@0 {
27 device_type = "cpu";
28 compatible = "arm,cortex-a7";
29 reg = <0>;
30 clock-frequency = <1000000000>;
31 };
32
33 cpu1: cpu@1 {
34 device_type = "cpu";
35 compatible = "arm,cortex-a7";
36 reg = <1>;
37 clock-frequency = <1000000000>;
38 };
39 };
40
41 gic: interrupt-controller@f1001000 {
42 compatible = "arm,cortex-a7-gic";
43 #interrupt-cells = <3>;
44 #address-cells = <0>;
45 interrupt-controller;
46 reg = <0 0xf1001000 0 0x1000>,
47 <0 0xf1002000 0 0x1000>,
48 <0 0xf1004000 0 0x2000>,
49 <0 0xf1006000 0 0x2000>;
50 interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
51 };
52
53 cmt0: timer@ffca0000 {
54 compatible = "renesas,cmt-48-gen2";
55 reg = <0 0xffca0000 0 0x1004>;
56 interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>,
57 <0 143 IRQ_TYPE_LEVEL_HIGH>;
58 clocks = <&mstp1_clks R8A7794_CLK_CMT0>;
59 clock-names = "fck";
60
61 renesas,channels-mask = <0x60>;
62
63 status = "disabled";
64 };
65
66 cmt1: timer@e6130000 {
67 compatible = "renesas,cmt-48-gen2";
68 reg = <0 0xe6130000 0 0x1004>;
69 interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>,
70 <0 121 IRQ_TYPE_LEVEL_HIGH>,
71 <0 122 IRQ_TYPE_LEVEL_HIGH>,
72 <0 123 IRQ_TYPE_LEVEL_HIGH>,
73 <0 124 IRQ_TYPE_LEVEL_HIGH>,
74 <0 125 IRQ_TYPE_LEVEL_HIGH>,
75 <0 126 IRQ_TYPE_LEVEL_HIGH>,
76 <0 127 IRQ_TYPE_LEVEL_HIGH>;
77 clocks = <&mstp3_clks R8A7794_CLK_CMT1>;
78 clock-names = "fck";
79
80 renesas,channels-mask = <0xff>;
81
82 status = "disabled";
83 };
84
85 irqc0: interrupt-controller@e61c0000 {
86 compatible = "renesas,irqc-r8a7794", "renesas,irqc";
87 #interrupt-cells = <2>;
88 interrupt-controller;
89 reg = <0 0xe61c0000 0 0x200>;
90 interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
91 <0 1 IRQ_TYPE_LEVEL_HIGH>,
92 <0 2 IRQ_TYPE_LEVEL_HIGH>,
93 <0 3 IRQ_TYPE_LEVEL_HIGH>,
94 <0 12 IRQ_TYPE_LEVEL_HIGH>,
95 <0 13 IRQ_TYPE_LEVEL_HIGH>,
96 <0 14 IRQ_TYPE_LEVEL_HIGH>,
97 <0 15 IRQ_TYPE_LEVEL_HIGH>,
98 <0 16 IRQ_TYPE_LEVEL_HIGH>,
99 <0 17 IRQ_TYPE_LEVEL_HIGH>;
100 };
101
102 scifa0: serial@e6c40000 {
103 compatible = "renesas,scifa-r8a7794", "renesas,scifa";
104 reg = <0 0xe6c40000 0 64>;
105 interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
106 clocks = <&mstp2_clks R8A7794_CLK_SCIFA0>;
107 clock-names = "sci_ick";
108 status = "disabled";
109 };
110
111 scifa1: serial@e6c50000 {
112 compatible = "renesas,scifa-r8a7794", "renesas,scifa";
113 reg = <0 0xe6c50000 0 64>;
114 interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>;
115 clocks = <&mstp2_clks R8A7794_CLK_SCIFA1>;
116 clock-names = "sci_ick";
117 status = "disabled";
118 };
119
120 scifa2: serial@e6c60000 {
121 compatible = "renesas,scifa-r8a7794", "renesas,scifa";
122 reg = <0 0xe6c60000 0 64>;
123 interrupts = <0 151 IRQ_TYPE_LEVEL_HIGH>;
124 clocks = <&mstp2_clks R8A7794_CLK_SCIFA2>;
125 clock-names = "sci_ick";
126 status = "disabled";
127 };
128
129 scifa3: serial@e6c70000 {
130 compatible = "renesas,scifa-r8a7794", "renesas,scifa";
131 reg = <0 0xe6c70000 0 64>;
132 interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>;
133 clocks = <&mstp11_clks R8A7794_CLK_SCIFA3>;
134 clock-names = "sci_ick";
135 status = "disabled";
136 };
137
138 scifa4: serial@e6c78000 {
139 compatible = "renesas,scifa-r8a7794", "renesas,scifa";
140 reg = <0 0xe6c78000 0 64>;
141 interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>;
142 clocks = <&mstp11_clks R8A7794_CLK_SCIFA4>;
143 clock-names = "sci_ick";
144 status = "disabled";
145 };
146
147 scifa5: serial@e6c80000 {
148 compatible = "renesas,scifa-r8a7794", "renesas,scifa";
149 reg = <0 0xe6c80000 0 64>;
150 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
151 clocks = <&mstp11_clks R8A7794_CLK_SCIFA5>;
152 clock-names = "sci_ick";
153 status = "disabled";
154 };
155
156 scifb0: serial@e6c20000 {
157 compatible = "renesas,scifb-r8a7794", "renesas,scifb";
158 reg = <0 0xe6c20000 0 64>;
159 interrupts = <0 148 IRQ_TYPE_LEVEL_HIGH>;
160 clocks = <&mstp2_clks R8A7794_CLK_SCIFB0>;
161 clock-names = "sci_ick";
162 status = "disabled";
163 };
164
165 scifb1: serial@e6c30000 {
166 compatible = "renesas,scifb-r8a7794", "renesas,scifb";
167 reg = <0 0xe6c30000 0 64>;
168 interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH>;
169 clocks = <&mstp2_clks R8A7794_CLK_SCIFB1>;
170 clock-names = "sci_ick";
171 status = "disabled";
172 };
173
174 scifb2: serial@e6ce0000 {
175 compatible = "renesas,scifb-r8a7794", "renesas,scifb";
176 reg = <0 0xe6ce0000 0 64>;
177 interrupts = <0 150 IRQ_TYPE_LEVEL_HIGH>;
178 clocks = <&mstp2_clks R8A7794_CLK_SCIFB2>;
179 clock-names = "sci_ick";
180 status = "disabled";
181 };
182
183 scif0: serial@e6e60000 {
184 compatible = "renesas,scif-r8a7794", "renesas,scif";
185 reg = <0 0xe6e60000 0 64>;
186 interrupts = <0 152 IRQ_TYPE_LEVEL_HIGH>;
187 clocks = <&mstp7_clks R8A7794_CLK_SCIF0>;
188 clock-names = "sci_ick";
189 status = "disabled";
190 };
191
192 scif1: serial@e6e68000 {
193 compatible = "renesas,scif-r8a7794", "renesas,scif";
194 reg = <0 0xe6e68000 0 64>;
195 interrupts = <0 153 IRQ_TYPE_LEVEL_HIGH>;
196 clocks = <&mstp7_clks R8A7794_CLK_SCIF1>;
197 clock-names = "sci_ick";
198 status = "disabled";
199 };
200
201 scif2: serial@e6e58000 {
202 compatible = "renesas,scif-r8a7794", "renesas,scif";
203 reg = <0 0xe6e58000 0 64>;
204 interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
205 clocks = <&mstp7_clks R8A7794_CLK_SCIF2>;
206 clock-names = "sci_ick";
207 status = "disabled";
208 };
209
210 scif3: serial@e6ea8000 {
211 compatible = "renesas,scif-r8a7794", "renesas,scif";
212 reg = <0 0xe6ea8000 0 64>;
213 interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>;
214 clocks = <&mstp7_clks R8A7794_CLK_SCIF3>;
215 clock-names = "sci_ick";
216 status = "disabled";
217 };
218
219 scif4: serial@e6ee0000 {
220 compatible = "renesas,scif-r8a7794", "renesas,scif";
221 reg = <0 0xe6ee0000 0 64>;
222 interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>;
223 clocks = <&mstp7_clks R8A7794_CLK_SCIF4>;
224 clock-names = "sci_ick";
225 status = "disabled";
226 };
227
228 scif5: serial@e6ee8000 {
229 compatible = "renesas,scif-r8a7794", "renesas,scif";
230 reg = <0 0xe6ee8000 0 64>;
231 interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>;
232 clocks = <&mstp7_clks R8A7794_CLK_SCIF5>;
233 clock-names = "sci_ick";
234 status = "disabled";
235 };
236
237 hscif0: serial@e62c0000 {
238 compatible = "renesas,hscif-r8a7794", "renesas,hscif";
239 reg = <0 0xe62c0000 0 96>;
240 interrupts = <0 154 IRQ_TYPE_LEVEL_HIGH>;
241 clocks = <&mstp7_clks R8A7794_CLK_HSCIF0>;
242 clock-names = "sci_ick";
243 status = "disabled";
244 };
245
246 hscif1: serial@e62c8000 {
247 compatible = "renesas,hscif-r8a7794", "renesas,hscif";
248 reg = <0 0xe62c8000 0 96>;
249 interrupts = <0 155 IRQ_TYPE_LEVEL_HIGH>;
250 clocks = <&mstp7_clks R8A7794_CLK_HSCIF1>;
251 clock-names = "sci_ick";
252 status = "disabled";
253 };
254
255 hscif2: serial@e62d0000 {
256 compatible = "renesas,hscif-r8a7794", "renesas,hscif";
257 reg = <0 0xe62d0000 0 96>;
258 interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>;
259 clocks = <&mstp7_clks R8A7794_CLK_HSCIF2>;
260 clock-names = "sci_ick";
261 status = "disabled";
262 };
263
264 clocks {
265 #address-cells = <2>;
266 #size-cells = <2>;
267 ranges;
268
269 /* External root clock */
270 extal_clk: extal_clk {
271 compatible = "fixed-clock";
272 #clock-cells = <0>;
273 /* This value must be overriden by the board. */
274 clock-frequency = <0>;
275 clock-output-names = "extal";
276 };
277
278 /* Special CPG clocks */
279 cpg_clocks: cpg_clocks@e6150000 {
280 compatible = "renesas,r8a7794-cpg-clocks",
281 "renesas,rcar-gen2-cpg-clocks";
282 reg = <0 0xe6150000 0 0x1000>;
283 clocks = <&extal_clk>;
284 #clock-cells = <1>;
285 clock-output-names = "main", "pll0", "pll1", "pll3",
286 "lb", "qspi", "sdh", "sd0", "z";
287 };
288
289 /* Fixed factor clocks */
290 pll1_div2_clk: pll1_div2_clk {
291 compatible = "fixed-factor-clock";
292 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
293 #clock-cells = <0>;
294 clock-div = <2>;
295 clock-mult = <1>;
296 clock-output-names = "pll1_div2";
297 };
298 zg_clk: zg_clk {
299 compatible = "fixed-factor-clock";
300 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
301 #clock-cells = <0>;
302 clock-div = <6>;
303 clock-mult = <1>;
304 clock-output-names = "zg";
305 };
306 zx_clk: zx_clk {
307 compatible = "fixed-factor-clock";
308 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
309 #clock-cells = <0>;
310 clock-div = <3>;
311 clock-mult = <1>;
312 clock-output-names = "zx";
313 };
314 zs_clk: zs_clk {
315 compatible = "fixed-factor-clock";
316 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
317 #clock-cells = <0>;
318 clock-div = <6>;
319 clock-mult = <1>;
320 clock-output-names = "zs";
321 };
322 hp_clk: hp_clk {
323 compatible = "fixed-factor-clock";
324 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
325 #clock-cells = <0>;
326 clock-div = <12>;
327 clock-mult = <1>;
328 clock-output-names = "hp";
329 };
330 i_clk: i_clk {
331 compatible = "fixed-factor-clock";
332 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
333 #clock-cells = <0>;
334 clock-div = <2>;
335 clock-mult = <1>;
336 clock-output-names = "i";
337 };
338 b_clk: b_clk {
339 compatible = "fixed-factor-clock";
340 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
341 #clock-cells = <0>;
342 clock-div = <12>;
343 clock-mult = <1>;
344 clock-output-names = "b";
345 };
346 p_clk: p_clk {
347 compatible = "fixed-factor-clock";
348 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
349 #clock-cells = <0>;
350 clock-div = <24>;
351 clock-mult = <1>;
352 clock-output-names = "p";
353 };
354 cl_clk: cl_clk {
355 compatible = "fixed-factor-clock";
356 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
357 #clock-cells = <0>;
358 clock-div = <48>;
359 clock-mult = <1>;
360 clock-output-names = "cl";
361 };
362 m2_clk: m2_clk {
363 compatible = "fixed-factor-clock";
364 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
365 #clock-cells = <0>;
366 clock-div = <8>;
367 clock-mult = <1>;
368 clock-output-names = "m2";
369 };
370 imp_clk: imp_clk {
371 compatible = "fixed-factor-clock";
372 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
373 #clock-cells = <0>;
374 clock-div = <4>;
375 clock-mult = <1>;
376 clock-output-names = "imp";
377 };
378 rclk_clk: rclk_clk {
379 compatible = "fixed-factor-clock";
380 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
381 #clock-cells = <0>;
382 clock-div = <(48 * 1024)>;
383 clock-mult = <1>;
384 clock-output-names = "rclk";
385 };
386 oscclk_clk: oscclk_clk {
387 compatible = "fixed-factor-clock";
388 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
389 #clock-cells = <0>;
390 clock-div = <(12 * 1024)>;
391 clock-mult = <1>;
392 clock-output-names = "oscclk";
393 };
394 zb3_clk: zb3_clk {
395 compatible = "fixed-factor-clock";
396 clocks = <&cpg_clocks R8A7794_CLK_PLL3>;
397 #clock-cells = <0>;
398 clock-div = <4>;
399 clock-mult = <1>;
400 clock-output-names = "zb3";
401 };
402 zb3d2_clk: zb3d2_clk {
403 compatible = "fixed-factor-clock";
404 clocks = <&cpg_clocks R8A7794_CLK_PLL3>;
405 #clock-cells = <0>;
406 clock-div = <8>;
407 clock-mult = <1>;
408 clock-output-names = "zb3d2";
409 };
410 ddr_clk: ddr_clk {
411 compatible = "fixed-factor-clock";
412 clocks = <&cpg_clocks R8A7794_CLK_PLL3>;
413 #clock-cells = <0>;
414 clock-div = <8>;
415 clock-mult = <1>;
416 clock-output-names = "ddr";
417 };
418 mp_clk: mp_clk {
419 compatible = "fixed-factor-clock";
420 clocks = <&pll1_div2_clk>;
421 #clock-cells = <0>;
422 clock-div = <15>;
423 clock-mult = <1>;
424 clock-output-names = "mp";
425 };
426 cp_clk: cp_clk {
427 compatible = "fixed-factor-clock";
428 clocks = <&cpg_clocks R8A7794_CLK_PLL1>;
429 #clock-cells = <0>;
430 clock-div = <48>;
431 clock-mult = <1>;
432 clock-output-names = "cp";
433 };
434
435 acp_clk: acp_clk {
436 compatible = "fixed-factor-clock";
437 clocks = <&extal_clk>;
438 #clock-cells = <0>;
439 clock-div = <2>;
440 clock-mult = <1>;
441 clock-output-names = "acp";
442 };
443
444 /* Gate clocks */
445 mstp0_clks: mstp0_clks@e6150130 {
446 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
447 reg = <0 0xe6150130 0 4>, <0 0xe6150030 0 4>;
448 clocks = <&mp_clk>;
449 #clock-cells = <1>;
450 renesas,clock-indices = <R8A7794_CLK_MSIOF0>;
451 clock-output-names = "msiof0";
452 };
453 mstp1_clks: mstp1_clks@e6150134 {
454 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
455 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
456 clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>,
457 <&cp_clk>,
458 <&zs_clk>, <&zs_clk>, <&zs_clk>;
459 #clock-cells = <1>;
460 renesas,clock-indices = <
461 R8A7794_CLK_TMU1 R8A7794_CLK_TMU3 R8A7794_CLK_TMU2
462 R8A7794_CLK_CMT0 R8A7794_CLK_TMU0
463 >;
464 clock-output-names =
465 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0";
466 };
467 mstp2_clks: mstp2_clks@e6150138 {
468 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
469 reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>;
470 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>,
471 <&mp_clk>, <&mp_clk>, <&mp_clk>;
472 #clock-cells = <1>;
473 renesas,clock-indices = <
474 R8A7794_CLK_SCIFA2 R8A7794_CLK_SCIFA1 R8A7794_CLK_SCIFA0
475 R8A7794_CLK_MSIOF2 R8A7794_CLK_SCIFB0 R8A7794_CLK_SCIFB1
476 R8A7794_CLK_MSIOF1 R8A7794_CLK_SCIFB2
477 >;
478 clock-output-names =
479 "scifa2", "scifa1", "scifa0", "msiof2", "scifb0",
480 "scifb1", "msiof1", "scifb2";
481 };
482 mstp3_clks: mstp3_clks@e615013c {
483 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
484 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
485 clocks = <&rclk_clk>;
486 #clock-cells = <1>;
487 renesas,clock-indices = <
488 R8A7794_CLK_CMT1
489 >;
490 clock-output-names =
491 "cmt1";
492 };
493 mstp7_clks: mstp7_clks@e615014c {
494 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
495 reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>;
496 clocks = <&zs_clk>, <&p_clk>, <&p_clk>, <&zs_clk>,
497 <&zs_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>;
498 #clock-cells = <1>;
499 renesas,clock-indices = <
500 R8A7794_CLK_HSCIF2 R8A7794_CLK_SCIF5
501 R8A7794_CLK_SCIF4 R8A7794_CLK_HSCIF1 R8A7794_CLK_HSCIF0
502 R8A7794_CLK_SCIF3 R8A7794_CLK_SCIF2 R8A7794_CLK_SCIF1
503 R8A7794_CLK_SCIF0
504 >;
505 clock-output-names =
506 "hscif2", "scif5", "scif4", "hscif1", "hscif0",
507 "scif3", "scif2", "scif1", "scif0";
508 };
509 mstp8_clks: mstp8_clks@e6150990 {
510 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
511 reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>;
512 clocks = <&p_clk>;
513 #clock-cells = <1>;
514 renesas,clock-indices = <
515 R8A7794_CLK_ETHER
516 >;
517 clock-output-names =
518 "ether";
519 };
520 mstp11_clks: mstp11_clks@e615099c {
521 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
522 reg = <0 0xe615099c 0 4>, <0 0xe61509ac 0 4>;
523 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>;
524 #clock-cells = <1>;
525 renesas,clock-indices = <
526 R8A7794_CLK_SCIFA3 R8A7794_CLK_SCIFA4 R8A7794_CLK_SCIFA5
527 >;
528 clock-output-names = "scifa3", "scifa4", "scifa5";
529 };
530 };
531};
diff --git a/arch/arm/boot/dts/rk3066a-bqcurie2.dts b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
index 042f821d9e4d..d5344510c676 100644
--- a/arch/arm/boot/dts/rk3066a-bqcurie2.dts
+++ b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
@@ -149,13 +149,11 @@
149&mmc0 { /* sdmmc */ 149&mmc0 { /* sdmmc */
150 num-slots = <1>; 150 num-slots = <1>;
151 status = "okay"; 151 status = "okay";
152 pinctrl-names = "default";
153 pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>;
152 vmmc-supply = <&vcc_sd0>; 154 vmmc-supply = <&vcc_sd0>;
153 155 bus-width = <4>;
154 slot@0 { 156 disable-wp;
155 reg = <0>;
156 bus-width = <4>;
157 disable-wp;
158 };
159}; 157};
160 158
161&mmc1 { /* wifi */ 159&mmc1 { /* wifi */
@@ -166,11 +164,8 @@
166 pinctrl-names = "default"; 164 pinctrl-names = "default";
167 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_bus4>; 165 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_bus4>;
168 166
169 slot@0 { 167 bus-width = <4>;
170 reg = <0>; 168 disable-wp;
171 bus-width = <4>;
172 disable-wp;
173 };
174}; 169};
175 170
176&uart0 { 171&uart0 {
diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi
index 879a818fba51..ad9c2db59670 100644
--- a/arch/arm/boot/dts/rk3066a.dtsi
+++ b/arch/arm/boot/dts/rk3066a.dtsi
@@ -179,6 +179,27 @@
179 bias-disable; 179 bias-disable;
180 }; 180 };
181 181
182 emmc {
183 emmc_clk: emmc-clk {
184 rockchip,pins = <RK_GPIO3 31 RK_FUNC_2 &pcfg_pull_default>;
185 };
186
187 emmc_cmd: emmc-cmd {
188 rockchip,pins = <RK_GPIO4 9 RK_FUNC_2 &pcfg_pull_default>;
189 };
190
191 emmc_rst: emmc-rst {
192 rockchip,pins = <RK_GPIO4 10 RK_FUNC_2 &pcfg_pull_default>;
193 };
194
195 /*
196 * The data pins are shared between nandc and emmc and
197 * not accessible through pinctrl. Also they should've
198 * been already set correctly by firmware, as
199 * flash/emmc is the boot-device.
200 */
201 };
202
182 i2c0 { 203 i2c0 {
183 i2c0_xfer: i2c0-xfer { 204 i2c0_xfer: i2c0-xfer {
184 rockchip,pins = <RK_GPIO2 28 RK_FUNC_1 &pcfg_pull_none>, 205 rockchip,pins = <RK_GPIO2 28 RK_FUNC_1 &pcfg_pull_none>,
@@ -238,6 +259,42 @@
238 }; 259 };
239 }; 260 };
240 261
262 spi0 {
263 spi0_clk: spi0-clk {
264 rockchip,pins = <RK_GPIO1 5 RK_FUNC_2 &pcfg_pull_default>;
265 };
266 spi0_cs0: spi0-cs0 {
267 rockchip,pins = <RK_GPIO1 4 RK_FUNC_2 &pcfg_pull_default>;
268 };
269 spi0_tx: spi0-tx {
270 rockchip,pins = <RK_GPIO1 7 RK_FUNC_2 &pcfg_pull_default>;
271 };
272 spi0_rx: spi0-rx {
273 rockchip,pins = <RK_GPIO1 6 RK_FUNC_2 &pcfg_pull_default>;
274 };
275 spi0_cs1: spi0-cs1 {
276 rockchip,pins = <RK_GPIO4 15 RK_FUNC_1 &pcfg_pull_default>;
277 };
278 };
279
280 spi1 {
281 spi1_clk: spi1-clk {
282 rockchip,pins = <RK_GPIO2 19 RK_FUNC_2 &pcfg_pull_default>;
283 };
284 spi1_cs0: spi1-cs0 {
285 rockchip,pins = <RK_GPIO2 20 RK_FUNC_2 &pcfg_pull_default>;
286 };
287 spi1_rx: spi1-rx {
288 rockchip,pins = <RK_GPIO2 22 RK_FUNC_2 &pcfg_pull_default>;
289 };
290 spi1_tx: spi1-tx {
291 rockchip,pins = <RK_GPIO2 21 RK_FUNC_2 &pcfg_pull_default>;
292 };
293 spi1_cs1: spi1-cs1 {
294 rockchip,pins = <RK_GPIO2 23 RK_FUNC_2 &pcfg_pull_default>;
295 };
296 };
297
241 uart0 { 298 uart0 {
242 uart0_xfer: uart0-xfer { 299 uart0_xfer: uart0-xfer {
243 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>, 300 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>,
@@ -406,6 +463,16 @@
406 pinctrl-0 = <&pwm3_out>; 463 pinctrl-0 = <&pwm3_out>;
407}; 464};
408 465
466&spi0 {
467 pinctrl-names = "default";
468 pinctrl-0 = <&spi0_clk &spi0_tx &spi0_rx &spi0_cs0>;
469};
470
471&spi1 {
472 pinctrl-names = "default";
473 pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0>;
474};
475
409&uart0 { 476&uart0 {
410 pinctrl-names = "default"; 477 pinctrl-names = "default";
411 pinctrl-0 = <&uart0_xfer>; 478 pinctrl-0 = <&uart0_xfer>;
diff --git a/arch/arm/boot/dts/rk3188-radxarock.dts b/arch/arm/boot/dts/rk3188-radxarock.dts
index 171b610db709..15910c9ddbc7 100644
--- a/arch/arm/boot/dts/rk3188-radxarock.dts
+++ b/arch/arm/boot/dts/rk3188-radxarock.dts
@@ -65,6 +65,19 @@
65 pinctrl-0 = <&ir_recv_pin>; 65 pinctrl-0 = <&ir_recv_pin>;
66 }; 66 };
67 67
68 vcc_otg: usb-otg-regulator {
69 compatible = "regulator-fixed";
70 enable-active-high;
71 gpio = <&gpio2 31 GPIO_ACTIVE_HIGH>;
72 pinctrl-names = "default";
73 pinctrl-0 = <&otg_vbus_drv>;
74 regulator-name = "otg-vbus";
75 regulator-min-microvolt = <5000000>;
76 regulator-max-microvolt = <5000000>;
77 regulator-always-on;
78 regulator-boot-on;
79 };
80
68 vcc_sd0: sdmmc-regulator { 81 vcc_sd0: sdmmc-regulator {
69 compatible = "regulator-fixed"; 82 compatible = "regulator-fixed";
70 regulator-name = "sdmmc-supply"; 83 regulator-name = "sdmmc-supply";
@@ -74,12 +87,52 @@
74 startup-delay-us = <100000>; 87 startup-delay-us = <100000>;
75 vin-supply = <&vcc_io>; 88 vin-supply = <&vcc_io>;
76 }; 89 };
90
91 vcc_host: usb-host-regulator {
92 compatible = "regulator-fixed";
93 enable-active-high;
94 gpio = <&gpio0 3 GPIO_ACTIVE_HIGH>;
95 pinctrl-names = "default";
96 pinctrl-0 = <&host_vbus_drv>;
97 regulator-name = "host-pwr";
98 regulator-min-microvolt = <5000000>;
99 regulator-max-microvolt = <5000000>;
100 regulator-always-on;
101 regulator-boot-on;
102 };
103};
104
105&emac {
106 status = "okay";
107
108 pinctrl-names = "default";
109 pinctrl-0 = <&emac_xfer>, <&emac_mdio>, <&phy_int>;
110
111 phy = <&phy0>;
112 phy-supply = <&vcc_rmii>;
113
114 phy0: ethernet-phy@0 {
115 reg = <0>;
116 interrupt-parent = <&gpio3>;
117 interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
118 };
77}; 119};
78 120
79&i2c1 { 121&i2c1 {
80 status = "okay"; 122 status = "okay";
81 clock-frequency = <400000>; 123 clock-frequency = <400000>;
82 124
125 rtc@51 {
126 compatible = "haoyu,hym8563";
127 reg = <0x51>;
128 interrupt-parent = <&gpio0>;
129 interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
130 pinctrl-names = "default";
131 pinctrl-0 = <&rtc_int>;
132 #clock-cells = <0>;
133 clock-output-names = "xin32k";
134 };
135
83 act8846: act8846@5a { 136 act8846: act8846@5a {
84 compatible = "active-semi,act8846"; 137 compatible = "active-semi,act8846";
85 reg = <0x5a>; 138 reg = <0x5a>;
@@ -149,7 +202,6 @@
149 regulator-name = "VCC_RMII"; 202 regulator-name = "VCC_RMII";
150 regulator-min-microvolt = <3300000>; 203 regulator-min-microvolt = <3300000>;
151 regulator-max-microvolt = <3300000>; 204 regulator-max-microvolt = <3300000>;
152 regulator-always-on;
153 }; 205 };
154 206
155 vccio_wl: REG10 { 207 vccio_wl: REG10 {
@@ -179,13 +231,12 @@
179&mmc0 { 231&mmc0 {
180 num-slots = <1>; 232 num-slots = <1>;
181 status = "okay"; 233 status = "okay";
234 pinctrl-names = "default";
235 pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>;
182 vmmc-supply = <&vcc_sd0>; 236 vmmc-supply = <&vcc_sd0>;
183 237
184 slot@0 { 238 bus-width = <4>;
185 reg = <0>; 239 disable-wp;
186 bus-width = <4>;
187 disable-wp;
188 };
189}; 240};
190 241
191&pinctrl { 242&pinctrl {
@@ -199,11 +250,32 @@
199 }; 250 };
200 }; 251 };
201 252
253 hym8563 {
254 rtc_int: rtc-int {
255 rockchip,pins = <RK_GPIO0 0 RK_FUNC_GPIO &pcfg_pull_up>;
256 };
257 };
258
259 lan8720a {
260 phy_int: phy-int {
261 rockchip,pins = <RK_GPIO3 26 RK_FUNC_GPIO &pcfg_pull_up>;
262 };
263 };
264
202 ir-receiver { 265 ir-receiver {
203 ir_recv_pin: ir-recv-pin { 266 ir_recv_pin: ir-recv-pin {
204 rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO &pcfg_pull_none>; 267 rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO &pcfg_pull_none>;
205 }; 268 };
206 }; 269 };
270
271 usb {
272 host_vbus_drv: host-vbus-drv {
273 rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_none>;
274 };
275 otg_vbus_drv: otg-vbus-drv {
276 rockchip,pins = <2 31 RK_FUNC_GPIO &pcfg_pull_none>;
277 };
278 };
207}; 279};
208 280
209&uart0 { 281&uart0 {
@@ -222,6 +294,14 @@
222 status = "okay"; 294 status = "okay";
223}; 295};
224 296
297&usb_host {
298 status = "okay";
299};
300
301&usb_otg {
302 status = "okay";
303};
304
225&wdt { 305&wdt {
226 status = "okay"; 306 status = "okay";
227}; 307};
diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index ee801a9c6b74..ddaada788b45 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -147,6 +147,45 @@
147 bias-disable; 147 bias-disable;
148 }; 148 };
149 149
150 emmc {
151 emmc_clk: emmc-clk {
152 rockchip,pins = <RK_GPIO0 24 RK_FUNC_2 &pcfg_pull_none>;
153 };
154
155 emmc_cmd: emmc-cmd {
156 rockchip,pins = <RK_GPIO0 26 RK_FUNC_2 &pcfg_pull_up>;
157 };
158
159 emmc_rst: emmc-rst {
160 rockchip,pins = <RK_GPIO0 27 RK_FUNC_2 &pcfg_pull_none>;
161 };
162
163 /*
164 * The data pins are shared between nandc and emmc and
165 * not accessible through pinctrl. Also they should've
166 * been already set correctly by firmware, as
167 * flash/emmc is the boot-device.
168 */
169 };
170
171 emac {
172 emac_xfer: emac-xfer {
173 rockchip,pins = <RK_GPIO3 16 RK_FUNC_2 &pcfg_pull_none>, /* tx_en */
174 <RK_GPIO3 17 RK_FUNC_2 &pcfg_pull_none>, /* txd1 */
175 <RK_GPIO3 18 RK_FUNC_2 &pcfg_pull_none>, /* txd0 */
176 <RK_GPIO3 19 RK_FUNC_2 &pcfg_pull_none>, /* rxd0 */
177 <RK_GPIO3 20 RK_FUNC_2 &pcfg_pull_none>, /* rxd1 */
178 <RK_GPIO3 21 RK_FUNC_2 &pcfg_pull_none>, /* mac_clk */
179 <RK_GPIO3 22 RK_FUNC_2 &pcfg_pull_none>, /* rx_err */
180 <RK_GPIO3 23 RK_FUNC_2 &pcfg_pull_none>; /* crs_dvalid */
181 };
182
183 emac_mdio: emac-mdio {
184 rockchip,pins = <RK_GPIO3 24 RK_FUNC_2 &pcfg_pull_none>,
185 <RK_GPIO3 25 RK_FUNC_2 &pcfg_pull_none>;
186 };
187 };
188
150 i2c0 { 189 i2c0 {
151 i2c0_xfer: i2c0-xfer { 190 i2c0_xfer: i2c0-xfer {
152 rockchip,pins = <RK_GPIO1 24 RK_FUNC_1 &pcfg_pull_none>, 191 rockchip,pins = <RK_GPIO1 24 RK_FUNC_1 &pcfg_pull_none>,
@@ -206,6 +245,42 @@
206 }; 245 };
207 }; 246 };
208 247
248 spi0 {
249 spi0_clk: spi0-clk {
250 rockchip,pins = <RK_GPIO1 6 RK_FUNC_2 &pcfg_pull_up>;
251 };
252 spi0_cs0: spi0-cs0 {
253 rockchip,pins = <RK_GPIO1 7 RK_FUNC_2 &pcfg_pull_up>;
254 };
255 spi0_tx: spi0-tx {
256 rockchip,pins = <RK_GPIO1 5 RK_FUNC_2 &pcfg_pull_up>;
257 };
258 spi0_rx: spi0-rx {
259 rockchip,pins = <RK_GPIO1 4 RK_FUNC_2 &pcfg_pull_up>;
260 };
261 spi0_cs1: spi0-cs1 {
262 rockchip,pins = <RK_GPIO1 15 RK_FUNC_1 &pcfg_pull_up>;
263 };
264 };
265
266 spi1 {
267 spi1_clk: spi1-clk {
268 rockchip,pins = <RK_GPIO0 30 RK_FUNC_1 &pcfg_pull_up>;
269 };
270 spi1_cs0: spi1-cs0 {
271 rockchip,pins = <RK_GPIO0 31 RK_FUNC_1 &pcfg_pull_up>;
272 };
273 spi1_rx: spi1-rx {
274 rockchip,pins = <RK_GPIO0 28 RK_FUNC_1 &pcfg_pull_up>;
275 };
276 spi1_tx: spi1-tx {
277 rockchip,pins = <RK_GPIO0 29 RK_FUNC_1 &pcfg_pull_up>;
278 };
279 spi1_cs1: spi1-cs1 {
280 rockchip,pins = <RK_GPIO1 14 RK_FUNC_2 &pcfg_pull_up>;
281 };
282 };
283
209 uart0 { 284 uart0 {
210 uart0_xfer: uart0-xfer { 285 uart0_xfer: uart0-xfer {
211 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_up>, 286 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_up>,
@@ -323,6 +398,10 @@
323 }; 398 };
324}; 399};
325 400
401&emac {
402 compatible = "rockchip,rk3188-emac";
403};
404
326&global_timer { 405&global_timer {
327 interrupts = <GIC_PPI 11 0xf04>; 406 interrupts = <GIC_PPI 11 0xf04>;
328}; 407};
@@ -381,6 +460,18 @@
381 pinctrl-0 = <&pwm3_out>; 460 pinctrl-0 = <&pwm3_out>;
382}; 461};
383 462
463&spi0 {
464 compatible = "rockchip,rk3188-spi", "rockchip,rk3066-spi";
465 pinctrl-names = "default";
466 pinctrl-0 = <&spi0_clk &spi0_tx &spi0_rx &spi0_cs0>;
467};
468
469&spi1 {
470 compatible = "rockchip,rk3188-spi", "rockchip,rk3066-spi";
471 pinctrl-names = "default";
472 pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0>;
473};
474
384&uart0 { 475&uart0 {
385 pinctrl-names = "default"; 476 pinctrl-names = "default";
386 pinctrl-0 = <&uart0_xfer>; 477 pinctrl-0 = <&uart0_xfer>;
diff --git a/arch/arm/boot/dts/rk3288-evb-act8846.dts b/arch/arm/boot/dts/rk3288-evb-act8846.dts
index 7d59ff4de408..a76dd44adb53 100644
--- a/arch/arm/boot/dts/rk3288-evb-act8846.dts
+++ b/arch/arm/boot/dts/rk3288-evb-act8846.dts
@@ -26,7 +26,7 @@
26 interrupts = <4 IRQ_TYPE_EDGE_FALLING>; 26 interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
27 27
28 pinctrl-names = "default"; 28 pinctrl-names = "default";
29 pinctrl-0 = <&hym8563_int>; 29 pinctrl-0 = <&pmic_int>;
30 30
31 #clock-cells = <0>; 31 #clock-cells = <0>;
32 clock-output-names = "xin32k"; 32 clock-output-names = "xin32k";
@@ -124,11 +124,3 @@
124 }; 124 };
125 }; 125 };
126}; 126};
127
128&pinctrl {
129 hym8563 {
130 hym8563_int: hym8563-int {
131 rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
132 };
133 };
134};
diff --git a/arch/arm/boot/dts/rk3288-evb-rk808.dts b/arch/arm/boot/dts/rk3288-evb-rk808.dts
index 9a88b6c66396..ff522f8e3df4 100644
--- a/arch/arm/boot/dts/rk3288-evb-rk808.dts
+++ b/arch/arm/boot/dts/rk3288-evb-rk808.dts
@@ -16,3 +16,135 @@
16/ { 16/ {
17 compatible = "rockchip,rk3288-evb-rk808", "rockchip,rk3288"; 17 compatible = "rockchip,rk3288-evb-rk808", "rockchip,rk3288";
18}; 18};
19
20&i2c0 {
21 clock-frequency = <400000>;
22 status = "okay";
23
24 rk808: pmic@1b {
25 compatible = "rockchip,rk808";
26 reg = <0x1b>;
27 interrupt-parent = <&gpio0>;
28 interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
29 pinctrl-names = "default";
30 pinctrl-0 = <&pmic_int>;
31 rockchip,system-power-controller;
32 wakeup-source;
33 #clock-cells = <1>;
34 clock-output-names = "xin32k", "rk808-clkout2";
35
36 vcc8-supply = <&vcc_18>;
37 vcc9-supply = <&vcc_io>;
38 vcc10-supply = <&vcc_io>;
39 vcc12-supply = <&vcc_io>;
40 vddio-supply = <&vccio_pmu>;
41
42 regulators {
43 vdd_cpu: DCDC_REG1 {
44 regulator-always-on;
45 regulator-boot-on;
46 regulator-min-microvolt = <750000>;
47 regulator-max-microvolt = <1300000>;
48 regulator-name = "vdd_arm";
49 };
50
51 vdd_gpu: DCDC_REG2 {
52 regulator-always-on;
53 regulator-boot-on;
54 regulator-min-microvolt = <850000>;
55 regulator-max-microvolt = <1250000>;
56 regulator-name = "vdd_gpu";
57 };
58
59 vcc_ddr: DCDC_REG3 {
60 regulator-always-on;
61 regulator-boot-on;
62 regulator-name = "vcc_ddr";
63 };
64
65 vcc_io: DCDC_REG4 {
66 regulator-always-on;
67 regulator-boot-on;
68 regulator-min-microvolt = <3300000>;
69 regulator-max-microvolt = <3300000>;
70 regulator-name = "vcc_io";
71 };
72
73 vccio_pmu: LDO_REG1 {
74 regulator-always-on;
75 regulator-boot-on;
76 regulator-min-microvolt = <3300000>;
77 regulator-max-microvolt = <3300000>;
78 regulator-name = "vccio_pmu";
79 };
80
81 vcc_tp: LDO_REG2 {
82 regulator-always-on;
83 regulator-boot-on;
84 regulator-min-microvolt = <3300000>;
85 regulator-max-microvolt = <3300000>;
86 regulator-name = "vcc_tp";
87 };
88
89 vdd_10: LDO_REG3 {
90 regulator-always-on;
91 regulator-boot-on;
92 regulator-min-microvolt = <1000000>;
93 regulator-max-microvolt = <1000000>;
94 regulator-name = "vdd_10";
95 };
96
97 vcc18_lcd: LDO_REG4 {
98 regulator-always-on;
99 regulator-boot-on;
100 regulator-min-microvolt = <1800000>;
101 regulator-max-microvolt = <1800000>;
102 regulator-name = "vcc18_lcd";
103 };
104
105 vccio_sd: LDO_REG5 {
106 regulator-always-on;
107 regulator-boot-on;
108 regulator-min-microvolt = <1800000>;
109 regulator-max-microvolt = <3300000>;
110 regulator-name = "vccio_sd";
111 };
112
113 vdd10_lcd: LDO_REG6 {
114 regulator-always-on;
115 regulator-boot-on;
116 regulator-min-microvolt = <1000000>;
117 regulator-max-microvolt = <1000000>;
118 regulator-name = "vdd10_lcd";
119 };
120
121 vcc_18: LDO_REG7 {
122 regulator-always-on;
123 regulator-boot-on;
124 regulator-min-microvolt = <1800000>;
125 regulator-max-microvolt = <1800000>;
126 regulator-name = "vcc_18";
127 };
128
129 vcca_codec: LDO_REG8 {
130 regulator-always-on;
131 regulator-boot-on;
132 regulator-min-microvolt = <3300000>;
133 regulator-max-microvolt = <3300000>;
134 regulator-name = "vcca_codec";
135 };
136
137 vcc_wl: SWITCH_REG1 {
138 regulator-always-on;
139 regulator-boot-on;
140 regulator-name = "vcc_wl";
141 };
142
143 vcc_lcd: SWITCH_REG2 {
144 regulator-always-on;
145 regulator-boot-on;
146 regulator-name = "vcc_lcd";
147 };
148 };
149 };
150};
diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi b/arch/arm/boot/dts/rk3288-evb.dtsi
index 4f572093c8b4..cb83cea52fa1 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -10,6 +10,7 @@
10 * GNU General Public License for more details. 10 * GNU General Public License for more details.
11 */ 11 */
12 12
13#include <dt-bindings/pwm/pwm.h>
13#include "rk3288.dtsi" 14#include "rk3288.dtsi"
14 15
15/ { 16/ {
@@ -17,6 +18,48 @@
17 reg = <0x0 0x80000000>; 18 reg = <0x0 0x80000000>;
18 }; 19 };
19 20
21 backlight {
22 compatible = "pwm-backlight";
23 brightness-levels = <
24 0 1 2 3 4 5 6 7
25 8 9 10 11 12 13 14 15
26 16 17 18 19 20 21 22 23
27 24 25 26 27 28 29 30 31
28 32 33 34 35 36 37 38 39
29 40 41 42 43 44 45 46 47
30 48 49 50 51 52 53 54 55
31 56 57 58 59 60 61 62 63
32 64 65 66 67 68 69 70 71
33 72 73 74 75 76 77 78 79
34 80 81 82 83 84 85 86 87
35 88 89 90 91 92 93 94 95
36 96 97 98 99 100 101 102 103
37 104 105 106 107 108 109 110 111
38 112 113 114 115 116 117 118 119
39 120 121 122 123 124 125 126 127
40 128 129 130 131 132 133 134 135
41 136 137 138 139 140 141 142 143
42 144 145 146 147 148 149 150 151
43 152 153 154 155 156 157 158 159
44 160 161 162 163 164 165 166 167
45 168 169 170 171 172 173 174 175
46 176 177 178 179 180 181 182 183
47 184 185 186 187 188 189 190 191
48 192 193 194 195 196 197 198 199
49 200 201 202 203 204 205 206 207
50 208 209 210 211 212 213 214 215
51 216 217 218 219 220 221 222 223
52 224 225 226 227 228 229 230 231
53 232 233 234 235 236 237 238 239
54 240 241 242 243 244 245 246 247
55 248 249 250 251 252 253 254 255>;
56 default-brightness-level = <128>;
57 enable-gpios = <&gpio7 2 GPIO_ACTIVE_HIGH>;
58 pinctrl-names = "default";
59 pinctrl-0 = <&bl_en>;
60 pwms = <&pwm0 0 1000000 PWM_POLARITY_INVERTED>;
61 };
62
20 gpio-keys { 63 gpio-keys {
21 compatible = "gpio-keys"; 64 compatible = "gpio-keys";
22 #address-cells = <1>; 65 #address-cells = <1>;
@@ -49,6 +92,30 @@
49 }; 92 };
50}; 93};
51 94
95&emmc {
96 broken-cd;
97 bus-width = <8>;
98 cap-mmc-highspeed;
99 disable-wp;
100 non-removable;
101 num-slots = <1>;
102 pinctrl-names = "default";
103 pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>;
104 status = "okay";
105};
106
107&sdmmc {
108 bus-width = <4>;
109 cap-mmc-highspeed;
110 cap-sd-highspeed;
111 card-detect-delay = <200>;
112 disable-wp; /* wp not hooked up */
113 num-slots = <1>;
114 pinctrl-names = "default";
115 pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
116 status = "okay";
117};
118
52&i2c0 { 119&i2c0 {
53 status = "okay"; 120 status = "okay";
54}; 121};
@@ -57,6 +124,10 @@
57 status = "okay"; 124 status = "okay";
58}; 125};
59 126
127&pwm0 {
128 status = "okay";
129};
130
60&uart0 { 131&uart0 {
61 status = "okay"; 132 status = "okay";
62}; 133};
@@ -78,12 +149,24 @@
78}; 149};
79 150
80&pinctrl { 151&pinctrl {
152 backlight {
153 bl_en: bl-en {
154 rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
155 };
156 };
157
81 buttons { 158 buttons {
82 pwrbtn: pwrbtn { 159 pwrbtn: pwrbtn {
83 rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; 160 rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
84 }; 161 };
85 }; 162 };
86 163
164 pmic {
165 pmic_int: pmic-int {
166 rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
167 };
168 };
169
87 usb { 170 usb {
88 host_vbus_drv: host-vbus-drv { 171 host_vbus_drv: host-vbus-drv {
89 rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>; 172 rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
@@ -94,3 +177,7 @@
94&usb_host0_ehci { 177&usb_host0_ehci {
95 status = "okay"; 178 status = "okay";
96}; 179};
180
181&usb_host1 {
182 status = "okay";
183};
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 5950b0a53224..874e66dbb93b 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -29,11 +29,18 @@
29 i2c3 = &i2c3; 29 i2c3 = &i2c3;
30 i2c4 = &i2c4; 30 i2c4 = &i2c4;
31 i2c5 = &i2c5; 31 i2c5 = &i2c5;
32 mshc0 = &emmc;
33 mshc1 = &sdmmc;
34 mshc2 = &sdio0;
35 mshc3 = &sdio1;
32 serial0 = &uart0; 36 serial0 = &uart0;
33 serial1 = &uart1; 37 serial1 = &uart1;
34 serial2 = &uart2; 38 serial2 = &uart2;
35 serial3 = &uart3; 39 serial3 = &uart3;
36 serial4 = &uart4; 40 serial4 = &uart4;
41 spi0 = &spi0;
42 spi1 = &spi1;
43 spi2 = &spi2;
37 }; 44 };
38 45
39 cpus { 46 cpus {
@@ -62,6 +69,44 @@
62 }; 69 };
63 }; 70 };
64 71
72 amba {
73 compatible = "arm,amba-bus";
74 #address-cells = <1>;
75 #size-cells = <1>;
76 ranges;
77
78 dmac_peri: dma-controller@ff250000 {
79 compatible = "arm,pl330", "arm,primecell";
80 reg = <0xff250000 0x4000>;
81 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
82 <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
83 #dma-cells = <1>;
84 clocks = <&cru ACLK_DMAC2>;
85 clock-names = "apb_pclk";
86 };
87
88 dmac_bus_ns: dma-controller@ff600000 {
89 compatible = "arm,pl330", "arm,primecell";
90 reg = <0xff600000 0x4000>;
91 interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
92 <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
93 #dma-cells = <1>;
94 clocks = <&cru ACLK_DMAC1>;
95 clock-names = "apb_pclk";
96 status = "disabled";
97 };
98
99 dmac_bus_s: dma-controller@ffb20000 {
100 compatible = "arm,pl330", "arm,primecell";
101 reg = <0xffb20000 0x4000>;
102 interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
103 <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
104 #dma-cells = <1>;
105 clocks = <&cru ACLK_DMAC1>;
106 clock-names = "apb_pclk";
107 };
108 };
109
65 xin24m: oscillator { 110 xin24m: oscillator {
66 compatible = "fixed-clock"; 111 compatible = "fixed-clock";
67 clock-frequency = <24000000>; 112 clock-frequency = <24000000>;
@@ -78,6 +123,95 @@
78 clock-frequency = <24000000>; 123 clock-frequency = <24000000>;
79 }; 124 };
80 125
126 sdmmc: dwmmc@ff0c0000 {
127 compatible = "rockchip,rk3288-dw-mshc";
128 clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>;
129 clock-names = "biu", "ciu";
130 fifo-depth = <0x100>;
131 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
132 reg = <0xff0c0000 0x4000>;
133 status = "disabled";
134 };
135
136 sdio0: dwmmc@ff0d0000 {
137 compatible = "rockchip,rk3288-dw-mshc";
138 clocks = <&cru HCLK_SDIO0>, <&cru SCLK_SDIO0>;
139 clock-names = "biu", "ciu";
140 fifo-depth = <0x100>;
141 interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
142 reg = <0xff0d0000 0x4000>;
143 status = "disabled";
144 };
145
146 sdio1: dwmmc@ff0e0000 {
147 compatible = "rockchip,rk3288-dw-mshc";
148 clocks = <&cru HCLK_SDIO1>, <&cru SCLK_SDIO1>;
149 clock-names = "biu", "ciu";
150 fifo-depth = <0x100>;
151 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
152 reg = <0xff0e0000 0x4000>;
153 status = "disabled";
154 };
155
156 emmc: dwmmc@ff0f0000 {
157 compatible = "rockchip,rk3288-dw-mshc";
158 clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>;
159 clock-names = "biu", "ciu";
160 fifo-depth = <0x100>;
161 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
162 reg = <0xff0f0000 0x4000>;
163 status = "disabled";
164 };
165
166 saradc: saradc@ff100000 {
167 compatible = "rockchip,saradc";
168 reg = <0xff100000 0x100>;
169 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
170 #io-channel-cells = <1>;
171 clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
172 clock-names = "saradc", "apb_pclk";
173 status = "disabled";
174 };
175
176 spi0: spi@ff110000 {
177 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi";
178 clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>;
179 clock-names = "spiclk", "apb_pclk";
180 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
181 pinctrl-names = "default";
182 pinctrl-0 = <&spi0_clk &spi0_tx &spi0_rx &spi0_cs0>;
183 reg = <0xff110000 0x1000>;
184 #address-cells = <1>;
185 #size-cells = <0>;
186 status = "disabled";
187 };
188
189 spi1: spi@ff120000 {
190 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi";
191 clocks = <&cru SCLK_SPI1>, <&cru PCLK_SPI1>;
192 clock-names = "spiclk", "apb_pclk";
193 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
194 pinctrl-names = "default";
195 pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0>;
196 reg = <0xff120000 0x1000>;
197 #address-cells = <1>;
198 #size-cells = <0>;
199 status = "disabled";
200 };
201
202 spi2: spi@ff130000 {
203 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi";
204 clocks = <&cru SCLK_SPI2>, <&cru PCLK_SPI2>;
205 clock-names = "spiclk", "apb_pclk";
206 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
207 pinctrl-names = "default";
208 pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0>;
209 reg = <0xff130000 0x1000>;
210 #address-cells = <1>;
211 #size-cells = <0>;
212 status = "disabled";
213 };
214
81 i2c1: i2c@ff140000 { 215 i2c1: i2c@ff140000 {
82 compatible = "rockchip,rk3288-i2c"; 216 compatible = "rockchip,rk3288-i2c";
83 reg = <0xff140000 0x1000>; 217 reg = <0xff140000 0x1000>;
@@ -206,6 +340,26 @@
206 340
207 /* NOTE: ohci@ff520000 doesn't actually work on hardware */ 341 /* NOTE: ohci@ff520000 doesn't actually work on hardware */
208 342
343 usb_host1: usb@ff540000 {
344 compatible = "rockchip,rk3288-usb", "rockchip,rk3066-usb",
345 "snps,dwc2";
346 reg = <0xff540000 0x40000>;
347 interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
348 clocks = <&cru HCLK_USBHOST1>;
349 clock-names = "otg";
350 status = "disabled";
351 };
352
353 usb_otg: usb@ff580000 {
354 compatible = "rockchip,rk3288-usb", "rockchip,rk3066-usb",
355 "snps,dwc2";
356 reg = <0xff580000 0x40000>;
357 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
358 clocks = <&cru HCLK_OTG0>;
359 clock-names = "otg";
360 status = "disabled";
361 };
362
209 usb_hsic: usb@ff5c0000 { 363 usb_hsic: usb@ff5c0000 {
210 compatible = "generic-ehci"; 364 compatible = "generic-ehci";
211 reg = <0xff5c0000 0x100>; 365 reg = <0xff5c0000 0x100>;
@@ -241,6 +395,50 @@
241 status = "disabled"; 395 status = "disabled";
242 }; 396 };
243 397
398 pwm0: pwm@ff680000 {
399 compatible = "rockchip,rk3288-pwm";
400 reg = <0xff680000 0x10>;
401 #pwm-cells = <3>;
402 pinctrl-names = "default";
403 pinctrl-0 = <&pwm0_pin>;
404 clocks = <&cru PCLK_PWM>;
405 clock-names = "pwm";
406 status = "disabled";
407 };
408
409 pwm1: pwm@ff680010 {
410 compatible = "rockchip,rk3288-pwm";
411 reg = <0xff680010 0x10>;
412 #pwm-cells = <3>;
413 pinctrl-names = "default";
414 pinctrl-0 = <&pwm1_pin>;
415 clocks = <&cru PCLK_PWM>;
416 clock-names = "pwm";
417 status = "disabled";
418 };
419
420 pwm2: pwm@ff680020 {
421 compatible = "rockchip,rk3288-pwm";
422 reg = <0xff680020 0x10>;
423 #pwm-cells = <3>;
424 pinctrl-names = "default";
425 pinctrl-0 = <&pwm2_pin>;
426 clocks = <&cru PCLK_PWM>;
427 clock-names = "pwm";
428 status = "disabled";
429 };
430
431 pwm3: pwm@ff680030 {
432 compatible = "rockchip,rk3288-pwm";
433 reg = <0xff680030 0x10>;
434 #pwm-cells = <2>;
435 pinctrl-names = "default";
436 pinctrl-0 = <&pwm3_pin>;
437 clocks = <&cru PCLK_PWM>;
438 clock-names = "pwm";
439 status = "disabled";
440 };
441
244 pmu: power-management@ff730000 { 442 pmu: power-management@ff730000 {
245 compatible = "rockchip,rk3288-pmu", "syscon"; 443 compatible = "rockchip,rk3288-pmu", "syscon";
246 reg = <0xff730000 0x100>; 444 reg = <0xff730000 0x100>;
@@ -271,6 +469,21 @@
271 status = "disabled"; 469 status = "disabled";
272 }; 470 };
273 471
472 i2s: i2s@ff890000 {
473 compatible = "rockchip,rk3288-i2s", "rockchip,rk3066-i2s";
474 reg = <0xff890000 0x10000>;
475 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
476 #address-cells = <1>;
477 #size-cells = <0>;
478 dmas = <&dmac_bus_s 0>, <&dmac_bus_s 1>;
479 dma-names = "tx", "rx";
480 clock-names = "i2s_hclk", "i2s_clk";
481 clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
482 pinctrl-names = "default";
483 pinctrl-0 = <&i2s0_bus>;
484 status = "disabled";
485 };
486
274 gic: interrupt-controller@ffc01000 { 487 gic: interrupt-controller@ffc01000 {
275 compatible = "arm,gic-400"; 488 compatible = "arm,gic-400";
276 interrupt-controller; 489 interrupt-controller;
@@ -463,6 +676,17 @@
463 }; 676 };
464 }; 677 };
465 678
679 i2s0 {
680 i2s0_bus: i2s0-bus {
681 rockchip,pins = <6 0 RK_FUNC_1 &pcfg_pull_none>,
682 <6 1 RK_FUNC_1 &pcfg_pull_none>,
683 <6 2 RK_FUNC_1 &pcfg_pull_none>,
684 <6 3 RK_FUNC_1 &pcfg_pull_none>,
685 <6 4 RK_FUNC_1 &pcfg_pull_none>,
686 <6 8 RK_FUNC_1 &pcfg_pull_none>;
687 };
688 };
689
466 sdmmc { 690 sdmmc {
467 sdmmc_clk: sdmmc-clk { 691 sdmmc_clk: sdmmc-clk {
468 rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none>; 692 rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none>;
@@ -488,6 +712,88 @@
488 }; 712 };
489 }; 713 };
490 714
715 sdio0 {
716 sdio0_bus1: sdio0-bus1 {
717 rockchip,pins = <4 20 RK_FUNC_1 &pcfg_pull_up>;
718 };
719
720 sdio0_bus4: sdio0-bus4 {
721 rockchip,pins = <4 20 RK_FUNC_1 &pcfg_pull_up>,
722 <4 21 RK_FUNC_1 &pcfg_pull_up>,
723 <4 22 RK_FUNC_1 &pcfg_pull_up>,
724 <4 23 RK_FUNC_1 &pcfg_pull_up>;
725 };
726
727 sdio0_cmd: sdio0-cmd {
728 rockchip,pins = <4 24 RK_FUNC_1 &pcfg_pull_up>;
729 };
730
731 sdio0_clk: sdio0-clk {
732 rockchip,pins = <4 25 RK_FUNC_1 &pcfg_pull_none>;
733 };
734
735 sdio0_cd: sdio0-cd {
736 rockchip,pins = <4 26 RK_FUNC_1 &pcfg_pull_up>;
737 };
738
739 sdio0_wp: sdio0-wp {
740 rockchip,pins = <4 27 RK_FUNC_1 &pcfg_pull_up>;
741 };
742
743 sdio0_pwr: sdio0-pwr {
744 rockchip,pins = <4 28 RK_FUNC_1 &pcfg_pull_up>;
745 };
746
747 sdio0_bkpwr: sdio0-bkpwr {
748 rockchip,pins = <4 29 RK_FUNC_1 &pcfg_pull_up>;
749 };
750
751 sdio0_int: sdio0-int {
752 rockchip,pins = <4 30 RK_FUNC_1 &pcfg_pull_up>;
753 };
754 };
755
756 sdio1 {
757 sdio1_bus1: sdio1-bus1 {
758 rockchip,pins = <3 24 4 &pcfg_pull_up>;
759 };
760
761 sdio1_bus4: sdio1-bus4 {
762 rockchip,pins = <3 24 4 &pcfg_pull_up>,
763 <3 25 4 &pcfg_pull_up>,
764 <3 26 4 &pcfg_pull_up>,
765 <3 27 4 &pcfg_pull_up>;
766 };
767
768 sdio1_cd: sdio1-cd {
769 rockchip,pins = <3 28 4 &pcfg_pull_up>;
770 };
771
772 sdio1_wp: sdio1-wp {
773 rockchip,pins = <3 29 4 &pcfg_pull_up>;
774 };
775
776 sdio1_bkpwr: sdio1-bkpwr {
777 rockchip,pins = <3 30 4 &pcfg_pull_up>;
778 };
779
780 sdio1_int: sdio1-int {
781 rockchip,pins = <3 31 4 &pcfg_pull_up>;
782 };
783
784 sdio1_cmd: sdio1-cmd {
785 rockchip,pins = <4 6 4 &pcfg_pull_up>;
786 };
787
788 sdio1_clk: sdio1-clk {
789 rockchip,pins = <4 7 4 &pcfg_pull_none>;
790 };
791
792 sdio1_pwr: sdio1-pwr {
793 rockchip,pins = <4 9 4 &pcfg_pull_up>;
794 };
795 };
796
491 emmc { 797 emmc {
492 emmc_clk: emmc-clk { 798 emmc_clk: emmc-clk {
493 rockchip,pins = <3 18 RK_FUNC_2 &pcfg_pull_none>; 799 rockchip,pins = <3 18 RK_FUNC_2 &pcfg_pull_none>;
@@ -524,6 +830,56 @@
524 }; 830 };
525 }; 831 };
526 832
833 spi0 {
834 spi0_clk: spi0-clk {
835 rockchip,pins = <5 12 RK_FUNC_1 &pcfg_pull_up>;
836 };
837 spi0_cs0: spi0-cs0 {
838 rockchip,pins = <5 13 RK_FUNC_1 &pcfg_pull_up>;
839 };
840 spi0_tx: spi0-tx {
841 rockchip,pins = <5 14 RK_FUNC_1 &pcfg_pull_up>;
842 };
843 spi0_rx: spi0-rx {
844 rockchip,pins = <5 15 RK_FUNC_1 &pcfg_pull_up>;
845 };
846 spi0_cs1: spi0-cs1 {
847 rockchip,pins = <5 16 RK_FUNC_1 &pcfg_pull_up>;
848 };
849 };
850 spi1 {
851 spi1_clk: spi1-clk {
852 rockchip,pins = <7 12 RK_FUNC_2 &pcfg_pull_up>;
853 };
854 spi1_cs0: spi1-cs0 {
855 rockchip,pins = <7 13 RK_FUNC_2 &pcfg_pull_up>;
856 };
857 spi1_rx: spi1-rx {
858 rockchip,pins = <7 14 RK_FUNC_2 &pcfg_pull_up>;
859 };
860 spi1_tx: spi1-tx {
861 rockchip,pins = <7 15 RK_FUNC_2 &pcfg_pull_up>;
862 };
863 };
864
865 spi2 {
866 spi2_cs1: spi2-cs1 {
867 rockchip,pins = <8 3 RK_FUNC_1 &pcfg_pull_up>;
868 };
869 spi2_clk: spi2-clk {
870 rockchip,pins = <8 6 RK_FUNC_1 &pcfg_pull_up>;
871 };
872 spi2_cs0: spi2-cs0 {
873 rockchip,pins = <8 7 RK_FUNC_1 &pcfg_pull_up>;
874 };
875 spi2_rx: spi2-rx {
876 rockchip,pins = <8 8 RK_FUNC_1 &pcfg_pull_up>;
877 };
878 spi2_tx: spi2-tx {
879 rockchip,pins = <8 9 RK_FUNC_1 &pcfg_pull_up>;
880 };
881 };
882
527 uart0 { 883 uart0 {
528 uart0_xfer: uart0-xfer { 884 uart0_xfer: uart0-xfer {
529 rockchip,pins = <4 16 RK_FUNC_1 &pcfg_pull_up>, 885 rockchip,pins = <4 16 RK_FUNC_1 &pcfg_pull_up>,
@@ -591,5 +947,29 @@
591 rockchip,pins = <5 15 3 &pcfg_pull_none>; 947 rockchip,pins = <5 15 3 &pcfg_pull_none>;
592 }; 948 };
593 }; 949 };
950
951 pwm0 {
952 pwm0_pin: pwm0-pin {
953 rockchip,pins = <7 0 RK_FUNC_1 &pcfg_pull_none>;
954 };
955 };
956
957 pwm1 {
958 pwm1_pin: pwm1-pin {
959 rockchip,pins = <7 1 RK_FUNC_1 &pcfg_pull_none>;
960 };
961 };
962
963 pwm2 {
964 pwm2_pin: pwm2-pin {
965 rockchip,pins = <7 22 3 &pcfg_pull_none>;
966 };
967 };
968
969 pwm3 {
970 pwm3_pin: pwm3-pin {
971 rockchip,pins = <7 23 3 &pcfg_pull_none>;
972 };
973 };
594 }; 974 };
595}; 975};
diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
index 8caf85d83901..499468d42ada 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -26,6 +26,49 @@
26 i2c2 = &i2c2; 26 i2c2 = &i2c2;
27 i2c3 = &i2c3; 27 i2c3 = &i2c3;
28 i2c4 = &i2c4; 28 i2c4 = &i2c4;
29 mshc0 = &emmc;
30 mshc1 = &mmc0;
31 mshc2 = &mmc1;
32 spi0 = &spi0;
33 spi1 = &spi1;
34 };
35
36 amba {
37 compatible = "arm,amba-bus";
38 #address-cells = <1>;
39 #size-cells = <1>;
40 ranges;
41
42 dmac1_s: dma-controller@20018000 {
43 compatible = "arm,pl330", "arm,primecell";
44 reg = <0x20018000 0x4000>;
45 interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
46 <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
47 #dma-cells = <1>;
48 clocks = <&cru ACLK_DMA1>;
49 clock-names = "apb_pclk";
50 };
51
52 dmac1_ns: dma-controller@2001c000 {
53 compatible = "arm,pl330", "arm,primecell";
54 reg = <0x2001c000 0x4000>;
55 interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
56 <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
57 #dma-cells = <1>;
58 clocks = <&cru ACLK_DMA1>;
59 clock-names = "apb_pclk";
60 status = "disabled";
61 };
62
63 dmac2: dma-controller@20078000 {
64 compatible = "arm,pl330", "arm,primecell";
65 reg = <0x20078000 0x4000>;
66 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
67 <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
68 #dma-cells = <1>;
69 clocks = <&cru ACLK_DMA2>;
70 clock-names = "apb_pclk";
71 };
29 }; 72 };
30 73
31 xin24m: oscillator { 74 xin24m: oscillator {
@@ -91,12 +134,45 @@
91 status = "disabled"; 134 status = "disabled";
92 }; 135 };
93 136
137 usb_otg: usb@10180000 {
138 compatible = "rockchip,rk3066-usb", "snps,dwc2";
139 reg = <0x10180000 0x40000>;
140 interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
141 clocks = <&cru HCLK_OTG0>;
142 clock-names = "otg";
143 status = "disabled";
144 };
145
146 usb_host: usb@101c0000 {
147 compatible = "snps,dwc2";
148 reg = <0x101c0000 0x40000>;
149 interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
150 clocks = <&cru HCLK_OTG1>;
151 clock-names = "otg";
152 status = "disabled";
153 };
154
155 emac: ethernet@10204000 {
156 compatible = "snps,arc-emac";
157 reg = <0x10204000 0x3c>;
158 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
159 #address-cells = <1>;
160 #size-cells = <0>;
161
162 rockchip,grf = <&grf>;
163
164 clocks = <&cru HCLK_EMAC>, <&cru SCLK_MAC>;
165 clock-names = "hclk", "macref";
166 max-speed = <100>;
167 phy-mode = "rmii";
168
169 status = "disabled";
170 };
171
94 mmc0: dwmmc@10214000 { 172 mmc0: dwmmc@10214000 {
95 compatible = "rockchip,rk2928-dw-mshc"; 173 compatible = "rockchip,rk2928-dw-mshc";
96 reg = <0x10214000 0x1000>; 174 reg = <0x10214000 0x1000>;
97 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; 175 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
98 #address-cells = <1>;
99 #size-cells = <0>;
100 176
101 clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>; 177 clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>;
102 clock-names = "biu", "ciu"; 178 clock-names = "biu", "ciu";
@@ -108,8 +184,6 @@
108 compatible = "rockchip,rk2928-dw-mshc"; 184 compatible = "rockchip,rk2928-dw-mshc";
109 reg = <0x10218000 0x1000>; 185 reg = <0x10218000 0x1000>;
110 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; 186 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
111 #address-cells = <1>;
112 #size-cells = <0>;
113 187
114 clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>; 188 clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>;
115 clock-names = "biu", "ciu"; 189 clock-names = "biu", "ciu";
@@ -117,6 +191,17 @@
117 status = "disabled"; 191 status = "disabled";
118 }; 192 };
119 193
194 emmc: dwmmc@1021c000 {
195 compatible = "rockchip,rk2928-dw-mshc";
196 reg = <0x1021c000 0x1000>;
197 interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
198
199 clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>;
200 clock-names = "biu", "ciu";
201
202 status = "disabled";
203 };
204
120 pmu: pmu@20004000 { 205 pmu: pmu@20004000 {
121 compatible = "rockchip,rk3066-pmu", "syscon"; 206 compatible = "rockchip,rk3066-pmu", "syscon";
122 reg = <0x20004000 0x100>; 207 reg = <0x20004000 0x100>;
@@ -135,7 +220,6 @@
135 #size-cells = <0>; 220 #size-cells = <0>;
136 221
137 rockchip,grf = <&grf>; 222 rockchip,grf = <&grf>;
138 rockchip,bus-index = <0>;
139 223
140 clock-names = "i2c"; 224 clock-names = "i2c";
141 clocks = <&cru PCLK_I2C0>; 225 clocks = <&cru PCLK_I2C0>;
@@ -264,4 +348,36 @@
264 clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>; 348 clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>;
265 status = "disabled"; 349 status = "disabled";
266 }; 350 };
351
352 saradc: saradc@2006c000 {
353 compatible = "rockchip,saradc";
354 reg = <0x2006c000 0x100>;
355 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
356 #io-channel-cells = <1>;
357 clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
358 clock-names = "saradc", "apb_pclk";
359 status = "disabled";
360 };
361
362 spi0: spi@20070000 {
363 compatible = "rockchip,rk3066-spi";
364 clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>;
365 clock-names = "spiclk", "apb_pclk";
366 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
367 reg = <0x20070000 0x1000>;
368 #address-cells = <1>;
369 #size-cells = <0>;
370 status = "disabled";
371 };
372
373 spi1: spi@20074000 {
374 compatible = "rockchip,rk3066-spi";
375 clocks = <&cru SCLK_SPI1>, <&cru PCLK_SPI1>;
376 clock-names = "spiclk", "apb_pclk";
377 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
378 reg = <0x20074000 0x1000>;
379 #address-cells = <1>;
380 #size-cells = <0>;
381 status = "disabled";
382 };
267}; 383};
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 45013b867c8d..5f4144d1e3a1 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -177,6 +177,9 @@
177 compatible = "atmel,at91sam9260-usart"; 177 compatible = "atmel,at91sam9260-usart";
178 reg = <0xf001c000 0x100>; 178 reg = <0xf001c000 0x100>;
179 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; 179 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
180 dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
181 <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
182 dma-names = "tx", "rx";
180 pinctrl-names = "default"; 183 pinctrl-names = "default";
181 pinctrl-0 = <&pinctrl_usart0>; 184 pinctrl-0 = <&pinctrl_usart0>;
182 clocks = <&usart0_clk>; 185 clocks = <&usart0_clk>;
@@ -188,6 +191,9 @@
188 compatible = "atmel,at91sam9260-usart"; 191 compatible = "atmel,at91sam9260-usart";
189 reg = <0xf0020000 0x100>; 192 reg = <0xf0020000 0x100>;
190 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>; 193 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>;
194 dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(5)>,
195 <&dma0 2 (AT91_DMA_CFG_PER_ID(6) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
196 dma-names = "tx", "rx";
191 pinctrl-names = "default"; 197 pinctrl-names = "default";
192 pinctrl-0 = <&pinctrl_usart1>; 198 pinctrl-0 = <&pinctrl_usart1>;
193 clocks = <&usart1_clk>; 199 clocks = <&usart1_clk>;
@@ -333,6 +339,9 @@
333 compatible = "atmel,at91sam9260-usart"; 339 compatible = "atmel,at91sam9260-usart";
334 reg = <0xf8020000 0x100>; 340 reg = <0xf8020000 0x100>;
335 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>; 341 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
342 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(7)>,
343 <&dma1 2 (AT91_DMA_CFG_PER_ID(8) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
344 dma-names = "tx", "rx";
336 pinctrl-names = "default"; 345 pinctrl-names = "default";
337 pinctrl-0 = <&pinctrl_usart2>; 346 pinctrl-0 = <&pinctrl_usart2>;
338 clocks = <&usart2_clk>; 347 clocks = <&usart2_clk>;
@@ -344,6 +353,9 @@
344 compatible = "atmel,at91sam9260-usart"; 353 compatible = "atmel,at91sam9260-usart";
345 reg = <0xf8024000 0x100>; 354 reg = <0xf8024000 0x100>;
346 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>; 355 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>;
356 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(9)>,
357 <&dma1 2 (AT91_DMA_CFG_PER_ID(10) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
358 dma-names = "tx", "rx";
347 pinctrl-names = "default"; 359 pinctrl-names = "default";
348 pinctrl-0 = <&pinctrl_usart3>; 360 pinctrl-0 = <&pinctrl_usart3>;
349 clocks = <&usart3_clk>; 361 clocks = <&usart3_clk>;
@@ -402,14 +414,19 @@
402 }; 414 };
403 415
404 ramc0: ramc@ffffea00 { 416 ramc0: ramc@ffffea00 {
405 compatible = "atmel,at91sam9g45-ddramc"; 417 compatible = "atmel,sama5d3-ddramc";
406 reg = <0xffffea00 0x200>; 418 reg = <0xffffea00 0x200>;
419 clocks = <&ddrck>, <&mpddr_clk>;
420 clock-names = "ddrck", "mpddr";
407 }; 421 };
408 422
409 dbgu: serial@ffffee00 { 423 dbgu: serial@ffffee00 {
410 compatible = "atmel,at91sam9260-usart"; 424 compatible = "atmel,at91sam9260-usart";
411 reg = <0xffffee00 0x200>; 425 reg = <0xffffee00 0x200>;
412 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>; 426 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>;
427 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(13)>,
428 <&dma1 2 (AT91_DMA_CFG_PER_ID(14) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
429 dma-names = "tx", "rx";
413 pinctrl-names = "default"; 430 pinctrl-names = "default";
414 pinctrl-0 = <&pinctrl_dbgu>; 431 pinctrl-0 = <&pinctrl_dbgu>;
415 clocks = <&dbgu_clk>; 432 clocks = <&dbgu_clk>;
@@ -428,7 +445,7 @@
428 pinctrl@fffff200 { 445 pinctrl@fffff200 {
429 #address-cells = <1>; 446 #address-cells = <1>;
430 #size-cells = <1>; 447 #size-cells = <1>;
431 compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus"; 448 compatible = "atmel,sama5d3-pinctrl", "atmel,at91sam9x5-pinctrl", "simple-bus";
432 ranges = <0xfffff200 0xfffff200 0xa00>; 449 ranges = <0xfffff200 0xfffff200 0xa00>;
433 atmel,mux-mask = < 450 atmel,mux-mask = <
434 /* A B C */ 451 /* A B C */
@@ -1003,6 +1020,11 @@
1003 reg = <2>; 1020 reg = <2>;
1004 }; 1021 };
1005 1022
1023 hsmc_clk: hsmc_clk {
1024 #clock-cells = <0>;
1025 reg = <5>;
1026 };
1027
1006 pioA_clk: pioA_clk { 1028 pioA_clk: pioA_clk {
1007 #clock-cells = <0>; 1029 #clock-cells = <0>;
1008 reg = <6>; 1030 reg = <6>;
@@ -1170,6 +1192,11 @@
1170 #clock-cells = <0>; 1192 #clock-cells = <0>;
1171 reg = <48>; 1193 reg = <48>;
1172 }; 1194 };
1195
1196 mpddr_clk: mpddr_clk {
1197 #clock-cells = <0>;
1198 reg = <49>;
1199 };
1173 }; 1200 };
1174 }; 1201 };
1175 1202
@@ -1178,6 +1205,11 @@
1178 reg = <0xfffffe00 0x10>; 1205 reg = <0xfffffe00 0x10>;
1179 }; 1206 };
1180 1207
1208 shutdown-controller@fffffe10 {
1209 compatible = "atmel,at91sam9x5-shdwc";
1210 reg = <0xfffffe10 0x10>;
1211 };
1212
1181 pit: timer@fffffe30 { 1213 pit: timer@fffffe30 {
1182 compatible = "atmel,at91sam9260-pit"; 1214 compatible = "atmel,at91sam9260-pit";
1183 reg = <0xfffffe30 0xf>; 1215 reg = <0xfffffe30 0xf>;
@@ -1393,6 +1425,7 @@
1393 0xffffc000 0x00000070 /* NFC HSMC regs */ 1425 0xffffc000 0x00000070 /* NFC HSMC regs */
1394 0x00200000 0x00100000 /* NFC SRAM banks */ 1426 0x00200000 0x00100000 /* NFC SRAM banks */
1395 >; 1427 >;
1428 clocks = <&hsmc_clk>;
1396 }; 1429 };
1397 }; 1430 };
1398 }; 1431 };
diff --git a/arch/arm/boot/dts/sama5d3_can.dtsi b/arch/arm/boot/dts/sama5d3_can.dtsi
index a0775851cce5..eaf41451ad0c 100644
--- a/arch/arm/boot/dts/sama5d3_can.dtsi
+++ b/arch/arm/boot/dts/sama5d3_can.dtsi
@@ -40,7 +40,7 @@
40 atmel,clk-output-range = <0 66000000>; 40 atmel,clk-output-range = <0 66000000>;
41 }; 41 };
42 42
43 can1_clk: can0_clk { 43 can1_clk: can1_clk {
44 #clock-cells = <0>; 44 #clock-cells = <0>;
45 reg = <41>; 45 reg = <41>;
46 atmel,clk-output-range = <0 66000000>; 46 atmel,clk-output-range = <0 66000000>;
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi
index f7d8583eef82..962dc28dc37b 100644
--- a/arch/arm/boot/dts/sama5d3xcm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xcm.dtsi
@@ -36,6 +36,36 @@
36 36
37 macb0: ethernet@f0028000 { 37 macb0: ethernet@f0028000 {
38 phy-mode = "rgmii"; 38 phy-mode = "rgmii";
39 #address-cells = <1>;
40 #size-cells = <0>;
41
42 ethernet-phy@1 {
43 reg = <0x1>;
44 interrupt-parent = <&pioB>;
45 interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
46 txen-skew-ps = <800>;
47 txc-skew-ps = <3000>;
48 rxdv-skew-ps = <400>;
49 rxc-skew-ps = <3000>;
50 rxd0-skew-ps = <400>;
51 rxd1-skew-ps = <400>;
52 rxd2-skew-ps = <400>;
53 rxd3-skew-ps = <400>;
54 };
55
56 ethernet-phy@7 {
57 reg = <0x7>;
58 interrupt-parent = <&pioB>;
59 interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
60 txen-skew-ps = <800>;
61 txc-skew-ps = <3000>;
62 rxdv-skew-ps = <400>;
63 rxc-skew-ps = <3000>;
64 rxd0-skew-ps = <400>;
65 rxd1-skew-ps = <400>;
66 rxd2-skew-ps = <400>;
67 rxd3-skew-ps = <400>;
68 };
39 }; 69 };
40 70
41 pmc: pmc@fffffc00 { 71 pmc: pmc@fffffc00 {
diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi
index b8c6f20e780c..49c10d33df30 100644
--- a/arch/arm/boot/dts/sama5d3xmb.dtsi
+++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
@@ -25,6 +25,8 @@
25 }; 25 };
26 26
27 spi0: spi@f0004000 { 27 spi0: spi@f0004000 {
28 dmas = <0>, <0>; /* Do not use DMA for spi0 */
29
28 m25p80@0 { 30 m25p80@0 {
29 compatible = "atmel,at25df321a"; 31 compatible = "atmel,at25df321a";
30 spi-max-frequency = <50000000>; 32 spi-max-frequency = <50000000>;
@@ -51,6 +53,7 @@
51 }; 53 };
52 54
53 usart1: serial@f0020000 { 55 usart1: serial@f0020000 {
56 dmas = <0>, <0>; /* Do not use DMA for usart1 */
54 pinctrl-names = "default"; 57 pinctrl-names = "default";
55 pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts_cts>; 58 pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts_cts>;
56 status = "okay"; 59 status = "okay";
@@ -132,6 +135,7 @@
132 }; 135 };
133 136
134 dbgu: serial@ffffee00 { 137 dbgu: serial@ffffee00 {
138 dmas = <0>, <0>; /* Do not use DMA for dbgu */
135 status = "okay"; 139 status = "okay";
136 }; 140 };
137 141
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
new file mode 100644
index 000000000000..e0157b0f075c
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -0,0 +1,1240 @@
1/*
2 * sama5d4.dtsi - Device Tree Include file for SAMA5D4 family SoC
3 *
4 * Copyright (C) 2014 Atmel,
5 * 2014 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * This file is dual-licensed: you can use it either under the terms
8 * of the GPL or the X11 license, at your option. Note that this dual
9 * licensing only applies to this file, and not this project as a
10 * whole.
11 *
12 * a) This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * Or, alternatively,
23 *
24 * b) Permission is hereby granted, free of charge, to any person
25 * obtaining a copy of this software and associated documentation
26 * files (the "Software"), to deal in the Software without
27 * restriction, including without limitation the rights to use,
28 * copy, modify, merge, publish, distribute, sublicense, and/or
29 * sell copies of the Software, and to permit persons to whom the
30 * Software is furnished to do so, subject to the following
31 * conditions:
32 *
33 * The above copyright notice and this permission notice shall be
34 * included in all copies or substantial portions of the Software.
35 *
36 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43 * OTHER DEALINGS IN THE SOFTWARE.
44 */
45
46#include "skeleton.dtsi"
47#include <dt-bindings/clock/at91.h>
48#include <dt-bindings/pinctrl/at91.h>
49#include <dt-bindings/interrupt-controller/irq.h>
50#include <dt-bindings/gpio/gpio.h>
51
52/ {
53 model = "Atmel SAMA5D4 family SoC";
54 compatible = "atmel,sama5d4";
55 interrupt-parent = <&aic>;
56
57 aliases {
58 serial0 = &usart3;
59 serial1 = &usart4;
60 serial2 = &usart2;
61 gpio0 = &pioA;
62 gpio1 = &pioB;
63 gpio2 = &pioC;
64 gpio4 = &pioE;
65 tcb0 = &tcb0;
66 tcb1 = &tcb1;
67 i2c2 = &i2c2;
68 };
69 cpus {
70 #address-cells = <1>;
71 #size-cells = <0>;
72
73 cpu@0 {
74 device_type = "cpu";
75 compatible = "arm,cortex-a5";
76 reg = <0>;
77 next-level-cache = <&L2>;
78 };
79 };
80
81 memory {
82 reg = <0x20000000 0x20000000>;
83 };
84
85 clocks {
86 slow_xtal: slow_xtal {
87 compatible = "fixed-clock";
88 #clock-cells = <0>;
89 clock-frequency = <0>;
90 };
91
92 main_xtal: main_xtal {
93 compatible = "fixed-clock";
94 #clock-cells = <0>;
95 clock-frequency = <0>;
96 };
97
98 adc_op_clk: adc_op_clk{
99 compatible = "fixed-clock";
100 #clock-cells = <0>;
101 clock-frequency = <1000000>;
102 };
103 };
104
105 ahb {
106 compatible = "simple-bus";
107 #address-cells = <1>;
108 #size-cells = <1>;
109 ranges;
110
111 usb0: gadget@00400000 {
112 #address-cells = <1>;
113 #size-cells = <0>;
114 compatible = "atmel,at91sam9rl-udc";
115 reg = <0x00400000 0x100000
116 0xfc02c000 0x4000>;
117 interrupts = <47 IRQ_TYPE_LEVEL_HIGH 2>;
118 clocks = <&udphs_clk>, <&utmi>;
119 clock-names = "pclk", "hclk";
120 status = "disabled";
121
122 ep0 {
123 reg = <0>;
124 atmel,fifo-size = <64>;
125 atmel,nb-banks = <1>;
126 };
127
128 ep1 {
129 reg = <1>;
130 atmel,fifo-size = <1024>;
131 atmel,nb-banks = <3>;
132 atmel,can-dma;
133 atmel,can-isoc;
134 };
135
136 ep2 {
137 reg = <2>;
138 atmel,fifo-size = <1024>;
139 atmel,nb-banks = <3>;
140 atmel,can-dma;
141 atmel,can-isoc;
142 };
143
144 ep3 {
145 reg = <3>;
146 atmel,fifo-size = <1024>;
147 atmel,nb-banks = <2>;
148 atmel,can-dma;
149 atmel,can-isoc;
150 };
151
152 ep4 {
153 reg = <4>;
154 atmel,fifo-size = <1024>;
155 atmel,nb-banks = <2>;
156 atmel,can-dma;
157 atmel,can-isoc;
158 };
159
160 ep5 {
161 reg = <5>;
162 atmel,fifo-size = <1024>;
163 atmel,nb-banks = <2>;
164 atmel,can-dma;
165 atmel,can-isoc;
166 };
167
168 ep6 {
169 reg = <6>;
170 atmel,fifo-size = <1024>;
171 atmel,nb-banks = <2>;
172 atmel,can-dma;
173 atmel,can-isoc;
174 };
175
176 ep7 {
177 reg = <7>;
178 atmel,fifo-size = <1024>;
179 atmel,nb-banks = <2>;
180 atmel,can-dma;
181 atmel,can-isoc;
182 };
183
184 ep8 {
185 reg = <8>;
186 atmel,fifo-size = <1024>;
187 atmel,nb-banks = <2>;
188 atmel,can-isoc;
189 };
190
191 ep9 {
192 reg = <9>;
193 atmel,fifo-size = <1024>;
194 atmel,nb-banks = <2>;
195 atmel,can-isoc;
196 };
197
198 ep10 {
199 reg = <10>;
200 atmel,fifo-size = <1024>;
201 atmel,nb-banks = <2>;
202 atmel,can-isoc;
203 };
204
205 ep11 {
206 reg = <11>;
207 atmel,fifo-size = <1024>;
208 atmel,nb-banks = <2>;
209 atmel,can-isoc;
210 };
211
212 ep12 {
213 reg = <12>;
214 atmel,fifo-size = <1024>;
215 atmel,nb-banks = <2>;
216 atmel,can-isoc;
217 };
218
219 ep13 {
220 reg = <13>;
221 atmel,fifo-size = <1024>;
222 atmel,nb-banks = <2>;
223 atmel,can-isoc;
224 };
225
226 ep14 {
227 reg = <14>;
228 atmel,fifo-size = <1024>;
229 atmel,nb-banks = <2>;
230 atmel,can-isoc;
231 };
232
233 ep15 {
234 reg = <15>;
235 atmel,fifo-size = <1024>;
236 atmel,nb-banks = <2>;
237 atmel,can-isoc;
238 };
239 };
240
241 usb1: ohci@00500000 {
242 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
243 reg = <0x00500000 0x100000>;
244 interrupts = <46 IRQ_TYPE_LEVEL_HIGH 2>;
245 clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>,
246 <&uhpck>;
247 clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck";
248 status = "disabled";
249 };
250
251 usb2: ehci@00600000 {
252 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
253 reg = <0x00600000 0x100000>;
254 interrupts = <46 IRQ_TYPE_LEVEL_HIGH 2>;
255 clocks = <&usb>, <&uhphs_clk>, <&uhpck>;
256 clock-names = "usb_clk", "ehci_clk", "uhpck";
257 status = "disabled";
258 };
259
260 L2: cache-controller@00a00000 {
261 compatible = "arm,pl310-cache";
262 reg = <0x00a00000 0x1000>;
263 interrupts = <67 IRQ_TYPE_LEVEL_HIGH 4>;
264 cache-unified;
265 cache-level = <2>;
266 };
267
268 nand0: nand@80000000 {
269 compatible = "atmel,at91rm9200-nand";
270 #address-cells = <1>;
271 #size-cells = <1>;
272 ranges;
273 reg = < 0x80000000 0x08000000 /* EBI CS3 */
274 0xfc05c070 0x00000490 /* SMC PMECC regs */
275 0xfc05c500 0x00000100 /* SMC PMECC Error Location regs */
276 >;
277 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 6>;
278 atmel,nand-addr-offset = <21>;
279 atmel,nand-cmd-offset = <22>;
280 atmel,nand-has-dma;
281 pinctrl-names = "default";
282 pinctrl-0 = <&pinctrl_nand>;
283 status = "disabled";
284
285 nfc@90000000 {
286 compatible = "atmel,sama5d3-nfc";
287 #address-cells = <1>;
288 #size-cells = <1>;
289 reg = <
290 0x90000000 0x10000000 /* NFC Command Registers */
291 0xfc05c000 0x00000070 /* NFC HSMC regs */
292 0x00100000 0x00100000 /* NFC SRAM banks */
293 >;
294 clocks = <&hsmc_clk>;
295 atmel,write-by-sram;
296 };
297 };
298
299 apb {
300 compatible = "simple-bus";
301 #address-cells = <1>;
302 #size-cells = <1>;
303 ranges;
304
305 ramc0: ramc@f0010000 {
306 compatible = "atmel,sama5d3-ddramc";
307 reg = <0xf0010000 0x200>;
308 clocks = <&ddrck>, <&mpddr_clk>;
309 clock-names = "ddrck", "mpddr";
310 };
311
312 pmc: pmc@f0018000 {
313 compatible = "atmel,sama5d3-pmc";
314 reg = <0xf0018000 0x120>;
315 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
316 interrupt-controller;
317 #address-cells = <1>;
318 #size-cells = <0>;
319 #interrupt-cells = <1>;
320
321 main_rc_osc: main_rc_osc {
322 compatible = "atmel,at91sam9x5-clk-main-rc-osc";
323 #clock-cells = <0>;
324 interrupt-parent = <&pmc>;
325 interrupts = <AT91_PMC_MOSCRCS>;
326 clock-frequency = <12000000>;
327 clock-accuracy = <100000000>;
328 };
329
330 main_osc: main_osc {
331 compatible = "atmel,at91rm9200-clk-main-osc";
332 #clock-cells = <0>;
333 interrupt-parent = <&pmc>;
334 interrupts = <AT91_PMC_MOSCS>;
335 clocks = <&main_xtal>;
336 };
337
338 main: mainck {
339 compatible = "atmel,at91sam9x5-clk-main";
340 #clock-cells = <0>;
341 interrupt-parent = <&pmc>;
342 interrupts = <AT91_PMC_MOSCSELS>;
343 clocks = <&main_rc_osc &main_osc>;
344 };
345
346 plla: pllack {
347 compatible = "atmel,sama5d3-clk-pll";
348 #clock-cells = <0>;
349 interrupt-parent = <&pmc>;
350 interrupts = <AT91_PMC_LOCKA>;
351 clocks = <&main>;
352 reg = <0>;
353 atmel,clk-input-range = <12000000 12000000>;
354 #atmel,pll-clk-output-range-cells = <4>;
355 atmel,pll-clk-output-ranges = <600000000 1200000000 0 0>;
356 };
357
358 plladiv: plladivck {
359 compatible = "atmel,at91sam9x5-clk-plldiv";
360 #clock-cells = <0>;
361 clocks = <&plla>;
362 };
363
364 utmi: utmick {
365 compatible = "atmel,at91sam9x5-clk-utmi";
366 #clock-cells = <0>;
367 interrupt-parent = <&pmc>;
368 interrupts = <AT91_PMC_LOCKU>;
369 clocks = <&main>;
370 };
371
372 mck: masterck {
373 compatible = "atmel,at91sam9x5-clk-master";
374 #clock-cells = <0>;
375 interrupt-parent = <&pmc>;
376 interrupts = <AT91_PMC_MCKRDY>;
377 clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>;
378 atmel,clk-output-range = <125000000 177000000>;
379 atmel,clk-divisors = <1 2 4 3>;
380 };
381
382 h32ck: h32mxck {
383 #clock-cells = <0>;
384 compatible = "atmel,sama5d4-clk-h32mx";
385 clocks = <&mck>;
386 };
387
388 usb: usbck {
389 compatible = "atmel,at91sam9x5-clk-usb";
390 #clock-cells = <0>;
391 clocks = <&plladiv>, <&utmi>;
392 };
393
394 prog: progck {
395 compatible = "atmel,at91sam9x5-clk-programmable";
396 #address-cells = <1>;
397 #size-cells = <0>;
398 interrupt-parent = <&pmc>;
399 clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>;
400
401 prog0: prog0 {
402 #clock-cells = <0>;
403 reg = <0>;
404 interrupts = <AT91_PMC_PCKRDY(0)>;
405 };
406
407 prog1: prog1 {
408 #clock-cells = <0>;
409 reg = <1>;
410 interrupts = <AT91_PMC_PCKRDY(1)>;
411 };
412
413 prog2: prog2 {
414 #clock-cells = <0>;
415 reg = <2>;
416 interrupts = <AT91_PMC_PCKRDY(2)>;
417 };
418 };
419
420 smd: smdclk {
421 compatible = "atmel,at91sam9x5-clk-smd";
422 #clock-cells = <0>;
423 clocks = <&plladiv>, <&utmi>;
424 };
425
426 systemck {
427 compatible = "atmel,at91rm9200-clk-system";
428 #address-cells = <1>;
429 #size-cells = <0>;
430
431 ddrck: ddrck {
432 #clock-cells = <0>;
433 reg = <2>;
434 clocks = <&mck>;
435 };
436
437 lcdck: lcdck {
438 #clock-cells = <0>;
439 reg = <4>;
440 clocks = <&smd>;
441 };
442
443 smdck: smdck {
444 #clock-cells = <0>;
445 reg = <4>;
446 clocks = <&smd>;
447 };
448
449 uhpck: uhpck {
450 #clock-cells = <0>;
451 reg = <6>;
452 clocks = <&usb>;
453 };
454
455 udpck: udpck {
456 #clock-cells = <0>;
457 reg = <7>;
458 clocks = <&usb>;
459 };
460
461 pck0: pck0 {
462 #clock-cells = <0>;
463 reg = <8>;
464 clocks = <&prog0>;
465 };
466
467 pck1: pck1 {
468 #clock-cells = <0>;
469 reg = <9>;
470 clocks = <&prog1>;
471 };
472
473 pck2: pck2 {
474 #clock-cells = <0>;
475 reg = <10>;
476 clocks = <&prog2>;
477 };
478 };
479
480 periph32ck {
481 compatible = "atmel,at91sam9x5-clk-peripheral";
482 #address-cells = <1>;
483 #size-cells = <0>;
484 clocks = <&h32ck>;
485
486 pioD_clk: pioD_clk {
487 #clock-cells = <0>;
488 reg = <5>;
489 };
490
491 usart0_clk: usart0_clk {
492 #clock-cells = <0>;
493 reg = <6>;
494 };
495
496 usart1_clk: usart1_clk {
497 #clock-cells = <0>;
498 reg = <7>;
499 };
500
501 icm_clk: icm_clk {
502 #clock-cells = <0>;
503 reg = <9>;
504 };
505
506 aes_clk: aes_clk {
507 #clock-cells = <0>;
508 reg = <12>;
509 };
510
511 tdes_clk: tdes_clk {
512 #clock-cells = <0>;
513 reg = <14>;
514 };
515
516 sha_clk: sha_clk {
517 #clock-cells = <0>;
518 reg = <15>;
519 };
520
521 matrix1_clk: matrix1_clk {
522 #clock-cells = <0>;
523 reg = <17>;
524 };
525
526 hsmc_clk: hsmc_clk {
527 #clock-cells = <0>;
528 reg = <22>;
529 };
530
531 pioA_clk: pioA_clk {
532 #clock-cells = <0>;
533 reg = <23>;
534 };
535
536 pioB_clk: pioB_clk {
537 #clock-cells = <0>;
538 reg = <24>;
539 };
540
541 pioC_clk: pioC_clk {
542 #clock-cells = <0>;
543 reg = <25>;
544 };
545
546 pioE_clk: pioE_clk {
547 #clock-cells = <0>;
548 reg = <26>;
549 };
550
551 uart0_clk: uart0_clk {
552 #clock-cells = <0>;
553 reg = <27>;
554 };
555
556 uart1_clk: uart1_clk {
557 #clock-cells = <0>;
558 reg = <28>;
559 };
560
561 usart2_clk: usart2_clk {
562 #clock-cells = <0>;
563 reg = <29>;
564 };
565
566 usart3_clk: usart3_clk {
567 #clock-cells = <0>;
568 reg = <30>;
569 };
570
571 usart4_clk: usart4_clk {
572 #clock-cells = <0>;
573 reg = <31>;
574 };
575
576 twi0_clk: twi0_clk {
577 reg = <32>;
578 #clock-cells = <0>;
579 };
580
581 twi1_clk: twi1_clk {
582 #clock-cells = <0>;
583 reg = <33>;
584 };
585
586 twi2_clk: twi2_clk {
587 #clock-cells = <0>;
588 reg = <34>;
589 };
590
591 mci0_clk: mci0_clk {
592 #clock-cells = <0>;
593 reg = <35>;
594 };
595
596 mci1_clk: mci1_clk {
597 #clock-cells = <0>;
598 reg = <36>;
599 };
600
601 spi0_clk: spi0_clk {
602 #clock-cells = <0>;
603 reg = <37>;
604 };
605
606 spi1_clk: spi1_clk {
607 #clock-cells = <0>;
608 reg = <38>;
609 };
610
611 spi2_clk: spi2_clk {
612 #clock-cells = <0>;
613 reg = <39>;
614 };
615
616 tcb0_clk: tcb0_clk {
617 #clock-cells = <0>;
618 reg = <40>;
619 };
620
621 tcb1_clk: tcb1_clk {
622 #clock-cells = <0>;
623 reg = <41>;
624 };
625
626 tcb2_clk: tcb2_clk {
627 #clock-cells = <0>;
628 reg = <42>;
629 };
630
631 pwm_clk: pwm_clk {
632 #clock-cells = <0>;
633 reg = <43>;
634 };
635
636 adc_clk: adc_clk {
637 #clock-cells = <0>;
638 reg = <44>;
639 };
640
641 dbgu_clk: dbgu_clk {
642 #clock-cells = <0>;
643 reg = <45>;
644 };
645
646 uhphs_clk: uhphs_clk {
647 #clock-cells = <0>;
648 reg = <46>;
649 };
650
651 udphs_clk: udphs_clk {
652 #clock-cells = <0>;
653 reg = <47>;
654 };
655
656 ssc0_clk: ssc0_clk {
657 #clock-cells = <0>;
658 reg = <48>;
659 };
660
661 ssc1_clk: ssc1_clk {
662 #clock-cells = <0>;
663 reg = <49>;
664 };
665
666 trng_clk: trng_clk {
667 #clock-cells = <0>;
668 reg = <53>;
669 };
670
671 macb0_clk: macb0_clk {
672 #clock-cells = <0>;
673 reg = <54>;
674 };
675
676 macb1_clk: macb1_clk {
677 #clock-cells = <0>;
678 reg = <55>;
679 };
680
681 fuse_clk: fuse_clk {
682 #clock-cells = <0>;
683 reg = <57>;
684 };
685
686 securam_clk: securam_clk {
687 #clock-cells = <0>;
688 reg = <59>;
689 };
690
691 smd_clk: smd_clk {
692 #clock-cells = <0>;
693 reg = <61>;
694 };
695
696 twi3_clk: twi3_clk {
697 #clock-cells = <0>;
698 reg = <62>;
699 };
700
701 catb_clk: catb_clk {
702 #clock-cells = <0>;
703 reg = <63>;
704 };
705 };
706
707 periph64ck {
708 compatible = "atmel,at91sam9x5-clk-peripheral";
709 #address-cells = <1>;
710 #size-cells = <0>;
711 clocks = <&mck>;
712
713 dma0_clk: dma0_clk {
714 #clock-cells = <0>;
715 reg = <8>;
716 };
717
718 cpkcc_clk: cpkcc_clk {
719 #clock-cells = <0>;
720 reg = <10>;
721 };
722
723 aesb_clk: aesb_clk {
724 #clock-cells = <0>;
725 reg = <13>;
726 };
727
728 mpddr_clk: mpddr_clk {
729 #clock-cells = <0>;
730 reg = <16>;
731 };
732
733 matrix0_clk: matrix0_clk {
734 #clock-cells = <0>;
735 reg = <18>;
736 };
737
738 vdec_clk: vdec_clk {
739 #clock-cells = <0>;
740 reg = <19>;
741 };
742
743 dma1_clk: dma1_clk {
744 #clock-cells = <0>;
745 reg = <50>;
746 };
747
748 lcd_clk: lcd_clk {
749 #clock-cells = <0>;
750 reg = <51>;
751 };
752
753 isi_clk: isi_clk {
754 #clock-cells = <0>;
755 reg = <52>;
756 };
757 };
758 };
759
760 mmc0: mmc@f8000000 {
761 compatible = "atmel,hsmci";
762 reg = <0xf8000000 0x600>;
763 interrupts = <35 IRQ_TYPE_LEVEL_HIGH 0>;
764 pinctrl-names = "default";
765 pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3>;
766 status = "disabled";
767 #address-cells = <1>;
768 #size-cells = <0>;
769 clocks = <&mci0_clk>;
770 clock-names = "mci_clk";
771 };
772
773 spi0: spi@f8010000 {
774 #address-cells = <1>;
775 #size-cells = <0>;
776 compatible = "atmel,at91rm9200-spi";
777 reg = <0xf8010000 0x100>;
778 interrupts = <37 IRQ_TYPE_LEVEL_HIGH 3>;
779 pinctrl-names = "default";
780 pinctrl-0 = <&pinctrl_spi0>;
781 clocks = <&spi0_clk>;
782 clock-names = "spi_clk";
783 status = "disabled";
784 };
785
786 i2c0: i2c@f8014000 {
787 compatible = "atmel,at91sam9x5-i2c";
788 reg = <0xf8014000 0x4000>;
789 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 6>;
790 pinctrl-names = "default";
791 pinctrl-0 = <&pinctrl_i2c0>;
792 #address-cells = <1>;
793 #size-cells = <0>;
794 clocks = <&twi0_clk>;
795 status = "disabled";
796 };
797
798 tcb0: timer@f801c000 {
799 compatible = "atmel,at91sam9x5-tcb";
800 reg = <0xf801c000 0x100>;
801 interrupts = <40 IRQ_TYPE_LEVEL_HIGH 0>;
802 clocks = <&tcb0_clk>;
803 clock-names = "t0_clk";
804 };
805
806 macb0: ethernet@f8020000 {
807 compatible = "atmel,sama5d4-gem";
808 reg = <0xf8020000 0x100>;
809 interrupts = <54 IRQ_TYPE_LEVEL_HIGH 3>;
810 pinctrl-names = "default";
811 pinctrl-0 = <&pinctrl_macb0_rmii>;
812 clocks = <&macb0_clk>, <&macb0_clk>;
813 clock-names = "hclk", "pclk";
814 status = "disabled";
815 };
816
817 i2c2: i2c@f8024000 {
818 compatible = "atmel,at91sam9x5-i2c";
819 reg = <0xf8024000 0x4000>;
820 interrupts = <34 4 6>;
821 pinctrl-names = "default";
822 pinctrl-0 = <&pinctrl_i2c2>;
823 #address-cells = <1>;
824 #size-cells = <0>;
825 clocks = <&twi2_clk>;
826 status = "disabled";
827 };
828
829 mmc1: mmc@fc000000 {
830 compatible = "atmel,hsmci";
831 reg = <0xfc000000 0x600>;
832 interrupts = <36 IRQ_TYPE_LEVEL_HIGH 0>;
833 pinctrl-names = "default";
834 pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>;
835 status = "disabled";
836 #address-cells = <1>;
837 #size-cells = <0>;
838 clocks = <&mci1_clk>;
839 clock-names = "mci_clk";
840 };
841
842 usart2: serial@fc008000 {
843 compatible = "atmel,at91sam9260-usart";
844 reg = <0xfc008000 0x100>;
845 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 5>;
846 pinctrl-names = "default";
847 pinctrl-0 = <&pinctrl_usart2 &pinctrl_usart2_rts &pinctrl_usart2_cts>;
848 clocks = <&usart2_clk>;
849 clock-names = "usart";
850 status = "disabled";
851 };
852
853 usart3: serial@fc00c000 {
854 compatible = "atmel,at91sam9260-usart";
855 reg = <0xfc00c000 0x100>;
856 interrupts = <30 IRQ_TYPE_LEVEL_HIGH 5>;
857 pinctrl-names = "default";
858 pinctrl-0 = <&pinctrl_usart3>;
859 clocks = <&usart3_clk>;
860 clock-names = "usart";
861 status = "disabled";
862 };
863
864 usart4: serial@fc010000 {
865 compatible = "atmel,at91sam9260-usart";
866 reg = <0xfc010000 0x100>;
867 interrupts = <31 IRQ_TYPE_LEVEL_HIGH 5>;
868 pinctrl-names = "default";
869 pinctrl-0 = <&pinctrl_usart4>;
870 clocks = <&usart4_clk>;
871 clock-names = "usart";
872 status = "disabled";
873 };
874
875 tcb1: timer@fc020000 {
876 compatible = "atmel,at91sam9x5-tcb";
877 reg = <0xfc020000 0x100>;
878 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 0>;
879 clocks = <&tcb1_clk>;
880 clock-names = "t0_clk";
881 };
882
883 adc0: adc@fc034000 {
884 compatible = "atmel,at91sam9x5-adc";
885 reg = <0xfc034000 0x100>;
886 interrupts = <44 IRQ_TYPE_LEVEL_HIGH 5>;
887 pinctrl-names = "default";
888 pinctrl-0 = <
889 /* external trigger is conflict with USBA_VBUS */
890 &pinctrl_adc0_ad0
891 &pinctrl_adc0_ad1
892 &pinctrl_adc0_ad2
893 &pinctrl_adc0_ad3
894 &pinctrl_adc0_ad4
895 >;
896 clocks = <&adc_clk>,
897 <&adc_op_clk>;
898 clock-names = "adc_clk", "adc_op_clk";
899 atmel,adc-channels-used = <0x01f>;
900 atmel,adc-startup-time = <40>;
901 atmel,adc-use-external;
902 atmel,adc-vref = <3000>;
903 atmel,adc-res = <8 10>;
904 atmel,adc-sample-hold-time = <11>;
905 atmel,adc-res-names = "lowres", "highres";
906 atmel,adc-ts-pressure-threshold = <10000>;
907 status = "disabled";
908
909 trigger@0 {
910 trigger-name = "external-rising";
911 trigger-value = <0x1>;
912 trigger-external;
913 };
914 trigger@1 {
915 trigger-name = "external-falling";
916 trigger-value = <0x2>;
917 trigger-external;
918 };
919 trigger@2 {
920 trigger-name = "external-any";
921 trigger-value = <0x3>;
922 trigger-external;
923 };
924 trigger@3 {
925 trigger-name = "continuous";
926 trigger-value = <0x6>;
927 };
928 };
929
930 rstc@fc068600 {
931 compatible = "atmel,at91sam9g45-rstc";
932 reg = <0xfc068600 0x10>;
933 };
934
935 shdwc@fc068610 {
936 compatible = "atmel,at91sam9x5-shdwc";
937 reg = <0xfc068610 0x10>;
938 };
939
940 pit: timer@fc068630 {
941 compatible = "atmel,at91sam9260-pit";
942 reg = <0xfc068630 0xf>;
943 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>;
944 clocks = <&h32ck>;
945 };
946
947 watchdog@fc068640 {
948 compatible = "atmel,at91sam9260-wdt";
949 reg = <0xfc068640 0x10>;
950 status = "disabled";
951 };
952
953 sckc@fc068650 {
954 compatible = "atmel,at91sam9x5-sckc";
955 reg = <0xfc068650 0x4>;
956
957 slow_rc_osc: slow_rc_osc {
958 compatible = "atmel,at91sam9x5-clk-slow-rc-osc";
959 #clock-cells = <0>;
960 clock-frequency = <32768>;
961 clock-accuracy = <250000000>;
962 atmel,startup-time-usec = <75>;
963 };
964
965 slow_osc: slow_osc {
966 compatible = "atmel,at91sam9x5-clk-slow-osc";
967 #clock-cells = <0>;
968 clocks = <&slow_xtal>;
969 atmel,startup-time-usec = <1200000>;
970 };
971
972 clk32k: slowck {
973 compatible = "atmel,at91sam9x5-clk-slow";
974 #clock-cells = <0>;
975 clocks = <&slow_rc_osc &slow_osc>;
976 };
977 };
978
979 rtc@fc0686b0 {
980 compatible = "atmel,at91rm9200-rtc";
981 reg = <0xfc0686b0 0x30>;
982 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
983 };
984
985 dbgu: serial@fc069000 {
986 compatible = "atmel,at91sam9260-usart";
987 reg = <0xfc069000 0x200>;
988 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>;
989 pinctrl-names = "default";
990 pinctrl-0 = <&pinctrl_dbgu>;
991 clocks = <&dbgu_clk>;
992 clock-names = "usart";
993 status = "disabled";
994 };
995
996
997 pinctrl@fc06a000 {
998 #address-cells = <1>;
999 #size-cells = <1>;
1000 compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
1001 ranges = <0xfc06a000 0xfc06a000 0x4000>;
1002 /* WARNING: revisit as pin spec has changed */
1003 atmel,mux-mask = <
1004 /* A B C */
1005 0xffffffff 0x3ffcfe7c 0x1c010101 /* pioA */
1006 0x7fffffff 0xfffccc3a 0x3f00cc3a /* pioB */
1007 0xffffffff 0x3ff83fff 0xff00ffff /* pioC */
1008 0x00000000 0x00000000 0x00000000 /* pioD */
1009 0xffffffff 0x7fffffff 0x76fff1bf /* pioE */
1010 >;
1011
1012 pioA: gpio@fc06a000 {
1013 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
1014 reg = <0xfc06a000 0x100>;
1015 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 1>;
1016 #gpio-cells = <2>;
1017 gpio-controller;
1018 interrupt-controller;
1019 #interrupt-cells = <2>;
1020 clocks = <&pioA_clk>;
1021 };
1022
1023 pioB: gpio@fc06b000 {
1024 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
1025 reg = <0xfc06b000 0x100>;
1026 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 1>;
1027 #gpio-cells = <2>;
1028 gpio-controller;
1029 interrupt-controller;
1030 #interrupt-cells = <2>;
1031 clocks = <&pioB_clk>;
1032 };
1033
1034 pioC: gpio@fc06c000 {
1035 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
1036 reg = <0xfc06c000 0x100>;
1037 interrupts = <25 IRQ_TYPE_LEVEL_HIGH 1>;
1038 #gpio-cells = <2>;
1039 gpio-controller;
1040 interrupt-controller;
1041 #interrupt-cells = <2>;
1042 clocks = <&pioC_clk>;
1043 };
1044
1045 pioE: gpio@fc06d000 {
1046 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
1047 reg = <0xfc06d000 0x100>;
1048 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 1>;
1049 #gpio-cells = <2>;
1050 gpio-controller;
1051 interrupt-controller;
1052 #interrupt-cells = <2>;
1053 clocks = <&pioE_clk>;
1054 };
1055
1056 /* pinctrl pin settings */
1057 adc0 {
1058 pinctrl_adc0_adtrg: adc0_adtrg {
1059 atmel,pins =
1060 <AT91_PIOE 31 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* conflicts with USBA_VBUS */
1061 };
1062 pinctrl_adc0_ad0: adc0_ad0 {
1063 atmel,pins =
1064 <AT91_PIOC 27 AT91_PERIPH_A AT91_PINCTRL_NONE>;
1065 };
1066 pinctrl_adc0_ad1: adc0_ad1 {
1067 atmel,pins =
1068 <AT91_PIOC 28 AT91_PERIPH_A AT91_PINCTRL_NONE>;
1069 };
1070 pinctrl_adc0_ad2: adc0_ad2 {
1071 atmel,pins =
1072 <AT91_PIOC 29 AT91_PERIPH_A AT91_PINCTRL_NONE>;
1073 };
1074 pinctrl_adc0_ad3: adc0_ad3 {
1075 atmel,pins =
1076 <AT91_PIOC 30 AT91_PERIPH_A AT91_PINCTRL_NONE>;
1077 };
1078 pinctrl_adc0_ad4: adc0_ad4 {
1079 atmel,pins =
1080 <AT91_PIOC 31 AT91_PERIPH_A AT91_PINCTRL_NONE>;
1081 };
1082 };
1083
1084 dbgu {
1085 pinctrl_dbgu: dbgu-0 {
1086 atmel,pins =
1087 <AT91_PIOB 24 AT91_PERIPH_A AT91_PINCTRL_NONE>, /* conflicts with D14 and TDI */
1088 <AT91_PIOB 25 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* conflicts with D15 and TDO */
1089 };
1090 };
1091
1092 i2c0 {
1093 pinctrl_i2c0: i2c0-0 {
1094 atmel,pins =
1095 <AT91_PIOA 30 AT91_PERIPH_A AT91_PINCTRL_NONE
1096 AT91_PIOA 31 AT91_PERIPH_A AT91_PINCTRL_NONE>;
1097 };
1098 };
1099
1100 i2c2 {
1101 pinctrl_i2c2: i2c2-0 {
1102 atmel,pins =
1103 <AT91_PIOB 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* TWD2, conflicts with RD0 and PWML1 */
1104 AT91_PIOB 30 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* TWCK2, conflicts with RF0 */
1105 };
1106 };
1107
1108 macb0 {
1109 pinctrl_macb0_rmii: macb0_rmii-0 {
1110 atmel,pins =
1111 <AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_TX0 */
1112 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_TX1 */
1113 AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_RX0 */
1114 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_RX1 */
1115 AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_RXDV */
1116 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_RXER */
1117 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_TXEN */
1118 AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_TXCK */
1119 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_MDC */
1120 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* G0_MDIO */
1121 >;
1122 };
1123 };
1124
1125 mmc0 {
1126 pinctrl_mmc0_clk_cmd_dat0: mmc0_clk_cmd_dat0 {
1127 atmel,pins =
1128 <AT91_PIOC 4 AT91_PERIPH_B AT91_PINCTRL_NONE /* MCI0_CK, conflict with PCK1(ISI_MCK) */
1129 AT91_PIOC 5 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* MCI0_CDB, conflict with NAND_D0 */
1130 AT91_PIOC 6 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* MCI0_DB0, conflict with NAND_D1 */
1131 >;
1132 };
1133 pinctrl_mmc0_dat1_3: mmc0_dat1_3 {
1134 atmel,pins =
1135 <AT91_PIOC 7 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* MCI0_DB1, conflict with NAND_D2 */
1136 AT91_PIOC 8 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* MCI0_DB2, conflict with NAND_D3 */
1137 AT91_PIOC 9 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* MCI0_DB3, conflict with NAND_D4 */
1138 >;
1139 };
1140 };
1141
1142 mmc1 {
1143 pinctrl_mmc1_clk_cmd_dat0: mmc1_clk_cmd_dat0 {
1144 atmel,pins =
1145 <AT91_PIOE 18 AT91_PERIPH_C AT91_PINCTRL_NONE /* MCI1_CK */
1146 AT91_PIOE 19 AT91_PERIPH_C AT91_PINCTRL_PULL_UP /* MCI1_CDA */
1147 AT91_PIOE 20 AT91_PERIPH_C AT91_PINCTRL_PULL_UP /* MCI1_DA0 */
1148 >;
1149 };
1150 pinctrl_mmc1_dat1_3: mmc1_dat1_3 {
1151 atmel,pins =
1152 <AT91_PIOE 21 AT91_PERIPH_C AT91_PINCTRL_PULL_UP /* MCI1_DA1 */
1153 AT91_PIOE 22 AT91_PERIPH_C AT91_PINCTRL_PULL_UP /* MCI1_DA2 */
1154 AT91_PIOE 23 AT91_PERIPH_C AT91_PINCTRL_PULL_UP /* MCI1_DA3 */
1155 >;
1156 };
1157 };
1158
1159 nand0 {
1160 pinctrl_nand: nand-0 {
1161 atmel,pins =
1162 <AT91_PIOC 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC13 periph A Read Enable */
1163 AT91_PIOC 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC14 periph A Write Enable */
1164
1165 AT91_PIOC 17 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PC17 ALE */
1166 AT91_PIOC 18 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PC18 CLE */
1167
1168 AT91_PIOC 15 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PC15 NCS3/Chip Enable */
1169 AT91_PIOC 16 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PC16 NANDRDY */
1170 AT91_PIOC 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC5 Data bit 0 */
1171 AT91_PIOC 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC6 Data bit 1 */
1172 AT91_PIOC 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC7 Data bit 2 */
1173 AT91_PIOC 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC8 Data bit 3 */
1174 AT91_PIOC 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC9 Data bit 4 */
1175 AT91_PIOC 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC10 Data bit 5 */
1176 AT91_PIOC 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC11 periph A Data bit 6 */
1177 AT91_PIOC 12 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC12 periph A Data bit 7 */
1178 };
1179 };
1180
1181 spi0 {
1182 pinctrl_spi0: spi0-0 {
1183 atmel,pins =
1184 <AT91_PIOC 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* SPI0_MISO */
1185 AT91_PIOC 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* SPI0_MOSI */
1186 AT91_PIOC 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* SPI0_SPCK */
1187 >;
1188 };
1189 };
1190
1191 usart2 {
1192 pinctrl_usart2: usart2-0 {
1193 atmel,pins =
1194 <AT91_PIOB 4 AT91_PERIPH_B AT91_PINCTRL_NONE /* RXD - conflicts with G0_CRS, ISI_HSYNC */
1195 AT91_PIOB 5 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* TXD - conflicts with G0_COL, PCK2 */
1196 >;
1197 };
1198 pinctrl_usart2_rts: usart2_rts-0 {
1199 atmel,pins = <AT91_PIOB 11 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* conflicts with G0_RX3, PWMH1 */
1200 };
1201 pinctrl_usart2_cts: usart2_cts-0 {
1202 atmel,pins = <AT91_PIOB 3 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* conflicts with G0_TXER, ISI_VSYNC */
1203 };
1204 };
1205
1206 usart3 {
1207 pinctrl_usart3: usart3-0 {
1208 atmel,pins =
1209 <AT91_PIOE 16 AT91_PERIPH_B AT91_PINCTRL_NONE /* RXD */
1210 AT91_PIOE 17 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* TXD */
1211 >;
1212 };
1213 };
1214
1215 usart4 {
1216 pinctrl_usart4: usart4-0 {
1217 atmel,pins =
1218 <AT91_PIOE 26 AT91_PERIPH_B AT91_PINCTRL_NONE /* RXD */
1219 AT91_PIOE 27 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* TXD */
1220 >;
1221 };
1222 pinctrl_usart4_rts: usart4_rts-0 {
1223 atmel,pins = <AT91_PIOE 28 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* conflicts with NWAIT, A19 */
1224 };
1225 pinctrl_usart4_cts: usart4_cts-0 {
1226 atmel,pins = <AT91_PIOE 0 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* conflicts with A0/NBS0, MCI0_CDB */
1227 };
1228 };
1229 };
1230
1231 aic: interrupt-controller@fc06e000 {
1232 #interrupt-cells = <3>;
1233 compatible = "atmel,sama5d4-aic";
1234 interrupt-controller;
1235 reg = <0xfc06e000 0x200>;
1236 atmel,external-irqs = <56>;
1237 };
1238 };
1239 };
1240};
diff --git a/arch/arm/boot/dts/sh7372.dtsi b/arch/arm/boot/dts/sh7372.dtsi
index 249f65be2a50..f863a10cb1b2 100644
--- a/arch/arm/boot/dts/sh7372.dtsi
+++ b/arch/arm/boot/dts/sh7372.dtsi
@@ -21,6 +21,7 @@
21 compatible = "arm,cortex-a8"; 21 compatible = "arm,cortex-a8";
22 device_type = "cpu"; 22 device_type = "cpu";
23 reg = <0x0>; 23 reg = <0x0>;
24 clock-frequency = <800000000>;
24 }; 25 };
25 }; 26 };
26 27
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index 18662aec2ec4..30ef97e99dc5 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -66,7 +66,7 @@
66 }; 66 };
67 67
68 vmmc_sdhi0: regulator@2 { 68 vmmc_sdhi0: regulator@2 {
69 compatible = "regulator-fixed"; 69 compatible = "regulator-fixed";
70 regulator-name = "SDHI0 Vcc"; 70 regulator-name = "SDHI0 Vcc";
71 regulator-min-microvolt = <3300000>; 71 regulator-min-microvolt = <3300000>;
72 regulator-max-microvolt = <3300000>; 72 regulator-max-microvolt = <3300000>;
@@ -75,7 +75,7 @@
75 }; 75 };
76 76
77 vmmc_sdhi2: regulator@3 { 77 vmmc_sdhi2: regulator@3 {
78 compatible = "regulator-fixed"; 78 compatible = "regulator-fixed";
79 regulator-name = "SDHI2 Vcc"; 79 regulator-name = "SDHI2 Vcc";
80 regulator-min-microvolt = <3300000>; 80 regulator-min-microvolt = <3300000>;
81 regulator-max-microvolt = <3300000>; 81 regulator-max-microvolt = <3300000>;
@@ -173,6 +173,10 @@
173 }; 173 };
174}; 174};
175 175
176&cmt1 {
177 status = "ok";
178};
179
176&i2c0 { 180&i2c0 {
177 status = "okay"; 181 status = "okay";
178 as3711@40 { 182 as3711@40 {
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 910b79079d5a..030a5920312f 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -14,6 +14,7 @@
14 14
15/ { 15/ {
16 compatible = "renesas,sh73a0"; 16 compatible = "renesas,sh73a0";
17 interrupt-parent = <&gic>;
17 18
18 cpus { 19 cpus {
19 #address-cells = <1>; 20 #address-cells = <1>;
@@ -23,11 +24,13 @@
23 device_type = "cpu"; 24 device_type = "cpu";
24 compatible = "arm,cortex-a9"; 25 compatible = "arm,cortex-a9";
25 reg = <0>; 26 reg = <0>;
27 clock-frequency = <1196000000>;
26 }; 28 };
27 cpu@1 { 29 cpu@1 {
28 device_type = "cpu"; 30 device_type = "cpu";
29 compatible = "arm,cortex-a9"; 31 compatible = "arm,cortex-a9";
30 reg = <1>; 32 reg = <1>;
33 clock-frequency = <1196000000>;
31 }; 34 };
32 }; 35 };
33 36
@@ -45,6 +48,16 @@
45 <0 56 IRQ_TYPE_LEVEL_HIGH>; 48 <0 56 IRQ_TYPE_LEVEL_HIGH>;
46 }; 49 };
47 50
51 cmt1: timer@e6138000 {
52 compatible = "renesas,cmt-48-sh73a0", "renesas,cmt-48";
53 reg = <0xe6138000 0x200>;
54 interrupts = <0 65 IRQ_TYPE_LEVEL_HIGH>;
55
56 renesas,channels-mask = <0x3f>;
57
58 status = "disabled";
59 };
60
48 irqpin0: irqpin@e6900000 { 61 irqpin0: irqpin@e6900000 {
49 compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin"; 62 compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
50 #interrupt-cells = <2>; 63 #interrupt-cells = <2>;
@@ -54,7 +67,6 @@
54 <0xe6900020 1>, 67 <0xe6900020 1>,
55 <0xe6900040 1>, 68 <0xe6900040 1>,
56 <0xe6900060 1>; 69 <0xe6900060 1>;
57 interrupt-parent = <&gic>;
58 interrupts = <0 1 IRQ_TYPE_LEVEL_HIGH 70 interrupts = <0 1 IRQ_TYPE_LEVEL_HIGH
59 0 2 IRQ_TYPE_LEVEL_HIGH 71 0 2 IRQ_TYPE_LEVEL_HIGH
60 0 3 IRQ_TYPE_LEVEL_HIGH 72 0 3 IRQ_TYPE_LEVEL_HIGH
@@ -74,7 +86,6 @@
74 <0xe6900024 1>, 86 <0xe6900024 1>,
75 <0xe6900044 1>, 87 <0xe6900044 1>,
76 <0xe6900064 1>; 88 <0xe6900064 1>;
77 interrupt-parent = <&gic>;
78 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH 89 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH
79 0 10 IRQ_TYPE_LEVEL_HIGH 90 0 10 IRQ_TYPE_LEVEL_HIGH
80 0 11 IRQ_TYPE_LEVEL_HIGH 91 0 11 IRQ_TYPE_LEVEL_HIGH
@@ -95,7 +106,6 @@
95 <0xe6900028 1>, 106 <0xe6900028 1>,
96 <0xe6900048 1>, 107 <0xe6900048 1>,
97 <0xe6900068 1>; 108 <0xe6900068 1>;
98 interrupt-parent = <&gic>;
99 interrupts = <0 17 IRQ_TYPE_LEVEL_HIGH 109 interrupts = <0 17 IRQ_TYPE_LEVEL_HIGH
100 0 18 IRQ_TYPE_LEVEL_HIGH 110 0 18 IRQ_TYPE_LEVEL_HIGH
101 0 19 IRQ_TYPE_LEVEL_HIGH 111 0 19 IRQ_TYPE_LEVEL_HIGH
@@ -115,7 +125,6 @@
115 <0xe690002c 1>, 125 <0xe690002c 1>,
116 <0xe690004c 1>, 126 <0xe690004c 1>,
117 <0xe690006c 1>; 127 <0xe690006c 1>;
118 interrupt-parent = <&gic>;
119 interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH 128 interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH
120 0 26 IRQ_TYPE_LEVEL_HIGH 129 0 26 IRQ_TYPE_LEVEL_HIGH
121 0 27 IRQ_TYPE_LEVEL_HIGH 130 0 27 IRQ_TYPE_LEVEL_HIGH
@@ -131,7 +140,6 @@
131 #size-cells = <0>; 140 #size-cells = <0>;
132 compatible = "renesas,rmobile-iic"; 141 compatible = "renesas,rmobile-iic";
133 reg = <0xe6820000 0x425>; 142 reg = <0xe6820000 0x425>;
134 interrupt-parent = <&gic>;
135 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH 143 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH
136 0 168 IRQ_TYPE_LEVEL_HIGH 144 0 168 IRQ_TYPE_LEVEL_HIGH
137 0 169 IRQ_TYPE_LEVEL_HIGH 145 0 169 IRQ_TYPE_LEVEL_HIGH
@@ -144,7 +152,6 @@
144 #size-cells = <0>; 152 #size-cells = <0>;
145 compatible = "renesas,rmobile-iic"; 153 compatible = "renesas,rmobile-iic";
146 reg = <0xe6822000 0x425>; 154 reg = <0xe6822000 0x425>;
147 interrupt-parent = <&gic>;
148 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH 155 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH
149 0 52 IRQ_TYPE_LEVEL_HIGH 156 0 52 IRQ_TYPE_LEVEL_HIGH
150 0 53 IRQ_TYPE_LEVEL_HIGH 157 0 53 IRQ_TYPE_LEVEL_HIGH
@@ -157,7 +164,6 @@
157 #size-cells = <0>; 164 #size-cells = <0>;
158 compatible = "renesas,rmobile-iic"; 165 compatible = "renesas,rmobile-iic";
159 reg = <0xe6824000 0x425>; 166 reg = <0xe6824000 0x425>;
160 interrupt-parent = <&gic>;
161 interrupts = <0 171 IRQ_TYPE_LEVEL_HIGH 167 interrupts = <0 171 IRQ_TYPE_LEVEL_HIGH
162 0 172 IRQ_TYPE_LEVEL_HIGH 168 0 172 IRQ_TYPE_LEVEL_HIGH
163 0 173 IRQ_TYPE_LEVEL_HIGH 169 0 173 IRQ_TYPE_LEVEL_HIGH
@@ -170,7 +176,6 @@
170 #size-cells = <0>; 176 #size-cells = <0>;
171 compatible = "renesas,rmobile-iic"; 177 compatible = "renesas,rmobile-iic";
172 reg = <0xe6826000 0x425>; 178 reg = <0xe6826000 0x425>;
173 interrupt-parent = <&gic>;
174 interrupts = <0 183 IRQ_TYPE_LEVEL_HIGH 179 interrupts = <0 183 IRQ_TYPE_LEVEL_HIGH
175 0 184 IRQ_TYPE_LEVEL_HIGH 180 0 184 IRQ_TYPE_LEVEL_HIGH
176 0 185 IRQ_TYPE_LEVEL_HIGH 181 0 185 IRQ_TYPE_LEVEL_HIGH
@@ -183,7 +188,6 @@
183 #size-cells = <0>; 188 #size-cells = <0>;
184 compatible = "renesas,rmobile-iic"; 189 compatible = "renesas,rmobile-iic";
185 reg = <0xe6828000 0x425>; 190 reg = <0xe6828000 0x425>;
186 interrupt-parent = <&gic>;
187 interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH 191 interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH
188 0 188 IRQ_TYPE_LEVEL_HIGH 192 0 188 IRQ_TYPE_LEVEL_HIGH
189 0 189 IRQ_TYPE_LEVEL_HIGH 193 0 189 IRQ_TYPE_LEVEL_HIGH
@@ -194,7 +198,6 @@
194 mmcif: mmc@e6bd0000 { 198 mmcif: mmc@e6bd0000 {
195 compatible = "renesas,sh-mmcif"; 199 compatible = "renesas,sh-mmcif";
196 reg = <0xe6bd0000 0x100>; 200 reg = <0xe6bd0000 0x100>;
197 interrupt-parent = <&gic>;
198 interrupts = <0 140 IRQ_TYPE_LEVEL_HIGH 201 interrupts = <0 140 IRQ_TYPE_LEVEL_HIGH
199 0 141 IRQ_TYPE_LEVEL_HIGH>; 202 0 141 IRQ_TYPE_LEVEL_HIGH>;
200 reg-io-width = <4>; 203 reg-io-width = <4>;
@@ -204,7 +207,6 @@
204 sdhi0: sd@ee100000 { 207 sdhi0: sd@ee100000 {
205 compatible = "renesas,sdhi-sh73a0"; 208 compatible = "renesas,sdhi-sh73a0";
206 reg = <0xee100000 0x100>; 209 reg = <0xee100000 0x100>;
207 interrupt-parent = <&gic>;
208 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH 210 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH
209 0 84 IRQ_TYPE_LEVEL_HIGH 211 0 84 IRQ_TYPE_LEVEL_HIGH
210 0 85 IRQ_TYPE_LEVEL_HIGH>; 212 0 85 IRQ_TYPE_LEVEL_HIGH>;
@@ -216,7 +218,6 @@
216 sdhi1: sd@ee120000 { 218 sdhi1: sd@ee120000 {
217 compatible = "renesas,sdhi-sh73a0"; 219 compatible = "renesas,sdhi-sh73a0";
218 reg = <0xee120000 0x100>; 220 reg = <0xee120000 0x100>;
219 interrupt-parent = <&gic>;
220 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH 221 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH
221 0 89 IRQ_TYPE_LEVEL_HIGH>; 222 0 89 IRQ_TYPE_LEVEL_HIGH>;
222 toshiba,mmc-wrprotect-disable; 223 toshiba,mmc-wrprotect-disable;
@@ -227,7 +228,6 @@
227 sdhi2: sd@ee140000 { 228 sdhi2: sd@ee140000 {
228 compatible = "renesas,sdhi-sh73a0"; 229 compatible = "renesas,sdhi-sh73a0";
229 reg = <0xee140000 0x100>; 230 reg = <0xee140000 0x100>;
230 interrupt-parent = <&gic>;
231 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH 231 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH
232 0 105 IRQ_TYPE_LEVEL_HIGH>; 232 0 105 IRQ_TYPE_LEVEL_HIGH>;
233 toshiba,mmc-wrprotect-disable; 233 toshiba,mmc-wrprotect-disable;
@@ -238,7 +238,6 @@
238 scifa0: serial@e6c40000 { 238 scifa0: serial@e6c40000 {
239 compatible = "renesas,scifa-sh73a0", "renesas,scifa"; 239 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
240 reg = <0xe6c40000 0x100>; 240 reg = <0xe6c40000 0x100>;
241 interrupt-parent = <&gic>;
242 interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>; 241 interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>;
243 status = "disabled"; 242 status = "disabled";
244 }; 243 };
@@ -246,7 +245,6 @@
246 scifa1: serial@e6c50000 { 245 scifa1: serial@e6c50000 {
247 compatible = "renesas,scifa-sh73a0", "renesas,scifa"; 246 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
248 reg = <0xe6c50000 0x100>; 247 reg = <0xe6c50000 0x100>;
249 interrupt-parent = <&gic>;
250 interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>; 248 interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
251 status = "disabled"; 249 status = "disabled";
252 }; 250 };
@@ -254,7 +252,6 @@
254 scifa2: serial@e6c60000 { 252 scifa2: serial@e6c60000 {
255 compatible = "renesas,scifa-sh73a0", "renesas,scifa"; 253 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
256 reg = <0xe6c60000 0x100>; 254 reg = <0xe6c60000 0x100>;
257 interrupt-parent = <&gic>;
258 interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>; 255 interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
259 status = "disabled"; 256 status = "disabled";
260 }; 257 };
@@ -262,7 +259,6 @@
262 scifa3: serial@e6c70000 { 259 scifa3: serial@e6c70000 {
263 compatible = "renesas,scifa-sh73a0", "renesas,scifa"; 260 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
264 reg = <0xe6c70000 0x100>; 261 reg = <0xe6c70000 0x100>;
265 interrupt-parent = <&gic>;
266 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>; 262 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
267 status = "disabled"; 263 status = "disabled";
268 }; 264 };
@@ -270,7 +266,6 @@
270 scifa4: serial@e6c80000 { 266 scifa4: serial@e6c80000 {
271 compatible = "renesas,scifa-sh73a0", "renesas,scifa"; 267 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
272 reg = <0xe6c80000 0x100>; 268 reg = <0xe6c80000 0x100>;
273 interrupt-parent = <&gic>;
274 interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>; 269 interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
275 status = "disabled"; 270 status = "disabled";
276 }; 271 };
@@ -278,7 +273,6 @@
278 scifa5: serial@e6cb0000 { 273 scifa5: serial@e6cb0000 {
279 compatible = "renesas,scifa-sh73a0", "renesas,scifa"; 274 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
280 reg = <0xe6cb0000 0x100>; 275 reg = <0xe6cb0000 0x100>;
281 interrupt-parent = <&gic>;
282 interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>; 276 interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
283 status = "disabled"; 277 status = "disabled";
284 }; 278 };
@@ -286,7 +280,6 @@
286 scifa6: serial@e6cc0000 { 280 scifa6: serial@e6cc0000 {
287 compatible = "renesas,scifa-sh73a0", "renesas,scifa"; 281 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
288 reg = <0xe6cc0000 0x100>; 282 reg = <0xe6cc0000 0x100>;
289 interrupt-parent = <&gic>;
290 interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>; 283 interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
291 status = "disabled"; 284 status = "disabled";
292 }; 285 };
@@ -294,7 +287,6 @@
294 scifa7: serial@e6cd0000 { 287 scifa7: serial@e6cd0000 {
295 compatible = "renesas,scifa-sh73a0", "renesas,scifa"; 288 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
296 reg = <0xe6cd0000 0x100>; 289 reg = <0xe6cd0000 0x100>;
297 interrupt-parent = <&gic>;
298 interrupts = <0 143 IRQ_TYPE_LEVEL_HIGH>; 290 interrupts = <0 143 IRQ_TYPE_LEVEL_HIGH>;
299 status = "disabled"; 291 status = "disabled";
300 }; 292 };
@@ -302,7 +294,6 @@
302 scifb8: serial@e6c30000 { 294 scifb8: serial@e6c30000 {
303 compatible = "renesas,scifb-sh73a0", "renesas,scifb"; 295 compatible = "renesas,scifb-sh73a0", "renesas,scifb";
304 reg = <0xe6c30000 0x100>; 296 reg = <0xe6c30000 0x100>;
305 interrupt-parent = <&gic>;
306 interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>; 297 interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
307 status = "disabled"; 298 status = "disabled";
308 }; 299 };
@@ -328,7 +319,6 @@
328 #sound-dai-cells = <1>; 319 #sound-dai-cells = <1>;
329 compatible = "renesas,sh_fsi2"; 320 compatible = "renesas,sh_fsi2";
330 reg = <0xec230000 0x400>; 321 reg = <0xec230000 0x400>;
331 interrupt-parent = <&gic>;
332 interrupts = <0 146 0x4>; 322 interrupts = <0 146 0x4>;
333 status = "disabled"; 323 status = "disabled";
334 }; 324 };
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index 4d77ad690ed5..45fce2cf6fed 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -607,6 +607,17 @@
607 }; 607 };
608 }; 608 };
609 609
610 sdr: sdr@ffc25000 {
611 compatible = "syscon";
612 reg = <0xffc25000 0x1000>;
613 };
614
615 sdramedac {
616 compatible = "altr,sdram-edac";
617 altr,sdr-syscon = <&sdr>;
618 interrupts = <0 39 4>;
619 };
620
610 L2: l2-cache@fffef000 { 621 L2: l2-cache@fffef000 {
611 compatible = "arm,pl310-cache"; 622 compatible = "arm,pl310-cache";
612 reg = <0xfffef000 0x1000>; 623 reg = <0xfffef000 0x1000>;
diff --git a/arch/arm/boot/dts/socfpga_arria5.dtsi b/arch/arm/boot/dts/socfpga_arria5.dtsi
index 12d1c2ccaf5b..03e8268ae219 100644
--- a/arch/arm/boot/dts/socfpga_arria5.dtsi
+++ b/arch/arm/boot/dts/socfpga_arria5.dtsi
@@ -15,6 +15,8 @@
15 */ 15 */
16 16
17/dts-v1/; 17/dts-v1/;
18/* First 4KB has trampoline code for secondary cores. */
19/memreserve/ 0x00000000 0x0001000;
18#include "socfpga.dtsi" 20#include "socfpga.dtsi"
19 21
20/ { 22/ {
@@ -29,13 +31,10 @@
29 31
30 dwmmc0@ff704000 { 32 dwmmc0@ff704000 {
31 num-slots = <1>; 33 num-slots = <1>;
32 supports-highspeed;
33 broken-cd; 34 broken-cd;
34 35 bus-width = <4>;
35 slot@0 { 36 cap-mmc-highspeed;
36 reg = <0>; 37 cap-sd-highspeed;
37 bus-width = <4>;
38 };
39 }; 38 };
40 39
41 sysmgr@ffd08000 { 40 sysmgr@ffd08000 {
diff --git a/arch/arm/boot/dts/socfpga_arria5_socdk.dts b/arch/arm/boot/dts/socfpga_arria5_socdk.dts
index d532d171e391..27d551c384d0 100644
--- a/arch/arm/boot/dts/socfpga_arria5_socdk.dts
+++ b/arch/arm/boot/dts/socfpga_arria5_socdk.dts
@@ -37,13 +37,6 @@
37 */ 37 */
38 ethernet0 = &gmac1; 38 ethernet0 = &gmac1;
39 }; 39 };
40
41 aliases {
42 /* this allow the ethaddr uboot environmnet variable contents
43 * to be added to the gmac1 device tree blob.
44 */
45 ethernet0 = &gmac1;
46 };
47}; 40};
48 41
49&gmac1 { 42&gmac1 {
diff --git a/arch/arm/boot/dts/socfpga_cyclone5.dtsi b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
index bf511828729f..28c05e7a31c9 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5.dtsi
+++ b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
@@ -16,6 +16,8 @@
16 */ 16 */
17 17
18/dts-v1/; 18/dts-v1/;
19/* First 4KB has trampoline code for secondary cores. */
20/memreserve/ 0x00000000 0x0001000;
19#include "socfpga.dtsi" 21#include "socfpga.dtsi"
20 22
21/ { 23/ {
@@ -28,15 +30,12 @@
28 }; 30 };
29 }; 31 };
30 32
31 dwmmc0@ff704000 { 33 mmc0: dwmmc0@ff704000 {
32 num-slots = <1>; 34 num-slots = <1>;
33 supports-highspeed;
34 broken-cd; 35 broken-cd;
35 36 bus-width = <4>;
36 slot@0 { 37 cap-mmc-highspeed;
37 reg = <0>; 38 cap-sd-highspeed;
38 bus-width = <4>;
39 };
40 }; 39 };
41 40
42 ethernet@ff702000 { 41 ethernet@ff702000 {
diff --git a/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts b/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
index 45de1514af0a..d7296a5f750c 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
+++ b/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
@@ -68,6 +68,10 @@
68 }; 68 };
69}; 69};
70 70
71&mmc0 {
72 cd-gpios = <&gpio1 18 0>;
73};
74
71&usb1 { 75&usb1 {
72 status = "okay"; 76 status = "okay";
73}; 77};
diff --git a/arch/arm/boot/dts/socfpga_vt.dts b/arch/arm/boot/dts/socfpga_vt.dts
index 09792b411110..f9345e02ca49 100644
--- a/arch/arm/boot/dts/socfpga_vt.dts
+++ b/arch/arm/boot/dts/socfpga_vt.dts
@@ -43,13 +43,10 @@
43 43
44 dwmmc0@ff704000 { 44 dwmmc0@ff704000 {
45 num-slots = <1>; 45 num-slots = <1>;
46 supports-highspeed;
47 broken-cd; 46 broken-cd;
48 47 bus-width = <4>;
49 slot@0 { 48 cap-mmc-highspeed;
50 reg = <0>; 49 cap-sd-highspeed;
51 bus-width = <4>;
52 };
53 }; 50 };
54 51
55 ethernet@ff700000 { 52 ethernet@ff700000 {
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index fa5f2bb5f106..9d342920695a 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -85,7 +85,8 @@
85 85
86 pcie0: pcie@b1000000 { 86 pcie0: pcie@b1000000 {
87 compatible = "st,spear1340-pcie", "snps,dw-pcie"; 87 compatible = "st,spear1340-pcie", "snps,dw-pcie";
88 reg = <0xb1000000 0x4000>; 88 reg = <0xb1000000 0x4000>, <0x80000000 0x20000>;
89 reg-names = "dbi", "config";
89 interrupts = <0 68 0x4>; 90 interrupts = <0 68 0x4>;
90 interrupt-map-mask = <0 0 0 0>; 91 interrupt-map-mask = <0 0 0 0>;
91 interrupt-map = <0x0 0 &gic 0 68 0x4>; 92 interrupt-map = <0x0 0 &gic 0 68 0x4>;
@@ -95,15 +96,15 @@
95 #address-cells = <3>; 96 #address-cells = <3>;
96 #size-cells = <2>; 97 #size-cells = <2>;
97 device_type = "pci"; 98 device_type = "pci";
98 ranges = <0x00000800 0 0x80000000 0x80000000 0 0x00020000 /* configuration space */ 99 ranges = <0x81000000 0 0 0x80020000 0 0x00010000 /* downstream I/O */
99 0x81000000 0 0 0x80020000 0 0x00010000 /* downstream I/O */
100 0x82000000 0 0x80030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */ 100 0x82000000 0 0x80030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */
101 status = "disabled"; 101 status = "disabled";
102 }; 102 };
103 103
104 pcie1: pcie@b1800000 { 104 pcie1: pcie@b1800000 {
105 compatible = "st,spear1340-pcie", "snps,dw-pcie"; 105 compatible = "st,spear1340-pcie", "snps,dw-pcie";
106 reg = <0xb1800000 0x4000>; 106 reg = <0xb1800000 0x4000>, <0x90000000 0x20000>;
107 reg-names = "dbi", "config";
107 interrupts = <0 69 0x4>; 108 interrupts = <0 69 0x4>;
108 interrupt-map-mask = <0 0 0 0>; 109 interrupt-map-mask = <0 0 0 0>;
109 interrupt-map = <0x0 0 &gic 0 69 0x4>; 110 interrupt-map = <0x0 0 &gic 0 69 0x4>;
@@ -113,15 +114,15 @@
113 #address-cells = <3>; 114 #address-cells = <3>;
114 #size-cells = <2>; 115 #size-cells = <2>;
115 device_type = "pci"; 116 device_type = "pci";
116 ranges = <0x00000800 0 0x90000000 0x90000000 0 0x00020000 /* configuration space */ 117 ranges = <0x81000000 0 0 0x90020000 0 0x00010000 /* downstream I/O */
117 0x81000000 0 0 0x90020000 0 0x00010000 /* downstream I/O */
118 0x82000000 0 0x90030000 0x90030000 0 0x0ffd0000>; /* non-prefetchable memory */ 118 0x82000000 0 0x90030000 0x90030000 0 0x0ffd0000>; /* non-prefetchable memory */
119 status = "disabled"; 119 status = "disabled";
120 }; 120 };
121 121
122 pcie2: pcie@b4000000 { 122 pcie2: pcie@b4000000 {
123 compatible = "st,spear1340-pcie", "snps,dw-pcie"; 123 compatible = "st,spear1340-pcie", "snps,dw-pcie";
124 reg = <0xb4000000 0x4000>; 124 reg = <0xb4000000 0x4000>, <0xc0000000 0x20000>;
125 reg-names = "dbi", "config";
125 interrupts = <0 70 0x4>; 126 interrupts = <0 70 0x4>;
126 interrupt-map-mask = <0 0 0 0>; 127 interrupt-map-mask = <0 0 0 0>;
127 interrupt-map = <0x0 0 &gic 0 70 0x4>; 128 interrupt-map = <0x0 0 &gic 0 70 0x4>;
@@ -131,8 +132,7 @@
131 #address-cells = <3>; 132 #address-cells = <3>;
132 #size-cells = <2>; 133 #size-cells = <2>;
133 device_type = "pci"; 134 device_type = "pci";
134 ranges = <0x00000800 0 0xc0000000 0xc0000000 0 0x00020000 /* configuration space */ 135 ranges = <0x81000000 0 0 0xc0020000 0 0x00010000 /* downstream I/O */
135 0x81000000 0 0 0xc0020000 0 0x00010000 /* downstream I/O */
136 0x82000000 0 0xc0030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */ 136 0x82000000 0 0xc0030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */
137 status = "disabled"; 137 status = "disabled";
138 }; 138 };
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index e71df0f2cb52..13e1aa33daa2 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -50,7 +50,8 @@
50 50
51 pcie0: pcie@b1000000 { 51 pcie0: pcie@b1000000 {
52 compatible = "st,spear1340-pcie", "snps,dw-pcie"; 52 compatible = "st,spear1340-pcie", "snps,dw-pcie";
53 reg = <0xb1000000 0x4000>; 53 reg = <0xb1000000 0x4000>, <0x80000000 0x20000>;
54 reg-names = "dbi", "config";
54 interrupts = <0 68 0x4>; 55 interrupts = <0 68 0x4>;
55 interrupt-map-mask = <0 0 0 0>; 56 interrupt-map-mask = <0 0 0 0>;
56 interrupt-map = <0x0 0 &gic 0 68 0x4>; 57 interrupt-map = <0x0 0 &gic 0 68 0x4>;
@@ -60,8 +61,7 @@
60 #address-cells = <3>; 61 #address-cells = <3>;
61 #size-cells = <2>; 62 #size-cells = <2>;
62 device_type = "pci"; 63 device_type = "pci";
63 ranges = <0x00000800 0 0x80000000 0x80000000 0 0x00020000 /* configuration space */ 64 ranges = <0x81000000 0 0 0x80020000 0 0x00010000 /* downstream I/O */
64 0x81000000 0 0 0x80020000 0 0x00010000 /* downstream I/O */
65 0x82000000 0 0x80030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */ 65 0x82000000 0 0x80030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */
66 status = "disabled"; 66 status = "disabled";
67 }; 67 };
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index 4a2000c620ad..3e97a669f15e 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -116,7 +116,6 @@
116 msp2: msp@80117000 { 116 msp2: msp@80117000 {
117 pinctrl-names = "default"; 117 pinctrl-names = "default";
118 pinctrl-0 = <&msp2_default_mode>; 118 pinctrl-0 = <&msp2_default_mode>;
119 status = "okay";
120 }; 119 };
121 120
122 msp3: msp@80125000 { 121 msp3: msp@80125000 {
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 459cb6377764..380f914b226d 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -339,12 +339,22 @@
339 #size-cells = <1>; 339 #size-cells = <1>;
340 ranges; 340 ranges;
341 341
342 dma: dma-controller@01c02000 {
343 compatible = "allwinner,sun4i-a10-dma";
344 reg = <0x01c02000 0x1000>;
345 interrupts = <27>;
346 clocks = <&ahb_gates 6>;
347 #dma-cells = <2>;
348 };
349
342 spi0: spi@01c05000 { 350 spi0: spi@01c05000 {
343 compatible = "allwinner,sun4i-a10-spi"; 351 compatible = "allwinner,sun4i-a10-spi";
344 reg = <0x01c05000 0x1000>; 352 reg = <0x01c05000 0x1000>;
345 interrupts = <10>; 353 interrupts = <10>;
346 clocks = <&ahb_gates 20>, <&spi0_clk>; 354 clocks = <&ahb_gates 20>, <&spi0_clk>;
347 clock-names = "ahb", "mod"; 355 clock-names = "ahb", "mod";
356 dmas = <&dma 1 27>, <&dma 1 26>;
357 dma-names = "rx", "tx";
348 status = "disabled"; 358 status = "disabled";
349 #address-cells = <1>; 359 #address-cells = <1>;
350 #size-cells = <0>; 360 #size-cells = <0>;
@@ -356,6 +366,8 @@
356 interrupts = <11>; 366 interrupts = <11>;
357 clocks = <&ahb_gates 21>, <&spi1_clk>; 367 clocks = <&ahb_gates 21>, <&spi1_clk>;
358 clock-names = "ahb", "mod"; 368 clock-names = "ahb", "mod";
369 dmas = <&dma 1 9>, <&dma 1 8>;
370 dma-names = "rx", "tx";
359 status = "disabled"; 371 status = "disabled";
360 #address-cells = <1>; 372 #address-cells = <1>;
361 #size-cells = <0>; 373 #size-cells = <0>;
@@ -451,6 +463,8 @@
451 interrupts = <12>; 463 interrupts = <12>;
452 clocks = <&ahb_gates 22>, <&spi2_clk>; 464 clocks = <&ahb_gates 22>, <&spi2_clk>;
453 clock-names = "ahb", "mod"; 465 clock-names = "ahb", "mod";
466 dmas = <&dma 1 29>, <&dma 1 28>;
467 dma-names = "rx", "tx";
454 status = "disabled"; 468 status = "disabled";
455 #address-cells = <1>; 469 #address-cells = <1>;
456 #size-cells = <0>; 470 #size-cells = <0>;
@@ -490,6 +504,8 @@
490 interrupts = <50>; 504 interrupts = <50>;
491 clocks = <&ahb_gates 23>, <&spi3_clk>; 505 clocks = <&ahb_gates 23>, <&spi3_clk>;
492 clock-names = "ahb", "mod"; 506 clock-names = "ahb", "mod";
507 dmas = <&dma 1 31>, <&dma 1 30>;
508 dma-names = "rx", "tx";
493 status = "disabled"; 509 status = "disabled";
494 #address-cells = <1>; 510 #address-cells = <1>;
495 #size-cells = <0>; 511 #size-cells = <0>;
@@ -749,7 +765,6 @@
749 reg = <0x01c2ac00 0x400>; 765 reg = <0x01c2ac00 0x400>;
750 interrupts = <7>; 766 interrupts = <7>;
751 clocks = <&apb1_gates 0>; 767 clocks = <&apb1_gates 0>;
752 clock-frequency = <100000>;
753 status = "disabled"; 768 status = "disabled";
754 #address-cells = <1>; 769 #address-cells = <1>;
755 #size-cells = <0>; 770 #size-cells = <0>;
@@ -760,7 +775,6 @@
760 reg = <0x01c2b000 0x400>; 775 reg = <0x01c2b000 0x400>;
761 interrupts = <8>; 776 interrupts = <8>;
762 clocks = <&apb1_gates 1>; 777 clocks = <&apb1_gates 1>;
763 clock-frequency = <100000>;
764 status = "disabled"; 778 status = "disabled";
765 #address-cells = <1>; 779 #address-cells = <1>;
766 #size-cells = <0>; 780 #size-cells = <0>;
@@ -771,7 +785,6 @@
771 reg = <0x01c2b400 0x400>; 785 reg = <0x01c2b400 0x400>;
772 interrupts = <9>; 786 interrupts = <9>;
773 clocks = <&apb1_gates 2>; 787 clocks = <&apb1_gates 2>;
774 clock-frequency = <100000>;
775 status = "disabled"; 788 status = "disabled";
776 #address-cells = <1>; 789 #address-cells = <1>;
777 #size-cells = <0>; 790 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index 24b0ad3a7c07..d73a2287b37a 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -300,12 +300,22 @@
300 #size-cells = <1>; 300 #size-cells = <1>;
301 ranges; 301 ranges;
302 302
303 dma: dma-controller@01c02000 {
304 compatible = "allwinner,sun4i-a10-dma";
305 reg = <0x01c02000 0x1000>;
306 interrupts = <27>;
307 clocks = <&ahb_gates 6>;
308 #dma-cells = <2>;
309 };
310
303 spi0: spi@01c05000 { 311 spi0: spi@01c05000 {
304 compatible = "allwinner,sun4i-a10-spi"; 312 compatible = "allwinner,sun4i-a10-spi";
305 reg = <0x01c05000 0x1000>; 313 reg = <0x01c05000 0x1000>;
306 interrupts = <10>; 314 interrupts = <10>;
307 clocks = <&ahb_gates 20>, <&spi0_clk>; 315 clocks = <&ahb_gates 20>, <&spi0_clk>;
308 clock-names = "ahb", "mod"; 316 clock-names = "ahb", "mod";
317 dmas = <&dma 1 27>, <&dma 1 26>;
318 dma-names = "rx", "tx";
309 status = "disabled"; 319 status = "disabled";
310 #address-cells = <1>; 320 #address-cells = <1>;
311 #size-cells = <0>; 321 #size-cells = <0>;
@@ -317,6 +327,8 @@
317 interrupts = <11>; 327 interrupts = <11>;
318 clocks = <&ahb_gates 21>, <&spi1_clk>; 328 clocks = <&ahb_gates 21>, <&spi1_clk>;
319 clock-names = "ahb", "mod"; 329 clock-names = "ahb", "mod";
330 dmas = <&dma 1 9>, <&dma 1 8>;
331 dma-names = "rx", "tx";
320 status = "disabled"; 332 status = "disabled";
321 #address-cells = <1>; 333 #address-cells = <1>;
322 #size-cells = <0>; 334 #size-cells = <0>;
@@ -403,6 +415,8 @@
403 interrupts = <12>; 415 interrupts = <12>;
404 clocks = <&ahb_gates 22>, <&spi2_clk>; 416 clocks = <&ahb_gates 22>, <&spi2_clk>;
405 clock-names = "ahb", "mod"; 417 clock-names = "ahb", "mod";
418 dmas = <&dma 1 29>, <&dma 1 28>;
419 dma-names = "rx", "tx";
406 status = "disabled"; 420 status = "disabled";
407 #address-cells = <1>; 421 #address-cells = <1>;
408 #size-cells = <0>; 422 #size-cells = <0>;
@@ -564,7 +578,6 @@
564 reg = <0x01c2ac00 0x400>; 578 reg = <0x01c2ac00 0x400>;
565 interrupts = <7>; 579 interrupts = <7>;
566 clocks = <&apb1_gates 0>; 580 clocks = <&apb1_gates 0>;
567 clock-frequency = <100000>;
568 status = "disabled"; 581 status = "disabled";
569 }; 582 };
570 583
@@ -575,7 +588,6 @@
575 reg = <0x01c2b000 0x400>; 588 reg = <0x01c2b000 0x400>;
576 interrupts = <8>; 589 interrupts = <8>;
577 clocks = <&apb1_gates 1>; 590 clocks = <&apb1_gates 1>;
578 clock-frequency = <100000>;
579 status = "disabled"; 591 status = "disabled";
580 }; 592 };
581 593
@@ -586,7 +598,6 @@
586 reg = <0x01c2b400 0x400>; 598 reg = <0x01c2b400 0x400>;
587 interrupts = <9>; 599 interrupts = <9>;
588 clocks = <&apb1_gates 2>; 600 clocks = <&apb1_gates 2>;
589 clock-frequency = <100000>;
590 status = "disabled"; 601 status = "disabled";
591 }; 602 };
592 603
diff --git a/arch/arm/boot/dts/sun5i-a13-hsg-h702.dts b/arch/arm/boot/dts/sun5i-a13-hsg-h702.dts
new file mode 100644
index 000000000000..8b3cd0907b32
--- /dev/null
+++ b/arch/arm/boot/dts/sun5i-a13-hsg-h702.dts
@@ -0,0 +1,130 @@
1/*
2 * Copyright 2014 Chen-Yu Tsai <wens@csie.org>
3 *
4 * This file is dual-licensed: you can use it either under the terms
5 * of the GPL or the X11 license, at your option. Note that this dual
6 * licensing only applies to this file, and not this project as a
7 * whole.
8 *
9 * a) This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this library; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 * MA 02110-1301 USA
23 *
24 * Or, alternatively,
25 *
26 * b) Permission is hereby granted, free of charge, to any person
27 * obtaining a copy of this software and associated documentation
28 * files (the "Software"), to deal in the Software without
29 * restriction, including without limitation the rights to use,
30 * copy, modify, merge, publish, distribute, sublicense, and/or
31 * sell copies of the Software, and to permit persons to whom the
32 * Software is furnished to do so, subject to the following
33 * conditions:
34 *
35 * The above copyright notice and this permission notice shall be
36 * included in all copies or substantial portions of the Software.
37 *
38 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
39 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
40 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
41 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
42 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
44 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45 * OTHER DEALINGS IN THE SOFTWARE.
46 */
47
48/dts-v1/;
49/include/ "sun5i-a13.dtsi"
50/include/ "sunxi-common-regulators.dtsi"
51
52/ {
53 model = "HSG H702";
54 compatible = "hsg,h702", "allwinner,sun5i-a13";
55
56 soc@01c00000 {
57 mmc0: mmc@01c0f000 {
58 pinctrl-names = "default";
59 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_h702>;
60 vmmc-supply = <&reg_vcc3v3>;
61 bus-width = <4>;
62 cd-gpios = <&pio 6 0 0>; /* PG0 */
63 cd-inverted;
64 status = "okay";
65 };
66
67 usbphy: phy@01c13400 {
68 /*
69 * There doesn't seem to be a GPIO for controlling
70 * usb1 vbus, despite the fex file saying otherwise.
71 */
72 usb1_vbus-supply = <&reg_vcc5v0>;
73 status = "okay";
74 };
75
76 ehci0: usb@01c14000 {
77 status = "okay";
78 };
79
80 ohci0: usb@01c14400 {
81 status = "okay";
82 };
83
84 pinctrl@01c20800 {
85 mmc0_cd_pin_h702: mmc0_cd_pin@0 {
86 allwinner,pins = "PG0";
87 allwinner,function = "gpio_in";
88 allwinner,drive = <0>;
89 allwinner,pull = <1>;
90 };
91 };
92
93 uart1: serial@01c28400 {
94 pinctrl-names = "default";
95 pinctrl-0 = <&uart1_pins_b>;
96 status = "okay";
97 };
98
99 i2c0: i2c@01c2ac00 {
100 pinctrl-names = "default";
101 pinctrl-0 = <&i2c0_pins_a>;
102 status = "okay";
103
104 axp209: pmic@34 {
105 compatible = "x-powers,axp209";
106 reg = <0x34>;
107 interrupts = <0>;
108 interrupt-controller;
109 #interrupt-cells = <1>;
110 };
111 };
112
113 i2c1: i2c@01c2b000 {
114 pinctrl-names = "default";
115 pinctrl-0 = <&i2c1_pins_a>;
116 status = "okay";
117
118 pcf8563: rtc@51 {
119 compatible = "nxp,pcf8563";
120 reg = <0x51>;
121 };
122 };
123
124 i2c2: i2c@01c2b400 {
125 pinctrl-names = "default";
126 pinctrl-0 = <&i2c2_pins_a>;
127 status = "okay";
128 };
129 };
130};
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index bf86e65dd167..c4b5d7825b9f 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -298,12 +298,22 @@
298 #size-cells = <1>; 298 #size-cells = <1>;
299 ranges; 299 ranges;
300 300
301 dma: dma-controller@01c02000 {
302 compatible = "allwinner,sun4i-a10-dma";
303 reg = <0x01c02000 0x1000>;
304 interrupts = <27>;
305 clocks = <&ahb_gates 6>;
306 #dma-cells = <2>;
307 };
308
301 spi0: spi@01c05000 { 309 spi0: spi@01c05000 {
302 compatible = "allwinner,sun4i-a10-spi"; 310 compatible = "allwinner,sun4i-a10-spi";
303 reg = <0x01c05000 0x1000>; 311 reg = <0x01c05000 0x1000>;
304 interrupts = <10>; 312 interrupts = <10>;
305 clocks = <&ahb_gates 20>, <&spi0_clk>; 313 clocks = <&ahb_gates 20>, <&spi0_clk>;
306 clock-names = "ahb", "mod"; 314 clock-names = "ahb", "mod";
315 dmas = <&dma 1 27>, <&dma 1 26>;
316 dma-names = "rx", "tx";
307 status = "disabled"; 317 status = "disabled";
308 #address-cells = <1>; 318 #address-cells = <1>;
309 #size-cells = <0>; 319 #size-cells = <0>;
@@ -315,6 +325,8 @@
315 interrupts = <11>; 325 interrupts = <11>;
316 clocks = <&ahb_gates 21>, <&spi1_clk>; 326 clocks = <&ahb_gates 21>, <&spi1_clk>;
317 clock-names = "ahb", "mod"; 327 clock-names = "ahb", "mod";
328 dmas = <&dma 1 9>, <&dma 1 8>;
329 dma-names = "rx", "tx";
318 status = "disabled"; 330 status = "disabled";
319 #address-cells = <1>; 331 #address-cells = <1>;
320 #size-cells = <0>; 332 #size-cells = <0>;
@@ -376,6 +388,8 @@
376 interrupts = <12>; 388 interrupts = <12>;
377 clocks = <&ahb_gates 22>, <&spi2_clk>; 389 clocks = <&ahb_gates 22>, <&spi2_clk>;
378 clock-names = "ahb", "mod"; 390 clock-names = "ahb", "mod";
391 dmas = <&dma 1 29>, <&dma 1 28>;
392 dma-names = "rx", "tx";
379 status = "disabled"; 393 status = "disabled";
380 #address-cells = <1>; 394 #address-cells = <1>;
381 #size-cells = <0>; 395 #size-cells = <0>;
@@ -490,7 +504,6 @@
490 reg = <0x01c2ac00 0x400>; 504 reg = <0x01c2ac00 0x400>;
491 interrupts = <7>; 505 interrupts = <7>;
492 clocks = <&apb1_gates 0>; 506 clocks = <&apb1_gates 0>;
493 clock-frequency = <100000>;
494 status = "disabled"; 507 status = "disabled";
495 #address-cells = <1>; 508 #address-cells = <1>;
496 #size-cells = <0>; 509 #size-cells = <0>;
@@ -501,7 +514,6 @@
501 reg = <0x01c2b000 0x400>; 514 reg = <0x01c2b000 0x400>;
502 interrupts = <8>; 515 interrupts = <8>;
503 clocks = <&apb1_gates 1>; 516 clocks = <&apb1_gates 1>;
504 clock-frequency = <100000>;
505 status = "disabled"; 517 status = "disabled";
506 #address-cells = <1>; 518 #address-cells = <1>;
507 #size-cells = <0>; 519 #size-cells = <0>;
@@ -512,7 +524,6 @@
512 reg = <0x01c2b400 0x400>; 524 reg = <0x01c2b400 0x400>;
513 interrupts = <9>; 525 interrupts = <9>;
514 clocks = <&apb1_gates 2>; 526 clocks = <&apb1_gates 2>;
515 clock-frequency = <100000>;
516 status = "disabled"; 527 status = "disabled";
517 #address-cells = <1>; 528 #address-cells = <1>;
518 #size-cells = <0>; 529 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 44b07e512c24..543f895d18d3 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -3,12 +3,48 @@
3 * 3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com> 4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * This file is dual-licensed: you can use it either under the terms
7 * License. You may obtain a copy of the GNU General Public License 7 * of the GPL or the X11 license, at your option. Note that this dual
8 * Version 2 or later at the following locations: 8 * licensing only applies to this file, and not this project as a
9 * whole.
9 * 10 *
10 * http://www.opensource.org/licenses/gpl-license.html 11 * a) This library is free software; you can redistribute it and/or
11 * http://www.gnu.org/copyleft/gpl.html 12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version.
15 *
16 * This library 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
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 * MA 02110-1301 USA
25 *
26 * Or, alternatively,
27 *
28 * b) Permission is hereby granted, free of charge, to any person
29 * obtaining a copy of this software and associated documentation
30 * files (the "Software"), to deal in the Software without
31 * restriction, including without limitation the rights to use,
32 * copy, modify, merge, publish, distribute, sublicense, and/or
33 * sell copies of the Software, and to permit persons to whom the
34 * Software is furnished to do so, subject to the following
35 * conditions:
36 *
37 * The above copyright notice and this permission notice shall be
38 * included in all copies or substantial portions of the Software.
39 *
40 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
42 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
44 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 * OTHER DEALINGS IN THE SOFTWARE.
12 */ 48 */
13 49
14/include/ "skeleton.dtsi" 50/include/ "skeleton.dtsi"
@@ -657,9 +693,10 @@
657 reg = <0x01c2ac00 0x400>; 693 reg = <0x01c2ac00 0x400>;
658 interrupts = <0 6 4>; 694 interrupts = <0 6 4>;
659 clocks = <&apb2_gates 0>; 695 clocks = <&apb2_gates 0>;
660 clock-frequency = <100000>;
661 resets = <&apb2_rst 0>; 696 resets = <&apb2_rst 0>;
662 status = "disabled"; 697 status = "disabled";
698 #address-cells = <1>;
699 #size-cells = <0>;
663 }; 700 };
664 701
665 i2c1: i2c@01c2b000 { 702 i2c1: i2c@01c2b000 {
@@ -667,9 +704,10 @@
667 reg = <0x01c2b000 0x400>; 704 reg = <0x01c2b000 0x400>;
668 interrupts = <0 7 4>; 705 interrupts = <0 7 4>;
669 clocks = <&apb2_gates 1>; 706 clocks = <&apb2_gates 1>;
670 clock-frequency = <100000>;
671 resets = <&apb2_rst 1>; 707 resets = <&apb2_rst 1>;
672 status = "disabled"; 708 status = "disabled";
709 #address-cells = <1>;
710 #size-cells = <0>;
673 }; 711 };
674 712
675 i2c2: i2c@01c2b400 { 713 i2c2: i2c@01c2b400 {
@@ -677,9 +715,10 @@
677 reg = <0x01c2b400 0x400>; 715 reg = <0x01c2b400 0x400>;
678 interrupts = <0 8 4>; 716 interrupts = <0 8 4>;
679 clocks = <&apb2_gates 2>; 717 clocks = <&apb2_gates 2>;
680 clock-frequency = <100000>;
681 resets = <&apb2_rst 2>; 718 resets = <&apb2_rst 2>;
682 status = "disabled"; 719 status = "disabled";
720 #address-cells = <1>;
721 #size-cells = <0>;
683 }; 722 };
684 723
685 i2c3: i2c@01c2b800 { 724 i2c3: i2c@01c2b800 {
@@ -687,9 +726,10 @@
687 reg = <0x01c2b800 0x400>; 726 reg = <0x01c2b800 0x400>;
688 interrupts = <0 9 4>; 727 interrupts = <0 9 4>;
689 clocks = <&apb2_gates 3>; 728 clocks = <&apb2_gates 3>;
690 clock-frequency = <100000>;
691 resets = <&apb2_rst 3>; 729 resets = <&apb2_rst 3>;
692 status = "disabled"; 730 status = "disabled";
731 #address-cells = <1>;
732 #size-cells = <0>;
693 }; 733 };
694 734
695 gmac: ethernet@01c30000 { 735 gmac: ethernet@01c30000 {
@@ -779,6 +819,12 @@
779 interrupts = <1 9 0xf04>; 819 interrupts = <1 9 0xf04>;
780 }; 820 };
781 821
822 rtc: rtc@01f00000 {
823 compatible = "allwinner,sun6i-a31-rtc";
824 reg = <0x01f00000 0x54>;
825 interrupts = <0 40 4>, <0 41 4>;
826 };
827
782 nmi_intc: interrupt-controller@01f00c0c { 828 nmi_intc: interrupt-controller@01f00c0c {
783 compatible = "allwinner,sun6i-a31-sc-nmi"; 829 compatible = "allwinner,sun6i-a31-sc-nmi";
784 interrupt-controller; 830 interrupt-controller;
diff --git a/arch/arm/boot/dts/sun7i-a20-hummingbird.dts b/arch/arm/boot/dts/sun7i-a20-hummingbird.dts
new file mode 100644
index 000000000000..0e4bfa3b2b85
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-hummingbird.dts
@@ -0,0 +1,236 @@
1/*
2 * Copyright 2013 Wills Wang
3 *
4 * Wills Wang <wills.wang.open@gmail.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/ "sun7i-a20.dtsi"
16/include/ "sunxi-common-regulators.dtsi"
17
18/ {
19 model = "Merrii A20 Hummingbird";
20 compatible = "merrii,a20-hummingbird", "allwinner,sun7i-a20";
21
22 soc@01c00000 {
23 mmc0: mmc@01c0f000 {
24 pinctrl-names = "default";
25 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
26 vmmc-supply = <&reg_vcc3v0>;
27 bus-width = <4>;
28 cd-gpios = <&pio 7 1 0>; /* PH1 */
29 cd-inverted;
30 status = "okay";
31 };
32
33 mmc3: mmc@01c12000 {
34 pinctrl-names = "default";
35 pinctrl-0 = <&mmc3_pins_a>;
36 vmmc-supply = <&reg_mmc3_vdd>;
37 bus-width = <4>;
38 non-removable;
39 status = "okay";
40 };
41
42 usbphy: phy@01c13400 {
43 usb1_vbus-supply = <&reg_usb1_vbus>;
44 usb2_vbus-supply = <&reg_usb2_vbus>;
45 status = "okay";
46 };
47
48 ehci0: usb@01c14000 {
49 status = "okay";
50 };
51
52 ohci0: usb@01c14400 {
53 status = "okay";
54 };
55
56 ahci: sata@01c18000 {
57 target-supply = <&reg_ahci_5v>;
58 status = "okay";
59 };
60
61 ehci1: usb@01c1c000 {
62 status = "okay";
63 };
64
65 ohci1: usb@01c1c400 {
66 status = "okay";
67 };
68
69 pio: pinctrl@01c20800 {
70 ahci_pwr_pin_a20_hummingbird: ahci_pwr_pin@0 {
71 allwinner,pins = "PH15";
72 allwinner,function = "gpio_out";
73 allwinner,drive = <0>;
74 allwinner,pull = <0>;
75 };
76
77 usb1_vbus_pin_a20_hummingbird: usb1_vbus_pin@0 {
78 allwinner,pins = "PH2";
79 allwinner,function = "gpio_out";
80 allwinner,drive = <0>;
81 allwinner,pull = <0>;
82 };
83
84 mmc3_vdd_pin_a20_hummingbird: mmc3_vdd_pin@0 {
85 allwinner,pins = "PH9";
86 allwinner,function = "gpio_out";
87 allwinner,drive = <0>;
88 allwinner,pull = <0>;
89 };
90
91 gmac_vdd_pin_a20_hummingbird: gmac_vdd_pin@0 {
92 allwinner,pins = "PH16";
93 allwinner,function = "gpio_out";
94 allwinner,drive = <0>;
95 allwinner,pull = <0>;
96 };
97 };
98
99 pwm: pwm@01c20e00 {
100 pinctrl-names = "default";
101 pinctrl-0 = <&pwm0_pins_a>;
102 status = "okay";
103 };
104
105 ir0: ir@01c21800 {
106 pinctrl-names = "default";
107 pinctrl-0 = <&ir0_pins_a>;
108 status = "okay";
109 };
110
111 uart0: serial@01c28000 {
112 pinctrl-names = "default";
113 pinctrl-0 = <&uart0_pins_a>;
114 status = "okay";
115 };
116
117 uart2: serial@01c28800 {
118 pinctrl-names = "default";
119 pinctrl-0 = <&uart2_pins_a>;
120 status = "okay";
121 };
122
123 uart3: serial@01c28c00 {
124 pinctrl-names = "default";
125 pinctrl-0 = <&uart3_pins_a>;
126 status = "okay";
127 };
128
129 uart4: serial@01c29000 {
130 pinctrl-names = "default";
131 pinctrl-0 = <&uart4_pins_a>;
132 status = "okay";
133 };
134
135 uart5: serial@01c29400 {
136 pinctrl-names = "default";
137 pinctrl-0 = <&uart5_pins_a>;
138 status = "okay";
139 };
140
141 i2c0: i2c@01c2ac00 {
142 pinctrl-names = "default";
143 pinctrl-0 = <&i2c0_pins_a>;
144 status = "okay";
145
146 axp209: pmic@34 {
147 compatible = "x-powers,axp209";
148 reg = <0x34>;
149 interrupt-parent = <&nmi_intc>;
150 interrupts = <0 8>;
151 interrupt-controller;
152 #interrupt-cells = <1>;
153 };
154 };
155
156 i2c1: i2c@01c2b000 {
157 pinctrl-names = "default";
158 pinctrl-0 = <&i2c1_pins_a>;
159 status = "okay";
160 };
161
162 i2c2: i2c@01c2b400 {
163 pinctrl-names = "default";
164 pinctrl-0 = <&i2c2_pins_a>;
165 status = "okay";
166 };
167
168 i2c3: i2c@01c2b800 {
169 pinctrl-names = "default";
170 pinctrl-0 = <&i2c3_pins_a>;
171 status = "okay";
172 };
173
174 spi2: spi@01c17000 {
175 pinctrl-names = "default";
176 pinctrl-0 = <&spi2_pins_b>;
177 status = "okay";
178 };
179
180 gmac: ethernet@01c50000 {
181 pinctrl-names = "default";
182 pinctrl-0 = <&gmac_pins_rgmii_a>;
183 phy = <&phy1>;
184 phy-mode = "rgmii";
185 phy-supply = <&reg_gmac_vdd>;
186 /* phy reset config */
187 snps,reset-gpio = <&pio 0 17 0>; /* PA17 */
188 snps,reset-active-low;
189 /* wait 1s after reset, otherwise fail to read phy id */
190 snps,reset-delays-us = <0 10000 1000000>;
191 status = "okay";
192
193 phy1: ethernet-phy@1 {
194 reg = <1>;
195 };
196 };
197 };
198
199 reg_ahci_5v: ahci-5v {
200 pinctrl-0 = <&ahci_pwr_pin_a20_hummingbird>;
201 gpio = <&pio 7 15 0>; /* PH15 */
202 status = "okay";
203 };
204
205 reg_usb1_vbus: usb1-vbus {
206 pinctrl-0 = <&usb1_vbus_pin_a20_hummingbird>;
207 gpio = <&pio 7 2 0>; /* PH2 */
208 status = "okay";
209 };
210
211 reg_usb2_vbus: usb2-vbus {
212 status = "okay";
213 };
214
215 reg_mmc3_vdd: mmc3_vdd {
216 compatible = "regulator-fixed";
217 pinctrl-names = "default";
218 pinctrl-0 = <&mmc3_vdd_pin_a20_hummingbird>;
219 regulator-name = "mmc3_vdd";
220 regulator-min-microvolt = <3000000>;
221 regulator-max-microvolt = <3000000>;
222 enable-active-high;
223 gpio = <&pio 7 9 0>; /* PH9 */
224 };
225
226 reg_gmac_vdd: gmac_vdd {
227 compatible = "regulator-fixed";
228 pinctrl-names = "default";
229 pinctrl-0 = <&gmac_vdd_pin_a20_hummingbird>;
230 regulator-name = "gmac_vdd";
231 regulator-min-microvolt = <3000000>;
232 regulator-max-microvolt = <3000000>;
233 enable-active-high;
234 gpio = <&pio 7 16 0>; /* PH16 */
235 };
236};
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts
new file mode 100644
index 000000000000..1eb8175959a6
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts
@@ -0,0 +1,137 @@
1/*
2 * This is based on sun4i-a10-olinuxino-lime.dts
3 *
4 * Copyright 2014 - Hans de Goede <hdegoede@redhat.com>
5 * Copyright (c) 2014 FUKAUMI Naoki <naobsd@gmail.com>
6 *
7 * The code contained herein is licensed under the GNU General Public
8 * License. You may obtain a copy of the GNU General Public License
9 * Version 2 or later at the following locations:
10 *
11 * http://www.opensource.org/licenses/gpl-license.html
12 * http://www.gnu.org/copyleft/gpl.html
13 */
14
15/dts-v1/;
16/include/ "sun7i-a20.dtsi"
17/include/ "sunxi-common-regulators.dtsi"
18
19/ {
20 model = "Olimex A20-OLinuXino-LIME";
21 compatible = "olimex,a20-olinuxino-lime", "allwinner,sun7i-a20";
22
23 soc@01c00000 {
24 mmc0: mmc@01c0f000 {
25 pinctrl-names = "default";
26 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
27 vmmc-supply = <&reg_vcc3v3>;
28 bus-width = <4>;
29 cd-gpios = <&pio 7 1 0>; /* PH1 */
30 cd-inverted;
31 status = "okay";
32 };
33
34 usbphy: phy@01c13400 {
35 usb1_vbus-supply = <&reg_usb1_vbus>;
36 usb2_vbus-supply = <&reg_usb2_vbus>;
37 status = "okay";
38 };
39
40 ehci0: usb@01c14000 {
41 status = "okay";
42 };
43
44 ohci0: usb@01c14400 {
45 status = "okay";
46 };
47
48 ahci: sata@01c18000 {
49 target-supply = <&reg_ahci_5v>;
50 status = "okay";
51 };
52
53 ehci1: usb@01c1c000 {
54 status = "okay";
55 };
56
57 ohci1: usb@01c1c400 {
58 status = "okay";
59 };
60
61 pinctrl@01c20800 {
62 ahci_pwr_pin_olinuxinolime: ahci_pwr_pin@1 {
63 allwinner,pins = "PC3";
64 allwinner,function = "gpio_out";
65 allwinner,drive = <0>;
66 allwinner,pull = <0>;
67 };
68
69 led_pins_olinuxinolime: led_pins@0 {
70 allwinner,pins = "PH2";
71 allwinner,function = "gpio_out";
72 allwinner,drive = <1>;
73 allwinner,pull = <0>;
74 };
75 };
76
77 uart0: serial@01c28000 {
78 pinctrl-names = "default";
79 pinctrl-0 = <&uart0_pins_a>;
80 status = "okay";
81 };
82
83 i2c0: i2c@01c2ac00 {
84 pinctrl-names = "default";
85 pinctrl-0 = <&i2c0_pins_a>;
86 status = "okay";
87
88 axp209: pmic@34 {
89 compatible = "x-powers,axp209";
90 reg = <0x34>;
91 interrupt-parent = <&nmi_intc>;
92 interrupts = <0 8>;
93
94 interrupt-controller;
95 #interrupt-cells = <1>;
96 };
97 };
98
99 gmac: ethernet@01c50000 {
100 pinctrl-names = "default";
101 pinctrl-0 = <&gmac_pins_mii_a>;
102 phy = <&phy1>;
103 phy-mode = "mii";
104 status = "okay";
105
106 phy1: ethernet-phy@1 {
107 reg = <1>;
108 };
109 };
110 };
111
112 leds {
113 compatible = "gpio-leds";
114 pinctrl-names = "default";
115 pinctrl-0 = <&led_pins_olinuxinolime>;
116
117 green {
118 label = "a20-olinuxino-lime:green:usr";
119 gpios = <&pio 7 2 0>;
120 default-state = "on";
121 };
122 };
123
124 reg_ahci_5v: ahci-5v {
125 pinctrl-0 = <&ahci_pwr_pin_olinuxinolime>;
126 gpio = <&pio 2 3 0>;
127 status = "okay";
128 };
129
130 reg_usb1_vbus: usb1-vbus {
131 status = "okay";
132 };
133
134 reg_usb2_vbus: usb2-vbus {
135 status = "okay";
136 };
137};
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 4011628c7381..a96b99465069 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -3,12 +3,48 @@
3 * 3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com> 4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * This file is dual-licensed: you can use it either under the terms
7 * License. You may obtain a copy of the GNU General Public License 7 * of the GPL or the X11 license, at your option. Note that this dual
8 * Version 2 or later at the following locations: 8 * licensing only applies to this file, and not this project as a
9 * whole.
9 * 10 *
10 * http://www.opensource.org/licenses/gpl-license.html 11 * a) This library is free software; you can redistribute it and/or
11 * http://www.gnu.org/copyleft/gpl.html 12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version.
15 *
16 * This library 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
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 * MA 02110-1301 USA
25 *
26 * Or, alternatively,
27 *
28 * b) Permission is hereby granted, free of charge, to any person
29 * obtaining a copy of this software and associated documentation
30 * files (the "Software"), to deal in the Software without
31 * restriction, including without limitation the rights to use,
32 * copy, modify, merge, publish, distribute, sublicense, and/or
33 * sell copies of the Software, and to permit persons to whom the
34 * Software is furnished to do so, subject to the following
35 * conditions:
36 *
37 * The above copyright notice and this permission notice shall be
38 * included in all copies or substantial portions of the Software.
39 *
40 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
42 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
44 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 * OTHER DEALINGS IN THE SOFTWARE.
12 */ 48 */
13 49
14/include/ "skeleton.dtsi" 50/include/ "skeleton.dtsi"
@@ -423,12 +459,22 @@
423 interrupts = <0 0 4>; 459 interrupts = <0 0 4>;
424 }; 460 };
425 461
462 dma: dma-controller@01c02000 {
463 compatible = "allwinner,sun4i-a10-dma";
464 reg = <0x01c02000 0x1000>;
465 interrupts = <0 27 4>;
466 clocks = <&ahb_gates 6>;
467 #dma-cells = <2>;
468 };
469
426 spi0: spi@01c05000 { 470 spi0: spi@01c05000 {
427 compatible = "allwinner,sun4i-a10-spi"; 471 compatible = "allwinner,sun4i-a10-spi";
428 reg = <0x01c05000 0x1000>; 472 reg = <0x01c05000 0x1000>;
429 interrupts = <0 10 4>; 473 interrupts = <0 10 4>;
430 clocks = <&ahb_gates 20>, <&spi0_clk>; 474 clocks = <&ahb_gates 20>, <&spi0_clk>;
431 clock-names = "ahb", "mod"; 475 clock-names = "ahb", "mod";
476 dmas = <&dma 1 27>, <&dma 1 26>;
477 dma-names = "rx", "tx";
432 status = "disabled"; 478 status = "disabled";
433 #address-cells = <1>; 479 #address-cells = <1>;
434 #size-cells = <0>; 480 #size-cells = <0>;
@@ -440,6 +486,8 @@
440 interrupts = <0 11 4>; 486 interrupts = <0 11 4>;
441 clocks = <&ahb_gates 21>, <&spi1_clk>; 487 clocks = <&ahb_gates 21>, <&spi1_clk>;
442 clock-names = "ahb", "mod"; 488 clock-names = "ahb", "mod";
489 dmas = <&dma 1 9>, <&dma 1 8>;
490 dma-names = "rx", "tx";
443 status = "disabled"; 491 status = "disabled";
444 #address-cells = <1>; 492 #address-cells = <1>;
445 #size-cells = <0>; 493 #size-cells = <0>;
@@ -535,6 +583,8 @@
535 interrupts = <0 12 4>; 583 interrupts = <0 12 4>;
536 clocks = <&ahb_gates 22>, <&spi2_clk>; 584 clocks = <&ahb_gates 22>, <&spi2_clk>;
537 clock-names = "ahb", "mod"; 585 clock-names = "ahb", "mod";
586 dmas = <&dma 1 29>, <&dma 1 28>;
587 dma-names = "rx", "tx";
538 status = "disabled"; 588 status = "disabled";
539 #address-cells = <1>; 589 #address-cells = <1>;
540 #size-cells = <0>; 590 #size-cells = <0>;
@@ -574,6 +624,8 @@
574 interrupts = <0 50 4>; 624 interrupts = <0 50 4>;
575 clocks = <&ahb_gates 23>, <&spi3_clk>; 625 clocks = <&ahb_gates 23>, <&spi3_clk>;
576 clock-names = "ahb", "mod"; 626 clock-names = "ahb", "mod";
627 dmas = <&dma 1 31>, <&dma 1 30>;
628 dma-names = "rx", "tx";
577 status = "disabled"; 629 status = "disabled";
578 #address-cells = <1>; 630 #address-cells = <1>;
579 #size-cells = <0>; 631 #size-cells = <0>;
@@ -618,6 +670,27 @@
618 allwinner,pull = <0>; 670 allwinner,pull = <0>;
619 }; 671 };
620 672
673 uart3_pins_a: uart3@0 {
674 allwinner,pins = "PG6", "PG7", "PG8", "PG9";
675 allwinner,function = "uart3";
676 allwinner,drive = <0>;
677 allwinner,pull = <0>;
678 };
679
680 uart4_pins_a: uart4@0 {
681 allwinner,pins = "PG10", "PG11";
682 allwinner,function = "uart4";
683 allwinner,drive = <0>;
684 allwinner,pull = <0>;
685 };
686
687 uart5_pins_a: uart5@0 {
688 allwinner,pins = "PI10", "PI11";
689 allwinner,function = "uart5";
690 allwinner,drive = <0>;
691 allwinner,pull = <0>;
692 };
693
621 uart6_pins_a: uart6@0 { 694 uart6_pins_a: uart6@0 {
622 allwinner,pins = "PI12", "PI13"; 695 allwinner,pins = "PI12", "PI13";
623 allwinner,function = "uart6"; 696 allwinner,function = "uart6";
@@ -653,6 +726,13 @@
653 allwinner,pull = <0>; 726 allwinner,pull = <0>;
654 }; 727 };
655 728
729 i2c3_pins_a: i2c3@0 {
730 allwinner,pins = "PI0", "PI1";
731 allwinner,function = "i2c3";
732 allwinner,drive = <0>;
733 allwinner,pull = <0>;
734 };
735
656 emac_pins_a: emac0@0 { 736 emac_pins_a: emac0@0 {
657 allwinner,pins = "PA0", "PA1", "PA2", 737 allwinner,pins = "PA0", "PA1", "PA2",
658 "PA3", "PA4", "PA5", "PA6", 738 "PA3", "PA4", "PA5", "PA6",
@@ -718,6 +798,13 @@
718 allwinner,pull = <0>; 798 allwinner,pull = <0>;
719 }; 799 };
720 800
801 spi2_pins_b: spi2@1 {
802 allwinner,pins = "PB14", "PB15", "PB16", "PB17";
803 allwinner,function = "spi2";
804 allwinner,drive = <0>;
805 allwinner,pull = <0>;
806 };
807
721 mmc0_pins_a: mmc0@0 { 808 mmc0_pins_a: mmc0@0 {
722 allwinner,pins = "PF0","PF1","PF2","PF3","PF4","PF5"; 809 allwinner,pins = "PF0","PF1","PF2","PF3","PF4","PF5";
723 allwinner,function = "mmc0"; 810 allwinner,function = "mmc0";
@@ -899,7 +986,6 @@
899 reg = <0x01c2ac00 0x400>; 986 reg = <0x01c2ac00 0x400>;
900 interrupts = <0 7 4>; 987 interrupts = <0 7 4>;
901 clocks = <&apb1_gates 0>; 988 clocks = <&apb1_gates 0>;
902 clock-frequency = <100000>;
903 status = "disabled"; 989 status = "disabled";
904 #address-cells = <1>; 990 #address-cells = <1>;
905 #size-cells = <0>; 991 #size-cells = <0>;
@@ -910,7 +996,6 @@
910 reg = <0x01c2b000 0x400>; 996 reg = <0x01c2b000 0x400>;
911 interrupts = <0 8 4>; 997 interrupts = <0 8 4>;
912 clocks = <&apb1_gates 1>; 998 clocks = <&apb1_gates 1>;
913 clock-frequency = <100000>;
914 status = "disabled"; 999 status = "disabled";
915 #address-cells = <1>; 1000 #address-cells = <1>;
916 #size-cells = <0>; 1001 #size-cells = <0>;
@@ -921,7 +1006,6 @@
921 reg = <0x01c2b400 0x400>; 1006 reg = <0x01c2b400 0x400>;
922 interrupts = <0 9 4>; 1007 interrupts = <0 9 4>;
923 clocks = <&apb1_gates 2>; 1008 clocks = <&apb1_gates 2>;
924 clock-frequency = <100000>;
925 status = "disabled"; 1009 status = "disabled";
926 #address-cells = <1>; 1010 #address-cells = <1>;
927 #size-cells = <0>; 1011 #size-cells = <0>;
@@ -932,7 +1016,6 @@
932 reg = <0x01c2b800 0x400>; 1016 reg = <0x01c2b800 0x400>;
933 interrupts = <0 88 4>; 1017 interrupts = <0 88 4>;
934 clocks = <&apb1_gates 3>; 1018 clocks = <&apb1_gates 3>;
935 clock-frequency = <100000>;
936 status = "disabled"; 1019 status = "disabled";
937 #address-cells = <1>; 1020 #address-cells = <1>;
938 #size-cells = <0>; 1021 #size-cells = <0>;
@@ -943,7 +1026,6 @@
943 reg = <0x01c2c000 0x400>; 1026 reg = <0x01c2c000 0x400>;
944 interrupts = <0 89 4>; 1027 interrupts = <0 89 4>;
945 clocks = <&apb1_gates 15>; 1028 clocks = <&apb1_gates 15>;
946 clock-frequency = <100000>;
947 status = "disabled"; 1029 status = "disabled";
948 #address-cells = <1>; 1030 #address-cells = <1>;
949 #size-cells = <0>; 1031 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts b/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts
index 34002e3eba9d..e9b8cca8dcc1 100644
--- a/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts
+++ b/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts
@@ -13,6 +13,7 @@
13 13
14/dts-v1/; 14/dts-v1/;
15/include/ "sun8i-a23.dtsi" 15/include/ "sun8i-a23.dtsi"
16/include/ "sunxi-common-regulators.dtsi"
16 17
17/ { 18/ {
18 model = "Ippo Q8H Dual Core Tablet (v5)"; 19 model = "Ippo Q8H Dual Core Tablet (v5)";
@@ -23,7 +24,47 @@
23 }; 24 };
24 25
25 soc@01c00000 { 26 soc@01c00000 {
27 mmc0: mmc@01c0f000 {
28 pinctrl-names = "default";
29 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_q8h>;
30 vmmc-supply = <&reg_vcc3v0>;
31 bus-width = <4>;
32 cd-gpios = <&pio 1 4 0>; /* PB4 */
33 cd-inverted;
34 status = "okay";
35 };
36
37 pinctrl@01c20800 {
38 mmc0_cd_pin_q8h: mmc0_cd_pin@0 {
39 allwinner,pins = "PB4";
40 allwinner,function = "gpio_in";
41 allwinner,drive = <0>;
42 allwinner,pull = <1>;
43 };
44 };
45
46 i2c0: i2c@01c2ac00 {
47 pinctrl-names = "default";
48 pinctrl-0 = <&i2c0_pins_a>;
49 status = "okay";
50 };
51
52 i2c1: i2c@01c2b000 {
53 pinctrl-names = "default";
54 pinctrl-0 = <&i2c1_pins_a>;
55 status = "okay";
56 };
57
58 i2c2: i2c@01c2b400 {
59 pinctrl-names = "default";
60 pinctrl-0 = <&i2c2_pins_a>;
61 /* pull-ups and devices require PMIC regulator */
62 status = "failed";
63 };
64
26 r_uart: serial@01f02800 { 65 r_uart: serial@01f02800 {
66 pinctrl-names = "default";
67 pinctrl-0 = <&r_uart_pins_a>;
27 status = "okay"; 68 status = "okay";
28 }; 69 };
29 }; 70 };
diff --git a/arch/arm/boot/dts/sun8i-a23.dtsi b/arch/arm/boot/dts/sun8i-a23.dtsi
index 54ac0787216a..6146ef15efbe 100644
--- a/arch/arm/boot/dts/sun8i-a23.dtsi
+++ b/arch/arm/boot/dts/sun8i-a23.dtsi
@@ -3,12 +3,48 @@
3 * 3 *
4 * Chen-Yu Tsai <wens@csie.org> 4 * Chen-Yu Tsai <wens@csie.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * This file is dual-licensed: you can use it either under the terms
7 * License. You may obtain a copy of the GNU General Public License 7 * of the GPL or the X11 license, at your option. Note that this dual
8 * Version 2 or later at the following locations: 8 * licensing only applies to this file, and not this project as a
9 * whole.
9 * 10 *
10 * http://www.opensource.org/licenses/gpl-license.html 11 * a) This library is free software; you can redistribute it and/or
11 * http://www.gnu.org/copyleft/gpl.html 12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version.
15 *
16 * This library 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
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 * MA 02110-1301 USA
25 *
26 * Or, alternatively,
27 *
28 * b) Permission is hereby granted, free of charge, to any person
29 * obtaining a copy of this software and associated documentation
30 * files (the "Software"), to deal in the Software without
31 * restriction, including without limitation the rights to use,
32 * copy, modify, merge, publish, distribute, sublicense, and/or
33 * sell copies of the Software, and to permit persons to whom the
34 * Software is furnished to do so, subject to the following
35 * conditions:
36 *
37 * The above copyright notice and this permission notice shall be
38 * included in all copies or substantial portions of the Software.
39 *
40 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
42 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
44 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 * OTHER DEALINGS IN THE SOFTWARE.
12 */ 48 */
13 49
14/include/ "skeleton.dtsi" 50/include/ "skeleton.dtsi"
@@ -179,6 +215,30 @@
179 "apb2_uart1", "apb2_uart2", 215 "apb2_uart1", "apb2_uart2",
180 "apb2_uart3", "apb2_uart4"; 216 "apb2_uart3", "apb2_uart4";
181 }; 217 };
218
219 mmc0_clk: clk@01c20088 {
220 #clock-cells = <0>;
221 compatible = "allwinner,sun4i-a10-mod0-clk";
222 reg = <0x01c20088 0x4>;
223 clocks = <&osc24M>, <&pll6>;
224 clock-output-names = "mmc0";
225 };
226
227 mmc1_clk: clk@01c2008c {
228 #clock-cells = <0>;
229 compatible = "allwinner,sun4i-a10-mod0-clk";
230 reg = <0x01c2008c 0x4>;
231 clocks = <&osc24M>, <&pll6>;
232 clock-output-names = "mmc1";
233 };
234
235 mmc2_clk: clk@01c20090 {
236 #clock-cells = <0>;
237 compatible = "allwinner,sun4i-a10-mod0-clk";
238 reg = <0x01c20090 0x4>;
239 clocks = <&osc24M>, <&pll6>;
240 clock-output-names = "mmc2";
241 };
182 }; 242 };
183 243
184 soc@01c00000 { 244 soc@01c00000 {
@@ -187,6 +247,104 @@
187 #size-cells = <1>; 247 #size-cells = <1>;
188 ranges; 248 ranges;
189 249
250 dma: dma-controller@01c02000 {
251 compatible = "allwinner,sun8i-a23-dma";
252 reg = <0x01c02000 0x1000>;
253 interrupts = <0 50 4>;
254 clocks = <&ahb1_gates 6>;
255 resets = <&ahb1_rst 6>;
256 #dma-cells = <1>;
257 };
258
259 mmc0: mmc@01c0f000 {
260 compatible = "allwinner,sun5i-a13-mmc";
261 reg = <0x01c0f000 0x1000>;
262 clocks = <&ahb1_gates 8>, <&mmc0_clk>;
263 clock-names = "ahb", "mmc";
264 resets = <&ahb1_rst 8>;
265 reset-names = "ahb";
266 interrupts = <0 60 4>;
267 status = "disabled";
268 };
269
270 mmc1: mmc@01c10000 {
271 compatible = "allwinner,sun5i-a13-mmc";
272 reg = <0x01c10000 0x1000>;
273 clocks = <&ahb1_gates 9>, <&mmc1_clk>;
274 clock-names = "ahb", "mmc";
275 resets = <&ahb1_rst 9>;
276 reset-names = "ahb";
277 interrupts = <0 61 4>;
278 status = "disabled";
279 };
280
281 mmc2: mmc@01c11000 {
282 compatible = "allwinner,sun5i-a13-mmc";
283 reg = <0x01c11000 0x1000>;
284 clocks = <&ahb1_gates 10>, <&mmc2_clk>;
285 clock-names = "ahb", "mmc";
286 resets = <&ahb1_rst 10>;
287 reset-names = "ahb";
288 interrupts = <0 62 4>;
289 status = "disabled";
290 };
291
292 pio: pinctrl@01c20800 {
293 compatible = "allwinner,sun8i-a23-pinctrl";
294 reg = <0x01c20800 0x400>;
295 interrupts = <0 11 4>,
296 <0 15 4>,
297 <0 17 4>;
298 clocks = <&apb1_gates 5>;
299 gpio-controller;
300 interrupt-controller;
301 #address-cells = <1>;
302 #size-cells = <0>;
303 #gpio-cells = <3>;
304
305 uart0_pins_a: uart0@0 {
306 allwinner,pins = "PF2", "PF4";
307 allwinner,function = "uart0";
308 allwinner,drive = <0>;
309 allwinner,pull = <0>;
310 };
311
312 mmc0_pins_a: mmc0@0 {
313 allwinner,pins = "PF0","PF1","PF2","PF3","PF4","PF5";
314 allwinner,function = "mmc0";
315 allwinner,drive = <2>;
316 allwinner,pull = <0>;
317 };
318
319 mmc1_pins_a: mmc1@0 {
320 allwinner,pins = "PG0","PG1","PG2","PG3","PG4","PG5";
321 allwinner,function = "mmc1";
322 allwinner,drive = <2>;
323 allwinner,pull = <0>;
324 };
325
326 i2c0_pins_a: i2c0@0 {
327 allwinner,pins = "PH2", "PH3";
328 allwinner,function = "i2c0";
329 allwinner,drive = <0>;
330 allwinner,pull = <0>;
331 };
332
333 i2c1_pins_a: i2c1@0 {
334 allwinner,pins = "PH4", "PH5";
335 allwinner,function = "i2c1";
336 allwinner,drive = <0>;
337 allwinner,pull = <0>;
338 };
339
340 i2c2_pins_a: i2c2@0 {
341 allwinner,pins = "PE12", "PE13";
342 allwinner,function = "i2c2";
343 allwinner,drive = <0>;
344 allwinner,pull = <0>;
345 };
346 };
347
190 ahb1_rst: reset@01c202c0 { 348 ahb1_rst: reset@01c202c0 {
191 #reset-cells = <1>; 349 #reset-cells = <1>;
192 compatible = "allwinner,sun6i-a31-clock-reset"; 350 compatible = "allwinner,sun6i-a31-clock-reset";
@@ -227,6 +385,8 @@
227 reg-io-width = <4>; 385 reg-io-width = <4>;
228 clocks = <&apb2_gates 16>; 386 clocks = <&apb2_gates 16>;
229 resets = <&apb2_rst 16>; 387 resets = <&apb2_rst 16>;
388 dmas = <&dma 6>, <&dma 6>;
389 dma-names = "rx", "tx";
230 status = "disabled"; 390 status = "disabled";
231 }; 391 };
232 392
@@ -238,6 +398,8 @@
238 reg-io-width = <4>; 398 reg-io-width = <4>;
239 clocks = <&apb2_gates 17>; 399 clocks = <&apb2_gates 17>;
240 resets = <&apb2_rst 17>; 400 resets = <&apb2_rst 17>;
401 dmas = <&dma 7>, <&dma 7>;
402 dma-names = "rx", "tx";
241 status = "disabled"; 403 status = "disabled";
242 }; 404 };
243 405
@@ -249,6 +411,8 @@
249 reg-io-width = <4>; 411 reg-io-width = <4>;
250 clocks = <&apb2_gates 18>; 412 clocks = <&apb2_gates 18>;
251 resets = <&apb2_rst 18>; 413 resets = <&apb2_rst 18>;
414 dmas = <&dma 8>, <&dma 8>;
415 dma-names = "rx", "tx";
252 status = "disabled"; 416 status = "disabled";
253 }; 417 };
254 418
@@ -260,6 +424,8 @@
260 reg-io-width = <4>; 424 reg-io-width = <4>;
261 clocks = <&apb2_gates 19>; 425 clocks = <&apb2_gates 19>;
262 resets = <&apb2_rst 19>; 426 resets = <&apb2_rst 19>;
427 dmas = <&dma 9>, <&dma 9>;
428 dma-names = "rx", "tx";
263 status = "disabled"; 429 status = "disabled";
264 }; 430 };
265 431
@@ -271,9 +437,44 @@
271 reg-io-width = <4>; 437 reg-io-width = <4>;
272 clocks = <&apb2_gates 20>; 438 clocks = <&apb2_gates 20>;
273 resets = <&apb2_rst 20>; 439 resets = <&apb2_rst 20>;
440 dmas = <&dma 10>, <&dma 10>;
441 dma-names = "rx", "tx";
274 status = "disabled"; 442 status = "disabled";
275 }; 443 };
276 444
445 i2c0: i2c@01c2ac00 {
446 compatible = "allwinner,sun6i-a31-i2c";
447 reg = <0x01c2ac00 0x400>;
448 interrupts = <0 6 4>;
449 clocks = <&apb2_gates 0>;
450 resets = <&apb2_rst 0>;
451 status = "disabled";
452 #address-cells = <1>;
453 #size-cells = <0>;
454 };
455
456 i2c1: i2c@01c2b000 {
457 compatible = "allwinner,sun6i-a31-i2c";
458 reg = <0x01c2b000 0x400>;
459 interrupts = <0 7 4>;
460 clocks = <&apb2_gates 1>;
461 resets = <&apb2_rst 1>;
462 status = "disabled";
463 #address-cells = <1>;
464 #size-cells = <0>;
465 };
466
467 i2c2: i2c@01c2b400 {
468 compatible = "allwinner,sun6i-a31-i2c";
469 reg = <0x01c2b400 0x400>;
470 interrupts = <0 8 4>;
471 clocks = <&apb2_gates 2>;
472 resets = <&apb2_rst 2>;
473 status = "disabled";
474 #address-cells = <1>;
475 #size-cells = <0>;
476 };
477
277 gic: interrupt-controller@01c81000 { 478 gic: interrupt-controller@01c81000 {
278 compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic"; 479 compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
279 reg = <0x01c81000 0x1000>, 480 reg = <0x01c81000 0x1000>,
@@ -285,6 +486,12 @@
285 interrupts = <1 9 0xf04>; 486 interrupts = <1 9 0xf04>;
286 }; 487 };
287 488
489 rtc: rtc@01f00000 {
490 compatible = "allwinner,sun6i-a31-rtc";
491 reg = <0x01f00000 0x54>;
492 interrupts = <0 40 4>, <0 41 4>;
493 };
494
288 prcm@01f01400 { 495 prcm@01f01400 {
289 compatible = "allwinner,sun8i-a23-prcm"; 496 compatible = "allwinner,sun8i-a23-prcm";
290 reg = <0x01f01400 0x200>; 497 reg = <0x01f01400 0x200>;
@@ -339,5 +546,25 @@
339 resets = <&apb0_rst 4>; 546 resets = <&apb0_rst 4>;
340 status = "disabled"; 547 status = "disabled";
341 }; 548 };
549
550 r_pio: pinctrl@01f02c00 {
551 compatible = "allwinner,sun8i-a23-r-pinctrl";
552 reg = <0x01f02c00 0x400>;
553 interrupts = <0 45 4>;
554 clocks = <&apb0_gates 0>;
555 resets = <&apb0_rst 0>;
556 gpio-controller;
557 interrupt-controller;
558 #address-cells = <1>;
559 #size-cells = <0>;
560 #gpio-cells = <3>;
561
562 r_uart_pins_a: r_uart@0 {
563 allwinner,pins = "PL2", "PL3";
564 allwinner,function = "s_uart";
565 allwinner,drive = <0>;
566 allwinner,pull = <0>;
567 };
568 };
342 }; 569 };
343}; 570};
diff --git a/arch/arm/boot/dts/sunxi-common-regulators.dtsi b/arch/arm/boot/dts/sunxi-common-regulators.dtsi
index 3d021efd1a38..c9c5b10e03eb 100644
--- a/arch/arm/boot/dts/sunxi-common-regulators.dtsi
+++ b/arch/arm/boot/dts/sunxi-common-regulators.dtsi
@@ -86,4 +86,11 @@
86 regulator-min-microvolt = <3300000>; 86 regulator-min-microvolt = <3300000>;
87 regulator-max-microvolt = <3300000>; 87 regulator-max-microvolt = <3300000>;
88 }; 88 };
89
90 reg_vcc5v0: vcc5v0 {
91 compatible = "regulator-fixed";
92 regulator-name = "vcc5v0";
93 regulator-min-microvolt = <5000000>;
94 regulator-max-microvolt = <5000000>;
95 };
89}; 96};
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index 80b8eddb4105..2ca9c1807f72 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -157,6 +157,11 @@
157 #reset-cells = <1>; 157 #reset-cells = <1>;
158 }; 158 };
159 159
160 flow-controller@60007000 {
161 compatible = "nvidia,tegra114-flowctrl";
162 reg = <0x60007000 0x1000>;
163 };
164
160 apbdma: dma@6000a000 { 165 apbdma: dma@6000a000 {
161 compatible = "nvidia,tegra114-apbdma"; 166 compatible = "nvidia,tegra114-apbdma";
162 reg = <0x6000a000 0x1400>; 167 reg = <0x6000a000 0x1400>;
diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
index 624b0fba2d0a..029c9a021541 100644
--- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts
+++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
@@ -16,6 +16,26 @@
16 reg = <0x0 0x80000000 0x0 0x80000000>; 16 reg = <0x0 0x80000000 0x0 0x80000000>;
17 }; 17 };
18 18
19 pcie-controller@0,01003000 {
20 status = "okay";
21
22 avddio-pex-supply = <&vdd_1v05_run>;
23 dvddio-pex-supply = <&vdd_1v05_run>;
24 avdd-pex-pll-supply = <&vdd_1v05_run>;
25 hvdd-pex-supply = <&vdd_3v3_lp0>;
26 hvdd-pex-pll-e-supply = <&vdd_3v3_lp0>;
27 vddio-pex-ctl-supply = <&vdd_3v3_lp0>;
28 avdd-pll-erefe-supply = <&avdd_1v05_run>;
29
30 pci@1,0 {
31 status = "okay";
32 };
33
34 pci@2,0 {
35 status = "okay";
36 };
37 };
38
19 host1x@0,50000000 { 39 host1x@0,50000000 {
20 hdmi@0,54280000 { 40 hdmi@0,54280000 {
21 status = "okay"; 41 status = "okay";
@@ -31,10 +51,10 @@
31 }; 51 };
32 52
33 pinmux: pinmux@0,70000868 { 53 pinmux: pinmux@0,70000868 {
34 pinctrl-names = "default"; 54 pinctrl-names = "boot";
35 pinctrl-0 = <&state_default>; 55 pinctrl-0 = <&state_boot>;
36 56
37 state_default: pinmux { 57 state_boot: pinmux {
38 clk_32k_out_pa0 { 58 clk_32k_out_pa0 {
39 nvidia,pins = "clk_32k_out_pa0"; 59 nvidia,pins = "clk_32k_out_pa0";
40 nvidia,function = "soc"; 60 nvidia,function = "soc";
@@ -1231,6 +1251,41 @@
1231 nvidia,tristate = <TEGRA_PIN_DISABLE>; 1251 nvidia,tristate = <TEGRA_PIN_DISABLE>;
1232 nvidia,enable-input = <TEGRA_PIN_DISABLE>; 1252 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
1233 }; 1253 };
1254 pex_l0_rst_n_pdd1 {
1255 nvidia,pins = "pex_l0_rst_n_pdd1";
1256 nvidia,function = "pe0";
1257 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
1258 nvidia,tristate = <TEGRA_PIN_DISABLE>;
1259 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
1260 };
1261 pex_l0_clkreq_n_pdd2 {
1262 nvidia,pins = "pex_l0_clkreq_n_pdd2";
1263 nvidia,function = "pe0";
1264 nvidia,pull = <TEGRA_PIN_PULL_UP>;
1265 nvidia,tristate = <TEGRA_PIN_DISABLE>;
1266 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
1267 };
1268 pex_wake_n_pdd3 {
1269 nvidia,pins = "pex_wake_n_pdd3";
1270 nvidia,function = "pe";
1271 nvidia,pull = <TEGRA_PIN_PULL_UP>;
1272 nvidia,tristate = <TEGRA_PIN_DISABLE>;
1273 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
1274 };
1275 pex_l1_rst_n_pdd5 {
1276 nvidia,pins = "pex_l1_rst_n_pdd5";
1277 nvidia,function = "pe1";
1278 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
1279 nvidia,tristate = <TEGRA_PIN_DISABLE>;
1280 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
1281 };
1282 pex_l1_clkreq_n_pdd6 {
1283 nvidia,pins = "pex_l1_clkreq_n_pdd6";
1284 nvidia,function = "pe1";
1285 nvidia,pull = <TEGRA_PIN_PULL_UP>;
1286 nvidia,tristate = <TEGRA_PIN_DISABLE>;
1287 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
1288 };
1234 clk3_out_pee0 { 1289 clk3_out_pee0 {
1235 nvidia,pins = "clk3_out_pee0"; 1290 nvidia,pins = "clk3_out_pee0";
1236 nvidia,function = "extperiph3"; 1291 nvidia,function = "extperiph3";
@@ -1515,7 +1570,7 @@
1515 regulator-always-on; 1570 regulator-always-on;
1516 }; 1571 };
1517 1572
1518 ldo0 { 1573 avdd_1v05_run: ldo0 {
1519 regulator-name = "+1.05V_RUN_AVDD"; 1574 regulator-name = "+1.05V_RUN_AVDD";
1520 regulator-min-microvolt = <1050000>; 1575 regulator-min-microvolt = <1050000>;
1521 regulator-max-microvolt = <1050000>; 1576 regulator-max-microvolt = <1050000>;
@@ -1619,6 +1674,18 @@
1619 nvidia,sys-clock-req-active-high; 1674 nvidia,sys-clock-req-active-high;
1620 }; 1675 };
1621 1676
1677 /* Serial ATA */
1678 sata@0,70020000 {
1679 status = "okay";
1680
1681 hvdd-supply = <&vdd_3v3_lp0>;
1682 vddio-supply = <&vdd_1v05_run>;
1683 avdd-supply = <&vdd_1v05_run>;
1684
1685 target-5v-supply = <&vdd_5v0_sata>;
1686 target-12v-supply = <&vdd_12v0_sata>;
1687 };
1688
1622 padctl@0,7009f000 { 1689 padctl@0,7009f000 {
1623 pinctrl-0 = <&padctl_default>; 1690 pinctrl-0 = <&padctl_default>;
1624 pinctrl-names = "default"; 1691 pinctrl-names = "default";
@@ -1828,6 +1895,29 @@
1828 enable-active-high; 1895 enable-active-high;
1829 vin-supply = <&vdd_5v0_sys>; 1896 vin-supply = <&vdd_5v0_sys>;
1830 }; 1897 };
1898
1899 /* Molex power connector */
1900 vdd_5v0_sata: regulator@13 {
1901 compatible = "regulator-fixed";
1902 reg = <13>;
1903 regulator-name = "+5V_SATA";
1904 regulator-min-microvolt = <5000000>;
1905 regulator-max-microvolt = <5000000>;
1906 gpio = <&gpio TEGRA_GPIO(EE, 2) GPIO_ACTIVE_HIGH>;
1907 enable-active-high;
1908 vin-supply = <&vdd_5v0_sys>;
1909 };
1910
1911 vdd_12v0_sata: regulator@14 {
1912 compatible = "regulator-fixed";
1913 reg = <14>;
1914 regulator-name = "+12V_SATA";
1915 regulator-min-microvolt = <12000000>;
1916 regulator-max-microvolt = <12000000>;
1917 gpio = <&gpio TEGRA_GPIO(EE, 2) GPIO_ACTIVE_HIGH>;
1918 enable-active-high;
1919 vin-supply = <&vdd_mux>;
1920 };
1831 }; 1921 };
1832 1922
1833 sound { 1923 sound {
diff --git a/arch/arm/boot/dts/tegra124-nyan-big.dts b/arch/arm/boot/dts/tegra124-nyan-big.dts
new file mode 100644
index 000000000000..7d0784ce4c74
--- /dev/null
+++ b/arch/arm/boot/dts/tegra124-nyan-big.dts
@@ -0,0 +1,1136 @@
1/dts-v1/;
2
3#include <dt-bindings/input/input.h>
4#include "tegra124.dtsi"
5
6/ {
7 model = "Acer Chromebook 13 CB5-311";
8 compatible = "google,nyan-big", "nvidia,tegra124";
9
10 aliases {
11 rtc0 = "/i2c@0,7000d000/pmic@40";
12 rtc1 = "/rtc@0,7000e000";
13 };
14
15 memory {
16 reg = <0x0 0x80000000 0x0 0x80000000>;
17 };
18
19 host1x@0,50000000 {
20 hdmi@0,54280000 {
21 status = "okay";
22
23 vdd-supply = <&vdd_3v3_hdmi>;
24 pll-supply = <&vdd_hdmi_pll>;
25 hdmi-supply = <&vdd_5v0_hdmi>;
26
27 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
28 nvidia,hpd-gpio =
29 <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
30 };
31
32 sor@0,54540000 {
33 status = "okay";
34
35 nvidia,dpaux = <&dpaux>;
36 nvidia,panel = <&panel>;
37 };
38
39 dpaux@0,545c0000 {
40 vdd-supply = <&vdd_3v3_panel>;
41 status = "okay";
42 };
43 };
44
45 pinmux@0,70000868 {
46 pinctrl-names = "default";
47 pinctrl-0 = <&pinmux_default>;
48
49 pinmux_default: common {
50 dap_mclk1_pw4 {
51 nvidia,pins = "dap_mclk1_pw4";
52 nvidia,function = "extperiph1";
53 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
54 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
55 nvidia,tristate = <TEGRA_PIN_DISABLE>;
56 };
57 dap2_din_pa4 {
58 nvidia,pins = "dap2_din_pa4";
59 nvidia,function = "i2s1";
60 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
61 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
62 nvidia,tristate = <TEGRA_PIN_DISABLE>;
63 };
64 dap2_dout_pa5 {
65 nvidia,pins = "dap2_dout_pa5",
66 "dap2_fs_pa2",
67 "dap2_sclk_pa3";
68 nvidia,function = "i2s1";
69 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
70 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
71 nvidia,tristate = <TEGRA_PIN_DISABLE>;
72 };
73 dvfs_pwm_px0 {
74 nvidia,pins = "dvfs_pwm_px0",
75 "dvfs_clk_px2";
76 nvidia,function = "cldvfs";
77 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
78 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
79 nvidia,tristate = <TEGRA_PIN_DISABLE>;
80 };
81 ulpi_clk_py0 {
82 nvidia,pins = "ulpi_clk_py0",
83 "ulpi_nxt_py2",
84 "ulpi_stp_py3";
85 nvidia,function = "spi1";
86 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
87 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
88 nvidia,tristate = <TEGRA_PIN_DISABLE>;
89 };
90 ulpi_dir_py1 {
91 nvidia,pins = "ulpi_dir_py1";
92 nvidia,function = "spi1";
93 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
94 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
95 nvidia,tristate = <TEGRA_PIN_DISABLE>;
96 };
97 cam_i2c_scl_pbb1 {
98 nvidia,pins = "cam_i2c_scl_pbb1",
99 "cam_i2c_sda_pbb2";
100 nvidia,function = "i2c3";
101 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
102 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
103 nvidia,tristate = <TEGRA_PIN_DISABLE>;
104 nvidia,lock = <TEGRA_PIN_DISABLE>;
105 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
106 };
107 gen2_i2c_scl_pt5 {
108 nvidia,pins = "gen2_i2c_scl_pt5",
109 "gen2_i2c_sda_pt6";
110 nvidia,function = "i2c2";
111 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
112 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
113 nvidia,tristate = <TEGRA_PIN_DISABLE>;
114 nvidia,lock = <TEGRA_PIN_DISABLE>;
115 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
116 };
117 pg4 {
118 nvidia,pins = "pg4",
119 "pg5",
120 "pg6",
121 "pi3";
122 nvidia,function = "spi4";
123 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
124 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
125 nvidia,tristate = <TEGRA_PIN_DISABLE>;
126 };
127 pg7 {
128 nvidia,pins = "pg7";
129 nvidia,function = "spi4";
130 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
131 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
132 nvidia,tristate = <TEGRA_PIN_DISABLE>;
133 };
134 ph1 {
135 nvidia,pins = "ph1";
136 nvidia,function = "pwm1";
137 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
138 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
139 nvidia,tristate = <TEGRA_PIN_DISABLE>;
140 };
141 pk0 {
142 nvidia,pins = "pk0",
143 "kb_row15_ps7",
144 "clk_32k_out_pa0";
145 nvidia,function = "soc";
146 nvidia,pull = <TEGRA_PIN_PULL_UP>;
147 nvidia,tristate = <TEGRA_PIN_DISABLE>;
148 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
149 };
150 sdmmc1_clk_pz0 {
151 nvidia,pins = "sdmmc1_clk_pz0";
152 nvidia,function = "sdmmc1";
153 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
154 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
155 nvidia,tristate = <TEGRA_PIN_DISABLE>;
156 };
157 sdmmc1_cmd_pz1 {
158 nvidia,pins = "sdmmc1_cmd_pz1",
159 "sdmmc1_dat0_py7",
160 "sdmmc1_dat1_py6",
161 "sdmmc1_dat2_py5",
162 "sdmmc1_dat3_py4";
163 nvidia,function = "sdmmc1";
164 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
165 nvidia,pull = <TEGRA_PIN_PULL_UP>;
166 nvidia,tristate = <TEGRA_PIN_DISABLE>;
167 };
168 sdmmc3_clk_pa6 {
169 nvidia,pins = "sdmmc3_clk_pa6";
170 nvidia,function = "sdmmc3";
171 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
172 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
173 nvidia,tristate = <TEGRA_PIN_DISABLE>;
174 };
175 sdmmc3_cmd_pa7 {
176 nvidia,pins = "sdmmc3_cmd_pa7",
177 "sdmmc3_dat0_pb7",
178 "sdmmc3_dat1_pb6",
179 "sdmmc3_dat2_pb5",
180 "sdmmc3_dat3_pb4",
181 "kb_col4_pq4",
182 "sdmmc3_clk_lb_out_pee4",
183 "sdmmc3_clk_lb_in_pee5",
184 "sdmmc3_cd_n_pv2";
185 nvidia,function = "sdmmc3";
186 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
187 nvidia,pull = <TEGRA_PIN_PULL_UP>;
188 nvidia,tristate = <TEGRA_PIN_DISABLE>;
189 };
190 sdmmc4_clk_pcc4 {
191 nvidia,pins = "sdmmc4_clk_pcc4";
192 nvidia,function = "sdmmc4";
193 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
194 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
195 nvidia,tristate = <TEGRA_PIN_DISABLE>;
196 };
197 sdmmc4_cmd_pt7 {
198 nvidia,pins = "sdmmc4_cmd_pt7",
199 "sdmmc4_dat0_paa0",
200 "sdmmc4_dat1_paa1",
201 "sdmmc4_dat2_paa2",
202 "sdmmc4_dat3_paa3",
203 "sdmmc4_dat4_paa4",
204 "sdmmc4_dat5_paa5",
205 "sdmmc4_dat6_paa6",
206 "sdmmc4_dat7_paa7";
207 nvidia,function = "sdmmc4";
208 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
209 nvidia,pull = <TEGRA_PIN_PULL_UP>;
210 nvidia,tristate = <TEGRA_PIN_DISABLE>;
211 };
212 pwr_i2c_scl_pz6 {
213 nvidia,pins = "pwr_i2c_scl_pz6",
214 "pwr_i2c_sda_pz7";
215 nvidia,function = "i2cpwr";
216 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
217 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
218 nvidia,tristate = <TEGRA_PIN_DISABLE>;
219 nvidia,lock = <TEGRA_PIN_DISABLE>;
220 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
221 };
222 jtag_rtck {
223 nvidia,pins = "jtag_rtck";
224 nvidia,function = "rtck";
225 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
226 nvidia,pull = <TEGRA_PIN_PULL_UP>;
227 nvidia,tristate = <TEGRA_PIN_DISABLE>;
228 };
229 clk_32k_in {
230 nvidia,pins = "clk_32k_in";
231 nvidia,function = "clk";
232 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
233 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
234 nvidia,tristate = <TEGRA_PIN_DISABLE>;
235 };
236 core_pwr_req {
237 nvidia,pins = "core_pwr_req";
238 nvidia,function = "pwron";
239 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
240 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
241 nvidia,tristate = <TEGRA_PIN_DISABLE>;
242 };
243 cpu_pwr_req {
244 nvidia,pins = "cpu_pwr_req";
245 nvidia,function = "cpu";
246 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
247 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
248 nvidia,tristate = <TEGRA_PIN_DISABLE>;
249 };
250 pwr_int_n {
251 nvidia,pins = "pwr_int_n";
252 nvidia,function = "pmi";
253 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
254 nvidia,pull = <TEGRA_PIN_PULL_UP>;
255 nvidia,tristate = <TEGRA_PIN_DISABLE>;
256 };
257 reset_out_n {
258 nvidia,pins = "reset_out_n";
259 nvidia,function = "reset_out_n";
260 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
261 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
262 nvidia,tristate = <TEGRA_PIN_DISABLE>;
263 };
264 clk3_out_pee0 {
265 nvidia,pins = "clk3_out_pee0";
266 nvidia,function = "extperiph3";
267 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
268 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
269 nvidia,tristate = <TEGRA_PIN_DISABLE>;
270 };
271 gen1_i2c_sda_pc5 {
272 nvidia,pins = "gen1_i2c_sda_pc5",
273 "gen1_i2c_scl_pc4";
274 nvidia,function = "i2c1";
275 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
276 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
277 nvidia,tristate = <TEGRA_PIN_DISABLE>;
278 nvidia,lock = <TEGRA_PIN_DISABLE>;
279 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
280 };
281 hdmi_cec_pee3 {
282 nvidia,pins = "hdmi_cec_pee3";
283 nvidia,function = "cec";
284 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
285 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
286 nvidia,tristate = <TEGRA_PIN_DISABLE>;
287 nvidia,lock = <TEGRA_PIN_DISABLE>;
288 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
289 };
290 hdmi_int_pn7 {
291 nvidia,pins = "hdmi_int_pn7";
292 nvidia,function = "rsvd1";
293 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
294 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
295 nvidia,tristate = <TEGRA_PIN_DISABLE>;
296 };
297 ddc_scl_pv4 {
298 nvidia,pins = "ddc_scl_pv4",
299 "ddc_sda_pv5";
300 nvidia,function = "i2c4";
301 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
302 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
303 nvidia,tristate = <TEGRA_PIN_DISABLE>;
304 nvidia,lock = <TEGRA_PIN_DISABLE>;
305 nvidia,rcv-sel = <TEGRA_PIN_ENABLE>;
306 };
307 kb_row10_ps2 {
308 nvidia,pins = "kb_row10_ps2";
309 nvidia,function = "uarta";
310 nvidia,pull = <TEGRA_PIN_PULL_UP>;
311 nvidia,tristate = <TEGRA_PIN_DISABLE>;
312 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
313 };
314 kb_row9_ps1 {
315 nvidia,pins = "kb_row9_ps1";
316 nvidia,function = "uarta";
317 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
318 nvidia,tristate = <TEGRA_PIN_DISABLE>;
319 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
320 };
321 usb_vbus_en0_pn4 {
322 nvidia,pins = "usb_vbus_en0_pn4",
323 "usb_vbus_en1_pn5";
324 nvidia,function = "usb";
325 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
326 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
327 nvidia,tristate = <TEGRA_PIN_DISABLE>;
328 nvidia,lock = <TEGRA_PIN_DISABLE>;
329 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
330 };
331 drive_sdio1 {
332 nvidia,pins = "drive_sdio1";
333 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
334 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
335 nvidia,pull-down-strength = <36>;
336 nvidia,pull-up-strength = <20>;
337 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOW>;
338 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_SLOW>;
339 };
340 drive_sdio3 {
341 nvidia,pins = "drive_sdio3";
342 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
343 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
344 nvidia,pull-down-strength = <22>;
345 nvidia,pull-up-strength = <36>;
346 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
347 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
348 };
349 drive_gma {
350 nvidia,pins = "drive_gma";
351 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
352 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
353 nvidia,pull-down-strength = <2>;
354 nvidia,pull-up-strength = <1>;
355 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
356 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
357 nvidia,drive-type = <1>;
358 };
359 codec_irq_l {
360 nvidia,pins = "ph4";
361 nvidia,function = "gmi";
362 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
363 nvidia,tristate = <TEGRA_PIN_DISABLE>;
364 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
365 };
366 lcd_bl_en {
367 nvidia,pins = "ph2";
368 nvidia,function = "gmi";
369 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
370 nvidia,tristate = <TEGRA_PIN_DISABLE>;
371 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
372 };
373 touch_irq_l {
374 nvidia,pins = "gpio_w3_aud_pw3";
375 nvidia,function = "spi6";
376 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
377 nvidia,tristate = <TEGRA_PIN_DISABLE>;
378 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
379 };
380 tpm_davint_l {
381 nvidia,pins = "ph6";
382 nvidia,function = "gmi";
383 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
384 nvidia,tristate = <TEGRA_PIN_DISABLE>;
385 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
386 };
387 ts_irq_l {
388 nvidia,pins = "pk2";
389 nvidia,function = "gmi";
390 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
391 nvidia,tristate = <TEGRA_PIN_DISABLE>;
392 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
393 };
394 ts_reset_l {
395 nvidia,pins = "pk4";
396 nvidia,function = "gmi";
397 nvidia,pull = <TEGRA_PIN_PULL_UP>;
398 nvidia,tristate = <TEGRA_PIN_DISABLE>;
399 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
400 };
401 ts_shdn_l {
402 nvidia,pins = "pk1";
403 nvidia,function = "gmi";
404 nvidia,pull = <TEGRA_PIN_PULL_UP>;
405 nvidia,tristate = <TEGRA_PIN_DISABLE>;
406 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
407 };
408 ph7 {
409 nvidia,pins = "ph7";
410 nvidia,function = "gmi";
411 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
412 nvidia,tristate = <TEGRA_PIN_DISABLE>;
413 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
414 };
415 kb_col0_ap {
416 nvidia,pins = "kb_col0_pq0";
417 nvidia,function = "rsvd4";
418 nvidia,pull = <TEGRA_PIN_PULL_UP>;
419 nvidia,tristate = <TEGRA_PIN_DISABLE>;
420 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
421 };
422 lid_open {
423 nvidia,pins = "kb_row4_pr4";
424 nvidia,function = "rsvd3";
425 nvidia,pull = <TEGRA_PIN_PULL_UP>;
426 nvidia,tristate = <TEGRA_PIN_DISABLE>;
427 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
428 };
429 en_vdd_sd {
430 nvidia,pins = "kb_row0_pr0";
431 nvidia,function = "rsvd4";
432 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
433 nvidia,tristate = <TEGRA_PIN_DISABLE>;
434 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
435 };
436 ac_ok {
437 nvidia,pins = "pj0";
438 nvidia,function = "gmi";
439 nvidia,pull = <TEGRA_PIN_PULL_UP>;
440 nvidia,tristate = <TEGRA_PIN_DISABLE>;
441 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
442 };
443 sensor_irq_l {
444 nvidia,pins = "pi6";
445 nvidia,function = "gmi";
446 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
447 nvidia,tristate = <TEGRA_PIN_DISABLE>;
448 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
449 };
450 wifi_en {
451 nvidia,pins = "gpio_x7_aud_px7";
452 nvidia,function = "rsvd4";
453 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
454 nvidia,tristate = <TEGRA_PIN_DISABLE>;
455 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
456 };
457 en_vdd_bl {
458 nvidia,pins = "dap3_dout_pp2";
459 nvidia,function = "i2s2";
460 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
461 nvidia,tristate = <TEGRA_PIN_DISABLE>;
462 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
463 };
464 en_vdd_hdmi {
465 nvidia,pins = "spdif_in_pk6";
466 nvidia,function = "spdif";
467 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
468 nvidia,tristate = <TEGRA_PIN_DISABLE>;
469 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
470 };
471 soc_warm_reset_l {
472 nvidia,pins = "pi5";
473 nvidia,function = "gmi";
474 nvidia,pull = <TEGRA_PIN_PULL_UP>;
475 nvidia,tristate = <TEGRA_PIN_DISABLE>;
476 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
477 };
478 hp_det_l {
479 nvidia,pins = "pi7";
480 nvidia,function = "rsvd1";
481 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
482 nvidia,tristate = <TEGRA_PIN_DISABLE>;
483 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
484 };
485 mic_det_l {
486 nvidia,pins = "kb_row7_pr7";
487 nvidia,function = "rsvd2";
488 nvidia,pull = <TEGRA_PIN_PULL_UP>;
489 nvidia,tristate = <TEGRA_PIN_DISABLE>;
490 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
491 };
492 };
493 };
494
495 serial@0,70006000 {
496 /* Debug connector on the bottom of the board near SD card. */
497 status = "okay";
498 };
499
500 pwm@0,7000a000 {
501 status = "okay";
502 };
503
504 i2c@0,7000c000 {
505 status = "okay";
506 clock-frequency = <100000>;
507
508 acodec: audio-codec@10 {
509 compatible = "maxim,max98090";
510 reg = <0x10>;
511 interrupt-parent = <&gpio>;
512 interrupts = <TEGRA_GPIO(H, 4) GPIO_ACTIVE_HIGH>;
513 };
514
515 temperature-sensor@4c {
516 compatible = "ti,tmp451";
517 reg = <0x4c>;
518 interrupt-parent = <&gpio>;
519 interrupts = <TEGRA_GPIO(I, 6) IRQ_TYPE_LEVEL_LOW>;
520
521 #thermal-sensor-cells = <1>;
522 };
523 };
524
525 i2c@0,7000c400 {
526 status = "okay";
527 clock-frequency = <100000>;
528 };
529
530 i2c@0,7000c500 {
531 status = "okay";
532 clock-frequency = <400000>;
533
534 tpm@20 {
535 compatible = "infineon,slb9645tt";
536 reg = <0x20>;
537 };
538 };
539
540 hdmi_ddc: i2c@0,7000c700 {
541 status = "okay";
542 clock-frequency = <100000>;
543 };
544
545 i2c@0,7000d000 {
546 status = "okay";
547 clock-frequency = <400000>;
548
549 pmic: pmic@40 {
550 compatible = "ams,as3722";
551 reg = <0x40>;
552 interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
553
554 ams,system-power-controller;
555
556 #interrupt-cells = <2>;
557 interrupt-controller;
558
559 gpio-controller;
560 #gpio-cells = <2>;
561
562 pinctrl-names = "default";
563 pinctrl-0 = <&as3722_default>;
564
565 as3722_default: pinmux {
566 gpio0 {
567 pins = "gpio0";
568 function = "gpio";
569 bias-pull-down;
570 };
571
572 gpio1 {
573 pins = "gpio1";
574 function = "gpio";
575 bias-pull-up;
576 };
577
578 gpio2_4_7 {
579 pins = "gpio2", "gpio4", "gpio7";
580 function = "gpio";
581 bias-pull-up;
582 };
583
584 gpio3_6 {
585 pins = "gpio3", "gpio6";
586 bias-high-impedance;
587 };
588
589 gpio5 {
590 pins = "gpio5";
591 function = "clk32k-out";
592 bias-pull-down;
593 };
594 };
595
596 regulators {
597 vsup-sd2-supply = <&vdd_5v0_sys>;
598 vsup-sd3-supply = <&vdd_5v0_sys>;
599 vsup-sd4-supply = <&vdd_5v0_sys>;
600 vsup-sd5-supply = <&vdd_5v0_sys>;
601 vin-ldo0-supply = <&vdd_1v35_lp0>;
602 vin-ldo1-6-supply = <&vdd_3v3_run>;
603 vin-ldo2-5-7-supply = <&vddio_1v8>;
604 vin-ldo3-4-supply = <&vdd_3v3_sys>;
605 vin-ldo9-10-supply = <&vdd_5v0_sys>;
606 vin-ldo11-supply = <&vdd_3v3_run>;
607
608 sd0 {
609 regulator-name = "+VDD_CPU_AP";
610 regulator-min-microvolt = <700000>;
611 regulator-max-microvolt = <1350000>;
612 regulator-min-microamp = <3500000>;
613 regulator-max-microamp = <3500000>;
614 regulator-always-on;
615 regulator-boot-on;
616 ams,ext-control = <2>;
617 };
618
619 sd1 {
620 regulator-name = "+VDD_CORE";
621 regulator-min-microvolt = <700000>;
622 regulator-max-microvolt = <1350000>;
623 regulator-min-microamp = <2500000>;
624 regulator-max-microamp = <4000000>;
625 regulator-always-on;
626 regulator-boot-on;
627 ams,ext-control = <1>;
628 };
629
630 vdd_1v35_lp0: sd2 {
631 regulator-name = "+1.35V_LP0(sd2)";
632 regulator-min-microvolt = <1350000>;
633 regulator-max-microvolt = <1350000>;
634 regulator-always-on;
635 regulator-boot-on;
636 };
637
638 sd3 {
639 regulator-name = "+1.35V_LP0(sd3)";
640 regulator-min-microvolt = <1350000>;
641 regulator-max-microvolt = <1350000>;
642 regulator-always-on;
643 regulator-boot-on;
644 };
645
646 vdd_1v05_run: sd4 {
647 regulator-name = "+1.05V_RUN";
648 regulator-min-microvolt = <1050000>;
649 regulator-max-microvolt = <1050000>;
650 };
651
652 vddio_1v8: sd5 {
653 regulator-name = "+1.8V_VDDIO";
654 regulator-min-microvolt = <1800000>;
655 regulator-max-microvolt = <1800000>;
656 regulator-boot-on;
657 regulator-always-on;
658 };
659
660 sd6 {
661 regulator-name = "+VDD_GPU_AP";
662 regulator-min-microvolt = <650000>;
663 regulator-max-microvolt = <1200000>;
664 regulator-min-microamp = <3500000>;
665 regulator-max-microamp = <3500000>;
666 regulator-boot-on;
667 regulator-always-on;
668 };
669
670 ldo0 {
671 regulator-name = "+1.05V_RUN_AVDD";
672 regulator-min-microvolt = <1050000>;
673 regulator-max-microvolt = <1050000>;
674 regulator-boot-on;
675 regulator-always-on;
676 ams,ext-control = <1>;
677 };
678
679 ldo1 {
680 regulator-name = "+1.8V_RUN_CAM";
681 regulator-min-microvolt = <1800000>;
682 regulator-max-microvolt = <1800000>;
683 };
684
685 ldo2 {
686 regulator-name = "+1.2V_GEN_AVDD";
687 regulator-min-microvolt = <1200000>;
688 regulator-max-microvolt = <1200000>;
689 regulator-boot-on;
690 regulator-always-on;
691 };
692
693 ldo3 {
694 regulator-name = "+1.00V_LP0_VDD_RTC";
695 regulator-min-microvolt = <1000000>;
696 regulator-max-microvolt = <1000000>;
697 regulator-boot-on;
698 regulator-always-on;
699 ams,enable-tracking;
700 };
701
702 vdd_run_cam: ldo4 {
703 regulator-name = "+3.3V_RUN_CAM";
704 regulator-min-microvolt = <2800000>;
705 regulator-max-microvolt = <2800000>;
706 };
707
708 ldo5 {
709 regulator-name = "+1.2V_RUN_CAM_FRONT";
710 regulator-min-microvolt = <1200000>;
711 regulator-max-microvolt = <1200000>;
712 };
713
714 vddio_sdmmc3: ldo6 {
715 regulator-name = "+VDDIO_SDMMC3";
716 regulator-min-microvolt = <1800000>;
717 regulator-max-microvolt = <3300000>;
718 };
719
720 ldo7 {
721 regulator-name = "+1.05V_RUN_CAM_REAR";
722 regulator-min-microvolt = <1050000>;
723 regulator-max-microvolt = <1050000>;
724 };
725
726 ldo9 {
727 regulator-name = "+2.8V_RUN_TOUCH";
728 regulator-min-microvolt = <2800000>;
729 regulator-max-microvolt = <2800000>;
730 };
731
732 ldo10 {
733 regulator-name = "+2.8V_RUN_CAM_AF";
734 regulator-min-microvolt = <2800000>;
735 regulator-max-microvolt = <2800000>;
736 };
737
738 ldo11 {
739 regulator-name = "+1.8V_RUN_VPP_FUSE";
740 regulator-min-microvolt = <1800000>;
741 regulator-max-microvolt = <1800000>;
742 };
743 };
744 };
745 };
746
747 spi@0,7000d400 {
748 status = "okay";
749
750 cros_ec: cros-ec@0 {
751 compatible = "google,cros-ec-spi";
752 spi-max-frequency = <3000000>;
753 interrupt-parent = <&gpio>;
754 interrupts = <TEGRA_GPIO(C, 7) IRQ_TYPE_LEVEL_LOW>;
755 reg = <0>;
756
757 google,cros-ec-spi-msg-delay = <2000>;
758
759 i2c-tunnel {
760 compatible = "google,cros-ec-i2c-tunnel";
761 #address-cells = <1>;
762 #size-cells = <0>;
763
764 google,remote-bus = <0>;
765
766 charger: bq24735@9 {
767 compatible = "ti,bq24735";
768 reg = <0x9>;
769 interrupt-parent = <&gpio>;
770 interrupts = <TEGRA_GPIO(J, 0)
771 GPIO_ACTIVE_HIGH>;
772 ti,ac-detect-gpios = <&gpio
773 TEGRA_GPIO(J, 0)
774 GPIO_ACTIVE_HIGH>;
775 };
776
777 battery: sbs-battery@b {
778 compatible = "sbs,sbs-battery";
779 reg = <0xb>;
780 sbs,i2c-retry-count = <2>;
781 sbs,poll-retry-count = <10>;
782 power-supplies = <&charger>;
783 };
784 };
785 };
786 };
787
788 spi@0,7000da00 {
789 status = "okay";
790 spi-max-frequency = <25000000>;
791
792 flash@0 {
793 compatible = "winbond,w25q32dw";
794 reg = <0>;
795 };
796 };
797
798 pmc@0,7000e400 {
799 nvidia,invert-interrupt;
800 nvidia,suspend-mode = <0>;
801 nvidia,cpu-pwr-good-time = <500>;
802 nvidia,cpu-pwr-off-time = <300>;
803 nvidia,core-pwr-good-time = <641 3845>;
804 nvidia,core-pwr-off-time = <61036>;
805 nvidia,core-power-req-active-high;
806 nvidia,sys-clock-req-active-high;
807 };
808
809 hda@0,70030000 {
810 status = "okay";
811 };
812
813 sdhci@0,700b0000 { /* WiFi/BT on this bus */
814 status = "okay";
815 power-gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_HIGH>;
816 bus-width = <4>;
817 no-1-8-v;
818 non-removable;
819 };
820
821 sdhci@0,700b0400 { /* SD Card on this bus */
822 status = "okay";
823 cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
824 power-gpios = <&gpio TEGRA_GPIO(R, 0) GPIO_ACTIVE_HIGH>;
825 wp-gpios = <&gpio TEGRA_GPIO(Q, 4) GPIO_ACTIVE_LOW>;
826 bus-width = <4>;
827 no-1-8-v;
828 vqmmc-supply = <&vddio_sdmmc3>;
829 };
830
831 sdhci@0,700b0600 { /* eMMC on this bus */
832 status = "okay";
833 bus-width = <8>;
834 no-1-8-v;
835 non-removable;
836 };
837
838 ahub@0,70300000 {
839 i2s@0,70301100 {
840 status = "okay";
841 };
842 };
843
844 usb@0,7d000000 { /* Rear external USB port. */
845 status = "okay";
846 };
847
848 usb-phy@0,7d000000 {
849 status = "okay";
850 vbus-supply = <&vdd_usb1_vbus>;
851 };
852
853 usb@0,7d004000 { /* Internal webcam. */
854 status = "okay";
855 };
856
857 usb-phy@0,7d004000 {
858 status = "okay";
859 vbus-supply = <&vdd_run_cam>;
860 };
861
862 usb@0,7d008000 { /* Left external USB port. */
863 status = "okay";
864 };
865
866 usb-phy@0,7d008000 {
867 status = "okay";
868 vbus-supply = <&vdd_usb3_vbus>;
869 };
870
871 backlight: backlight {
872 compatible = "pwm-backlight";
873
874 enable-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
875 power-supply = <&vdd_led>;
876 pwms = <&pwm 1 1000000>;
877
878 default-brightness-level = <224>;
879 brightness-levels =
880 < 0 1 2 3 4 5 6 7
881 8 9 10 11 12 13 14 15
882 16 17 18 19 20 21 22 23
883 24 25 26 27 28 29 30 31
884 32 33 34 35 36 37 38 39
885 40 41 42 43 44 45 46 47
886 48 49 50 51 52 53 54 55
887 56 57 58 59 60 61 62 63
888 64 65 66 67 68 69 70 71
889 72 73 74 75 76 77 78 79
890 80 81 82 83 84 85 86 87
891 88 89 90 91 92 93 94 95
892 96 97 98 99 100 101 102 103
893 104 105 106 107 108 109 110 111
894 112 113 114 115 116 117 118 119
895 120 121 122 123 124 125 126 127
896 128 129 130 131 132 133 134 135
897 136 137 138 139 140 141 142 143
898 144 145 146 147 148 149 150 151
899 152 153 154 155 156 157 158 159
900 160 161 162 163 164 165 166 167
901 168 169 170 171 172 173 174 175
902 176 177 178 179 180 181 182 183
903 184 185 186 187 188 189 190 191
904 192 193 194 195 196 197 198 199
905 200 201 202 203 204 205 206 207
906 208 209 210 211 212 213 214 215
907 216 217 218 219 220 221 222 223
908 224 225 226 227 228 229 230 231
909 232 233 234 235 236 237 238 239
910 240 241 242 243 244 245 246 247
911 248 249 250 251 252 253 254 255
912 256>;
913 };
914
915 clocks {
916 compatible = "simple-bus";
917 #address-cells = <1>;
918 #size-cells = <0>;
919
920 clk32k_in: clock@0 {
921 compatible = "fixed-clock";
922 reg = <0>;
923 #clock-cells = <0>;
924 clock-frequency = <32768>;
925 };
926 };
927
928 gpio-keys {
929 compatible = "gpio-keys";
930
931 lid {
932 label = "Lid";
933 gpios = <&gpio TEGRA_GPIO(R, 4) GPIO_ACTIVE_LOW>;
934 linux,input-type = <5>;
935 linux,code = <KEY_RESERVED>;
936 debounce-interval = <1>;
937 gpio-key,wakeup;
938 };
939
940 power {
941 label = "Power";
942 gpios = <&gpio TEGRA_GPIO(Q, 0) GPIO_ACTIVE_LOW>;
943 linux,code = <KEY_POWER>;
944 debounce-interval = <30>;
945 gpio-key,wakeup;
946 };
947 };
948
949 panel: panel {
950 compatible = "auo,b133xtn01";
951
952 backlight = <&backlight>;
953 ddc-i2c-bus = <&dpaux>;
954 };
955
956 regulators {
957 compatible = "simple-bus";
958 #address-cells = <1>;
959 #size-cells = <0>;
960
961 vdd_mux: regulator@0 {
962 compatible = "regulator-fixed";
963 reg = <0>;
964 regulator-name = "+VDD_MUX";
965 regulator-min-microvolt = <12000000>;
966 regulator-max-microvolt = <12000000>;
967 regulator-always-on;
968 regulator-boot-on;
969 };
970
971 vdd_5v0_sys: regulator@1 {
972 compatible = "regulator-fixed";
973 reg = <1>;
974 regulator-name = "+5V_SYS";
975 regulator-min-microvolt = <5000000>;
976 regulator-max-microvolt = <5000000>;
977 regulator-always-on;
978 regulator-boot-on;
979 vin-supply = <&vdd_mux>;
980 };
981
982 vdd_3v3_sys: regulator@2 {
983 compatible = "regulator-fixed";
984 reg = <2>;
985 regulator-name = "+3.3V_SYS";
986 regulator-min-microvolt = <3300000>;
987 regulator-max-microvolt = <3300000>;
988 regulator-always-on;
989 regulator-boot-on;
990 vin-supply = <&vdd_mux>;
991 };
992
993 vdd_3v3_run: regulator@3 {
994 compatible = "regulator-fixed";
995 reg = <3>;
996 regulator-name = "+3.3V_RUN";
997 regulator-min-microvolt = <3300000>;
998 regulator-max-microvolt = <3300000>;
999 regulator-always-on;
1000 regulator-boot-on;
1001 gpio = <&pmic 1 GPIO_ACTIVE_HIGH>;
1002 enable-active-high;
1003 vin-supply = <&vdd_3v3_sys>;
1004 };
1005
1006 vdd_3v3_hdmi: regulator@4 {
1007 compatible = "regulator-fixed";
1008 reg = <4>;
1009 regulator-name = "+3.3V_AVDD_HDMI_AP_GATED";
1010 regulator-min-microvolt = <3300000>;
1011 regulator-max-microvolt = <3300000>;
1012 vin-supply = <&vdd_3v3_run>;
1013 };
1014
1015 vdd_led: regulator@5 {
1016 compatible = "regulator-fixed";
1017 reg = <5>;
1018 regulator-name = "+VDD_LED";
1019 gpio = <&gpio TEGRA_GPIO(P, 2) GPIO_ACTIVE_HIGH>;
1020 enable-active-high;
1021 vin-supply = <&vdd_mux>;
1022 };
1023
1024 vdd_5v0_ts: regulator@6 {
1025 compatible = "regulator-fixed";
1026 reg = <6>;
1027 regulator-name = "+5V_VDD_TS_SW";
1028 regulator-min-microvolt = <5000000>;
1029 regulator-max-microvolt = <5000000>;
1030 regulator-boot-on;
1031 gpio = <&gpio TEGRA_GPIO(K, 1) GPIO_ACTIVE_HIGH>;
1032 enable-active-high;
1033 vin-supply = <&vdd_5v0_sys>;
1034 };
1035
1036 vdd_usb1_vbus: regulator@7 {
1037 compatible = "regulator-fixed";
1038 reg = <7>;
1039 regulator-name = "+5V_USB_HS";
1040 regulator-min-microvolt = <5000000>;
1041 regulator-max-microvolt = <5000000>;
1042 gpio = <&gpio TEGRA_GPIO(N, 4) GPIO_ACTIVE_HIGH>;
1043 enable-active-high;
1044 gpio-open-drain;
1045 vin-supply = <&vdd_5v0_sys>;
1046 };
1047
1048 vdd_usb3_vbus: regulator@8 {
1049 compatible = "regulator-fixed";
1050 reg = <8>;
1051 regulator-name = "+5V_USB_SS";
1052 regulator-min-microvolt = <5000000>;
1053 regulator-max-microvolt = <5000000>;
1054 gpio = <&gpio TEGRA_GPIO(N, 5) GPIO_ACTIVE_HIGH>;
1055 enable-active-high;
1056 gpio-open-drain;
1057 vin-supply = <&vdd_5v0_sys>;
1058 };
1059
1060 vdd_3v3_panel: regulator@9 {
1061 compatible = "regulator-fixed";
1062 reg = <9>;
1063 regulator-name = "+3.3V_PANEL";
1064 regulator-min-microvolt = <3300000>;
1065 regulator-max-microvolt = <3300000>;
1066 gpio = <&pmic 4 GPIO_ACTIVE_HIGH>;
1067 enable-active-high;
1068 vin-supply = <&vdd_3v3_run>;
1069 };
1070
1071 vdd_3v3_lp0: regulator@10 {
1072 compatible = "regulator-fixed";
1073 reg = <10>;
1074 regulator-name = "+3.3V_LP0";
1075 regulator-min-microvolt = <3300000>;
1076 regulator-max-microvolt = <3300000>;
1077 /*
1078 * TODO: find a way to wire this up with the USB EHCI
1079 * controllers so that it can be enabled on demand.
1080 */
1081 regulator-always-on;
1082 gpio = <&pmic 2 GPIO_ACTIVE_HIGH>;
1083 enable-active-high;
1084 vin-supply = <&vdd_3v3_sys>;
1085 };
1086
1087 vdd_hdmi_pll: regulator@11 {
1088 compatible = "regulator-fixed";
1089 reg = <11>;
1090 regulator-name = "+1.05V_RUN_AVDD_HDMI_PLL";
1091 regulator-min-microvolt = <1050000>;
1092 regulator-max-microvolt = <1050000>;
1093 gpio = <&gpio TEGRA_GPIO(H, 7) GPIO_ACTIVE_LOW>;
1094 vin-supply = <&vdd_1v05_run>;
1095 };
1096
1097 vdd_5v0_hdmi: regulator@12 {
1098 compatible = "regulator-fixed";
1099 reg = <12>;
1100 regulator-name = "+5V_HDMI_CON";
1101 regulator-min-microvolt = <5000000>;
1102 regulator-max-microvolt = <5000000>;
1103 gpio = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_HIGH>;
1104 enable-active-high;
1105 vin-supply = <&vdd_5v0_sys>;
1106 };
1107 };
1108
1109 sound {
1110 compatible = "nvidia,tegra-audio-max98090-nyan-big",
1111 "nvidia,tegra-audio-max98090";
1112 nvidia,model = "Acer Chromebook 13";
1113
1114 nvidia,audio-routing =
1115 "Headphones", "HPR",
1116 "Headphones", "HPL",
1117 "Speakers", "SPKR",
1118 "Speakers", "SPKL",
1119 "Mic Jack", "MICBIAS",
1120 "DMICL", "Int Mic",
1121 "DMICR", "Int Mic",
1122 "IN34", "Mic Jack";
1123
1124 nvidia,i2s-controller = <&tegra_i2s1>;
1125 nvidia,audio-codec = <&acodec>;
1126
1127 clocks = <&tegra_car TEGRA124_CLK_PLL_A>,
1128 <&tegra_car TEGRA124_CLK_PLL_A_OUT0>,
1129 <&tegra_car TEGRA124_CLK_EXTERN1>;
1130 clock-names = "pll_a", "pll_a_out0", "mclk";
1131
1132 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(I, 7) GPIO_ACTIVE_HIGH>;
1133 };
1134};
1135
1136#include "cros-ec-keyboard.dtsi"
diff --git a/arch/arm/boot/dts/tegra124-venice2.dts b/arch/arm/boot/dts/tegra124-venice2.dts
index 70ad91d1a20b..13008858e967 100644
--- a/arch/arm/boot/dts/tegra124-venice2.dts
+++ b/arch/arm/boot/dts/tegra124-venice2.dts
@@ -36,17 +36,17 @@
36 nvidia,panel = <&panel>; 36 nvidia,panel = <&panel>;
37 }; 37 };
38 38
39 dpaux: dpaux@0,545c0000 { 39 dpaux@0,545c0000 {
40 vdd-supply = <&vdd_3v3_panel>; 40 vdd-supply = <&vdd_3v3_panel>;
41 status = "okay"; 41 status = "okay";
42 }; 42 };
43 }; 43 };
44 44
45 pinmux: pinmux@0,70000868 { 45 pinmux: pinmux@0,70000868 {
46 pinctrl-names = "default"; 46 pinctrl-names = "boot";
47 pinctrl-0 = <&pinmux_default>; 47 pinctrl-0 = <&pinmux_boot>;
48 48
49 pinmux_default: common { 49 pinmux_boot: common {
50 dap_mclk1_pw4 { 50 dap_mclk1_pw4 {
51 nvidia,pins = "dap_mclk1_pw4"; 51 nvidia,pins = "dap_mclk1_pw4";
52 nvidia,function = "extperiph1"; 52 nvidia,function = "extperiph1";
@@ -587,7 +587,7 @@
587 status = "okay"; 587 status = "okay";
588 }; 588 };
589 589
590 pwm: pwm@0,7000a000 { 590 pwm@0,7000a000 {
591 status = "okay"; 591 status = "okay";
592 }; 592 };
593 593
@@ -606,6 +606,14 @@
606 i2c@0,7000c400 { 606 i2c@0,7000c400 {
607 status = "okay"; 607 status = "okay";
608 clock-frequency = <100000>; 608 clock-frequency = <100000>;
609
610 trackpad@4b {
611 compatible = "atmel,maxtouch";
612 reg = <0x4b>;
613 interrupt-parent = <&gpio>;
614 interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_LEVEL_LOW>;
615 linux,gpio-keymap = <0 0 0 BTN_LEFT>;
616 };
609 }; 617 };
610 618
611 i2c@0,7000c500 { 619 i2c@0,7000c500 {
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi
index 03916efd6fa9..478c555ebd96 100644
--- a/arch/arm/boot/dts/tegra124.dtsi
+++ b/arch/arm/boot/dts/tegra124.dtsi
@@ -12,6 +12,72 @@
12 #address-cells = <2>; 12 #address-cells = <2>;
13 #size-cells = <2>; 13 #size-cells = <2>;
14 14
15 pcie-controller@0,01003000 {
16 compatible = "nvidia,tegra124-pcie";
17 device_type = "pci";
18 reg = <0x0 0x01003000 0x0 0x00000800 /* PADS registers */
19 0x0 0x01003800 0x0 0x00000800 /* AFI registers */
20 0x0 0x02000000 0x0 0x10000000>; /* configuration space */
21 reg-names = "pads", "afi", "cs";
22 interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>, /* controller interrupt */
23 <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>; /* MSI interrupt */
24 interrupt-names = "intr", "msi";
25
26 #interrupt-cells = <1>;
27 interrupt-map-mask = <0 0 0 0>;
28 interrupt-map = <0 0 0 0 &gic GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
29
30 bus-range = <0x00 0xff>;
31 #address-cells = <3>;
32 #size-cells = <2>;
33
34 ranges = <0x82000000 0 0x01000000 0x0 0x01000000 0 0x00001000 /* port 0 configuration space */
35 0x82000000 0 0x01001000 0x0 0x01001000 0 0x00001000 /* port 1 configuration space */
36 0x81000000 0 0x0 0x0 0x12000000 0 0x00010000 /* downstream I/O (64 KiB) */
37 0x82000000 0 0x13000000 0x0 0x13000000 0 0x0d000000 /* non-prefetchable memory (208 MiB) */
38 0xc2000000 0 0x20000000 0x0 0x20000000 0 0x20000000>; /* prefetchable memory (512 MiB) */
39
40 clocks = <&tegra_car TEGRA124_CLK_PCIE>,
41 <&tegra_car TEGRA124_CLK_AFI>,
42 <&tegra_car TEGRA124_CLK_PLL_E>,
43 <&tegra_car TEGRA124_CLK_CML0>;
44 clock-names = "pex", "afi", "pll_e", "cml";
45 resets = <&tegra_car 70>,
46 <&tegra_car 72>,
47 <&tegra_car 74>;
48 reset-names = "pex", "afi", "pcie_x";
49 status = "disabled";
50
51 phys = <&padctl TEGRA_XUSB_PADCTL_PCIE>;
52 phy-names = "pcie";
53
54 pci@1,0 {
55 device_type = "pci";
56 assigned-addresses = <0x82000800 0 0x01000000 0 0x1000>;
57 reg = <0x000800 0 0 0 0>;
58 status = "disabled";
59
60 #address-cells = <3>;
61 #size-cells = <2>;
62 ranges;
63
64 nvidia,num-lanes = <2>;
65 };
66
67 pci@2,0 {
68 device_type = "pci";
69 assigned-addresses = <0x82001000 0 0x01001000 0 0x1000>;
70 reg = <0x001000 0 0 0 0>;
71 status = "disabled";
72
73 #address-cells = <3>;
74 #size-cells = <2>;
75 ranges;
76
77 nvidia,num-lanes = <1>;
78 };
79 };
80
15 host1x@0,50000000 { 81 host1x@0,50000000 {
16 compatible = "nvidia,tegra124-host1x", "simple-bus"; 82 compatible = "nvidia,tegra124-host1x", "simple-bus";
17 reg = <0x0 0x50000000 0x0 0x00034000>; 83 reg = <0x0 0x50000000 0x0 0x00034000>;
@@ -78,7 +144,7 @@
78 status = "disabled"; 144 status = "disabled";
79 }; 145 };
80 146
81 dpaux@0,545c0000 { 147 dpaux: dpaux@0,545c0000 {
82 compatible = "nvidia,tegra124-dpaux"; 148 compatible = "nvidia,tegra124-dpaux";
83 reg = <0x0 0x545c0000 0x0 0x00040000>; 149 reg = <0x0 0x545c0000 0x0 0x00040000>;
84 interrupts = <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>; 150 interrupts = <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>;
@@ -137,6 +203,11 @@
137 #reset-cells = <1>; 203 #reset-cells = <1>;
138 }; 204 };
139 205
206 flow-controller@0,60007000 {
207 compatible = "nvidia,tegra124-flowctrl";
208 reg = <0x0 0x60007000 0x0 0x1000>;
209 };
210
140 gpio: gpio@0,6000d000 { 211 gpio: gpio@0,6000d000 {
141 compatible = "nvidia,tegra124-gpio", "nvidia,tegra30-gpio"; 212 compatible = "nvidia,tegra124-gpio", "nvidia,tegra30-gpio";
142 reg = <0x0 0x6000d000 0x0 0x1000>; 213 reg = <0x0 0x6000d000 0x0 0x1000>;
@@ -267,7 +338,7 @@
267 status = "disabled"; 338 status = "disabled";
268 }; 339 };
269 340
270 pwm@0,7000a000 { 341 pwm: pwm@0,7000a000 {
271 compatible = "nvidia,tegra124-pwm", "nvidia,tegra20-pwm"; 342 compatible = "nvidia,tegra124-pwm", "nvidia,tegra20-pwm";
272 reg = <0x0 0x7000a000 0x0 0x100>; 343 reg = <0x0 0x7000a000 0x0 0x100>;
273 #pwm-cells = <2>; 344 #pwm-cells = <2>;
@@ -480,6 +551,31 @@
480 reset-names = "fuse"; 551 reset-names = "fuse";
481 }; 552 };
482 553
554 sata@0,70020000 {
555 compatible = "nvidia,tegra124-ahci";
556
557 reg = <0x0 0x70027000 0x0 0x2000>, /* AHCI */
558 <0x0 0x70020000 0x0 0x7000>; /* SATA */
559
560 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
561
562 clocks = <&tegra_car TEGRA124_CLK_SATA>,
563 <&tegra_car TEGRA124_CLK_SATA_OOB>,
564 <&tegra_car TEGRA124_CLK_CML1>,
565 <&tegra_car TEGRA124_CLK_PLL_E>;
566 clock-names = "sata", "sata-oob", "cml1", "pll_e";
567
568 resets = <&tegra_car 124>,
569 <&tegra_car 123>,
570 <&tegra_car 129>;
571 reset-names = "sata", "sata-oob", "sata-cold";
572
573 phys = <&padctl TEGRA_XUSB_PADCTL_SATA>;
574 phy-names = "sata-phy";
575
576 status = "disabled";
577 };
578
483 hda@0,70030000 { 579 hda@0,70030000 {
484 compatible = "nvidia,tegra124-hda", "nvidia,tegra30-hda"; 580 compatible = "nvidia,tegra124-hda", "nvidia,tegra30-hda";
485 reg = <0x0 0x70030000 0x0 0x10000>; 581 reg = <0x0 0x70030000 0x0 0x10000>;
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 1908f6937e53..3b374c49d04d 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -190,6 +190,11 @@
190 #reset-cells = <1>; 190 #reset-cells = <1>;
191 }; 191 };
192 192
193 flow-controller@60007000 {
194 compatible = "nvidia,tegra20-flowctrl";
195 reg = <0x60007000 0x1000>;
196 };
197
193 apbdma: dma@6000a000 { 198 apbdma: dma@6000a000 {
194 compatible = "nvidia,tegra20-apbdma"; 199 compatible = "nvidia,tegra20-apbdma";
195 reg = <0x6000a000 0x1200>; 200 reg = <0x6000a000 0x1200>;
diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi
index 8adaa7871dd3..a5446cba9804 100644
--- a/arch/arm/boot/dts/tegra30-apalis.dtsi
+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
@@ -423,7 +423,7 @@
423 vcc4-supply = <&sys_3v3_reg>; 423 vcc4-supply = <&sys_3v3_reg>;
424 vcc5-supply = <&sys_3v3_reg>; 424 vcc5-supply = <&sys_3v3_reg>;
425 vcc6-supply = <&vio_reg>; 425 vcc6-supply = <&vio_reg>;
426 vcc7-supply = <&sys_5v0_reg>; 426 vcc7-supply = <&charge_pump_5v0_reg>;
427 vccio-supply = <&sys_3v3_reg>; 427 vccio-supply = <&sys_3v3_reg>;
428 428
429 regulators { 429 regulators {
@@ -674,5 +674,14 @@
674 regulator-max-microvolt = <3300000>; 674 regulator-max-microvolt = <3300000>;
675 regulator-always-on; 675 regulator-always-on;
676 }; 676 };
677
678 charge_pump_5v0_reg: regulator@101 {
679 compatible = "regulator-fixed";
680 reg = <101>;
681 regulator-name = "5v0";
682 regulator-min-microvolt = <5000000>;
683 regulator-max-microvolt = <5000000>;
684 regulator-always-on;
685 };
677 }; 686 };
678}; 687};
diff --git a/arch/arm/boot/dts/tegra30-colibri.dtsi b/arch/arm/boot/dts/tegra30-colibri.dtsi
index bf16f8e65627..c4ed1bec4d92 100644
--- a/arch/arm/boot/dts/tegra30-colibri.dtsi
+++ b/arch/arm/boot/dts/tegra30-colibri.dtsi
@@ -201,7 +201,7 @@
201 vcc4-supply = <&sys_3v3_reg>; 201 vcc4-supply = <&sys_3v3_reg>;
202 vcc5-supply = <&sys_3v3_reg>; 202 vcc5-supply = <&sys_3v3_reg>;
203 vcc6-supply = <&vio_reg>; 203 vcc6-supply = <&vio_reg>;
204 vcc7-supply = <&sys_5v0_reg>; 204 vcc7-supply = <&charge_pump_5v0_reg>;
205 vccio-supply = <&sys_3v3_reg>; 205 vccio-supply = <&sys_3v3_reg>;
206 206
207 regulators { 207 regulators {
@@ -373,5 +373,14 @@
373 regulator-max-microvolt = <3300000>; 373 regulator-max-microvolt = <3300000>;
374 regulator-always-on; 374 regulator-always-on;
375 }; 375 };
376
377 charge_pump_5v0_reg: regulator@101 {
378 compatible = "regulator-fixed";
379 reg = <101>;
380 regulator-name = "5v0";
381 regulator-min-microvolt = <5000000>;
382 regulator-max-microvolt = <5000000>;
383 regulator-always-on;
384 };
376 }; 385 };
377}; 386};
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index 6b35c29278d7..aa6ccea13d30 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -272,6 +272,11 @@
272 #reset-cells = <1>; 272 #reset-cells = <1>;
273 }; 273 };
274 274
275 flow-controller@60007000 {
276 compatible = "nvidia,tegra30-flowctrl";
277 reg = <0x60007000 0x1000>;
278 };
279
275 apbdma: dma@6000a000 { 280 apbdma: dma@6000a000 {
276 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma"; 281 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma";
277 reg = <0x6000a000 0x1400>; 282 reg = <0x6000a000 0x1400>;
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
index 2e3bd3172b23..55eb35f068fb 100644
--- a/arch/arm/boot/dts/twl6030.dtsi
+++ b/arch/arm/boot/dts/twl6030.dtsi
@@ -83,10 +83,6 @@
83 regulator-always-on; 83 regulator-always-on;
84 }; 84 };
85 85
86 clk32kg: regulator-clk32kg {
87 compatible = "ti,twl6030-clk32kg";
88 };
89
90 twl_usb_comparator: usb-comparator { 86 twl_usb_comparator: usb-comparator {
91 compatible = "ti,twl6030-usb"; 87 compatible = "ti,twl6030-usb";
92 interrupts = <4>, <10>; 88 interrupts = <4>, <10>;
diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
index 756c986995a3..2efb2058ba49 100644
--- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
@@ -41,7 +41,7 @@
41 bank-width = <4>; 41 bank-width = <4>;
42 }; 42 };
43 43
44 vram@2,00000000 { 44 v2m_video_ram: vram@2,00000000 {
45 compatible = "arm,vexpress-vram"; 45 compatible = "arm,vexpress-vram";
46 reg = <2 0x00000000 0x00800000>; 46 reg = <2 0x00000000 0x00800000>;
47 }; 47 };
@@ -246,9 +246,41 @@
246 clcd@1f0000 { 246 clcd@1f0000 {
247 compatible = "arm,pl111", "arm,primecell"; 247 compatible = "arm,pl111", "arm,primecell";
248 reg = <0x1f0000 0x1000>; 248 reg = <0x1f0000 0x1000>;
249 interrupt-names = "combined";
249 interrupts = <14>; 250 interrupts = <14>;
250 clocks = <&v2m_oscclk1>, <&smbclk>; 251 clocks = <&v2m_oscclk1>, <&smbclk>;
251 clock-names = "clcdclk", "apb_pclk"; 252 clock-names = "clcdclk", "apb_pclk";
253 memory-region = <&v2m_video_ram>;
254 max-memory-bandwidth = <50350000>; /* 16bpp @ 25.175MHz */
255
256 port {
257 v2m_clcd_pads: endpoint {
258 remote-endpoint = <&v2m_clcd_panel>;
259 arm,pl11x,tft-r0g0b0-pads = <0 8 16>;
260 };
261 };
262
263 panel {
264 compatible = "panel-dpi";
265
266 port {
267 v2m_clcd_panel: endpoint {
268 remote-endpoint = <&v2m_clcd_pads>;
269 };
270 };
271
272 panel-timing {
273 clock-frequency = <25175000>;
274 hactive = <640>;
275 hback-porch = <40>;
276 hfront-porch = <24>;
277 hsync-len = <96>;
278 vactive = <480>;
279 vback-porch = <32>;
280 vfront-porch = <11>;
281 vsync-len = <2>;
282 };
283 };
252 }; 284 };
253 }; 285 };
254 286
@@ -350,7 +382,7 @@
350 /* CLCD clock */ 382 /* CLCD clock */
351 compatible = "arm,vexpress-osc"; 383 compatible = "arm,vexpress-osc";
352 arm,vexpress-sysreg,func = <1 1>; 384 arm,vexpress-sysreg,func = <1 1>;
353 freq-range = <23750000 63500000>; 385 freq-range = <23750000 65000000>;
354 #clock-cells = <0>; 386 #clock-cells = <0>;
355 clock-output-names = "v2m:oscclk1"; 387 clock-output-names = "v2m:oscclk1";
356 }; 388 };
diff --git a/arch/arm/boot/dts/vexpress-v2m.dtsi b/arch/arm/boot/dts/vexpress-v2m.dtsi
index ba856d604fb7..cb3090f919a7 100644
--- a/arch/arm/boot/dts/vexpress-v2m.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m.dtsi
@@ -40,7 +40,7 @@
40 bank-width = <4>; 40 bank-width = <4>;
41 }; 41 };
42 42
43 vram@3,00000000 { 43 v2m_video_ram: vram@3,00000000 {
44 compatible = "arm,vexpress-vram"; 44 compatible = "arm,vexpress-vram";
45 reg = <3 0x00000000 0x00800000>; 45 reg = <3 0x00000000 0x00800000>;
46 }; 46 };
@@ -245,9 +245,41 @@
245 clcd@1f000 { 245 clcd@1f000 {
246 compatible = "arm,pl111", "arm,primecell"; 246 compatible = "arm,pl111", "arm,primecell";
247 reg = <0x1f000 0x1000>; 247 reg = <0x1f000 0x1000>;
248 interrupt-names = "combined";
248 interrupts = <14>; 249 interrupts = <14>;
249 clocks = <&v2m_oscclk1>, <&smbclk>; 250 clocks = <&v2m_oscclk1>, <&smbclk>;
250 clock-names = "clcdclk", "apb_pclk"; 251 clock-names = "clcdclk", "apb_pclk";
252 memory-region = <&v2m_video_ram>;
253 max-memory-bandwidth = <50350000>; /* 16bpp @ 25.175MHz */
254
255 port {
256 v2m_clcd_pads: endpoint {
257 remote-endpoint = <&v2m_clcd_panel>;
258 arm,pl11x,tft-r0g0b0-pads = <0 8 16>;
259 };
260 };
261
262 panel {
263 compatible = "panel-dpi";
264
265 port {
266 v2m_clcd_panel: endpoint {
267 remote-endpoint = <&v2m_clcd_pads>;
268 };
269 };
270
271 panel-timing {
272 clock-frequency = <25175000>;
273 hactive = <640>;
274 hback-porch = <40>;
275 hfront-porch = <24>;
276 hsync-len = <96>;
277 vactive = <480>;
278 vback-porch = <32>;
279 vfront-porch = <11>;
280 vsync-len = <2>;
281 };
282 };
251 }; 283 };
252 }; 284 };
253 285
@@ -349,7 +381,7 @@
349 /* CLCD clock */ 381 /* CLCD clock */
350 compatible = "arm,vexpress-osc"; 382 compatible = "arm,vexpress-osc";
351 arm,vexpress-sysreg,func = <1 1>; 383 arm,vexpress-sysreg,func = <1 1>;
352 freq-range = <23750000 63500000>; 384 freq-range = <23750000 65000000>;
353 #clock-cells = <0>; 385 #clock-cells = <0>;
354 clock-output-names = "v2m:oscclk1"; 386 clock-output-names = "v2m:oscclk1";
355 }; 387 };
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index a25c262326dc..322fd1519b09 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -38,6 +38,7 @@
38 compatible = "arm,cortex-a15"; 38 compatible = "arm,cortex-a15";
39 reg = <0>; 39 reg = <0>;
40 cci-control-port = <&cci_control1>; 40 cci-control-port = <&cci_control1>;
41 cpu-idle-states = <&CLUSTER_SLEEP_BIG>;
41 }; 42 };
42 43
43 cpu1: cpu@1 { 44 cpu1: cpu@1 {
@@ -45,6 +46,7 @@
45 compatible = "arm,cortex-a15"; 46 compatible = "arm,cortex-a15";
46 reg = <1>; 47 reg = <1>;
47 cci-control-port = <&cci_control1>; 48 cci-control-port = <&cci_control1>;
49 cpu-idle-states = <&CLUSTER_SLEEP_BIG>;
48 }; 50 };
49 51
50 cpu2: cpu@2 { 52 cpu2: cpu@2 {
@@ -52,6 +54,7 @@
52 compatible = "arm,cortex-a7"; 54 compatible = "arm,cortex-a7";
53 reg = <0x100>; 55 reg = <0x100>;
54 cci-control-port = <&cci_control2>; 56 cci-control-port = <&cci_control2>;
57 cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>;
55 }; 58 };
56 59
57 cpu3: cpu@3 { 60 cpu3: cpu@3 {
@@ -59,6 +62,7 @@
59 compatible = "arm,cortex-a7"; 62 compatible = "arm,cortex-a7";
60 reg = <0x101>; 63 reg = <0x101>;
61 cci-control-port = <&cci_control2>; 64 cci-control-port = <&cci_control2>;
65 cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>;
62 }; 66 };
63 67
64 cpu4: cpu@4 { 68 cpu4: cpu@4 {
@@ -66,6 +70,25 @@
66 compatible = "arm,cortex-a7"; 70 compatible = "arm,cortex-a7";
67 reg = <0x102>; 71 reg = <0x102>;
68 cci-control-port = <&cci_control2>; 72 cci-control-port = <&cci_control2>;
73 cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>;
74 };
75
76 idle-states {
77 CLUSTER_SLEEP_BIG: cluster-sleep-big {
78 compatible = "arm,idle-state";
79 local-timer-stop;
80 entry-latency-us = <1000>;
81 exit-latency-us = <700>;
82 min-residency-us = <2000>;
83 };
84
85 CLUSTER_SLEEP_LITTLE: cluster-sleep-little {
86 compatible = "arm,idle-state";
87 local-timer-stop;
88 entry-latency-us = <1000>;
89 exit-latency-us = <500>;
90 min-residency-us = <2500>;
91 };
69 }; 92 };
70 }; 93 };
71 94
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca9.dts b/arch/arm/boot/dts/vexpress-v2p-ca9.dts
index 62d9b225dcce..23662b5a5e9d 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca9.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca9.dts
@@ -70,9 +70,40 @@
70 clcd@10020000 { 70 clcd@10020000 {
71 compatible = "arm,pl111", "arm,primecell"; 71 compatible = "arm,pl111", "arm,primecell";
72 reg = <0x10020000 0x1000>; 72 reg = <0x10020000 0x1000>;
73 interrupt-names = "combined";
73 interrupts = <0 44 4>; 74 interrupts = <0 44 4>;
74 clocks = <&oscclk1>, <&oscclk2>; 75 clocks = <&oscclk1>, <&oscclk2>;
75 clock-names = "clcdclk", "apb_pclk"; 76 clock-names = "clcdclk", "apb_pclk";
77 max-memory-bandwidth = <130000000>; /* 16bpp @ 63.5MHz */
78
79 port {
80 clcd_pads: endpoint {
81 remote-endpoint = <&clcd_panel>;
82 arm,pl11x,tft-r0g0b0-pads = <0 8 16>;
83 };
84 };
85
86 panel {
87 compatible = "panel-dpi";
88
89 port {
90 clcd_panel: endpoint {
91 remote-endpoint = <&clcd_pads>;
92 };
93 };
94
95 panel-timing {
96 clock-frequency = <63500127>;
97 hactive = <1024>;
98 hback-porch = <152>;
99 hfront-porch = <48>;
100 hsync-len = <104>;
101 vactive = <768>;
102 vback-porch = <23>;
103 vfront-porch = <3>;
104 vsync-len = <4>;
105 };
106 };
76 }; 107 };
77 108
78 memory-controller@100e0000 { 109 memory-controller@100e0000 {
diff --git a/arch/arm/boot/dts/vf610-colibri-eval-v3.dts b/arch/arm/boot/dts/vf610-colibri-eval-v3.dts
new file mode 100644
index 000000000000..7fb306679341
--- /dev/null
+++ b/arch/arm/boot/dts/vf610-colibri-eval-v3.dts
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2014 Toradex AG
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10/dts-v1/;
11#include "vf610-colibri.dtsi"
12
13/ {
14 model = "Toradex Colibri VF61 on Colibri Evaluation Board";
15 compatible = "toradex,vf610-colibri_vf61-on-eval", "toradex,vf610-colibri_vf61", "fsl,vf610";
16
17 chosen {
18 bootargs = "console=ttyLP0,115200";
19 };
20};
21
22&esdhc1 {
23 pinctrl-names = "default";
24 pinctrl-0 = <&pinctrl_esdhc1>;
25 bus-width = <4>;
26 status = "okay";
27};
28
29&fec1 {
30 phy-mode = "rmii";
31 pinctrl-names = "default";
32 pinctrl-0 = <&pinctrl_fec1>;
33 status = "okay";
34};
35
36&uart0 {
37 status = "okay";
38};
39
40&uart1 {
41 status = "okay";
42};
43
44&uart2 {
45 status = "okay";
46};
diff --git a/arch/arm/boot/dts/vf610-colibri.dts b/arch/arm/boot/dts/vf610-colibri.dtsi
index aecc7dbc65e8..0cd83434b073 100644
--- a/arch/arm/boot/dts/vf610-colibri.dts
+++ b/arch/arm/boot/dts/vf610-colibri.dtsi
@@ -7,16 +7,11 @@
7 * (at your option) any later version. 7 * (at your option) any later version.
8 */ 8 */
9 9
10/dts-v1/;
11#include "vf610.dtsi" 10#include "vf610.dtsi"
12 11
13/ { 12/ {
14 model = "Toradex Colibri VF61 COM"; 13 model = "Toradex Colibri VF61 COM";
15 compatible = "toradex,vf610-colibri", "fsl,vf610"; 14 compatible = "toradex,vf610-colibri_vf61", "fsl,vf610";
16
17 chosen {
18 bootargs = "console=ttyLP0,115200";
19 };
20 15
21 memory { 16 memory {
22 reg = <0x80000000 0x10000000>; 17 reg = <0x80000000 0x10000000>;
@@ -36,14 +31,12 @@
36 pinctrl-names = "default"; 31 pinctrl-names = "default";
37 pinctrl-0 = <&pinctrl_esdhc1>; 32 pinctrl-0 = <&pinctrl_esdhc1>;
38 bus-width = <4>; 33 bus-width = <4>;
39 status = "okay";
40}; 34};
41 35
42&fec1 { 36&fec1 {
43 phy-mode = "rmii"; 37 phy-mode = "rmii";
44 pinctrl-names = "default"; 38 pinctrl-names = "default";
45 pinctrl-0 = <&pinctrl_fec1>; 39 pinctrl-0 = <&pinctrl_fec1>;
46 status = "okay";
47}; 40};
48 41
49&L2 { 42&L2 {
@@ -54,25 +47,32 @@
54&uart0 { 47&uart0 {
55 pinctrl-names = "default"; 48 pinctrl-names = "default";
56 pinctrl-0 = <&pinctrl_uart0>; 49 pinctrl-0 = <&pinctrl_uart0>;
57 status = "okay";
58}; 50};
59 51
60&uart1 { 52&uart1 {
61 pinctrl-names = "default"; 53 pinctrl-names = "default";
62 pinctrl-0 = <&pinctrl_uart1>; 54 pinctrl-0 = <&pinctrl_uart1>;
63 status = "okay";
64}; 55};
65 56
66&uart2 { 57&uart2 {
67 pinctrl-names = "default"; 58 pinctrl-names = "default";
68 pinctrl-0 = <&pinctrl_uart2>; 59 pinctrl-0 = <&pinctrl_uart2>;
60};
61
62&usbdev0 {
63 disable-over-current;
64 status = "okay";
65};
66
67&usbh1 {
68 disable-over-current;
69 status = "okay"; 69 status = "okay";
70}; 70};
71 71
72&iomuxc { 72&iomuxc {
73 vf610-colibri { 73 vf610-colibri {
74 pinctrl_esdhc1: esdhc1grp { 74 pinctrl_esdhc1: esdhc1grp {
75 fsl,fsl,pins = < 75 fsl,pins = <
76 VF610_PAD_PTA24__ESDHC1_CLK 0x31ef 76 VF610_PAD_PTA24__ESDHC1_CLK 0x31ef
77 VF610_PAD_PTA25__ESDHC1_CMD 0x31ef 77 VF610_PAD_PTA25__ESDHC1_CMD 0x31ef
78 VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef 78 VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index 11d733406c7e..189b6975fe7d 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -76,7 +76,6 @@
76 76
77 simple-audio-card,cpu { 77 simple-audio-card,cpu {
78 sound-dai = <&sai2>; 78 sound-dai = <&sai2>;
79 master-clkdir-out;
80 frame-master; 79 frame-master;
81 bitclock-master; 80 bitclock-master;
82 }; 81 };
@@ -168,7 +167,7 @@
168 }; 167 };
169 168
170 pinctrl_esdhc1: esdhc1grp { 169 pinctrl_esdhc1: esdhc1grp {
171 fsl,fsl,pins = < 170 fsl,pins = <
172 VF610_PAD_PTA24__ESDHC1_CLK 0x31ef 171 VF610_PAD_PTA24__ESDHC1_CLK 0x31ef
173 VF610_PAD_PTA25__ESDHC1_CMD 0x31ef 172 VF610_PAD_PTA25__ESDHC1_CMD 0x31ef
174 VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef 173 VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef
@@ -221,8 +220,6 @@
221 VF610_PAD_PTB1__FTM0_CH1 0x1582 220 VF610_PAD_PTB1__FTM0_CH1 0x1582
222 VF610_PAD_PTB2__FTM0_CH2 0x1582 221 VF610_PAD_PTB2__FTM0_CH2 0x1582
223 VF610_PAD_PTB3__FTM0_CH3 0x1582 222 VF610_PAD_PTB3__FTM0_CH3 0x1582
224 VF610_PAD_PTB6__FTM0_CH6 0x1582
225 VF610_PAD_PTB7__FTM0_CH7 0x1582
226 >; 223 >;
227 }; 224 };
228 225
@@ -244,6 +241,13 @@
244 VF610_PAD_PTB5__UART1_RX 0x21a1 241 VF610_PAD_PTB5__UART1_RX 0x21a1
245 >; 242 >;
246 }; 243 };
244
245 pinctrl_uart2: uart2grp {
246 fsl,pins = <
247 VF610_PAD_PTB6__UART2_TX 0x21a2
248 VF610_PAD_PTB7__UART2_RX 0x21a1
249 >;
250 };
247 }; 251 };
248}; 252};
249 253
@@ -265,3 +269,19 @@
265 pinctrl-0 = <&pinctrl_uart1>; 269 pinctrl-0 = <&pinctrl_uart1>;
266 status = "okay"; 270 status = "okay";
267}; 271};
272
273&uart2 {
274 pinctrl-names = "default";
275 pinctrl-0 = <&pinctrl_uart2>;
276 status = "okay";
277};
278
279&usbdev0 {
280 disable-over-current;
281 status = "okay";
282};
283
284&usbh1 {
285 disable-over-current;
286 status = "okay";
287};
diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index 583dd363c9dc..4d2ec32de96f 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -27,6 +27,8 @@
27 gpio2 = &gpio3; 27 gpio2 = &gpio3;
28 gpio3 = &gpio4; 28 gpio3 = &gpio4;
29 gpio4 = &gpio5; 29 gpio4 = &gpio5;
30 usbphy0 = &usbphy0;
31 usbphy1 = &usbphy1;
30 }; 32 };
31 33
32 cpus { 34 cpus {
@@ -297,9 +299,25 @@
297 gpio-ranges = <&iomuxc 0 128 7>; 299 gpio-ranges = <&iomuxc 0 128 7>;
298 }; 300 };
299 301
300 anatop@40050000 { 302 anatop: anatop@40050000 {
301 compatible = "fsl,vf610-anatop"; 303 compatible = "fsl,vf610-anatop", "syscon";
302 reg = <0x40050000 0x1000>; 304 reg = <0x40050000 0x400>;
305 };
306
307 usbphy0: usbphy@40050800 {
308 compatible = "fsl,vf610-usbphy";
309 reg = <0x40050800 0x400>;
310 interrupts = <0 50 IRQ_TYPE_LEVEL_HIGH>;
311 clocks = <&clks VF610_CLK_USBPHY0>;
312 fsl,anatop = <&anatop>;
313 };
314
315 usbphy1: usbphy@40050c00 {
316 compatible = "fsl,vf610-usbphy";
317 reg = <0x40050c00 0x400>;
318 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>;
319 clocks = <&clks VF610_CLK_USBPHY1>;
320 fsl,anatop = <&anatop>;
303 }; 321 };
304 322
305 i2c0: i2c@40066000 { 323 i2c0: i2c@40066000 {
@@ -321,6 +339,24 @@
321 reg = <0x4006b000 0x1000>; 339 reg = <0x4006b000 0x1000>;
322 #clock-cells = <1>; 340 #clock-cells = <1>;
323 }; 341 };
342
343 usbdev0: usb@40034000 {
344 compatible = "fsl,vf610-usb", "fsl,imx27-usb";
345 reg = <0x40034000 0x800>;
346 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
347 clocks = <&clks VF610_CLK_USBC0>;
348 fsl,usbphy = <&usbphy0>;
349 fsl,usbmisc = <&usbmisc0 0>;
350 dr_mode = "peripheral";
351 status = "disabled";
352 };
353
354 usbmisc0: usb@40034800 {
355 #index-cells = <1>;
356 compatible = "fsl,vf610-usbmisc";
357 reg = <0x40034800 0x200>;
358 clocks = <&clks VF610_CLK_USBC0>;
359 };
324 }; 360 };
325 361
326 aips1: aips-bus@40080000 { 362 aips1: aips-bus@40080000 {
@@ -383,6 +419,24 @@
383 status = "disabled"; 419 status = "disabled";
384 }; 420 };
385 421
422 usbh1: usb@400b4000 {
423 compatible = "fsl,vf610-usb", "fsl,imx27-usb";
424 reg = <0x400b4000 0x800>;
425 interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
426 clocks = <&clks VF610_CLK_USBC1>;
427 fsl,usbphy = <&usbphy1>;
428 fsl,usbmisc = <&usbmisc1 0>;
429 dr_mode = "host";
430 status = "disabled";
431 };
432
433 usbmisc1: usb@400b4800 {
434 #index-cells = <1>;
435 compatible = "fsl,vf610-usbmisc";
436 reg = <0x400b4800 0x200>;
437 clocks = <&clks VF610_CLK_USBC1>;
438 };
439
386 ftm: ftm@400b8000 { 440 ftm: ftm@400b8000 {
387 compatible = "fsl,ftm-timer"; 441 compatible = "fsl,ftm-timer";
388 reg = <0x400b8000 0x1000 0x400b9000 0x1000>; 442 reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index 6cc83d4c6c76..24036c440440 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -146,6 +146,11 @@
146 cache-level = <2>; 146 cache-level = <2>;
147 }; 147 };
148 148
149 memory-controller@f8006000 {
150 compatible = "xlnx,zynq-ddrc-a05";
151 reg = <0xf8006000 0x1000>;
152 } ;
153
149 uart0: serial@e0000000 { 154 uart0: serial@e0000000 {
150 compatible = "xlnx,xuartps", "cdns,uart-r1p8"; 155 compatible = "xlnx,xuartps", "cdns,uart-r1p8";
151 status = "disabled"; 156 status = "disabled";
@@ -195,6 +200,8 @@
195 interrupts = <0 22 4>; 200 interrupts = <0 22 4>;
196 clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>; 201 clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
197 clock-names = "pclk", "hclk", "tx_clk"; 202 clock-names = "pclk", "hclk", "tx_clk";
203 #address-cells = <1>;
204 #size-cells = <0>;
198 }; 205 };
199 206
200 gem1: ethernet@e000c000 { 207 gem1: ethernet@e000c000 {
@@ -204,6 +211,8 @@
204 interrupts = <0 45 4>; 211 interrupts = <0 45 4>;
205 clocks = <&clkc 31>, <&clkc 31>, <&clkc 14>; 212 clocks = <&clkc 31>, <&clkc 31>, <&clkc 14>;
206 clock-names = "pclk", "hclk", "tx_clk"; 213 clock-names = "pclk", "hclk", "tx_clk";
214 #address-cells = <1>;
215 #size-cells = <0>;
207 }; 216 };
208 217
209 sdhci0: sdhci@e0100000 { 218 sdhci0: sdhci@e0100000 {
@@ -214,7 +223,7 @@
214 interrupt-parent = <&intc>; 223 interrupt-parent = <&intc>;
215 interrupts = <0 24 4>; 224 interrupts = <0 24 4>;
216 reg = <0xe0100000 0x1000>; 225 reg = <0xe0100000 0x1000>;
217 } ; 226 };
218 227
219 sdhci1: sdhci@e0101000 { 228 sdhci1: sdhci@e0101000 {
220 compatible = "arasan,sdhci-8.9a"; 229 compatible = "arasan,sdhci-8.9a";
@@ -224,7 +233,7 @@
224 interrupt-parent = <&intc>; 233 interrupt-parent = <&intc>;
225 interrupts = <0 47 4>; 234 interrupts = <0 47 4>;
226 reg = <0xe0101000 0x1000>; 235 reg = <0xe0101000 0x1000>;
227 } ; 236 };
228 237
229 slcr: slcr@f8000000 { 238 slcr: slcr@f8000000 {
230 #address-cells = <1>; 239 #address-cells = <1>;
@@ -256,6 +265,8 @@
256 compatible = "arm,pl330", "arm,primecell"; 265 compatible = "arm,pl330", "arm,primecell";
257 reg = <0xf8003000 0x1000>; 266 reg = <0xf8003000 0x1000>;
258 interrupt-parent = <&intc>; 267 interrupt-parent = <&intc>;
268 interrupt-names = "abort", "dma0", "dma1", "dma2", "dma3",
269 "dma4", "dma5", "dma6", "dma7";
259 interrupts = <0 13 4>, 270 interrupts = <0 13 4>,
260 <0 14 4>, <0 15 4>, 271 <0 14 4>, <0 15 4>,
261 <0 16 4>, <0 17 4>, 272 <0 16 4>, <0 17 4>,
@@ -271,7 +282,7 @@
271 devcfg: devcfg@f8007000 { 282 devcfg: devcfg@f8007000 {
272 compatible = "xlnx,zynq-devcfg-1.0"; 283 compatible = "xlnx,zynq-devcfg-1.0";
273 reg = <0xf8007000 0x100>; 284 reg = <0xf8007000 0x100>;
274 } ; 285 };
275 286
276 global_timer: timer@f8f00200 { 287 global_timer: timer@f8f00200 {
277 compatible = "arm,cortex-a9-global-timer"; 288 compatible = "arm,cortex-a9-global-timer";
@@ -303,6 +314,6 @@
303 compatible = "arm,cortex-a9-twd-timer"; 314 compatible = "arm,cortex-a9-twd-timer";
304 reg = <0xf8f00600 0x20>; 315 reg = <0xf8f00600 0x20>;
305 clocks = <&clkc 4>; 316 clocks = <&clkc 4>;
306 } ; 317 };
307 }; 318 };
308}; 319};
diff --git a/arch/arm/boot/dts/zynq-parallella.dts b/arch/arm/boot/dts/zynq-parallella.dts
index 41afd9da6876..e1f51ca127fe 100644
--- a/arch/arm/boot/dts/zynq-parallella.dts
+++ b/arch/arm/boot/dts/zynq-parallella.dts
@@ -25,7 +25,7 @@
25 25
26 memory { 26 memory {
27 device_type = "memory"; 27 device_type = "memory";
28 reg = <0 0x40000000>; 28 reg = <0x0 0x40000000>;
29 }; 29 };
30 30
31 chosen { 31 chosen {
@@ -38,8 +38,6 @@
38 status = "okay"; 38 status = "okay";
39 phy-mode = "rgmii-id"; 39 phy-mode = "rgmii-id";
40 phy-handle = <&ethernet_phy>; 40 phy-handle = <&ethernet_phy>;
41 #address-cells = <1>;
42 #size-cells = <0>;
43 41
44 ethernet_phy: ethernet-phy@0 { 42 ethernet_phy: ethernet-phy@0 {
45 /* Marvell 88E1318 */ 43 /* Marvell 88E1318 */
@@ -53,6 +51,29 @@
53 51
54&i2c0 { 52&i2c0 {
55 status = "okay"; 53 status = "okay";
54
55 isl9305: isl9305@68 {
56 compatible = "isl,isl9305";
57 reg = <0x68>;
58
59 regulators {
60 dcd1 {
61 regulator-name = "VDD_DSP";
62 regulator-always-on;
63 };
64 dcd2 {
65 regulator-name = "1P35V";
66 regulator-always-on;
67 };
68 ldo1 {
69 regulator-name = "VDD_ADJ";
70 };
71 ldo2 {
72 regulator-name = "VDD_GPIO";
73 regulator-always-on;
74 };
75 };
76 };
56}; 77};
57 78
58&sdhci1 { 79&sdhci1 {
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index 835c3089c61c..94e2cda6f9b6 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2011 Xilinx 2 * Copyright (C) 2011 - 2014 Xilinx
3 * Copyright (C) 2012 National Instruments Corp. 3 * Copyright (C) 2012 National Instruments Corp.
4 * 4 *
5 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
@@ -27,6 +27,15 @@
27 bootargs = "console=ttyPS0,115200 earlyprintk"; 27 bootargs = "console=ttyPS0,115200 earlyprintk";
28 }; 28 };
29 29
30 leds {
31 compatible = "gpio-leds";
32
33 ds23 {
34 label = "ds23";
35 gpios = <&gpio0 10 0>;
36 linux,default-trigger = "heartbeat";
37 };
38 };
30}; 39};
31 40
32&can0 { 41&can0 {
@@ -35,7 +44,12 @@
35 44
36&gem0 { 45&gem0 {
37 status = "okay"; 46 status = "okay";
38 phy-mode = "rgmii"; 47 phy-mode = "rgmii-id";
48 phy-handle = <&ethernet_phy>;
49
50 ethernet_phy: ethernet-phy@7 {
51 reg = <7>;
52 };
39}; 53};
40 54
41&i2c0 { 55&i2c0 {
diff --git a/arch/arm/boot/dts/zynq-zc706.dts b/arch/arm/boot/dts/zynq-zc706.dts
index 4cc9913078cd..a8bbdfbc7093 100644
--- a/arch/arm/boot/dts/zynq-zc706.dts
+++ b/arch/arm/boot/dts/zynq-zc706.dts
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright (C) 2011 Xilinx 2 * Copyright (C) 2011 - 2014 Xilinx
3 * Copyright (C) 2012 National Instruments Corp. 3 * Copyright (C) 2012 National Instruments Corp.
4 * Copyright (C) 2013 Xilinx
5 * 4 *
6 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 6 * License version 2, as published by the Free Software Foundation, and
@@ -21,7 +20,7 @@
21 20
22 memory { 21 memory {
23 device_type = "memory"; 22 device_type = "memory";
24 reg = <0 0x40000000>; 23 reg = <0x0 0x40000000>;
25 }; 24 };
26 25
27 chosen { 26 chosen {
@@ -32,7 +31,12 @@
32 31
33&gem0 { 32&gem0 {
34 status = "okay"; 33 status = "okay";
35 phy-mode = "rgmii"; 34 phy-mode = "rgmii-id";
35 phy-handle = <&ethernet_phy>;
36
37 ethernet_phy: ethernet-phy@7 {
38 reg = <7>;
39 };
36}; 40};
37 41
38&i2c0 { 42&i2c0 {
diff --git a/arch/arm/boot/dts/zynq-zed.dts b/arch/arm/boot/dts/zynq-zed.dts
index 82d7ef1a9a9c..697779a353ed 100644
--- a/arch/arm/boot/dts/zynq-zed.dts
+++ b/arch/arm/boot/dts/zynq-zed.dts
@@ -1,7 +1,6 @@
1/* 1/*
2 * Copyright (C) 2011 Xilinx 2 * Copyright (C) 2011 - 2014 Xilinx
3 * Copyright (C) 2012 National Instruments Corp. 3 * Copyright (C) 2012 National Instruments Corp.
4 * Copyright (C) 2013 Xilinx
5 * 4 *
6 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 6 * License version 2, as published by the Free Software Foundation, and
@@ -17,11 +16,11 @@
17 16
18/ { 17/ {
19 model = "Zynq Zed Development Board"; 18 model = "Zynq Zed Development Board";
20 compatible = "xlnx,zynq-7000"; 19 compatible = "xlnx,zynq-zed", "xlnx,zynq-7000";
21 20
22 memory { 21 memory {
23 device_type = "memory"; 22 device_type = "memory";
24 reg = <0 0x20000000>; 23 reg = <0x0 0x20000000>;
25 }; 24 };
26 25
27 chosen { 26 chosen {
@@ -32,7 +31,12 @@
32 31
33&gem0 { 32&gem0 {
34 status = "okay"; 33 status = "okay";
35 phy-mode = "rgmii"; 34 phy-mode = "rgmii-id";
35 phy-handle = <&ethernet_phy>;
36
37 ethernet_phy: ethernet-phy@0 {
38 reg = <0>;
39 };
36}; 40};
37 41
38&sdhci0 { 42&sdhci0 {
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 88099175fc56..d86771abbf57 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -1443,14 +1443,14 @@ void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no)
1443EXPORT_SYMBOL(edma_assign_channel_eventq); 1443EXPORT_SYMBOL(edma_assign_channel_eventq);
1444 1444
1445static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata, 1445static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
1446 struct edma *edma_cc) 1446 struct edma *edma_cc, int cc_id)
1447{ 1447{
1448 int i; 1448 int i;
1449 u32 value, cccfg; 1449 u32 value, cccfg;
1450 s8 (*queue_priority_map)[2]; 1450 s8 (*queue_priority_map)[2];
1451 1451
1452 /* Decode the eDMA3 configuration from CCCFG register */ 1452 /* Decode the eDMA3 configuration from CCCFG register */
1453 cccfg = edma_read(0, EDMA_CCCFG); 1453 cccfg = edma_read(cc_id, EDMA_CCCFG);
1454 1454
1455 value = GET_NUM_REGN(cccfg); 1455 value = GET_NUM_REGN(cccfg);
1456 edma_cc->num_region = BIT(value); 1456 edma_cc->num_region = BIT(value);
@@ -1464,7 +1464,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
1464 value = GET_NUM_EVQUE(cccfg); 1464 value = GET_NUM_EVQUE(cccfg);
1465 edma_cc->num_tc = value + 1; 1465 edma_cc->num_tc = value + 1;
1466 1466
1467 dev_dbg(dev, "eDMA3 HW configuration (cccfg: 0x%08x):\n", cccfg); 1467 dev_dbg(dev, "eDMA3 CC%d HW configuration (cccfg: 0x%08x):\n", cc_id,
1468 cccfg);
1468 dev_dbg(dev, "num_region: %u\n", edma_cc->num_region); 1469 dev_dbg(dev, "num_region: %u\n", edma_cc->num_region);
1469 dev_dbg(dev, "num_channel: %u\n", edma_cc->num_channels); 1470 dev_dbg(dev, "num_channel: %u\n", edma_cc->num_channels);
1470 dev_dbg(dev, "num_slot: %u\n", edma_cc->num_slots); 1471 dev_dbg(dev, "num_slot: %u\n", edma_cc->num_slots);
@@ -1684,7 +1685,7 @@ static int edma_probe(struct platform_device *pdev)
1684 return -ENOMEM; 1685 return -ENOMEM;
1685 1686
1686 /* Get eDMA3 configuration from IP */ 1687 /* Get eDMA3 configuration from IP */
1687 ret = edma_setup_from_hw(dev, info[j], edma_cc[j]); 1688 ret = edma_setup_from_hw(dev, info[j], edma_cc[j], j);
1688 if (ret) 1689 if (ret)
1689 return ret; 1690 return ret;
1690 1691
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index a20fa80776d3..45f4c21e393c 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -243,18 +243,12 @@ err_ioremap:
243static int scoop_remove(struct platform_device *pdev) 243static int scoop_remove(struct platform_device *pdev)
244{ 244{
245 struct scoop_dev *sdev = platform_get_drvdata(pdev); 245 struct scoop_dev *sdev = platform_get_drvdata(pdev);
246 int ret;
247 246
248 if (!sdev) 247 if (!sdev)
249 return -EINVAL; 248 return -EINVAL;
250 249
251 if (sdev->gpio.base != -1) { 250 if (sdev->gpio.base != -1)
252 ret = gpiochip_remove(&sdev->gpio); 251 gpiochip_remove(&sdev->gpio);
253 if (ret) {
254 dev_err(&pdev->dev, "Can't remove gpio chip: %d\n", ret);
255 return ret;
256 }
257 }
258 252
259 platform_set_drvdata(pdev, NULL); 253 platform_set_drvdata(pdev, NULL);
260 iounmap(sdev->base); 254 iounmap(sdev->base);
diff --git a/arch/arm/configs/ape6evm_defconfig b/arch/arm/configs/ape6evm_defconfig
index bb396c0e5fda..b54b28fc5a70 100644
--- a/arch/arm/configs/ape6evm_defconfig
+++ b/arch/arm/configs/ape6evm_defconfig
@@ -12,7 +12,6 @@ CONFIG_KALLSYMS_ALL=y
12CONFIG_EMBEDDED=y 12CONFIG_EMBEDDED=y
13CONFIG_PERF_EVENTS=y 13CONFIG_PERF_EVENTS=y
14CONFIG_SLAB=y 14CONFIG_SLAB=y
15# CONFIG_BLOCK is not set
16CONFIG_ARCH_SHMOBILE_LEGACY=y 15CONFIG_ARCH_SHMOBILE_LEGACY=y
17CONFIG_ARCH_R8A73A4=y 16CONFIG_ARCH_R8A73A4=y
18CONFIG_MACH_APE6EVM=y 17CONFIG_MACH_APE6EVM=y
@@ -64,6 +63,8 @@ CONFIG_SERIAL_NONSTANDARD=y
64CONFIG_SERIAL_SH_SCI=y 63CONFIG_SERIAL_SH_SCI=y
65CONFIG_SERIAL_SH_SCI_NR_UARTS=12 64CONFIG_SERIAL_SH_SCI_NR_UARTS=12
66CONFIG_SERIAL_SH_SCI_CONSOLE=y 65CONFIG_SERIAL_SH_SCI_CONSOLE=y
66CONFIG_I2C=y
67CONFIG_I2C_SH_MOBILE=y
67CONFIG_GPIO_SH_PFC=y 68CONFIG_GPIO_SH_PFC=y
68CONFIG_GPIOLIB=y 69CONFIG_GPIOLIB=y
69# CONFIG_HWMON is not set 70# CONFIG_HWMON is not set
@@ -72,11 +73,17 @@ CONFIG_RCAR_THERMAL=y
72CONFIG_REGULATOR=y 73CONFIG_REGULATOR=y
73CONFIG_REGULATOR_FIXED_VOLTAGE=y 74CONFIG_REGULATOR_FIXED_VOLTAGE=y
74CONFIG_REGULATOR_GPIO=y 75CONFIG_REGULATOR_GPIO=y
76CONFIG_REGULATOR_MAX8973=y
75# CONFIG_HID is not set 77# CONFIG_HID is not set
76# CONFIG_USB_SUPPORT is not set 78# CONFIG_USB_SUPPORT is not set
79CONFIG_MMC=y
80CONFIG_MMC_SDHI=y
81CONFIG_MMC_SH_MMCIF=y
77CONFIG_NEW_LEDS=y 82CONFIG_NEW_LEDS=y
78CONFIG_LEDS_CLASS=y 83CONFIG_LEDS_CLASS=y
79CONFIG_LEDS_GPIO=y 84CONFIG_LEDS_GPIO=y
85CONFIG_DMADEVICES=y
86CONFIG_SH_DMAE=y
80# CONFIG_IOMMU_SUPPORT is not set 87# CONFIG_IOMMU_SUPPORT is not set
81# CONFIG_DNOTIFY is not set 88# CONFIG_DNOTIFY is not set
82CONFIG_TMPFS=y 89CONFIG_TMPFS=y
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 300ded9acbe9..3b515c179487 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -18,15 +18,14 @@ CONFIG_SOC_AT91RM9200=y
18CONFIG_SOC_AT91SAM9260=y 18CONFIG_SOC_AT91SAM9260=y
19CONFIG_SOC_AT91SAM9261=y 19CONFIG_SOC_AT91SAM9261=y
20CONFIG_SOC_AT91SAM9263=y 20CONFIG_SOC_AT91SAM9263=y
21CONFIG_SOC_AT91SAM9RL=y
21CONFIG_SOC_AT91SAM9G45=y 22CONFIG_SOC_AT91SAM9G45=y
22CONFIG_SOC_AT91SAM9X5=y 23CONFIG_SOC_AT91SAM9X5=y
23CONFIG_SOC_AT91SAM9N12=y 24CONFIG_SOC_AT91SAM9N12=y
24CONFIG_SOC_AT91SAM9RL=y
25CONFIG_MACH_AT91RM9200_DT=y 25CONFIG_MACH_AT91RM9200_DT=y
26CONFIG_MACH_AT91SAM9_DT=y 26CONFIG_MACH_AT91SAM9_DT=y
27CONFIG_AT91_TIMER_HZ=128 27CONFIG_AT91_TIMER_HZ=128
28CONFIG_AEABI=y 28CONFIG_AEABI=y
29# CONFIG_OABI_COMPAT is not set
30CONFIG_UACCESS_WITH_MEMCPY=y 29CONFIG_UACCESS_WITH_MEMCPY=y
31CONFIG_ZBOOT_ROM_TEXT=0x0 30CONFIG_ZBOOT_ROM_TEXT=0x0
32CONFIG_ZBOOT_ROM_BSS=0x0 31CONFIG_ZBOOT_ROM_BSS=0x0
@@ -63,23 +62,20 @@ CONFIG_DEVTMPFS_MOUNT=y
63# CONFIG_PREVENT_FIRMWARE_BUILD is not set 62# CONFIG_PREVENT_FIRMWARE_BUILD is not set
64CONFIG_MTD=y 63CONFIG_MTD=y
65CONFIG_MTD_CMDLINE_PARTS=y 64CONFIG_MTD_CMDLINE_PARTS=y
66CONFIG_MTD_CHAR=y
67CONFIG_MTD_BLOCK=y 65CONFIG_MTD_BLOCK=y
68CONFIG_MTD_DATAFLASH=y 66CONFIG_MTD_DATAFLASH=y
69CONFIG_MTD_NAND=y 67CONFIG_MTD_NAND=y
70CONFIG_MTD_NAND_ATMEL=y 68CONFIG_MTD_NAND_ATMEL=y
71CONFIG_MTD_UBI=y 69CONFIG_MTD_UBI=y
72CONFIG_MTD_UBI_GLUEBI=y 70CONFIG_MTD_UBI_GLUEBI=y
73CONFIG_PROC_DEVICETREE=y
74CONFIG_BLK_DEV_LOOP=y 71CONFIG_BLK_DEV_LOOP=y
75CONFIG_BLK_DEV_RAM=y 72CONFIG_BLK_DEV_RAM=y
76CONFIG_BLK_DEV_RAM_COUNT=4 73CONFIG_BLK_DEV_RAM_COUNT=4
77CONFIG_BLK_DEV_RAM_SIZE=8192 74CONFIG_BLK_DEV_RAM_SIZE=8192
78CONFIG_ATMEL_PWM=y
79CONFIG_ATMEL_TCLIB=y 75CONFIG_ATMEL_TCLIB=y
76CONFIG_ATMEL_SSC=y
80CONFIG_SCSI=y 77CONFIG_SCSI=y
81CONFIG_BLK_DEV_SD=y 78CONFIG_BLK_DEV_SD=y
82CONFIG_SCSI_MULTI_LUN=y
83# CONFIG_SCSI_LOWLEVEL is not set 79# CONFIG_SCSI_LOWLEVEL is not set
84CONFIG_NETDEVICES=y 80CONFIG_NETDEVICES=y
85CONFIG_MACB=y 81CONFIG_MACB=y
@@ -105,9 +101,8 @@ CONFIG_RT2800USB=m
105CONFIG_RT2800USB_RT53XX=y 101CONFIG_RT2800USB_RT53XX=y
106CONFIG_RT2800USB_RT55XX=y 102CONFIG_RT2800USB_RT55XX=y
107CONFIG_RT2800USB_UNKNOWN=y 103CONFIG_RT2800USB_UNKNOWN=y
108CONFIG_RTLWIFI=m
109# CONFIG_RTLWIFI_DEBUG is not set
110CONFIG_RTL8192CU=m 104CONFIG_RTL8192CU=m
105# CONFIG_RTLWIFI_DEBUG is not set
111CONFIG_MWIFIEX=m 106CONFIG_MWIFIEX=m
112CONFIG_MWIFIEX_SDIO=m 107CONFIG_MWIFIEX_SDIO=m
113CONFIG_MWIFIEX_USB=m 108CONFIG_MWIFIEX_USB=m
@@ -128,9 +123,12 @@ CONFIG_SERIAL_ATMEL=y
128CONFIG_SERIAL_ATMEL_CONSOLE=y 123CONFIG_SERIAL_ATMEL_CONSOLE=y
129CONFIG_HW_RANDOM=y 124CONFIG_HW_RANDOM=y
130CONFIG_I2C=y 125CONFIG_I2C=y
126CONFIG_I2C_AT91=y
131CONFIG_I2C_GPIO=y 127CONFIG_I2C_GPIO=y
132CONFIG_SPI=y 128CONFIG_SPI=y
133CONFIG_SPI_ATMEL=y 129CONFIG_SPI_ATMEL=y
130CONFIG_POWER_SUPPLY=y
131CONFIG_POWER_RESET=y
134# CONFIG_HWMON is not set 132# CONFIG_HWMON is not set
135CONFIG_WATCHDOG=y 133CONFIG_WATCHDOG=y
136CONFIG_AT91SAM9X_WATCHDOG=y 134CONFIG_AT91SAM9X_WATCHDOG=y
@@ -144,11 +142,14 @@ CONFIG_BACKLIGHT_ATMEL_LCDC=y
144# CONFIG_BACKLIGHT_GENERIC is not set 142# CONFIG_BACKLIGHT_GENERIC is not set
145CONFIG_FRAMEBUFFER_CONSOLE=y 143CONFIG_FRAMEBUFFER_CONSOLE=y
146CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 144CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
147CONFIG_FONTS=y
148CONFIG_FONT_8x8=y
149CONFIG_FONT_ACORN_8x8=y
150CONFIG_FONT_MINI_4x6=y
151CONFIG_LOGO=y 145CONFIG_LOGO=y
146CONFIG_SOUND=y
147CONFIG_SND=y
148CONFIG_SND_SOC=y
149CONFIG_SND_ATMEL_SOC=y
150CONFIG_SND_AT91_SOC_SAM9G20_WM8731=y
151CONFIG_SND_ATMEL_SOC_WM8904=y
152CONFIG_SND_AT91_SOC_SAM9X5_WM8731=y
152CONFIG_USB=y 153CONFIG_USB=y
153CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 154CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
154CONFIG_USB_EHCI_HCD=y 155CONFIG_USB_EHCI_HCD=y
@@ -169,6 +170,7 @@ CONFIG_MMC_SPI=y
169CONFIG_NEW_LEDS=y 170CONFIG_NEW_LEDS=y
170CONFIG_LEDS_CLASS=y 171CONFIG_LEDS_CLASS=y
171CONFIG_LEDS_GPIO=y 172CONFIG_LEDS_GPIO=y
173CONFIG_LEDS_PWM=y
172CONFIG_LEDS_TRIGGERS=y 174CONFIG_LEDS_TRIGGERS=y
173CONFIG_LEDS_TRIGGER_TIMER=y 175CONFIG_LEDS_TRIGGER_TIMER=y
174CONFIG_LEDS_TRIGGER_HEARTBEAT=y 176CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -178,7 +180,12 @@ CONFIG_RTC_DRV_RV3029C2=y
178CONFIG_RTC_DRV_AT91RM9200=y 180CONFIG_RTC_DRV_AT91RM9200=y
179CONFIG_RTC_DRV_AT91SAM9=y 181CONFIG_RTC_DRV_AT91SAM9=y
180CONFIG_DMADEVICES=y 182CONFIG_DMADEVICES=y
183CONFIG_AT_HDMAC=y
181# CONFIG_IOMMU_SUPPORT is not set 184# CONFIG_IOMMU_SUPPORT is not set
185CONFIG_IIO=y
186CONFIG_AT91_ADC=y
187CONFIG_PWM=y
188CONFIG_PWM_ATMEL=y
182CONFIG_EXT4_FS=y 189CONFIG_EXT4_FS=y
183CONFIG_FANOTIFY=y 190CONFIG_FANOTIFY=y
184CONFIG_VFAT_FS=y 191CONFIG_VFAT_FS=y
@@ -209,3 +216,7 @@ CONFIG_CRC_CCITT=y
209CONFIG_CRC_ITU_T=y 216CONFIG_CRC_ITU_T=y
210CONFIG_CRC7=m 217CONFIG_CRC7=m
211CONFIG_AVERAGE=y 218CONFIG_AVERAGE=y
219CONFIG_FONTS=y
220CONFIG_FONT_8x8=y
221CONFIG_FONT_ACORN_8x8=y
222CONFIG_FONT_MINI_4x6=y
diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig
index c4c160fc8791..3ada05d639ad 100644
--- a/arch/arm/configs/at91sam9260_9g20_defconfig
+++ b/arch/arm/configs/at91sam9260_9g20_defconfig
@@ -54,7 +54,6 @@ CONFIG_DEVTMPFS=y
54CONFIG_DEVTMPFS_MOUNT=y 54CONFIG_DEVTMPFS_MOUNT=y
55CONFIG_MTD=y 55CONFIG_MTD=y
56CONFIG_MTD_CMDLINE_PARTS=y 56CONFIG_MTD_CMDLINE_PARTS=y
57CONFIG_MTD_OF_PARTS=y
58CONFIG_MTD_BLOCK=y 57CONFIG_MTD_BLOCK=y
59CONFIG_MTD_DATAFLASH=y 58CONFIG_MTD_DATAFLASH=y
60CONFIG_MTD_NAND=y 59CONFIG_MTD_NAND=y
@@ -66,13 +65,10 @@ CONFIG_BLK_DEV_RAM_SIZE=8192
66CONFIG_EEPROM_AT25=y 65CONFIG_EEPROM_AT25=y
67CONFIG_SCSI=y 66CONFIG_SCSI=y
68CONFIG_BLK_DEV_SD=y 67CONFIG_BLK_DEV_SD=y
69CONFIG_SCSI_MULTI_LUN=y
70# CONFIG_SCSI_LOWLEVEL is not set 68# CONFIG_SCSI_LOWLEVEL is not set
71CONFIG_NETDEVICES=y 69CONFIG_NETDEVICES=y
72CONFIG_MII=y
73CONFIG_MACB=y 70CONFIG_MACB=y
74# CONFIG_NET_VENDOR_BROADCOM is not set 71# CONFIG_NET_VENDOR_BROADCOM is not set
75# CONFIG_NET_VENDOR_CHELSIO is not set
76# CONFIG_NET_VENDOR_FARADAY is not set 72# CONFIG_NET_VENDOR_FARADAY is not set
77# CONFIG_NET_VENDOR_INTEL is not set 73# CONFIG_NET_VENDOR_INTEL is not set
78# CONFIG_NET_VENDOR_MARVELL is not set 74# CONFIG_NET_VENDOR_MARVELL is not set
@@ -86,7 +82,6 @@ CONFIG_SMSC_PHY=y
86# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 82# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
87CONFIG_KEYBOARD_GPIO=y 83CONFIG_KEYBOARD_GPIO=y
88# CONFIG_INPUT_MOUSE is not set 84# CONFIG_INPUT_MOUSE is not set
89# CONFIG_SERIO is not set
90CONFIG_SERIAL_ATMEL=y 85CONFIG_SERIAL_ATMEL=y
91CONFIG_SERIAL_ATMEL_CONSOLE=y 86CONFIG_SERIAL_ATMEL_CONSOLE=y
92CONFIG_HW_RANDOM=y 87CONFIG_HW_RANDOM=y
@@ -97,6 +92,8 @@ CONFIG_SPI=y
97CONFIG_SPI_ATMEL=y 92CONFIG_SPI_ATMEL=y
98CONFIG_SPI_SPIDEV=y 93CONFIG_SPI_SPIDEV=y
99CONFIG_GPIO_SYSFS=y 94CONFIG_GPIO_SYSFS=y
95CONFIG_POWER_SUPPLY=y
96CONFIG_POWER_RESET=y
100# CONFIG_HWMON is not set 97# CONFIG_HWMON is not set
101CONFIG_WATCHDOG=y 98CONFIG_WATCHDOG=y
102CONFIG_WATCHDOG_NOWAYOUT=y 99CONFIG_WATCHDOG_NOWAYOUT=y
@@ -127,6 +124,8 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y
127CONFIG_RTC_CLASS=y 124CONFIG_RTC_CLASS=y
128CONFIG_RTC_DRV_RV3029C2=y 125CONFIG_RTC_DRV_RV3029C2=y
129CONFIG_RTC_DRV_AT91SAM9=y 126CONFIG_RTC_DRV_AT91SAM9=y
127CONFIG_IIO=y
128CONFIG_AT91_ADC=y
130CONFIG_EXT4_FS=y 129CONFIG_EXT4_FS=y
131CONFIG_VFAT_FS=y 130CONFIG_VFAT_FS=y
132CONFIG_TMPFS=y 131CONFIG_TMPFS=y
@@ -139,10 +138,8 @@ CONFIG_NLS_CODEPAGE_850=y
139CONFIG_NLS_ISO8859_1=y 138CONFIG_NLS_ISO8859_1=y
140CONFIG_NLS_ISO8859_15=y 139CONFIG_NLS_ISO8859_15=y
141CONFIG_NLS_UTF8=y 140CONFIG_NLS_UTF8=y
142# CONFIG_ENABLE_WARN_DEPRECATED is not set
143CONFIG_DEBUG_KERNEL=y
144CONFIG_DEBUG_INFO=y 141CONFIG_DEBUG_INFO=y
142# CONFIG_ENABLE_WARN_DEPRECATED is not set
145# CONFIG_FTRACE is not set 143# CONFIG_FTRACE is not set
146CONFIG_DEBUG_LL=y 144CONFIG_DEBUG_LL=y
147CONFIG_AT91_DEBUG_LL_DBGU0=y
148CONFIG_EARLY_PRINTK=y 145CONFIG_EARLY_PRINTK=y
diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig
index f80e993b04ce..0c505d801e25 100644
--- a/arch/arm/configs/at91sam9261_9g10_defconfig
+++ b/arch/arm/configs/at91sam9261_9g10_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_KERNEL_LZMA=y 2CONFIG_KERNEL_LZMA=y
4# CONFIG_SWAP is not set 3# CONFIG_SWAP is not set
@@ -20,7 +19,6 @@ CONFIG_MACH_AT91SAM9261EK=y
20CONFIG_MACH_AT91SAM9G10EK=y 19CONFIG_MACH_AT91SAM9G10EK=y
21# CONFIG_ARM_THUMB is not set 20# CONFIG_ARM_THUMB is not set
22CONFIG_AEABI=y 21CONFIG_AEABI=y
23# CONFIG_OABI_COMPAT is not set
24CONFIG_ZBOOT_ROM_TEXT=0x0 22CONFIG_ZBOOT_ROM_TEXT=0x0
25CONFIG_ZBOOT_ROM_BSS=0x0 23CONFIG_ZBOOT_ROM_BSS=0x0
26CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw" 24CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
@@ -55,7 +53,6 @@ CONFIG_ATMEL_TCLIB=y
55CONFIG_ATMEL_SSC=y 53CONFIG_ATMEL_SSC=y
56CONFIG_SCSI=y 54CONFIG_SCSI=y
57CONFIG_BLK_DEV_SD=y 55CONFIG_BLK_DEV_SD=y
58CONFIG_SCSI_MULTI_LUN=y
59CONFIG_NETDEVICES=y 56CONFIG_NETDEVICES=y
60CONFIG_DM9000=y 57CONFIG_DM9000=y
61CONFIG_USB_ZD1201=m 58CONFIG_USB_ZD1201=m
@@ -87,6 +84,8 @@ CONFIG_I2C_CHARDEV=y
87CONFIG_I2C_GPIO=y 84CONFIG_I2C_GPIO=y
88CONFIG_SPI=y 85CONFIG_SPI=y
89CONFIG_SPI_ATMEL=y 86CONFIG_SPI_ATMEL=y
87CONFIG_POWER_SUPPLY=y
88CONFIG_POWER_RESET=y
90# CONFIG_HWMON is not set 89# CONFIG_HWMON is not set
91CONFIG_WATCHDOG=y 90CONFIG_WATCHDOG=y
92CONFIG_WATCHDOG_NOWAYOUT=y 91CONFIG_WATCHDOG_NOWAYOUT=y
diff --git a/arch/arm/configs/at91sam9263_defconfig b/arch/arm/configs/at91sam9263_defconfig
index e40026364e57..8b671c977b81 100644
--- a/arch/arm/configs/at91sam9263_defconfig
+++ b/arch/arm/configs/at91sam9263_defconfig
@@ -18,7 +18,6 @@ CONFIG_MACH_AT91SAM9263EK=y
18CONFIG_MTD_AT91_DATAFLASH_CARD=y 18CONFIG_MTD_AT91_DATAFLASH_CARD=y
19# CONFIG_ARM_THUMB is not set 19# CONFIG_ARM_THUMB is not set
20CONFIG_AEABI=y 20CONFIG_AEABI=y
21# CONFIG_OABI_COMPAT is not set
22CONFIG_ZBOOT_ROM_TEXT=0x0 21CONFIG_ZBOOT_ROM_TEXT=0x0
23CONFIG_ZBOOT_ROM_BSS=0x0 22CONFIG_ZBOOT_ROM_BSS=0x0
24CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw" 23CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
@@ -51,7 +50,6 @@ CONFIG_DEVTMPFS=y
51CONFIG_DEVTMPFS_MOUNT=y 50CONFIG_DEVTMPFS_MOUNT=y
52CONFIG_MTD=y 51CONFIG_MTD=y
53CONFIG_MTD_CMDLINE_PARTS=y 52CONFIG_MTD_CMDLINE_PARTS=y
54CONFIG_MTD_CHAR=y
55CONFIG_MTD_BLOCK=y 53CONFIG_MTD_BLOCK=y
56CONFIG_NFTL=y 54CONFIG_NFTL=y
57CONFIG_NFTL_RW=y 55CONFIG_NFTL_RW=y
@@ -64,13 +62,10 @@ CONFIG_MTD_UBI_GLUEBI=y
64CONFIG_BLK_DEV_LOOP=y 62CONFIG_BLK_DEV_LOOP=y
65CONFIG_BLK_DEV_RAM=y 63CONFIG_BLK_DEV_RAM=y
66CONFIG_BLK_DEV_RAM_SIZE=8192 64CONFIG_BLK_DEV_RAM_SIZE=8192
67CONFIG_ATMEL_PWM=y
68CONFIG_ATMEL_TCLIB=y 65CONFIG_ATMEL_TCLIB=y
69CONFIG_SCSI=y 66CONFIG_SCSI=y
70CONFIG_BLK_DEV_SD=y 67CONFIG_BLK_DEV_SD=y
71CONFIG_SCSI_MULTI_LUN=y
72CONFIG_NETDEVICES=y 68CONFIG_NETDEVICES=y
73CONFIG_MII=y
74CONFIG_MACB=y 69CONFIG_MACB=y
75CONFIG_SMSC_PHY=y 70CONFIG_SMSC_PHY=y
76# CONFIG_WLAN is not set 71# CONFIG_WLAN is not set
@@ -92,6 +87,8 @@ CONFIG_I2C_GPIO=y
92CONFIG_SPI=y 87CONFIG_SPI=y
93CONFIG_SPI_ATMEL=y 88CONFIG_SPI_ATMEL=y
94CONFIG_GPIO_SYSFS=y 89CONFIG_GPIO_SYSFS=y
90CONFIG_POWER_SUPPLY=y
91CONFIG_POWER_RESET=y
95# CONFIG_HWMON is not set 92# CONFIG_HWMON is not set
96CONFIG_WATCHDOG=y 93CONFIG_WATCHDOG=y
97CONFIG_WATCHDOG_NOWAYOUT=y 94CONFIG_WATCHDOG_NOWAYOUT=y
@@ -103,7 +100,6 @@ CONFIG_LCD_CLASS_DEVICE=y
103CONFIG_BACKLIGHT_CLASS_DEVICE=y 100CONFIG_BACKLIGHT_CLASS_DEVICE=y
104CONFIG_FRAMEBUFFER_CONSOLE=y 101CONFIG_FRAMEBUFFER_CONSOLE=y
105CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 102CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
106CONFIG_FONTS=y
107CONFIG_LOGO=y 103CONFIG_LOGO=y
108CONFIG_SOUND=y 104CONFIG_SOUND=y
109CONFIG_SND=y 105CONFIG_SND=y
@@ -129,12 +125,14 @@ CONFIG_SDIO_UART=m
129CONFIG_MMC_ATMELMCI=m 125CONFIG_MMC_ATMELMCI=m
130CONFIG_NEW_LEDS=y 126CONFIG_NEW_LEDS=y
131CONFIG_LEDS_CLASS=y 127CONFIG_LEDS_CLASS=y
132CONFIG_LEDS_ATMEL_PWM=y
133CONFIG_LEDS_GPIO=y 128CONFIG_LEDS_GPIO=y
129CONFIG_LEDS_PWM=y
134CONFIG_LEDS_TRIGGERS=y 130CONFIG_LEDS_TRIGGERS=y
135CONFIG_LEDS_TRIGGER_HEARTBEAT=y 131CONFIG_LEDS_TRIGGER_HEARTBEAT=y
136CONFIG_RTC_CLASS=y 132CONFIG_RTC_CLASS=y
137CONFIG_RTC_DRV_AT91SAM9=y 133CONFIG_RTC_DRV_AT91SAM9=y
134CONFIG_PWM=y
135CONFIG_PWM_ATMEL=y
138CONFIG_EXT4_FS=y 136CONFIG_EXT4_FS=y
139CONFIG_VFAT_FS=y 137CONFIG_VFAT_FS=y
140CONFIG_TMPFS=y 138CONFIG_TMPFS=y
@@ -150,3 +148,4 @@ CONFIG_NLS_ISO8859_1=y
150CONFIG_NLS_UTF8=y 148CONFIG_NLS_UTF8=y
151CONFIG_DEBUG_USER=y 149CONFIG_DEBUG_USER=y
152CONFIG_XZ_DEC=y 150CONFIG_XZ_DEC=y
151CONFIG_FONTS=y
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
index c6661a60025d..f66d1a1b64bf 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -20,7 +20,6 @@ CONFIG_MACH_AT91SAM9M10G45EK=y
20CONFIG_MACH_AT91SAM9_DT=y 20CONFIG_MACH_AT91SAM9_DT=y
21CONFIG_AT91_SLOW_CLOCK=y 21CONFIG_AT91_SLOW_CLOCK=y
22CONFIG_AEABI=y 22CONFIG_AEABI=y
23# CONFIG_OABI_COMPAT is not set
24CONFIG_UACCESS_WITH_MEMCPY=y 23CONFIG_UACCESS_WITH_MEMCPY=y
25CONFIG_ZBOOT_ROM_TEXT=0x0 24CONFIG_ZBOOT_ROM_TEXT=0x0
26CONFIG_ZBOOT_ROM_BSS=0x0 25CONFIG_ZBOOT_ROM_BSS=0x0
@@ -51,7 +50,6 @@ CONFIG_DEVTMPFS_MOUNT=y
51# CONFIG_PREVENT_FIRMWARE_BUILD is not set 50# CONFIG_PREVENT_FIRMWARE_BUILD is not set
52CONFIG_MTD=y 51CONFIG_MTD=y
53CONFIG_MTD_CMDLINE_PARTS=y 52CONFIG_MTD_CMDLINE_PARTS=y
54CONFIG_MTD_CHAR=y
55CONFIG_MTD_BLOCK=y 53CONFIG_MTD_BLOCK=y
56CONFIG_MTD_DATAFLASH=y 54CONFIG_MTD_DATAFLASH=y
57CONFIG_MTD_NAND=y 55CONFIG_MTD_NAND=y
@@ -62,15 +60,12 @@ CONFIG_BLK_DEV_LOOP=y
62CONFIG_BLK_DEV_RAM=y 60CONFIG_BLK_DEV_RAM=y
63CONFIG_BLK_DEV_RAM_COUNT=4 61CONFIG_BLK_DEV_RAM_COUNT=4
64CONFIG_BLK_DEV_RAM_SIZE=8192 62CONFIG_BLK_DEV_RAM_SIZE=8192
65CONFIG_ATMEL_PWM=y
66CONFIG_ATMEL_TCLIB=y 63CONFIG_ATMEL_TCLIB=y
67CONFIG_ATMEL_SSC=y 64CONFIG_ATMEL_SSC=y
68CONFIG_SCSI=y 65CONFIG_SCSI=y
69CONFIG_BLK_DEV_SD=y 66CONFIG_BLK_DEV_SD=y
70CONFIG_SCSI_MULTI_LUN=y
71# CONFIG_SCSI_LOWLEVEL is not set 67# CONFIG_SCSI_LOWLEVEL is not set
72CONFIG_NETDEVICES=y 68CONFIG_NETDEVICES=y
73CONFIG_MII=y
74CONFIG_MACB=y 69CONFIG_MACB=y
75CONFIG_DAVICOM_PHY=y 70CONFIG_DAVICOM_PHY=y
76# CONFIG_INPUT_MOUSEDEV is not set 71# CONFIG_INPUT_MOUSEDEV is not set
@@ -93,18 +88,22 @@ CONFIG_I2C_CHARDEV=y
93CONFIG_I2C_GPIO=y 88CONFIG_I2C_GPIO=y
94CONFIG_SPI=y 89CONFIG_SPI=y
95CONFIG_SPI_ATMEL=y 90CONFIG_SPI_ATMEL=y
91CONFIG_POWER_SUPPLY=y
92CONFIG_POWER_RESET=y
96# CONFIG_HWMON is not set 93# CONFIG_HWMON is not set
94CONFIG_WATCHDOG=y
95CONFIG_WATCHDOG_NOWAYOUT=y
96CONFIG_AT91SAM9X_WATCHDOG=y
97CONFIG_FB=y 97CONFIG_FB=y
98CONFIG_FB_ATMEL=y 98CONFIG_FB_ATMEL=y
99CONFIG_BACKLIGHT_LCD_SUPPORT=y 99CONFIG_BACKLIGHT_LCD_SUPPORT=y
100CONFIG_LCD_CLASS_DEVICE=y 100CONFIG_LCD_CLASS_DEVICE=y
101CONFIG_BACKLIGHT_CLASS_DEVICE=y 101CONFIG_BACKLIGHT_CLASS_DEVICE=y
102CONFIG_BACKLIGHT_ATMEL_LCDC=y 102CONFIG_BACKLIGHT_ATMEL_LCDC=y
103CONFIG_BACKLIGHT_ATMEL_PWM=y
104# CONFIG_BACKLIGHT_GENERIC is not set 103# CONFIG_BACKLIGHT_GENERIC is not set
104CONFIG_BACKLIGHT_PWM=y
105CONFIG_FRAMEBUFFER_CONSOLE=y 105CONFIG_FRAMEBUFFER_CONSOLE=y
106CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 106CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
107CONFIG_FONTS=y
108CONFIG_LOGO=y 107CONFIG_LOGO=y
109CONFIG_SOUND=y 108CONFIG_SOUND=y
110CONFIG_SND=y 109CONFIG_SND=y
@@ -135,6 +134,7 @@ CONFIG_MMC_ATMELMCI=y
135CONFIG_NEW_LEDS=y 134CONFIG_NEW_LEDS=y
136CONFIG_LEDS_CLASS=y 135CONFIG_LEDS_CLASS=y
137CONFIG_LEDS_GPIO=y 136CONFIG_LEDS_GPIO=y
137CONFIG_LEDS_PWM=y
138CONFIG_LEDS_TRIGGERS=y 138CONFIG_LEDS_TRIGGERS=y
139CONFIG_LEDS_TRIGGER_TIMER=y 139CONFIG_LEDS_TRIGGER_TIMER=y
140CONFIG_LEDS_TRIGGER_HEARTBEAT=y 140CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -147,6 +147,8 @@ CONFIG_DMATEST=m
147# CONFIG_IOMMU_SUPPORT is not set 147# CONFIG_IOMMU_SUPPORT is not set
148CONFIG_IIO=y 148CONFIG_IIO=y
149CONFIG_AT91_ADC=y 149CONFIG_AT91_ADC=y
150CONFIG_PWM=y
151CONFIG_PWM_ATMEL=y
150CONFIG_EXT4_FS=y 152CONFIG_EXT4_FS=y
151CONFIG_FANOTIFY=y 153CONFIG_FANOTIFY=y
152CONFIG_VFAT_FS=y 154CONFIG_VFAT_FS=y
@@ -159,8 +161,8 @@ CONFIG_NLS_CODEPAGE_437=y
159CONFIG_NLS_CODEPAGE_850=y 161CONFIG_NLS_CODEPAGE_850=y
160CONFIG_NLS_ISO8859_1=y 162CONFIG_NLS_ISO8859_1=y
161CONFIG_STRIP_ASM_SYMS=y 163CONFIG_STRIP_ASM_SYMS=y
162# CONFIG_SCHED_DEBUG is not set
163CONFIG_DEBUG_MEMORY_INIT=y 164CONFIG_DEBUG_MEMORY_INIT=y
165# CONFIG_SCHED_DEBUG is not set
164# CONFIG_FTRACE is not set 166# CONFIG_FTRACE is not set
165CONFIG_DEBUG_USER=y 167CONFIG_DEBUG_USER=y
166CONFIG_DEBUG_LL=y 168CONFIG_DEBUG_LL=y
@@ -170,3 +172,4 @@ CONFIG_CRYPTO_ECB=y
170CONFIG_CRYPTO_USER_API_HASH=m 172CONFIG_CRYPTO_USER_API_HASH=m
171CONFIG_CRYPTO_USER_API_SKCIPHER=m 173CONFIG_CRYPTO_USER_API_SKCIPHER=m
172# CONFIG_CRYPTO_HW is not set 174# CONFIG_CRYPTO_HW is not set
175CONFIG_FONTS=y
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
index 5d7797d43d23..4c26d344ae88 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -2,8 +2,8 @@
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_EMBEDDED=y
6CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y
7CONFIG_SLAB=y 7CONFIG_SLAB=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
@@ -37,7 +37,6 @@ CONFIG_BLK_DEV_RAM_COUNT=4
37CONFIG_BLK_DEV_RAM_SIZE=24576 37CONFIG_BLK_DEV_RAM_SIZE=24576
38CONFIG_SCSI=y 38CONFIG_SCSI=y
39CONFIG_BLK_DEV_SD=y 39CONFIG_BLK_DEV_SD=y
40CONFIG_SCSI_MULTI_LUN=y
41# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 40# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
42CONFIG_INPUT_MOUSEDEV_SCREEN_X=320 41CONFIG_INPUT_MOUSEDEV_SCREEN_X=320
43CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240 42CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240
@@ -54,20 +53,31 @@ CONFIG_I2C_CHARDEV=y
54CONFIG_I2C_GPIO=y 53CONFIG_I2C_GPIO=y
55CONFIG_SPI=y 54CONFIG_SPI=y
56CONFIG_SPI_ATMEL=y 55CONFIG_SPI_ATMEL=y
56CONFIG_POWER_SUPPLY=y
57CONFIG_POWER_RESET=y
57# CONFIG_HWMON is not set 58# CONFIG_HWMON is not set
58CONFIG_WATCHDOG=y 59CONFIG_WATCHDOG=y
59CONFIG_WATCHDOG_NOWAYOUT=y 60CONFIG_WATCHDOG_NOWAYOUT=y
60CONFIG_AT91SAM9X_WATCHDOG=y 61CONFIG_AT91SAM9X_WATCHDOG=y
61CONFIG_FB=y 62CONFIG_FB=y
62CONFIG_FB_ATMEL=y 63CONFIG_FB_ATMEL=y
64CONFIG_USB_GADGET=y
65CONFIG_USB_ATMEL_USBA=y
63CONFIG_MMC=y 66CONFIG_MMC=y
64CONFIG_MMC_ATMELMCI=m 67CONFIG_MMC_ATMELMCI=m
68CONFIG_NEW_LEDS=y
69CONFIG_LEDS_CLASS=y
70CONFIG_LEDS_GPIO=y
71CONFIG_LEDS_PWM=y
72CONFIG_LEDS_TRIGGERS=y
73CONFIG_LEDS_TRIGGER_HEARTBEAT=y
65CONFIG_RTC_CLASS=y 74CONFIG_RTC_CLASS=y
66CONFIG_RTC_DRV_AT91SAM9=y 75CONFIG_RTC_DRV_AT91SAM9=y
67CONFIG_IIO=y 76CONFIG_IIO=y
68CONFIG_AT91_ADC=y 77CONFIG_AT91_ADC=y
69CONFIG_EXT2_FS=y 78CONFIG_PWM=y
70CONFIG_MSDOS_FS=y 79CONFIG_PWM_ATMEL=y
80CONFIG_EXT4_FS=y
71CONFIG_VFAT_FS=y 81CONFIG_VFAT_FS=y
72CONFIG_TMPFS=y 82CONFIG_TMPFS=y
73CONFIG_UBIFS_FS=y 83CONFIG_UBIFS_FS=y
@@ -77,7 +87,6 @@ CONFIG_NLS_CODEPAGE_850=y
77CONFIG_NLS_ISO8859_1=y 87CONFIG_NLS_ISO8859_1=y
78CONFIG_NLS_ISO8859_15=y 88CONFIG_NLS_ISO8859_15=y
79CONFIG_NLS_UTF8=y 89CONFIG_NLS_UTF8=y
80CONFIG_DEBUG_KERNEL=y
81CONFIG_DEBUG_INFO=y 90CONFIG_DEBUG_INFO=y
82CONFIG_DEBUG_USER=y 91CONFIG_DEBUG_USER=y
83CONFIG_DEBUG_LL=y 92CONFIG_DEBUG_LL=y
diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig
index 0302d293fba0..31cb07388885 100644
--- a/arch/arm/configs/bcm2835_defconfig
+++ b/arch/arm/configs/bcm2835_defconfig
@@ -98,6 +98,7 @@ CONFIG_LEDS_TRIGGER_TRANSIENT=y
98CONFIG_LEDS_TRIGGER_CAMERA=y 98CONFIG_LEDS_TRIGGER_CAMERA=y
99CONFIG_STAGING=y 99CONFIG_STAGING=y
100CONFIG_USB_DWC2=y 100CONFIG_USB_DWC2=y
101CONFIG_USB_DWC2_HOST=y
101# CONFIG_IOMMU_SUPPORT is not set 102# CONFIG_IOMMU_SUPPORT is not set
102CONFIG_EXT2_FS=y 103CONFIG_EXT2_FS=y
103CONFIG_EXT2_FS_XATTR=y 104CONFIG_EXT2_FS_XATTR=y
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index fbebcbce1e8c..bc614f44b33d 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_defconfig
@@ -83,7 +83,6 @@ CONFIG_I2C_CHARDEV=y
83CONFIG_MFD_BCM590XX=y 83CONFIG_MFD_BCM590XX=y
84CONFIG_REGULATOR=y 84CONFIG_REGULATOR=y
85CONFIG_REGULATOR_FIXED_VOLTAGE=y 85CONFIG_REGULATOR_FIXED_VOLTAGE=y
86CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
87CONFIG_REGULATOR_USERSPACE_CONSUMER=y 86CONFIG_REGULATOR_USERSPACE_CONSUMER=y
88CONFIG_REGULATOR_BCM590XX=y 87CONFIG_REGULATOR_BCM590XX=y
89 88
diff --git a/arch/arm/configs/bockw_defconfig b/arch/arm/configs/bockw_defconfig
index e816140d81c5..1dde5daa84f9 100644
--- a/arch/arm/configs/bockw_defconfig
+++ b/arch/arm/configs/bockw_defconfig
@@ -29,7 +29,6 @@ CONFIG_ZBOOT_ROM_BSS=0x0
29CONFIG_ARM_APPENDED_DTB=y 29CONFIG_ARM_APPENDED_DTB=y
30CONFIG_VFP=y 30CONFIG_VFP=y
31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
32# CONFIG_SUSPEND is not set
33CONFIG_PM_RUNTIME=y 32CONFIG_PM_RUNTIME=y
34CONFIG_NET=y 33CONFIG_NET=y
35CONFIG_PACKET=y 34CONFIG_PACKET=y
@@ -55,6 +54,7 @@ CONFIG_MTD_BLOCK=y
55CONFIG_MTD_CFI=y 54CONFIG_MTD_CFI=y
56CONFIG_MTD_CFI_AMDSTD=y 55CONFIG_MTD_CFI_AMDSTD=y
57CONFIG_MTD_M25P80=y 56CONFIG_MTD_M25P80=y
57CONFIG_MTD_SPI_NOR=y
58CONFIG_SCSI=y 58CONFIG_SCSI=y
59CONFIG_BLK_DEV_SD=y 59CONFIG_BLK_DEV_SD=y
60CONFIG_NETDEVICES=y 60CONFIG_NETDEVICES=y
@@ -82,6 +82,7 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
82# CONFIG_HWMON is not set 82# CONFIG_HWMON is not set
83CONFIG_I2C=y 83CONFIG_I2C=y
84CONFIG_I2C_RCAR=y 84CONFIG_I2C_RCAR=y
85CONFIG_GPIO_RCAR=y
85CONFIG_REGULATOR=y 86CONFIG_REGULATOR=y
86CONFIG_MEDIA_SUPPORT=y 87CONFIG_MEDIA_SUPPORT=y
87CONFIG_MEDIA_CAMERA_SUPPORT=y 88CONFIG_MEDIA_CAMERA_SUPPORT=y
diff --git a/arch/arm/configs/clps711x_defconfig b/arch/arm/configs/clps711x_defconfig
index 0facf9da047c..fc105c9178cc 100644
--- a/arch/arm/configs/clps711x_defconfig
+++ b/arch/arm/configs/clps711x_defconfig
@@ -68,8 +68,8 @@ CONFIG_GPIO_GENERIC_PLATFORM=y
68# CONFIG_HWMON is not set 68# CONFIG_HWMON is not set
69CONFIG_FB=y 69CONFIG_FB=y
70CONFIG_FB_CLPS711X=y 70CONFIG_FB_CLPS711X=y
71CONFIG_BACKLIGHT_LCD_SUPPORT=y
72CONFIG_LCD_PLATFORM=y 71CONFIG_LCD_PLATFORM=y
72CONFIG_BACKLIGHT_PWM=y
73# CONFIG_USB_SUPPORT is not set 73# CONFIG_USB_SUPPORT is not set
74CONFIG_NEW_LEDS=y 74CONFIG_NEW_LEDS=y
75CONFIG_LEDS_CLASS=y 75CONFIG_LEDS_CLASS=y
@@ -77,6 +77,8 @@ CONFIG_LEDS_GPIO=y
77CONFIG_LEDS_TRIGGERS=y 77CONFIG_LEDS_TRIGGERS=y
78CONFIG_LEDS_TRIGGER_HEARTBEAT=y 78CONFIG_LEDS_TRIGGER_HEARTBEAT=y
79# CONFIG_IOMMU_SUPPORT is not set 79# CONFIG_IOMMU_SUPPORT is not set
80CONFIG_PWM=y
81CONFIG_PWM_CLPS711X=y
80CONFIG_EXT2_FS=y 82CONFIG_EXT2_FS=y
81CONFIG_CRAMFS=y 83CONFIG_CRAMFS=y
82CONFIG_MINIX_FS=y 84CONFIG_MINIX_FS=y
diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig
index 1b650c85bdd0..72233b9c9d07 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -107,5 +107,6 @@ CONFIG_DEBUG_SPINLOCK=y
107CONFIG_DEBUG_MUTEXES=y 107CONFIG_DEBUG_MUTEXES=y
108CONFIG_DEBUG_USER=y 108CONFIG_DEBUG_USER=y
109CONFIG_DEBUG_LL=y 109CONFIG_DEBUG_LL=y
110CONFIG_DEBUG_LL_UART_PL01X=y
110# CONFIG_CRYPTO_ANSI_CPRNG is not set 111# CONFIG_CRYPTO_ANSI_CPRNG is not set
111CONFIG_LIBCRC32C=y 112CONFIG_LIBCRC32C=y
diff --git a/arch/arm/configs/ezx_defconfig b/arch/arm/configs/ezx_defconfig
index d95763d5f0d8..eb440aae4283 100644
--- a/arch/arm/configs/ezx_defconfig
+++ b/arch/arm/configs/ezx_defconfig
@@ -230,7 +230,6 @@ CONFIG_POWER_SUPPLY=y
230CONFIG_EZX_PCAP=y 230CONFIG_EZX_PCAP=y
231CONFIG_REGULATOR=y 231CONFIG_REGULATOR=y
232CONFIG_REGULATOR_DEBUG=y 232CONFIG_REGULATOR_DEBUG=y
233CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
234CONFIG_REGULATOR_USERSPACE_CONSUMER=y 233CONFIG_REGULATOR_USERSPACE_CONSUMER=y
235CONFIG_REGULATOR_PCAP=y 234CONFIG_REGULATOR_PCAP=y
236CONFIG_MEDIA_SUPPORT=y 235CONFIG_MEDIA_SUPPORT=y
diff --git a/arch/arm/configs/hi3xxx_defconfig b/arch/arm/configs/hisi_defconfig
index 9630687e7d07..1772505caeba 100644
--- a/arch/arm/configs/hi3xxx_defconfig
+++ b/arch/arm/configs/hisi_defconfig
@@ -6,10 +6,15 @@ CONFIG_RD_LZMA=y
6CONFIG_ARCH_HISI=y 6CONFIG_ARCH_HISI=y
7CONFIG_ARCH_HI3xxx=y 7CONFIG_ARCH_HI3xxx=y
8CONFIG_ARCH_HIX5HD2=y 8CONFIG_ARCH_HIX5HD2=y
9CONFIG_ARCH_HIP04=y
9CONFIG_SMP=y 10CONFIG_SMP=y
11CONFIG_NR_CPUS=16
10CONFIG_PREEMPT=y 12CONFIG_PREEMPT=y
11CONFIG_AEABI=y 13CONFIG_AEABI=y
14CONFIG_HIGHMEM=y
12CONFIG_ARM_APPENDED_DTB=y 15CONFIG_ARM_APPENDED_DTB=y
16CONFIG_ARM_ATAG_DTB_COMPAT=y
17CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
13CONFIG_NET=y 18CONFIG_NET=y
14CONFIG_UNIX=y 19CONFIG_UNIX=y
15CONFIG_INET=y 20CONFIG_INET=y
@@ -21,6 +26,12 @@ CONFIG_BLK_DEV_SD=y
21CONFIG_ATA=y 26CONFIG_ATA=y
22CONFIG_SATA_AHCI_PLATFORM=y 27CONFIG_SATA_AHCI_PLATFORM=y
23CONFIG_NETDEVICES=y 28CONFIG_NETDEVICES=y
29CONFIG_SERIAL_8250=y
30CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
31CONFIG_SERIAL_8250_CONSOLE=y
32CONFIG_SERIAL_8250_NR_UARTS=2
33CONFIG_SERIAL_8250_RUNTIME_UARTS=2
34CONFIG_SERIAL_8250_DW=y
24CONFIG_SERIAL_AMBA_PL011=y 35CONFIG_SERIAL_AMBA_PL011=y
25CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 36CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
26CONFIG_SERIAL_OF_PLATFORM=y 37CONFIG_SERIAL_OF_PLATFORM=y
@@ -56,3 +67,5 @@ CONFIG_PRINTK_TIME=y
56CONFIG_DEBUG_FS=y 67CONFIG_DEBUG_FS=y
57CONFIG_DEBUG_KERNEL=y 68CONFIG_DEBUG_KERNEL=y
58CONFIG_LOCKUP_DETECTOR=y 69CONFIG_LOCKUP_DETECTOR=y
70CONFIG_VFP=y
71CONFIG_VFPv3=y
diff --git a/arch/arm/configs/imote2_defconfig b/arch/arm/configs/imote2_defconfig
index fd996bb13022..182e54692664 100644
--- a/arch/arm/configs/imote2_defconfig
+++ b/arch/arm/configs/imote2_defconfig
@@ -208,7 +208,6 @@ CONFIG_POWER_SUPPLY=y
208CONFIG_PMIC_DA903X=y 208CONFIG_PMIC_DA903X=y
209CONFIG_REGULATOR=y 209CONFIG_REGULATOR=y
210CONFIG_REGULATOR_DEBUG=y 210CONFIG_REGULATOR_DEBUG=y
211CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
212CONFIG_REGULATOR_USERSPACE_CONSUMER=y 211CONFIG_REGULATOR_USERSPACE_CONSUMER=y
213CONFIG_REGULATOR_DA903X=y 212CONFIG_REGULATOR_DA903X=y
214CONFIG_MEDIA_SUPPORT=y 213CONFIG_MEDIA_SUPPORT=y
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index 63bde0efc041..e688741c89aa 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -21,8 +21,6 @@ CONFIG_ARCH_MULTI_V4T=y
21CONFIG_ARCH_MULTI_V5=y 21CONFIG_ARCH_MULTI_V5=y
22# CONFIG_ARCH_MULTI_V7 is not set 22# CONFIG_ARCH_MULTI_V7 is not set
23CONFIG_ARCH_MXC=y 23CONFIG_ARCH_MXC=y
24CONFIG_MXC_IRQ_PRIOR=y
25CONFIG_ARCH_MX1ADS=y
26CONFIG_MACH_SCB9328=y 24CONFIG_MACH_SCB9328=y
27CONFIG_MACH_APF9328=y 25CONFIG_MACH_APF9328=y
28CONFIG_MACH_MX21ADS=y 26CONFIG_MACH_MX21ADS=y
@@ -30,10 +28,6 @@ CONFIG_MACH_MX25_3DS=y
30CONFIG_MACH_EUKREA_CPUIMX25SD=y 28CONFIG_MACH_EUKREA_CPUIMX25SD=y
31CONFIG_MACH_IMX25_DT=y 29CONFIG_MACH_IMX25_DT=y
32CONFIG_MACH_MX27ADS=y 30CONFIG_MACH_MX27ADS=y
33CONFIG_MACH_PCM038=y
34CONFIG_MACH_CPUIMX27=y
35CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2=y
36CONFIG_MACH_EUKREA_CPUIMX27_USEUART4=y
37CONFIG_MACH_MX27_3DS=y 31CONFIG_MACH_MX27_3DS=y
38CONFIG_MACH_IMX27_VISSTRIM_M10=y 32CONFIG_MACH_IMX27_VISSTRIM_M10=y
39CONFIG_MACH_PCA100=y 33CONFIG_MACH_PCA100=y
@@ -43,8 +37,6 @@ CONFIG_PREEMPT=y
43CONFIG_AEABI=y 37CONFIG_AEABI=y
44CONFIG_ZBOOT_ROM_TEXT=0x0 38CONFIG_ZBOOT_ROM_TEXT=0x0
45CONFIG_ZBOOT_ROM_BSS=0x0 39CONFIG_ZBOOT_ROM_BSS=0x0
46CONFIG_FPE_NWFPE=y
47CONFIG_FPE_NWFPE_XP=y
48CONFIG_PM_DEBUG=y 40CONFIG_PM_DEBUG=y
49CONFIG_NET=y 41CONFIG_NET=y
50CONFIG_PACKET=y 42CONFIG_PACKET=y
@@ -63,6 +55,7 @@ CONFIG_NETFILTER=y
63CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 55CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
64CONFIG_DEVTMPFS=y 56CONFIG_DEVTMPFS=y
65CONFIG_DEVTMPFS_MOUNT=y 57CONFIG_DEVTMPFS_MOUNT=y
58CONFIG_IMX_WEIM=y
66CONFIG_MTD=y 59CONFIG_MTD=y
67CONFIG_MTD_CMDLINE_PARTS=y 60CONFIG_MTD_CMDLINE_PARTS=y
68CONFIG_MTD_BLOCK=y 61CONFIG_MTD_BLOCK=y
@@ -78,8 +71,8 @@ CONFIG_MTD_NAND_MXC=y
78CONFIG_MTD_UBI=y 71CONFIG_MTD_UBI=y
79CONFIG_EEPROM_AT24=y 72CONFIG_EEPROM_AT24=y
80CONFIG_EEPROM_AT25=y 73CONFIG_EEPROM_AT25=y
81CONFIG_ATA=y
82CONFIG_BLK_DEV_SD=y 74CONFIG_BLK_DEV_SD=y
75CONFIG_ATA=y
83CONFIG_PATA_IMX=y 76CONFIG_PATA_IMX=y
84CONFIG_NETDEVICES=y 77CONFIG_NETDEVICES=y
85CONFIG_CS89x0=y 78CONFIG_CS89x0=y
@@ -102,10 +95,8 @@ CONFIG_SERIAL_8250=m
102CONFIG_SERIAL_IMX=y 95CONFIG_SERIAL_IMX=y
103CONFIG_SERIAL_IMX_CONSOLE=y 96CONFIG_SERIAL_IMX_CONSOLE=y
104# CONFIG_HW_RANDOM is not set 97# CONFIG_HW_RANDOM is not set
105CONFIG_I2C=y
106CONFIG_I2C_CHARDEV=y 98CONFIG_I2C_CHARDEV=y
107CONFIG_I2C_IMX=y 99CONFIG_I2C_IMX=y
108CONFIG_SPI=y
109CONFIG_SPI_IMX=y 100CONFIG_SPI_IMX=y
110CONFIG_SPI_SPIDEV=y 101CONFIG_SPI_SPIDEV=y
111CONFIG_GPIO_SYSFS=y 102CONFIG_GPIO_SYSFS=y
@@ -132,10 +123,7 @@ CONFIG_VIDEO_CODA=y
132CONFIG_SOC_CAMERA_OV2640=y 123CONFIG_SOC_CAMERA_OV2640=y
133CONFIG_FB=y 124CONFIG_FB=y
134CONFIG_FB_IMX=y 125CONFIG_FB_IMX=y
135CONFIG_BACKLIGHT_LCD_SUPPORT=y
136CONFIG_LCD_CLASS_DEVICE=y
137CONFIG_LCD_L4F00242T03=y 126CONFIG_LCD_L4F00242T03=y
138CONFIG_BACKLIGHT_CLASS_DEVICE=y
139CONFIG_FRAMEBUFFER_CONSOLE=y 127CONFIG_FRAMEBUFFER_CONSOLE=y
140CONFIG_LOGO=y 128CONFIG_LOGO=y
141CONFIG_SOUND=y 129CONFIG_SOUND=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 16cfec4385c8..8fca6e276b69 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -32,8 +32,8 @@ CONFIG_MACH_IMX35_DT=y
32CONFIG_MACH_PCM043=y 32CONFIG_MACH_PCM043=y
33CONFIG_MACH_MX35_3DS=y 33CONFIG_MACH_MX35_3DS=y
34CONFIG_MACH_VPR200=y 34CONFIG_MACH_VPR200=y
35CONFIG_SOC_IMX51=y
36CONFIG_SOC_IMX50=y 35CONFIG_SOC_IMX50=y
36CONFIG_SOC_IMX51=y
37CONFIG_SOC_IMX53=y 37CONFIG_SOC_IMX53=y
38CONFIG_SOC_IMX6Q=y 38CONFIG_SOC_IMX6Q=y
39CONFIG_SOC_IMX6SL=y 39CONFIG_SOC_IMX6SL=y
@@ -105,7 +105,6 @@ CONFIG_EEPROM_AT24=y
105CONFIG_EEPROM_AT25=y 105CONFIG_EEPROM_AT25=y
106# CONFIG_SCSI_PROC_FS is not set 106# CONFIG_SCSI_PROC_FS is not set
107CONFIG_BLK_DEV_SD=y 107CONFIG_BLK_DEV_SD=y
108CONFIG_SCSI_MULTI_LUN=y
109CONFIG_SCSI_CONSTANTS=y 108CONFIG_SCSI_CONSTANTS=y
110CONFIG_SCSI_LOGGING=y 109CONFIG_SCSI_LOGGING=y
111CONFIG_SCSI_SCAN_ASYNC=y 110CONFIG_SCSI_SCAN_ASYNC=y
@@ -153,14 +152,12 @@ CONFIG_SERIAL_IMX_CONSOLE=y
153CONFIG_SERIAL_FSL_LPUART=y 152CONFIG_SERIAL_FSL_LPUART=y
154CONFIG_SERIAL_FSL_LPUART_CONSOLE=y 153CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
155CONFIG_HW_RANDOM=y 154CONFIG_HW_RANDOM=y
156CONFIG_HW_RANDOM_MXC_RNGA=y
157# CONFIG_I2C_COMPAT is not set 155# CONFIG_I2C_COMPAT is not set
158CONFIG_I2C_CHARDEV=y 156CONFIG_I2C_CHARDEV=y
159# CONFIG_I2C_HELPER_AUTO is not set 157# CONFIG_I2C_HELPER_AUTO is not set
160CONFIG_I2C_ALGOPCF=m 158CONFIG_I2C_ALGOPCF=m
161CONFIG_I2C_ALGOPCA=m 159CONFIG_I2C_ALGOPCA=m
162CONFIG_I2C_IMX=y 160CONFIG_I2C_IMX=y
163CONFIG_SPI=y
164CONFIG_SPI_IMX=y 161CONFIG_SPI_IMX=y
165CONFIG_GPIO_SYSFS=y 162CONFIG_GPIO_SYSFS=y
166CONFIG_GPIO_MC9S08DZ60=y 163CONFIG_GPIO_MC9S08DZ60=y
@@ -198,7 +195,6 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y
198CONFIG_LCD_CLASS_DEVICE=y 195CONFIG_LCD_CLASS_DEVICE=y
199CONFIG_LCD_L4F00242T03=y 196CONFIG_LCD_L4F00242T03=y
200CONFIG_LCD_PLATFORM=y 197CONFIG_LCD_PLATFORM=y
201CONFIG_BACKLIGHT_CLASS_DEVICE=y
202CONFIG_BACKLIGHT_PWM=y 198CONFIG_BACKLIGHT_PWM=y
203CONFIG_BACKLIGHT_GPIO=y 199CONFIG_BACKLIGHT_GPIO=y
204CONFIG_FRAMEBUFFER_CONSOLE=y 200CONFIG_FRAMEBUFFER_CONSOLE=y
@@ -206,6 +202,7 @@ CONFIG_LOGO=y
206CONFIG_SOUND=y 202CONFIG_SOUND=y
207CONFIG_SND=y 203CONFIG_SND=y
208CONFIG_SND_SOC=y 204CONFIG_SND_SOC=y
205CONFIG_SND_SOC_FSL_SAI=y
209CONFIG_SND_IMX_SOC=y 206CONFIG_SND_IMX_SOC=y
210CONFIG_SND_SOC_PHYCORE_AC97=y 207CONFIG_SND_SOC_PHYCORE_AC97=y
211CONFIG_SND_SOC_EUKREA_TLV320=y 208CONFIG_SND_SOC_EUKREA_TLV320=y
@@ -213,6 +210,7 @@ CONFIG_SND_SOC_IMX_WM8962=y
213CONFIG_SND_SOC_IMX_SGTL5000=y 210CONFIG_SND_SOC_IMX_SGTL5000=y
214CONFIG_SND_SOC_IMX_SPDIF=y 211CONFIG_SND_SOC_IMX_SPDIF=y
215CONFIG_SND_SOC_IMX_MC13783=y 212CONFIG_SND_SOC_IMX_MC13783=y
213CONFIG_SND_SIMPLE_CARD=y
216CONFIG_USB=y 214CONFIG_USB=y
217CONFIG_USB_EHCI_HCD=y 215CONFIG_USB_EHCI_HCD=y
218CONFIG_USB_EHCI_MXC=y 216CONFIG_USB_EHCI_MXC=y
@@ -240,6 +238,7 @@ CONFIG_LEDS_TRIGGER_BACKLIGHT=y
240CONFIG_LEDS_TRIGGER_GPIO=y 238CONFIG_LEDS_TRIGGER_GPIO=y
241CONFIG_RTC_CLASS=y 239CONFIG_RTC_CLASS=y
242CONFIG_RTC_INTF_DEV_UIE_EMUL=y 240CONFIG_RTC_INTF_DEV_UIE_EMUL=y
241CONFIG_RTC_DRV_ISL1208=y
243CONFIG_RTC_DRV_PCF8563=y 242CONFIG_RTC_DRV_PCF8563=y
244CONFIG_RTC_DRV_MC13XXX=y 243CONFIG_RTC_DRV_MC13XXX=y
245CONFIG_RTC_DRV_MXC=y 244CONFIG_RTC_DRV_MXC=y
@@ -254,7 +253,6 @@ CONFIG_DRM_IMX_FB_HELPER=y
254CONFIG_DRM_IMX_PARALLEL_DISPLAY=y 253CONFIG_DRM_IMX_PARALLEL_DISPLAY=y
255CONFIG_DRM_IMX_TVE=y 254CONFIG_DRM_IMX_TVE=y
256CONFIG_DRM_IMX_LDB=y 255CONFIG_DRM_IMX_LDB=y
257CONFIG_DRM_IMX_IPUV3_CORE=y
258CONFIG_DRM_IMX_IPUV3=y 256CONFIG_DRM_IMX_IPUV3=y
259CONFIG_DRM_IMX_HDMI=y 257CONFIG_DRM_IMX_HDMI=y
260# CONFIG_IOMMU_SUPPORT is not set 258# CONFIG_IOMMU_SUPPORT is not set
diff --git a/arch/arm/configs/koelsch_defconfig b/arch/arm/configs/koelsch_defconfig
index 86faab565a96..b33d19b7f134 100644
--- a/arch/arm/configs/koelsch_defconfig
+++ b/arch/arm/configs/koelsch_defconfig
@@ -15,6 +15,9 @@ CONFIG_MACH_KOELSCH=y
15CONFIG_CPU_BPREDICT_DISABLE=y 15CONFIG_CPU_BPREDICT_DISABLE=y
16CONFIG_PL310_ERRATA_588369=y 16CONFIG_PL310_ERRATA_588369=y
17CONFIG_ARM_ERRATA_754322=y 17CONFIG_ARM_ERRATA_754322=y
18CONFIG_PCI=y
19CONFIG_PCI_RCAR_GEN2=y
20CONFIG_PCI_RCAR_GEN2_PCIE=y
18CONFIG_SMP=y 21CONFIG_SMP=y
19CONFIG_SCHED_MC=y 22CONFIG_SCHED_MC=y
20CONFIG_NR_CPUS=8 23CONFIG_NR_CPUS=8
@@ -42,6 +45,8 @@ CONFIG_ATA=y
42CONFIG_SATA_RCAR=y 45CONFIG_SATA_RCAR=y
43CONFIG_MTD=y 46CONFIG_MTD=y
44CONFIG_MTD_M25P80=y 47CONFIG_MTD_M25P80=y
48CONFIG_MTD_SPI_NOR=y
49CONFIG_EEPROM_AT24=y
45CONFIG_NETDEVICES=y 50CONFIG_NETDEVICES=y
46# CONFIG_NET_VENDOR_ARC is not set 51# CONFIG_NET_VENDOR_ARC is not set
47# CONFIG_NET_CADENCE is not set 52# CONFIG_NET_CADENCE is not set
@@ -66,9 +71,12 @@ CONFIG_SERIAL_SH_SCI=y
66CONFIG_SERIAL_SH_SCI_NR_UARTS=20 71CONFIG_SERIAL_SH_SCI_NR_UARTS=20
67CONFIG_SERIAL_SH_SCI_CONSOLE=y 72CONFIG_SERIAL_SH_SCI_CONSOLE=y
68CONFIG_I2C=y 73CONFIG_I2C=y
74CONFIG_I2C_MUX=y
75CONFIG_I2C_SH_MOBILE=y
69CONFIG_I2C_RCAR=y 76CONFIG_I2C_RCAR=y
70CONFIG_SPI=y 77CONFIG_SPI=y
71CONFIG_SPI_RSPI=y 78CONFIG_SPI_RSPI=y
79CONFIG_SPI_SH_MSIOF=y
72CONFIG_GPIOLIB=y 80CONFIG_GPIOLIB=y
73CONFIG_GPIO_RCAR=y 81CONFIG_GPIO_RCAR=y
74# CONFIG_HWMON is not set 82# CONFIG_HWMON is not set
@@ -76,7 +84,16 @@ CONFIG_THERMAL=y
76CONFIG_RCAR_THERMAL=y 84CONFIG_RCAR_THERMAL=y
77CONFIG_REGULATOR=y 85CONFIG_REGULATOR=y
78CONFIG_REGULATOR_FIXED_VOLTAGE=y 86CONFIG_REGULATOR_FIXED_VOLTAGE=y
87CONFIG_REGULATOR_DA9210=y
79CONFIG_REGULATOR_GPIO=y 88CONFIG_REGULATOR_GPIO=y
89CONFIG_MEDIA_SUPPORT=y
90CONFIG_MEDIA_CAMERA_SUPPORT=y
91CONFIG_V4L_PLATFORM_DRIVERS=y
92CONFIG_SOC_CAMERA=y
93CONFIG_SOC_CAMERA_PLATFORM=y
94CONFIG_VIDEO_RCAR_VIN=y
95# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
96CONFIG_VIDEO_ADV7180=y
80# CONFIG_HID is not set 97# CONFIG_HID is not set
81# CONFIG_USB_SUPPORT is not set 98# CONFIG_USB_SUPPORT is not set
82CONFIG_MMC=y 99CONFIG_MMC=y
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
index bd097d455f87..8cb115d74fdf 100644
--- a/arch/arm/configs/kzm9g_defconfig
+++ b/arch/arm/configs/kzm9g_defconfig
@@ -119,6 +119,7 @@ CONFIG_MMC_SDHI=y
119CONFIG_MMC_SH_MMCIF=y 119CONFIG_MMC_SH_MMCIF=y
120CONFIG_NEW_LEDS=y 120CONFIG_NEW_LEDS=y
121CONFIG_LEDS_CLASS=y 121CONFIG_LEDS_CLASS=y
122CONFIG_LEDS_GPIO=y
122CONFIG_RTC_CLASS=y 123CONFIG_RTC_CLASS=y
123CONFIG_RTC_DRV_RS5C372=y 124CONFIG_RTC_DRV_RS5C372=y
124CONFIG_DMADEVICES=y 125CONFIG_DMADEVICES=y
diff --git a/arch/arm/configs/lager_defconfig b/arch/arm/configs/lager_defconfig
index 58702440472a..929c571ea29b 100644
--- a/arch/arm/configs/lager_defconfig
+++ b/arch/arm/configs/lager_defconfig
@@ -22,6 +22,9 @@ CONFIG_ARM_ERRATA_458693=y
22CONFIG_ARM_ERRATA_460075=y 22CONFIG_ARM_ERRATA_460075=y
23CONFIG_ARM_ERRATA_743622=y 23CONFIG_ARM_ERRATA_743622=y
24CONFIG_ARM_ERRATA_754322=y 24CONFIG_ARM_ERRATA_754322=y
25CONFIG_PCI=y
26CONFIG_PCI_RCAR_GEN2=y
27CONFIG_PCI_RCAR_GEN2_PCIE=y
25CONFIG_HAVE_ARM_ARCH_TIMER=y 28CONFIG_HAVE_ARM_ARCH_TIMER=y
26CONFIG_AEABI=y 29CONFIG_AEABI=y
27# CONFIG_OABI_COMPAT is not set 30# CONFIG_OABI_COMPAT is not set
@@ -53,6 +56,7 @@ CONFIG_DEVTMPFS=y
53CONFIG_DEVTMPFS_MOUNT=y 56CONFIG_DEVTMPFS_MOUNT=y
54CONFIG_MTD=y 57CONFIG_MTD=y
55CONFIG_MTD_M25P80=y 58CONFIG_MTD_M25P80=y
59CONFIG_MTD_SPI_NOR=y
56CONFIG_BLK_DEV_SD=y 60CONFIG_BLK_DEV_SD=y
57CONFIG_ATA=y 61CONFIG_ATA=y
58CONFIG_SATA_RCAR=y 62CONFIG_SATA_RCAR=y
@@ -85,11 +89,12 @@ CONFIG_SERIAL_SH_SCI=y
85CONFIG_SERIAL_SH_SCI_NR_UARTS=10 89CONFIG_SERIAL_SH_SCI_NR_UARTS=10
86CONFIG_SERIAL_SH_SCI_CONSOLE=y 90CONFIG_SERIAL_SH_SCI_CONSOLE=y
87# CONFIG_HW_RANDOM is not set 91# CONFIG_HW_RANDOM is not set
88CONFIG_I2C=y
89CONFIG_I2C_GPIO=y 92CONFIG_I2C_GPIO=y
93CONFIG_I2C_SH_MOBILE=y
90CONFIG_I2C_RCAR=y 94CONFIG_I2C_RCAR=y
91CONFIG_SPI=y 95CONFIG_SPI=y
92CONFIG_SPI_RSPI=y 96CONFIG_SPI_RSPI=y
97CONFIG_SPI_SH_MSIOF=y
93CONFIG_GPIO_SH_PFC=y 98CONFIG_GPIO_SH_PFC=y
94CONFIG_GPIOLIB=y 99CONFIG_GPIOLIB=y
95CONFIG_GPIO_RCAR=y 100CONFIG_GPIO_RCAR=y
@@ -98,6 +103,7 @@ CONFIG_THERMAL=y
98CONFIG_RCAR_THERMAL=y 103CONFIG_RCAR_THERMAL=y
99CONFIG_REGULATOR=y 104CONFIG_REGULATOR=y
100CONFIG_REGULATOR_FIXED_VOLTAGE=y 105CONFIG_REGULATOR_FIXED_VOLTAGE=y
106CONFIG_REGULATOR_DA9210=y
101CONFIG_REGULATOR_GPIO=y 107CONFIG_REGULATOR_GPIO=y
102CONFIG_MEDIA_SUPPORT=y 108CONFIG_MEDIA_SUPPORT=y
103CONFIG_MEDIA_CAMERA_SUPPORT=y 109CONFIG_MEDIA_CAMERA_SUPPORT=y
diff --git a/arch/arm/configs/lpc32xx_defconfig b/arch/arm/configs/lpc32xx_defconfig
index 398a367ffce8..9f56ca3985ae 100644
--- a/arch/arm/configs/lpc32xx_defconfig
+++ b/arch/arm/configs/lpc32xx_defconfig
@@ -59,6 +59,7 @@ CONFIG_MTD_M25P80=y
59CONFIG_MTD_NAND=y 59CONFIG_MTD_NAND=y
60CONFIG_MTD_NAND_SLC_LPC32XX=y 60CONFIG_MTD_NAND_SLC_LPC32XX=y
61CONFIG_MTD_NAND_MLC_LPC32XX=y 61CONFIG_MTD_NAND_MLC_LPC32XX=y
62CONFIG_MTD_UBI=y
62CONFIG_BLK_DEV_LOOP=y 63CONFIG_BLK_DEV_LOOP=y
63CONFIG_BLK_DEV_CRYPTOLOOP=y 64CONFIG_BLK_DEV_CRYPTOLOOP=y
64CONFIG_BLK_DEV_RAM=y 65CONFIG_BLK_DEV_RAM=y
@@ -189,6 +190,7 @@ CONFIG_VFAT_FS=y
189CONFIG_TMPFS=y 190CONFIG_TMPFS=y
190CONFIG_JFFS2_FS=y 191CONFIG_JFFS2_FS=y
191CONFIG_JFFS2_FS_WBUF_VERIFY=y 192CONFIG_JFFS2_FS_WBUF_VERIFY=y
193CONFIG_UBIFS_FS=y
192CONFIG_CRAMFS=y 194CONFIG_CRAMFS=y
193CONFIG_NFS_FS=y 195CONFIG_NFS_FS=y
194CONFIG_ROOT_NFS=y 196CONFIG_ROOT_NFS=y
diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig
index 92994f7f6fd8..ff91630d34e1 100644
--- a/arch/arm/configs/marzen_defconfig
+++ b/arch/arm/configs/marzen_defconfig
@@ -84,6 +84,7 @@ CONFIG_GPIO_RCAR=y
84CONFIG_THERMAL=y 84CONFIG_THERMAL=y
85CONFIG_RCAR_THERMAL=y 85CONFIG_RCAR_THERMAL=y
86CONFIG_SSB=y 86CONFIG_SSB=y
87CONFIG_REGULATOR=y
87CONFIG_MEDIA_SUPPORT=y 88CONFIG_MEDIA_SUPPORT=y
88CONFIG_MEDIA_CAMERA_SUPPORT=y 89CONFIG_MEDIA_CAMERA_SUPPORT=y
89CONFIG_V4L_PLATFORM_DRIVERS=y 90CONFIG_V4L_PLATFORM_DRIVERS=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 5fb95fb758d9..491b7d5523bf 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -28,7 +28,9 @@ CONFIG_ARCH_HIGHBANK=y
28CONFIG_ARCH_HISI=y 28CONFIG_ARCH_HISI=y
29CONFIG_ARCH_HI3xxx=y 29CONFIG_ARCH_HI3xxx=y
30CONFIG_ARCH_HIX5HD2=y 30CONFIG_ARCH_HIX5HD2=y
31CONFIG_ARCH_HIP04=y
31CONFIG_ARCH_KEYSTONE=y 32CONFIG_ARCH_KEYSTONE=y
33CONFIG_ARCH_MESON=y
32CONFIG_ARCH_MXC=y 34CONFIG_ARCH_MXC=y
33CONFIG_SOC_IMX51=y 35CONFIG_SOC_IMX51=y
34CONFIG_SOC_IMX53=y 36CONFIG_SOC_IMX53=y
@@ -42,6 +44,7 @@ CONFIG_SOC_AM33XX=y
42CONFIG_SOC_AM43XX=y 44CONFIG_SOC_AM43XX=y
43CONFIG_SOC_DRA7XX=y 45CONFIG_SOC_DRA7XX=y
44CONFIG_ARCH_QCOM=y 46CONFIG_ARCH_QCOM=y
47CONFIG_ARCH_MEDIATEK=y
45CONFIG_ARCH_MSM8X60=y 48CONFIG_ARCH_MSM8X60=y
46CONFIG_ARCH_MSM8960=y 49CONFIG_ARCH_MSM8960=y
47CONFIG_ARCH_MSM8974=y 50CONFIG_ARCH_MSM8974=y
@@ -74,6 +77,7 @@ CONFIG_PCI=y
74CONFIG_PCI_MSI=y 77CONFIG_PCI_MSI=y
75CONFIG_PCI_MVEBU=y 78CONFIG_PCI_MVEBU=y
76CONFIG_PCI_TEGRA=y 79CONFIG_PCI_TEGRA=y
80CONFIG_PCIEPORTBUS=y
77CONFIG_SMP=y 81CONFIG_SMP=y
78CONFIG_NR_CPUS=8 82CONFIG_NR_CPUS=8
79CONFIG_HIGHPTE=y 83CONFIG_HIGHPTE=y
@@ -86,6 +90,7 @@ CONFIG_CPU_FREQ_STAT_DETAILS=y
86CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 90CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
87CONFIG_CPU_IDLE=y 91CONFIG_CPU_IDLE=y
88CONFIG_NEON=y 92CONFIG_NEON=y
93CONFIG_ARM_ZYNQ_CPUIDLE=y
89CONFIG_NET=y 94CONFIG_NET=y
90CONFIG_PACKET=y 95CONFIG_PACKET=y
91CONFIG_UNIX=y 96CONFIG_UNIX=y
@@ -106,6 +111,7 @@ CONFIG_CAN=y
106CONFIG_CAN_RAW=y 111CONFIG_CAN_RAW=y
107CONFIG_CAN_BCM=y 112CONFIG_CAN_BCM=y
108CONFIG_CAN_DEV=y 113CONFIG_CAN_DEV=y
114CONFIG_CAN_XILINXCAN=y
109CONFIG_CAN_MCP251X=y 115CONFIG_CAN_MCP251X=y
110CONFIG_CFG80211=m 116CONFIG_CFG80211=m
111CONFIG_MAC80211=m 117CONFIG_MAC80211=m
@@ -119,7 +125,10 @@ CONFIG_CMA_SIZE_MBYTES=64
119CONFIG_OMAP_OCP2SCP=y 125CONFIG_OMAP_OCP2SCP=y
120CONFIG_MTD=y 126CONFIG_MTD=y
121CONFIG_MTD_M25P80=y 127CONFIG_MTD_M25P80=y
128CONFIG_MTD_SPI_NOR=y
122CONFIG_BLK_DEV_LOOP=y 129CONFIG_BLK_DEV_LOOP=y
130CONFIG_AD525X_DPOT=y
131CONFIG_AD525X_DPOT_I2C=y
123CONFIG_ICS932S401=y 132CONFIG_ICS932S401=y
124CONFIG_APDS9802ALS=y 133CONFIG_APDS9802ALS=y
125CONFIG_ISL29003=y 134CONFIG_ISL29003=y
@@ -129,9 +138,11 @@ CONFIG_BLK_DEV_SD=y
129CONFIG_BLK_DEV_SR=y 138CONFIG_BLK_DEV_SR=y
130CONFIG_SCSI_MULTI_LUN=y 139CONFIG_SCSI_MULTI_LUN=y
131CONFIG_ATA=y 140CONFIG_ATA=y
141CONFIG_SATA_AHCI=y
132CONFIG_SATA_AHCI_PLATFORM=y 142CONFIG_SATA_AHCI_PLATFORM=y
133CONFIG_AHCI_ST=y 143CONFIG_AHCI_ST=y
134CONFIG_AHCI_SUNXI=y 144CONFIG_AHCI_SUNXI=y
145CONFIG_AHCI_TEGRA=y
135CONFIG_SATA_HIGHBANK=y 146CONFIG_SATA_HIGHBANK=y
136CONFIG_SATA_MV=y 147CONFIG_SATA_MV=y
137CONFIG_NETDEVICES=y 148CONFIG_NETDEVICES=y
@@ -146,6 +157,7 @@ CONFIG_R8169=y
146CONFIG_SMSC911X=y 157CONFIG_SMSC911X=y
147CONFIG_STMMAC_ETH=y 158CONFIG_STMMAC_ETH=y
148CONFIG_TI_CPSW=y 159CONFIG_TI_CPSW=y
160CONFIG_XILINX_EMACLITE=y
149CONFIG_AT803X_PHY=y 161CONFIG_AT803X_PHY=y
150CONFIG_MARVELL_PHY=y 162CONFIG_MARVELL_PHY=y
151CONFIG_ICPLUS_PHY=y 163CONFIG_ICPLUS_PHY=y
@@ -156,6 +168,7 @@ CONFIG_USB_NET_SMSC95XX=y
156CONFIG_BRCMFMAC=m 168CONFIG_BRCMFMAC=m
157CONFIG_RT2X00=m 169CONFIG_RT2X00=m
158CONFIG_RT2800USB=m 170CONFIG_RT2800USB=m
171CONFIG_INPUT_JOYDEV=y
159CONFIG_INPUT_EVDEV=y 172CONFIG_INPUT_EVDEV=y
160CONFIG_KEYBOARD_GPIO=y 173CONFIG_KEYBOARD_GPIO=y
161CONFIG_KEYBOARD_TEGRA=y 174CONFIG_KEYBOARD_TEGRA=y
@@ -164,6 +177,7 @@ CONFIG_KEYBOARD_ST_KEYSCAN=y
164CONFIG_KEYBOARD_CROS_EC=y 177CONFIG_KEYBOARD_CROS_EC=y
165CONFIG_MOUSE_PS2_ELANTECH=y 178CONFIG_MOUSE_PS2_ELANTECH=y
166CONFIG_INPUT_TOUCHSCREEN=y 179CONFIG_INPUT_TOUCHSCREEN=y
180CONFIG_TOUCHSCREEN_ATMEL_MXT=y
167CONFIG_TOUCHSCREEN_STMPE=y 181CONFIG_TOUCHSCREEN_STMPE=y
168CONFIG_INPUT_MISC=y 182CONFIG_INPUT_MISC=y
169CONFIG_INPUT_MPU3050=y 183CONFIG_INPUT_MPU3050=y
@@ -173,6 +187,8 @@ CONFIG_SERIAL_8250_CONSOLE=y
173CONFIG_SERIAL_8250_DW=y 187CONFIG_SERIAL_8250_DW=y
174CONFIG_SERIAL_AMBA_PL011=y 188CONFIG_SERIAL_AMBA_PL011=y
175CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 189CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
190CONFIG_SERIAL_MESON=y
191CONFIG_SERIAL_MESON_CONSOLE=y
176CONFIG_SERIAL_SAMSUNG=y 192CONFIG_SERIAL_SAMSUNG=y
177CONFIG_SERIAL_SAMSUNG_CONSOLE=y 193CONFIG_SERIAL_SAMSUNG_CONSOLE=y
178CONFIG_SERIAL_SIRFSOC=y 194CONFIG_SERIAL_SIRFSOC=y
@@ -205,6 +221,8 @@ CONFIG_I2C_SIRF=y
205CONFIG_I2C_TEGRA=y 221CONFIG_I2C_TEGRA=y
206CONFIG_I2C_ST=y 222CONFIG_I2C_ST=y
207CONFIG_SPI=y 223CONFIG_SPI=y
224CONFIG_I2C_XILINX=y
225CONFIG_SPI_CADENCE=y
208CONFIG_SPI_OMAP24XX=y 226CONFIG_SPI_OMAP24XX=y
209CONFIG_SPI_ORION=y 227CONFIG_SPI_ORION=y
210CONFIG_SPI_PL022=y 228CONFIG_SPI_PL022=y
@@ -214,11 +232,14 @@ CONFIG_SPI_SUN6I=y
214CONFIG_SPI_TEGRA114=y 232CONFIG_SPI_TEGRA114=y
215CONFIG_SPI_TEGRA20_SFLASH=y 233CONFIG_SPI_TEGRA20_SFLASH=y
216CONFIG_SPI_TEGRA20_SLINK=y 234CONFIG_SPI_TEGRA20_SLINK=y
235CONFIG_SPI_XILINX=y
217CONFIG_PINCTRL_AS3722=y 236CONFIG_PINCTRL_AS3722=y
218CONFIG_PINCTRL_PALMAS=y 237CONFIG_PINCTRL_PALMAS=y
219CONFIG_GPIO_SYSFS=y 238CONFIG_GPIO_SYSFS=y
220CONFIG_GPIO_GENERIC_PLATFORM=y 239CONFIG_GPIO_GENERIC_PLATFORM=y
221CONFIG_GPIO_DWAPB=y 240CONFIG_GPIO_DWAPB=y
241CONFIG_GPIO_XILINX=y
242CONFIG_GPIO_ZYNQ=y
222CONFIG_GPIO_PCA953X=y 243CONFIG_GPIO_PCA953X=y
223CONFIG_GPIO_PCA953X_IRQ=y 244CONFIG_GPIO_PCA953X_IRQ=y
224CONFIG_GPIO_TWL4030=y 245CONFIG_GPIO_TWL4030=y
@@ -237,6 +258,7 @@ CONFIG_ARMADA_THERMAL=y
237CONFIG_ST_THERMAL_SYSCFG=y 258CONFIG_ST_THERMAL_SYSCFG=y
238CONFIG_ST_THERMAL_MEMMAP=y 259CONFIG_ST_THERMAL_MEMMAP=y
239CONFIG_WATCHDOG=y 260CONFIG_WATCHDOG=y
261CONFIG_XILINX_WATCHDOG=y
240CONFIG_ORION_WATCHDOG=y 262CONFIG_ORION_WATCHDOG=y
241CONFIG_SUNXI_WATCHDOG=y 263CONFIG_SUNXI_WATCHDOG=y
242CONFIG_MFD_AS3722=y 264CONFIG_MFD_AS3722=y
@@ -250,7 +272,6 @@ CONFIG_MFD_PALMAS=y
250CONFIG_MFD_TPS65090=y 272CONFIG_MFD_TPS65090=y
251CONFIG_MFD_TPS6586X=y 273CONFIG_MFD_TPS6586X=y
252CONFIG_MFD_TPS65910=y 274CONFIG_MFD_TPS65910=y
253CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
254CONFIG_REGULATOR_AB8500=y 275CONFIG_REGULATOR_AB8500=y
255CONFIG_REGULATOR_AS3722=y 276CONFIG_REGULATOR_AS3722=y
256CONFIG_REGULATOR_BCM590XX=y 277CONFIG_REGULATOR_BCM590XX=y
@@ -281,6 +302,7 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y
281CONFIG_BACKLIGHT_CLASS_DEVICE=y 302CONFIG_BACKLIGHT_CLASS_DEVICE=y
282CONFIG_BACKLIGHT_PWM=y 303CONFIG_BACKLIGHT_PWM=y
283CONFIG_FRAMEBUFFER_CONSOLE=y 304CONFIG_FRAMEBUFFER_CONSOLE=y
305CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
284CONFIG_SOUND=y 306CONFIG_SOUND=y
285CONFIG_SND=y 307CONFIG_SND=y
286CONFIG_SND_SOC=y 308CONFIG_SND_SOC=y
@@ -333,7 +355,18 @@ CONFIG_MMC_DW=y
333CONFIG_MMC_DW_EXYNOS=y 355CONFIG_MMC_DW_EXYNOS=y
334CONFIG_NEW_LEDS=y 356CONFIG_NEW_LEDS=y
335CONFIG_LEDS_CLASS=y 357CONFIG_LEDS_CLASS=y
358CONFIG_LEDS_GPIO=y
336CONFIG_LEDS_PWM=y 359CONFIG_LEDS_PWM=y
360CONFIG_LEDS_TRIGGERS=y
361CONFIG_LEDS_TRIGGER_TIMER=y
362CONFIG_LEDS_TRIGGER_ONESHOT=y
363CONFIG_LEDS_TRIGGER_HEARTBEAT=y
364CONFIG_LEDS_TRIGGER_BACKLIGHT=y
365CONFIG_LEDS_TRIGGER_CPU=y
366CONFIG_LEDS_TRIGGER_GPIO=y
367CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
368CONFIG_LEDS_TRIGGER_TRANSIENT=y
369CONFIG_LEDS_TRIGGER_CAMERA=y
337CONFIG_EDAC=y 370CONFIG_EDAC=y
338CONFIG_EDAC_MM_EDAC=y 371CONFIG_EDAC_MM_EDAC=y
339CONFIG_EDAC_HIGHBANK_MC=y 372CONFIG_EDAC_HIGHBANK_MC=y
@@ -349,6 +382,7 @@ CONFIG_RTC_DRV_TPS65910=y
349CONFIG_RTC_DRV_EM3027=y 382CONFIG_RTC_DRV_EM3027=y
350CONFIG_RTC_DRV_PL031=y 383CONFIG_RTC_DRV_PL031=y
351CONFIG_RTC_DRV_VT8500=y 384CONFIG_RTC_DRV_VT8500=y
385CONFIG_RTC_DRV_SUN6I=y
352CONFIG_RTC_DRV_SUNXI=y 386CONFIG_RTC_DRV_SUNXI=y
353CONFIG_RTC_DRV_MV=y 387CONFIG_RTC_DRV_MV=y
354CONFIG_RTC_DRV_TEGRA=y 388CONFIG_RTC_DRV_TEGRA=y
@@ -364,6 +398,7 @@ CONFIG_IMX_SDMA=y
364CONFIG_IMX_DMA=y 398CONFIG_IMX_DMA=y
365CONFIG_MXS_DMA=y 399CONFIG_MXS_DMA=y
366CONFIG_DMA_OMAP=y 400CONFIG_DMA_OMAP=y
401CONFIG_XILINX_VDMA=y
367CONFIG_STAGING=y 402CONFIG_STAGING=y
368CONFIG_SENSORS_ISL29018=y 403CONFIG_SENSORS_ISL29018=y
369CONFIG_SENSORS_ISL29028=y 404CONFIG_SENSORS_ISL29028=y
@@ -371,6 +406,7 @@ CONFIG_MFD_NVEC=y
371CONFIG_KEYBOARD_NVEC=y 406CONFIG_KEYBOARD_NVEC=y
372CONFIG_SERIO_NVEC_PS2=y 407CONFIG_SERIO_NVEC_PS2=y
373CONFIG_NVEC_POWER=y 408CONFIG_NVEC_POWER=y
409CONFIG_NVEC_PAZ00=y
374CONFIG_QCOM_GSBI=y 410CONFIG_QCOM_GSBI=y
375CONFIG_COMMON_CLK_QCOM=y 411CONFIG_COMMON_CLK_QCOM=y
376CONFIG_MSM_GCC_8660=y 412CONFIG_MSM_GCC_8660=y
@@ -380,6 +416,7 @@ CONFIG_TEGRA_IOMMU_GART=y
380CONFIG_TEGRA_IOMMU_SMMU=y 416CONFIG_TEGRA_IOMMU_SMMU=y
381CONFIG_MEMORY=y 417CONFIG_MEMORY=y
382CONFIG_IIO=y 418CONFIG_IIO=y
419CONFIG_XILINX_XADC=y
383CONFIG_AK8975=y 420CONFIG_AK8975=y
384CONFIG_PWM=y 421CONFIG_PWM=y
385CONFIG_PWM_TEGRA=y 422CONFIG_PWM_TEGRA=y
@@ -403,3 +440,4 @@ CONFIG_DEBUG_FS=y
403CONFIG_MAGIC_SYSRQ=y 440CONFIG_MAGIC_SYSRQ=y
404CONFIG_LOCKUP_DETECTOR=y 441CONFIG_LOCKUP_DETECTOR=y
405CONFIG_CRYPTO_DEV_TEGRA_AES=y 442CONFIG_CRYPTO_DEV_TEGRA_AES=y
443CONFIG_GENERIC_CPUFREQ_CPU0=y
diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig
index fdfda1fa9521..ed0a0d1be0f3 100644
--- a/arch/arm/configs/mvebu_v7_defconfig
+++ b/arch/arm/configs/mvebu_v7_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_FHANDLE=y 2CONFIG_FHANDLE=y
4CONFIG_IRQ_DOMAIN_DEBUG=y 3CONFIG_IRQ_DOMAIN_DEBUG=y
@@ -15,9 +14,6 @@ CONFIG_MACH_ARMADA_375=y
15CONFIG_MACH_ARMADA_38X=y 14CONFIG_MACH_ARMADA_38X=y
16CONFIG_MACH_ARMADA_XP=y 15CONFIG_MACH_ARMADA_XP=y
17CONFIG_MACH_DOVE=y 16CONFIG_MACH_DOVE=y
18CONFIG_NEON=y
19# CONFIG_CACHE_L2X0 is not set
20# CONFIG_SWP_EMULATE is not set
21CONFIG_PCI=y 17CONFIG_PCI=y
22CONFIG_PCI_MSI=y 18CONFIG_PCI_MSI=y
23CONFIG_PCI_MVEBU=y 19CONFIG_PCI_MVEBU=y
@@ -29,12 +25,14 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
29CONFIG_ZBOOT_ROM_BSS=0x0 25CONFIG_ZBOOT_ROM_BSS=0x0
30CONFIG_ARM_APPENDED_DTB=y 26CONFIG_ARM_APPENDED_DTB=y
31CONFIG_ARM_ATAG_DTB_COMPAT=y 27CONFIG_ARM_ATAG_DTB_COMPAT=y
28CONFIG_CPU_FREQ=y
32CONFIG_CPU_IDLE=y 29CONFIG_CPU_IDLE=y
33CONFIG_ARM_MVEBU_V7_CPUIDLE=y 30CONFIG_ARM_MVEBU_V7_CPUIDLE=y
34CONFIG_CPU_FREQ=y
35CONFIG_CPUFREQ_GENERIC=y
36CONFIG_VFP=y 31CONFIG_VFP=y
32CONFIG_NEON=y
37CONFIG_NET=y 33CONFIG_NET=y
34CONFIG_PACKET=y
35CONFIG_UNIX=y
38CONFIG_INET=y 36CONFIG_INET=y
39CONFIG_IP_PNP=y 37CONFIG_IP_PNP=y
40CONFIG_IP_PNP_DHCP=y 38CONFIG_IP_PNP_DHCP=y
@@ -44,11 +42,24 @@ CONFIG_BT_MRVL=y
44CONFIG_BT_MRVL_SDIO=y 42CONFIG_BT_MRVL_SDIO=y
45CONFIG_CFG80211=y 43CONFIG_CFG80211=y
46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 44CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
45CONFIG_DEVTMPFS=y
46CONFIG_DEVTMPFS_MOUNT=y
47CONFIG_MTD=y
48CONFIG_MTD_CFI=y
49CONFIG_MTD_CFI_INTELEXT=y
50CONFIG_MTD_CFI_AMDSTD=y
51CONFIG_MTD_CFI_STAA=y
52CONFIG_MTD_PHYSMAP_OF=y
53CONFIG_MTD_M25P80=y
54CONFIG_MTD_NAND=y
55CONFIG_MTD_NAND_PXA3xx=y
56CONFIG_MTD_SPI_NOR=y
47CONFIG_BLK_DEV_SD=y 57CONFIG_BLK_DEV_SD=y
48CONFIG_ATA=y 58CONFIG_ATA=y
49CONFIG_AHCI_MVEBU=y 59CONFIG_AHCI_MVEBU=y
50CONFIG_SATA_MV=y 60CONFIG_SATA_MV=y
51CONFIG_NETDEVICES=y 61CONFIG_NETDEVICES=y
62CONFIG_MV643XX_ETH=y
52CONFIG_MVNETA=y 63CONFIG_MVNETA=y
53CONFIG_MVPP2=y 64CONFIG_MVPP2=y
54CONFIG_MARVELL_PHY=y 65CONFIG_MARVELL_PHY=y
@@ -58,47 +69,36 @@ CONFIG_INPUT_EVDEV=y
58CONFIG_KEYBOARD_GPIO=y 69CONFIG_KEYBOARD_GPIO=y
59CONFIG_SERIAL_8250=y 70CONFIG_SERIAL_8250=y
60CONFIG_SERIAL_8250_CONSOLE=y 71CONFIG_SERIAL_8250_CONSOLE=y
72CONFIG_SERIAL_8250_DW=y
61CONFIG_SERIAL_OF_PLATFORM=y 73CONFIG_SERIAL_OF_PLATFORM=y
62CONFIG_I2C=y 74CONFIG_I2C=y
75CONFIG_I2C_MV64XXX=y
63CONFIG_SPI=y 76CONFIG_SPI=y
64CONFIG_SPI_ORION=y 77CONFIG_SPI_ORION=y
65CONFIG_I2C_MV64XXX=y
66CONFIG_MTD=y
67CONFIG_MTD_CHAR=y
68CONFIG_MTD_M25P80=y
69CONFIG_MTD_SPI_NOR=y
70CONFIG_MTD_CFI=y
71CONFIG_MTD_CFI_INTELEXT=y
72CONFIG_MTD_CFI_AMDSTD=y
73CONFIG_MTD_CFI_STAA=y
74CONFIG_MTD_PHYSMAP_OF=y
75CONFIG_MTD_NAND=y
76CONFIG_MTD_NAND_PXA3xx=y
77CONFIG_SERIAL_8250_DW=y
78CONFIG_GPIOLIB=y
79CONFIG_GPIO_SYSFS=y 78CONFIG_GPIO_SYSFS=y
79CONFIG_SENSORS_GPIO_FAN=y
80CONFIG_THERMAL=y 80CONFIG_THERMAL=y
81CONFIG_ARMADA_THERMAL=y 81CONFIG_ARMADA_THERMAL=y
82CONFIG_WATCHDOG=y
83CONFIG_ORION_WATCHDOG=y
82CONFIG_SOUND=y 84CONFIG_SOUND=y
83CONFIG_SND=y 85CONFIG_SND=y
84CONFIG_SND_SOC=y 86CONFIG_SND_SOC=y
85CONFIG_SND_KIRKWOOD_SOC=y 87CONFIG_SND_KIRKWOOD_SOC=y
86CONFIG_SND_KIRKWOOD_SOC_ARMADA370_DB=y 88CONFIG_SND_KIRKWOOD_SOC_ARMADA370_DB=y
87CONFIG_WATCHDOG=y
88CONFIG_ORION_WATCHDOG=y
89CONFIG_USB_SUPPORT=y
90CONFIG_USB=y 89CONFIG_USB=y
90CONFIG_USB_XHCI_HCD=y
91CONFIG_USB_XHCI_MVEBU=y
91CONFIG_USB_EHCI_HCD=y 92CONFIG_USB_EHCI_HCD=y
92CONFIG_USB_EHCI_ROOT_HUB_TT=y 93CONFIG_USB_EHCI_ROOT_HUB_TT=y
93CONFIG_USB_STORAGE=y 94CONFIG_USB_STORAGE=y
94CONFIG_USB_XHCI_HCD=y
95CONFIG_USB_XHCI_MVEBU=y
96CONFIG_MMC=y 95CONFIG_MMC=y
97CONFIG_MMC_SDHCI_PXAV3=y 96CONFIG_MMC_SDHCI=y
97CONFIG_MMC_SDHCI_PLTFM=y
98CONFIG_MMC_SDHCI_DOVE=y
98CONFIG_MMC_MVSDIO=y 99CONFIG_MMC_MVSDIO=y
99CONFIG_NEW_LEDS=y
100CONFIG_LEDS_GPIO=y 100CONFIG_LEDS_GPIO=y
101CONFIG_LEDS_CLASS=m 101CONFIG_LEDS_CLASS=y
102CONFIG_LEDS_TRIGGERS=y 102CONFIG_LEDS_TRIGGERS=y
103CONFIG_LEDS_TRIGGER_TIMER=y 103CONFIG_LEDS_TRIGGER_TIMER=y
104CONFIG_LEDS_TRIGGER_HEARTBEAT=y 104CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -107,12 +107,9 @@ CONFIG_RTC_DRV_S35390A=y
107CONFIG_RTC_DRV_MV=y 107CONFIG_RTC_DRV_MV=y
108CONFIG_DMADEVICES=y 108CONFIG_DMADEVICES=y
109CONFIG_MV_XOR=y 109CONFIG_MV_XOR=y
110CONFIG_MEMORY=y
111CONFIG_MVEBU_DEVBUS=y
112# CONFIG_IOMMU_SUPPORT is not set 110# CONFIG_IOMMU_SUPPORT is not set
113CONFIG_EXT2_FS=y 111CONFIG_MEMORY=y
114CONFIG_EXT3_FS=y 112CONFIG_EXT4_FS=y
115# CONFIG_EXT3_FS_XATTR is not set
116CONFIG_ISO9660_FS=y 113CONFIG_ISO9660_FS=y
117CONFIG_JOLIET=y 114CONFIG_JOLIET=y
118CONFIG_UDF_FS=m 115CONFIG_UDF_FS=m
@@ -126,10 +123,11 @@ CONFIG_NLS_CODEPAGE_850=y
126CONFIG_NLS_ISO8859_1=y 123CONFIG_NLS_ISO8859_1=y
127CONFIG_NLS_ISO8859_2=y 124CONFIG_NLS_ISO8859_2=y
128CONFIG_NLS_UTF8=y 125CONFIG_NLS_UTF8=y
129CONFIG_MAGIC_SYSRQ=y 126CONFIG_PRINTK_TIME=y
127CONFIG_DEBUG_INFO=y
130CONFIG_DEBUG_FS=y 128CONFIG_DEBUG_FS=y
129CONFIG_MAGIC_SYSRQ=y
131# CONFIG_SCHED_DEBUG is not set 130# CONFIG_SCHED_DEBUG is not set
132CONFIG_TIMER_STATS=y 131CONFIG_TIMER_STATS=y
133# CONFIG_DEBUG_BUGVERBOSE is not set 132# CONFIG_DEBUG_BUGVERBOSE is not set
134CONFIG_DEBUG_INFO=y
135CONFIG_DEBUG_USER=y 133CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index f650f00e8cee..69c7bed3c634 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -1,11 +1,28 @@
1CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
3CONFIG_FHANDLE=y
4CONFIG_AUDIT=y
3CONFIG_NO_HZ=y 5CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y 6CONFIG_HIGH_RES_TIMERS=y
5CONFIG_BSD_PROCESS_ACCT=y 7CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_IKCONFIG=y 8CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 9CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=16 10CONFIG_LOG_BUF_SHIFT=16
11CONFIG_CGROUPS=y
12CONFIG_CGROUP_FREEZER=y
13CONFIG_CGROUP_DEVICE=y
14CONFIG_CPUSETS=y
15CONFIG_CGROUP_CPUACCT=y
16CONFIG_RESOURCE_COUNTERS=y
17CONFIG_MEMCG=y
18CONFIG_MEMCG_SWAP=y
19CONFIG_MEMCG_KMEM=y
20CONFIG_CGROUP_PERF=y
21CONFIG_CGROUP_SCHED=y
22CONFIG_CFS_BANDWIDTH=y
23CONFIG_RT_GROUP_SCHED=y
24CONFIG_BLK_CGROUP=y
25CONFIG_NAMESPACES=y
9CONFIG_BLK_DEV_INITRD=y 26CONFIG_BLK_DEV_INITRD=y
10CONFIG_EXPERT=y 27CONFIG_EXPERT=y
11CONFIG_SLAB=y 28CONFIG_SLAB=y
@@ -32,19 +49,26 @@ CONFIG_SOC_OMAP5=y
32CONFIG_SOC_AM33XX=y 49CONFIG_SOC_AM33XX=y
33CONFIG_SOC_AM43XX=y 50CONFIG_SOC_AM43XX=y
34CONFIG_SOC_DRA7XX=y 51CONFIG_SOC_DRA7XX=y
35CONFIG_CACHE_L2X0=y
36CONFIG_ARM_THUMBEE=y 52CONFIG_ARM_THUMBEE=y
37CONFIG_ARM_ERRATA_411920=y 53CONFIG_ARM_ERRATA_411920=y
38CONFIG_SMP=y 54CONFIG_SMP=y
39CONFIG_NR_CPUS=2 55CONFIG_NR_CPUS=2
40CONFIG_CMA=y 56CONFIG_CMA=y
57CONFIG_SECCOMP=y
41CONFIG_ZBOOT_ROM_TEXT=0x0 58CONFIG_ZBOOT_ROM_TEXT=0x0
42CONFIG_ZBOOT_ROM_BSS=0x0 59CONFIG_ZBOOT_ROM_BSS=0x0
43CONFIG_ARM_APPENDED_DTB=y 60CONFIG_ARM_APPENDED_DTB=y
44CONFIG_ARM_ATAG_DTB_COMPAT=y 61CONFIG_ARM_ATAG_DTB_COMPAT=y
45CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200" 62CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200"
46CONFIG_KEXEC=y 63CONFIG_KEXEC=y
47CONFIG_FPE_NWFPE=y 64CONFIG_CPU_FREQ=y
65CONFIG_CPU_FREQ_STAT_DETAILS=y
66CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
67CONFIG_CPU_FREQ_GOV_POWERSAVE=y
68CONFIG_CPU_FREQ_GOV_USERSPACE=y
69CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
70CONFIG_GENERIC_CPUFREQ_CPU0=y
71# CONFIG_ARM_OMAP2PLUS_CPUFREQ is not set
48CONFIG_CPU_IDLE=y 72CONFIG_CPU_IDLE=y
49CONFIG_BINFMT_MISC=y 73CONFIG_BINFMT_MISC=y
50CONFIG_PM_DEBUG=y 74CONFIG_PM_DEBUG=y
@@ -61,7 +85,7 @@ CONFIG_IP_PNP_DHCP=y
61CONFIG_IP_PNP_BOOTP=y 85CONFIG_IP_PNP_BOOTP=y
62CONFIG_IP_PNP_RARP=y 86CONFIG_IP_PNP_RARP=y
63# CONFIG_INET_LRO is not set 87# CONFIG_INET_LRO is not set
64# CONFIG_IPV6 is not set 88CONFIG_IPV6=y
65CONFIG_NETFILTER=y 89CONFIG_NETFILTER=y
66CONFIG_CAN=m 90CONFIG_CAN=m
67CONFIG_CAN_C_CAN=m 91CONFIG_CAN_C_CAN=m
@@ -75,9 +99,6 @@ CONFIG_BT_HCIBCM203X=m
75CONFIG_BT_HCIBPA10X=m 99CONFIG_BT_HCIBPA10X=m
76CONFIG_CFG80211=m 100CONFIG_CFG80211=m
77CONFIG_MAC80211=m 101CONFIG_MAC80211=m
78CONFIG_MAC80211_RC_PID=y
79CONFIG_MAC80211_RC_DEFAULT_PID=y
80CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
81CONFIG_DEVTMPFS=y 102CONFIG_DEVTMPFS=y
82CONFIG_DEVTMPFS_MOUNT=y 103CONFIG_DEVTMPFS_MOUNT=y
83CONFIG_DMA_CMA=y 104CONFIG_DMA_CMA=y
@@ -101,9 +122,9 @@ CONFIG_BLK_DEV_RAM_SIZE=16384
101CONFIG_SENSORS_TSL2550=m 122CONFIG_SENSORS_TSL2550=m
102CONFIG_BMP085_I2C=m 123CONFIG_BMP085_I2C=m
103CONFIG_SENSORS_LIS3_I2C=m 124CONFIG_SENSORS_LIS3_I2C=m
125CONFIG_SRAM=y
104CONFIG_SCSI=y 126CONFIG_SCSI=y
105CONFIG_BLK_DEV_SD=y 127CONFIG_BLK_DEV_SD=y
106CONFIG_SCSI_MULTI_LUN=y
107CONFIG_SCSI_SCAN_ASYNC=y 128CONFIG_SCSI_SCAN_ASYNC=y
108CONFIG_MD=y 129CONFIG_MD=y
109CONFIG_NETDEVICES=y 130CONFIG_NETDEVICES=y
@@ -138,7 +159,9 @@ CONFIG_KEYBOARD_GPIO=y
138CONFIG_KEYBOARD_MATRIX=m 159CONFIG_KEYBOARD_MATRIX=m
139CONFIG_KEYBOARD_TWL4030=y 160CONFIG_KEYBOARD_TWL4030=y
140CONFIG_INPUT_TOUCHSCREEN=y 161CONFIG_INPUT_TOUCHSCREEN=y
141CONFIG_TOUCHSCREEN_ADS7846=y 162CONFIG_TOUCHSCREEN_ADS7846=m
163CONFIG_TOUCHSCREEN_TSC2005=m
164CONFIG_TOUCHSCREEN_TSC2007=m
142CONFIG_INPUT_MISC=y 165CONFIG_INPUT_MISC=y
143CONFIG_INPUT_TWL4030_PWRBUTTON=y 166CONFIG_INPUT_TWL4030_PWRBUTTON=y
144# CONFIG_LEGACY_PTYS is not set 167# CONFIG_LEGACY_PTYS is not set
@@ -162,7 +185,13 @@ CONFIG_DEBUG_GPIO=y
162CONFIG_GPIO_SYSFS=y 185CONFIG_GPIO_SYSFS=y
163CONFIG_GPIO_TWL4030=y 186CONFIG_GPIO_TWL4030=y
164CONFIG_W1=y 187CONFIG_W1=y
165CONFIG_POWER_SUPPLY=y 188CONFIG_BATTERY_BQ27x00=m
189CONFIG_CHARGER_ISP1704=m
190CONFIG_CHARGER_TWL4030=m
191CONFIG_CHARGER_BQ2415X=m
192CONFIG_CHARGER_BQ24190=m
193CONFIG_CHARGER_BQ24735=m
194CONFIG_POWER_RESET=y
166CONFIG_POWER_AVS=y 195CONFIG_POWER_AVS=y
167CONFIG_SENSORS_LM75=m 196CONFIG_SENSORS_LM75=m
168CONFIG_THERMAL=y 197CONFIG_THERMAL=y
@@ -183,8 +212,8 @@ CONFIG_MFD_TPS65217=y
183CONFIG_MFD_TPS65218=y 212CONFIG_MFD_TPS65218=y
184CONFIG_MFD_TPS65910=y 213CONFIG_MFD_TPS65910=y
185CONFIG_TWL6040_CORE=y 214CONFIG_TWL6040_CORE=y
186CONFIG_REGULATOR_FIXED_VOLTAGE=y
187CONFIG_REGULATOR_PALMAS=y 215CONFIG_REGULATOR_PALMAS=y
216CONFIG_REGULATOR_PBIAS=y
188CONFIG_REGULATOR_TI_ABB=y 217CONFIG_REGULATOR_TI_ABB=y
189CONFIG_REGULATOR_TPS65023=y 218CONFIG_REGULATOR_TPS65023=y
190CONFIG_REGULATOR_TPS6507X=y 219CONFIG_REGULATOR_TPS6507X=y
@@ -192,12 +221,12 @@ CONFIG_REGULATOR_TPS65217=y
192CONFIG_REGULATOR_TPS65218=y 221CONFIG_REGULATOR_TPS65218=y
193CONFIG_REGULATOR_TPS65910=y 222CONFIG_REGULATOR_TPS65910=y
194CONFIG_REGULATOR_TWL4030=y 223CONFIG_REGULATOR_TWL4030=y
195CONFIG_REGULATOR_PBIAS=y
196CONFIG_FB=y 224CONFIG_FB=y
197CONFIG_FIRMWARE_EDID=y 225CONFIG_FIRMWARE_EDID=y
198CONFIG_FB_MODE_HELPERS=y 226CONFIG_FB_MODE_HELPERS=y
199CONFIG_FB_TILEBLITTING=y 227CONFIG_FB_TILEBLITTING=y
200CONFIG_OMAP2_DSS=m 228CONFIG_OMAP2_DSS=m
229CONFIG_OMAP5_DSS_HDMI=y
201CONFIG_OMAP2_DSS_SDI=y 230CONFIG_OMAP2_DSS_SDI=y
202CONFIG_OMAP2_DSS_DSI=y 231CONFIG_OMAP2_DSS_DSI=y
203CONFIG_FB_OMAP2=m 232CONFIG_FB_OMAP2=m
@@ -205,11 +234,25 @@ CONFIG_DISPLAY_ENCODER_TFP410=m
205CONFIG_DISPLAY_ENCODER_TPD12S015=m 234CONFIG_DISPLAY_ENCODER_TPD12S015=m
206CONFIG_DISPLAY_CONNECTOR_DVI=m 235CONFIG_DISPLAY_CONNECTOR_DVI=m
207CONFIG_DISPLAY_CONNECTOR_HDMI=m 236CONFIG_DISPLAY_CONNECTOR_HDMI=m
237CONFIG_DISPLAY_CONNECTOR_ANALOG_TV=m
208CONFIG_DISPLAY_PANEL_DPI=m 238CONFIG_DISPLAY_PANEL_DPI=m
239CONFIG_DISPLAY_PANEL_DSI_CM=m
240CONFIG_DISPLAY_PANEL_SONY_ACX565AKM=m
241CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02=m
242CONFIG_DISPLAY_PANEL_SHARP_LS037V7DW01=m
243CONFIG_DISPLAY_PANEL_TPO_TD028TTEC1=m
244CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1=m
245CONFIG_DISPLAY_PANEL_NEC_NL8048HL11=m
209CONFIG_BACKLIGHT_LCD_SUPPORT=y 246CONFIG_BACKLIGHT_LCD_SUPPORT=y
210CONFIG_LCD_CLASS_DEVICE=y 247CONFIG_LCD_CLASS_DEVICE=y
211CONFIG_LCD_PLATFORM=y 248CONFIG_LCD_PLATFORM=y
249CONFIG_BACKLIGHT_CLASS_DEVICE=y
250CONFIG_BACKLIGHT_GENERIC=m
251CONFIG_BACKLIGHT_PWM=m
252CONFIG_BACKLIGHT_PANDORA=m
253CONFIG_BACKLIGHT_GPIO=m
212CONFIG_FRAMEBUFFER_CONSOLE=y 254CONFIG_FRAMEBUFFER_CONSOLE=y
255CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
213CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 256CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
214CONFIG_LOGO=y 257CONFIG_LOGO=y
215CONFIG_SOUND=m 258CONFIG_SOUND=m
@@ -221,8 +264,6 @@ CONFIG_SND_DEBUG=y
221CONFIG_SND_USB_AUDIO=m 264CONFIG_SND_USB_AUDIO=m
222CONFIG_SND_SOC=m 265CONFIG_SND_SOC=m
223CONFIG_SND_OMAP_SOC=m 266CONFIG_SND_OMAP_SOC=m
224CONFIG_SND_AM33XX_SOC_EVM=m
225CONFIG_SND_DAVINCI_SOC=m
226CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m 267CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m
227CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m 268CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m
228CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m 269CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
@@ -233,9 +274,6 @@ CONFIG_USB_WDM=y
233CONFIG_USB_STORAGE=y 274CONFIG_USB_STORAGE=y
234CONFIG_USB_DWC3=m 275CONFIG_USB_DWC3=m
235CONFIG_USB_TEST=y 276CONFIG_USB_TEST=y
236CONFIG_NOP_USB_XCEIV=y
237CONFIG_OMAP_USB2=y
238CONFIG_TI_PIPE3=y
239CONFIG_AM335X_PHY_USB=y 277CONFIG_AM335X_PHY_USB=y
240CONFIG_USB_GADGET=y 278CONFIG_USB_GADGET=y
241CONFIG_USB_GADGET_DEBUG=y 279CONFIG_USB_GADGET_DEBUG=y
@@ -243,7 +281,6 @@ CONFIG_USB_GADGET_DEBUG_FILES=y
243CONFIG_USB_GADGET_DEBUG_FS=y 281CONFIG_USB_GADGET_DEBUG_FS=y
244CONFIG_USB_ZERO=m 282CONFIG_USB_ZERO=m
245CONFIG_MMC=y 283CONFIG_MMC=y
246CONFIG_MMC_UNSAFE_RESUME=y
247CONFIG_SDIO_UART=y 284CONFIG_SDIO_UART=y
248CONFIG_MMC_OMAP=y 285CONFIG_MMC_OMAP=y
249CONFIG_MMC_OMAP_HS=y 286CONFIG_MMC_OMAP_HS=y
@@ -267,15 +304,23 @@ CONFIG_TI_EDMA=y
267CONFIG_DMA_OMAP=y 304CONFIG_DMA_OMAP=y
268CONFIG_EXTCON=y 305CONFIG_EXTCON=y
269CONFIG_EXTCON_PALMAS=y 306CONFIG_EXTCON_PALMAS=y
307CONFIG_PWM=y
308CONFIG_PWM_TWL=y
309CONFIG_PWM_TWL_LED=y
310CONFIG_OMAP_USB2=y
311CONFIG_TI_PIPE3=y
270CONFIG_EXT2_FS=y 312CONFIG_EXT2_FS=y
271CONFIG_EXT3_FS=y 313CONFIG_EXT3_FS=y
272# CONFIG_EXT3_FS_XATTR is not set 314# CONFIG_EXT3_FS_XATTR is not set
273CONFIG_EXT4_FS=y 315CONFIG_EXT4_FS=y
316CONFIG_FANOTIFY=y
274CONFIG_QUOTA=y 317CONFIG_QUOTA=y
275CONFIG_QFMT_V2=y 318CONFIG_QFMT_V2=y
319CONFIG_AUTOFS4_FS=y
276CONFIG_MSDOS_FS=y 320CONFIG_MSDOS_FS=y
277CONFIG_VFAT_FS=y 321CONFIG_VFAT_FS=y
278CONFIG_TMPFS=y 322CONFIG_TMPFS=y
323CONFIG_TMPFS_POSIX_ACL=y
279CONFIG_JFFS2_FS=y 324CONFIG_JFFS2_FS=y
280CONFIG_JFFS2_SUMMARY=y 325CONFIG_JFFS2_SUMMARY=y
281CONFIG_JFFS2_FS_XATTR=y 326CONFIG_JFFS2_FS_XATTR=y
diff --git a/arch/arm/configs/pxa3xx_defconfig b/arch/arm/configs/pxa3xx_defconfig
index 60e313834b3f..5f337d7ceb5b 100644
--- a/arch/arm/configs/pxa3xx_defconfig
+++ b/arch/arm/configs/pxa3xx_defconfig
@@ -77,7 +77,6 @@ CONFIG_BATTERY_DA9030=y
77CONFIG_PMIC_DA903X=y 77CONFIG_PMIC_DA903X=y
78CONFIG_REGULATOR=y 78CONFIG_REGULATOR=y
79CONFIG_REGULATOR_DEBUG=y 79CONFIG_REGULATOR_DEBUG=y
80CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
81CONFIG_REGULATOR_DA903X=y 80CONFIG_REGULATOR_DA903X=y
82CONFIG_FB=y 81CONFIG_FB=y
83CONFIG_FB_PXA=y 82CONFIG_FB_PXA=y
diff --git a/arch/arm/configs/qcom_defconfig b/arch/arm/configs/qcom_defconfig
index 42ebd72799e6..8c7da3319d82 100644
--- a/arch/arm/configs/qcom_defconfig
+++ b/arch/arm/configs/qcom_defconfig
@@ -29,6 +29,7 @@ CONFIG_HIGHPTE=y
29CONFIG_CLEANCACHE=y 29CONFIG_CLEANCACHE=y
30CONFIG_ARM_APPENDED_DTB=y 30CONFIG_ARM_APPENDED_DTB=y
31CONFIG_ARM_ATAG_DTB_COMPAT=y 31CONFIG_ARM_ATAG_DTB_COMPAT=y
32CONFIG_CPU_IDLE=y
32CONFIG_VFP=y 33CONFIG_VFP=y
33CONFIG_NEON=y 34CONFIG_NEON=y
34# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
@@ -53,14 +54,13 @@ CONFIG_DEVTMPFS_MOUNT=y
53CONFIG_MTD=y 54CONFIG_MTD=y
54CONFIG_MTD_BLOCK=y 55CONFIG_MTD_BLOCK=y
55CONFIG_MTD_M25P80=y 56CONFIG_MTD_M25P80=y
57CONFIG_MTD_SPI_NOR=y
56CONFIG_BLK_DEV_LOOP=y 58CONFIG_BLK_DEV_LOOP=y
57CONFIG_BLK_DEV_RAM=y 59CONFIG_BLK_DEV_RAM=y
58CONFIG_SCSI=y 60CONFIG_SCSI=y
59CONFIG_SCSI_TGT=y
60CONFIG_BLK_DEV_SD=y 61CONFIG_BLK_DEV_SD=y
61CONFIG_CHR_DEV_SG=y 62CONFIG_CHR_DEV_SG=y
62CONFIG_CHR_DEV_SCH=y 63CONFIG_CHR_DEV_SCH=y
63CONFIG_SCSI_MULTI_LUN=y
64CONFIG_SCSI_CONSTANTS=y 64CONFIG_SCSI_CONSTANTS=y
65CONFIG_SCSI_LOGGING=y 65CONFIG_SCSI_LOGGING=y
66CONFIG_SCSI_SCAN_ASYNC=y 66CONFIG_SCSI_SCAN_ASYNC=y
@@ -86,7 +86,6 @@ CONFIG_SERIO_LIBPS2=y
86CONFIG_SERIAL_MSM=y 86CONFIG_SERIAL_MSM=y
87CONFIG_SERIAL_MSM_CONSOLE=y 87CONFIG_SERIAL_MSM_CONSOLE=y
88CONFIG_HW_RANDOM=y 88CONFIG_HW_RANDOM=y
89CONFIG_HW_RANDOM_MSM=y
90CONFIG_I2C=y 89CONFIG_I2C=y
91CONFIG_I2C_CHARDEV=y 90CONFIG_I2C_CHARDEV=y
92CONFIG_I2C_QUP=y 91CONFIG_I2C_QUP=y
@@ -94,7 +93,9 @@ CONFIG_SPI=y
94CONFIG_SPI_QUP=y 93CONFIG_SPI_QUP=y
95CONFIG_SPMI=y 94CONFIG_SPMI=y
96CONFIG_PINCTRL_APQ8064=y 95CONFIG_PINCTRL_APQ8064=y
96CONFIG_PINCTRL_APQ8084=y
97CONFIG_PINCTRL_IPQ8064=y 97CONFIG_PINCTRL_IPQ8064=y
98CONFIG_PINCTRL_MSM8960=y
98CONFIG_PINCTRL_MSM8X74=y 99CONFIG_PINCTRL_MSM8X74=y
99CONFIG_DEBUG_GPIO=y 100CONFIG_DEBUG_GPIO=y
100CONFIG_GPIO_SYSFS=y 101CONFIG_GPIO_SYSFS=y
@@ -103,6 +104,7 @@ CONFIG_POWER_RESET=y
103CONFIG_POWER_RESET_MSM=y 104CONFIG_POWER_RESET_MSM=y
104CONFIG_THERMAL=y 105CONFIG_THERMAL=y
105CONFIG_REGULATOR=y 106CONFIG_REGULATOR=y
107CONFIG_REGULATOR_FIXED_VOLTAGE=y
106CONFIG_MEDIA_SUPPORT=y 108CONFIG_MEDIA_SUPPORT=y
107CONFIG_FB=y 109CONFIG_FB=y
108CONFIG_SOUND=y 110CONFIG_SOUND=y
@@ -124,6 +126,7 @@ CONFIG_USB_GADGET_DEBUG_FILES=y
124CONFIG_USB_GADGET_VBUS_DRAW=500 126CONFIG_USB_GADGET_VBUS_DRAW=500
125CONFIG_MMC=y 127CONFIG_MMC=y
126CONFIG_MMC_BLOCK_MINORS=16 128CONFIG_MMC_BLOCK_MINORS=16
129CONFIG_MMC_ARMMMCI=y
127CONFIG_MMC_SDHCI=y 130CONFIG_MMC_SDHCI=y
128CONFIG_MMC_SDHCI_PLTFM=y 131CONFIG_MMC_SDHCI_PLTFM=y
129CONFIG_MMC_SDHCI_MSM=y 132CONFIG_MMC_SDHCI_MSM=y
@@ -133,11 +136,14 @@ CONFIG_QCOM_BAM_DMA=y
133CONFIG_STAGING=y 136CONFIG_STAGING=y
134CONFIG_QCOM_GSBI=y 137CONFIG_QCOM_GSBI=y
135CONFIG_COMMON_CLK_QCOM=y 138CONFIG_COMMON_CLK_QCOM=y
139CONFIG_APQ_MMCC_8084=y
140CONFIG_IPQ_GCC_806X=y
136CONFIG_MSM_GCC_8660=y 141CONFIG_MSM_GCC_8660=y
137CONFIG_MSM_MMCC_8960=y 142CONFIG_MSM_MMCC_8960=y
138CONFIG_MSM_MMCC_8974=y 143CONFIG_MSM_MMCC_8974=y
139CONFIG_MSM_IOMMU=y 144CONFIG_MSM_IOMMU=y
140CONFIG_GENERIC_PHY=y 145CONFIG_PHY_QCOM_APQ8064_SATA=y
146CONFIG_PHY_QCOM_IPQ806X_SATA=y
141CONFIG_EXT2_FS=y 147CONFIG_EXT2_FS=y
142CONFIG_EXT2_FS_XATTR=y 148CONFIG_EXT2_FS_XATTR=y
143CONFIG_EXT3_FS=y 149CONFIG_EXT3_FS=y
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 4414990521d3..c9089c927daf 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -19,9 +19,9 @@ CONFIG_MODULE_FORCE_UNLOAD=y
19CONFIG_ARCH_AT91=y 19CONFIG_ARCH_AT91=y
20CONFIG_SOC_SAM_V7=y 20CONFIG_SOC_SAM_V7=y
21CONFIG_SOC_SAMA5D3=y 21CONFIG_SOC_SAMA5D3=y
22CONFIG_SOC_SAMA5D4=y
22CONFIG_MACH_SAMA5_DT=y 23CONFIG_MACH_SAMA5_DT=y
23CONFIG_AEABI=y 24CONFIG_AEABI=y
24# CONFIG_OABI_COMPAT is not set
25CONFIG_UACCESS_WITH_MEMCPY=y 25CONFIG_UACCESS_WITH_MEMCPY=y
26CONFIG_ZBOOT_ROM_TEXT=0x0 26CONFIG_ZBOOT_ROM_TEXT=0x0
27CONFIG_ZBOOT_ROM_BSS=0x0 27CONFIG_ZBOOT_ROM_BSS=0x0
@@ -65,15 +65,14 @@ CONFIG_DEVTMPFS_MOUNT=y
65# CONFIG_PREVENT_FIRMWARE_BUILD is not set 65# CONFIG_PREVENT_FIRMWARE_BUILD is not set
66CONFIG_MTD=y 66CONFIG_MTD=y
67CONFIG_MTD_CMDLINE_PARTS=y 67CONFIG_MTD_CMDLINE_PARTS=y
68CONFIG_MTD_CHAR=y
69CONFIG_MTD_BLOCK=y 68CONFIG_MTD_BLOCK=y
70CONFIG_MTD_CFI=y 69CONFIG_MTD_CFI=y
71CONFIG_MTD_M25P80=y 70CONFIG_MTD_M25P80=y
72CONFIG_MTD_NAND=y 71CONFIG_MTD_NAND=y
73CONFIG_MTD_NAND_ATMEL=y 72CONFIG_MTD_NAND_ATMEL=y
73CONFIG_MTD_SPI_NOR=y
74CONFIG_MTD_UBI=y 74CONFIG_MTD_UBI=y
75CONFIG_MTD_UBI_GLUEBI=y 75CONFIG_MTD_UBI_GLUEBI=y
76CONFIG_PROC_DEVICETREE=y
77CONFIG_BLK_DEV_LOOP=y 76CONFIG_BLK_DEV_LOOP=y
78CONFIG_BLK_DEV_RAM=y 77CONFIG_BLK_DEV_RAM=y
79CONFIG_BLK_DEV_RAM_COUNT=4 78CONFIG_BLK_DEV_RAM_COUNT=4
@@ -83,10 +82,8 @@ CONFIG_ATMEL_SSC=y
83CONFIG_EEPROM_AT24=y 82CONFIG_EEPROM_AT24=y
84CONFIG_SCSI=y 83CONFIG_SCSI=y
85CONFIG_BLK_DEV_SD=y 84CONFIG_BLK_DEV_SD=y
86CONFIG_SCSI_MULTI_LUN=y
87# CONFIG_SCSI_LOWLEVEL is not set 85# CONFIG_SCSI_LOWLEVEL is not set
88CONFIG_NETDEVICES=y 86CONFIG_NETDEVICES=y
89CONFIG_MII=y
90CONFIG_MACB=y 87CONFIG_MACB=y
91# CONFIG_NET_VENDOR_BROADCOM is not set 88# CONFIG_NET_VENDOR_BROADCOM is not set
92# CONFIG_NET_VENDOR_CIRRUS is not set 89# CONFIG_NET_VENDOR_CIRRUS is not set
@@ -135,6 +132,8 @@ CONFIG_SPI=y
135CONFIG_SPI_ATMEL=y 132CONFIG_SPI_ATMEL=y
136CONFIG_SPI_GPIO=y 133CONFIG_SPI_GPIO=y
137CONFIG_GPIO_SYSFS=y 134CONFIG_GPIO_SYSFS=y
135CONFIG_POWER_SUPPLY=y
136CONFIG_POWER_RESET=y
138# CONFIG_HWMON is not set 137# CONFIG_HWMON is not set
139CONFIG_SSB=m 138CONFIG_SSB=m
140CONFIG_REGULATOR=y 139CONFIG_REGULATOR=y
@@ -145,6 +144,11 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y
145CONFIG_BACKLIGHT_CLASS_DEVICE=y 144CONFIG_BACKLIGHT_CLASS_DEVICE=y
146# CONFIG_BACKLIGHT_GENERIC is not set 145# CONFIG_BACKLIGHT_GENERIC is not set
147CONFIG_FRAMEBUFFER_CONSOLE=y 146CONFIG_FRAMEBUFFER_CONSOLE=y
147CONFIG_SOUND=y
148CONFIG_SND=y
149CONFIG_SND_SOC=y
150CONFIG_SND_ATMEL_SOC=y
151CONFIG_SND_ATMEL_SOC_WM8904=y
148# CONFIG_HID_GENERIC is not set 152# CONFIG_HID_GENERIC is not set
149CONFIG_USB=y 153CONFIG_USB=y
150CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 154CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
@@ -165,6 +169,7 @@ CONFIG_MMC_ATMELMCI=y
165CONFIG_NEW_LEDS=y 169CONFIG_NEW_LEDS=y
166CONFIG_LEDS_CLASS=y 170CONFIG_LEDS_CLASS=y
167CONFIG_LEDS_GPIO=y 171CONFIG_LEDS_GPIO=y
172CONFIG_LEDS_PWM=y
168CONFIG_LEDS_TRIGGER_TIMER=y 173CONFIG_LEDS_TRIGGER_TIMER=y
169CONFIG_LEDS_TRIGGER_HEARTBEAT=y 174CONFIG_LEDS_TRIGGER_HEARTBEAT=y
170CONFIG_LEDS_TRIGGER_GPIO=y 175CONFIG_LEDS_TRIGGER_GPIO=y
@@ -174,6 +179,8 @@ CONFIG_DMADEVICES=y
174# CONFIG_IOMMU_SUPPORT is not set 179# CONFIG_IOMMU_SUPPORT is not set
175CONFIG_IIO=y 180CONFIG_IIO=y
176CONFIG_AT91_ADC=y 181CONFIG_AT91_ADC=y
182CONFIG_PWM=y
183CONFIG_PWM_ATMEL=y
177CONFIG_EXT4_FS=y 184CONFIG_EXT4_FS=y
178CONFIG_FANOTIFY=y 185CONFIG_FANOTIFY=y
179CONFIG_VFAT_FS=y 186CONFIG_VFAT_FS=y
@@ -188,8 +195,8 @@ CONFIG_NLS_ISO8859_1=y
188CONFIG_NLS_UTF8=y 195CONFIG_NLS_UTF8=y
189CONFIG_STRIP_ASM_SYMS=y 196CONFIG_STRIP_ASM_SYMS=y
190CONFIG_DEBUG_FS=y 197CONFIG_DEBUG_FS=y
191# CONFIG_SCHED_DEBUG is not set
192CONFIG_DEBUG_MEMORY_INIT=y 198CONFIG_DEBUG_MEMORY_INIT=y
199# CONFIG_SCHED_DEBUG is not set
193# CONFIG_FTRACE is not set 200# CONFIG_FTRACE is not set
194CONFIG_DEBUG_USER=y 201CONFIG_DEBUG_USER=y
195CONFIG_DEBUG_LL=y 202CONFIG_DEBUG_LL=y
diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
index 3b136144cc83..d7346ad51043 100644
--- a/arch/arm/configs/shmobile_defconfig
+++ b/arch/arm/configs/shmobile_defconfig
@@ -3,6 +3,7 @@ CONFIG_NO_HZ=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16 5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_BLK_DEV_INITRD=y
6CONFIG_CC_OPTIMIZE_FOR_SIZE=y 7CONFIG_CC_OPTIMIZE_FOR_SIZE=y
7CONFIG_SYSCTL_SYSCALL=y 8CONFIG_SYSCTL_SYSCALL=y
8CONFIG_EMBEDDED=y 9CONFIG_EMBEDDED=y
@@ -11,9 +12,11 @@ CONFIG_SLAB=y
11CONFIG_ARCH_SHMOBILE_MULTI=y 12CONFIG_ARCH_SHMOBILE_MULTI=y
12CONFIG_ARCH_EMEV2=y 13CONFIG_ARCH_EMEV2=y
13CONFIG_ARCH_R7S72100=y 14CONFIG_ARCH_R7S72100=y
15CONFIG_ARCH_R8A7740=y
14CONFIG_ARCH_R8A7779=y 16CONFIG_ARCH_R8A7779=y
15CONFIG_ARCH_R8A7790=y 17CONFIG_ARCH_R8A7790=y
16CONFIG_ARCH_R8A7791=y 18CONFIG_ARCH_R8A7791=y
19CONFIG_ARCH_R8A7794=y
17CONFIG_MACH_KOELSCH=y 20CONFIG_MACH_KOELSCH=y
18CONFIG_MACH_LAGER=y 21CONFIG_MACH_LAGER=y
19CONFIG_MACH_MARZEN=y 22CONFIG_MACH_MARZEN=y
@@ -49,6 +52,7 @@ CONFIG_DEVTMPFS=y
49CONFIG_DEVTMPFS_MOUNT=y 52CONFIG_DEVTMPFS_MOUNT=y
50CONFIG_MTD=y 53CONFIG_MTD=y
51CONFIG_MTD_M25P80=y 54CONFIG_MTD_M25P80=y
55CONFIG_MTD_SPI_NOR=y
52CONFIG_EEPROM_AT24=y 56CONFIG_EEPROM_AT24=y
53CONFIG_BLK_DEV_SD=y 57CONFIG_BLK_DEV_SD=y
54CONFIG_ATA=y 58CONFIG_ATA=y
@@ -73,6 +77,8 @@ CONFIG_SMSC_PHY=y
73# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 77# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
74CONFIG_KEYBOARD_GPIO=y 78CONFIG_KEYBOARD_GPIO=y
75# CONFIG_INPUT_MOUSE is not set 79# CONFIG_INPUT_MOUSE is not set
80CONFIG_INPUT_TOUCHSCREEN=y
81CONFIG_TOUCHSCREEN_ST1232=y
76# CONFIG_LEGACY_PTYS is not set 82# CONFIG_LEGACY_PTYS is not set
77CONFIG_SERIAL_8250=y 83CONFIG_SERIAL_8250=y
78CONFIG_SERIAL_8250_CONSOLE=y 84CONFIG_SERIAL_8250_CONSOLE=y
@@ -82,6 +88,7 @@ CONFIG_SERIAL_SH_SCI=y
82CONFIG_SERIAL_SH_SCI_NR_UARTS=20 88CONFIG_SERIAL_SH_SCI_NR_UARTS=20
83CONFIG_SERIAL_SH_SCI_CONSOLE=y 89CONFIG_SERIAL_SH_SCI_CONSOLE=y
84CONFIG_I2C_GPIO=y 90CONFIG_I2C_GPIO=y
91CONFIG_I2C_RIIC=y
85CONFIG_I2C_SH_MOBILE=y 92CONFIG_I2C_SH_MOBILE=y
86CONFIG_I2C_RCAR=y 93CONFIG_I2C_RCAR=y
87CONFIG_SPI=y 94CONFIG_SPI=y
@@ -110,10 +117,16 @@ CONFIG_VIDEO_RENESAS_VSP1=y
110CONFIG_VIDEO_ADV7180=y 117CONFIG_VIDEO_ADV7180=y
111CONFIG_DRM=y 118CONFIG_DRM=y
112CONFIG_DRM_RCAR_DU=y 119CONFIG_DRM_RCAR_DU=y
120CONFIG_BACKLIGHT_LCD_SUPPORT=y
121# CONFIG_LCD_CLASS_DEVICE is not set
122# CONFIG_BACKLIGHT_GENERIC is not set
123CONFIG_BACKLIGHT_PWM=y
113CONFIG_SOUND=y 124CONFIG_SOUND=y
114CONFIG_SND=y 125CONFIG_SND=y
115CONFIG_SND_SOC=y 126CONFIG_SND_SOC=y
127CONFIG_SND_SOC_SH4_FSI=y
116CONFIG_SND_SOC_RCAR=y 128CONFIG_SND_SOC_RCAR=y
129CONFIG_SND_SOC_WM8978=y
117CONFIG_USB=y 130CONFIG_USB=y
118CONFIG_USB_EHCI_HCD=y 131CONFIG_USB_EHCI_HCD=y
119CONFIG_USB_OHCI_HCD=y 132CONFIG_USB_OHCI_HCD=y
@@ -130,9 +143,12 @@ CONFIG_NEW_LEDS=y
130CONFIG_LEDS_CLASS=y 143CONFIG_LEDS_CLASS=y
131CONFIG_LEDS_GPIO=y 144CONFIG_LEDS_GPIO=y
132CONFIG_RTC_CLASS=y 145CONFIG_RTC_CLASS=y
146CONFIG_RTC_DRV_S35390A=y
133CONFIG_DMADEVICES=y 147CONFIG_DMADEVICES=y
134CONFIG_SH_DMAE=y 148CONFIG_SH_DMAE=y
135# CONFIG_IOMMU_SUPPORT is not set 149# CONFIG_IOMMU_SUPPORT is not set
150CONFIG_PWM=y
151CONFIG_PWM_RENESAS_TPU=y
136# CONFIG_DNOTIFY is not set 152# CONFIG_DNOTIFY is not set
137CONFIG_MSDOS_FS=y 153CONFIG_MSDOS_FS=y
138CONFIG_VFAT_FS=y 154CONFIG_VFAT_FS=y
diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
index 7209bfd62074..c1a4ca4f6e6d 100644
--- a/arch/arm/configs/sunxi_defconfig
+++ b/arch/arm/configs/sunxi_defconfig
@@ -75,7 +75,6 @@ CONFIG_POWER_RESET_SUN6I=y
75CONFIG_WATCHDOG=y 75CONFIG_WATCHDOG=y
76CONFIG_SUNXI_WATCHDOG=y 76CONFIG_SUNXI_WATCHDOG=y
77CONFIG_MFD_AXP20X=y 77CONFIG_MFD_AXP20X=y
78CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
79CONFIG_REGULATOR_GPIO=y 78CONFIG_REGULATOR_GPIO=y
80CONFIG_USB=y 79CONFIG_USB=y
81CONFIG_USB_EHCI_HCD=y 80CONFIG_USB_EHCI_HCD=y
@@ -93,6 +92,7 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
93CONFIG_RTC_CLASS=y 92CONFIG_RTC_CLASS=y
94# CONFIG_RTC_INTF_SYSFS is not set 93# CONFIG_RTC_INTF_SYSFS is not set
95# CONFIG_RTC_INTF_PROC is not set 94# CONFIG_RTC_INTF_PROC is not set
95CONFIG_RTC_DRV_SUN6I=y
96CONFIG_RTC_DRV_SUNXI=y 96CONFIG_RTC_DRV_SUNXI=y
97# CONFIG_IOMMU_SUPPORT is not set 97# CONFIG_IOMMU_SUPPORT is not set
98CONFIG_PHY_SUN4I_USB=y 98CONFIG_PHY_SUN4I_USB=y
@@ -103,5 +103,7 @@ CONFIG_NFS_FS=y
103CONFIG_NFS_V3_ACL=y 103CONFIG_NFS_V3_ACL=y
104CONFIG_NFS_V4=y 104CONFIG_NFS_V4=y
105CONFIG_ROOT_NFS=y 105CONFIG_ROOT_NFS=y
106CONFIG_NLS_CODEPAGE_437=y
107CONFIG_NLS_ISO8859_1=y
106CONFIG_PRINTK_TIME=y 108CONFIG_PRINTK_TIME=y
107CONFIG_DEBUG_FS=y 109CONFIG_DEBUG_FS=y
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index 285c433a9aad..888fc1521322 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -102,6 +102,9 @@ CONFIG_BLK_DEV_SD=y
102CONFIG_BLK_DEV_SR=y 102CONFIG_BLK_DEV_SR=y
103CONFIG_SCSI_MULTI_LUN=y 103CONFIG_SCSI_MULTI_LUN=y
104# CONFIG_SCSI_LOWLEVEL is not set 104# CONFIG_SCSI_LOWLEVEL is not set
105CONFIG_ATA=y
106CONFIG_SATA_AHCI=y
107CONFIG_AHCI_TEGRA=y
105CONFIG_NETDEVICES=y 108CONFIG_NETDEVICES=y
106CONFIG_DUMMY=y 109CONFIG_DUMMY=y
107CONFIG_IGB=y 110CONFIG_IGB=y
@@ -120,6 +123,7 @@ CONFIG_KEYBOARD_TEGRA=y
120CONFIG_KEYBOARD_CROS_EC=y 123CONFIG_KEYBOARD_CROS_EC=y
121CONFIG_MOUSE_PS2_ELANTECH=y 124CONFIG_MOUSE_PS2_ELANTECH=y
122CONFIG_INPUT_TOUCHSCREEN=y 125CONFIG_INPUT_TOUCHSCREEN=y
126CONFIG_TOUCHSCREEN_ATMEL_MXT=y
123CONFIG_TOUCHSCREEN_STMPE=y 127CONFIG_TOUCHSCREEN_STMPE=y
124CONFIG_INPUT_MISC=y 128CONFIG_INPUT_MISC=y
125CONFIG_INPUT_MPU3050=y 129CONFIG_INPUT_MPU3050=y
@@ -165,7 +169,6 @@ CONFIG_MFD_TPS6586X=y
165CONFIG_MFD_TPS65910=y 169CONFIG_MFD_TPS65910=y
166CONFIG_REGULATOR=y 170CONFIG_REGULATOR=y
167CONFIG_REGULATOR_FIXED_VOLTAGE=y 171CONFIG_REGULATOR_FIXED_VOLTAGE=y
168CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
169CONFIG_REGULATOR_AS3722=y 172CONFIG_REGULATOR_AS3722=y
170CONFIG_REGULATOR_GPIO=y 173CONFIG_REGULATOR_GPIO=y
171CONFIG_REGULATOR_MAX8907=y 174CONFIG_REGULATOR_MAX8907=y
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index d52b4ffe2012..ea49d37564da 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -82,5 +82,6 @@ CONFIG_MAGIC_SYSRQ=y
82CONFIG_DEBUG_KERNEL=y 82CONFIG_DEBUG_KERNEL=y
83CONFIG_DEBUG_USER=y 83CONFIG_DEBUG_USER=y
84CONFIG_DEBUG_LL=y 84CONFIG_DEBUG_LL=y
85CONFIG_DEBUG_LL_UART_PL01X=y
85CONFIG_FONTS=y 86CONFIG_FONTS=y
86CONFIG_FONT_ACORN_8x8=y 87CONFIG_FONT_ACORN_8x8=y
diff --git a/arch/arm/crypto/sha1-armv7-neon.S b/arch/arm/crypto/sha1-armv7-neon.S
index 50013c0e2864..dcd01f3f0bb0 100644
--- a/arch/arm/crypto/sha1-armv7-neon.S
+++ b/arch/arm/crypto/sha1-armv7-neon.S
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12 12#include <asm/assembler.h>
13 13
14.syntax unified 14.syntax unified
15.code 32 15.code 32
@@ -61,13 +61,13 @@
61#define RT3 r12 61#define RT3 r12
62 62
63#define W0 q0 63#define W0 q0
64#define W1 q1 64#define W1 q7
65#define W2 q2 65#define W2 q2
66#define W3 q3 66#define W3 q3
67#define W4 q4 67#define W4 q4
68#define W5 q5 68#define W5 q6
69#define W6 q6 69#define W6 q5
70#define W7 q7 70#define W7 q1
71 71
72#define tmp0 q8 72#define tmp0 q8
73#define tmp1 q9 73#define tmp1 q9
@@ -79,6 +79,11 @@
79#define qK3 q14 79#define qK3 q14
80#define qK4 q15 80#define qK4 q15
81 81
82#ifdef CONFIG_CPU_BIG_ENDIAN
83#define ARM_LE(code...)
84#else
85#define ARM_LE(code...) code
86#endif
82 87
83/* Round function macros. */ 88/* Round function macros. */
84 89
@@ -150,45 +155,45 @@
150#define W_PRECALC_00_15() \ 155#define W_PRECALC_00_15() \
151 add RWK, sp, #(WK_offs(0)); \ 156 add RWK, sp, #(WK_offs(0)); \
152 \ 157 \
153 vld1.32 {tmp0, tmp1}, [RDATA]!; \ 158 vld1.32 {W0, W7}, [RDATA]!; \
154 vrev32.8 W0, tmp0; /* big => little */ \ 159 ARM_LE(vrev32.8 W0, W0; ) /* big => little */ \
155 vld1.32 {tmp2, tmp3}, [RDATA]!; \ 160 vld1.32 {W6, W5}, [RDATA]!; \
156 vadd.u32 tmp0, W0, curK; \ 161 vadd.u32 tmp0, W0, curK; \
157 vrev32.8 W7, tmp1; /* big => little */ \ 162 ARM_LE(vrev32.8 W7, W7; ) /* big => little */ \
158 vrev32.8 W6, tmp2; /* big => little */ \ 163 ARM_LE(vrev32.8 W6, W6; ) /* big => little */ \
159 vadd.u32 tmp1, W7, curK; \ 164 vadd.u32 tmp1, W7, curK; \
160 vrev32.8 W5, tmp3; /* big => little */ \ 165 ARM_LE(vrev32.8 W5, W5; ) /* big => little */ \
161 vadd.u32 tmp2, W6, curK; \ 166 vadd.u32 tmp2, W6, curK; \
162 vst1.32 {tmp0, tmp1}, [RWK]!; \ 167 vst1.32 {tmp0, tmp1}, [RWK]!; \
163 vadd.u32 tmp3, W5, curK; \ 168 vadd.u32 tmp3, W5, curK; \
164 vst1.32 {tmp2, tmp3}, [RWK]; \ 169 vst1.32 {tmp2, tmp3}, [RWK]; \
165 170
166#define WPRECALC_00_15_0(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 171#define WPRECALC_00_15_0(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
167 vld1.32 {tmp0, tmp1}, [RDATA]!; \ 172 vld1.32 {W0, W7}, [RDATA]!; \
168 173
169#define WPRECALC_00_15_1(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 174#define WPRECALC_00_15_1(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
170 add RWK, sp, #(WK_offs(0)); \ 175 add RWK, sp, #(WK_offs(0)); \
171 176
172#define WPRECALC_00_15_2(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 177#define WPRECALC_00_15_2(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
173 vrev32.8 W0, tmp0; /* big => little */ \ 178 ARM_LE(vrev32.8 W0, W0; ) /* big => little */ \
174 179
175#define WPRECALC_00_15_3(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 180#define WPRECALC_00_15_3(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
176 vld1.32 {tmp2, tmp3}, [RDATA]!; \ 181 vld1.32 {W6, W5}, [RDATA]!; \
177 182
178#define WPRECALC_00_15_4(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 183#define WPRECALC_00_15_4(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
179 vadd.u32 tmp0, W0, curK; \ 184 vadd.u32 tmp0, W0, curK; \
180 185
181#define WPRECALC_00_15_5(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 186#define WPRECALC_00_15_5(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
182 vrev32.8 W7, tmp1; /* big => little */ \ 187 ARM_LE(vrev32.8 W7, W7; ) /* big => little */ \
183 188
184#define WPRECALC_00_15_6(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 189#define WPRECALC_00_15_6(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
185 vrev32.8 W6, tmp2; /* big => little */ \ 190 ARM_LE(vrev32.8 W6, W6; ) /* big => little */ \
186 191
187#define WPRECALC_00_15_7(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 192#define WPRECALC_00_15_7(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
188 vadd.u32 tmp1, W7, curK; \ 193 vadd.u32 tmp1, W7, curK; \
189 194
190#define WPRECALC_00_15_8(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 195#define WPRECALC_00_15_8(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
191 vrev32.8 W5, tmp3; /* big => little */ \ 196 ARM_LE(vrev32.8 W5, W5; ) /* big => little */ \
192 197
193#define WPRECALC_00_15_9(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \ 198#define WPRECALC_00_15_9(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
194 vadd.u32 tmp2, W6, curK; \ 199 vadd.u32 tmp2, W6, curK; \
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 0704e0cf5571..92793ba69c40 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -99,31 +99,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)
99 asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); 99 asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
100} 100}
101 101
102static inline void arch_counter_set_user_access(void)
103{
104 u32 cntkctl = arch_timer_get_cntkctl();
105
106 /* Disable user access to both physical/virtual counters/timers */
107 /* Also disable virtual event stream */
108 cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
109 | ARCH_TIMER_USR_VT_ACCESS_EN
110 | ARCH_TIMER_VIRT_EVT_EN
111 | ARCH_TIMER_USR_VCT_ACCESS_EN
112 | ARCH_TIMER_USR_PCT_ACCESS_EN);
113 arch_timer_set_cntkctl(cntkctl);
114}
115
116static inline void arch_timer_evtstrm_enable(int divider)
117{
118 u32 cntkctl = arch_timer_get_cntkctl();
119 cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
120 /* Set the divider and enable virtual event stream */
121 cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
122 | ARCH_TIMER_VIRT_EVT_EN;
123 arch_timer_set_cntkctl(cntkctl);
124 elf_hwcap |= HWCAP_EVTSTRM;
125}
126
127#endif 102#endif
128 103
129#endif 104#endif
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index fd43f7f55b70..10e78d00a0bb 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -466,13 +466,13 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size)
466 */ 466 */
467#define v7_exit_coherency_flush(level) \ 467#define v7_exit_coherency_flush(level) \
468 asm volatile( \ 468 asm volatile( \
469 ".arch armv7-a \n\t" \
469 "stmfd sp!, {fp, ip} \n\t" \ 470 "stmfd sp!, {fp, ip} \n\t" \
470 "mrc p15, 0, r0, c1, c0, 0 @ get SCTLR \n\t" \ 471 "mrc p15, 0, r0, c1, c0, 0 @ get SCTLR \n\t" \
471 "bic r0, r0, #"__stringify(CR_C)" \n\t" \ 472 "bic r0, r0, #"__stringify(CR_C)" \n\t" \
472 "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR \n\t" \ 473 "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR \n\t" \
473 "isb \n\t" \ 474 "isb \n\t" \
474 "bl v7_flush_dcache_"__stringify(level)" \n\t" \ 475 "bl v7_flush_dcache_"__stringify(level)" \n\t" \
475 "clrex \n\t" \
476 "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR \n\t" \ 476 "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR \n\t" \
477 "bic r0, r0, #(1 << 6) @ disable local coherency \n\t" \ 477 "bic r0, r0, #(1 << 6) @ disable local coherency \n\t" \
478 "mcr p15, 0, r0, c1, c0, 1 @ set ACTLR \n\t" \ 478 "mcr p15, 0, r0, c1, c0, 1 @ set ACTLR \n\t" \
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 963a2515906d..819777d0e91f 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -74,6 +74,7 @@
74#define ARM_CPU_PART_CORTEX_A12 0x4100c0d0 74#define ARM_CPU_PART_CORTEX_A12 0x4100c0d0
75#define ARM_CPU_PART_CORTEX_A17 0x4100c0e0 75#define ARM_CPU_PART_CORTEX_A17 0x4100c0e0
76#define ARM_CPU_PART_CORTEX_A15 0x4100c0f0 76#define ARM_CPU_PART_CORTEX_A15 0x4100c0f0
77#define ARM_CPU_PART_MASK 0xff00fff0
77 78
78#define ARM_CPU_XSCALE_ARCH_MASK 0xe000 79#define ARM_CPU_XSCALE_ARCH_MASK 0xe000
79#define ARM_CPU_XSCALE_ARCH_V1 0x2000 80#define ARM_CPU_XSCALE_ARCH_V1 0x2000
@@ -179,7 +180,7 @@ static inline unsigned int __attribute_const__ read_cpuid_implementor(void)
179 */ 180 */
180static inline unsigned int __attribute_const__ read_cpuid_part(void) 181static inline unsigned int __attribute_const__ read_cpuid_part(void)
181{ 182{
182 return read_cpuid_id() & 0xff00fff0; 183 return read_cpuid_id() & ARM_CPU_PART_MASK;
183} 184}
184 185
185static inline unsigned int __attribute_const__ __deprecated read_cpuid_part_number(void) 186static inline unsigned int __attribute_const__ __deprecated read_cpuid_part_number(void)
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index f4b46d39b9cf..afb9cafd3786 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -50,6 +50,7 @@ typedef struct user_fp elf_fpregset_t;
50#define R_ARM_ABS32 2 50#define R_ARM_ABS32 2
51#define R_ARM_CALL 28 51#define R_ARM_CALL 28
52#define R_ARM_JUMP24 29 52#define R_ARM_JUMP24 29
53#define R_ARM_TARGET1 38
53#define R_ARM_V4BX 40 54#define R_ARM_V4BX 40
54#define R_ARM_PREL31 42 55#define R_ARM_PREL31 42
55#define R_ARM_MOVW_ABS_NC 43 56#define R_ARM_MOVW_ABS_NC 43
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index 39eb16b0066f..bfe2a2f5a644 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -45,7 +45,7 @@ void *return_address(unsigned int);
45 45
46#else 46#else
47 47
48extern inline void *return_address(unsigned int level) 48static inline void *return_address(unsigned int level)
49{ 49{
50 return NULL; 50 return NULL;
51} 51}
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 3d23418cbddd..180567408ee8 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -178,6 +178,7 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
178 178
179/* PCI fixed i/o mapping */ 179/* PCI fixed i/o mapping */
180#define PCI_IO_VIRT_BASE 0xfee00000 180#define PCI_IO_VIRT_BASE 0xfee00000
181#define PCI_IOBASE ((void __iomem *)PCI_IO_VIRT_BASE)
181 182
182#if defined(CONFIG_PCI) 183#if defined(CONFIG_PCI)
183void pci_ioremap_set_mem_type(int mem_type); 184void pci_ioremap_set_mem_type(int mem_type);
diff --git a/arch/arm/include/asm/irq_work.h b/arch/arm/include/asm/irq_work.h
new file mode 100644
index 000000000000..712d03e5973a
--- /dev/null
+++ b/arch/arm/include/asm/irq_work.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_ARM_IRQ_WORK_H
2#define __ASM_ARM_IRQ_WORK_H
3
4#include <asm/smp_plat.h>
5
6static inline bool arch_irq_work_has_interrupt(void)
7{
8 return is_smp();
9}
10
11#endif /* _ASM_ARM_IRQ_WORK_H */
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index 69b746955fca..b9db269c6e61 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -149,6 +149,11 @@ static inline bool kvm_vcpu_trap_is_iabt(struct kvm_vcpu *vcpu)
149 149
150static inline u8 kvm_vcpu_trap_get_fault(struct kvm_vcpu *vcpu) 150static inline u8 kvm_vcpu_trap_get_fault(struct kvm_vcpu *vcpu)
151{ 151{
152 return kvm_vcpu_get_hsr(vcpu) & HSR_FSC;
153}
154
155static inline u8 kvm_vcpu_trap_get_fault_type(struct kvm_vcpu *vcpu)
156{
152 return kvm_vcpu_get_hsr(vcpu) & HSR_FSC_TYPE; 157 return kvm_vcpu_get_hsr(vcpu) & HSR_FSC_TYPE;
153} 158}
154 159
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 6dfb404f6c46..53036e21756b 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -19,6 +19,8 @@
19#ifndef __ARM_KVM_HOST_H__ 19#ifndef __ARM_KVM_HOST_H__
20#define __ARM_KVM_HOST_H__ 20#define __ARM_KVM_HOST_H__
21 21
22#include <linux/types.h>
23#include <linux/kvm_types.h>
22#include <asm/kvm.h> 24#include <asm/kvm.h>
23#include <asm/kvm_asm.h> 25#include <asm/kvm_asm.h>
24#include <asm/kvm_mmio.h> 26#include <asm/kvm_mmio.h>
@@ -40,9 +42,8 @@
40 42
41#include <kvm/arm_vgic.h> 43#include <kvm/arm_vgic.h>
42 44
43struct kvm_vcpu;
44u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode); 45u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
45int kvm_target_cpu(void); 46int __attribute_const__ kvm_target_cpu(void);
46int kvm_reset_vcpu(struct kvm_vcpu *vcpu); 47int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
47void kvm_reset_coprocs(struct kvm_vcpu *vcpu); 48void kvm_reset_coprocs(struct kvm_vcpu *vcpu);
48 49
@@ -149,20 +150,17 @@ struct kvm_vcpu_stat {
149 u32 halt_wakeup; 150 u32 halt_wakeup;
150}; 151};
151 152
152struct kvm_vcpu_init;
153int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, 153int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
154 const struct kvm_vcpu_init *init); 154 const struct kvm_vcpu_init *init);
155int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init); 155int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
156unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu); 156unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
157int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); 157int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
158struct kvm_one_reg;
159int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg); 158int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
160int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg); 159int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
161u64 kvm_call_hyp(void *hypfn, ...); 160u64 kvm_call_hyp(void *hypfn, ...);
162void force_vm_exit(const cpumask_t *mask); 161void force_vm_exit(const cpumask_t *mask);
163 162
164#define KVM_ARCH_WANT_MMU_NOTIFIER 163#define KVM_ARCH_WANT_MMU_NOTIFIER
165struct kvm;
166int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); 164int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
167int kvm_unmap_hva_range(struct kvm *kvm, 165int kvm_unmap_hva_range(struct kvm *kvm,
168 unsigned long start, unsigned long end); 166 unsigned long start, unsigned long end);
@@ -172,7 +170,8 @@ unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
172int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); 170int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
173 171
174/* We do not have shadow page tables, hence the empty hooks */ 172/* We do not have shadow page tables, hence the empty hooks */
175static inline int kvm_age_hva(struct kvm *kvm, unsigned long hva) 173static inline int kvm_age_hva(struct kvm *kvm, unsigned long start,
174 unsigned long end)
176{ 175{
177 return 0; 176 return 0;
178} 177}
@@ -182,12 +181,16 @@ static inline int kvm_test_age_hva(struct kvm *kvm, unsigned long hva)
182 return 0; 181 return 0;
183} 182}
184 183
184static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
185 unsigned long address)
186{
187}
188
185struct kvm_vcpu *kvm_arm_get_running_vcpu(void); 189struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
186struct kvm_vcpu __percpu **kvm_get_running_vcpus(void); 190struct kvm_vcpu __percpu **kvm_get_running_vcpus(void);
187 191
188int kvm_arm_copy_coproc_indices(struct kvm_vcpu *vcpu, u64 __user *uindices); 192int kvm_arm_copy_coproc_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
189unsigned long kvm_arm_num_coproc_regs(struct kvm_vcpu *vcpu); 193unsigned long kvm_arm_num_coproc_regs(struct kvm_vcpu *vcpu);
190struct kvm_one_reg;
191int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *); 194int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
192int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *); 195int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
193 196
@@ -233,4 +236,10 @@ static inline void vgic_arch_setup(const struct vgic_params *vgic)
233int kvm_perf_init(void); 236int kvm_perf_init(void);
234int kvm_perf_teardown(void); 237int kvm_perf_teardown(void);
235 238
239static inline void kvm_arch_hardware_disable(void) {}
240static inline void kvm_arch_hardware_unsetup(void) {}
241static inline void kvm_arch_sync_events(struct kvm *kvm) {}
242static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {}
243static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
244
236#endif /* __ARM_KVM_HOST_H__ */ 245#endif /* __ARM_KVM_HOST_H__ */
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 5cc0b0f5f72f..3f688b458143 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -78,17 +78,6 @@ static inline void kvm_set_pte(pte_t *pte, pte_t new_pte)
78 flush_pmd_entry(pte); 78 flush_pmd_entry(pte);
79} 79}
80 80
81static inline bool kvm_is_write_fault(unsigned long hsr)
82{
83 unsigned long hsr_ec = hsr >> HSR_EC_SHIFT;
84 if (hsr_ec == HSR_EC_IABT)
85 return false;
86 else if ((hsr & HSR_ISV) && !(hsr & HSR_WNR))
87 return false;
88 else
89 return true;
90}
91
92static inline void kvm_clean_pgd(pgd_t *pgd) 81static inline void kvm_clean_pgd(pgd_t *pgd)
93{ 82{
94 clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t)); 83 clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t));
diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h
index 57ff7f2a3084..d428e386c88e 100644
--- a/arch/arm/include/asm/mcpm.h
+++ b/arch/arm/include/asm/mcpm.h
@@ -20,7 +20,12 @@
20 * to consider dynamic allocation. 20 * to consider dynamic allocation.
21 */ 21 */
22#define MAX_CPUS_PER_CLUSTER 4 22#define MAX_CPUS_PER_CLUSTER 4
23
24#ifdef CONFIG_MCPM_QUAD_CLUSTER
25#define MAX_NR_CLUSTERS 4
26#else
23#define MAX_NR_CLUSTERS 2 27#define MAX_NR_CLUSTERS 2
28#endif
24 29
25#ifndef __ASSEMBLY__ 30#ifndef __ASSEMBLY__
26 31
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 219ac88a9542..f0279411847d 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -182,6 +182,8 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
182#define pmd_addr_end(addr,end) (end) 182#define pmd_addr_end(addr,end) (end)
183 183
184#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext) 184#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)
185#define pte_special(pte) (0)
186static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
185 187
186/* 188/*
187 * We don't have huge page support for short descriptors, for the moment 189 * We don't have huge page support for short descriptors, for the moment
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 06e0bc0f8b00..a31ecdad4b59 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -213,10 +213,19 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
213#define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val))) 213#define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val)))
214 214
215#define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF)) 215#define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF))
216#define pte_special(pte) (pte_isset((pte), L_PTE_SPECIAL))
217static inline pte_t pte_mkspecial(pte_t pte)
218{
219 pte_val(pte) |= L_PTE_SPECIAL;
220 return pte;
221}
222#define __HAVE_ARCH_PTE_SPECIAL
216 223
217#define __HAVE_ARCH_PMD_WRITE 224#define __HAVE_ARCH_PMD_WRITE
218#define pmd_write(pmd) (pmd_isclear((pmd), L_PMD_SECT_RDONLY)) 225#define pmd_write(pmd) (pmd_isclear((pmd), L_PMD_SECT_RDONLY))
219#define pmd_dirty(pmd) (pmd_isset((pmd), L_PMD_SECT_DIRTY)) 226#define pmd_dirty(pmd) (pmd_isset((pmd), L_PMD_SECT_DIRTY))
227#define pud_page(pud) pmd_page(__pmd(pud_val(pud)))
228#define pud_write(pud) pmd_write(__pmd(pud_val(pud)))
220 229
221#define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd)) 230#define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd))
222#define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd)) 231#define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd))
@@ -224,6 +233,12 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
224#ifdef CONFIG_TRANSPARENT_HUGEPAGE 233#ifdef CONFIG_TRANSPARENT_HUGEPAGE
225#define pmd_trans_huge(pmd) (pmd_val(pmd) && !pmd_table(pmd)) 234#define pmd_trans_huge(pmd) (pmd_val(pmd) && !pmd_table(pmd))
226#define pmd_trans_splitting(pmd) (pmd_isset((pmd), L_PMD_SECT_SPLITTING)) 235#define pmd_trans_splitting(pmd) (pmd_isset((pmd), L_PMD_SECT_SPLITTING))
236
237#ifdef CONFIG_HAVE_RCU_TABLE_FREE
238#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH
239void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
240 pmd_t *pmdp);
241#endif
227#endif 242#endif
228 243
229#define PMD_BIT_FUNC(fn,op) \ 244#define PMD_BIT_FUNC(fn,op) \
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 01baef07cd0c..90aa4583b308 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -226,7 +226,6 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
226#define pte_dirty(pte) (pte_isset((pte), L_PTE_DIRTY)) 226#define pte_dirty(pte) (pte_isset((pte), L_PTE_DIRTY))
227#define pte_young(pte) (pte_isset((pte), L_PTE_YOUNG)) 227#define pte_young(pte) (pte_isset((pte), L_PTE_YOUNG))
228#define pte_exec(pte) (pte_isclear((pte), L_PTE_XN)) 228#define pte_exec(pte) (pte_isclear((pte), L_PTE_XN))
229#define pte_special(pte) (0)
230 229
231#define pte_valid_user(pte) \ 230#define pte_valid_user(pte) \
232 (pte_valid(pte) && pte_isset((pte), L_PTE_USER) && pte_young(pte)) 231 (pte_valid(pte) && pte_isset((pte), L_PTE_USER) && pte_young(pte))
@@ -245,7 +244,8 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
245 unsigned long ext = 0; 244 unsigned long ext = 0;
246 245
247 if (addr < TASK_SIZE && pte_valid_user(pteval)) { 246 if (addr < TASK_SIZE && pte_valid_user(pteval)) {
248 __sync_icache_dcache(pteval); 247 if (!pte_special(pteval))
248 __sync_icache_dcache(pteval);
249 ext |= PTE_EXT_NG; 249 ext |= PTE_EXT_NG;
250 } 250 }
251 251
@@ -264,8 +264,6 @@ PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
264PTE_BIT_FUNC(mkexec, &= ~L_PTE_XN); 264PTE_BIT_FUNC(mkexec, &= ~L_PTE_XN);
265PTE_BIT_FUNC(mknexec, |= L_PTE_XN); 265PTE_BIT_FUNC(mknexec, |= L_PTE_XN);
266 266
267static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
268
269static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 267static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
270{ 268{
271 const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER | 269 const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER |
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 2ec765c39ab4..18f5a554134f 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -49,12 +49,6 @@ extern void smp_init_cpus(void);
49extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int)); 49extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
50 50
51/* 51/*
52 * Boot a secondary CPU, and assign it the specified idle task.
53 * This also gives us the initial stack to use for this CPU.
54 */
55extern int boot_secondary(unsigned int cpu, struct task_struct *);
56
57/*
58 * Called from platform specific assembly code, this is the 52 * Called from platform specific assembly code, this is the
59 * secondary CPU entry point. 53 * secondary CPU entry point.
60 */ 54 */
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
index a252c0bfacf5..0ad7d490ee6f 100644
--- a/arch/arm/include/asm/smp_plat.h
+++ b/arch/arm/include/asm/smp_plat.h
@@ -8,6 +8,7 @@
8#include <linux/cpumask.h> 8#include <linux/cpumask.h>
9#include <linux/err.h> 9#include <linux/err.h>
10 10
11#include <asm/cpu.h>
11#include <asm/cputype.h> 12#include <asm/cputype.h>
12 13
13/* 14/*
@@ -25,6 +26,20 @@ static inline bool is_smp(void)
25#endif 26#endif
26} 27}
27 28
29/**
30 * smp_cpuid_part() - return part id for a given cpu
31 * @cpu: logical cpu id.
32 *
33 * Return: part id of logical cpu passed as argument.
34 */
35static inline unsigned int smp_cpuid_part(int cpu)
36{
37 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpu);
38
39 return is_smp() ? cpu_info->cpuid & ARM_CPU_PART_MASK :
40 read_cpuid_part();
41}
42
28/* all SMP configurations have the extended CPUID registers */ 43/* all SMP configurations have the extended CPUID registers */
29#ifndef CONFIG_MMU 44#ifndef CONFIG_MMU
30#define tlb_ops_need_broadcast() 0 45#define tlb_ops_need_broadcast() 0
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index 4651f6999b7d..e86c985b8c7a 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -63,8 +63,8 @@ static inline void syscall_get_arguments(struct task_struct *task,
63 if (i + n > SYSCALL_MAX_ARGS) { 63 if (i + n > SYSCALL_MAX_ARGS) {
64 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i; 64 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
65 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS; 65 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
66 pr_warning("%s called with max args %d, handling only %d\n", 66 pr_warn("%s called with max args %d, handling only %d\n",
67 __func__, i + n, SYSCALL_MAX_ARGS); 67 __func__, i + n, SYSCALL_MAX_ARGS);
68 memset(args_bad, 0, n_bad * sizeof(args[0])); 68 memset(args_bad, 0, n_bad * sizeof(args[0]));
69 n = SYSCALL_MAX_ARGS - i; 69 n = SYSCALL_MAX_ARGS - i;
70 } 70 }
@@ -88,8 +88,8 @@ static inline void syscall_set_arguments(struct task_struct *task,
88 return; 88 return;
89 89
90 if (i + n > SYSCALL_MAX_ARGS) { 90 if (i + n > SYSCALL_MAX_ARGS) {
91 pr_warning("%s called with max args %d, handling only %d\n", 91 pr_warn("%s called with max args %d, handling only %d\n",
92 __func__, i + n, SYSCALL_MAX_ARGS); 92 __func__, i + n, SYSCALL_MAX_ARGS);
93 n = SYSCALL_MAX_ARGS - i; 93 n = SYSCALL_MAX_ARGS - i;
94 } 94 }
95 95
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
index f1a0dace3efe..3cadb726ec88 100644
--- a/arch/arm/include/asm/tlb.h
+++ b/arch/arm/include/asm/tlb.h
@@ -35,12 +35,39 @@
35 35
36#define MMU_GATHER_BUNDLE 8 36#define MMU_GATHER_BUNDLE 8
37 37
38#ifdef CONFIG_HAVE_RCU_TABLE_FREE
39static inline void __tlb_remove_table(void *_table)
40{
41 free_page_and_swap_cache((struct page *)_table);
42}
43
44struct mmu_table_batch {
45 struct rcu_head rcu;
46 unsigned int nr;
47 void *tables[0];
48};
49
50#define MAX_TABLE_BATCH \
51 ((PAGE_SIZE - sizeof(struct mmu_table_batch)) / sizeof(void *))
52
53extern void tlb_table_flush(struct mmu_gather *tlb);
54extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
55
56#define tlb_remove_entry(tlb, entry) tlb_remove_table(tlb, entry)
57#else
58#define tlb_remove_entry(tlb, entry) tlb_remove_page(tlb, entry)
59#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
60
38/* 61/*
39 * TLB handling. This allows us to remove pages from the page 62 * TLB handling. This allows us to remove pages from the page
40 * tables, and efficiently handle the TLB issues. 63 * tables, and efficiently handle the TLB issues.
41 */ 64 */
42struct mmu_gather { 65struct mmu_gather {
43 struct mm_struct *mm; 66 struct mm_struct *mm;
67#ifdef CONFIG_HAVE_RCU_TABLE_FREE
68 struct mmu_table_batch *batch;
69 unsigned int need_flush;
70#endif
44 unsigned int fullmm; 71 unsigned int fullmm;
45 struct vm_area_struct *vma; 72 struct vm_area_struct *vma;
46 unsigned long start, end; 73 unsigned long start, end;
@@ -101,6 +128,9 @@ static inline void __tlb_alloc_page(struct mmu_gather *tlb)
101static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) 128static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb)
102{ 129{
103 tlb_flush(tlb); 130 tlb_flush(tlb);
131#ifdef CONFIG_HAVE_RCU_TABLE_FREE
132 tlb_table_flush(tlb);
133#endif
104} 134}
105 135
106static inline void tlb_flush_mmu_free(struct mmu_gather *tlb) 136static inline void tlb_flush_mmu_free(struct mmu_gather *tlb)
@@ -129,6 +159,10 @@ tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start
129 tlb->pages = tlb->local; 159 tlb->pages = tlb->local;
130 tlb->nr = 0; 160 tlb->nr = 0;
131 __tlb_alloc_page(tlb); 161 __tlb_alloc_page(tlb);
162
163#ifdef CONFIG_HAVE_RCU_TABLE_FREE
164 tlb->batch = NULL;
165#endif
132} 166}
133 167
134static inline void 168static inline void
@@ -205,7 +239,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
205 tlb_add_flush(tlb, addr + SZ_1M); 239 tlb_add_flush(tlb, addr + SZ_1M);
206#endif 240#endif
207 241
208 tlb_remove_page(tlb, pte); 242 tlb_remove_entry(tlb, pte);
209} 243}
210 244
211static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, 245static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
@@ -213,7 +247,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
213{ 247{
214#ifdef CONFIG_ARM_LPAE 248#ifdef CONFIG_ARM_LPAE
215 tlb_add_flush(tlb, addr); 249 tlb_add_flush(tlb, addr);
216 tlb_remove_page(tlb, virt_to_page(pmdp)); 250 tlb_remove_entry(tlb, virt_to_page(pmdp));
217#endif 251#endif
218} 252}
219 253
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
index 83259b873333..5f833f7adba1 100644
--- a/arch/arm/include/asm/tls.h
+++ b/arch/arm/include/asm/tls.h
@@ -1,6 +1,9 @@
1#ifndef __ASMARM_TLS_H 1#ifndef __ASMARM_TLS_H
2#define __ASMARM_TLS_H 2#define __ASMARM_TLS_H
3 3
4#include <linux/compiler.h>
5#include <asm/thread_info.h>
6
4#ifdef __ASSEMBLY__ 7#ifdef __ASSEMBLY__
5#include <asm/asm-offsets.h> 8#include <asm/asm-offsets.h>
6 .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2 9 .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2
@@ -50,6 +53,49 @@
50#endif 53#endif
51 54
52#ifndef __ASSEMBLY__ 55#ifndef __ASSEMBLY__
56
57static inline void set_tls(unsigned long val)
58{
59 struct thread_info *thread;
60
61 thread = current_thread_info();
62
63 thread->tp_value[0] = val;
64
65 /*
66 * This code runs with preemption enabled and therefore must
67 * be reentrant with respect to switch_tls.
68 *
69 * We need to ensure ordering between the shadow state and the
70 * hardware state, so that we don't corrupt the hardware state
71 * with a stale shadow state during context switch.
72 *
73 * If we're preempted here, switch_tls will load TPIDRURO from
74 * thread_info upon resuming execution and the following mcr
75 * is merely redundant.
76 */
77 barrier();
78
79 if (!tls_emu) {
80 if (has_tls_reg) {
81 asm("mcr p15, 0, %0, c13, c0, 3"
82 : : "r" (val));
83 } else {
84#ifdef CONFIG_KUSER_HELPERS
85 /*
86 * User space must never try to access this
87 * directly. Expect your app to break
88 * eventually if you do so. The user helper
89 * at 0xffff0fe0 must be used instead. (see
90 * entry-armv.S for details)
91 */
92 *((unsigned int *)0xffff0ff0) = val;
93#endif
94 }
95
96 }
97}
98
53static inline unsigned long get_tpuser(void) 99static inline unsigned long get_tpuser(void)
54{ 100{
55 unsigned long reg = 0; 101 unsigned long reg = 0;
@@ -59,5 +105,23 @@ static inline unsigned long get_tpuser(void)
59 105
60 return reg; 106 return reg;
61} 107}
108
109static inline void set_tpuser(unsigned long val)
110{
111 /* Since TPIDRURW is fully context-switched (unlike TPIDRURO),
112 * we need not update thread_info.
113 */
114 if (has_tls_reg && !tls_emu) {
115 asm("mcr p15, 0, %0, c13, c0, 2"
116 : : "r" (val));
117 }
118}
119
120static inline void flush_tls(void)
121{
122 set_tls(0);
123 set_tpuser(0);
124}
125
62#endif 126#endif
63#endif /* __ASMARM_TLS_H */ 127#endif /* __ASMARM_TLS_H */
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index a4cd7af475e9..4767eb9caa78 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -107,8 +107,11 @@ static inline void set_fs(mm_segment_t fs)
107extern int __get_user_1(void *); 107extern int __get_user_1(void *);
108extern int __get_user_2(void *); 108extern int __get_user_2(void *);
109extern int __get_user_4(void *); 109extern int __get_user_4(void *);
110extern int __get_user_lo8(void *); 110extern int __get_user_32t_8(void *);
111extern int __get_user_8(void *); 111extern int __get_user_8(void *);
112extern int __get_user_64t_1(void *);
113extern int __get_user_64t_2(void *);
114extern int __get_user_64t_4(void *);
112 115
113#define __GUP_CLOBBER_1 "lr", "cc" 116#define __GUP_CLOBBER_1 "lr", "cc"
114#ifdef CONFIG_CPU_USE_DOMAINS 117#ifdef CONFIG_CPU_USE_DOMAINS
@@ -117,7 +120,7 @@ extern int __get_user_8(void *);
117#define __GUP_CLOBBER_2 "lr", "cc" 120#define __GUP_CLOBBER_2 "lr", "cc"
118#endif 121#endif
119#define __GUP_CLOBBER_4 "lr", "cc" 122#define __GUP_CLOBBER_4 "lr", "cc"
120#define __GUP_CLOBBER_lo8 "lr", "cc" 123#define __GUP_CLOBBER_32t_8 "lr", "cc"
121#define __GUP_CLOBBER_8 "lr", "cc" 124#define __GUP_CLOBBER_8 "lr", "cc"
122 125
123#define __get_user_x(__r2,__p,__e,__l,__s) \ 126#define __get_user_x(__r2,__p,__e,__l,__s) \
@@ -131,12 +134,30 @@ extern int __get_user_8(void *);
131 134
132/* narrowing a double-word get into a single 32bit word register: */ 135/* narrowing a double-word get into a single 32bit word register: */
133#ifdef __ARMEB__ 136#ifdef __ARMEB__
134#define __get_user_xb(__r2, __p, __e, __l, __s) \ 137#define __get_user_x_32t(__r2, __p, __e, __l, __s) \
135 __get_user_x(__r2, __p, __e, __l, lo8) 138 __get_user_x(__r2, __p, __e, __l, 32t_8)
136#else 139#else
137#define __get_user_xb __get_user_x 140#define __get_user_x_32t __get_user_x
138#endif 141#endif
139 142
143/*
144 * storing result into proper least significant word of 64bit target var,
145 * different only for big endian case where 64 bit __r2 lsw is r3:
146 */
147#ifdef __ARMEB__
148#define __get_user_x_64t(__r2, __p, __e, __l, __s) \
149 __asm__ __volatile__ ( \
150 __asmeq("%0", "r0") __asmeq("%1", "r2") \
151 __asmeq("%3", "r1") \
152 "bl __get_user_64t_" #__s \
153 : "=&r" (__e), "=r" (__r2) \
154 : "0" (__p), "r" (__l) \
155 : __GUP_CLOBBER_##__s)
156#else
157#define __get_user_x_64t __get_user_x
158#endif
159
160
140#define __get_user_check(x,p) \ 161#define __get_user_check(x,p) \
141 ({ \ 162 ({ \
142 unsigned long __limit = current_thread_info()->addr_limit - 1; \ 163 unsigned long __limit = current_thread_info()->addr_limit - 1; \
@@ -146,17 +167,26 @@ extern int __get_user_8(void *);
146 register int __e asm("r0"); \ 167 register int __e asm("r0"); \
147 switch (sizeof(*(__p))) { \ 168 switch (sizeof(*(__p))) { \
148 case 1: \ 169 case 1: \
149 __get_user_x(__r2, __p, __e, __l, 1); \ 170 if (sizeof((x)) >= 8) \
171 __get_user_x_64t(__r2, __p, __e, __l, 1); \
172 else \
173 __get_user_x(__r2, __p, __e, __l, 1); \
150 break; \ 174 break; \
151 case 2: \ 175 case 2: \
152 __get_user_x(__r2, __p, __e, __l, 2); \ 176 if (sizeof((x)) >= 8) \
177 __get_user_x_64t(__r2, __p, __e, __l, 2); \
178 else \
179 __get_user_x(__r2, __p, __e, __l, 2); \
153 break; \ 180 break; \
154 case 4: \ 181 case 4: \
155 __get_user_x(__r2, __p, __e, __l, 4); \ 182 if (sizeof((x)) >= 8) \
183 __get_user_x_64t(__r2, __p, __e, __l, 4); \
184 else \
185 __get_user_x(__r2, __p, __e, __l, 4); \
156 break; \ 186 break; \
157 case 8: \ 187 case 8: \
158 if (sizeof((x)) < 8) \ 188 if (sizeof((x)) < 8) \
159 __get_user_xb(__r2, __p, __e, __l, 4); \ 189 __get_user_x_32t(__r2, __p, __e, __l, 4); \
160 else \ 190 else \
161 __get_user_x(__r2, __p, __e, __l, 8); \ 191 __get_user_x(__r2, __p, __e, __l, 8); \
162 break; \ 192 break; \
diff --git a/arch/arm/include/asm/xen/page-coherent.h b/arch/arm/include/asm/xen/page-coherent.h
index 1109017499e5..e8275ea88e88 100644
--- a/arch/arm/include/asm/xen/page-coherent.h
+++ b/arch/arm/include/asm/xen/page-coherent.h
@@ -26,25 +26,14 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
26 __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); 26 __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
27} 27}
28 28
29static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, 29void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
30 size_t size, enum dma_data_direction dir, 30 size_t size, enum dma_data_direction dir,
31 struct dma_attrs *attrs) 31 struct dma_attrs *attrs);
32{
33 if (__generic_dma_ops(hwdev)->unmap_page)
34 __generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
35}
36 32
37static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, 33void xen_dma_sync_single_for_cpu(struct device *hwdev,
38 dma_addr_t handle, size_t size, enum dma_data_direction dir) 34 dma_addr_t handle, size_t size, enum dma_data_direction dir);
39{ 35
40 if (__generic_dma_ops(hwdev)->sync_single_for_cpu) 36void xen_dma_sync_single_for_device(struct device *hwdev,
41 __generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); 37 dma_addr_t handle, size_t size, enum dma_data_direction dir);
42}
43 38
44static inline void xen_dma_sync_single_for_device(struct device *hwdev,
45 dma_addr_t handle, size_t size, enum dma_data_direction dir)
46{
47 if (__generic_dma_ops(hwdev)->sync_single_for_device)
48 __generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
49}
50#endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ 39#endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index ded062f9b358..135c24a5ba26 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -33,7 +33,6 @@ typedef struct xpaddr {
33#define INVALID_P2M_ENTRY (~0UL) 33#define INVALID_P2M_ENTRY (~0UL)
34 34
35unsigned long __pfn_to_mfn(unsigned long pfn); 35unsigned long __pfn_to_mfn(unsigned long pfn);
36unsigned long __mfn_to_pfn(unsigned long mfn);
37extern struct rb_root phys_to_mach; 36extern struct rb_root phys_to_mach;
38 37
39static inline unsigned long pfn_to_mfn(unsigned long pfn) 38static inline unsigned long pfn_to_mfn(unsigned long pfn)
@@ -51,14 +50,6 @@ static inline unsigned long pfn_to_mfn(unsigned long pfn)
51 50
52static inline unsigned long mfn_to_pfn(unsigned long mfn) 51static inline unsigned long mfn_to_pfn(unsigned long mfn)
53{ 52{
54 unsigned long pfn;
55
56 if (phys_to_mach.rb_node != NULL) {
57 pfn = __mfn_to_pfn(mfn);
58 if (pfn != INVALID_P2M_ENTRY)
59 return pfn;
60 }
61
62 return mfn; 53 return mfn;
63} 54}
64 55
diff --git a/arch/arm/include/debug/bcm63xx.S b/arch/arm/include/debug/bcm63xx.S
new file mode 100644
index 000000000000..e7164d570f44
--- /dev/null
+++ b/arch/arm/include/debug/bcm63xx.S
@@ -0,0 +1,33 @@
1/*
2 * Broadcom BCM63xx low-level UART debug
3 *
4 * Copyright (C) 2014 Broadcom Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/serial_bcm63xx.h>
12
13 .macro addruart, rp, rv, tmp
14 ldr \rp, =CONFIG_DEBUG_UART_PHYS
15 ldr \rv, =CONFIG_DEBUG_UART_VIRT
16 .endm
17
18 .macro senduart, rd, rx
19 /* word access do not work */
20 strb \rd, [\rx, #UART_FIFO_REG]
21 .endm
22
23 .macro waituart, rd, rx
241001: ldr \rd, [\rx, #UART_IR_REG]
25 tst \rd, #(1 << UART_IR_TXEMPTY)
26 beq 1001b
27 .endm
28
29 .macro busyuart, rd, rx
301002: ldr \rd, [\rx, #UART_IR_REG]
31 tst \rd, #(1 << UART_IR_TXTRESH)
32 beq 1002b
33 .endm
diff --git a/arch/arm/include/debug/meson.S b/arch/arm/include/debug/meson.S
new file mode 100644
index 000000000000..1bae99bf6f11
--- /dev/null
+++ b/arch/arm/include/debug/meson.S
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2014 Carlo Caione
3 * Carlo Caione <carlo@caione.org>
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#define MESON_AO_UART_WFIFO 0x0
11#define MESON_AO_UART_STATUS 0xc
12
13#define MESON_AO_UART_TX_FIFO_EMPTY (1 << 22)
14#define MESON_AO_UART_TX_FIFO_FULL (1 << 21)
15
16 .macro addruart, rp, rv, tmp
17 ldr \rp, =(CONFIG_DEBUG_UART_PHYS) @ physical
18 ldr \rv, =(CONFIG_DEBUG_UART_VIRT) @ virtual
19 .endm
20
21 .macro senduart,rd,rx
22 str \rd, [\rx, #MESON_AO_UART_WFIFO]
23 .endm
24
25 .macro busyuart,rd,rx
261002: ldr \rd, [\rx, #MESON_AO_UART_STATUS]
27 tst \rd, #MESON_AO_UART_TX_FIFO_EMPTY
28 beq 1002b
29 .endm
30
31 .macro waituart,rd,rx
321001: ldr \rd, [\rx, #MESON_AO_UART_STATUS]
33 tst \rd, #MESON_AO_UART_TX_FIFO_FULL
34 bne 1001b
35 .endm
diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h
index e6ebdd3471e5..09ee408c1a67 100644
--- a/arch/arm/include/uapi/asm/kvm.h
+++ b/arch/arm/include/uapi/asm/kvm.h
@@ -25,6 +25,7 @@
25 25
26#define __KVM_HAVE_GUEST_DEBUG 26#define __KVM_HAVE_GUEST_DEBUG
27#define __KVM_HAVE_IRQ_LINE 27#define __KVM_HAVE_IRQ_LINE
28#define __KVM_HAVE_READONLY_MEM
28 29
29#define KVM_REG_SIZE(id) \ 30#define KVM_REG_SIZE(id) \
30 (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) 31 (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
@@ -173,6 +174,7 @@ struct kvm_arch_memory_slot {
173#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT) 174#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT)
174#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0 175#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0
175#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT) 176#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
177#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3
176 178
177/* KVM_IRQ_LINE irq field index values */ 179/* KVM_IRQ_LINE irq field index values */
178#define KVM_ARM_IRQ_TYPE_SHIFT 24 180#define KVM_ARM_IRQ_TYPE_SHIFT 24
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index f7b450f97e68..a88671cfe1ff 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -98,6 +98,14 @@ EXPORT_SYMBOL(__clear_user);
98EXPORT_SYMBOL(__get_user_1); 98EXPORT_SYMBOL(__get_user_1);
99EXPORT_SYMBOL(__get_user_2); 99EXPORT_SYMBOL(__get_user_2);
100EXPORT_SYMBOL(__get_user_4); 100EXPORT_SYMBOL(__get_user_4);
101EXPORT_SYMBOL(__get_user_8);
102
103#ifdef __ARMEB__
104EXPORT_SYMBOL(__get_user_64t_1);
105EXPORT_SYMBOL(__get_user_64t_2);
106EXPORT_SYMBOL(__get_user_64t_4);
107EXPORT_SYMBOL(__get_user_32t_8);
108#endif
101 109
102EXPORT_SYMBOL(__put_user_1); 110EXPORT_SYMBOL(__put_user_1);
103EXPORT_SYMBOL(__put_user_2); 111EXPORT_SYMBOL(__put_user_2);
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c
index 7807ef58a2ab..528f8af2addb 100644
--- a/arch/arm/kernel/atags_parse.c
+++ b/arch/arm/kernel/atags_parse.c
@@ -130,7 +130,7 @@ static int __init parse_tag_cmdline(const struct tag *tag)
130 strlcat(default_command_line, tag->u.cmdline.cmdline, 130 strlcat(default_command_line, tag->u.cmdline.cmdline,
131 COMMAND_LINE_SIZE); 131 COMMAND_LINE_SIZE);
132#elif defined(CONFIG_CMDLINE_FORCE) 132#elif defined(CONFIG_CMDLINE_FORCE)
133 pr_warning("Ignoring tag cmdline (using the default kernel command line)\n"); 133 pr_warn("Ignoring tag cmdline (using the default kernel command line)\n");
134#else 134#else
135 strlcpy(default_command_line, tag->u.cmdline.cmdline, 135 strlcpy(default_command_line, tag->u.cmdline.cmdline,
136 COMMAND_LINE_SIZE); 136 COMMAND_LINE_SIZE);
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 36276cdccfbc..2f5555d307b3 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -146,7 +146,7 @@ ENDPROC(__und_invalid)
146#define SPFIX(code...) 146#define SPFIX(code...)
147#endif 147#endif
148 148
149 .macro svc_entry, stack_hole=0 149 .macro svc_entry, stack_hole=0, trace=1
150 UNWIND(.fnstart ) 150 UNWIND(.fnstart )
151 UNWIND(.save {r0 - pc} ) 151 UNWIND(.save {r0 - pc} )
152 sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4) 152 sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
@@ -182,9 +182,11 @@ ENDPROC(__und_invalid)
182 @ 182 @
183 stmia r7, {r2 - r6} 183 stmia r7, {r2 - r6}
184 184
185 .if \trace
185#ifdef CONFIG_TRACE_IRQFLAGS 186#ifdef CONFIG_TRACE_IRQFLAGS
186 bl trace_hardirqs_off 187 bl trace_hardirqs_off
187#endif 188#endif
189 .endif
188 .endm 190 .endm
189 191
190 .align 5 192 .align 5
@@ -295,6 +297,15 @@ __pabt_svc:
295ENDPROC(__pabt_svc) 297ENDPROC(__pabt_svc)
296 298
297 .align 5 299 .align 5
300__fiq_svc:
301 svc_entry trace=0
302 mov r0, sp @ struct pt_regs *regs
303 bl handle_fiq_as_nmi
304 svc_exit_via_fiq
305 UNWIND(.fnend )
306ENDPROC(__fiq_svc)
307
308 .align 5
298.LCcralign: 309.LCcralign:
299 .word cr_alignment 310 .word cr_alignment
300#ifdef MULTI_DABORT 311#ifdef MULTI_DABORT
@@ -305,6 +316,46 @@ ENDPROC(__pabt_svc)
305 .word fp_enter 316 .word fp_enter
306 317
307/* 318/*
319 * Abort mode handlers
320 */
321
322@
323@ Taking a FIQ in abort mode is similar to taking a FIQ in SVC mode
324@ and reuses the same macros. However in abort mode we must also
325@ save/restore lr_abt and spsr_abt to make nested aborts safe.
326@
327 .align 5
328__fiq_abt:
329 svc_entry trace=0
330
331 ARM( msr cpsr_c, #ABT_MODE | PSR_I_BIT | PSR_F_BIT )
332 THUMB( mov r0, #ABT_MODE | PSR_I_BIT | PSR_F_BIT )
333 THUMB( msr cpsr_c, r0 )
334 mov r1, lr @ Save lr_abt
335 mrs r2, spsr @ Save spsr_abt, abort is now safe
336 ARM( msr cpsr_c, #SVC_MODE | PSR_I_BIT | PSR_F_BIT )
337 THUMB( mov r0, #SVC_MODE | PSR_I_BIT | PSR_F_BIT )
338 THUMB( msr cpsr_c, r0 )
339 stmfd sp!, {r1 - r2}
340
341 add r0, sp, #8 @ struct pt_regs *regs
342 bl handle_fiq_as_nmi
343
344 ldmfd sp!, {r1 - r2}
345 ARM( msr cpsr_c, #ABT_MODE | PSR_I_BIT | PSR_F_BIT )
346 THUMB( mov r0, #ABT_MODE | PSR_I_BIT | PSR_F_BIT )
347 THUMB( msr cpsr_c, r0 )
348 mov lr, r1 @ Restore lr_abt, abort is unsafe
349 msr spsr_cxsf, r2 @ Restore spsr_abt
350 ARM( msr cpsr_c, #SVC_MODE | PSR_I_BIT | PSR_F_BIT )
351 THUMB( mov r0, #SVC_MODE | PSR_I_BIT | PSR_F_BIT )
352 THUMB( msr cpsr_c, r0 )
353
354 svc_exit_via_fiq
355 UNWIND(.fnend )
356ENDPROC(__fiq_abt)
357
358/*
308 * User mode handlers 359 * User mode handlers
309 * 360 *
310 * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE 361 * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
@@ -314,13 +365,16 @@ ENDPROC(__pabt_svc)
314#error "sizeof(struct pt_regs) must be a multiple of 8" 365#error "sizeof(struct pt_regs) must be a multiple of 8"
315#endif 366#endif
316 367
317 .macro usr_entry 368 .macro usr_entry, trace=1
318 UNWIND(.fnstart ) 369 UNWIND(.fnstart )
319 UNWIND(.cantunwind ) @ don't unwind the user space 370 UNWIND(.cantunwind ) @ don't unwind the user space
320 sub sp, sp, #S_FRAME_SIZE 371 sub sp, sp, #S_FRAME_SIZE
321 ARM( stmib sp, {r1 - r12} ) 372 ARM( stmib sp, {r1 - r12} )
322 THUMB( stmia sp, {r0 - r12} ) 373 THUMB( stmia sp, {r0 - r12} )
323 374
375 ATRAP( mrc p15, 0, r7, c1, c0, 0)
376 ATRAP( ldr r8, .LCcralign)
377
324 ldmia r0, {r3 - r5} 378 ldmia r0, {r3 - r5}
325 add r0, sp, #S_PC @ here for interlock avoidance 379 add r0, sp, #S_PC @ here for interlock avoidance
326 mov r6, #-1 @ "" "" "" "" 380 mov r6, #-1 @ "" "" "" ""
@@ -328,6 +382,8 @@ ENDPROC(__pabt_svc)
328 str r3, [sp] @ save the "real" r0 copied 382 str r3, [sp] @ save the "real" r0 copied
329 @ from the exception stack 383 @ from the exception stack
330 384
385 ATRAP( ldr r8, [r8, #0])
386
331 @ 387 @
332 @ We are now ready to fill in the remaining blanks on the stack: 388 @ We are now ready to fill in the remaining blanks on the stack:
333 @ 389 @
@@ -341,20 +397,21 @@ ENDPROC(__pabt_svc)
341 ARM( stmdb r0, {sp, lr}^ ) 397 ARM( stmdb r0, {sp, lr}^ )
342 THUMB( store_user_sp_lr r0, r1, S_SP - S_PC ) 398 THUMB( store_user_sp_lr r0, r1, S_SP - S_PC )
343 399
344 @
345 @ Enable the alignment trap while in kernel mode 400 @ Enable the alignment trap while in kernel mode
346 @ 401 ATRAP( teq r8, r7)
347 alignment_trap r0, .LCcralign 402 ATRAP( mcrne p15, 0, r8, c1, c0, 0)
348 403
349 @ 404 @
350 @ Clear FP to mark the first stack frame 405 @ Clear FP to mark the first stack frame
351 @ 406 @
352 zero_fp 407 zero_fp
353 408
409 .if \trace
354#ifdef CONFIG_IRQSOFF_TRACER 410#ifdef CONFIG_IRQSOFF_TRACER
355 bl trace_hardirqs_off 411 bl trace_hardirqs_off
356#endif 412#endif
357 ct_user_exit save = 0 413 ct_user_exit save = 0
414 .endif
358 .endm 415 .endm
359 416
360 .macro kuser_cmpxchg_check 417 .macro kuser_cmpxchg_check
@@ -683,6 +740,17 @@ ENTRY(ret_from_exception)
683ENDPROC(__pabt_usr) 740ENDPROC(__pabt_usr)
684ENDPROC(ret_from_exception) 741ENDPROC(ret_from_exception)
685 742
743 .align 5
744__fiq_usr:
745 usr_entry trace=0
746 kuser_cmpxchg_check
747 mov r0, sp @ struct pt_regs *regs
748 bl handle_fiq_as_nmi
749 get_thread_info tsk
750 restore_user_regs fast = 0, offset = 0
751 UNWIND(.fnend )
752ENDPROC(__fiq_usr)
753
686/* 754/*
687 * Register switch for ARMv3 and ARMv4 processors 755 * Register switch for ARMv3 and ARMv4 processors
688 * r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info 756 * r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info
@@ -1118,17 +1186,29 @@ vector_addrexcptn:
1118 b vector_addrexcptn 1186 b vector_addrexcptn
1119 1187
1120/*============================================================================= 1188/*=============================================================================
1121 * Undefined FIQs 1189 * FIQ "NMI" handler
1122 *----------------------------------------------------------------------------- 1190 *-----------------------------------------------------------------------------
1123 * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC 1191 * Handle a FIQ using the SVC stack allowing FIQ act like NMI on x86
1124 * MUST PRESERVE SVC SPSR, but need to switch to SVC mode to show our msg. 1192 * systems.
1125 * Basically to switch modes, we *HAVE* to clobber one register... brain
1126 * damage alert! I don't think that we can execute any code in here in any
1127 * other mode than FIQ... Ok you can switch to another mode, but you can't
1128 * get out of that mode without clobbering one register.
1129 */ 1193 */
1130vector_fiq: 1194 vector_stub fiq, FIQ_MODE, 4
1131 subs pc, lr, #4 1195
1196 .long __fiq_usr @ 0 (USR_26 / USR_32)
1197 .long __fiq_svc @ 1 (FIQ_26 / FIQ_32)
1198 .long __fiq_svc @ 2 (IRQ_26 / IRQ_32)
1199 .long __fiq_svc @ 3 (SVC_26 / SVC_32)
1200 .long __fiq_svc @ 4
1201 .long __fiq_svc @ 5
1202 .long __fiq_svc @ 6
1203 .long __fiq_abt @ 7
1204 .long __fiq_svc @ 8
1205 .long __fiq_svc @ 9
1206 .long __fiq_svc @ a
1207 .long __fiq_svc @ b
1208 .long __fiq_svc @ c
1209 .long __fiq_svc @ d
1210 .long __fiq_svc @ e
1211 .long __fiq_svc @ f
1132 1212
1133 .globl vector_fiq_offset 1213 .globl vector_fiq_offset
1134 .equ vector_fiq_offset, vector_fiq 1214 .equ vector_fiq_offset, vector_fiq
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index e52fe5a2d843..6bb09d4abdea 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -366,7 +366,7 @@ ENTRY(vector_swi)
366 str r0, [sp, #S_OLD_R0] @ Save OLD_R0 366 str r0, [sp, #S_OLD_R0] @ Save OLD_R0
367#endif 367#endif
368 zero_fp 368 zero_fp
369 alignment_trap ip, __cr_alignment 369 alignment_trap r10, ip, __cr_alignment
370 enable_irq 370 enable_irq
371 ct_user_exit 371 ct_user_exit
372 get_thread_info tsk 372 get_thread_info tsk
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 8db307d0954b..4176df721bf0 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -37,11 +37,19 @@
37#endif 37#endif
38 .endm 38 .endm
39 39
40 .macro alignment_trap, rtemp, label
41#ifdef CONFIG_ALIGNMENT_TRAP 40#ifdef CONFIG_ALIGNMENT_TRAP
42 ldr \rtemp, \label 41#define ATRAP(x...) x
43 ldr \rtemp, [\rtemp] 42#else
44 mcr p15, 0, \rtemp, c1, c0 43#define ATRAP(x...)
44#endif
45
46 .macro alignment_trap, rtmp1, rtmp2, label
47#ifdef CONFIG_ALIGNMENT_TRAP
48 mrc p15, 0, \rtmp2, c1, c0, 0
49 ldr \rtmp1, \label
50 ldr \rtmp1, [\rtmp1]
51 teq \rtmp1, \rtmp2
52 mcrne p15, 0, \rtmp1, c1, c0, 0
45#endif 53#endif
46 .endm 54 .endm
47 55
@@ -208,26 +216,49 @@
208#endif 216#endif
209 .endif 217 .endif
210 msr spsr_cxsf, \rpsr 218 msr spsr_cxsf, \rpsr
211#if defined(CONFIG_CPU_V6) 219#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K)
212 ldr r0, [sp] 220 @ We must avoid clrex due to Cortex-A15 erratum #830321
213 strex r1, r2, [sp] @ clear the exclusive monitor 221 sub r0, sp, #4 @ uninhabited address
214 ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr 222 strex r1, r2, [r0] @ clear the exclusive monitor
215#elif defined(CONFIG_CPU_32v6K)
216 clrex @ clear the exclusive monitor
217 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
218#else
219 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
220#endif 223#endif
224 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
225 .endm
226
227 @
228 @ svc_exit_via_fiq - like svc_exit but switches to FIQ mode before exit
229 @
230 @ This macro acts in a similar manner to svc_exit but switches to FIQ
231 @ mode to restore the final part of the register state.
232 @
233 @ We cannot use the normal svc_exit procedure because that would
234 @ clobber spsr_svc (FIQ could be delivered during the first few
235 @ instructions of vector_swi meaning its contents have not been
236 @ saved anywhere).
237 @
238 @ Note that, unlike svc_exit, this macro also does not allow a caller
239 @ supplied rpsr. This is because the FIQ exceptions are not re-entrant
240 @ and the handlers cannot call into the scheduler (meaning the value
241 @ on the stack remains correct).
242 @
243 .macro svc_exit_via_fiq
244 mov r0, sp
245 ldmib r0, {r1 - r14} @ abort is deadly from here onward (it will
246 @ clobber state restored below)
247 msr cpsr_c, #FIQ_MODE | PSR_I_BIT | PSR_F_BIT
248 add r8, r0, #S_PC
249 ldr r9, [r0, #S_PSR]
250 msr spsr_cxsf, r9
251 ldr r0, [r0, #S_R0]
252 ldmia r8, {pc}^
221 .endm 253 .endm
222 254
223 .macro restore_user_regs, fast = 0, offset = 0 255 .macro restore_user_regs, fast = 0, offset = 0
224 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr 256 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
225 ldr lr, [sp, #\offset + S_PC]! @ get pc 257 ldr lr, [sp, #\offset + S_PC]! @ get pc
226 msr spsr_cxsf, r1 @ save in spsr_svc 258 msr spsr_cxsf, r1 @ save in spsr_svc
227#if defined(CONFIG_CPU_V6) 259#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K)
260 @ We must avoid clrex due to Cortex-A15 erratum #830321
228 strex r1, r2, [sp] @ clear the exclusive monitor 261 strex r1, r2, [sp] @ clear the exclusive monitor
229#elif defined(CONFIG_CPU_32v6K)
230 clrex @ clear the exclusive monitor
231#endif 262#endif
232 .if \fast 263 .if \fast
233 ldmdb sp, {r1 - lr}^ @ get calling r1 - lr 264 ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
@@ -261,7 +292,10 @@
261 .endif 292 .endif
262 ldr lr, [sp, #S_SP] @ top of the stack 293 ldr lr, [sp, #S_SP] @ top of the stack
263 ldrd r0, r1, [sp, #S_LR] @ calling lr and pc 294 ldrd r0, r1, [sp, #S_LR] @ calling lr and pc
264 clrex @ clear the exclusive monitor 295
296 @ We must avoid clrex due to Cortex-A15 erratum #830321
297 strex r2, r1, [sp, #S_LR] @ clear the exclusive monitor
298
265 stmdb lr!, {r0, r1, \rpsr} @ calling lr and rfe context 299 stmdb lr!, {r0, r1, \rpsr} @ calling lr and rfe context
266 ldmia sp, {r0 - r12} 300 ldmia sp, {r0 - r12}
267 mov sp, lr 301 mov sp, lr
@@ -269,6 +303,25 @@
269 rfeia sp! 303 rfeia sp!
270 .endm 304 .endm
271 305
306 @
307 @ svc_exit_via_fiq - like svc_exit but switches to FIQ mode before exit
308 @
309 @ For full details see non-Thumb implementation above.
310 @
311 .macro svc_exit_via_fiq
312 add r0, sp, #S_R2
313 ldr lr, [sp, #S_LR]
314 ldr sp, [sp, #S_SP] @ abort is deadly from here onward (it will
315 @ clobber state restored below)
316 ldmia r0, {r2 - r12}
317 mov r1, #FIQ_MODE | PSR_I_BIT | PSR_F_BIT
318 msr cpsr_c, r1
319 sub r0, #S_R2
320 add r8, r0, #S_PC
321 ldmia r0, {r0 - r1}
322 rfeia r8
323 .endm
324
272#ifdef CONFIG_CPU_V7M 325#ifdef CONFIG_CPU_V7M
273 /* 326 /*
274 * Note we don't need to do clrex here as clearing the local monitor is 327 * Note we don't need to do clrex here as clearing the local monitor is
@@ -282,13 +335,16 @@
282 .endm 335 .endm
283#else /* ifdef CONFIG_CPU_V7M */ 336#else /* ifdef CONFIG_CPU_V7M */
284 .macro restore_user_regs, fast = 0, offset = 0 337 .macro restore_user_regs, fast = 0, offset = 0
285 clrex @ clear the exclusive monitor
286 mov r2, sp 338 mov r2, sp
287 load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr 339 load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr
288 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr 340 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
289 ldr lr, [sp, #\offset + S_PC] @ get pc 341 ldr lr, [sp, #\offset + S_PC] @ get pc
290 add sp, sp, #\offset + S_SP 342 add sp, sp, #\offset + S_SP
291 msr spsr_cxsf, r1 @ save in spsr_svc 343 msr spsr_cxsf, r1 @ save in spsr_svc
344
345 @ We must avoid clrex due to Cortex-A15 erratum #830321
346 strex r1, r2, [sp] @ clear the exclusive monitor
347
292 .if \fast 348 .if \fast
293 ldmdb sp, {r1 - r12} @ get calling r1 - r12 349 ldmdb sp, {r1 - r12} @ get calling r1 - r12
294 .else 350 .else
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
index 918875d96d5d..b37752a96652 100644
--- a/arch/arm/kernel/fiq.c
+++ b/arch/arm/kernel/fiq.c
@@ -52,7 +52,8 @@
52 (unsigned)&vector_fiq_offset; \ 52 (unsigned)&vector_fiq_offset; \
53 }) 53 })
54 54
55static unsigned long no_fiq_insn; 55static unsigned long dfl_fiq_insn;
56static struct pt_regs dfl_fiq_regs;
56 57
57/* Default reacquire function 58/* Default reacquire function
58 * - we always relinquish FIQ control 59 * - we always relinquish FIQ control
@@ -60,8 +61,15 @@ static unsigned long no_fiq_insn;
60 */ 61 */
61static int fiq_def_op(void *ref, int relinquish) 62static int fiq_def_op(void *ref, int relinquish)
62{ 63{
63 if (!relinquish) 64 if (!relinquish) {
64 set_fiq_handler(&no_fiq_insn, sizeof(no_fiq_insn)); 65 /* Restore default handler and registers */
66 local_fiq_disable();
67 set_fiq_regs(&dfl_fiq_regs);
68 set_fiq_handler(&dfl_fiq_insn, sizeof(dfl_fiq_insn));
69 local_fiq_enable();
70
71 /* FIXME: notify irq controller to standard enable FIQs */
72 }
65 73
66 return 0; 74 return 0;
67} 75}
@@ -150,6 +158,7 @@ EXPORT_SYMBOL(disable_fiq);
150void __init init_FIQ(int start) 158void __init init_FIQ(int start)
151{ 159{
152 unsigned offset = FIQ_OFFSET; 160 unsigned offset = FIQ_OFFSET;
153 no_fiq_insn = *(unsigned long *)(0xffff0000 + offset); 161 dfl_fiq_insn = *(unsigned long *)(0xffff0000 + offset);
162 get_fiq_regs(&dfl_fiq_regs);
154 fiq_start = start; 163 fiq_start = start;
155} 164}
diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
index bb8b79648643..c4cc50e58c13 100644
--- a/arch/arm/kernel/hibernate.c
+++ b/arch/arm/kernel/hibernate.c
@@ -21,8 +21,7 @@
21#include <asm/idmap.h> 21#include <asm/idmap.h>
22#include <asm/suspend.h> 22#include <asm/suspend.h>
23#include <asm/memory.h> 23#include <asm/memory.h>
24 24#include <asm/sections.h>
25extern const void __nosave_begin, __nosave_end;
26 25
27int pfn_is_nosave(unsigned long pfn) 26int pfn_is_nosave(unsigned long pfn)
28{ 27{
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 4d963fb66e3f..b5b452f90f76 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -113,8 +113,8 @@ static u32 read_wb_reg(int n)
113 GEN_READ_WB_REG_CASES(ARM_OP2_WVR, val); 113 GEN_READ_WB_REG_CASES(ARM_OP2_WVR, val);
114 GEN_READ_WB_REG_CASES(ARM_OP2_WCR, val); 114 GEN_READ_WB_REG_CASES(ARM_OP2_WCR, val);
115 default: 115 default:
116 pr_warning("attempt to read from unknown breakpoint " 116 pr_warn("attempt to read from unknown breakpoint register %d\n",
117 "register %d\n", n); 117 n);
118 } 118 }
119 119
120 return val; 120 return val;
@@ -128,8 +128,8 @@ static void write_wb_reg(int n, u32 val)
128 GEN_WRITE_WB_REG_CASES(ARM_OP2_WVR, val); 128 GEN_WRITE_WB_REG_CASES(ARM_OP2_WVR, val);
129 GEN_WRITE_WB_REG_CASES(ARM_OP2_WCR, val); 129 GEN_WRITE_WB_REG_CASES(ARM_OP2_WCR, val);
130 default: 130 default:
131 pr_warning("attempt to write to unknown breakpoint " 131 pr_warn("attempt to write to unknown breakpoint register %d\n",
132 "register %d\n", n); 132 n);
133 } 133 }
134 isb(); 134 isb();
135} 135}
@@ -292,7 +292,7 @@ int hw_breakpoint_slots(int type)
292 case TYPE_DATA: 292 case TYPE_DATA:
293 return get_num_wrps(); 293 return get_num_wrps();
294 default: 294 default:
295 pr_warning("unknown slot type: %d\n", type); 295 pr_warn("unknown slot type: %d\n", type);
296 return 0; 296 return 0;
297 } 297 }
298} 298}
@@ -365,7 +365,7 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
365 } 365 }
366 366
367 if (i == max_slots) { 367 if (i == max_slots) {
368 pr_warning("Can't find any breakpoint slot\n"); 368 pr_warn("Can't find any breakpoint slot\n");
369 return -EBUSY; 369 return -EBUSY;
370 } 370 }
371 371
@@ -417,7 +417,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
417 } 417 }
418 418
419 if (i == max_slots) { 419 if (i == max_slots) {
420 pr_warning("Can't find any breakpoint slot\n"); 420 pr_warn("Can't find any breakpoint slot\n");
421 return; 421 return;
422 } 422 }
423 423
@@ -894,8 +894,8 @@ static int debug_reg_trap(struct pt_regs *regs, unsigned int instr)
894{ 894{
895 int cpu = smp_processor_id(); 895 int cpu = smp_processor_id();
896 896
897 pr_warning("Debug register access (0x%x) caused undefined instruction on CPU %d\n", 897 pr_warn("Debug register access (0x%x) caused undefined instruction on CPU %d\n",
898 instr, cpu); 898 instr, cpu);
899 899
900 /* Set the error flag for this CPU and skip the faulting instruction. */ 900 /* Set the error flag for this CPU and skip the faulting instruction. */
901 cpumask_set_cpu(cpu, &debug_err_mask); 901 cpumask_set_cpu(cpu, &debug_err_mask);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 2c4257604513..7c81ec428b9b 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -65,24 +65,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
65 */ 65 */
66void handle_IRQ(unsigned int irq, struct pt_regs *regs) 66void handle_IRQ(unsigned int irq, struct pt_regs *regs)
67{ 67{
68 struct pt_regs *old_regs = set_irq_regs(regs); 68 __handle_domain_irq(NULL, irq, false, regs);
69
70 irq_enter();
71
72 /*
73 * Some hardware gives randomly wrong interrupts. Rather
74 * than crashing, do something sensible.
75 */
76 if (unlikely(irq >= nr_irqs)) {
77 if (printk_ratelimit())
78 printk(KERN_WARNING "Bad IRQ%u\n", irq);
79 ack_bad_irq(irq);
80 } else {
81 generic_handle_irq(irq);
82 }
83
84 irq_exit();
85 set_irq_regs(old_regs);
86} 69}
87 70
88/* 71/*
@@ -175,7 +158,7 @@ static bool migrate_one_irq(struct irq_desc *desc)
175 c = irq_data_get_irq_chip(d); 158 c = irq_data_get_irq_chip(d);
176 if (!c->irq_set_affinity) 159 if (!c->irq_set_affinity)
177 pr_debug("IRQ%u: unable to set affinity\n", d->irq); 160 pr_debug("IRQ%u: unable to set affinity\n", d->irq);
178 else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) 161 else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret)
179 cpumask_copy(d->affinity, affinity); 162 cpumask_copy(d->affinity, affinity);
180 163
181 return ret; 164 return ret;
@@ -205,8 +188,8 @@ void migrate_irqs(void)
205 raw_spin_unlock(&desc->lock); 188 raw_spin_unlock(&desc->lock);
206 189
207 if (affinity_broken && printk_ratelimit()) 190 if (affinity_broken && printk_ratelimit())
208 pr_warning("IRQ%u no longer affine to CPU%u\n", i, 191 pr_warn("IRQ%u no longer affine to CPU%u\n",
209 smp_processor_id()); 192 i, smp_processor_id());
210 } 193 }
211 194
212 local_irq_restore(flags); 195 local_irq_restore(flags);
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 08d731294bcd..b206d7790c77 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -110,10 +110,13 @@
110 * 110 *
111 * @ TESTCASE_START 111 * @ TESTCASE_START
112 * bl __kprobes_test_case_start 112 * bl __kprobes_test_case_start
113 * @ start of inline data... 113 * .pushsection .rodata
114 * "10:
114 * .ascii "mov r0, r7" @ text title for test case 115 * .ascii "mov r0, r7" @ text title for test case
115 * .byte 0 116 * .byte 0
116 * .align 2, 0 117 * .popsection
118 * @ start of inline data...
119 * .word 10b @ pointer to title in .rodata section
117 * 120 *
118 * @ TEST_ARG_REG 121 * @ TEST_ARG_REG
119 * .byte ARG_TYPE_REG 122 * .byte ARG_TYPE_REG
@@ -971,7 +974,7 @@ void __naked __kprobes_test_case_start(void)
971 __asm__ __volatile__ ( 974 __asm__ __volatile__ (
972 "stmdb sp!, {r4-r11} \n\t" 975 "stmdb sp!, {r4-r11} \n\t"
973 "sub sp, sp, #"__stringify(TEST_MEMORY_SIZE)"\n\t" 976 "sub sp, sp, #"__stringify(TEST_MEMORY_SIZE)"\n\t"
974 "bic r0, lr, #1 @ r0 = inline title string \n\t" 977 "bic r0, lr, #1 @ r0 = inline data \n\t"
975 "mov r1, sp \n\t" 978 "mov r1, sp \n\t"
976 "bl kprobes_test_case_start \n\t" 979 "bl kprobes_test_case_start \n\t"
977 "bx r0 \n\t" 980 "bx r0 \n\t"
@@ -1349,15 +1352,14 @@ static unsigned long next_instruction(unsigned long pc)
1349 return pc + 4; 1352 return pc + 4;
1350} 1353}
1351 1354
1352static uintptr_t __used kprobes_test_case_start(const char *title, void *stack) 1355static uintptr_t __used kprobes_test_case_start(const char **title, void *stack)
1353{ 1356{
1354 struct test_arg *args; 1357 struct test_arg *args;
1355 struct test_arg_end *end_arg; 1358 struct test_arg_end *end_arg;
1356 unsigned long test_code; 1359 unsigned long test_code;
1357 1360
1358 args = (struct test_arg *)PTR_ALIGN(title + strlen(title) + 1, 4); 1361 current_title = *title++;
1359 1362 args = (struct test_arg *)title;
1360 current_title = title;
1361 current_args = args; 1363 current_args = args;
1362 current_stack = stack; 1364 current_stack = stack;
1363 1365
diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/kernel/kprobes-test.h
index eecc90a0fd91..4430990e90e7 100644
--- a/arch/arm/kernel/kprobes-test.h
+++ b/arch/arm/kernel/kprobes-test.h
@@ -111,11 +111,14 @@ struct test_arg_end {
111#define TESTCASE_START(title) \ 111#define TESTCASE_START(title) \
112 __asm__ __volatile__ ( \ 112 __asm__ __volatile__ ( \
113 "bl __kprobes_test_case_start \n\t" \ 113 "bl __kprobes_test_case_start \n\t" \
114 ".pushsection .rodata \n\t" \
115 "10: \n\t" \
114 /* don't use .asciz here as 'title' may be */ \ 116 /* don't use .asciz here as 'title' may be */ \
115 /* multiple strings to be concatenated. */ \ 117 /* multiple strings to be concatenated. */ \
116 ".ascii "#title" \n\t" \ 118 ".ascii "#title" \n\t" \
117 ".byte 0 \n\t" \ 119 ".byte 0 \n\t" \
118 ".align 2, 0 \n\t" 120 ".popsection \n\t" \
121 ".word 10b \n\t"
119 122
120#define TEST_ARG_REG(reg, val) \ 123#define TEST_ARG_REG(reg, val) \
121 ".byte "__stringify(ARG_TYPE_REG)" \n\t" \ 124 ".byte "__stringify(ARG_TYPE_REG)" \n\t" \
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 45e478157278..6a4dffefd357 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -91,6 +91,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
91 break; 91 break;
92 92
93 case R_ARM_ABS32: 93 case R_ARM_ABS32:
94 case R_ARM_TARGET1:
94 *(u32 *)loc += sym->st_value; 95 *(u32 *)loc += sym->st_value;
95 break; 96 break;
96 97
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index e6a6edbec613..eb2c4d55666b 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -76,21 +76,15 @@ static struct pmu_hw_events *cpu_pmu_get_cpu_events(void)
76 76
77static void cpu_pmu_enable_percpu_irq(void *data) 77static void cpu_pmu_enable_percpu_irq(void *data)
78{ 78{
79 struct arm_pmu *cpu_pmu = data; 79 int irq = *(int *)data;
80 struct platform_device *pmu_device = cpu_pmu->plat_device;
81 int irq = platform_get_irq(pmu_device, 0);
82 80
83 enable_percpu_irq(irq, IRQ_TYPE_NONE); 81 enable_percpu_irq(irq, IRQ_TYPE_NONE);
84 cpumask_set_cpu(smp_processor_id(), &cpu_pmu->active_irqs);
85} 82}
86 83
87static void cpu_pmu_disable_percpu_irq(void *data) 84static void cpu_pmu_disable_percpu_irq(void *data)
88{ 85{
89 struct arm_pmu *cpu_pmu = data; 86 int irq = *(int *)data;
90 struct platform_device *pmu_device = cpu_pmu->plat_device;
91 int irq = platform_get_irq(pmu_device, 0);
92 87
93 cpumask_clear_cpu(smp_processor_id(), &cpu_pmu->active_irqs);
94 disable_percpu_irq(irq); 88 disable_percpu_irq(irq);
95} 89}
96 90
@@ -103,7 +97,7 @@ static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
103 97
104 irq = platform_get_irq(pmu_device, 0); 98 irq = platform_get_irq(pmu_device, 0);
105 if (irq >= 0 && irq_is_percpu(irq)) { 99 if (irq >= 0 && irq_is_percpu(irq)) {
106 on_each_cpu(cpu_pmu_disable_percpu_irq, cpu_pmu, 1); 100 on_each_cpu(cpu_pmu_disable_percpu_irq, &irq, 1);
107 free_percpu_irq(irq, &percpu_pmu); 101 free_percpu_irq(irq, &percpu_pmu);
108 } else { 102 } else {
109 for (i = 0; i < irqs; ++i) { 103 for (i = 0; i < irqs; ++i) {
@@ -138,7 +132,7 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
138 irq); 132 irq);
139 return err; 133 return err;
140 } 134 }
141 on_each_cpu(cpu_pmu_enable_percpu_irq, cpu_pmu, 1); 135 on_each_cpu(cpu_pmu_enable_percpu_irq, &irq, 1);
142 } else { 136 } else {
143 for (i = 0; i < irqs; ++i) { 137 for (i = 0; i < irqs; ++i) {
144 err = 0; 138 err = 0;
@@ -152,8 +146,8 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
152 * continue. Otherwise, continue without this interrupt. 146 * continue. Otherwise, continue without this interrupt.
153 */ 147 */
154 if (irq_set_affinity(irq, cpumask_of(i)) && irqs > 1) { 148 if (irq_set_affinity(irq, cpumask_of(i)) && irqs > 1) {
155 pr_warning("unable to set irq affinity (irq=%d, cpu=%u)\n", 149 pr_warn("unable to set irq affinity (irq=%d, cpu=%u)\n",
156 irq, i); 150 irq, i);
157 continue; 151 continue;
158 } 152 }
159 153
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 81ef686a91ca..a0a691d1cbee 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -306,7 +306,6 @@ void __show_regs(struct pt_regs *regs)
306 306
307void show_regs(struct pt_regs * regs) 307void show_regs(struct pt_regs * regs)
308{ 308{
309 printk("\n");
310 __show_regs(regs); 309 __show_regs(regs);
311 dump_stack(); 310 dump_stack();
312} 311}
@@ -334,6 +333,8 @@ void flush_thread(void)
334 memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); 333 memset(&tsk->thread.debug, 0, sizeof(struct debug_info));
335 memset(&thread->fpstate, 0, sizeof(union fp_state)); 334 memset(&thread->fpstate, 0, sizeof(union fp_state));
336 335
336 flush_tls();
337
337 thread_notify(THREAD_NOTIFY_FLUSH, thread); 338 thread_notify(THREAD_NOTIFY_FLUSH, thread);
338} 339}
339 340
@@ -472,19 +473,57 @@ int in_gate_area_no_mm(unsigned long addr)
472 473
473const char *arch_vma_name(struct vm_area_struct *vma) 474const char *arch_vma_name(struct vm_area_struct *vma)
474{ 475{
475 return is_gate_vma(vma) ? "[vectors]" : 476 return is_gate_vma(vma) ? "[vectors]" : NULL;
476 (vma->vm_mm && vma->vm_start == vma->vm_mm->context.sigpage) ? 477}
477 "[sigpage]" : NULL; 478
479/* If possible, provide a placement hint at a random offset from the
480 * stack for the signal page.
481 */
482static unsigned long sigpage_addr(const struct mm_struct *mm,
483 unsigned int npages)
484{
485 unsigned long offset;
486 unsigned long first;
487 unsigned long last;
488 unsigned long addr;
489 unsigned int slots;
490
491 first = PAGE_ALIGN(mm->start_stack);
492
493 last = TASK_SIZE - (npages << PAGE_SHIFT);
494
495 /* No room after stack? */
496 if (first > last)
497 return 0;
498
499 /* Just enough room? */
500 if (first == last)
501 return first;
502
503 slots = ((last - first) >> PAGE_SHIFT) + 1;
504
505 offset = get_random_int() % slots;
506
507 addr = first + (offset << PAGE_SHIFT);
508
509 return addr;
478} 510}
479 511
480static struct page *signal_page; 512static struct page *signal_page;
481extern struct page *get_signal_page(void); 513extern struct page *get_signal_page(void);
482 514
515static const struct vm_special_mapping sigpage_mapping = {
516 .name = "[sigpage]",
517 .pages = &signal_page,
518};
519
483int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) 520int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
484{ 521{
485 struct mm_struct *mm = current->mm; 522 struct mm_struct *mm = current->mm;
523 struct vm_area_struct *vma;
486 unsigned long addr; 524 unsigned long addr;
487 int ret; 525 unsigned long hint;
526 int ret = 0;
488 527
489 if (!signal_page) 528 if (!signal_page)
490 signal_page = get_signal_page(); 529 signal_page = get_signal_page();
@@ -492,18 +531,23 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
492 return -ENOMEM; 531 return -ENOMEM;
493 532
494 down_write(&mm->mmap_sem); 533 down_write(&mm->mmap_sem);
495 addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0); 534 hint = sigpage_addr(mm, 1);
535 addr = get_unmapped_area(NULL, hint, PAGE_SIZE, 0, 0);
496 if (IS_ERR_VALUE(addr)) { 536 if (IS_ERR_VALUE(addr)) {
497 ret = addr; 537 ret = addr;
498 goto up_fail; 538 goto up_fail;
499 } 539 }
500 540
501 ret = install_special_mapping(mm, addr, PAGE_SIZE, 541 vma = _install_special_mapping(mm, addr, PAGE_SIZE,
502 VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, 542 VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
503 &signal_page); 543 &sigpage_mapping);
544
545 if (IS_ERR(vma)) {
546 ret = PTR_ERR(vma);
547 goto up_fail;
548 }
504 549
505 if (ret == 0) 550 mm->context.sigpage = addr;
506 mm->context.sigpage = addr;
507 551
508 up_fail: 552 up_fail:
509 up_write(&mm->mmap_sem); 553 up_write(&mm->mmap_sem);
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index fafedd86885d..98ea4b7eb406 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -59,15 +59,6 @@ void *return_address(unsigned int level)
59 59
60#else /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */ 60#else /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */
61 61
62#if defined(CONFIG_ARM_UNWIND)
63#warning "TODO: return_address should use unwind tables"
64#endif
65
66void *return_address(unsigned int level)
67{
68 return NULL;
69}
70
71#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */ 62#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
72 63
73EXPORT_SYMBOL_GPL(return_address); 64EXPORT_SYMBOL_GPL(return_address);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 84db893dedc2..c03106378b49 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -133,6 +133,7 @@ struct stack {
133 u32 irq[3]; 133 u32 irq[3];
134 u32 abt[3]; 134 u32 abt[3];
135 u32 und[3]; 135 u32 und[3];
136 u32 fiq[3];
136} ____cacheline_aligned; 137} ____cacheline_aligned;
137 138
138#ifndef CONFIG_CPU_V7M 139#ifndef CONFIG_CPU_V7M
@@ -470,7 +471,10 @@ void notrace cpu_init(void)
470 "msr cpsr_c, %5\n\t" 471 "msr cpsr_c, %5\n\t"
471 "add r14, %0, %6\n\t" 472 "add r14, %0, %6\n\t"
472 "mov sp, r14\n\t" 473 "mov sp, r14\n\t"
473 "msr cpsr_c, %7" 474 "msr cpsr_c, %7\n\t"
475 "add r14, %0, %8\n\t"
476 "mov sp, r14\n\t"
477 "msr cpsr_c, %9"
474 : 478 :
475 : "r" (stk), 479 : "r" (stk),
476 PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE), 480 PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
@@ -479,6 +483,8 @@ void notrace cpu_init(void)
479 "I" (offsetof(struct stack, abt[0])), 483 "I" (offsetof(struct stack, abt[0])),
480 PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE), 484 PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE),
481 "I" (offsetof(struct stack, und[0])), 485 "I" (offsetof(struct stack, und[0])),
486 PLC (PSR_F_BIT | PSR_I_BIT | FIQ_MODE),
487 "I" (offsetof(struct stack, fiq[0])),
482 PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE) 488 PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
483 : "r14"); 489 : "r14");
484#endif 490#endif
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 9388a3d479e1..13396d3d600e 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -95,6 +95,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
95{ 95{
96 int ret; 96 int ret;
97 97
98 if (!smp_ops.smp_boot_secondary)
99 return -ENOSYS;
100
98 /* 101 /*
99 * We need to tell the secondary core where to find 102 * We need to tell the secondary core where to find
100 * its stack and the page tables. 103 * its stack and the page tables.
@@ -113,7 +116,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
113 /* 116 /*
114 * Now bring the CPU into our world. 117 * Now bring the CPU into our world.
115 */ 118 */
116 ret = boot_secondary(cpu, idle); 119 ret = smp_ops.smp_boot_secondary(cpu, idle);
117 if (ret == 0) { 120 if (ret == 0) {
118 /* 121 /*
119 * CPU was successfully started, wait for it 122 * CPU was successfully started, wait for it
@@ -142,13 +145,6 @@ void __init smp_init_cpus(void)
142 smp_ops.smp_init_cpus(); 145 smp_ops.smp_init_cpus();
143} 146}
144 147
145int boot_secondary(unsigned int cpu, struct task_struct *idle)
146{
147 if (smp_ops.smp_boot_secondary)
148 return smp_ops.smp_boot_secondary(cpu, idle);
149 return -ENOSYS;
150}
151
152int platform_can_cpu_hotplug(void) 148int platform_can_cpu_hotplug(void)
153{ 149{
154#ifdef CONFIG_HOTPLUG_CPU 150#ifdef CONFIG_HOTPLUG_CPU
@@ -503,7 +499,7 @@ void arch_send_call_function_single_ipi(int cpu)
503#ifdef CONFIG_IRQ_WORK 499#ifdef CONFIG_IRQ_WORK
504void arch_irq_work_raise(void) 500void arch_irq_work_raise(void)
505{ 501{
506 if (is_smp()) 502 if (arch_irq_work_has_interrupt())
507 smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK); 503 smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
508} 504}
509#endif 505#endif
@@ -650,7 +646,7 @@ void smp_send_stop(void)
650 udelay(1); 646 udelay(1);
651 647
652 if (num_online_cpus() > 1) 648 if (num_online_cpus() > 1)
653 pr_warning("SMP: failed to stop secondary CPUs\n"); 649 pr_warn("SMP: failed to stop secondary CPUs\n");
654} 650}
655 651
656/* 652/*
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c
index 67ca8578c6d8..587fdfe1a72c 100644
--- a/arch/arm/kernel/swp_emulate.c
+++ b/arch/arm/kernel/swp_emulate.c
@@ -142,14 +142,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data,
142 while (1) { 142 while (1) {
143 unsigned long temp; 143 unsigned long temp;
144 144
145 /*
146 * Barrier required between accessing protected resource and
147 * releasing a lock for it. Legacy code might not have done
148 * this, and we cannot determine that this is not the case
149 * being emulated, so insert always.
150 */
151 smp_mb();
152
153 if (type == TYPE_SWPB) 145 if (type == TYPE_SWPB)
154 __user_swpb_asm(*data, address, res, temp); 146 __user_swpb_asm(*data, address, res, temp);
155 else 147 else
@@ -162,13 +154,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data,
162 } 154 }
163 155
164 if (res == 0) { 156 if (res == 0) {
165 /*
166 * Barrier also required between acquiring a lock for a
167 * protected resource and accessing the resource. Inserted for
168 * same reason as above.
169 */
170 smp_mb();
171
172 if (type == TYPE_SWPB) 157 if (type == TYPE_SWPB)
173 swpbcounter++; 158 swpbcounter++;
174 else 159 else
diff --git a/arch/arm/kernel/thumbee.c b/arch/arm/kernel/thumbee.c
index 7b8403b76666..80f0d69205e7 100644
--- a/arch/arm/kernel/thumbee.c
+++ b/arch/arm/kernel/thumbee.c
@@ -45,7 +45,7 @@ static int thumbee_notifier(struct notifier_block *self, unsigned long cmd, void
45 45
46 switch (cmd) { 46 switch (cmd) {
47 case THREAD_NOTIFY_FLUSH: 47 case THREAD_NOTIFY_FLUSH:
48 thread->thumbee_state = 0; 48 teehbr_write(0);
49 break; 49 break;
50 case THREAD_NOTIFY_SWITCH: 50 case THREAD_NOTIFY_SWITCH:
51 current_thread_info()->thumbee_state = teehbr_read(); 51 current_thread_info()->thumbee_state = teehbr_read();
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index c8e4bb714944..0c8b10801d36 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -25,6 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/sched.h> 27#include <linux/sched.h>
28#include <linux/irq.h>
28 29
29#include <linux/atomic.h> 30#include <linux/atomic.h>
30#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
@@ -460,10 +461,29 @@ die_sig:
460 arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6); 461 arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6);
461} 462}
462 463
463asmlinkage void do_unexp_fiq (struct pt_regs *regs) 464/*
465 * Handle FIQ similarly to NMI on x86 systems.
466 *
467 * The runtime environment for NMIs is extremely restrictive
468 * (NMIs can pre-empt critical sections meaning almost all locking is
469 * forbidden) meaning this default FIQ handling must only be used in
470 * circumstances where non-maskability improves robustness, such as
471 * watchdog or debug logic.
472 *
473 * This handler is not appropriate for general purpose use in drivers
474 * platform code and can be overrideen using set_fiq_handler.
475 */
476asmlinkage void __exception_irq_entry handle_fiq_as_nmi(struct pt_regs *regs)
464{ 477{
465 printk("Hmm. Unexpected FIQ received, but trying to continue\n"); 478 struct pt_regs *old_regs = set_irq_regs(regs);
466 printk("You may have a hardware problem...\n"); 479
480 nmi_enter();
481
482 /* nop. FIQ handlers for special arch/arm features can be added here. */
483
484 nmi_exit();
485
486 set_irq_regs(old_regs);
467} 487}
468 488
469/* 489/*
@@ -581,7 +601,6 @@ do_cache_op(unsigned long start, unsigned long end, int flags)
581#define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE) 601#define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE)
582asmlinkage int arm_syscall(int no, struct pt_regs *regs) 602asmlinkage int arm_syscall(int no, struct pt_regs *regs)
583{ 603{
584 struct thread_info *thread = current_thread_info();
585 siginfo_t info; 604 siginfo_t info;
586 605
587 if ((no >> 16) != (__ARM_NR_BASE>> 16)) 606 if ((no >> 16) != (__ARM_NR_BASE>> 16))
@@ -632,21 +651,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
632 return regs->ARM_r0; 651 return regs->ARM_r0;
633 652
634 case NR(set_tls): 653 case NR(set_tls):
635 thread->tp_value[0] = regs->ARM_r0; 654 set_tls(regs->ARM_r0);
636 if (tls_emu)
637 return 0;
638 if (has_tls_reg) {
639 asm ("mcr p15, 0, %0, c13, c0, 3"
640 : : "r" (regs->ARM_r0));
641 } else {
642 /*
643 * User space must never try to access this directly.
644 * Expect your app to break eventually if you do so.
645 * The user helper at 0xffff0fe0 must be used instead.
646 * (see entry-armv.S for details)
647 */
648 *((unsigned int *)0xffff0ff0) = regs->ARM_r0;
649 }
650 return 0; 655 return 0;
651 656
652#ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG 657#ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index a61a1dfbb0db..cbb85c5fabf9 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -157,7 +157,7 @@ static const struct unwind_idx *search_index(unsigned long addr,
157 if (likely(start->addr_offset <= addr_prel31)) 157 if (likely(start->addr_offset <= addr_prel31))
158 return start; 158 return start;
159 else { 159 else {
160 pr_warning("unwind: Unknown symbol address %08lx\n", addr); 160 pr_warn("unwind: Unknown symbol address %08lx\n", addr);
161 return NULL; 161 return NULL;
162 } 162 }
163} 163}
@@ -225,7 +225,7 @@ static unsigned long unwind_get_byte(struct unwind_ctrl_block *ctrl)
225 unsigned long ret; 225 unsigned long ret;
226 226
227 if (ctrl->entries <= 0) { 227 if (ctrl->entries <= 0) {
228 pr_warning("unwind: Corrupt unwind table\n"); 228 pr_warn("unwind: Corrupt unwind table\n");
229 return 0; 229 return 0;
230 } 230 }
231 231
@@ -333,8 +333,8 @@ static int unwind_exec_insn(struct unwind_ctrl_block *ctrl)
333 insn = (insn << 8) | unwind_get_byte(ctrl); 333 insn = (insn << 8) | unwind_get_byte(ctrl);
334 mask = insn & 0x0fff; 334 mask = insn & 0x0fff;
335 if (mask == 0) { 335 if (mask == 0) {
336 pr_warning("unwind: 'Refuse to unwind' instruction %04lx\n", 336 pr_warn("unwind: 'Refuse to unwind' instruction %04lx\n",
337 insn); 337 insn);
338 return -URC_FAILURE; 338 return -URC_FAILURE;
339 } 339 }
340 340
@@ -357,8 +357,8 @@ static int unwind_exec_insn(struct unwind_ctrl_block *ctrl)
357 unsigned long mask = unwind_get_byte(ctrl); 357 unsigned long mask = unwind_get_byte(ctrl);
358 358
359 if (mask == 0 || mask & 0xf0) { 359 if (mask == 0 || mask & 0xf0) {
360 pr_warning("unwind: Spare encoding %04lx\n", 360 pr_warn("unwind: Spare encoding %04lx\n",
361 (insn << 8) | mask); 361 (insn << 8) | mask);
362 return -URC_FAILURE; 362 return -URC_FAILURE;
363 } 363 }
364 364
@@ -370,7 +370,7 @@ static int unwind_exec_insn(struct unwind_ctrl_block *ctrl)
370 370
371 ctrl->vrs[SP] += 0x204 + (uleb128 << 2); 371 ctrl->vrs[SP] += 0x204 + (uleb128 << 2);
372 } else { 372 } else {
373 pr_warning("unwind: Unhandled instruction %02lx\n", insn); 373 pr_warn("unwind: Unhandled instruction %02lx\n", insn);
374 return -URC_FAILURE; 374 return -URC_FAILURE;
375 } 375 }
376 376
@@ -403,7 +403,7 @@ int unwind_frame(struct stackframe *frame)
403 403
404 idx = unwind_find_idx(frame->pc); 404 idx = unwind_find_idx(frame->pc);
405 if (!idx) { 405 if (!idx) {
406 pr_warning("unwind: Index not found %08lx\n", frame->pc); 406 pr_warn("unwind: Index not found %08lx\n", frame->pc);
407 return -URC_FAILURE; 407 return -URC_FAILURE;
408 } 408 }
409 409
@@ -422,8 +422,8 @@ int unwind_frame(struct stackframe *frame)
422 /* only personality routine 0 supported in the index */ 422 /* only personality routine 0 supported in the index */
423 ctrl.insn = &idx->insn; 423 ctrl.insn = &idx->insn;
424 else { 424 else {
425 pr_warning("unwind: Unsupported personality routine %08lx in the index at %p\n", 425 pr_warn("unwind: Unsupported personality routine %08lx in the index at %p\n",
426 idx->insn, idx); 426 idx->insn, idx);
427 return -URC_FAILURE; 427 return -URC_FAILURE;
428 } 428 }
429 429
@@ -435,8 +435,8 @@ int unwind_frame(struct stackframe *frame)
435 ctrl.byte = 1; 435 ctrl.byte = 1;
436 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16); 436 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16);
437 } else { 437 } else {
438 pr_warning("unwind: Unsupported personality routine %08lx at %p\n", 438 pr_warn("unwind: Unsupported personality routine %08lx at %p\n",
439 *ctrl.insn, ctrl.insn); 439 *ctrl.insn, ctrl.insn);
440 return -URC_FAILURE; 440 return -URC_FAILURE;
441 } 441 }
442 442
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 6f57cb94367f..8e95aa47457a 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -219,8 +219,8 @@ SECTIONS
219 __data_loc = ALIGN(4); /* location in binary */ 219 __data_loc = ALIGN(4); /* location in binary */
220 . = PAGE_OFFSET + TEXT_OFFSET; 220 . = PAGE_OFFSET + TEXT_OFFSET;
221#else 221#else
222 __init_end = .;
223 . = ALIGN(THREAD_SIZE); 222 . = ALIGN(THREAD_SIZE);
223 __init_end = .;
224 __data_loc = .; 224 __data_loc = .;
225#endif 225#endif
226 226
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index a99e0cdf8ba2..779605122f32 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -82,12 +82,12 @@ struct kvm_vcpu *kvm_arm_get_running_vcpu(void)
82/** 82/**
83 * kvm_arm_get_running_vcpus - get the per-CPU array of currently running vcpus. 83 * kvm_arm_get_running_vcpus - get the per-CPU array of currently running vcpus.
84 */ 84 */
85struct kvm_vcpu __percpu **kvm_get_running_vcpus(void) 85struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void)
86{ 86{
87 return &kvm_arm_running_vcpu; 87 return &kvm_arm_running_vcpu;
88} 88}
89 89
90int kvm_arch_hardware_enable(void *garbage) 90int kvm_arch_hardware_enable(void)
91{ 91{
92 return 0; 92 return 0;
93} 93}
@@ -97,27 +97,16 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
97 return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE; 97 return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE;
98} 98}
99 99
100void kvm_arch_hardware_disable(void *garbage)
101{
102}
103
104int kvm_arch_hardware_setup(void) 100int kvm_arch_hardware_setup(void)
105{ 101{
106 return 0; 102 return 0;
107} 103}
108 104
109void kvm_arch_hardware_unsetup(void)
110{
111}
112
113void kvm_arch_check_processor_compat(void *rtn) 105void kvm_arch_check_processor_compat(void *rtn)
114{ 106{
115 *(int *)rtn = 0; 107 *(int *)rtn = 0;
116} 108}
117 109
118void kvm_arch_sync_events(struct kvm *kvm)
119{
120}
121 110
122/** 111/**
123 * kvm_arch_init_vm - initializes a VM data structure 112 * kvm_arch_init_vm - initializes a VM data structure
@@ -172,6 +161,8 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
172 kvm->vcpus[i] = NULL; 161 kvm->vcpus[i] = NULL;
173 } 162 }
174 } 163 }
164
165 kvm_vgic_destroy(kvm);
175} 166}
176 167
177int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) 168int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
@@ -188,6 +179,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
188 case KVM_CAP_ONE_REG: 179 case KVM_CAP_ONE_REG:
189 case KVM_CAP_ARM_PSCI: 180 case KVM_CAP_ARM_PSCI:
190 case KVM_CAP_ARM_PSCI_0_2: 181 case KVM_CAP_ARM_PSCI_0_2:
182 case KVM_CAP_READONLY_MEM:
191 r = 1; 183 r = 1;
192 break; 184 break;
193 case KVM_CAP_COALESCED_MMIO: 185 case KVM_CAP_COALESCED_MMIO:
@@ -253,6 +245,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
253{ 245{
254 kvm_mmu_free_memory_caches(vcpu); 246 kvm_mmu_free_memory_caches(vcpu);
255 kvm_timer_vcpu_terminate(vcpu); 247 kvm_timer_vcpu_terminate(vcpu);
248 kvm_vgic_vcpu_destroy(vcpu);
256 kmem_cache_free(kvm_vcpu_cache, vcpu); 249 kmem_cache_free(kvm_vcpu_cache, vcpu);
257} 250}
258 251
@@ -268,26 +261,15 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
268 261
269int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) 262int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
270{ 263{
271 int ret;
272
273 /* Force users to call KVM_ARM_VCPU_INIT */ 264 /* Force users to call KVM_ARM_VCPU_INIT */
274 vcpu->arch.target = -1; 265 vcpu->arch.target = -1;
275 266
276 /* Set up VGIC */
277 ret = kvm_vgic_vcpu_init(vcpu);
278 if (ret)
279 return ret;
280
281 /* Set up the timer */ 267 /* Set up the timer */
282 kvm_timer_vcpu_init(vcpu); 268 kvm_timer_vcpu_init(vcpu);
283 269
284 return 0; 270 return 0;
285} 271}
286 272
287void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
288{
289}
290
291void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 273void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
292{ 274{
293 vcpu->cpu = cpu; 275 vcpu->cpu = cpu;
@@ -428,9 +410,9 @@ static void update_vttbr(struct kvm *kvm)
428 410
429 /* update vttbr to be used with the new vmid */ 411 /* update vttbr to be used with the new vmid */
430 pgd_phys = virt_to_phys(kvm->arch.pgd); 412 pgd_phys = virt_to_phys(kvm->arch.pgd);
413 BUG_ON(pgd_phys & ~VTTBR_BADDR_MASK);
431 vmid = ((u64)(kvm->arch.vmid) << VTTBR_VMID_SHIFT) & VTTBR_VMID_MASK; 414 vmid = ((u64)(kvm->arch.vmid) << VTTBR_VMID_SHIFT) & VTTBR_VMID_MASK;
432 kvm->arch.vttbr = pgd_phys & VTTBR_BADDR_MASK; 415 kvm->arch.vttbr = pgd_phys | vmid;
433 kvm->arch.vttbr |= vmid;
434 416
435 spin_unlock(&kvm_vmid_lock); 417 spin_unlock(&kvm_vmid_lock);
436} 418}
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index 37a0fe1bb9bb..7928dbdf2102 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -791,7 +791,7 @@ static bool is_valid_cache(u32 val)
791 u32 level, ctype; 791 u32 level, ctype;
792 792
793 if (val >= CSSELR_MAX) 793 if (val >= CSSELR_MAX)
794 return -ENOENT; 794 return false;
795 795
796 /* Bottom bit is Instruction or Data bit. Next 3 bits are level. */ 796 /* Bottom bit is Instruction or Data bit. Next 3 bits are level. */
797 level = (val >> 1); 797 level = (val >> 1);
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
index 813e49258690..cc0b78769bd8 100644
--- a/arch/arm/kvm/guest.c
+++ b/arch/arm/kvm/guest.c
@@ -163,7 +163,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
163 163
164 ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id)); 164 ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id));
165 if (ret != 0) 165 if (ret != 0)
166 return ret; 166 return -EFAULT;
167 167
168 return kvm_arm_timer_set_reg(vcpu, reg->id, val); 168 return kvm_arm_timer_set_reg(vcpu, reg->id, val);
169} 169}
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c
index 4c979d466cc1..a96a8043277c 100644
--- a/arch/arm/kvm/handle_exit.c
+++ b/arch/arm/kvm/handle_exit.c
@@ -93,6 +93,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run)
93 else 93 else
94 kvm_vcpu_block(vcpu); 94 kvm_vcpu_block(vcpu);
95 95
96 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
97
96 return 1; 98 return 1;
97} 99}
98 100
diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S
index 991415d978b6..3988e72d16ff 100644
--- a/arch/arm/kvm/init.S
+++ b/arch/arm/kvm/init.S
@@ -99,6 +99,10 @@ __do_hyp_init:
99 mrc p15, 0, r0, c10, c2, 1 99 mrc p15, 0, r0, c10, c2, 1
100 mcr p15, 4, r0, c10, c2, 1 100 mcr p15, 4, r0, c10, c2, 1
101 101
102 @ Invalidate the stale TLBs from Bootloader
103 mcr p15, 4, r0, c8, c7, 0 @ TLBIALLH
104 dsb ish
105
102 @ Set the HSCTLR to: 106 @ Set the HSCTLR to:
103 @ - ARM/THUMB exceptions: Kernel config (Thumb-2 kernel) 107 @ - ARM/THUMB exceptions: Kernel config (Thumb-2 kernel)
104 @ - Endianness: Kernel config 108 @ - Endianness: Kernel config
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 16e7994bf347..eea03069161b 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -746,22 +746,29 @@ static bool transparent_hugepage_adjust(pfn_t *pfnp, phys_addr_t *ipap)
746 return false; 746 return false;
747} 747}
748 748
749static bool kvm_is_write_fault(struct kvm_vcpu *vcpu)
750{
751 if (kvm_vcpu_trap_is_iabt(vcpu))
752 return false;
753
754 return kvm_vcpu_dabt_iswrite(vcpu);
755}
756
749static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, 757static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
750 struct kvm_memory_slot *memslot, 758 struct kvm_memory_slot *memslot, unsigned long hva,
751 unsigned long fault_status) 759 unsigned long fault_status)
752{ 760{
753 int ret; 761 int ret;
754 bool write_fault, writable, hugetlb = false, force_pte = false; 762 bool write_fault, writable, hugetlb = false, force_pte = false;
755 unsigned long mmu_seq; 763 unsigned long mmu_seq;
756 gfn_t gfn = fault_ipa >> PAGE_SHIFT; 764 gfn_t gfn = fault_ipa >> PAGE_SHIFT;
757 unsigned long hva = gfn_to_hva(vcpu->kvm, gfn);
758 struct kvm *kvm = vcpu->kvm; 765 struct kvm *kvm = vcpu->kvm;
759 struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache; 766 struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache;
760 struct vm_area_struct *vma; 767 struct vm_area_struct *vma;
761 pfn_t pfn; 768 pfn_t pfn;
762 pgprot_t mem_type = PAGE_S2; 769 pgprot_t mem_type = PAGE_S2;
763 770
764 write_fault = kvm_is_write_fault(kvm_vcpu_get_hsr(vcpu)); 771 write_fault = kvm_is_write_fault(vcpu);
765 if (fault_status == FSC_PERM && !write_fault) { 772 if (fault_status == FSC_PERM && !write_fault) {
766 kvm_err("Unexpected L2 read permission error\n"); 773 kvm_err("Unexpected L2 read permission error\n");
767 return -EFAULT; 774 return -EFAULT;
@@ -863,7 +870,8 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
863 unsigned long fault_status; 870 unsigned long fault_status;
864 phys_addr_t fault_ipa; 871 phys_addr_t fault_ipa;
865 struct kvm_memory_slot *memslot; 872 struct kvm_memory_slot *memslot;
866 bool is_iabt; 873 unsigned long hva;
874 bool is_iabt, write_fault, writable;
867 gfn_t gfn; 875 gfn_t gfn;
868 int ret, idx; 876 int ret, idx;
869 877
@@ -874,17 +882,22 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
874 kvm_vcpu_get_hfar(vcpu), fault_ipa); 882 kvm_vcpu_get_hfar(vcpu), fault_ipa);
875 883
876 /* Check the stage-2 fault is trans. fault or write fault */ 884 /* Check the stage-2 fault is trans. fault or write fault */
877 fault_status = kvm_vcpu_trap_get_fault(vcpu); 885 fault_status = kvm_vcpu_trap_get_fault_type(vcpu);
878 if (fault_status != FSC_FAULT && fault_status != FSC_PERM) { 886 if (fault_status != FSC_FAULT && fault_status != FSC_PERM) {
879 kvm_err("Unsupported fault status: EC=%#x DFCS=%#lx\n", 887 kvm_err("Unsupported FSC: EC=%#x xFSC=%#lx ESR_EL2=%#lx\n",
880 kvm_vcpu_trap_get_class(vcpu), fault_status); 888 kvm_vcpu_trap_get_class(vcpu),
889 (unsigned long)kvm_vcpu_trap_get_fault(vcpu),
890 (unsigned long)kvm_vcpu_get_hsr(vcpu));
881 return -EFAULT; 891 return -EFAULT;
882 } 892 }
883 893
884 idx = srcu_read_lock(&vcpu->kvm->srcu); 894 idx = srcu_read_lock(&vcpu->kvm->srcu);
885 895
886 gfn = fault_ipa >> PAGE_SHIFT; 896 gfn = fault_ipa >> PAGE_SHIFT;
887 if (!kvm_is_visible_gfn(vcpu->kvm, gfn)) { 897 memslot = gfn_to_memslot(vcpu->kvm, gfn);
898 hva = gfn_to_hva_memslot_prot(memslot, gfn, &writable);
899 write_fault = kvm_is_write_fault(vcpu);
900 if (kvm_is_error_hva(hva) || (write_fault && !writable)) {
888 if (is_iabt) { 901 if (is_iabt) {
889 /* Prefetch Abort on I/O address */ 902 /* Prefetch Abort on I/O address */
890 kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu)); 903 kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu));
@@ -892,13 +905,6 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
892 goto out_unlock; 905 goto out_unlock;
893 } 906 }
894 907
895 if (fault_status != FSC_FAULT) {
896 kvm_err("Unsupported fault status on io memory: %#lx\n",
897 fault_status);
898 ret = -EFAULT;
899 goto out_unlock;
900 }
901
902 /* 908 /*
903 * The IPA is reported as [MAX:12], so we need to 909 * The IPA is reported as [MAX:12], so we need to
904 * complement it with the bottom 12 bits from the 910 * complement it with the bottom 12 bits from the
@@ -910,9 +916,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
910 goto out_unlock; 916 goto out_unlock;
911 } 917 }
912 918
913 memslot = gfn_to_memslot(vcpu->kvm, gfn); 919 ret = user_mem_abort(vcpu, fault_ipa, memslot, hva, fault_status);
914
915 ret = user_mem_abort(vcpu, fault_ipa, memslot, fault_status);
916 if (ret == 0) 920 if (ret == 0)
917 ret = 1; 921 ret = 1;
918out_unlock: 922out_unlock:
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
index 938600098b88..8ecfd15c3a02 100644
--- a/arch/arm/lib/getuser.S
+++ b/arch/arm/lib/getuser.S
@@ -80,7 +80,7 @@ ENTRY(__get_user_8)
80ENDPROC(__get_user_8) 80ENDPROC(__get_user_8)
81 81
82#ifdef __ARMEB__ 82#ifdef __ARMEB__
83ENTRY(__get_user_lo8) 83ENTRY(__get_user_32t_8)
84 check_uaccess r0, 8, r1, r2, __get_user_bad 84 check_uaccess r0, 8, r1, r2, __get_user_bad
85#ifdef CONFIG_CPU_USE_DOMAINS 85#ifdef CONFIG_CPU_USE_DOMAINS
86 add r0, r0, #4 86 add r0, r0, #4
@@ -90,7 +90,37 @@ ENTRY(__get_user_lo8)
90#endif 90#endif
91 mov r0, #0 91 mov r0, #0
92 ret lr 92 ret lr
93ENDPROC(__get_user_lo8) 93ENDPROC(__get_user_32t_8)
94
95ENTRY(__get_user_64t_1)
96 check_uaccess r0, 1, r1, r2, __get_user_bad8
978: TUSER(ldrb) r3, [r0]
98 mov r0, #0
99 ret lr
100ENDPROC(__get_user_64t_1)
101
102ENTRY(__get_user_64t_2)
103 check_uaccess r0, 2, r1, r2, __get_user_bad8
104#ifdef CONFIG_CPU_USE_DOMAINS
105rb .req ip
1069: ldrbt r3, [r0], #1
10710: ldrbt rb, [r0], #0
108#else
109rb .req r0
1109: ldrb r3, [r0]
11110: ldrb rb, [r0, #1]
112#endif
113 orr r3, rb, r3, lsl #8
114 mov r0, #0
115 ret lr
116ENDPROC(__get_user_64t_2)
117
118ENTRY(__get_user_64t_4)
119 check_uaccess r0, 4, r1, r2, __get_user_bad8
12011: TUSER(ldr) r3, [r0]
121 mov r0, #0
122 ret lr
123ENDPROC(__get_user_64t_4)
94#endif 124#endif
95 125
96__get_user_bad8: 126__get_user_bad8:
@@ -111,5 +141,9 @@ ENDPROC(__get_user_bad8)
111 .long 6b, __get_user_bad8 141 .long 6b, __get_user_bad8
112#ifdef __ARMEB__ 142#ifdef __ARMEB__
113 .long 7b, __get_user_bad 143 .long 7b, __get_user_bad
144 .long 8b, __get_user_bad8
145 .long 9b, __get_user_bad8
146 .long 10b, __get_user_bad8
147 .long 11b, __get_user_bad8
114#endif 148#endif
115.popsection 149.popsection
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 6cc6f7aebdae..0e6d548b70d9 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -12,6 +12,9 @@ config HAVE_AT91_DBGU0
12config HAVE_AT91_DBGU1 12config HAVE_AT91_DBGU1
13 bool 13 bool
14 14
15config HAVE_AT91_DBGU2
16 bool
17
15config AT91_USE_OLD_CLK 18config AT91_USE_OLD_CLK
16 bool 19 bool
17 20
@@ -28,36 +31,33 @@ config OLD_CLK_AT91
28 bool 31 bool
29 default AT91_PMC_UNIT && AT91_USE_OLD_CLK 32 default AT91_PMC_UNIT && AT91_USE_OLD_CLK
30 33
31config AT91_SAM9_ALT_RESET 34config OLD_IRQ_AT91
32 bool 35 bool
33 default !ARCH_AT91X40 36 select MULTI_IRQ_HANDLER
34 37 select SPARSE_IRQ
35config AT91_SAM9G45_RESET
36 bool
37 default !ARCH_AT91X40
38 38
39config AT91_SAM9_TIME 39config HAVE_AT91_SMD
40 bool 40 bool
41 41
42config HAVE_AT91_SMD 42config HAVE_AT91_H32MX
43 bool 43 bool
44 44
45config SOC_AT91SAM9 45config SOC_AT91SAM9
46 bool 46 bool
47 select AT91_SAM9_TIME 47 select ATMEL_AIC_IRQ if !OLD_IRQ_AT91
48 select CPU_ARM926T 48 select CPU_ARM926T
49 select GENERIC_CLOCKEVENTS 49 select GENERIC_CLOCKEVENTS
50 select MULTI_IRQ_HANDLER 50 select MEMORY if USE_OF
51 select SPARSE_IRQ 51 select ATMEL_SDRAMC if USE_OF
52 52
53config SOC_SAMA5 53config SOC_SAMA5
54 bool 54 bool
55 select AT91_SAM9_TIME 55 select ATMEL_AIC5_IRQ
56 select CPU_V7 56 select CPU_V7
57 select GENERIC_CLOCKEVENTS 57 select GENERIC_CLOCKEVENTS
58 select MULTI_IRQ_HANDLER
59 select SPARSE_IRQ
60 select USE_OF 58 select USE_OF
59 select MEMORY
60 select ATMEL_SDRAMC
61 61
62menu "Atmel AT91 System-on-Chip" 62menu "Atmel AT91 System-on-Chip"
63 63
@@ -70,8 +70,7 @@ config ARCH_AT91X40
70 depends on !MMU 70 depends on !MMU
71 select CPU_ARM7TDMI 71 select CPU_ARM7TDMI
72 select ARCH_USES_GETTIMEOFFSET 72 select ARCH_USES_GETTIMEOFFSET
73 select MULTI_IRQ_HANDLER 73 select OLD_IRQ_AT91
74 select SPARSE_IRQ
75 74
76 help 75 help
77 Select this if you are using one of Atmel's AT91X40 SoC. 76 Select this if you are using one of Atmel's AT91X40 SoC.
@@ -103,16 +102,30 @@ config SOC_SAMA5D3
103 help 102 help
104 Select this if you are using one of Atmel's SAMA5D3 family SoC. 103 Select this if you are using one of Atmel's SAMA5D3 family SoC.
105 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36. 104 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36.
105
106config SOC_SAMA5D4
107 bool "SAMA5D4 family"
108 select SOC_SAMA5
109 select HAVE_AT91_DBGU2
110 select CLKSRC_MMIO
111 select CACHE_L2X0
112 select CACHE_PL310
113 select HAVE_FB_ATMEL
114 select HAVE_AT91_UTMI
115 select HAVE_AT91_SMD
116 select HAVE_AT91_USB_CLK
117 select HAVE_AT91_H32MX
118 help
119 Select this if you are using one of Atmel's SAMA5D4 family SoC.
106endif 120endif
107 121
108if SOC_SAM_V4_V5 122if SOC_SAM_V4_V5
109config SOC_AT91RM9200 123config SOC_AT91RM9200
110 bool "AT91RM9200" 124 bool "AT91RM9200"
125 select ATMEL_AIC_IRQ if !OLD_IRQ_AT91
111 select CPU_ARM920T 126 select CPU_ARM920T
112 select GENERIC_CLOCKEVENTS 127 select GENERIC_CLOCKEVENTS
113 select HAVE_AT91_DBGU0 128 select HAVE_AT91_DBGU0
114 select MULTI_IRQ_HANDLER
115 select SPARSE_IRQ
116 select HAVE_AT91_USB_CLK 129 select HAVE_AT91_USB_CLK
117 130
118config SOC_AT91SAM9260 131config SOC_AT91SAM9260
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt
index 44ace320d2e1..d8e88219edb4 100644
--- a/arch/arm/mach-at91/Kconfig.non_dt
+++ b/arch/arm/mach-at91/Kconfig.non_dt
@@ -14,31 +14,37 @@ config ARCH_AT91RM9200
14 bool "AT91RM9200" 14 bool "AT91RM9200"
15 select SOC_AT91RM9200 15 select SOC_AT91RM9200
16 select AT91_USE_OLD_CLK 16 select AT91_USE_OLD_CLK
17 select OLD_IRQ_AT91
17 18
18config ARCH_AT91SAM9260 19config ARCH_AT91SAM9260
19 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20" 20 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20"
20 select SOC_AT91SAM9260 21 select SOC_AT91SAM9260
21 select AT91_USE_OLD_CLK 22 select AT91_USE_OLD_CLK
23 select OLD_IRQ_AT91
22 24
23config ARCH_AT91SAM9261 25config ARCH_AT91SAM9261
24 bool "AT91SAM9261 or AT91SAM9G10" 26 bool "AT91SAM9261 or AT91SAM9G10"
25 select SOC_AT91SAM9261 27 select SOC_AT91SAM9261
26 select AT91_USE_OLD_CLK 28 select AT91_USE_OLD_CLK
29 select OLD_IRQ_AT91
27 30
28config ARCH_AT91SAM9263 31config ARCH_AT91SAM9263
29 bool "AT91SAM9263" 32 bool "AT91SAM9263"
30 select SOC_AT91SAM9263 33 select SOC_AT91SAM9263
31 select AT91_USE_OLD_CLK 34 select AT91_USE_OLD_CLK
35 select OLD_IRQ_AT91
32 36
33config ARCH_AT91SAM9RL 37config ARCH_AT91SAM9RL
34 bool "AT91SAM9RL" 38 bool "AT91SAM9RL"
35 select SOC_AT91SAM9RL 39 select SOC_AT91SAM9RL
36 select AT91_USE_OLD_CLK 40 select AT91_USE_OLD_CLK
41 select OLD_IRQ_AT91
37 42
38config ARCH_AT91SAM9G45 43config ARCH_AT91SAM9G45
39 bool "AT91SAM9G45" 44 bool "AT91SAM9G45"
40 select SOC_AT91SAM9G45 45 select SOC_AT91SAM9G45
41 select AT91_USE_OLD_CLK 46 select AT91_USE_OLD_CLK
47 select OLD_IRQ_AT91
42 48
43endchoice 49endchoice
44 50
@@ -132,12 +138,6 @@ config MACH_ECO920
132 bool "eco920" 138 bool "eco920"
133 help 139 help
134 Select this if you are using the eco920 board 140 Select this if you are using the eco920 board
135
136config MACH_RSI_EWS
137 bool "RSI Embedded Webserver"
138 depends on ARCH_AT91RM9200
139 help
140 Select this if you are using RSIs EWS board.
141endif 141endif
142 142
143# ---------------------------------------------------------- 143# ----------------------------------------------------------
@@ -212,12 +212,6 @@ config MACH_CPU9G20
212 Select this if you are using a Eukrea Electromatique's 212 Select this if you are using a Eukrea Electromatique's
213 CPU9G20 Board <http://www.eukrea.com/> 213 CPU9G20 Board <http://www.eukrea.com/>
214 214
215config MACH_ACMENETUSFOXG20
216 bool "Acme Systems srl FOX Board G20"
217 help
218 Select this if you are using Acme Systems
219 FOX Board G20 <http://www.acmesystems.it>
220
221config MACH_PORTUXG20 215config MACH_PORTUXG20
222 bool "taskit PortuxG20" 216 bool "taskit PortuxG20"
223 help 217 help
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 78e9cec282f4..ac99d87ffefe 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -2,15 +2,13 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := irq.o gpio.o setup.o sysirq_mask.o 5obj-y := gpio.o setup.o sysirq_mask.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
9 9
10obj-$(CONFIG_OLD_IRQ_AT91) += irq.o
10obj-$(CONFIG_OLD_CLK_AT91) += clock.o 11obj-$(CONFIG_OLD_CLK_AT91) += clock.o
11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o
13obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o
14obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o 12obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o
15 13
16# CPU-specific support 14# CPU-specific support
@@ -23,6 +21,7 @@ obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o
23obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o 21obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o
24obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o 22obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o
25obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o 23obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
24obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
26 25
27obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o 26obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o
28obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o 27obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o
@@ -46,7 +45,6 @@ obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o
46obj-$(CONFIG_MACH_YL9200) += board-yl-9200.o 45obj-$(CONFIG_MACH_YL9200) += board-yl-9200.o
47obj-$(CONFIG_MACH_CPUAT91) += board-cpuat91.o 46obj-$(CONFIG_MACH_CPUAT91) += board-cpuat91.o
48obj-$(CONFIG_MACH_ECO920) += board-eco920.o 47obj-$(CONFIG_MACH_ECO920) += board-eco920.o
49obj-$(CONFIG_MACH_RSI_EWS) += board-rsi-ews.o
50 48
51# AT91SAM9260 board-specific support 49# AT91SAM9260 board-specific support
52obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 50obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
@@ -69,7 +67,6 @@ obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
69# AT91SAM9G20 board-specific support 67# AT91SAM9G20 board-specific support
70obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o 68obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
71obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o 69obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o
72obj-$(CONFIG_MACH_ACMENETUSFOXG20) += board-foxg20.o
73obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o 70obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
74obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o 71obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
75obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o 72obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o
diff --git a/arch/arm/mach-at91/at91_rstc.h b/arch/arm/mach-at91/at91_rstc.h
deleted file mode 100644
index a600e6992920..000000000000
--- a/arch/arm/mach-at91/at91_rstc.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_rstc.h
3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
7 * Reset Controller (RSTC) - System peripherals regsters.
8 * Based on AT91SAM9261 datasheet revision D.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_RSTC_H
17#define AT91_RSTC_H
18
19#ifndef __ASSEMBLY__
20extern void __iomem *at91_rstc_base;
21
22#define at91_rstc_read(field) \
23 __raw_readl(at91_rstc_base + field)
24
25#define at91_rstc_write(field, value) \
26 __raw_writel(value, at91_rstc_base + field)
27#else
28.extern at91_rstc_base
29#endif
30
31#define AT91_RSTC_CR 0x00 /* Reset Controller Control Register */
32#define AT91_RSTC_PROCRST (1 << 0) /* Processor Reset */
33#define AT91_RSTC_PERRST (1 << 2) /* Peripheral Reset */
34#define AT91_RSTC_EXTRST (1 << 3) /* External Reset */
35#define AT91_RSTC_KEY (0xa5 << 24) /* KEY Password */
36
37#define AT91_RSTC_SR 0x04 /* Reset Controller Status Register */
38#define AT91_RSTC_URSTS (1 << 0) /* User Reset Status */
39#define AT91_RSTC_RSTTYP (7 << 8) /* Reset Type */
40#define AT91_RSTC_RSTTYP_GENERAL (0 << 8)
41#define AT91_RSTC_RSTTYP_WAKEUP (1 << 8)
42#define AT91_RSTC_RSTTYP_WATCHDOG (2 << 8)
43#define AT91_RSTC_RSTTYP_SOFTWARE (3 << 8)
44#define AT91_RSTC_RSTTYP_USER (4 << 8)
45#define AT91_RSTC_NRSTL (1 << 16) /* NRST Pin Level */
46#define AT91_RSTC_SRCMP (1 << 17) /* Software Reset Command in Progress */
47
48#define AT91_RSTC_MR 0x08 /* Reset Controller Mode Register */
49#define AT91_RSTC_URSTEN (1 << 0) /* User Reset Enable */
50#define AT91_RSTC_URSTIEN (1 << 4) /* User Reset Interrupt Enable */
51#define AT91_RSTC_ERSTL (0xf << 8) /* External Reset Length */
52
53#endif
diff --git a/arch/arm/mach-at91/at91_shdwc.h b/arch/arm/mach-at91/at91_shdwc.h
deleted file mode 100644
index 9e29f31ec9a6..000000000000
--- a/arch/arm/mach-at91/at91_shdwc.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_shdwc.h
3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
7 * Shutdown Controller (SHDWC) - System peripherals regsters.
8 * Based on AT91SAM9261 datasheet revision D.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_SHDWC_H
17#define AT91_SHDWC_H
18
19#ifndef __ASSEMBLY__
20extern void __iomem *at91_shdwc_base;
21
22#define at91_shdwc_read(field) \
23 __raw_readl(at91_shdwc_base + field)
24
25#define at91_shdwc_write(field, value) \
26 __raw_writel(value, at91_shdwc_base + field)
27#endif
28
29#define AT91_SHDW_CR 0x00 /* Shut Down Control Register */
30#define AT91_SHDW_SHDW (1 << 0) /* Shut Down command */
31#define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */
32
33#define AT91_SHDW_MR 0x04 /* Shut Down Mode Register */
34#define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */
35#define AT91_SHDW_WKMODE0_NONE 0
36#define AT91_SHDW_WKMODE0_HIGH 1
37#define AT91_SHDW_WKMODE0_LOW 2
38#define AT91_SHDW_WKMODE0_ANYLEVEL 3
39#define AT91_SHDW_CPTWK0_MAX 0xf /* Maximum Counter On Wake Up 0 */
40#define AT91_SHDW_CPTWK0 (AT91_SHDW_CPTWK0_MAX << 4) /* Counter On Wake Up 0 */
41#define AT91_SHDW_CPTWK0_(x) ((x) << 4)
42#define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */
43#define AT91_SHDW_RTCWKEN (1 << 17) /* Real Time Clock Wake-up Enable */
44
45#define AT91_SHDW_SR 0x08 /* Shut Down Status Register */
46#define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */
47#define AT91_SHDW_RTTWK (1 << 16) /* Real-time Timer Wake-up */
48#define AT91_SHDW_RTCWK (1 << 17) /* Real-time Clock Wake-up [SAM9RL] */
49
50#endif
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 3477ba94c4c5..aab1f969a7c3 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h>
14#include <linux/clk/at91_pmc.h> 15#include <linux/clk/at91_pmc.h>
15 16
16#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
@@ -24,7 +25,6 @@
24#include <mach/hardware.h> 25#include <mach/hardware.h>
25 26
26#include "at91_aic.h" 27#include "at91_aic.h"
27#include "at91_rstc.h"
28#include "soc.h" 28#include "soc.h"
29#include "generic.h" 29#include "generic.h"
30#include "sam9_smc.h" 30#include "sam9_smc.h"
@@ -342,8 +342,6 @@ static void __init at91sam9260_map_io(void)
342 342
343static void __init at91sam9260_ioremap_registers(void) 343static void __init at91sam9260_ioremap_registers(void)
344{ 344{
345 at91_ioremap_shdwc(AT91SAM9260_BASE_SHDWC);
346 at91_ioremap_rstc(AT91SAM9260_BASE_RSTC);
347 at91_ioremap_ramc(0, AT91SAM9260_BASE_SDRAMC, 512); 345 at91_ioremap_ramc(0, AT91SAM9260_BASE_SDRAMC, 512);
348 at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT); 346 at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT);
349 at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC); 347 at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC);
@@ -354,7 +352,6 @@ static void __init at91sam9260_ioremap_registers(void)
354static void __init at91sam9260_initialize(void) 352static void __init at91sam9260_initialize(void)
355{ 353{
356 arm_pm_idle = at91sam9_idle; 354 arm_pm_idle = at91sam9_idle;
357 arm_pm_restart = at91sam9_alt_restart;
358 355
359 at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT); 356 at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT);
360 357
@@ -362,6 +359,45 @@ static void __init at91sam9260_initialize(void)
362 at91_gpio_init(at91sam9260_gpio, 3); 359 at91_gpio_init(at91sam9260_gpio, 3);
363} 360}
364 361
362static struct resource rstc_resources[] = {
363 [0] = {
364 .start = AT91SAM9260_BASE_RSTC,
365 .end = AT91SAM9260_BASE_RSTC + SZ_16 - 1,
366 .flags = IORESOURCE_MEM,
367 },
368 [1] = {
369 .start = AT91SAM9260_BASE_SDRAMC,
370 .end = AT91SAM9260_BASE_SDRAMC + SZ_512 - 1,
371 .flags = IORESOURCE_MEM,
372 },
373};
374
375static struct platform_device rstc_device = {
376 .name = "at91-sam9260-reset",
377 .resource = rstc_resources,
378 .num_resources = ARRAY_SIZE(rstc_resources),
379};
380
381static struct resource shdwc_resources[] = {
382 [0] = {
383 .start = AT91SAM9260_BASE_SHDWC,
384 .end = AT91SAM9260_BASE_SHDWC + SZ_16 - 1,
385 .flags = IORESOURCE_MEM,
386 },
387};
388
389static struct platform_device shdwc_device = {
390 .name = "at91-poweroff",
391 .resource = shdwc_resources,
392 .num_resources = ARRAY_SIZE(shdwc_resources),
393};
394
395static void __init at91sam9260_register_devices(void)
396{
397 platform_device_register(&rstc_device);
398 platform_device_register(&shdwc_device);
399}
400
365/* -------------------------------------------------------------------- 401/* --------------------------------------------------------------------
366 * Interrupt initialization 402 * Interrupt initialization
367 * -------------------------------------------------------------------- */ 403 * -------------------------------------------------------------------- */
@@ -404,6 +440,11 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
404 0, /* Advanced Interrupt Controller */ 440 0, /* Advanced Interrupt Controller */
405}; 441};
406 442
443static void __init at91sam9260_init_time(void)
444{
445 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
446}
447
407AT91_SOC_START(at91sam9260) 448AT91_SOC_START(at91sam9260)
408 .map_io = at91sam9260_map_io, 449 .map_io = at91sam9260_map_io,
409 .default_irq_priority = at91sam9260_default_irq_priority, 450 .default_irq_priority = at91sam9260_default_irq_priority,
@@ -411,5 +452,7 @@ AT91_SOC_START(at91sam9260)
411 | (1 << AT91SAM9260_ID_IRQ2), 452 | (1 << AT91SAM9260_ID_IRQ2),
412 .ioremap_registers = at91sam9260_ioremap_registers, 453 .ioremap_registers = at91sam9260_ioremap_registers,
413 .register_clocks = at91sam9260_register_clocks, 454 .register_clocks = at91sam9260_register_clocks,
455 .register_devices = at91sam9260_register_devices,
414 .init = at91sam9260_initialize, 456 .init = at91sam9260_initialize,
457 .init_time = at91sam9260_init_time,
415AT91_SOC_END 458AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index fb164a5d04a9..a8bd35963332 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h>
14#include <linux/clk/at91_pmc.h> 15#include <linux/clk/at91_pmc.h>
15 16
16#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
@@ -23,7 +24,6 @@
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24 25
25#include "at91_aic.h" 26#include "at91_aic.h"
26#include "at91_rstc.h"
27#include "soc.h" 27#include "soc.h"
28#include "generic.h" 28#include "generic.h"
29#include "sam9_smc.h" 29#include "sam9_smc.h"
@@ -301,8 +301,6 @@ static void __init at91sam9261_map_io(void)
301 301
302static void __init at91sam9261_ioremap_registers(void) 302static void __init at91sam9261_ioremap_registers(void)
303{ 303{
304 at91_ioremap_shdwc(AT91SAM9261_BASE_SHDWC);
305 at91_ioremap_rstc(AT91SAM9261_BASE_RSTC);
306 at91_ioremap_ramc(0, AT91SAM9261_BASE_SDRAMC, 512); 304 at91_ioremap_ramc(0, AT91SAM9261_BASE_SDRAMC, 512);
307 at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT); 305 at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT);
308 at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC); 306 at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC);
@@ -313,7 +311,6 @@ static void __init at91sam9261_ioremap_registers(void)
313static void __init at91sam9261_initialize(void) 311static void __init at91sam9261_initialize(void)
314{ 312{
315 arm_pm_idle = at91sam9_idle; 313 arm_pm_idle = at91sam9_idle;
316 arm_pm_restart = at91sam9_alt_restart;
317 314
318 at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT); 315 at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT);
319 316
@@ -321,6 +318,45 @@ static void __init at91sam9261_initialize(void)
321 at91_gpio_init(at91sam9261_gpio, 3); 318 at91_gpio_init(at91sam9261_gpio, 3);
322} 319}
323 320
321static struct resource rstc_resources[] = {
322 [0] = {
323 .start = AT91SAM9261_BASE_RSTC,
324 .end = AT91SAM9261_BASE_RSTC + SZ_16 - 1,
325 .flags = IORESOURCE_MEM,
326 },
327 [1] = {
328 .start = AT91SAM9261_BASE_SDRAMC,
329 .end = AT91SAM9261_BASE_SDRAMC + SZ_512 - 1,
330 .flags = IORESOURCE_MEM,
331 },
332};
333
334static struct platform_device rstc_device = {
335 .name = "at91-sam9260-reset",
336 .resource = rstc_resources,
337 .num_resources = ARRAY_SIZE(rstc_resources),
338};
339
340static struct resource shdwc_resources[] = {
341 [0] = {
342 .start = AT91SAM9261_BASE_SHDWC,
343 .end = AT91SAM9261_BASE_SHDWC + SZ_16 - 1,
344 .flags = IORESOURCE_MEM,
345 },
346};
347
348static struct platform_device shdwc_device = {
349 .name = "at91-poweroff",
350 .resource = shdwc_resources,
351 .num_resources = ARRAY_SIZE(shdwc_resources),
352};
353
354static void __init at91sam9261_register_devices(void)
355{
356 platform_device_register(&rstc_device);
357 platform_device_register(&shdwc_device);
358}
359
324/* -------------------------------------------------------------------- 360/* --------------------------------------------------------------------
325 * Interrupt initialization 361 * Interrupt initialization
326 * -------------------------------------------------------------------- */ 362 * -------------------------------------------------------------------- */
@@ -363,6 +399,11 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
363 0, /* Advanced Interrupt Controller */ 399 0, /* Advanced Interrupt Controller */
364}; 400};
365 401
402static void __init at91sam9261_init_time(void)
403{
404 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
405}
406
366AT91_SOC_START(at91sam9261) 407AT91_SOC_START(at91sam9261)
367 .map_io = at91sam9261_map_io, 408 .map_io = at91sam9261_map_io,
368 .default_irq_priority = at91sam9261_default_irq_priority, 409 .default_irq_priority = at91sam9261_default_irq_priority,
@@ -370,5 +411,7 @@ AT91_SOC_START(at91sam9261)
370 | (1 << AT91SAM9261_ID_IRQ2), 411 | (1 << AT91SAM9261_ID_IRQ2),
371 .ioremap_registers = at91sam9261_ioremap_registers, 412 .ioremap_registers = at91sam9261_ioremap_registers,
372 .register_clocks = at91sam9261_register_clocks, 413 .register_clocks = at91sam9261_register_clocks,
414 .register_devices = at91sam9261_register_devices,
373 .init = at91sam9261_initialize, 415 .init = at91sam9261_initialize,
416 .init_time = at91sam9261_init_time,
374AT91_SOC_END 417AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 810fa5f15a51..fbff228cc63e 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h>
14#include <linux/clk/at91_pmc.h> 15#include <linux/clk/at91_pmc.h>
15 16
16#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
@@ -22,7 +23,6 @@
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23 24
24#include "at91_aic.h" 25#include "at91_aic.h"
25#include "at91_rstc.h"
26#include "soc.h" 26#include "soc.h"
27#include "generic.h" 27#include "generic.h"
28#include "sam9_smc.h" 28#include "sam9_smc.h"
@@ -321,8 +321,6 @@ static void __init at91sam9263_map_io(void)
321 321
322static void __init at91sam9263_ioremap_registers(void) 322static void __init at91sam9263_ioremap_registers(void)
323{ 323{
324 at91_ioremap_shdwc(AT91SAM9263_BASE_SHDWC);
325 at91_ioremap_rstc(AT91SAM9263_BASE_RSTC);
326 at91_ioremap_ramc(0, AT91SAM9263_BASE_SDRAMC0, 512); 324 at91_ioremap_ramc(0, AT91SAM9263_BASE_SDRAMC0, 512);
327 at91_ioremap_ramc(1, AT91SAM9263_BASE_SDRAMC1, 512); 325 at91_ioremap_ramc(1, AT91SAM9263_BASE_SDRAMC1, 512);
328 at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT); 326 at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT);
@@ -335,7 +333,6 @@ static void __init at91sam9263_ioremap_registers(void)
335static void __init at91sam9263_initialize(void) 333static void __init at91sam9263_initialize(void)
336{ 334{
337 arm_pm_idle = at91sam9_idle; 335 arm_pm_idle = at91sam9_idle;
338 arm_pm_restart = at91sam9_alt_restart;
339 336
340 at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0); 337 at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0);
341 at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1); 338 at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1);
@@ -344,6 +341,45 @@ static void __init at91sam9263_initialize(void)
344 at91_gpio_init(at91sam9263_gpio, 5); 341 at91_gpio_init(at91sam9263_gpio, 5);
345} 342}
346 343
344static struct resource rstc_resources[] = {
345 [0] = {
346 .start = AT91SAM9263_BASE_RSTC,
347 .end = AT91SAM9263_BASE_RSTC + SZ_16 - 1,
348 .flags = IORESOURCE_MEM,
349 },
350 [1] = {
351 .start = AT91SAM9263_BASE_SDRAMC0,
352 .end = AT91SAM9263_BASE_SDRAMC0 + SZ_512 - 1,
353 .flags = IORESOURCE_MEM,
354 },
355};
356
357static struct platform_device rstc_device = {
358 .name = "at91-sam9260-reset",
359 .resource = rstc_resources,
360 .num_resources = ARRAY_SIZE(rstc_resources),
361};
362
363static struct resource shdwc_resources[] = {
364 [0] = {
365 .start = AT91SAM9263_BASE_SHDWC,
366 .end = AT91SAM9263_BASE_SHDWC + SZ_16 - 1,
367 .flags = IORESOURCE_MEM,
368 },
369};
370
371static struct platform_device shdwc_device = {
372 .name = "at91-poweroff",
373 .resource = shdwc_resources,
374 .num_resources = ARRAY_SIZE(shdwc_resources),
375};
376
377static void __init at91sam9263_register_devices(void)
378{
379 platform_device_register(&rstc_device);
380 platform_device_register(&shdwc_device);
381}
382
347/* -------------------------------------------------------------------- 383/* --------------------------------------------------------------------
348 * Interrupt initialization 384 * Interrupt initialization
349 * -------------------------------------------------------------------- */ 385 * -------------------------------------------------------------------- */
@@ -386,11 +422,18 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
386 0, /* Advanced Interrupt Controller (IRQ1) */ 422 0, /* Advanced Interrupt Controller (IRQ1) */
387}; 423};
388 424
425static void __init at91sam9263_init_time(void)
426{
427 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
428}
429
389AT91_SOC_START(at91sam9263) 430AT91_SOC_START(at91sam9263)
390 .map_io = at91sam9263_map_io, 431 .map_io = at91sam9263_map_io,
391 .default_irq_priority = at91sam9263_default_irq_priority, 432 .default_irq_priority = at91sam9263_default_irq_priority,
392 .extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1), 433 .extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1),
393 .ioremap_registers = at91sam9263_ioremap_registers, 434 .ioremap_registers = at91sam9263_ioremap_registers,
394 .register_clocks = at91sam9263_register_clocks, 435 .register_clocks = at91sam9263_register_clocks,
436 .register_devices = at91sam9263_register_devices,
395 .init = at91sam9263_initialize, 437 .init = at91sam9263_initialize,
438 .init_time = at91sam9263_init_time,
396AT91_SOC_END 439AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
deleted file mode 100644
index 0a9e2fc8f796..000000000000
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ /dev/null
@@ -1,294 +0,0 @@
1/*
2 * at91sam926x_time.c - Periodic Interval Timer (PIT) for at91sam926x
3 *
4 * Copyright (C) 2005-2006 M. Amine SAYA, ATMEL Rousset, France
5 * Revision 2005 M. Nicolas Diremdjian, ATMEL Rousset, France
6 * Converted to ClockSource/ClockEvents by David Brownell.
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/interrupt.h>
13#include <linux/irq.h>
14#include <linux/kernel.h>
15#include <linux/clk.h>
16#include <linux/clockchips.h>
17#include <linux/of.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
20
21#include <asm/mach/time.h>
22#include <mach/hardware.h>
23
24#define AT91_PIT_MR 0x00 /* Mode Register */
25#define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */
26#define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */
27#define AT91_PIT_PIV (0xfffff) /* Periodic Interval Value */
28
29#define AT91_PIT_SR 0x04 /* Status Register */
30#define AT91_PIT_PITS (1 << 0) /* Timer Status */
31
32#define AT91_PIT_PIVR 0x08 /* Periodic Interval Value Register */
33#define AT91_PIT_PIIR 0x0c /* Periodic Interval Image Register */
34#define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */
35#define AT91_PIT_CPIV (0xfffff) /* Inverval Value */
36
37#define PIT_CPIV(x) ((x) & AT91_PIT_CPIV)
38#define PIT_PICNT(x) (((x) & AT91_PIT_PICNT) >> 20)
39
40static u32 pit_cycle; /* write-once */
41static u32 pit_cnt; /* access only w/system irq blocked */
42static void __iomem *pit_base_addr __read_mostly;
43static struct clk *mck;
44
45static inline unsigned int pit_read(unsigned int reg_offset)
46{
47 return __raw_readl(pit_base_addr + reg_offset);
48}
49
50static inline void pit_write(unsigned int reg_offset, unsigned long value)
51{
52 __raw_writel(value, pit_base_addr + reg_offset);
53}
54
55/*
56 * Clocksource: just a monotonic counter of MCK/16 cycles.
57 * We don't care whether or not PIT irqs are enabled.
58 */
59static cycle_t read_pit_clk(struct clocksource *cs)
60{
61 unsigned long flags;
62 u32 elapsed;
63 u32 t;
64
65 raw_local_irq_save(flags);
66 elapsed = pit_cnt;
67 t = pit_read(AT91_PIT_PIIR);
68 raw_local_irq_restore(flags);
69
70 elapsed += PIT_PICNT(t) * pit_cycle;
71 elapsed += PIT_CPIV(t);
72 return elapsed;
73}
74
75static struct clocksource pit_clk = {
76 .name = "pit",
77 .rating = 175,
78 .read = read_pit_clk,
79 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
80};
81
82
83/*
84 * Clockevent device: interrupts every 1/HZ (== pit_cycles * MCK/16)
85 */
86static void
87pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
88{
89 switch (mode) {
90 case CLOCK_EVT_MODE_PERIODIC:
91 /* update clocksource counter */
92 pit_cnt += pit_cycle * PIT_PICNT(pit_read(AT91_PIT_PIVR));
93 pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN
94 | AT91_PIT_PITIEN);
95 break;
96 case CLOCK_EVT_MODE_ONESHOT:
97 BUG();
98 /* FALLTHROUGH */
99 case CLOCK_EVT_MODE_SHUTDOWN:
100 case CLOCK_EVT_MODE_UNUSED:
101 /* disable irq, leaving the clocksource active */
102 pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
103 break;
104 case CLOCK_EVT_MODE_RESUME:
105 break;
106 }
107}
108
109static void at91sam926x_pit_suspend(struct clock_event_device *cedev)
110{
111 /* Disable timer */
112 pit_write(AT91_PIT_MR, 0);
113}
114
115static void at91sam926x_pit_reset(void)
116{
117 /* Disable timer and irqs */
118 pit_write(AT91_PIT_MR, 0);
119
120 /* Clear any pending interrupts, wait for PIT to stop counting */
121 while (PIT_CPIV(pit_read(AT91_PIT_PIVR)) != 0)
122 cpu_relax();
123
124 /* Start PIT but don't enable IRQ */
125 pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
126}
127
128static void at91sam926x_pit_resume(struct clock_event_device *cedev)
129{
130 at91sam926x_pit_reset();
131}
132
133static struct clock_event_device pit_clkevt = {
134 .name = "pit",
135 .features = CLOCK_EVT_FEAT_PERIODIC,
136 .shift = 32,
137 .rating = 100,
138 .set_mode = pit_clkevt_mode,
139 .suspend = at91sam926x_pit_suspend,
140 .resume = at91sam926x_pit_resume,
141};
142
143
144/*
145 * IRQ handler for the timer.
146 */
147static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
148{
149 /*
150 * irqs should be disabled here, but as the irq is shared they are only
151 * guaranteed to be off if the timer irq is registered first.
152 */
153 WARN_ON_ONCE(!irqs_disabled());
154
155 /* The PIT interrupt may be disabled, and is shared */
156 if ((pit_clkevt.mode == CLOCK_EVT_MODE_PERIODIC)
157 && (pit_read(AT91_PIT_SR) & AT91_PIT_PITS)) {
158 unsigned nr_ticks;
159
160 /* Get number of ticks performed before irq, and ack it */
161 nr_ticks = PIT_PICNT(pit_read(AT91_PIT_PIVR));
162 do {
163 pit_cnt += pit_cycle;
164 pit_clkevt.event_handler(&pit_clkevt);
165 nr_ticks--;
166 } while (nr_ticks);
167
168 return IRQ_HANDLED;
169 }
170
171 return IRQ_NONE;
172}
173
174static struct irqaction at91sam926x_pit_irq = {
175 .name = "at91_tick",
176 .flags = IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
177 .handler = at91sam926x_pit_interrupt,
178 .irq = NR_IRQS_LEGACY + AT91_ID_SYS,
179};
180
181#ifdef CONFIG_OF
182static struct of_device_id pit_timer_ids[] = {
183 { .compatible = "atmel,at91sam9260-pit" },
184 { /* sentinel */ }
185};
186
187static int __init of_at91sam926x_pit_init(void)
188{
189 struct device_node *np;
190 int ret;
191
192 np = of_find_matching_node(NULL, pit_timer_ids);
193 if (!np)
194 goto err;
195
196 pit_base_addr = of_iomap(np, 0);
197 if (!pit_base_addr)
198 goto node_err;
199
200 mck = of_clk_get(np, 0);
201
202 /* Get the interrupts property */
203 ret = irq_of_parse_and_map(np, 0);
204 if (!ret) {
205 pr_crit("AT91: PIT: Unable to get IRQ from DT\n");
206 if (!IS_ERR(mck))
207 clk_put(mck);
208 goto ioremap_err;
209 }
210 at91sam926x_pit_irq.irq = ret;
211
212 of_node_put(np);
213
214 return 0;
215
216ioremap_err:
217 iounmap(pit_base_addr);
218node_err:
219 of_node_put(np);
220err:
221 return -EINVAL;
222}
223#else
224static int __init of_at91sam926x_pit_init(void)
225{
226 return -EINVAL;
227}
228#endif
229
230/*
231 * Set up both clocksource and clockevent support.
232 */
233void __init at91sam926x_pit_init(void)
234{
235 unsigned long pit_rate;
236 unsigned bits;
237 int ret;
238
239 mck = ERR_PTR(-ENOENT);
240
241 /* For device tree enabled device: initialize here */
242 of_at91sam926x_pit_init();
243
244 /*
245 * Use our actual MCK to figure out how many MCK/16 ticks per
246 * 1/HZ period (instead of a compile-time constant LATCH).
247 */
248 if (IS_ERR(mck))
249 mck = clk_get(NULL, "mck");
250
251 if (IS_ERR(mck))
252 panic("AT91: PIT: Unable to get mck clk\n");
253 pit_rate = clk_get_rate(mck) / 16;
254 pit_cycle = (pit_rate + HZ/2) / HZ;
255 WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0);
256
257 /* Initialize and enable the timer */
258 at91sam926x_pit_reset();
259
260 /*
261 * Register clocksource. The high order bits of PIV are unused,
262 * so this isn't a 32-bit counter unless we get clockevent irqs.
263 */
264 bits = 12 /* PICNT */ + ilog2(pit_cycle) /* PIV */;
265 pit_clk.mask = CLOCKSOURCE_MASK(bits);
266 clocksource_register_hz(&pit_clk, pit_rate);
267
268 /* Set up irq handler */
269 ret = setup_irq(at91sam926x_pit_irq.irq, &at91sam926x_pit_irq);
270 if (ret)
271 pr_crit("AT91: PIT: Unable to setup IRQ\n");
272
273 /* Set up and register clockevents */
274 pit_clkevt.mult = div_sc(pit_rate, NSEC_PER_SEC, pit_clkevt.shift);
275 pit_clkevt.cpumask = cpumask_of(0);
276 clockevents_register_device(&pit_clkevt);
277}
278
279void __init at91sam926x_ioremap_pit(u32 addr)
280{
281#if defined(CONFIG_OF)
282 struct device_node *np =
283 of_find_matching_node(NULL, pit_timer_ids);
284
285 if (np) {
286 of_node_put(np);
287 return;
288 }
289#endif
290 pit_base_addr = ioremap(addr, 16);
291
292 if (!pit_base_addr)
293 panic("Impossible to ioremap PIT\n");
294}
diff --git a/arch/arm/mach-at91/at91sam9_alt_reset.S b/arch/arm/mach-at91/at91sam9_alt_reset.S
deleted file mode 100644
index f039538d3bdb..000000000000
--- a/arch/arm/mach-at91/at91sam9_alt_reset.S
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * reset AT91SAM9G20 as per errata
3 *
4 * (C) BitBox Ltd 2010
5 *
6 * unless the SDRAM is cleanly shutdown before we hit the
7 * reset register it can be left driving the data bus and
8 * killing the chance of a subsequent boot from NAND
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#include <linux/linkage.h>
17#include <mach/hardware.h>
18#include <mach/at91_ramc.h>
19#include "at91_rstc.h"
20
21 .arm
22
23 .globl at91sam9_alt_restart
24
25at91sam9_alt_restart: ldr r0, =at91_ramc_base @ preload constants
26 ldr r0, [r0]
27 ldr r4, =at91_rstc_base
28 ldr r1, [r4]
29
30 mov r2, #1
31 mov r3, #AT91_SDRAMC_LPCB_POWER_DOWN
32 ldr r4, =AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST
33
34 .balign 32 @ align to cache line
35
36 str r2, [r0, #AT91_SDRAMC_TR] @ disable SDRAM access
37 str r3, [r0, #AT91_SDRAMC_LPR] @ power down SDRAM
38 str r4, [r1, #AT91_RSTC_CR] @ reset processor
39
40 b .
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 9d45496e4932..405427ec05f8 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -13,6 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/clk/at91_pmc.h> 15#include <linux/clk/at91_pmc.h>
16#include <linux/platform_device.h>
16 17
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
@@ -371,8 +372,6 @@ static void __init at91sam9g45_map_io(void)
371 372
372static void __init at91sam9g45_ioremap_registers(void) 373static void __init at91sam9g45_ioremap_registers(void)
373{ 374{
374 at91_ioremap_shdwc(AT91SAM9G45_BASE_SHDWC);
375 at91_ioremap_rstc(AT91SAM9G45_BASE_RSTC);
376 at91_ioremap_ramc(0, AT91SAM9G45_BASE_DDRSDRC1, 512); 375 at91_ioremap_ramc(0, AT91SAM9G45_BASE_DDRSDRC1, 512);
377 at91_ioremap_ramc(1, AT91SAM9G45_BASE_DDRSDRC0, 512); 376 at91_ioremap_ramc(1, AT91SAM9G45_BASE_DDRSDRC0, 512);
378 at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT); 377 at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT);
@@ -384,7 +383,6 @@ static void __init at91sam9g45_ioremap_registers(void)
384static void __init at91sam9g45_initialize(void) 383static void __init at91sam9g45_initialize(void)
385{ 384{
386 arm_pm_idle = at91sam9_idle; 385 arm_pm_idle = at91sam9_idle;
387 arm_pm_restart = at91sam9g45_restart;
388 386
389 at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC); 387 at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC);
390 at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT); 388 at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT);
@@ -393,6 +391,50 @@ static void __init at91sam9g45_initialize(void)
393 at91_gpio_init(at91sam9g45_gpio, 5); 391 at91_gpio_init(at91sam9g45_gpio, 5);
394} 392}
395 393
394static struct resource rstc_resources[] = {
395 [0] = {
396 .start = AT91SAM9G45_BASE_RSTC,
397 .end = AT91SAM9G45_BASE_RSTC + SZ_16 - 1,
398 .flags = IORESOURCE_MEM,
399 },
400 [1] = {
401 .start = AT91SAM9G45_BASE_DDRSDRC1,
402 .end = AT91SAM9G45_BASE_DDRSDRC1 + SZ_512 - 1,
403 .flags = IORESOURCE_MEM,
404 },
405 [2] = {
406 .start = AT91SAM9G45_BASE_DDRSDRC0,
407 .end = AT91SAM9G45_BASE_DDRSDRC0 + SZ_512 - 1,
408 .flags = IORESOURCE_MEM,
409 },
410};
411
412static struct platform_device rstc_device = {
413 .name = "at91-sam9g45-reset",
414 .resource = rstc_resources,
415 .num_resources = ARRAY_SIZE(rstc_resources),
416};
417
418static struct resource shdwc_resources[] = {
419 [0] = {
420 .start = AT91SAM9G45_BASE_SHDWC,
421 .end = AT91SAM9G45_BASE_SHDWC + SZ_16 - 1,
422 .flags = IORESOURCE_MEM,
423 },
424};
425
426static struct platform_device shdwc_device = {
427 .name = "at91-poweroff",
428 .resource = shdwc_resources,
429 .num_resources = ARRAY_SIZE(shdwc_resources),
430};
431
432static void __init at91sam9g45_register_devices(void)
433{
434 platform_device_register(&rstc_device);
435 platform_device_register(&shdwc_device);
436}
437
396/* -------------------------------------------------------------------- 438/* --------------------------------------------------------------------
397 * Interrupt initialization 439 * Interrupt initialization
398 * -------------------------------------------------------------------- */ 440 * -------------------------------------------------------------------- */
@@ -435,11 +477,18 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {
435 0, /* Advanced Interrupt Controller (IRQ0) */ 477 0, /* Advanced Interrupt Controller (IRQ0) */
436}; 478};
437 479
480static void __init at91sam9g45_init_time(void)
481{
482 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
483}
484
438AT91_SOC_START(at91sam9g45) 485AT91_SOC_START(at91sam9g45)
439 .map_io = at91sam9g45_map_io, 486 .map_io = at91sam9g45_map_io,
440 .default_irq_priority = at91sam9g45_default_irq_priority, 487 .default_irq_priority = at91sam9g45_default_irq_priority,
441 .extern_irq = (1 << AT91SAM9G45_ID_IRQ0), 488 .extern_irq = (1 << AT91SAM9G45_ID_IRQ0),
442 .ioremap_registers = at91sam9g45_ioremap_registers, 489 .ioremap_registers = at91sam9g45_ioremap_registers,
443 .register_clocks = at91sam9g45_register_clocks, 490 .register_clocks = at91sam9g45_register_clocks,
491 .register_devices = at91sam9g45_register_devices,
444 .init = at91sam9g45_initialize, 492 .init = at91sam9g45_initialize,
493 .init_time = at91sam9g45_init_time,
445AT91_SOC_END 494AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9g45_reset.S b/arch/arm/mach-at91/at91sam9g45_reset.S
deleted file mode 100644
index c40c1e2ef80f..000000000000
--- a/arch/arm/mach-at91/at91sam9g45_reset.S
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * reset AT91SAM9G45 as per errata
3 *
4 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcosoft.com>
5 *
6 * unless the SDRAM is cleanly shutdown before we hit the
7 * reset register it can be left driving the data bus and
8 * killing the chance of a subsequent boot from NAND
9 *
10 * GPLv2 Only
11 */
12
13#include <linux/linkage.h>
14#include <mach/hardware.h>
15#include <mach/at91_ramc.h>
16#include "at91_rstc.h"
17 .arm
18
19/*
20 * at91_ramc_base is an array void*
21 * init at NULL if only one DDR controler is present in or DT
22 */
23 .globl at91sam9g45_restart
24
25at91sam9g45_restart:
26 ldr r5, =at91_ramc_base @ preload constants
27 ldr r0, [r5]
28 ldr r5, [r5, #4] @ ddr1
29 cmp r5, #0
30 ldr r4, =at91_rstc_base
31 ldr r1, [r4]
32
33 mov r2, #1
34 mov r3, #AT91_DDRSDRC_LPCB_POWER_DOWN
35 ldr r4, =AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST
36
37 .balign 32 @ align to cache line
38
39 strne r2, [r5, #AT91_DDRSDRC_RTR] @ disable DDR1 access
40 strne r3, [r5, #AT91_DDRSDRC_LPR] @ power down DDR1
41 str r2, [r0, #AT91_DDRSDRC_RTR] @ disable DDR0 access
42 str r3, [r0, #AT91_DDRSDRC_LPR] @ power down DDR0
43 str r4, [r1, #AT91_RSTC_CR] @ reset processor
44
45 b .
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 878d5015daab..f553e4ea034b 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/platform_device.h>
13#include <linux/clk/at91_pmc.h> 14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/proc-fns.h> 16#include <asm/proc-fns.h>
@@ -23,7 +24,6 @@
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24 25
25#include "at91_aic.h" 26#include "at91_aic.h"
26#include "at91_rstc.h"
27#include "soc.h" 27#include "soc.h"
28#include "generic.h" 28#include "generic.h"
29#include "sam9_smc.h" 29#include "sam9_smc.h"
@@ -311,8 +311,6 @@ static void __init at91sam9rl_map_io(void)
311 311
312static void __init at91sam9rl_ioremap_registers(void) 312static void __init at91sam9rl_ioremap_registers(void)
313{ 313{
314 at91_ioremap_shdwc(AT91SAM9RL_BASE_SHDWC);
315 at91_ioremap_rstc(AT91SAM9RL_BASE_RSTC);
316 at91_ioremap_ramc(0, AT91SAM9RL_BASE_SDRAMC, 512); 314 at91_ioremap_ramc(0, AT91SAM9RL_BASE_SDRAMC, 512);
317 at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT); 315 at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT);
318 at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC); 316 at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC);
@@ -323,7 +321,6 @@ static void __init at91sam9rl_ioremap_registers(void)
323static void __init at91sam9rl_initialize(void) 321static void __init at91sam9rl_initialize(void)
324{ 322{
325 arm_pm_idle = at91sam9_idle; 323 arm_pm_idle = at91sam9_idle;
326 arm_pm_restart = at91sam9_alt_restart;
327 324
328 at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC); 325 at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC);
329 at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT); 326 at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT);
@@ -332,6 +329,45 @@ static void __init at91sam9rl_initialize(void)
332 at91_gpio_init(at91sam9rl_gpio, 4); 329 at91_gpio_init(at91sam9rl_gpio, 4);
333} 330}
334 331
332static struct resource rstc_resources[] = {
333 [0] = {
334 .start = AT91SAM9RL_BASE_RSTC,
335 .end = AT91SAM9RL_BASE_RSTC + SZ_16 - 1,
336 .flags = IORESOURCE_MEM,
337 },
338 [1] = {
339 .start = AT91SAM9RL_BASE_SDRAMC,
340 .end = AT91SAM9RL_BASE_SDRAMC + SZ_512 - 1,
341 .flags = IORESOURCE_MEM,
342 },
343};
344
345static struct platform_device rstc_device = {
346 .name = "at91-sam9260-reset",
347 .resource = rstc_resources,
348 .num_resources = ARRAY_SIZE(rstc_resources),
349};
350
351static struct resource shdwc_resources[] = {
352 [0] = {
353 .start = AT91SAM9RL_BASE_SHDWC,
354 .end = AT91SAM9RL_BASE_SHDWC + SZ_16 - 1,
355 .flags = IORESOURCE_MEM,
356 },
357};
358
359static struct platform_device shdwc_device = {
360 .name = "at91-poweroff",
361 .resource = shdwc_resources,
362 .num_resources = ARRAY_SIZE(shdwc_resources),
363};
364
365static void __init at91sam9rl_register_devices(void)
366{
367 platform_device_register(&rstc_device);
368 platform_device_register(&shdwc_device);
369}
370
335/* -------------------------------------------------------------------- 371/* --------------------------------------------------------------------
336 * Interrupt initialization 372 * Interrupt initialization
337 * -------------------------------------------------------------------- */ 373 * -------------------------------------------------------------------- */
@@ -374,6 +410,11 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
374 0, /* Advanced Interrupt Controller */ 410 0, /* Advanced Interrupt Controller */
375}; 411};
376 412
413static void __init at91sam9rl_init_time(void)
414{
415 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
416}
417
377AT91_SOC_START(at91sam9rl) 418AT91_SOC_START(at91sam9rl)
378 .map_io = at91sam9rl_map_io, 419 .map_io = at91sam9rl_map_io,
379 .default_irq_priority = at91sam9rl_default_irq_priority, 420 .default_irq_priority = at91sam9rl_default_irq_priority,
@@ -382,5 +423,7 @@ AT91_SOC_START(at91sam9rl)
382#if defined(CONFIG_OLD_CLK_AT91) 423#if defined(CONFIG_OLD_CLK_AT91)
383 .register_clocks = at91sam9rl_register_clocks, 424 .register_clocks = at91sam9rl_register_clocks,
384#endif 425#endif
426 .register_devices = at91sam9rl_register_devices,
385 .init = at91sam9rl_initialize, 427 .init = at91sam9rl_initialize,
428 .init_time = at91sam9rl_init_time,
386AT91_SOC_END 429AT91_SOC_END
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index 597c649170aa..e76e35ce81e7 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -167,6 +167,8 @@ static struct at91_cf_data afeb9260_cf_data = {
167 167
168static void __init afeb9260_board_init(void) 168static void __init afeb9260_board_init(void)
169{ 169{
170 at91_register_devices();
171
170 /* Serial */ 172 /* Serial */
171 /* DBGU on ttyS0. (Rx & Tx only) */ 173 /* DBGU on ttyS0. (Rx & Tx only) */
172 at91_register_uart(0, 0, 0); 174 at91_register_uart(0, 0, 0);
@@ -211,7 +213,7 @@ static void __init afeb9260_board_init(void)
211 213
212MACHINE_START(AFEB9260, "Custom afeb9260 board") 214MACHINE_START(AFEB9260, "Custom afeb9260 board")
213 /* Maintainer: Sergey Lapin <slapin@ossfans.org> */ 215 /* Maintainer: Sergey Lapin <slapin@ossfans.org> */
214 .init_time = at91sam926x_pit_init, 216 .init_time = at91_init_time,
215 .map_io = at91_map_io, 217 .map_io = at91_map_io,
216 .handle_irq = at91_aic_handle_irq, 218 .handle_irq = at91_aic_handle_irq,
217 .init_early = afeb9260_init_early, 219 .init_early = afeb9260_init_early,
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index a30502c8d379..ae827dd2d0d2 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -170,6 +170,8 @@ static void __init cam60_add_device_nand(void)
170 170
171static void __init cam60_board_init(void) 171static void __init cam60_board_init(void)
172{ 172{
173 at91_register_devices();
174
173 /* Serial */ 175 /* Serial */
174 /* DBGU on ttyS0. (Rx & Tx only) */ 176 /* DBGU on ttyS0. (Rx & Tx only) */
175 at91_register_uart(0, 0, 0); 177 at91_register_uart(0, 0, 0);
@@ -188,7 +190,7 @@ static void __init cam60_board_init(void)
188 190
189MACHINE_START(CAM60, "KwikByte CAM60") 191MACHINE_START(CAM60, "KwikByte CAM60")
190 /* Maintainer: KwikByte */ 192 /* Maintainer: KwikByte */
191 .init_time = at91sam926x_pit_init, 193 .init_time = at91_init_time,
192 .map_io = at91_map_io, 194 .map_io = at91_map_io,
193 .handle_irq = at91_aic_handle_irq, 195 .handle_irq = at91_aic_handle_irq,
194 .init_early = cam60_init_early, 196 .init_early = cam60_init_early,
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 2037f78c84e7..731c8318f4f5 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -322,6 +322,8 @@ static struct mci_platform_data __initdata cpu9krea_mci0_data = {
322 322
323static void __init cpu9krea_board_init(void) 323static void __init cpu9krea_board_init(void)
324{ 324{
325 at91_register_devices();
326
325 /* NOR */ 327 /* NOR */
326 cpu9krea_add_device_nor(); 328 cpu9krea_add_device_nor();
327 /* Serial */ 329 /* Serial */
@@ -375,7 +377,7 @@ MACHINE_START(CPUAT9260, "Eukrea CPU9260")
375MACHINE_START(CPUAT9G20, "Eukrea CPU9G20") 377MACHINE_START(CPUAT9G20, "Eukrea CPU9G20")
376#endif 378#endif
377 /* Maintainer: Eric Benard - EUKREA Electromatique */ 379 /* Maintainer: Eric Benard - EUKREA Electromatique */
378 .init_time = at91sam926x_pit_init, 380 .init_time = at91_init_time,
379 .map_io = at91_map_io, 381 .map_io = at91_map_io,
380 .handle_irq = at91_aic_handle_irq, 382 .handle_irq = at91_aic_handle_irq,
381 .init_early = cpu9krea_init_early, 383 .init_early = cpu9krea_init_early,
diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c
index 3a185faee795..226563f850b8 100644
--- a/arch/arm/mach-at91/board-dt-rm9200.c
+++ b/arch/arm/mach-at91/board-dt-rm9200.c
@@ -14,6 +14,7 @@
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_irq.h> 16#include <linux/of_irq.h>
17#include <linux/clk-provider.h>
17 18
18#include <asm/setup.h> 19#include <asm/setup.h>
19#include <asm/irq.h> 20#include <asm/irq.h>
@@ -24,15 +25,12 @@
24#include "at91_aic.h" 25#include "at91_aic.h"
25#include "generic.h" 26#include "generic.h"
26 27
27 28static void __init at91rm9200_dt_timer_init(void)
28static const struct of_device_id irq_of_match[] __initconst = {
29 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
30 { /*sentinel*/ }
31};
32
33static void __init at91rm9200_dt_init_irq(void)
34{ 29{
35 of_irq_init(irq_of_match); 30#if defined(CONFIG_COMMON_CLK)
31 of_clk_init(NULL);
32#endif
33 at91rm9200_timer_init();
36} 34}
37 35
38static const char *at91rm9200_dt_board_compat[] __initdata = { 36static const char *at91rm9200_dt_board_compat[] __initdata = {
@@ -41,10 +39,8 @@ static const char *at91rm9200_dt_board_compat[] __initdata = {
41}; 39};
42 40
43DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") 41DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
44 .init_time = at91rm9200_timer_init, 42 .init_time = at91rm9200_dt_timer_init,
45 .map_io = at91_map_io, 43 .map_io = at91_map_io,
46 .handle_irq = at91_aic_handle_irq,
47 .init_early = at91rm9200_dt_initialize, 44 .init_early = at91rm9200_dt_initialize,
48 .init_irq = at91rm9200_dt_init_irq,
49 .dt_compat = at91rm9200_dt_board_compat, 45 .dt_compat = at91rm9200_dt_board_compat,
50MACHINE_END 46MACHINE_END
diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/board-dt-sam9.c
index 575b0be66ca8..d3048ccdc41f 100644
--- a/arch/arm/mach-at91/board-dt-sam9.c
+++ b/arch/arm/mach-at91/board-dt-sam9.c
@@ -25,26 +25,6 @@
25#include "board.h" 25#include "board.h"
26#include "generic.h" 26#include "generic.h"
27 27
28
29static void __init sam9_dt_timer_init(void)
30{
31#if defined(CONFIG_COMMON_CLK)
32 of_clk_init(NULL);
33#endif
34 at91sam926x_pit_init();
35}
36
37static const struct of_device_id irq_of_match[] __initconst = {
38
39 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
40 { /*sentinel*/ }
41};
42
43static void __init at91_dt_init_irq(void)
44{
45 of_irq_init(irq_of_match);
46}
47
48static const char *at91_dt_board_compat[] __initdata = { 28static const char *at91_dt_board_compat[] __initdata = {
49 "atmel,at91sam9", 29 "atmel,at91sam9",
50 NULL 30 NULL
@@ -52,10 +32,7 @@ static const char *at91_dt_board_compat[] __initdata = {
52 32
53DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)") 33DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
54 /* Maintainer: Atmel */ 34 /* Maintainer: Atmel */
55 .init_time = sam9_dt_timer_init,
56 .map_io = at91_map_io, 35 .map_io = at91_map_io,
57 .handle_irq = at91_aic_handle_irq,
58 .init_early = at91_dt_initialize, 36 .init_early = at91_dt_initialize,
59 .init_irq = at91_dt_init_irq,
60 .dt_compat = at91_dt_board_compat, 37 .dt_compat = at91_dt_board_compat,
61MACHINE_END 38MACHINE_END
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
index 075ec0576ada..129e2917506b 100644
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -27,64 +27,34 @@
27#include "at91_aic.h" 27#include "at91_aic.h"
28#include "generic.h" 28#include "generic.h"
29 29
30static void __init sama5_dt_timer_init(void)
31{
32#if defined(CONFIG_COMMON_CLK)
33 of_clk_init(NULL);
34#endif
35 at91sam926x_pit_init();
36}
37
38static const struct of_device_id irq_of_match[] __initconst = {
39
40 { .compatible = "atmel,sama5d3-aic", .data = at91_aic5_of_init },
41 { /*sentinel*/ }
42};
43
44static void __init at91_dt_init_irq(void)
45{
46 of_irq_init(irq_of_match);
47}
48
49static int ksz9021rn_phy_fixup(struct phy_device *phy)
50{
51 int value;
52
53 /* Set delay values */
54 value = MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW | 0x8000;
55 phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
56 value = 0xF2F4;
57 phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
58 value = MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW | 0x8000;
59 phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
60 value = 0x2222;
61 phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
62
63 return 0;
64}
65
66static void __init sama5_dt_device_init(void) 30static void __init sama5_dt_device_init(void)
67{ 31{
68 if (of_machine_is_compatible("atmel,sama5d3xcm") &&
69 IS_ENABLED(CONFIG_PHYLIB))
70 phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
71 ksz9021rn_phy_fixup);
72
73 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 32 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
74} 33}
75 34
76static const char *sama5_dt_board_compat[] __initdata = { 35static const char *sama5_dt_board_compat[] __initconst = {
77 "atmel,sama5", 36 "atmel,sama5",
78 NULL 37 NULL
79}; 38};
80 39
81DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") 40DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
82 /* Maintainer: Atmel */ 41 /* Maintainer: Atmel */
83 .init_time = sama5_dt_timer_init,
84 .map_io = at91_map_io, 42 .map_io = at91_map_io,
85 .handle_irq = at91_aic5_handle_irq,
86 .init_early = at91_dt_initialize, 43 .init_early = at91_dt_initialize,
87 .init_irq = at91_dt_init_irq,
88 .init_machine = sama5_dt_device_init, 44 .init_machine = sama5_dt_device_init,
89 .dt_compat = sama5_dt_board_compat, 45 .dt_compat = sama5_dt_board_compat,
90MACHINE_END 46MACHINE_END
47
48static const char *sama5_alt_dt_board_compat[] __initconst = {
49 "atmel,sama5d4",
50 NULL
51};
52
53DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)")
54 /* Maintainer: Atmel */
55 .map_io = at91_alt_map_io,
56 .init_early = at91_dt_initialize,
57 .init_machine = sama5_dt_device_init,
58 .dt_compat = sama5_alt_dt_board_compat,
59 .l2c_aux_mask = ~0UL,
60MACHINE_END
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index 68f1ab6bd08f..a6aa4a2432f2 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -138,6 +138,8 @@ static struct gpio_led flexibity_leds[] = {
138 138
139static void __init flexibity_board_init(void) 139static void __init flexibity_board_init(void)
140{ 140{
141 at91_register_devices();
142
141 /* Serial */ 143 /* Serial */
142 /* DBGU on ttyS0. (Rx & Tx only) */ 144 /* DBGU on ttyS0. (Rx & Tx only) */
143 at91_register_uart(0, 0, 0); 145 at91_register_uart(0, 0, 0);
@@ -160,7 +162,7 @@ static void __init flexibity_board_init(void)
160 162
161MACHINE_START(FLEXIBITY, "Flexibity Connect") 163MACHINE_START(FLEXIBITY, "Flexibity Connect")
162 /* Maintainer: Maxim Osipov */ 164 /* Maintainer: Maxim Osipov */
163 .init_time = at91sam926x_pit_init, 165 .init_time = at91_init_time,
164 .map_io = at91_map_io, 166 .map_io = at91_map_io,
165 .handle_irq = at91_aic_handle_irq, 167 .handle_irq = at91_aic_handle_irq,
166 .init_early = flexibity_init_early, 168 .init_early = flexibity_init_early,
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
deleted file mode 100644
index 8b22c60bb238..000000000000
--- a/arch/arm/mach-at91/board-foxg20.c
+++ /dev/null
@@ -1,272 +0,0 @@
1/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2008 Atmel
4 * Copyright (C) 2010 Lee McLoughlin - lee@lmmrtech.com
5 * Copyright (C) 2010 Sergio Tanzilli - tanzilli@acmesystems.it
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/types.h>
23#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/platform_device.h>
27#include <linux/spi/spi.h>
28#include <linux/spi/at73c213.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
32#include <linux/clk.h>
33#include <linux/w1-gpio.h>
34
35#include <mach/hardware.h>
36#include <asm/setup.h>
37#include <asm/mach-types.h>
38#include <asm/irq.h>
39
40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43
44#include <mach/at91sam9_smc.h>
45
46#include "at91_aic.h"
47#include "board.h"
48#include "sam9_smc.h"
49#include "generic.h"
50#include "gpio.h"
51
52/*
53 * The FOX Board G20 hardware comes as the "Netus G20" board with
54 * just the cpu, ram, dataflash and two header connectors.
55 * This is plugged into the FOX Board which provides the ethernet,
56 * usb, rtc, leds, switch, ...
57 *
58 * For more info visit: http://www.acmesystems.it/foxg20
59 */
60
61
62static void __init foxg20_init_early(void)
63{
64 /* Initialize processor: 18.432 MHz crystal */
65 at91_initialize(18432000);
66}
67
68/*
69 * USB Host port
70 */
71static struct at91_usbh_data __initdata foxg20_usbh_data = {
72 .ports = 2,
73 .vbus_pin = {-EINVAL, -EINVAL},
74 .overcurrent_pin= {-EINVAL, -EINVAL},
75};
76
77/*
78 * USB Device port
79 */
80static struct at91_udc_data __initdata foxg20_udc_data = {
81 .vbus_pin = AT91_PIN_PC6,
82 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
83};
84
85
86/*
87 * SPI devices.
88 */
89static struct spi_board_info foxg20_spi_devices[] = {
90#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
91 {
92 .modalias = "mtd_dataflash",
93 .chip_select = 1,
94 .max_speed_hz = 15 * 1000 * 1000,
95 .bus_num = 0,
96 },
97#endif
98};
99
100
101/*
102 * MACB Ethernet device
103 */
104static struct macb_platform_data __initdata foxg20_macb_data = {
105 .phy_irq_pin = AT91_PIN_PA7,
106 .is_rmii = 1,
107};
108
109/*
110 * MCI (SD/MMC)
111 * det_pin, wp_pin and vcc_pin are not connected
112 */
113static struct mci_platform_data __initdata foxg20_mci0_data = {
114 .slot[1] = {
115 .bus_width = 4,
116 .detect_pin = -EINVAL,
117 .wp_pin = -EINVAL,
118 },
119};
120
121
122/*
123 * LEDs
124 */
125static struct gpio_led foxg20_leds[] = {
126 { /* user led, red */
127 .name = "user_led",
128 .gpio = AT91_PIN_PC7,
129 .active_low = 0,
130 .default_trigger = "heartbeat",
131 },
132};
133
134
135/*
136 * GPIO Buttons
137 */
138#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
139static struct gpio_keys_button foxg20_buttons[] = {
140 {
141 .gpio = AT91_PIN_PC4,
142 .code = BTN_1,
143 .desc = "Button 1",
144 .active_low = 1,
145 .wakeup = 1,
146 },
147};
148
149static struct gpio_keys_platform_data foxg20_button_data = {
150 .buttons = foxg20_buttons,
151 .nbuttons = ARRAY_SIZE(foxg20_buttons),
152};
153
154static struct platform_device foxg20_button_device = {
155 .name = "gpio-keys",
156 .id = -1,
157 .num_resources = 0,
158 .dev = {
159 .platform_data = &foxg20_button_data,
160 }
161};
162
163static void __init foxg20_add_device_buttons(void)
164{
165 at91_set_gpio_input(AT91_PIN_PC4, 1); /* btn1 */
166 at91_set_deglitch(AT91_PIN_PC4, 1);
167
168 platform_device_register(&foxg20_button_device);
169}
170#else
171static void __init foxg20_add_device_buttons(void) {}
172#endif
173
174
175#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
176static struct w1_gpio_platform_data w1_gpio_pdata = {
177 /* If you choose to use a pin other than PB16 it needs to be 3.3V */
178 .pin = AT91_PIN_PB16,
179 .is_open_drain = 1,
180 .ext_pullup_enable_pin = -EINVAL,
181};
182
183static struct platform_device w1_device = {
184 .name = "w1-gpio",
185 .id = -1,
186 .dev.platform_data = &w1_gpio_pdata,
187};
188
189static void __init at91_add_device_w1(void)
190{
191 at91_set_GPIO_periph(w1_gpio_pdata.pin, 1);
192 at91_set_multi_drive(w1_gpio_pdata.pin, 1);
193 platform_device_register(&w1_device);
194}
195
196#endif
197
198
199static struct i2c_board_info __initdata foxg20_i2c_devices[] = {
200 {
201 I2C_BOARD_INFO("24c512", 0x50),
202 },
203};
204
205
206static void __init foxg20_board_init(void)
207{
208 /* Serial */
209 /* DBGU on ttyS0. (Rx & Tx only) */
210 at91_register_uart(0, 0, 0);
211
212 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
213 at91_register_uart(AT91SAM9260_ID_US0, 1,
214 ATMEL_UART_CTS
215 | ATMEL_UART_RTS
216 | ATMEL_UART_DTR
217 | ATMEL_UART_DSR
218 | ATMEL_UART_DCD
219 | ATMEL_UART_RI);
220
221 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
222 at91_register_uart(AT91SAM9260_ID_US1, 2,
223 ATMEL_UART_CTS
224 | ATMEL_UART_RTS);
225
226 /* USART2 on ttyS3. (Rx & Tx only) */
227 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
228
229 /* USART3 on ttyS4. (Rx, Tx, RTS, CTS) */
230 at91_register_uart(AT91SAM9260_ID_US3, 4,
231 ATMEL_UART_CTS
232 | ATMEL_UART_RTS);
233
234 /* USART4 on ttyS5. (Rx & Tx only) */
235 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
236
237 /* USART5 on ttyS6. (Rx & Tx only) */
238 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
239
240 /* Set the internal pull-up resistor on DRXD */
241 at91_set_A_periph(AT91_PIN_PB14, 1);
242 at91_add_device_serial();
243 /* USB Host */
244 at91_add_device_usbh(&foxg20_usbh_data);
245 /* USB Device */
246 at91_add_device_udc(&foxg20_udc_data);
247 /* SPI */
248 at91_add_device_spi(foxg20_spi_devices, ARRAY_SIZE(foxg20_spi_devices));
249 /* Ethernet */
250 at91_add_device_eth(&foxg20_macb_data);
251 /* MMC */
252 at91_add_device_mci(0, &foxg20_mci0_data);
253 /* I2C */
254 at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices));
255 /* LEDs */
256 at91_gpio_leds(foxg20_leds, ARRAY_SIZE(foxg20_leds));
257 /* Push Buttons */
258 foxg20_add_device_buttons();
259#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
260 at91_add_device_w1();
261#endif
262}
263
264MACHINE_START(ACMENETUSFOXG20, "Acme Systems srl FOX Board G20")
265 /* Maintainer: Sergio Tanzilli */
266 .init_time = at91sam926x_pit_init,
267 .map_io = at91_map_io,
268 .handle_irq = at91_aic_handle_irq,
269 .init_early = foxg20_init_early,
270 .init_irq = at91_init_irq_default,
271 .init_machine = foxg20_board_init,
272MACHINE_END
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index b729dd1271bf..bf5cc55c7db6 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -576,7 +576,7 @@ static void __init gsia18s_board_init(void)
576} 576}
577 577
578MACHINE_START(GSIA18S, "GS_IA18_S") 578MACHINE_START(GSIA18S, "GS_IA18_S")
579 .init_time = at91sam926x_pit_init, 579 .init_time = at91_init_time,
580 .map_io = at91_map_io, 580 .map_io = at91_map_io,
581 .handle_irq = at91_aic_handle_irq, 581 .handle_irq = at91_aic_handle_irq,
582 .init_early = gsia18s_init_early, 582 .init_early = gsia18s_init_early,
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index b48d95ec5152..9c26b94ce448 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -219,7 +219,7 @@ static void __init pcontrol_g20_board_init(void)
219 219
220MACHINE_START(PCONTROL_G20, "PControl G20") 220MACHINE_START(PCONTROL_G20, "PControl G20")
221 /* Maintainer: pgsellmann@portner-elektronik.at */ 221 /* Maintainer: pgsellmann@portner-elektronik.at */
222 .init_time = at91sam926x_pit_init, 222 .init_time = at91_init_time,
223 .map_io = at91_map_io, 223 .map_io = at91_map_io,
224 .handle_irq = at91_aic_handle_irq, 224 .handle_irq = at91_aic_handle_irq,
225 .init_early = pcontrol_g20_init_early, 225 .init_early = pcontrol_g20_init_early,
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c
deleted file mode 100644
index f28e8b74df4b..000000000000
--- a/arch/arm/mach-at91/board-rsi-ews.c
+++ /dev/null
@@ -1,232 +0,0 @@
1/*
2 * board-rsi-ews.c
3 *
4 * Copyright (C)
5 * 2005 SAN People,
6 * 2008-2011 R-S-I Elektrotechnik GmbH & Co. KG
7 *
8 * Licensed under GPLv2 or later.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/mm.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/spi/spi.h>
17#include <linux/mtd/physmap.h>
18
19#include <asm/setup.h>
20#include <asm/mach-types.h>
21#include <asm/irq.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
26
27#include <mach/hardware.h>
28
29#include <linux/gpio.h>
30
31#include "at91_aic.h"
32#include "board.h"
33#include "generic.h"
34#include "gpio.h"
35
36static void __init rsi_ews_init_early(void)
37{
38 /* Initialize processor: 18.432 MHz crystal */
39 at91_initialize(18432000);
40}
41
42/*
43 * Ethernet
44 */
45static struct macb_platform_data rsi_ews_eth_data __initdata = {
46 .phy_irq_pin = AT91_PIN_PC4,
47 .is_rmii = 1,
48};
49
50/*
51 * USB Host
52 */
53static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
54 .ports = 1,
55 .vbus_pin = {-EINVAL, -EINVAL},
56 .overcurrent_pin= {-EINVAL, -EINVAL},
57};
58
59/*
60 * SD/MC
61 */
62static struct mci_platform_data __initdata rsi_ews_mci0_data = {
63 .slot[0] = {
64 .bus_width = 4,
65 .detect_pin = AT91_PIN_PB27,
66 .wp_pin = AT91_PIN_PB29,
67 },
68};
69
70/*
71 * I2C
72 */
73static struct i2c_board_info rsi_ews_i2c_devices[] __initdata = {
74 {
75 I2C_BOARD_INFO("ds1337", 0x68),
76 },
77 {
78 I2C_BOARD_INFO("24c01", 0x50),
79 }
80};
81
82/*
83 * LEDs
84 */
85static struct gpio_led rsi_ews_leds[] = {
86 {
87 .name = "led0",
88 .gpio = AT91_PIN_PB6,
89 .active_low = 0,
90 },
91 {
92 .name = "led1",
93 .gpio = AT91_PIN_PB7,
94 .active_low = 0,
95 },
96 {
97 .name = "led2",
98 .gpio = AT91_PIN_PB8,
99 .active_low = 0,
100 },
101 {
102 .name = "led3",
103 .gpio = AT91_PIN_PB9,
104 .active_low = 0,
105 },
106};
107
108/*
109 * DataFlash
110 */
111static struct spi_board_info rsi_ews_spi_devices[] = {
112 { /* DataFlash chip 1*/
113 .modalias = "mtd_dataflash",
114 .chip_select = 0,
115 .max_speed_hz = 5 * 1000 * 1000,
116 },
117 { /* DataFlash chip 2*/
118 .modalias = "mtd_dataflash",
119 .chip_select = 1,
120 .max_speed_hz = 5 * 1000 * 1000,
121 },
122};
123
124/*
125 * NOR flash
126 */
127static struct mtd_partition rsiews_nor_partitions[] = {
128 {
129 .name = "boot",
130 .offset = 0,
131 .size = 3 * SZ_128K,
132 .mask_flags = MTD_WRITEABLE
133 },
134 {
135 .name = "kernel",
136 .offset = MTDPART_OFS_NXTBLK,
137 .size = SZ_2M - (3 * SZ_128K)
138 },
139 {
140 .name = "root",
141 .offset = MTDPART_OFS_NXTBLK,
142 .size = SZ_8M
143 },
144 {
145 .name = "kernelupd",
146 .offset = MTDPART_OFS_NXTBLK,
147 .size = 3 * SZ_512K,
148 .mask_flags = MTD_WRITEABLE
149 },
150 {
151 .name = "rootupd",
152 .offset = MTDPART_OFS_NXTBLK,
153 .size = 9 * SZ_512K,
154 .mask_flags = MTD_WRITEABLE
155 },
156};
157
158static struct physmap_flash_data rsiews_nor_data = {
159 .width = 2,
160 .parts = rsiews_nor_partitions,
161 .nr_parts = ARRAY_SIZE(rsiews_nor_partitions),
162};
163
164#define NOR_BASE AT91_CHIPSELECT_0
165#define NOR_SIZE SZ_16M
166
167static struct resource nor_flash_resources[] = {
168 {
169 .start = NOR_BASE,
170 .end = NOR_BASE + NOR_SIZE - 1,
171 .flags = IORESOURCE_MEM,
172 }
173};
174
175static struct platform_device rsiews_nor_flash = {
176 .name = "physmap-flash",
177 .id = 0,
178 .dev = {
179 .platform_data = &rsiews_nor_data,
180 },
181 .resource = nor_flash_resources,
182 .num_resources = ARRAY_SIZE(nor_flash_resources),
183};
184
185/*
186 * Init Func
187 */
188static void __init rsi_ews_board_init(void)
189{
190 /* Serial */
191 /* DBGU on ttyS0. (Rx & Tx only) */
192 /* This one is for debugging */
193 at91_register_uart(0, 0, 0);
194
195 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
196 /* Dialin/-out modem interface */
197 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
198 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
199 | ATMEL_UART_RI);
200
201 /* USART3 on ttyS4. (Rx, Tx, RTS) */
202 /* RS485 communication */
203 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
204 at91_add_device_serial();
205 at91_set_gpio_output(AT91_PIN_PA21, 0);
206 /* Ethernet */
207 at91_add_device_eth(&rsi_ews_eth_data);
208 /* USB Host */
209 at91_add_device_usbh(&rsi_ews_usbh_data);
210 /* I2C */
211 at91_add_device_i2c(rsi_ews_i2c_devices,
212 ARRAY_SIZE(rsi_ews_i2c_devices));
213 /* SPI */
214 at91_add_device_spi(rsi_ews_spi_devices,
215 ARRAY_SIZE(rsi_ews_spi_devices));
216 /* MMC */
217 at91_add_device_mci(0, &rsi_ews_mci0_data);
218 /* NOR Flash */
219 platform_device_register(&rsiews_nor_flash);
220 /* LEDs */
221 at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds));
222}
223
224MACHINE_START(RSI_EWS, "RSI EWS")
225 /* Maintainer: Josef Holzmayr <holzmayr@rsi-elektrotechnik.de> */
226 .init_time = at91rm9200_timer_init,
227 .map_io = at91_map_io,
228 .handle_irq = at91_aic_handle_irq,
229 .init_early = rsi_ews_init_early,
230 .init_irq = at91_init_irq_default,
231 .init_machine = rsi_ews_board_init,
232MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index d24dda67e2d3..c2166e3a236c 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -187,6 +187,8 @@ static struct gpio_led ek_leds[] = {
187 187
188static void __init ek_board_init(void) 188static void __init ek_board_init(void)
189{ 189{
190 at91_register_devices();
191
190 /* Serial */ 192 /* Serial */
191 /* DBGU on ttyS0. (Rx & Tx only) */ 193 /* DBGU on ttyS0. (Rx & Tx only) */
192 at91_register_uart(0, 0, 0); 194 at91_register_uart(0, 0, 0);
@@ -219,7 +221,7 @@ static void __init ek_board_init(void)
219 221
220MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260") 222MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260")
221 /* Maintainer: Olimex */ 223 /* Maintainer: Olimex */
222 .init_time = at91sam926x_pit_init, 224 .init_time = at91_init_time,
223 .map_io = at91_map_io, 225 .map_io = at91_map_io,
224 .handle_irq = at91_aic_handle_irq, 226 .handle_irq = at91_aic_handle_irq,
225 .init_early = ek_init_early, 227 .init_early = ek_init_early,
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 65dea12d685e..bf8a946b4cd0 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -45,7 +45,6 @@
45#include <mach/system_rev.h> 45#include <mach/system_rev.h>
46 46
47#include "at91_aic.h" 47#include "at91_aic.h"
48#include "at91_shdwc.h"
49#include "board.h" 48#include "board.h"
50#include "sam9_smc.h" 49#include "sam9_smc.h"
51#include "generic.h" 50#include "generic.h"
@@ -307,6 +306,8 @@ static void __init ek_add_device_buttons(void) {}
307 306
308static void __init ek_board_init(void) 307static void __init ek_board_init(void)
309{ 308{
309 at91_register_devices();
310
310 /* Serial */ 311 /* Serial */
311 /* DBGU on ttyS0. (Rx & Tx only) */ 312 /* DBGU on ttyS0. (Rx & Tx only) */
312 at91_register_uart(0, 0, 0); 313 at91_register_uart(0, 0, 0);
@@ -344,7 +345,7 @@ static void __init ek_board_init(void)
344 345
345MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK") 346MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
346 /* Maintainer: Atmel */ 347 /* Maintainer: Atmel */
347 .init_time = at91sam926x_pit_init, 348 .init_time = at91_init_time,
348 .map_io = at91_map_io, 349 .map_io = at91_map_io,
349 .handle_irq = at91_aic_handle_irq, 350 .handle_irq = at91_aic_handle_irq,
350 .init_early = ek_init_early, 351 .init_early = ek_init_early,
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 4637432de08f..e85ada820bfb 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -49,7 +49,6 @@
49#include <mach/system_rev.h> 49#include <mach/system_rev.h>
50 50
51#include "at91_aic.h" 51#include "at91_aic.h"
52#include "at91_shdwc.h"
53#include "board.h" 52#include "board.h"
54#include "sam9_smc.h" 53#include "sam9_smc.h"
55#include "generic.h" 54#include "generic.h"
@@ -561,6 +560,8 @@ static struct gpio_led ek_leds[] = {
561 560
562static void __init ek_board_init(void) 561static void __init ek_board_init(void)
563{ 562{
563 at91_register_devices();
564
564 /* Serial */ 565 /* Serial */
565 /* DBGU on ttyS0. (Rx & Tx only) */ 566 /* DBGU on ttyS0. (Rx & Tx only) */
566 at91_register_uart(0, 0, 0); 567 at91_register_uart(0, 0, 0);
@@ -603,7 +604,7 @@ static void __init ek_board_init(void)
603 604
604MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") 605MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
605 /* Maintainer: Atmel */ 606 /* Maintainer: Atmel */
606 .init_time = at91sam926x_pit_init, 607 .init_time = at91_init_time,
607 .map_io = at91_map_io, 608 .map_io = at91_map_io,
608 .handle_irq = at91_aic_handle_irq, 609 .handle_irq = at91_aic_handle_irq,
609 .init_early = ek_init_early, 610 .init_early = ek_init_early,
@@ -613,7 +614,7 @@ MACHINE_END
613 614
614MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK") 615MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK")
615 /* Maintainer: Atmel */ 616 /* Maintainer: Atmel */
616 .init_time = at91sam926x_pit_init, 617 .init_time = at91_init_time,
617 .map_io = at91_map_io, 618 .map_io = at91_map_io,
618 .handle_irq = at91_aic_handle_irq, 619 .handle_irq = at91_aic_handle_irq,
619 .init_early = ek_init_early, 620 .init_early = ek_init_early,
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index fc446097f410..d76680f2a209 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -50,7 +50,6 @@
50#include <mach/system_rev.h> 50#include <mach/system_rev.h>
51 51
52#include "at91_aic.h" 52#include "at91_aic.h"
53#include "at91_shdwc.h"
54#include "board.h" 53#include "board.h"
55#include "sam9_smc.h" 54#include "sam9_smc.h"
56#include "generic.h" 55#include "generic.h"
@@ -439,6 +438,8 @@ static struct platform_device *devices[] __initdata = {
439 438
440static void __init ek_board_init(void) 439static void __init ek_board_init(void)
441{ 440{
441 at91_register_devices();
442
442 /* Serial */ 443 /* Serial */
443 /* DBGU on ttyS0. (Rx & Tx only) */ 444 /* DBGU on ttyS0. (Rx & Tx only) */
444 at91_register_uart(0, 0, 0); 445 at91_register_uart(0, 0, 0);
@@ -483,7 +484,7 @@ static void __init ek_board_init(void)
483 484
484MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") 485MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
485 /* Maintainer: Atmel */ 486 /* Maintainer: Atmel */
486 .init_time = at91sam926x_pit_init, 487 .init_time = at91_init_time,
487 .map_io = at91_map_io, 488 .map_io = at91_map_io,
488 .handle_irq = at91_aic_handle_irq, 489 .handle_irq = at91_aic_handle_irq,
489 .init_early = ek_init_early, 490 .init_early = ek_init_early,
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index e1be6e25b380..49f075213451 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -410,7 +410,7 @@ static void __init ek_board_init(void)
410 410
411MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK") 411MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
412 /* Maintainer: Atmel */ 412 /* Maintainer: Atmel */
413 .init_time = at91sam926x_pit_init, 413 .init_time = at91_init_time,
414 .map_io = at91_map_io, 414 .map_io = at91_map_io,
415 .handle_irq = at91_aic_handle_irq, 415 .handle_irq = at91_aic_handle_irq,
416 .init_early = ek_init_early, 416 .init_early = ek_init_early,
@@ -420,7 +420,7 @@ MACHINE_END
420 420
421MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod") 421MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod")
422 /* Maintainer: Atmel */ 422 /* Maintainer: Atmel */
423 .init_time = at91sam926x_pit_init, 423 .init_time = at91_init_time,
424 .map_io = at91_map_io, 424 .map_io = at91_map_io,
425 .handle_irq = at91_aic_handle_irq, 425 .handle_irq = at91_aic_handle_irq,
426 .init_early = ek_init_early, 426 .init_early = ek_init_early,
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index b227732b0c83..a517c7f7af92 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -48,7 +48,6 @@
48#include <mach/system_rev.h> 48#include <mach/system_rev.h>
49 49
50#include "at91_aic.h" 50#include "at91_aic.h"
51#include "at91_shdwc.h"
52#include "board.h" 51#include "board.h"
53#include "sam9_smc.h" 52#include "sam9_smc.h"
54#include "generic.h" 53#include "generic.h"
@@ -471,6 +470,8 @@ static struct platform_device *devices[] __initdata = {
471 470
472static void __init ek_board_init(void) 471static void __init ek_board_init(void)
473{ 472{
473 at91_register_devices();
474
474 /* Serial */ 475 /* Serial */
475 /* DGBU on ttyS0. (Rx & Tx only) */ 476 /* DGBU on ttyS0. (Rx & Tx only) */
476 at91_register_uart(0, 0, 0); 477 at91_register_uart(0, 0, 0);
@@ -517,7 +518,7 @@ static void __init ek_board_init(void)
517 518
518MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK") 519MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK")
519 /* Maintainer: Atmel */ 520 /* Maintainer: Atmel */
520 .init_time = at91sam926x_pit_init, 521 .init_time = at91_init_time,
521 .map_io = at91_map_io, 522 .map_io = at91_map_io,
522 .handle_irq = at91_aic_handle_irq, 523 .handle_irq = at91_aic_handle_irq,
523 .init_early = ek_init_early, 524 .init_early = ek_init_early,
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index b64648b4a1fc..8bca329b0293 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -35,7 +35,6 @@
35 35
36 36
37#include "at91_aic.h" 37#include "at91_aic.h"
38#include "at91_shdwc.h"
39#include "board.h" 38#include "board.h"
40#include "sam9_smc.h" 39#include "sam9_smc.h"
41#include "generic.h" 40#include "generic.h"
@@ -292,6 +291,8 @@ static void __init ek_add_device_buttons(void) {}
292 291
293static void __init ek_board_init(void) 292static void __init ek_board_init(void)
294{ 293{
294 at91_register_devices();
295
295 /* Serial */ 296 /* Serial */
296 /* DBGU on ttyS0. (Rx & Tx only) */ 297 /* DBGU on ttyS0. (Rx & Tx only) */
297 at91_register_uart(0, 0, 0); 298 at91_register_uart(0, 0, 0);
@@ -323,7 +324,7 @@ static void __init ek_board_init(void)
323 324
324MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK") 325MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK")
325 /* Maintainer: Atmel */ 326 /* Maintainer: Atmel */
326 .init_time = at91sam926x_pit_init, 327 .init_time = at91_init_time,
327 .map_io = at91_map_io, 328 .map_io = at91_map_io,
328 .handle_irq = at91_aic_handle_irq, 329 .handle_irq = at91_aic_handle_irq,
329 .init_early = ek_init_early, 330 .init_early = ek_init_early,
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 1b870e6def0c..b4aff840a1a0 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -154,6 +154,8 @@ static void __init snapper9260_add_device_nand(void)
154 154
155static void __init snapper9260_board_init(void) 155static void __init snapper9260_board_init(void)
156{ 156{
157 at91_register_devices();
158
157 at91_add_device_i2c(snapper9260_i2c_devices, 159 at91_add_device_i2c(snapper9260_i2c_devices,
158 ARRAY_SIZE(snapper9260_i2c_devices)); 160 ARRAY_SIZE(snapper9260_i2c_devices));
159 161
@@ -178,7 +180,7 @@ static void __init snapper9260_board_init(void)
178} 180}
179 181
180MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module") 182MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module")
181 .init_time = at91sam926x_pit_init, 183 .init_time = at91_init_time,
182 .map_io = at91_map_io, 184 .map_io = at91_map_io,
183 .handle_irq = at91_aic_handle_irq, 185 .handle_irq = at91_aic_handle_irq,
184 .init_early = snapper9260_init_early, 186 .init_early = snapper9260_init_early,
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index 3b575036ff96..e825641a1dee 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -275,7 +275,7 @@ static void __init stamp9g20evb_board_init(void)
275 275
276MACHINE_START(PORTUXG20, "taskit PortuxG20") 276MACHINE_START(PORTUXG20, "taskit PortuxG20")
277 /* Maintainer: taskit GmbH */ 277 /* Maintainer: taskit GmbH */
278 .init_time = at91sam926x_pit_init, 278 .init_time = at91_init_time,
279 .map_io = at91_map_io, 279 .map_io = at91_map_io,
280 .handle_irq = at91_aic_handle_irq, 280 .handle_irq = at91_aic_handle_irq,
281 .init_early = stamp9g20_init_early, 281 .init_early = stamp9g20_init_early,
@@ -285,7 +285,7 @@ MACHINE_END
285 285
286MACHINE_START(STAMP9G20, "taskit Stamp9G20") 286MACHINE_START(STAMP9G20, "taskit Stamp9G20")
287 /* Maintainer: taskit GmbH */ 287 /* Maintainer: taskit GmbH */
288 .init_time = at91sam926x_pit_init, 288 .init_time = at91_init_time,
289 .map_io = at91_map_io, 289 .map_io = at91_map_io,
290 .handle_irq = at91_aic_handle_irq, 290 .handle_irq = at91_aic_handle_irq,
291 .init_early = stamp9g20_init_early, 291 .init_early = stamp9g20_init_early,
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 034529d801b2..d66f102c352a 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -962,6 +962,7 @@ static int __init at91_clock_reset(void)
962 } 962 }
963 963
964 at91_pmc_write(AT91_PMC_SCDR, scdr); 964 at91_pmc_write(AT91_PMC_SCDR, scdr);
965 at91_pmc_write(AT91_PMC_PCDR, pcdr);
965 if (cpu_is_sama5d3()) 966 if (cpu_is_sama5d3())
966 at91_pmc_write(AT91_PMC_PCDR1, pcdr1); 967 at91_pmc_write(AT91_PMC_PCDR1, pcdr1);
967 968
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 631fa3b8c16d..81959cf4a137 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -8,12 +8,16 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#ifndef _AT91_GENERIC_H
12#define _AT91_GENERIC_H
13
11#include <linux/clkdev.h> 14#include <linux/clkdev.h>
12#include <linux/of.h> 15#include <linux/of.h>
13#include <linux/reboot.h> 16#include <linux/reboot.h>
14 17
15 /* Map io */ 18 /* Map io */
16extern void __init at91_map_io(void); 19extern void __init at91_map_io(void);
20extern void __init at91_alt_map_io(void);
17extern void __init at91_init_sram(int bank, unsigned long base, 21extern void __init at91_init_sram(int bank, unsigned long base,
18 unsigned int length); 22 unsigned int length);
19 23
@@ -37,12 +41,15 @@ extern int __init at91_aic5_of_init(struct device_node *node,
37extern void __init at91_sysirq_mask_rtc(u32 rtc_base); 41extern void __init at91_sysirq_mask_rtc(u32 rtc_base);
38extern void __init at91_sysirq_mask_rtt(u32 rtt_base); 42extern void __init at91_sysirq_mask_rtt(u32 rtt_base);
39 43
44 /* Devices */
45extern void __init at91_register_devices(void);
40 46
41 /* Timer */ 47 /* Timer */
48extern void __init at91_init_time(void);
42extern void at91rm9200_ioremap_st(u32 addr); 49extern void at91rm9200_ioremap_st(u32 addr);
43extern void at91rm9200_timer_init(void); 50extern void at91rm9200_timer_init(void);
44extern void at91sam926x_ioremap_pit(u32 addr); 51extern void at91sam926x_ioremap_pit(u32 addr);
45extern void at91sam926x_pit_init(void); 52extern void at91sam926x_pit_init(int irq);
46extern void at91x40_timer_init(void); 53extern void at91x40_timer_init(void);
47 54
48 /* Clocks */ 55 /* Clocks */
@@ -62,14 +69,6 @@ extern void at91_irq_resume(void);
62/* idle */ 69/* idle */
63extern void at91sam9_idle(void); 70extern void at91sam9_idle(void);
64 71
65/* reset */
66extern void at91_ioremap_rstc(u32 base_addr);
67extern void at91sam9_alt_restart(enum reboot_mode, const char *);
68extern void at91sam9g45_restart(enum reboot_mode, const char *);
69
70/* shutdown */
71extern void at91_ioremap_shdwc(u32 base_addr);
72
73/* Matrix */ 72/* Matrix */
74extern void at91_ioremap_matrix(u32 base_addr); 73extern void at91_ioremap_matrix(u32 base_addr);
75 74
@@ -90,3 +89,5 @@ extern int __init at91_gpio_of_irq_setup(struct device_node *node,
90 struct device_node *parent); 89 struct device_node *parent);
91 90
92extern u32 at91_get_extern_irq(void); 91extern u32 at91_get_extern_irq(void);
92
93#endif /* _AT91_GENERIC_H */
diff --git a/arch/arm/mach-at91/include/mach/at91_pio.h b/arch/arm/mach-at91/include/mach/at91_pio.h
index 732b11c37f1a..7b7366253ceb 100644
--- a/arch/arm/mach-at91/include/mach/at91_pio.h
+++ b/arch/arm/mach-at91/include/mach/at91_pio.h
@@ -71,4 +71,10 @@
71#define ABCDSR_PERIPH_C 0x2 71#define ABCDSR_PERIPH_C 0x2
72#define ABCDSR_PERIPH_D 0x3 72#define ABCDSR_PERIPH_D 0x3
73 73
74#define SAMA5D3_PIO_DRIVER1 0x118 /*PIO Driver 1 register offset*/
75#define SAMA5D3_PIO_DRIVER2 0x11C /*PIO Driver 2 register offset*/
76
77#define AT91SAM9X5_PIO_DRIVER1 0x114 /*PIO Driver 1 register offset*/
78#define AT91SAM9X5_PIO_DRIVER2 0x118 /*PIO Driver 2 register offset*/
79
74#endif 80#endif
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index 86c71debab5b..b27e9ca65653 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -36,7 +36,7 @@
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 39#define ARCH_ID_SAMA5 0x8A5C07C0
40 40
41#define ARCH_EXID_AT91SAM9M11 0x00000001 41#define ARCH_EXID_AT91SAM9M11 0x00000001
42#define ARCH_EXID_AT91SAM9M10 0x00000002 42#define ARCH_EXID_AT91SAM9M10 0x00000002
@@ -49,12 +49,19 @@
49#define ARCH_EXID_AT91SAM9G25 0x00000003 49#define ARCH_EXID_AT91SAM9G25 0x00000003
50#define ARCH_EXID_AT91SAM9X25 0x00000004 50#define ARCH_EXID_AT91SAM9X25 0x00000004
51 51
52#define ARCH_EXID_SAMA5D3 0x00004300
52#define ARCH_EXID_SAMA5D31 0x00444300 53#define ARCH_EXID_SAMA5D31 0x00444300
53#define ARCH_EXID_SAMA5D33 0x00414300 54#define ARCH_EXID_SAMA5D33 0x00414300
54#define ARCH_EXID_SAMA5D34 0x00414301 55#define ARCH_EXID_SAMA5D34 0x00414301
55#define ARCH_EXID_SAMA5D35 0x00584300 56#define ARCH_EXID_SAMA5D35 0x00584300
56#define ARCH_EXID_SAMA5D36 0x00004301 57#define ARCH_EXID_SAMA5D36 0x00004301
57 58
59#define ARCH_EXID_SAMA5D4 0x00000007
60#define ARCH_EXID_SAMA5D41 0x00000001
61#define ARCH_EXID_SAMA5D42 0x00000002
62#define ARCH_EXID_SAMA5D43 0x00000003
63#define ARCH_EXID_SAMA5D44 0x00000004
64
58#define ARCH_FAMILY_AT91X92 0x09200000 65#define ARCH_FAMILY_AT91X92 0x09200000
59#define ARCH_FAMILY_AT91SAM9 0x01900000 66#define ARCH_FAMILY_AT91SAM9 0x01900000
60#define ARCH_FAMILY_AT91SAM9XE 0x02900000 67#define ARCH_FAMILY_AT91SAM9XE 0x02900000
@@ -86,6 +93,9 @@ enum at91_soc_type {
86 /* SAMA5D3 */ 93 /* SAMA5D3 */
87 AT91_SOC_SAMA5D3, 94 AT91_SOC_SAMA5D3,
88 95
96 /* SAMA5D4 */
97 AT91_SOC_SAMA5D4,
98
89 /* Unknown type */ 99 /* Unknown type */
90 AT91_SOC_UNKNOWN, 100 AT91_SOC_UNKNOWN,
91}; 101};
@@ -108,6 +118,10 @@ enum at91_soc_subtype {
108 AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34, 118 AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34,
109 AT91_SOC_SAMA5D35, AT91_SOC_SAMA5D36, 119 AT91_SOC_SAMA5D35, AT91_SOC_SAMA5D36,
110 120
121 /* SAMA5D4 */
122 AT91_SOC_SAMA5D41, AT91_SOC_SAMA5D42, AT91_SOC_SAMA5D43,
123 AT91_SOC_SAMA5D44,
124
111 /* No subtype for this SoC */ 125 /* No subtype for this SoC */
112 AT91_SOC_SUBTYPE_NONE, 126 AT91_SOC_SUBTYPE_NONE,
113 127
@@ -211,6 +225,12 @@ static inline int at91_soc_is_detected(void)
211#define cpu_is_sama5d3() (0) 225#define cpu_is_sama5d3() (0)
212#endif 226#endif
213 227
228#ifdef CONFIG_SOC_SAMA5D4
229#define cpu_is_sama5d4() (at91_soc_initdata.type == AT91_SOC_SAMA5D4)
230#else
231#define cpu_is_sama5d4() (0)
232#endif
233
214/* 234/*
215 * Since this is ARM, we will never run on any AVR32 CPU. But these 235 * Since this is ARM, we will never run on any AVR32 CPU. But these
216 * definitions may reduce clutter in common drivers. 236 * definitions may reduce clutter in common drivers.
diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/mach-at91/include/mach/debug-macro.S
index c6bb9e2d9baa..2103a90f2261 100644
--- a/arch/arm/mach-at91/include/mach/debug-macro.S
+++ b/arch/arm/mach-at91/include/mach/debug-macro.S
@@ -16,8 +16,11 @@
16 16
17#if defined(CONFIG_AT91_DEBUG_LL_DBGU0) 17#if defined(CONFIG_AT91_DEBUG_LL_DBGU0)
18#define AT91_DBGU AT91_BASE_DBGU0 18#define AT91_DBGU AT91_BASE_DBGU0
19#else 19#elif defined(CONFIG_AT91_DEBUG_LL_DBGU1)
20#define AT91_DBGU AT91_BASE_DBGU1 20#define AT91_DBGU AT91_BASE_DBGU1
21#else
22/* On sama5d4, use USART3 as low level serial console */
23#define AT91_DBGU SAMA5D4_BASE_USART3
21#endif 24#endif
22 25
23 .macro addruart, rp, rv, tmp 26 .macro addruart, rp, rv, tmp
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index 56338245653a..c13797352688 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -19,8 +19,10 @@
19/* DBGU base */ 19/* DBGU base */
20/* rm9200, 9260/9g20, 9261/9g10, 9rl */ 20/* rm9200, 9260/9g20, 9261/9g10, 9rl */
21#define AT91_BASE_DBGU0 0xfffff200 21#define AT91_BASE_DBGU0 0xfffff200
22/* 9263, 9g45 */ 22/* 9263, 9g45, sama5d3 */
23#define AT91_BASE_DBGU1 0xffffee00 23#define AT91_BASE_DBGU1 0xffffee00
24/* sama5d4 */
25#define AT91_BASE_DBGU2 0xfc069000
24 26
25#if defined(CONFIG_ARCH_AT91X40) 27#if defined(CONFIG_ARCH_AT91X40)
26#include <mach/at91x40.h> 28#include <mach/at91x40.h>
@@ -34,6 +36,7 @@
34#include <mach/at91sam9x5.h> 36#include <mach/at91sam9x5.h>
35#include <mach/at91sam9n12.h> 37#include <mach/at91sam9n12.h>
36#include <mach/sama5d3.h> 38#include <mach/sama5d3.h>
39#include <mach/sama5d4.h>
37 40
38/* 41/*
39 * On all at91 except rm9200 and x40 have the System Controller starts 42 * On all at91 except rm9200 and x40 have the System Controller starts
@@ -47,9 +50,15 @@
47 * and map the same memory space 50 * and map the same memory space
48 */ 51 */
49#define AT91_BASE_SYS 0xffffc000 52#define AT91_BASE_SYS 0xffffc000
53
50#endif 54#endif
51 55
52/* 56/*
57 * On sama5d4 there is no system controller, we map some needed peripherals
58 */
59#define AT91_ALT_BASE_SYS 0xfc069000
60
61/*
53 * On all at91 have the Advanced Interrupt Controller starts at address 62 * On all at91 have the Advanced Interrupt Controller starts at address
54 * 0xfffff000 and the Power Management Controller starts at 0xfffffc00 63 * 0xfffff000 and the Power Management Controller starts at 0xfffffc00
55 */ 64 */
@@ -69,23 +78,35 @@
69 */ 78 */
70#define AT91_IO_PHYS_BASE 0xFFF78000 79#define AT91_IO_PHYS_BASE 0xFFF78000
71#define AT91_IO_VIRT_BASE IOMEM(0xFF000000 - AT91_IO_SIZE) 80#define AT91_IO_VIRT_BASE IOMEM(0xFF000000 - AT91_IO_SIZE)
81
82/*
83 * On sama5d4, remap the peripherals from address 0xFC069000 .. 0xFC06F000
84 * to 0xFB069000 .. 0xFB06F000. (24Kb)
85 */
86#define AT91_ALT_IO_PHYS_BASE AT91_ALT_BASE_SYS
87#define AT91_ALT_IO_VIRT_BASE IOMEM(0xFB069000)
72#else 88#else
73/* 89/*
74 * Identity mapping for the non MMU case. 90 * Identity mapping for the non MMU case.
75 */ 91 */
76#define AT91_IO_PHYS_BASE AT91_BASE_SYS 92#define AT91_IO_PHYS_BASE AT91_BASE_SYS
77#define AT91_IO_VIRT_BASE IOMEM(AT91_IO_PHYS_BASE) 93#define AT91_IO_VIRT_BASE IOMEM(AT91_IO_PHYS_BASE)
94
95#define AT91_ALT_IO_PHYS_BASE AT91_ALT_BASE_SYS
96#define AT91_ALT_IO_VIRT_BASE IOMEM(AT91_ALT_BASE_SYS)
78#endif 97#endif
79 98
80#define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1) 99#define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1)
81 100
82 /* Convert a physical IO address to virtual IO address */ 101 /* Convert a physical IO address to virtual IO address */
83#define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE) 102#define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE)
103#define AT91_ALT_IO_P2V(x) ((x) - AT91_ALT_IO_PHYS_BASE + AT91_ALT_IO_VIRT_BASE)
84 104
85/* 105/*
86 * Virtual to Physical Address mapping for IO devices. 106 * Virtual to Physical Address mapping for IO devices.
87 */ 107 */
88#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS) 108#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS)
109#define AT91_ALT_VA_BASE_SYS AT91_ALT_IO_P2V(AT91_ALT_BASE_SYS)
89 110
90 /* Internal SRAM is mapped below the IO devices */ 111 /* Internal SRAM is mapped below the IO devices */
91#define AT91_SRAM_MAX SZ_1M 112#define AT91_SRAM_MAX SZ_1M
diff --git a/arch/arm/mach-at91/include/mach/sama5d4.h b/arch/arm/mach-at91/include/mach/sama5d4.h
new file mode 100644
index 000000000000..f256a45d9854
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/sama5d4.h
@@ -0,0 +1,33 @@
1/*
2 * Chip-specific header file for the SAMA5D4 family
3 *
4 * Copyright (C) 2013 Atmel Corporation,
5 * Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Common definitions.
8 * Based on SAMA5D4 datasheet.
9 *
10 * Licensed under GPLv2 or later.
11 */
12
13#ifndef SAMA5D4_H
14#define SAMA5D4_H
15
16/*
17 * User Peripheral physical base addresses.
18 */
19#define SAMA5D4_BASE_USART3 0xfc00c000 /* (USART3 non-secure) Base Address */
20#define SAMA5D4_BASE_PMC 0xf0018000 /* (PMC) Base Address */
21#define SAMA5D4_BASE_MPDDRC 0xf0010000 /* (MPDDRC) Base Address */
22#define SAMA5D4_BASE_PIOD 0xfc068000 /* (PIOD) Base Address */
23
24/* Some other peripherals */
25#define SAMA5D4_BASE_SYS2 SAMA5D4_BASE_PIOD
26
27/*
28 * Internal Memory.
29 */
30#define SAMA5D4_NS_SRAM_BASE 0x00210000 /* Internal SRAM base address Non-Secure */
31#define SAMA5D4_NS_SRAM_SIZE (64 * SZ_1K) /* Internal SRAM size Non-Secure part (64Kb) */
32
33#endif
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h
index 4bb644f8e87c..acb2d890ad7e 100644
--- a/arch/arm/mach-at91/include/mach/uncompress.h
+++ b/arch/arm/mach-at91/include/mach/uncompress.h
@@ -94,7 +94,7 @@ static const u32 uarts_sam9x5[] = {
94 0, 94 0,
95}; 95};
96 96
97static const u32 uarts_sama5[] = { 97static const u32 uarts_sama5d3[] = {
98 AT91_BASE_DBGU1, 98 AT91_BASE_DBGU1,
99 SAMA5D3_BASE_USART0, 99 SAMA5D3_BASE_USART0,
100 SAMA5D3_BASE_USART1, 100 SAMA5D3_BASE_USART1,
@@ -103,6 +103,12 @@ static const u32 uarts_sama5[] = {
103 0, 103 0,
104}; 104};
105 105
106static const u32 uarts_sama5d4[] = {
107 AT91_BASE_DBGU2,
108 SAMA5D4_BASE_USART3,
109 0,
110};
111
106static inline const u32* decomp_soc_detect(void __iomem *dbgu_base) 112static inline const u32* decomp_soc_detect(void __iomem *dbgu_base)
107{ 113{
108 u32 cidr, socid; 114 u32 cidr, socid;
@@ -134,8 +140,14 @@ static inline const u32* decomp_soc_detect(void __iomem *dbgu_base)
134 case ARCH_ID_AT91SAM9X5: 140 case ARCH_ID_AT91SAM9X5:
135 return uarts_sam9x5; 141 return uarts_sam9x5;
136 142
137 case ARCH_ID_SAMA5D3: 143 case ARCH_ID_SAMA5:
138 return uarts_sama5; 144 cidr = __raw_readl(dbgu_base + AT91_DBGU_EXID);
145 if (cidr & ARCH_EXID_SAMA5D3)
146 return uarts_sama5d3;
147 else if (cidr & ARCH_EXID_SAMA5D4)
148 return uarts_sama5d4;
149
150 break;
139 } 151 }
140 152
141 /* at91sam9g10 */ 153 /* at91sam9g10 */
@@ -156,9 +168,10 @@ static inline void arch_decomp_setup(void)
156 const u32* usarts; 168 const u32* usarts;
157 169
158 usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU0); 170 usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU0);
159
160 if (!usarts) 171 if (!usarts)
161 usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU1); 172 usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU1);
173 if (!usarts)
174 usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU2);
162 if (!usarts) { 175 if (!usarts) {
163 at91_uart = NULL; 176 at91_uart = NULL;
164 return; 177 return;
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
index 3d192c5aee66..cdb3ec9efd2b 100644
--- a/arch/arm/mach-at91/irq.c
+++ b/arch/arm/mach-at91/irq.c
@@ -48,11 +48,6 @@ void __iomem *at91_aic_base;
48static struct irq_domain *at91_aic_domain; 48static struct irq_domain *at91_aic_domain;
49static struct device_node *at91_aic_np; 49static struct device_node *at91_aic_np;
50static unsigned int n_irqs = NR_AIC_IRQS; 50static unsigned int n_irqs = NR_AIC_IRQS;
51static unsigned long at91_aic_caps = 0;
52
53/* AIC5 introduces a Source Select Register */
54#define AT91_AIC_CAP_AIC5 (1 << 0)
55#define has_aic5() (at91_aic_caps & AT91_AIC_CAP_AIC5)
56 51
57#ifdef CONFIG_PM 52#ifdef CONFIG_PM
58 53
@@ -92,50 +87,14 @@ static int at91_aic_set_wake(struct irq_data *d, unsigned value)
92 87
93void at91_irq_suspend(void) 88void at91_irq_suspend(void)
94{ 89{
95 int bit = -1; 90 at91_aic_write(AT91_AIC_IDCR, *backups);
96 91 at91_aic_write(AT91_AIC_IECR, *wakeups);
97 if (has_aic5()) {
98 /* disable enabled irqs */
99 while ((bit = find_next_bit(backups, n_irqs, bit + 1)) < n_irqs) {
100 at91_aic_write(AT91_AIC5_SSR,
101 bit & AT91_AIC5_INTSEL_MSK);
102 at91_aic_write(AT91_AIC5_IDCR, 1);
103 }
104 /* enable wakeup irqs */
105 bit = -1;
106 while ((bit = find_next_bit(wakeups, n_irqs, bit + 1)) < n_irqs) {
107 at91_aic_write(AT91_AIC5_SSR,
108 bit & AT91_AIC5_INTSEL_MSK);
109 at91_aic_write(AT91_AIC5_IECR, 1);
110 }
111 } else {
112 at91_aic_write(AT91_AIC_IDCR, *backups);
113 at91_aic_write(AT91_AIC_IECR, *wakeups);
114 }
115} 92}
116 93
117void at91_irq_resume(void) 94void at91_irq_resume(void)
118{ 95{
119 int bit = -1; 96 at91_aic_write(AT91_AIC_IDCR, *wakeups);
120 97 at91_aic_write(AT91_AIC_IECR, *backups);
121 if (has_aic5()) {
122 /* disable wakeup irqs */
123 while ((bit = find_next_bit(wakeups, n_irqs, bit + 1)) < n_irqs) {
124 at91_aic_write(AT91_AIC5_SSR,
125 bit & AT91_AIC5_INTSEL_MSK);
126 at91_aic_write(AT91_AIC5_IDCR, 1);
127 }
128 /* enable irqs disabled for suspend */
129 bit = -1;
130 while ((bit = find_next_bit(backups, n_irqs, bit + 1)) < n_irqs) {
131 at91_aic_write(AT91_AIC5_SSR,
132 bit & AT91_AIC5_INTSEL_MSK);
133 at91_aic_write(AT91_AIC5_IECR, 1);
134 }
135 } else {
136 at91_aic_write(AT91_AIC_IDCR, *wakeups);
137 at91_aic_write(AT91_AIC_IECR, *backups);
138 }
139} 98}
140 99
141#else 100#else
@@ -169,21 +128,6 @@ at91_aic_handle_irq(struct pt_regs *regs)
169 handle_IRQ(irqnr, regs); 128 handle_IRQ(irqnr, regs);
170} 129}
171 130
172asmlinkage void __exception_irq_entry
173at91_aic5_handle_irq(struct pt_regs *regs)
174{
175 u32 irqnr;
176 u32 irqstat;
177
178 irqnr = at91_aic_read(AT91_AIC5_IVR);
179 irqstat = at91_aic_read(AT91_AIC5_ISR);
180
181 if (!irqstat)
182 at91_aic_write(AT91_AIC5_EOICR, 0);
183 else
184 handle_IRQ(irqnr, regs);
185}
186
187static void at91_aic_mask_irq(struct irq_data *d) 131static void at91_aic_mask_irq(struct irq_data *d)
188{ 132{
189 /* Disable interrupt on AIC */ 133 /* Disable interrupt on AIC */
@@ -192,15 +136,6 @@ static void at91_aic_mask_irq(struct irq_data *d)
192 clear_backup(d->hwirq); 136 clear_backup(d->hwirq);
193} 137}
194 138
195static void __maybe_unused at91_aic5_mask_irq(struct irq_data *d)
196{
197 /* Disable interrupt on AIC5 */
198 at91_aic_write(AT91_AIC5_SSR, d->hwirq & AT91_AIC5_INTSEL_MSK);
199 at91_aic_write(AT91_AIC5_IDCR, 1);
200 /* Update ISR cache */
201 clear_backup(d->hwirq);
202}
203
204static void at91_aic_unmask_irq(struct irq_data *d) 139static void at91_aic_unmask_irq(struct irq_data *d)
205{ 140{
206 /* Enable interrupt on AIC */ 141 /* Enable interrupt on AIC */
@@ -209,15 +144,6 @@ static void at91_aic_unmask_irq(struct irq_data *d)
209 set_backup(d->hwirq); 144 set_backup(d->hwirq);
210} 145}
211 146
212static void __maybe_unused at91_aic5_unmask_irq(struct irq_data *d)
213{
214 /* Enable interrupt on AIC5 */
215 at91_aic_write(AT91_AIC5_SSR, d->hwirq & AT91_AIC5_INTSEL_MSK);
216 at91_aic_write(AT91_AIC5_IECR, 1);
217 /* Update ISR cache */
218 set_backup(d->hwirq);
219}
220
221static void at91_aic_eoi(struct irq_data *d) 147static void at91_aic_eoi(struct irq_data *d)
222{ 148{
223 /* 149 /*
@@ -227,11 +153,6 @@ static void at91_aic_eoi(struct irq_data *d)
227 at91_aic_write(AT91_AIC_EOICR, 0); 153 at91_aic_write(AT91_AIC_EOICR, 0);
228} 154}
229 155
230static void __maybe_unused at91_aic5_eoi(struct irq_data *d)
231{
232 at91_aic_write(AT91_AIC5_EOICR, 0);
233}
234
235static unsigned long *at91_extern_irq; 156static unsigned long *at91_extern_irq;
236 157
237u32 at91_get_extern_irq(void) 158u32 at91_get_extern_irq(void)
@@ -282,16 +203,8 @@ static int at91_aic_set_type(struct irq_data *d, unsigned type)
282 if (srctype < 0) 203 if (srctype < 0)
283 return srctype; 204 return srctype;
284 205
285 if (has_aic5()) { 206 smr = at91_aic_read(AT91_AIC_SMR(d->hwirq)) & ~AT91_AIC_SRCTYPE;
286 at91_aic_write(AT91_AIC5_SSR, 207 at91_aic_write(AT91_AIC_SMR(d->hwirq), smr | srctype);
287 d->hwirq & AT91_AIC5_INTSEL_MSK);
288 smr = at91_aic_read(AT91_AIC5_SMR) & ~AT91_AIC_SRCTYPE;
289 at91_aic_write(AT91_AIC5_SMR, smr | srctype);
290 } else {
291 smr = at91_aic_read(AT91_AIC_SMR(d->hwirq))
292 & ~AT91_AIC_SRCTYPE;
293 at91_aic_write(AT91_AIC_SMR(d->hwirq), smr | srctype);
294 }
295 208
296 return 0; 209 return 0;
297} 210}
@@ -331,177 +244,6 @@ static void __init at91_aic_hw_init(unsigned int spu_vector)
331 at91_aic_write(AT91_AIC_ICCR, 0xFFFFFFFF); 244 at91_aic_write(AT91_AIC_ICCR, 0xFFFFFFFF);
332} 245}
333 246
334static void __init __maybe_unused at91_aic5_hw_init(unsigned int spu_vector)
335{
336 int i;
337
338 /*
339 * Perform 8 End Of Interrupt Command to make sure AIC
340 * will not Lock out nIRQ
341 */
342 for (i = 0; i < 8; i++)
343 at91_aic_write(AT91_AIC5_EOICR, 0);
344
345 /*
346 * Spurious Interrupt ID in Spurious Vector Register.
347 * When there is no current interrupt, the IRQ Vector Register
348 * reads the value stored in AIC_SPU
349 */
350 at91_aic_write(AT91_AIC5_SPU, spu_vector);
351
352 /* No debugging in AIC: Debug (Protect) Control Register */
353 at91_aic_write(AT91_AIC5_DCR, 0);
354
355 /* Disable and clear all interrupts initially */
356 for (i = 0; i < n_irqs; i++) {
357 at91_aic_write(AT91_AIC5_SSR, i & AT91_AIC5_INTSEL_MSK);
358 at91_aic_write(AT91_AIC5_IDCR, 1);
359 at91_aic_write(AT91_AIC5_ICCR, 1);
360 }
361}
362
363#if defined(CONFIG_OF)
364static unsigned int *at91_aic_irq_priorities;
365
366static int at91_aic_irq_map(struct irq_domain *h, unsigned int virq,
367 irq_hw_number_t hw)
368{
369 /* Put virq number in Source Vector Register */
370 at91_aic_write(AT91_AIC_SVR(hw), virq);
371
372 /* Active Low interrupt, with priority */
373 at91_aic_write(AT91_AIC_SMR(hw),
374 AT91_AIC_SRCTYPE_LOW | at91_aic_irq_priorities[hw]);
375
376 irq_set_chip_and_handler(virq, &at91_aic_chip, handle_fasteoi_irq);
377 set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);
378
379 return 0;
380}
381
382static int at91_aic5_irq_map(struct irq_domain *h, unsigned int virq,
383 irq_hw_number_t hw)
384{
385 at91_aic_write(AT91_AIC5_SSR, hw & AT91_AIC5_INTSEL_MSK);
386
387 /* Put virq number in Source Vector Register */
388 at91_aic_write(AT91_AIC5_SVR, virq);
389
390 /* Active Low interrupt, with priority */
391 at91_aic_write(AT91_AIC5_SMR,
392 AT91_AIC_SRCTYPE_LOW | at91_aic_irq_priorities[hw]);
393
394 irq_set_chip_and_handler(virq, &at91_aic_chip, handle_fasteoi_irq);
395 set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);
396
397 return 0;
398}
399
400static int at91_aic_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
401 const u32 *intspec, unsigned int intsize,
402 irq_hw_number_t *out_hwirq, unsigned int *out_type)
403{
404 if (WARN_ON(intsize < 3))
405 return -EINVAL;
406 if (WARN_ON(intspec[0] >= n_irqs))
407 return -EINVAL;
408 if (WARN_ON((intspec[2] < AT91_AIC_IRQ_MIN_PRIORITY)
409 || (intspec[2] > AT91_AIC_IRQ_MAX_PRIORITY)))
410 return -EINVAL;
411
412 *out_hwirq = intspec[0];
413 *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
414 at91_aic_irq_priorities[*out_hwirq] = intspec[2];
415
416 return 0;
417}
418
419static struct irq_domain_ops at91_aic_irq_ops = {
420 .map = at91_aic_irq_map,
421 .xlate = at91_aic_irq_domain_xlate,
422};
423
424int __init at91_aic_of_common_init(struct device_node *node,
425 struct device_node *parent)
426{
427 struct property *prop;
428 const __be32 *p;
429 u32 val;
430
431 at91_extern_irq = kzalloc(BITS_TO_LONGS(n_irqs)
432 * sizeof(*at91_extern_irq), GFP_KERNEL);
433 if (!at91_extern_irq)
434 return -ENOMEM;
435
436 if (at91_aic_pm_init()) {
437 kfree(at91_extern_irq);
438 return -ENOMEM;
439 }
440
441 at91_aic_irq_priorities = kzalloc(n_irqs
442 * sizeof(*at91_aic_irq_priorities),
443 GFP_KERNEL);
444 if (!at91_aic_irq_priorities)
445 return -ENOMEM;
446
447 at91_aic_base = of_iomap(node, 0);
448 at91_aic_np = node;
449
450 at91_aic_domain = irq_domain_add_linear(at91_aic_np, n_irqs,
451 &at91_aic_irq_ops, NULL);
452 if (!at91_aic_domain)
453 panic("Unable to add AIC irq domain (DT)\n");
454
455 of_property_for_each_u32(node, "atmel,external-irqs", prop, p, val) {
456 if (val >= n_irqs)
457 pr_warn("AIC: external irq %d >= %d skip it\n",
458 val, n_irqs);
459 else
460 set_bit(val, at91_extern_irq);
461 }
462
463 irq_set_default_host(at91_aic_domain);
464
465 return 0;
466}
467
468int __init at91_aic_of_init(struct device_node *node,
469 struct device_node *parent)
470{
471 int err;
472
473 err = at91_aic_of_common_init(node, parent);
474 if (err)
475 return err;
476
477 at91_aic_hw_init(n_irqs);
478
479 return 0;
480}
481
482int __init at91_aic5_of_init(struct device_node *node,
483 struct device_node *parent)
484{
485 int err;
486
487 at91_aic_caps |= AT91_AIC_CAP_AIC5;
488 n_irqs = NR_AIC5_IRQS;
489 at91_aic_chip.irq_ack = at91_aic5_mask_irq;
490 at91_aic_chip.irq_mask = at91_aic5_mask_irq;
491 at91_aic_chip.irq_unmask = at91_aic5_unmask_irq;
492 at91_aic_chip.irq_eoi = at91_aic5_eoi;
493 at91_aic_irq_ops.map = at91_aic5_irq_map;
494
495 err = at91_aic_of_common_init(node, parent);
496 if (err)
497 return err;
498
499 at91_aic5_hw_init(n_irqs);
500
501 return 0;
502}
503#endif
504
505/* 247/*
506 * Initialize the AIC interrupt controller. 248 * Initialize the AIC interrupt controller.
507 */ 249 */
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index e95554532987..4073ab7f38f3 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -34,79 +34,8 @@
34#include "pm.h" 34#include "pm.h"
35#include "gpio.h" 35#include "gpio.h"
36 36
37/*
38 * Show the reason for the previous system reset.
39 */
40
41#include "at91_rstc.h"
42#include "at91_shdwc.h"
43
44static void (*at91_pm_standby)(void); 37static void (*at91_pm_standby)(void);
45 38
46static void __init show_reset_status(void)
47{
48 static char reset[] __initdata = "reset";
49
50 static char general[] __initdata = "general";
51 static char wakeup[] __initdata = "wakeup";
52 static char watchdog[] __initdata = "watchdog";
53 static char software[] __initdata = "software";
54 static char user[] __initdata = "user";
55 static char unknown[] __initdata = "unknown";
56
57 static char signal[] __initdata = "signal";
58 static char rtc[] __initdata = "rtc";
59 static char rtt[] __initdata = "rtt";
60 static char restore[] __initdata = "power-restored";
61
62 char *reason, *r2 = reset;
63 u32 reset_type, wake_type;
64
65 if (!at91_shdwc_base || !at91_rstc_base)
66 return;
67
68 reset_type = at91_rstc_read(AT91_RSTC_SR) & AT91_RSTC_RSTTYP;
69 wake_type = at91_shdwc_read(AT91_SHDW_SR);
70
71 switch (reset_type) {
72 case AT91_RSTC_RSTTYP_GENERAL:
73 reason = general;
74 break;
75 case AT91_RSTC_RSTTYP_WAKEUP:
76 /* board-specific code enabled the wakeup sources */
77 reason = wakeup;
78
79 /* "wakeup signal" */
80 if (wake_type & AT91_SHDW_WAKEUP0)
81 r2 = signal;
82 else {
83 r2 = reason;
84 if (wake_type & AT91_SHDW_RTTWK) /* rtt wakeup */
85 reason = rtt;
86 else if (wake_type & AT91_SHDW_RTCWK) /* rtc wakeup */
87 reason = rtc;
88 else if (wake_type == 0) /* power-restored wakeup */
89 reason = restore;
90 else /* unknown wakeup */
91 reason = unknown;
92 }
93 break;
94 case AT91_RSTC_RSTTYP_WATCHDOG:
95 reason = watchdog;
96 break;
97 case AT91_RSTC_RSTTYP_SOFTWARE:
98 reason = software;
99 break;
100 case AT91_RSTC_RSTTYP_USER:
101 reason = user;
102 break;
103 default:
104 reason = unknown;
105 break;
106 }
107 pr_info("AT91: Starting after %s %s\n", reason, r2);
108}
109
110static int at91_pm_valid_state(suspend_state_t state) 39static int at91_pm_valid_state(suspend_state_t state)
111{ 40{
112 switch (state) { 41 switch (state) {
@@ -206,16 +135,19 @@ static int at91_pm_enter(suspend_state_t state)
206 at91_pinctrl_gpio_suspend(); 135 at91_pinctrl_gpio_suspend();
207 else 136 else
208 at91_gpio_suspend(); 137 at91_gpio_suspend();
209 at91_irq_suspend();
210 138
211 pr_debug("AT91: PM - wake mask %08x, pm state %d\n", 139 if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base) {
212 /* remember all the always-wake irqs */ 140 at91_irq_suspend();
213 (at91_pmc_read(AT91_PMC_PCSR) 141
214 | (1 << AT91_ID_FIQ) 142 pr_debug("AT91: PM - wake mask %08x, pm state %d\n",
215 | (1 << AT91_ID_SYS) 143 /* remember all the always-wake irqs */
216 | (at91_get_extern_irq())) 144 (at91_pmc_read(AT91_PMC_PCSR)
217 & at91_aic_read(AT91_AIC_IMR), 145 | (1 << AT91_ID_FIQ)
218 state); 146 | (1 << AT91_ID_SYS)
147 | (at91_get_extern_irq()))
148 & at91_aic_read(AT91_AIC_IMR),
149 state);
150 }
219 151
220 switch (state) { 152 switch (state) {
221 /* 153 /*
@@ -280,12 +212,17 @@ static int at91_pm_enter(suspend_state_t state)
280 goto error; 212 goto error;
281 } 213 }
282 214
283 pr_debug("AT91: PM - wakeup %08x\n", 215 if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base)
284 at91_aic_read(AT91_AIC_IPR) & at91_aic_read(AT91_AIC_IMR)); 216 pr_debug("AT91: PM - wakeup %08x\n",
217 at91_aic_read(AT91_AIC_IPR) &
218 at91_aic_read(AT91_AIC_IMR));
285 219
286error: 220error:
287 target_state = PM_SUSPEND_ON; 221 target_state = PM_SUSPEND_ON;
288 at91_irq_resume(); 222
223 if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base)
224 at91_irq_resume();
225
289 if (of_have_populated_dt()) 226 if (of_have_populated_dt())
290 at91_pinctrl_gpio_resume(); 227 at91_pinctrl_gpio_resume();
291 else 228 else
@@ -338,7 +275,6 @@ static int __init at91_pm_init(void)
338 275
339 suspend_set_ops(&at91_pm_ops); 276 suspend_set_ops(&at91_pm_ops);
340 277
341 show_reset_status();
342 return 0; 278 return 0;
343} 279}
344arch_initcall(at91_pm_init); 280arch_initcall(at91_pm_init);
diff --git a/arch/arm/mach-at91/sama5d4.c b/arch/arm/mach-at91/sama5d4.c
new file mode 100644
index 000000000000..7638509639f4
--- /dev/null
+++ b/arch/arm/mach-at91/sama5d4.c
@@ -0,0 +1,64 @@
1/*
2 * Chip-specific setup code for the SAMA5D4 family
3 *
4 * Copyright (C) 2013 Atmel Corporation,
5 * Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10#include <linux/module.h>
11#include <linux/dma-mapping.h>
12#include <linux/clk/at91_pmc.h>
13
14#include <asm/irq.h>
15#include <asm/mach/arch.h>
16#include <asm/mach/map.h>
17#include <mach/sama5d4.h>
18#include <mach/cpu.h>
19#include <mach/hardware.h>
20
21#include "soc.h"
22#include "generic.h"
23#include "sam9_smc.h"
24
25/* --------------------------------------------------------------------
26 * Processor initialization
27 * -------------------------------------------------------------------- */
28static struct map_desc at91_io_desc[] __initdata = {
29 {
30 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC),
31 .pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC),
32 .length = SZ_512,
33 .type = MT_DEVICE,
34 },
35 {
36 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC),
37 .pfn = __phys_to_pfn(SAMA5D4_BASE_PMC),
38 .length = SZ_512,
39 .type = MT_DEVICE,
40 },
41 { /* On sama5d4, we use USART3 as serial console */
42 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3),
43 .pfn = __phys_to_pfn(SAMA5D4_BASE_USART3),
44 .length = SZ_256,
45 .type = MT_DEVICE,
46 },
47 { /* A bunch of peripheral with fine grained IO space */
48 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2),
49 .pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2),
50 .length = SZ_2K,
51 .type = MT_DEVICE,
52 },
53};
54
55
56static void __init sama5d4_map_io(void)
57{
58 iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc));
59 at91_init_sram(0, SAMA5D4_NS_SRAM_BASE, SAMA5D4_NS_SRAM_SIZE);
60}
61
62AT91_SOC_START(sama5d4)
63 .map_io = sama5d4_map_io,
64AT91_SOC_END
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index f7a07a58ebb6..961079250b83 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -5,6 +5,8 @@
5 * Under GPLv2 5 * Under GPLv2
6 */ 6 */
7 7
8#define pr_fmt(fmt) "AT91: " fmt
9
8#include <linux/module.h> 10#include <linux/module.h>
9#include <linux/io.h> 11#include <linux/io.h>
10#include <linux/mm.h> 12#include <linux/mm.h>
@@ -20,7 +22,6 @@
20#include <mach/cpu.h> 22#include <mach/cpu.h>
21#include <mach/at91_dbgu.h> 23#include <mach/at91_dbgu.h>
22 24
23#include "at91_shdwc.h"
24#include "soc.h" 25#include "soc.h"
25#include "generic.h" 26#include "generic.h"
26#include "pm.h" 27#include "pm.h"
@@ -37,7 +38,7 @@ void __init at91rm9200_set_type(int type)
37 else 38 else
38 at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA; 39 at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
39 40
40 pr_info("AT91: filled in soc subtype: %s\n", 41 pr_info("filled in soc subtype: %s\n",
41 at91_get_soc_subtype(&at91_soc_initdata)); 42 at91_get_soc_subtype(&at91_soc_initdata));
42} 43}
43 44
@@ -49,7 +50,8 @@ void __init at91_init_irq_default(void)
49void __init at91_init_interrupts(unsigned int *priority) 50void __init at91_init_interrupts(unsigned int *priority)
50{ 51{
51 /* Initialize the AIC interrupt controller */ 52 /* Initialize the AIC interrupt controller */
52 at91_aic_init(priority, at91_boot_soc.extern_irq); 53 if (IS_ENABLED(CONFIG_OLD_IRQ_AT91))
54 at91_aic_init(priority, at91_boot_soc.extern_irq);
53 55
54 /* Enable GPIO interrupts */ 56 /* Enable GPIO interrupts */
55 at91_gpio_irq_setup(); 57 at91_gpio_irq_setup();
@@ -66,7 +68,7 @@ void __init at91_ioremap_ramc(int id, u32 addr, u32 size)
66 } 68 }
67 at91_ramc_base[id] = ioremap(addr, size); 69 at91_ramc_base[id] = ioremap(addr, size);
68 if (!at91_ramc_base[id]) 70 if (!at91_ramc_base[id])
69 panic("Impossible to ioremap ramc.%d 0x%x\n", id, addr); 71 panic(pr_fmt("Impossible to ioremap ramc.%d 0x%x\n"), id, addr);
70} 72}
71 73
72static struct map_desc sram_desc[2] __initdata; 74static struct map_desc sram_desc[2] __initdata;
@@ -83,7 +85,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
83 desc->length = length; 85 desc->length = length;
84 desc->type = MT_MEMORY_RWX_NONCACHED; 86 desc->type = MT_MEMORY_RWX_NONCACHED;
85 87
86 pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n", 88 pr_info("sram at 0x%lx of 0x%x mapped at 0x%lx\n",
87 base, length, desc->virtual); 89 base, length, desc->virtual);
88 90
89 iotable_init(desc, 1); 91 iotable_init(desc, 1);
@@ -96,6 +98,13 @@ static struct map_desc at91_io_desc __initdata __maybe_unused = {
96 .type = MT_DEVICE, 98 .type = MT_DEVICE,
97}; 99};
98 100
101static struct map_desc at91_alt_io_desc __initdata __maybe_unused = {
102 .virtual = (unsigned long)AT91_ALT_VA_BASE_SYS,
103 .pfn = __phys_to_pfn(AT91_ALT_BASE_SYS),
104 .length = 24 * SZ_1K,
105 .type = MT_DEVICE,
106};
107
99static void __init soc_detect(u32 dbgu_base) 108static void __init soc_detect(u32 dbgu_base)
100{ 109{
101 u32 cidr, socid; 110 u32 cidr, socid;
@@ -158,9 +167,12 @@ static void __init soc_detect(u32 dbgu_base)
158 at91_boot_soc = at91sam9n12_soc; 167 at91_boot_soc = at91sam9n12_soc;
159 break; 168 break;
160 169
161 case ARCH_ID_SAMA5D3: 170 case ARCH_ID_SAMA5:
162 at91_soc_initdata.type = AT91_SOC_SAMA5D3; 171 at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
163 at91_boot_soc = sama5d3_soc; 172 if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) {
173 at91_soc_initdata.type = AT91_SOC_SAMA5D3;
174 at91_boot_soc = sama5d3_soc;
175 }
164 break; 176 break;
165 } 177 }
166 178
@@ -183,7 +195,8 @@ static void __init soc_detect(u32 dbgu_base)
183 at91_soc_initdata.cidr = cidr; 195 at91_soc_initdata.cidr = cidr;
184 196
185 /* sub version of soc */ 197 /* sub version of soc */
186 at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID); 198 if (!at91_soc_initdata.exid)
199 at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
187 200
188 if (at91_soc_initdata.type == AT91_SOC_SAM9G45) { 201 if (at91_soc_initdata.type == AT91_SOC_SAM9G45) {
189 switch (at91_soc_initdata.exid) { 202 switch (at91_soc_initdata.exid) {
@@ -240,6 +253,54 @@ static void __init soc_detect(u32 dbgu_base)
240 } 253 }
241} 254}
242 255
256static void __init alt_soc_detect(u32 dbgu_base)
257{
258 u32 cidr, socid;
259
260 /* SoC ID */
261 cidr = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_CIDR);
262 socid = cidr & ~AT91_CIDR_VERSION;
263
264 switch (socid) {
265 case ARCH_ID_SAMA5:
266 at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
267 if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) {
268 at91_soc_initdata.type = AT91_SOC_SAMA5D3;
269 at91_boot_soc = sama5d3_soc;
270 } else if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D4) {
271 at91_soc_initdata.type = AT91_SOC_SAMA5D4;
272 at91_boot_soc = sama5d4_soc;
273 }
274 break;
275 }
276
277 if (!at91_soc_is_detected())
278 return;
279
280 at91_soc_initdata.cidr = cidr;
281
282 /* sub version of soc */
283 if (!at91_soc_initdata.exid)
284 at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
285
286 if (at91_soc_initdata.type == AT91_SOC_SAMA5D4) {
287 switch (at91_soc_initdata.exid) {
288 case ARCH_EXID_SAMA5D41:
289 at91_soc_initdata.subtype = AT91_SOC_SAMA5D41;
290 break;
291 case ARCH_EXID_SAMA5D42:
292 at91_soc_initdata.subtype = AT91_SOC_SAMA5D42;
293 break;
294 case ARCH_EXID_SAMA5D43:
295 at91_soc_initdata.subtype = AT91_SOC_SAMA5D43;
296 break;
297 case ARCH_EXID_SAMA5D44:
298 at91_soc_initdata.subtype = AT91_SOC_SAMA5D44;
299 break;
300 }
301 }
302}
303
243static const char *soc_name[] = { 304static const char *soc_name[] = {
244 [AT91_SOC_RM9200] = "at91rm9200", 305 [AT91_SOC_RM9200] = "at91rm9200",
245 [AT91_SOC_SAM9260] = "at91sam9260", 306 [AT91_SOC_SAM9260] = "at91sam9260",
@@ -252,6 +313,7 @@ static const char *soc_name[] = {
252 [AT91_SOC_SAM9X5] = "at91sam9x5", 313 [AT91_SOC_SAM9X5] = "at91sam9x5",
253 [AT91_SOC_SAM9N12] = "at91sam9n12", 314 [AT91_SOC_SAM9N12] = "at91sam9n12",
254 [AT91_SOC_SAMA5D3] = "sama5d3", 315 [AT91_SOC_SAMA5D3] = "sama5d3",
316 [AT91_SOC_SAMA5D4] = "sama5d4",
255 [AT91_SOC_UNKNOWN] = "Unknown", 317 [AT91_SOC_UNKNOWN] = "Unknown",
256}; 318};
257 319
@@ -279,6 +341,10 @@ static const char *soc_subtype_name[] = {
279 [AT91_SOC_SAMA5D34] = "sama5d34", 341 [AT91_SOC_SAMA5D34] = "sama5d34",
280 [AT91_SOC_SAMA5D35] = "sama5d35", 342 [AT91_SOC_SAMA5D35] = "sama5d35",
281 [AT91_SOC_SAMA5D36] = "sama5d36", 343 [AT91_SOC_SAMA5D36] = "sama5d36",
344 [AT91_SOC_SAMA5D41] = "sama5d41",
345 [AT91_SOC_SAMA5D42] = "sama5d42",
346 [AT91_SOC_SAMA5D43] = "sama5d43",
347 [AT91_SOC_SAMA5D44] = "sama5d44",
282 [AT91_SOC_SUBTYPE_NONE] = "None", 348 [AT91_SOC_SUBTYPE_NONE] = "None",
283 [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown", 349 [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown",
284}; 350};
@@ -302,43 +368,44 @@ void __init at91_map_io(void)
302 soc_detect(AT91_BASE_DBGU1); 368 soc_detect(AT91_BASE_DBGU1);
303 369
304 if (!at91_soc_is_detected()) 370 if (!at91_soc_is_detected())
305 panic("AT91: Impossible to detect the SOC type"); 371 panic(pr_fmt("Impossible to detect the SOC type"));
306 372
307 pr_info("AT91: Detected soc type: %s\n", 373 pr_info("Detected soc type: %s\n",
308 at91_get_soc_type(&at91_soc_initdata)); 374 at91_get_soc_type(&at91_soc_initdata));
309 if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE) 375 if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE)
310 pr_info("AT91: Detected soc subtype: %s\n", 376 pr_info("Detected soc subtype: %s\n",
311 at91_get_soc_subtype(&at91_soc_initdata)); 377 at91_get_soc_subtype(&at91_soc_initdata));
312 378
313 if (!at91_soc_is_enabled()) 379 if (!at91_soc_is_enabled())
314 panic("AT91: Soc not enabled"); 380 panic(pr_fmt("Soc not enabled"));
315 381
316 if (at91_boot_soc.map_io) 382 if (at91_boot_soc.map_io)
317 at91_boot_soc.map_io(); 383 at91_boot_soc.map_io();
318} 384}
319 385
320void __iomem *at91_shdwc_base = NULL; 386void __init at91_alt_map_io(void)
321
322static void at91sam9_poweroff(void)
323{ 387{
324 at91_shdwc_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); 388 /* Map peripherals */
325} 389 iotable_init(&at91_alt_io_desc, 1);
326 390
327void __init at91_ioremap_shdwc(u32 base_addr) 391 at91_soc_initdata.type = AT91_SOC_UNKNOWN;
328{ 392 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_UNKNOWN;
329 at91_shdwc_base = ioremap(base_addr, 16);
330 if (!at91_shdwc_base)
331 panic("Impossible to ioremap at91_shdwc_base\n");
332 pm_power_off = at91sam9_poweroff;
333}
334 393
335void __iomem *at91_rstc_base; 394 alt_soc_detect(AT91_BASE_DBGU2);
395 if (!at91_soc_is_detected())
396 panic("AT91: Impossible to detect the SOC type");
336 397
337void __init at91_ioremap_rstc(u32 base_addr) 398 pr_info("AT91: Detected soc type: %s\n",
338{ 399 at91_get_soc_type(&at91_soc_initdata));
339 at91_rstc_base = ioremap(base_addr, 16); 400 if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE)
340 if (!at91_rstc_base) 401 pr_info("AT91: Detected soc subtype: %s\n",
341 panic("Impossible to ioremap at91_rstc_base\n"); 402 at91_get_soc_subtype(&at91_soc_initdata));
403
404 if (!at91_soc_is_enabled())
405 panic("AT91: Soc not enabled");
406
407 if (at91_boot_soc.map_io)
408 at91_boot_soc.map_io();
342} 409}
343 410
344void __iomem *at91_matrix_base; 411void __iomem *at91_matrix_base;
@@ -348,42 +415,15 @@ void __init at91_ioremap_matrix(u32 base_addr)
348{ 415{
349 at91_matrix_base = ioremap(base_addr, 512); 416 at91_matrix_base = ioremap(base_addr, 512);
350 if (!at91_matrix_base) 417 if (!at91_matrix_base)
351 panic("Impossible to ioremap at91_matrix_base\n"); 418 panic(pr_fmt("Impossible to ioremap at91_matrix_base\n"));
352} 419}
353 420
354#if defined(CONFIG_OF) && !defined(CONFIG_ARCH_AT91X40) 421#if defined(CONFIG_OF) && !defined(CONFIG_ARCH_AT91X40)
355static struct of_device_id rstc_ids[] = {
356 { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9_alt_restart },
357 { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart },
358 { /*sentinel*/ }
359};
360
361static void at91_dt_rstc(void)
362{
363 struct device_node *np;
364 const struct of_device_id *of_id;
365
366 np = of_find_matching_node(NULL, rstc_ids);
367 if (!np)
368 panic("unable to find compatible rstc node in dtb\n");
369
370 at91_rstc_base = of_iomap(np, 0);
371 if (!at91_rstc_base)
372 panic("unable to map rstc cpu registers\n");
373
374 of_id = of_match_node(rstc_ids, np);
375 if (!of_id)
376 panic("AT91: rtsc no restart function available\n");
377
378 arm_pm_restart = of_id->data;
379
380 of_node_put(np);
381}
382
383static struct of_device_id ramc_ids[] = { 422static struct of_device_id ramc_ids[] = {
384 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, 423 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
385 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, 424 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
386 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby }, 425 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
426 { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby },
387 { /*sentinel*/ } 427 { /*sentinel*/ }
388}; 428};
389 429
@@ -391,100 +431,29 @@ static void at91_dt_ramc(void)
391{ 431{
392 struct device_node *np; 432 struct device_node *np;
393 const struct of_device_id *of_id; 433 const struct of_device_id *of_id;
434 int idx = 0;
435 const void *standby = NULL;
394 436
395 np = of_find_matching_node(NULL, ramc_ids); 437 for_each_matching_node_and_match(np, ramc_ids, &of_id) {
396 if (!np) 438 at91_ramc_base[idx] = of_iomap(np, 0);
397 panic("unable to find compatible ram controller node in dtb\n"); 439 if (!at91_ramc_base[idx])
398 440 panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx);
399 at91_ramc_base[0] = of_iomap(np, 0);
400 if (!at91_ramc_base[0])
401 panic("unable to map ramc[0] cpu registers\n");
402 /* the controller may have 2 banks */
403 at91_ramc_base[1] = of_iomap(np, 1);
404 441
405 of_id = of_match_node(ramc_ids, np); 442 if (!standby)
406 if (!of_id) 443 standby = of_id->data;
407 pr_warn("AT91: ramc no standby function available\n");
408 else
409 at91_pm_set_standby(of_id->data);
410 444
411 of_node_put(np); 445 idx++;
412}
413
414static struct of_device_id shdwc_ids[] = {
415 { .compatible = "atmel,at91sam9260-shdwc", },
416 { .compatible = "atmel,at91sam9rl-shdwc", },
417 { .compatible = "atmel,at91sam9x5-shdwc", },
418 { /*sentinel*/ }
419};
420
421static const char *shdwc_wakeup_modes[] = {
422 [AT91_SHDW_WKMODE0_NONE] = "none",
423 [AT91_SHDW_WKMODE0_HIGH] = "high",
424 [AT91_SHDW_WKMODE0_LOW] = "low",
425 [AT91_SHDW_WKMODE0_ANYLEVEL] = "any",
426};
427
428const int at91_dtget_shdwc_wakeup_mode(struct device_node *np)
429{
430 const char *pm;
431 int err, i;
432
433 err = of_property_read_string(np, "atmel,wakeup-mode", &pm);
434 if (err < 0)
435 return AT91_SHDW_WKMODE0_ANYLEVEL;
436
437 for (i = 0; i < ARRAY_SIZE(shdwc_wakeup_modes); i++)
438 if (!strcasecmp(pm, shdwc_wakeup_modes[i]))
439 return i;
440
441 return -ENODEV;
442}
443
444static void at91_dt_shdwc(void)
445{
446 struct device_node *np;
447 int wakeup_mode;
448 u32 reg;
449 u32 mode = 0;
450
451 np = of_find_matching_node(NULL, shdwc_ids);
452 if (!np) {
453 pr_debug("AT91: unable to find compatible shutdown (shdwc) controller node in dtb\n");
454 return;
455 } 446 }
456 447
457 at91_shdwc_base = of_iomap(np, 0); 448 if (!idx)
458 if (!at91_shdwc_base) 449 panic(pr_fmt("unable to find compatible ram controller node in dtb\n"));
459 panic("AT91: unable to map shdwc cpu registers\n");
460
461 wakeup_mode = at91_dtget_shdwc_wakeup_mode(np);
462 if (wakeup_mode < 0) {
463 pr_warn("AT91: shdwc unknown wakeup mode\n");
464 goto end;
465 }
466 450
467 if (!of_property_read_u32(np, "atmel,wakeup-counter", &reg)) { 451 if (!standby) {
468 if (reg > AT91_SHDW_CPTWK0_MAX) { 452 pr_warn("ramc no standby function available\n");
469 pr_warn("AT91: shdwc wakeup counter 0x%x > 0x%x reduce it to 0x%x\n", 453 return;
470 reg, AT91_SHDW_CPTWK0_MAX, AT91_SHDW_CPTWK0_MAX);
471 reg = AT91_SHDW_CPTWK0_MAX;
472 }
473 mode |= AT91_SHDW_CPTWK0_(reg);
474 } 454 }
475 455
476 if (of_property_read_bool(np, "atmel,wakeup-rtc-timer")) 456 at91_pm_set_standby(standby);
477 mode |= AT91_SHDW_RTCWKEN;
478
479 if (of_property_read_bool(np, "atmel,wakeup-rtt-timer"))
480 mode |= AT91_SHDW_RTTWKEN;
481
482 at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
483
484end:
485 pm_power_off = at91sam9_poweroff;
486
487 of_node_put(np);
488} 457}
489 458
490void __init at91rm9200_dt_initialize(void) 459void __init at91rm9200_dt_initialize(void)
@@ -503,9 +472,7 @@ void __init at91rm9200_dt_initialize(void)
503 472
504void __init at91_dt_initialize(void) 473void __init at91_dt_initialize(void)
505{ 474{
506 at91_dt_rstc();
507 at91_dt_ramc(); 475 at91_dt_ramc();
508 at91_dt_shdwc();
509 476
510 /* Init clock subsystem */ 477 /* Init clock subsystem */
511 at91_dt_clock_init(); 478 at91_dt_clock_init();
@@ -533,3 +500,13 @@ void __init at91_initialize(unsigned long main_clock)
533 500
534 pinctrl_provide_dummies(); 501 pinctrl_provide_dummies();
535} 502}
503
504void __init at91_register_devices(void)
505{
506 at91_boot_soc.register_devices();
507}
508
509void __init at91_init_time(void)
510{
511 at91_boot_soc.init_time();
512}
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index a1e1482c6da8..9a8fd97a8bef 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -11,7 +11,9 @@ struct at91_init_soc {
11 void (*map_io)(void); 11 void (*map_io)(void);
12 void (*ioremap_registers)(void); 12 void (*ioremap_registers)(void);
13 void (*register_clocks)(void); 13 void (*register_clocks)(void);
14 void (*register_devices)(void);
14 void (*init)(void); 15 void (*init)(void);
16 void (*init_time)(void);
15}; 17};
16 18
17extern struct at91_init_soc at91_boot_soc; 19extern struct at91_init_soc at91_boot_soc;
@@ -24,6 +26,7 @@ extern struct at91_init_soc at91sam9rl_soc;
24extern struct at91_init_soc at91sam9x5_soc; 26extern struct at91_init_soc at91sam9x5_soc;
25extern struct at91_init_soc at91sam9n12_soc; 27extern struct at91_init_soc at91sam9n12_soc;
26extern struct at91_init_soc sama5d3_soc; 28extern struct at91_init_soc sama5d3_soc;
29extern struct at91_init_soc sama5d4_soc;
27 30
28#define AT91_SOC_START(_name) \ 31#define AT91_SOC_START(_name) \
29struct at91_init_soc __initdata _name##_soc \ 32struct at91_init_soc __initdata _name##_soc \
@@ -74,3 +77,7 @@ static inline int at91_soc_is_enabled(void)
74#if !defined(CONFIG_SOC_SAMA5D3) 77#if !defined(CONFIG_SOC_SAMA5D3)
75#define sama5d3_soc at91_boot_soc 78#define sama5d3_soc at91_boot_soc
76#endif 79#endif
80
81#if !defined(CONFIG_SOC_SAMA5D4)
82#define sama5d4_soc at91_boot_soc
83#endif
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index fc938005ad39..2abad742516d 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -99,6 +99,23 @@ config ARCH_BCM_5301X
99 different SoC or with the older BCM47XX and BCM53XX based 99 different SoC or with the older BCM47XX and BCM53XX based
100 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx 100 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx
101 101
102config ARCH_BCM_63XX
103 bool "Broadcom BCM63xx DSL SoC" if ARCH_MULTI_V7
104 depends on MMU
105 select ARM_ERRATA_754322
106 select ARM_ERRATA_764369 if SMP
107 select ARM_GIC
108 select ARM_GLOBAL_TIMER
109 select CACHE_L2X0
110 select HAVE_ARM_ARCH_TIMER
111 select HAVE_ARM_TWD if SMP
112 select HAVE_ARM_SCU if SMP
113 select HAVE_SMP
114 help
115 This enables support for systems based on Broadcom DSL SoCs.
116 It currently supports the 'BCM63XX' ARM-based family, which includes
117 the BCM63138 variant.
118
102config ARCH_BRCMSTB 119config ARCH_BRCMSTB
103 bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7 120 bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7
104 depends on MMU 121 depends on MMU
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index 67c492aabf4d..300ae4b79ae6 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -34,7 +34,9 @@ obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o
34# BCM5301X 34# BCM5301X
35obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o 35obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o
36 36
37# BCM63XXx
38obj-$(CONFIG_ARCH_BCM_63XX) := bcm63xx.o
39
37ifeq ($(CONFIG_ARCH_BRCMSTB),y) 40ifeq ($(CONFIG_ARCH_BRCMSTB),y)
38obj-y += brcmstb.o 41obj-y += brcmstb.o
39obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o
40endif 42endif
diff --git a/arch/arm/mach-bcm/brcmstb.h b/arch/arm/mach-bcm/bcm63xx.c
index ec0c3d112b36..c4c66ae51308 100644
--- a/arch/arm/mach-bcm/brcmstb.h
+++ b/arch/arm/mach-bcm/bcm63xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2013-2014 Broadcom Corporation 2 * Copyright (C) 2014 Broadcom Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or 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 5 * modify it under the terms of the GNU General Public License as
@@ -11,9 +11,17 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14#ifndef __BRCMSTB_H__ 14#include <linux/of_platform.h>
15#define __BRCMSTB_H__
16 15
17void brcmstb_secondary_startup(void); 16#include <asm/mach/arch.h>
18 17
19#endif /* __BRCMSTB_H__ */ 18static const char * const bcm63xx_dt_compat[] = {
19 "brcm,bcm63138",
20 NULL
21};
22
23DT_MACHINE_START(BCM63XXX_DT, "BCM63xx DSL SoC")
24 .dt_compat = bcm63xx_dt_compat,
25 .l2c_aux_val = 0,
26 .l2c_aux_mask = ~0,
27MACHINE_END
diff --git a/arch/arm/mach-bcm/headsmp-brcmstb.S b/arch/arm/mach-bcm/headsmp-brcmstb.S
deleted file mode 100644
index 199c1ea58248..000000000000
--- a/arch/arm/mach-bcm/headsmp-brcmstb.S
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * SMP boot code for secondary CPUs
3 * Based on arch/arm/mach-tegra/headsmp.S
4 *
5 * Copyright (C) 2010 NVIDIA, Inc.
6 * Copyright (C) 2013-2014 Broadcom Corporation
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 as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <asm/assembler.h>
19#include <linux/linkage.h>
20#include <linux/init.h>
21
22 .section ".text.head", "ax"
23
24ENTRY(brcmstb_secondary_startup)
25 /*
26 * Ensure CPU is in a sane state by disabling all IRQs and switching
27 * into SVC mode.
28 */
29 setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0
30
31 bl v7_invalidate_l1
32 b secondary_startup
33ENDPROC(brcmstb_secondary_startup)
diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c
deleted file mode 100644
index af780e9c23a6..000000000000
--- a/arch/arm/mach-bcm/platsmp-brcmstb.c
+++ /dev/null
@@ -1,363 +0,0 @@
1/*
2 * Broadcom STB CPU SMP and hotplug support for ARM
3 *
4 * Copyright (C) 2013-2014 Broadcom 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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/delay.h>
17#include <linux/errno.h>
18#include <linux/init.h>
19#include <linux/io.h>
20#include <linux/of_address.h>
21#include <linux/of_platform.h>
22#include <linux/printk.h>
23#include <linux/regmap.h>
24#include <linux/smp.h>
25#include <linux/mfd/syscon.h>
26#include <linux/spinlock.h>
27
28#include <asm/cacheflush.h>
29#include <asm/cp15.h>
30#include <asm/mach-types.h>
31#include <asm/smp_plat.h>
32
33#include "brcmstb.h"
34
35enum {
36 ZONE_MAN_CLKEN_MASK = BIT(0),
37 ZONE_MAN_RESET_CNTL_MASK = BIT(1),
38 ZONE_MAN_MEM_PWR_MASK = BIT(4),
39 ZONE_RESERVED_1_MASK = BIT(5),
40 ZONE_MAN_ISO_CNTL_MASK = BIT(6),
41 ZONE_MANUAL_CONTROL_MASK = BIT(7),
42 ZONE_PWR_DN_REQ_MASK = BIT(9),
43 ZONE_PWR_UP_REQ_MASK = BIT(10),
44 ZONE_BLK_RST_ASSERT_MASK = BIT(12),
45 ZONE_PWR_OFF_STATE_MASK = BIT(25),
46 ZONE_PWR_ON_STATE_MASK = BIT(26),
47 ZONE_DPG_PWR_STATE_MASK = BIT(28),
48 ZONE_MEM_PWR_STATE_MASK = BIT(29),
49 ZONE_RESET_STATE_MASK = BIT(31),
50 CPU0_PWR_ZONE_CTRL_REG = 1,
51 CPU_RESET_CONFIG_REG = 2,
52};
53
54static void __iomem *cpubiuctrl_block;
55static void __iomem *hif_cont_block;
56static u32 cpu0_pwr_zone_ctrl_reg;
57static u32 cpu_rst_cfg_reg;
58static u32 hif_cont_reg;
59
60#ifdef CONFIG_HOTPLUG_CPU
61static DEFINE_PER_CPU_ALIGNED(int, per_cpu_sw_state);
62
63static int per_cpu_sw_state_rd(u32 cpu)
64{
65 sync_cache_r(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu)));
66 return per_cpu(per_cpu_sw_state, cpu);
67}
68
69static void per_cpu_sw_state_wr(u32 cpu, int val)
70{
71 per_cpu(per_cpu_sw_state, cpu) = val;
72 dmb();
73 sync_cache_w(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu)));
74 dsb_sev();
75}
76#else
77static inline void per_cpu_sw_state_wr(u32 cpu, int val) { }
78#endif
79
80static void __iomem *pwr_ctrl_get_base(u32 cpu)
81{
82 void __iomem *base = cpubiuctrl_block + cpu0_pwr_zone_ctrl_reg;
83 base += (cpu_logical_map(cpu) * 4);
84 return base;
85}
86
87static u32 pwr_ctrl_rd(u32 cpu)
88{
89 void __iomem *base = pwr_ctrl_get_base(cpu);
90 return readl_relaxed(base);
91}
92
93static void pwr_ctrl_wr(u32 cpu, u32 val)
94{
95 void __iomem *base = pwr_ctrl_get_base(cpu);
96 writel(val, base);
97}
98
99static void cpu_rst_cfg_set(u32 cpu, int set)
100{
101 u32 val;
102 val = readl_relaxed(cpubiuctrl_block + cpu_rst_cfg_reg);
103 if (set)
104 val |= BIT(cpu_logical_map(cpu));
105 else
106 val &= ~BIT(cpu_logical_map(cpu));
107 writel_relaxed(val, cpubiuctrl_block + cpu_rst_cfg_reg);
108}
109
110static void cpu_set_boot_addr(u32 cpu, unsigned long boot_addr)
111{
112 const int reg_ofs = cpu_logical_map(cpu) * 8;
113 writel_relaxed(0, hif_cont_block + hif_cont_reg + reg_ofs);
114 writel_relaxed(boot_addr, hif_cont_block + hif_cont_reg + 4 + reg_ofs);
115}
116
117static void brcmstb_cpu_boot(u32 cpu)
118{
119 pr_info("SMP: Booting CPU%d...\n", cpu);
120
121 /*
122 * set the reset vector to point to the secondary_startup
123 * routine
124 */
125 cpu_set_boot_addr(cpu, virt_to_phys(brcmstb_secondary_startup));
126
127 /* unhalt the cpu */
128 cpu_rst_cfg_set(cpu, 0);
129}
130
131static void brcmstb_cpu_power_on(u32 cpu)
132{
133 /*
134 * The secondary cores power was cut, so we must go through
135 * power-on initialization.
136 */
137 u32 tmp;
138
139 pr_info("SMP: Powering up CPU%d...\n", cpu);
140
141 /* Request zone power up */
142 pwr_ctrl_wr(cpu, ZONE_PWR_UP_REQ_MASK);
143
144 /* Wait for the power up FSM to complete */
145 do {
146 tmp = pwr_ctrl_rd(cpu);
147 } while (!(tmp & ZONE_PWR_ON_STATE_MASK));
148
149 per_cpu_sw_state_wr(cpu, 1);
150}
151
152static int brcmstb_cpu_get_power_state(u32 cpu)
153{
154 int tmp = pwr_ctrl_rd(cpu);
155 return (tmp & ZONE_RESET_STATE_MASK) ? 0 : 1;
156}
157
158#ifdef CONFIG_HOTPLUG_CPU
159
160static void brcmstb_cpu_die(u32 cpu)
161{
162 v7_exit_coherency_flush(all);
163
164 /* Prevent all interrupts from reaching this CPU. */
165 arch_local_irq_disable();
166
167 /*
168 * Final full barrier to ensure everything before this instruction has
169 * quiesced.
170 */
171 isb();
172 dsb();
173
174 per_cpu_sw_state_wr(cpu, 0);
175
176 /* Sit and wait to die */
177 wfi();
178
179 /* We should never get here... */
180 panic("Spurious interrupt on CPU %d received!\n", cpu);
181}
182
183static int brcmstb_cpu_kill(u32 cpu)
184{
185 u32 tmp;
186
187 pr_info("SMP: Powering down CPU%d...\n", cpu);
188
189 while (per_cpu_sw_state_rd(cpu))
190 ;
191
192 /* Program zone reset */
193 pwr_ctrl_wr(cpu, ZONE_RESET_STATE_MASK | ZONE_BLK_RST_ASSERT_MASK |
194 ZONE_PWR_DN_REQ_MASK);
195
196 /* Verify zone reset */
197 tmp = pwr_ctrl_rd(cpu);
198 if (!(tmp & ZONE_RESET_STATE_MASK))
199 pr_err("%s: Zone reset bit for CPU %d not asserted!\n",
200 __func__, cpu);
201
202 /* Wait for power down */
203 do {
204 tmp = pwr_ctrl_rd(cpu);
205 } while (!(tmp & ZONE_PWR_OFF_STATE_MASK));
206
207 /* Settle-time from Broadcom-internal DVT reference code */
208 udelay(7);
209
210 /* Assert reset on the CPU */
211 cpu_rst_cfg_set(cpu, 1);
212
213 return 1;
214}
215
216#endif /* CONFIG_HOTPLUG_CPU */
217
218static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
219{
220 int rc = 0;
221 char *name;
222 struct device_node *syscon_np = NULL;
223
224 name = "syscon-cpu";
225
226 syscon_np = of_parse_phandle(np, name, 0);
227 if (!syscon_np) {
228 pr_err("can't find phandle %s\n", name);
229 rc = -EINVAL;
230 goto cleanup;
231 }
232
233 cpubiuctrl_block = of_iomap(syscon_np, 0);
234 if (!cpubiuctrl_block) {
235 pr_err("iomap failed for cpubiuctrl_block\n");
236 rc = -EINVAL;
237 goto cleanup;
238 }
239
240 rc = of_property_read_u32_index(np, name, CPU0_PWR_ZONE_CTRL_REG,
241 &cpu0_pwr_zone_ctrl_reg);
242 if (rc) {
243 pr_err("failed to read 1st entry from %s property (%d)\n", name,
244 rc);
245 rc = -EINVAL;
246 goto cleanup;
247 }
248
249 rc = of_property_read_u32_index(np, name, CPU_RESET_CONFIG_REG,
250 &cpu_rst_cfg_reg);
251 if (rc) {
252 pr_err("failed to read 2nd entry from %s property (%d)\n", name,
253 rc);
254 rc = -EINVAL;
255 goto cleanup;
256 }
257
258cleanup:
259 if (syscon_np)
260 of_node_put(syscon_np);
261
262 return rc;
263}
264
265static int __init setup_hifcont_regs(struct device_node *np)
266{
267 int rc = 0;
268 char *name;
269 struct device_node *syscon_np = NULL;
270
271 name = "syscon-cont";
272
273 syscon_np = of_parse_phandle(np, name, 0);
274 if (!syscon_np) {
275 pr_err("can't find phandle %s\n", name);
276 rc = -EINVAL;
277 goto cleanup;
278 }
279
280 hif_cont_block = of_iomap(syscon_np, 0);
281 if (!hif_cont_block) {
282 pr_err("iomap failed for hif_cont_block\n");
283 rc = -EINVAL;
284 goto cleanup;
285 }
286
287 /* offset is at top of hif_cont_block */
288 hif_cont_reg = 0;
289
290cleanup:
291 if (syscon_np)
292 of_node_put(syscon_np);
293
294 return rc;
295}
296
297static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus)
298{
299 int rc;
300 struct device_node *np;
301 char *name;
302
303 name = "brcm,brcmstb-smpboot";
304 np = of_find_compatible_node(NULL, NULL, name);
305 if (!np) {
306 pr_err("can't find compatible node %s\n", name);
307 return;
308 }
309
310 rc = setup_hifcpubiuctrl_regs(np);
311 if (rc)
312 return;
313
314 rc = setup_hifcont_regs(np);
315 if (rc)
316 return;
317}
318
319static DEFINE_SPINLOCK(boot_lock);
320
321static void brcmstb_secondary_init(unsigned int cpu)
322{
323 /*
324 * Synchronise with the boot thread.
325 */
326 spin_lock(&boot_lock);
327 spin_unlock(&boot_lock);
328}
329
330static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle)
331{
332 /*
333 * set synchronisation state between this boot processor
334 * and the secondary one
335 */
336 spin_lock(&boot_lock);
337
338 /* Bring up power to the core if necessary */
339 if (brcmstb_cpu_get_power_state(cpu) == 0)
340 brcmstb_cpu_power_on(cpu);
341
342 brcmstb_cpu_boot(cpu);
343
344 /*
345 * now the secondary core is starting up let it run its
346 * calibrations, then wait for it to finish
347 */
348 spin_unlock(&boot_lock);
349
350 return 0;
351}
352
353static struct smp_operations brcmstb_smp_ops __initdata = {
354 .smp_prepare_cpus = brcmstb_cpu_ctrl_setup,
355 .smp_secondary_init = brcmstb_secondary_init,
356 .smp_boot_secondary = brcmstb_boot_secondary,
357#ifdef CONFIG_HOTPLUG_CPU
358 .cpu_kill = brcmstb_cpu_kill,
359 .cpu_die = brcmstb_cpu_die,
360#endif
361};
362
363CPU_METHOD_OF_DECLARE(brcmstb_smp, "brcm,brahma-b15", &brcmstb_smp_ops);
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
index fdf54d40909a..f33979784f38 100644
--- a/arch/arm/mach-clps711x/board-edb7211.c
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -14,8 +14,9 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/i2c-gpio.h> 15#include <linux/i2c-gpio.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/backlight.h>
18#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/pwm.h>
19#include <linux/pwm_backlight.h>
19#include <linux/memblock.h> 20#include <linux/memblock.h>
20 21
21#include <linux/mtd/physmap.h> 22#include <linux/mtd/physmap.h>
@@ -108,23 +109,23 @@ static struct plat_lcd_data edb7211_lcd_power_pdata = {
108 .set_power = edb7211_lcd_power_set, 109 .set_power = edb7211_lcd_power_set,
109}; 110};
110 111
111static void edb7211_lcd_backlight_set_intensity(int intensity) 112static struct pwm_lookup edb7211_pwm_lookup[] = {
112{ 113 PWM_LOOKUP("clps711x-pwm", 0, "pwm-backlight.0", NULL,
113 gpio_set_value(EDB7211_LCDBL, !!intensity); 114 0, PWM_POLARITY_NORMAL),
114 clps_writel((clps_readl(PMPCON) & 0xf0ff) | (intensity << 8), PMPCON); 115};
115}
116 116
117static struct generic_bl_info edb7211_lcd_backlight_pdata = { 117static struct platform_pwm_backlight_data pwm_bl_pdata = {
118 .name = "lcd-backlight.0", 118 .dft_brightness = 0x01,
119 .default_intensity = 0x01, 119 .max_brightness = 0x0f,
120 .max_intensity = 0x0f, 120 .enable_gpio = EDB7211_LCDBL,
121 .set_bl_intensity = edb7211_lcd_backlight_set_intensity,
122}; 121};
123 122
123static struct resource clps711x_pwm_res =
124 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + PMPCON, SZ_4);
125
124static struct gpio edb7211_gpios[] __initconst = { 126static struct gpio edb7211_gpios[] __initconst = {
125 { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, 127 { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" },
126 { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, 128 { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" },
127 { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" },
128}; 129};
129 130
130/* Reserve screen memory region at the start of main system memory. */ 131/* Reserve screen memory region at the start of main system memory. */
@@ -153,12 +154,18 @@ static void __init edb7211_init_late(void)
153 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); 154 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
154 155
155 platform_device_register(&edb7211_flash_pdev); 156 platform_device_register(&edb7211_flash_pdev);
157
156 platform_device_register_data(NULL, "platform-lcd", 0, 158 platform_device_register_data(NULL, "platform-lcd", 0,
157 &edb7211_lcd_power_pdata, 159 &edb7211_lcd_power_pdata,
158 sizeof(edb7211_lcd_power_pdata)); 160 sizeof(edb7211_lcd_power_pdata));
159 platform_device_register_data(NULL, "generic-bl", 0, 161
160 &edb7211_lcd_backlight_pdata, 162 platform_device_register_simple("clps711x-pwm", PLATFORM_DEVID_NONE,
161 sizeof(edb7211_lcd_backlight_pdata)); 163 &clps711x_pwm_res, 1);
164 pwm_add_table(edb7211_pwm_lookup, ARRAY_SIZE(edb7211_pwm_lookup));
165
166 platform_device_register_data(&platform_bus, "pwm-backlight", 0,
167 &pwm_bl_pdata, sizeof(pwm_bl_pdata));
168
162 platform_device_register_simple("video-clps711x", 0, NULL, 0); 169 platform_device_register_simple("video-clps711x", 0, NULL, 0);
163 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, 170 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
164 ARRAY_SIZE(edb7211_cs8900_resource)); 171 ARRAY_SIZE(edb7211_cs8900_resource));
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index 2a6323b15782..671acc5a3282 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -19,29 +19,17 @@
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22#include <linux/io.h> 22
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/sizes.h> 24#include <linux/sizes.h>
25#include <linux/interrupt.h>
26#include <linux/irq.h>
27#include <linux/clk.h>
28#include <linux/clkdev.h>
29#include <linux/clockchips.h>
30#include <linux/clocksource.h>
31#include <linux/clk-provider.h>
32#include <linux/sched_clock.h>
33 25
34#include <asm/mach/map.h> 26#include <asm/mach/map.h>
35#include <asm/mach/time.h>
36#include <asm/system_misc.h> 27#include <asm/system_misc.h>
37 28
38#include <mach/hardware.h> 29#include <mach/hardware.h>
39 30
40#include "common.h" 31#include "common.h"
41 32
42static struct clk *clk_pll, *clk_bus, *clk_uart, *clk_timerl, *clk_timerh,
43 *clk_tint, *clk_spi;
44
45/* 33/*
46 * This maps the generic CLPS711x registers 34 * This maps the generic CLPS711x registers
47 */ 35 */
@@ -64,129 +52,11 @@ void __init clps711x_init_irq(void)
64 clps711x_intc_init(CLPS711X_PHYS_BASE, SZ_16K); 52 clps711x_intc_init(CLPS711X_PHYS_BASE, SZ_16K);
65} 53}
66 54
67static u64 notrace clps711x_sched_clock_read(void)
68{
69 return ~readw_relaxed(CLPS711X_VIRT_BASE + TC1D);
70}
71
72static void clps711x_clockevent_set_mode(enum clock_event_mode mode,
73 struct clock_event_device *evt)
74{
75 disable_irq(IRQ_TC2OI);
76
77 switch (mode) {
78 case CLOCK_EVT_MODE_PERIODIC:
79 enable_irq(IRQ_TC2OI);
80 break;
81 case CLOCK_EVT_MODE_ONESHOT:
82 /* Not supported */
83 case CLOCK_EVT_MODE_SHUTDOWN:
84 case CLOCK_EVT_MODE_UNUSED:
85 case CLOCK_EVT_MODE_RESUME:
86 /* Left event sources disabled, no more interrupts appear */
87 break;
88 }
89}
90
91static struct clock_event_device clockevent_clps711x = {
92 .name = "clps711x-clockevent",
93 .rating = 300,
94 .features = CLOCK_EVT_FEAT_PERIODIC,
95 .set_mode = clps711x_clockevent_set_mode,
96};
97
98static irqreturn_t clps711x_timer_interrupt(int irq, void *dev_id)
99{
100 clockevent_clps711x.event_handler(&clockevent_clps711x);
101
102 return IRQ_HANDLED;
103}
104
105static struct irqaction clps711x_timer_irq = {
106 .name = "clps711x-timer",
107 .flags = IRQF_TIMER | IRQF_IRQPOLL,
108 .handler = clps711x_timer_interrupt,
109};
110
111static void add_fixed_clk(struct clk *clk, const char *name, int rate)
112{
113 clk = clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
114 clk_register_clkdev(clk, name, NULL);
115}
116
117void __init clps711x_timer_init(void) 55void __init clps711x_timer_init(void)
118{ 56{
119 int osc, ext, pll, cpu, bus, timl, timh, uart, spi; 57 clps711x_clk_init(CLPS711X_VIRT_BASE);
120 u32 tmp; 58 clps711x_clksrc_init(CLPS711X_VIRT_BASE + TC1D,
121 59 CLPS711X_VIRT_BASE + TC2D, IRQ_TC2OI);
122 osc = 3686400;
123 ext = 13000000;
124
125 tmp = clps_readl(PLLR) >> 24;
126 if (tmp)
127 pll = (osc * tmp) / 2;
128 else
129 pll = 73728000; /* Default value */
130
131 tmp = clps_readl(SYSFLG2);
132 if (tmp & SYSFLG2_CKMODE) {
133 cpu = ext;
134 bus = cpu;
135 spi = 135400;
136 pll = 0;
137 } else {
138 cpu = pll;
139 if (cpu >= 36864000)
140 bus = cpu / 2;
141 else
142 bus = 36864000 / 2;
143 spi = cpu / 576;
144 }
145
146 uart = bus / 10;
147
148 if (tmp & SYSFLG2_CKMODE) {
149 tmp = clps_readl(SYSCON2);
150 if (tmp & SYSCON2_OSTB)
151 timh = ext / 26;
152 else
153 timh = 541440;
154 } else
155 timh = DIV_ROUND_CLOSEST(cpu, 144);
156
157 timl = DIV_ROUND_CLOSEST(timh, 256);
158
159 /* All clocks are fixed */
160 add_fixed_clk(clk_pll, "pll", pll);
161 add_fixed_clk(clk_bus, "bus", bus);
162 add_fixed_clk(clk_uart, "uart", uart);
163 add_fixed_clk(clk_timerl, "timer_lf", timl);
164 add_fixed_clk(clk_timerh, "timer_hf", timh);
165 add_fixed_clk(clk_tint, "tint", 64);
166 add_fixed_clk(clk_spi, "spi", spi);
167
168 pr_info("CPU frequency set at %i Hz.\n", cpu);
169
170 /* Start Timer1 in free running mode (Low frequency) */
171 tmp = clps_readl(SYSCON1) & ~(SYSCON1_TC1S | SYSCON1_TC1M);
172 clps_writel(tmp, SYSCON1);
173
174 sched_clock_register(clps711x_sched_clock_read, 16, timl);
175
176 clocksource_mmio_init(CLPS711X_VIRT_BASE + TC1D,
177 "clps711x_clocksource", timl, 300, 16,
178 clocksource_mmio_readw_down);
179
180 /* Set Timer2 prescaler */
181 clps_writew(DIV_ROUND_CLOSEST(timh, HZ), TC2D);
182
183 /* Start Timer2 in prescale mode (High frequency)*/
184 tmp = clps_readl(SYSCON1) | SYSCON1_TC2M | SYSCON1_TC2S;
185 clps_writel(tmp, SYSCON1);
186
187 clockevents_config_and_register(&clockevent_clps711x, timh, 0, 0);
188
189 setup_irq(IRQ_TC2OI, &clps711x_timer_irq);
190} 60}
191 61
192void clps711x_restart(enum reboot_mode mode, const char *cmd) 62void clps711x_restart(enum reboot_mode mode, const char *cmd)
diff --git a/arch/arm/mach-clps711x/common.h b/arch/arm/mach-clps711x/common.h
index f88189963898..370200b26333 100644
--- a/arch/arm/mach-clps711x/common.h
+++ b/arch/arm/mach-clps711x/common.h
@@ -16,3 +16,8 @@ extern void clps711x_restart(enum reboot_mode mode, const char *cmd);
16 16
17/* drivers/irqchip/irq-clps711x.c */ 17/* drivers/irqchip/irq-clps711x.c */
18void clps711x_intc_init(phys_addr_t, resource_size_t); 18void clps711x_intc_init(phys_addr_t, resource_size_t);
19/* drivers/clk/clk-clps711x.c */
20void clps711x_clk_init(void __iomem *base);
21/* drivers/clocksource/clps711x-timer.c */
22void clps711x_clksrc_init(void __iomem *tc1_base, void __iomem *tc2_base,
23 unsigned int irq);
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c
index 0c689d3a6710..77a9617c216d 100644
--- a/arch/arm/mach-clps711x/devices.c
+++ b/arch/arm/mach-clps711x/devices.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * CLPS711X common devices definitions 2 * CLPS711X common devices definitions
3 * 3 *
4 * Author: Alexander Shiyan <shc_work@mail.ru>, 2013 4 * Author: Alexander Shiyan <shc_work@mail.ru>, 2013-2014
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
@@ -9,8 +9,15 @@
9 * (at your option) any later version. 9 * (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/io.h>
13#include <linux/of_fdt.h>
12#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/random.h>
13#include <linux/sizes.h> 16#include <linux/sizes.h>
17#include <linux/slab.h>
18#include <linux/sys_soc.h>
19
20#include <asm/system_info.h>
14 21
15#include <mach/hardware.h> 22#include <mach/hardware.h>
16 23
@@ -90,10 +97,53 @@ static void __init clps711x_add_uart(void)
90 ARRAY_SIZE(clps711x_uart2_res)); 97 ARRAY_SIZE(clps711x_uart2_res));
91}; 98};
92 99
100static void __init clps711x_soc_init(void)
101{
102 struct soc_device_attribute *soc_dev_attr;
103 struct soc_device *soc_dev;
104 void __iomem *base;
105 u32 id[5];
106
107 base = ioremap(CLPS711X_PHYS_BASE, SZ_32K);
108 if (!base)
109 return;
110
111 id[0] = readl(base + UNIQID);
112 id[1] = readl(base + RANDID0);
113 id[2] = readl(base + RANDID1);
114 id[3] = readl(base + RANDID2);
115 id[4] = readl(base + RANDID3);
116 system_rev = SYSFLG1_VERID(readl(base + SYSFLG1));
117
118 add_device_randomness(id, sizeof(id));
119
120 system_serial_low = id[0];
121
122 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
123 if (!soc_dev_attr)
124 goto out_unmap;
125
126 soc_dev_attr->machine = of_flat_dt_get_machine_name();
127 soc_dev_attr->family = "Cirrus Logic CLPS711X";
128 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%u", system_rev);
129 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%08x", id[0]);
130
131 soc_dev = soc_device_register(soc_dev_attr);
132 if (IS_ERR(soc_dev)) {
133 kfree(soc_dev_attr->revision);
134 kfree(soc_dev_attr->soc_id);
135 kfree(soc_dev_attr);
136 }
137
138out_unmap:
139 iounmap(base);
140}
141
93void __init clps711x_devices_init(void) 142void __init clps711x_devices_init(void)
94{ 143{
95 clps711x_add_cpuidle(); 144 clps711x_add_cpuidle();
96 clps711x_add_gpio(); 145 clps711x_add_gpio();
97 clps711x_add_syscon(); 146 clps711x_add_syscon();
98 clps711x_add_uart(); 147 clps711x_add_uart();
148 clps711x_soc_init();
99} 149}
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index d863d8729edc..6428bcc77e87 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -250,5 +250,6 @@ MACHINE_START(CNS3420VB, "Cavium Networks CNS3420 Validation Board")
250 .init_irq = cns3xxx_init_irq, 250 .init_irq = cns3xxx_init_irq,
251 .init_time = cns3xxx_timer_init, 251 .init_time = cns3xxx_timer_init,
252 .init_machine = cns3420_init, 252 .init_machine = cns3420_init,
253 .init_late = cns3xxx_pcie_init_late,
253 .restart = cns3xxx_restart, 254 .restart = cns3xxx_restart,
254MACHINE_END 255MACHINE_END
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
index f85449a6accd..4e9837ded96d 100644
--- a/arch/arm/mach-cns3xxx/core.c
+++ b/arch/arm/mach-cns3xxx/core.c
@@ -404,5 +404,6 @@ DT_MACHINE_START(CNS3XXX_DT, "Cavium Networks CNS3xxx")
404 .init_irq = cns3xxx_init_irq, 404 .init_irq = cns3xxx_init_irq,
405 .init_time = cns3xxx_timer_init, 405 .init_time = cns3xxx_timer_init,
406 .init_machine = cns3xxx_init, 406 .init_machine = cns3xxx_init,
407 .init_late = cns3xxx_pcie_init_late,
407 .restart = cns3xxx_restart, 408 .restart = cns3xxx_restart,
408MACHINE_END 409MACHINE_END
diff --git a/arch/arm/mach-cns3xxx/core.h b/arch/arm/mach-cns3xxx/core.h
index 5218b6198dc2..dc5df7f1e39f 100644
--- a/arch/arm/mach-cns3xxx/core.h
+++ b/arch/arm/mach-cns3xxx/core.h
@@ -21,6 +21,12 @@ void __init cns3xxx_l2x0_init(void);
21static inline void cns3xxx_l2x0_init(void) {} 21static inline void cns3xxx_l2x0_init(void) {}
22#endif /* CONFIG_CACHE_L2X0 */ 22#endif /* CONFIG_CACHE_L2X0 */
23 23
24#ifdef CONFIG_PCI
25extern void __init cns3xxx_pcie_init_late(void);
26#else
27static inline void __init cns3xxx_pcie_init_late(void) {}
28#endif
29
24void __init cns3xxx_map_io(void); 30void __init cns3xxx_map_io(void);
25void __init cns3xxx_init_irq(void); 31void __init cns3xxx_init_irq(void);
26void cns3xxx_power_off(void); 32void cns3xxx_power_off(void);
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c
index 413134c54452..45d6bd09e6ef 100644
--- a/arch/arm/mach-cns3xxx/pcie.c
+++ b/arch/arm/mach-cns3xxx/pcie.c
@@ -60,11 +60,10 @@ static void __iomem *cns3xxx_pci_cfg_base(struct pci_bus *bus,
60 struct cns3xxx_pcie *cnspci = pbus_to_cnspci(bus); 60 struct cns3xxx_pcie *cnspci = pbus_to_cnspci(bus);
61 int busno = bus->number; 61 int busno = bus->number;
62 int slot = PCI_SLOT(devfn); 62 int slot = PCI_SLOT(devfn);
63 int offset;
64 void __iomem *base; 63 void __iomem *base;
65 64
66 /* If there is no link, just show the CNS PCI bridge. */ 65 /* If there is no link, just show the CNS PCI bridge. */
67 if (!cnspci->linked && (busno > 0 || slot > 0)) 66 if (!cnspci->linked && busno > 0)
68 return NULL; 67 return NULL;
69 68
70 /* 69 /*
@@ -72,22 +71,21 @@ static void __iomem *cns3xxx_pci_cfg_base(struct pci_bus *bus,
72 * we still want to access it. For this to work, we must place 71 * we still want to access it. For this to work, we must place
73 * the first device on the same bus as the CNS PCI bridge. 72 * the first device on the same bus as the CNS PCI bridge.
74 */ 73 */
75 if (busno == 0) { /* directly connected PCIe bus */ 74 if (busno == 0) { /* internal PCIe bus, host bridge device */
76 switch (slot) { 75 if (devfn == 0) /* device# and function# are ignored by hw */
77 case 0: /* host bridge device, function 0 only */
78 base = cnspci->host_regs; 76 base = cnspci->host_regs;
79 break; 77 else
80 case 1: /* directly connected device */ 78 return NULL; /* no such device */
79
80 } else if (busno == 1) { /* directly connected PCIe device */
81 if (slot == 0) /* device# is ignored by hw */
81 base = cnspci->cfg0_regs; 82 base = cnspci->cfg0_regs;
82 break; 83 else
83 default:
84 return NULL; /* no such device */ 84 return NULL; /* no such device */
85 }
86 } else /* remote PCI bus */ 85 } else /* remote PCI bus */
87 base = cnspci->cfg1_regs; 86 base = cnspci->cfg1_regs + ((busno & 0xf) << 20);
88 87
89 offset = ((busno & 0xf) << 20) | (devfn << 12) | (where & 0xffc); 88 return base + (where & 0xffc) + (devfn << 12);
90 return base + offset;
91} 89}
92 90
93static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, 91static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
@@ -167,7 +165,7 @@ static struct pci_ops cns3xxx_pcie_ops = {
167static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 165static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
168{ 166{
169 struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev); 167 struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev);
170 int irq = cnspci->irqs[slot]; 168 int irq = cnspci->irqs[!!dev->bus->number];
171 169
172 pr_info("PCIe map irq: %04d:%02x:%02x.%02x slot %d, pin %d, irq: %d\n", 170 pr_info("PCIe map irq: %04d:%02x:%02x.%02x slot %d, pin %d, irq: %d\n",
173 pci_domain_nr(dev->bus), dev->bus->number, PCI_SLOT(dev->devfn), 171 pci_domain_nr(dev->bus), dev->bus->number, PCI_SLOT(dev->devfn),
@@ -297,15 +295,19 @@ static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci)
297 return; 295 return;
298 296
299 /* Set Device Max_Read_Request_Size to 128 byte */ 297 /* Set Device Max_Read_Request_Size to 128 byte */
300 devfn = PCI_DEVFN(1, 0); 298 bus.number = 1; /* directly connected PCIe device */
299 devfn = PCI_DEVFN(0, 0);
301 pos = pci_bus_find_capability(&bus, devfn, PCI_CAP_ID_EXP); 300 pos = pci_bus_find_capability(&bus, devfn, PCI_CAP_ID_EXP);
302 pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc); 301 pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc);
303 dc &= ~(0x3 << 12); /* Clear Device Control Register [14:12] */ 302 if (dc & PCI_EXP_DEVCTL_READRQ) {
304 pci_bus_write_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, dc); 303 dc &= ~PCI_EXP_DEVCTL_READRQ;
305 pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc); 304 pci_bus_write_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, dc);
306 if (!(dc & (0x3 << 12))) 305 pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc);
307 pr_info("PCIe: Set Device Max_Read_Request_Size to 128 byte\n"); 306 if (dc & PCI_EXP_DEVCTL_READRQ)
308 307 pr_warn("PCIe: Unable to set device Max_Read_Request_Size\n");
308 else
309 pr_info("PCIe: Max_Read_Request_Size set to 128 bytes\n");
310 }
309 /* Disable PCIe0 Interrupt Mask INTA to INTD */ 311 /* Disable PCIe0 Interrupt Mask INTA to INTD */
310 __raw_writel(~0x3FFF, MISC_PCIE_INT_MASK(port)); 312 __raw_writel(~0x3FFF, MISC_PCIE_INT_MASK(port));
311} 313}
@@ -318,7 +320,7 @@ static int cns3xxx_pcie_abort_handler(unsigned long addr, unsigned int fsr,
318 return 0; 320 return 0;
319} 321}
320 322
321static int __init cns3xxx_pcie_init(void) 323void __init cns3xxx_pcie_init_late(void)
322{ 324{
323 int i; 325 int i;
324 326
@@ -337,7 +339,4 @@ static int __init cns3xxx_pcie_init(void)
337 } 339 }
338 340
339 pci_assign_unassigned_resources(); 341 pci_assign_unassigned_resources();
340
341 return 0;
342} 342}
343device_initcall(cns3xxx_pcie_init);
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 234c5bb091f5..fa11415e906a 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -35,6 +35,7 @@
35#include <linux/platform_data/uio_pruss.h> 35#include <linux/platform_data/uio_pruss.h>
36#include <linux/regulator/machine.h> 36#include <linux/regulator/machine.h>
37#include <linux/regulator/tps6507x.h> 37#include <linux/regulator/tps6507x.h>
38#include <linux/regulator/fixed.h>
38#include <linux/spi/spi.h> 39#include <linux/spi/spi.h>
39#include <linux/spi/flash.h> 40#include <linux/spi/flash.h>
40#include <linux/wl12xx.h> 41#include <linux/wl12xx.h>
@@ -842,6 +843,16 @@ static int da850_lcd_hw_init(void)
842 return 0; 843 return 0;
843} 844}
844 845
846/* Fixed regulator support */
847static struct regulator_consumer_supply fixed_supplies[] = {
848 /* Baseboard 3.3V: 5V -> TPS73701DCQ -> 3.3V */
849 REGULATOR_SUPPLY("AVDD", "1-0018"),
850 REGULATOR_SUPPLY("DRVDD", "1-0018"),
851
852 /* Baseboard 1.8V: 5V -> TPS73701DCQ -> 1.8V */
853 REGULATOR_SUPPLY("DVDD", "1-0018"),
854};
855
845/* TPS65070 voltage regulator support */ 856/* TPS65070 voltage regulator support */
846 857
847/* 3.3V */ 858/* 3.3V */
@@ -865,6 +876,7 @@ static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
865 { 876 {
866 .supply = "dvdd3318_c", 877 .supply = "dvdd3318_c",
867 }, 878 },
879 REGULATOR_SUPPLY("IOVDD", "1-0018"),
868}; 880};
869 881
870/* 1.2V */ 882/* 1.2V */
@@ -936,6 +948,7 @@ static struct regulator_init_data tps65070_regulator_data[] = {
936 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | 948 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
937 REGULATOR_CHANGE_STATUS), 949 REGULATOR_CHANGE_STATUS),
938 .boot_on = 1, 950 .boot_on = 1,
951 .always_on = 1,
939 }, 952 },
940 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers), 953 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
941 .consumer_supplies = tps65070_dcdc2_consumers, 954 .consumer_supplies = tps65070_dcdc2_consumers,
@@ -1446,6 +1459,8 @@ static __init void da850_evm_init(void)
1446 if (ret) 1459 if (ret)
1447 pr_warn("%s: GPIO init failed: %d\n", __func__, ret); 1460 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
1448 1461
1462 regulator_register_fixed(0, fixed_supplies, ARRAY_SIZE(fixed_supplies));
1463
1449 ret = pmic_tps65070_init(); 1464 ret = pmic_tps65070_init();
1450 if (ret) 1465 if (ret)
1451 pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret); 1466 pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index ed1928740b5f..f703d82f08a8 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -46,6 +46,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
46 OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0", NULL), 46 OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0", NULL),
47 OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000, "davinci_emac.1", 47 OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000, "davinci_emac.1",
48 NULL), 48 NULL),
49 OF_DEV_AUXDATA("ti,da830-mcasp-audio", 0x01d00000, "davinci-mcasp.0", NULL),
49 {} 50 {}
50}; 51};
51 52
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 6a24e111d6e1..b89e5f35db84 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -193,7 +193,6 @@ static void __init exynos_init_late(void)
193 /* to be supported later */ 193 /* to be supported later */
194 return; 194 return;
195 195
196 pm_genpd_poweroff_unused();
197 exynos_pm_init(); 196 exynos_pm_init();
198} 197}
199 198
diff --git a/arch/arm/mach-exynos/include/mach/memory.h b/arch/arm/mach-exynos/include/mach/memory.h
deleted file mode 100644
index e19df1f18c0d..000000000000
--- a/arch/arm/mach-exynos/include/mach/memory.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS4 - Memory definitions
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_ARCH_MEMORY_H
13#define __ASM_ARCH_MEMORY_H __FILE__
14
15#define PLAT_PHYS_OFFSET UL(0x40000000)
16
17#ifndef CONFIG_ARM_LPAE
18/* Maximum of 256MiB in one bank */
19#define MAX_PHYSMEM_BITS 32
20#define SECTION_SIZE_BITS 28
21#else
22#define MAX_PHYSMEM_BITS 36
23#define SECTION_SIZE_BITS 31
24#endif
25
26#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index b2f8b60cf0e9..dc9a764a7c37 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -43,7 +43,6 @@
43 "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR\n\t" \ 43 "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR\n\t" \
44 "isb\n\t"\ 44 "isb\n\t"\
45 "bl v7_flush_dcache_"__stringify(level)"\n\t" \ 45 "bl v7_flush_dcache_"__stringify(level)"\n\t" \
46 "clrex\n\t"\
47 "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR\n\t" \ 46 "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR\n\t" \
48 "bic r0, r0, #(1 << 6) @ disable local coherency\n\t" \ 47 "bic r0, r0, #(1 << 6) @ disable local coherency\n\t" \
49 /* Dummy Load of a device register to avoid Erratum 799270 */ \ 48 /* Dummy Load of a device register to avoid Erratum 799270 */ \
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index a9f1cf759949..41ae28d69e6f 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -224,7 +224,7 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle)
224 ret = PTR_ERR(boot_reg); 224 ret = PTR_ERR(boot_reg);
225 goto fail; 225 goto fail;
226 } 226 }
227 __raw_writel(boot_addr, cpu_boot_reg(core_id)); 227 __raw_writel(boot_addr, boot_reg);
228 } 228 }
229 229
230 call_firmware_op(cpu_boot, core_id); 230 call_firmware_op(cpu_boot, core_id);
@@ -313,7 +313,7 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
313 313
314 if (IS_ERR(boot_reg)) 314 if (IS_ERR(boot_reg))
315 break; 315 break;
316 __raw_writel(boot_addr, cpu_boot_reg(core_id)); 316 __raw_writel(boot_addr, boot_reg);
317 } 317 }
318 } 318 }
319} 319}
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index fd76e1b5a471..20f267121b3e 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -105,78 +105,6 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain)
105 return exynos_pd_power(domain, false); 105 return exynos_pd_power(domain, false);
106} 106}
107 107
108static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
109 struct device *dev)
110{
111 int ret;
112
113 dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
114
115 while (1) {
116 ret = pm_genpd_add_device(&pd->pd, dev);
117 if (ret != -EAGAIN)
118 break;
119 cond_resched();
120 }
121
122 pm_genpd_dev_need_restore(dev, true);
123}
124
125static void exynos_remove_device_from_domain(struct device *dev)
126{
127 struct generic_pm_domain *genpd = dev_to_genpd(dev);
128 int ret;
129
130 dev_dbg(dev, "removing from power domain %s\n", genpd->name);
131
132 while (1) {
133 ret = pm_genpd_remove_device(genpd, dev);
134 if (ret != -EAGAIN)
135 break;
136 cond_resched();
137 }
138}
139
140static void exynos_read_domain_from_dt(struct device *dev)
141{
142 struct platform_device *pd_pdev;
143 struct exynos_pm_domain *pd;
144 struct device_node *node;
145
146 node = of_parse_phandle(dev->of_node, "samsung,power-domain", 0);
147 if (!node)
148 return;
149 pd_pdev = of_find_device_by_node(node);
150 if (!pd_pdev)
151 return;
152 pd = platform_get_drvdata(pd_pdev);
153 exynos_add_device_to_domain(pd, dev);
154}
155
156static int exynos_pm_notifier_call(struct notifier_block *nb,
157 unsigned long event, void *data)
158{
159 struct device *dev = data;
160
161 switch (event) {
162 case BUS_NOTIFY_BIND_DRIVER:
163 if (dev->of_node)
164 exynos_read_domain_from_dt(dev);
165
166 break;
167
168 case BUS_NOTIFY_UNBOUND_DRIVER:
169 exynos_remove_device_from_domain(dev);
170
171 break;
172 }
173 return NOTIFY_DONE;
174}
175
176static struct notifier_block platform_nb = {
177 .notifier_call = exynos_pm_notifier_call,
178};
179
180static __init int exynos4_pm_init_power_domain(void) 108static __init int exynos4_pm_init_power_domain(void)
181{ 109{
182 struct platform_device *pdev; 110 struct platform_device *pdev;
@@ -202,7 +130,6 @@ static __init int exynos4_pm_init_power_domain(void)
202 pd->base = of_iomap(np, 0); 130 pd->base = of_iomap(np, 0);
203 pd->pd.power_off = exynos_pd_power_off; 131 pd->pd.power_off = exynos_pd_power_off;
204 pd->pd.power_on = exynos_pd_power_on; 132 pd->pd.power_on = exynos_pd_power_on;
205 pd->pd.of_node = np;
206 133
207 pd->oscclk = clk_get(dev, "oscclk"); 134 pd->oscclk = clk_get(dev, "oscclk");
208 if (IS_ERR(pd->oscclk)) 135 if (IS_ERR(pd->oscclk))
@@ -228,15 +155,12 @@ static __init int exynos4_pm_init_power_domain(void)
228 clk_put(pd->oscclk); 155 clk_put(pd->oscclk);
229 156
230no_clk: 157no_clk:
231 platform_set_drvdata(pdev, pd);
232
233 on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN; 158 on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN;
234 159
235 pm_genpd_init(&pd->pd, NULL, !on); 160 pm_genpd_init(&pd->pd, NULL, !on);
161 of_genpd_add_provider_simple(np, &pd->pd);
236 } 162 }
237 163
238 bus_register_notifier(&platform_bus_type, &platform_nb);
239
240 return 0; 164 return 0;
241} 165}
242arch_initcall(exynos4_pm_init_power_domain); 166arch_initcall(exynos4_pm_init_power_domain);
diff --git a/arch/arm/mach-hisi/Kconfig b/arch/arm/mach-hisi/Kconfig
index 984882943f77..cd19433f76d3 100644
--- a/arch/arm/mach-hisi/Kconfig
+++ b/arch/arm/mach-hisi/Kconfig
@@ -1,6 +1,6 @@
1config ARCH_HISI 1config ARCH_HISI
2 bool "Hisilicon SoC Support" 2 bool "Hisilicon SoC Support"
3 depends on ARCH_MULTIPLATFORM 3 depends on ARCH_MULTI_V7
4 select ARM_AMBA 4 select ARM_AMBA
5 select ARM_GIC 5 select ARM_GIC
6 select ARM_TIMER_SP804 6 select ARM_TIMER_SP804
@@ -22,6 +22,15 @@ config ARCH_HI3xxx
22 help 22 help
23 Support for Hisilicon Hi36xx SoC family 23 Support for Hisilicon Hi36xx SoC family
24 24
25config ARCH_HIP04
26 bool "Hisilicon HiP04 Cortex A15 family" if ARCH_MULTI_V7
27 select ARM_ERRATA_798181 if SMP
28 select HAVE_ARM_ARCH_TIMER
29 select MCPM if SMP
30 select MCPM_QUAD_CLUSTER if SMP
31 help
32 Support for Hisilicon HiP04 SoC family
33
25config ARCH_HIX5HD2 34config ARCH_HIX5HD2
26 bool "Hisilicon X5HD2 family" if ARCH_MULTI_V7 35 bool "Hisilicon X5HD2 family" if ARCH_MULTI_V7
27 select CACHE_L2X0 36 select CACHE_L2X0
diff --git a/arch/arm/mach-hisi/Makefile b/arch/arm/mach-hisi/Makefile
index ee2506b9cde3..6b7b3033de0b 100644
--- a/arch/arm/mach-hisi/Makefile
+++ b/arch/arm/mach-hisi/Makefile
@@ -2,5 +2,8 @@
2# Makefile for Hisilicon processors family 2# Makefile for Hisilicon processors family
3# 3#
4 4
5CFLAGS_platmcpm.o := -march=armv7-a
6
5obj-y += hisilicon.o 7obj-y += hisilicon.o
8obj-$(CONFIG_MCPM) += platmcpm.o
6obj-$(CONFIG_SMP) += platsmp.o hotplug.o headsmp.o 9obj-$(CONFIG_SMP) += platsmp.o hotplug.o headsmp.o
diff --git a/arch/arm/mach-hisi/hisilicon.c b/arch/arm/mach-hisi/hisilicon.c
index 7cda6dda3cd0..7744c351bbfd 100644
--- a/arch/arm/mach-hisi/hisilicon.c
+++ b/arch/arm/mach-hisi/hisilicon.c
@@ -63,3 +63,12 @@ static const char *hix5hd2_compat[] __initconst = {
63DT_MACHINE_START(HIX5HD2_DT, "Hisilicon HIX5HD2 (Flattened Device Tree)") 63DT_MACHINE_START(HIX5HD2_DT, "Hisilicon HIX5HD2 (Flattened Device Tree)")
64 .dt_compat = hix5hd2_compat, 64 .dt_compat = hix5hd2_compat,
65MACHINE_END 65MACHINE_END
66
67static const char *hip04_compat[] __initconst = {
68 "hisilicon,hip04-d01",
69 NULL,
70};
71
72DT_MACHINE_START(HIP04, "Hisilicon HiP04 (Flattened Device Tree)")
73 .dt_compat = hip04_compat,
74MACHINE_END
diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c
new file mode 100644
index 000000000000..280f3f14f77c
--- /dev/null
+++ b/arch/arm/mach-hisi/platmcpm.c
@@ -0,0 +1,386 @@
1/*
2 * Copyright (c) 2013-2014 Linaro Ltd.
3 * Copyright (c) 2013-2014 Hisilicon Limited.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 */
9#include <linux/delay.h>
10#include <linux/io.h>
11#include <linux/memblock.h>
12#include <linux/of_address.h>
13
14#include <asm/cputype.h>
15#include <asm/cp15.h>
16#include <asm/mcpm.h>
17
18#include "core.h"
19
20/* bits definition in SC_CPU_RESET_REQ[x]/SC_CPU_RESET_DREQ[x]
21 * 1 -- unreset; 0 -- reset
22 */
23#define CORE_RESET_BIT(x) (1 << x)
24#define NEON_RESET_BIT(x) (1 << (x + 4))
25#define CORE_DEBUG_RESET_BIT(x) (1 << (x + 9))
26#define CLUSTER_L2_RESET_BIT (1 << 8)
27#define CLUSTER_DEBUG_RESET_BIT (1 << 13)
28
29/*
30 * bits definition in SC_CPU_RESET_STATUS[x]
31 * 1 -- reset status; 0 -- unreset status
32 */
33#define CORE_RESET_STATUS(x) (1 << x)
34#define NEON_RESET_STATUS(x) (1 << (x + 4))
35#define CORE_DEBUG_RESET_STATUS(x) (1 << (x + 9))
36#define CLUSTER_L2_RESET_STATUS (1 << 8)
37#define CLUSTER_DEBUG_RESET_STATUS (1 << 13)
38#define CORE_WFI_STATUS(x) (1 << (x + 16))
39#define CORE_WFE_STATUS(x) (1 << (x + 20))
40#define CORE_DEBUG_ACK(x) (1 << (x + 24))
41
42#define SC_CPU_RESET_REQ(x) (0x520 + (x << 3)) /* reset */
43#define SC_CPU_RESET_DREQ(x) (0x524 + (x << 3)) /* unreset */
44#define SC_CPU_RESET_STATUS(x) (0x1520 + (x << 3))
45
46#define FAB_SF_MODE 0x0c
47#define FAB_SF_INVLD 0x10
48
49/* bits definition in FB_SF_INVLD */
50#define FB_SF_INVLD_START (1 << 8)
51
52#define HIP04_MAX_CLUSTERS 4
53#define HIP04_MAX_CPUS_PER_CLUSTER 4
54
55#define POLL_MSEC 10
56#define TIMEOUT_MSEC 1000
57
58static void __iomem *sysctrl, *fabric;
59static int hip04_cpu_table[HIP04_MAX_CLUSTERS][HIP04_MAX_CPUS_PER_CLUSTER];
60static DEFINE_SPINLOCK(boot_lock);
61static u32 fabric_phys_addr;
62/*
63 * [0]: bootwrapper physical address
64 * [1]: bootwrapper size
65 * [2]: relocation address
66 * [3]: relocation size
67 */
68static u32 hip04_boot_method[4];
69
70static bool hip04_cluster_is_down(unsigned int cluster)
71{
72 int i;
73
74 for (i = 0; i < HIP04_MAX_CPUS_PER_CLUSTER; i++)
75 if (hip04_cpu_table[cluster][i])
76 return false;
77 return true;
78}
79
80static void hip04_set_snoop_filter(unsigned int cluster, unsigned int on)
81{
82 unsigned long data;
83
84 if (!fabric)
85 BUG();
86 data = readl_relaxed(fabric + FAB_SF_MODE);
87 if (on)
88 data |= 1 << cluster;
89 else
90 data &= ~(1 << cluster);
91 writel_relaxed(data, fabric + FAB_SF_MODE);
92 do {
93 cpu_relax();
94 } while (data != readl_relaxed(fabric + FAB_SF_MODE));
95}
96
97static int hip04_mcpm_power_up(unsigned int cpu, unsigned int cluster)
98{
99 unsigned long data;
100 void __iomem *sys_dreq, *sys_status;
101
102 if (!sysctrl)
103 return -ENODEV;
104 if (cluster >= HIP04_MAX_CLUSTERS || cpu >= HIP04_MAX_CPUS_PER_CLUSTER)
105 return -EINVAL;
106
107 spin_lock_irq(&boot_lock);
108
109 if (hip04_cpu_table[cluster][cpu])
110 goto out;
111
112 sys_dreq = sysctrl + SC_CPU_RESET_DREQ(cluster);
113 sys_status = sysctrl + SC_CPU_RESET_STATUS(cluster);
114 if (hip04_cluster_is_down(cluster)) {
115 data = CLUSTER_DEBUG_RESET_BIT;
116 writel_relaxed(data, sys_dreq);
117 do {
118 cpu_relax();
119 data = readl_relaxed(sys_status);
120 } while (data & CLUSTER_DEBUG_RESET_STATUS);
121 }
122
123 data = CORE_RESET_BIT(cpu) | NEON_RESET_BIT(cpu) | \
124 CORE_DEBUG_RESET_BIT(cpu);
125 writel_relaxed(data, sys_dreq);
126 do {
127 cpu_relax();
128 } while (data == readl_relaxed(sys_status));
129 /*
130 * We may fail to power up core again without this delay.
131 * It's not mentioned in document. It's found by test.
132 */
133 udelay(20);
134out:
135 hip04_cpu_table[cluster][cpu]++;
136 spin_unlock_irq(&boot_lock);
137
138 return 0;
139}
140
141static void hip04_mcpm_power_down(void)
142{
143 unsigned int mpidr, cpu, cluster;
144 bool skip_wfi = false, last_man = false;
145
146 mpidr = read_cpuid_mpidr();
147 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
148 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
149
150 __mcpm_cpu_going_down(cpu, cluster);
151
152 spin_lock(&boot_lock);
153 BUG_ON(__mcpm_cluster_state(cluster) != CLUSTER_UP);
154 hip04_cpu_table[cluster][cpu]--;
155 if (hip04_cpu_table[cluster][cpu] == 1) {
156 /* A power_up request went ahead of us. */
157 skip_wfi = true;
158 } else if (hip04_cpu_table[cluster][cpu] > 1) {
159 pr_err("Cluster %d CPU%d boots multiple times\n", cluster, cpu);
160 BUG();
161 }
162
163 last_man = hip04_cluster_is_down(cluster);
164 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) {
165 spin_unlock(&boot_lock);
166 /* Since it's Cortex A15, disable L2 prefetching. */
167 asm volatile(
168 "mcr p15, 1, %0, c15, c0, 3 \n\t"
169 "isb \n\t"
170 "dsb "
171 : : "r" (0x400) );
172 v7_exit_coherency_flush(all);
173 hip04_set_snoop_filter(cluster, 0);
174 __mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN);
175 } else {
176 spin_unlock(&boot_lock);
177 v7_exit_coherency_flush(louis);
178 }
179
180 __mcpm_cpu_down(cpu, cluster);
181
182 if (!skip_wfi)
183 wfi();
184}
185
186static int hip04_mcpm_wait_for_powerdown(unsigned int cpu, unsigned int cluster)
187{
188 unsigned int data, tries, count;
189 int ret = -ETIMEDOUT;
190
191 BUG_ON(cluster >= HIP04_MAX_CLUSTERS ||
192 cpu >= HIP04_MAX_CPUS_PER_CLUSTER);
193
194 count = TIMEOUT_MSEC / POLL_MSEC;
195 spin_lock_irq(&boot_lock);
196 for (tries = 0; tries < count; tries++) {
197 if (hip04_cpu_table[cluster][cpu]) {
198 ret = -EBUSY;
199 goto err;
200 }
201 cpu_relax();
202 data = readl_relaxed(sysctrl + SC_CPU_RESET_STATUS(cluster));
203 if (data & CORE_WFI_STATUS(cpu))
204 break;
205 spin_unlock_irq(&boot_lock);
206 /* Wait for clean L2 when the whole cluster is down. */
207 msleep(POLL_MSEC);
208 spin_lock_irq(&boot_lock);
209 }
210 if (tries >= count)
211 goto err;
212 data = CORE_RESET_BIT(cpu) | NEON_RESET_BIT(cpu) | \
213 CORE_DEBUG_RESET_BIT(cpu);
214 writel_relaxed(data, sysctrl + SC_CPU_RESET_REQ(cluster));
215 for (tries = 0; tries < count; tries++) {
216 cpu_relax();
217 data = readl_relaxed(sysctrl + SC_CPU_RESET_STATUS(cluster));
218 if (data & CORE_RESET_STATUS(cpu))
219 break;
220 }
221 if (tries >= count)
222 goto err;
223 spin_unlock_irq(&boot_lock);
224 return 0;
225err:
226 spin_unlock_irq(&boot_lock);
227 return ret;
228}
229
230static void hip04_mcpm_powered_up(void)
231{
232 unsigned int mpidr, cpu, cluster;
233
234 mpidr = read_cpuid_mpidr();
235 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
236 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
237
238 spin_lock(&boot_lock);
239 if (!hip04_cpu_table[cluster][cpu])
240 hip04_cpu_table[cluster][cpu] = 1;
241 spin_unlock(&boot_lock);
242}
243
244static void __naked hip04_mcpm_power_up_setup(unsigned int affinity_level)
245{
246 asm volatile (" \n"
247" cmp r0, #0 \n"
248" bxeq lr \n"
249 /* calculate fabric phys address */
250" adr r2, 2f \n"
251" ldmia r2, {r1, r3} \n"
252" sub r0, r2, r1 \n"
253" ldr r2, [r0, r3] \n"
254 /* get cluster id from MPIDR */
255" mrc p15, 0, r0, c0, c0, 5 \n"
256" ubfx r1, r0, #8, #8 \n"
257 /* 1 << cluster id */
258" mov r0, #1 \n"
259" mov r3, r0, lsl r1 \n"
260" ldr r0, [r2, #"__stringify(FAB_SF_MODE)"] \n"
261" tst r0, r3 \n"
262" bxne lr \n"
263" orr r1, r0, r3 \n"
264" str r1, [r2, #"__stringify(FAB_SF_MODE)"] \n"
265"1: ldr r0, [r2, #"__stringify(FAB_SF_MODE)"] \n"
266" tst r0, r3 \n"
267" beq 1b \n"
268" bx lr \n"
269
270" .align 2 \n"
271"2: .word . \n"
272" .word fabric_phys_addr \n"
273 );
274}
275
276static const struct mcpm_platform_ops hip04_mcpm_ops = {
277 .power_up = hip04_mcpm_power_up,
278 .power_down = hip04_mcpm_power_down,
279 .wait_for_powerdown = hip04_mcpm_wait_for_powerdown,
280 .powered_up = hip04_mcpm_powered_up,
281};
282
283static bool __init hip04_cpu_table_init(void)
284{
285 unsigned int mpidr, cpu, cluster;
286
287 mpidr = read_cpuid_mpidr();
288 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
289 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
290
291 if (cluster >= HIP04_MAX_CLUSTERS ||
292 cpu >= HIP04_MAX_CPUS_PER_CLUSTER) {
293 pr_err("%s: boot CPU is out of bound!\n", __func__);
294 return false;
295 }
296 hip04_set_snoop_filter(cluster, 1);
297 hip04_cpu_table[cluster][cpu] = 1;
298 return true;
299}
300
301static int __init hip04_mcpm_init(void)
302{
303 struct device_node *np, *np_sctl, *np_fab;
304 struct resource fab_res;
305 void __iomem *relocation;
306 int ret = -ENODEV;
307
308 np = of_find_compatible_node(NULL, NULL, "hisilicon,hip04-bootwrapper");
309 if (!np)
310 goto err;
311 ret = of_property_read_u32_array(np, "boot-method",
312 &hip04_boot_method[0], 4);
313 if (ret)
314 goto err;
315 np_sctl = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
316 if (!np_sctl)
317 goto err;
318 np_fab = of_find_compatible_node(NULL, NULL, "hisilicon,hip04-fabric");
319 if (!np_fab)
320 goto err;
321
322 ret = memblock_reserve(hip04_boot_method[0], hip04_boot_method[1]);
323 if (ret)
324 goto err;
325
326 relocation = ioremap(hip04_boot_method[2], hip04_boot_method[3]);
327 if (!relocation) {
328 pr_err("failed to map relocation space\n");
329 ret = -ENOMEM;
330 goto err_reloc;
331 }
332 sysctrl = of_iomap(np_sctl, 0);
333 if (!sysctrl) {
334 pr_err("failed to get sysctrl base\n");
335 ret = -ENOMEM;
336 goto err_sysctrl;
337 }
338 ret = of_address_to_resource(np_fab, 0, &fab_res);
339 if (ret) {
340 pr_err("failed to get fabric base phys\n");
341 goto err_fabric;
342 }
343 fabric_phys_addr = fab_res.start;
344 sync_cache_w(&fabric_phys_addr);
345 fabric = of_iomap(np_fab, 0);
346 if (!fabric) {
347 pr_err("failed to get fabric base\n");
348 ret = -ENOMEM;
349 goto err_fabric;
350 }
351
352 if (!hip04_cpu_table_init()) {
353 ret = -EINVAL;
354 goto err_table;
355 }
356 ret = mcpm_platform_register(&hip04_mcpm_ops);
357 if (ret) {
358 goto err_table;
359 }
360
361 /*
362 * Fill the instruction address that is used after secondary core
363 * out of reset.
364 */
365 writel_relaxed(hip04_boot_method[0], relocation);
366 writel_relaxed(0xa5a5a5a5, relocation + 4); /* magic number */
367 writel_relaxed(virt_to_phys(mcpm_entry_point), relocation + 8);
368 writel_relaxed(0, relocation + 12);
369 iounmap(relocation);
370
371 mcpm_sync_init(hip04_mcpm_power_up_setup);
372 mcpm_smp_set_ops();
373 pr_info("HiP04 MCPM initialized\n");
374 return ret;
375err_table:
376 iounmap(fabric);
377err_fabric:
378 iounmap(sysctrl);
379err_sysctrl:
380 iounmap(relocation);
381err_reloc:
382 memblock_free(hip04_boot_method[0], hip04_boot_method[1]);
383err:
384 return ret;
385}
386early_initcall(hip04_mcpm_init);
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 9de84a215abd..11b2957f792b 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -69,6 +69,7 @@ config SOC_IMX1
69 select CPU_ARM920T 69 select CPU_ARM920T
70 select IMX_HAVE_IOMUX_V1 70 select IMX_HAVE_IOMUX_V1
71 select MXC_AVIC 71 select MXC_AVIC
72 select PINCTRL_IMX1
72 73
73config SOC_IMX21 74config SOC_IMX21
74 bool 75 bool
@@ -85,7 +86,6 @@ config SOC_IMX25
85 86
86config SOC_IMX27 87config SOC_IMX27
87 bool 88 bool
88 select ARCH_HAS_OPP
89 select CPU_ARM926T 89 select CPU_ARM926T
90 select IMX_HAVE_IOMUX_V1 90 select IMX_HAVE_IOMUX_V1
91 select MXC_AVIC 91 select MXC_AVIC
@@ -109,17 +109,6 @@ config SOC_IMX35
109if ARCH_MULTI_V4T 109if ARCH_MULTI_V4T
110 110
111comment "MX1 platforms:" 111comment "MX1 platforms:"
112config MACH_MXLADS
113 bool
114
115config ARCH_MX1ADS
116 bool "MX1ADS platform"
117 select IMX_HAVE_PLATFORM_IMX_I2C
118 select IMX_HAVE_PLATFORM_IMX_UART
119 select MACH_MXLADS
120 select SOC_IMX1
121 help
122 Say Y here if you are using Motorola MX1ADS/MXLADS boards
123 112
124config MACH_SCB9328 113config MACH_SCB9328
125 bool "Synertronixx scb9328" 114 bool "Synertronixx scb9328"
@@ -136,6 +125,13 @@ config MACH_APF9328
136 help 125 help
137 Say Yes here if you are using the Armadeus APF9328 development board 126 Say Yes here if you are using the Armadeus APF9328 development board
138 127
128config MACH_IMX1_DT
129 bool "Support i.MX1 platforms from device tree"
130 select SOC_IMX1
131 help
132 Include support for Freescale i.MX1 based platforms
133 using the device tree for discovery.
134
139endif 135endif
140 136
141if ARCH_MULTI_V5 137if ARCH_MULTI_V5
@@ -224,86 +220,6 @@ config MACH_MX27ADS
224 Include support for MX27ADS platform. This includes specific 220 Include support for MX27ADS platform. This includes specific
225 configurations for the board and its peripherals. 221 configurations for the board and its peripherals.
226 222
227config MACH_PCM038
228 bool "Phytec phyCORE-i.MX27 CPU module (pcm038)"
229 select IMX_HAVE_PLATFORM_IMX2_WDT
230 select IMX_HAVE_PLATFORM_IMX_I2C
231 select IMX_HAVE_PLATFORM_IMX_UART
232 select IMX_HAVE_PLATFORM_MXC_EHCI
233 select IMX_HAVE_PLATFORM_MXC_NAND
234 select IMX_HAVE_PLATFORM_MXC_W1
235 select IMX_HAVE_PLATFORM_SPI_IMX
236 select USB_ULPI_VIEWPORT if USB_ULPI
237 select SOC_IMX27
238 help
239 Include support for phyCORE-i.MX27 (aka pcm038) platform. This
240 includes specific configurations for the module and its peripherals.
241
242choice
243 prompt "Baseboard"
244 depends on MACH_PCM038
245 default MACH_PCM970_BASEBOARD
246
247config MACH_PCM970_BASEBOARD
248 bool "PHYTEC PCM970 development board"
249 select IMX_HAVE_PLATFORM_IMX_FB
250 select IMX_HAVE_PLATFORM_MXC_MMC
251 help
252 This adds board specific devices that can be found on Phytec's
253 PCM970 evaluation board.
254
255endchoice
256
257config MACH_CPUIMX27
258 bool "Eukrea CPUIMX27 module"
259 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
260 select IMX_HAVE_PLATFORM_IMX2_WDT
261 select IMX_HAVE_PLATFORM_IMX_I2C
262 select IMX_HAVE_PLATFORM_IMX_UART
263 select IMX_HAVE_PLATFORM_MXC_EHCI
264 select IMX_HAVE_PLATFORM_MXC_NAND
265 select IMX_HAVE_PLATFORM_MXC_W1
266 select USB_ULPI_VIEWPORT if USB_ULPI
267 select SOC_IMX27
268 help
269 Include support for Eukrea CPUIMX27 platform. This includes
270 specific configurations for the module and its peripherals.
271
272config MACH_EUKREA_CPUIMX27_USESDHC2
273 bool "CPUIMX27 integrates SDHC2 module"
274 depends on MACH_CPUIMX27
275 select IMX_HAVE_PLATFORM_MXC_MMC
276 help
277 This adds support for the internal SDHC2 used on CPUIMX27
278 for wifi or eMMC.
279
280config MACH_EUKREA_CPUIMX27_USEUART4
281 bool "CPUIMX27 integrates UART4 module"
282 depends on MACH_CPUIMX27
283 help
284 This adds support for the internal UART4 used on CPUIMX27
285 for bluetooth.
286
287choice
288 prompt "Baseboard"
289 depends on MACH_CPUIMX27
290 default MACH_EUKREA_MBIMX27_BASEBOARD
291
292config MACH_EUKREA_MBIMX27_BASEBOARD
293 bool "Eukrea MBIMX27 development board"
294 select IMX_HAVE_PLATFORM_IMX_FB
295 select IMX_HAVE_PLATFORM_IMX_KEYPAD
296 select IMX_HAVE_PLATFORM_IMX_SSI
297 select IMX_HAVE_PLATFORM_IMX_UART
298 select IMX_HAVE_PLATFORM_MXC_MMC
299 select IMX_HAVE_PLATFORM_SPI_IMX
300 select LEDS_GPIO_REGISTER
301 help
302 This adds board specific devices that can be found on Eukrea's
303 MBIMX27 evaluation board.
304
305endchoice
306
307config MACH_MX27_3DS 223config MACH_MX27_3DS
308 bool "MX27PDK platform" 224 bool "MX27PDK platform"
309 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 225 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
@@ -360,18 +276,6 @@ config MACH_PCA100
360 Include support for phyCARD-s (aka pca100) platform. This 276 Include support for phyCARD-s (aka pca100) platform. This
361 includes specific configurations for the module and its peripherals. 277 includes specific configurations for the module and its peripherals.
362 278
363config MACH_MXT_TD60
364 bool "Maxtrack i-MXT TD60"
365 select IMX_HAVE_PLATFORM_IMX_FB
366 select IMX_HAVE_PLATFORM_IMX_I2C
367 select IMX_HAVE_PLATFORM_IMX_UART
368 select IMX_HAVE_PLATFORM_MXC_MMC
369 select IMX_HAVE_PLATFORM_MXC_NAND
370 select SOC_IMX27
371 help
372 Include support for i-MXT (aka td60) platform. This
373 includes specific configurations for the module and its peripherals.
374
375config MACH_IMX27_DT 279config MACH_IMX27_DT
376 bool "Support i.MX27 platforms from device tree" 280 bool "Support i.MX27 platforms from device tree"
377 select SOC_IMX27 281 select SOC_IMX27
@@ -659,7 +563,6 @@ comment "Device tree only"
659 563
660config SOC_IMX5 564config SOC_IMX5
661 bool 565 bool
662 select ARCH_HAS_OPP
663 select HAVE_IMX_SRC 566 select HAVE_IMX_SRC
664 select MXC_TZIC 567 select MXC_TZIC
665 568
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index ac88599ca080..6e4fcd8339cd 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -16,7 +16,8 @@ obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o clk-imx51-imx53.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 \
19 clk-fixup-div.o clk-fixup-mux.o 19 clk-fixup-div.o clk-fixup-mux.o \
20 clk-gate-exclusive.o
20 21
21obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o 22obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
22obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o 23obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
@@ -41,9 +42,9 @@ obj-y += ssi-fiq-ksym.o
41endif 42endif
42 43
43# i.MX1 based machines 44# i.MX1 based machines
44obj-$(CONFIG_ARCH_MX1ADS) += mach-mx1ads.o
45obj-$(CONFIG_MACH_SCB9328) += mach-scb9328.o 45obj-$(CONFIG_MACH_SCB9328) += mach-scb9328.o
46obj-$(CONFIG_MACH_APF9328) += mach-apf9328.o 46obj-$(CONFIG_MACH_APF9328) += mach-apf9328.o
47obj-$(CONFIG_MACH_IMX1_DT) += imx1-dt.o
47 48
48# i.MX21 based machines 49# i.MX21 based machines
49obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o 50obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
@@ -56,14 +57,9 @@ obj-$(CONFIG_MACH_IMX25_DT) += imx25-dt.o
56 57
57# i.MX27 based machines 58# i.MX27 based machines
58obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o 59obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o
59obj-$(CONFIG_MACH_PCM038) += mach-pcm038.o
60obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o
61obj-$(CONFIG_MACH_MX27_3DS) += mach-mx27_3ds.o 60obj-$(CONFIG_MACH_MX27_3DS) += mach-mx27_3ds.o
62obj-$(CONFIG_MACH_IMX27_VISSTRIM_M10) += mach-imx27_visstrim_m10.o 61obj-$(CONFIG_MACH_IMX27_VISSTRIM_M10) += mach-imx27_visstrim_m10.o
63obj-$(CONFIG_MACH_CPUIMX27) += mach-cpuimx27.o
64obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o
65obj-$(CONFIG_MACH_PCA100) += mach-pca100.o 62obj-$(CONFIG_MACH_PCA100) += mach-pca100.o
66obj-$(CONFIG_MACH_MXT_TD60) += mach-mxt_td60.o
67obj-$(CONFIG_MACH_IMX27_DT) += imx27-dt.o 63obj-$(CONFIG_MACH_IMX27_DT) += imx27-dt.o
68 64
69# i.MX31 based machines 65# i.MX31 based machines
@@ -93,9 +89,11 @@ obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
93obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o 89obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
94obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o 90obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o
95obj-$(CONFIG_HAVE_IMX_SRC) += src.o 91obj-$(CONFIG_HAVE_IMX_SRC) += src.o
92ifdef CONFIG_SOC_IMX6
96AFLAGS_headsmp.o :=-Wa,-march=armv7-a 93AFLAGS_headsmp.o :=-Wa,-march=armv7-a
97obj-$(CONFIG_SMP) += headsmp.o platsmp.o 94obj-$(CONFIG_SMP) += headsmp.o platsmp.o
98obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 95obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
96endif
99obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o 97obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o
100obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o 98obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o
101obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o mach-imx6sx.o 99obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o mach-imx6sx.o
diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c
index 4a40bbb46183..8259a625a920 100644
--- a/arch/arm/mach-imx/anatop.c
+++ b/arch/arm/mach-imx/anatop.c
@@ -104,6 +104,19 @@ void __init imx_init_revision_from_anatop(void)
104 case 2: 104 case 2:
105 revision = IMX_CHIP_REVISION_1_2; 105 revision = IMX_CHIP_REVISION_1_2;
106 break; 106 break;
107 case 3:
108 revision = IMX_CHIP_REVISION_1_3;
109 break;
110 case 4:
111 revision = IMX_CHIP_REVISION_1_4;
112 break;
113 case 5:
114 /*
115 * i.MX6DQ TO1.5 is defined as Rev 1.3 in Data Sheet, marked
116 * as 'D' in Part Number last character.
117 */
118 revision = IMX_CHIP_REVISION_1_5;
119 break;
107 default: 120 default:
108 revision = IMX_CHIP_REVISION_UNKNOWN; 121 revision = IMX_CHIP_REVISION_UNKNOWN;
109 } 122 }
diff --git a/arch/arm/mach-imx/avic.c b/arch/arm/mach-imx/avic.c
index 24b103c67f82..1a8932335b21 100644
--- a/arch/arm/mach-imx/avic.c
+++ b/arch/arm/mach-imx/avic.c
@@ -144,7 +144,7 @@ static void __exception_irq_entry avic_handle_irq(struct pt_regs *regs)
144 if (nivector == 0xffff) 144 if (nivector == 0xffff)
145 break; 145 break;
146 146
147 handle_IRQ(irq_find_mapping(domain, nivector), regs); 147 handle_domain_irq(domain, nivector, regs);
148 } while (1); 148 } while (1);
149} 149}
150 150
diff --git a/arch/arm/mach-imx/board-pcm038.h b/arch/arm/mach-imx/board-pcm038.h
deleted file mode 100644
index 6f371e35753d..000000000000
--- a/arch/arm/mach-imx/board-pcm038.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
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, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
17 */
18
19#ifndef __ASM_ARCH_MXC_BOARD_PCM038_H__
20#define __ASM_ARCH_MXC_BOARD_PCM038_H__
21
22#ifndef __ASSEMBLY__
23/*
24 * This CPU module needs a baseboard to work. After basic initializing
25 * its own devices, it calls the baseboard's init function.
26 * TODO: Add your own baseboard init function and call it from
27 * inside pcm038_init().
28 *
29 * This example here is for the development board. Refer pcm970-baseboard.c
30 */
31
32extern void pcm970_baseboard_init(void);
33
34#endif
35
36#endif /* __ASM_ARCH_MXC_BOARD_PCM038_H__ */
diff --git a/arch/arm/mach-imx/clk-gate-exclusive.c b/arch/arm/mach-imx/clk-gate-exclusive.c
new file mode 100644
index 000000000000..c12f5f2e04dc
--- /dev/null
+++ b/arch/arm/mach-imx/clk-gate-exclusive.c
@@ -0,0 +1,94 @@
1/*
2 * Copyright 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/clk-provider.h>
10#include <linux/err.h>
11#include <linux/io.h>
12#include <linux/slab.h>
13#include "clk.h"
14
15/**
16 * struct clk_gate_exclusive - i.MX specific gate clock which is mutually
17 * exclusive with other gate clocks
18 *
19 * @gate: the parent class
20 * @exclusive_mask: mask of gate bits which are mutually exclusive to this
21 * gate clock
22 *
23 * The imx exclusive gate clock is a subclass of basic clk_gate
24 * with an addtional mask to indicate which other gate bits in the same
25 * register is mutually exclusive to this gate clock.
26 */
27struct clk_gate_exclusive {
28 struct clk_gate gate;
29 u32 exclusive_mask;
30};
31
32static int clk_gate_exclusive_enable(struct clk_hw *hw)
33{
34 struct clk_gate *gate = container_of(hw, struct clk_gate, hw);
35 struct clk_gate_exclusive *exgate = container_of(gate,
36 struct clk_gate_exclusive, gate);
37 u32 val = readl(gate->reg);
38
39 if (val & exgate->exclusive_mask)
40 return -EBUSY;
41
42 return clk_gate_ops.enable(hw);
43}
44
45static void clk_gate_exclusive_disable(struct clk_hw *hw)
46{
47 clk_gate_ops.disable(hw);
48}
49
50static int clk_gate_exclusive_is_enabled(struct clk_hw *hw)
51{
52 return clk_gate_ops.is_enabled(hw);
53}
54
55static const struct clk_ops clk_gate_exclusive_ops = {
56 .enable = clk_gate_exclusive_enable,
57 .disable = clk_gate_exclusive_disable,
58 .is_enabled = clk_gate_exclusive_is_enabled,
59};
60
61struct clk *imx_clk_gate_exclusive(const char *name, const char *parent,
62 void __iomem *reg, u8 shift, u32 exclusive_mask)
63{
64 struct clk_gate_exclusive *exgate;
65 struct clk_gate *gate;
66 struct clk *clk;
67 struct clk_init_data init;
68
69 if (exclusive_mask == 0)
70 return ERR_PTR(-EINVAL);
71
72 exgate = kzalloc(sizeof(*exgate), GFP_KERNEL);
73 if (!exgate)
74 return ERR_PTR(-ENOMEM);
75 gate = &exgate->gate;
76
77 init.name = name;
78 init.ops = &clk_gate_exclusive_ops;
79 init.flags = CLK_SET_RATE_PARENT;
80 init.parent_names = parent ? &parent : NULL;
81 init.num_parents = parent ? 1 : 0;
82
83 gate->reg = reg;
84 gate->bit_idx = shift;
85 gate->lock = &imx_ccm_lock;
86 gate->hw.init = &init;
87 exgate->exclusive_mask = exclusive_mask;
88
89 clk = clk_register(NULL, &gate->hw);
90 if (IS_ERR(clk))
91 kfree(exgate);
92
93 return clk;
94}
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index 84acdfd1d715..5a75cdc81891 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -97,7 +97,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
97 struct clk_gate2 *gate = to_clk_gate2(hw); 97 struct clk_gate2 *gate = to_clk_gate2(hw);
98 98
99 if (gate->share_count) 99 if (gate->share_count)
100 return !!(*gate->share_count); 100 return !!__clk_get_enable_count(hw->clk);
101 else 101 else
102 return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); 102 return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx);
103} 103}
@@ -127,10 +127,6 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
127 gate->bit_idx = bit_idx; 127 gate->bit_idx = bit_idx;
128 gate->flags = clk_gate2_flags; 128 gate->flags = clk_gate2_flags;
129 gate->lock = lock; 129 gate->lock = lock;
130
131 /* Initialize share_count per hardware state */
132 if (share_count)
133 *share_count = clk_gate2_reg_is_enabled(reg, bit_idx) ? 1 : 0;
134 gate->share_count = share_count; 130 gate->share_count = share_count;
135 131
136 init.name = name; 132 init.name = name;
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 6cceb7765c14..1412daf4a714 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -64,7 +64,7 @@ static const char *cko2_sels[] = {
64 "ipu2", "vdo_axi", "osc", "gpu2d_core", 64 "ipu2", "vdo_axi", "osc", "gpu2d_core",
65 "gpu3d_core", "usdhc2", "ssi1", "ssi2", 65 "gpu3d_core", "usdhc2", "ssi1", "ssi2",
66 "ssi3", "gpu3d_shader", "vpu_axi", "can_root", 66 "ssi3", "gpu3d_shader", "vpu_axi", "can_root",
67 "ldb_di0", "ldb_di1", "esai", "eim_slow", 67 "ldb_di0", "ldb_di1", "esai_extal", "eim_slow",
68 "uart_serial", "spdif", "asrc", "hsi_tx", 68 "uart_serial", "spdif", "asrc", "hsi_tx",
69}; 69};
70static const char *cko_sels[] = { "cko1", "cko2", }; 70static const char *cko_sels[] = { "cko1", "cko2", };
@@ -73,6 +73,14 @@ static const char *lvds_sels[] = {
73 "pll4_audio", "pll5_video", "pll8_mlb", "enet_ref", 73 "pll4_audio", "pll5_video", "pll8_mlb", "enet_ref",
74 "pcie_ref_125m", "sata_ref_100m", 74 "pcie_ref_125m", "sata_ref_100m",
75}; 75};
76static const char *pll_bypass_src_sels[] = { "osc", "lvds1_in", "lvds2_in", "dummy", };
77static const char *pll1_bypass_sels[] = { "pll1", "pll1_bypass_src", };
78static const char *pll2_bypass_sels[] = { "pll2", "pll2_bypass_src", };
79static const char *pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", };
80static const char *pll4_bypass_sels[] = { "pll4", "pll4_bypass_src", };
81static const char *pll5_bypass_sels[] = { "pll5", "pll5_bypass_src", };
82static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", };
83static const char *pll7_bypass_sels[] = { "pll7", "pll7_bypass_src", };
76 84
77static struct clk *clk[IMX6QDL_CLK_END]; 85static struct clk *clk[IMX6QDL_CLK_END];
78static struct clk_onecell_data clk_data; 86static struct clk_onecell_data clk_data;
@@ -107,6 +115,10 @@ static struct clk_div_table video_div_table[] = {
107}; 115};
108 116
109static unsigned int share_count_esai; 117static unsigned int share_count_esai;
118static unsigned int share_count_asrc;
119static unsigned int share_count_ssi1;
120static unsigned int share_count_ssi2;
121static unsigned int share_count_ssi3;
110 122
111static void __init imx6q_clocks_init(struct device_node *ccm_node) 123static void __init imx6q_clocks_init(struct device_node *ccm_node)
112{ 124{
@@ -119,6 +131,9 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
119 clk[IMX6QDL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0); 131 clk[IMX6QDL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0);
120 clk[IMX6QDL_CLK_CKIH] = imx_obtain_fixed_clock("ckih1", 0); 132 clk[IMX6QDL_CLK_CKIH] = imx_obtain_fixed_clock("ckih1", 0);
121 clk[IMX6QDL_CLK_OSC] = imx_obtain_fixed_clock("osc", 0); 133 clk[IMX6QDL_CLK_OSC] = imx_obtain_fixed_clock("osc", 0);
134 /* Clock source from external clock via CLK1/2 PADs */
135 clk[IMX6QDL_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0);
136 clk[IMX6QDL_CLK_ANACLK2] = imx_obtain_fixed_clock("anaclk2", 0);
122 137
123 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); 138 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
124 base = of_iomap(np, 0); 139 base = of_iomap(np, 0);
@@ -132,14 +147,47 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
132 video_div_table[2].div = 1; 147 video_div_table[2].div = 1;
133 }; 148 };
134 149
135 /* type name parent_name base div_mask */ 150 clk[IMX6QDL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
136 clk[IMX6QDL_CLK_PLL1_SYS] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f); 151 clk[IMX6QDL_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
137 clk[IMX6QDL_CLK_PLL2_BUS] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1); 152 clk[IMX6QDL_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", base + 0x10, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
138 clk[IMX6QDL_CLK_PLL3_USB_OTG] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x3); 153 clk[IMX6QDL_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", base + 0x70, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
139 clk[IMX6QDL_CLK_PLL4_AUDIO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x7f); 154 clk[IMX6QDL_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", base + 0xa0, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
140 clk[IMX6QDL_CLK_PLL5_VIDEO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f); 155 clk[IMX6QDL_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", base + 0xe0, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
141 clk[IMX6QDL_CLK_PLL6_ENET] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3); 156 clk[IMX6QDL_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", base + 0x20, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
142 clk[IMX6QDL_CLK_PLL7_USB_HOST] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host","osc", base + 0x20, 0x3); 157
158 /* type name parent_name base div_mask */
159 clk[IMX6QDL_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1", "pll1_bypass_src", base + 0x00, 0x7f);
160 clk[IMX6QDL_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", base + 0x30, 0x1);
161 clk[IMX6QDL_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "pll3_bypass_src", base + 0x10, 0x3);
162 clk[IMX6QDL_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", base + 0x70, 0x7f);
163 clk[IMX6QDL_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5", "pll5_bypass_src", base + 0xa0, 0x7f);
164 clk[IMX6QDL_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "pll6_bypass_src", base + 0xe0, 0x3);
165 clk[IMX6QDL_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "pll7_bypass_src", base + 0x20, 0x3);
166
167 clk[IMX6QDL_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT);
168 clk[IMX6QDL_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT);
169 clk[IMX6QDL_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT);
170 clk[IMX6QDL_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT);
171 clk[IMX6QDL_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT);
172 clk[IMX6QDL_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT);
173 clk[IMX6QDL_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT);
174
175 /* Do not bypass PLLs initially */
176 clk_set_parent(clk[IMX6QDL_PLL1_BYPASS], clk[IMX6QDL_CLK_PLL1]);
177 clk_set_parent(clk[IMX6QDL_PLL2_BYPASS], clk[IMX6QDL_CLK_PLL2]);
178 clk_set_parent(clk[IMX6QDL_PLL3_BYPASS], clk[IMX6QDL_CLK_PLL3]);
179 clk_set_parent(clk[IMX6QDL_PLL4_BYPASS], clk[IMX6QDL_CLK_PLL4]);
180 clk_set_parent(clk[IMX6QDL_PLL5_BYPASS], clk[IMX6QDL_CLK_PLL5]);
181 clk_set_parent(clk[IMX6QDL_PLL6_BYPASS], clk[IMX6QDL_CLK_PLL6]);
182 clk_set_parent(clk[IMX6QDL_PLL7_BYPASS], clk[IMX6QDL_CLK_PLL7]);
183
184 clk[IMX6QDL_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", base + 0x00, 13);
185 clk[IMX6QDL_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", base + 0x30, 13);
186 clk[IMX6QDL_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13);
187 clk[IMX6QDL_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", base + 0x70, 13);
188 clk[IMX6QDL_CLK_PLL5_VIDEO] = imx_clk_gate("pll5_video", "pll5_bypass", base + 0xa0, 13);
189 clk[IMX6QDL_CLK_PLL6_ENET] = imx_clk_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13);
190 clk[IMX6QDL_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13);
143 191
144 /* 192 /*
145 * Bit 20 is the reserved and read-only bit, we do this only for: 193 * Bit 20 is the reserved and read-only bit, we do this only for:
@@ -176,8 +224,11 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
176 * the "output_enable" bit as a gate, even though it's really just 224 * the "output_enable" bit as a gate, even though it's really just
177 * enabling clock output. 225 * enabling clock output.
178 */ 226 */
179 clk[IMX6QDL_CLK_LVDS1_GATE] = imx_clk_gate("lvds1_gate", "lvds1_sel", base + 0x160, 10); 227 clk[IMX6QDL_CLK_LVDS1_GATE] = imx_clk_gate_exclusive("lvds1_gate", "lvds1_sel", base + 0x160, 10, BIT(12));
180 clk[IMX6QDL_CLK_LVDS2_GATE] = imx_clk_gate("lvds2_gate", "lvds2_sel", base + 0x160, 11); 228 clk[IMX6QDL_CLK_LVDS2_GATE] = imx_clk_gate_exclusive("lvds2_gate", "lvds2_sel", base + 0x160, 11, BIT(13));
229
230 clk[IMX6QDL_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10));
231 clk[IMX6QDL_CLK_LVDS2_IN] = imx_clk_gate_exclusive("lvds2_in", "anaclk2", base + 0x160, 13, BIT(11));
181 232
182 /* name parent_name reg idx */ 233 /* name parent_name reg idx */
183 clk[IMX6QDL_CLK_PLL2_PFD0_352M] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 234 clk[IMX6QDL_CLK_PLL2_PFD0_352M] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0);
@@ -194,6 +245,11 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
194 clk[IMX6QDL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 245 clk[IMX6QDL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6);
195 clk[IMX6QDL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 246 clk[IMX6QDL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8);
196 clk[IMX6QDL_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2); 247 clk[IMX6QDL_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2);
248 clk[IMX6QDL_CLK_GPT_3M] = imx_clk_fixed_factor("gpt_3m", "osc", 1, 8);
249 if (cpu_is_imx6dl()) {
250 clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_fixed_factor("gpu2d_axi", "mmdc_ch0_axi_podf", 1, 1);
251 clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_fixed_factor("gpu3d_axi", "mmdc_ch0_axi_podf", 1, 1);
252 }
197 253
198 clk[IMX6QDL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 254 clk[IMX6QDL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock);
199 clk[IMX6QDL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); 255 clk[IMX6QDL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock);
@@ -217,8 +273,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
217 clk[IMX6QDL_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); 273 clk[IMX6QDL_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels));
218 clk[IMX6QDL_CLK_ASRC_SEL] = imx_clk_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); 274 clk[IMX6QDL_CLK_ASRC_SEL] = imx_clk_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels));
219 clk[IMX6QDL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); 275 clk[IMX6QDL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels));
220 clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 276 if (cpu_is_imx6q()) {
221 clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 277 clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels));
278 clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels));
279 }
222 clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); 280 clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels));
223 clk[IMX6QDL_CLK_GPU3D_CORE_SEL] = imx_clk_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels)); 281 clk[IMX6QDL_CLK_GPU3D_CORE_SEL] = imx_clk_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels));
224 clk[IMX6QDL_CLK_GPU3D_SHADER_SEL] = imx_clk_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); 282 clk[IMX6QDL_CLK_GPU3D_SHADER_SEL] = imx_clk_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels));
@@ -311,7 +369,9 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
311 369
312 /* name parent_name reg shift */ 370 /* name parent_name reg shift */
313 clk[IMX6QDL_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4); 371 clk[IMX6QDL_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4);
314 clk[IMX6QDL_CLK_ASRC] = imx_clk_gate2("asrc", "asrc_podf", base + 0x68, 6); 372 clk[IMX6QDL_CLK_ASRC] = imx_clk_gate2_shared("asrc", "asrc_podf", base + 0x68, 6, &share_count_asrc);
373 clk[IMX6QDL_CLK_ASRC_IPG] = imx_clk_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc);
374 clk[IMX6QDL_CLK_ASRC_MEM] = imx_clk_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc);
315 clk[IMX6QDL_CLK_CAN1_IPG] = imx_clk_gate2("can1_ipg", "ipg", base + 0x68, 14); 375 clk[IMX6QDL_CLK_CAN1_IPG] = imx_clk_gate2("can1_ipg", "ipg", base + 0x68, 14);
316 clk[IMX6QDL_CLK_CAN1_SERIAL] = imx_clk_gate2("can1_serial", "can_root", base + 0x68, 16); 376 clk[IMX6QDL_CLK_CAN1_SERIAL] = imx_clk_gate2("can1_serial", "can_root", base + 0x68, 16);
317 clk[IMX6QDL_CLK_CAN2_IPG] = imx_clk_gate2("can2_ipg", "ipg", base + 0x68, 18); 377 clk[IMX6QDL_CLK_CAN2_IPG] = imx_clk_gate2("can2_ipg", "ipg", base + 0x68, 18);
@@ -325,8 +385,9 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
325 else 385 else
326 clk[IMX6Q_CLK_ECSPI5] = imx_clk_gate2("ecspi5", "ecspi_root", base + 0x6c, 8); 386 clk[IMX6Q_CLK_ECSPI5] = imx_clk_gate2("ecspi5", "ecspi_root", base + 0x6c, 8);
327 clk[IMX6QDL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10); 387 clk[IMX6QDL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10);
328 clk[IMX6QDL_CLK_ESAI] = imx_clk_gate2_shared("esai", "esai_podf", base + 0x6c, 16, &share_count_esai); 388 clk[IMX6QDL_CLK_ESAI_EXTAL] = imx_clk_gate2_shared("esai_extal", "esai_podf", base + 0x6c, 16, &share_count_esai);
329 clk[IMX6QDL_CLK_ESAI_AHB] = imx_clk_gate2_shared("esai_ahb", "ahb", base + 0x6c, 16, &share_count_esai); 389 clk[IMX6QDL_CLK_ESAI_IPG] = imx_clk_gate2_shared("esai_ipg", "ipg", base + 0x6c, 16, &share_count_esai);
390 clk[IMX6QDL_CLK_ESAI_MEM] = imx_clk_gate2_shared("esai_mem", "ahb", base + 0x6c, 16, &share_count_esai);
330 clk[IMX6QDL_CLK_GPT_IPG] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20); 391 clk[IMX6QDL_CLK_GPT_IPG] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20);
331 clk[IMX6QDL_CLK_GPT_IPG_PER] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22); 392 clk[IMX6QDL_CLK_GPT_IPG_PER] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22);
332 if (cpu_is_imx6dl()) 393 if (cpu_is_imx6dl())
@@ -382,9 +443,12 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
382 clk[IMX6QDL_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); 443 clk[IMX6QDL_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6);
383 clk[IMX6QDL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 444 clk[IMX6QDL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12);
384 clk[IMX6QDL_CLK_SPDIF] = imx_clk_gate2("spdif", "spdif_podf", base + 0x7c, 14); 445 clk[IMX6QDL_CLK_SPDIF] = imx_clk_gate2("spdif", "spdif_podf", base + 0x7c, 14);
385 clk[IMX6QDL_CLK_SSI1_IPG] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18); 446 clk[IMX6QDL_CLK_SSI1_IPG] = imx_clk_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1);
386 clk[IMX6QDL_CLK_SSI2_IPG] = imx_clk_gate2("ssi2_ipg", "ipg", base + 0x7c, 20); 447 clk[IMX6QDL_CLK_SSI2_IPG] = imx_clk_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2);
387 clk[IMX6QDL_CLK_SSI3_IPG] = imx_clk_gate2("ssi3_ipg", "ipg", base + 0x7c, 22); 448 clk[IMX6QDL_CLK_SSI3_IPG] = imx_clk_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3);
449 clk[IMX6QDL_CLK_SSI1] = imx_clk_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1);
450 clk[IMX6QDL_CLK_SSI2] = imx_clk_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2);
451 clk[IMX6QDL_CLK_SSI3] = imx_clk_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3);
388 clk[IMX6QDL_CLK_UART_IPG] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24); 452 clk[IMX6QDL_CLK_UART_IPG] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24);
389 clk[IMX6QDL_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_serial_podf", base + 0x7c, 26); 453 clk[IMX6QDL_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_serial_podf", base + 0x7c, 26);
390 clk[IMX6QDL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0); 454 clk[IMX6QDL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0);
@@ -398,6 +462,13 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
398 clk[IMX6QDL_CLK_CKO1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7); 462 clk[IMX6QDL_CLK_CKO1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7);
399 clk[IMX6QDL_CLK_CKO2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24); 463 clk[IMX6QDL_CLK_CKO2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24);
400 464
465 /*
466 * The gpt_3m clock is not available on i.MX6Q TO1.0. Let's point it
467 * to clock gpt_ipg_per to ease the gpt driver code.
468 */
469 if (cpu_is_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0)
470 clk[IMX6QDL_CLK_GPT_3M] = clk[IMX6QDL_CLK_GPT_IPG_PER];
471
401 imx_check_clocks(clk, ARRAY_SIZE(clk)); 472 imx_check_clocks(clk, ARRAY_SIZE(clk));
402 473
403 clk_data.clks = clk; 474 clk_data.clks = clk;
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index fef46faf692f..e982ebe10814 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -43,11 +43,13 @@ static const char *periph_clk2_sels[] = { "pll3_usb_otg", "osc", "osc", "dummy",
43static const char *periph2_clk2_sels[] = { "pll3_usb_otg", "pll2_bus", }; 43static const char *periph2_clk2_sels[] = { "pll3_usb_otg", "pll2_bus", };
44static const char *periph_sels[] = { "pre_periph_sel", "periph_clk2_podf", }; 44static const char *periph_sels[] = { "pre_periph_sel", "periph_clk2_podf", };
45static const char *periph2_sels[] = { "pre_periph2_sel", "periph2_clk2_podf", }; 45static const char *periph2_sels[] = { "pre_periph2_sel", "periph2_clk2_podf", };
46static const char *csi_lcdif_sels[] = { "mmdc", "pll2_pfd2", "pll3_120m", "pll3_pfd1", }; 46static const char *csi_sels[] = { "osc", "pll2_pfd2", "pll3_120m", "pll3_pfd1", };
47static const char *lcdif_axi_sels[] = { "pll2_bus", "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", };
47static const char *usdhc_sels[] = { "pll2_pfd2", "pll2_pfd0", }; 48static const char *usdhc_sels[] = { "pll2_pfd2", "pll2_pfd0", };
48static const char *ssi_sels[] = { "pll3_pfd2", "pll3_pfd3", "pll4_audio_div", "dummy", }; 49static const char *ssi_sels[] = { "pll3_pfd2", "pll3_pfd3", "pll4_audio_div", "dummy", };
49static const char *perclk_sels[] = { "ipg", "osc", }; 50static const char *perclk_sels[] = { "ipg", "osc", };
50static const char *epdc_pxp_sels[] = { "mmdc", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd1", }; 51static const char *pxp_axi_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd3", };
52static const char *epdc_axi_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd2", };
51static const char *gpu2d_ovg_sels[] = { "pll3_pfd1", "pll3_usb_otg", "pll2_bus", "pll2_pfd2", }; 53static const char *gpu2d_ovg_sels[] = { "pll3_pfd1", "pll3_usb_otg", "pll2_bus", "pll2_pfd2", };
52static const char *gpu2d_sels[] = { "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", "pll2_bus", }; 54static const char *gpu2d_sels[] = { "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", "pll2_bus", };
53static const char *lcdif_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll3_pfd0", "pll3_pfd1", }; 55static const char *lcdif_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll3_pfd0", "pll3_pfd1", };
@@ -55,6 +57,20 @@ static const char *epdc_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_d
55static const char *audio_sels[] = { "pll4_audio_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", }; 57static const char *audio_sels[] = { "pll4_audio_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", };
56static const char *ecspi_sels[] = { "pll3_60m", "osc", }; 58static const char *ecspi_sels[] = { "pll3_60m", "osc", };
57static const char *uart_sels[] = { "pll3_80m", "osc", }; 59static const char *uart_sels[] = { "pll3_80m", "osc", };
60static const char *lvds_sels[] = {
61 "pll1_sys", "pll2_bus", "pll2_pfd0", "pll2_pfd1", "pll2_pfd2", "dummy", "pll4_audio", "pll5_video",
62 "dummy", "enet_ref", "dummy", "dummy", "pll3_usb_otg", "pll7_usb_host", "pll3_pfd0", "pll3_pfd1",
63 "pll3_pfd2", "pll3_pfd3", "osc", "dummy", "dummy", "dummy", "dummy", "dummy",
64 "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy",
65};
66static const char *pll_bypass_src_sels[] = { "osc", "lvds1_in", };
67static const char *pll1_bypass_sels[] = { "pll1", "pll1_bypass_src", };
68static const char *pll2_bypass_sels[] = { "pll2", "pll2_bypass_src", };
69static const char *pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", };
70static const char *pll4_bypass_sels[] = { "pll4", "pll4_bypass_src", };
71static const char *pll5_bypass_sels[] = { "pll5", "pll5_bypass_src", };
72static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", };
73static const char *pll7_bypass_sels[] = { "pll7", "pll7_bypass_src", };
58 74
59static struct clk_div_table clk_enet_ref_table[] = { 75static struct clk_div_table clk_enet_ref_table[] = {
60 { .val = 0, .div = 20, }, 76 { .val = 0, .div = 20, },
@@ -79,6 +95,10 @@ static struct clk_div_table video_div_table[] = {
79 { } 95 { }
80}; 96};
81 97
98static unsigned int share_count_ssi1;
99static unsigned int share_count_ssi2;
100static unsigned int share_count_ssi3;
101
82static struct clk *clks[IMX6SL_CLK_END]; 102static struct clk *clks[IMX6SL_CLK_END];
83static struct clk_onecell_data clk_data; 103static struct clk_onecell_data clk_data;
84static void __iomem *ccm_base; 104static void __iomem *ccm_base;
@@ -175,20 +195,59 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
175 clks[IMX6SL_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 195 clks[IMX6SL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
176 clks[IMX6SL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0); 196 clks[IMX6SL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0);
177 clks[IMX6SL_CLK_OSC] = imx_obtain_fixed_clock("osc", 0); 197 clks[IMX6SL_CLK_OSC] = imx_obtain_fixed_clock("osc", 0);
198 /* Clock source from external clock via CLK1 PAD */
199 clks[IMX6SL_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0);
178 200
179 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-anatop"); 201 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-anatop");
180 base = of_iomap(np, 0); 202 base = of_iomap(np, 0);
181 WARN_ON(!base); 203 WARN_ON(!base);
182 anatop_base = base; 204 anatop_base = base;
183 205
184 /* type name parent base div_mask */ 206 clks[IMX6SL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
185 clks[IMX6SL_CLK_PLL1_SYS] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f); 207 clks[IMX6SL_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
186 clks[IMX6SL_CLK_PLL2_BUS] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1); 208 clks[IMX6SL_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
187 clks[IMX6SL_CLK_PLL3_USB_OTG] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x3); 209 clks[IMX6SL_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
188 clks[IMX6SL_CLK_PLL4_AUDIO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x7f); 210 clks[IMX6SL_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
189 clks[IMX6SL_CLK_PLL5_VIDEO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f); 211 clks[IMX6SL_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
190 clks[IMX6SL_CLK_PLL6_ENET] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3); 212 clks[IMX6SL_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
191 clks[IMX6SL_CLK_PLL7_USB_HOST] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host", "osc", base + 0x20, 0x3); 213
214 /* type name parent_name base div_mask */
215 clks[IMX6SL_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1", "pll1_bypass_src", base + 0x00, 0x7f);
216 clks[IMX6SL_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", base + 0x30, 0x1);
217 clks[IMX6SL_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "pll3_bypass_src", base + 0x10, 0x3);
218 clks[IMX6SL_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", base + 0x70, 0x7f);
219 clks[IMX6SL_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5", "pll5_bypass_src", base + 0xa0, 0x7f);
220 clks[IMX6SL_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "pll6_bypass_src", base + 0xe0, 0x3);
221 clks[IMX6SL_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "pll7_bypass_src", base + 0x20, 0x3);
222
223 clks[IMX6SL_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT);
224 clks[IMX6SL_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT);
225 clks[IMX6SL_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT);
226 clks[IMX6SL_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT);
227 clks[IMX6SL_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT);
228 clks[IMX6SL_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT);
229 clks[IMX6SL_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT);
230
231 /* Do not bypass PLLs initially */
232 clk_set_parent(clks[IMX6SL_PLL1_BYPASS], clks[IMX6SL_CLK_PLL1]);
233 clk_set_parent(clks[IMX6SL_PLL2_BYPASS], clks[IMX6SL_CLK_PLL2]);
234 clk_set_parent(clks[IMX6SL_PLL3_BYPASS], clks[IMX6SL_CLK_PLL3]);
235 clk_set_parent(clks[IMX6SL_PLL4_BYPASS], clks[IMX6SL_CLK_PLL4]);
236 clk_set_parent(clks[IMX6SL_PLL5_BYPASS], clks[IMX6SL_CLK_PLL5]);
237 clk_set_parent(clks[IMX6SL_PLL6_BYPASS], clks[IMX6SL_CLK_PLL6]);
238 clk_set_parent(clks[IMX6SL_PLL7_BYPASS], clks[IMX6SL_CLK_PLL7]);
239
240 clks[IMX6SL_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", base + 0x00, 13);
241 clks[IMX6SL_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", base + 0x30, 13);
242 clks[IMX6SL_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13);
243 clks[IMX6SL_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", base + 0x70, 13);
244 clks[IMX6SL_CLK_PLL5_VIDEO] = imx_clk_gate("pll5_video", "pll5_bypass", base + 0xa0, 13);
245 clks[IMX6SL_CLK_PLL6_ENET] = imx_clk_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13);
246 clks[IMX6SL_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13);
247
248 clks[IMX6SL_CLK_LVDS1_SEL] = imx_clk_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels));
249 clks[IMX6SL_CLK_LVDS1_OUT] = imx_clk_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x160, 10, BIT(12));
250 clks[IMX6SL_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10));
192 251
193 /* 252 /*
194 * usbphy1 and usbphy2 are implemented as dummy gates using reserve 253 * usbphy1 and usbphy2 are implemented as dummy gates using reserve
@@ -241,8 +300,8 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
241 clks[IMX6SL_CLK_PRE_PERIPH_SEL] = imx_clk_mux("pre_periph_sel", base + 0x18, 18, 2, pre_periph_sels, ARRAY_SIZE(pre_periph_sels)); 300 clks[IMX6SL_CLK_PRE_PERIPH_SEL] = imx_clk_mux("pre_periph_sel", base + 0x18, 18, 2, pre_periph_sels, ARRAY_SIZE(pre_periph_sels));
242 clks[IMX6SL_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 301 clks[IMX6SL_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels));
243 clks[IMX6SL_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 302 clks[IMX6SL_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels));
244 clks[IMX6SL_CLK_CSI_SEL] = imx_clk_mux("csi_sel", base + 0x3c, 9, 2, csi_lcdif_sels, ARRAY_SIZE(csi_lcdif_sels)); 303 clks[IMX6SL_CLK_CSI_SEL] = imx_clk_mux("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels));
245 clks[IMX6SL_CLK_LCDIF_AXI_SEL] = imx_clk_mux("lcdif_axi_sel", base + 0x3c, 14, 2, csi_lcdif_sels, ARRAY_SIZE(csi_lcdif_sels)); 304 clks[IMX6SL_CLK_LCDIF_AXI_SEL] = imx_clk_mux("lcdif_axi_sel", base + 0x3c, 14, 2, lcdif_axi_sels, ARRAY_SIZE(lcdif_axi_sels));
246 clks[IMX6SL_CLK_USDHC1_SEL] = imx_clk_fixup_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 305 clks[IMX6SL_CLK_USDHC1_SEL] = imx_clk_fixup_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup);
247 clks[IMX6SL_CLK_USDHC2_SEL] = imx_clk_fixup_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 306 clks[IMX6SL_CLK_USDHC2_SEL] = imx_clk_fixup_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup);
248 clks[IMX6SL_CLK_USDHC3_SEL] = imx_clk_fixup_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 307 clks[IMX6SL_CLK_USDHC3_SEL] = imx_clk_fixup_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup);
@@ -251,8 +310,8 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
251 clks[IMX6SL_CLK_SSI2_SEL] = imx_clk_fixup_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 310 clks[IMX6SL_CLK_SSI2_SEL] = imx_clk_fixup_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup);
252 clks[IMX6SL_CLK_SSI3_SEL] = imx_clk_fixup_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 311 clks[IMX6SL_CLK_SSI3_SEL] = imx_clk_fixup_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup);
253 clks[IMX6SL_CLK_PERCLK_SEL] = imx_clk_fixup_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels), imx_cscmr1_fixup); 312 clks[IMX6SL_CLK_PERCLK_SEL] = imx_clk_fixup_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels), imx_cscmr1_fixup);
254 clks[IMX6SL_CLK_PXP_AXI_SEL] = imx_clk_mux("pxp_axi_sel", base + 0x34, 6, 3, epdc_pxp_sels, ARRAY_SIZE(epdc_pxp_sels)); 313 clks[IMX6SL_CLK_PXP_AXI_SEL] = imx_clk_mux("pxp_axi_sel", base + 0x34, 6, 3, pxp_axi_sels, ARRAY_SIZE(pxp_axi_sels));
255 clks[IMX6SL_CLK_EPDC_AXI_SEL] = imx_clk_mux("epdc_axi_sel", base + 0x34, 15, 3, epdc_pxp_sels, ARRAY_SIZE(epdc_pxp_sels)); 314 clks[IMX6SL_CLK_EPDC_AXI_SEL] = imx_clk_mux("epdc_axi_sel", base + 0x34, 15, 3, epdc_axi_sels, ARRAY_SIZE(epdc_axi_sels));
256 clks[IMX6SL_CLK_GPU2D_OVG_SEL] = imx_clk_mux("gpu2d_ovg_sel", base + 0x18, 4, 2, gpu2d_ovg_sels, ARRAY_SIZE(gpu2d_ovg_sels)); 315 clks[IMX6SL_CLK_GPU2D_OVG_SEL] = imx_clk_mux("gpu2d_ovg_sel", base + 0x18, 4, 2, gpu2d_ovg_sels, ARRAY_SIZE(gpu2d_ovg_sels));
257 clks[IMX6SL_CLK_GPU2D_SEL] = imx_clk_mux("gpu2d_sel", base + 0x18, 8, 2, gpu2d_sels, ARRAY_SIZE(gpu2d_sels)); 316 clks[IMX6SL_CLK_GPU2D_SEL] = imx_clk_mux("gpu2d_sel", base + 0x18, 8, 2, gpu2d_sels, ARRAY_SIZE(gpu2d_sels));
258 clks[IMX6SL_CLK_LCDIF_PIX_SEL] = imx_clk_mux("lcdif_pix_sel", base + 0x38, 6, 3, lcdif_pix_sels, ARRAY_SIZE(lcdif_pix_sels)); 317 clks[IMX6SL_CLK_LCDIF_PIX_SEL] = imx_clk_mux("lcdif_pix_sel", base + 0x38, 6, 3, lcdif_pix_sels, ARRAY_SIZE(lcdif_pix_sels));
@@ -337,9 +396,12 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
337 clks[IMX6SL_CLK_SDMA] = imx_clk_gate2("sdma", "ipg", base + 0x7c, 6); 396 clks[IMX6SL_CLK_SDMA] = imx_clk_gate2("sdma", "ipg", base + 0x7c, 6);
338 clks[IMX6SL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 397 clks[IMX6SL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12);
339 clks[IMX6SL_CLK_SPDIF] = imx_clk_gate2("spdif", "spdif0_podf", base + 0x7c, 14); 398 clks[IMX6SL_CLK_SPDIF] = imx_clk_gate2("spdif", "spdif0_podf", base + 0x7c, 14);
340 clks[IMX6SL_CLK_SSI1] = imx_clk_gate2("ssi1", "ssi1_podf", base + 0x7c, 18); 399 clks[IMX6SL_CLK_SSI1_IPG] = imx_clk_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1);
341 clks[IMX6SL_CLK_SSI2] = imx_clk_gate2("ssi2", "ssi2_podf", base + 0x7c, 20); 400 clks[IMX6SL_CLK_SSI2_IPG] = imx_clk_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2);
342 clks[IMX6SL_CLK_SSI3] = imx_clk_gate2("ssi3", "ssi3_podf", base + 0x7c, 22); 401 clks[IMX6SL_CLK_SSI3_IPG] = imx_clk_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3);
402 clks[IMX6SL_CLK_SSI1] = imx_clk_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1);
403 clks[IMX6SL_CLK_SSI2] = imx_clk_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2);
404 clks[IMX6SL_CLK_SSI3] = imx_clk_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3);
343 clks[IMX6SL_CLK_UART] = imx_clk_gate2("uart", "ipg", base + 0x7c, 24); 405 clks[IMX6SL_CLK_UART] = imx_clk_gate2("uart", "ipg", base + 0x7c, 24);
344 clks[IMX6SL_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_root", base + 0x7c, 26); 406 clks[IMX6SL_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_root", base + 0x7c, 26);
345 clks[IMX6SL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0); 407 clks[IMX6SL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0);
@@ -375,6 +437,13 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
375 /* Audio-related clocks configuration */ 437 /* Audio-related clocks configuration */
376 clk_set_parent(clks[IMX6SL_CLK_SPDIF0_SEL], clks[IMX6SL_CLK_PLL3_PFD3]); 438 clk_set_parent(clks[IMX6SL_CLK_SPDIF0_SEL], clks[IMX6SL_CLK_PLL3_PFD3]);
377 439
440 /* set PLL5 video as lcdif pix parent clock */
441 clk_set_parent(clks[IMX6SL_CLK_LCDIF_PIX_SEL],
442 clks[IMX6SL_CLK_PLL5_VIDEO_DIV]);
443
444 clk_set_parent(clks[IMX6SL_CLK_LCDIF_AXI_SEL],
445 clks[IMX6SL_CLK_PLL2_PFD2]);
446
378 /* Set initial power mode */ 447 /* Set initial power mode */
379 imx6q_set_lpm(WAIT_CLOCKED); 448 imx6q_set_lpm(WAIT_CLOCKED);
380} 449}
diff --git a/arch/arm/mach-imx/clk-imx6sx.c b/arch/arm/mach-imx/clk-imx6sx.c
index ecde72bdfe88..17354a11356f 100644
--- a/arch/arm/mach-imx/clk-imx6sx.c
+++ b/arch/arm/mach-imx/clk-imx6sx.c
@@ -81,6 +81,14 @@ static const char *lvds_sels[] = {
81 "arm", "pll1_sys", "dummy", "dummy", "dummy", "dummy", "dummy", "pll5_video_div", 81 "arm", "pll1_sys", "dummy", "dummy", "dummy", "dummy", "dummy", "pll5_video_div",
82 "dummy", "dummy", "pcie_ref_125m", "dummy", "usbphy1", "usbphy2", 82 "dummy", "dummy", "pcie_ref_125m", "dummy", "usbphy1", "usbphy2",
83}; 83};
84static const char *pll_bypass_src_sels[] = { "osc", "lvds1_in", };
85static const char *pll1_bypass_sels[] = { "pll1", "pll1_bypass_src", };
86static const char *pll2_bypass_sels[] = { "pll2", "pll2_bypass_src", };
87static const char *pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", };
88static const char *pll4_bypass_sels[] = { "pll4", "pll4_bypass_src", };
89static const char *pll5_bypass_sels[] = { "pll5", "pll5_bypass_src", };
90static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", };
91static const char *pll7_bypass_sels[] = { "pll7", "pll7_bypass_src", };
84 92
85static struct clk *clks[IMX6SX_CLK_CLK_END]; 93static struct clk *clks[IMX6SX_CLK_CLK_END];
86static struct clk_onecell_data clk_data; 94static struct clk_onecell_data clk_data;
@@ -143,18 +151,54 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
143 clks[IMX6SX_CLK_IPP_DI0] = of_clk_get_by_name(ccm_node, "ipp_di0"); 151 clks[IMX6SX_CLK_IPP_DI0] = of_clk_get_by_name(ccm_node, "ipp_di0");
144 clks[IMX6SX_CLK_IPP_DI1] = of_clk_get_by_name(ccm_node, "ipp_di1"); 152 clks[IMX6SX_CLK_IPP_DI1] = of_clk_get_by_name(ccm_node, "ipp_di1");
145 153
154 /* Clock source from external clock via CLK1 PAD */
155 clks[IMX6SX_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0);
156
146 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-anatop"); 157 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-anatop");
147 base = of_iomap(np, 0); 158 base = of_iomap(np, 0);
148 WARN_ON(!base); 159 WARN_ON(!base);
149 160
150 /* type name parent_name base div_mask */ 161 clks[IMX6SX_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
151 clks[IMX6SX_CLK_PLL1_SYS] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f); 162 clks[IMX6SX_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
152 clks[IMX6SX_CLK_PLL2_BUS] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1); 163 clks[IMX6SX_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
153 clks[IMX6SX_CLK_PLL3_USB_OTG] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x3); 164 clks[IMX6SX_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
154 clks[IMX6SX_CLK_PLL4_AUDIO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x7f); 165 clks[IMX6SX_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
155 clks[IMX6SX_CLK_PLL5_VIDEO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f); 166 clks[IMX6SX_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
156 clks[IMX6SX_CLK_PLL6_ENET] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3); 167 clks[IMX6SX_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
157 clks[IMX6SX_CLK_PLL7_USB_HOST] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host", "osc", base + 0x20, 0x3); 168
169 /* type name parent_name base div_mask */
170 clks[IMX6SX_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1", "pll1_bypass_src", base + 0x00, 0x7f);
171 clks[IMX6SX_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", base + 0x30, 0x1);
172 clks[IMX6SX_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "pll3_bypass_src", base + 0x10, 0x3);
173 clks[IMX6SX_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", base + 0x70, 0x7f);
174 clks[IMX6SX_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5", "pll5_bypass_src", base + 0xa0, 0x7f);
175 clks[IMX6SX_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "pll6_bypass_src", base + 0xe0, 0x3);
176 clks[IMX6SX_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "pll7_bypass_src", base + 0x20, 0x3);
177
178 clks[IMX6SX_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT);
179 clks[IMX6SX_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT);
180 clks[IMX6SX_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT);
181 clks[IMX6SX_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT);
182 clks[IMX6SX_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT);
183 clks[IMX6SX_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT);
184 clks[IMX6SX_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT);
185
186 /* Do not bypass PLLs initially */
187 clk_set_parent(clks[IMX6SX_PLL1_BYPASS], clks[IMX6SX_CLK_PLL1]);
188 clk_set_parent(clks[IMX6SX_PLL2_BYPASS], clks[IMX6SX_CLK_PLL2]);
189 clk_set_parent(clks[IMX6SX_PLL3_BYPASS], clks[IMX6SX_CLK_PLL3]);
190 clk_set_parent(clks[IMX6SX_PLL4_BYPASS], clks[IMX6SX_CLK_PLL4]);
191 clk_set_parent(clks[IMX6SX_PLL5_BYPASS], clks[IMX6SX_CLK_PLL5]);
192 clk_set_parent(clks[IMX6SX_PLL6_BYPASS], clks[IMX6SX_CLK_PLL6]);
193 clk_set_parent(clks[IMX6SX_PLL7_BYPASS], clks[IMX6SX_CLK_PLL7]);
194
195 clks[IMX6SX_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", base + 0x00, 13);
196 clks[IMX6SX_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", base + 0x30, 13);
197 clks[IMX6SX_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13);
198 clks[IMX6SX_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", base + 0x70, 13);
199 clks[IMX6SX_CLK_PLL5_VIDEO] = imx_clk_gate("pll5_video", "pll5_bypass", base + 0xa0, 13);
200 clks[IMX6SX_CLK_PLL6_ENET] = imx_clk_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13);
201 clks[IMX6SX_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13);
158 202
159 /* 203 /*
160 * Bit 20 is the reserved and read-only bit, we do this only for: 204 * Bit 20 is the reserved and read-only bit, we do this only for:
@@ -176,7 +220,8 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
176 clks[IMX6SX_CLK_PCIE_REF] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 5); 220 clks[IMX6SX_CLK_PCIE_REF] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 5);
177 clks[IMX6SX_CLK_PCIE_REF_125M] = imx_clk_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19); 221 clks[IMX6SX_CLK_PCIE_REF_125M] = imx_clk_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19);
178 222
179 clks[IMX6SX_CLK_LVDS1_OUT] = imx_clk_gate("lvds1_out", "lvds1_sel", base + 0x160, 10); 223 clks[IMX6SX_CLK_LVDS1_OUT] = imx_clk_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x160, 10, BIT(12));
224 clks[IMX6SX_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10));
180 225
181 clks[IMX6SX_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, 226 clks[IMX6SX_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0,
182 base + 0xe0, 0, 2, 0, clk_enet_ref_table, 227 base + 0xe0, 0, 2, 0, clk_enet_ref_table,
diff --git a/arch/arm/mach-imx/clk-pllv3.c b/arch/arm/mach-imx/clk-pllv3.c
index 61364050fccd..57de74da0acf 100644
--- a/arch/arm/mach-imx/clk-pllv3.c
+++ b/arch/arm/mach-imx/clk-pllv3.c
@@ -23,8 +23,6 @@
23#define PLL_DENOM_OFFSET 0x20 23#define PLL_DENOM_OFFSET 0x20
24 24
25#define BM_PLL_POWER (0x1 << 12) 25#define BM_PLL_POWER (0x1 << 12)
26#define BM_PLL_ENABLE (0x1 << 13)
27#define BM_PLL_BYPASS (0x1 << 16)
28#define BM_PLL_LOCK (0x1 << 31) 26#define BM_PLL_LOCK (0x1 << 31)
29 27
30/** 28/**
@@ -84,10 +82,6 @@ static int clk_pllv3_prepare(struct clk_hw *hw)
84 if (ret) 82 if (ret)
85 return ret; 83 return ret;
86 84
87 val = readl_relaxed(pll->base);
88 val &= ~BM_PLL_BYPASS;
89 writel_relaxed(val, pll->base);
90
91 return 0; 85 return 0;
92} 86}
93 87
@@ -97,7 +91,6 @@ static void clk_pllv3_unprepare(struct clk_hw *hw)
97 u32 val; 91 u32 val;
98 92
99 val = readl_relaxed(pll->base); 93 val = readl_relaxed(pll->base);
100 val |= BM_PLL_BYPASS;
101 if (pll->powerup_set) 94 if (pll->powerup_set)
102 val &= ~BM_PLL_POWER; 95 val &= ~BM_PLL_POWER;
103 else 96 else
@@ -105,28 +98,6 @@ static void clk_pllv3_unprepare(struct clk_hw *hw)
105 writel_relaxed(val, pll->base); 98 writel_relaxed(val, pll->base);
106} 99}
107 100
108static int clk_pllv3_enable(struct clk_hw *hw)
109{
110 struct clk_pllv3 *pll = to_clk_pllv3(hw);
111 u32 val;
112
113 val = readl_relaxed(pll->base);
114 val |= BM_PLL_ENABLE;
115 writel_relaxed(val, pll->base);
116
117 return 0;
118}
119
120static void clk_pllv3_disable(struct clk_hw *hw)
121{
122 struct clk_pllv3 *pll = to_clk_pllv3(hw);
123 u32 val;
124
125 val = readl_relaxed(pll->base);
126 val &= ~BM_PLL_ENABLE;
127 writel_relaxed(val, pll->base);
128}
129
130static unsigned long clk_pllv3_recalc_rate(struct clk_hw *hw, 101static unsigned long clk_pllv3_recalc_rate(struct clk_hw *hw,
131 unsigned long parent_rate) 102 unsigned long parent_rate)
132{ 103{
@@ -169,8 +140,6 @@ static int clk_pllv3_set_rate(struct clk_hw *hw, unsigned long rate,
169static const struct clk_ops clk_pllv3_ops = { 140static const struct clk_ops clk_pllv3_ops = {
170 .prepare = clk_pllv3_prepare, 141 .prepare = clk_pllv3_prepare,
171 .unprepare = clk_pllv3_unprepare, 142 .unprepare = clk_pllv3_unprepare,
172 .enable = clk_pllv3_enable,
173 .disable = clk_pllv3_disable,
174 .recalc_rate = clk_pllv3_recalc_rate, 143 .recalc_rate = clk_pllv3_recalc_rate,
175 .round_rate = clk_pllv3_round_rate, 144 .round_rate = clk_pllv3_round_rate,
176 .set_rate = clk_pllv3_set_rate, 145 .set_rate = clk_pllv3_set_rate,
@@ -225,8 +194,6 @@ static int clk_pllv3_sys_set_rate(struct clk_hw *hw, unsigned long rate,
225static const struct clk_ops clk_pllv3_sys_ops = { 194static const struct clk_ops clk_pllv3_sys_ops = {
226 .prepare = clk_pllv3_prepare, 195 .prepare = clk_pllv3_prepare,
227 .unprepare = clk_pllv3_unprepare, 196 .unprepare = clk_pllv3_unprepare,
228 .enable = clk_pllv3_enable,
229 .disable = clk_pllv3_disable,
230 .recalc_rate = clk_pllv3_sys_recalc_rate, 197 .recalc_rate = clk_pllv3_sys_recalc_rate,
231 .round_rate = clk_pllv3_sys_round_rate, 198 .round_rate = clk_pllv3_sys_round_rate,
232 .set_rate = clk_pllv3_sys_set_rate, 199 .set_rate = clk_pllv3_sys_set_rate,
@@ -299,8 +266,6 @@ static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate,
299static const struct clk_ops clk_pllv3_av_ops = { 266static const struct clk_ops clk_pllv3_av_ops = {
300 .prepare = clk_pllv3_prepare, 267 .prepare = clk_pllv3_prepare,
301 .unprepare = clk_pllv3_unprepare, 268 .unprepare = clk_pllv3_unprepare,
302 .enable = clk_pllv3_enable,
303 .disable = clk_pllv3_disable,
304 .recalc_rate = clk_pllv3_av_recalc_rate, 269 .recalc_rate = clk_pllv3_av_recalc_rate,
305 .round_rate = clk_pllv3_av_round_rate, 270 .round_rate = clk_pllv3_av_round_rate,
306 .set_rate = clk_pllv3_av_set_rate, 271 .set_rate = clk_pllv3_av_set_rate,
@@ -315,8 +280,6 @@ static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw,
315static const struct clk_ops clk_pllv3_enet_ops = { 280static const struct clk_ops clk_pllv3_enet_ops = {
316 .prepare = clk_pllv3_prepare, 281 .prepare = clk_pllv3_prepare,
317 .unprepare = clk_pllv3_unprepare, 282 .unprepare = clk_pllv3_unprepare,
318 .enable = clk_pllv3_enable,
319 .disable = clk_pllv3_disable,
320 .recalc_rate = clk_pllv3_enet_recalc_rate, 283 .recalc_rate = clk_pllv3_enet_recalc_rate,
321}; 284};
322 285
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index f60d6d569ce3..a17818475050 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -58,6 +58,8 @@
58#define PFD_PLL1_BASE (anatop_base + 0x2b0) 58#define PFD_PLL1_BASE (anatop_base + 0x2b0)
59#define PFD_PLL2_BASE (anatop_base + 0x100) 59#define PFD_PLL2_BASE (anatop_base + 0x100)
60#define PFD_PLL3_BASE (anatop_base + 0xf0) 60#define PFD_PLL3_BASE (anatop_base + 0xf0)
61#define PLL3_CTRL (anatop_base + 0x10)
62#define PLL7_CTRL (anatop_base + 0x20)
61 63
62static void __iomem *anatop_base; 64static void __iomem *anatop_base;
63static void __iomem *ccm_base; 65static void __iomem *ccm_base;
@@ -98,9 +100,15 @@ static struct clk_div_table pll4_main_div_table[] = {
98static struct clk *clk[VF610_CLK_END]; 100static struct clk *clk[VF610_CLK_END];
99static struct clk_onecell_data clk_data; 101static struct clk_onecell_data clk_data;
100 102
103static unsigned int const clks_init_on[] __initconst = {
104 VF610_CLK_SYS_BUS,
105 VF610_CLK_DDR_SEL,
106};
107
101static void __init vf610_clocks_init(struct device_node *ccm_node) 108static void __init vf610_clocks_init(struct device_node *ccm_node)
102{ 109{
103 struct device_node *np; 110 struct device_node *np;
111 int i;
104 112
105 clk[VF610_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 113 clk[VF610_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
106 clk[VF610_CLK_SIRC_128K] = imx_clk_fixed("sirc_128k", 128000); 114 clk[VF610_CLK_SIRC_128K] = imx_clk_fixed("sirc_128k", 128000);
@@ -148,6 +156,9 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
148 clk[VF610_CLK_PLL5_MAIN] = imx_clk_fixed_factor("pll5_main", "fast_clk_sel", 125, 6); 156 clk[VF610_CLK_PLL5_MAIN] = imx_clk_fixed_factor("pll5_main", "fast_clk_sel", 125, 6);
149 /* pll6: default 960Mhz */ 157 /* pll6: default 960Mhz */
150 clk[VF610_CLK_PLL6_MAIN] = imx_clk_fixed_factor("pll6_main", "fast_clk_sel", 40, 1); 158 clk[VF610_CLK_PLL6_MAIN] = imx_clk_fixed_factor("pll6_main", "fast_clk_sel", 40, 1);
159 /* pll7: USB1 PLL at 480MHz */
160 clk[VF610_CLK_PLL7_MAIN] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_main", "fast_clk_sel", PLL7_CTRL, 0x2);
161
151 clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5); 162 clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5);
152 clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5); 163 clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5);
153 clk[VF610_CLK_SYS_SEL] = imx_clk_mux("sys_sel", CCM_CCSR, 0, 3, sys_sels, ARRAY_SIZE(sys_sels)); 164 clk[VF610_CLK_SYS_SEL] = imx_clk_mux("sys_sel", CCM_CCSR, 0, 3, sys_sels, ARRAY_SIZE(sys_sels));
@@ -160,8 +171,11 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
160 clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_main_div", "pll4_main", 0, CCM_CACRR, 6, 3, 0, pll4_main_div_table, &imx_ccm_lock); 171 clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_main_div", "pll4_main", 0, CCM_CACRR, 6, 3, 0, pll4_main_div_table, &imx_ccm_lock);
161 clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_main_div", "pll6_main", CCM_CACRR, 21, 1); 172 clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_main_div", "pll6_main", CCM_CACRR, 21, 1);
162 173
163 clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "pll3_main", CCM_CCGR1, CCM_CCGRx_CGn(4)); 174 clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_main", PLL3_CTRL, 6);
164 clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "pll3_main", CCM_CCGR7, CCM_CCGRx_CGn(4)); 175 clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_main", PLL7_CTRL, 6);
176
177 clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4));
178 clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4));
165 179
166 clk[VF610_CLK_QSPI0_SEL] = imx_clk_mux("qspi0_sel", CCM_CSCMR1, 22, 2, qspi_sels, 4); 180 clk[VF610_CLK_QSPI0_SEL] = imx_clk_mux("qspi0_sel", CCM_CSCMR1, 22, 2, qspi_sels, 4);
167 clk[VF610_CLK_QSPI0_EN] = imx_clk_gate("qspi0_en", "qspi0_sel", CCM_CSCDR3, 4); 181 clk[VF610_CLK_QSPI0_EN] = imx_clk_gate("qspi0_en", "qspi0_sel", CCM_CSCDR3, 4);
@@ -322,6 +336,9 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
322 clk_set_parent(clk[VF610_CLK_SAI2_SEL], clk[VF610_CLK_AUDIO_EXT]); 336 clk_set_parent(clk[VF610_CLK_SAI2_SEL], clk[VF610_CLK_AUDIO_EXT]);
323 clk_set_parent(clk[VF610_CLK_SAI3_SEL], clk[VF610_CLK_AUDIO_EXT]); 337 clk_set_parent(clk[VF610_CLK_SAI3_SEL], clk[VF610_CLK_AUDIO_EXT]);
324 338
339 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
340 clk_prepare_enable(clk[clks_init_on[i]]);
341
325 /* Add the clocks to provider list */ 342 /* Add the clocks to provider list */
326 clk_data.clks = clk; 343 clk_data.clks = clk;
327 clk_data.clk_num = ARRAY_SIZE(clk); 344 clk_data.clk_num = ARRAY_SIZE(clk);
diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
index d5ba76fee115..4cdf8b6a74e8 100644
--- a/arch/arm/mach-imx/clk.h
+++ b/arch/arm/mach-imx/clk.h
@@ -36,6 +36,9 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
36struct clk * imx_obtain_fixed_clock( 36struct clk * imx_obtain_fixed_clock(
37 const char *name, unsigned long rate); 37 const char *name, unsigned long rate);
38 38
39struct clk *imx_clk_gate_exclusive(const char *name, const char *parent,
40 void __iomem *reg, u8 shift, u32 exclusive_mask);
41
39static inline struct clk *imx_clk_gate2(const char *name, const char *parent, 42static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
40 void __iomem *reg, u8 shift) 43 void __iomem *reg, u8 shift)
41{ 44{
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 22ba8973bcb9..1dabf435c592 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -98,11 +98,9 @@ void imx_set_cpu_arg(int cpu, u32 arg);
98void v7_secondary_startup(void); 98void v7_secondary_startup(void);
99void imx_scu_map_io(void); 99void imx_scu_map_io(void);
100void imx_smp_prepare(void); 100void imx_smp_prepare(void);
101void imx_scu_standby_enable(void);
102#else 101#else
103static inline void imx_scu_map_io(void) {} 102static inline void imx_scu_map_io(void) {}
104static inline void imx_smp_prepare(void) {} 103static inline void imx_smp_prepare(void) {}
105static inline void imx_scu_standby_enable(void) {}
106#endif 104#endif
107void imx_src_init(void); 105void imx_src_init(void);
108void imx_gpc_init(void); 106void imx_gpc_init(void);
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
index 10844d3bb926..aa935787b743 100644
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
@@ -66,10 +66,6 @@ static struct cpuidle_driver imx6q_cpuidle_driver = {
66 66
67int __init imx6q_cpuidle_init(void) 67int __init imx6q_cpuidle_init(void)
68{ 68{
69 /* Need to enable SCU standby for entering WAIT modes */
70 if (!cpu_is_imx6sx())
71 imx_scu_standby_enable();
72
73 /* Set INT_MEM_CLK_LPM bit to get a reliable WAIT mode support */ 69 /* Set INT_MEM_CLK_LPM bit to get a reliable WAIT mode support */
74 imx6q_set_int_mem_clk_lpm(true); 70 imx6q_set_int_mem_clk_lpm(true);
75 71
diff --git a/arch/arm/mach-imx/eukrea-baseboards.h b/arch/arm/mach-imx/eukrea-baseboards.h
index a21d3313f994..bb2c90d65914 100644
--- a/arch/arm/mach-imx/eukrea-baseboards.h
+++ b/arch/arm/mach-imx/eukrea-baseboards.h
@@ -27,23 +27,15 @@
27 * This CPU module needs a baseboard to work. After basic initializing 27 * This CPU module needs a baseboard to work. After basic initializing
28 * its own devices, it calls baseboard's init function. 28 * its own devices, it calls baseboard's init function.
29 * TODO: Add your own baseboard init function and call it from 29 * TODO: Add your own baseboard init function and call it from
30 * inside eukrea_cpuimx25_init() eukrea_cpuimx27_init() 30 * inside eukrea_cpuimx25_init() or eukrea_cpuimx35_init()
31 * eukrea_cpuimx35_init() eukrea_cpuimx51_init()
32 * or eukrea_cpuimx51sd_init().
33 * 31 *
34 * This example here is for the development board. Refer 32 * This example here is for the development board. Refer
35 * mach-mx25/eukrea_mbimxsd-baseboard.c for cpuimx25 33 * mach-mx25/eukrea_mbimxsd-baseboard.c for cpuimx25
36 * mach-imx/eukrea_mbimx27-baseboard.c for cpuimx27
37 * mach-mx3/eukrea_mbimxsd-baseboard.c for cpuimx35 34 * mach-mx3/eukrea_mbimxsd-baseboard.c for cpuimx35
38 * mach-mx5/eukrea_mbimx51-baseboard.c for cpuimx51
39 * mach-mx5/eukrea_mbimxsd-baseboard.c for cpuimx51sd
40 */ 35 */
41 36
42extern void eukrea_mbimxsd25_baseboard_init(void); 37extern void eukrea_mbimxsd25_baseboard_init(void);
43extern void eukrea_mbimx27_baseboard_init(void);
44extern void eukrea_mbimxsd35_baseboard_init(void); 38extern void eukrea_mbimxsd35_baseboard_init(void);
45extern void eukrea_mbimx51_baseboard_init(void);
46extern void eukrea_mbimxsd51_baseboard_init(void);
47 39
48#endif 40#endif
49 41
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
deleted file mode 100644
index b2f08bfbbdd3..000000000000
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
+++ /dev/null
@@ -1,351 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#include <linux/gpio.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/spi/spi.h>
26#include <linux/spi/ads7846.h>
27#include <linux/backlight.h>
28#include <video/platform_lcd.h>
29
30#include <asm/mach/arch.h>
31
32#include "common.h"
33#include "devices-imx27.h"
34#include "hardware.h"
35#include "iomux-mx27.h"
36
37static const int eukrea_mbimx27_pins[] __initconst = {
38 /* UART2 */
39 PE3_PF_UART2_CTS,
40 PE4_PF_UART2_RTS,
41 PE6_PF_UART2_TXD,
42 PE7_PF_UART2_RXD,
43 /* UART3 */
44 PE8_PF_UART3_TXD,
45 PE9_PF_UART3_RXD,
46 PE10_PF_UART3_CTS,
47 PE11_PF_UART3_RTS,
48 /* UART4 */
49#if !defined(CONFIG_MACH_EUKREA_CPUIMX27_USEUART4)
50 PB26_AF_UART4_RTS,
51 PB28_AF_UART4_TXD,
52 PB29_AF_UART4_CTS,
53 PB31_AF_UART4_RXD,
54#endif
55 /* SDHC1*/
56 PE18_PF_SD1_D0,
57 PE19_PF_SD1_D1,
58 PE20_PF_SD1_D2,
59 PE21_PF_SD1_D3,
60 PE22_PF_SD1_CMD,
61 PE23_PF_SD1_CLK,
62 /* display */
63 PA5_PF_LSCLK,
64 PA6_PF_LD0,
65 PA7_PF_LD1,
66 PA8_PF_LD2,
67 PA9_PF_LD3,
68 PA10_PF_LD4,
69 PA11_PF_LD5,
70 PA12_PF_LD6,
71 PA13_PF_LD7,
72 PA14_PF_LD8,
73 PA15_PF_LD9,
74 PA16_PF_LD10,
75 PA17_PF_LD11,
76 PA18_PF_LD12,
77 PA19_PF_LD13,
78 PA20_PF_LD14,
79 PA21_PF_LD15,
80 PA22_PF_LD16,
81 PA23_PF_LD17,
82 PA28_PF_HSYNC,
83 PA29_PF_VSYNC,
84 PA30_PF_CONTRAST,
85 PA31_PF_OE_ACD,
86 /* SPI1 */
87 PD29_PF_CSPI1_SCLK,
88 PD30_PF_CSPI1_MISO,
89 PD31_PF_CSPI1_MOSI,
90 /* SSI4 */
91#if defined(CONFIG_SND_SOC_EUKREA_TLV320) \
92 || defined(CONFIG_SND_SOC_EUKREA_TLV320_MODULE)
93 PC16_PF_SSI4_FS,
94 PC17_PF_SSI4_RXD | GPIO_PUEN,
95 PC18_PF_SSI4_TXD | GPIO_PUEN,
96 PC19_PF_SSI4_CLK,
97#endif
98};
99
100static const uint32_t eukrea_mbimx27_keymap[] = {
101 KEY(0, 0, KEY_UP),
102 KEY(0, 1, KEY_DOWN),
103 KEY(1, 0, KEY_RIGHT),
104 KEY(1, 1, KEY_LEFT),
105};
106
107static const struct matrix_keymap_data
108eukrea_mbimx27_keymap_data __initconst = {
109 .keymap = eukrea_mbimx27_keymap,
110 .keymap_size = ARRAY_SIZE(eukrea_mbimx27_keymap),
111};
112
113static const struct gpio_led eukrea_mbimx27_gpio_leds[] __initconst = {
114 {
115 .name = "led1",
116 .default_trigger = "heartbeat",
117 .active_low = 1,
118 .gpio = GPIO_PORTF | 16,
119 },
120 {
121 .name = "led2",
122 .default_trigger = "none",
123 .active_low = 1,
124 .gpio = GPIO_PORTF | 19,
125 },
126};
127
128static const struct gpio_led_platform_data
129 eukrea_mbimx27_gpio_led_info __initconst = {
130 .leds = eukrea_mbimx27_gpio_leds,
131 .num_leds = ARRAY_SIZE(eukrea_mbimx27_gpio_leds),
132};
133
134static struct imx_fb_videomode eukrea_mbimx27_modes[] = {
135 {
136 .mode = {
137 .name = "CMO-QVGA",
138 .refresh = 60,
139 .xres = 320,
140 .yres = 240,
141 .pixclock = 156000,
142 .hsync_len = 30,
143 .left_margin = 38,
144 .right_margin = 20,
145 .vsync_len = 3,
146 .upper_margin = 15,
147 .lower_margin = 4,
148 },
149 .pcr = 0xFAD08B80,
150 .bpp = 16,
151 }, {
152 .mode = {
153 .name = "DVI-VGA",
154 .refresh = 60,
155 .xres = 640,
156 .yres = 480,
157 .pixclock = 32000,
158 .hsync_len = 1,
159 .left_margin = 35,
160 .right_margin = 0,
161 .vsync_len = 1,
162 .upper_margin = 7,
163 .lower_margin = 0,
164 },
165 .pcr = 0xFA208B80,
166 .bpp = 16,
167 }, {
168 .mode = {
169 .name = "DVI-SVGA",
170 .refresh = 60,
171 .xres = 800,
172 .yres = 600,
173 .pixclock = 25000,
174 .hsync_len = 1,
175 .left_margin = 35,
176 .right_margin = 0,
177 .vsync_len = 1,
178 .upper_margin = 7,
179 .lower_margin = 0,
180 },
181 .pcr = 0xFA208B80,
182 .bpp = 16,
183 },
184};
185
186static const struct imx_fb_platform_data eukrea_mbimx27_fb_data __initconst = {
187 .mode = eukrea_mbimx27_modes,
188 .num_modes = ARRAY_SIZE(eukrea_mbimx27_modes),
189
190 .pwmr = 0x00A903FF,
191 .lscr1 = 0x00120300,
192 .dmacr = 0x00040060,
193};
194
195static void eukrea_mbimx27_bl_set_intensity(int intensity)
196{
197 if (intensity)
198 gpio_direction_output(GPIO_PORTE | 5, 1);
199 else
200 gpio_direction_output(GPIO_PORTE | 5, 0);
201}
202
203static struct generic_bl_info eukrea_mbimx27_bl_info = {
204 .name = "eukrea_mbimx27-bl",
205 .max_intensity = 0xff,
206 .default_intensity = 0xff,
207 .set_bl_intensity = eukrea_mbimx27_bl_set_intensity,
208};
209
210static struct platform_device eukrea_mbimx27_bl_dev = {
211 .name = "generic-bl",
212 .id = 1,
213 .dev = {
214 .platform_data = &eukrea_mbimx27_bl_info,
215 },
216};
217
218static void eukrea_mbimx27_lcd_power_set(struct plat_lcd_data *pd,
219 unsigned int power)
220{
221 if (power)
222 gpio_direction_output(GPIO_PORTA | 25, 1);
223 else
224 gpio_direction_output(GPIO_PORTA | 25, 0);
225}
226
227static struct plat_lcd_data eukrea_mbimx27_lcd_power_data = {
228 .set_power = eukrea_mbimx27_lcd_power_set,
229};
230
231static struct platform_device eukrea_mbimx27_lcd_powerdev = {
232 .name = "platform-lcd",
233 .dev.platform_data = &eukrea_mbimx27_lcd_power_data,
234};
235
236static const struct imxuart_platform_data uart_pdata __initconst = {
237 .flags = IMXUART_HAVE_RTSCTS,
238};
239
240#define ADS7846_PENDOWN (GPIO_PORTD | 25)
241
242static void __maybe_unused ads7846_dev_init(void)
243{
244 if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) {
245 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
246 return;
247 }
248 gpio_direction_input(ADS7846_PENDOWN);
249}
250
251static int ads7846_get_pendown_state(void)
252{
253 return !gpio_get_value(ADS7846_PENDOWN);
254}
255
256static struct ads7846_platform_data ads7846_config __initdata = {
257 .get_pendown_state = ads7846_get_pendown_state,
258 .keep_vref_on = 1,
259};
260
261static struct spi_board_info __maybe_unused
262 eukrea_mbimx27_spi_board_info[] __initdata = {
263 [0] = {
264 .modalias = "ads7846",
265 .bus_num = 0,
266 .chip_select = 0,
267 .max_speed_hz = 1500000,
268 /* irq number is run-time assigned */
269 .platform_data = &ads7846_config,
270 .mode = SPI_MODE_2,
271 },
272};
273
274static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28};
275
276static const struct spi_imx_master eukrea_mbimx27_spi0_data __initconst = {
277 .chipselect = eukrea_mbimx27_spi_cs,
278 .num_chipselect = ARRAY_SIZE(eukrea_mbimx27_spi_cs),
279};
280
281static struct i2c_board_info eukrea_mbimx27_i2c_devices[] = {
282 {
283 I2C_BOARD_INFO("tlv320aic23", 0x1a),
284 },
285};
286
287static const struct imxmmc_platform_data sdhc_pdata __initconst = {
288 .dat3_card_detect = 1,
289};
290
291static const
292struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata __initconst = {
293 .flags = IMX_SSI_DMA | IMX_SSI_USE_I2S_SLAVE,
294};
295
296/*
297 * system init for baseboard usage. Will be called by cpuimx27 init.
298 *
299 * Add platform devices present on this baseboard and init
300 * them from CPU side as far as required to use them later on
301 */
302void __init eukrea_mbimx27_baseboard_init(void)
303{
304 mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins,
305 ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27");
306
307 imx27_add_imx_uart1(&uart_pdata);
308 imx27_add_imx_uart2(&uart_pdata);
309#if !defined(CONFIG_MACH_EUKREA_CPUIMX27_USEUART4)
310 imx27_add_imx_uart3(&uart_pdata);
311#endif
312
313 imx27_add_imx_fb(&eukrea_mbimx27_fb_data);
314 imx27_add_mxc_mmc(0, &sdhc_pdata);
315
316 i2c_register_board_info(0, eukrea_mbimx27_i2c_devices,
317 ARRAY_SIZE(eukrea_mbimx27_i2c_devices));
318
319 imx27_add_imx_ssi(0, &eukrea_mbimx27_ssi_pdata);
320
321#if defined(CONFIG_TOUCHSCREEN_ADS7846) \
322 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
323 /* ADS7846 Touchscreen controller init */
324 mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN);
325 ads7846_dev_init();
326#endif
327
328 /* SPI_CS0 init */
329 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
330 imx27_add_spi_imx0(&eukrea_mbimx27_spi0_data);
331 eukrea_mbimx27_spi_board_info[0].irq = gpio_to_irq(IMX_GPIO_NR(4, 25));
332 spi_register_board_info(eukrea_mbimx27_spi_board_info,
333 ARRAY_SIZE(eukrea_mbimx27_spi_board_info));
334
335 /* Leds configuration */
336 mxc_gpio_mode(GPIO_PORTF | 16 | GPIO_GPIO | GPIO_OUT);
337 mxc_gpio_mode(GPIO_PORTF | 19 | GPIO_GPIO | GPIO_OUT);
338 /* Backlight */
339 mxc_gpio_mode(GPIO_PORTE | 5 | GPIO_GPIO | GPIO_OUT);
340 gpio_request(GPIO_PORTE | 5, "backlight");
341 platform_device_register(&eukrea_mbimx27_bl_dev);
342 /* LCD Reset */
343 mxc_gpio_mode(GPIO_PORTA | 25 | GPIO_GPIO | GPIO_OUT);
344 gpio_request(GPIO_PORTA | 25, "lcd_enable");
345 platform_device_register(&eukrea_mbimx27_lcd_powerdev);
346
347 imx27_add_imx_keypad(&eukrea_mbimx27_keymap_data);
348
349 gpio_led_register_device(-1, &eukrea_mbimx27_gpio_led_info);
350 imx_add_platform_device("eukrea_tlv320", 0, NULL, 0, NULL, 0);
351}
diff --git a/arch/arm/mach-imx/imx1-dt.c b/arch/arm/mach-imx/imx1-dt.c
new file mode 100644
index 000000000000..6f915b0961c4
--- /dev/null
+++ b/arch/arm/mach-imx/imx1-dt.c
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#include <linux/of_platform.h>
11#include <asm/mach/arch.h>
12
13#include "common.h"
14
15static const char * const imx1_dt_board_compat[] __initconst = {
16 "fsl,imx1",
17 NULL
18};
19
20DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)")
21 .map_io = mx1_map_io,
22 .init_early = imx1_init_early,
23 .init_irq = mx1_init_irq,
24 .dt_compat = imx1_dt_board_compat,
25 .restart = mxc_restart,
26MACHINE_END
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index 080e66c6a1d0..dc8f1a6f45f2 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -20,7 +20,7 @@
20 20
21static void __init imx27_dt_init(void) 21static void __init imx27_dt_init(void)
22{ 22{
23 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 23 struct platform_device_info devinfo = { .name = "cpufreq-dt", };
24 24
25 mxc_arch_reset_init_dt(); 25 mxc_arch_reset_init_dt();
26 26
diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
index 7c66805d2cc0..1657fe64cd0f 100644
--- a/arch/arm/mach-imx/iomux-imx31.c
+++ b/arch/arm/mach-imx/iomux-imx31.c
@@ -64,7 +64,6 @@ int mxc_iomux_mode(unsigned int pin_mode)
64 64
65 return ret; 65 return ret;
66} 66}
67EXPORT_SYMBOL(mxc_iomux_mode);
68 67
69/* 68/*
70 * This function configures the pad value for a IOMUX pin. 69 * This function configures the pad value for a IOMUX pin.
@@ -90,7 +89,6 @@ void mxc_iomux_set_pad(enum iomux_pins pin, u32 config)
90 89
91 spin_unlock(&gpio_mux_lock); 90 spin_unlock(&gpio_mux_lock);
92} 91}
93EXPORT_SYMBOL(mxc_iomux_set_pad);
94 92
95/* 93/*
96 * allocs a single pin: 94 * allocs a single pin:
@@ -116,7 +114,6 @@ int mxc_iomux_alloc_pin(unsigned int pin, const char *label)
116 114
117 return 0; 115 return 0;
118} 116}
119EXPORT_SYMBOL(mxc_iomux_alloc_pin);
120 117
121int mxc_iomux_setup_multiple_pins(const unsigned int *pin_list, unsigned count, 118int mxc_iomux_setup_multiple_pins(const unsigned int *pin_list, unsigned count,
122 const char *label) 119 const char *label)
@@ -137,7 +134,6 @@ setup_error:
137 mxc_iomux_release_multiple_pins(pin_list, i); 134 mxc_iomux_release_multiple_pins(pin_list, i);
138 return ret; 135 return ret;
139} 136}
140EXPORT_SYMBOL(mxc_iomux_setup_multiple_pins);
141 137
142void mxc_iomux_release_pin(unsigned int pin) 138void mxc_iomux_release_pin(unsigned int pin)
143{ 139{
@@ -146,7 +142,6 @@ void mxc_iomux_release_pin(unsigned int pin)
146 if (pad < (PIN_MAX + 1)) 142 if (pad < (PIN_MAX + 1))
147 clear_bit(pad, mxc_pin_alloc_map); 143 clear_bit(pad, mxc_pin_alloc_map);
148} 144}
149EXPORT_SYMBOL(mxc_iomux_release_pin);
150 145
151void mxc_iomux_release_multiple_pins(const unsigned int *pin_list, int count) 146void mxc_iomux_release_multiple_pins(const unsigned int *pin_list, int count)
152{ 147{
@@ -158,7 +153,6 @@ void mxc_iomux_release_multiple_pins(const unsigned int *pin_list, int count)
158 p++; 153 p++;
159 } 154 }
160} 155}
161EXPORT_SYMBOL(mxc_iomux_release_multiple_pins);
162 156
163/* 157/*
164 * This function enables/disables the general purpose function for a particular 158 * This function enables/disables the general purpose function for a particular
@@ -178,4 +172,3 @@ void mxc_iomux_set_gpr(enum iomux_gp_func gp, bool en)
178 __raw_writel(l, IOMUXGPR); 172 __raw_writel(l, IOMUXGPR);
179 spin_unlock(&gpio_mux_lock); 173 spin_unlock(&gpio_mux_lock);
180} 174}
181EXPORT_SYMBOL(mxc_iomux_set_gpr);
diff --git a/arch/arm/mach-imx/iomux-v1.c b/arch/arm/mach-imx/iomux-v1.c
index 2b156d1d9e21..ecd543664644 100644
--- a/arch/arm/mach-imx/iomux-v1.c
+++ b/arch/arm/mach-imx/iomux-v1.c
@@ -153,7 +153,6 @@ int mxc_gpio_mode(int gpio_mode)
153 153
154 return 0; 154 return 0;
155} 155}
156EXPORT_SYMBOL(mxc_gpio_mode);
157 156
158static int imx_iomuxv1_setup_multiple(const int *list, unsigned count) 157static int imx_iomuxv1_setup_multiple(const int *list, unsigned count)
159{ 158{
@@ -178,7 +177,6 @@ int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
178 ret = imx_iomuxv1_setup_multiple(pin_list, count); 177 ret = imx_iomuxv1_setup_multiple(pin_list, count);
179 return ret; 178 return ret;
180} 179}
181EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins);
182 180
183int __init imx_iomuxv1_init(void __iomem *base, int numports) 181int __init imx_iomuxv1_init(void __iomem *base, int numports)
184{ 182{
diff --git a/arch/arm/mach-imx/iomux-v3.c b/arch/arm/mach-imx/iomux-v3.c
index 9dae74bf47fc..d61f9606fc56 100644
--- a/arch/arm/mach-imx/iomux-v3.c
+++ b/arch/arm/mach-imx/iomux-v3.c
@@ -55,7 +55,6 @@ int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
55 55
56 return 0; 56 return 0;
57} 57}
58EXPORT_SYMBOL(mxc_iomux_v3_setup_pad);
59 58
60int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count) 59int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count)
61{ 60{
@@ -71,7 +70,6 @@ int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count)
71 } 70 }
72 return 0; 71 return 0;
73} 72}
74EXPORT_SYMBOL(mxc_iomux_v3_setup_multiple_pads);
75 73
76void mxc_iomux_v3_init(void __iomem *iomux_v3_base) 74void mxc_iomux_v3_init(void __iomem *iomux_v3_base)
77{ 75{
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c
index a7e9bd26a552..f2060523ba48 100644
--- a/arch/arm/mach-imx/mach-armadillo5x0.c
+++ b/arch/arm/mach-imx/mach-armadillo5x0.c
@@ -537,7 +537,7 @@ static void __init armadillo5x0_init(void)
537 gpio_free(ARMADILLO5X0_RTC_GPIO); 537 gpio_free(ARMADILLO5X0_RTC_GPIO);
538 } 538 }
539 if (armadillo5x0_i2c_rtc.irq == 0) 539 if (armadillo5x0_i2c_rtc.irq == 0)
540 pr_warning("armadillo5x0_init: failed to get RTC IRQ\n"); 540 pr_warn("armadillo5x0_init: failed to get RTC IRQ\n");
541 i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1); 541 i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1);
542 542
543 /* USB */ 543 /* USB */
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
deleted file mode 100644
index e6d4b9929571..000000000000
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ /dev/null
@@ -1,321 +0,0 @@
1/*
2 * Copyright (C) 2009 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm038.c which is :
5 * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
6 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
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/i2c.h>
24#include <linux/io.h>
25#include <linux/mtd/plat-ram.h>
26#include <linux/mtd/physmap.h>
27#include <linux/platform_device.h>
28#include <linux/serial_8250.h>
29#include <linux/usb/otg.h>
30#include <linux/usb/ulpi.h>
31
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/time.h>
35#include <asm/mach/map.h>
36
37#include "common.h"
38#include "devices-imx27.h"
39#include "ehci.h"
40#include "eukrea-baseboards.h"
41#include "hardware.h"
42#include "iomux-mx27.h"
43#include "ulpi.h"
44
45static const int eukrea_cpuimx27_pins[] __initconst = {
46 /* UART1 */
47 PE12_PF_UART1_TXD,
48 PE13_PF_UART1_RXD,
49 PE14_PF_UART1_CTS,
50 PE15_PF_UART1_RTS,
51 /* UART4 */
52#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USEUART4)
53 PB26_AF_UART4_RTS,
54 PB28_AF_UART4_TXD,
55 PB29_AF_UART4_CTS,
56 PB31_AF_UART4_RXD,
57#endif
58 /* FEC */
59 PD0_AIN_FEC_TXD0,
60 PD1_AIN_FEC_TXD1,
61 PD2_AIN_FEC_TXD2,
62 PD3_AIN_FEC_TXD3,
63 PD4_AOUT_FEC_RX_ER,
64 PD5_AOUT_FEC_RXD1,
65 PD6_AOUT_FEC_RXD2,
66 PD7_AOUT_FEC_RXD3,
67 PD8_AF_FEC_MDIO,
68 PD9_AIN_FEC_MDC,
69 PD10_AOUT_FEC_CRS,
70 PD11_AOUT_FEC_TX_CLK,
71 PD12_AOUT_FEC_RXD0,
72 PD13_AOUT_FEC_RX_DV,
73 PD14_AOUT_FEC_RX_CLK,
74 PD15_AOUT_FEC_COL,
75 PD16_AIN_FEC_TX_ER,
76 PF23_AIN_FEC_TX_EN,
77 /* I2C1 */
78 PD17_PF_I2C_DATA,
79 PD18_PF_I2C_CLK,
80 /* SDHC2 */
81#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
82 PB4_PF_SD2_D0,
83 PB5_PF_SD2_D1,
84 PB6_PF_SD2_D2,
85 PB7_PF_SD2_D3,
86 PB8_PF_SD2_CMD,
87 PB9_PF_SD2_CLK,
88#endif
89#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
90 /* Quad UART's IRQ */
91 GPIO_PORTB | 22 | GPIO_GPIO | GPIO_IN,
92 GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN,
93 GPIO_PORTB | 27 | GPIO_GPIO | GPIO_IN,
94 GPIO_PORTB | 30 | GPIO_GPIO | GPIO_IN,
95#endif
96 /* OTG */
97 PC7_PF_USBOTG_DATA5,
98 PC8_PF_USBOTG_DATA6,
99 PC9_PF_USBOTG_DATA0,
100 PC10_PF_USBOTG_DATA2,
101 PC11_PF_USBOTG_DATA1,
102 PC12_PF_USBOTG_DATA4,
103 PC13_PF_USBOTG_DATA3,
104 PE0_PF_USBOTG_NXT,
105 PE1_PF_USBOTG_STP,
106 PE2_PF_USBOTG_DIR,
107 PE24_PF_USBOTG_CLK,
108 PE25_PF_USBOTG_DATA7,
109 /* USBH2 */
110 PA0_PF_USBH2_CLK,
111 PA1_PF_USBH2_DIR,
112 PA2_PF_USBH2_DATA7,
113 PA3_PF_USBH2_NXT,
114 PA4_PF_USBH2_STP,
115 PD19_AF_USBH2_DATA4,
116 PD20_AF_USBH2_DATA3,
117 PD21_AF_USBH2_DATA6,
118 PD22_AF_USBH2_DATA0,
119 PD23_AF_USBH2_DATA2,
120 PD24_AF_USBH2_DATA1,
121 PD26_AF_USBH2_DATA5,
122};
123
124static struct physmap_flash_data eukrea_cpuimx27_flash_data = {
125 .width = 2,
126};
127
128static struct resource eukrea_cpuimx27_flash_resource = {
129 .start = 0xc0000000,
130 .end = 0xc3ffffff,
131 .flags = IORESOURCE_MEM,
132};
133
134static struct platform_device eukrea_cpuimx27_nor_mtd_device = {
135 .name = "physmap-flash",
136 .id = 0,
137 .dev = {
138 .platform_data = &eukrea_cpuimx27_flash_data,
139 },
140 .num_resources = 1,
141 .resource = &eukrea_cpuimx27_flash_resource,
142};
143
144static const struct imxuart_platform_data uart_pdata __initconst = {
145 .flags = IMXUART_HAVE_RTSCTS,
146};
147
148static const struct mxc_nand_platform_data
149cpuimx27_nand_board_info __initconst = {
150 .width = 1,
151 .hw_ecc = 1,
152};
153
154static struct platform_device *platform_devices[] __initdata = {
155 &eukrea_cpuimx27_nor_mtd_device,
156};
157
158static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
159 .bitrate = 100000,
160};
161
162static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {
163 {
164 I2C_BOARD_INFO("pcf8563", 0x51),
165 },
166};
167
168#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
169static struct plat_serial8250_port serial_platform_data[] = {
170 {
171 .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x200000),
172 /* irq number is run-time assigned */
173 .uartclk = 14745600,
174 .regshift = 1,
175 .iotype = UPIO_MEM,
176 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
177 }, {
178 .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x400000),
179 /* irq number is run-time assigned */
180 .uartclk = 14745600,
181 .regshift = 1,
182 .iotype = UPIO_MEM,
183 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
184 }, {
185 .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x800000),
186 /* irq number is run-time assigned */
187 .uartclk = 14745600,
188 .regshift = 1,
189 .iotype = UPIO_MEM,
190 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
191 }, {
192 .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x1000000),
193 /* irq number is run-time assigned */
194 .uartclk = 14745600,
195 .regshift = 1,
196 .iotype = UPIO_MEM,
197 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
198 }, {
199 }
200};
201
202static struct platform_device serial_device = {
203 .name = "serial8250",
204 .id = 0,
205 .dev = {
206 .platform_data = serial_platform_data,
207 },
208};
209#endif
210
211static int eukrea_cpuimx27_otg_init(struct platform_device *pdev)
212{
213 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
214}
215
216static struct mxc_usbh_platform_data otg_pdata __initdata = {
217 .init = eukrea_cpuimx27_otg_init,
218 .portsc = MXC_EHCI_MODE_ULPI,
219};
220
221static int eukrea_cpuimx27_usbh2_init(struct platform_device *pdev)
222{
223 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
224}
225
226static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
227 .init = eukrea_cpuimx27_usbh2_init,
228 .portsc = MXC_EHCI_MODE_ULPI,
229};
230
231static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
232 .operating_mode = FSL_USB2_DR_DEVICE,
233 .phy_mode = FSL_USB2_PHY_ULPI,
234};
235
236static bool otg_mode_host __initdata;
237
238static int __init eukrea_cpuimx27_otg_mode(char *options)
239{
240 if (!strcmp(options, "host"))
241 otg_mode_host = true;
242 else if (!strcmp(options, "device"))
243 otg_mode_host = false;
244 else
245 pr_info("otg_mode neither \"host\" nor \"device\". "
246 "Defaulting to device\n");
247 return 1;
248}
249__setup("otg_mode=", eukrea_cpuimx27_otg_mode);
250
251static void __init eukrea_cpuimx27_init(void)
252{
253 imx27_soc_init();
254
255 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
256 ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");
257
258 imx27_add_imx_uart0(&uart_pdata);
259
260 imx27_add_mxc_nand(&cpuimx27_nand_board_info);
261
262 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
263 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
264
265 imx27_add_imx_i2c(0, &cpuimx27_i2c1_data);
266
267 imx27_add_fec(NULL);
268 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
269 imx27_add_imx2_wdt();
270 imx27_add_mxc_w1();
271
272#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
273 /* SDHC2 can be used for Wifi */
274 imx27_add_mxc_mmc(1, NULL);
275#endif
276#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USEUART4)
277 /* in which case UART4 is also used for Bluetooth */
278 imx27_add_imx_uart3(&uart_pdata);
279#endif
280
281#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
282 serial_platform_data[0].irq = IMX_GPIO_NR(2, 23);
283 serial_platform_data[1].irq = IMX_GPIO_NR(2, 22);
284 serial_platform_data[2].irq = IMX_GPIO_NR(2, 27);
285 serial_platform_data[3].irq = IMX_GPIO_NR(2, 30);
286 platform_device_register(&serial_device);
287#endif
288
289 if (otg_mode_host) {
290 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
291 ULPI_OTG_DRVVBUS_EXT);
292 if (otg_pdata.otg)
293 imx27_add_mxc_ehci_otg(&otg_pdata);
294 } else {
295 imx27_add_fsl_usb2_udc(&otg_device_pdata);
296 }
297
298 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
299 ULPI_OTG_DRVVBUS_EXT);
300 if (usbh2_pdata.otg)
301 imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
302
303#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
304 eukrea_mbimx27_baseboard_init();
305#endif
306}
307
308static void __init eukrea_cpuimx27_timer_init(void)
309{
310 mx27_clocks_init(26000000);
311}
312
313MACHINE_START(EUKREA_CPUIMX27, "EUKREA CPUIMX27")
314 .atag_offset = 0x100,
315 .map_io = mx27_map_io,
316 .init_early = imx27_init_early,
317 .init_irq = mx27_init_irq,
318 .init_time = eukrea_cpuimx27_timer_init,
319 .init_machine = eukrea_cpuimx27_init,
320 .restart = mxc_restart,
321MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx51.c b/arch/arm/mach-imx/mach-imx51.c
index c77deb3f0893..2c5fcaf8675b 100644
--- a/arch/arm/mach-imx/mach-imx51.c
+++ b/arch/arm/mach-imx/mach-imx51.c
@@ -51,7 +51,7 @@ static void __init imx51_ipu_mipi_setup(void)
51 51
52static void __init imx51_dt_init(void) 52static void __init imx51_dt_init(void)
53{ 53{
54 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 54 struct platform_device_info devinfo = { .name = "cpufreq-dt", };
55 55
56 mxc_arch_reset_init_dt(); 56 mxc_arch_reset_init_dt();
57 imx51_ipu_mipi_setup(); 57 imx51_ipu_mipi_setup();
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 673a734165ba..3de3b7369aef 100644
--- a/arch/arm/mach-imx/mach-imx6sx.c
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -42,6 +42,9 @@ static void __init imx6sx_init_irq(void)
42static void __init imx6sx_init_late(void) 42static void __init imx6sx_init_late(void)
43{ 43{
44 imx6q_cpuidle_init(); 44 imx6q_cpuidle_init();
45
46 if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
47 platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
45} 48}
46 49
47static const char * const imx6sx_dt_compat[] __initconst = { 50static const char * const imx6sx_dt_compat[] __initconst = {
diff --git a/arch/arm/mach-imx/mach-mx1ads.c b/arch/arm/mach-imx/mach-mx1ads.c
deleted file mode 100644
index 77fda3de4290..000000000000
--- a/arch/arm/mach-imx/mach-mx1ads.c
+++ /dev/null
@@ -1,154 +0,0 @@
1/*
2 * arch/arm/mach-imx/mach-mx1ads.c
3 *
4 * Initially based on:
5 * linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
6 * Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
7 *
8 * 2004 (c) MontaVista Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#include <linux/i2c.h>
16#include <linux/i2c/pcf857x.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/platform_device.h>
20#include <linux/mtd/physmap.h>
21
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/time.h>
25
26#include "common.h"
27#include "devices-imx1.h"
28#include "hardware.h"
29#include "iomux-mx1.h"
30
31static const int mx1ads_pins[] __initconst = {
32 /* UART1 */
33 PC9_PF_UART1_CTS,
34 PC10_PF_UART1_RTS,
35 PC11_PF_UART1_TXD,
36 PC12_PF_UART1_RXD,
37 /* UART2 */
38 PB28_PF_UART2_CTS,
39 PB29_PF_UART2_RTS,
40 PB30_PF_UART2_TXD,
41 PB31_PF_UART2_RXD,
42 /* I2C */
43 PA15_PF_I2C_SDA,
44 PA16_PF_I2C_SCL,
45 /* SPI */
46 PC13_PF_SPI1_SPI_RDY,
47 PC14_PF_SPI1_SCLK,
48 PC15_PF_SPI1_SS,
49 PC16_PF_SPI1_MISO,
50 PC17_PF_SPI1_MOSI,
51};
52
53/*
54 * UARTs platform data
55 */
56
57static const struct imxuart_platform_data uart0_pdata __initconst = {
58 .flags = IMXUART_HAVE_RTSCTS,
59};
60
61static const struct imxuart_platform_data uart1_pdata __initconst = {
62 .flags = IMXUART_HAVE_RTSCTS,
63};
64
65/*
66 * Physmap flash
67 */
68
69static const struct physmap_flash_data mx1ads_flash_data __initconst = {
70 .width = 4, /* bankwidth in bytes */
71};
72
73static const struct resource flash_resource __initconst = {
74 .start = MX1_CS0_PHYS,
75 .end = MX1_CS0_PHYS + SZ_32M - 1,
76 .flags = IORESOURCE_MEM,
77};
78
79/*
80 * I2C
81 */
82static struct pcf857x_platform_data pcf857x_data[] = {
83 {
84 .gpio_base = 4 * 32,
85 }, {
86 .gpio_base = 4 * 32 + 16,
87 }
88};
89
90static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
91 .bitrate = 100000,
92};
93
94static struct i2c_board_info mx1ads_i2c_devices[] = {
95 {
96 I2C_BOARD_INFO("pcf8575", 0x22),
97 .platform_data = &pcf857x_data[0],
98 }, {
99 I2C_BOARD_INFO("pcf8575", 0x24),
100 .platform_data = &pcf857x_data[1],
101 },
102};
103
104/*
105 * Board init
106 */
107static void __init mx1ads_init(void)
108{
109 imx1_soc_init();
110
111 mxc_gpio_setup_multiple_pins(mx1ads_pins,
112 ARRAY_SIZE(mx1ads_pins), "mx1ads");
113
114 /* UART */
115 imx1_add_imx_uart0(&uart0_pdata);
116 imx1_add_imx_uart1(&uart1_pdata);
117
118 /* Physmap flash */
119 platform_device_register_resndata(NULL, "physmap-flash", 0,
120 &flash_resource, 1,
121 &mx1ads_flash_data, sizeof(mx1ads_flash_data));
122
123 /* I2C */
124 i2c_register_board_info(0, mx1ads_i2c_devices,
125 ARRAY_SIZE(mx1ads_i2c_devices));
126
127 imx1_add_imx_i2c(&mx1ads_i2c_data);
128}
129
130static void __init mx1ads_timer_init(void)
131{
132 mx1_clocks_init(32000);
133}
134
135MACHINE_START(MX1ADS, "Freescale MX1ADS")
136 /* Maintainer: Sascha Hauer, Pengutronix */
137 .atag_offset = 0x100,
138 .map_io = mx1_map_io,
139 .init_early = imx1_init_early,
140 .init_irq = mx1_init_irq,
141 .init_time = mx1ads_timer_init,
142 .init_machine = mx1ads_init,
143 .restart = mxc_restart,
144MACHINE_END
145
146MACHINE_START(MXLADS, "Freescale MXLADS")
147 .atag_offset = 0x100,
148 .map_io = mx1_map_io,
149 .init_early = imx1_init_early,
150 .init_irq = mx1_init_irq,
151 .init_time = mx1ads_timer_init,
152 .init_machine = mx1ads_init,
153 .restart = mxc_restart,
154MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 453f41a2c5a9..65a0dc06a97c 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -307,7 +307,7 @@ static int mx31_3ds_sdhc1_init(struct device *dev,
307 ret = gpio_request_array(mx31_3ds_sdhc1_gpios, 307 ret = gpio_request_array(mx31_3ds_sdhc1_gpios,
308 ARRAY_SIZE(mx31_3ds_sdhc1_gpios)); 308 ARRAY_SIZE(mx31_3ds_sdhc1_gpios));
309 if (ret) { 309 if (ret) {
310 pr_warning("Unable to request the SD/MMC GPIOs.\n"); 310 pr_warn("Unable to request the SD/MMC GPIOs.\n");
311 return ret; 311 return ret;
312 } 312 }
313 313
@@ -316,7 +316,7 @@ static int mx31_3ds_sdhc1_init(struct device *dev,
316 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 316 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
317 "sdhc1-detect", data); 317 "sdhc1-detect", data);
318 if (ret) { 318 if (ret) {
319 pr_warning("Unable to request the SD/MMC card-detect IRQ.\n"); 319 pr_warn("Unable to request the SD/MMC card-detect IRQ.\n");
320 goto gpio_free; 320 goto gpio_free;
321 } 321 }
322 322
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index 57eac6f45fab..4822a1738de4 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -270,7 +270,7 @@ static void __init mx31lite_init(void)
270 /* SMSC9117 IRQ pin */ 270 /* SMSC9117 IRQ pin */
271 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); 271 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
272 if (ret) 272 if (ret)
273 pr_warning("could not get LAN irq gpio\n"); 273 pr_warn("could not get LAN irq gpio\n");
274 else { 274 else {
275 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_SFS6)); 275 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_SFS6));
276 smsc911x_resources[1].start = 276 smsc911x_resources[1].start =
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
deleted file mode 100644
index 0b5d1ca31b9f..000000000000
--- a/arch/arm/mach-imx/mach-mxt_td60.c
+++ /dev/null
@@ -1,273 +0,0 @@
1/*
2 * Copyright (C) 2000 Deep Blue Solutions Ltd
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright 2006-2007 Freescale Semiconductor, Inc. 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 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
17#include <linux/platform_device.h>
18#include <linux/mtd/mtd.h>
19#include <linux/mtd/map.h>
20#include <linux/mtd/partitions.h>
21#include <linux/mtd/physmap.h>
22#include <linux/i2c.h>
23#include <linux/irq.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/time.h>
27#include <asm/mach/map.h>
28#include <linux/gpio.h>
29#include <linux/platform_data/pca953x.h>
30
31#include "common.h"
32#include "devices-imx27.h"
33#include "hardware.h"
34#include "iomux-mx27.h"
35
36static const int mxt_td60_pins[] __initconst = {
37 /* UART0 */
38 PE12_PF_UART1_TXD,
39 PE13_PF_UART1_RXD,
40 PE14_PF_UART1_CTS,
41 PE15_PF_UART1_RTS,
42 /* UART1 */
43 PE3_PF_UART2_CTS,
44 PE4_PF_UART2_RTS,
45 PE6_PF_UART2_TXD,
46 PE7_PF_UART2_RXD,
47 /* UART2 */
48 PE8_PF_UART3_TXD,
49 PE9_PF_UART3_RXD,
50 PE10_PF_UART3_CTS,
51 PE11_PF_UART3_RTS,
52 /* FEC */
53 PD0_AIN_FEC_TXD0,
54 PD1_AIN_FEC_TXD1,
55 PD2_AIN_FEC_TXD2,
56 PD3_AIN_FEC_TXD3,
57 PD4_AOUT_FEC_RX_ER,
58 PD5_AOUT_FEC_RXD1,
59 PD6_AOUT_FEC_RXD2,
60 PD7_AOUT_FEC_RXD3,
61 PD8_AF_FEC_MDIO,
62 PD9_AIN_FEC_MDC,
63 PD10_AOUT_FEC_CRS,
64 PD11_AOUT_FEC_TX_CLK,
65 PD12_AOUT_FEC_RXD0,
66 PD13_AOUT_FEC_RX_DV,
67 PD14_AOUT_FEC_RX_CLK,
68 PD15_AOUT_FEC_COL,
69 PD16_AIN_FEC_TX_ER,
70 PF23_AIN_FEC_TX_EN,
71 /* I2C1 */
72 PD17_PF_I2C_DATA,
73 PD18_PF_I2C_CLK,
74 /* I2C2 */
75 PC5_PF_I2C2_SDA,
76 PC6_PF_I2C2_SCL,
77 /* FB */
78 PA5_PF_LSCLK,
79 PA6_PF_LD0,
80 PA7_PF_LD1,
81 PA8_PF_LD2,
82 PA9_PF_LD3,
83 PA10_PF_LD4,
84 PA11_PF_LD5,
85 PA12_PF_LD6,
86 PA13_PF_LD7,
87 PA14_PF_LD8,
88 PA15_PF_LD9,
89 PA16_PF_LD10,
90 PA17_PF_LD11,
91 PA18_PF_LD12,
92 PA19_PF_LD13,
93 PA20_PF_LD14,
94 PA21_PF_LD15,
95 PA22_PF_LD16,
96 PA23_PF_LD17,
97 PA25_PF_CLS,
98 PA27_PF_SPL_SPR,
99 PA28_PF_HSYNC,
100 PA29_PF_VSYNC,
101 PA30_PF_CONTRAST,
102 PA31_PF_OE_ACD,
103 /* OWIRE */
104 PE16_AF_OWIRE,
105 /* SDHC1*/
106 PE18_PF_SD1_D0,
107 PE19_PF_SD1_D1,
108 PE20_PF_SD1_D2,
109 PE21_PF_SD1_D3,
110 PE22_PF_SD1_CMD,
111 PE23_PF_SD1_CLK,
112 PF8_AF_ATA_IORDY,
113 /* SDHC2*/
114 PB4_PF_SD2_D0,
115 PB5_PF_SD2_D1,
116 PB6_PF_SD2_D2,
117 PB7_PF_SD2_D3,
118 PB8_PF_SD2_CMD,
119 PB9_PF_SD2_CLK,
120};
121
122static const struct mxc_nand_platform_data
123mxt_td60_nand_board_info __initconst = {
124 .width = 1,
125 .hw_ecc = 1,
126};
127
128static const struct imxi2c_platform_data mxt_td60_i2c0_data __initconst = {
129 .bitrate = 100000,
130};
131
132/* PCA9557 */
133static int mxt_td60_pca9557_setup(struct i2c_client *client,
134 unsigned gpio_base, unsigned ngpio,
135 void *context)
136{
137 static int mxt_td60_gpio_value[] = {
138 -1, -1, -1, -1, -1, -1, -1, 1
139 };
140 int n;
141
142 for (n = 0; n < ARRAY_SIZE(mxt_td60_gpio_value); ++n) {
143 gpio_request(gpio_base + n, "MXT_TD60 GPIO Exp");
144 if (mxt_td60_gpio_value[n] < 0)
145 gpio_direction_input(gpio_base + n);
146 else
147 gpio_direction_output(gpio_base + n,
148 mxt_td60_gpio_value[n]);
149 gpio_export(gpio_base + n, 0);
150 }
151
152 return 0;
153}
154
155static struct pca953x_platform_data mxt_td60_pca9557_pdata = {
156 .gpio_base = 240, /* place PCA9557 after all MX27 gpio pins */
157 .invert = 0, /* Do not invert */
158 .setup = mxt_td60_pca9557_setup,
159};
160
161static struct i2c_board_info mxt_td60_i2c_devices[] = {
162 {
163 I2C_BOARD_INFO("pca9557", 0x18),
164 .platform_data = &mxt_td60_pca9557_pdata,
165 },
166};
167
168static const struct imxi2c_platform_data mxt_td60_i2c1_data __initconst = {
169 .bitrate = 100000,
170};
171
172static struct i2c_board_info mxt_td60_i2c2_devices[] = {
173};
174
175static struct imx_fb_videomode mxt_td60_modes[] = {
176 {
177 .mode = {
178 .name = "Chimei LW700AT9003",
179 .refresh = 60,
180 .xres = 800,
181 .yres = 480,
182 .pixclock = 30303,
183 .hsync_len = 64,
184 .left_margin = 0x67,
185 .right_margin = 0x68,
186 .vsync_len = 16,
187 .upper_margin = 0x0f,
188 .lower_margin = 0x0f,
189 },
190 .bpp = 16,
191 .pcr = 0xFA208B83,
192 },
193};
194
195static const struct imx_fb_platform_data mxt_td60_fb_data __initconst = {
196 .mode = mxt_td60_modes,
197 .num_modes = ARRAY_SIZE(mxt_td60_modes),
198
199 /*
200 * - HSYNC active high
201 * - VSYNC active high
202 * - clk notenabled while idle
203 * - clock inverted
204 * - data not inverted
205 * - data enable low active
206 * - enable sharp mode
207 */
208 .pwmr = 0x00A903FF,
209 .lscr1 = 0x00120300,
210 .dmacr = 0x00020010,
211};
212
213static int mxt_td60_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
214 void *data)
215{
216 return request_irq(gpio_to_irq(IMX_GPIO_NR(6, 8)), detect_irq,
217 IRQF_TRIGGER_FALLING, "sdhc1-card-detect", data);
218}
219
220static void mxt_td60_sdhc1_exit(struct device *dev, void *data)
221{
222 free_irq(gpio_to_irq(IMX_GPIO_NR(6, 8)), data);
223}
224
225static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
226 .init = mxt_td60_sdhc1_init,
227 .exit = mxt_td60_sdhc1_exit,
228};
229
230static const struct imxuart_platform_data uart_pdata __initconst = {
231 .flags = IMXUART_HAVE_RTSCTS,
232};
233
234static void __init mxt_td60_board_init(void)
235{
236 imx27_soc_init();
237
238 mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins),
239 "MXT_TD60");
240
241 imx27_add_imx_uart0(&uart_pdata);
242 imx27_add_imx_uart1(&uart_pdata);
243 imx27_add_imx_uart2(&uart_pdata);
244 imx27_add_mxc_nand(&mxt_td60_nand_board_info);
245
246 i2c_register_board_info(0, mxt_td60_i2c_devices,
247 ARRAY_SIZE(mxt_td60_i2c_devices));
248
249 i2c_register_board_info(1, mxt_td60_i2c2_devices,
250 ARRAY_SIZE(mxt_td60_i2c2_devices));
251
252 imx27_add_imx_i2c(0, &mxt_td60_i2c0_data);
253 imx27_add_imx_i2c(1, &mxt_td60_i2c1_data);
254 imx27_add_imx_fb(&mxt_td60_fb_data);
255 imx27_add_mxc_mmc(0, &sdhc1_pdata);
256 imx27_add_fec(NULL);
257}
258
259static void __init mxt_td60_timer_init(void)
260{
261 mx27_clocks_init(26000000);
262}
263
264MACHINE_START(MXT_TD60, "Maxtrack i-MXT TD60")
265 /* maintainer: Maxtrack Industrial */
266 .atag_offset = 0x100,
267 .map_io = mx27_map_io,
268 .init_early = imx27_init_early,
269 .init_irq = mx27_init_irq,
270 .init_time = mxt_td60_timer_init,
271 .init_machine = mxt_td60_board_init,
272 .restart = mxc_restart,
273MACHINE_END
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
index 8eb1570f7851..6d879417db49 100644
--- a/arch/arm/mach-imx/mach-pcm037.c
+++ b/arch/arm/mach-imx/mach-pcm037.c
@@ -58,7 +58,7 @@ static int __init pcm037_variant_setup(char *str)
58 if (!strcmp("eet", str)) 58 if (!strcmp("eet", str))
59 pcm037_instance = PCM037_EET; 59 pcm037_instance = PCM037_EET;
60 else if (strcmp("pcm970", str)) 60 else if (strcmp("pcm970", str))
61 pr_warning("Unknown pcm037 baseboard variant %s\n", str); 61 pr_warn("Unknown pcm037 baseboard variant %s\n", str);
62 62
63 return 1; 63 return 1;
64} 64}
@@ -624,7 +624,7 @@ static void __init pcm037_init(void)
624 /* LAN9217 IRQ pin */ 624 /* LAN9217 IRQ pin */
625 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq"); 625 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");
626 if (ret) 626 if (ret)
627 pr_warning("could not get LAN irq gpio\n"); 627 pr_warn("could not get LAN irq gpio\n");
628 else { 628 else {
629 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)); 629 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
630 smsc911x_resources[1].start = 630 smsc911x_resources[1].start =
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
deleted file mode 100644
index ee862ad6b6fc..000000000000
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ /dev/null
@@ -1,358 +0,0 @@
1/*
2 * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
3 * Copyright (C) 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#include <linux/i2c.h>
21#include <linux/platform_data/at24.h>
22#include <linux/io.h>
23#include <linux/mtd/plat-ram.h>
24#include <linux/mtd/physmap.h>
25#include <linux/platform_device.h>
26#include <linux/regulator/machine.h>
27#include <linux/mfd/mc13783.h>
28#include <linux/spi/spi.h>
29#include <linux/irq.h>
30#include <linux/gpio.h>
31
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/time.h>
35
36#include "board-pcm038.h"
37#include "common.h"
38#include "devices-imx27.h"
39#include "ehci.h"
40#include "hardware.h"
41#include "iomux-mx27.h"
42#include "ulpi.h"
43
44static const int pcm038_pins[] __initconst = {
45 /* UART1 */
46 PE12_PF_UART1_TXD,
47 PE13_PF_UART1_RXD,
48 PE14_PF_UART1_CTS,
49 PE15_PF_UART1_RTS,
50 /* UART2 */
51 PE3_PF_UART2_CTS,
52 PE4_PF_UART2_RTS,
53 PE6_PF_UART2_TXD,
54 PE7_PF_UART2_RXD,
55 /* UART3 */
56 PE8_PF_UART3_TXD,
57 PE9_PF_UART3_RXD,
58 PE10_PF_UART3_CTS,
59 PE11_PF_UART3_RTS,
60 /* FEC */
61 PD0_AIN_FEC_TXD0,
62 PD1_AIN_FEC_TXD1,
63 PD2_AIN_FEC_TXD2,
64 PD3_AIN_FEC_TXD3,
65 PD4_AOUT_FEC_RX_ER,
66 PD5_AOUT_FEC_RXD1,
67 PD6_AOUT_FEC_RXD2,
68 PD7_AOUT_FEC_RXD3,
69 PD8_AF_FEC_MDIO,
70 PD9_AIN_FEC_MDC,
71 PD10_AOUT_FEC_CRS,
72 PD11_AOUT_FEC_TX_CLK,
73 PD12_AOUT_FEC_RXD0,
74 PD13_AOUT_FEC_RX_DV,
75 PD14_AOUT_FEC_RX_CLK,
76 PD15_AOUT_FEC_COL,
77 PD16_AIN_FEC_TX_ER,
78 PF23_AIN_FEC_TX_EN,
79 /* I2C2 */
80 PC5_PF_I2C2_SDA,
81 PC6_PF_I2C2_SCL,
82 /* SPI1 */
83 PD25_PF_CSPI1_RDY,
84 PD29_PF_CSPI1_SCLK,
85 PD30_PF_CSPI1_MISO,
86 PD31_PF_CSPI1_MOSI,
87 /* SSI1 */
88 PC20_PF_SSI1_FS,
89 PC21_PF_SSI1_RXD,
90 PC22_PF_SSI1_TXD,
91 PC23_PF_SSI1_CLK,
92 /* SSI4 */
93 PC16_PF_SSI4_FS,
94 PC17_PF_SSI4_RXD,
95 PC18_PF_SSI4_TXD,
96 PC19_PF_SSI4_CLK,
97 /* USB host */
98 PA0_PF_USBH2_CLK,
99 PA1_PF_USBH2_DIR,
100 PA2_PF_USBH2_DATA7,
101 PA3_PF_USBH2_NXT,
102 PA4_PF_USBH2_STP,
103 PD19_AF_USBH2_DATA4,
104 PD20_AF_USBH2_DATA3,
105 PD21_AF_USBH2_DATA6,
106 PD22_AF_USBH2_DATA0,
107 PD23_AF_USBH2_DATA2,
108 PD24_AF_USBH2_DATA1,
109 PD26_AF_USBH2_DATA5,
110};
111
112/*
113 * Phytec's PCM038 comes with 2MiB battery buffered SRAM,
114 * 16 bit width
115 */
116
117static struct platdata_mtd_ram pcm038_sram_data = {
118 .bankwidth = 2,
119};
120
121static struct resource pcm038_sram_resource = {
122 .start = MX27_CS1_BASE_ADDR,
123 .end = MX27_CS1_BASE_ADDR + 512 * 1024 - 1,
124 .flags = IORESOURCE_MEM,
125};
126
127static struct platform_device pcm038_sram_mtd_device = {
128 .name = "mtd-ram",
129 .id = 0,
130 .dev = {
131 .platform_data = &pcm038_sram_data,
132 },
133 .num_resources = 1,
134 .resource = &pcm038_sram_resource,
135};
136
137/*
138 * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
139 * 16 bit width
140 */
141static struct physmap_flash_data pcm038_flash_data = {
142 .width = 2,
143};
144
145static struct resource pcm038_flash_resource = {
146 .start = 0xc0000000,
147 .end = 0xc1ffffff,
148 .flags = IORESOURCE_MEM,
149};
150
151static struct platform_device pcm038_nor_mtd_device = {
152 .name = "physmap-flash",
153 .id = 0,
154 .dev = {
155 .platform_data = &pcm038_flash_data,
156 },
157 .num_resources = 1,
158 .resource = &pcm038_flash_resource,
159};
160
161static const struct imxuart_platform_data uart_pdata __initconst = {
162 .flags = IMXUART_HAVE_RTSCTS,
163};
164
165static const struct mxc_nand_platform_data
166pcm038_nand_board_info __initconst = {
167 .width = 1,
168 .hw_ecc = 1,
169};
170
171static struct platform_device *platform_devices[] __initdata = {
172 &pcm038_nor_mtd_device,
173 &pcm038_sram_mtd_device,
174};
175
176/* On pcm038 there's a sram attached to CS1, we enable the chipselect here and
177 * setup other stuffs to access the sram. */
178static void __init pcm038_init_sram(void)
179{
180 __raw_writel(0x0000d843, MX27_IO_ADDRESS(MX27_WEIM_CSCRxU(1)));
181 __raw_writel(0x22252521, MX27_IO_ADDRESS(MX27_WEIM_CSCRxL(1)));
182 __raw_writel(0x22220a00, MX27_IO_ADDRESS(MX27_WEIM_CSCRxA(1)));
183}
184
185static const struct imxi2c_platform_data pcm038_i2c1_data __initconst = {
186 .bitrate = 100000,
187};
188
189static struct at24_platform_data board_eeprom = {
190 .byte_len = 4096,
191 .page_size = 32,
192 .flags = AT24_FLAG_ADDR16,
193};
194
195static struct i2c_board_info pcm038_i2c_devices[] = {
196 {
197 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
198 .platform_data = &board_eeprom,
199 }, {
200 I2C_BOARD_INFO("pcf8563", 0x51),
201 }, {
202 I2C_BOARD_INFO("lm75", 0x4a),
203 }
204};
205
206static int pcm038_spi_cs[] = {GPIO_PORTD + 28};
207
208static const struct spi_imx_master pcm038_spi0_data __initconst = {
209 .chipselect = pcm038_spi_cs,
210 .num_chipselect = ARRAY_SIZE(pcm038_spi_cs),
211};
212
213static struct regulator_consumer_supply sdhc1_consumers[] = {
214 {
215 .dev_name = "imx21-mmc.1",
216 .supply = "sdhc_vcc",
217 },
218};
219
220static struct regulator_init_data sdhc1_data = {
221 .constraints = {
222 .min_uV = 3000000,
223 .max_uV = 3400000,
224 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
225 REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
226 .valid_modes_mask = REGULATOR_MODE_NORMAL |
227 REGULATOR_MODE_FAST,
228 .always_on = 0,
229 .boot_on = 0,
230 },
231 .num_consumer_supplies = ARRAY_SIZE(sdhc1_consumers),
232 .consumer_supplies = sdhc1_consumers,
233};
234
235static struct regulator_consumer_supply cam_consumers[] = {
236 {
237 .dev_name = NULL,
238 .supply = "imx_cam_vcc",
239 },
240};
241
242static struct regulator_init_data cam_data = {
243 .constraints = {
244 .min_uV = 3000000,
245 .max_uV = 3400000,
246 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
247 REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
248 .valid_modes_mask = REGULATOR_MODE_NORMAL |
249 REGULATOR_MODE_FAST,
250 .always_on = 0,
251 .boot_on = 0,
252 },
253 .num_consumer_supplies = ARRAY_SIZE(cam_consumers),
254 .consumer_supplies = cam_consumers,
255};
256
257static struct mc13xxx_regulator_init_data pcm038_regulators[] = {
258 {
259 .id = MC13783_REG_VCAM,
260 .init_data = &cam_data,
261 }, {
262 .id = MC13783_REG_VMMC1,
263 .init_data = &sdhc1_data,
264 },
265};
266
267static struct mc13xxx_platform_data pcm038_pmic = {
268 .regulators = {
269 .regulators = pcm038_regulators,
270 .num_regulators = ARRAY_SIZE(pcm038_regulators),
271 },
272 .flags = MC13XXX_USE_ADC | MC13XXX_USE_TOUCHSCREEN,
273};
274
275static struct spi_board_info pcm038_spi_board_info[] __initdata = {
276 {
277 .modalias = "mc13783",
278 /* irq number is run-time assigned */
279 .max_speed_hz = 300000,
280 .bus_num = 0,
281 .chip_select = 0,
282 .platform_data = &pcm038_pmic,
283 .mode = SPI_CS_HIGH,
284 }
285};
286
287static int pcm038_usbh2_init(struct platform_device *pdev)
288{
289 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED |
290 MXC_EHCI_INTERFACE_DIFF_UNI);
291}
292
293static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
294 .init = pcm038_usbh2_init,
295 .portsc = MXC_EHCI_MODE_ULPI,
296};
297
298static void __init pcm038_init(void)
299{
300 imx27_soc_init();
301
302 mxc_gpio_setup_multiple_pins(pcm038_pins, ARRAY_SIZE(pcm038_pins),
303 "PCM038");
304
305 pcm038_init_sram();
306
307 imx27_add_imx_uart0(&uart_pdata);
308 imx27_add_imx_uart1(&uart_pdata);
309 imx27_add_imx_uart2(&uart_pdata);
310
311 mxc_gpio_mode(PE16_AF_OWIRE);
312 imx27_add_mxc_nand(&pcm038_nand_board_info);
313
314 /* only the i2c master 1 is used on this CPU card */
315 i2c_register_board_info(1, pcm038_i2c_devices,
316 ARRAY_SIZE(pcm038_i2c_devices));
317
318 imx27_add_imx_i2c(1, &pcm038_i2c1_data);
319
320 /* PE18 for user-LED D40 */
321 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT);
322
323 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
324
325 /* MC13783 IRQ */
326 mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN);
327
328 imx27_add_spi_imx0(&pcm038_spi0_data);
329 pcm038_spi_board_info[0].irq = gpio_to_irq(IMX_GPIO_NR(2, 23));
330 spi_register_board_info(pcm038_spi_board_info,
331 ARRAY_SIZE(pcm038_spi_board_info));
332
333 imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
334
335 imx27_add_fec(NULL);
336 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
337 imx27_add_imx2_wdt();
338 imx27_add_mxc_w1();
339
340#ifdef CONFIG_MACH_PCM970_BASEBOARD
341 pcm970_baseboard_init();
342#endif
343}
344
345static void __init pcm038_timer_init(void)
346{
347 mx27_clocks_init(26000000);
348}
349
350MACHINE_START(PCM038, "phyCORE-i.MX27")
351 .atag_offset = 0x100,
352 .map_io = mx27_map_io,
353 .init_early = imx27_init_early,
354 .init_irq = mx27_init_irq,
355 .init_time = pcm038_timer_init,
356 .init_machine = pcm038_init,
357 .restart = mxc_restart,
358MACHINE_END
diff --git a/arch/arm/mach-imx/mxc.h b/arch/arm/mach-imx/mxc.h
index a39b69ef4301..17a41ca65acf 100644
--- a/arch/arm/mach-imx/mxc.h
+++ b/arch/arm/mach-imx/mxc.h
@@ -43,6 +43,8 @@
43#define IMX_CHIP_REVISION_1_1 0x11 43#define IMX_CHIP_REVISION_1_1 0x11
44#define IMX_CHIP_REVISION_1_2 0x12 44#define IMX_CHIP_REVISION_1_2 0x12
45#define IMX_CHIP_REVISION_1_3 0x13 45#define IMX_CHIP_REVISION_1_3 0x13
46#define IMX_CHIP_REVISION_1_4 0x14
47#define IMX_CHIP_REVISION_1_5 0x15
46#define IMX_CHIP_REVISION_2_0 0x20 48#define IMX_CHIP_REVISION_2_0 0x20
47#define IMX_CHIP_REVISION_2_1 0x21 49#define IMX_CHIP_REVISION_2_1 0x21
48#define IMX_CHIP_REVISION_2_2 0x22 50#define IMX_CHIP_REVISION_2_2 0x22
diff --git a/arch/arm/mach-imx/pcm970-baseboard.c b/arch/arm/mach-imx/pcm970-baseboard.c
deleted file mode 100644
index 51c608234089..000000000000
--- a/arch/arm/mach-imx/pcm970-baseboard.c
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
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, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
17 */
18
19#include <linux/gpio.h>
20#include <linux/irq.h>
21#include <linux/platform_device.h>
22#include <linux/can/platform/sja1000.h>
23
24#include <asm/mach/arch.h>
25
26#include "common.h"
27#include "devices-imx27.h"
28#include "hardware.h"
29#include "iomux-mx27.h"
30
31static const int pcm970_pins[] __initconst = {
32 /* SDHC */
33 PB4_PF_SD2_D0,
34 PB5_PF_SD2_D1,
35 PB6_PF_SD2_D2,
36 PB7_PF_SD2_D3,
37 PB8_PF_SD2_CMD,
38 PB9_PF_SD2_CLK,
39 /* display */
40 PA5_PF_LSCLK,
41 PA6_PF_LD0,
42 PA7_PF_LD1,
43 PA8_PF_LD2,
44 PA9_PF_LD3,
45 PA10_PF_LD4,
46 PA11_PF_LD5,
47 PA12_PF_LD6,
48 PA13_PF_LD7,
49 PA14_PF_LD8,
50 PA15_PF_LD9,
51 PA16_PF_LD10,
52 PA17_PF_LD11,
53 PA18_PF_LD12,
54 PA19_PF_LD13,
55 PA20_PF_LD14,
56 PA21_PF_LD15,
57 PA22_PF_LD16,
58 PA23_PF_LD17,
59 PA24_PF_REV,
60 PA25_PF_CLS,
61 PA26_PF_PS,
62 PA27_PF_SPL_SPR,
63 PA28_PF_HSYNC,
64 PA29_PF_VSYNC,
65 PA30_PF_CONTRAST,
66 PA31_PF_OE_ACD,
67 /*
68 * it seems the data line misses a pullup, so we must enable
69 * the internal pullup as a local workaround
70 */
71 PD17_PF_I2C_DATA | GPIO_PUEN,
72 PD18_PF_I2C_CLK,
73 /* Camera */
74 PB10_PF_CSI_D0,
75 PB11_PF_CSI_D1,
76 PB12_PF_CSI_D2,
77 PB13_PF_CSI_D3,
78 PB14_PF_CSI_D4,
79 PB15_PF_CSI_MCLK,
80 PB16_PF_CSI_PIXCLK,
81 PB17_PF_CSI_D5,
82 PB18_PF_CSI_D6,
83 PB19_PF_CSI_D7,
84 PB20_PF_CSI_VSYNC,
85 PB21_PF_CSI_HSYNC,
86};
87
88static int pcm970_sdhc2_get_ro(struct device *dev)
89{
90 return gpio_get_value(GPIO_PORTC + 28);
91}
92
93static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data)
94{
95 int ret;
96
97 ret = request_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), detect_irq,
98 IRQF_TRIGGER_FALLING, "imx-mmc-detect", data);
99 if (ret)
100 return ret;
101
102 ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro");
103 if (ret) {
104 free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data);
105 return ret;
106 }
107
108 gpio_direction_input(GPIO_PORTC + 28);
109
110 return 0;
111}
112
113static void pcm970_sdhc2_exit(struct device *dev, void *data)
114{
115 free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data);
116 gpio_free(GPIO_PORTC + 28);
117}
118
119static const struct imxmmc_platform_data sdhc_pdata __initconst = {
120 .get_ro = pcm970_sdhc2_get_ro,
121 .init = pcm970_sdhc2_init,
122 .exit = pcm970_sdhc2_exit,
123};
124
125static struct imx_fb_videomode pcm970_modes[] = {
126 {
127 .mode = {
128 .name = "Sharp-LQ035Q7",
129 .refresh = 60,
130 .xres = 240,
131 .yres = 320,
132 .pixclock = 188679, /* in ps (5.3MHz) */
133 .hsync_len = 7,
134 .left_margin = 5,
135 .right_margin = 16,
136 .vsync_len = 1,
137 .upper_margin = 7,
138 .lower_margin = 9,
139 },
140 /*
141 * - HSYNC active high
142 * - VSYNC active high
143 * - clk notenabled while idle
144 * - clock not inverted
145 * - data not inverted
146 * - data enable low active
147 * - enable sharp mode
148 */
149 .pcr = 0xF00080C0,
150 .bpp = 16,
151 }, {
152 .mode = {
153 .name = "TX090",
154 .refresh = 60,
155 .xres = 240,
156 .yres = 320,
157 .pixclock = 38255,
158 .left_margin = 144,
159 .right_margin = 0,
160 .upper_margin = 7,
161 .lower_margin = 40,
162 .hsync_len = 96,
163 .vsync_len = 1,
164 },
165 /*
166 * - HSYNC active low (1 << 22)
167 * - VSYNC active low (1 << 23)
168 * - clk notenabled while idle
169 * - clock not inverted
170 * - data not inverted
171 * - data enable low active
172 * - enable sharp mode
173 */
174 .pcr = 0xF0008080 | (1<<22) | (1<<23) | (1<<19),
175 .bpp = 32,
176 },
177};
178
179static const struct imx_fb_platform_data pcm038_fb_data __initconst = {
180 .mode = pcm970_modes,
181 .num_modes = ARRAY_SIZE(pcm970_modes),
182
183 .pwmr = 0x00A903FF,
184 .lscr1 = 0x00120300,
185 .dmacr = 0x00020010,
186};
187
188static struct resource pcm970_sja1000_resources[] = {
189 {
190 .start = MX27_CS4_BASE_ADDR,
191 .end = MX27_CS4_BASE_ADDR + 0x100 - 1,
192 .flags = IORESOURCE_MEM,
193 }, {
194 /* irq number is run-time assigned */
195 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
196 },
197};
198
199static struct sja1000_platform_data pcm970_sja1000_platform_data = {
200 .osc_freq = 16000000,
201 .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
202 .cdr = CDR_CBP,
203};
204
205static struct platform_device pcm970_sja1000 = {
206 .name = "sja1000_platform",
207 .dev = {
208 .platform_data = &pcm970_sja1000_platform_data,
209 },
210 .resource = pcm970_sja1000_resources,
211 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
212};
213
214/*
215 * system init for baseboard usage. Will be called by pcm038 init.
216 *
217 * Add platform devices present on this baseboard and init
218 * them from CPU side as far as required to use them later on
219 */
220void __init pcm970_baseboard_init(void)
221{
222 mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins),
223 "PCM970");
224
225 imx27_add_imx_fb(&pcm038_fb_data);
226 mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN);
227 imx27_add_mxc_mmc(1, &sdhc_pdata);
228 pcm970_sja1000_resources[1].start = gpio_to_irq(IMX_GPIO_NR(5, 19));
229 pcm970_sja1000_resources[1].end = gpio_to_irq(IMX_GPIO_NR(5, 19));
230 platform_device_register(&pcm970_sja1000);
231}
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 5b57c17c06bd..771bd25c1025 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -20,8 +20,6 @@
20#include "common.h" 20#include "common.h"
21#include "hardware.h" 21#include "hardware.h"
22 22
23#define SCU_STANDBY_ENABLE (1 << 5)
24
25u32 g_diag_reg; 23u32 g_diag_reg;
26static void __iomem *scu_base; 24static void __iomem *scu_base;
27 25
@@ -45,14 +43,6 @@ void __init imx_scu_map_io(void)
45 scu_base = IMX_IO_ADDRESS(base); 43 scu_base = IMX_IO_ADDRESS(base);
46} 44}
47 45
48void imx_scu_standby_enable(void)
49{
50 u32 val = readl_relaxed(scu_base);
51
52 val |= SCU_STANDBY_ENABLE;
53 writel_relaxed(val, scu_base);
54}
55
56static int imx_boot_secondary(unsigned int cpu, struct task_struct *idle) 46static int imx_boot_secondary(unsigned int cpu, struct task_struct *idle)
57{ 47{
58 imx_set_cpu_jump(cpu, v7_secondary_startup); 48 imx_set_cpu_jump(cpu, v7_secondary_startup);
diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
index 74b50f1982db..ca4ea2daf25b 100644
--- a/arch/arm/mach-imx/suspend-imx6.S
+++ b/arch/arm/mach-imx/suspend-imx6.S
@@ -173,6 +173,8 @@ ENTRY(imx6_suspend)
173 ldr r6, [r11, #0x0] 173 ldr r6, [r11, #0x0]
174 ldr r11, [r0, #PM_INFO_MX6Q_GPC_V_OFFSET] 174 ldr r11, [r0, #PM_INFO_MX6Q_GPC_V_OFFSET]
175 ldr r6, [r11, #0x0] 175 ldr r6, [r11, #0x0]
176 ldr r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET]
177 ldr r6, [r11, #0x0]
176 178
177 /* use r11 to store the IO address */ 179 /* use r11 to store the IO address */
178 ldr r11, [r0, #PM_INFO_MX6Q_SRC_V_OFFSET] 180 ldr r11, [r0, #PM_INFO_MX6Q_SRC_V_OFFSET]
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index bf92e5a351c0..15d18e198303 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -60,17 +60,22 @@
60#define MX2_TSTAT_CAPT (1 << 1) 60#define MX2_TSTAT_CAPT (1 << 1)
61#define MX2_TSTAT_COMP (1 << 0) 61#define MX2_TSTAT_COMP (1 << 0)
62 62
63/* MX31, MX35, MX25, MX5 */ 63/* MX31, MX35, MX25, MX5, MX6 */
64#define V2_TCTL_WAITEN (1 << 3) /* Wait enable mode */ 64#define V2_TCTL_WAITEN (1 << 3) /* Wait enable mode */
65#define V2_TCTL_CLK_IPG (1 << 6) 65#define V2_TCTL_CLK_IPG (1 << 6)
66#define V2_TCTL_CLK_PER (2 << 6) 66#define V2_TCTL_CLK_PER (2 << 6)
67#define V2_TCTL_CLK_OSC_DIV8 (5 << 6)
67#define V2_TCTL_FRR (1 << 9) 68#define V2_TCTL_FRR (1 << 9)
69#define V2_TCTL_24MEN (1 << 10)
70#define V2_TPRER_PRE24M 12
68#define V2_IR 0x0c 71#define V2_IR 0x0c
69#define V2_TSTAT 0x08 72#define V2_TSTAT 0x08
70#define V2_TSTAT_OF1 (1 << 0) 73#define V2_TSTAT_OF1 (1 << 0)
71#define V2_TCN 0x24 74#define V2_TCN 0x24
72#define V2_TCMP 0x10 75#define V2_TCMP 0x10
73 76
77#define V2_TIMER_RATE_OSC_DIV8 3000000
78
74#define timer_is_v1() (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27()) 79#define timer_is_v1() (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27())
75#define timer_is_v2() (!timer_is_v1()) 80#define timer_is_v2() (!timer_is_v1())
76 81
@@ -312,10 +317,22 @@ static void __init _mxc_timer_init(int irq,
312 __raw_writel(0, timer_base + MXC_TCTL); 317 __raw_writel(0, timer_base + MXC_TCTL);
313 __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */ 318 __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */
314 319
315 if (timer_is_v2()) 320 if (timer_is_v2()) {
316 tctl_val = V2_TCTL_CLK_PER | V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN; 321 tctl_val = V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN;
317 else 322 if (clk_get_rate(clk_per) == V2_TIMER_RATE_OSC_DIV8) {
323 tctl_val |= V2_TCTL_CLK_OSC_DIV8;
324 if (cpu_is_imx6dl() || cpu_is_imx6sx()) {
325 /* 24 / 8 = 3 MHz */
326 __raw_writel(7 << V2_TPRER_PRE24M,
327 timer_base + MXC_TPRER);
328 tctl_val |= V2_TCTL_24MEN;
329 }
330 } else {
331 tctl_val |= V2_TCTL_CLK_PER;
332 }
333 } else {
318 tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN; 334 tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN;
335 }
319 336
320 __raw_writel(tctl_val, timer_base + MXC_TCTL); 337 __raw_writel(tctl_val, timer_base + MXC_TCTL);
321 338
@@ -349,9 +366,13 @@ static void __init mxc_timer_init_dt(struct device_node *np)
349 WARN_ON(!timer_base); 366 WARN_ON(!timer_base);
350 irq = irq_of_parse_and_map(np, 0); 367 irq = irq_of_parse_and_map(np, 0);
351 368
352 clk_per = of_clk_get_by_name(np, "per");
353 clk_ipg = of_clk_get_by_name(np, "ipg"); 369 clk_ipg = of_clk_get_by_name(np, "ipg");
354 370
371 /* Try osc_per first, and fall back to per otherwise */
372 clk_per = of_clk_get_by_name(np, "osc_per");
373 if (IS_ERR(clk_per))
374 clk_per = of_clk_get_by_name(np, "per");
375
355 _mxc_timer_init(irq, clk_per, clk_ipg); 376 _mxc_timer_init(irq, clk_per, clk_ipg);
356} 377}
357CLOCKSOURCE_OF_DECLARE(mx1_timer, "fsl,imx1-gpt", mxc_timer_init_dt); 378CLOCKSOURCE_OF_DECLARE(mx1_timer, "fsl,imx1-gpt", mxc_timer_init_dt);
diff --git a/arch/arm/mach-imx/tzic.c b/arch/arm/mach-imx/tzic.c
index 1d4f384ca773..4de65eeda1eb 100644
--- a/arch/arm/mach-imx/tzic.c
+++ b/arch/arm/mach-imx/tzic.c
@@ -141,8 +141,7 @@ static void __exception_irq_entry tzic_handle_irq(struct pt_regs *regs)
141 while (stat) { 141 while (stat) {
142 handled = 1; 142 handled = 1;
143 irqofs = fls(stat) - 1; 143 irqofs = fls(stat) - 1;
144 handle_IRQ(irq_find_mapping(domain, 144 handle_domain_irq(domain, irqofs + i * 32, regs);
145 irqofs + i * 32), regs);
146 stat &= ~(1 << irqofs); 145 stat &= ~(1 << irqofs);
147 } 146 }
148 } 147 }
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 3ce880729cff..38b0da300dd5 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -20,10 +20,13 @@
20#include <linux/mm.h> 20#include <linux/mm.h>
21#include <linux/amba/bus.h> 21#include <linux/amba/bus.h>
22#include <linux/amba/clcd.h> 22#include <linux/amba/clcd.h>
23#include <linux/amba/mmci.h>
24#include <linux/amba/pl061.h>
23#include <linux/io.h> 25#include <linux/io.h>
24#include <linux/platform_data/clk-integrator.h> 26#include <linux/platform_data/clk-integrator.h>
25#include <linux/slab.h> 27#include <linux/slab.h>
26#include <linux/irqchip/arm-vic.h> 28#include <linux/irqchip/arm-vic.h>
29#include <linux/gpio/machine.h>
27 30
28#include <asm/sizes.h> 31#include <asm/sizes.h>
29#include "lm.h" 32#include "lm.h"
@@ -52,6 +55,13 @@ void impd1_tweak_control(struct device *dev, u32 mask, u32 val)
52EXPORT_SYMBOL(impd1_tweak_control); 55EXPORT_SYMBOL(impd1_tweak_control);
53 56
54/* 57/*
58 * MMC support
59 */
60static struct mmci_platform_data mmc_data = {
61 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
62};
63
64/*
55 * CLCD support 65 * CLCD support
56 */ 66 */
57#define PANEL PROSPECTOR 67#define PANEL PROSPECTOR
@@ -291,6 +301,7 @@ static struct impd1_device impd1_devs[] = {
291 .offset = 0x00700000, 301 .offset = 0x00700000,
292 .irq = { 7, 8 }, 302 .irq = { 7, 8 },
293 .id = 0x00041181, 303 .id = 0x00041181,
304 .platform_data = &mmc_data,
294 }, { 305 }, {
295 .offset = 0x00800000, 306 .offset = 0x00800000,
296 .irq = { 9 }, 307 .irq = { 9 },
@@ -372,6 +383,43 @@ static int __init_refok impd1_probe(struct lm_device *dev)
372 383
373 pc_base = dev->resource.start + idev->offset; 384 pc_base = dev->resource.start + idev->offset;
374 snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12); 385 snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12);
386
387 /* Add GPIO descriptor lookup table for the PL061 block */
388 if (idev->offset == 0x00400000) {
389 struct gpiod_lookup_table *lookup;
390 char *chipname;
391 char *mmciname;
392
393 lookup = devm_kzalloc(&dev->dev,
394 sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup),
395 GFP_KERNEL);
396 chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL);
397 mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id);
398 lookup->dev_id = mmciname;
399 /*
400 * Offsets on GPIO block 1:
401 * 3 = MMC WP (write protect)
402 * 4 = MMC CD (card detect)
403 *
404 * Offsets on GPIO block 2:
405 * 0 = Up key
406 * 1 = Down key
407 * 2 = Left key
408 * 3 = Right key
409 * 4 = Key lower left
410 * 5 = Key lower right
411 */
412 /* We need the two MMCI GPIO entries */
413 lookup->table[0].chip_label = chipname;
414 lookup->table[0].chip_hwnum = 3;
415 lookup->table[0].con_id = "wp";
416 lookup->table[1].chip_label = chipname;
417 lookup->table[1].chip_hwnum = 4;
418 lookup->table[1].con_id = "cd";
419 lookup->table[1].flags = GPIO_ACTIVE_LOW;
420 gpiod_add_lookup_table(lookup);
421 }
422
375 d = amba_ahb_device_add_res(&dev->dev, devname, pc_base, SZ_4K, 423 d = amba_ahb_device_add_res(&dev->dev, devname, pc_base, SZ_4K,
376 irq1, irq2, 424 irq1, irq2,
377 idev->platform_data, idev->id, 425 idev->platform_data, idev->id,
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index 05e1f73a1e8d..c186a17c2cff 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -660,6 +660,7 @@ static void __init pci_v3_preinit(void)
660{ 660{
661 unsigned long flags; 661 unsigned long flags;
662 unsigned int temp; 662 unsigned int temp;
663 phys_addr_t io_address = pci_pio_to_address(io_mem.start);
663 664
664 pcibios_min_mem = 0x00100000; 665 pcibios_min_mem = 0x00100000;
665 666
@@ -701,7 +702,7 @@ static void __init pci_v3_preinit(void)
701 /* 702 /*
702 * Setup window 2 - PCI IO 703 * Setup window 2 - PCI IO
703 */ 704 */
704 v3_writel(V3_LB_BASE2, v3_addr_to_lb_base2(io_mem.start) | 705 v3_writel(V3_LB_BASE2, v3_addr_to_lb_base2(io_address) |
705 V3_LB_BASE_ENABLE); 706 V3_LB_BASE_ENABLE);
706 v3_writew(V3_LB_MAP2, v3_addr_to_lb_map2(0)); 707 v3_writew(V3_LB_MAP2, v3_addr_to_lb_map2(0));
707 708
@@ -742,6 +743,7 @@ static void __init pci_v3_preinit(void)
742static void __init pci_v3_postinit(void) 743static void __init pci_v3_postinit(void)
743{ 744{
744 unsigned int pci_cmd; 745 unsigned int pci_cmd;
746 phys_addr_t io_address = pci_pio_to_address(io_mem.start);
745 747
746 pci_cmd = PCI_COMMAND_MEMORY | 748 pci_cmd = PCI_COMMAND_MEMORY |
747 PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE; 749 PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE;
@@ -758,7 +760,7 @@ static void __init pci_v3_postinit(void)
758 "interrupt: %d\n", ret); 760 "interrupt: %d\n", ret);
759#endif 761#endif
760 762
761 register_isa_ports(non_mem.start, io_mem.start, 0); 763 register_isa_ports(non_mem.start, io_address, 0);
762} 764}
763 765
764/* 766/*
@@ -867,33 +869,32 @@ static int __init pci_v3_probe(struct platform_device *pdev)
867 869
868 for_each_of_pci_range(&parser, &range) { 870 for_each_of_pci_range(&parser, &range) {
869 if (!range.flags) { 871 if (!range.flags) {
870 of_pci_range_to_resource(&range, np, &conf_mem); 872 ret = of_pci_range_to_resource(&range, np, &conf_mem);
871 conf_mem.name = "PCIv3 config"; 873 conf_mem.name = "PCIv3 config";
872 } 874 }
873 if (range.flags & IORESOURCE_IO) { 875 if (range.flags & IORESOURCE_IO) {
874 of_pci_range_to_resource(&range, np, &io_mem); 876 ret = of_pci_range_to_resource(&range, np, &io_mem);
875 io_mem.name = "PCIv3 I/O"; 877 io_mem.name = "PCIv3 I/O";
876 } 878 }
877 if ((range.flags & IORESOURCE_MEM) && 879 if ((range.flags & IORESOURCE_MEM) &&
878 !(range.flags & IORESOURCE_PREFETCH)) { 880 !(range.flags & IORESOURCE_PREFETCH)) {
879 non_mem_pci = range.pci_addr; 881 non_mem_pci = range.pci_addr;
880 non_mem_pci_sz = range.size; 882 non_mem_pci_sz = range.size;
881 of_pci_range_to_resource(&range, np, &non_mem); 883 ret = of_pci_range_to_resource(&range, np, &non_mem);
882 non_mem.name = "PCIv3 non-prefetched mem"; 884 non_mem.name = "PCIv3 non-prefetched mem";
883 } 885 }
884 if ((range.flags & IORESOURCE_MEM) && 886 if ((range.flags & IORESOURCE_MEM) &&
885 (range.flags & IORESOURCE_PREFETCH)) { 887 (range.flags & IORESOURCE_PREFETCH)) {
886 pre_mem_pci = range.pci_addr; 888 pre_mem_pci = range.pci_addr;
887 pre_mem_pci_sz = range.size; 889 pre_mem_pci_sz = range.size;
888 of_pci_range_to_resource(&range, np, &pre_mem); 890 ret = of_pci_range_to_resource(&range, np, &pre_mem);
889 pre_mem.name = "PCIv3 prefetched mem"; 891 pre_mem.name = "PCIv3 prefetched mem";
890 } 892 }
891 }
892 893
893 if (!conf_mem.start || !io_mem.start || 894 if (ret < 0) {
894 !non_mem.start || !pre_mem.start) { 895 dev_err(&pdev->dev, "missing ranges in device node\n");
895 dev_err(&pdev->dev, "missing ranges in device node\n"); 896 return ret;
896 return -EINVAL; 897 }
897 } 898 }
898 899
899 pci_v3.map_irq = of_irq_parse_and_map_pci; 900 pci_v3.map_irq = of_irq_parse_and_map_pci;
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index de03620d7fa7..716e83eb1db8 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -57,20 +57,6 @@ int clk_is_sysclk_mainosc(void)
57} 57}
58 58
59/* 59/*
60 * System reset via the watchdog timer
61 */
62static void lpc32xx_watchdog_reset(void)
63{
64 /* Make sure WDT clocks are enabled */
65 __raw_writel(LPC32XX_CLKPWR_PWMCLK_WDOG_EN,
66 LPC32XX_CLKPWR_TIMER_CLK_CTRL);
67
68 /* Instant assert of RESETOUT_N with pulse length 1mS */
69 __raw_writel(13000, io_p2v(LPC32XX_WDTIM_BASE + 0x18));
70 __raw_writel(0x70, io_p2v(LPC32XX_WDTIM_BASE + 0xC));
71}
72
73/*
74 * Detects and returns IRAM size for the device variation 60 * Detects and returns IRAM size for the device variation
75 */ 61 */
76#define LPC32XX_IRAM_BANK_SIZE SZ_128K 62#define LPC32XX_IRAM_BANK_SIZE SZ_128K
@@ -210,16 +196,13 @@ void __init lpc32xx_map_io(void)
210 196
211void lpc23xx_restart(enum reboot_mode mode, const char *cmd) 197void lpc23xx_restart(enum reboot_mode mode, const char *cmd)
212{ 198{
213 switch (mode) { 199 /* Make sure WDT clocks are enabled */
214 case REBOOT_SOFT: 200 __raw_writel(LPC32XX_CLKPWR_PWMCLK_WDOG_EN,
215 case REBOOT_HARD: 201 LPC32XX_CLKPWR_TIMER_CLK_CTRL);
216 lpc32xx_watchdog_reset();
217 break;
218 202
219 default: 203 /* Instant assert of RESETOUT_N with pulse length 1mS */
220 /* Do nothing */ 204 __raw_writel(13000, io_p2v(LPC32XX_WDTIM_BASE + 0x18));
221 break; 205 __raw_writel(0x70, io_p2v(LPC32XX_WDTIM_BASE + 0xC));
222 }
223 206
224 /* Wait for watchdog to reset system */ 207 /* Wait for watchdog to reset system */
225 while (1) 208 while (1)
diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig
new file mode 100644
index 000000000000..2c1154e1794a
--- /dev/null
+++ b/arch/arm/mach-meson/Kconfig
@@ -0,0 +1,13 @@
1menuconfig ARCH_MESON
2 bool "Amlogic Meson SoCs" if ARCH_MULTI_V7
3 select GENERIC_IRQ_CHIP
4 select ARM_GIC
5
6if ARCH_MESON
7
8config MACH_MESON6
9 bool "Amlogic Meson6 (8726MX) SoCs support"
10 default ARCH_MESON
11 select MESON6_TIMER
12
13endif
diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile
new file mode 100644
index 000000000000..9d7380eeeedd
--- /dev/null
+++ b/arch/arm/mach-meson/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_ARCH_MESON) += meson.o
diff --git a/arch/arm/mach-meson/meson.c b/arch/arm/mach-meson/meson.c
new file mode 100644
index 000000000000..5ee064f5a89f
--- /dev/null
+++ b/arch/arm/mach-meson/meson.c
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2014 Carlo Caione <carlo@caione.org>
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, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#include <linux/of_platform.h>
17#include <asm/mach/arch.h>
18
19static const char * const m6_common_board_compat[] = {
20 "amlogic,meson6",
21 NULL,
22};
23
24DT_MACHINE_START(AML8726_MX, "Amlogic Meson6 platform")
25 .dt_compat = m6_common_board_compat,
26MACHINE_END
27
diff --git a/arch/arm/mach-msm/board-mahimahi.c b/arch/arm/mach-msm/board-mahimahi.c
deleted file mode 100644
index 873c3ca3cd7e..000000000000
--- a/arch/arm/mach-msm/board-mahimahi.c
+++ /dev/null
@@ -1,83 +0,0 @@
1/* linux/arch/arm/mach-msm/board-mahimahi.c
2 *
3 * Copyright (C) 2009 Google, Inc.
4 * Copyright (C) 2009 HTC Corporation.
5 * Author: Dima Zavin <dima@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#include <linux/delay.h>
19#include <linux/gpio.h>
20#include <linux/init.h>
21#include <linux/input.h>
22#include <linux/io.h>
23#include <linux/kernel.h>
24#include <linux/platform_device.h>
25#include <linux/memblock.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <asm/setup.h>
31
32#include <mach/hardware.h>
33
34#include "board-mahimahi.h"
35#include "devices.h"
36#include "proc_comm.h"
37#include "common.h"
38
39static uint debug_uart;
40
41module_param_named(debug_uart, debug_uart, uint, 0);
42
43static struct platform_device *devices[] __initdata = {
44#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
45 &msm_device_uart1,
46#endif
47 &msm_device_uart_dm1,
48 &msm_device_nand,
49};
50
51static void __init mahimahi_init(void)
52{
53 platform_add_devices(devices, ARRAY_SIZE(devices));
54}
55
56static void __init mahimahi_fixup(struct tag *tags, char **cmdline)
57{
58 memblock_add(PHYS_OFFSET, 219*SZ_1M);
59 memblock_add(MSM_HIGHMEM_BASE, MSM_HIGHMEM_SIZE);
60}
61
62static void __init mahimahi_map_io(void)
63{
64 msm_map_common_io();
65 msm_clock_init();
66}
67
68static void __init mahimahi_init_late(void)
69{
70 smd_debugfs_init();
71}
72
73void msm_timer_init(void);
74
75MACHINE_START(MAHIMAHI, "mahimahi")
76 .atag_offset = 0x100,
77 .fixup = mahimahi_fixup,
78 .map_io = mahimahi_map_io,
79 .init_irq = msm_init_irq,
80 .init_machine = mahimahi_init,
81 .init_late = mahimahi_init_late,
82 .init_time = msm_timer_init,
83MACHINE_END
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 245884319d2e..8f5ecdc4f3ce 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -124,7 +124,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
124static struct platform_device *devices[] __initdata = { 124static struct platform_device *devices[] __initdata = {
125 &msm_clock_7x30, 125 &msm_clock_7x30,
126 &msm_device_gpio_7x30, 126 &msm_device_gpio_7x30,
127#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER) 127#if defined(CONFIG_SERIAL_MSM)
128 &msm_device_uart2, 128 &msm_device_uart2,
129#endif 129#endif
130 &msm_device_smd, 130 &msm_device_smd,
diff --git a/arch/arm/mach-msm/board-trout-gpio.c b/arch/arm/mach-msm/board-trout-gpio.c
index 2c25050209ce..722ad63b7edc 100644
--- a/arch/arm/mach-msm/board-trout-gpio.c
+++ b/arch/arm/mach-msm/board-trout-gpio.c
@@ -94,7 +94,7 @@ static int trout_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
94 } 94 }
95 95
96static struct msm_gpio_chip msm_gpio_banks[] = { 96static struct msm_gpio_chip msm_gpio_banks[] = {
97#if defined(CONFIG_MSM_DEBUG_UART1) 97#if defined(CONFIG_DEBUG_MSM_UART) && (CONFIG_DEBUG_UART_PHYS == 0xa9a00000)
98 /* H2W pins <-> UART1 */ 98 /* H2W pins <-> UART1 */
99 TROUT_GPIO_BANK("MISC2", 0x00, TROUT_GPIO_MISC2_BASE, 0x40), 99 TROUT_GPIO_BANK("MISC2", 0x00, TROUT_GPIO_MISC2_BASE, 0x40),
100#else 100#else
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index f72b07de2152..ba3edd3a46cb 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -88,7 +88,7 @@ static void __init trout_map_io(void)
88 msm_map_common_io(); 88 msm_map_common_io();
89 iotable_init(trout_io_desc, ARRAY_SIZE(trout_io_desc)); 89 iotable_init(trout_io_desc, ARRAY_SIZE(trout_io_desc));
90 90
91#ifdef CONFIG_MSM_DEBUG_UART3 91#if defined(CONFIG_DEBUG_MSM_UART) && (CONFIG_DEBUG_UART_PHYS == 0xa9c00000)
92 /* route UART3 to the "H2W" extended usb connector */ 92 /* route UART3 to the "H2W" extended usb connector */
93 writeb(0x80, TROUT_CPLD_BASE + 0x00); 93 writeb(0x80, TROUT_CPLD_BASE + 0x00);
94#endif 94#endif
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index 34e09474636d..b042dca1f633 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -57,8 +57,7 @@ static struct map_desc msm_io_desc[] __initdata = {
57 .length = MSM_SHARED_RAM_SIZE, 57 .length = MSM_SHARED_RAM_SIZE,
58 .type = MT_DEVICE, 58 .type = MT_DEVICE,
59 }, 59 },
60#if defined(CONFIG_DEBUG_MSM_UART1) || defined(CONFIG_DEBUG_MSM_UART2) || \ 60#if defined(CONFIG_DEBUG_MSM_UART)
61 defined(CONFIG_DEBUG_MSM_UART3)
62 { 61 {
63 /* Must be last: virtual and pfn filled in by debug_ll_addr() */ 62 /* Must be last: virtual and pfn filled in by debug_ll_addr() */
64 .length = SZ_4K, 63 .length = SZ_4K,
@@ -76,8 +75,7 @@ void __init msm_map_common_io(void)
76 * pages are peripheral interface or not. 75 * pages are peripheral interface or not.
77 */ 76 */
78 asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0)); 77 asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0));
79#if defined(CONFIG_DEBUG_MSM_UART1) || defined(CONFIG_DEBUG_MSM_UART2) || \ 78#if defined(CONFIG_DEBUG_MSM_UART)
80 defined(CONFIG_DEBUG_MSM_UART3)
81#ifdef CONFIG_MMU 79#ifdef CONFIG_MMU
82 debug_ll_addr(&msm_io_desc[size - 1].pfn, 80 debug_ll_addr(&msm_io_desc[size - 1].pfn,
83 &msm_io_desc[size - 1].virtual); 81 &msm_io_desc[size - 1].virtual);
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 8a70a51533fd..bbd8664d1bac 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -644,7 +644,7 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
644 } 644 }
645 } 645 }
646 646
647 platform_device_register_simple("cpufreq-generic", -1, NULL, 0); 647 platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
648 return 0; 648 return 0;
649} 649}
650 650
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index e7189dcc9309..f4d06aea8460 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -1,9 +1,6 @@
1menu "TI OMAP/AM/DM/DRA Family" 1menu "TI OMAP/AM/DM/DRA Family"
2 depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 2 depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
3 3
4config ARCH_OMAP
5 bool
6
7config ARCH_OMAP2 4config ARCH_OMAP2
8 bool "TI OMAP2" 5 bool "TI OMAP2"
9 depends on ARCH_MULTI_V6 6 depends on ARCH_MULTI_V6
@@ -25,7 +22,6 @@ config ARCH_OMAP4
25 bool "TI OMAP4" 22 bool "TI OMAP4"
26 depends on ARCH_MULTI_V7 23 depends on ARCH_MULTI_V7
27 select ARCH_OMAP2PLUS 24 select ARCH_OMAP2PLUS
28 select ARCH_HAS_OPP
29 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP 25 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
30 select ARM_CPU_SUSPEND if PM 26 select ARM_CPU_SUSPEND if PM
31 select ARM_ERRATA_720789 27 select ARM_ERRATA_720789
@@ -44,7 +40,6 @@ config SOC_OMAP5
44 bool "TI OMAP5" 40 bool "TI OMAP5"
45 depends on ARCH_MULTI_V7 41 depends on ARCH_MULTI_V7
46 select ARCH_OMAP2PLUS 42 select ARCH_OMAP2PLUS
47 select ARCH_HAS_OPP
48 select ARM_CPU_SUSPEND if PM 43 select ARM_CPU_SUSPEND if PM
49 select ARM_GIC 44 select ARM_GIC
50 select HAVE_ARM_SCU if SMP 45 select HAVE_ARM_SCU if SMP
@@ -56,14 +51,12 @@ config SOC_AM33XX
56 bool "TI AM33XX" 51 bool "TI AM33XX"
57 depends on ARCH_MULTI_V7 52 depends on ARCH_MULTI_V7
58 select ARCH_OMAP2PLUS 53 select ARCH_OMAP2PLUS
59 select ARCH_HAS_OPP
60 select ARM_CPU_SUSPEND if PM 54 select ARM_CPU_SUSPEND if PM
61 55
62config SOC_AM43XX 56config SOC_AM43XX
63 bool "TI AM43x" 57 bool "TI AM43x"
64 depends on ARCH_MULTI_V7 58 depends on ARCH_MULTI_V7
65 select ARCH_OMAP2PLUS 59 select ARCH_OMAP2PLUS
66 select ARCH_HAS_OPP
67 select ARM_GIC 60 select ARM_GIC
68 select MACH_OMAP_GENERIC 61 select MACH_OMAP_GENERIC
69 select MIGHT_HAVE_CACHE_L2X0 62 select MIGHT_HAVE_CACHE_L2X0
@@ -72,7 +65,6 @@ config SOC_DRA7XX
72 bool "TI DRA7XX" 65 bool "TI DRA7XX"
73 depends on ARCH_MULTI_V7 66 depends on ARCH_MULTI_V7
74 select ARCH_OMAP2PLUS 67 select ARCH_OMAP2PLUS
75 select ARCH_HAS_OPP
76 select ARM_CPU_SUSPEND if PM 68 select ARM_CPU_SUSPEND if PM
77 select ARM_GIC 69 select ARM_GIC
78 select HAVE_ARM_ARCH_TIMER 70 select HAVE_ARM_ARCH_TIMER
@@ -91,6 +83,7 @@ config ARCH_OMAP2PLUS
91 select PINCTRL 83 select PINCTRL
92 select SOC_BUS 84 select SOC_BUS
93 select TI_PRIV_EDMA 85 select TI_PRIV_EDMA
86 select OMAP_IRQCHIP
94 help 87 help
95 Systems based on OMAP2, OMAP3, OMAP4 or OMAP5 88 Systems based on OMAP2, OMAP3, OMAP4 or OMAP5
96 89
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 69bbcba8842f..d9e94122073e 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -10,7 +10,6 @@ obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \
10 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ 10 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
11 omap_device.o sram.o drm.o 11 omap_device.o sram.o drm.o
12 12
13omap-2-3-common = irq.o
14hwmod-common = omap_hwmod.o omap_hwmod_reset.o \ 13hwmod-common = omap_hwmod.o omap_hwmod_reset.o \
15 omap_hwmod_common_data.o 14 omap_hwmod_common_data.o
16clock-common = clock.o clock_common_data.o \ 15clock-common = clock.o clock_common_data.o \
@@ -20,7 +19,7 @@ secure-common = omap-smc.o omap-secure.o
20obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common) 19obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
21obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common) 20obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
22obj-$(CONFIG_ARCH_OMAP4) += $(hwmod-common) $(secure-common) 21obj-$(CONFIG_ARCH_OMAP4) += $(hwmod-common) $(secure-common)
23obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common) 22obj-$(CONFIG_SOC_AM33XX) += $(hwmod-common)
24obj-$(CONFIG_SOC_OMAP5) += $(hwmod-common) $(secure-common) 23obj-$(CONFIG_SOC_OMAP5) += $(hwmod-common) $(secure-common)
25obj-$(CONFIG_SOC_AM43XX) += $(hwmod-common) $(secure-common) 24obj-$(CONFIG_SOC_AM43XX) += $(hwmod-common) $(secure-common)
26obj-$(CONFIG_SOC_DRA7XX) += $(hwmod-common) $(secure-common) 25obj-$(CONFIG_SOC_DRA7XX) += $(hwmod-common) $(secure-common)
@@ -87,9 +86,10 @@ ifeq ($(CONFIG_PM),y)
87obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o 86obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
88obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o 87obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o
89obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o 88obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o
90obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o 89omap-4-5-pm-common = pm44xx.o omap-mpuss-lowpower.o
91obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o 90obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-pm-common)
92obj-$(CONFIG_SOC_DRA7XX) += omap-mpuss-lowpower.o 91obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-pm-common)
92obj-$(CONFIG_SOC_DRA7XX) += $(omap-4-5-pm-common)
93obj-$(CONFIG_PM_DEBUG) += pm-debug.o 93obj-$(CONFIG_PM_DEBUG) += pm-debug.o
94 94
95obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o 95obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o
@@ -102,7 +102,10 @@ endif
102 102
103ifeq ($(CONFIG_CPU_IDLE),y) 103ifeq ($(CONFIG_CPU_IDLE),y)
104obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o 104obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o
105obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o 105omap-4-5-idle-common = cpuidle44xx.o
106obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-idle-common)
107obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-idle-common)
108obj-$(CONFIG_SOC_DRA7XX) += $(omap-4-5-idle-common)
106endif 109endif
107 110
108# PRCM 111# PRCM
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index d95d0ef1354a..d21a3048d06b 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -625,7 +625,6 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
625 .map_io = omap3_map_io, 625 .map_io = omap3_map_io,
626 .init_early = omap3430_init_early, 626 .init_early = omap3430_init_early,
627 .init_irq = omap3_init_irq, 627 .init_irq = omap3_init_irq,
628 .handle_irq = omap3_intc_handle_irq,
629 .init_machine = omap_3430sdp_init, 628 .init_machine = omap_3430sdp_init,
630 .init_late = omap3430_init_late, 629 .init_late = omap3430_init_late,
631 .init_time = omap3_sync32k_timer_init, 630 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 0d499a1878f6..212c3160de18 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -142,7 +142,6 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
142 .map_io = omap3_map_io, 142 .map_io = omap3_map_io,
143 .init_early = am35xx_init_early, 143 .init_early = am35xx_init_early,
144 .init_irq = omap3_init_irq, 144 .init_irq = omap3_init_irq,
145 .handle_irq = omap3_intc_handle_irq,
146 .init_machine = am3517_crane_init, 145 .init_machine = am3517_crane_init,
147 .init_late = am35xx_init_late, 146 .init_late = am35xx_init_late,
148 .init_time = omap3_sync32k_timer_init, 147 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 4f9383cecf76..1c091b3fa312 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -366,7 +366,6 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
366 .map_io = omap3_map_io, 366 .map_io = omap3_map_io,
367 .init_early = am35xx_init_early, 367 .init_early = am35xx_init_early,
368 .init_irq = omap3_init_irq, 368 .init_irq = omap3_init_irq,
369 .handle_irq = omap3_intc_handle_irq,
370 .init_machine = am3517_evm_init, 369 .init_machine = am3517_evm_init,
371 .init_late = am35xx_init_late, 370 .init_late = am35xx_init_late,
372 .init_time = omap3_sync32k_timer_init, 371 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 018353d88b96..c6df8eec4553 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -766,7 +766,6 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
766 .map_io = omap3_map_io, 766 .map_io = omap3_map_io,
767 .init_early = omap35xx_init_early, 767 .init_early = omap35xx_init_early,
768 .init_irq = omap3_init_irq, 768 .init_irq = omap3_init_irq,
769 .handle_irq = omap3_intc_handle_irq,
770 .init_machine = cm_t35_init, 769 .init_machine = cm_t35_init,
771 .init_late = omap35xx_init_late, 770 .init_late = omap35xx_init_late,
772 .init_time = omap3_sync32k_timer_init, 771 .init_time = omap3_sync32k_timer_init,
@@ -779,7 +778,6 @@ MACHINE_START(CM_T3730, "Compulab CM-T3730")
779 .map_io = omap3_map_io, 778 .map_io = omap3_map_io,
780 .init_early = omap3630_init_early, 779 .init_early = omap3630_init_early,
781 .init_irq = omap3_init_irq, 780 .init_irq = omap3_init_irq,
782 .handle_irq = omap3_intc_handle_irq,
783 .init_machine = cm_t3730_init, 781 .init_machine = cm_t3730_init,
784 .init_late = omap3630_init_late, 782 .init_late = omap3630_init_late,
785 .init_time = omap3_sync32k_timer_init, 783 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 4eb5e6f2f7f5..8a2c1677964c 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -329,7 +329,6 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
329 .map_io = omap3_map_io, 329 .map_io = omap3_map_io,
330 .init_early = am35xx_init_early, 330 .init_early = am35xx_init_early,
331 .init_irq = omap3_init_irq, 331 .init_irq = omap3_init_irq,
332 .handle_irq = omap3_intc_handle_irq,
333 .init_machine = cm_t3517_init, 332 .init_machine = cm_t3517_init,
334 .init_late = am35xx_init_late, 333 .init_late = am35xx_init_late,
335 .init_time = omap3_gptimer_timer_init, 334 .init_time = omap3_gptimer_timer_init,
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index cdc4fb9960a9..d8e4f346936a 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -647,7 +647,6 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
647 .map_io = omap3_map_io, 647 .map_io = omap3_map_io,
648 .init_early = omap35xx_init_early, 648 .init_early = omap35xx_init_early,
649 .init_irq = omap3_init_irq, 649 .init_irq = omap3_init_irq,
650 .handle_irq = omap3_intc_handle_irq,
651 .init_machine = devkit8000_init, 650 .init_machine = devkit8000_init,
652 .init_late = omap35xx_init_late, 651 .init_late = omap35xx_init_late,
653 .init_time = omap3_secure_sync32k_timer_init, 652 .init_time = omap3_secure_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index e87f2a83d6bf..2d245c2e641c 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
142 board_nand_data.nr_parts = nr_parts; 142 board_nand_data.nr_parts = nr_parts;
143 board_nand_data.devsize = nand_type; 143 board_nand_data.devsize = nand_type;
144 144
145 board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_HW; 145 board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_SW;
146 gpmc_nand_init(&board_nand_data, gpmc_t); 146 gpmc_nand_init(&board_nand_data, gpmc_t);
147} 147}
148#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ 148#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 9480997ba616..608079a1aba6 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -27,7 +27,7 @@
27#define gic_of_init NULL 27#define gic_of_init NULL
28#endif 28#endif
29 29
30static struct of_device_id omap_dt_match_table[] __initdata = { 30static const struct of_device_id omap_dt_match_table[] __initconst = {
31 { .compatible = "simple-bus", }, 31 { .compatible = "simple-bus", },
32 { .compatible = "ti,omap-infra", }, 32 { .compatible = "ti,omap-infra", },
33 { } 33 { }
@@ -43,7 +43,7 @@ static void __init omap_generic_init(void)
43} 43}
44 44
45#ifdef CONFIG_SOC_OMAP2420 45#ifdef CONFIG_SOC_OMAP2420
46static const char *omap242x_boards_compat[] __initconst = { 46static const char *const omap242x_boards_compat[] __initconst = {
47 "ti,omap2420", 47 "ti,omap2420",
48 NULL, 48 NULL,
49}; 49};
@@ -52,8 +52,6 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
52 .reserve = omap_reserve, 52 .reserve = omap_reserve,
53 .map_io = omap242x_map_io, 53 .map_io = omap242x_map_io,
54 .init_early = omap2420_init_early, 54 .init_early = omap2420_init_early,
55 .init_irq = omap_intc_of_init,
56 .handle_irq = omap2_intc_handle_irq,
57 .init_machine = omap_generic_init, 55 .init_machine = omap_generic_init,
58 .init_time = omap2_sync32k_timer_init, 56 .init_time = omap2_sync32k_timer_init,
59 .dt_compat = omap242x_boards_compat, 57 .dt_compat = omap242x_boards_compat,
@@ -62,7 +60,7 @@ MACHINE_END
62#endif 60#endif
63 61
64#ifdef CONFIG_SOC_OMAP2430 62#ifdef CONFIG_SOC_OMAP2430
65static const char *omap243x_boards_compat[] __initconst = { 63static const char *const omap243x_boards_compat[] __initconst = {
66 "ti,omap2430", 64 "ti,omap2430",
67 NULL, 65 NULL,
68}; 66};
@@ -71,8 +69,6 @@ DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
71 .reserve = omap_reserve, 69 .reserve = omap_reserve,
72 .map_io = omap243x_map_io, 70 .map_io = omap243x_map_io,
73 .init_early = omap2430_init_early, 71 .init_early = omap2430_init_early,
74 .init_irq = omap_intc_of_init,
75 .handle_irq = omap2_intc_handle_irq,
76 .init_machine = omap_generic_init, 72 .init_machine = omap_generic_init,
77 .init_time = omap2_sync32k_timer_init, 73 .init_time = omap2_sync32k_timer_init,
78 .dt_compat = omap243x_boards_compat, 74 .dt_compat = omap243x_boards_compat,
@@ -81,7 +77,7 @@ MACHINE_END
81#endif 77#endif
82 78
83#ifdef CONFIG_ARCH_OMAP3 79#ifdef CONFIG_ARCH_OMAP3
84static const char *omap3_boards_compat[] __initconst = { 80static const char *const omap3_boards_compat[] __initconst = {
85 "ti,omap3430", 81 "ti,omap3430",
86 "ti,omap3", 82 "ti,omap3",
87 NULL, 83 NULL,
@@ -91,8 +87,6 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
91 .reserve = omap_reserve, 87 .reserve = omap_reserve,
92 .map_io = omap3_map_io, 88 .map_io = omap3_map_io,
93 .init_early = omap3430_init_early, 89 .init_early = omap3430_init_early,
94 .init_irq = omap_intc_of_init,
95 .handle_irq = omap3_intc_handle_irq,
96 .init_machine = omap_generic_init, 90 .init_machine = omap_generic_init,
97 .init_late = omap3_init_late, 91 .init_late = omap3_init_late,
98 .init_time = omap3_sync32k_timer_init, 92 .init_time = omap3_sync32k_timer_init,
@@ -100,7 +94,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
100 .restart = omap3xxx_restart, 94 .restart = omap3xxx_restart,
101MACHINE_END 95MACHINE_END
102 96
103static const char *omap36xx_boards_compat[] __initconst = { 97static const char *const omap36xx_boards_compat[] __initconst = {
104 "ti,omap36xx", 98 "ti,omap36xx",
105 NULL, 99 NULL,
106}; 100};
@@ -109,8 +103,6 @@ DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
109 .reserve = omap_reserve, 103 .reserve = omap_reserve,
110 .map_io = omap3_map_io, 104 .map_io = omap3_map_io,
111 .init_early = omap3630_init_early, 105 .init_early = omap3630_init_early,
112 .init_irq = omap_intc_of_init,
113 .handle_irq = omap3_intc_handle_irq,
114 .init_machine = omap_generic_init, 106 .init_machine = omap_generic_init,
115 .init_late = omap3_init_late, 107 .init_late = omap3_init_late,
116 .init_time = omap3_sync32k_timer_init, 108 .init_time = omap3_sync32k_timer_init,
@@ -118,7 +110,7 @@ DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
118 .restart = omap3xxx_restart, 110 .restart = omap3xxx_restart,
119MACHINE_END 111MACHINE_END
120 112
121static const char *omap3_gp_boards_compat[] __initconst = { 113static const char *const omap3_gp_boards_compat[] __initconst = {
122 "ti,omap3-beagle", 114 "ti,omap3-beagle",
123 "timll,omap3-devkit8000", 115 "timll,omap3-devkit8000",
124 NULL, 116 NULL,
@@ -128,8 +120,6 @@ DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
128 .reserve = omap_reserve, 120 .reserve = omap_reserve,
129 .map_io = omap3_map_io, 121 .map_io = omap3_map_io,
130 .init_early = omap3430_init_early, 122 .init_early = omap3430_init_early,
131 .init_irq = omap_intc_of_init,
132 .handle_irq = omap3_intc_handle_irq,
133 .init_machine = omap_generic_init, 123 .init_machine = omap_generic_init,
134 .init_late = omap3_init_late, 124 .init_late = omap3_init_late,
135 .init_time = omap3_secure_sync32k_timer_init, 125 .init_time = omap3_secure_sync32k_timer_init,
@@ -137,7 +127,7 @@ DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
137 .restart = omap3xxx_restart, 127 .restart = omap3xxx_restart,
138MACHINE_END 128MACHINE_END
139 129
140static const char *am3517_boards_compat[] __initconst = { 130static const char *const am3517_boards_compat[] __initconst = {
141 "ti,am3517", 131 "ti,am3517",
142 NULL, 132 NULL,
143}; 133};
@@ -146,8 +136,6 @@ DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
146 .reserve = omap_reserve, 136 .reserve = omap_reserve,
147 .map_io = omap3_map_io, 137 .map_io = omap3_map_io,
148 .init_early = am35xx_init_early, 138 .init_early = am35xx_init_early,
149 .init_irq = omap_intc_of_init,
150 .handle_irq = omap3_intc_handle_irq,
151 .init_machine = omap_generic_init, 139 .init_machine = omap_generic_init,
152 .init_late = omap3_init_late, 140 .init_late = omap3_init_late,
153 .init_time = omap3_gptimer_timer_init, 141 .init_time = omap3_gptimer_timer_init,
@@ -157,7 +145,7 @@ MACHINE_END
157#endif 145#endif
158 146
159#ifdef CONFIG_SOC_AM33XX 147#ifdef CONFIG_SOC_AM33XX
160static const char *am33xx_boards_compat[] __initconst = { 148static const char *const am33xx_boards_compat[] __initconst = {
161 "ti,am33xx", 149 "ti,am33xx",
162 NULL, 150 NULL,
163}; 151};
@@ -166,8 +154,6 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
166 .reserve = omap_reserve, 154 .reserve = omap_reserve,
167 .map_io = am33xx_map_io, 155 .map_io = am33xx_map_io,
168 .init_early = am33xx_init_early, 156 .init_early = am33xx_init_early,
169 .init_irq = omap_intc_of_init,
170 .handle_irq = omap3_intc_handle_irq,
171 .init_machine = omap_generic_init, 157 .init_machine = omap_generic_init,
172 .init_late = am33xx_init_late, 158 .init_late = am33xx_init_late,
173 .init_time = omap3_gptimer_timer_init, 159 .init_time = omap3_gptimer_timer_init,
@@ -177,7 +163,7 @@ MACHINE_END
177#endif 163#endif
178 164
179#ifdef CONFIG_ARCH_OMAP4 165#ifdef CONFIG_ARCH_OMAP4
180static const char *omap4_boards_compat[] __initconst = { 166static const char *const omap4_boards_compat[] __initconst = {
181 "ti,omap4460", 167 "ti,omap4460",
182 "ti,omap4430", 168 "ti,omap4430",
183 "ti,omap4", 169 "ti,omap4",
@@ -199,7 +185,7 @@ MACHINE_END
199#endif 185#endif
200 186
201#ifdef CONFIG_SOC_OMAP5 187#ifdef CONFIG_SOC_OMAP5
202static const char *omap5_boards_compat[] __initconst = { 188static const char *const omap5_boards_compat[] __initconst = {
203 "ti,omap5432", 189 "ti,omap5432",
204 "ti,omap5430", 190 "ti,omap5430",
205 "ti,omap5", 191 "ti,omap5",
@@ -221,7 +207,7 @@ MACHINE_END
221#endif 207#endif
222 208
223#ifdef CONFIG_SOC_AM43XX 209#ifdef CONFIG_SOC_AM43XX
224static const char *am43_boards_compat[] __initconst = { 210static const char *const am43_boards_compat[] __initconst = {
225 "ti,am4372", 211 "ti,am4372",
226 "ti,am43", 212 "ti,am43",
227 NULL, 213 NULL,
@@ -240,7 +226,9 @@ MACHINE_END
240#endif 226#endif
241 227
242#ifdef CONFIG_SOC_DRA7XX 228#ifdef CONFIG_SOC_DRA7XX
243static const char *dra74x_boards_compat[] __initconst = { 229static const char *const dra74x_boards_compat[] __initconst = {
230 "ti,am5728",
231 "ti,am5726",
244 "ti,dra742", 232 "ti,dra742",
245 "ti,dra7", 233 "ti,dra7",
246 NULL, 234 NULL,
@@ -259,7 +247,9 @@ DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
259 .restart = omap44xx_restart, 247 .restart = omap44xx_restart,
260MACHINE_END 248MACHINE_END
261 249
262static const char *dra72x_boards_compat[] __initconst = { 250static const char *const dra72x_boards_compat[] __initconst = {
251 "ti,am5718",
252 "ti,am5716",
263 "ti,dra722", 253 "ti,dra722",
264 NULL, 254 NULL,
265}; 255};
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 44a59c3abfb0..c2975af4cd5d 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -422,7 +422,6 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
422 .map_io = omap3_map_io, 422 .map_io = omap3_map_io,
423 .init_early = omap3430_init_early, 423 .init_early = omap3430_init_early,
424 .init_irq = omap3_init_irq, 424 .init_irq = omap3_init_irq,
425 .handle_irq = omap3_intc_handle_irq,
426 .init_machine = omap_ldp_init, 425 .init_machine = omap_ldp_init,
427 .init_late = omap3430_init_late, 426 .init_late = omap3430_init_late,
428 .init_time = omap3_sync32k_timer_init, 427 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index aead77a4bc6d..97767a27ca9d 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -33,6 +33,7 @@
33#include "mmc.h" 33#include "mmc.h"
34#include "soc.h" 34#include "soc.h"
35#include "gpmc-onenand.h" 35#include "gpmc-onenand.h"
36#include "common-board-devices.h"
36 37
37#define TUSB6010_ASYNC_CS 1 38#define TUSB6010_ASYNC_CS 1
38#define TUSB6010_SYNC_CS 4 39#define TUSB6010_SYNC_CS 4
@@ -568,29 +569,14 @@ static int n8x0_menelaus_late_init(struct device *dev)
568} 569}
569#endif 570#endif
570 571
571static struct menelaus_platform_data n8x0_menelaus_platform_data __initdata = { 572struct menelaus_platform_data n8x0_menelaus_platform_data __initdata = {
572 .late_init = n8x0_menelaus_late_init, 573 .late_init = n8x0_menelaus_late_init,
573}; 574};
574 575
575static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] __initdata = { 576struct aic3x_pdata n810_aic33_data __initdata = {
576 {
577 I2C_BOARD_INFO("menelaus", 0x72),
578 .irq = 7 + OMAP_INTC_START,
579 .platform_data = &n8x0_menelaus_platform_data,
580 },
581};
582
583static struct aic3x_pdata n810_aic33_data __initdata = {
584 .gpio_reset = 118, 577 .gpio_reset = 118,
585}; 578};
586 579
587static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
588 {
589 I2C_BOARD_INFO("tlv320aic3x", 0x18),
590 .platform_data = &n810_aic33_data,
591 },
592};
593
594static int __init n8x0_late_initcall(void) 580static int __init n8x0_late_initcall(void)
595{ 581{
596 if (!board_caps) 582 if (!board_caps)
@@ -612,11 +598,5 @@ void * __init n8x0_legacy_init(void)
612 board_check_revision(); 598 board_check_revision();
613 spi_register_board_info(n800_spi_board_info, 599 spi_register_board_info(n800_spi_board_info,
614 ARRAY_SIZE(n800_spi_board_info)); 600 ARRAY_SIZE(n800_spi_board_info));
615 i2c_register_board_info(0, n8x0_i2c_board_info_1,
616 ARRAY_SIZE(n8x0_i2c_board_info_1));
617 if (board_is_n810())
618 i2c_register_board_info(1, n810_i2c_board_info_2,
619 ARRAY_SIZE(n810_i2c_board_info_2));
620
621 return &mmc1_data; 601 return &mmc1_data;
622} 602}
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index e2e52031f056..81de1c68b360 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -588,7 +588,6 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
588 .map_io = omap3_map_io, 588 .map_io = omap3_map_io,
589 .init_early = omap3_init_early, 589 .init_early = omap3_init_early,
590 .init_irq = omap3_init_irq, 590 .init_irq = omap3_init_irq,
591 .handle_irq = omap3_intc_handle_irq,
592 .init_machine = omap3_beagle_init, 591 .init_machine = omap3_beagle_init,
593 .init_late = omap3_init_late, 592 .init_late = omap3_init_late,
594 .init_time = omap3_secure_sync32k_timer_init, 593 .init_time = omap3_secure_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index bab51e64c4b5..6049f60a8813 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -230,7 +230,6 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
230 .map_io = omap3_map_io, 230 .map_io = omap3_map_io,
231 .init_early = omap35xx_init_early, 231 .init_early = omap35xx_init_early,
232 .init_irq = omap3_init_irq, 232 .init_irq = omap3_init_irq,
233 .handle_irq = omap3_intc_handle_irq,
234 .init_machine = omap3logic_init, 233 .init_machine = omap3logic_init,
235 .init_late = omap35xx_init_late, 234 .init_late = omap35xx_init_late,
236 .init_time = omap3_sync32k_timer_init, 235 .init_time = omap3_sync32k_timer_init,
@@ -243,7 +242,6 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
243 .map_io = omap3_map_io, 242 .map_io = omap3_map_io,
244 .init_early = omap35xx_init_early, 243 .init_early = omap35xx_init_early,
245 .init_irq = omap3_init_irq, 244 .init_irq = omap3_init_irq,
246 .handle_irq = omap3_intc_handle_irq,
247 .init_machine = omap3logic_init, 245 .init_machine = omap3logic_init,
248 .init_late = omap35xx_init_late, 246 .init_late = omap35xx_init_late,
249 .init_time = omap3_sync32k_timer_init, 247 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index cf18340eb3bb..f32201656cf3 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -624,7 +624,6 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
624 .map_io = omap3_map_io, 624 .map_io = omap3_map_io,
625 .init_early = omap35xx_init_early, 625 .init_early = omap35xx_init_early,
626 .init_irq = omap3_init_irq, 626 .init_irq = omap3_init_irq,
627 .handle_irq = omap3_intc_handle_irq,
628 .init_machine = omap3pandora_init, 627 .init_machine = omap3pandora_init,
629 .init_late = omap35xx_init_late, 628 .init_late = omap35xx_init_late,
630 .init_time = omap3_sync32k_timer_init, 629 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index a2e035e0792a..6311f4b1ee44 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -426,7 +426,6 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
426 .map_io = omap3_map_io, 426 .map_io = omap3_map_io,
427 .init_early = omap35xx_init_early, 427 .init_early = omap35xx_init_early,
428 .init_irq = omap3_init_irq, 428 .init_irq = omap3_init_irq,
429 .handle_irq = omap3_intc_handle_irq,
430 .init_machine = omap3_stalker_init, 429 .init_machine = omap3_stalker_init,
431 .init_late = omap35xx_init_late, 430 .init_late = omap35xx_init_late,
432 .init_time = omap3_secure_sync32k_timer_init, 431 .init_time = omap3_secure_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 70b904c010c6..a01993e5500f 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -388,7 +388,6 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
388 .map_io = omap3_map_io, 388 .map_io = omap3_map_io,
389 .init_early = omap3430_init_early, 389 .init_early = omap3430_init_early,
390 .init_irq = omap3_init_irq, 390 .init_irq = omap3_init_irq,
391 .handle_irq = omap3_intc_handle_irq,
392 .init_machine = omap3_touchbook_init, 391 .init_machine = omap3_touchbook_init,
393 .init_late = omap3430_init_late, 392 .init_late = omap3430_init_late,
394 .init_time = omap3_secure_sync32k_timer_init, 393 .init_time = omap3_secure_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index f6d384111911..2dae6ccd39bb 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -564,7 +564,6 @@ MACHINE_START(OVERO, "Gumstix Overo")
564 .map_io = omap3_map_io, 564 .map_io = omap3_map_io,
565 .init_early = omap35xx_init_early, 565 .init_early = omap35xx_init_early,
566 .init_irq = omap3_init_irq, 566 .init_irq = omap3_init_irq,
567 .handle_irq = omap3_intc_handle_irq,
568 .init_machine = overo_init, 567 .init_machine = overo_init,
569 .init_late = omap35xx_init_late, 568 .init_late = omap35xx_init_late,
570 .init_time = omap3_sync32k_timer_init, 569 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index db168c9627a1..2d1e5a6beb85 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -134,7 +134,6 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
134 .map_io = omap3_map_io, 134 .map_io = omap3_map_io,
135 .init_early = omap3430_init_early, 135 .init_early = omap3430_init_early,
136 .init_irq = omap3_init_irq, 136 .init_irq = omap3_init_irq,
137 .handle_irq = omap3_intc_handle_irq,
138 .init_machine = rx51_init, 137 .init_machine = rx51_init,
139 .init_late = omap3430_init_late, 138 .init_late = omap3430_init_late,
140 .init_time = omap3_sync32k_timer_init, 139 .init_time = omap3_sync32k_timer_init,
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
index f338177e6900..07c88ae083fb 100644
--- a/arch/arm/mach-omap2/common-board-devices.h
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -1,6 +1,8 @@
1#ifndef __OMAP_COMMON_BOARD_DEVICES__ 1#ifndef __OMAP_COMMON_BOARD_DEVICES__
2#define __OMAP_COMMON_BOARD_DEVICES__ 2#define __OMAP_COMMON_BOARD_DEVICES__
3 3
4#include <sound/tlv320aic3x.h>
5#include <linux/mfd/menelaus.h>
4#include "twl-common.h" 6#include "twl-common.h"
5 7
6#define NAND_BLOCK_SIZE SZ_128K 8#define NAND_BLOCK_SIZE SZ_128K
@@ -12,4 +14,7 @@ void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
12 struct ads7846_platform_data *board_pdata); 14 struct ads7846_platform_data *board_pdata);
13void *n8x0_legacy_init(void); 15void *n8x0_legacy_init(void);
14 16
17extern struct menelaus_platform_data n8x0_menelaus_platform_data;
18extern struct aic3x_pdata n810_aic33_data;
19
15#endif /* __OMAP_COMMON_BOARD_DEVICES__ */ 20#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index dc571f1d3b8a..377eea849e7b 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -32,6 +32,7 @@
32#include <linux/i2c/twl.h> 32#include <linux/i2c/twl.h>
33#include <linux/i2c-omap.h> 33#include <linux/i2c-omap.h>
34#include <linux/reboot.h> 34#include <linux/reboot.h>
35#include <linux/irqchip/irq-omap-intc.h>
35 36
36#include <asm/proc-fns.h> 37#include <asm/proc-fns.h>
37 38
@@ -60,7 +61,7 @@ static inline int omap3_pm_init(void)
60} 61}
61#endif 62#endif
62 63
63#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) 64#if defined(CONFIG_PM) && (defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX))
64int omap4_pm_init(void); 65int omap4_pm_init(void);
65int omap4_pm_init_early(void); 66int omap4_pm_init_early(void);
66#else 67#else
@@ -210,18 +211,6 @@ extern struct device *omap2_get_iva_device(void);
210extern struct device *omap2_get_l3_device(void); 211extern struct device *omap2_get_l3_device(void);
211extern struct device *omap4_get_dsp_device(void); 212extern struct device *omap4_get_dsp_device(void);
212 213
213void omap2_init_irq(void);
214void omap3_init_irq(void);
215void ti81xx_init_irq(void);
216extern int omap_irq_pending(void);
217void omap_intc_save_context(void);
218void omap_intc_restore_context(void);
219void omap3_intc_suspend(void);
220void omap3_intc_prepare_idle(void);
221void omap3_intc_resume_idle(void);
222void omap2_intc_handle_irq(struct pt_regs *regs);
223void omap3_intc_handle_irq(struct pt_regs *regs);
224void omap_intc_of_init(void);
225void omap_gic_of_init(void); 214void omap_gic_of_init(void);
226 215
227#ifdef CONFIG_CACHE_L2X0 216#ifdef CONFIG_CACHE_L2X0
@@ -229,16 +218,6 @@ extern void __iomem *omap4_get_l2cache_base(void);
229#endif 218#endif
230 219
231struct device_node; 220struct device_node;
232#ifdef CONFIG_OF
233int __init intc_of_init(struct device_node *node,
234 struct device_node *parent);
235#else
236int __init intc_of_init(struct device_node *node,
237 struct device_node *parent)
238{
239 return 0;
240}
241#endif
242 221
243#ifdef CONFIG_SMP 222#ifdef CONFIG_SMP
244extern void __iomem *omap4_get_scu_base(void); 223extern void __iomem *omap4_get_scu_base(void);
@@ -307,7 +286,7 @@ static inline void omap4_cpu_resume(void)
307 286
308#endif 287#endif
309 288
310void pdata_quirks_init(struct of_device_id *); 289void pdata_quirks_init(const struct of_device_id *);
311void omap_auxdata_legacy_init(struct device *dev); 290void omap_auxdata_legacy_init(struct device *dev);
312void omap_pcs_legacy_init(int irq, void (*rearm)(void)); 291void omap_pcs_legacy_init(int irq, void (*rearm)(void));
313 292
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index bf852d7ae951..7a050f9c37ff 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -544,7 +544,7 @@ int omap_dss_reset(struct omap_hwmod *oh)
544 MAX_MODULE_SOFTRESET_WAIT, c); 544 MAX_MODULE_SOFTRESET_WAIT, c);
545 545
546 if (c == MAX_MODULE_SOFTRESET_WAIT) 546 if (c == MAX_MODULE_SOFTRESET_WAIT)
547 pr_warning("dss_core: waiting for reset to finish failed\n"); 547 pr_warn("dss_core: waiting for reset to finish failed\n");
548 else 548 else
549 pr_debug("dss_core: softreset done\n"); 549 pr_debug("dss_core: softreset done\n");
550 550
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 8897ad7035fd..cb7764314f17 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -49,7 +49,8 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
49 return 0; 49 return 0;
50 50
51 /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */ 51 /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */
52 if (ecc_opt == OMAP_ECC_HAM1_CODE_HW) 52 if (ecc_opt == OMAP_ECC_HAM1_CODE_HW ||
53 ecc_opt == OMAP_ECC_HAM1_CODE_SW)
53 return 1; 54 return 1;
54 else 55 else
55 return 0; 56 return 0;
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 8bc13380f0a0..a4d52c42a438 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1207,8 +1207,7 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p)
1207 } 1207 }
1208 } 1208 }
1209 1209
1210 if ((p->wait_on_read || p->wait_on_write) && 1210 if (p->wait_pin > gpmc_nr_waitpins) {
1211 (p->wait_pin > gpmc_nr_waitpins)) {
1212 pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin); 1211 pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin);
1213 return -EINVAL; 1212 return -EINVAL;
1214 } 1213 }
@@ -1244,7 +1243,7 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p)
1244} 1243}
1245 1244
1246#ifdef CONFIG_OF 1245#ifdef CONFIG_OF
1247static struct of_device_id gpmc_dt_ids[] = { 1246static const struct of_device_id gpmc_dt_ids[] = {
1248 { .compatible = "ti,omap2420-gpmc" }, 1247 { .compatible = "ti,omap2420-gpmc" },
1249 { .compatible = "ti,omap2430-gpmc" }, 1248 { .compatible = "ti,omap2430-gpmc" },
1250 { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ 1249 { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */
@@ -1288,8 +1287,8 @@ void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p)
1288 p->wait_on_write = of_property_read_bool(np, 1287 p->wait_on_write = of_property_read_bool(np,
1289 "gpmc,wait-on-write"); 1288 "gpmc,wait-on-write");
1290 if (!p->wait_on_read && !p->wait_on_write) 1289 if (!p->wait_on_read && !p->wait_on_write)
1291 pr_warn("%s: read/write wait monitoring not enabled!\n", 1290 pr_debug("%s: rd/wr wait monitoring not enabled!\n",
1292 __func__); 1291 __func__);
1293 } 1292 }
1294} 1293}
1295 1294
@@ -1403,8 +1402,11 @@ static int gpmc_probe_nand_child(struct platform_device *pdev,
1403 pr_err("%s: ti,nand-ecc-opt not found\n", __func__); 1402 pr_err("%s: ti,nand-ecc-opt not found\n", __func__);
1404 return -ENODEV; 1403 return -ENODEV;
1405 } 1404 }
1406 if (!strcmp(s, "ham1") || !strcmp(s, "sw") || 1405
1407 !strcmp(s, "hw") || !strcmp(s, "hw-romcode")) 1406 if (!strcmp(s, "sw"))
1407 gpmc_nand_data->ecc_opt = OMAP_ECC_HAM1_CODE_SW;
1408 else if (!strcmp(s, "ham1") ||
1409 !strcmp(s, "hw") || !strcmp(s, "hw-romcode"))
1408 gpmc_nand_data->ecc_opt = 1410 gpmc_nand_data->ecc_opt =
1409 OMAP_ECC_HAM1_CODE_HW; 1411 OMAP_ECC_HAM1_CODE_HW;
1410 else if (!strcmp(s, "bch4")) 1412 else if (!strcmp(s, "bch4"))
diff --git a/arch/arm/mach-omap2/hdq1w.c b/arch/arm/mach-omap2/hdq1w.c
index f78b4a161959..f3897d82e53e 100644
--- a/arch/arm/mach-omap2/hdq1w.c
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -67,8 +67,8 @@ int omap_hdq1w_reset(struct omap_hwmod *oh)
67 MAX_MODULE_SOFTRESET_WAIT, c); 67 MAX_MODULE_SOFTRESET_WAIT, c);
68 68
69 if (c == MAX_MODULE_SOFTRESET_WAIT) 69 if (c == MAX_MODULE_SOFTRESET_WAIT)
70 pr_warning("%s: %s: softreset failed (waited %d usec)\n", 70 pr_warn("%s: %s: softreset failed (waited %d usec)\n",
71 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT); 71 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
72 else 72 else
73 pr_debug("%s: %s: softreset in %d usec\n", __func__, 73 pr_debug("%s: %s: softreset in %d usec\n", __func__,
74 oh->name, c); 74 oh->name, c);
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index b456b4471f35..b9d8e47ffe8e 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -99,7 +99,7 @@ int omap_i2c_reset(struct omap_hwmod *oh)
99 MAX_MODULE_SOFTRESET_WAIT, c); 99 MAX_MODULE_SOFTRESET_WAIT, c);
100 100
101 if (c == MAX_MODULE_SOFTRESET_WAIT) 101 if (c == MAX_MODULE_SOFTRESET_WAIT)
102 pr_warning("%s: %s: softreset failed (waited %d usec)\n", 102 pr_warn("%s: %s: softreset failed (waited %d usec)\n",
103 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT); 103 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
104 else 104 else
105 pr_debug("%s: %s: softreset in %d usec\n", __func__, 105 pr_debug("%s: %s: softreset in %d usec\n", __func__,
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index d42022f2a71e..53841dea80ea 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -663,7 +663,7 @@ void __init dra7xxx_check_revision(void)
663 663
664 default: 664 default:
665 /* Unknown default to latest silicon rev as default*/ 665 /* Unknown default to latest silicon rev as default*/
666 pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n", 666 pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%x)\n",
667 __func__, idcode, hawkeye, rev); 667 __func__, idcode, hawkeye, rev);
668 omap_revision = DRA752_REV_ES1_1; 668 omap_revision = DRA752_REV_ES1_1;
669 } 669 }
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 5d0667c119f6..b8ad045bcb8d 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -231,15 +231,6 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
231 .length = L4_PER_44XX_SIZE, 231 .length = L4_PER_44XX_SIZE,
232 .type = MT_DEVICE, 232 .type = MT_DEVICE,
233 }, 233 },
234#ifdef CONFIG_OMAP4_ERRATA_I688
235 {
236 .virtual = OMAP4_SRAM_VA,
237 .pfn = __phys_to_pfn(OMAP4_SRAM_PA),
238 .length = PAGE_SIZE,
239 .type = MT_MEMORY_RW_SO,
240 },
241#endif
242
243}; 234};
244#endif 235#endif
245 236
@@ -269,14 +260,6 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
269 .length = L4_PER_54XX_SIZE, 260 .length = L4_PER_54XX_SIZE,
270 .type = MT_DEVICE, 261 .type = MT_DEVICE,
271 }, 262 },
272#ifdef CONFIG_OMAP4_ERRATA_I688
273 {
274 .virtual = OMAP4_SRAM_VA,
275 .pfn = __phys_to_pfn(OMAP4_SRAM_PA),
276 .length = PAGE_SIZE,
277 .type = MT_MEMORY_RW_SO,
278 },
279#endif
280}; 263};
281#endif 264#endif
282 265
@@ -667,6 +650,7 @@ void __init omap5_init_early(void)
667 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE), 650 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
668 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE)); 651 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
669 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); 652 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
653 omap4_pm_init_early();
670 omap_prm_base_init(); 654 omap_prm_base_init();
671 omap_cm_base_init(); 655 omap_cm_base_init();
672 omap44xx_prm_init(); 656 omap44xx_prm_init();
@@ -682,6 +666,8 @@ void __init omap5_init_early(void)
682void __init omap5_init_late(void) 666void __init omap5_init_late(void)
683{ 667{
684 omap_common_late_init(); 668 omap_common_late_init();
669 omap4_pm_init();
670 omap2_clk_enable_autoidle_all();
685} 671}
686#endif 672#endif
687 673
@@ -695,6 +681,7 @@ void __init dra7xx_init_early(void)
695 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(DRA7XX_CM_CORE_AON_BASE), 681 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(DRA7XX_CM_CORE_AON_BASE),
696 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE)); 682 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
697 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); 683 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
684 omap4_pm_init_early();
698 omap_prm_base_init(); 685 omap_prm_base_init();
699 omap_cm_base_init(); 686 omap_cm_base_init();
700 omap44xx_prm_init(); 687 omap44xx_prm_init();
@@ -709,6 +696,8 @@ void __init dra7xx_init_early(void)
709void __init dra7xx_init_late(void) 696void __init dra7xx_init_late(void)
710{ 697{
711 omap_common_late_init(); 698 omap_common_late_init();
699 omap4_pm_init();
700 omap2_clk_enable_autoidle_all();
712} 701}
713#endif 702#endif
714 703
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
deleted file mode 100644
index 35b8590c322e..000000000000
--- a/arch/arm/mach-omap2/irq.c
+++ /dev/null
@@ -1,380 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/irq.c
3 *
4 * Interrupt handler for OMAP2 boards.
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 * Author: Paul Mundt <paul.mundt@nokia.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/kernel.h>
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/interrupt.h>
17#include <linux/io.h>
18
19#include <asm/exception.h>
20#include <asm/mach/irq.h>
21#include <linux/irqdomain.h>
22#include <linux/of.h>
23#include <linux/of_address.h>
24#include <linux/of_irq.h>
25
26#include "soc.h"
27#include "iomap.h"
28#include "common.h"
29
30/* selected INTC register offsets */
31
32#define INTC_REVISION 0x0000
33#define INTC_SYSCONFIG 0x0010
34#define INTC_SYSSTATUS 0x0014
35#define INTC_SIR 0x0040
36#define INTC_CONTROL 0x0048
37#define INTC_PROTECTION 0x004C
38#define INTC_IDLE 0x0050
39#define INTC_THRESHOLD 0x0068
40#define INTC_MIR0 0x0084
41#define INTC_MIR_CLEAR0 0x0088
42#define INTC_MIR_SET0 0x008c
43#define INTC_PENDING_IRQ0 0x0098
44/* Number of IRQ state bits in each MIR register */
45#define IRQ_BITS_PER_REG 32
46
47#define OMAP2_IRQ_BASE OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
48#define OMAP3_IRQ_BASE OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
49#define INTCPS_SIR_IRQ_OFFSET 0x0040 /* omap2/3 active interrupt offset */
50#define ACTIVEIRQ_MASK 0x7f /* omap2/3 active interrupt bits */
51#define INTCPS_NR_MIR_REGS 3
52#define INTCPS_NR_IRQS 96
53
54/*
55 * OMAP2 has a number of different interrupt controllers, each interrupt
56 * controller is identified as its own "bank". Register definitions are
57 * fairly consistent for each bank, but not all registers are implemented
58 * for each bank.. when in doubt, consult the TRM.
59 */
60static struct omap_irq_bank {
61 void __iomem *base_reg;
62 unsigned int nr_irqs;
63} __attribute__ ((aligned(4))) irq_banks[] = {
64 {
65 /* MPU INTC */
66 .nr_irqs = 96,
67 },
68};
69
70static struct irq_domain *domain;
71
72/* Structure to save interrupt controller context */
73struct omap3_intc_regs {
74 u32 sysconfig;
75 u32 protection;
76 u32 idle;
77 u32 threshold;
78 u32 ilr[INTCPS_NR_IRQS];
79 u32 mir[INTCPS_NR_MIR_REGS];
80};
81
82/* INTC bank register get/set */
83
84static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg)
85{
86 writel_relaxed(val, bank->base_reg + reg);
87}
88
89static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg)
90{
91 return readl_relaxed(bank->base_reg + reg);
92}
93
94/* XXX: FIQ and additional INTC support (only MPU at the moment) */
95static void omap_ack_irq(struct irq_data *d)
96{
97 intc_bank_write_reg(0x1, &irq_banks[0], INTC_CONTROL);
98}
99
100static void omap_mask_ack_irq(struct irq_data *d)
101{
102 irq_gc_mask_disable_reg(d);
103 omap_ack_irq(d);
104}
105
106static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
107{
108 unsigned long tmp;
109
110 tmp = intc_bank_read_reg(bank, INTC_REVISION) & 0xff;
111 pr_info("IRQ: Found an INTC at 0x%p (revision %ld.%ld) with %d interrupts\n",
112 bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs);
113
114 tmp = intc_bank_read_reg(bank, INTC_SYSCONFIG);
115 tmp |= 1 << 1; /* soft reset */
116 intc_bank_write_reg(tmp, bank, INTC_SYSCONFIG);
117
118 while (!(intc_bank_read_reg(bank, INTC_SYSSTATUS) & 0x1))
119 /* Wait for reset to complete */;
120
121 /* Enable autoidle */
122 intc_bank_write_reg(1 << 0, bank, INTC_SYSCONFIG);
123}
124
125int omap_irq_pending(void)
126{
127 int i;
128
129 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
130 struct omap_irq_bank *bank = irq_banks + i;
131 int irq;
132
133 for (irq = 0; irq < bank->nr_irqs; irq += 32)
134 if (intc_bank_read_reg(bank, INTC_PENDING_IRQ0 +
135 ((irq >> 5) << 5)))
136 return 1;
137 }
138 return 0;
139}
140
141static __init void
142omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
143{
144 struct irq_chip_generic *gc;
145 struct irq_chip_type *ct;
146
147 gc = irq_alloc_generic_chip("INTC", 1, irq_start, base,
148 handle_level_irq);
149 ct = gc->chip_types;
150 ct->chip.irq_ack = omap_mask_ack_irq;
151 ct->chip.irq_mask = irq_gc_mask_disable_reg;
152 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
153 ct->chip.flags |= IRQCHIP_SKIP_SET_WAKE;
154
155 ct->regs.enable = INTC_MIR_CLEAR0;
156 ct->regs.disable = INTC_MIR_SET0;
157 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
158 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
159}
160
161static void __init omap_init_irq(u32 base, int nr_irqs,
162 struct device_node *node)
163{
164 void __iomem *omap_irq_base;
165 unsigned long nr_of_irqs = 0;
166 unsigned int nr_banks = 0;
167 int i, j, irq_base;
168
169 omap_irq_base = ioremap(base, SZ_4K);
170 if (WARN_ON(!omap_irq_base))
171 return;
172
173 irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
174 if (irq_base < 0) {
175 pr_warn("Couldn't allocate IRQ numbers\n");
176 irq_base = 0;
177 }
178
179 domain = irq_domain_add_legacy(node, nr_irqs, irq_base, 0,
180 &irq_domain_simple_ops, NULL);
181
182 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
183 struct omap_irq_bank *bank = irq_banks + i;
184
185 bank->nr_irqs = nr_irqs;
186
187 /* Static mapping, never released */
188 bank->base_reg = ioremap(base, SZ_4K);
189 if (!bank->base_reg) {
190 pr_err("Could not ioremap irq bank%i\n", i);
191 continue;
192 }
193
194 omap_irq_bank_init_one(bank);
195
196 for (j = 0; j < bank->nr_irqs; j += 32)
197 omap_alloc_gc(bank->base_reg + j, j + irq_base, 32);
198
199 nr_of_irqs += bank->nr_irqs;
200 nr_banks++;
201 }
202
203 pr_info("Total of %ld interrupts on %d active controller%s\n",
204 nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : "");
205}
206
207void __init omap2_init_irq(void)
208{
209 omap_init_irq(OMAP24XX_IC_BASE, 96, NULL);
210}
211
212void __init omap3_init_irq(void)
213{
214 omap_init_irq(OMAP34XX_IC_BASE, 96, NULL);
215}
216
217void __init ti81xx_init_irq(void)
218{
219 omap_init_irq(OMAP34XX_IC_BASE, 128, NULL);
220}
221
222static inline void omap_intc_handle_irq(void __iomem *base_addr, struct pt_regs *regs)
223{
224 u32 irqnr;
225 int handled_irq = 0;
226
227 do {
228 irqnr = readl_relaxed(base_addr + 0x98);
229 if (irqnr)
230 goto out;
231
232 irqnr = readl_relaxed(base_addr + 0xb8);
233 if (irqnr)
234 goto out;
235
236 irqnr = readl_relaxed(base_addr + 0xd8);
237#if IS_ENABLED(CONFIG_SOC_TI81XX) || IS_ENABLED(CONFIG_SOC_AM33XX)
238 if (irqnr)
239 goto out;
240 irqnr = readl_relaxed(base_addr + 0xf8);
241#endif
242
243out:
244 if (!irqnr)
245 break;
246
247 irqnr = readl_relaxed(base_addr + INTCPS_SIR_IRQ_OFFSET);
248 irqnr &= ACTIVEIRQ_MASK;
249
250 if (irqnr) {
251 irqnr = irq_find_mapping(domain, irqnr);
252 handle_IRQ(irqnr, regs);
253 handled_irq = 1;
254 }
255 } while (irqnr);
256
257 /* If an irq is masked or deasserted while active, we will
258 * keep ending up here with no irq handled. So remove it from
259 * the INTC with an ack.*/
260 if (!handled_irq)
261 omap_ack_irq(NULL);
262}
263
264asmlinkage void __exception_irq_entry omap2_intc_handle_irq(struct pt_regs *regs)
265{
266 void __iomem *base_addr = OMAP2_IRQ_BASE;
267 omap_intc_handle_irq(base_addr, regs);
268}
269
270int __init intc_of_init(struct device_node *node,
271 struct device_node *parent)
272{
273 struct resource res;
274 u32 nr_irq = 96;
275
276 if (WARN_ON(!node))
277 return -ENODEV;
278
279 if (of_address_to_resource(node, 0, &res)) {
280 WARN(1, "unable to get intc registers\n");
281 return -EINVAL;
282 }
283
284 if (of_property_read_u32(node, "ti,intc-size", &nr_irq))
285 pr_warn("unable to get intc-size, default to %d\n", nr_irq);
286
287 omap_init_irq(res.start, nr_irq, of_node_get(node));
288
289 return 0;
290}
291
292static struct of_device_id irq_match[] __initdata = {
293 { .compatible = "ti,omap2-intc", .data = intc_of_init, },
294 { }
295};
296
297void __init omap_intc_of_init(void)
298{
299 of_irq_init(irq_match);
300}
301
302#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX)
303static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
304
305void omap_intc_save_context(void)
306{
307 int ind = 0, i = 0;
308 for (ind = 0; ind < ARRAY_SIZE(irq_banks); ind++) {
309 struct omap_irq_bank *bank = irq_banks + ind;
310 intc_context[ind].sysconfig =
311 intc_bank_read_reg(bank, INTC_SYSCONFIG);
312 intc_context[ind].protection =
313 intc_bank_read_reg(bank, INTC_PROTECTION);
314 intc_context[ind].idle =
315 intc_bank_read_reg(bank, INTC_IDLE);
316 intc_context[ind].threshold =
317 intc_bank_read_reg(bank, INTC_THRESHOLD);
318 for (i = 0; i < INTCPS_NR_IRQS; i++)
319 intc_context[ind].ilr[i] =
320 intc_bank_read_reg(bank, (0x100 + 0x4*i));
321 for (i = 0; i < INTCPS_NR_MIR_REGS; i++)
322 intc_context[ind].mir[i] =
323 intc_bank_read_reg(&irq_banks[0], INTC_MIR0 +
324 (0x20 * i));
325 }
326}
327
328void omap_intc_restore_context(void)
329{
330 int ind = 0, i = 0;
331
332 for (ind = 0; ind < ARRAY_SIZE(irq_banks); ind++) {
333 struct omap_irq_bank *bank = irq_banks + ind;
334 intc_bank_write_reg(intc_context[ind].sysconfig,
335 bank, INTC_SYSCONFIG);
336 intc_bank_write_reg(intc_context[ind].sysconfig,
337 bank, INTC_SYSCONFIG);
338 intc_bank_write_reg(intc_context[ind].protection,
339 bank, INTC_PROTECTION);
340 intc_bank_write_reg(intc_context[ind].idle,
341 bank, INTC_IDLE);
342 intc_bank_write_reg(intc_context[ind].threshold,
343 bank, INTC_THRESHOLD);
344 for (i = 0; i < INTCPS_NR_IRQS; i++)
345 intc_bank_write_reg(intc_context[ind].ilr[i],
346 bank, (0x100 + 0x4*i));
347 for (i = 0; i < INTCPS_NR_MIR_REGS; i++)
348 intc_bank_write_reg(intc_context[ind].mir[i],
349 &irq_banks[0], INTC_MIR0 + (0x20 * i));
350 }
351 /* MIRs are saved and restore with other PRCM registers */
352}
353
354void omap3_intc_suspend(void)
355{
356 /* A pending interrupt would prevent OMAP from entering suspend */
357 omap_ack_irq(NULL);
358}
359
360void omap3_intc_prepare_idle(void)
361{
362 /*
363 * Disable autoidle as it can stall interrupt controller,
364 * cf. errata ID i540 for 3430 (all revisions up to 3.1.x)
365 */
366 intc_bank_write_reg(0, &irq_banks[0], INTC_SYSCONFIG);
367}
368
369void omap3_intc_resume_idle(void)
370{
371 /* Re-enable autoidle */
372 intc_bank_write_reg(1, &irq_banks[0], INTC_SYSCONFIG);
373}
374
375asmlinkage void __exception_irq_entry omap3_intc_handle_irq(struct pt_regs *regs)
376{
377 void __iomem *base_addr = OMAP3_IRQ_BASE;
378 omap_intc_handle_irq(base_addr, regs);
379}
380#endif /* CONFIG_ARCH_OMAP3 */
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
index 828e0db3d943..8bdf182422bd 100644
--- a/arch/arm/mach-omap2/msdi.c
+++ b/arch/arm/mach-omap2/msdi.c
@@ -76,8 +76,8 @@ int omap_msdi_reset(struct omap_hwmod *oh)
76 MAX_MODULE_SOFTRESET_WAIT, c); 76 MAX_MODULE_SOFTRESET_WAIT, c);
77 77
78 if (c == MAX_MODULE_SOFTRESET_WAIT) 78 if (c == MAX_MODULE_SOFTRESET_WAIT)
79 pr_warning("%s: %s: softreset failed (waited %d usec)\n", 79 pr_warn("%s: %s: softreset failed (waited %d usec)\n",
80 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT); 80 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
81 else 81 else
82 pr_debug("%s: %s: softreset in %d usec\n", __func__, 82 pr_debug("%s: %s: softreset in %d usec\n", __func__,
83 oh->name, c); 83 oh->name, c);
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index ac8a249779f2..78064b0d4db5 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -814,7 +814,7 @@ int __init omap_mux_late_init(void)
814 "hwmod_io", omap_mux_late_init); 814 "hwmod_io", omap_mux_late_init);
815 815
816 if (ret) 816 if (ret)
817 pr_warning("mux: Failed to setup hwmod io irq %d\n", ret); 817 pr_warn("mux: Failed to setup hwmod io irq %d\n", ret);
818 818
819 return 0; 819 return 0;
820} 820}
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 4001325f90fb..6944ae3674e8 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -56,6 +56,7 @@
56#include "omap4-sar-layout.h" 56#include "omap4-sar-layout.h"
57#include "pm.h" 57#include "pm.h"
58#include "prcm_mpu44xx.h" 58#include "prcm_mpu44xx.h"
59#include "prcm_mpu54xx.h"
59#include "prminst44xx.h" 60#include "prminst44xx.h"
60#include "prcm44xx.h" 61#include "prcm44xx.h"
61#include "prm44xx.h" 62#include "prm44xx.h"
@@ -68,7 +69,6 @@ struct omap4_cpu_pm_info {
68 void __iomem *scu_sar_addr; 69 void __iomem *scu_sar_addr;
69 void __iomem *wkup_sar_addr; 70 void __iomem *wkup_sar_addr;
70 void __iomem *l2x0_sar_addr; 71 void __iomem *l2x0_sar_addr;
71 void (*secondary_startup)(void);
72}; 72};
73 73
74/** 74/**
@@ -76,6 +76,7 @@ struct omap4_cpu_pm_info {
76 * @finish_suspend: CPU suspend finisher function pointer 76 * @finish_suspend: CPU suspend finisher function pointer
77 * @resume: CPU resume function pointer 77 * @resume: CPU resume function pointer
78 * @scu_prepare: CPU Snoop Control program function pointer 78 * @scu_prepare: CPU Snoop Control program function pointer
79 * @hotplug_restart: CPU restart function pointer
79 * 80 *
80 * Structure holds functions pointer for CPU low power operations like 81 * Structure holds functions pointer for CPU low power operations like
81 * suspend, resume and scu programming. 82 * suspend, resume and scu programming.
@@ -84,11 +85,13 @@ struct cpu_pm_ops {
84 int (*finish_suspend)(unsigned long cpu_state); 85 int (*finish_suspend)(unsigned long cpu_state);
85 void (*resume)(void); 86 void (*resume)(void);
86 void (*scu_prepare)(unsigned int cpu_id, unsigned int cpu_state); 87 void (*scu_prepare)(unsigned int cpu_id, unsigned int cpu_state);
88 void (*hotplug_restart)(void);
87}; 89};
88 90
89static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info); 91static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
90static struct powerdomain *mpuss_pd; 92static struct powerdomain *mpuss_pd;
91static void __iomem *sar_base; 93static void __iomem *sar_base;
94static u32 cpu_context_offset;
92 95
93static int default_finish_suspend(unsigned long cpu_state) 96static int default_finish_suspend(unsigned long cpu_state)
94{ 97{
@@ -106,6 +109,7 @@ struct cpu_pm_ops omap_pm_ops = {
106 .finish_suspend = default_finish_suspend, 109 .finish_suspend = default_finish_suspend,
107 .resume = dummy_cpu_resume, 110 .resume = dummy_cpu_resume,
108 .scu_prepare = dummy_scu_prepare, 111 .scu_prepare = dummy_scu_prepare,
112 .hotplug_restart = dummy_cpu_resume,
109}; 113};
110 114
111/* 115/*
@@ -116,7 +120,8 @@ static inline void set_cpu_wakeup_addr(unsigned int cpu_id, u32 addr)
116{ 120{
117 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); 121 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
118 122
119 writel_relaxed(addr, pm_info->wkup_sar_addr); 123 if (pm_info->wkup_sar_addr)
124 writel_relaxed(addr, pm_info->wkup_sar_addr);
120} 125}
121 126
122/* 127/*
@@ -141,7 +146,8 @@ static void scu_pwrst_prepare(unsigned int cpu_id, unsigned int cpu_state)
141 break; 146 break;
142 } 147 }
143 148
144 writel_relaxed(scu_pwr_st, pm_info->scu_sar_addr); 149 if (pm_info->scu_sar_addr)
150 writel_relaxed(scu_pwr_st, pm_info->scu_sar_addr);
145} 151}
146 152
147/* Helper functions for MPUSS OSWR */ 153/* Helper functions for MPUSS OSWR */
@@ -161,14 +167,14 @@ static inline void cpu_clear_prev_logic_pwrst(unsigned int cpu_id)
161 167
162 if (cpu_id) { 168 if (cpu_id) {
163 reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU1_INST, 169 reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU1_INST,
164 OMAP4_RM_CPU1_CPU1_CONTEXT_OFFSET); 170 cpu_context_offset);
165 omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU1_INST, 171 omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU1_INST,
166 OMAP4_RM_CPU1_CPU1_CONTEXT_OFFSET); 172 cpu_context_offset);
167 } else { 173 } else {
168 reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU0_INST, 174 reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU0_INST,
169 OMAP4_RM_CPU0_CPU0_CONTEXT_OFFSET); 175 cpu_context_offset);
170 omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU0_INST, 176 omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU0_INST,
171 OMAP4_RM_CPU0_CPU0_CONTEXT_OFFSET); 177 cpu_context_offset);
172 } 178 }
173} 179}
174 180
@@ -179,7 +185,8 @@ static void l2x0_pwrst_prepare(unsigned int cpu_id, unsigned int save_state)
179{ 185{
180 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); 186 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
181 187
182 writel_relaxed(save_state, pm_info->l2x0_sar_addr); 188 if (pm_info->l2x0_sar_addr)
189 writel_relaxed(save_state, pm_info->l2x0_sar_addr);
183} 190}
184 191
185/* 192/*
@@ -189,10 +196,14 @@ static void l2x0_pwrst_prepare(unsigned int cpu_id, unsigned int save_state)
189#ifdef CONFIG_CACHE_L2X0 196#ifdef CONFIG_CACHE_L2X0
190static void __init save_l2x0_context(void) 197static void __init save_l2x0_context(void)
191{ 198{
192 writel_relaxed(l2x0_saved_regs.aux_ctrl, 199 void __iomem *l2x0_base = omap4_get_l2cache_base();
193 sar_base + L2X0_AUXCTRL_OFFSET); 200
194 writel_relaxed(l2x0_saved_regs.prefetch_ctrl, 201 if (l2x0_base && sar_base) {
195 sar_base + L2X0_PREFETCH_CTRL_OFFSET); 202 writel_relaxed(l2x0_saved_regs.aux_ctrl,
203 sar_base + L2X0_AUXCTRL_OFFSET);
204 writel_relaxed(l2x0_saved_regs.prefetch_ctrl,
205 sar_base + L2X0_PREFETCH_CTRL_OFFSET);
206 }
196} 207}
197#else 208#else
198static void __init save_l2x0_context(void) 209static void __init save_l2x0_context(void)
@@ -231,6 +242,10 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
231 save_state = 1; 242 save_state = 1;
232 break; 243 break;
233 case PWRDM_POWER_RET: 244 case PWRDM_POWER_RET:
245 if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) {
246 save_state = 0;
247 break;
248 }
234 default: 249 default:
235 /* 250 /*
236 * CPUx CSWR is invalid hardware state. Also CPUx OSWR 251 * CPUx CSWR is invalid hardware state. Also CPUx OSWR
@@ -298,12 +313,16 @@ int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
298 if (omap_rev() == OMAP4430_REV_ES1_0) 313 if (omap_rev() == OMAP4430_REV_ES1_0)
299 return -ENXIO; 314 return -ENXIO;
300 315
316 /* Use the achievable power state for the domain */
317 power_state = pwrdm_get_valid_lp_state(pm_info->pwrdm,
318 false, power_state);
319
301 if (power_state == PWRDM_POWER_OFF) 320 if (power_state == PWRDM_POWER_OFF)
302 cpu_state = 1; 321 cpu_state = 1;
303 322
304 pwrdm_clear_all_prev_pwrst(pm_info->pwrdm); 323 pwrdm_clear_all_prev_pwrst(pm_info->pwrdm);
305 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state); 324 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
306 set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup)); 325 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.hotplug_restart));
307 omap_pm_ops.scu_prepare(cpu, power_state); 326 omap_pm_ops.scu_prepare(cpu, power_state);
308 327
309 /* 328 /*
@@ -319,6 +338,21 @@ int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
319 338
320 339
321/* 340/*
341 * Enable Mercury Fast HG retention mode by default.
342 */
343static void enable_mercury_retention_mode(void)
344{
345 u32 reg;
346
347 reg = omap4_prcm_mpu_read_inst_reg(OMAP54XX_PRCM_MPU_DEVICE_INST,
348 OMAP54XX_PRCM_MPU_PRM_PSCON_COUNT_OFFSET);
349 /* Enable HG_EN, HG_RAMPUP = fast mode */
350 reg |= BIT(24) | BIT(25);
351 omap4_prcm_mpu_write_inst_reg(reg, OMAP54XX_PRCM_MPU_DEVICE_INST,
352 OMAP54XX_PRCM_MPU_PRM_PSCON_COUNT_OFFSET);
353}
354
355/*
322 * Initialise OMAP4 MPUSS 356 * Initialise OMAP4 MPUSS
323 */ 357 */
324int __init omap4_mpuss_init(void) 358int __init omap4_mpuss_init(void)
@@ -330,13 +364,17 @@ int __init omap4_mpuss_init(void)
330 return -ENODEV; 364 return -ENODEV;
331 } 365 }
332 366
333 sar_base = omap4_get_sar_ram_base(); 367 if (cpu_is_omap44xx())
368 sar_base = omap4_get_sar_ram_base();
334 369
335 /* Initilaise per CPU PM information */ 370 /* Initilaise per CPU PM information */
336 pm_info = &per_cpu(omap4_pm_info, 0x0); 371 pm_info = &per_cpu(omap4_pm_info, 0x0);
337 pm_info->scu_sar_addr = sar_base + SCU_OFFSET0; 372 if (sar_base) {
338 pm_info->wkup_sar_addr = sar_base + CPU0_WAKEUP_NS_PA_ADDR_OFFSET; 373 pm_info->scu_sar_addr = sar_base + SCU_OFFSET0;
339 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET0; 374 pm_info->wkup_sar_addr = sar_base +
375 CPU0_WAKEUP_NS_PA_ADDR_OFFSET;
376 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET0;
377 }
340 pm_info->pwrdm = pwrdm_lookup("cpu0_pwrdm"); 378 pm_info->pwrdm = pwrdm_lookup("cpu0_pwrdm");
341 if (!pm_info->pwrdm) { 379 if (!pm_info->pwrdm) {
342 pr_err("Lookup failed for CPU0 pwrdm\n"); 380 pr_err("Lookup failed for CPU0 pwrdm\n");
@@ -351,13 +389,12 @@ int __init omap4_mpuss_init(void)
351 pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON); 389 pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON);
352 390
353 pm_info = &per_cpu(omap4_pm_info, 0x1); 391 pm_info = &per_cpu(omap4_pm_info, 0x1);
354 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1; 392 if (sar_base) {
355 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET; 393 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1;
356 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1; 394 pm_info->wkup_sar_addr = sar_base +
357 if (cpu_is_omap446x()) 395 CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
358 pm_info->secondary_startup = omap4460_secondary_startup; 396 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1;
359 else 397 }
360 pm_info->secondary_startup = omap4_secondary_startup;
361 398
362 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm"); 399 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm");
363 if (!pm_info->pwrdm) { 400 if (!pm_info->pwrdm) {
@@ -380,20 +417,27 @@ int __init omap4_mpuss_init(void)
380 pwrdm_clear_all_prev_pwrst(mpuss_pd); 417 pwrdm_clear_all_prev_pwrst(mpuss_pd);
381 mpuss_clear_prev_logic_pwrst(); 418 mpuss_clear_prev_logic_pwrst();
382 419
383 /* Save device type on scratchpad for low level code to use */ 420 if (sar_base) {
384 if (omap_type() != OMAP2_DEVICE_TYPE_GP) 421 /* Save device type on scratchpad for low level code to use */
385 writel_relaxed(1, sar_base + OMAP_TYPE_OFFSET); 422 writel_relaxed((omap_type() != OMAP2_DEVICE_TYPE_GP) ? 1 : 0,
386 else 423 sar_base + OMAP_TYPE_OFFSET);
387 writel_relaxed(0, sar_base + OMAP_TYPE_OFFSET); 424 save_l2x0_context();
388 425 }
389 save_l2x0_context();
390 426
391 if (cpu_is_omap44xx()) { 427 if (cpu_is_omap44xx()) {
392 omap_pm_ops.finish_suspend = omap4_finish_suspend; 428 omap_pm_ops.finish_suspend = omap4_finish_suspend;
393 omap_pm_ops.resume = omap4_cpu_resume; 429 omap_pm_ops.resume = omap4_cpu_resume;
394 omap_pm_ops.scu_prepare = scu_pwrst_prepare; 430 omap_pm_ops.scu_prepare = scu_pwrst_prepare;
431 omap_pm_ops.hotplug_restart = omap4_secondary_startup;
432 cpu_context_offset = OMAP4_RM_CPU0_CPU0_CONTEXT_OFFSET;
433 } else if (soc_is_omap54xx() || soc_is_dra7xx()) {
434 cpu_context_offset = OMAP54XX_RM_CPU0_CPU0_CONTEXT_OFFSET;
435 enable_mercury_retention_mode();
395 } 436 }
396 437
438 if (cpu_is_omap446x())
439 omap_pm_ops.hotplug_restart = omap4460_secondary_startup;
440
397 return 0; 441 return 0;
398} 442}
399 443
diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h
index 3e97c6c8ecf1..dec2b05d184b 100644
--- a/arch/arm/mach-omap2/omap-secure.h
+++ b/arch/arm/mach-omap2/omap-secure.h
@@ -45,6 +45,7 @@
45#define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113 45#define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113
46 46
47#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109 47#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109
48#define OMAP5_MON_AMBA_IF_INDEX 0x108
48 49
49/* Secure PPA(Primary Protected Application) APIs */ 50/* Secure PPA(Primary Protected Application) APIs */
50#define OMAP4_PPA_L2_POR_INDEX 0x23 51#define OMAP4_PPA_L2_POR_INDEX 0x23
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index 37843a7d3639..f961c46453b9 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -32,6 +32,7 @@
32#include "soc.h" 32#include "soc.h"
33#include "omap4-sar-layout.h" 33#include "omap4-sar-layout.h"
34#include "common.h" 34#include "common.h"
35#include "pm.h"
35 36
36#define AM43XX_NR_REG_BANKS 7 37#define AM43XX_NR_REG_BANKS 7
37#define AM43XX_IRQS 224 38#define AM43XX_IRQS 224
@@ -381,7 +382,7 @@ static struct notifier_block irq_notifier_block = {
381static void __init irq_pm_init(void) 382static void __init irq_pm_init(void)
382{ 383{
383 /* FIXME: Remove this when MPU OSWR support is added */ 384 /* FIXME: Remove this when MPU OSWR support is added */
384 if (!soc_is_omap54xx()) 385 if (!IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE))
385 cpu_pm_register_notifier(&irq_notifier_block); 386 cpu_pm_register_notifier(&irq_notifier_block);
386} 387}
387#else 388#else
@@ -406,6 +407,7 @@ int __init omap_wakeupgen_init(void)
406{ 407{
407 int i; 408 int i;
408 unsigned int boot_cpu = smp_processor_id(); 409 unsigned int boot_cpu = smp_processor_id();
410 u32 val;
409 411
410 /* Not supported on OMAP4 ES1.0 silicon */ 412 /* Not supported on OMAP4 ES1.0 silicon */
411 if (omap_rev() == OMAP4430_REV_ES1_0) { 413 if (omap_rev() == OMAP4430_REV_ES1_0) {
@@ -451,6 +453,22 @@ int __init omap_wakeupgen_init(void)
451 for (i = 0; i < max_irqs; i++) 453 for (i = 0; i < max_irqs; i++)
452 irq_target_cpu[i] = boot_cpu; 454 irq_target_cpu[i] = boot_cpu;
453 455
456 /*
457 * Enables OMAP5 ES2 PM Mode using ES2_PM_MODE in AMBA_IF_MODE
458 * 0x0: ES1 behavior, CPU cores would enter and exit OFF mode together.
459 * 0x1: ES2 behavior, CPU cores are allowed to enter/exit OFF mode
460 * independently.
461 * This needs to be set one time thanks to always ON domain.
462 *
463 * We do not support ES1 behavior anymore. OMAP5 is assumed to be
464 * ES2.0, and the same is applicable for DRA7.
465 */
466 if (soc_is_omap54xx() || soc_is_dra7xx()) {
467 val = __raw_readl(wakeupgen_base + OMAP_AMBA_IF_MODE);
468 val |= BIT(5);
469 omap_smc1(OMAP5_MON_AMBA_IF_INDEX, val);
470 }
471
454 irq_hotplug_init(); 472 irq_hotplug_init();
455 irq_pm_init(); 473 irq_pm_init();
456 474
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.h b/arch/arm/mach-omap2/omap-wakeupgen.h
index b0fd16f5c391..b3c8eccfae79 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.h
+++ b/arch/arm/mach-omap2/omap-wakeupgen.h
@@ -27,6 +27,7 @@
27#define OMAP_WKG_ENB_E_1 0x420 27#define OMAP_WKG_ENB_E_1 0x420
28#define OMAP_AUX_CORE_BOOT_0 0x800 28#define OMAP_AUX_CORE_BOOT_0 0x800
29#define OMAP_AUX_CORE_BOOT_1 0x804 29#define OMAP_AUX_CORE_BOOT_1 0x804
30#define OMAP_AMBA_IF_MODE 0x80c
30#define OMAP_PTMSYNCREQ_MASK 0xc00 31#define OMAP_PTMSYNCREQ_MASK 0xc00
31#define OMAP_PTMSYNCREQ_EN 0xc04 32#define OMAP_PTMSYNCREQ_EN 0xc04
32#define OMAP_TIMESTAMPCYCLELO 0xc08 33#define OMAP_TIMESTAMPCYCLELO 0xc08
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index a0fe747634c1..16b20cedc38d 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -25,6 +25,7 @@
25#include <linux/irqchip/irq-crossbar.h> 25#include <linux/irqchip/irq-crossbar.h>
26#include <linux/of_address.h> 26#include <linux/of_address.h>
27#include <linux/reboot.h> 27#include <linux/reboot.h>
28#include <linux/genalloc.h>
28 29
29#include <asm/hardware/cache-l2x0.h> 30#include <asm/hardware/cache-l2x0.h>
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
@@ -71,6 +72,26 @@ void omap_bus_sync(void)
71} 72}
72EXPORT_SYMBOL(omap_bus_sync); 73EXPORT_SYMBOL(omap_bus_sync);
73 74
75static int __init omap4_sram_init(void)
76{
77 struct device_node *np;
78 struct gen_pool *sram_pool;
79
80 np = of_find_compatible_node(NULL, NULL, "ti,omap4-mpu");
81 if (!np)
82 pr_warn("%s:Unable to allocate sram needed to handle errata I688\n",
83 __func__);
84 sram_pool = of_get_named_gen_pool(np, "sram", 0);
85 if (!sram_pool)
86 pr_warn("%s:Unable to get sram pool needed to handle errata I688\n",
87 __func__);
88 else
89 sram_sync = (void *)gen_pool_alloc(sram_pool, PAGE_SIZE);
90
91 return 0;
92}
93omap_arch_initcall(omap4_sram_init);
94
74/* Steal one page physical memory for barrier implementation */ 95/* Steal one page physical memory for barrier implementation */
75int __init omap_barrier_reserve_memblock(void) 96int __init omap_barrier_reserve_memblock(void)
76{ 97{
@@ -91,7 +112,6 @@ void __init omap_barriers_init(void)
91 dram_io_desc[0].type = MT_MEMORY_RW_SO; 112 dram_io_desc[0].type = MT_MEMORY_RW_SO;
92 iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); 113 iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc));
93 dram_sync = (void __iomem *) dram_io_desc[0].virtual; 114 dram_sync = (void __iomem *) dram_io_desc[0].virtual;
94 sram_sync = (void __iomem *) OMAP4_SRAM_VA;
95 115
96 pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n", 116 pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n",
97 (long long) paddr, dram_io_desc[0].virtual); 117 (long long) paddr, dram_io_desc[0].virtual);
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 01ef59def44b..d22c30d3ccfa 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -56,7 +56,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
56 56
57 r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); 57 r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias);
58 if (!IS_ERR(r)) { 58 if (!IS_ERR(r)) {
59 dev_warn(&od->pdev->dev, 59 dev_dbg(&od->pdev->dev,
60 "alias %s already exists\n", clk_alias); 60 "alias %s already exists\n", clk_alias);
61 clk_put(r); 61 clk_put(r);
62 return; 62 return;
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 6c074f37cdd2..716247ed9e0c 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -769,8 +769,8 @@ static int _init_main_clk(struct omap_hwmod *oh)
769 769
770 oh->_clk = clk_get(NULL, oh->main_clk); 770 oh->_clk = clk_get(NULL, oh->main_clk);
771 if (IS_ERR(oh->_clk)) { 771 if (IS_ERR(oh->_clk)) {
772 pr_warning("omap_hwmod: %s: cannot clk_get main_clk %s\n", 772 pr_warn("omap_hwmod: %s: cannot clk_get main_clk %s\n",
773 oh->name, oh->main_clk); 773 oh->name, oh->main_clk);
774 return -EINVAL; 774 return -EINVAL;
775 } 775 }
776 /* 776 /*
@@ -814,8 +814,8 @@ static int _init_interface_clks(struct omap_hwmod *oh)
814 814
815 c = clk_get(NULL, os->clk); 815 c = clk_get(NULL, os->clk);
816 if (IS_ERR(c)) { 816 if (IS_ERR(c)) {
817 pr_warning("omap_hwmod: %s: cannot clk_get interface_clk %s\n", 817 pr_warn("omap_hwmod: %s: cannot clk_get interface_clk %s\n",
818 oh->name, os->clk); 818 oh->name, os->clk);
819 ret = -EINVAL; 819 ret = -EINVAL;
820 continue; 820 continue;
821 } 821 }
@@ -851,8 +851,8 @@ static int _init_opt_clks(struct omap_hwmod *oh)
851 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) { 851 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) {
852 c = clk_get(NULL, oc->clk); 852 c = clk_get(NULL, oc->clk);
853 if (IS_ERR(c)) { 853 if (IS_ERR(c)) {
854 pr_warning("omap_hwmod: %s: cannot clk_get opt_clk %s\n", 854 pr_warn("omap_hwmod: %s: cannot clk_get opt_clk %s\n",
855 oh->name, oc->clk); 855 oh->name, oc->clk);
856 ret = -EINVAL; 856 ret = -EINVAL;
857 continue; 857 continue;
858 } 858 }
@@ -1576,7 +1576,7 @@ static int _init_clkdm(struct omap_hwmod *oh)
1576 1576
1577 oh->clkdm = clkdm_lookup(oh->clkdm_name); 1577 oh->clkdm = clkdm_lookup(oh->clkdm_name);
1578 if (!oh->clkdm) { 1578 if (!oh->clkdm) {
1579 pr_warning("omap_hwmod: %s: could not associate to clkdm %s\n", 1579 pr_warn("omap_hwmod: %s: could not associate to clkdm %s\n",
1580 oh->name, oh->clkdm_name); 1580 oh->name, oh->clkdm_name);
1581 return 0; 1581 return 0;
1582 } 1582 }
@@ -1616,7 +1616,7 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1616 if (!ret) 1616 if (!ret)
1617 oh->_state = _HWMOD_STATE_CLKS_INITED; 1617 oh->_state = _HWMOD_STATE_CLKS_INITED;
1618 else 1618 else
1619 pr_warning("omap_hwmod: %s: cannot _init_clocks\n", oh->name); 1619 pr_warn("omap_hwmod: %s: cannot _init_clocks\n", oh->name);
1620 1620
1621 return ret; 1621 return ret;
1622} 1622}
@@ -1739,7 +1739,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1739 _disable_clocks(oh); 1739 _disable_clocks(oh);
1740 1740
1741 if (ret == -EBUSY) 1741 if (ret == -EBUSY)
1742 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name); 1742 pr_warn("omap_hwmod: %s: failed to hardreset\n", oh->name);
1743 1743
1744 if (!ret) { 1744 if (!ret) {
1745 /* 1745 /*
@@ -1953,8 +1953,8 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1953 1953
1954 c = _wait_softreset_complete(oh); 1954 c = _wait_softreset_complete(oh);
1955 if (c == MAX_MODULE_SOFTRESET_WAIT) { 1955 if (c == MAX_MODULE_SOFTRESET_WAIT) {
1956 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", 1956 pr_warn("omap_hwmod: %s: softreset failed (waited %d usec)\n",
1957 oh->name, MAX_MODULE_SOFTRESET_WAIT); 1957 oh->name, MAX_MODULE_SOFTRESET_WAIT);
1958 ret = -ETIMEDOUT; 1958 ret = -ETIMEDOUT;
1959 goto dis_opt_clks; 1959 goto dis_opt_clks;
1960 } else { 1960 } else {
@@ -2065,7 +2065,7 @@ static void _reconfigure_io_chain(void)
2065 2065
2066 spin_lock_irqsave(&io_chain_lock, flags); 2066 spin_lock_irqsave(&io_chain_lock, flags);
2067 2067
2068 if (cpu_is_omap34xx() && omap3_has_io_chain_ctrl()) 2068 if (cpu_is_omap34xx())
2069 omap3xxx_prm_reconfigure_io_chain(); 2069 omap3xxx_prm_reconfigure_io_chain();
2070 else if (cpu_is_omap44xx()) 2070 else if (cpu_is_omap44xx())
2071 omap44xx_prm_reconfigure_io_chain(); 2071 omap44xx_prm_reconfigure_io_chain();
@@ -2185,6 +2185,8 @@ static int _enable(struct omap_hwmod *oh)
2185 oh->mux->pads_dynamic))) { 2185 oh->mux->pads_dynamic))) {
2186 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED); 2186 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
2187 _reconfigure_io_chain(); 2187 _reconfigure_io_chain();
2188 } else if (oh->flags & HWMOD_RECONFIG_IO_CHAIN) {
2189 _reconfigure_io_chain();
2188 } 2190 }
2189 2191
2190 _add_initiator_dep(oh, mpu_oh); 2192 _add_initiator_dep(oh, mpu_oh);
@@ -2291,6 +2293,8 @@ static int _idle(struct omap_hwmod *oh)
2291 if (oh->mux && oh->mux->pads_dynamic) { 2293 if (oh->mux && oh->mux->pads_dynamic) {
2292 omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE); 2294 omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE);
2293 _reconfigure_io_chain(); 2295 _reconfigure_io_chain();
2296 } else if (oh->flags & HWMOD_RECONFIG_IO_CHAIN) {
2297 _reconfigure_io_chain();
2294 } 2298 }
2295 2299
2296 oh->_state = _HWMOD_STATE_IDLE; 2300 oh->_state = _HWMOD_STATE_IDLE;
@@ -2614,8 +2618,8 @@ static int __init _setup_reset(struct omap_hwmod *oh)
2614 if (oh->rst_lines_cnt == 0) { 2618 if (oh->rst_lines_cnt == 0) {
2615 r = _enable(oh); 2619 r = _enable(oh);
2616 if (r) { 2620 if (r) {
2617 pr_warning("omap_hwmod: %s: cannot be enabled for reset (%d)\n", 2621 pr_warn("omap_hwmod: %s: cannot be enabled for reset (%d)\n",
2618 oh->name, oh->_state); 2622 oh->name, oh->_state);
2619 return -EINVAL; 2623 return -EINVAL;
2620 } 2624 }
2621 } 2625 }
@@ -3345,6 +3349,9 @@ int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois)
3345 if (!ois) 3349 if (!ois)
3346 return 0; 3350 return 0;
3347 3351
3352 if (ois[0] == NULL) /* Empty list */
3353 return 0;
3354
3348 if (!linkspace) { 3355 if (!linkspace) {
3349 if (_alloc_linkspace(ois)) { 3356 if (_alloc_linkspace(ois)) {
3350 pr_err("omap_hwmod: could not allocate link space\n"); 3357 pr_err("omap_hwmod: could not allocate link space\n");
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 0f97d635ff90..512f809a3f4d 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -514,6 +514,9 @@ struct omap_hwmod_omap4_prcm {
514 * HWMOD_SWSUP_SIDLE_ACT: omap_hwmod code should manually bring the module 514 * HWMOD_SWSUP_SIDLE_ACT: omap_hwmod code should manually bring the module
515 * out of idle, but rely on smart-idle to the put it back in idle, 515 * out of idle, but rely on smart-idle to the put it back in idle,
516 * so the wakeups are still functional (Only known case for now is UART) 516 * so the wakeups are still functional (Only known case for now is UART)
517 * HWMOD_RECONFIG_IO_CHAIN: omap_hwmod code needs to reconfigure wake-up
518 * events by calling _reconfigure_io_chain() when a device is enabled
519 * or idled.
517 */ 520 */
518#define HWMOD_SWSUP_SIDLE (1 << 0) 521#define HWMOD_SWSUP_SIDLE (1 << 0)
519#define HWMOD_SWSUP_MSTANDBY (1 << 1) 522#define HWMOD_SWSUP_MSTANDBY (1 << 1)
@@ -528,6 +531,7 @@ struct omap_hwmod_omap4_prcm {
528#define HWMOD_BLOCK_WFI (1 << 10) 531#define HWMOD_BLOCK_WFI (1 << 10)
529#define HWMOD_FORCE_MSTANDBY (1 << 11) 532#define HWMOD_FORCE_MSTANDBY (1 << 11)
530#define HWMOD_SWSUP_SIDLE_ACT (1 << 12) 533#define HWMOD_SWSUP_SIDLE_ACT (1 << 12)
534#define HWMOD_RECONFIG_IO_CHAIN (1 << 13)
531 535
532/* 536/*
533 * omap_hwmod._int_flags definitions 537 * omap_hwmod._int_flags definitions
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index e9516b454e76..2a78b093c0ce 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -490,7 +490,7 @@ static struct omap_hwmod omap3xxx_uart1_hwmod = {
490 .mpu_irqs = omap2_uart1_mpu_irqs, 490 .mpu_irqs = omap2_uart1_mpu_irqs,
491 .sdma_reqs = omap2_uart1_sdma_reqs, 491 .sdma_reqs = omap2_uart1_sdma_reqs,
492 .main_clk = "uart1_fck", 492 .main_clk = "uart1_fck",
493 .flags = DEBUG_TI81XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 493 .flags = DEBUG_TI81XXUART1_FLAGS | HWMOD_SWSUP_SIDLE,
494 .prcm = { 494 .prcm = {
495 .omap2 = { 495 .omap2 = {
496 .module_offs = CORE_MOD, 496 .module_offs = CORE_MOD,
@@ -509,7 +509,7 @@ static struct omap_hwmod omap3xxx_uart2_hwmod = {
509 .mpu_irqs = omap2_uart2_mpu_irqs, 509 .mpu_irqs = omap2_uart2_mpu_irqs,
510 .sdma_reqs = omap2_uart2_sdma_reqs, 510 .sdma_reqs = omap2_uart2_sdma_reqs,
511 .main_clk = "uart2_fck", 511 .main_clk = "uart2_fck",
512 .flags = DEBUG_TI81XXUART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 512 .flags = DEBUG_TI81XXUART2_FLAGS | HWMOD_SWSUP_SIDLE,
513 .prcm = { 513 .prcm = {
514 .omap2 = { 514 .omap2 = {
515 .module_offs = CORE_MOD, 515 .module_offs = CORE_MOD,
@@ -529,7 +529,7 @@ static struct omap_hwmod omap3xxx_uart3_hwmod = {
529 .sdma_reqs = omap2_uart3_sdma_reqs, 529 .sdma_reqs = omap2_uart3_sdma_reqs,
530 .main_clk = "uart3_fck", 530 .main_clk = "uart3_fck",
531 .flags = DEBUG_OMAP3UART3_FLAGS | DEBUG_TI81XXUART3_FLAGS | 531 .flags = DEBUG_OMAP3UART3_FLAGS | DEBUG_TI81XXUART3_FLAGS |
532 HWMOD_SWSUP_SIDLE_ACT, 532 HWMOD_SWSUP_SIDLE,
533 .prcm = { 533 .prcm = {
534 .omap2 = { 534 .omap2 = {
535 .module_offs = OMAP3430_PER_MOD, 535 .module_offs = OMAP3430_PER_MOD,
@@ -559,7 +559,7 @@ static struct omap_hwmod omap36xx_uart4_hwmod = {
559 .mpu_irqs = uart4_mpu_irqs, 559 .mpu_irqs = uart4_mpu_irqs,
560 .sdma_reqs = uart4_sdma_reqs, 560 .sdma_reqs = uart4_sdma_reqs,
561 .main_clk = "uart4_fck", 561 .main_clk = "uart4_fck",
562 .flags = DEBUG_OMAP3UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 562 .flags = DEBUG_OMAP3UART4_FLAGS | HWMOD_SWSUP_SIDLE,
563 .prcm = { 563 .prcm = {
564 .omap2 = { 564 .omap2 = {
565 .module_offs = OMAP3430_PER_MOD, 565 .module_offs = OMAP3430_PER_MOD,
@@ -1730,8 +1730,8 @@ static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
1730 * Note that musb has OTG_FORCESTDBY register that controls MSTANDBY 1730 * Note that musb has OTG_FORCESTDBY register that controls MSTANDBY
1731 * signal when MIDLEMODE is set to force-idle. 1731 * signal when MIDLEMODE is set to force-idle.
1732 */ 1732 */
1733 .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE 1733 .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE |
1734 | HWMOD_FORCE_MSTANDBY, 1734 HWMOD_FORCE_MSTANDBY | HWMOD_RECONFIG_IO_CHAIN,
1735}; 1735};
1736 1736
1737/* usb_otg_hs */ 1737/* usb_otg_hs */
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 2757abf87fbc..5684f112654b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -35,6 +35,7 @@
35#include "i2c.h" 35#include "i2c.h"
36#include "mmc.h" 36#include "mmc.h"
37#include "wd_timer.h" 37#include "wd_timer.h"
38#include "soc.h"
38 39
39/* Base offset for all DRA7XX interrupts external to MPUSS */ 40/* Base offset for all DRA7XX interrupts external to MPUSS */
40#define DRA7XX_IRQ_GIC_START 32 41#define DRA7XX_IRQ_GIC_START 32
@@ -3261,7 +3262,6 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
3261 &dra7xx_l4_per3__usb_otg_ss1, 3262 &dra7xx_l4_per3__usb_otg_ss1,
3262 &dra7xx_l4_per3__usb_otg_ss2, 3263 &dra7xx_l4_per3__usb_otg_ss2,
3263 &dra7xx_l4_per3__usb_otg_ss3, 3264 &dra7xx_l4_per3__usb_otg_ss3,
3264 &dra7xx_l4_per3__usb_otg_ss4,
3265 &dra7xx_l3_main_1__vcp1, 3265 &dra7xx_l3_main_1__vcp1,
3266 &dra7xx_l4_per2__vcp1, 3266 &dra7xx_l4_per2__vcp1,
3267 &dra7xx_l3_main_1__vcp2, 3267 &dra7xx_l3_main_1__vcp2,
@@ -3270,8 +3270,26 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
3270 NULL, 3270 NULL,
3271}; 3271};
3272 3272
3273static struct omap_hwmod_ocp_if *dra74x_hwmod_ocp_ifs[] __initdata = {
3274 &dra7xx_l4_per3__usb_otg_ss4,
3275 NULL,
3276};
3277
3278static struct omap_hwmod_ocp_if *dra72x_hwmod_ocp_ifs[] __initdata = {
3279 NULL,
3280};
3281
3273int __init dra7xx_hwmod_init(void) 3282int __init dra7xx_hwmod_init(void)
3274{ 3283{
3284 int ret;
3285
3275 omap_hwmod_init(); 3286 omap_hwmod_init();
3276 return omap_hwmod_register_links(dra7xx_hwmod_ocp_ifs); 3287 ret = omap_hwmod_register_links(dra7xx_hwmod_ocp_ifs);
3288
3289 if (!ret && soc_is_dra74x())
3290 return omap_hwmod_register_links(dra74x_hwmod_ocp_ifs);
3291 else if (!ret && soc_is_dra72x())
3292 return omap_hwmod_register_links(dra72x_hwmod_ocp_ifs);
3293
3294 return ret;
3277} 3295}
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 90c88d498485..c95346c94829 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -244,14 +244,22 @@ static void __init nokia_n900_legacy_init(void)
244 /* set IBE to 1 */ 244 /* set IBE to 1 */
245 rx51_secure_update_aux_cr(BIT(6), 0); 245 rx51_secure_update_aux_cr(BIT(6), 0);
246 } else { 246 } else {
247 pr_warning("RX-51: Not enabling ARM errata 430973 workaround\n"); 247 pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n");
248 pr_warning("Thumb binaries may crash randomly without this workaround\n"); 248 pr_warn("Thumb binaries may crash randomly without this workaround\n");
249 } 249 }
250 250
251 pr_info("RX-51: Registring OMAP3 HWRNG device\n"); 251 pr_info("RX-51: Registring OMAP3 HWRNG device\n");
252 platform_device_register(&omap3_rom_rng_device); 252 platform_device_register(&omap3_rom_rng_device);
253 253
254 } 254 }
255
256 /* Only on some development boards */
257 gpio_request_one(164, GPIOF_OUT_INIT_LOW, "smc91x reset");
258}
259
260static void __init omap3_tao3530_legacy_init(void)
261{
262 hsmmc2_internal_input_clk();
255} 263}
256#endif /* CONFIG_ARCH_OMAP3 */ 264#endif /* CONFIG_ARCH_OMAP3 */
257 265
@@ -336,6 +344,8 @@ static struct pdata_init auxdata_quirks[] __initdata = {
336struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { 344struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
337#ifdef CONFIG_MACH_NOKIA_N8X0 345#ifdef CONFIG_MACH_NOKIA_N8X0
338 OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL), 346 OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
347 OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
348 OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
339#endif 349#endif
340#ifdef CONFIG_ARCH_OMAP3 350#ifdef CONFIG_ARCH_OMAP3
341 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata), 351 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
@@ -352,6 +362,16 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
352 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata), 362 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata),
353 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata), 363 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata),
354#endif 364#endif
365#ifdef CONFIG_SOC_OMAP5
366 OF_DEV_AUXDATA("ti,omap5-padconf", 0x4a002840, "4a002840.pinmux", &pcs_pdata),
367 OF_DEV_AUXDATA("ti,omap5-padconf", 0x4ae0c840, "4ae0c840.pinmux", &pcs_pdata),
368#endif
369#ifdef CONFIG_SOC_DRA7XX
370 OF_DEV_AUXDATA("ti,dra7-padconf", 0x4a003400, "4a003400.pinmux", &pcs_pdata),
371#endif
372#ifdef CONFIG_SOC_AM43XX
373 OF_DEV_AUXDATA("ti,am437-padconf", 0x44e10800, "44e10800.pinmux", &pcs_pdata),
374#endif
355#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) 375#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
356 OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu", 376 OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
357 &omap4_iommu_pdata), 377 &omap4_iommu_pdata),
@@ -377,6 +397,7 @@ static struct pdata_init pdata_quirks[] __initdata = {
377 { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, 397 { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
378 { "ti,omap3-zoom3", omap3_zoom_legacy_init, }, 398 { "ti,omap3-zoom3", omap3_zoom_legacy_init, },
379 { "ti,am3517-evm", am3517_evm_legacy_init, }, 399 { "ti,am3517-evm", am3517_evm_legacy_init, },
400 { "technexion,omap3-tao3530", omap3_tao3530_legacy_init, },
380#endif 401#endif
381#ifdef CONFIG_ARCH_OMAP4 402#ifdef CONFIG_ARCH_OMAP4
382 { "ti,omap4-sdp", omap4_sdp_legacy_init, }, 403 { "ti,omap4-sdp", omap4_sdp_legacy_init, },
@@ -405,7 +426,7 @@ static void pdata_quirks_check(struct pdata_init *quirks)
405 } 426 }
406} 427}
407 428
408void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table) 429void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
409{ 430{
410 omap_sdrc_init(NULL, NULL); 431 omap_sdrc_init(NULL, NULL);
411 pdata_quirks_check(auxdata_quirks); 432 pdata_quirks_check(auxdata_quirks);
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 828aee9ea6a8..58920bc8807b 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -282,7 +282,7 @@ static inline void omap_init_cpufreq(void)
282 if (!of_have_populated_dt()) 282 if (!of_have_populated_dt())
283 devinfo.name = "omap-cpufreq"; 283 devinfo.name = "omap-cpufreq";
284 else 284 else
285 devinfo.name = "cpufreq-cpu0"; 285 devinfo.name = "cpufreq-dt";
286 platform_device_register_full(&devinfo); 286 platform_device_register_full(&devinfo);
287} 287}
288 288
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index e150102d6c06..425bfcd67db6 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -101,6 +101,7 @@ static inline void enable_omap3630_toggle_l2_on_restore(void) { }
101#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */ 101#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */
102 102
103#define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0) 103#define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0)
104#define PM_OMAP4_CPU_OSWR_DISABLE (1 << 1)
104 105
105#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) 106#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4)
106extern u16 pm44xx_errata; 107extern u16 pm44xx_errata;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 3f80929a5f7e..175564c88a30 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -465,7 +465,7 @@ int __init omap3_pm_init(void)
465 int ret; 465 int ret;
466 466
467 if (!omap3_has_io_chain_ctrl()) 467 if (!omap3_has_io_chain_ctrl())
468 pr_warning("PM: no software I/O chain control; some wakeups may be lost\n"); 468 pr_warn("PM: no software I/O chain control; some wakeups may be lost\n");
469 469
470 pm_errata_configure(); 470 pm_errata_configure();
471 471
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 0dda6cf8b855..503097c72b82 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -29,6 +29,7 @@ u16 pm44xx_errata;
29struct power_state { 29struct power_state {
30 struct powerdomain *pwrdm; 30 struct powerdomain *pwrdm;
31 u32 next_state; 31 u32 next_state;
32 u32 next_logic_state;
32#ifdef CONFIG_SUSPEND 33#ifdef CONFIG_SUSPEND
33 u32 saved_state; 34 u32 saved_state;
34 u32 saved_logic_state; 35 u32 saved_logic_state;
@@ -36,6 +37,8 @@ struct power_state {
36 struct list_head node; 37 struct list_head node;
37}; 38};
38 39
40static u32 cpu_suspend_state = PWRDM_POWER_OFF;
41
39static LIST_HEAD(pwrst_list); 42static LIST_HEAD(pwrst_list);
40 43
41#ifdef CONFIG_SUSPEND 44#ifdef CONFIG_SUSPEND
@@ -54,7 +57,7 @@ static int omap4_pm_suspend(void)
54 /* Set targeted power domain states by suspend */ 57 /* Set targeted power domain states by suspend */
55 list_for_each_entry(pwrst, &pwrst_list, node) { 58 list_for_each_entry(pwrst, &pwrst_list, node) {
56 omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); 59 omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
57 pwrdm_set_logic_retst(pwrst->pwrdm, PWRDM_POWER_OFF); 60 pwrdm_set_logic_retst(pwrst->pwrdm, pwrst->next_logic_state);
58 } 61 }
59 62
60 /* 63 /*
@@ -66,7 +69,7 @@ static int omap4_pm_suspend(void)
66 * domain CSWR is not supported by hardware. 69 * domain CSWR is not supported by hardware.
67 * More details can be found in OMAP4430 TRM section 4.3.4.2. 70 * More details can be found in OMAP4430 TRM section 4.3.4.2.
68 */ 71 */
69 omap4_enter_lowpower(cpu_id, PWRDM_POWER_OFF); 72 omap4_enter_lowpower(cpu_id, cpu_suspend_state);
70 73
71 /* Restore next powerdomain state */ 74 /* Restore next powerdomain state */
72 list_for_each_entry(pwrst, &pwrst_list, node) { 75 list_for_each_entry(pwrst, &pwrst_list, node) {
@@ -112,15 +115,22 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
112 * through hotplug path and CPU0 explicitly programmed 115 * through hotplug path and CPU0 explicitly programmed
113 * further down in the code path 116 * further down in the code path
114 */ 117 */
115 if (!strncmp(pwrdm->name, "cpu", 3)) 118 if (!strncmp(pwrdm->name, "cpu", 3)) {
119 if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE))
120 cpu_suspend_state = PWRDM_POWER_RET;
116 return 0; 121 return 0;
122 }
117 123
118 pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC); 124 pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC);
119 if (!pwrst) 125 if (!pwrst)
120 return -ENOMEM; 126 return -ENOMEM;
121 127
122 pwrst->pwrdm = pwrdm; 128 pwrst->pwrdm = pwrdm;
123 pwrst->next_state = PWRDM_POWER_RET; 129 pwrst->next_state = pwrdm_get_valid_lp_state(pwrdm, false,
130 PWRDM_POWER_RET);
131 pwrst->next_logic_state = pwrdm_get_valid_lp_state(pwrdm, true,
132 PWRDM_POWER_OFF);
133
124 list_add(&pwrst->node, &pwrst_list); 134 list_add(&pwrst->node, &pwrst_list);
125 135
126 return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); 136 return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
@@ -203,6 +213,32 @@ static inline int omap4_init_static_deps(void)
203} 213}
204 214
205/** 215/**
216 * omap5_dra7_init_static_deps - Init static clkdm dependencies on OMAP5 and
217 * DRA7
218 *
219 * The dynamic dependency between MPUSS -> EMIF is broken and has
220 * not worked as expected. The hardware recommendation is to
221 * enable static dependencies for these to avoid system
222 * lock ups or random crashes.
223 */
224static inline int omap5_dra7_init_static_deps(void)
225{
226 struct clockdomain *mpuss_clkdm, *emif_clkdm;
227 int ret;
228
229 mpuss_clkdm = clkdm_lookup("mpu_clkdm");
230 emif_clkdm = clkdm_lookup("emif_clkdm");
231 if (!mpuss_clkdm || !emif_clkdm)
232 return -EINVAL;
233
234 ret = clkdm_add_wkdep(mpuss_clkdm, emif_clkdm);
235 if (ret)
236 pr_err("Failed to add MPUSS -> EMIF wakeup dependency\n");
237
238 return ret;
239}
240
241/**
206 * omap4_pm_init_early - Does early initialization necessary for OMAP4+ devices 242 * omap4_pm_init_early - Does early initialization necessary for OMAP4+ devices
207 * 243 *
208 * Initializes basic stuff for power management functionality. 244 * Initializes basic stuff for power management functionality.
@@ -212,6 +248,9 @@ int __init omap4_pm_init_early(void)
212 if (cpu_is_omap446x()) 248 if (cpu_is_omap446x())
213 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD; 249 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
214 250
251 if (soc_is_omap54xx() || soc_is_dra7xx())
252 pm44xx_errata |= PM_OMAP4_CPU_OSWR_DISABLE;
253
215 return 0; 254 return 0;
216} 255}
217 256
@@ -239,10 +278,14 @@ int __init omap4_pm_init(void)
239 goto err2; 278 goto err2;
240 } 279 }
241 280
242 if (cpu_is_omap44xx()) { 281 if (cpu_is_omap44xx())
243 ret = omap4_init_static_deps(); 282 ret = omap4_init_static_deps();
244 if (ret) 283 else if (soc_is_omap54xx() || soc_is_dra7xx())
245 goto err2; 284 ret = omap5_dra7_init_static_deps();
285
286 if (ret) {
287 pr_err("Failed to initialise static dependencies.\n");
288 goto err2;
246 } 289 }
247 290
248 ret = omap4_mpuss_init(); 291 ret = omap4_mpuss_init();
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index faebd5f076af..7fb033eca0a5 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -546,7 +546,8 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
546 return -EINVAL; 546 return -EINVAL;
547 547
548 for (i = 0; i < PWRDM_MAX_CLKDMS && !ret; i++) 548 for (i = 0; i < PWRDM_MAX_CLKDMS && !ret; i++)
549 ret = (*fn)(pwrdm, pwrdm->pwrdm_clkdms[i]); 549 if (pwrdm->pwrdm_clkdms[i])
550 ret = (*fn)(pwrdm, pwrdm->pwrdm_clkdms[i]);
550 551
551 return ret; 552 return ret;
552} 553}
@@ -1080,6 +1081,82 @@ int pwrdm_post_transition(struct powerdomain *pwrdm)
1080} 1081}
1081 1082
1082/** 1083/**
1084 * pwrdm_get_valid_lp_state() - Find best match deep power state
1085 * @pwrdm: power domain for which we want to find best match
1086 * @is_logic_state: Are we looking for logic state match here? Should
1087 * be one of PWRDM_xxx macro values
1088 * @req_state: requested power state
1089 *
1090 * Returns: closest match for requested power state. default fallback
1091 * is RET for logic state and ON for power state.
1092 *
1093 * This does a search from the power domain data looking for the
1094 * closest valid power domain state that the hardware can achieve.
1095 * PRCM definitions for PWRSTCTRL allows us to program whatever
1096 * configuration we'd like, and PRCM will actually attempt such
1097 * a transition, however if the powerdomain does not actually support it,
1098 * we endup with a hung system. The valid power domain states are already
1099 * available in our powerdomain data files. So this function tries to do
1100 * the following:
1101 * a) find if we have an exact match to the request - no issues.
1102 * b) else find if a deeper power state is possible.
1103 * c) failing which, it tries to find closest higher power state for the
1104 * request.
1105 */
1106u8 pwrdm_get_valid_lp_state(struct powerdomain *pwrdm,
1107 bool is_logic_state, u8 req_state)
1108{
1109 u8 pwrdm_states = is_logic_state ? pwrdm->pwrsts_logic_ret :
1110 pwrdm->pwrsts;
1111 /* For logic, ret is highest and others, ON is highest */
1112 u8 default_pwrst = is_logic_state ? PWRDM_POWER_RET : PWRDM_POWER_ON;
1113 u8 new_pwrst;
1114 bool found;
1115
1116 /* If it is already supported, nothing to search */
1117 if (pwrdm_states & BIT(req_state))
1118 return req_state;
1119
1120 if (!req_state)
1121 goto up_search;
1122
1123 /*
1124 * So, we dont have a exact match
1125 * Can we get a deeper power state match?
1126 */
1127 new_pwrst = req_state - 1;
1128 found = true;
1129 while (!(pwrdm_states & BIT(new_pwrst))) {
1130 /* No match even at OFF? Not available */
1131 if (new_pwrst == PWRDM_POWER_OFF) {
1132 found = false;
1133 break;
1134 }
1135 new_pwrst--;
1136 }
1137
1138 if (found)
1139 goto done;
1140
1141up_search:
1142 /* OK, no deeper ones, can we get a higher match? */
1143 new_pwrst = req_state + 1;
1144 while (!(pwrdm_states & BIT(new_pwrst))) {
1145 if (new_pwrst > PWRDM_POWER_ON) {
1146 WARN(1, "powerdomain: %s: Fix max powerstate to ON\n",
1147 pwrdm->name);
1148 return PWRDM_POWER_ON;
1149 }
1150
1151 if (new_pwrst == default_pwrst)
1152 break;
1153 new_pwrst++;
1154 }
1155done:
1156 return new_pwrst;
1157}
1158
1159/**
1083 * omap_set_pwrdm_state - change a powerdomain's current power state 1160 * omap_set_pwrdm_state - change a powerdomain's current power state
1084 * @pwrdm: struct powerdomain * to change the power state of 1161 * @pwrdm: struct powerdomain * to change the power state of
1085 * @pwrst: power state to change to 1162 * @pwrst: power state to change to
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index f4727117f6cc..11bd4dd7d8d6 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -39,6 +39,7 @@
39#define PWRSTS_OFF_RET (PWRSTS_OFF | PWRSTS_RET) 39#define PWRSTS_OFF_RET (PWRSTS_OFF | PWRSTS_RET)
40#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) 40#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON)
41#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON) 41#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON)
42#define PWRSTS_INA_ON (PWRSTS_INACTIVE | PWRSTS_ON)
42 43
43 44
44/* 45/*
@@ -219,6 +220,9 @@ struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm);
219 220
220int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm); 221int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
221 222
223u8 pwrdm_get_valid_lp_state(struct powerdomain *pwrdm,
224 bool is_logic_state, u8 req_state);
225
222int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); 226int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
223int pwrdm_read_next_pwrst(struct powerdomain *pwrdm); 227int pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
224int pwrdm_read_pwrst(struct powerdomain *pwrdm); 228int pwrdm_read_pwrst(struct powerdomain *pwrdm);
diff --git a/arch/arm/mach-omap2/powerdomains54xx_data.c b/arch/arm/mach-omap2/powerdomains54xx_data.c
index ce1d752af991..60d7ed8ef8ca 100644
--- a/arch/arm/mach-omap2/powerdomains54xx_data.c
+++ b/arch/arm/mach-omap2/powerdomains54xx_data.c
@@ -35,7 +35,7 @@ static struct powerdomain core_54xx_pwrdm = {
35 .prcm_offs = OMAP54XX_PRM_CORE_INST, 35 .prcm_offs = OMAP54XX_PRM_CORE_INST,
36 .prcm_partition = OMAP54XX_PRM_PARTITION, 36 .prcm_partition = OMAP54XX_PRM_PARTITION,
37 .pwrsts = PWRSTS_RET_ON, 37 .pwrsts = PWRSTS_RET_ON,
38 .pwrsts_logic_ret = PWRSTS_OFF_RET, 38 .pwrsts_logic_ret = PWRSTS_RET,
39 .banks = 5, 39 .banks = 5,
40 .pwrsts_mem_ret = { 40 .pwrsts_mem_ret = {
41 [0] = PWRSTS_OFF_RET, /* core_nret_bank */ 41 [0] = PWRSTS_OFF_RET, /* core_nret_bank */
@@ -107,8 +107,8 @@ static struct powerdomain cpu0_54xx_pwrdm = {
107 .voltdm = { .name = "mpu" }, 107 .voltdm = { .name = "mpu" },
108 .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C0_INST, 108 .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C0_INST,
109 .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION, 109 .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION,
110 .pwrsts = PWRSTS_OFF_RET_ON, 110 .pwrsts = PWRSTS_RET_ON,
111 .pwrsts_logic_ret = PWRSTS_OFF_RET, 111 .pwrsts_logic_ret = PWRSTS_RET,
112 .banks = 1, 112 .banks = 1,
113 .pwrsts_mem_ret = { 113 .pwrsts_mem_ret = {
114 [0] = PWRSTS_OFF_RET, /* cpu0_l1 */ 114 [0] = PWRSTS_OFF_RET, /* cpu0_l1 */
@@ -124,8 +124,8 @@ static struct powerdomain cpu1_54xx_pwrdm = {
124 .voltdm = { .name = "mpu" }, 124 .voltdm = { .name = "mpu" },
125 .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C1_INST, 125 .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C1_INST,
126 .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION, 126 .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION,
127 .pwrsts = PWRSTS_OFF_RET_ON, 127 .pwrsts = PWRSTS_RET_ON,
128 .pwrsts_logic_ret = PWRSTS_OFF_RET, 128 .pwrsts_logic_ret = PWRSTS_RET,
129 .banks = 1, 129 .banks = 1,
130 .pwrsts_mem_ret = { 130 .pwrsts_mem_ret = {
131 [0] = PWRSTS_OFF_RET, /* cpu1_l1 */ 131 [0] = PWRSTS_OFF_RET, /* cpu1_l1 */
@@ -158,7 +158,7 @@ static struct powerdomain mpu_54xx_pwrdm = {
158 .prcm_offs = OMAP54XX_PRM_MPU_INST, 158 .prcm_offs = OMAP54XX_PRM_MPU_INST,
159 .prcm_partition = OMAP54XX_PRM_PARTITION, 159 .prcm_partition = OMAP54XX_PRM_PARTITION,
160 .pwrsts = PWRSTS_RET_ON, 160 .pwrsts = PWRSTS_RET_ON,
161 .pwrsts_logic_ret = PWRSTS_OFF_RET, 161 .pwrsts_logic_ret = PWRSTS_RET,
162 .banks = 2, 162 .banks = 2,
163 .pwrsts_mem_ret = { 163 .pwrsts_mem_ret = {
164 [0] = PWRSTS_OFF_RET, /* mpu_l2 */ 164 [0] = PWRSTS_OFF_RET, /* mpu_l2 */
diff --git a/arch/arm/mach-omap2/powerdomains7xx_data.c b/arch/arm/mach-omap2/powerdomains7xx_data.c
index 48151d1cfde0..287a2037aa16 100644
--- a/arch/arm/mach-omap2/powerdomains7xx_data.c
+++ b/arch/arm/mach-omap2/powerdomains7xx_data.c
@@ -160,8 +160,8 @@ static struct powerdomain core_7xx_pwrdm = {
160 .name = "core_pwrdm", 160 .name = "core_pwrdm",
161 .prcm_offs = DRA7XX_PRM_CORE_INST, 161 .prcm_offs = DRA7XX_PRM_CORE_INST,
162 .prcm_partition = DRA7XX_PRM_PARTITION, 162 .prcm_partition = DRA7XX_PRM_PARTITION,
163 .pwrsts = PWRSTS_RET_ON, 163 .pwrsts = PWRSTS_INA_ON,
164 .pwrsts_logic_ret = PWRSTS_OFF_RET, 164 .pwrsts_logic_ret = PWRSTS_RET,
165 .banks = 5, 165 .banks = 5,
166 .pwrsts_mem_ret = { 166 .pwrsts_mem_ret = {
167 [0] = PWRSTS_OFF_RET, /* core_nret_bank */ 167 [0] = PWRSTS_OFF_RET, /* core_nret_bank */
@@ -193,8 +193,8 @@ static struct powerdomain cpu0_7xx_pwrdm = {
193 .name = "cpu0_pwrdm", 193 .name = "cpu0_pwrdm",
194 .prcm_offs = DRA7XX_MPU_PRCM_PRM_C0_INST, 194 .prcm_offs = DRA7XX_MPU_PRCM_PRM_C0_INST,
195 .prcm_partition = DRA7XX_MPU_PRCM_PARTITION, 195 .prcm_partition = DRA7XX_MPU_PRCM_PARTITION,
196 .pwrsts = PWRSTS_OFF_RET_ON, 196 .pwrsts = PWRSTS_RET_ON,
197 .pwrsts_logic_ret = PWRSTS_OFF_RET, 197 .pwrsts_logic_ret = PWRSTS_RET,
198 .banks = 1, 198 .banks = 1,
199 .pwrsts_mem_ret = { 199 .pwrsts_mem_ret = {
200 [0] = PWRSTS_OFF_RET, /* cpu0_l1 */ 200 [0] = PWRSTS_OFF_RET, /* cpu0_l1 */
@@ -209,8 +209,8 @@ static struct powerdomain cpu1_7xx_pwrdm = {
209 .name = "cpu1_pwrdm", 209 .name = "cpu1_pwrdm",
210 .prcm_offs = DRA7XX_MPU_PRCM_PRM_C1_INST, 210 .prcm_offs = DRA7XX_MPU_PRCM_PRM_C1_INST,
211 .prcm_partition = DRA7XX_MPU_PRCM_PARTITION, 211 .prcm_partition = DRA7XX_MPU_PRCM_PARTITION,
212 .pwrsts = PWRSTS_OFF_RET_ON, 212 .pwrsts = PWRSTS_RET_ON,
213 .pwrsts_logic_ret = PWRSTS_OFF_RET, 213 .pwrsts_logic_ret = PWRSTS_RET,
214 .banks = 1, 214 .banks = 1,
215 .pwrsts_mem_ret = { 215 .pwrsts_mem_ret = {
216 [0] = PWRSTS_OFF_RET, /* cpu1_l1 */ 216 [0] = PWRSTS_OFF_RET, /* cpu1_l1 */
@@ -243,7 +243,7 @@ static struct powerdomain mpu_7xx_pwrdm = {
243 .prcm_offs = DRA7XX_PRM_MPU_INST, 243 .prcm_offs = DRA7XX_PRM_MPU_INST,
244 .prcm_partition = DRA7XX_PRM_PARTITION, 244 .prcm_partition = DRA7XX_PRM_PARTITION,
245 .pwrsts = PWRSTS_RET_ON, 245 .pwrsts = PWRSTS_RET_ON,
246 .pwrsts_logic_ret = PWRSTS_OFF_RET, 246 .pwrsts_logic_ret = PWRSTS_RET,
247 .banks = 2, 247 .banks = 2,
248 .pwrsts_mem_ret = { 248 .pwrsts_mem_ret = {
249 [0] = PWRSTS_OFF_RET, /* mpu_l2 */ 249 [0] = PWRSTS_OFF_RET, /* mpu_l2 */
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index 2458be6fc67b..ff08da385a2d 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -17,6 +17,7 @@
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/of_irq.h>
20 21
21#include "soc.h" 22#include "soc.h"
22#include "common.h" 23#include "common.h"
@@ -45,7 +46,7 @@ static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
45 .ocp_barrier = &omap3xxx_prm_ocp_barrier, 46 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
46 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, 47 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
47 .restore_irqen = &omap3xxx_prm_restore_irqen, 48 .restore_irqen = &omap3xxx_prm_restore_irqen,
48 .reconfigure_io_chain = &omap3xxx_prm_reconfigure_io_chain, 49 .reconfigure_io_chain = NULL,
49}; 50};
50 51
51/* 52/*
@@ -369,15 +370,30 @@ void __init omap3_prm_init_pm(bool has_uart4, bool has_iva)
369} 370}
370 371
371/** 372/**
372 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain 373 * omap3430_pre_es3_1_reconfigure_io_chain - restart wake-up daisy chain
374 *
375 * The ST_IO_CHAIN bit does not exist in 3430 before es3.1. The only
376 * thing we can do is toggle EN_IO bit for earlier omaps.
377 */
378void omap3430_pre_es3_1_reconfigure_io_chain(void)
379{
380 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
381 PM_WKEN);
382 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
383 PM_WKEN);
384 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
385}
386
387/**
388 * omap3_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
373 * 389 *
374 * Clear any previously-latched I/O wakeup events and ensure that the 390 * Clear any previously-latched I/O wakeup events and ensure that the
375 * I/O wakeup gates are aligned with the current mux settings. Works 391 * I/O wakeup gates are aligned with the current mux settings. Works
376 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then 392 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
377 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No 393 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
378 * return value. 394 * return value. These registers are only available in 3430 es3.1 and later.
379 */ 395 */
380void omap3xxx_prm_reconfigure_io_chain(void) 396void omap3_prm_reconfigure_io_chain(void)
381{ 397{
382 int i = 0; 398 int i = 0;
383 399
@@ -400,6 +416,15 @@ void omap3xxx_prm_reconfigure_io_chain(void)
400} 416}
401 417
402/** 418/**
419 * omap3xxx_prm_reconfigure_io_chain - reconfigure I/O chain
420 */
421void omap3xxx_prm_reconfigure_io_chain(void)
422{
423 if (omap3_prcm_irq_setup.reconfigure_io_chain)
424 omap3_prcm_irq_setup.reconfigure_io_chain();
425}
426
427/**
403 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches 428 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
404 * 429 *
405 * Activates the I/O wakeup event latches and allows events logged by 430 * Activates the I/O wakeup event latches and allows events logged by
@@ -649,6 +674,11 @@ int __init omap3xxx_prm_init(void)
649 return prm_register(&omap3xxx_prm_ll_data); 674 return prm_register(&omap3xxx_prm_ll_data);
650} 675}
651 676
677static struct of_device_id omap3_prm_dt_match_table[] = {
678 { .compatible = "ti,omap3-prm" },
679 { }
680};
681
652static int omap3xxx_prm_late_init(void) 682static int omap3xxx_prm_late_init(void)
653{ 683{
654 int ret; 684 int ret;
@@ -656,6 +686,25 @@ static int omap3xxx_prm_late_init(void)
656 if (!(prm_features & PRM_HAS_IO_WAKEUP)) 686 if (!(prm_features & PRM_HAS_IO_WAKEUP))
657 return 0; 687 return 0;
658 688
689 if (omap3_has_io_chain_ctrl())
690 omap3_prcm_irq_setup.reconfigure_io_chain =
691 omap3_prm_reconfigure_io_chain;
692 else
693 omap3_prcm_irq_setup.reconfigure_io_chain =
694 omap3430_pre_es3_1_reconfigure_io_chain;
695
696 if (of_have_populated_dt()) {
697 struct device_node *np;
698 int irq_num;
699
700 np = of_find_matching_node(NULL, omap3_prm_dt_match_table);
701 if (np) {
702 irq_num = of_irq_get(np, 0);
703 if (irq_num >= 0)
704 omap3_prcm_irq_setup.irq = irq_num;
705 }
706 }
707
659 omap3xxx_prm_enable_io_wakeup(); 708 omap3xxx_prm_enable_io_wakeup();
660 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); 709 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup);
661 if (!ret) 710 if (!ret)
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index a7f6ea27180a..0958d070d3db 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -17,6 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/of_irq.h>
20 21
21 22
22#include "soc.h" 23#include "soc.h"
@@ -32,7 +33,6 @@
32/* Static data */ 33/* Static data */
33 34
34static const struct omap_prcm_irq omap4_prcm_irqs[] = { 35static const struct omap_prcm_irq omap4_prcm_irqs[] = {
35 OMAP_PRCM_IRQ("wkup", 0, 0),
36 OMAP_PRCM_IRQ("io", 9, 1), 36 OMAP_PRCM_IRQ("io", 9, 1),
37}; 37};
38 38
@@ -154,21 +154,36 @@ void omap4_prm_vp_clear_txdone(u8 vp_id)
154 154
155u32 omap4_prm_vcvp_read(u8 offset) 155u32 omap4_prm_vcvp_read(u8 offset)
156{ 156{
157 s32 inst = omap4_prmst_get_prm_dev_inst();
158
159 if (inst == PRM_INSTANCE_UNKNOWN)
160 return 0;
161
157 return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, 162 return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
158 OMAP4430_PRM_DEVICE_INST, offset); 163 inst, offset);
159} 164}
160 165
161void omap4_prm_vcvp_write(u32 val, u8 offset) 166void omap4_prm_vcvp_write(u32 val, u8 offset)
162{ 167{
168 s32 inst = omap4_prmst_get_prm_dev_inst();
169
170 if (inst == PRM_INSTANCE_UNKNOWN)
171 return;
172
163 omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, 173 omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION,
164 OMAP4430_PRM_DEVICE_INST, offset); 174 inst, offset);
165} 175}
166 176
167u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset) 177u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
168{ 178{
179 s32 inst = omap4_prmst_get_prm_dev_inst();
180
181 if (inst == PRM_INSTANCE_UNKNOWN)
182 return 0;
183
169 return omap4_prminst_rmw_inst_reg_bits(mask, bits, 184 return omap4_prminst_rmw_inst_reg_bits(mask, bits,
170 OMAP4430_PRM_PARTITION, 185 OMAP4430_PRM_PARTITION,
171 OMAP4430_PRM_DEVICE_INST, 186 inst,
172 offset); 187 offset);
173} 188}
174 189
@@ -275,14 +290,18 @@ void omap44xx_prm_restore_irqen(u32 *saved_mask)
275void omap44xx_prm_reconfigure_io_chain(void) 290void omap44xx_prm_reconfigure_io_chain(void)
276{ 291{
277 int i = 0; 292 int i = 0;
293 s32 inst = omap4_prmst_get_prm_dev_inst();
294
295 if (inst == PRM_INSTANCE_UNKNOWN)
296 return;
278 297
279 /* Trigger WUCLKIN enable */ 298 /* Trigger WUCLKIN enable */
280 omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 299 omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK,
281 OMAP4430_WUCLK_CTRL_MASK, 300 OMAP4430_WUCLK_CTRL_MASK,
282 OMAP4430_PRM_DEVICE_INST, 301 inst,
283 OMAP4_PRM_IO_PMCTRL_OFFSET); 302 OMAP4_PRM_IO_PMCTRL_OFFSET);
284 omap_test_timeout( 303 omap_test_timeout(
285 (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, 304 (((omap4_prm_read_inst_reg(inst,
286 OMAP4_PRM_IO_PMCTRL_OFFSET) & 305 OMAP4_PRM_IO_PMCTRL_OFFSET) &
287 OMAP4430_WUCLK_STATUS_MASK) >> 306 OMAP4430_WUCLK_STATUS_MASK) >>
288 OMAP4430_WUCLK_STATUS_SHIFT) == 1), 307 OMAP4430_WUCLK_STATUS_SHIFT) == 1),
@@ -292,10 +311,10 @@ void omap44xx_prm_reconfigure_io_chain(void)
292 311
293 /* Trigger WUCLKIN disable */ 312 /* Trigger WUCLKIN disable */
294 omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0, 313 omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
295 OMAP4430_PRM_DEVICE_INST, 314 inst,
296 OMAP4_PRM_IO_PMCTRL_OFFSET); 315 OMAP4_PRM_IO_PMCTRL_OFFSET);
297 omap_test_timeout( 316 omap_test_timeout(
298 (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, 317 (((omap4_prm_read_inst_reg(inst,
299 OMAP4_PRM_IO_PMCTRL_OFFSET) & 318 OMAP4_PRM_IO_PMCTRL_OFFSET) &
300 OMAP4430_WUCLK_STATUS_MASK) >> 319 OMAP4430_WUCLK_STATUS_MASK) >>
301 OMAP4430_WUCLK_STATUS_SHIFT) == 0), 320 OMAP4430_WUCLK_STATUS_SHIFT) == 0),
@@ -316,9 +335,14 @@ void omap44xx_prm_reconfigure_io_chain(void)
316 */ 335 */
317static void __init omap44xx_prm_enable_io_wakeup(void) 336static void __init omap44xx_prm_enable_io_wakeup(void)
318{ 337{
338 s32 inst = omap4_prmst_get_prm_dev_inst();
339
340 if (inst == PRM_INSTANCE_UNKNOWN)
341 return;
342
319 omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK, 343 omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
320 OMAP4430_GLOBAL_WUEN_MASK, 344 OMAP4430_GLOBAL_WUEN_MASK,
321 OMAP4430_PRM_DEVICE_INST, 345 inst,
322 OMAP4_PRM_IO_PMCTRL_OFFSET); 346 OMAP4_PRM_IO_PMCTRL_OFFSET);
323} 347}
324 348
@@ -333,8 +357,13 @@ static u32 omap44xx_prm_read_reset_sources(void)
333 struct prm_reset_src_map *p; 357 struct prm_reset_src_map *p;
334 u32 r = 0; 358 u32 r = 0;
335 u32 v; 359 u32 v;
360 s32 inst = omap4_prmst_get_prm_dev_inst();
336 361
337 v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, 362 if (inst == PRM_INSTANCE_UNKNOWN)
363 return 0;
364
365
366 v = omap4_prm_read_inst_reg(inst,
338 OMAP4_RM_RSTST); 367 OMAP4_RM_RSTST);
339 368
340 p = omap44xx_prm_reset_src_map; 369 p = omap44xx_prm_reset_src_map;
@@ -664,17 +693,56 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
664 693
665int __init omap44xx_prm_init(void) 694int __init omap44xx_prm_init(void)
666{ 695{
667 if (cpu_is_omap44xx()) 696 if (cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx())
668 prm_features |= PRM_HAS_IO_WAKEUP; 697 prm_features |= PRM_HAS_IO_WAKEUP;
669 698
670 return prm_register(&omap44xx_prm_ll_data); 699 return prm_register(&omap44xx_prm_ll_data);
671} 700}
672 701
702static struct of_device_id omap_prm_dt_match_table[] = {
703 { .compatible = "ti,omap4-prm" },
704 { .compatible = "ti,omap5-prm" },
705 { .compatible = "ti,dra7-prm" },
706 { }
707};
708
673static int omap44xx_prm_late_init(void) 709static int omap44xx_prm_late_init(void)
674{ 710{
711 struct device_node *np;
712 int irq_num;
713
675 if (!(prm_features & PRM_HAS_IO_WAKEUP)) 714 if (!(prm_features & PRM_HAS_IO_WAKEUP))
676 return 0; 715 return 0;
677 716
717 /* OMAP4+ is DT only now */
718 if (!of_have_populated_dt())
719 return 0;
720
721 np = of_find_matching_node(NULL, omap_prm_dt_match_table);
722
723 if (!np) {
724 /* Default loaded up with OMAP4 values */
725 if (!cpu_is_omap44xx())
726 return 0;
727 } else {
728 irq_num = of_irq_get(np, 0);
729 /*
730 * Already have OMAP4 IRQ num. For all other platforms, we need
731 * IRQ numbers from DT
732 */
733 if (irq_num < 0 && !cpu_is_omap44xx()) {
734 if (irq_num == -EPROBE_DEFER)
735 return irq_num;
736
737 /* Have nothing to do */
738 return 0;
739 }
740
741 /* Once OMAP4 DT is filled as well */
742 if (irq_num >= 0)
743 omap4_prcm_irq_setup.irq = irq_num;
744 }
745
678 omap44xx_prm_enable_io_wakeup(); 746 omap44xx_prm_enable_io_wakeup();
679 747
680 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); 748 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 76ca320f007c..74054b813600 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -467,7 +467,7 @@ int prm_unregister(struct prm_ll_data *pld)
467 return 0; 467 return 0;
468} 468}
469 469
470static struct of_device_id omap_prcm_dt_match_table[] = { 470static const struct of_device_id omap_prcm_dt_match_table[] = {
471 { .compatible = "ti,am3-prcm" }, 471 { .compatible = "ti,am3-prcm" },
472 { .compatible = "ti,am3-scrm" }, 472 { .compatible = "ti,am3-scrm" },
473 { .compatible = "ti,am4-prcm" }, 473 { .compatible = "ti,am4-prcm" },
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 69f0dd08629c..225e0258d76d 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -31,6 +31,8 @@
31 31
32static void __iomem *_prm_bases[OMAP4_MAX_PRCM_PARTITIONS]; 32static void __iomem *_prm_bases[OMAP4_MAX_PRCM_PARTITIONS];
33 33
34static s32 prm_dev_inst = PRM_INSTANCE_UNKNOWN;
35
34/** 36/**
35 * omap_prm_base_init - Populates the prm partitions 37 * omap_prm_base_init - Populates the prm partitions
36 * 38 *
@@ -43,6 +45,24 @@ void omap_prm_base_init(void)
43 _prm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base; 45 _prm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base;
44} 46}
45 47
48s32 omap4_prmst_get_prm_dev_inst(void)
49{
50 if (prm_dev_inst != PRM_INSTANCE_UNKNOWN)
51 return prm_dev_inst;
52
53 /* This cannot be done way early at boot.. as things are not setup */
54 if (cpu_is_omap44xx())
55 prm_dev_inst = OMAP4430_PRM_DEVICE_INST;
56 else if (soc_is_omap54xx())
57 prm_dev_inst = OMAP54XX_PRM_DEVICE_INST;
58 else if (soc_is_dra7xx())
59 prm_dev_inst = DRA7XX_PRM_DEVICE_INST;
60 else if (soc_is_am43xx())
61 prm_dev_inst = AM43XX_PRM_DEVICE_INST;
62
63 return prm_dev_inst;
64}
65
46/* Read a register in a PRM instance */ 66/* Read a register in a PRM instance */
47u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) 67u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
48{ 68{
@@ -169,28 +189,18 @@ int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
169void omap4_prminst_global_warm_sw_reset(void) 189void omap4_prminst_global_warm_sw_reset(void)
170{ 190{
171 u32 v; 191 u32 v;
172 s16 dev_inst; 192 s32 inst = omap4_prmst_get_prm_dev_inst();
173 193
174 if (cpu_is_omap44xx()) 194 if (inst == PRM_INSTANCE_UNKNOWN)
175 dev_inst = OMAP4430_PRM_DEVICE_INST;
176 else if (soc_is_omap54xx())
177 dev_inst = OMAP54XX_PRM_DEVICE_INST;
178 else if (soc_is_dra7xx())
179 dev_inst = DRA7XX_PRM_DEVICE_INST;
180 else if (soc_is_am43xx())
181 dev_inst = AM43XX_PRM_DEVICE_INST;
182 else
183 return; 195 return;
184 196
185 v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, dev_inst, 197 v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, inst,
186 OMAP4_PRM_RSTCTRL_OFFSET); 198 OMAP4_PRM_RSTCTRL_OFFSET);
187 v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK; 199 v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK;
188 omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION, 200 omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION,
189 dev_inst, 201 inst, OMAP4_PRM_RSTCTRL_OFFSET);
190 OMAP4_PRM_RSTCTRL_OFFSET);
191 202
192 /* OCP barrier */ 203 /* OCP barrier */
193 v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, 204 v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
194 dev_inst, 205 inst, OMAP4_PRM_RSTCTRL_OFFSET);
195 OMAP4_PRM_RSTCTRL_OFFSET);
196} 206}
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index a2ede2d65481..583aa3774571 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -12,6 +12,9 @@
12#ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H 12#ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
13#define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H 13#define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H
14 14
15#define PRM_INSTANCE_UNKNOWN -1
16extern s32 omap4_prmst_get_prm_dev_inst(void);
17
15/* 18/*
16 * In an ideal world, we would not export these low-level functions, 19 * In an ideal world, we would not export these low-level functions,
17 * but this will probably take some time to fix properly 20 * but this will probably take some time to fix properly
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index 7a42e1960c3b..d3a588cf3a6e 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -20,8 +20,8 @@ static int sr_class3_enable(struct omap_sr *sr)
20 unsigned long volt = voltdm_get_voltage(sr->voltdm); 20 unsigned long volt = voltdm_get_voltage(sr->voltdm);
21 21
22 if (!volt) { 22 if (!volt) {
23 pr_warning("%s: Curr voltage unknown. Cannot enable %s\n", 23 pr_warn("%s: Curr voltage unknown. Cannot enable %s\n",
24 __func__, sr->name); 24 __func__, sr->name);
25 return -ENODATA; 25 return -ENODATA;
26 } 26 }
27 27
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index 01ca8086fb6c..4376f59626d1 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -245,6 +245,8 @@ IS_AM_SUBCLASS(437x, 0x437)
245#define soc_is_omap54xx() 0 245#define soc_is_omap54xx() 0
246#define soc_is_omap543x() 0 246#define soc_is_omap543x() 0
247#define soc_is_dra7xx() 0 247#define soc_is_dra7xx() 0
248#define soc_is_dra74x() 0
249#define soc_is_dra72x() 0
248 250
249#if defined(MULTI_OMAP2) 251#if defined(MULTI_OMAP2)
250# if defined(CONFIG_ARCH_OMAP2) 252# if defined(CONFIG_ARCH_OMAP2)
@@ -393,7 +395,11 @@ IS_OMAP_TYPE(3430, 0x3430)
393 395
394#if defined(CONFIG_SOC_DRA7XX) 396#if defined(CONFIG_SOC_DRA7XX)
395#undef soc_is_dra7xx 397#undef soc_is_dra7xx
398#undef soc_is_dra74x
399#undef soc_is_dra72x
396#define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7")) 400#define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7"))
401#define soc_is_dra74x() (of_machine_is_compatible("ti,dra74"))
402#define soc_is_dra72x() (of_machine_is_compatible("ti,dra72"))
397#endif 403#endif
398 404
399/* Various silicon revisions for omap2 */ 405/* Various silicon revisions for omap2 */
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 1b91ef0c182a..d7cff2632d1e 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -154,7 +154,7 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
154 154
155 pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data)); 155 pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data));
156 if (IS_ERR(pdev)) 156 if (IS_ERR(pdev))
157 pr_warning("%s: Could not build omap_device for %s: %s.\n\n", 157 pr_warn("%s: Could not build omap_device for %s: %s\n",
158 __func__, name, oh->name); 158 __func__, name, oh->name);
159exit: 159exit:
160 i++; 160 i++;
diff --git a/arch/arm/mach-omap2/sram.c b/arch/arm/mach-omap2/sram.c
index ddf1818af228..cd488b80ba36 100644
--- a/arch/arm/mach-omap2/sram.c
+++ b/arch/arm/mach-omap2/sram.c
@@ -32,12 +32,6 @@
32 32
33#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800) 33#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800)
34#define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000) 34#define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000)
35#ifdef CONFIG_OMAP4_ERRATA_I688
36#define OMAP4_SRAM_PUB_PA OMAP4_SRAM_PA
37#else
38#define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000)
39#endif
40#define OMAP5_SRAM_PA 0x40300000
41 35
42#define SRAM_BOOTLOADER_SZ 0x00 36#define SRAM_BOOTLOADER_SZ 0x00
43 37
@@ -105,32 +99,14 @@ static void __init omap_detect_sram(void)
105 } else { 99 } else {
106 omap_sram_size = 0x8000; /* 32K */ 100 omap_sram_size = 0x8000; /* 32K */
107 } 101 }
108 } else if (cpu_is_omap44xx()) {
109 omap_sram_start = OMAP4_SRAM_PUB_PA;
110 omap_sram_size = 0xa000; /* 40K */
111 } else if (soc_is_omap54xx()) {
112 omap_sram_start = OMAP5_SRAM_PA;
113 omap_sram_size = SZ_128K; /* 128KB */
114 } else { 102 } else {
115 omap_sram_start = OMAP2_SRAM_PUB_PA; 103 omap_sram_start = OMAP2_SRAM_PUB_PA;
116 omap_sram_size = 0x800; /* 2K */ 104 omap_sram_size = 0x800; /* 2K */
117 } 105 }
118 } else { 106 } else {
119 if (soc_is_am33xx()) { 107 if (cpu_is_omap34xx()) {
120 omap_sram_start = AM33XX_SRAM_PA;
121 omap_sram_size = 0x10000; /* 64K */
122 } else if (soc_is_am43xx()) {
123 omap_sram_start = AM33XX_SRAM_PA;
124 omap_sram_size = SZ_256K;
125 } else if (cpu_is_omap34xx()) {
126 omap_sram_start = OMAP3_SRAM_PA; 108 omap_sram_start = OMAP3_SRAM_PA;
127 omap_sram_size = 0x10000; /* 64K */ 109 omap_sram_size = 0x10000; /* 64K */
128 } else if (cpu_is_omap44xx()) {
129 omap_sram_start = OMAP4_SRAM_PA;
130 omap_sram_size = 0xe000; /* 56K */
131 } else if (soc_is_omap54xx()) {
132 omap_sram_start = OMAP5_SRAM_PA;
133 omap_sram_size = SZ_128K; /* 128KB */
134 } else { 110 } else {
135 omap_sram_start = OMAP2_SRAM_PA; 111 omap_sram_start = OMAP2_SRAM_PA;
136 if (cpu_is_omap242x()) 112 if (cpu_is_omap242x())
@@ -148,12 +124,6 @@ static void __init omap2_map_sram(void)
148{ 124{
149 int cached = 1; 125 int cached = 1;
150 126
151#ifdef CONFIG_OMAP4_ERRATA_I688
152 if (cpu_is_omap44xx()) {
153 omap_sram_start += PAGE_SIZE;
154 omap_sram_size -= SZ_16K;
155 }
156#endif
157 if (cpu_is_omap34xx()) { 127 if (cpu_is_omap34xx()) {
158 /* 128 /*
159 * SRAM must be marked as non-cached on OMAP3 since the 129 * SRAM must be marked as non-cached on OMAP3 since the
@@ -285,11 +255,6 @@ static inline int omap34xx_sram_init(void)
285} 255}
286#endif /* CONFIG_ARCH_OMAP3 */ 256#endif /* CONFIG_ARCH_OMAP3 */
287 257
288static inline int am33xx_sram_init(void)
289{
290 return 0;
291}
292
293int __init omap_sram_init(void) 258int __init omap_sram_init(void)
294{ 259{
295 omap_detect_sram(); 260 omap_detect_sram();
@@ -299,8 +264,6 @@ int __init omap_sram_init(void)
299 omap242x_sram_init(); 264 omap242x_sram_init();
300 else if (cpu_is_omap2430()) 265 else if (cpu_is_omap2430())
301 omap243x_sram_init(); 266 omap243x_sram_init();
302 else if (soc_is_am33xx())
303 am33xx_sram_init();
304 else if (cpu_is_omap34xx()) 267 else if (cpu_is_omap34xx())
305 omap34xx_sram_init(); 268 omap34xx_sram_init();
306 269
diff --git a/arch/arm/mach-omap2/sram.h b/arch/arm/mach-omap2/sram.h
index ca7277c2a9ee..948d3edefc38 100644
--- a/arch/arm/mach-omap2/sram.h
+++ b/arch/arm/mach-omap2/sram.h
@@ -74,10 +74,3 @@ static inline void omap_push_sram_idle(void) {}
74 */ 74 */
75#define OMAP2_SRAM_PA 0x40200000 75#define OMAP2_SRAM_PA 0x40200000
76#define OMAP3_SRAM_PA 0x40200000 76#define OMAP3_SRAM_PA 0x40200000
77#ifdef CONFIG_OMAP4_ERRATA_I688
78#define OMAP4_SRAM_PA 0x40304000
79#define OMAP4_SRAM_VA 0xfe404000
80#else
81#define OMAP4_SRAM_PA 0x40300000
82#endif
83#define AM33XX_SRAM_PA 0x40300000
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 43d03fbf4c0b..4f61148ec168 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -141,7 +141,7 @@ static struct property device_disabled = {
141 .value = "disabled", 141 .value = "disabled",
142}; 142};
143 143
144static struct of_device_id omap_timer_match[] __initdata = { 144static const struct of_device_id omap_timer_match[] __initconst = {
145 { .compatible = "ti,omap2420-timer", }, 145 { .compatible = "ti,omap2420-timer", },
146 { .compatible = "ti,omap3430-timer", }, 146 { .compatible = "ti,omap3430-timer", },
147 { .compatible = "ti,omap4430-timer", }, 147 { .compatible = "ti,omap4430-timer", },
@@ -162,7 +162,7 @@ static struct of_device_id omap_timer_match[] __initdata = {
162 * the timer node in device-tree as disabled, to prevent the kernel from 162 * the timer node in device-tree as disabled, to prevent the kernel from
163 * registering this timer as a platform device and so no one else can use it. 163 * registering this timer as a platform device and so no one else can use it.
164 */ 164 */
165static struct device_node * __init omap_get_timer_dt(struct of_device_id *match, 165static struct device_node * __init omap_get_timer_dt(const struct of_device_id *match,
166 const char *property) 166 const char *property)
167{ 167{
168 struct device_node *np; 168 struct device_node *np;
@@ -388,7 +388,7 @@ static u64 notrace dmtimer_read_sched_clock(void)
388 return 0; 388 return 0;
389} 389}
390 390
391static struct of_device_id omap_counter_match[] __initdata = { 391static const struct of_device_id omap_counter_match[] __initconst = {
392 { .compatible = "ti,omap-counter32k", }, 392 { .compatible = "ti,omap-counter32k", },
393 { } 393 { }
394}; 394};
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index a4628a9e760c..be9ef834fa81 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -198,7 +198,7 @@ int omap_vc_bypass_scale(struct voltagedomain *voltdm,
198 loop_cnt++; 198 loop_cnt++;
199 199
200 if (retries_cnt > 10) { 200 if (retries_cnt > 10) {
201 pr_warning("%s: Retry count exceeded\n", __func__); 201 pr_warn("%s: Retry count exceeded\n", __func__);
202 return -ETIMEDOUT; 202 return -ETIMEDOUT;
203 } 203 }
204 204
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 3ac8fe1d8213..3783b8625f0f 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -55,7 +55,7 @@ static LIST_HEAD(voltdm_list);
55unsigned long voltdm_get_voltage(struct voltagedomain *voltdm) 55unsigned long voltdm_get_voltage(struct voltagedomain *voltdm)
56{ 56{
57 if (!voltdm || IS_ERR(voltdm)) { 57 if (!voltdm || IS_ERR(voltdm)) {
58 pr_warning("%s: VDD specified does not exist!\n", __func__); 58 pr_warn("%s: VDD specified does not exist!\n", __func__);
59 return 0; 59 return 0;
60 } 60 }
61 61
@@ -77,7 +77,7 @@ int voltdm_scale(struct voltagedomain *voltdm,
77 unsigned long volt = 0; 77 unsigned long volt = 0;
78 78
79 if (!voltdm || IS_ERR(voltdm)) { 79 if (!voltdm || IS_ERR(voltdm)) {
80 pr_warning("%s: VDD specified does not exist!\n", __func__); 80 pr_warn("%s: VDD specified does not exist!\n", __func__);
81 return -EINVAL; 81 return -EINVAL;
82 } 82 }
83 83
@@ -96,8 +96,8 @@ int voltdm_scale(struct voltagedomain *voltdm,
96 } 96 }
97 97
98 if (!volt) { 98 if (!volt) {
99 pr_warning("%s: not scaling. OPP voltage for %lu, not found.\n", 99 pr_warn("%s: not scaling. OPP voltage for %lu, not found.\n",
100 __func__, target_volt); 100 __func__, target_volt);
101 return -EINVAL; 101 return -EINVAL;
102 } 102 }
103 103
@@ -122,7 +122,7 @@ void voltdm_reset(struct voltagedomain *voltdm)
122 unsigned long target_volt; 122 unsigned long target_volt;
123 123
124 if (!voltdm || IS_ERR(voltdm)) { 124 if (!voltdm || IS_ERR(voltdm)) {
125 pr_warning("%s: VDD specified does not exist!\n", __func__); 125 pr_warn("%s: VDD specified does not exist!\n", __func__);
126 return; 126 return;
127 } 127 }
128 128
@@ -152,7 +152,7 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
152 struct omap_volt_data **volt_data) 152 struct omap_volt_data **volt_data)
153{ 153{
154 if (!voltdm || IS_ERR(voltdm)) { 154 if (!voltdm || IS_ERR(voltdm)) {
155 pr_warning("%s: VDD specified does not exist!\n", __func__); 155 pr_warn("%s: VDD specified does not exist!\n", __func__);
156 return; 156 return;
157 } 157 }
158 158
@@ -180,12 +180,12 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
180 int i; 180 int i;
181 181
182 if (!voltdm || IS_ERR(voltdm)) { 182 if (!voltdm || IS_ERR(voltdm)) {
183 pr_warning("%s: VDD specified does not exist!\n", __func__); 183 pr_warn("%s: VDD specified does not exist!\n", __func__);
184 return ERR_PTR(-EINVAL); 184 return ERR_PTR(-EINVAL);
185 } 185 }
186 186
187 if (!voltdm->volt_data) { 187 if (!voltdm->volt_data) {
188 pr_warning("%s: voltage table does not exist for vdd_%s\n", 188 pr_warn("%s: voltage table does not exist for vdd_%s\n",
189 __func__, voltdm->name); 189 __func__, voltdm->name);
190 return ERR_PTR(-ENODATA); 190 return ERR_PTR(-ENODATA);
191 } 191 }
@@ -214,7 +214,7 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
214 struct omap_voltdm_pmic *pmic) 214 struct omap_voltdm_pmic *pmic)
215{ 215{
216 if (!voltdm || IS_ERR(voltdm)) { 216 if (!voltdm || IS_ERR(voltdm)) {
217 pr_warning("%s: VDD specified does not exist!\n", __func__); 217 pr_warn("%s: VDD specified does not exist!\n", __func__);
218 return -EINVAL; 218 return -EINVAL;
219 } 219 }
220 220
@@ -237,7 +237,7 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
237 int voltscale_method) 237 int voltscale_method)
238{ 238{
239 if (!voltdm || IS_ERR(voltdm)) { 239 if (!voltdm || IS_ERR(voltdm)) {
240 pr_warning("%s: VDD specified does not exist!\n", __func__); 240 pr_warn("%s: VDD specified does not exist!\n", __func__);
241 return; 241 return;
242 } 242 }
243 243
@@ -279,7 +279,7 @@ int __init omap_voltage_late_init(void)
279 279
280 sys_ck = clk_get(NULL, voltdm->sys_clk.name); 280 sys_ck = clk_get(NULL, voltdm->sys_clk.name);
281 if (IS_ERR(sys_ck)) { 281 if (IS_ERR(sys_ck)) {
282 pr_warning("%s: Could not get sys clk.\n", __func__); 282 pr_warn("%s: Could not get sys clk.\n", __func__);
283 return -EINVAL; 283 return -EINVAL;
284 } 284 }
285 voltdm->sys_clk.rate = clk_get_rate(sys_ck); 285 voltdm->sys_clk.rate = clk_get_rate(sys_ck);
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index 97d6607d447a..ff0a68cf7439 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -93,8 +93,8 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
93 udelay(oh->class->sysc->srst_udelay); 93 udelay(oh->class->sysc->srst_udelay);
94 94
95 if (c == MAX_MODULE_SOFTRESET_WAIT) 95 if (c == MAX_MODULE_SOFTRESET_WAIT)
96 pr_warning("%s: %s: softreset failed (waited %d usec)\n", 96 pr_warn("%s: %s: softreset failed (waited %d usec)\n",
97 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT); 97 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
98 else 98 else
99 pr_debug("%s: %s: softreset in %d usec\n", __func__, 99 pr_debug("%s: %s: softreset in %d usec\n", __func__,
100 oh->name, c); 100 oh->name, c);
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 56edeab17b68..09d2a26985da 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -550,7 +550,7 @@ static int __init dns323_identify_rev(void)
550 break; 550 break;
551 } 551 }
552 if (i >= 1000) { 552 if (i >= 1000) {
553 pr_warning("DNS-323: Timeout accessing PHY, assuming rev B1\n"); 553 pr_warn("DNS-323: Timeout accessing PHY, assuming rev B1\n");
554 return DNS323_REV_B1; 554 return DNS323_REV_B1;
555 } 555 }
556 writel((3 << 21) /* phy ID reg */ | 556 writel((3 << 21) /* phy ID reg */ |
@@ -562,7 +562,7 @@ static int __init dns323_identify_rev(void)
562 break; 562 break;
563 } 563 }
564 if (i >= 1000) { 564 if (i >= 1000) {
565 pr_warning("DNS-323: Timeout reading PHY, assuming rev B1\n"); 565 pr_warn("DNS-323: Timeout reading PHY, assuming rev B1\n");
566 return DNS323_REV_B1; 566 return DNS323_REV_B1;
567 } 567 }
568 pr_debug("DNS-323: Ethernet PHY ID 0x%x\n", reg & 0xffff); 568 pr_debug("DNS-323: Ethernet PHY ID 0x%x\n", reg & 0xffff);
@@ -577,8 +577,8 @@ static int __init dns323_identify_rev(void)
577 case 0x0e10: /* MV88E1118 */ 577 case 0x0e10: /* MV88E1118 */
578 return DNS323_REV_C1; 578 return DNS323_REV_C1;
579 default: 579 default:
580 pr_warning("DNS-323: Unknown PHY ID 0x%04x, assuming rev B1\n", 580 pr_warn("DNS-323: Unknown PHY ID 0x%04x, assuming rev B1\n",
581 reg & 0xffff); 581 reg & 0xffff);
582 } 582 }
583 return DNS323_REV_B1; 583 return DNS323_REV_B1;
584} 584}
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c
index 6208d125c1b9..12086745c9fd 100644
--- a/arch/arm/mach-orion5x/terastation_pro2-setup.c
+++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c
@@ -349,7 +349,7 @@ static void __init tsp2_init(void)
349 gpio_free(TSP2_RTC_GPIO); 349 gpio_free(TSP2_RTC_GPIO);
350 } 350 }
351 if (tsp2_i2c_rtc.irq == 0) 351 if (tsp2_i2c_rtc.irq == 0)
352 pr_warning("tsp2_init: failed to get RTC IRQ\n"); 352 pr_warn("tsp2_init: failed to get RTC IRQ\n");
353 i2c_register_board_info(0, &tsp2_i2c_rtc, 1); 353 i2c_register_board_info(0, &tsp2_i2c_rtc, 1);
354 354
355 /* register Terastation Pro II specific power-off method */ 355 /* register Terastation Pro II specific power-off method */
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index 9136797addb2..c725b7cb9875 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -314,7 +314,7 @@ static void __init qnap_ts209_init(void)
314 gpio_free(TS209_RTC_GPIO); 314 gpio_free(TS209_RTC_GPIO);
315 } 315 }
316 if (qnap_ts209_i2c_rtc.irq == 0) 316 if (qnap_ts209_i2c_rtc.irq == 0)
317 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n"); 317 pr_warn("qnap_ts209_init: failed to get RTC IRQ\n");
318 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1); 318 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
319 319
320 /* register tsx09 specific power-off method */ 320 /* register tsx09 specific power-off method */
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index 5c079d312015..cf2ab531cabc 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -302,7 +302,7 @@ static void __init qnap_ts409_init(void)
302 gpio_free(TS409_RTC_GPIO); 302 gpio_free(TS409_RTC_GPIO);
303 } 303 }
304 if (qnap_ts409_i2c_rtc.irq == 0) 304 if (qnap_ts409_i2c_rtc.irq == 0)
305 pr_warning("qnap_ts409_init: failed to get RTC IRQ\n"); 305 pr_warn("qnap_ts409_init: failed to get RTC IRQ\n");
306 i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1); 306 i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1);
307 platform_device_register(&ts409_leds); 307 platform_device_register(&ts409_leds);
308 308
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index db16dae441e2..1b704d35cf5b 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -403,8 +403,8 @@ static void ts78xx_fpga_supports(void)
403 /* enable devices if magic matches */ 403 /* enable devices if magic matches */
404 switch ((ts78xx_fpga.id >> 8) & 0xffffff) { 404 switch ((ts78xx_fpga.id >> 8) & 0xffffff) {
405 case TS7800_FPGA_MAGIC: 405 case TS7800_FPGA_MAGIC:
406 pr_warning("unrecognised FPGA revision 0x%.2x\n", 406 pr_warn("unrecognised FPGA revision 0x%.2x\n",
407 ts78xx_fpga.id & 0xff); 407 ts78xx_fpga.id & 0xff);
408 ts78xx_fpga.supports.ts_rtc.present = 1; 408 ts78xx_fpga.supports.ts_rtc.present = 1;
409 ts78xx_fpga.supports.ts_nand.present = 1; 409 ts78xx_fpga.supports.ts_nand.present = 1;
410 ts78xx_fpga.supports.ts_rng.present = 1; 410 ts78xx_fpga.supports.ts_rng.present = 1;
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 666094315ab1..ac7b3eabbd85 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -1071,9 +1071,47 @@ static struct resource pxa3xx_resource_ssp4[] = {
1071 }, 1071 },
1072}; 1072};
1073 1073
1074/*
1075 * PXA3xx SSP is basically equivalent to PXA27x.
1076 * However, we need to register the device by the correct name in order to
1077 * make the driver set the correct internal type, hence we provide specific
1078 * platform_devices for each of them.
1079 */
1080struct platform_device pxa3xx_device_ssp1 = {
1081 .name = "pxa3xx-ssp",
1082 .id = 0,
1083 .dev = {
1084 .dma_mask = &pxa27x_ssp1_dma_mask,
1085 .coherent_dma_mask = DMA_BIT_MASK(32),
1086 },
1087 .resource = pxa27x_resource_ssp1,
1088 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
1089};
1090
1091struct platform_device pxa3xx_device_ssp2 = {
1092 .name = "pxa3xx-ssp",
1093 .id = 1,
1094 .dev = {
1095 .dma_mask = &pxa27x_ssp2_dma_mask,
1096 .coherent_dma_mask = DMA_BIT_MASK(32),
1097 },
1098 .resource = pxa27x_resource_ssp2,
1099 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
1100};
1101
1102struct platform_device pxa3xx_device_ssp3 = {
1103 .name = "pxa3xx-ssp",
1104 .id = 2,
1105 .dev = {
1106 .dma_mask = &pxa27x_ssp3_dma_mask,
1107 .coherent_dma_mask = DMA_BIT_MASK(32),
1108 },
1109 .resource = pxa27x_resource_ssp3,
1110 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
1111};
1112
1074struct platform_device pxa3xx_device_ssp4 = { 1113struct platform_device pxa3xx_device_ssp4 = {
1075 /* PXA3xx SSP is basically equivalent to PXA27x */ 1114 .name = "pxa3xx-ssp",
1076 .name = "pxa27x-ssp",
1077 .id = 3, 1115 .id = 3,
1078 .dev = { 1116 .dev = {
1079 .dma_mask = &pxa3xx_ssp4_dma_mask, 1117 .dma_mask = &pxa3xx_ssp4_dma_mask,
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 0f3fd0d65b12..4a13c32fb705 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -27,6 +27,9 @@ extern struct platform_device pxa25x_device_assp;
27extern struct platform_device pxa27x_device_ssp1; 27extern struct platform_device pxa27x_device_ssp1;
28extern struct platform_device pxa27x_device_ssp2; 28extern struct platform_device pxa27x_device_ssp2;
29extern struct platform_device pxa27x_device_ssp3; 29extern struct platform_device pxa27x_device_ssp3;
30extern struct platform_device pxa3xx_device_ssp1;
31extern struct platform_device pxa3xx_device_ssp2;
32extern struct platform_device pxa3xx_device_ssp3;
30extern struct platform_device pxa3xx_device_ssp4; 33extern struct platform_device pxa3xx_device_ssp4;
31 34
32extern struct platform_device pxa25x_device_pwm0; 35extern struct platform_device pxa25x_device_pwm0;
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 630fa916bbc6..04b013fbc98f 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -61,7 +61,7 @@ EXPORT_SYMBOL(get_clock_tick_rate);
61/* 61/*
62 * For non device-tree builds, keep legacy timer init 62 * For non device-tree builds, keep legacy timer init
63 */ 63 */
64void pxa_timer_init(void) 64void __init pxa_timer_init(void)
65{ 65{
66 pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000), 66 pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000),
67 get_clock_tick_rate()); 67 get_clock_tick_rate());
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 593ccd35ca97..edcbd9c0bcb2 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -84,10 +84,10 @@ static struct clk_lookup pxa3xx_clkregs[] = {
84 INIT_CLKREG(&clk_pxa3xx_usbh, "pxa27x-ohci", NULL), 84 INIT_CLKREG(&clk_pxa3xx_usbh, "pxa27x-ohci", NULL),
85 INIT_CLKREG(&clk_pxa3xx_u2d, "pxa3xx-u2d", NULL), 85 INIT_CLKREG(&clk_pxa3xx_u2d, "pxa3xx-u2d", NULL),
86 INIT_CLKREG(&clk_pxa3xx_keypad, "pxa27x-keypad", NULL), 86 INIT_CLKREG(&clk_pxa3xx_keypad, "pxa27x-keypad", NULL),
87 INIT_CLKREG(&clk_pxa3xx_ssp1, "pxa27x-ssp.0", NULL), 87 INIT_CLKREG(&clk_pxa3xx_ssp1, "pxa3xx-ssp.0", NULL),
88 INIT_CLKREG(&clk_pxa3xx_ssp2, "pxa27x-ssp.1", NULL), 88 INIT_CLKREG(&clk_pxa3xx_ssp2, "pxa3xx-ssp.1", NULL),
89 INIT_CLKREG(&clk_pxa3xx_ssp3, "pxa27x-ssp.2", NULL), 89 INIT_CLKREG(&clk_pxa3xx_ssp3, "pxa3xx-ssp.2", NULL),
90 INIT_CLKREG(&clk_pxa3xx_ssp4, "pxa27x-ssp.3", NULL), 90 INIT_CLKREG(&clk_pxa3xx_ssp4, "pxa3xx-ssp.3", NULL),
91 INIT_CLKREG(&clk_pxa3xx_pwm0, "pxa27x-pwm.0", NULL), 91 INIT_CLKREG(&clk_pxa3xx_pwm0, "pxa27x-pwm.0", NULL),
92 INIT_CLKREG(&clk_pxa3xx_pwm1, "pxa27x-pwm.1", NULL), 92 INIT_CLKREG(&clk_pxa3xx_pwm1, "pxa27x-pwm.1", NULL),
93 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL), 93 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
@@ -452,9 +452,9 @@ static struct platform_device *devices[] __initdata = {
452 &pxa_device_asoc_platform, 452 &pxa_device_asoc_platform,
453 &sa1100_device_rtc, 453 &sa1100_device_rtc,
454 &pxa_device_rtc, 454 &pxa_device_rtc,
455 &pxa27x_device_ssp1, 455 &pxa3xx_device_ssp1,
456 &pxa27x_device_ssp2, 456 &pxa3xx_device_ssp2,
457 &pxa27x_device_ssp3, 457 &pxa3xx_device_ssp3,
458 &pxa3xx_device_ssp4, 458 &pxa3xx_device_ssp4,
459 &pxa27x_device_pwm0, 459 &pxa27x_device_pwm0,
460 &pxa27x_device_pwm1, 460 &pxa27x_device_pwm1,
diff --git a/arch/arm/mach-qcom/board.c b/arch/arm/mach-qcom/board.c
index c437a9941726..6d8bbf7d39d8 100644
--- a/arch/arm/mach-qcom/board.c
+++ b/arch/arm/mach-qcom/board.c
@@ -18,6 +18,8 @@ static const char * const qcom_dt_match[] __initconst = {
18 "qcom,apq8064", 18 "qcom,apq8064",
19 "qcom,apq8074-dragonboard", 19 "qcom,apq8074-dragonboard",
20 "qcom,apq8084", 20 "qcom,apq8084",
21 "qcom,ipq8062",
22 "qcom,ipq8064",
21 "qcom,msm8660-surf", 23 "qcom,msm8660-surf",
22 "qcom,msm8960-cdp", 24 "qcom,msm8960-cdp",
23 NULL 25 NULL
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index d1686696ca41..ac5803cac98d 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -4,6 +4,7 @@ config ARCH_ROCKCHIP
4 select PINCTRL_ROCKCHIP 4 select PINCTRL_ROCKCHIP
5 select ARCH_HAS_RESET_CONTROLLER 5 select ARCH_HAS_RESET_CONTROLLER
6 select ARCH_REQUIRE_GPIOLIB 6 select ARCH_REQUIRE_GPIOLIB
7 select ARM_AMBA
7 select ARM_GIC 8 select ARM_GIC
8 select CACHE_L2X0 9 select CACHE_L2X0
9 select HAVE_ARM_ARCH_TIMER 10 select HAVE_ARM_ARCH_TIMER
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index ad5316ae524e..9eb22297cbe1 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -32,7 +32,6 @@ config CPU_S3C2410
32 select S3C2410_DMA if S3C24XX_DMA 32 select S3C2410_DMA if S3C24XX_DMA
33 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ 33 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
34 select S3C2410_PM if PM 34 select S3C2410_PM if PM
35 select SAMSUNG_WDT_RESET
36 help 35 help
37 Support for S3C2410 and S3C2410A family from the S3C24XX line 36 Support for S3C2410 and S3C2410A family from the S3C24XX line
38 of Samsung Mobile CPUs. 37 of Samsung Mobile CPUs.
@@ -76,7 +75,6 @@ config CPU_S3C2442
76config CPU_S3C244X 75config CPU_S3C244X
77 def_bool y 76 def_bool y
78 depends on CPU_S3C2440 || CPU_S3C2442 77 depends on CPU_S3C2440 || CPU_S3C2442
79 select SAMSUNG_WDT_RESET
80 78
81config CPU_S3C2443 79config CPU_S3C2443
82 bool "SAMSUNG S3C2443" 80 bool "SAMSUNG S3C2443"
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 44fa95df9262..bf50328107bd 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -51,7 +51,6 @@
51#include <plat/devs.h> 51#include <plat/devs.h>
52#include <plat/cpu-freq.h> 52#include <plat/cpu-freq.h>
53#include <plat/pwm-core.h> 53#include <plat/pwm-core.h>
54#include <plat/watchdog-reset.h>
55 54
56#include "common.h" 55#include "common.h"
57 56
@@ -513,7 +512,6 @@ struct platform_device s3c2443_device_dma = {
513void __init s3c2410_init_clocks(int xtal) 512void __init s3c2410_init_clocks(int xtal)
514{ 513{
515 s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR); 514 s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
516 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
517} 515}
518#endif 516#endif
519 517
@@ -535,7 +533,6 @@ void __init s3c2416_init_clocks(int xtal)
535void __init s3c2440_init_clocks(int xtal) 533void __init s3c2440_init_clocks(int xtal)
536{ 534{
537 s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR); 535 s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
538 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
539} 536}
540#endif 537#endif
541 538
@@ -543,7 +540,6 @@ void __init s3c2440_init_clocks(int xtal)
543void __init s3c2442_init_clocks(int xtal) 540void __init s3c2442_init_clocks(int xtal)
544{ 541{
545 s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR); 542 s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
546 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
547} 543}
548#endif 544#endif
549 545
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
index ac3ff12a0601..c7ac7e61a22e 100644
--- a/arch/arm/mach-s3c24xx/common.h
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -22,7 +22,6 @@ extern int s3c2410a_init(void);
22extern void s3c2410_map_io(void); 22extern void s3c2410_map_io(void);
23extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); 23extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
24extern void s3c2410_init_clocks(int xtal); 24extern void s3c2410_init_clocks(int xtal);
25extern void s3c2410_restart(enum reboot_mode mode, const char *cmd);
26extern void s3c2410_init_irq(void); 25extern void s3c2410_init_irq(void);
27#else 26#else
28#define s3c2410_init_clocks NULL 27#define s3c2410_init_clocks NULL
@@ -38,7 +37,6 @@ extern void s3c2412_map_io(void);
38extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no); 37extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
39extern void s3c2412_init_clocks(int xtal); 38extern void s3c2412_init_clocks(int xtal);
40extern int s3c2412_baseclk_add(void); 39extern int s3c2412_baseclk_add(void);
41extern void s3c2412_restart(enum reboot_mode mode, const char *cmd);
42extern void s3c2412_init_irq(void); 40extern void s3c2412_init_irq(void);
43#else 41#else
44#define s3c2412_init_clocks NULL 42#define s3c2412_init_clocks NULL
@@ -53,7 +51,6 @@ extern void s3c2416_map_io(void);
53extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no); 51extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no);
54extern void s3c2416_init_clocks(int xtal); 52extern void s3c2416_init_clocks(int xtal);
55extern int s3c2416_baseclk_add(void); 53extern int s3c2416_baseclk_add(void);
56extern void s3c2416_restart(enum reboot_mode mode, const char *cmd);
57extern void s3c2416_init_irq(void); 54extern void s3c2416_init_irq(void);
58 55
59extern struct syscore_ops s3c2416_irq_syscore_ops; 56extern struct syscore_ops s3c2416_irq_syscore_ops;
@@ -67,7 +64,6 @@ extern struct syscore_ops s3c2416_irq_syscore_ops;
67#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) 64#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
68extern void s3c244x_map_io(void); 65extern void s3c244x_map_io(void);
69extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no); 66extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
70extern void s3c244x_restart(enum reboot_mode mode, const char *cmd);
71#else 67#else
72#define s3c244x_init_uarts NULL 68#define s3c244x_init_uarts NULL
73#endif 69#endif
@@ -98,7 +94,6 @@ extern void s3c2443_map_io(void);
98extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no); 94extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
99extern void s3c2443_init_clocks(int xtal); 95extern void s3c2443_init_clocks(int xtal);
100extern int s3c2443_baseclk_add(void); 96extern int s3c2443_baseclk_add(void);
101extern void s3c2443_restart(enum reboot_mode mode, const char *cmd);
102extern void s3c2443_init_irq(void); 97extern void s3c2443_init_irq(void);
103#else 98#else
104#define s3c2443_init_clocks NULL 99#define s3c2443_init_clocks NULL
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h
index c3feff3c0488..ffe37bdb9f59 100644
--- a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h
@@ -42,8 +42,6 @@
42#define S3C2443_URSTCON S3C2443_CLKREG(0x88) 42#define S3C2443_URSTCON S3C2443_CLKREG(0x88)
43#define S3C2443_UCLKCON S3C2443_CLKREG(0x8C) 43#define S3C2443_UCLKCON S3C2443_CLKREG(0x8C)
44 44
45#define S3C2443_SWRST_RESET (0x533c2443)
46
47#define S3C2443_PLLCON_OFF (1<<24) 45#define S3C2443_PLLCON_OFF (1<<24)
48 46
49#define S3C2443_CLKSRC_EPLLREF_XTAL (2<<7) 47#define S3C2443_CLKSRC_EPLLREF_XTAL (2<<7)
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index 5157e250dd13..3e63777a109f 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -247,5 +247,4 @@ MACHINE_START(AML_M5900, "AML_M5900")
247 .init_irq = s3c2410_init_irq, 247 .init_irq = s3c2410_init_irq,
248 .init_machine = amlm5900_init, 248 .init_machine = amlm5900_init,
249 .init_time = amlm5900_init_time, 249 .init_time = amlm5900_init_time,
250 .restart = s3c2410_restart,
251MACHINE_END 250MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index e053581cab0b..d03df0df01fa 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -430,5 +430,4 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
430 .init_machine = anubis_init, 430 .init_machine = anubis_init,
431 .init_irq = s3c2440_init_irq, 431 .init_irq = s3c2440_init_irq,
432 .init_time = anubis_init_time, 432 .init_time = anubis_init_time,
433 .restart = s3c244x_restart,
434MACHINE_END 433MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index 9db768f448a5..9ae170fef2a7 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -218,5 +218,4 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
218 .init_machine = at2440evb_init, 218 .init_machine = at2440evb_init,
219 .init_irq = s3c2440_init_irq, 219 .init_irq = s3c2440_init_irq,
220 .init_time = at2440evb_init_time, 220 .init_time = at2440evb_init_time,
221 .restart = s3c244x_restart,
222MACHINE_END 221MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index f9112b801a33..ed07cf392d4b 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -591,5 +591,4 @@ MACHINE_START(BAST, "Simtec-BAST")
591 .init_irq = s3c2410_init_irq, 591 .init_irq = s3c2410_init_irq,
592 .init_machine = bast_init, 592 .init_machine = bast_init,
593 .init_time = bast_init_time, 593 .init_time = bast_init_time,
594 .restart = s3c2410_restart,
595MACHINE_END 594MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index fc3a08d0cb3f..6d1e0b9c5b27 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -597,5 +597,4 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
597 .init_irq = s3c2442_init_irq, 597 .init_irq = s3c2442_init_irq,
598 .init_machine = gta02_machine_init, 598 .init_machine = gta02_machine_init,
599 .init_time = gta02_init_time, 599 .init_time = gta02_init_time,
600 .restart = s3c244x_restart,
601MACHINE_END 600MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index c9a99bbad545..d35ddc1d9991 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -747,5 +747,4 @@ MACHINE_START(H1940, "IPAQ-H1940")
747 .init_irq = s3c2410_init_irq, 747 .init_irq = s3c2410_init_irq,
748 .init_machine = h1940_init, 748 .init_machine = h1940_init,
749 .init_time = h1940_init_time, 749 .init_time = h1940_init_time,
750 .restart = s3c2410_restart,
751MACHINE_END 750MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index 7804d3c6991b..7d99fe8f6157 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -670,5 +670,4 @@ MACHINE_START(JIVE, "JIVE")
670 .map_io = jive_map_io, 670 .map_io = jive_map_io,
671 .init_machine = jive_machine_init, 671 .init_machine = jive_machine_init,
672 .init_time = jive_init_time, 672 .init_time = jive_init_time,
673 .restart = s3c2412_restart,
674MACHINE_END 673MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 5cc40ec1d254..a8521684a7f5 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -695,5 +695,4 @@ MACHINE_START(MINI2440, "MINI2440")
695 .init_machine = mini2440_init, 695 .init_machine = mini2440_init,
696 .init_irq = s3c2440_init_irq, 696 .init_irq = s3c2440_init_irq,
697 .init_time = mini2440_init_time, 697 .init_time = mini2440_init_time,
698 .restart = s3c244x_restart,
699MACHINE_END 698MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index 3ac2a54348d6..171c1f11fd22 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -599,7 +599,6 @@ MACHINE_START(N30, "Acer-N30")
599 .init_machine = n30_init, 599 .init_machine = n30_init,
600 .init_irq = s3c2410_init_irq, 600 .init_irq = s3c2410_init_irq,
601 .map_io = n30_map_io, 601 .map_io = n30_map_io,
602 .restart = s3c2410_restart,
603MACHINE_END 602MACHINE_END
604 603
605MACHINE_START(N35, "Acer-N35") 604MACHINE_START(N35, "Acer-N35")
@@ -610,5 +609,4 @@ MACHINE_START(N35, "Acer-N35")
610 .init_machine = n30_init, 609 .init_machine = n30_init,
611 .init_irq = s3c2410_init_irq, 610 .init_irq = s3c2410_init_irq,
612 .map_io = n30_map_io, 611 .map_io = n30_map_io,
613 .restart = s3c2410_restart,
614MACHINE_END 612MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index c82c281ce351..2a61d13dcd6c 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -159,5 +159,4 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
159 .init_machine = nexcoder_init, 159 .init_machine = nexcoder_init,
160 .init_irq = s3c2440_init_irq, 160 .init_irq = s3c2440_init_irq,
161 .init_time = nexcoder_init_time, 161 .init_time = nexcoder_init_time,
162 .restart = s3c244x_restart,
163MACHINE_END 162MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index 189147b80eca..2f6fdc326835 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -412,5 +412,4 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
412 .init_irq = s3c2440_init_irq, 412 .init_irq = s3c2440_init_irq,
413 .init_machine = osiris_init, 413 .init_machine = osiris_init,
414 .init_time = osiris_init_time, 414 .init_time = osiris_init_time,
415 .restart = s3c244x_restart,
416MACHINE_END 415MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index 45833001186d..345a484b93cc 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -122,5 +122,4 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
122 .init_machine = otom11_init, 122 .init_machine = otom11_init,
123 .init_irq = s3c2410_init_irq, 123 .init_irq = s3c2410_init_irq,
124 .init_time = otom11_init_time, 124 .init_time = otom11_init_time,
125 .restart = s3c2410_restart,
126MACHINE_END 125MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 228c9094519d..984516e8307a 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -352,5 +352,4 @@ MACHINE_START(QT2410, "QT2410")
352 .init_irq = s3c2410_init_irq, 352 .init_irq = s3c2410_init_irq,
353 .init_machine = qt2410_machine_init, 353 .init_machine = qt2410_machine_init,
354 .init_time = qt2410_init_time, 354 .init_time = qt2410_init_time,
355 .restart = s3c2410_restart,
356MACHINE_END 355MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index e2c6541909c1..c3f2682d0c62 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -812,5 +812,4 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
812 .init_irq = s3c2442_init_irq, 812 .init_irq = s3c2442_init_irq,
813 .init_machine = rx1950_init_machine, 813 .init_machine = rx1950_init_machine,
814 .init_time = rx1950_init_time, 814 .init_time = rx1950_init_time,
815 .restart = s3c244x_restart,
816MACHINE_END 815MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index 6e749ec3a2ea..cf55196f89ca 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -215,5 +215,4 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
215 .init_irq = s3c2440_init_irq, 215 .init_irq = s3c2440_init_irq,
216 .init_machine = rx3715_init_machine, 216 .init_machine = rx3715_init_machine,
217 .init_time = rx3715_init_time, 217 .init_time = rx3715_init_time,
218 .restart = s3c244x_restart,
219MACHINE_END 218MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
index e4dcb9aa2ca2..f886478b88c5 100644
--- a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
+++ b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
@@ -51,5 +51,4 @@ DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)")
51 .map_io = s3c2416_dt_map_io, 51 .map_io = s3c2416_dt_map_io,
52 .init_irq = irqchip_init, 52 .init_irq = irqchip_init,
53 .init_machine = s3c2416_dt_machine_init, 53 .init_machine = s3c2416_dt_machine_init,
54 .restart = s3c2416_restart,
55MACHINE_END 54MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index 419fadd6e446..27dd6605e395 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -124,5 +124,4 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
124 .init_irq = s3c2410_init_irq, 124 .init_irq = s3c2410_init_irq,
125 .init_machine = smdk2410_init, 125 .init_machine = smdk2410_init,
126 .init_time = smdk2410_init_time, 126 .init_time = smdk2410_init_time,
127 .restart = s3c2410_restart,
128MACHINE_END 127MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index 10726bf84920..586e4a3b8d5d 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -138,7 +138,6 @@ MACHINE_START(S3C2413, "S3C2413")
138 .map_io = smdk2413_map_io, 138 .map_io = smdk2413_map_io,
139 .init_machine = smdk2413_machine_init, 139 .init_machine = smdk2413_machine_init,
140 .init_time = samsung_timer_init, 140 .init_time = samsung_timer_init,
141 .restart = s3c2412_restart,
142MACHINE_END 141MACHINE_END
143 142
144MACHINE_START(SMDK2412, "SMDK2412") 143MACHINE_START(SMDK2412, "SMDK2412")
@@ -150,7 +149,6 @@ MACHINE_START(SMDK2412, "SMDK2412")
150 .map_io = smdk2413_map_io, 149 .map_io = smdk2413_map_io,
151 .init_machine = smdk2413_machine_init, 150 .init_machine = smdk2413_machine_init,
152 .init_time = samsung_timer_init, 151 .init_time = samsung_timer_init,
153 .restart = s3c2412_restart,
154MACHINE_END 152MACHINE_END
155 153
156MACHINE_START(SMDK2413, "SMDK2413") 154MACHINE_START(SMDK2413, "SMDK2413")
@@ -162,5 +160,4 @@ MACHINE_START(SMDK2413, "SMDK2413")
162 .map_io = smdk2413_map_io, 160 .map_io = smdk2413_map_io,
163 .init_machine = smdk2413_machine_init, 161 .init_machine = smdk2413_machine_init,
164 .init_time = smdk2413_init_time, 162 .init_time = smdk2413_init_time,
165 .restart = s3c2412_restart,
166MACHINE_END 163MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index 24189e8e8560..86394f72d29e 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -262,5 +262,4 @@ MACHINE_START(SMDK2416, "SMDK2416")
262 .map_io = smdk2416_map_io, 262 .map_io = smdk2416_map_io,
263 .init_machine = smdk2416_machine_init, 263 .init_machine = smdk2416_machine_init,
264 .init_time = smdk2416_init_time, 264 .init_time = smdk2416_init_time,
265 .restart = s3c2416_restart,
266MACHINE_END 265MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index 5fb89c0ae17a..9bb96bfbb420 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -185,5 +185,4 @@ MACHINE_START(S3C2440, "SMDK2440")
185 .map_io = smdk2440_map_io, 185 .map_io = smdk2440_map_io,
186 .init_machine = smdk2440_machine_init, 186 .init_machine = smdk2440_machine_init,
187 .init_time = smdk2440_init_time, 187 .init_time = smdk2440_init_time,
188 .restart = s3c244x_restart,
189MACHINE_END 188MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 0ed77614dcfe..87fe5c5b8073 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -150,5 +150,4 @@ MACHINE_START(SMDK2443, "SMDK2443")
150 .map_io = smdk2443_map_io, 150 .map_io = smdk2443_map_io,
151 .init_machine = smdk2443_machine_init, 151 .init_machine = smdk2443_machine_init,
152 .init_time = smdk2443_init_time, 152 .init_time = smdk2443_init_time,
153 .restart = s3c2443_restart,
154MACHINE_END 153MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index c616ca2d409e..2deb62f92fb2 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -157,5 +157,4 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
157 .init_irq = s3c2410_init_irq, 157 .init_irq = s3c2410_init_irq,
158 .init_machine = tct_hammer_init, 158 .init_machine = tct_hammer_init,
159 .init_time = tct_hammer_init_time, 159 .init_time = tct_hammer_init_time,
160 .restart = s3c2410_restart,
161MACHINE_END 160MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index f88c584c3001..89f32bd3f01b 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -340,5 +340,4 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
340 .init_machine = vr1000_init, 340 .init_machine = vr1000_init,
341 .init_irq = s3c2410_init_irq, 341 .init_irq = s3c2410_init_irq,
342 .init_time = vr1000_init_time, 342 .init_time = vr1000_init_time,
343 .restart = s3c2410_restart,
344MACHINE_END 343MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index 9d4f64750698..b4460d5f7011 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -165,5 +165,4 @@ MACHINE_START(VSTMS, "VSTMS")
165 .init_machine = vstms_init, 165 .init_machine = vstms_init,
166 .map_io = vstms_map_io, 166 .map_io = vstms_map_io,
167 .init_time = vstms_init_time, 167 .init_time = vstms_init_time,
168 .restart = s3c2412_restart,
169MACHINE_END 168MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index 5ffe828cd659..2a6985a4a0ff 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -42,7 +42,6 @@
42#include <plat/cpu.h> 42#include <plat/cpu.h>
43#include <plat/devs.h> 43#include <plat/devs.h>
44#include <plat/pm.h> 44#include <plat/pm.h>
45#include <plat/watchdog-reset.h>
46 45
47#include <plat/gpio-core.h> 46#include <plat/gpio-core.h>
48#include <plat/gpio-cfg.h> 47#include <plat/gpio-cfg.h>
@@ -135,15 +134,3 @@ int __init s3c2410a_init(void)
135 s3c2410_dev.bus = &s3c2410a_subsys; 134 s3c2410_dev.bus = &s3c2410a_subsys;
136 return s3c2410_init(); 135 return s3c2410_init();
137} 136}
138
139void s3c2410_restart(enum reboot_mode mode, const char *cmd)
140{
141 if (mode == REBOOT_SOFT) {
142 soft_restart(0);
143 }
144
145 samsung_wdt_reset();
146
147 /* we'll take a jump through zero as a poor second */
148 soft_restart(0);
149}
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index 569f3f5a6c71..ecf2c77ab88b 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -48,9 +48,6 @@
48#include "regs-dsc.h" 48#include "regs-dsc.h"
49#include "s3c2412-power.h" 49#include "s3c2412-power.h"
50 50
51#define S3C2412_SWRST (S3C24XX_VA_CLKPWR + 0x30)
52#define S3C2412_SWRST_RESET (0x533C2412)
53
54#ifndef CONFIG_CPU_S3C2412_ONLY 51#ifndef CONFIG_CPU_S3C2412_ONLY
55void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO; 52void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
56 53
@@ -128,26 +125,6 @@ static void s3c2412_idle(void)
128 cpu_do_idle(); 125 cpu_do_idle();
129} 126}
130 127
131void s3c2412_restart(enum reboot_mode mode, const char *cmd)
132{
133 if (mode == REBOOT_SOFT)
134 soft_restart(0);
135
136 /* errata "Watch-dog/Software Reset Problem" specifies that
137 * this reset must be done with the SYSCLK sourced from
138 * EXTCLK instead of FOUT to avoid a glitch in the reset
139 * mechanism.
140 *
141 * See the watchdog section of the S3C2412 manual for more
142 * information on this fix.
143 */
144
145 __raw_writel(0x00, S3C2412_CLKSRC);
146 __raw_writel(S3C2412_SWRST_RESET, S3C2412_SWRST);
147
148 mdelay(1);
149}
150
151/* s3c2412_map_io 128/* s3c2412_map_io
152 * 129 *
153 * register the standard cpu IO areas, and any passed in from the 130 * register the standard cpu IO areas, and any passed in from the
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
index 9fe260ae11e1..bfd4da86deb8 100644
--- a/arch/arm/mach-s3c24xx/s3c2416.c
+++ b/arch/arm/mach-s3c24xx/s3c2416.c
@@ -81,14 +81,6 @@ static struct device s3c2416_dev = {
81 .bus = &s3c2416_subsys, 81 .bus = &s3c2416_subsys,
82}; 82};
83 83
84void s3c2416_restart(enum reboot_mode mode, const char *cmd)
85{
86 if (mode == REBOOT_SOFT)
87 soft_restart(0);
88
89 __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST);
90}
91
92int __init s3c2416_init(void) 84int __init s3c2416_init(void)
93{ 85{
94 printk(KERN_INFO "S3C2416: Initializing architecture\n"); 86 printk(KERN_INFO "S3C2416: Initializing architecture\n");
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
index c7a804d0348e..87b6b89d8ee7 100644
--- a/arch/arm/mach-s3c24xx/s3c2443.c
+++ b/arch/arm/mach-s3c24xx/s3c2443.c
@@ -61,14 +61,6 @@ static struct device s3c2443_dev = {
61 .bus = &s3c2443_subsys, 61 .bus = &s3c2443_subsys,
62}; 62};
63 63
64void s3c2443_restart(enum reboot_mode mode, const char *cmd)
65{
66 if (mode == REBOOT_SOFT)
67 soft_restart(0);
68
69 __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST);
70}
71
72int __init s3c2443_init(void) 64int __init s3c2443_init(void)
73{ 65{
74 printk("S3C2443: Initialising architecture\n"); 66 printk("S3C2443: Initialising architecture\n");
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index d1c3e65785a1..177f97802745 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -42,7 +42,6 @@
42#include <plat/cpu.h> 42#include <plat/cpu.h>
43#include <plat/pm.h> 43#include <plat/pm.h>
44#include <plat/nand-core.h> 44#include <plat/nand-core.h>
45#include <plat/watchdog-reset.h>
46 45
47#include "common.h" 46#include "common.h"
48#include "regs-dsc.h" 47#include "regs-dsc.h"
@@ -137,14 +136,3 @@ struct syscore_ops s3c244x_pm_syscore_ops = {
137 .suspend = s3c244x_suspend, 136 .suspend = s3c244x_suspend,
138 .resume = s3c244x_resume, 137 .resume = s3c244x_resume,
139}; 138};
140
141void s3c244x_restart(enum reboot_mode mode, const char *cmd)
142{
143 if (mode == REBOOT_SOFT)
144 soft_restart(0);
145
146 samsung_wdt_reset();
147
148 /* we'll take a jump through zero as a poor second */
149 soft_restart(0);
150}
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 5c45aae675b6..16547f2641a3 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -440,8 +440,3 @@ void s3c64xx_restart(enum reboot_mode mode, const char *cmd)
440 /* if all else fails, or mode was for soft, jump to 0 */ 440 /* if all else fails, or mode was for soft, jump to 0 */
441 soft_restart(0); 441 soft_restart(0);
442} 442}
443
444void __init s3c64xx_init_late(void)
445{
446 s3c64xx_pm_late_initcall();
447}
diff --git a/arch/arm/mach-s3c64xx/common.h b/arch/arm/mach-s3c64xx/common.h
index 7043e7a3a67e..9eb864412911 100644
--- a/arch/arm/mach-s3c64xx/common.h
+++ b/arch/arm/mach-s3c64xx/common.h
@@ -23,7 +23,6 @@ void s3c64xx_init_irq(u32 vic0, u32 vic1);
23void s3c64xx_init_io(struct map_desc *mach_desc, int size); 23void s3c64xx_init_io(struct map_desc *mach_desc, int size);
24 24
25void s3c64xx_restart(enum reboot_mode mode, const char *cmd); 25void s3c64xx_restart(enum reboot_mode mode, const char *cmd);
26void s3c64xx_init_late(void);
27 26
28void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f, 27void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
29 unsigned long xusbxti_f, bool is_s3c6400, void __iomem *reg_base); 28 unsigned long xusbxti_f, bool is_s3c6400, void __iomem *reg_base);
@@ -52,12 +51,6 @@ extern void s3c6410_map_io(void);
52#define s3c6410_init NULL 51#define s3c6410_init NULL
53#endif 52#endif
54 53
55#ifdef CONFIG_PM
56int __init s3c64xx_pm_late_initcall(void);
57#else
58static inline int s3c64xx_pm_late_initcall(void) { return 0; }
59#endif
60
61#ifdef CONFIG_S3C64XX_PL080 54#ifdef CONFIG_S3C64XX_PL080
62extern struct pl08x_platform_data s3c64xx_dma0_plat_data; 55extern struct pl08x_platform_data s3c64xx_dma0_plat_data;
63extern struct pl08x_platform_data s3c64xx_dma1_plat_data; 56extern struct pl08x_platform_data s3c64xx_dma1_plat_data;
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 60576dfbea8d..6224c67f5061 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -233,7 +233,6 @@ MACHINE_START(ANW6410, "A&W6410")
233 .init_irq = s3c6410_init_irq, 233 .init_irq = s3c6410_init_irq,
234 .map_io = anw6410_map_io, 234 .map_io = anw6410_map_io,
235 .init_machine = anw6410_machine_init, 235 .init_machine = anw6410_machine_init,
236 .init_late = s3c64xx_init_late,
237 .init_time = samsung_timer_init, 236 .init_time = samsung_timer_init,
238 .restart = s3c64xx_restart, 237 .restart = s3c64xx_restart,
239MACHINE_END 238MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index fe116334afda..10b913baab28 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -857,7 +857,6 @@ MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
857 .init_irq = s3c6410_init_irq, 857 .init_irq = s3c6410_init_irq,
858 .map_io = crag6410_map_io, 858 .map_io = crag6410_map_io,
859 .init_machine = crag6410_machine_init, 859 .init_machine = crag6410_machine_init,
860 .init_late = s3c64xx_init_late,
861 .init_time = samsung_timer_init, 860 .init_time = samsung_timer_init,
862 .restart = s3c64xx_restart, 861 .restart = s3c64xx_restart,
863MACHINE_END 862MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 19e8feb908fd..e4b087c58ee6 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -277,7 +277,6 @@ MACHINE_START(HMT, "Airgoo-HMT")
277 .init_irq = s3c6410_init_irq, 277 .init_irq = s3c6410_init_irq,
278 .map_io = hmt_map_io, 278 .map_io = hmt_map_io,
279 .init_machine = hmt_machine_init, 279 .init_machine = hmt_machine_init,
280 .init_late = s3c64xx_init_late,
281 .init_time = samsung_timer_init, 280 .init_time = samsung_timer_init,
282 .restart = s3c64xx_restart, 281 .restart = s3c64xx_restart,
283MACHINE_END 282MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 9cbc07602ef3..ab61af50bfb9 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -366,7 +366,6 @@ MACHINE_START(MINI6410, "MINI6410")
366 .init_irq = s3c6410_init_irq, 366 .init_irq = s3c6410_init_irq,
367 .map_io = mini6410_map_io, 367 .map_io = mini6410_map_io,
368 .init_machine = mini6410_machine_init, 368 .init_machine = mini6410_machine_init,
369 .init_late = s3c64xx_init_late,
370 .init_time = samsung_timer_init, 369 .init_time = samsung_timer_init,
371 .restart = s3c64xx_restart, 370 .restart = s3c64xx_restart,
372MACHINE_END 371MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index 4bae7dc49eea..80cb1446f69f 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -103,7 +103,6 @@ MACHINE_START(NCP, "NCP")
103 .init_irq = s3c6410_init_irq, 103 .init_irq = s3c6410_init_irq,
104 .map_io = ncp_map_io, 104 .map_io = ncp_map_io,
105 .init_machine = ncp_machine_init, 105 .init_machine = ncp_machine_init,
106 .init_late = s3c64xx_init_late,
107 .init_time = samsung_timer_init, 106 .init_time = samsung_timer_init,
108 .restart = s3c64xx_restart, 107 .restart = s3c64xx_restart,
109MACHINE_END 108MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index fbad2af1ef16..85fa9598b980 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -335,7 +335,6 @@ MACHINE_START(REAL6410, "REAL6410")
335 .init_irq = s3c6410_init_irq, 335 .init_irq = s3c6410_init_irq,
336 .map_io = real6410_map_io, 336 .map_io = real6410_map_io,
337 .init_machine = real6410_machine_init, 337 .init_machine = real6410_machine_init,
338 .init_late = s3c64xx_init_late,
339 .init_time = samsung_timer_init, 338 .init_time = samsung_timer_init,
340 .restart = s3c64xx_restart, 339 .restart = s3c64xx_restart,
341MACHINE_END 340MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index dec4c08e834f..33224ab36fac 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -156,7 +156,6 @@ MACHINE_START(SMARTQ5, "SmartQ 5")
156 .init_irq = s3c6410_init_irq, 156 .init_irq = s3c6410_init_irq,
157 .map_io = smartq_map_io, 157 .map_io = smartq_map_io,
158 .init_machine = smartq5_machine_init, 158 .init_machine = smartq5_machine_init,
159 .init_late = s3c64xx_init_late,
160 .init_time = samsung_timer_init, 159 .init_time = samsung_timer_init,
161 .restart = s3c64xx_restart, 160 .restart = s3c64xx_restart,
162MACHINE_END 161MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index 27b322069c7d..fc7fece22fb0 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -172,7 +172,6 @@ MACHINE_START(SMARTQ7, "SmartQ 7")
172 .init_irq = s3c6410_init_irq, 172 .init_irq = s3c6410_init_irq,
173 .map_io = smartq_map_io, 173 .map_io = smartq_map_io,
174 .init_machine = smartq7_machine_init, 174 .init_machine = smartq7_machine_init,
175 .init_late = s3c64xx_init_late,
176 .init_time = samsung_timer_init, 175 .init_time = samsung_timer_init,
177 .restart = s3c64xx_restart, 176 .restart = s3c64xx_restart,
178MACHINE_END 177MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index 910749768340..6f425126a735 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -92,7 +92,6 @@ MACHINE_START(SMDK6400, "SMDK6400")
92 .init_irq = s3c6400_init_irq, 92 .init_irq = s3c6400_init_irq,
93 .map_io = smdk6400_map_io, 93 .map_io = smdk6400_map_io,
94 .init_machine = smdk6400_machine_init, 94 .init_machine = smdk6400_machine_init,
95 .init_late = s3c64xx_init_late,
96 .init_time = samsung_timer_init, 95 .init_time = samsung_timer_init,
97 .restart = s3c64xx_restart, 96 .restart = s3c64xx_restart,
98MACHINE_END 97MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index 1dc86d76b530..661eb662d051 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -705,7 +705,6 @@ MACHINE_START(SMDK6410, "SMDK6410")
705 .init_irq = s3c6410_init_irq, 705 .init_irq = s3c6410_init_irq,
706 .map_io = smdk6410_map_io, 706 .map_io = smdk6410_map_io,
707 .init_machine = smdk6410_machine_init, 707 .init_machine = smdk6410_machine_init,
708 .init_late = s3c64xx_init_late,
709 .init_time = samsung_timer_init, 708 .init_time = samsung_timer_init,
710 .restart = s3c64xx_restart, 709 .restart = s3c64xx_restart,
711MACHINE_END 710MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
index 6b37694fa335..aaf7bea4032f 100644
--- a/arch/arm/mach-s3c64xx/pm.c
+++ b/arch/arm/mach-s3c64xx/pm.c
@@ -347,10 +347,3 @@ static __init int s3c64xx_pm_initcall(void)
347 return 0; 347 return 0;
348} 348}
349arch_initcall(s3c64xx_pm_initcall); 349arch_initcall(s3c64xx_pm_initcall);
350
351int __init s3c64xx_pm_late_initcall(void)
352{
353 pm_genpd_poweroff_unused();
354
355 return 0;
356}
diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c
index 123163dd2ab0..21b4b13c5ab7 100644
--- a/arch/arm/mach-s5pv210/pm.c
+++ b/arch/arm/mach-s5pv210/pm.c
@@ -24,9 +24,8 @@
24 24
25#include <plat/pm-common.h> 25#include <plat/pm-common.h>
26 26
27#include <mach/regs-clock.h>
28
29#include "common.h" 27#include "common.h"
28#include "regs-clock.h"
30 29
31static struct sleep_save s5pv210_core_save[] = { 30static struct sleep_save s5pv210_core_save[] = {
32 /* Clock ETC */ 31 /* Clock ETC */
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-clock.h b/arch/arm/mach-s5pv210/regs-clock.h
index b14ffcd7f6cc..4640f0f03c12 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv210/regs-clock.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/regs-clock.h 1/*
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 3 * http://www.samsung.com/
5 * 4 *
diff --git a/arch/arm/mach-s5pv210/s5pv210.c b/arch/arm/mach-s5pv210/s5pv210.c
index 53feff33d129..43eb1eaea0c9 100644
--- a/arch/arm/mach-s5pv210/s5pv210.c
+++ b/arch/arm/mach-s5pv210/s5pv210.c
@@ -18,9 +18,9 @@
18#include <asm/system_misc.h> 18#include <asm/system_misc.h>
19 19
20#include <plat/map-base.h> 20#include <plat/map-base.h>
21#include <mach/regs-clock.h>
22 21
23#include "common.h" 22#include "common.h"
23#include "regs-clock.h"
24 24
25static int __init s5pv210_fdt_map_sys(unsigned long node, const char *uname, 25static int __init s5pv210_fdt_map_sys(unsigned long node, const char *uname,
26 int depth, void *data) 26 int depth, void *data)
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index 04f9784ff0ed..c6f6ed1cbed0 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -58,6 +58,7 @@ config SA1100_H3100
58 bool "Compaq iPAQ H3100" 58 bool "Compaq iPAQ H3100"
59 select ARM_SA1110_CPUFREQ 59 select ARM_SA1110_CPUFREQ
60 select HTC_EGPIO 60 select HTC_EGPIO
61 select MFD_IPAQ_MICRO
61 help 62 help
62 Say Y here if you intend to run this kernel on the Compaq iPAQ 63 Say Y here if you intend to run this kernel on the Compaq iPAQ
63 H3100 handheld computer. Information about this machine and the 64 H3100 handheld computer. Information about this machine and the
@@ -69,6 +70,7 @@ config SA1100_H3600
69 bool "Compaq iPAQ H3600/H3700" 70 bool "Compaq iPAQ H3600/H3700"
70 select ARM_SA1110_CPUFREQ 71 select ARM_SA1110_CPUFREQ
71 select HTC_EGPIO 72 select HTC_EGPIO
73 select MFD_IPAQ_MICRO
72 help 74 help
73 Say Y here if you intend to run this kernel on the Compaq iPAQ 75 Say Y here if you intend to run this kernel on the Compaq iPAQ
74 H3600 handheld computer. Information about this machine and the 76 H3600 handheld computer. Information about this machine and the
diff --git a/arch/arm/mach-sa1100/h3xxx.c b/arch/arm/mach-sa1100/h3xxx.c
index c79bf467fb7f..b1d4faa12f9a 100644
--- a/arch/arm/mach-sa1100/h3xxx.c
+++ b/arch/arm/mach-sa1100/h3xxx.c
@@ -25,6 +25,7 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <mach/h3xxx.h> 27#include <mach/h3xxx.h>
28#include <mach/irqs.h>
28 29
29#include "generic.h" 30#include "generic.h"
30 31
@@ -244,9 +245,23 @@ static struct platform_device h3xxx_keys = {
244 }, 245 },
245}; 246};
246 247
248static struct resource h3xxx_micro_resources[] = {
249 DEFINE_RES_MEM(0x80010000, SZ_4K),
250 DEFINE_RES_MEM(0x80020000, SZ_4K),
251 DEFINE_RES_IRQ(IRQ_Ser1UART),
252};
253
254struct platform_device h3xxx_micro_asic = {
255 .name = "ipaq-h3xxx-micro",
256 .id = -1,
257 .resource = h3xxx_micro_resources,
258 .num_resources = ARRAY_SIZE(h3xxx_micro_resources),
259};
260
247static struct platform_device *h3xxx_devices[] = { 261static struct platform_device *h3xxx_devices[] = {
248 &h3xxx_egpio, 262 &h3xxx_egpio,
249 &h3xxx_keys, 263 &h3xxx_keys,
264 &h3xxx_micro_asic,
250}; 265};
251 266
252void __init h3xxx_mach_init(void) 267void __init h3xxx_mach_init(void)
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index e15dff790dbb..21f457b56c01 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -1,6 +1,30 @@
1config ARCH_SHMOBILE 1config ARCH_SHMOBILE
2 bool 2 bool
3 3
4config PM_RCAR
5 bool
6
7config PM_RMOBILE
8 bool
9
10config ARCH_RCAR_GEN1
11 bool
12 select PM_RCAR if PM || SMP
13 select RENESAS_INTC_IRQPIN
14 select SYS_SUPPORTS_SH_TMU
15
16config ARCH_RCAR_GEN2
17 bool
18 select PM_RCAR if PM || SMP
19 select RENESAS_IRQC
20 select SYS_SUPPORTS_SH_CMT
21
22config ARCH_RMOBILE
23 bool
24 select PM_RMOBILE if PM && !ARCH_SHMOBILE_MULTI
25 select SYS_SUPPORTS_SH_CMT
26 select SYS_SUPPORTS_SH_TMU
27
4menuconfig ARCH_SHMOBILE_MULTI 28menuconfig ARCH_SHMOBILE_MULTI
5 bool "Renesas ARM SoCs" if ARCH_MULTI_V7 29 bool "Renesas ARM SoCs" if ARCH_MULTI_V7
6 depends on MMU 30 depends on MMU
@@ -26,26 +50,28 @@ config ARCH_R7S72100
26 bool "RZ/A1H (R7S72100)" 50 bool "RZ/A1H (R7S72100)"
27 select SYS_SUPPORTS_SH_MTU2 51 select SYS_SUPPORTS_SH_MTU2
28 52
53config ARCH_R8A7740
54 bool "R-Mobile A1 (R8A77400)"
55 select ARCH_RMOBILE
56 select RENESAS_INTC_IRQPIN
57
29config ARCH_R8A7779 58config ARCH_R8A7779
30 bool "R-Car H1 (R8A77790)" 59 bool "R-Car H1 (R8A77790)"
31 select RENESAS_INTC_IRQPIN 60 select ARCH_RCAR_GEN1
32 select SYS_SUPPORTS_SH_TMU
33 61
34config ARCH_R8A7790 62config ARCH_R8A7790
35 bool "R-Car H2 (R8A77900)" 63 bool "R-Car H2 (R8A77900)"
36 select RENESAS_IRQC 64 select ARCH_RCAR_GEN2
37 select SYS_SUPPORTS_SH_CMT
38 65
39config ARCH_R8A7791 66config ARCH_R8A7791
40 bool "R-Car M2 (R8A77910)" 67 bool "R-Car M2-W (R8A77910)"
41 select RENESAS_IRQC 68 select ARCH_RCAR_GEN2
42 select SYS_SUPPORTS_SH_CMT
43 69
44comment "Renesas ARM SoCs Board Type" 70config ARCH_R8A7794
71 bool "R-Car E2 (R8A77940)"
72 select ARCH_RCAR_GEN2
45 73
46config MACH_GENMAI 74comment "Renesas ARM SoCs Board Type"
47 bool "Genmai board"
48 depends on ARCH_R7S72100
49 75
50config MACH_KOELSCH 76config MACH_KOELSCH
51 bool "Koelsch board" 77 bool "Koelsch board"
@@ -71,92 +97,62 @@ comment "Renesas ARM SoCs System Type"
71 97
72config ARCH_SH7372 98config ARCH_SH7372
73 bool "SH-Mobile AP4 (SH7372)" 99 bool "SH-Mobile AP4 (SH7372)"
100 select ARCH_RMOBILE
74 select ARCH_WANT_OPTIONAL_GPIOLIB 101 select ARCH_WANT_OPTIONAL_GPIOLIB
75 select ARM_CPU_SUSPEND if PM || CPU_IDLE 102 select ARM_CPU_SUSPEND if PM || CPU_IDLE
76 select CPU_V7 103 select SH_INTC
77 select SH_CLK_CPG
78 select SYS_SUPPORTS_SH_CMT
79 select SYS_SUPPORTS_SH_TMU
80 104
81config ARCH_SH73A0 105config ARCH_SH73A0
82 bool "SH-Mobile AG5 (R8A73A00)" 106 bool "SH-Mobile AG5 (R8A73A00)"
107 select ARCH_RMOBILE
83 select ARCH_WANT_OPTIONAL_GPIOLIB 108 select ARCH_WANT_OPTIONAL_GPIOLIB
84 select ARM_GIC 109 select ARM_GIC
85 select CPU_V7
86 select I2C 110 select I2C
87 select SH_CLK_CPG 111 select SH_INTC
88 select RENESAS_INTC_IRQPIN 112 select RENESAS_INTC_IRQPIN
89 select SYS_SUPPORTS_SH_CMT
90 select SYS_SUPPORTS_SH_TMU
91 113
92config ARCH_R8A73A4 114config ARCH_R8A73A4
93 bool "R-Mobile APE6 (R8A73A40)" 115 bool "R-Mobile APE6 (R8A73A40)"
116 select ARCH_RMOBILE
94 select ARCH_WANT_OPTIONAL_GPIOLIB 117 select ARCH_WANT_OPTIONAL_GPIOLIB
95 select ARM_GIC 118 select ARM_GIC
96 select CPU_V7
97 select SH_CLK_CPG
98 select RENESAS_IRQC 119 select RENESAS_IRQC
99 select SYS_SUPPORTS_SH_CMT
100 select SYS_SUPPORTS_SH_TMU
101 120
102config ARCH_R8A7740 121config ARCH_R8A7740
103 bool "R-Mobile A1 (R8A77400)" 122 bool "R-Mobile A1 (R8A77400)"
123 select ARCH_RMOBILE
104 select ARCH_WANT_OPTIONAL_GPIOLIB 124 select ARCH_WANT_OPTIONAL_GPIOLIB
105 select ARM_GIC 125 select ARM_GIC
106 select CPU_V7
107 select SH_CLK_CPG
108 select RENESAS_INTC_IRQPIN 126 select RENESAS_INTC_IRQPIN
109 select SYS_SUPPORTS_SH_CMT
110 select SYS_SUPPORTS_SH_TMU
111 127
112config ARCH_R8A7778 128config ARCH_R8A7778
113 bool "R-Car M1A (R8A77781)" 129 bool "R-Car M1A (R8A77781)"
130 select ARCH_RCAR_GEN1
114 select ARCH_WANT_OPTIONAL_GPIOLIB 131 select ARCH_WANT_OPTIONAL_GPIOLIB
115 select CPU_V7
116 select SH_CLK_CPG
117 select ARM_GIC 132 select ARM_GIC
118 select SYS_SUPPORTS_SH_TMU
119 select RENESAS_INTC_IRQPIN
120 133
121config ARCH_R8A7779 134config ARCH_R8A7779
122 bool "R-Car H1 (R8A77790)" 135 bool "R-Car H1 (R8A77790)"
136 select ARCH_RCAR_GEN1
123 select ARCH_WANT_OPTIONAL_GPIOLIB 137 select ARCH_WANT_OPTIONAL_GPIOLIB
124 select ARM_GIC 138 select ARM_GIC
125 select CPU_V7
126 select SH_CLK_CPG
127 select RENESAS_INTC_IRQPIN
128 select SYS_SUPPORTS_SH_TMU
129 139
130config ARCH_R8A7790 140config ARCH_R8A7790
131 bool "R-Car H2 (R8A77900)" 141 bool "R-Car H2 (R8A77900)"
142 select ARCH_RCAR_GEN2
132 select ARCH_WANT_OPTIONAL_GPIOLIB 143 select ARCH_WANT_OPTIONAL_GPIOLIB
133 select ARM_GIC 144 select ARM_GIC
134 select CPU_V7
135 select MIGHT_HAVE_PCI 145 select MIGHT_HAVE_PCI
136 select SH_CLK_CPG
137 select RENESAS_IRQC
138 select SYS_SUPPORTS_SH_CMT
139 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 146 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
140 147
141config ARCH_R8A7791 148config ARCH_R8A7791
142 bool "R-Car M2 (R8A77910)" 149 bool "R-Car M2-W (R8A77910)"
150 select ARCH_RCAR_GEN2
143 select ARCH_WANT_OPTIONAL_GPIOLIB 151 select ARCH_WANT_OPTIONAL_GPIOLIB
144 select ARM_GIC 152 select ARM_GIC
145 select CPU_V7
146 select MIGHT_HAVE_PCI 153 select MIGHT_HAVE_PCI
147 select SH_CLK_CPG
148 select RENESAS_IRQC
149 select SYS_SUPPORTS_SH_CMT
150 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 154 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
151 155
152config ARCH_R7S72100
153 bool "RZ/A1H (R7S72100)"
154 select ARCH_WANT_OPTIONAL_GPIOLIB
155 select ARM_GIC
156 select CPU_V7
157 select SH_CLK_CPG
158 select SYS_SUPPORTS_SH_MTU2
159
160comment "Renesas ARM SoCs Board Type" 156comment "Renesas ARM SoCs Board Type"
161 157
162config MACH_APE6EVM 158config MACH_APE6EVM
@@ -195,21 +191,6 @@ config MACH_ARMADILLO800EVA
195 select SND_SOC_WM8978 if SND_SIMPLE_CARD 191 select SND_SOC_WM8978 if SND_SIMPLE_CARD
196 select USE_OF 192 select USE_OF
197 193
198config MACH_ARMADILLO800EVA_REFERENCE
199 bool "Armadillo-800 EVA board - Reference Device Tree Implementation"
200 depends on ARCH_R8A7740
201 select ARCH_REQUIRE_GPIOLIB
202 select REGULATOR_FIXED_VOLTAGE if REGULATOR
203 select SMSC_PHY if SH_ETH
204 select SND_SOC_WM8978 if SND_SIMPLE_CARD
205 select USE_OF
206 ---help---
207 Use reference implementation of Armadillo800 EVA board support
208 which makes greater use of device tree at the expense
209 of not supporting a number of devices.
210
211 This is intended to aid developers
212
213config MACH_BOCKW 194config MACH_BOCKW
214 bool "BOCK-W platform" 195 bool "BOCK-W platform"
215 depends on ARCH_R8A7778 196 depends on ARCH_R8A7778
@@ -232,11 +213,6 @@ config MACH_BOCKW_REFERENCE
232 213
233 This is intended to aid developers 214 This is intended to aid developers
234 215
235config MACH_GENMAI
236 bool "Genmai board"
237 depends on ARCH_R7S72100
238 select USE_OF
239
240config MACH_MARZEN 216config MACH_MARZEN
241 bool "MARZEN board" 217 bool "MARZEN board"
242 depends on ARCH_R8A7779 218 depends on ARCH_R8A7779
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index fe3878a1a69a..e20f2786ec72 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -2,21 +2,19 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/arch/arm/mach-shmobile/include
6
7# Common objects 5# Common objects
8obj-y := timer.o console.o 6obj-y := timer.o console.o
9 7
10# CPU objects 8# CPU objects
11obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o intc-sh7372.o 9obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o intc-sh7372.o pm-sh7372.o
12obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o intc-sh73a0.o 10obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o intc-sh73a0.o pm-sh73a0.o
13obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o 11obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o
14obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o 12obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o pm-r8a7740.o
15obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o 13obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
16obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o 14obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o
17obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o 15obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o pm-r8a7790.o
18obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o setup-rcar-gen2.o 16obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o pm-r8a7791.o
19obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o setup-rcar-gen2.o 17obj-$(CONFIG_ARCH_R8A7794) += setup-r8a7794.o
20obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o 18obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
21obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o 19obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
22 20
@@ -31,13 +29,13 @@ obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
31obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o 29obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
32obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o 30obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o
33obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o 31obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o
34obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o
35endif 32endif
36 33
37# CPU reset vector handling objects 34# CPU reset vector handling objects
38cpu-y := platsmp.o headsmp.o 35cpu-y := platsmp.o headsmp.o
39cpu-$(CONFIG_ARCH_R8A7790) += platsmp-apmu.o 36
40cpu-$(CONFIG_ARCH_R8A7791) += platsmp-apmu.o 37# Shared SoC family objects
38obj-$(CONFIG_ARCH_RCAR_GEN2) += setup-rcar-gen2.o platsmp-apmu.o $(cpu-y)
41 39
42# SMP objects 40# SMP objects
43smp-y := $(cpu-y) 41smp-y := $(cpu-y)
@@ -51,19 +49,14 @@ smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
51obj-$(CONFIG_SUSPEND) += suspend.o 49obj-$(CONFIG_SUSPEND) += suspend.o
52obj-$(CONFIG_CPU_IDLE) += cpuidle.o 50obj-$(CONFIG_CPU_IDLE) += cpuidle.o
53obj-$(CONFIG_CPU_FREQ) += cpufreq.o 51obj-$(CONFIG_CPU_FREQ) += cpufreq.o
54obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o 52obj-$(CONFIG_PM_RCAR) += pm-rcar.o
55obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o 53obj-$(CONFIG_PM_RMOBILE) += pm-rmobile.o
56obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o
57obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o pm-rcar.o
58obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o $(cpu-y)
59obj-$(CONFIG_ARCH_R8A7791) += pm-r8a7791.o pm-rcar.o $(cpu-y)
60 54
61# IRQ objects 55# special sh7372 handling for IRQ objects and low level sleep code
62obj-$(CONFIG_ARCH_SH7372) += entry-intc.o 56obj-$(CONFIG_ARCH_SH7372) += entry-intc.o sleep-sh7372.o
63 57
64# Board objects 58# Board objects
65ifdef CONFIG_ARCH_SHMOBILE_MULTI 59ifdef CONFIG_ARCH_SHMOBILE_MULTI
66obj-$(CONFIG_MACH_GENMAI) += board-genmai-reference.o
67obj-$(CONFIG_MACH_KOELSCH) += board-koelsch-reference.o 60obj-$(CONFIG_MACH_KOELSCH) += board-koelsch-reference.o
68obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o 61obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o
69obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o 62obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o
@@ -73,11 +66,9 @@ obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o
73obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o 66obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
74obj-$(CONFIG_MACH_BOCKW) += board-bockw.o 67obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
75obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o 68obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
76obj-$(CONFIG_MACH_GENMAI) += board-genmai.o
77obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 69obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
78obj-$(CONFIG_MACH_LAGER) += board-lager.o 70obj-$(CONFIG_MACH_LAGER) += board-lager.o
79obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 71obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
80obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o
81obj-$(CONFIG_MACH_KOELSCH) += board-koelsch.o 72obj-$(CONFIG_MACH_KOELSCH) += board-koelsch.o
82obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 73obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
83obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o 74obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index ebf97d4bcfd8..de9a23852fc8 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -3,10 +3,8 @@ loadaddr-y :=
3loadaddr-$(CONFIG_MACH_APE6EVM) += 0x40008000 3loadaddr-$(CONFIG_MACH_APE6EVM) += 0x40008000
4loadaddr-$(CONFIG_MACH_APE6EVM_REFERENCE) += 0x40008000 4loadaddr-$(CONFIG_MACH_APE6EVM_REFERENCE) += 0x40008000
5loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000 5loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
6loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
7loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000 6loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
8loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000 7loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
9loadaddr-$(CONFIG_MACH_GENMAI) += 0x08008000
10loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000 8loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000
11loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000 9loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
12loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000 10loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
diff --git a/arch/arm/mach-shmobile/board-ape6evm-reference.c b/arch/arm/mach-shmobile/board-ape6evm-reference.c
index 2f7723e5fe91..a6503d8c77de 100644
--- a/arch/arm/mach-shmobile/board-ape6evm-reference.c
+++ b/arch/arm/mach-shmobile/board-ape6evm-reference.c
@@ -50,7 +50,6 @@ static void __init ape6evm_add_standard_devices(void)
50 50
51 r8a73a4_add_dt_devices(); 51 r8a73a4_add_dt_devices();
52 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 52 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
53 platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0);
54} 53}
55 54
56static const char *ape6evm_boards_compat_dt[] __initdata = { 55static const char *ape6evm_boards_compat_dt[] __initdata = {
@@ -59,7 +58,8 @@ static const char *ape6evm_boards_compat_dt[] __initdata = {
59}; 58};
60 59
61DT_MACHINE_START(APE6EVM_DT, "ape6evm") 60DT_MACHINE_START(APE6EVM_DT, "ape6evm")
62 .init_early = r8a73a4_init_early, 61 .init_early = shmobile_init_delay,
63 .init_machine = ape6evm_add_standard_devices, 62 .init_machine = ape6evm_add_standard_devices,
63 .init_late = shmobile_init_late,
64 .dt_compat = ape6evm_boards_compat_dt, 64 .dt_compat = ape6evm_boards_compat_dt,
65MACHINE_END 65MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index 1585b8830b13..b222f68d55b7 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -283,7 +283,8 @@ static const char *ape6evm_boards_compat_dt[] __initdata = {
283}; 283};
284 284
285DT_MACHINE_START(APE6EVM_DT, "ape6evm") 285DT_MACHINE_START(APE6EVM_DT, "ape6evm")
286 .init_early = r8a73a4_init_early, 286 .init_early = shmobile_init_delay,
287 .init_machine = ape6evm_add_standard_devices, 287 .init_machine = ape6evm_add_standard_devices,
288 .init_late = shmobile_init_late,
288 .dt_compat = ape6evm_boards_compat_dt, 289 .dt_compat = ape6evm_boards_compat_dt,
289MACHINE_END 290MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
deleted file mode 100644
index 84bc6cb6d5aa..000000000000
--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+++ /dev/null
@@ -1,198 +0,0 @@
1/*
2 * armadillo 800 eva board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.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; version 2 of the License.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/err.h>
24#include <linux/kernel.h>
25#include <linux/gpio.h>
26#include <linux/io.h>
27
28#include <asm/mach/arch.h>
29#include <asm/hardware/cache-l2x0.h>
30
31#include "common.h"
32#include "r8a7740.h"
33
34/*
35 * CON1 Camera Module
36 * CON2 Extension Bus
37 * CON3 HDMI Output
38 * CON4 Composite Video Output
39 * CON5 H-UDI JTAG
40 * CON6 ARM JTAG
41 * CON7 SD1
42 * CON8 SD2
43 * CON9 RTC BackUp
44 * CON10 Monaural Mic Input
45 * CON11 Stereo Headphone Output
46 * CON12 Audio Line Output(L)
47 * CON13 Audio Line Output(R)
48 * CON14 AWL13 Module
49 * CON15 Extension
50 * CON16 LCD1
51 * CON17 LCD2
52 * CON19 Power Input
53 * CON20 USB1
54 * CON21 USB2
55 * CON22 Serial
56 * CON23 LAN
57 * CON24 USB3
58 * LED1 Camera LED (Yellow)
59 * LED2 Power LED (Green)
60 * LED3-LED6 User LED (Yellow)
61 * LED7 LAN link LED (Green)
62 * LED8 LAN activity LED (Yellow)
63 */
64
65/*
66 * DipSwitch
67 *
68 * SW1
69 *
70 * -12345678-+---------------+----------------------------
71 * 1 | boot | hermit
72 * 0 | boot | OS auto boot
73 * -12345678-+---------------+----------------------------
74 * 00 | boot device | eMMC
75 * 10 | boot device | SDHI0 (CON7)
76 * 01 | boot device | -
77 * 11 | boot device | Extension Buss (CS0)
78 * -12345678-+---------------+----------------------------
79 * 0 | Extension Bus | D8-D15 disable, eMMC enable
80 * 1 | Extension Bus | D8-D15 enable, eMMC disable
81 * -12345678-+---------------+----------------------------
82 * 0 | SDHI1 | COM8 disable, COM14 enable
83 * 1 | SDHI1 | COM8 enable, COM14 disable
84 * -12345678-+---------------+----------------------------
85 * 0 | USB0 | COM20 enable, COM24 disable
86 * 1 | USB0 | COM20 disable, COM24 enable
87 * -12345678-+---------------+----------------------------
88 * 00 | JTAG | SH-X2
89 * 10 | JTAG | ARM
90 * 01 | JTAG | -
91 * 11 | JTAG | Boundary Scan
92 *-----------+---------------+----------------------------
93 */
94
95/*
96 * FSI-WM8978
97 *
98 * this command is required when playback.
99 *
100 * # amixer set "Headphone" 50
101 *
102 * this command is required when capture.
103 *
104 * # amixer set "Input PGA" 15
105 * # amixer set "Left Input Mixer MicP" on
106 * # amixer set "Left Input Mixer MicN" on
107 * # amixer set "Right Input Mixer MicN" on
108 * # amixer set "Right Input Mixer MicP" on
109 */
110
111/*
112 * USB function
113 *
114 * When you use USB Function,
115 * set SW1.6 ON, and connect cable to CN24.
116 *
117 * USBF needs workaround on R8A7740 chip.
118 * These are a little bit complex.
119 * see
120 * usbhsf_power_ctrl()
121 */
122
123static void __init eva_clock_init(void)
124{
125 struct clk *system = clk_get(NULL, "system_clk");
126 struct clk *xtal1 = clk_get(NULL, "extal1");
127 struct clk *usb24s = clk_get(NULL, "usb24s");
128 struct clk *fsibck = clk_get(NULL, "fsibck");
129
130 if (IS_ERR(system) ||
131 IS_ERR(xtal1) ||
132 IS_ERR(usb24s) ||
133 IS_ERR(fsibck)) {
134 pr_err("armadillo800eva board clock init failed\n");
135 goto clock_error;
136 }
137
138 /* armadillo 800 eva extal1 is 24MHz */
139 clk_set_rate(xtal1, 24000000);
140
141 /* usb24s use extal1 (= system) clock (= 24MHz) */
142 clk_set_parent(usb24s, system);
143
144 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
145 clk_set_rate(fsibck, 12288000);
146
147clock_error:
148 if (!IS_ERR(system))
149 clk_put(system);
150 if (!IS_ERR(xtal1))
151 clk_put(xtal1);
152 if (!IS_ERR(usb24s))
153 clk_put(usb24s);
154 if (!IS_ERR(fsibck))
155 clk_put(fsibck);
156}
157
158/*
159 * board init
160 */
161static void __init eva_init(void)
162{
163 r8a7740_clock_init(MD_CK0 | MD_CK2);
164 eva_clock_init();
165
166 r8a7740_meram_workaround();
167
168#ifdef CONFIG_CACHE_L2X0
169 /* Shared attribute override enable, 32K*8way */
170 l2x0_init(IOMEM(0xf0002000), 0x00400000, 0xc20f0fff);
171#endif
172
173 r8a7740_add_standard_devices_dt();
174
175 r8a7740_pm_init();
176}
177
178#define RESCNT2 IOMEM(0xe6188020)
179static void eva_restart(enum reboot_mode mode, const char *cmd)
180{
181 /* Do soft power on reset */
182 writel(1 << 31, RESCNT2);
183}
184
185static const char *eva_boards_compat_dt[] __initdata = {
186 "renesas,armadillo800eva-reference",
187 NULL,
188};
189
190DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference")
191 .map_io = r8a7740_map_io,
192 .init_early = shmobile_init_delay,
193 .init_irq = r8a7740_init_irq_of,
194 .init_machine = eva_init,
195 .init_late = shmobile_init_late,
196 .dt_compat = eva_boards_compat_dt,
197 .restart = eva_restart,
198MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 6dbaad611a92..e70983534403 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1231,6 +1231,10 @@ clock_error:
1231#define GPIO_PORT8CR IOMEM(0xe6050008) 1231#define GPIO_PORT8CR IOMEM(0xe6050008)
1232static void __init eva_init(void) 1232static void __init eva_init(void)
1233{ 1233{
1234 static struct pm_domain_device domain_devices[] __initdata = {
1235 { "A4LC", &lcdc0_device },
1236 { "A4LC", &hdmi_lcdc_device },
1237 };
1234 struct platform_device *usb = NULL; 1238 struct platform_device *usb = NULL;
1235 1239
1236 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 1240 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
@@ -1316,8 +1320,8 @@ static void __init eva_init(void)
1316 platform_add_devices(eva_devices, 1320 platform_add_devices(eva_devices,
1317 ARRAY_SIZE(eva_devices)); 1321 ARRAY_SIZE(eva_devices));
1318 1322
1319 rmobile_add_device_to_domain("A4LC", &lcdc0_device); 1323 rmobile_add_devices_to_domains(domain_devices,
1320 rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device); 1324 ARRAY_SIZE(domain_devices));
1321 if (usb) 1325 if (usb)
1322 rmobile_add_device_to_domain("A3SP", usb); 1326 rmobile_add_device_to_domain("A3SP", usb);
1323 1327
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
index ba840cd333b9..79c47847f200 100644
--- a/arch/arm/mach-shmobile/board-bockw-reference.c
+++ b/arch/arm/mach-shmobile/board-bockw-reference.c
@@ -80,8 +80,9 @@ static const char *bockw_boards_compat_dt[] __initdata = {
80}; 80};
81 81
82DT_MACHINE_START(BOCKW_DT, "bockw") 82DT_MACHINE_START(BOCKW_DT, "bockw")
83 .init_early = r8a7778_init_delay, 83 .init_early = shmobile_init_delay,
84 .init_irq = r8a7778_init_irq_dt, 84 .init_irq = r8a7778_init_irq_dt,
85 .init_machine = bockw_init, 85 .init_machine = bockw_init,
86 .init_late = shmobile_init_late,
86 .dt_compat = bockw_boards_compat_dt, 87 .dt_compat = bockw_boards_compat_dt,
87MACHINE_END 88MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 8a83eb39d3f1..1cf2c75dacfb 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -733,7 +733,7 @@ static const char *bockw_boards_compat_dt[] __initdata = {
733}; 733};
734 734
735DT_MACHINE_START(BOCKW_DT, "bockw") 735DT_MACHINE_START(BOCKW_DT, "bockw")
736 .init_early = r8a7778_init_delay, 736 .init_early = shmobile_init_delay,
737 .init_irq = r8a7778_init_irq_dt, 737 .init_irq = r8a7778_init_irq_dt,
738 .init_machine = bockw_init, 738 .init_machine = bockw_init,
739 .dt_compat = bockw_boards_compat_dt, 739 .dt_compat = bockw_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
deleted file mode 100644
index e5448f7b868a..000000000000
--- a/arch/arm/mach-shmobile/board-genmai-reference.c
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Genmai board support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
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; version 2 of the License.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/of_platform.h>
23
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27#include "clock.h"
28#include "common.h"
29#include "r7s72100.h"
30
31/*
32 * This is a really crude hack to provide clkdev support to platform
33 * devices until they get moved to DT.
34 */
35static const struct clk_name clk_names[] = {
36 { "mtu2", "fck", "sh-mtu2" },
37};
38
39static void __init genmai_add_standard_devices(void)
40{
41 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), true);
42 r7s72100_add_dt_devices();
43 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
44}
45
46static const char * const genmai_boards_compat_dt[] __initconst = {
47 "renesas,genmai",
48 NULL,
49};
50
51DT_MACHINE_START(GENMAI_DT, "genmai")
52 .init_early = shmobile_init_delay,
53 .init_machine = genmai_add_standard_devices,
54 .dt_compat = genmai_boards_compat_dt,
55MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
deleted file mode 100644
index 7bf2d8057535..000000000000
--- a/arch/arm/mach-shmobile/board-genmai.c
+++ /dev/null
@@ -1,161 +0,0 @@
1/*
2 * Genmai board support
3 *
4 * Copyright (C) 2013-2014 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
6 * Copyright (C) 2014 Cogent Embedded, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; 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/kernel.h>
23#include <linux/platform_device.h>
24#include <linux/serial_sci.h>
25#include <linux/sh_eth.h>
26#include <linux/spi/rspi.h>
27#include <linux/spi/spi.h>
28
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31
32#include "common.h"
33#include "irqs.h"
34#include "r7s72100.h"
35
36/* Ether */
37static const struct sh_eth_plat_data ether_pdata __initconst = {
38 .phy = 0x00, /* PD60610 */
39 .edmac_endian = EDMAC_LITTLE_ENDIAN,
40 .phy_interface = PHY_INTERFACE_MODE_MII,
41 .no_ether_link = 1
42};
43
44static const struct resource ether_resources[] __initconst = {
45 DEFINE_RES_MEM(0xe8203000, 0x800),
46 DEFINE_RES_MEM(0xe8204800, 0x200),
47 DEFINE_RES_IRQ(gic_iid(359)),
48};
49
50static const struct platform_device_info ether_info __initconst = {
51 .name = "r7s72100-ether",
52 .id = -1,
53 .res = ether_resources,
54 .num_res = ARRAY_SIZE(ether_resources),
55 .data = &ether_pdata,
56 .size_data = sizeof(ether_pdata),
57 .dma_mask = DMA_BIT_MASK(32),
58};
59
60/* RSPI */
61#define RSPI_RESOURCE(idx, baseaddr, irq) \
62static const struct resource rspi##idx##_resources[] __initconst = { \
63 DEFINE_RES_MEM(baseaddr, 0x24), \
64 DEFINE_RES_IRQ_NAMED(irq, "error"), \
65 DEFINE_RES_IRQ_NAMED(irq + 1, "rx"), \
66 DEFINE_RES_IRQ_NAMED(irq + 2, "tx"), \
67}
68
69RSPI_RESOURCE(0, 0xe800c800, gic_iid(270));
70RSPI_RESOURCE(1, 0xe800d000, gic_iid(273));
71RSPI_RESOURCE(2, 0xe800d800, gic_iid(276));
72RSPI_RESOURCE(3, 0xe800e000, gic_iid(279));
73RSPI_RESOURCE(4, 0xe800e800, gic_iid(282));
74
75static const struct rspi_plat_data rspi_pdata __initconst = {
76 .num_chipselect = 1,
77};
78
79#define r7s72100_register_rspi(idx) \
80 platform_device_register_resndata(NULL, "rspi-rz", idx, \
81 rspi##idx##_resources, \
82 ARRAY_SIZE(rspi##idx##_resources), \
83 &rspi_pdata, sizeof(rspi_pdata))
84
85static const struct spi_board_info spi_info[] __initconst = {
86 {
87 .modalias = "wm8978",
88 .max_speed_hz = 5000000,
89 .bus_num = 4,
90 .chip_select = 0,
91 },
92};
93
94/* SCIF */
95#define R7S72100_SCIF(index, baseaddr, irq) \
96static const struct plat_sci_port scif##index##_platform_data = { \
97 .type = PORT_SCIF, \
98 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, \
99 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
100 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | \
101 SCSCR_REIE, \
102}; \
103 \
104static struct resource scif##index##_resources[] = { \
105 DEFINE_RES_MEM(baseaddr, 0x100), \
106 DEFINE_RES_IRQ(irq + 1), \
107 DEFINE_RES_IRQ(irq + 2), \
108 DEFINE_RES_IRQ(irq + 3), \
109 DEFINE_RES_IRQ(irq), \
110} \
111
112R7S72100_SCIF(0, 0xe8007000, gic_iid(221));
113R7S72100_SCIF(1, 0xe8007800, gic_iid(225));
114R7S72100_SCIF(2, 0xe8008000, gic_iid(229));
115R7S72100_SCIF(3, 0xe8008800, gic_iid(233));
116R7S72100_SCIF(4, 0xe8009000, gic_iid(237));
117R7S72100_SCIF(5, 0xe8009800, gic_iid(241));
118R7S72100_SCIF(6, 0xe800a000, gic_iid(245));
119R7S72100_SCIF(7, 0xe800a800, gic_iid(249));
120
121#define r7s72100_register_scif(index) \
122 platform_device_register_resndata(NULL, "sh-sci", index, \
123 scif##index##_resources, \
124 ARRAY_SIZE(scif##index##_resources), \
125 &scif##index##_platform_data, \
126 sizeof(scif##index##_platform_data))
127
128static void __init genmai_add_standard_devices(void)
129{
130 r7s72100_clock_init();
131 r7s72100_add_dt_devices();
132
133 platform_device_register_full(&ether_info);
134
135 r7s72100_register_rspi(0);
136 r7s72100_register_rspi(1);
137 r7s72100_register_rspi(2);
138 r7s72100_register_rspi(3);
139 r7s72100_register_rspi(4);
140 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
141
142 r7s72100_register_scif(0);
143 r7s72100_register_scif(1);
144 r7s72100_register_scif(2);
145 r7s72100_register_scif(3);
146 r7s72100_register_scif(4);
147 r7s72100_register_scif(5);
148 r7s72100_register_scif(6);
149 r7s72100_register_scif(7);
150}
151
152static const char * const genmai_boards_compat_dt[] __initconst = {
153 "renesas,genmai",
154 NULL,
155};
156
157DT_MACHINE_START(GENMAI_DT, "genmai")
158 .init_early = shmobile_init_delay,
159 .init_machine = genmai_add_standard_devices,
160 .dt_compat = genmai_boards_compat_dt,
161MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
index 3ff88c138896..9db5e6774fb7 100644
--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
+++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
@@ -88,7 +88,6 @@ static void __init koelsch_add_du_device(void)
88 * devices until they get moved to DT. 88 * devices until they get moved to DT.
89 */ 89 */
90static const struct clk_name clk_names[] __initconst = { 90static const struct clk_name clk_names[] __initconst = {
91 { "cmt0", "fck", "sh-cmt-48-gen2.0" },
92 { "du0", "du.0", "rcar-du-r8a7791" }, 91 { "du0", "du.0", "rcar-du-r8a7791" },
93 { "du1", "du.1", "rcar-du-r8a7791" }, 92 { "du1", "du.1", "rcar-du-r8a7791" },
94 { "lvds0", "lvds.0", "rcar-du-r8a7791" }, 93 { "lvds0", "lvds.0", "rcar-du-r8a7791" },
@@ -97,7 +96,6 @@ static const struct clk_name clk_names[] __initconst = {
97static void __init koelsch_add_standard_devices(void) 96static void __init koelsch_add_standard_devices(void)
98{ 97{
99 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false); 98 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
100 r8a7791_add_dt_devices();
101 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 99 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
102 100
103 koelsch_add_du_device(); 101 koelsch_add_du_device();
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
index 5d2621f202d1..d9cdf9a97e23 100644
--- a/arch/arm/mach-shmobile/board-kzm9g-reference.c
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -51,8 +51,8 @@ static const char *kzm9g_boards_compat_dt[] __initdata = {
51DT_MACHINE_START(KZM9G_DT, "kzm9g-reference") 51DT_MACHINE_START(KZM9G_DT, "kzm9g-reference")
52 .smp = smp_ops(sh73a0_smp_ops), 52 .smp = smp_ops(sh73a0_smp_ops),
53 .map_io = sh73a0_map_io, 53 .map_io = sh73a0_map_io,
54 .init_early = sh73a0_init_delay, 54 .init_early = shmobile_init_delay,
55 .nr_irqs = NR_IRQS_LEGACY,
56 .init_machine = kzm_init, 55 .init_machine = kzm_init,
56 .init_late = shmobile_init_late,
57 .dt_compat = kzm9g_boards_compat_dt, 57 .dt_compat = kzm9g_boards_compat_dt,
58MACHINE_END 58MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index f8bc7f8f86ad..77e36fa0b142 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -50,6 +50,7 @@
50#include <video/sh_mobile_lcdc.h> 50#include <video/sh_mobile_lcdc.h>
51 51
52#include "common.h" 52#include "common.h"
53#include "intc.h"
53#include "irqs.h" 54#include "irqs.h"
54#include "sh73a0.h" 55#include "sh73a0.h"
55 56
@@ -910,7 +911,6 @@ DT_MACHINE_START(KZM9G_DT, "kzm9g")
910 .smp = smp_ops(sh73a0_smp_ops), 911 .smp = smp_ops(sh73a0_smp_ops),
911 .map_io = sh73a0_map_io, 912 .map_io = sh73a0_map_io,
912 .init_early = sh73a0_add_early_devices, 913 .init_early = sh73a0_add_early_devices,
913 .nr_irqs = NR_IRQS_LEGACY,
914 .init_irq = sh73a0_init_irq, 914 .init_irq = sh73a0_init_irq,
915 .init_machine = kzm_init, 915 .init_machine = kzm_init,
916 .init_late = shmobile_init_late, 916 .init_late = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index 41c808e56005..2a05c02bec39 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -92,7 +92,6 @@ static void __init lager_add_du_device(void)
92 * devices until they get moved to DT. 92 * devices until they get moved to DT.
93 */ 93 */
94static const struct clk_name clk_names[] __initconst = { 94static const struct clk_name clk_names[] __initconst = {
95 { "cmt0", "fck", "sh-cmt-48-gen2.0" },
96 { "du0", "du.0", "rcar-du-r8a7790" }, 95 { "du0", "du.0", "rcar-du-r8a7790" },
97 { "du1", "du.1", "rcar-du-r8a7790" }, 96 { "du1", "du.1", "rcar-du-r8a7790" },
98 { "du2", "du.2", "rcar-du-r8a7790" }, 97 { "du2", "du.2", "rcar-du-r8a7790" },
@@ -103,7 +102,6 @@ static const struct clk_name clk_names[] __initconst = {
103static void __init lager_add_standard_devices(void) 102static void __init lager_add_standard_devices(void)
104{ 103{
105 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false); 104 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
106 r8a7790_add_dt_devices();
107 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 105 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
108 106
109 lager_add_du_device(); 107 lager_add_du_device();
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 79f448e93abb..ca5d34b92aa7 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -63,6 +63,7 @@
63#include <asm/mach-types.h> 63#include <asm/mach-types.h>
64 64
65#include "common.h" 65#include "common.h"
66#include "intc.h"
66#include "irqs.h" 67#include "irqs.h"
67#include "pm-rmobile.h" 68#include "pm-rmobile.h"
68#include "sh-gpio.h" 69#include "sh-gpio.h"
@@ -1420,7 +1421,7 @@ static const struct pinctrl_map mackerel_pinctrl_map[] = {
1420#define USCCR1 IOMEM(0xE6058144) 1421#define USCCR1 IOMEM(0xE6058144)
1421static void __init mackerel_init(void) 1422static void __init mackerel_init(void)
1422{ 1423{
1423 struct pm_domain_device domain_devices[] = { 1424 static struct pm_domain_device domain_devices[] __initdata = {
1424 { "A4LC", &lcdc_device, }, 1425 { "A4LC", &lcdc_device, },
1425 { "A4LC", &hdmi_lcdc_device, }, 1426 { "A4LC", &hdmi_lcdc_device, },
1426 { "A4LC", &meram_device, }, 1427 { "A4LC", &meram_device, },
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
index 21b3e1ca2261..38d9cdd26587 100644
--- a/arch/arm/mach-shmobile/board-marzen-reference.c
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -37,18 +37,8 @@ static void __init marzen_init_timer(void)
37 clocksource_of_init(); 37 clocksource_of_init();
38} 38}
39 39
40/*
41 * This is a really crude hack to provide clkdev support to platform
42 * devices until they get moved to DT.
43 */
44static const struct clk_name clk_names[] __initconst = {
45 { "tmu0", "fck", "sh-tmu.0" },
46};
47
48static void __init marzen_init(void) 40static void __init marzen_init(void)
49{ 41{
50 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
51 r8a7779_add_standard_devices_dt();
52 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 42 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
53 r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */ 43 r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
54} 44}
@@ -64,8 +54,8 @@ DT_MACHINE_START(MARZEN, "marzen")
64 .map_io = r8a7779_map_io, 54 .map_io = r8a7779_map_io,
65 .init_early = shmobile_init_delay, 55 .init_early = shmobile_init_delay,
66 .init_time = marzen_init_timer, 56 .init_time = marzen_init_timer,
67 .nr_irqs = NR_IRQS_LEGACY,
68 .init_irq = r8a7779_init_irq_dt, 57 .init_irq = r8a7779_init_irq_dt,
69 .init_machine = marzen_init, 58 .init_machine = marzen_init,
59 .init_late = shmobile_init_late,
70 .dt_compat = marzen_boards_compat_dt, 60 .dt_compat = marzen_boards_compat_dt,
71MACHINE_END 61MACHINE_END
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
deleted file mode 100644
index 3eb2ec401e0c..000000000000
--- a/arch/arm/mach-shmobile/clock-r7s72100.c
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * r7a72100 clock framework support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2012 Phil Edworthy
6 * Copyright (C) 2011 Magnus Damm
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#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/io.h>
20#include <linux/sh_clk.h>
21#include <linux/clkdev.h>
22
23#include "common.h"
24#include "r7s72100.h"
25
26/* Frequency Control Registers */
27#define FRQCR 0xfcfe0010
28#define FRQCR2 0xfcfe0014
29/* Standby Control Registers */
30#define STBCR3 0xfcfe0420
31#define STBCR4 0xfcfe0424
32#define STBCR7 0xfcfe0430
33#define STBCR9 0xfcfe0438
34#define STBCR10 0xfcfe043c
35
36#define PLL_RATE 30
37
38static struct clk_mapping cpg_mapping = {
39 .phys = 0xfcfe0000,
40 .len = 0x1000,
41};
42
43/* Fixed 32 KHz root clock for RTC */
44static struct clk r_clk = {
45 .rate = 32768,
46};
47
48/*
49 * Default rate for the root input clock, reset this with clk_set_rate()
50 * from the platform code.
51 */
52static struct clk extal_clk = {
53 .rate = 13330000,
54 .mapping = &cpg_mapping,
55};
56
57static unsigned long pll_recalc(struct clk *clk)
58{
59 return clk->parent->rate * PLL_RATE;
60}
61
62static struct sh_clk_ops pll_clk_ops = {
63 .recalc = pll_recalc,
64};
65
66static struct clk pll_clk = {
67 .ops = &pll_clk_ops,
68 .parent = &extal_clk,
69 .flags = CLK_ENABLE_ON_INIT,
70};
71
72static unsigned long bus_recalc(struct clk *clk)
73{
74 return clk->parent->rate / 3;
75}
76
77static struct sh_clk_ops bus_clk_ops = {
78 .recalc = bus_recalc,
79};
80
81static struct clk bus_clk = {
82 .ops = &bus_clk_ops,
83 .parent = &pll_clk,
84 .flags = CLK_ENABLE_ON_INIT,
85};
86
87static unsigned long peripheral0_recalc(struct clk *clk)
88{
89 return clk->parent->rate / 12;
90}
91
92static struct sh_clk_ops peripheral0_clk_ops = {
93 .recalc = peripheral0_recalc,
94};
95
96static struct clk peripheral0_clk = {
97 .ops = &peripheral0_clk_ops,
98 .parent = &pll_clk,
99 .flags = CLK_ENABLE_ON_INIT,
100};
101
102static unsigned long peripheral1_recalc(struct clk *clk)
103{
104 return clk->parent->rate / 6;
105}
106
107static struct sh_clk_ops peripheral1_clk_ops = {
108 .recalc = peripheral1_recalc,
109};
110
111static struct clk peripheral1_clk = {
112 .ops = &peripheral1_clk_ops,
113 .parent = &pll_clk,
114 .flags = CLK_ENABLE_ON_INIT,
115};
116
117struct clk *main_clks[] = {
118 &r_clk,
119 &extal_clk,
120 &pll_clk,
121 &bus_clk,
122 &peripheral0_clk,
123 &peripheral1_clk,
124};
125
126static int div2[] = { 1, 3, 0, 3 }; /* 1, 2/3, reserve, 1/3 */
127static int multipliers[] = { 1, 2, 1, 1 };
128
129static struct clk_div_mult_table div4_div_mult_table = {
130 .divisors = div2,
131 .nr_divisors = ARRAY_SIZE(div2),
132 .multipliers = multipliers,
133 .nr_multipliers = ARRAY_SIZE(multipliers),
134};
135
136static struct clk_div4_table div4_table = {
137 .div_mult_table = &div4_div_mult_table,
138};
139
140enum { DIV4_I,
141 DIV4_NR };
142
143#define DIV4(_reg, _bit, _mask, _flags) \
144 SH_CLK_DIV4(&pll_clk, _reg, _bit, _mask, _flags)
145
146/* The mask field specifies the div2 entries that are valid */
147struct clk div4_clks[DIV4_NR] = {
148 [DIV4_I] = DIV4(FRQCR, 8, 0xB, CLK_ENABLE_REG_16BIT
149 | CLK_ENABLE_ON_INIT),
150};
151
152enum {
153 MSTP107, MSTP106, MSTP105, MSTP104, MSTP103,
154 MSTP97, MSTP96, MSTP95, MSTP94,
155 MSTP74,
156 MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40,
157 MSTP33, MSTP_NR
158};
159
160static struct clk mstp_clks[MSTP_NR] = {
161 [MSTP107] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 7, 0), /* RSPI0 */
162 [MSTP106] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 6, 0), /* RSPI1 */
163 [MSTP105] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 5, 0), /* RSPI2 */
164 [MSTP104] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 4, 0), /* RSPI3 */
165 [MSTP103] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 3, 0), /* RSPI4 */
166 [MSTP97] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 7, 0), /* RIIC0 */
167 [MSTP96] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 6, 0), /* RIIC1 */
168 [MSTP95] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 5, 0), /* RIIC2 */
169 [MSTP94] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 4, 0), /* RIIC3 */
170 [MSTP74] = SH_CLK_MSTP8(&peripheral1_clk, STBCR7, 4, 0), /* Ether */
171 [MSTP47] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 7, 0), /* SCIF0 */
172 [MSTP46] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 6, 0), /* SCIF1 */
173 [MSTP45] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 5, 0), /* SCIF2 */
174 [MSTP44] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 4, 0), /* SCIF3 */
175 [MSTP43] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 3, 0), /* SCIF4 */
176 [MSTP42] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 2, 0), /* SCIF5 */
177 [MSTP41] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 1, 0), /* SCIF6 */
178 [MSTP40] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 0, 0), /* SCIF7 */
179 [MSTP33] = SH_CLK_MSTP8(&peripheral0_clk, STBCR3, 3, 0), /* MTU2 */
180};
181
182static struct clk_lookup lookups[] = {
183 /* main clocks */
184 CLKDEV_CON_ID("rclk", &r_clk),
185 CLKDEV_CON_ID("extal", &extal_clk),
186 CLKDEV_CON_ID("pll_clk", &pll_clk),
187 CLKDEV_CON_ID("peripheral_clk", &peripheral1_clk),
188
189 /* DIV4 clocks */
190 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
191
192 /* MSTP clocks */
193 CLKDEV_DEV_ID("rspi-rz.0", &mstp_clks[MSTP107]),
194 CLKDEV_DEV_ID("rspi-rz.1", &mstp_clks[MSTP106]),
195 CLKDEV_DEV_ID("rspi-rz.2", &mstp_clks[MSTP105]),
196 CLKDEV_DEV_ID("rspi-rz.3", &mstp_clks[MSTP104]),
197 CLKDEV_DEV_ID("rspi-rz.4", &mstp_clks[MSTP103]),
198 CLKDEV_DEV_ID("r7s72100-ether", &mstp_clks[MSTP74]),
199
200 /* ICK */
201 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]),
202 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]),
203 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]),
204 CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP44]),
205 CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP43]),
206 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]),
207 CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]),
208 CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
209 CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP33]),
210};
211
212void __init r7s72100_clock_init(void)
213{
214 int k, ret = 0;
215
216 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
217 ret = clk_register(main_clks[k]);
218
219 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
220
221 if (!ret)
222 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
223
224 if (!ret)
225 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
226
227 if (!ret)
228 shmobile_clk_init();
229 else
230 panic("failed to setup rza1 clocks\n");
231}
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index 17435c1aa2fe..126ddafad526 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -183,8 +183,8 @@ enum {
183 183
184static struct clk div4_clks[DIV4_NR] = { 184static struct clk div4_clks[DIV4_NR] = {
185 [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT), 185 [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT),
186 [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT), 186 [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1df0, CLK_ENABLE_ON_INIT),
187 [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1de0, CLK_ENABLE_ON_INIT), 187 [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1df0, CLK_ENABLE_ON_INIT),
188}; 188};
189 189
190/* DIV6 clocks */ 190/* DIV6 clocks */
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
index 10e193d707f5..453b23129cfa 100644
--- a/arch/arm/mach-shmobile/clock-r8a7791.c
+++ b/arch/arm/mach-shmobile/clock-r8a7791.c
@@ -152,7 +152,7 @@ enum {
152 152
153static struct clk div4_clks[DIV4_NR] = { 153static struct clk div4_clks[DIV4_NR] = {
154 [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT), 154 [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT),
155 [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT), 155 [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1df0, CLK_ENABLE_ON_INIT),
156}; 156};
157 157
158/* DIV6 clocks */ 158/* DIV6 clocks */
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index d8c4048b9e33..02a6f45a0b9e 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -644,7 +644,7 @@ static struct clk_lookup lookups[] = {
644 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ 644 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
645 CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */ 645 CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */
646 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ 646 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
647 CLKDEV_DEV_ID("0xe6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */ 647 CLKDEV_DEV_ID("e6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */
648 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ 648 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
649 CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */ 649 CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */
650 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ 650 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
index 98056081f0da..72087c79ad7b 100644
--- a/arch/arm/mach-shmobile/common.h
+++ b/arch/arm/mach-shmobile/common.h
@@ -2,8 +2,6 @@
2#define __ARCH_MACH_COMMON_H 2#define __ARCH_MACH_COMMON_H
3 3
4extern void shmobile_earlytimer_init(void); 4extern void shmobile_earlytimer_init(void);
5extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
6 unsigned int mult, unsigned int div);
7extern void shmobile_init_delay(void); 5extern void shmobile_init_delay(void);
8struct twd_local_timer; 6struct twd_local_timer;
9extern void shmobile_setup_console(void); 7extern void shmobile_setup_console(void);
diff --git a/arch/arm/mach-shmobile/cpufreq.c b/arch/arm/mach-shmobile/cpufreq.c
index 8a24b2be46ae..57fbff024dcd 100644
--- a/arch/arm/mach-shmobile/cpufreq.c
+++ b/arch/arm/mach-shmobile/cpufreq.c
@@ -12,6 +12,6 @@
12 12
13int __init shmobile_cpufreq_init(void) 13int __init shmobile_cpufreq_init(void)
14{ 14{
15 platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); 15 platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
16 return 0; 16 return 0;
17} 17}
diff --git a/arch/arm/mach-shmobile/dma-register.h b/arch/arm/mach-shmobile/dma-register.h
index 97c40bd9b94f..52a2f66e600f 100644
--- a/arch/arm/mach-shmobile/dma-register.h
+++ b/arch/arm/mach-shmobile/dma-register.h
@@ -52,8 +52,8 @@ static const unsigned int dma_ts_shift[] = {
52 ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\ 52 ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\
53 (((i) & TS_HI_BIT) << TS_HI_SHIFT)) 53 (((i) & TS_HI_BIT) << TS_HI_SHIFT))
54 54
55#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz))) 55#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL((xmit_sz)))
56#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz))) 56#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL((xmit_sz)))
57 57
58 58
59/* 59/*
diff --git a/arch/arm/mach-shmobile/intc.h b/arch/arm/mach-shmobile/intc.h
index a5603c76cfe0..40b2ad4ca5b4 100644
--- a/arch/arm/mach-shmobile/intc.h
+++ b/arch/arm/mach-shmobile/intc.h
@@ -287,4 +287,9 @@ static struct intc_desc p ## _desc __initdata = { \
287 p ## _sense_registers, NULL), \ 287 p ## _sense_registers, NULL), \
288} 288}
289 289
290/* INTCS */
291#define INTCS_VECT_BASE 0x3400
292#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
293#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
294
290#endif /* __ASM_MACH_INTC_H */ 295#endif /* __ASM_MACH_INTC_H */
diff --git a/arch/arm/mach-shmobile/irqs.h b/arch/arm/mach-shmobile/irqs.h
index 4ff2d2aa94f0..3070f6d887eb 100644
--- a/arch/arm/mach-shmobile/irqs.h
+++ b/arch/arm/mach-shmobile/irqs.h
@@ -1,18 +1,12 @@
1#ifndef __SHMOBILE_IRQS_H 1#ifndef __SHMOBILE_IRQS_H
2#define __SHMOBILE_IRQS_H 2#define __SHMOBILE_IRQS_H
3 3
4#include <linux/sh_intc.h> 4#include "include/mach/irqs.h"
5#include <mach/irqs.h>
6 5
7/* GIC */ 6/* GIC */
8#define gic_spi(nr) ((nr) + 32) 7#define gic_spi(nr) ((nr) + 32)
9#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */ 8#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
10 9
11/* INTCS */
12#define INTCS_VECT_BASE 0x3400
13#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
14#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
15
16/* GPIO IRQ */ 10/* GPIO IRQ */
17#define _GPIO_IRQ_BASE 2500 11#define _GPIO_IRQ_BASE 2500
18#define GPIO_IRQ_BASE(x) (_GPIO_IRQ_BASE + (32 * x)) 12#define GPIO_IRQ_BASE(x) (_GPIO_IRQ_BASE + (32 * x))
diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
index a0d44d537fa0..e3f146448237 100644
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ b/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -13,12 +13,12 @@
13#include "common.h" 13#include "common.h"
14#include "pm-rmobile.h" 14#include "pm-rmobile.h"
15 15
16#ifdef CONFIG_PM 16#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
17static int r8a7740_pd_a4s_suspend(void) 17static int r8a7740_pd_a4s_suspend(void)
18{ 18{
19 /* 19 /*
20 * The A4S domain contains the CPU core and therefore it should 20 * The A4S domain contains the CPU core and therefore it should
21 * only be turned off if the CPU is in use. 21 * only be turned off if the CPU is not in use.
22 */ 22 */
23 return -EBUSY; 23 return -EBUSY;
24} 24}
@@ -34,23 +34,21 @@ static int r8a7740_pd_a3sp_suspend(void)
34 34
35static struct rmobile_pm_domain r8a7740_pm_domains[] = { 35static struct rmobile_pm_domain r8a7740_pm_domains[] = {
36 { 36 {
37 .genpd.name = "A4LC",
38 .bit_shift = 1,
39 }, {
37 .genpd.name = "A4S", 40 .genpd.name = "A4S",
38 .bit_shift = 10, 41 .bit_shift = 10,
39 .gov = &pm_domain_always_on_gov, 42 .gov = &pm_domain_always_on_gov,
40 .no_debug = true, 43 .no_debug = true,
41 .suspend = r8a7740_pd_a4s_suspend, 44 .suspend = r8a7740_pd_a4s_suspend,
42 }, 45 }, {
43 {
44 .genpd.name = "A3SP", 46 .genpd.name = "A3SP",
45 .bit_shift = 11, 47 .bit_shift = 11,
46 .gov = &pm_domain_always_on_gov, 48 .gov = &pm_domain_always_on_gov,
47 .no_debug = true, 49 .no_debug = true,
48 .suspend = r8a7740_pd_a3sp_suspend, 50 .suspend = r8a7740_pd_a3sp_suspend,
49 }, 51 },
50 {
51 .genpd.name = "A4LC",
52 .bit_shift = 1,
53 },
54}; 52};
55 53
56void __init r8a7740_init_pm_domains(void) 54void __init r8a7740_init_pm_domains(void)
@@ -58,8 +56,7 @@ void __init r8a7740_init_pm_domains(void)
58 rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains)); 56 rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
59 pm_genpd_add_subdomain_names("A4S", "A3SP"); 57 pm_genpd_add_subdomain_names("A4S", "A3SP");
60} 58}
61 59#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
62#endif /* CONFIG_PM */
63 60
64#ifdef CONFIG_SUSPEND 61#ifdef CONFIG_SUSPEND
65static int r8a7740_enter_suspend(suspend_state_t suspend_state) 62static int r8a7740_enter_suspend(suspend_state_t suspend_state)
diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
index 69f70b7f7fb2..82fe3d7f9662 100644
--- a/arch/arm/mach-shmobile/pm-r8a7779.c
+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -87,7 +87,6 @@ static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
87 genpd->dev_ops.stop = pm_clk_suspend; 87 genpd->dev_ops.stop = pm_clk_suspend;
88 genpd->dev_ops.start = pm_clk_resume; 88 genpd->dev_ops.start = pm_clk_resume;
89 genpd->dev_ops.active_wakeup = pd_active_wakeup; 89 genpd->dev_ops.active_wakeup = pd_active_wakeup;
90 genpd->dev_irq_safe = true;
91 genpd->power_off = pd_power_down; 90 genpd->power_off = pd_power_down;
92 genpd->power_on = pd_power_up; 91 genpd->power_on = pd_power_up;
93 92
diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
index 34b8a5674f85..00022ee56f80 100644
--- a/arch/arm/mach-shmobile/pm-rcar.c
+++ b/arch/arm/mach-shmobile/pm-rcar.c
@@ -31,8 +31,6 @@
31#define SYSCISR_RETRIES 1000 31#define SYSCISR_RETRIES 1000
32#define SYSCISR_DELAY_US 1 32#define SYSCISR_DELAY_US 1
33 33
34#if defined(CONFIG_PM) || defined(CONFIG_SMP)
35
36static void __iomem *rcar_sysc_base; 34static void __iomem *rcar_sysc_base;
37static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */ 35static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
38 36
@@ -137,5 +135,3 @@ void __iomem *rcar_sysc_init(phys_addr_t base)
137 135
138 return rcar_sysc_base; 136 return rcar_sysc_base;
139} 137}
140
141#endif /* CONFIG_PM || CONFIG_SMP */
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index ebdd16e94a84..717e6413d29c 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -27,7 +27,6 @@
27#define PSTR_RETRIES 100 27#define PSTR_RETRIES 100
28#define PSTR_DELAY_US 10 28#define PSTR_DELAY_US 10
29 29
30#ifdef CONFIG_PM
31static int rmobile_pd_power_down(struct generic_pm_domain *genpd) 30static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
32{ 31{
33 struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd); 32 struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd);
@@ -111,7 +110,6 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
111 genpd->dev_ops.stop = pm_clk_suspend; 110 genpd->dev_ops.stop = pm_clk_suspend;
112 genpd->dev_ops.start = pm_clk_resume; 111 genpd->dev_ops.start = pm_clk_resume;
113 genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; 112 genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup;
114 genpd->dev_irq_safe = true;
115 genpd->power_off = rmobile_pd_power_down; 113 genpd->power_off = rmobile_pd_power_down;
116 genpd->power_on = rmobile_pd_power_up; 114 genpd->power_on = rmobile_pd_power_up;
117 __rmobile_pd_power_up(rmobile_pd, false); 115 __rmobile_pd_power_up(rmobile_pd, false);
@@ -151,4 +149,3 @@ void rmobile_add_devices_to_domains(struct pm_domain_device data[],
151 rmobile_add_device_to_domain_td(data[j].domain_name, 149 rmobile_add_device_to_domain_td(data[j].domain_name,
152 data[j].pdev, &latencies); 150 data[j].pdev, &latencies);
153} 151}
154#endif /* CONFIG_PM */
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 690553a06887..8f66b343162b 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -36,7 +36,7 @@ struct pm_domain_device {
36 struct platform_device *pdev; 36 struct platform_device *pdev;
37}; 37};
38 38
39#ifdef CONFIG_PM 39#ifdef CONFIG_PM_RMOBILE
40extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num); 40extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
41extern void rmobile_add_device_to_domain_td(const char *domain_name, 41extern void rmobile_add_device_to_domain_td(const char *domain_name,
42 struct platform_device *pdev, 42 struct platform_device *pdev,
@@ -58,6 +58,6 @@ extern void rmobile_add_devices_to_domains(struct pm_domain_device data[],
58 58
59static inline void rmobile_add_devices_to_domains(struct pm_domain_device d[], 59static inline void rmobile_add_devices_to_domains(struct pm_domain_device d[],
60 int size) {} 60 int size) {}
61#endif /* CONFIG_PM */ 61#endif /* CONFIG_PM_RMOBILE */
62 62
63#endif /* PM_RMOBILE_H */ 63#endif /* PM_RMOBILE_H */
diff --git a/arch/arm/mach-shmobile/r7s72100.h b/arch/arm/mach-shmobile/r7s72100.h
deleted file mode 100644
index efb723c88dd0..000000000000
--- a/arch/arm/mach-shmobile/r7s72100.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_R7S72100_H__
2#define __ASM_R7S72100_H__
3
4void r7s72100_add_dt_devices(void);
5void r7s72100_clock_init(void);
6
7#endif /* __ASM_R7S72100_H__ */
diff --git a/arch/arm/mach-shmobile/r8a73a4.h b/arch/arm/mach-shmobile/r8a73a4.h
index ce8bdd1d8a8a..5fafd6fcedf7 100644
--- a/arch/arm/mach-shmobile/r8a73a4.h
+++ b/arch/arm/mach-shmobile/r8a73a4.h
@@ -14,6 +14,5 @@ void r8a73a4_add_standard_devices(void);
14void r8a73a4_add_dt_devices(void); 14void r8a73a4_add_dt_devices(void);
15void r8a73a4_clock_init(void); 15void r8a73a4_clock_init(void);
16void r8a73a4_pinmux_init(void); 16void r8a73a4_pinmux_init(void);
17void r8a73a4_init_early(void);
18 17
19#endif /* __ASM_R8A73A4_H__ */ 18#endif /* __ASM_R8A73A4_H__ */
diff --git a/arch/arm/mach-shmobile/r8a7740.h b/arch/arm/mach-shmobile/r8a7740.h
index 1d1a5fd78b6b..f369b4b0863d 100644
--- a/arch/arm/mach-shmobile/r8a7740.h
+++ b/arch/arm/mach-shmobile/r8a7740.h
@@ -49,15 +49,14 @@ extern void r8a7740_init_irq_of(void);
49extern void r8a7740_map_io(void); 49extern void r8a7740_map_io(void);
50extern void r8a7740_add_early_devices(void); 50extern void r8a7740_add_early_devices(void);
51extern void r8a7740_add_standard_devices(void); 51extern void r8a7740_add_standard_devices(void);
52extern void r8a7740_add_standard_devices_dt(void);
53extern void r8a7740_clock_init(u8 md_ck); 52extern void r8a7740_clock_init(u8 md_ck);
54extern void r8a7740_pinmux_init(void); 53extern void r8a7740_pinmux_init(void);
55extern void r8a7740_pm_init(void); 54extern void r8a7740_pm_init(void);
56 55
57#ifdef CONFIG_PM 56#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
58extern void __init r8a7740_init_pm_domains(void); 57extern void __init r8a7740_init_pm_domains(void);
59#else 58#else
60static inline void r8a7740_init_pm_domains(void) {} 59static inline void r8a7740_init_pm_domains(void) {}
61#endif /* CONFIG_PM */ 60#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
62 61
63#endif /* __ASM_R8A7740_H__ */ 62#endif /* __ASM_R8A7740_H__ */
diff --git a/arch/arm/mach-shmobile/r8a7779.h b/arch/arm/mach-shmobile/r8a7779.h
index 5415c719dc19..19f97046dd70 100644
--- a/arch/arm/mach-shmobile/r8a7779.h
+++ b/arch/arm/mach-shmobile/r8a7779.h
@@ -17,7 +17,6 @@ extern void r8a7779_map_io(void);
17extern void r8a7779_earlytimer_init(void); 17extern void r8a7779_earlytimer_init(void);
18extern void r8a7779_add_early_devices(void); 18extern void r8a7779_add_early_devices(void);
19extern void r8a7779_add_standard_devices(void); 19extern void r8a7779_add_standard_devices(void);
20extern void r8a7779_add_standard_devices_dt(void);
21extern void r8a7779_init_late(void); 20extern void r8a7779_init_late(void);
22extern u32 r8a7779_read_mode_pins(void); 21extern u32 r8a7779_read_mode_pins(void);
23extern void r8a7779_clock_init(void); 22extern void r8a7779_clock_init(void);
diff --git a/arch/arm/mach-shmobile/r8a7790.h b/arch/arm/mach-shmobile/r8a7790.h
index 459827f1369b..388f0514d931 100644
--- a/arch/arm/mach-shmobile/r8a7790.h
+++ b/arch/arm/mach-shmobile/r8a7790.h
@@ -27,7 +27,6 @@ enum {
27}; 27};
28 28
29void r8a7790_add_standard_devices(void); 29void r8a7790_add_standard_devices(void);
30void r8a7790_add_dt_devices(void);
31void r8a7790_clock_init(void); 30void r8a7790_clock_init(void);
32void r8a7790_pinmux_init(void); 31void r8a7790_pinmux_init(void);
33void r8a7790_pm_init(void); 32void r8a7790_pm_init(void);
diff --git a/arch/arm/mach-shmobile/r8a7791.h b/arch/arm/mach-shmobile/r8a7791.h
index 86eae7bceb6f..c1bf7abefa5a 100644
--- a/arch/arm/mach-shmobile/r8a7791.h
+++ b/arch/arm/mach-shmobile/r8a7791.h
@@ -2,7 +2,6 @@
2#define __ASM_R8A7791_H__ 2#define __ASM_R8A7791_H__
3 3
4void r8a7791_add_standard_devices(void); 4void r8a7791_add_standard_devices(void);
5void r8a7791_add_dt_devices(void);
6void r8a7791_clock_init(void); 5void r8a7791_clock_init(void);
7void r8a7791_pinmux_init(void); 6void r8a7791_pinmux_init(void);
8void r8a7791_pm_init(void); 7void r8a7791_pm_init(void);
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
index f3b3b14ba972..4122104359f9 100644
--- a/arch/arm/mach-shmobile/setup-r7s72100.c
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -18,34 +18,12 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21#include <linux/irq.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <linux/of_platform.h>
24#include <linux/sh_timer.h>
25 22
26#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
27 24
28#include "common.h" 25#include "common.h"
29#include "irqs.h"
30#include "r7s72100.h"
31 26
32static struct resource mtu2_resources[] __initdata = {
33 DEFINE_RES_MEM(0xfcff0000, 0x400),
34 DEFINE_RES_IRQ_NAMED(gic_iid(139), "tgi0a"),
35};
36
37#define r7s72100_register_mtu2() \
38 platform_device_register_resndata(NULL, "sh-mtu2", \
39 -1, mtu2_resources, \
40 ARRAY_SIZE(mtu2_resources), \
41 NULL, 0)
42
43void __init r7s72100_add_dt_devices(void)
44{
45 r7s72100_register_mtu2();
46}
47
48#ifdef CONFIG_USE_OF
49static const char *r7s72100_boards_compat_dt[] __initdata = { 27static const char *r7s72100_boards_compat_dt[] __initdata = {
50 "renesas,r7s72100", 28 "renesas,r7s72100",
51 NULL, 29 NULL,
@@ -53,6 +31,6 @@ static const char *r7s72100_boards_compat_dt[] __initdata = {
53 31
54DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)") 32DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)")
55 .init_early = shmobile_init_delay, 33 .init_early = shmobile_init_delay,
34 .init_late = shmobile_init_late,
56 .dt_compat = r7s72100_boards_compat_dt, 35 .dt_compat = r7s72100_boards_compat_dt,
57MACHINE_END 36MACHINE_END
58#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 6683072a9d98..53f40b70680d 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -295,13 +295,6 @@ void __init r8a73a4_add_standard_devices(void)
295 r8a73a4_register_dmac(); 295 r8a73a4_register_dmac();
296} 296}
297 297
298void __init r8a73a4_init_early(void)
299{
300#ifndef CONFIG_ARM_ARCH_TIMER
301 shmobile_setup_delay(1500, 2, 4); /* Cortex-A15 @ 1500MHz */
302#endif
303}
304
305#ifdef CONFIG_USE_OF 298#ifdef CONFIG_USE_OF
306 299
307static const char *r8a73a4_boards_compat_dt[] __initdata = { 300static const char *r8a73a4_boards_compat_dt[] __initdata = {
@@ -310,7 +303,8 @@ static const char *r8a73a4_boards_compat_dt[] __initdata = {
310}; 303};
311 304
312DT_MACHINE_START(R8A73A4_DT, "Generic R8A73A4 (Flattened Device Tree)") 305DT_MACHINE_START(R8A73A4_DT, "Generic R8A73A4 (Flattened Device Tree)")
313 .init_early = r8a73a4_init_early, 306 .init_early = shmobile_init_delay,
307 .init_late = shmobile_init_late,
314 .dt_compat = r8a73a4_boards_compat_dt, 308 .dt_compat = r8a73a4_boards_compat_dt,
315MACHINE_END 309MACHINE_END
316#endif /* CONFIG_USE_OF */ 310#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 3d5eacaba3e6..8894e1b7ab0e 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -36,6 +36,7 @@
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
38#include <asm/mach/time.h> 38#include <asm/mach/time.h>
39#include <asm/hardware/cache-l2x0.h>
39 40
40#include "common.h" 41#include "common.h"
41#include "dma-register.h" 42#include "dma-register.h"
@@ -311,10 +312,6 @@ static struct platform_device ipmmu_device = {
311 .num_resources = ARRAY_SIZE(ipmmu_resources), 312 .num_resources = ARRAY_SIZE(ipmmu_resources),
312}; 313};
313 314
314static struct platform_device *r8a7740_devices_dt[] __initdata = {
315 &cmt1_device,
316};
317
318static struct platform_device *r8a7740_early_devices[] __initdata = { 315static struct platform_device *r8a7740_early_devices[] __initdata = {
319 &scif0_device, 316 &scif0_device,
320 &scif1_device, 317 &scif1_device,
@@ -331,6 +328,7 @@ static struct platform_device *r8a7740_early_devices[] __initdata = {
331 &irqpin3_device, 328 &irqpin3_device,
332 &tmu0_device, 329 &tmu0_device,
333 &ipmmu_device, 330 &ipmmu_device,
331 &cmt1_device,
334}; 332};
335 333
336/* DMA */ 334/* DMA */
@@ -747,6 +745,19 @@ static void r8a7740_i2c_workaround(struct platform_device *pdev)
747 745
748void __init r8a7740_add_standard_devices(void) 746void __init r8a7740_add_standard_devices(void)
749{ 747{
748 static struct pm_domain_device domain_devices[] __initdata = {
749 { "A3SP", &scif0_device },
750 { "A3SP", &scif1_device },
751 { "A3SP", &scif2_device },
752 { "A3SP", &scif3_device },
753 { "A3SP", &scif4_device },
754 { "A3SP", &scif5_device },
755 { "A3SP", &scif6_device },
756 { "A3SP", &scif7_device },
757 { "A3SP", &scif8_device },
758 { "A3SP", &i2c1_device },
759 };
760
750 /* I2C work-around */ 761 /* I2C work-around */
751 r8a7740_i2c_workaround(&i2c0_device); 762 r8a7740_i2c_workaround(&i2c0_device);
752 r8a7740_i2c_workaround(&i2c1_device); 763 r8a7740_i2c_workaround(&i2c1_device);
@@ -756,31 +767,18 @@ void __init r8a7740_add_standard_devices(void)
756 /* add devices */ 767 /* add devices */
757 platform_add_devices(r8a7740_early_devices, 768 platform_add_devices(r8a7740_early_devices,
758 ARRAY_SIZE(r8a7740_early_devices)); 769 ARRAY_SIZE(r8a7740_early_devices));
759 platform_add_devices(r8a7740_devices_dt,
760 ARRAY_SIZE(r8a7740_devices_dt));
761 platform_add_devices(r8a7740_late_devices, 770 platform_add_devices(r8a7740_late_devices,
762 ARRAY_SIZE(r8a7740_late_devices)); 771 ARRAY_SIZE(r8a7740_late_devices));
763 772
764 /* add devices to PM domain */ 773 /* add devices to PM domain */
765 774 rmobile_add_devices_to_domains(domain_devices,
766 rmobile_add_device_to_domain("A3SP", &scif0_device); 775 ARRAY_SIZE(domain_devices));
767 rmobile_add_device_to_domain("A3SP", &scif1_device);
768 rmobile_add_device_to_domain("A3SP", &scif2_device);
769 rmobile_add_device_to_domain("A3SP", &scif3_device);
770 rmobile_add_device_to_domain("A3SP", &scif4_device);
771 rmobile_add_device_to_domain("A3SP", &scif5_device);
772 rmobile_add_device_to_domain("A3SP", &scif6_device);
773 rmobile_add_device_to_domain("A3SP", &scif7_device);
774 rmobile_add_device_to_domain("A3SP", &scif8_device);
775 rmobile_add_device_to_domain("A3SP", &i2c1_device);
776} 776}
777 777
778void __init r8a7740_add_early_devices(void) 778void __init r8a7740_add_early_devices(void)
779{ 779{
780 early_platform_add_devices(r8a7740_early_devices, 780 early_platform_add_devices(r8a7740_early_devices,
781 ARRAY_SIZE(r8a7740_early_devices)); 781 ARRAY_SIZE(r8a7740_early_devices));
782 early_platform_add_devices(r8a7740_devices_dt,
783 ARRAY_SIZE(r8a7740_devices_dt));
784 782
785 /* setup early console here as well */ 783 /* setup early console here as well */
786 shmobile_setup_console(); 784 shmobile_setup_console();
@@ -788,13 +786,6 @@ void __init r8a7740_add_early_devices(void)
788 786
789#ifdef CONFIG_USE_OF 787#ifdef CONFIG_USE_OF
790 788
791void __init r8a7740_add_standard_devices_dt(void)
792{
793 platform_add_devices(r8a7740_devices_dt,
794 ARRAY_SIZE(r8a7740_devices_dt));
795 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
796}
797
798void __init r8a7740_init_irq_of(void) 789void __init r8a7740_init_irq_of(void)
799{ 790{
800 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10); 791 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
@@ -827,8 +818,20 @@ void __init r8a7740_init_irq_of(void)
827 818
828static void __init r8a7740_generic_init(void) 819static void __init r8a7740_generic_init(void)
829{ 820{
830 r8a7740_clock_init(0); 821 r8a7740_meram_workaround();
831 r8a7740_add_standard_devices_dt(); 822
823#ifdef CONFIG_CACHE_L2X0
824 /* Shared attribute override enable, 32K*8way */
825 l2x0_init(IOMEM(0xf0002000), 0x00400000, 0xc20f0fff);
826#endif
827 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
828}
829
830#define RESCNT2 IOMEM(0xe6188020)
831static void r8a7740_restart(enum reboot_mode mode, const char *cmd)
832{
833 /* Do soft power on reset */
834 writel(1 << 31, RESCNT2);
832} 835}
833 836
834static const char *r8a7740_boards_compat_dt[] __initdata = { 837static const char *r8a7740_boards_compat_dt[] __initdata = {
@@ -843,6 +846,7 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
843 .init_machine = r8a7740_generic_init, 846 .init_machine = r8a7740_generic_init,
844 .init_late = shmobile_init_late, 847 .init_late = shmobile_init_late,
845 .dt_compat = r8a7740_boards_compat_dt, 848 .dt_compat = r8a7740_boards_compat_dt,
849 .restart = r8a7740_restart,
846MACHINE_END 850MACHINE_END
847 851
848#endif /* CONFIG_USE_OF */ 852#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index f00a488dcf43..85fe016d6a87 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -520,6 +520,7 @@ void __init r8a7778_add_standard_devices(void)
520 520
521void __init r8a7778_init_late(void) 521void __init r8a7778_init_late(void)
522{ 522{
523 shmobile_init_late();
523 platform_device_register_full(&ehci_info); 524 platform_device_register_full(&ehci_info);
524 platform_device_register_full(&ohci_info); 525 platform_device_register_full(&ohci_info);
525} 526}
@@ -573,7 +574,7 @@ void __init r8a7778_init_irq_extpin(int irlm)
573 574
574void __init r8a7778_init_delay(void) 575void __init r8a7778_init_delay(void)
575{ 576{
576 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */ 577 shmobile_init_delay();
577} 578}
578 579
579#ifdef CONFIG_USE_OF 580#ifdef CONFIG_USE_OF
@@ -609,8 +610,8 @@ static const char *r8a7778_compat_dt[] __initdata = {
609DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)") 610DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)")
610 .init_early = r8a7778_init_delay, 611 .init_early = r8a7778_init_delay,
611 .init_irq = r8a7778_init_irq_dt, 612 .init_irq = r8a7778_init_irq_dt,
613 .init_late = shmobile_init_late,
612 .dt_compat = r8a7778_compat_dt, 614 .dt_compat = r8a7778_compat_dt,
613 .init_late = r8a7778_init_late,
614MACHINE_END 615MACHINE_END
615 616
616#endif /* CONFIG_USE_OF */ 617#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 236c1befb9e3..136078ab9407 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -641,7 +641,7 @@ static void __init r8a7779_register_hpb_dmae(void)
641 sizeof(dma_platform_data)); 641 sizeof(dma_platform_data));
642} 642}
643 643
644static struct platform_device *r8a7779_devices_dt[] __initdata = { 644static struct platform_device *r8a7779_early_devices[] __initdata = {
645 &tmu0_device, 645 &tmu0_device,
646}; 646};
647 647
@@ -669,8 +669,8 @@ void __init r8a7779_add_standard_devices(void)
669 669
670 r8a7779_init_pm_domains(); 670 r8a7779_init_pm_domains();
671 671
672 platform_add_devices(r8a7779_devices_dt, 672 platform_add_devices(r8a7779_early_devices,
673 ARRAY_SIZE(r8a7779_devices_dt)); 673 ARRAY_SIZE(r8a7779_early_devices));
674 platform_add_devices(r8a7779_standard_devices, 674 platform_add_devices(r8a7779_standard_devices,
675 ARRAY_SIZE(r8a7779_standard_devices)); 675 ARRAY_SIZE(r8a7779_standard_devices));
676 r8a7779_register_hpb_dmae(); 676 r8a7779_register_hpb_dmae();
@@ -678,8 +678,8 @@ void __init r8a7779_add_standard_devices(void)
678 678
679void __init r8a7779_add_early_devices(void) 679void __init r8a7779_add_early_devices(void)
680{ 680{
681 early_platform_add_devices(r8a7779_devices_dt, 681 early_platform_add_devices(r8a7779_early_devices,
682 ARRAY_SIZE(r8a7779_devices_dt)); 682 ARRAY_SIZE(r8a7779_early_devices));
683 683
684 /* Early serial console setup is not included here due to 684 /* Early serial console setup is not included here due to
685 * memory map collisions. The SCIF serial ports in r8a7779 685 * memory map collisions. The SCIF serial ports in r8a7779
@@ -739,12 +739,6 @@ void __init r8a7779_init_irq_dt(void)
739 __raw_writel(0x003fee3f, INT2SMSKCR4); 739 __raw_writel(0x003fee3f, INT2SMSKCR4);
740} 740}
741 741
742void __init r8a7779_add_standard_devices_dt(void)
743{
744 platform_add_devices(r8a7779_devices_dt,
745 ARRAY_SIZE(r8a7779_devices_dt));
746}
747
748#define MODEMR 0xffcc0020 742#define MODEMR 0xffcc0020
749 743
750u32 __init r8a7779_read_mode_pins(void) 744u32 __init r8a7779_read_mode_pins(void)
@@ -771,10 +765,8 @@ static const char *r8a7779_compat_dt[] __initdata = {
771DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)") 765DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
772 .map_io = r8a7779_map_io, 766 .map_io = r8a7779_map_io,
773 .init_early = shmobile_init_delay, 767 .init_early = shmobile_init_delay,
774 .nr_irqs = NR_IRQS_LEGACY,
775 .init_irq = r8a7779_init_irq_dt, 768 .init_irq = r8a7779_init_irq_dt,
776 .init_machine = r8a7779_add_standard_devices_dt, 769 .init_late = shmobile_init_late,
777 .init_late = r8a7779_init_late,
778 .dt_compat = r8a7779_compat_dt, 770 .dt_compat = r8a7779_compat_dt,
779MACHINE_END 771MACHINE_END
780#endif /* CONFIG_USE_OF */ 772#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 0c12b01bb9e3..877fdeb985d0 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -282,11 +282,6 @@ static struct resource cmt0_resources[] = {
282 &cmt##idx##_platform_data, \ 282 &cmt##idx##_platform_data, \
283 sizeof(struct sh_timer_config)) 283 sizeof(struct sh_timer_config))
284 284
285void __init r8a7790_add_dt_devices(void)
286{
287 r8a7790_register_cmt(0);
288}
289
290void __init r8a7790_add_standard_devices(void) 285void __init r8a7790_add_standard_devices(void)
291{ 286{
292 r8a7790_register_scif(0); 287 r8a7790_register_scif(0);
@@ -299,7 +294,7 @@ void __init r8a7790_add_standard_devices(void)
299 r8a7790_register_scif(7); 294 r8a7790_register_scif(7);
300 r8a7790_register_scif(8); 295 r8a7790_register_scif(8);
301 r8a7790_register_scif(9); 296 r8a7790_register_scif(9);
302 r8a7790_add_dt_devices(); 297 r8a7790_register_cmt(0);
303 r8a7790_register_irqc(0); 298 r8a7790_register_irqc(0);
304 r8a7790_register_thermal(); 299 r8a7790_register_thermal();
305 r8a7790_register_i2c(0); 300 r8a7790_register_i2c(0);
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index d47d8b16a43f..35d78639244f 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -182,11 +182,6 @@ static const struct resource thermal_resources[] __initconst = {
182 thermal_resources, \ 182 thermal_resources, \
183 ARRAY_SIZE(thermal_resources)) 183 ARRAY_SIZE(thermal_resources))
184 184
185void __init r8a7791_add_dt_devices(void)
186{
187 r8a7791_register_cmt(0);
188}
189
190void __init r8a7791_add_standard_devices(void) 185void __init r8a7791_add_standard_devices(void)
191{ 186{
192 r8a7791_register_scif(0); 187 r8a7791_register_scif(0);
@@ -204,7 +199,7 @@ void __init r8a7791_add_standard_devices(void)
204 r8a7791_register_scif(12); 199 r8a7791_register_scif(12);
205 r8a7791_register_scif(13); 200 r8a7791_register_scif(13);
206 r8a7791_register_scif(14); 201 r8a7791_register_scif(14);
207 r8a7791_add_dt_devices(); 202 r8a7791_register_cmt(0);
208 r8a7791_register_irqc(0); 203 r8a7791_register_irqc(0);
209 r8a7791_register_thermal(); 204 r8a7791_register_thermal();
210} 205}
diff --git a/arch/arm/mach-shmobile/setup-r8a7794.c b/arch/arm/mach-shmobile/setup-r8a7794.c
new file mode 100644
index 000000000000..d2b093033132
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-r8a7794.c
@@ -0,0 +1,33 @@
1/*
2 * r8a7794 processor support
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 * Copyright (C) 2014 Ulrich Hecht
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; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/of_platform.h>
18#include "common.h"
19#include "rcar-gen2.h"
20#include <asm/mach/arch.h>
21
22static const char * const r8a7794_boards_compat_dt[] __initconst = {
23 "renesas,r8a7794",
24 NULL,
25};
26
27DT_MACHINE_START(R8A7794_DT, "Generic R8A7794 (Flattened Device Tree)")
28 .init_early = shmobile_init_delay,
29 .init_late = shmobile_init_late,
30 .init_time = rcar_gen2_timer_init,
31 .reserve = rcar_gen2_reserve,
32 .dt_compat = r8a7794_boards_compat_dt,
33MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 9cdfcdfd38fc..d646c8d12423 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -41,6 +41,7 @@
41 41
42#include "common.h" 42#include "common.h"
43#include "dma-register.h" 43#include "dma-register.h"
44#include "intc.h"
44#include "irqs.h" 45#include "irqs.h"
45#include "pm-rmobile.h" 46#include "pm-rmobile.h"
46#include "sh7372.h" 47#include "sh7372.h"
@@ -927,7 +928,7 @@ static struct platform_device *sh7372_late_devices[] __initdata = {
927 928
928void __init sh7372_add_standard_devices(void) 929void __init sh7372_add_standard_devices(void)
929{ 930{
930 struct pm_domain_device domain_devices[] = { 931 static struct pm_domain_device domain_devices[] __initdata = {
931 { "A3RV", &vpu_device, }, 932 { "A3RV", &vpu_device, },
932 { "A4MP", &spu0_device, }, 933 { "A4MP", &spu0_device, },
933 { "A4MP", &spu1_device, }, 934 { "A4MP", &spu1_device, },
@@ -984,7 +985,7 @@ void __init sh7372_add_early_devices(void)
984 985
985void __init sh7372_add_early_devices_dt(void) 986void __init sh7372_add_early_devices_dt(void)
986{ 987{
987 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */ 988 shmobile_init_delay();
988 989
989 sh7372_add_early_devices(); 990 sh7372_add_early_devices();
990} 991}
@@ -1008,7 +1009,6 @@ static const char *sh7372_boards_compat_dt[] __initdata = {
1008DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)") 1009DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1009 .map_io = sh7372_map_io, 1010 .map_io = sh7372_map_io,
1010 .init_early = sh7372_add_early_devices_dt, 1011 .init_early = sh7372_add_early_devices_dt,
1011 .nr_irqs = NR_IRQS_LEGACY,
1012 .init_irq = sh7372_init_irq, 1012 .init_irq = sh7372_init_irq,
1013 .handle_irq = shmobile_handle_irq_intc, 1013 .handle_irq = shmobile_handle_irq_intc,
1014 .init_machine = sh7372_add_standard_devices_dt, 1014 .init_machine = sh7372_add_standard_devices_dt,
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 2c802ae9b241..b7bd8e509668 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -40,6 +40,7 @@
40 40
41#include "common.h" 41#include "common.h"
42#include "dma-register.h" 42#include "dma-register.h"
43#include "intc.h"
43#include "irqs.h" 44#include "irqs.h"
44#include "sh73a0.h" 45#include "sh73a0.h"
45 46
@@ -696,10 +697,6 @@ static struct platform_device irqpin3_device = {
696 }, 697 },
697}; 698};
698 699
699static struct platform_device *sh73a0_devices_dt[] __initdata = {
700 &cmt1_device,
701};
702
703static struct platform_device *sh73a0_early_devices[] __initdata = { 700static struct platform_device *sh73a0_early_devices[] __initdata = {
704 &scif0_device, 701 &scif0_device,
705 &scif1_device, 702 &scif1_device,
@@ -712,6 +709,7 @@ static struct platform_device *sh73a0_early_devices[] __initdata = {
712 &scif8_device, 709 &scif8_device,
713 &tmu0_device, 710 &tmu0_device,
714 &ipmmu_device, 711 &ipmmu_device,
712 &cmt1_device,
715}; 713};
716 714
717static struct platform_device *sh73a0_late_devices[] __initdata = { 715static struct platform_device *sh73a0_late_devices[] __initdata = {
@@ -736,8 +734,6 @@ void __init sh73a0_add_standard_devices(void)
736 /* Clear software reset bit on SY-DMAC module */ 734 /* Clear software reset bit on SY-DMAC module */
737 __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); 735 __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
738 736
739 platform_add_devices(sh73a0_devices_dt,
740 ARRAY_SIZE(sh73a0_devices_dt));
741 platform_add_devices(sh73a0_early_devices, 737 platform_add_devices(sh73a0_early_devices,
742 ARRAY_SIZE(sh73a0_early_devices)); 738 ARRAY_SIZE(sh73a0_early_devices));
743 platform_add_devices(sh73a0_late_devices, 739 platform_add_devices(sh73a0_late_devices,
@@ -746,7 +742,7 @@ void __init sh73a0_add_standard_devices(void)
746 742
747void __init sh73a0_init_delay(void) 743void __init sh73a0_init_delay(void)
748{ 744{
749 shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */ 745 shmobile_init_delay();
750} 746}
751 747
752/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ 748/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
@@ -762,8 +758,6 @@ void __init sh73a0_earlytimer_init(void)
762 758
763void __init sh73a0_add_early_devices(void) 759void __init sh73a0_add_early_devices(void)
764{ 760{
765 early_platform_add_devices(sh73a0_devices_dt,
766 ARRAY_SIZE(sh73a0_devices_dt));
767 early_platform_add_devices(sh73a0_early_devices, 761 early_platform_add_devices(sh73a0_early_devices,
768 ARRAY_SIZE(sh73a0_early_devices)); 762 ARRAY_SIZE(sh73a0_early_devices));
769 763
@@ -775,17 +769,10 @@ void __init sh73a0_add_early_devices(void)
775 769
776void __init sh73a0_add_standard_devices_dt(void) 770void __init sh73a0_add_standard_devices_dt(void)
777{ 771{
778 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1, };
779
780 /* clocks are setup late during boot in the case of DT */ 772 /* clocks are setup late during boot in the case of DT */
781 sh73a0_clock_init(); 773 sh73a0_clock_init();
782 774
783 platform_add_devices(sh73a0_devices_dt,
784 ARRAY_SIZE(sh73a0_devices_dt));
785 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 775 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
786
787 /* Instantiate cpufreq-cpu0 */
788 platform_device_register_full(&devinfo);
789} 776}
790 777
791static const char *sh73a0_boards_compat_dt[] __initdata = { 778static const char *sh73a0_boards_compat_dt[] __initdata = {
@@ -797,8 +784,8 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
797 .smp = smp_ops(sh73a0_smp_ops), 784 .smp = smp_ops(sh73a0_smp_ops),
798 .map_io = sh73a0_map_io, 785 .map_io = sh73a0_map_io,
799 .init_early = sh73a0_init_delay, 786 .init_early = sh73a0_init_delay,
800 .nr_irqs = NR_IRQS_LEGACY,
801 .init_machine = sh73a0_add_standard_devices_dt, 787 .init_machine = sh73a0_add_standard_devices_dt,
788 .init_late = shmobile_init_late,
802 .dt_compat = sh73a0_boards_compat_dt, 789 .dt_compat = sh73a0_boards_compat_dt,
803MACHINE_END 790MACHINE_END
804#endif /* CONFIG_USE_OF */ 791#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 942efdc82a62..87c6be1e79bd 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -23,8 +23,8 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/of_address.h> 24#include <linux/of_address.h>
25 25
26void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz, 26static void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz,
27 unsigned int mult, unsigned int div) 27 unsigned int mult, unsigned int div)
28{ 28{
29 /* calculate a worst-case loops-per-jiffy value 29 /* calculate a worst-case loops-per-jiffy value
30 * based on maximum cpu core hz setting and the 30 * based on maximum cpu core hz setting and the
@@ -40,27 +40,10 @@ void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz,
40 preset_lpj = max_cpu_core_hz / value; 40 preset_lpj = max_cpu_core_hz / value;
41} 41}
42 42
43void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
44 unsigned int mult, unsigned int div)
45{
46 /* calculate a worst-case loops-per-jiffy value
47 * based on maximum cpu core mhz setting and the
48 * __delay() implementation in arch/arm/lib/delay.S
49 *
50 * this will result in a longer delay than expected
51 * when the cpu core runs on lower frequencies.
52 */
53
54 unsigned int value = (1000000 * mult) / (HZ * div);
55
56 if (!preset_lpj)
57 preset_lpj = max_cpu_core_mhz * value;
58}
59
60void __init shmobile_init_delay(void) 43void __init shmobile_init_delay(void)
61{ 44{
62 struct device_node *np, *cpus; 45 struct device_node *np, *cpus;
63 bool is_a8_a9 = false; 46 bool is_a7_a8_a9 = false;
64 bool is_a15 = false; 47 bool is_a15 = false;
65 u32 max_freq = 0; 48 u32 max_freq = 0;
66 49
@@ -74,9 +57,10 @@ void __init shmobile_init_delay(void)
74 if (!of_property_read_u32(np, "clock-frequency", &freq)) 57 if (!of_property_read_u32(np, "clock-frequency", &freq))
75 max_freq = max(max_freq, freq); 58 max_freq = max(max_freq, freq);
76 59
77 if (of_device_is_compatible(np, "arm,cortex-a8") || 60 if (of_device_is_compatible(np, "arm,cortex-a7") ||
61 of_device_is_compatible(np, "arm,cortex-a8") ||
78 of_device_is_compatible(np, "arm,cortex-a9")) 62 of_device_is_compatible(np, "arm,cortex-a9"))
79 is_a8_a9 = true; 63 is_a7_a8_a9 = true;
80 else if (of_device_is_compatible(np, "arm,cortex-a15")) 64 else if (of_device_is_compatible(np, "arm,cortex-a15"))
81 is_a15 = true; 65 is_a15 = true;
82 } 66 }
@@ -86,7 +70,7 @@ void __init shmobile_init_delay(void)
86 if (!max_freq) 70 if (!max_freq)
87 return; 71 return;
88 72
89 if (is_a8_a9) 73 if (is_a7_a8_a9)
90 shmobile_setup_delay_hz(max_freq, 1, 3); 74 shmobile_setup_delay_hz(max_freq, 1, 3);
91 else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) 75 else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
92 shmobile_setup_delay_hz(max_freq, 2, 4); 76 shmobile_setup_delay_hz(max_freq, 2, 4);
diff --git a/arch/arm/mach-spear/Kconfig b/arch/arm/mach-spear/Kconfig
index 6fd4dc88160b..b6f4bda273b3 100644
--- a/arch/arm/mach-spear/Kconfig
+++ b/arch/arm/mach-spear/Kconfig
@@ -4,7 +4,6 @@
4 4
5menuconfig PLAT_SPEAR 5menuconfig PLAT_SPEAR
6 bool "ST SPEAr Family" if ARCH_MULTI_V7 || ARCH_MULTI_V5 6 bool "ST SPEAr Family" if ARCH_MULTI_V7 || ARCH_MULTI_V5
7 default PLAT_SPEAR_SINGLE
8 select ARCH_REQUIRE_GPIOLIB 7 select ARCH_REQUIRE_GPIOLIB
9 select ARM_AMBA 8 select ARM_AMBA
10 select CLKSRC_MMIO 9 select CLKSRC_MMIO
@@ -13,7 +12,7 @@ if PLAT_SPEAR
13 12
14config ARCH_SPEAR13XX 13config ARCH_SPEAR13XX
15 bool "ST SPEAr13xx" 14 bool "ST SPEAr13xx"
16 depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE 15 depends on ARCH_MULTI_V7
17 select ARM_GIC 16 select ARM_GIC
18 select GPIO_SPEAR_SPICS 17 select GPIO_SPEAR_SPICS
19 select HAVE_ARM_SCU if SMP 18 select HAVE_ARM_SCU if SMP
@@ -44,7 +43,7 @@ endif #ARCH_SPEAR13XX
44 43
45config ARCH_SPEAR3XX 44config ARCH_SPEAR3XX
46 bool "ST SPEAr3xx" 45 bool "ST SPEAr3xx"
47 depends on ARCH_MULTI_V5 || PLAT_SPEAR_SINGLE 46 depends on ARCH_MULTI_V5
48 depends on !ARCH_SPEAR13XX 47 depends on !ARCH_SPEAR13XX
49 select ARM_VIC 48 select ARM_VIC
50 select PINCTRL 49 select PINCTRL
@@ -75,7 +74,7 @@ endif
75 74
76config ARCH_SPEAR6XX 75config ARCH_SPEAR6XX
77 bool "ST SPEAr6XX" 76 bool "ST SPEAr6XX"
78 depends on ARCH_MULTI_V5 || PLAT_SPEAR_SINGLE 77 depends on ARCH_MULTI_V5
79 depends on !ARCH_SPEAR13XX 78 depends on !ARCH_SPEAR13XX
80 select ARM_VIC 79 select ARM_VIC
81 help 80 help
@@ -88,7 +87,7 @@ config MACH_SPEAR600
88 Supports ST SPEAr600 boards configured via the device-tree 87 Supports ST SPEAr600 boards configured via the device-tree
89 88
90config ARCH_SPEAR_AUTO 89config ARCH_SPEAR_AUTO
91 def_bool PLAT_SPEAR_SINGLE 90 bool
92 depends on !ARCH_SPEAR13XX && !ARCH_SPEAR6XX 91 depends on !ARCH_SPEAR13XX && !ARCH_SPEAR6XX
93 select ARCH_SPEAR3XX 92 select ARCH_SPEAR3XX
94 93
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 42d4753683ce..d7598aeed803 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -12,81 +12,9 @@
12 12
13#include <linux/clk-provider.h> 13#include <linux/clk-provider.h>
14#include <linux/clocksource.h> 14#include <linux/clocksource.h>
15#include <linux/delay.h>
16#include <linux/kernel.h>
17#include <linux/init.h> 15#include <linux/init.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
20#include <linux/of_platform.h>
21#include <linux/io.h>
22#include <linux/reboot.h>
23 16
24#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/system_misc.h>
27
28#define SUN4I_WATCHDOG_CTRL_REG 0x00
29#define SUN4I_WATCHDOG_CTRL_RESTART BIT(0)
30#define SUN4I_WATCHDOG_MODE_REG 0x04
31#define SUN4I_WATCHDOG_MODE_ENABLE BIT(0)
32#define SUN4I_WATCHDOG_MODE_RESET_ENABLE BIT(1)
33
34#define SUN6I_WATCHDOG1_IRQ_REG 0x00
35#define SUN6I_WATCHDOG1_CTRL_REG 0x10
36#define SUN6I_WATCHDOG1_CTRL_RESTART BIT(0)
37#define SUN6I_WATCHDOG1_CONFIG_REG 0x14
38#define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0)
39#define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1)
40#define SUN6I_WATCHDOG1_MODE_REG 0x18
41#define SUN6I_WATCHDOG1_MODE_ENABLE BIT(0)
42
43static void __iomem *wdt_base;
44
45static void sun4i_restart(enum reboot_mode mode, const char *cmd)
46{
47 if (!wdt_base)
48 return;
49
50 /* Enable timer and set reset bit in the watchdog */
51 writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
52 wdt_base + SUN4I_WATCHDOG_MODE_REG);
53
54 /*
55 * Restart the watchdog. The default (and lowest) interval
56 * value for the watchdog is 0.5s.
57 */
58 writel(SUN4I_WATCHDOG_CTRL_RESTART, wdt_base + SUN4I_WATCHDOG_CTRL_REG);
59
60 while (1) {
61 mdelay(5);
62 writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
63 wdt_base + SUN4I_WATCHDOG_MODE_REG);
64 }
65}
66
67static struct of_device_id sunxi_restart_ids[] = {
68 { .compatible = "allwinner,sun4i-a10-wdt" },
69 { /*sentinel*/ }
70};
71
72static void sunxi_setup_restart(void)
73{
74 struct device_node *np;
75
76 np = of_find_matching_node(NULL, sunxi_restart_ids);
77 if (WARN(!np, "unable to setup watchdog restart"))
78 return;
79
80 wdt_base = of_iomap(np, 0);
81 WARN(!wdt_base, "failed to map watchdog base address");
82}
83
84static void __init sunxi_dt_init(void)
85{
86 sunxi_setup_restart();
87
88 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
89}
90 18
91static const char * const sunxi_board_dt_compat[] = { 19static const char * const sunxi_board_dt_compat[] = {
92 "allwinner,sun4i-a10", 20 "allwinner,sun4i-a10",
@@ -96,9 +24,7 @@ static const char * const sunxi_board_dt_compat[] = {
96}; 24};
97 25
98DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") 26DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
99 .init_machine = sunxi_dt_init,
100 .dt_compat = sunxi_board_dt_compat, 27 .dt_compat = sunxi_board_dt_compat,
101 .restart = sun4i_restart,
102MACHINE_END 28MACHINE_END
103 29
104static const char * const sun6i_board_dt_compat[] = { 30static const char * const sun6i_board_dt_compat[] = {
@@ -126,9 +52,7 @@ static const char * const sun7i_board_dt_compat[] = {
126}; 52};
127 53
128DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family") 54DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
129 .init_machine = sunxi_dt_init,
130 .dt_compat = sun7i_board_dt_compat, 55 .dt_compat = sun7i_board_dt_compat,
131 .restart = sun4i_restart,
132MACHINE_END 56MACHINE_END
133 57
134static const char * const sun8i_board_dt_compat[] = { 58static const char * const sun8i_board_dt_compat[] = {
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c
index ec55d1de1b55..475e783992fd 100644
--- a/arch/arm/mach-tegra/flowctrl.c
+++ b/arch/arm/mach-tegra/flowctrl.c
@@ -22,11 +22,12 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
25 27
26#include <soc/tegra/fuse.h> 28#include <soc/tegra/fuse.h>
27 29
28#include "flowctrl.h" 30#include "flowctrl.h"
29#include "iomap.h"
30 31
31static u8 flowctrl_offset_halt_cpu[] = { 32static u8 flowctrl_offset_halt_cpu[] = {
32 FLOW_CTRL_HALT_CPU0_EVENTS, 33 FLOW_CTRL_HALT_CPU0_EVENTS,
@@ -42,23 +43,22 @@ static u8 flowctrl_offset_cpu_csr[] = {
42 FLOW_CTRL_CPU1_CSR + 16, 43 FLOW_CTRL_CPU1_CSR + 16,
43}; 44};
44 45
46static void __iomem *tegra_flowctrl_base;
47
45static void flowctrl_update(u8 offset, u32 value) 48static void flowctrl_update(u8 offset, u32 value)
46{ 49{
47 void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset; 50 writel(value, tegra_flowctrl_base + offset);
48
49 writel(value, addr);
50 51
51 /* ensure the update has reached the flow controller */ 52 /* ensure the update has reached the flow controller */
52 wmb(); 53 wmb();
53 readl_relaxed(addr); 54 readl_relaxed(tegra_flowctrl_base + offset);
54} 55}
55 56
56u32 flowctrl_read_cpu_csr(unsigned int cpuid) 57u32 flowctrl_read_cpu_csr(unsigned int cpuid)
57{ 58{
58 u8 offset = flowctrl_offset_cpu_csr[cpuid]; 59 u8 offset = flowctrl_offset_cpu_csr[cpuid];
59 void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset;
60 60
61 return readl(addr); 61 return readl(tegra_flowctrl_base + offset);
62} 62}
63 63
64void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) 64void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
@@ -139,3 +139,33 @@ void flowctrl_cpu_suspend_exit(unsigned int cpuid)
139 reg |= FLOW_CTRL_CSR_EVENT_FLAG; /* clear event */ 139 reg |= FLOW_CTRL_CSR_EVENT_FLAG; /* clear event */
140 flowctrl_write_cpu_csr(cpuid, reg); 140 flowctrl_write_cpu_csr(cpuid, reg);
141} 141}
142
143static const struct of_device_id matches[] __initconst = {
144 { .compatible = "nvidia,tegra124-flowctrl" },
145 { .compatible = "nvidia,tegra114-flowctrl" },
146 { .compatible = "nvidia,tegra30-flowctrl" },
147 { .compatible = "nvidia,tegra20-flowctrl" },
148 { }
149};
150
151void __init tegra_flowctrl_init(void)
152{
153 /* hardcoded fallback if device tree node is missing */
154 unsigned long base = 0x60007000;
155 unsigned long size = SZ_4K;
156 struct device_node *np;
157
158 np = of_find_matching_node(NULL, matches);
159 if (np) {
160 struct resource res;
161
162 if (of_address_to_resource(np, 0, &res) == 0) {
163 size = resource_size(&res);
164 base = res.start;
165 }
166
167 of_node_put(np);
168 }
169
170 tegra_flowctrl_base = ioremap_nocache(base, size);
171}
diff --git a/arch/arm/mach-tegra/flowctrl.h b/arch/arm/mach-tegra/flowctrl.h
index c89aac60a143..73a9c5016c1a 100644
--- a/arch/arm/mach-tegra/flowctrl.h
+++ b/arch/arm/mach-tegra/flowctrl.h
@@ -59,6 +59,8 @@ void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value);
59 59
60void flowctrl_cpu_suspend_enter(unsigned int cpuid); 60void flowctrl_cpu_suspend_enter(unsigned int cpuid);
61void flowctrl_cpu_suspend_exit(unsigned int cpuid); 61void flowctrl_cpu_suspend_exit(unsigned int cpuid);
62
63void tegra_flowctrl_init(void);
62#endif 64#endif
63 65
64#endif 66#endif
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 5ef5173dec83..ef016af1c9e7 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -48,6 +48,7 @@
48#include "board.h" 48#include "board.h"
49#include "common.h" 49#include "common.h"
50#include "cpuidle.h" 50#include "cpuidle.h"
51#include "flowctrl.h"
51#include "iomap.h" 52#include "iomap.h"
52#include "irq.h" 53#include "irq.h"
53#include "pm.h" 54#include "pm.h"
@@ -74,6 +75,7 @@ static void __init tegra_init_early(void)
74{ 75{
75 of_register_trusted_foundations(); 76 of_register_trusted_foundations();
76 tegra_cpu_reset_handler_init(); 77 tegra_cpu_reset_handler_init();
78 tegra_flowctrl_init();
77} 79}
78 80
79static void __init tegra_dt_init_irq(void) 81static void __init tegra_dt_init_irq(void)
diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c
index 2c2754e79cb3..f61158c6ce71 100644
--- a/arch/arm/mach-vexpress/spc.c
+++ b/arch/arm/mach-vexpress/spc.c
@@ -426,9 +426,15 @@ static int ve_spc_populate_opps(uint32_t cluster)
426 426
427static int ve_init_opp_table(struct device *cpu_dev) 427static int ve_init_opp_table(struct device *cpu_dev)
428{ 428{
429 int cluster = topology_physical_package_id(cpu_dev->id); 429 int cluster;
430 int idx, ret = 0, max_opp = info->num_opps[cluster]; 430 int idx, ret = 0, max_opp;
431 struct ve_spc_opp *opps = info->opps[cluster]; 431 struct ve_spc_opp *opps;
432
433 cluster = topology_physical_package_id(cpu_dev->id);
434 cluster = cluster < 0 ? 0 : cluster;
435
436 max_opp = info->num_opps[cluster];
437 opps = info->opps[cluster];
432 438
433 for (idx = 0; idx < max_opp; idx++, opps++) { 439 for (idx = 0; idx < max_opp; idx++, opps++) {
434 ret = dev_pm_opp_add(cpu_dev, opps->freq * 1000, opps->u_volt); 440 ret = dev_pm_opp_add(cpu_dev, opps->freq * 1000, opps->u_volt);
@@ -537,6 +543,8 @@ static struct clk *ve_spc_clk_register(struct device *cpu_dev)
537 spc->hw.init = &init; 543 spc->hw.init = &init;
538 spc->cluster = topology_physical_package_id(cpu_dev->id); 544 spc->cluster = topology_physical_package_id(cpu_dev->id);
539 545
546 spc->cluster = spc->cluster < 0 ? 0 : spc->cluster;
547
540 init.name = dev_name(cpu_dev); 548 init.name = dev_name(cpu_dev);
541 init.ops = &clk_spc_ops; 549 init.ops = &clk_spc_ops;
542 init.flags = CLK_IS_ROOT | CLK_GET_RATE_NOCACHE; 550 init.flags = CLK_IS_ROOT | CLK_GET_RATE_NOCACHE;
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index 2da7be31e7e2..3bc0dc9a4d69 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -69,7 +69,7 @@ static void vt8500_power_off(void)
69{ 69{
70 local_irq_disable(); 70 local_irq_disable();
71 writew(5, pmc_base + VT8500_HCR_REG); 71 writew(5, pmc_base + VT8500_HCR_REG);
72 asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); 72 asm("mcr p15, 0, %0, c7, c0, 4" : : "r" (0));
73} 73}
74 74
75static void __init vt8500_init(void) 75static void __init vt8500_init(void)
diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile
index 1b25d92ebf22..c85fb3f7d5cd 100644
--- a/arch/arm/mach-zynq/Makefile
+++ b/arch/arm/mach-zynq/Makefile
@@ -3,8 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := common.o slcr.o 6obj-y := common.o slcr.o pm.o
7CFLAGS_REMOVE_hotplug.o =-march=armv6k 7CFLAGS_REMOVE_hotplug.o =-march=armv6k
8CFLAGS_hotplug.o =-Wa,-march=armv7-a -mcpu=cortex-a9 8CFLAGS_hotplug.o =-Wa,-march=armv7-a -mcpu=cortex-a9
9obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
10obj-$(CONFIG_SMP) += headsmp.o platsmp.o 9obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 31a6fa40ba37..26f92c28d22b 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -98,13 +98,19 @@ static int __init zynq_get_revision(void)
98 return revision; 98 return revision;
99} 99}
100 100
101static void __init zynq_init_late(void)
102{
103 zynq_core_pm_init();
104 zynq_pm_late_init();
105}
106
101/** 107/**
102 * zynq_init_machine - System specific initialization, intended to be 108 * zynq_init_machine - System specific initialization, intended to be
103 * called from board specific initialization. 109 * called from board specific initialization.
104 */ 110 */
105static void __init zynq_init_machine(void) 111static void __init zynq_init_machine(void)
106{ 112{
107 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 113 struct platform_device_info devinfo = { .name = "cpufreq-dt", };
108 struct soc_device_attribute *soc_dev_attr; 114 struct soc_device_attribute *soc_dev_attr;
109 struct soc_device *soc_dev; 115 struct soc_device *soc_dev;
110 struct device *parent = NULL; 116 struct device *parent = NULL;
@@ -198,12 +204,13 @@ static const char * const zynq_dt_match[] = {
198 204
199DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") 205DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
200 /* 64KB way size, 8-way associativity, parity disabled */ 206 /* 64KB way size, 8-way associativity, parity disabled */
201 .l2c_aux_val = 0x02000000, 207 .l2c_aux_val = 0x00000000,
202 .l2c_aux_mask = 0xf0ffffff, 208 .l2c_aux_mask = 0xffffffff,
203 .smp = smp_ops(zynq_smp_ops), 209 .smp = smp_ops(zynq_smp_ops),
204 .map_io = zynq_map_io, 210 .map_io = zynq_map_io,
205 .init_irq = zynq_irq_init, 211 .init_irq = zynq_irq_init,
206 .init_machine = zynq_init_machine, 212 .init_machine = zynq_init_machine,
213 .init_late = zynq_init_late,
207 .init_time = zynq_timer_init, 214 .init_time = zynq_timer_init,
208 .dt_compat = zynq_dt_match, 215 .dt_compat = zynq_dt_match,
209 .reserve = zynq_memory_init, 216 .reserve = zynq_memory_init,
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index f652f0a884a6..2bc71273c73c 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -24,6 +24,8 @@ extern int zynq_early_slcr_init(void);
24extern void zynq_slcr_system_reset(void); 24extern void zynq_slcr_system_reset(void);
25extern void zynq_slcr_cpu_stop(int cpu); 25extern void zynq_slcr_cpu_stop(int cpu);
26extern void zynq_slcr_cpu_start(int cpu); 26extern void zynq_slcr_cpu_start(int cpu);
27extern bool zynq_slcr_cpu_state_read(int cpu);
28extern void zynq_slcr_cpu_state_write(int cpu, bool die);
27extern u32 zynq_slcr_get_device_id(void); 29extern u32 zynq_slcr_get_device_id(void);
28 30
29#ifdef CONFIG_SMP 31#ifdef CONFIG_SMP
@@ -37,7 +39,17 @@ extern struct smp_operations zynq_smp_ops __initdata;
37 39
38extern void __iomem *zynq_scu_base; 40extern void __iomem *zynq_scu_base;
39 41
40/* Hotplug */ 42void zynq_pm_late_init(void);
41extern void zynq_platform_cpu_die(unsigned int cpu); 43
44static inline void zynq_core_pm_init(void)
45{
46 /* A9 clock gating */
47 asm volatile ("mrc p15, 0, r12, c15, c0, 0\n"
48 "orr r12, r12, #1\n"
49 "mcr p15, 0, r12, c15, c0, 0\n"
50 : /* no outputs */
51 : /* no inputs */
52 : "r12");
53}
42 54
43#endif 55#endif
diff --git a/arch/arm/mach-zynq/hotplug.c b/arch/arm/mach-zynq/hotplug.c
index 5052c70326e4..b685c89f11e4 100644
--- a/arch/arm/mach-zynq/hotplug.c
+++ b/arch/arm/mach-zynq/hotplug.c
@@ -10,50 +10,5 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#include <linux/kernel.h> 13#include <asm/proc-fns.h>
14#include <linux/errno.h>
15#include <linux/smp.h>
16 14
17#include <asm/cacheflush.h>
18#include <asm/cp15.h>
19#include "common.h"
20
21static inline void zynq_cpu_enter_lowpower(void)
22{
23 unsigned int v;
24
25 flush_cache_all();
26 asm volatile(
27 " mcr p15, 0, %1, c7, c5, 0\n"
28 " dsb\n"
29 /*
30 * Turn off coherency
31 */
32 " mrc p15, 0, %0, c1, c0, 1\n"
33 " bic %0, %0, #0x40\n"
34 " mcr p15, 0, %0, c1, c0, 1\n"
35 " mrc p15, 0, %0, c1, c0, 0\n"
36 " bic %0, %0, %2\n"
37 " mcr p15, 0, %0, c1, c0, 0\n"
38 : "=&r" (v)
39 : "r" (0), "Ir" (CR_C)
40 : "cc");
41}
42
43/*
44 * platform-specific code to shutdown a CPU
45 *
46 * Called with IRQs disabled
47 */
48void zynq_platform_cpu_die(unsigned int cpu)
49{
50 zynq_cpu_enter_lowpower();
51
52 /*
53 * there is no power-control hardware on this platform, so all
54 * we can do is put the core into WFI; this is safe as the calling
55 * code will have already disabled interrupts
56 */
57 for (;;)
58 cpu_do_idle();
59}
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index abc82ef085c1..52d768ff7857 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -112,20 +112,59 @@ static void __init zynq_smp_prepare_cpus(unsigned int max_cpus)
112 scu_enable(zynq_scu_base); 112 scu_enable(zynq_scu_base);
113} 113}
114 114
115/**
116 * zynq_secondary_init - Initialize secondary CPU cores
117 * @cpu: CPU that is initialized
118 *
119 * This function is in the hotplug path. Don't move it into the
120 * init section!!
121 */
122static void zynq_secondary_init(unsigned int cpu)
123{
124 zynq_core_pm_init();
125}
126
115#ifdef CONFIG_HOTPLUG_CPU 127#ifdef CONFIG_HOTPLUG_CPU
116static int zynq_cpu_kill(unsigned cpu) 128static int zynq_cpu_kill(unsigned cpu)
117{ 129{
130 unsigned long timeout = jiffies + msecs_to_jiffies(50);
131
132 while (zynq_slcr_cpu_state_read(cpu))
133 if (time_after(jiffies, timeout))
134 return 0;
135
118 zynq_slcr_cpu_stop(cpu); 136 zynq_slcr_cpu_stop(cpu);
119 return 1; 137 return 1;
120} 138}
139
140/**
141 * zynq_cpu_die - Let a CPU core die
142 * @cpu: Dying CPU
143 *
144 * Platform-specific code to shutdown a CPU.
145 * Called with IRQs disabled on the dying CPU.
146 */
147static void zynq_cpu_die(unsigned int cpu)
148{
149 zynq_slcr_cpu_state_write(cpu, true);
150
151 /*
152 * there is no power-control hardware on this platform, so all
153 * we can do is put the core into WFI; this is safe as the calling
154 * code will have already disabled interrupts
155 */
156 for (;;)
157 cpu_do_idle();
158}
121#endif 159#endif
122 160
123struct smp_operations zynq_smp_ops __initdata = { 161struct smp_operations zynq_smp_ops __initdata = {
124 .smp_init_cpus = zynq_smp_init_cpus, 162 .smp_init_cpus = zynq_smp_init_cpus,
125 .smp_prepare_cpus = zynq_smp_prepare_cpus, 163 .smp_prepare_cpus = zynq_smp_prepare_cpus,
126 .smp_boot_secondary = zynq_boot_secondary, 164 .smp_boot_secondary = zynq_boot_secondary,
165 .smp_secondary_init = zynq_secondary_init,
127#ifdef CONFIG_HOTPLUG_CPU 166#ifdef CONFIG_HOTPLUG_CPU
128 .cpu_die = zynq_platform_cpu_die, 167 .cpu_die = zynq_cpu_die,
129 .cpu_kill = zynq_cpu_kill, 168 .cpu_kill = zynq_cpu_kill,
130#endif 169#endif
131}; 170};
diff --git a/arch/arm/mach-zynq/pm.c b/arch/arm/mach-zynq/pm.c
new file mode 100644
index 000000000000..911fcf865be8
--- /dev/null
+++ b/arch/arm/mach-zynq/pm.c
@@ -0,0 +1,83 @@
1/*
2 * Zynq power management
3 *
4 * Copyright (C) 2012 - 2014 Xilinx
5 *
6 * Sören Brinkmann <soren.brinkmann@xilinx.com>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <linux/io.h>
23#include <linux/of_address.h>
24#include <linux/of_device.h>
25#include "common.h"
26
27/* register offsets */
28#define DDRC_CTRL_REG1_OFFS 0x60
29#define DDRC_DRAM_PARAM_REG3_OFFS 0x20
30
31/* bitfields */
32#define DDRC_CLOCKSTOP_MASK BIT(23)
33#define DDRC_SELFREFRESH_MASK BIT(12)
34
35static void __iomem *ddrc_base;
36
37/**
38 * zynq_pm_ioremap() - Create IO mappings
39 * @comp: DT compatible string
40 * Return: Pointer to the mapped memory or NULL.
41 *
42 * Remap the memory region for a compatible DT node.
43 */
44static void __iomem *zynq_pm_ioremap(const char *comp)
45{
46 struct device_node *np;
47 void __iomem *base = NULL;
48
49 np = of_find_compatible_node(NULL, NULL, comp);
50 if (np) {
51 base = of_iomap(np, 0);
52 of_node_put(np);
53 } else {
54 pr_warn("%s: no compatible node found for '%s'\n", __func__,
55 comp);
56 }
57
58 return base;
59}
60
61/**
62 * zynq_pm_late_init() - Power management init
63 *
64 * Initialization of power management related featurs and infrastructure.
65 */
66void __init zynq_pm_late_init(void)
67{
68 u32 reg;
69
70 ddrc_base = zynq_pm_ioremap("xlnx,zynq-ddrc-a05");
71 if (!ddrc_base) {
72 pr_warn("%s: Unable to map DDRC IO memory.\n", __func__);
73 } else {
74 /*
75 * Enable DDRC clock stop feature. The HW takes care of
76 * entering/exiting the correct mode depending
77 * on activity state.
78 */
79 reg = readl(ddrc_base + DDRC_DRAM_PARAM_REG3_OFFS);
80 reg |= DDRC_CLOCKSTOP_MASK;
81 writel(reg, ddrc_base + DDRC_DRAM_PARAM_REG3_OFFS);
82 }
83}
diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c
index c43a2d16e223..d4cb50cf97c0 100644
--- a/arch/arm/mach-zynq/slcr.c
+++ b/arch/arm/mach-zynq/slcr.c
@@ -138,6 +138,8 @@ void zynq_slcr_cpu_start(int cpu)
138 zynq_slcr_write(reg, SLCR_A9_CPU_RST_CTRL_OFFSET); 138 zynq_slcr_write(reg, SLCR_A9_CPU_RST_CTRL_OFFSET);
139 reg &= ~(SLCR_A9_CPU_CLKSTOP << cpu); 139 reg &= ~(SLCR_A9_CPU_CLKSTOP << cpu);
140 zynq_slcr_write(reg, SLCR_A9_CPU_RST_CTRL_OFFSET); 140 zynq_slcr_write(reg, SLCR_A9_CPU_RST_CTRL_OFFSET);
141
142 zynq_slcr_cpu_state_write(cpu, false);
141} 143}
142 144
143/** 145/**
@@ -154,8 +156,47 @@ void zynq_slcr_cpu_stop(int cpu)
154} 156}
155 157
156/** 158/**
157 * zynq_slcr_init - Regular slcr driver init 159 * zynq_slcr_cpu_state - Read/write cpu state
160 * @cpu: cpu number
158 * 161 *
162 * SLCR_REBOOT_STATUS save upper 2 bits (31/30 cpu states for cpu0 and cpu1)
163 * 0 means cpu is running, 1 cpu is going to die.
164 *
165 * Return: true if cpu is running, false if cpu is going to die
166 */
167bool zynq_slcr_cpu_state_read(int cpu)
168{
169 u32 state;
170
171 state = readl(zynq_slcr_base + SLCR_REBOOT_STATUS_OFFSET);
172 state &= 1 << (31 - cpu);
173
174 return !state;
175}
176
177/**
178 * zynq_slcr_cpu_state - Read/write cpu state
179 * @cpu: cpu number
180 * @die: cpu state - true if cpu is going to die
181 *
182 * SLCR_REBOOT_STATUS save upper 2 bits (31/30 cpu states for cpu0 and cpu1)
183 * 0 means cpu is running, 1 cpu is going to die.
184 */
185void zynq_slcr_cpu_state_write(int cpu, bool die)
186{
187 u32 state, mask;
188
189 state = readl(zynq_slcr_base + SLCR_REBOOT_STATUS_OFFSET);
190 mask = 1 << (31 - cpu);
191 if (die)
192 state |= mask;
193 else
194 state &= ~mask;
195 writel(state, zynq_slcr_base + SLCR_REBOOT_STATUS_OFFSET);
196}
197
198/**
199 * zynq_slcr_init - Regular slcr driver init
159 * Return: 0 on success, negative errno otherwise. 200 * Return: 0 on success, negative errno otherwise.
160 * 201 *
161 * Called early during boot from platform code to remap SLCR area. 202 * Called early during boot from platform code to remap SLCR area.
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index 3815a8262af0..8c48c5c22a33 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -17,12 +17,6 @@
17 */ 17 */
18 .align 5 18 .align 5
19ENTRY(v6_early_abort) 19ENTRY(v6_early_abort)
20#ifdef CONFIG_CPU_V6
21 sub r1, sp, #4 @ Get unused stack location
22 strex r0, r1, [r1] @ Clear the exclusive monitor
23#elif defined(CONFIG_CPU_32v6K)
24 clrex
25#endif
26 mrc p15, 0, r1, c5, c0, 0 @ get FSR 20 mrc p15, 0, r1, c5, c0, 0 @ get FSR
27 mrc p15, 0, r0, c6, c0, 0 @ get FAR 21 mrc p15, 0, r0, c6, c0, 0 @ get FAR
28/* 22/*
diff --git a/arch/arm/mm/abort-ev7.S b/arch/arm/mm/abort-ev7.S
index 703375277ba6..4812ad054214 100644
--- a/arch/arm/mm/abort-ev7.S
+++ b/arch/arm/mm/abort-ev7.S
@@ -13,12 +13,6 @@
13 */ 13 */
14 .align 5 14 .align 5
15ENTRY(v7_early_abort) 15ENTRY(v7_early_abort)
16 /*
17 * The effect of data aborts on on the exclusive access monitor are
18 * UNPREDICTABLE. Do a CLREX to clear the state
19 */
20 clrex
21
22 mrc p15, 0, r1, c5, c0, 0 @ get FSR 16 mrc p15, 0, r1, c5, c0, 0 @ get FSR
23 mrc p15, 0, r0, c6, c0, 0 @ get FAR 17 mrc p15, 0, r0, c6, c0, 0 @ get FAR
24 18
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 0c1ab49e5f7b..83792f4324ea 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -41,6 +41,7 @@
41 * This code is not portable to processors with late data abort handling. 41 * This code is not portable to processors with late data abort handling.
42 */ 42 */
43#define CODING_BITS(i) (i & 0x0e000000) 43#define CODING_BITS(i) (i & 0x0e000000)
44#define COND_BITS(i) (i & 0xf0000000)
44 45
45#define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */ 46#define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */
46#define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */ 47#define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */
@@ -821,6 +822,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
821 break; 822 break;
822 823
823 case 0x04000000: /* ldr or str immediate */ 824 case 0x04000000: /* ldr or str immediate */
825 if (COND_BITS(instr) == 0xf0000000) /* NEON VLDn, VSTn */
826 goto bad;
824 offset.un = OFFSET_BITS(instr); 827 offset.un = OFFSET_BITS(instr);
825 handler = do_alignment_ldrstr; 828 handler = do_alignment_ldrstr;
826 break; 829 break;
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 5f2c988a06ac..55f9d6e0cc88 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/log2.h>
24#include <linux/io.h> 25#include <linux/io.h>
25#include <linux/of.h> 26#include <linux/of.h>
26#include <linux/of_address.h> 27#include <linux/of_address.h>
@@ -945,6 +946,98 @@ static int l2_wt_override;
945 * pass it though the device tree */ 946 * pass it though the device tree */
946static u32 cache_id_part_number_from_dt; 947static u32 cache_id_part_number_from_dt;
947 948
949/**
950 * l2x0_cache_size_of_parse() - read cache size parameters from DT
951 * @np: the device tree node for the l2 cache
952 * @aux_val: pointer to machine-supplied auxilary register value, to
953 * be augmented by the call (bits to be set to 1)
954 * @aux_mask: pointer to machine-supplied auxilary register mask, to
955 * be augmented by the call (bits to be set to 0)
956 * @associativity: variable to return the calculated associativity in
957 * @max_way_size: the maximum size in bytes for the cache ways
958 */
959static void __init l2x0_cache_size_of_parse(const struct device_node *np,
960 u32 *aux_val, u32 *aux_mask,
961 u32 *associativity,
962 u32 max_way_size)
963{
964 u32 mask = 0, val = 0;
965 u32 cache_size = 0, sets = 0;
966 u32 way_size_bits = 1;
967 u32 way_size = 0;
968 u32 block_size = 0;
969 u32 line_size = 0;
970
971 of_property_read_u32(np, "cache-size", &cache_size);
972 of_property_read_u32(np, "cache-sets", &sets);
973 of_property_read_u32(np, "cache-block-size", &block_size);
974 of_property_read_u32(np, "cache-line-size", &line_size);
975
976 if (!cache_size || !sets)
977 return;
978
979 /* All these l2 caches have the same line = block size actually */
980 if (!line_size) {
981 if (block_size) {
982 /* If linesize if not given, it is equal to blocksize */
983 line_size = block_size;
984 } else {
985 /* Fall back to known size */
986 pr_warn("L2C OF: no cache block/line size given: "
987 "falling back to default size %d bytes\n",
988 CACHE_LINE_SIZE);
989 line_size = CACHE_LINE_SIZE;
990 }
991 }
992
993 if (line_size != CACHE_LINE_SIZE)
994 pr_warn("L2C OF: DT supplied line size %d bytes does "
995 "not match hardware line size of %d bytes\n",
996 line_size,
997 CACHE_LINE_SIZE);
998
999 /*
1000 * Since:
1001 * set size = cache size / sets
1002 * ways = cache size / (sets * line size)
1003 * way size = cache size / (cache size / (sets * line size))
1004 * way size = sets * line size
1005 * associativity = ways = cache size / way size
1006 */
1007 way_size = sets * line_size;
1008 *associativity = cache_size / way_size;
1009
1010 if (way_size > max_way_size) {
1011 pr_err("L2C OF: set size %dKB is too large\n", way_size);
1012 return;
1013 }
1014
1015 pr_info("L2C OF: override cache size: %d bytes (%dKB)\n",
1016 cache_size, cache_size >> 10);
1017 pr_info("L2C OF: override line size: %d bytes\n", line_size);
1018 pr_info("L2C OF: override way size: %d bytes (%dKB)\n",
1019 way_size, way_size >> 10);
1020 pr_info("L2C OF: override associativity: %d\n", *associativity);
1021
1022 /*
1023 * Calculates the bits 17:19 to set for way size:
1024 * 512KB -> 6, 256KB -> 5, ... 16KB -> 1
1025 */
1026 way_size_bits = ilog2(way_size >> 10) - 3;
1027 if (way_size_bits < 1 || way_size_bits > 6) {
1028 pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n",
1029 way_size);
1030 return;
1031 }
1032
1033 mask |= L2C_AUX_CTRL_WAY_SIZE_MASK;
1034 val |= (way_size_bits << L2C_AUX_CTRL_WAY_SIZE_SHIFT);
1035
1036 *aux_val &= ~mask;
1037 *aux_val |= val;
1038 *aux_mask &= ~mask;
1039}
1040
948static void __init l2x0_of_parse(const struct device_node *np, 1041static void __init l2x0_of_parse(const struct device_node *np,
949 u32 *aux_val, u32 *aux_mask) 1042 u32 *aux_val, u32 *aux_mask)
950{ 1043{
@@ -952,6 +1045,7 @@ static void __init l2x0_of_parse(const struct device_node *np,
952 u32 tag = 0; 1045 u32 tag = 0;
953 u32 dirty = 0; 1046 u32 dirty = 0;
954 u32 val = 0, mask = 0; 1047 u32 val = 0, mask = 0;
1048 u32 assoc;
955 1049
956 of_property_read_u32(np, "arm,tag-latency", &tag); 1050 of_property_read_u32(np, "arm,tag-latency", &tag);
957 if (tag) { 1051 if (tag) {
@@ -974,6 +1068,15 @@ static void __init l2x0_of_parse(const struct device_node *np,
974 val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; 1068 val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT;
975 } 1069 }
976 1070
1071 l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K);
1072 if (assoc > 8) {
1073 pr_err("l2x0 of: cache setting yield too high associativity\n");
1074 pr_err("l2x0 of: %d calculated, max 8\n", assoc);
1075 } else {
1076 mask |= L2X0_AUX_CTRL_ASSOC_MASK;
1077 val |= (assoc << L2X0_AUX_CTRL_ASSOC_SHIFT);
1078 }
1079
977 *aux_val &= ~mask; 1080 *aux_val &= ~mask;
978 *aux_val |= val; 1081 *aux_val |= val;
979 *aux_mask &= ~mask; 1082 *aux_mask &= ~mask;
@@ -1021,6 +1124,7 @@ static void __init l2c310_of_parse(const struct device_node *np,
1021 u32 data[3] = { 0, 0, 0 }; 1124 u32 data[3] = { 0, 0, 0 };
1022 u32 tag[3] = { 0, 0, 0 }; 1125 u32 tag[3] = { 0, 0, 0 };
1023 u32 filter[2] = { 0, 0 }; 1126 u32 filter[2] = { 0, 0 };
1127 u32 assoc;
1024 1128
1025 of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); 1129 of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));
1026 if (tag[0] && tag[1] && tag[2]) 1130 if (tag[0] && tag[1] && tag[2])
@@ -1047,6 +1151,23 @@ static void __init l2c310_of_parse(const struct device_node *np,
1047 writel_relaxed((filter[0] & ~(SZ_1M - 1)) | L310_ADDR_FILTER_EN, 1151 writel_relaxed((filter[0] & ~(SZ_1M - 1)) | L310_ADDR_FILTER_EN,
1048 l2x0_base + L310_ADDR_FILTER_START); 1152 l2x0_base + L310_ADDR_FILTER_START);
1049 } 1153 }
1154
1155 l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K);
1156 switch (assoc) {
1157 case 16:
1158 *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
1159 *aux_val |= L310_AUX_CTRL_ASSOCIATIVITY_16;
1160 *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
1161 break;
1162 case 8:
1163 *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
1164 *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
1165 break;
1166 default:
1167 pr_err("PL310 OF: cache setting yield illegal associativity\n");
1168 pr_err("PL310 OF: %d calculated, only 8 and 16 legal\n", assoc);
1169 break;
1170 }
1050} 1171}
1051 1172
1052static const struct l2c_init_data of_l2c310_data __initconst = { 1173static const struct l2c_init_data of_l2c310_data __initconst = {
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 7a996aaa061e..c245d903927f 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -12,6 +12,7 @@
12#include <linux/bootmem.h> 12#include <linux/bootmem.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/genalloc.h>
15#include <linux/gfp.h> 16#include <linux/gfp.h>
16#include <linux/errno.h> 17#include <linux/errno.h>
17#include <linux/list.h> 18#include <linux/list.h>
@@ -298,57 +299,29 @@ static void *
298__dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot, 299__dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot,
299 const void *caller) 300 const void *caller)
300{ 301{
301 struct vm_struct *area;
302 unsigned long addr;
303
304 /* 302 /*
305 * DMA allocation can be mapped to user space, so lets 303 * DMA allocation can be mapped to user space, so lets
306 * set VM_USERMAP flags too. 304 * set VM_USERMAP flags too.
307 */ 305 */
308 area = get_vm_area_caller(size, VM_ARM_DMA_CONSISTENT | VM_USERMAP, 306 return dma_common_contiguous_remap(page, size,
309 caller); 307 VM_ARM_DMA_CONSISTENT | VM_USERMAP,
310 if (!area) 308 prot, caller);
311 return NULL;
312 addr = (unsigned long)area->addr;
313 area->phys_addr = __pfn_to_phys(page_to_pfn(page));
314
315 if (ioremap_page_range(addr, addr + size, area->phys_addr, prot)) {
316 vunmap((void *)addr);
317 return NULL;
318 }
319 return (void *)addr;
320} 309}
321 310
322static void __dma_free_remap(void *cpu_addr, size_t size) 311static void __dma_free_remap(void *cpu_addr, size_t size)
323{ 312{
324 unsigned int flags = VM_ARM_DMA_CONSISTENT | VM_USERMAP; 313 dma_common_free_remap(cpu_addr, size,
325 struct vm_struct *area = find_vm_area(cpu_addr); 314 VM_ARM_DMA_CONSISTENT | VM_USERMAP);
326 if (!area || (area->flags & flags) != flags) {
327 WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr);
328 return;
329 }
330 unmap_kernel_range((unsigned long)cpu_addr, size);
331 vunmap(cpu_addr);
332} 315}
333 316
334#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K 317#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
318static struct gen_pool *atomic_pool;
335 319
336struct dma_pool { 320static size_t atomic_pool_size = DEFAULT_DMA_COHERENT_POOL_SIZE;
337 size_t size;
338 spinlock_t lock;
339 unsigned long *bitmap;
340 unsigned long nr_pages;
341 void *vaddr;
342 struct page **pages;
343};
344
345static struct dma_pool atomic_pool = {
346 .size = DEFAULT_DMA_COHERENT_POOL_SIZE,
347};
348 321
349static int __init early_coherent_pool(char *p) 322static int __init early_coherent_pool(char *p)
350{ 323{
351 atomic_pool.size = memparse(p, &p); 324 atomic_pool_size = memparse(p, &p);
352 return 0; 325 return 0;
353} 326}
354early_param("coherent_pool", early_coherent_pool); 327early_param("coherent_pool", early_coherent_pool);
@@ -358,14 +331,14 @@ void __init init_dma_coherent_pool_size(unsigned long size)
358 /* 331 /*
359 * Catch any attempt to set the pool size too late. 332 * Catch any attempt to set the pool size too late.
360 */ 333 */
361 BUG_ON(atomic_pool.vaddr); 334 BUG_ON(atomic_pool);
362 335
363 /* 336 /*
364 * Set architecture specific coherent pool size only if 337 * Set architecture specific coherent pool size only if
365 * it has not been changed by kernel command line parameter. 338 * it has not been changed by kernel command line parameter.
366 */ 339 */
367 if (atomic_pool.size == DEFAULT_DMA_COHERENT_POOL_SIZE) 340 if (atomic_pool_size == DEFAULT_DMA_COHERENT_POOL_SIZE)
368 atomic_pool.size = size; 341 atomic_pool_size = size;
369} 342}
370 343
371/* 344/*
@@ -373,52 +346,44 @@ void __init init_dma_coherent_pool_size(unsigned long size)
373 */ 346 */
374static int __init atomic_pool_init(void) 347static int __init atomic_pool_init(void)
375{ 348{
376 struct dma_pool *pool = &atomic_pool;
377 pgprot_t prot = pgprot_dmacoherent(PAGE_KERNEL); 349 pgprot_t prot = pgprot_dmacoherent(PAGE_KERNEL);
378 gfp_t gfp = GFP_KERNEL | GFP_DMA; 350 gfp_t gfp = GFP_KERNEL | GFP_DMA;
379 unsigned long nr_pages = pool->size >> PAGE_SHIFT;
380 unsigned long *bitmap;
381 struct page *page; 351 struct page *page;
382 struct page **pages;
383 void *ptr; 352 void *ptr;
384 int bitmap_size = BITS_TO_LONGS(nr_pages) * sizeof(long);
385 353
386 bitmap = kzalloc(bitmap_size, GFP_KERNEL); 354 atomic_pool = gen_pool_create(PAGE_SHIFT, -1);
387 if (!bitmap) 355 if (!atomic_pool)
388 goto no_bitmap; 356 goto out;
389
390 pages = kzalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
391 if (!pages)
392 goto no_pages;
393 357
394 if (dev_get_cma_area(NULL)) 358 if (dev_get_cma_area(NULL))
395 ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page, 359 ptr = __alloc_from_contiguous(NULL, atomic_pool_size, prot,
396 atomic_pool_init); 360 &page, atomic_pool_init);
397 else 361 else
398 ptr = __alloc_remap_buffer(NULL, pool->size, gfp, prot, &page, 362 ptr = __alloc_remap_buffer(NULL, atomic_pool_size, gfp, prot,
399 atomic_pool_init); 363 &page, atomic_pool_init);
400 if (ptr) { 364 if (ptr) {
401 int i; 365 int ret;
402 366
403 for (i = 0; i < nr_pages; i++) 367 ret = gen_pool_add_virt(atomic_pool, (unsigned long)ptr,
404 pages[i] = page + i; 368 page_to_phys(page),
405 369 atomic_pool_size, -1);
406 spin_lock_init(&pool->lock); 370 if (ret)
407 pool->vaddr = ptr; 371 goto destroy_genpool;
408 pool->pages = pages; 372
409 pool->bitmap = bitmap; 373 gen_pool_set_algo(atomic_pool,
410 pool->nr_pages = nr_pages; 374 gen_pool_first_fit_order_align,
411 pr_info("DMA: preallocated %u KiB pool for atomic coherent allocations\n", 375 (void *)PAGE_SHIFT);
412 (unsigned)pool->size / 1024); 376 pr_info("DMA: preallocated %zd KiB pool for atomic coherent allocations\n",
377 atomic_pool_size / 1024);
413 return 0; 378 return 0;
414 } 379 }
415 380
416 kfree(pages); 381destroy_genpool:
417no_pages: 382 gen_pool_destroy(atomic_pool);
418 kfree(bitmap); 383 atomic_pool = NULL;
419no_bitmap: 384out:
420 pr_err("DMA: failed to allocate %u KiB pool for atomic coherent allocation\n", 385 pr_err("DMA: failed to allocate %zx KiB pool for atomic coherent allocation\n",
421 (unsigned)pool->size / 1024); 386 atomic_pool_size / 1024);
422 return -ENOMEM; 387 return -ENOMEM;
423} 388}
424/* 389/*
@@ -522,76 +487,36 @@ static void *__alloc_remap_buffer(struct device *dev, size_t size, gfp_t gfp,
522 487
523static void *__alloc_from_pool(size_t size, struct page **ret_page) 488static void *__alloc_from_pool(size_t size, struct page **ret_page)
524{ 489{
525 struct dma_pool *pool = &atomic_pool; 490 unsigned long val;
526 unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
527 unsigned int pageno;
528 unsigned long flags;
529 void *ptr = NULL; 491 void *ptr = NULL;
530 unsigned long align_mask;
531 492
532 if (!pool->vaddr) { 493 if (!atomic_pool) {
533 WARN(1, "coherent pool not initialised!\n"); 494 WARN(1, "coherent pool not initialised!\n");
534 return NULL; 495 return NULL;
535 } 496 }
536 497
537 /* 498 val = gen_pool_alloc(atomic_pool, size);
538 * Align the region allocation - allocations from pool are rather 499 if (val) {
539 * small, so align them to their order in pages, minimum is a page 500 phys_addr_t phys = gen_pool_virt_to_phys(atomic_pool, val);
540 * size. This helps reduce fragmentation of the DMA space. 501
541 */ 502 *ret_page = phys_to_page(phys);
542 align_mask = (1 << get_order(size)) - 1; 503 ptr = (void *)val;
543
544 spin_lock_irqsave(&pool->lock, flags);
545 pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages,
546 0, count, align_mask);
547 if (pageno < pool->nr_pages) {
548 bitmap_set(pool->bitmap, pageno, count);
549 ptr = pool->vaddr + PAGE_SIZE * pageno;
550 *ret_page = pool->pages[pageno];
551 } else {
552 pr_err_once("ERROR: %u KiB atomic DMA coherent pool is too small!\n"
553 "Please increase it with coherent_pool= kernel parameter!\n",
554 (unsigned)pool->size / 1024);
555 } 504 }
556 spin_unlock_irqrestore(&pool->lock, flags);
557 505
558 return ptr; 506 return ptr;
559} 507}
560 508
561static bool __in_atomic_pool(void *start, size_t size) 509static bool __in_atomic_pool(void *start, size_t size)
562{ 510{
563 struct dma_pool *pool = &atomic_pool; 511 return addr_in_gen_pool(atomic_pool, (unsigned long)start, size);
564 void *end = start + size;
565 void *pool_start = pool->vaddr;
566 void *pool_end = pool->vaddr + pool->size;
567
568 if (start < pool_start || start >= pool_end)
569 return false;
570
571 if (end <= pool_end)
572 return true;
573
574 WARN(1, "Wrong coherent size(%p-%p) from atomic pool(%p-%p)\n",
575 start, end - 1, pool_start, pool_end - 1);
576
577 return false;
578} 512}
579 513
580static int __free_from_pool(void *start, size_t size) 514static int __free_from_pool(void *start, size_t size)
581{ 515{
582 struct dma_pool *pool = &atomic_pool;
583 unsigned long pageno, count;
584 unsigned long flags;
585
586 if (!__in_atomic_pool(start, size)) 516 if (!__in_atomic_pool(start, size))
587 return 0; 517 return 0;
588 518
589 pageno = (start - pool->vaddr) >> PAGE_SHIFT; 519 gen_pool_free(atomic_pool, (unsigned long)start, size);
590 count = size >> PAGE_SHIFT;
591
592 spin_lock_irqsave(&pool->lock, flags);
593 bitmap_clear(pool->bitmap, pageno, count);
594 spin_unlock_irqrestore(&pool->lock, flags);
595 520
596 return 1; 521 return 1;
597} 522}
@@ -1271,29 +1196,8 @@ static void *
1271__iommu_alloc_remap(struct page **pages, size_t size, gfp_t gfp, pgprot_t prot, 1196__iommu_alloc_remap(struct page **pages, size_t size, gfp_t gfp, pgprot_t prot,
1272 const void *caller) 1197 const void *caller)
1273{ 1198{
1274 unsigned int i, nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; 1199 return dma_common_pages_remap(pages, size,
1275 struct vm_struct *area; 1200 VM_ARM_DMA_CONSISTENT | VM_USERMAP, prot, caller);
1276 unsigned long p;
1277
1278 area = get_vm_area_caller(size, VM_ARM_DMA_CONSISTENT | VM_USERMAP,
1279 caller);
1280 if (!area)
1281 return NULL;
1282
1283 area->pages = pages;
1284 area->nr_pages = nr_pages;
1285 p = (unsigned long)area->addr;
1286
1287 for (i = 0; i < nr_pages; i++) {
1288 phys_addr_t phys = __pfn_to_phys(page_to_pfn(pages[i]));
1289 if (ioremap_page_range(p, p + PAGE_SIZE, phys, prot))
1290 goto err;
1291 p += PAGE_SIZE;
1292 }
1293 return area->addr;
1294err:
1295 unmap_kernel_range((unsigned long)area->addr, size);
1296 vunmap(area->addr);
1297 return NULL; 1201 return NULL;
1298} 1202}
1299 1203
@@ -1355,11 +1259,13 @@ static int __iommu_remove_mapping(struct device *dev, dma_addr_t iova, size_t si
1355 1259
1356static struct page **__atomic_get_pages(void *addr) 1260static struct page **__atomic_get_pages(void *addr)
1357{ 1261{
1358 struct dma_pool *pool = &atomic_pool; 1262 struct page *page;
1359 struct page **pages = pool->pages; 1263 phys_addr_t phys;
1360 int offs = (addr - pool->vaddr) >> PAGE_SHIFT; 1264
1265 phys = gen_pool_virt_to_phys(atomic_pool, (unsigned long)addr);
1266 page = phys_to_page(phys);
1361 1267
1362 return pages + offs; 1268 return (struct page **)page;
1363} 1269}
1364 1270
1365static struct page **__iommu_get_pages(void *cpu_addr, struct dma_attrs *attrs) 1271static struct page **__iommu_get_pages(void *cpu_addr, struct dma_attrs *attrs)
@@ -1501,8 +1407,8 @@ void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
1501 } 1407 }
1502 1408
1503 if (!dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs)) { 1409 if (!dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs)) {
1504 unmap_kernel_range((unsigned long)cpu_addr, size); 1410 dma_common_free_remap(cpu_addr, size,
1505 vunmap(cpu_addr); 1411 VM_ARM_DMA_CONSISTENT | VM_USERMAP);
1506 } 1412 }
1507 1413
1508 __iommu_remove_mapping(dev, handle, size); 1414 __iommu_remove_mapping(dev, handle, size);
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 43d54f5b26b9..265b836b3bd1 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -400,3 +400,18 @@ void __flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned l
400 */ 400 */
401 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); 401 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
402} 402}
403
404#ifdef CONFIG_TRANSPARENT_HUGEPAGE
405#ifdef CONFIG_HAVE_RCU_TABLE_FREE
406void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
407 pmd_t *pmdp)
408{
409 pmd_t pmd = pmd_mksplitting(*pmdp);
410 VM_BUG_ON(address & ~PMD_MASK);
411 set_pmd_at(vma->vm_mm, address, pmdp, pmd);
412
413 /* dummy IPI to serialise against fast_gup */
414 kick_all_cpus_sync();
415}
416#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
417#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index c447ec70e868..e7a81cebbb2e 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -27,7 +27,7 @@ static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
27 if (pud_none_or_clear_bad(pud) || (pud_val(*pud) & L_PGD_SWAPPER)) { 27 if (pud_none_or_clear_bad(pud) || (pud_val(*pud) & L_PGD_SWAPPER)) {
28 pmd = pmd_alloc_one(&init_mm, addr); 28 pmd = pmd_alloc_one(&init_mm, addr);
29 if (!pmd) { 29 if (!pmd) {
30 pr_warning("Failed to allocate identity pmd.\n"); 30 pr_warn("Failed to allocate identity pmd.\n");
31 return; 31 return;
32 } 32 }
33 /* 33 /*
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 659c75d808dc..92bba32d9230 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -322,7 +322,7 @@ void __init arm_memblock_init(const struct machine_desc *mdesc)
322 * reserve memory for DMA contigouos allocations, 322 * reserve memory for DMA contigouos allocations,
323 * must come from DMA area inside low memory 323 * must come from DMA area inside low memory
324 */ 324 */
325 dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit)); 325 dma_contiguous_reserve(arm_dma_limit);
326 326
327 arm_memblock_steal_permitted = false; 327 arm_memblock_steal_permitted = false;
328 memblock_dump_all(); 328 memblock_dump_all();
@@ -636,6 +636,11 @@ static int keep_initrd;
636void free_initrd_mem(unsigned long start, unsigned long end) 636void free_initrd_mem(unsigned long start, unsigned long end)
637{ 637{
638 if (!keep_initrd) { 638 if (!keep_initrd) {
639 if (start == initrd_start)
640 start = round_down(start, PAGE_SIZE);
641 if (end == initrd_end)
642 end = round_up(end, PAGE_SIZE);
643
639 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 644 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
640 free_reserved_area((void *)start, (void *)end, -1, "initrd"); 645 free_reserved_area((void *)start, (void *)end, -1, "initrd");
641 } 646 }
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 8348ed6b2efe..9f98cec7fe1e 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -223,13 +223,13 @@ early_param("ecc", early_ecc);
223 223
224static int __init early_cachepolicy(char *p) 224static int __init early_cachepolicy(char *p)
225{ 225{
226 pr_warning("cachepolicy kernel parameter not supported without cp15\n"); 226 pr_warn("cachepolicy kernel parameter not supported without cp15\n");
227} 227}
228early_param("cachepolicy", early_cachepolicy); 228early_param("cachepolicy", early_cachepolicy);
229 229
230static int __init noalign_setup(char *__unused) 230static int __init noalign_setup(char *__unused)
231{ 231{
232 pr_warning("noalign kernel parameter not supported without cp15\n"); 232 pr_warn("noalign kernel parameter not supported without cp15\n");
233} 233}
234__setup("noalign", noalign_setup); 234__setup("noalign", noalign_setup);
235 235
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 1a24e9232ec8..d3daed0ae0ad 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -146,7 +146,6 @@ ENDPROC(cpu_v7_set_pte_ext)
146 mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits 146 mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits
147 mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits 147 mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits
148 addls \ttbr1, \ttbr1, #TTBR1_OFFSET 148 addls \ttbr1, \ttbr1, #TTBR1_OFFSET
149 adcls \tmp, \tmp, #0
150 mcrr p15, 1, \ttbr1, \tmp, c2 @ load TTBR1 149 mcrr p15, 1, \ttbr1, \tmp, c2 @ load TTBR1
151 mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits 150 mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits
152 mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits 151 mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits
@@ -158,9 +157,9 @@ ENDPROC(cpu_v7_set_pte_ext)
158 * TFR EV X F IHD LR S 157 * TFR EV X F IHD LR S
159 * .EEE ..EE PUI. .TAT 4RVI ZWRS BLDP WCAM 158 * .EEE ..EE PUI. .TAT 4RVI ZWRS BLDP WCAM
160 * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced 159 * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced
161 * 11 0 110 1 0011 1100 .111 1101 < we want 160 * 11 0 110 0 0011 1100 .111 1101 < we want
162 */ 161 */
163 .align 2 162 .align 2
164 .type v7_crval, #object 163 .type v7_crval, #object
165v7_crval: 164v7_crval:
166 crval clear=0x0120c302, mmuset=0x30c23c7d, ucset=0x00c01c7c 165 crval clear=0x0122c302, mmuset=0x30c03c7d, ucset=0x00c01c7c
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index b5d67db20897..b3a947863ac7 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -570,7 +570,7 @@ __v7_ca15mp_proc_info:
570__v7_b15mp_proc_info: 570__v7_b15mp_proc_info:
571 .long 0x420f00f0 571 .long 0x420f00f0
572 .long 0xff0ffff0 572 .long 0xff0ffff0
573 __v7_proc __v7_b15mp_setup, hwcaps = HWCAP_IDIV 573 __v7_proc __v7_b15mp_setup
574 .size __v7_b15mp_proc_info, . - __v7_b15mp_proc_info 574 .size __v7_b15mp_proc_info, . - __v7_b15mp_proc_info
575 575
576 /* 576 /*
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index a37b989a2f91..e1268f905026 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -12,11 +12,11 @@
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/filter.h> 14#include <linux/filter.h>
15#include <linux/moduleloader.h>
16#include <linux/netdevice.h> 15#include <linux/netdevice.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/if_vlan.h> 18#include <linux/if_vlan.h>
19
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21#include <asm/hwcap.h> 21#include <asm/hwcap.h>
22#include <asm/opcodes.h> 22#include <asm/opcodes.h>
@@ -174,6 +174,14 @@ static inline bool is_load_to_a(u16 inst)
174 } 174 }
175} 175}
176 176
177static void jit_fill_hole(void *area, unsigned int size)
178{
179 u32 *ptr;
180 /* We are guaranteed to have aligned memory. */
181 for (ptr = area; size >= sizeof(u32); size -= sizeof(u32))
182 *ptr++ = __opcode_to_mem_arm(ARM_INST_UDF);
183}
184
177static void build_prologue(struct jit_ctx *ctx) 185static void build_prologue(struct jit_ctx *ctx)
178{ 186{
179 u16 reg_set = saved_regs(ctx); 187 u16 reg_set = saved_regs(ctx);
@@ -859,9 +867,11 @@ b_epilogue:
859 867
860void bpf_jit_compile(struct bpf_prog *fp) 868void bpf_jit_compile(struct bpf_prog *fp)
861{ 869{
870 struct bpf_binary_header *header;
862 struct jit_ctx ctx; 871 struct jit_ctx ctx;
863 unsigned tmp_idx; 872 unsigned tmp_idx;
864 unsigned alloc_size; 873 unsigned alloc_size;
874 u8 *target_ptr;
865 875
866 if (!bpf_jit_enable) 876 if (!bpf_jit_enable)
867 return; 877 return;
@@ -897,13 +907,15 @@ void bpf_jit_compile(struct bpf_prog *fp)
897 /* there's nothing after the epilogue on ARMv7 */ 907 /* there's nothing after the epilogue on ARMv7 */
898 build_epilogue(&ctx); 908 build_epilogue(&ctx);
899#endif 909#endif
900
901 alloc_size = 4 * ctx.idx; 910 alloc_size = 4 * ctx.idx;
902 ctx.target = module_alloc(alloc_size); 911 header = bpf_jit_binary_alloc(alloc_size, &target_ptr,
903 if (unlikely(ctx.target == NULL)) 912 4, jit_fill_hole);
913 if (header == NULL)
904 goto out; 914 goto out;
905 915
916 ctx.target = (u32 *) target_ptr;
906 ctx.idx = 0; 917 ctx.idx = 0;
918
907 build_prologue(&ctx); 919 build_prologue(&ctx);
908 build_body(&ctx); 920 build_body(&ctx);
909 build_epilogue(&ctx); 921 build_epilogue(&ctx);
@@ -919,8 +931,9 @@ void bpf_jit_compile(struct bpf_prog *fp)
919 /* there are 2 passes here */ 931 /* there are 2 passes here */
920 bpf_jit_dump(fp->len, alloc_size, 2, ctx.target); 932 bpf_jit_dump(fp->len, alloc_size, 2, ctx.target);
921 933
934 set_memory_ro((unsigned long)header, header->pages);
922 fp->bpf_func = (void *)ctx.target; 935 fp->bpf_func = (void *)ctx.target;
923 fp->jited = 1; 936 fp->jited = true;
924out: 937out:
925 kfree(ctx.offsets); 938 kfree(ctx.offsets);
926 return; 939 return;
@@ -928,7 +941,15 @@ out:
928 941
929void bpf_jit_free(struct bpf_prog *fp) 942void bpf_jit_free(struct bpf_prog *fp)
930{ 943{
931 if (fp->jited) 944 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
932 module_free(NULL, fp->bpf_func); 945 struct bpf_binary_header *header = (void *)addr;
933 kfree(fp); 946
947 if (!fp->jited)
948 goto free_filter;
949
950 set_memory_rw(addr, header->pages);
951 bpf_jit_binary_free(header);
952
953free_filter:
954 bpf_prog_unlock_free(fp);
934} 955}
diff --git a/arch/arm/net/bpf_jit_32.h b/arch/arm/net/bpf_jit_32.h
index afb84621ff6f..b2d7d92859d3 100644
--- a/arch/arm/net/bpf_jit_32.h
+++ b/arch/arm/net/bpf_jit_32.h
@@ -114,6 +114,20 @@
114 114
115#define ARM_INST_UMULL 0x00800090 115#define ARM_INST_UMULL 0x00800090
116 116
117/*
118 * Use a suitable undefined instruction to use for ARM/Thumb2 faulting.
119 * We need to be careful not to conflict with those used by other modules
120 * (BUG, kprobes, etc) and the register_undef_hook() system.
121 *
122 * The ARM architecture reference manual guarantees that the following
123 * instruction space will produce an undefined instruction exception on
124 * all CPUs:
125 *
126 * ARM: xxxx 0111 1111 xxxx xxxx xxxx 1111 xxxx ARMv7-AR, section A5.4
127 * Thumb: 1101 1110 xxxx xxxx ARMv7-M, section A5.2.6
128 */
129#define ARM_INST_UDF 0xe7fddef1
130
117/* register */ 131/* register */
118#define _AL3_R(op, rd, rn, rm) ((op ## _R) | (rd) << 12 | (rn) << 16 | (rm)) 132#define _AL3_R(op, rd, rn, rm) ((op ## _R) | (rd) << 12 | (rn) << 16 | (rm))
119/* immediate */ 133/* immediate */
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 02fc10d2d63b..d055db32ffcb 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -1,3 +1,6 @@
1config ARCH_OMAP
2 bool
3
1if ARCH_OMAP 4if ARCH_OMAP
2 5
3menu "TI OMAP Common Features" 6menu "TI OMAP Common Features"
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index c2baa8ede543..24770e5a5081 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -64,7 +64,9 @@ enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED };
64 64
65static struct omap_system_dma_plat_info *p; 65static struct omap_system_dma_plat_info *p;
66static struct omap_dma_dev_attr *d; 66static struct omap_dma_dev_attr *d;
67 67static void omap_clear_dma(int lch);
68static int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
69 unsigned char write_prio);
68static int enable_1510_mode; 70static int enable_1510_mode;
69static u32 errata; 71static u32 errata;
70 72
@@ -284,66 +286,6 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
284} 286}
285EXPORT_SYMBOL(omap_set_dma_transfer_params); 287EXPORT_SYMBOL(omap_set_dma_transfer_params);
286 288
287void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
288{
289 BUG_ON(omap_dma_in_1510_mode());
290
291 if (dma_omap1()) {
292 u16 w;
293
294 w = p->dma_read(CCR2, lch);
295 w &= ~0x03;
296
297 switch (mode) {
298 case OMAP_DMA_CONSTANT_FILL:
299 w |= 0x01;
300 break;
301 case OMAP_DMA_TRANSPARENT_COPY:
302 w |= 0x02;
303 break;
304 case OMAP_DMA_COLOR_DIS:
305 break;
306 default:
307 BUG();
308 }
309 p->dma_write(w, CCR2, lch);
310
311 w = p->dma_read(LCH_CTRL, lch);
312 w &= ~0x0f;
313 /* Default is channel type 2D */
314 if (mode) {
315 p->dma_write(color, COLOR, lch);
316 w |= 1; /* Channel type G */
317 }
318 p->dma_write(w, LCH_CTRL, lch);
319 }
320
321 if (dma_omap2plus()) {
322 u32 val;
323
324 val = p->dma_read(CCR, lch);
325 val &= ~((1 << 17) | (1 << 16));
326
327 switch (mode) {
328 case OMAP_DMA_CONSTANT_FILL:
329 val |= 1 << 16;
330 break;
331 case OMAP_DMA_TRANSPARENT_COPY:
332 val |= 1 << 17;
333 break;
334 case OMAP_DMA_COLOR_DIS:
335 break;
336 default:
337 BUG();
338 }
339 p->dma_write(val, CCR, lch);
340
341 color &= 0xffffff;
342 p->dma_write(color, COLOR, lch);
343 }
344}
345EXPORT_SYMBOL(omap_set_dma_color_mode);
346
347void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) 289void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode)
348{ 290{
349 if (dma_omap2plus()) { 291 if (dma_omap2plus()) {
@@ -417,16 +359,6 @@ void omap_set_dma_params(int lch, struct omap_dma_channel_params *params)
417} 359}
418EXPORT_SYMBOL(omap_set_dma_params); 360EXPORT_SYMBOL(omap_set_dma_params);
419 361
420void omap_set_dma_src_index(int lch, int eidx, int fidx)
421{
422 if (dma_omap2plus())
423 return;
424
425 p->dma_write(eidx, CSEI, lch);
426 p->dma_write(fidx, CSFI, lch);
427}
428EXPORT_SYMBOL(omap_set_dma_src_index);
429
430void omap_set_dma_src_data_pack(int lch, int enable) 362void omap_set_dma_src_data_pack(int lch, int enable)
431{ 363{
432 u32 l; 364 u32 l;
@@ -510,16 +442,6 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
510} 442}
511EXPORT_SYMBOL(omap_set_dma_dest_params); 443EXPORT_SYMBOL(omap_set_dma_dest_params);
512 444
513void omap_set_dma_dest_index(int lch, int eidx, int fidx)
514{
515 if (dma_omap2plus())
516 return;
517
518 p->dma_write(eidx, CDEI, lch);
519 p->dma_write(fidx, CDFI, lch);
520}
521EXPORT_SYMBOL(omap_set_dma_dest_index);
522
523void omap_set_dma_dest_data_pack(int lch, int enable) 445void omap_set_dma_dest_data_pack(int lch, int enable)
524{ 446{
525 u32 l; 447 u32 l;
@@ -843,7 +765,7 @@ EXPORT_SYMBOL(omap_dma_set_global_params);
843 * Both of the above can be set with one of the following values : 765 * Both of the above can be set with one of the following values :
844 * DMA_CH_PRIO_HIGH/DMA_CH_PRIO_LOW 766 * DMA_CH_PRIO_HIGH/DMA_CH_PRIO_LOW
845 */ 767 */
846int 768static int
847omap_dma_set_prio_lch(int lch, unsigned char read_prio, 769omap_dma_set_prio_lch(int lch, unsigned char read_prio,
848 unsigned char write_prio) 770 unsigned char write_prio)
849{ 771{
@@ -864,13 +786,13 @@ omap_dma_set_prio_lch(int lch, unsigned char read_prio,
864 786
865 return 0; 787 return 0;
866} 788}
867EXPORT_SYMBOL(omap_dma_set_prio_lch); 789
868 790
869/* 791/*
870 * Clears any DMA state so the DMA engine is ready to restart with new buffers 792 * Clears any DMA state so the DMA engine is ready to restart with new buffers
871 * through omap_start_dma(). Any buffers in flight are discarded. 793 * through omap_start_dma(). Any buffers in flight are discarded.
872 */ 794 */
873void omap_clear_dma(int lch) 795static void omap_clear_dma(int lch)
874{ 796{
875 unsigned long flags; 797 unsigned long flags;
876 798
@@ -878,7 +800,6 @@ void omap_clear_dma(int lch)
878 p->clear_dma(lch); 800 p->clear_dma(lch);
879 local_irq_restore(flags); 801 local_irq_restore(flags);
880} 802}
881EXPORT_SYMBOL(omap_clear_dma);
882 803
883void omap_start_dma(int lch) 804void omap_start_dma(int lch)
884{ 805{
@@ -1167,652 +1088,6 @@ void omap_dma_link_lch(int lch_head, int lch_queue)
1167} 1088}
1168EXPORT_SYMBOL(omap_dma_link_lch); 1089EXPORT_SYMBOL(omap_dma_link_lch);
1169 1090
1170/*
1171 * Once the DMA queue is stopped, we can destroy it.
1172 */
1173void omap_dma_unlink_lch(int lch_head, int lch_queue)
1174{
1175 if (omap_dma_in_1510_mode()) {
1176 if (lch_head == lch_queue) {
1177 p->dma_write(p->dma_read(CCR, lch_head) & ~(3 << 8),
1178 CCR, lch_head);
1179 return;
1180 }
1181 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
1182 BUG();
1183 return;
1184 }
1185
1186 if (dma_chan[lch_head].next_lch != lch_queue ||
1187 dma_chan[lch_head].next_lch == -1) {
1188 pr_err("omap_dma: trying to unlink non linked channels\n");
1189 dump_stack();
1190 }
1191
1192 if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) ||
1193 (dma_chan[lch_queue].flags & OMAP_DMA_ACTIVE)) {
1194 pr_err("omap_dma: You need to stop the DMA channels before unlinking\n");
1195 dump_stack();
1196 }
1197
1198 dma_chan[lch_head].next_lch = -1;
1199}
1200EXPORT_SYMBOL(omap_dma_unlink_lch);
1201
1202#ifndef CONFIG_ARCH_OMAP1
1203/* Create chain of DMA channesls */
1204static void create_dma_lch_chain(int lch_head, int lch_queue)
1205{
1206 u32 l;
1207
1208 /* Check if this is the first link in chain */
1209 if (dma_chan[lch_head].next_linked_ch == -1) {
1210 dma_chan[lch_head].next_linked_ch = lch_queue;
1211 dma_chan[lch_head].prev_linked_ch = lch_queue;
1212 dma_chan[lch_queue].next_linked_ch = lch_head;
1213 dma_chan[lch_queue].prev_linked_ch = lch_head;
1214 }
1215
1216 /* a link exists, link the new channel in circular chain */
1217 else {
1218 dma_chan[lch_queue].next_linked_ch =
1219 dma_chan[lch_head].next_linked_ch;
1220 dma_chan[lch_queue].prev_linked_ch = lch_head;
1221 dma_chan[lch_head].next_linked_ch = lch_queue;
1222 dma_chan[dma_chan[lch_queue].next_linked_ch].prev_linked_ch =
1223 lch_queue;
1224 }
1225
1226 l = p->dma_read(CLNK_CTRL, lch_head);
1227 l &= ~(0x1f);
1228 l |= lch_queue;
1229 p->dma_write(l, CLNK_CTRL, lch_head);
1230
1231 l = p->dma_read(CLNK_CTRL, lch_queue);
1232 l &= ~(0x1f);
1233 l |= (dma_chan[lch_queue].next_linked_ch);
1234 p->dma_write(l, CLNK_CTRL, lch_queue);
1235}
1236
1237/**
1238 * @brief omap_request_dma_chain : Request a chain of DMA channels
1239 *
1240 * @param dev_id - Device id using the dma channel
1241 * @param dev_name - Device name
1242 * @param callback - Call back function
1243 * @chain_id -
1244 * @no_of_chans - Number of channels requested
1245 * @chain_mode - Dynamic or static chaining : OMAP_DMA_STATIC_CHAIN
1246 * OMAP_DMA_DYNAMIC_CHAIN
1247 * @params - Channel parameters
1248 *
1249 * @return - Success : 0
1250 * Failure: -EINVAL/-ENOMEM
1251 */
1252int omap_request_dma_chain(int dev_id, const char *dev_name,
1253 void (*callback) (int lch, u16 ch_status,
1254 void *data),
1255 int *chain_id, int no_of_chans, int chain_mode,
1256 struct omap_dma_channel_params params)
1257{
1258 int *channels;
1259 int i, err;
1260
1261 /* Is the chain mode valid ? */
1262 if (chain_mode != OMAP_DMA_STATIC_CHAIN
1263 && chain_mode != OMAP_DMA_DYNAMIC_CHAIN) {
1264 printk(KERN_ERR "Invalid chain mode requested\n");
1265 return -EINVAL;
1266 }
1267
1268 if (unlikely((no_of_chans < 1
1269 || no_of_chans > dma_lch_count))) {
1270 printk(KERN_ERR "Invalid Number of channels requested\n");
1271 return -EINVAL;
1272 }
1273
1274 /*
1275 * Allocate a queue to maintain the status of the channels
1276 * in the chain
1277 */
1278 channels = kmalloc(sizeof(*channels) * no_of_chans, GFP_KERNEL);
1279 if (channels == NULL) {
1280 printk(KERN_ERR "omap_dma: No memory for channel queue\n");
1281 return -ENOMEM;
1282 }
1283
1284 /* request and reserve DMA channels for the chain */
1285 for (i = 0; i < no_of_chans; i++) {
1286 err = omap_request_dma(dev_id, dev_name,
1287 callback, NULL, &channels[i]);
1288 if (err < 0) {
1289 int j;
1290 for (j = 0; j < i; j++)
1291 omap_free_dma(channels[j]);
1292 kfree(channels);
1293 printk(KERN_ERR "omap_dma: Request failed %d\n", err);
1294 return err;
1295 }
1296 dma_chan[channels[i]].prev_linked_ch = -1;
1297 dma_chan[channels[i]].state = DMA_CH_NOTSTARTED;
1298
1299 /*
1300 * Allowing client drivers to set common parameters now,
1301 * so that later only relevant (src_start, dest_start
1302 * and element count) can be set
1303 */
1304 omap_set_dma_params(channels[i], &params);
1305 }
1306
1307 *chain_id = channels[0];
1308 dma_linked_lch[*chain_id].linked_dmach_q = channels;
1309 dma_linked_lch[*chain_id].chain_mode = chain_mode;
1310 dma_linked_lch[*chain_id].chain_state = DMA_CHAIN_NOTSTARTED;
1311 dma_linked_lch[*chain_id].no_of_lchs_linked = no_of_chans;
1312
1313 for (i = 0; i < no_of_chans; i++)
1314 dma_chan[channels[i]].chain_id = *chain_id;
1315
1316 /* Reset the Queue pointers */
1317 OMAP_DMA_CHAIN_QINIT(*chain_id);
1318
1319 /* Set up the chain */
1320 if (no_of_chans == 1)
1321 create_dma_lch_chain(channels[0], channels[0]);
1322 else {
1323 for (i = 0; i < (no_of_chans - 1); i++)
1324 create_dma_lch_chain(channels[i], channels[i + 1]);
1325 }
1326
1327 return 0;
1328}
1329EXPORT_SYMBOL(omap_request_dma_chain);
1330
1331/**
1332 * @brief omap_modify_dma_chain_param : Modify the chain's params - Modify the
1333 * params after setting it. Dont do this while dma is running!!
1334 *
1335 * @param chain_id - Chained logical channel id.
1336 * @param params
1337 *
1338 * @return - Success : 0
1339 * Failure : -EINVAL
1340 */
1341int omap_modify_dma_chain_params(int chain_id,
1342 struct omap_dma_channel_params params)
1343{
1344 int *channels;
1345 u32 i;
1346
1347 /* Check for input params */
1348 if (unlikely((chain_id < 0
1349 || chain_id >= dma_lch_count))) {
1350 printk(KERN_ERR "Invalid chain id\n");
1351 return -EINVAL;
1352 }
1353
1354 /* Check if the chain exists */
1355 if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
1356 printk(KERN_ERR "Chain doesn't exists\n");
1357 return -EINVAL;
1358 }
1359 channels = dma_linked_lch[chain_id].linked_dmach_q;
1360
1361 for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked; i++) {
1362 /*
1363 * Allowing client drivers to set common parameters now,
1364 * so that later only relevant (src_start, dest_start
1365 * and element count) can be set
1366 */
1367 omap_set_dma_params(channels[i], &params);
1368 }
1369
1370 return 0;
1371}
1372EXPORT_SYMBOL(omap_modify_dma_chain_params);
1373
1374/**
1375 * @brief omap_free_dma_chain - Free all the logical channels in a chain.
1376 *
1377 * @param chain_id
1378 *
1379 * @return - Success : 0
1380 * Failure : -EINVAL
1381 */
1382int omap_free_dma_chain(int chain_id)
1383{
1384 int *channels;
1385 u32 i;
1386
1387 /* Check for input params */
1388 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1389 printk(KERN_ERR "Invalid chain id\n");
1390 return -EINVAL;
1391 }
1392
1393 /* Check if the chain exists */
1394 if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
1395 printk(KERN_ERR "Chain doesn't exists\n");
1396 return -EINVAL;
1397 }
1398
1399 channels = dma_linked_lch[chain_id].linked_dmach_q;
1400 for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked; i++) {
1401 dma_chan[channels[i]].next_linked_ch = -1;
1402 dma_chan[channels[i]].prev_linked_ch = -1;
1403 dma_chan[channels[i]].chain_id = -1;
1404 dma_chan[channels[i]].state = DMA_CH_NOTSTARTED;
1405 omap_free_dma(channels[i]);
1406 }
1407
1408 kfree(channels);
1409
1410 dma_linked_lch[chain_id].linked_dmach_q = NULL;
1411 dma_linked_lch[chain_id].chain_mode = -1;
1412 dma_linked_lch[chain_id].chain_state = -1;
1413
1414 return (0);
1415}
1416EXPORT_SYMBOL(omap_free_dma_chain);
1417
1418/**
1419 * @brief omap_dma_chain_status - Check if the chain is in
1420 * active / inactive state.
1421 * @param chain_id
1422 *
1423 * @return - Success : OMAP_DMA_CHAIN_ACTIVE/OMAP_DMA_CHAIN_INACTIVE
1424 * Failure : -EINVAL
1425 */
1426int omap_dma_chain_status(int chain_id)
1427{
1428 /* Check for input params */
1429 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1430 printk(KERN_ERR "Invalid chain id\n");
1431 return -EINVAL;
1432 }
1433
1434 /* Check if the chain exists */
1435 if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
1436 printk(KERN_ERR "Chain doesn't exists\n");
1437 return -EINVAL;
1438 }
1439 pr_debug("CHAINID=%d, qcnt=%d\n", chain_id,
1440 dma_linked_lch[chain_id].q_count);
1441
1442 if (OMAP_DMA_CHAIN_QEMPTY(chain_id))
1443 return OMAP_DMA_CHAIN_INACTIVE;
1444
1445 return OMAP_DMA_CHAIN_ACTIVE;
1446}
1447EXPORT_SYMBOL(omap_dma_chain_status);
1448
1449/**
1450 * @brief omap_dma_chain_a_transfer - Get a free channel from a chain,
1451 * set the params and start the transfer.
1452 *
1453 * @param chain_id
1454 * @param src_start - buffer start address
1455 * @param dest_start - Dest address
1456 * @param elem_count
1457 * @param frame_count
1458 * @param callbk_data - channel callback parameter data.
1459 *
1460 * @return - Success : 0
1461 * Failure: -EINVAL/-EBUSY
1462 */
1463int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1464 int elem_count, int frame_count, void *callbk_data)
1465{
1466 int *channels;
1467 u32 l, lch;
1468 int start_dma = 0;
1469
1470 /*
1471 * if buffer size is less than 1 then there is
1472 * no use of starting the chain
1473 */
1474 if (elem_count < 1) {
1475 printk(KERN_ERR "Invalid buffer size\n");
1476 return -EINVAL;
1477 }
1478
1479 /* Check for input params */
1480 if (unlikely((chain_id < 0
1481 || chain_id >= dma_lch_count))) {
1482 printk(KERN_ERR "Invalid chain id\n");
1483 return -EINVAL;
1484 }
1485
1486 /* Check if the chain exists */
1487 if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
1488 printk(KERN_ERR "Chain doesn't exist\n");
1489 return -EINVAL;
1490 }
1491
1492 /* Check if all the channels in chain are in use */
1493 if (OMAP_DMA_CHAIN_QFULL(chain_id))
1494 return -EBUSY;
1495
1496 /* Frame count may be negative in case of indexed transfers */
1497 channels = dma_linked_lch[chain_id].linked_dmach_q;
1498
1499 /* Get a free channel */
1500 lch = channels[dma_linked_lch[chain_id].q_tail];
1501
1502 /* Store the callback data */
1503 dma_chan[lch].data = callbk_data;
1504
1505 /* Increment the q_tail */
1506 OMAP_DMA_CHAIN_INCQTAIL(chain_id);
1507
1508 /* Set the params to the free channel */
1509 if (src_start != 0)
1510 p->dma_write(src_start, CSSA, lch);
1511 if (dest_start != 0)
1512 p->dma_write(dest_start, CDSA, lch);
1513
1514 /* Write the buffer size */
1515 p->dma_write(elem_count, CEN, lch);
1516 p->dma_write(frame_count, CFN, lch);
1517
1518 /*
1519 * If the chain is dynamically linked,
1520 * then we may have to start the chain if its not active
1521 */
1522 if (dma_linked_lch[chain_id].chain_mode == OMAP_DMA_DYNAMIC_CHAIN) {
1523
1524 /*
1525 * In Dynamic chain, if the chain is not started,
1526 * queue the channel
1527 */
1528 if (dma_linked_lch[chain_id].chain_state ==
1529 DMA_CHAIN_NOTSTARTED) {
1530 /* Enable the link in previous channel */
1531 if (dma_chan[dma_chan[lch].prev_linked_ch].state ==
1532 DMA_CH_QUEUED)
1533 enable_lnk(dma_chan[lch].prev_linked_ch);
1534 dma_chan[lch].state = DMA_CH_QUEUED;
1535 }
1536
1537 /*
1538 * Chain is already started, make sure its active,
1539 * if not then start the chain
1540 */
1541 else {
1542 start_dma = 1;
1543
1544 if (dma_chan[dma_chan[lch].prev_linked_ch].state ==
1545 DMA_CH_STARTED) {
1546 enable_lnk(dma_chan[lch].prev_linked_ch);
1547 dma_chan[lch].state = DMA_CH_QUEUED;
1548 start_dma = 0;
1549 if (0 == ((1 << 7) & p->dma_read(
1550 CCR, dma_chan[lch].prev_linked_ch))) {
1551 disable_lnk(dma_chan[lch].
1552 prev_linked_ch);
1553 pr_debug("\n prev ch is stopped\n");
1554 start_dma = 1;
1555 }
1556 }
1557
1558 else if (dma_chan[dma_chan[lch].prev_linked_ch].state
1559 == DMA_CH_QUEUED) {
1560 enable_lnk(dma_chan[lch].prev_linked_ch);
1561 dma_chan[lch].state = DMA_CH_QUEUED;
1562 start_dma = 0;
1563 }
1564 omap_enable_channel_irq(lch);
1565
1566 l = p->dma_read(CCR, lch);
1567
1568 if ((0 == (l & (1 << 24))))
1569 l &= ~(1 << 25);
1570 else
1571 l |= (1 << 25);
1572 if (start_dma == 1) {
1573 if (0 == (l & (1 << 7))) {
1574 l |= (1 << 7);
1575 dma_chan[lch].state = DMA_CH_STARTED;
1576 pr_debug("starting %d\n", lch);
1577 p->dma_write(l, CCR, lch);
1578 } else
1579 start_dma = 0;
1580 } else {
1581 if (0 == (l & (1 << 7)))
1582 p->dma_write(l, CCR, lch);
1583 }
1584 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
1585 }
1586 }
1587
1588 return 0;
1589}
1590EXPORT_SYMBOL(omap_dma_chain_a_transfer);
1591
1592/**
1593 * @brief omap_start_dma_chain_transfers - Start the chain
1594 *
1595 * @param chain_id
1596 *
1597 * @return - Success : 0
1598 * Failure : -EINVAL/-EBUSY
1599 */
1600int omap_start_dma_chain_transfers(int chain_id)
1601{
1602 int *channels;
1603 u32 l, i;
1604
1605 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1606 printk(KERN_ERR "Invalid chain id\n");
1607 return -EINVAL;
1608 }
1609
1610 channels = dma_linked_lch[chain_id].linked_dmach_q;
1611
1612 if (dma_linked_lch[channels[0]].chain_state == DMA_CHAIN_STARTED) {
1613 printk(KERN_ERR "Chain is already started\n");
1614 return -EBUSY;
1615 }
1616
1617 if (dma_linked_lch[chain_id].chain_mode == OMAP_DMA_STATIC_CHAIN) {
1618 for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked;
1619 i++) {
1620 enable_lnk(channels[i]);
1621 omap_enable_channel_irq(channels[i]);
1622 }
1623 } else {
1624 omap_enable_channel_irq(channels[0]);
1625 }
1626
1627 l = p->dma_read(CCR, channels[0]);
1628 l |= (1 << 7);
1629 dma_linked_lch[chain_id].chain_state = DMA_CHAIN_STARTED;
1630 dma_chan[channels[0]].state = DMA_CH_STARTED;
1631
1632 if ((0 == (l & (1 << 24))))
1633 l &= ~(1 << 25);
1634 else
1635 l |= (1 << 25);
1636 p->dma_write(l, CCR, channels[0]);
1637
1638 dma_chan[channels[0]].flags |= OMAP_DMA_ACTIVE;
1639
1640 return 0;
1641}
1642EXPORT_SYMBOL(omap_start_dma_chain_transfers);
1643
1644/**
1645 * @brief omap_stop_dma_chain_transfers - Stop the dma transfer of a chain.
1646 *
1647 * @param chain_id
1648 *
1649 * @return - Success : 0
1650 * Failure : EINVAL
1651 */
1652int omap_stop_dma_chain_transfers(int chain_id)
1653{
1654 int *channels;
1655 u32 l, i;
1656 u32 sys_cf = 0;
1657
1658 /* Check for input params */
1659 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1660 printk(KERN_ERR "Invalid chain id\n");
1661 return -EINVAL;
1662 }
1663
1664 /* Check if the chain exists */
1665 if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
1666 printk(KERN_ERR "Chain doesn't exists\n");
1667 return -EINVAL;
1668 }
1669 channels = dma_linked_lch[chain_id].linked_dmach_q;
1670
1671 if (IS_DMA_ERRATA(DMA_ERRATA_i88)) {
1672 sys_cf = p->dma_read(OCP_SYSCONFIG, 0);
1673 l = sys_cf;
1674 /* Middle mode reg set no Standby */
1675 l &= ~((1 << 12)|(1 << 13));
1676 p->dma_write(l, OCP_SYSCONFIG, 0);
1677 }
1678
1679 for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked; i++) {
1680
1681 /* Stop the Channel transmission */
1682 l = p->dma_read(CCR, channels[i]);
1683 l &= ~(1 << 7);
1684 p->dma_write(l, CCR, channels[i]);
1685
1686 /* Disable the link in all the channels */
1687 disable_lnk(channels[i]);
1688 dma_chan[channels[i]].state = DMA_CH_NOTSTARTED;
1689
1690 }
1691 dma_linked_lch[chain_id].chain_state = DMA_CHAIN_NOTSTARTED;
1692
1693 /* Reset the Queue pointers */
1694 OMAP_DMA_CHAIN_QINIT(chain_id);
1695
1696 if (IS_DMA_ERRATA(DMA_ERRATA_i88))
1697 p->dma_write(sys_cf, OCP_SYSCONFIG, 0);
1698
1699 return 0;
1700}
1701EXPORT_SYMBOL(omap_stop_dma_chain_transfers);
1702
1703/* Get the index of the ongoing DMA in chain */
1704/**
1705 * @brief omap_get_dma_chain_index - Get the element and frame index
1706 * of the ongoing DMA in chain
1707 *
1708 * @param chain_id
1709 * @param ei - Element index
1710 * @param fi - Frame index
1711 *
1712 * @return - Success : 0
1713 * Failure : -EINVAL
1714 */
1715int omap_get_dma_chain_index(int chain_id, int *ei, int *fi)
1716{
1717 int lch;
1718 int *channels;
1719
1720 /* Check for input params */
1721 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1722 printk(KERN_ERR "Invalid chain id\n");
1723 return -EINVAL;
1724 }
1725
1726 /* Check if the chain exists */
1727 if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
1728 printk(KERN_ERR "Chain doesn't exists\n");
1729 return -EINVAL;
1730 }
1731 if ((!ei) || (!fi))
1732 return -EINVAL;
1733
1734 channels = dma_linked_lch[chain_id].linked_dmach_q;
1735
1736 /* Get the current channel */
1737 lch = channels[dma_linked_lch[chain_id].q_head];
1738
1739 *ei = p->dma_read(CCEN, lch);
1740 *fi = p->dma_read(CCFN, lch);
1741
1742 return 0;
1743}
1744EXPORT_SYMBOL(omap_get_dma_chain_index);
1745
1746/**
1747 * @brief omap_get_dma_chain_dst_pos - Get the destination position of the
1748 * ongoing DMA in chain
1749 *
1750 * @param chain_id
1751 *
1752 * @return - Success : Destination position
1753 * Failure : -EINVAL
1754 */
1755int omap_get_dma_chain_dst_pos(int chain_id)
1756{
1757 int lch;
1758 int *channels;
1759
1760 /* Check for input params */
1761 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1762 printk(KERN_ERR "Invalid chain id\n");
1763 return -EINVAL;
1764 }
1765
1766 /* Check if the chain exists */
1767 if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
1768 printk(KERN_ERR "Chain doesn't exists\n");
1769 return -EINVAL;
1770 }
1771
1772 channels = dma_linked_lch[chain_id].linked_dmach_q;
1773
1774 /* Get the current channel */
1775 lch = channels[dma_linked_lch[chain_id].q_head];
1776
1777 return p->dma_read(CDAC, lch);
1778}
1779EXPORT_SYMBOL(omap_get_dma_chain_dst_pos);
1780
1781/**
1782 * @brief omap_get_dma_chain_src_pos - Get the source position
1783 * of the ongoing DMA in chain
1784 * @param chain_id
1785 *
1786 * @return - Success : Destination position
1787 * Failure : -EINVAL
1788 */
1789int omap_get_dma_chain_src_pos(int chain_id)
1790{
1791 int lch;
1792 int *channels;
1793
1794 /* Check for input params */
1795 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1796 printk(KERN_ERR "Invalid chain id\n");
1797 return -EINVAL;
1798 }
1799
1800 /* Check if the chain exists */
1801 if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
1802 printk(KERN_ERR "Chain doesn't exists\n");
1803 return -EINVAL;
1804 }
1805
1806 channels = dma_linked_lch[chain_id].linked_dmach_q;
1807
1808 /* Get the current channel */
1809 lch = channels[dma_linked_lch[chain_id].q_head];
1810
1811 return p->dma_read(CSAC, lch);
1812}
1813EXPORT_SYMBOL(omap_get_dma_chain_src_pos);
1814#endif /* ifndef CONFIG_ARCH_OMAP1 */
1815
1816/*----------------------------------------------------------------------------*/ 1091/*----------------------------------------------------------------------------*/
1817 1092
1818#ifdef CONFIG_ARCH_OMAP1 1093#ifdef CONFIG_ARCH_OMAP1
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 3ec6e8e8d368..f5b00f41c4f6 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -499,7 +499,7 @@ void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
499 499
500 d->netdev = &orion_ge00.dev; 500 d->netdev = &orion_ge00.dev;
501 for (i = 0; i < d->nr_chips; i++) 501 for (i = 0; i < d->nr_chips; i++)
502 d->chip[i].mii_bus = &orion_ge00_shared.dev; 502 d->chip[i].host_dev = &orion_ge00_shared.dev;
503 orion_switch_device.dev.platform_data = d; 503 orion_switch_device.dev.platform_data = d;
504 504
505 platform_device_register(&orion_switch_device); 505 platform_device_register(&orion_switch_device);
diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
index 3ea02903d75a..1f5ee17a10e8 100644
--- a/arch/arm/plat-pxa/ssp.c
+++ b/arch/arm/plat-pxa/ssp.c
@@ -258,6 +258,7 @@ static const struct platform_device_id ssp_id_table[] = {
258 { "pxa25x-ssp", PXA25x_SSP }, 258 { "pxa25x-ssp", PXA25x_SSP },
259 { "pxa25x-nssp", PXA25x_NSSP }, 259 { "pxa25x-nssp", PXA25x_NSSP },
260 { "pxa27x-ssp", PXA27x_SSP }, 260 { "pxa27x-ssp", PXA27x_SSP },
261 { "pxa3xx-ssp", PXA3xx_SSP },
261 { "pxa168-ssp", PXA168_SSP }, 262 { "pxa168-ssp", PXA168_SSP },
262 { "pxa910-ssp", PXA910_SSP }, 263 { "pxa910-ssp", PXA910_SSP },
263 { }, 264 { },
diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile
index 12969523414c..1f85bfe6b470 100644
--- a/arch/arm/xen/Makefile
+++ b/arch/arm/xen/Makefile
@@ -1 +1 @@
obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o mm32.o
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 98544c5f86e9..0e15f011f9c8 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -260,6 +260,12 @@ static int __init xen_guest_init(void)
260 xen_domain_type = XEN_HVM_DOMAIN; 260 xen_domain_type = XEN_HVM_DOMAIN;
261 261
262 xen_setup_features(); 262 xen_setup_features();
263
264 if (!xen_feature(XENFEAT_grant_map_identity)) {
265 pr_warn("Please upgrade your Xen.\n"
266 "If your platform has any non-coherent DMA devices, they won't work properly.\n");
267 }
268
263 if (xen_feature(XENFEAT_dom0)) 269 if (xen_feature(XENFEAT_dom0))
264 xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; 270 xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
265 else 271 else
diff --git a/arch/arm/xen/mm32.c b/arch/arm/xen/mm32.c
new file mode 100644
index 000000000000..3b99860fd7ae
--- /dev/null
+++ b/arch/arm/xen/mm32.c
@@ -0,0 +1,202 @@
1#include <linux/cpu.h>
2#include <linux/dma-mapping.h>
3#include <linux/gfp.h>
4#include <linux/highmem.h>
5
6#include <xen/features.h>
7
8static DEFINE_PER_CPU(unsigned long, xen_mm32_scratch_virt);
9static DEFINE_PER_CPU(pte_t *, xen_mm32_scratch_ptep);
10
11static int alloc_xen_mm32_scratch_page(int cpu)
12{
13 struct page *page;
14 unsigned long virt;
15 pmd_t *pmdp;
16 pte_t *ptep;
17
18 if (per_cpu(xen_mm32_scratch_ptep, cpu) != NULL)
19 return 0;
20
21 page = alloc_page(GFP_KERNEL);
22 if (page == NULL) {
23 pr_warn("Failed to allocate xen_mm32_scratch_page for cpu %d\n", cpu);
24 return -ENOMEM;
25 }
26
27 virt = (unsigned long)__va(page_to_phys(page));
28 pmdp = pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt);
29 ptep = pte_offset_kernel(pmdp, virt);
30
31 per_cpu(xen_mm32_scratch_virt, cpu) = virt;
32 per_cpu(xen_mm32_scratch_ptep, cpu) = ptep;
33
34 return 0;
35}
36
37static int xen_mm32_cpu_notify(struct notifier_block *self,
38 unsigned long action, void *hcpu)
39{
40 int cpu = (long)hcpu;
41 switch (action) {
42 case CPU_UP_PREPARE:
43 if (alloc_xen_mm32_scratch_page(cpu))
44 return NOTIFY_BAD;
45 break;
46 default:
47 break;
48 }
49 return NOTIFY_OK;
50}
51
52static struct notifier_block xen_mm32_cpu_notifier = {
53 .notifier_call = xen_mm32_cpu_notify,
54};
55
56static void* xen_mm32_remap_page(dma_addr_t handle)
57{
58 unsigned long virt = get_cpu_var(xen_mm32_scratch_virt);
59 pte_t *ptep = __get_cpu_var(xen_mm32_scratch_ptep);
60
61 *ptep = pfn_pte(handle >> PAGE_SHIFT, PAGE_KERNEL);
62 local_flush_tlb_kernel_page(virt);
63
64 return (void*)virt;
65}
66
67static void xen_mm32_unmap(void *vaddr)
68{
69 put_cpu_var(xen_mm32_scratch_virt);
70}
71
72
73/* functions called by SWIOTLB */
74
75static void dma_cache_maint(dma_addr_t handle, unsigned long offset,
76 size_t size, enum dma_data_direction dir,
77 void (*op)(const void *, size_t, int))
78{
79 unsigned long pfn;
80 size_t left = size;
81
82 pfn = (handle >> PAGE_SHIFT) + offset / PAGE_SIZE;
83 offset %= PAGE_SIZE;
84
85 do {
86 size_t len = left;
87 void *vaddr;
88
89 if (!pfn_valid(pfn))
90 {
91 /* Cannot map the page, we don't know its physical address.
92 * Return and hope for the best */
93 if (!xen_feature(XENFEAT_grant_map_identity))
94 return;
95 vaddr = xen_mm32_remap_page(handle) + offset;
96 op(vaddr, len, dir);
97 xen_mm32_unmap(vaddr - offset);
98 } else {
99 struct page *page = pfn_to_page(pfn);
100
101 if (PageHighMem(page)) {
102 if (len + offset > PAGE_SIZE)
103 len = PAGE_SIZE - offset;
104
105 if (cache_is_vipt_nonaliasing()) {
106 vaddr = kmap_atomic(page);
107 op(vaddr + offset, len, dir);
108 kunmap_atomic(vaddr);
109 } else {
110 vaddr = kmap_high_get(page);
111 if (vaddr) {
112 op(vaddr + offset, len, dir);
113 kunmap_high(page);
114 }
115 }
116 } else {
117 vaddr = page_address(page) + offset;
118 op(vaddr, len, dir);
119 }
120 }
121
122 offset = 0;
123 pfn++;
124 left -= len;
125 } while (left);
126}
127
128static void __xen_dma_page_dev_to_cpu(struct device *hwdev, dma_addr_t handle,
129 size_t size, enum dma_data_direction dir)
130{
131 /* Cannot use __dma_page_dev_to_cpu because we don't have a
132 * struct page for handle */
133
134 if (dir != DMA_TO_DEVICE)
135 outer_inv_range(handle, handle + size);
136
137 dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, dmac_unmap_area);
138}
139
140static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle,
141 size_t size, enum dma_data_direction dir)
142{
143
144 dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, dmac_map_area);
145
146 if (dir == DMA_FROM_DEVICE) {
147 outer_inv_range(handle, handle + size);
148 } else {
149 outer_clean_range(handle, handle + size);
150 }
151}
152
153void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
154 size_t size, enum dma_data_direction dir,
155 struct dma_attrs *attrs)
156
157{
158 if (!__generic_dma_ops(hwdev)->unmap_page)
159 return;
160 if (dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
161 return;
162
163 __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir);
164}
165
166void xen_dma_sync_single_for_cpu(struct device *hwdev,
167 dma_addr_t handle, size_t size, enum dma_data_direction dir)
168{
169 if (!__generic_dma_ops(hwdev)->sync_single_for_cpu)
170 return;
171 __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir);
172}
173
174void xen_dma_sync_single_for_device(struct device *hwdev,
175 dma_addr_t handle, size_t size, enum dma_data_direction dir)
176{
177 if (!__generic_dma_ops(hwdev)->sync_single_for_device)
178 return;
179 __xen_dma_page_cpu_to_dev(hwdev, handle, size, dir);
180}
181
182int __init xen_mm32_init(void)
183{
184 int cpu;
185
186 if (!xen_initial_domain())
187 return 0;
188
189 register_cpu_notifier(&xen_mm32_cpu_notifier);
190 get_online_cpus();
191 for_each_online_cpu(cpu) {
192 if (alloc_xen_mm32_scratch_page(cpu)) {
193 put_online_cpus();
194 unregister_cpu_notifier(&xen_mm32_cpu_notifier);
195 return -ENOMEM;
196 }
197 }
198 put_online_cpus();
199
200 return 0;
201}
202arch_initcall(xen_mm32_init);
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
index 97baf4427817..054857776254 100644
--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -21,14 +21,12 @@ struct xen_p2m_entry {
21 unsigned long pfn; 21 unsigned long pfn;
22 unsigned long mfn; 22 unsigned long mfn;
23 unsigned long nr_pages; 23 unsigned long nr_pages;
24 struct rb_node rbnode_mach;
25 struct rb_node rbnode_phys; 24 struct rb_node rbnode_phys;
26}; 25};
27 26
28static rwlock_t p2m_lock; 27static rwlock_t p2m_lock;
29struct rb_root phys_to_mach = RB_ROOT; 28struct rb_root phys_to_mach = RB_ROOT;
30EXPORT_SYMBOL_GPL(phys_to_mach); 29EXPORT_SYMBOL_GPL(phys_to_mach);
31static struct rb_root mach_to_phys = RB_ROOT;
32 30
33static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) 31static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new)
34{ 32{
@@ -41,8 +39,6 @@ static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new)
41 parent = *link; 39 parent = *link;
42 entry = rb_entry(parent, struct xen_p2m_entry, rbnode_phys); 40 entry = rb_entry(parent, struct xen_p2m_entry, rbnode_phys);
43 41
44 if (new->mfn == entry->mfn)
45 goto err_out;
46 if (new->pfn == entry->pfn) 42 if (new->pfn == entry->pfn)
47 goto err_out; 43 goto err_out;
48 44
@@ -88,64 +84,6 @@ unsigned long __pfn_to_mfn(unsigned long pfn)
88} 84}
89EXPORT_SYMBOL_GPL(__pfn_to_mfn); 85EXPORT_SYMBOL_GPL(__pfn_to_mfn);
90 86
91static int xen_add_mach_to_phys_entry(struct xen_p2m_entry *new)
92{
93 struct rb_node **link = &mach_to_phys.rb_node;
94 struct rb_node *parent = NULL;
95 struct xen_p2m_entry *entry;
96 int rc = 0;
97
98 while (*link) {
99 parent = *link;
100 entry = rb_entry(parent, struct xen_p2m_entry, rbnode_mach);
101
102 if (new->mfn == entry->mfn)
103 goto err_out;
104 if (new->pfn == entry->pfn)
105 goto err_out;
106
107 if (new->mfn < entry->mfn)
108 link = &(*link)->rb_left;
109 else
110 link = &(*link)->rb_right;
111 }
112 rb_link_node(&new->rbnode_mach, parent, link);
113 rb_insert_color(&new->rbnode_mach, &mach_to_phys);
114 goto out;
115
116err_out:
117 rc = -EINVAL;
118 pr_warn("%s: cannot add pfn=%pa -> mfn=%pa: pfn=%pa -> mfn=%pa already exists\n",
119 __func__, &new->pfn, &new->mfn, &entry->pfn, &entry->mfn);
120out:
121 return rc;
122}
123
124unsigned long __mfn_to_pfn(unsigned long mfn)
125{
126 struct rb_node *n = mach_to_phys.rb_node;
127 struct xen_p2m_entry *entry;
128 unsigned long irqflags;
129
130 read_lock_irqsave(&p2m_lock, irqflags);
131 while (n) {
132 entry = rb_entry(n, struct xen_p2m_entry, rbnode_mach);
133 if (entry->mfn <= mfn &&
134 entry->mfn + entry->nr_pages > mfn) {
135 read_unlock_irqrestore(&p2m_lock, irqflags);
136 return entry->pfn + (mfn - entry->mfn);
137 }
138 if (mfn < entry->mfn)
139 n = n->rb_left;
140 else
141 n = n->rb_right;
142 }
143 read_unlock_irqrestore(&p2m_lock, irqflags);
144
145 return INVALID_P2M_ENTRY;
146}
147EXPORT_SYMBOL_GPL(__mfn_to_pfn);
148
149int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, 87int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
150 struct gnttab_map_grant_ref *kmap_ops, 88 struct gnttab_map_grant_ref *kmap_ops,
151 struct page **pages, unsigned int count) 89 struct page **pages, unsigned int count)
@@ -192,7 +130,6 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
192 p2m_entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys); 130 p2m_entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys);
193 if (p2m_entry->pfn <= pfn && 131 if (p2m_entry->pfn <= pfn &&
194 p2m_entry->pfn + p2m_entry->nr_pages > pfn) { 132 p2m_entry->pfn + p2m_entry->nr_pages > pfn) {
195 rb_erase(&p2m_entry->rbnode_mach, &mach_to_phys);
196 rb_erase(&p2m_entry->rbnode_phys, &phys_to_mach); 133 rb_erase(&p2m_entry->rbnode_phys, &phys_to_mach);
197 write_unlock_irqrestore(&p2m_lock, irqflags); 134 write_unlock_irqrestore(&p2m_lock, irqflags);
198 kfree(p2m_entry); 135 kfree(p2m_entry);
@@ -217,8 +154,7 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
217 p2m_entry->mfn = mfn; 154 p2m_entry->mfn = mfn;
218 155
219 write_lock_irqsave(&p2m_lock, irqflags); 156 write_lock_irqsave(&p2m_lock, irqflags);
220 if ((rc = xen_add_phys_to_mach_entry(p2m_entry) < 0) || 157 if ((rc = xen_add_phys_to_mach_entry(p2m_entry)) < 0) {
221 (rc = xen_add_mach_to_phys_entry(p2m_entry) < 0)) {
222 write_unlock_irqrestore(&p2m_lock, irqflags); 158 write_unlock_irqrestore(&p2m_lock, irqflags);
223 return false; 159 return false;
224 } 160 }
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index fd4e81a4e1ce..c49ca4c738bb 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -18,6 +18,7 @@ config ARM64
18 select COMMON_CLK 18 select COMMON_CLK
19 select CPU_PM if (SUSPEND || CPU_IDLE) 19 select CPU_PM if (SUSPEND || CPU_IDLE)
20 select DCACHE_WORD_ACCESS 20 select DCACHE_WORD_ACCESS
21 select GENERIC_ALLOCATOR
21 select GENERIC_CLOCKEVENTS 22 select GENERIC_CLOCKEVENTS
22 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 23 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
23 select GENERIC_CPU_AUTOPROBE 24 select GENERIC_CPU_AUTOPROBE
@@ -30,11 +31,13 @@ config ARM64
30 select GENERIC_STRNCPY_FROM_USER 31 select GENERIC_STRNCPY_FROM_USER
31 select GENERIC_STRNLEN_USER 32 select GENERIC_STRNLEN_USER
32 select GENERIC_TIME_VSYSCALL 33 select GENERIC_TIME_VSYSCALL
34 select HANDLE_DOMAIN_IRQ
33 select HARDIRQS_SW_RESEND 35 select HARDIRQS_SW_RESEND
34 select HAVE_ARCH_AUDITSYSCALL 36 select HAVE_ARCH_AUDITSYSCALL
35 select HAVE_ARCH_JUMP_LABEL 37 select HAVE_ARCH_JUMP_LABEL
36 select HAVE_ARCH_KGDB 38 select HAVE_ARCH_KGDB
37 select HAVE_ARCH_TRACEHOOK 39 select HAVE_ARCH_TRACEHOOK
40 select HAVE_BPF_JIT
38 select HAVE_C_RECORDMCOUNT 41 select HAVE_C_RECORDMCOUNT
39 select HAVE_CC_STACKPROTECTOR 42 select HAVE_CC_STACKPROTECTOR
40 select HAVE_DEBUG_BUGVERBOSE 43 select HAVE_DEBUG_BUGVERBOSE
@@ -54,6 +57,7 @@ config ARM64
54 select HAVE_PERF_EVENTS 57 select HAVE_PERF_EVENTS
55 select HAVE_PERF_REGS 58 select HAVE_PERF_REGS
56 select HAVE_PERF_USER_STACK_DUMP 59 select HAVE_PERF_USER_STACK_DUMP
60 select HAVE_RCU_TABLE_FREE
57 select HAVE_SYSCALL_TRACEPOINTS 61 select HAVE_SYSCALL_TRACEPOINTS
58 select IRQ_DOMAIN 62 select IRQ_DOMAIN
59 select MODULES_USE_ELF_RELA 63 select MODULES_USE_ELF_RELA
@@ -81,7 +85,7 @@ config MMU
81 def_bool y 85 def_bool y
82 86
83config NO_IOPORT_MAP 87config NO_IOPORT_MAP
84 def_bool y 88 def_bool y if !PCI
85 89
86config STACKTRACE_SUPPORT 90config STACKTRACE_SUPPORT
87 def_bool y 91 def_bool y
@@ -107,6 +111,9 @@ config GENERIC_CALIBRATE_DELAY
107config ZONE_DMA 111config ZONE_DMA
108 def_bool y 112 def_bool y
109 113
114config HAVE_GENERIC_RCU_GUP
115 def_bool y
116
110config ARCH_DMA_ADDR_T_64BIT 117config ARCH_DMA_ADDR_T_64BIT
111 def_bool y 118 def_bool y
112 119
@@ -134,6 +141,11 @@ source "kernel/Kconfig.freezer"
134 141
135menu "Platform selection" 142menu "Platform selection"
136 143
144config ARCH_THUNDER
145 bool "Cavium Inc. Thunder SoC Family"
146 help
147 This enables support for Cavium's Thunder Family of SoCs.
148
137config ARCH_VEXPRESS 149config ARCH_VEXPRESS
138 bool "ARMv8 software model (Versatile Express)" 150 bool "ARMv8 software model (Versatile Express)"
139 select ARCH_REQUIRE_GPIOLIB 151 select ARCH_REQUIRE_GPIOLIB
@@ -156,6 +168,26 @@ menu "Bus support"
156config ARM_AMBA 168config ARM_AMBA
157 bool 169 bool
158 170
171config PCI
172 bool "PCI support"
173 help
174 This feature enables support for PCI bus system. If you say Y
175 here, the kernel will include drivers and infrastructure code
176 to support PCI bus devices.
177
178config PCI_DOMAINS
179 def_bool PCI
180
181config PCI_DOMAINS_GENERIC
182 def_bool PCI
183
184config PCI_SYSCALL
185 def_bool PCI
186
187source "drivers/pci/Kconfig"
188source "drivers/pci/pcie/Kconfig"
189source "drivers/pci/hotplug/Kconfig"
190
159endmenu 191endmenu
160 192
161menu "Kernel Features" 193menu "Kernel Features"
@@ -252,11 +284,11 @@ config SCHED_SMT
252 places. If unsure say N here. 284 places. If unsure say N here.
253 285
254config NR_CPUS 286config NR_CPUS
255 int "Maximum number of CPUs (2-32)" 287 int "Maximum number of CPUs (2-64)"
256 range 2 32 288 range 2 64
257 depends on SMP 289 depends on SMP
258 # These have to remain sorted largest to smallest 290 # These have to remain sorted largest to smallest
259 default "8" 291 default "64"
260 292
261config HOTPLUG_CPU 293config HOTPLUG_CPU
262 bool "Support for hot-pluggable CPUs" 294 bool "Support for hot-pluggable CPUs"
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index 4ee8e90b7a45..0a12933e50ed 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -43,4 +43,15 @@ config ARM64_RANDOMIZE_TEXT_OFFSET
43 of TEXT_OFFSET and platforms must not require a specific 43 of TEXT_OFFSET and platforms must not require a specific
44 value. 44 value.
45 45
46config DEBUG_SET_MODULE_RONX
47 bool "Set loadable kernel module data as NX and text as RO"
48 depends on MODULES
49 help
50 This option helps catch unintended modifications to loadable
51 kernel module's text and read-only data. It also prevents execution
52 of module data. Such protection may interfere with run-time code
53 patching and dynamic kernel tracing - and they might also protect
54 against certain classes of kernel exploits.
55 If in doubt, say "N".
56
46endmenu 57endmenu
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 57833546bf00..59c86b6b3052 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -39,7 +39,7 @@ head-y := arch/arm64/kernel/head.o
39 39
40# The byte offset of the kernel image in RAM from the start of RAM. 40# The byte offset of the kernel image in RAM from the start of RAM.
41ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y) 41ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y)
42TEXT_OFFSET := $(shell awk 'BEGIN {srand(); printf "0x%04x0\n", int(65535 * rand())}') 42TEXT_OFFSET := $(shell awk 'BEGIN {srand(); printf "0x%03x000\n", int(512 * rand())}')
43else 43else
44TEXT_OFFSET := 0x00080000 44TEXT_OFFSET := 0x00080000
45endif 45endif
@@ -47,6 +47,7 @@ endif
47export TEXT_OFFSET GZFLAGS 47export TEXT_OFFSET GZFLAGS
48 48
49core-y += arch/arm64/kernel/ arch/arm64/mm/ 49core-y += arch/arm64/kernel/ arch/arm64/mm/
50core-$(CONFIG_NET) += arch/arm64/net/
50core-$(CONFIG_KVM) += arch/arm64/kvm/ 51core-$(CONFIG_KVM) += arch/arm64/kvm/
51core-$(CONFIG_XEN) += arch/arm64/xen/ 52core-$(CONFIG_XEN) += arch/arm64/xen/
52core-$(CONFIG_CRYPTO) += arch/arm64/crypto/ 53core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index c52bdb051f66..f8001a62029c 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,3 +1,4 @@
1dtb-$(CONFIG_ARCH_THUNDER) += thunder-88xx.dtb
1dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb 2dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb
2dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb 3dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
3 4
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
index b2f56229aa5e..f64900052f4e 100644
--- a/arch/arm64/boot/dts/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm-mustang.dts
@@ -25,6 +25,14 @@
25 }; 25 };
26}; 26};
27 27
28&pcie0clk {
29 status = "ok";
30};
31
32&pcie0 {
33 status = "ok";
34};
35
28&serial0 { 36&serial0 {
29 status = "ok"; 37 status = "ok";
30}; 38};
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
index c0aceef7f5b3..4f6d04d52cca 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -269,6 +269,184 @@
269 enable-mask = <0x2>; 269 enable-mask = <0x2>;
270 clock-output-names = "rtcclk"; 270 clock-output-names = "rtcclk";
271 }; 271 };
272
273 rngpkaclk: rngpkaclk@17000000 {
274 compatible = "apm,xgene-device-clock";
275 #clock-cells = <1>;
276 clocks = <&socplldiv2 0>;
277 reg = <0x0 0x17000000 0x0 0x2000>;
278 reg-names = "csr-reg";
279 csr-offset = <0xc>;
280 csr-mask = <0x10>;
281 enable-offset = <0x10>;
282 enable-mask = <0x10>;
283 clock-output-names = "rngpkaclk";
284 };
285
286 pcie0clk: pcie0clk@1f2bc000 {
287 status = "disabled";
288 compatible = "apm,xgene-device-clock";
289 #clock-cells = <1>;
290 clocks = <&socplldiv2 0>;
291 reg = <0x0 0x1f2bc000 0x0 0x1000>;
292 reg-names = "csr-reg";
293 clock-output-names = "pcie0clk";
294 };
295
296 pcie1clk: pcie1clk@1f2cc000 {
297 status = "disabled";
298 compatible = "apm,xgene-device-clock";
299 #clock-cells = <1>;
300 clocks = <&socplldiv2 0>;
301 reg = <0x0 0x1f2cc000 0x0 0x1000>;
302 reg-names = "csr-reg";
303 clock-output-names = "pcie1clk";
304 };
305
306 pcie2clk: pcie2clk@1f2dc000 {
307 status = "disabled";
308 compatible = "apm,xgene-device-clock";
309 #clock-cells = <1>;
310 clocks = <&socplldiv2 0>;
311 reg = <0x0 0x1f2dc000 0x0 0x1000>;
312 reg-names = "csr-reg";
313 clock-output-names = "pcie2clk";
314 };
315
316 pcie3clk: pcie3clk@1f50c000 {
317 status = "disabled";
318 compatible = "apm,xgene-device-clock";
319 #clock-cells = <1>;
320 clocks = <&socplldiv2 0>;
321 reg = <0x0 0x1f50c000 0x0 0x1000>;
322 reg-names = "csr-reg";
323 clock-output-names = "pcie3clk";
324 };
325
326 pcie4clk: pcie4clk@1f51c000 {
327 status = "disabled";
328 compatible = "apm,xgene-device-clock";
329 #clock-cells = <1>;
330 clocks = <&socplldiv2 0>;
331 reg = <0x0 0x1f51c000 0x0 0x1000>;
332 reg-names = "csr-reg";
333 clock-output-names = "pcie4clk";
334 };
335 };
336
337 pcie0: pcie@1f2b0000 {
338 status = "disabled";
339 device_type = "pci";
340 compatible = "apm,xgene-storm-pcie", "apm,xgene-pcie";
341 #interrupt-cells = <1>;
342 #size-cells = <2>;
343 #address-cells = <3>;
344 reg = < 0x00 0x1f2b0000 0x0 0x00010000 /* Controller registers */
345 0xe0 0xd0000000 0x0 0x00040000>; /* PCI config space */
346 reg-names = "csr", "cfg";
347 ranges = <0x01000000 0x00 0x00000000 0xe0 0x10000000 0x00 0x00010000 /* io */
348 0x02000000 0x00 0x80000000 0xe1 0x80000000 0x00 0x80000000>; /* mem */
349 dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
350 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
351 interrupt-map-mask = <0x0 0x0 0x0 0x7>;
352 interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0xc2 0x1
353 0x0 0x0 0x0 0x2 &gic 0x0 0xc3 0x1
354 0x0 0x0 0x0 0x3 &gic 0x0 0xc4 0x1
355 0x0 0x0 0x0 0x4 &gic 0x0 0xc5 0x1>;
356 dma-coherent;
357 clocks = <&pcie0clk 0>;
358 };
359
360 pcie1: pcie@1f2c0000 {
361 status = "disabled";
362 device_type = "pci";
363 compatible = "apm,xgene-storm-pcie", "apm,xgene-pcie";
364 #interrupt-cells = <1>;
365 #size-cells = <2>;
366 #address-cells = <3>;
367 reg = < 0x00 0x1f2c0000 0x0 0x00010000 /* Controller registers */
368 0xd0 0xd0000000 0x0 0x00040000>; /* PCI config space */
369 reg-names = "csr", "cfg";
370 ranges = <0x01000000 0x0 0x00000000 0xd0 0x10000000 0x00 0x00010000 /* io */
371 0x02000000 0x0 0x80000000 0xd1 0x80000000 0x00 0x80000000>; /* mem */
372 dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
373 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
374 interrupt-map-mask = <0x0 0x0 0x0 0x7>;
375 interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0xc8 0x1
376 0x0 0x0 0x0 0x2 &gic 0x0 0xc9 0x1
377 0x0 0x0 0x0 0x3 &gic 0x0 0xca 0x1
378 0x0 0x0 0x0 0x4 &gic 0x0 0xcb 0x1>;
379 dma-coherent;
380 clocks = <&pcie1clk 0>;
381 };
382
383 pcie2: pcie@1f2d0000 {
384 status = "disabled";
385 device_type = "pci";
386 compatible = "apm,xgene-storm-pcie", "apm,xgene-pcie";
387 #interrupt-cells = <1>;
388 #size-cells = <2>;
389 #address-cells = <3>;
390 reg = < 0x00 0x1f2d0000 0x0 0x00010000 /* Controller registers */
391 0x90 0xd0000000 0x0 0x00040000>; /* PCI config space */
392 reg-names = "csr", "cfg";
393 ranges = <0x01000000 0x0 0x00000000 0x90 0x10000000 0x0 0x00010000 /* io */
394 0x02000000 0x0 0x80000000 0x91 0x80000000 0x0 0x80000000>; /* mem */
395 dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
396 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
397 interrupt-map-mask = <0x0 0x0 0x0 0x7>;
398 interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0xce 0x1
399 0x0 0x0 0x0 0x2 &gic 0x0 0xcf 0x1
400 0x0 0x0 0x0 0x3 &gic 0x0 0xd0 0x1
401 0x0 0x0 0x0 0x4 &gic 0x0 0xd1 0x1>;
402 dma-coherent;
403 clocks = <&pcie2clk 0>;
404 };
405
406 pcie3: pcie@1f500000 {
407 status = "disabled";
408 device_type = "pci";
409 compatible = "apm,xgene-storm-pcie", "apm,xgene-pcie";
410 #interrupt-cells = <1>;
411 #size-cells = <2>;
412 #address-cells = <3>;
413 reg = < 0x00 0x1f500000 0x0 0x00010000 /* Controller registers */
414 0xa0 0xd0000000 0x0 0x00040000>; /* PCI config space */
415 reg-names = "csr", "cfg";
416 ranges = <0x01000000 0x0 0x00000000 0xa0 0x10000000 0x0 0x00010000 /* io */
417 0x02000000 0x0 0x80000000 0xa1 0x80000000 0x0 0x80000000>; /* mem */
418 dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
419 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
420 interrupt-map-mask = <0x0 0x0 0x0 0x7>;
421 interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0xd4 0x1
422 0x0 0x0 0x0 0x2 &gic 0x0 0xd5 0x1
423 0x0 0x0 0x0 0x3 &gic 0x0 0xd6 0x1
424 0x0 0x0 0x0 0x4 &gic 0x0 0xd7 0x1>;
425 dma-coherent;
426 clocks = <&pcie3clk 0>;
427 };
428
429 pcie4: pcie@1f510000 {
430 status = "disabled";
431 device_type = "pci";
432 compatible = "apm,xgene-storm-pcie", "apm,xgene-pcie";
433 #interrupt-cells = <1>;
434 #size-cells = <2>;
435 #address-cells = <3>;
436 reg = < 0x00 0x1f510000 0x0 0x00010000 /* Controller registers */
437 0xc0 0xd0000000 0x0 0x00200000>; /* PCI config space */
438 reg-names = "csr", "cfg";
439 ranges = <0x01000000 0x0 0x00000000 0xc0 0x10000000 0x0 0x00010000 /* io */
440 0x02000000 0x0 0x80000000 0xc1 0x80000000 0x0 0x80000000>; /* mem */
441 dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
442 0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
443 interrupt-map-mask = <0x0 0x0 0x0 0x7>;
444 interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0xda 0x1
445 0x0 0x0 0x0 0x2 &gic 0x0 0xdb 0x1
446 0x0 0x0 0x0 0x3 &gic 0x0 0xdc 0x1
447 0x0 0x0 0x0 0x4 &gic 0x0 0xdd 0x1>;
448 dma-coherent;
449 clocks = <&pcie4clk 0>;
272 }; 450 };
273 451
274 serial0: serial@1c020000 { 452 serial0: serial@1c020000 {
@@ -421,5 +599,13 @@
421 599
422 }; 600 };
423 }; 601 };
602
603 rng: rng@10520000 {
604 compatible = "apm,xgene-rng";
605 reg = <0x0 0x10520000 0x0 0x100>;
606 interrupts = <0x0 0x41 0x4>;
607 clocks = <&rngpkaclk 0>;
608 };
609
424 }; 610 };
425}; 611};
diff --git a/arch/arm64/boot/dts/thunder-88xx.dts b/arch/arm64/boot/dts/thunder-88xx.dts
new file mode 100644
index 000000000000..800ba65991f7
--- /dev/null
+++ b/arch/arm64/boot/dts/thunder-88xx.dts
@@ -0,0 +1,67 @@
1/*
2 * Cavium Thunder DTS file - Thunder board description
3 *
4 * Copyright (C) 2014, Cavium Inc.
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 * a) This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version.
15 *
16 * This library 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
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 * MA 02110-1301 USA
25 *
26 * Or, alternatively,
27 *
28 * b) Permission is hereby granted, free of charge, to any person
29 * obtaining a copy of this software and associated documentation
30 * files (the "Software"), to deal in the Software without
31 * restriction, including without limitation the rights to use,
32 * copy, modify, merge, publish, distribute, sublicense, and/or
33 * sell copies of the Software, and to permit persons to whom the
34 * Software is furnished to do so, subject to the following
35 * conditions:
36 *
37 * The above copyright notice and this permission notice shall be
38 * included in all copies or substantial portions of the Software.
39 *
40 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
42 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
44 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 * OTHER DEALINGS IN THE SOFTWARE.
48 */
49
50/dts-v1/;
51
52/include/ "thunder-88xx.dtsi"
53
54/ {
55 model = "Cavium ThunderX CN88XX board";
56 compatible = "cavium,thunder-88xx";
57
58 aliases {
59 serial0 = &uaa0;
60 serial1 = &uaa1;
61 };
62
63 memory@00000000 {
64 device_type = "memory";
65 reg = <0x0 0x00000000 0x0 0x80000000>;
66 };
67};
diff --git a/arch/arm64/boot/dts/thunder-88xx.dtsi b/arch/arm64/boot/dts/thunder-88xx.dtsi
new file mode 100644
index 000000000000..d8c0bdc51882
--- /dev/null
+++ b/arch/arm64/boot/dts/thunder-88xx.dtsi
@@ -0,0 +1,401 @@
1/*
2 * Cavium Thunder DTS file - Thunder SoC description
3 *
4 * Copyright (C) 2014, Cavium Inc.
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 * a) This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version.
15 *
16 * This library 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
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 * MA 02110-1301 USA
25 *
26 * Or, alternatively,
27 *
28 * b) Permission is hereby granted, free of charge, to any person
29 * obtaining a copy of this software and associated documentation
30 * files (the "Software"), to deal in the Software without
31 * restriction, including without limitation the rights to use,
32 * copy, modify, merge, publish, distribute, sublicense, and/or
33 * sell copies of the Software, and to permit persons to whom the
34 * Software is furnished to do so, subject to the following
35 * conditions:
36 *
37 * The above copyright notice and this permission notice shall be
38 * included in all copies or substantial portions of the Software.
39 *
40 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
42 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
44 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 * OTHER DEALINGS IN THE SOFTWARE.
48 */
49
50/ {
51 compatible = "cavium,thunder-88xx";
52 interrupt-parent = <&gic0>;
53 #address-cells = <2>;
54 #size-cells = <2>;
55
56 psci {
57 compatible = "arm,psci-0.2";
58 method = "smc";
59 };
60
61 cpus {
62 #address-cells = <2>;
63 #size-cells = <0>;
64
65 cpu@000 {
66 device_type = "cpu";
67 compatible = "cavium,thunder", "arm,armv8";
68 reg = <0x0 0x000>;
69 enable-method = "psci";
70 };
71 cpu@001 {
72 device_type = "cpu";
73 compatible = "cavium,thunder", "arm,armv8";
74 reg = <0x0 0x001>;
75 enable-method = "psci";
76 };
77 cpu@002 {
78 device_type = "cpu";
79 compatible = "cavium,thunder", "arm,armv8";
80 reg = <0x0 0x002>;
81 enable-method = "psci";
82 };
83 cpu@003 {
84 device_type = "cpu";
85 compatible = "cavium,thunder", "arm,armv8";
86 reg = <0x0 0x003>;
87 enable-method = "psci";
88 };
89 cpu@004 {
90 device_type = "cpu";
91 compatible = "cavium,thunder", "arm,armv8";
92 reg = <0x0 0x004>;
93 enable-method = "psci";
94 };
95 cpu@005 {
96 device_type = "cpu";
97 compatible = "cavium,thunder", "arm,armv8";
98 reg = <0x0 0x005>;
99 enable-method = "psci";
100 };
101 cpu@006 {
102 device_type = "cpu";
103 compatible = "cavium,thunder", "arm,armv8";
104 reg = <0x0 0x006>;
105 enable-method = "psci";
106 };
107 cpu@007 {
108 device_type = "cpu";
109 compatible = "cavium,thunder", "arm,armv8";
110 reg = <0x0 0x007>;
111 enable-method = "psci";
112 };
113 cpu@008 {
114 device_type = "cpu";
115 compatible = "cavium,thunder", "arm,armv8";
116 reg = <0x0 0x008>;
117 enable-method = "psci";
118 };
119 cpu@009 {
120 device_type = "cpu";
121 compatible = "cavium,thunder", "arm,armv8";
122 reg = <0x0 0x009>;
123 enable-method = "psci";
124 };
125 cpu@00a {
126 device_type = "cpu";
127 compatible = "cavium,thunder", "arm,armv8";
128 reg = <0x0 0x00a>;
129 enable-method = "psci";
130 };
131 cpu@00b {
132 device_type = "cpu";
133 compatible = "cavium,thunder", "arm,armv8";
134 reg = <0x0 0x00b>;
135 enable-method = "psci";
136 };
137 cpu@00c {
138 device_type = "cpu";
139 compatible = "cavium,thunder", "arm,armv8";
140 reg = <0x0 0x00c>;
141 enable-method = "psci";
142 };
143 cpu@00d {
144 device_type = "cpu";
145 compatible = "cavium,thunder", "arm,armv8";
146 reg = <0x0 0x00d>;
147 enable-method = "psci";
148 };
149 cpu@00e {
150 device_type = "cpu";
151 compatible = "cavium,thunder", "arm,armv8";
152 reg = <0x0 0x00e>;
153 enable-method = "psci";
154 };
155 cpu@00f {
156 device_type = "cpu";
157 compatible = "cavium,thunder", "arm,armv8";
158 reg = <0x0 0x00f>;
159 enable-method = "psci";
160 };
161 cpu@100 {
162 device_type = "cpu";
163 compatible = "cavium,thunder", "arm,armv8";
164 reg = <0x0 0x100>;
165 enable-method = "psci";
166 };
167 cpu@101 {
168 device_type = "cpu";
169 compatible = "cavium,thunder", "arm,armv8";
170 reg = <0x0 0x101>;
171 enable-method = "psci";
172 };
173 cpu@102 {
174 device_type = "cpu";
175 compatible = "cavium,thunder", "arm,armv8";
176 reg = <0x0 0x102>;
177 enable-method = "psci";
178 };
179 cpu@103 {
180 device_type = "cpu";
181 compatible = "cavium,thunder", "arm,armv8";
182 reg = <0x0 0x103>;
183 enable-method = "psci";
184 };
185 cpu@104 {
186 device_type = "cpu";
187 compatible = "cavium,thunder", "arm,armv8";
188 reg = <0x0 0x104>;
189 enable-method = "psci";
190 };
191 cpu@105 {
192 device_type = "cpu";
193 compatible = "cavium,thunder", "arm,armv8";
194 reg = <0x0 0x105>;
195 enable-method = "psci";
196 };
197 cpu@106 {
198 device_type = "cpu";
199 compatible = "cavium,thunder", "arm,armv8";
200 reg = <0x0 0x106>;
201 enable-method = "psci";
202 };
203 cpu@107 {
204 device_type = "cpu";
205 compatible = "cavium,thunder", "arm,armv8";
206 reg = <0x0 0x107>;
207 enable-method = "psci";
208 };
209 cpu@108 {
210 device_type = "cpu";
211 compatible = "cavium,thunder", "arm,armv8";
212 reg = <0x0 0x108>;
213 enable-method = "psci";
214 };
215 cpu@109 {
216 device_type = "cpu";
217 compatible = "cavium,thunder", "arm,armv8";
218 reg = <0x0 0x109>;
219 enable-method = "psci";
220 };
221 cpu@10a {
222 device_type = "cpu";
223 compatible = "cavium,thunder", "arm,armv8";
224 reg = <0x0 0x10a>;
225 enable-method = "psci";
226 };
227 cpu@10b {
228 device_type = "cpu";
229 compatible = "cavium,thunder", "arm,armv8";
230 reg = <0x0 0x10b>;
231 enable-method = "psci";
232 };
233 cpu@10c {
234 device_type = "cpu";
235 compatible = "cavium,thunder", "arm,armv8";
236 reg = <0x0 0x10c>;
237 enable-method = "psci";
238 };
239 cpu@10d {
240 device_type = "cpu";
241 compatible = "cavium,thunder", "arm,armv8";
242 reg = <0x0 0x10d>;
243 enable-method = "psci";
244 };
245 cpu@10e {
246 device_type = "cpu";
247 compatible = "cavium,thunder", "arm,armv8";
248 reg = <0x0 0x10e>;
249 enable-method = "psci";
250 };
251 cpu@10f {
252 device_type = "cpu";
253 compatible = "cavium,thunder", "arm,armv8";
254 reg = <0x0 0x10f>;
255 enable-method = "psci";
256 };
257 cpu@200 {
258 device_type = "cpu";
259 compatible = "cavium,thunder", "arm,armv8";
260 reg = <0x0 0x200>;
261 enable-method = "psci";
262 };
263 cpu@201 {
264 device_type = "cpu";
265 compatible = "cavium,thunder", "arm,armv8";
266 reg = <0x0 0x201>;
267 enable-method = "psci";
268 };
269 cpu@202 {
270 device_type = "cpu";
271 compatible = "cavium,thunder", "arm,armv8";
272 reg = <0x0 0x202>;
273 enable-method = "psci";
274 };
275 cpu@203 {
276 device_type = "cpu";
277 compatible = "cavium,thunder", "arm,armv8";
278 reg = <0x0 0x203>;
279 enable-method = "psci";
280 };
281 cpu@204 {
282 device_type = "cpu";
283 compatible = "cavium,thunder", "arm,armv8";
284 reg = <0x0 0x204>;
285 enable-method = "psci";
286 };
287 cpu@205 {
288 device_type = "cpu";
289 compatible = "cavium,thunder", "arm,armv8";
290 reg = <0x0 0x205>;
291 enable-method = "psci";
292 };
293 cpu@206 {
294 device_type = "cpu";
295 compatible = "cavium,thunder", "arm,armv8";
296 reg = <0x0 0x206>;
297 enable-method = "psci";
298 };
299 cpu@207 {
300 device_type = "cpu";
301 compatible = "cavium,thunder", "arm,armv8";
302 reg = <0x0 0x207>;
303 enable-method = "psci";
304 };
305 cpu@208 {
306 device_type = "cpu";
307 compatible = "cavium,thunder", "arm,armv8";
308 reg = <0x0 0x208>;
309 enable-method = "psci";
310 };
311 cpu@209 {
312 device_type = "cpu";
313 compatible = "cavium,thunder", "arm,armv8";
314 reg = <0x0 0x209>;
315 enable-method = "psci";
316 };
317 cpu@20a {
318 device_type = "cpu";
319 compatible = "cavium,thunder", "arm,armv8";
320 reg = <0x0 0x20a>;
321 enable-method = "psci";
322 };
323 cpu@20b {
324 device_type = "cpu";
325 compatible = "cavium,thunder", "arm,armv8";
326 reg = <0x0 0x20b>;
327 enable-method = "psci";
328 };
329 cpu@20c {
330 device_type = "cpu";
331 compatible = "cavium,thunder", "arm,armv8";
332 reg = <0x0 0x20c>;
333 enable-method = "psci";
334 };
335 cpu@20d {
336 device_type = "cpu";
337 compatible = "cavium,thunder", "arm,armv8";
338 reg = <0x0 0x20d>;
339 enable-method = "psci";
340 };
341 cpu@20e {
342 device_type = "cpu";
343 compatible = "cavium,thunder", "arm,armv8";
344 reg = <0x0 0x20e>;
345 enable-method = "psci";
346 };
347 cpu@20f {
348 device_type = "cpu";
349 compatible = "cavium,thunder", "arm,armv8";
350 reg = <0x0 0x20f>;
351 enable-method = "psci";
352 };
353 };
354
355 timer {
356 compatible = "arm,armv8-timer";
357 interrupts = <1 13 0xff01>,
358 <1 14 0xff01>,
359 <1 11 0xff01>,
360 <1 10 0xff01>;
361 };
362
363 soc {
364 compatible = "simple-bus";
365 #address-cells = <2>;
366 #size-cells = <2>;
367 ranges;
368
369 refclk50mhz: refclk50mhz {
370 compatible = "fixed-clock";
371 #clock-cells = <0>;
372 clock-frequency = <50000000>;
373 clock-output-names = "refclk50mhz";
374 };
375
376 gic0: interrupt-controller@8010,00000000 {
377 compatible = "arm,gic-v3";
378 #interrupt-cells = <3>;
379 interrupt-controller;
380 reg = <0x8010 0x00000000 0x0 0x010000>, /* GICD */
381 <0x8010 0x80000000 0x0 0x600000>; /* GICR */
382 interrupts = <1 9 0xf04>;
383 };
384
385 uaa0: serial@87e0,24000000 {
386 compatible = "arm,pl011", "arm,primecell";
387 reg = <0x87e0 0x24000000 0x0 0x1000>;
388 interrupts = <1 21 4>;
389 clocks = <&refclk50mhz>;
390 clock-names = "apb_pclk";
391 };
392
393 uaa1: serial@87e0,25000000 {
394 compatible = "arm,pl011", "arm,primecell";
395 reg = <0x87e0 0x25000000 0x0 0x1000>;
396 interrupts = <1 22 4>;
397 clocks = <&refclk50mhz>;
398 clock-names = "apb_pclk";
399 };
400 };
401};
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 1e52b741d806..9cd37de9aa8d 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -32,6 +32,7 @@ CONFIG_MODULES=y
32CONFIG_MODULE_UNLOAD=y 32CONFIG_MODULE_UNLOAD=y
33# CONFIG_BLK_DEV_BSG is not set 33# CONFIG_BLK_DEV_BSG is not set
34# CONFIG_IOSCHED_DEADLINE is not set 34# CONFIG_IOSCHED_DEADLINE is not set
35CONFIG_ARCH_THUNDER=y
35CONFIG_ARCH_VEXPRESS=y 36CONFIG_ARCH_VEXPRESS=y
36CONFIG_ARCH_XGENE=y 37CONFIG_ARCH_XGENE=y
37CONFIG_SMP=y 38CONFIG_SMP=y
@@ -64,6 +65,8 @@ CONFIG_VIRTIO_BLK=y
64CONFIG_BLK_DEV_SD=y 65CONFIG_BLK_DEV_SD=y
65# CONFIG_SCSI_LOWLEVEL is not set 66# CONFIG_SCSI_LOWLEVEL is not set
66CONFIG_ATA=y 67CONFIG_ATA=y
68CONFIG_AHCI_XGENE=y
69CONFIG_PHY_XGENE=y
67CONFIG_PATA_PLATFORM=y 70CONFIG_PATA_PLATFORM=y
68CONFIG_PATA_OF_PLATFORM=y 71CONFIG_PATA_OF_PLATFORM=y
69CONFIG_NETDEVICES=y 72CONFIG_NETDEVICES=y
@@ -71,6 +74,7 @@ CONFIG_TUN=y
71CONFIG_VIRTIO_NET=y 74CONFIG_VIRTIO_NET=y
72CONFIG_SMC91X=y 75CONFIG_SMC91X=y
73CONFIG_SMSC911X=y 76CONFIG_SMSC911X=y
77CONFIG_NET_XGENE=y
74# CONFIG_WLAN is not set 78# CONFIG_WLAN is not set
75CONFIG_INPUT_EVDEV=y 79CONFIG_INPUT_EVDEV=y
76# CONFIG_SERIO_SERPORT is not set 80# CONFIG_SERIO_SERPORT is not set
diff --git a/arch/arm64/crypto/sha2-ce-glue.c b/arch/arm64/crypto/sha2-ce-glue.c
index c294e67d3925..ae67e88c28b9 100644
--- a/arch/arm64/crypto/sha2-ce-glue.c
+++ b/arch/arm64/crypto/sha2-ce-glue.c
@@ -150,7 +150,6 @@ static void sha2_finup(struct shash_desc *desc, const u8 *data,
150 kernel_neon_begin_partial(28); 150 kernel_neon_begin_partial(28);
151 sha2_ce_transform(blocks, data, sctx->state, NULL, len); 151 sha2_ce_transform(blocks, data, sctx->state, NULL, len);
152 kernel_neon_end(); 152 kernel_neon_end();
153 data += blocks * SHA256_BLOCK_SIZE;
154} 153}
155 154
156static int sha224_finup(struct shash_desc *desc, const u8 *data, 155static int sha224_finup(struct shash_desc *desc, const u8 *data,
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 0b3fcf86e6ba..774a7c85e70f 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -9,8 +9,8 @@ generic-y += current.h
9generic-y += delay.h 9generic-y += delay.h
10generic-y += div64.h 10generic-y += div64.h
11generic-y += dma.h 11generic-y += dma.h
12generic-y += emergency-restart.h
13generic-y += early_ioremap.h 12generic-y += early_ioremap.h
13generic-y += emergency-restart.h
14generic-y += errno.h 14generic-y += errno.h
15generic-y += ftrace.h 15generic-y += ftrace.h
16generic-y += hash.h 16generic-y += hash.h
@@ -29,6 +29,7 @@ generic-y += mman.h
29generic-y += msgbuf.h 29generic-y += msgbuf.h
30generic-y += mutex.h 30generic-y += mutex.h
31generic-y += pci.h 31generic-y += pci.h
32generic-y += pci-bridge.h
32generic-y += poll.h 33generic-y += poll.h
33generic-y += preempt.h 34generic-y += preempt.h
34generic-y += resource.h 35generic-y += resource.h
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index 9400596a0f39..f19097134b02 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -104,37 +104,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)
104 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl)); 104 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
105} 105}
106 106
107static inline void arch_counter_set_user_access(void)
108{
109 u32 cntkctl = arch_timer_get_cntkctl();
110
111 /* Disable user access to the timers and the physical counter */
112 /* Also disable virtual event stream */
113 cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
114 | ARCH_TIMER_USR_VT_ACCESS_EN
115 | ARCH_TIMER_VIRT_EVT_EN
116 | ARCH_TIMER_USR_PCT_ACCESS_EN);
117
118 /* Enable user access to the virtual counter */
119 cntkctl |= ARCH_TIMER_USR_VCT_ACCESS_EN;
120
121 arch_timer_set_cntkctl(cntkctl);
122}
123
124static inline void arch_timer_evtstrm_enable(int divider)
125{
126 u32 cntkctl = arch_timer_get_cntkctl();
127 cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
128 /* Set the divider and enable virtual event stream */
129 cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
130 | ARCH_TIMER_VIRT_EVT_EN;
131 arch_timer_set_cntkctl(cntkctl);
132 elf_hwcap |= HWCAP_EVTSTRM;
133#ifdef CONFIG_COMPAT
134 compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM;
135#endif
136}
137
138static inline u64 arch_counter_get_cntvct(void) 107static inline u64 arch_counter_get_cntvct(void)
139{ 108{
140 u64 cval; 109 u64 cval;
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h
index f2defe1c380c..689b6379188c 100644
--- a/arch/arm64/include/asm/cacheflush.h
+++ b/arch/arm64/include/asm/cacheflush.h
@@ -148,4 +148,8 @@ static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
148{ 148{
149} 149}
150 150
151int set_memory_ro(unsigned long addr, int numpages);
152int set_memory_rw(unsigned long addr, int numpages);
153int set_memory_x(unsigned long addr, int numpages);
154int set_memory_nx(unsigned long addr, int numpages);
151#endif 155#endif
diff --git a/arch/arm64/include/asm/cachetype.h b/arch/arm64/include/asm/cachetype.h
index 7a2e0762cb40..4c631a0a3609 100644
--- a/arch/arm64/include/asm/cachetype.h
+++ b/arch/arm64/include/asm/cachetype.h
@@ -39,6 +39,26 @@
39 39
40extern unsigned long __icache_flags; 40extern unsigned long __icache_flags;
41 41
42#define CCSIDR_EL1_LINESIZE_MASK 0x7
43#define CCSIDR_EL1_LINESIZE(x) ((x) & CCSIDR_EL1_LINESIZE_MASK)
44
45#define CCSIDR_EL1_NUMSETS_SHIFT 13
46#define CCSIDR_EL1_NUMSETS_MASK (0x7fff << CCSIDR_EL1_NUMSETS_SHIFT)
47#define CCSIDR_EL1_NUMSETS(x) \
48 (((x) & CCSIDR_EL1_NUMSETS_MASK) >> CCSIDR_EL1_NUMSETS_SHIFT)
49
50extern u64 __attribute_const__ icache_get_ccsidr(void);
51
52static inline int icache_get_linesize(void)
53{
54 return 16 << CCSIDR_EL1_LINESIZE(icache_get_ccsidr());
55}
56
57static inline int icache_get_numsets(void)
58{
59 return 1 + CCSIDR_EL1_NUMSETS(icache_get_ccsidr());
60}
61
42/* 62/*
43 * Whilst the D-side always behaves as PIPT on AArch64, aliasing is 63 * Whilst the D-side always behaves as PIPT on AArch64, aliasing is
44 * permitted in the I-cache. 64 * permitted in the I-cache.
diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h
index d7b4b38a8e86..6f8e2ef9094a 100644
--- a/arch/arm64/include/asm/cpu_ops.h
+++ b/arch/arm64/include/asm/cpu_ops.h
@@ -28,6 +28,8 @@ struct device_node;
28 * enable-method property. 28 * enable-method property.
29 * @cpu_init: Reads any data necessary for a specific enable-method from the 29 * @cpu_init: Reads any data necessary for a specific enable-method from the
30 * devicetree, for a given cpu node and proposed logical id. 30 * devicetree, for a given cpu node and proposed logical id.
31 * @cpu_init_idle: Reads any data necessary to initialize CPU idle states from
32 * devicetree, for a given cpu node and proposed logical id.
31 * @cpu_prepare: Early one-time preparation step for a cpu. If there is a 33 * @cpu_prepare: Early one-time preparation step for a cpu. If there is a
32 * mechanism for doing so, tests whether it is possible to boot 34 * mechanism for doing so, tests whether it is possible to boot
33 * the given CPU. 35 * the given CPU.
@@ -47,6 +49,7 @@ struct device_node;
47struct cpu_operations { 49struct cpu_operations {
48 const char *name; 50 const char *name;
49 int (*cpu_init)(struct device_node *, unsigned int); 51 int (*cpu_init)(struct device_node *, unsigned int);
52 int (*cpu_init_idle)(struct device_node *, unsigned int);
50 int (*cpu_prepare)(unsigned int); 53 int (*cpu_prepare)(unsigned int);
51 int (*cpu_boot)(unsigned int); 54 int (*cpu_boot)(unsigned int);
52 void (*cpu_postboot)(void); 55 void (*cpu_postboot)(void);
@@ -61,7 +64,7 @@ struct cpu_operations {
61}; 64};
62 65
63extern const struct cpu_operations *cpu_ops[NR_CPUS]; 66extern const struct cpu_operations *cpu_ops[NR_CPUS];
64extern int __init cpu_read_ops(struct device_node *dn, int cpu); 67int __init cpu_read_ops(struct device_node *dn, int cpu);
65extern void __init cpu_read_bootcpu_ops(void); 68void __init cpu_read_bootcpu_ops(void);
66 69
67#endif /* ifndef __ASM_CPU_OPS_H */ 70#endif /* ifndef __ASM_CPU_OPS_H */
diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h
new file mode 100644
index 000000000000..b52a9932e2b1
--- /dev/null
+++ b/arch/arm64/include/asm/cpuidle.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_CPUIDLE_H
2#define __ASM_CPUIDLE_H
3
4#ifdef CONFIG_CPU_IDLE
5extern int cpu_init_idle(unsigned int cpu);
6#else
7static inline int cpu_init_idle(unsigned int cpu)
8{
9 return -EOPNOTSUPP;
10}
11#endif
12
13#endif
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index 7fb343779498..40ec68aa6870 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -48,11 +48,13 @@
48/* 48/*
49 * #imm16 values used for BRK instruction generation 49 * #imm16 values used for BRK instruction generation
50 * Allowed values for kgbd are 0x400 - 0x7ff 50 * Allowed values for kgbd are 0x400 - 0x7ff
51 * 0x100: for triggering a fault on purpose (reserved)
51 * 0x400: for dynamic BRK instruction 52 * 0x400: for dynamic BRK instruction
52 * 0x401: for compile time BRK instruction 53 * 0x401: for compile time BRK instruction
53 */ 54 */
54#define KGDB_DYN_DGB_BRK_IMM 0x400 55#define FAULT_BRK_IMM 0x100
55#define KDBG_COMPILED_DBG_BRK_IMM 0x401 56#define KGDB_DYN_DBG_BRK_IMM 0x400
57#define KGDB_COMPILED_DBG_BRK_IMM 0x401
56 58
57/* 59/*
58 * BRK instruction encoding 60 * BRK instruction encoding
@@ -61,24 +63,30 @@
61#define AARCH64_BREAK_MON 0xd4200000 63#define AARCH64_BREAK_MON 0xd4200000
62 64
63/* 65/*
66 * BRK instruction for provoking a fault on purpose
67 * Unlike kgdb, #imm16 value with unallocated handler is used for faulting.
68 */
69#define AARCH64_BREAK_FAULT (AARCH64_BREAK_MON | (FAULT_BRK_IMM << 5))
70
71/*
64 * Extract byte from BRK instruction 72 * Extract byte from BRK instruction
65 */ 73 */
66#define KGDB_DYN_DGB_BRK_INS_BYTE(x) \ 74#define KGDB_DYN_DBG_BRK_INS_BYTE(x) \
67 ((((AARCH64_BREAK_MON) & 0xffe0001f) >> (x * 8)) & 0xff) 75 ((((AARCH64_BREAK_MON) & 0xffe0001f) >> (x * 8)) & 0xff)
68 76
69/* 77/*
70 * Extract byte from BRK #imm16 78 * Extract byte from BRK #imm16
71 */ 79 */
72#define KGBD_DYN_DGB_BRK_IMM_BYTE(x) \ 80#define KGBD_DYN_DBG_BRK_IMM_BYTE(x) \
73 (((((KGDB_DYN_DGB_BRK_IMM) & 0xffff) << 5) >> (x * 8)) & 0xff) 81 (((((KGDB_DYN_DBG_BRK_IMM) & 0xffff) << 5) >> (x * 8)) & 0xff)
74 82
75#define KGDB_DYN_DGB_BRK_BYTE(x) \ 83#define KGDB_DYN_DBG_BRK_BYTE(x) \
76 (KGDB_DYN_DGB_BRK_INS_BYTE(x) | KGBD_DYN_DGB_BRK_IMM_BYTE(x)) 84 (KGDB_DYN_DBG_BRK_INS_BYTE(x) | KGBD_DYN_DBG_BRK_IMM_BYTE(x))
77 85
78#define KGDB_DYN_BRK_INS_BYTE0 KGDB_DYN_DGB_BRK_BYTE(0) 86#define KGDB_DYN_BRK_INS_BYTE0 KGDB_DYN_DBG_BRK_BYTE(0)
79#define KGDB_DYN_BRK_INS_BYTE1 KGDB_DYN_DGB_BRK_BYTE(1) 87#define KGDB_DYN_BRK_INS_BYTE1 KGDB_DYN_DBG_BRK_BYTE(1)
80#define KGDB_DYN_BRK_INS_BYTE2 KGDB_DYN_DGB_BRK_BYTE(2) 88#define KGDB_DYN_BRK_INS_BYTE2 KGDB_DYN_DBG_BRK_BYTE(2)
81#define KGDB_DYN_BRK_INS_BYTE3 KGDB_DYN_DGB_BRK_BYTE(3) 89#define KGDB_DYN_BRK_INS_BYTE3 KGDB_DYN_DBG_BRK_BYTE(3)
82 90
83#define CACHE_FLUSH_IS_SAFE 1 91#define CACHE_FLUSH_IS_SAFE 1
84 92
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index dc82e52acdb3..adeae3f6f0fc 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -52,6 +52,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
52 dev->archdata.dma_ops = ops; 52 dev->archdata.dma_ops = ops;
53} 53}
54 54
55static inline int set_arch_dma_coherent_ops(struct device *dev)
56{
57 set_dma_ops(dev, &coherent_swiotlb_dma_ops);
58 return 0;
59}
60#define set_arch_dma_coherent_ops set_arch_dma_coherent_ops
61
55#include <asm-generic/dma-mapping-common.h> 62#include <asm-generic/dma-mapping-common.h>
56 63
57static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) 64static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
diff --git a/arch/arm64/include/asm/hardirq.h b/arch/arm64/include/asm/hardirq.h
index 0be67821f9ce..e8a3268a891c 100644
--- a/arch/arm64/include/asm/hardirq.h
+++ b/arch/arm64/include/asm/hardirq.h
@@ -47,8 +47,6 @@ static inline void ack_bad_irq(unsigned int irq)
47 irq_err_count++; 47 irq_err_count++;
48} 48}
49 49
50extern void handle_IRQ(unsigned int, struct pt_regs *);
51
52/* 50/*
53 * No arch-specific IRQ flags. 51 * No arch-specific IRQ flags.
54 */ 52 */
diff --git a/arch/arm64/include/asm/hw_breakpoint.h b/arch/arm64/include/asm/hw_breakpoint.h
index d064047612b1..52b484b6aa1a 100644
--- a/arch/arm64/include/asm/hw_breakpoint.h
+++ b/arch/arm64/include/asm/hw_breakpoint.h
@@ -79,7 +79,6 @@ static inline void decode_ctrl_reg(u32 reg,
79 */ 79 */
80#define ARM_MAX_BRP 16 80#define ARM_MAX_BRP 16
81#define ARM_MAX_WRP 16 81#define ARM_MAX_WRP 16
82#define ARM_MAX_HBP_SLOTS (ARM_MAX_BRP + ARM_MAX_WRP)
83 82
84/* Virtual debug register bases. */ 83/* Virtual debug register bases. */
85#define AARCH64_DBG_REG_BVR 0 84#define AARCH64_DBG_REG_BVR 0
diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
index dc1f73b13e74..56a9e63b6c33 100644
--- a/arch/arm64/include/asm/insn.h
+++ b/arch/arm64/include/asm/insn.h
@@ -2,6 +2,8 @@
2 * Copyright (C) 2013 Huawei Ltd. 2 * Copyright (C) 2013 Huawei Ltd.
3 * Author: Jiang Liu <liuj97@gmail.com> 3 * Author: Jiang Liu <liuj97@gmail.com>
4 * 4 *
5 * Copyright (C) 2014 Zi Shen Lim <zlim.lnx@gmail.com>
6 *
5 * 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
6 * 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
7 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
@@ -64,12 +66,155 @@ enum aarch64_insn_imm_type {
64 AARCH64_INSN_IMM_14, 66 AARCH64_INSN_IMM_14,
65 AARCH64_INSN_IMM_12, 67 AARCH64_INSN_IMM_12,
66 AARCH64_INSN_IMM_9, 68 AARCH64_INSN_IMM_9,
69 AARCH64_INSN_IMM_7,
70 AARCH64_INSN_IMM_6,
71 AARCH64_INSN_IMM_S,
72 AARCH64_INSN_IMM_R,
67 AARCH64_INSN_IMM_MAX 73 AARCH64_INSN_IMM_MAX
68}; 74};
69 75
76enum aarch64_insn_register_type {
77 AARCH64_INSN_REGTYPE_RT,
78 AARCH64_INSN_REGTYPE_RN,
79 AARCH64_INSN_REGTYPE_RT2,
80 AARCH64_INSN_REGTYPE_RM,
81 AARCH64_INSN_REGTYPE_RD,
82 AARCH64_INSN_REGTYPE_RA,
83};
84
85enum aarch64_insn_register {
86 AARCH64_INSN_REG_0 = 0,
87 AARCH64_INSN_REG_1 = 1,
88 AARCH64_INSN_REG_2 = 2,
89 AARCH64_INSN_REG_3 = 3,
90 AARCH64_INSN_REG_4 = 4,
91 AARCH64_INSN_REG_5 = 5,
92 AARCH64_INSN_REG_6 = 6,
93 AARCH64_INSN_REG_7 = 7,
94 AARCH64_INSN_REG_8 = 8,
95 AARCH64_INSN_REG_9 = 9,
96 AARCH64_INSN_REG_10 = 10,
97 AARCH64_INSN_REG_11 = 11,
98 AARCH64_INSN_REG_12 = 12,
99 AARCH64_INSN_REG_13 = 13,
100 AARCH64_INSN_REG_14 = 14,
101 AARCH64_INSN_REG_15 = 15,
102 AARCH64_INSN_REG_16 = 16,
103 AARCH64_INSN_REG_17 = 17,
104 AARCH64_INSN_REG_18 = 18,
105 AARCH64_INSN_REG_19 = 19,
106 AARCH64_INSN_REG_20 = 20,
107 AARCH64_INSN_REG_21 = 21,
108 AARCH64_INSN_REG_22 = 22,
109 AARCH64_INSN_REG_23 = 23,
110 AARCH64_INSN_REG_24 = 24,
111 AARCH64_INSN_REG_25 = 25,
112 AARCH64_INSN_REG_26 = 26,
113 AARCH64_INSN_REG_27 = 27,
114 AARCH64_INSN_REG_28 = 28,
115 AARCH64_INSN_REG_29 = 29,
116 AARCH64_INSN_REG_FP = 29, /* Frame pointer */
117 AARCH64_INSN_REG_30 = 30,
118 AARCH64_INSN_REG_LR = 30, /* Link register */
119 AARCH64_INSN_REG_ZR = 31, /* Zero: as source register */
120 AARCH64_INSN_REG_SP = 31 /* Stack pointer: as load/store base reg */
121};
122
123enum aarch64_insn_variant {
124 AARCH64_INSN_VARIANT_32BIT,
125 AARCH64_INSN_VARIANT_64BIT
126};
127
128enum aarch64_insn_condition {
129 AARCH64_INSN_COND_EQ = 0x0, /* == */
130 AARCH64_INSN_COND_NE = 0x1, /* != */
131 AARCH64_INSN_COND_CS = 0x2, /* unsigned >= */
132 AARCH64_INSN_COND_CC = 0x3, /* unsigned < */
133 AARCH64_INSN_COND_MI = 0x4, /* < 0 */
134 AARCH64_INSN_COND_PL = 0x5, /* >= 0 */
135 AARCH64_INSN_COND_VS = 0x6, /* overflow */
136 AARCH64_INSN_COND_VC = 0x7, /* no overflow */
137 AARCH64_INSN_COND_HI = 0x8, /* unsigned > */
138 AARCH64_INSN_COND_LS = 0x9, /* unsigned <= */
139 AARCH64_INSN_COND_GE = 0xa, /* signed >= */
140 AARCH64_INSN_COND_LT = 0xb, /* signed < */
141 AARCH64_INSN_COND_GT = 0xc, /* signed > */
142 AARCH64_INSN_COND_LE = 0xd, /* signed <= */
143 AARCH64_INSN_COND_AL = 0xe, /* always */
144};
145
70enum aarch64_insn_branch_type { 146enum aarch64_insn_branch_type {
71 AARCH64_INSN_BRANCH_NOLINK, 147 AARCH64_INSN_BRANCH_NOLINK,
72 AARCH64_INSN_BRANCH_LINK, 148 AARCH64_INSN_BRANCH_LINK,
149 AARCH64_INSN_BRANCH_RETURN,
150 AARCH64_INSN_BRANCH_COMP_ZERO,
151 AARCH64_INSN_BRANCH_COMP_NONZERO,
152};
153
154enum aarch64_insn_size_type {
155 AARCH64_INSN_SIZE_8,
156 AARCH64_INSN_SIZE_16,
157 AARCH64_INSN_SIZE_32,
158 AARCH64_INSN_SIZE_64,
159};
160
161enum aarch64_insn_ldst_type {
162 AARCH64_INSN_LDST_LOAD_REG_OFFSET,
163 AARCH64_INSN_LDST_STORE_REG_OFFSET,
164 AARCH64_INSN_LDST_LOAD_PAIR_PRE_INDEX,
165 AARCH64_INSN_LDST_STORE_PAIR_PRE_INDEX,
166 AARCH64_INSN_LDST_LOAD_PAIR_POST_INDEX,
167 AARCH64_INSN_LDST_STORE_PAIR_POST_INDEX,
168};
169
170enum aarch64_insn_adsb_type {
171 AARCH64_INSN_ADSB_ADD,
172 AARCH64_INSN_ADSB_SUB,
173 AARCH64_INSN_ADSB_ADD_SETFLAGS,
174 AARCH64_INSN_ADSB_SUB_SETFLAGS
175};
176
177enum aarch64_insn_movewide_type {
178 AARCH64_INSN_MOVEWIDE_ZERO,
179 AARCH64_INSN_MOVEWIDE_KEEP,
180 AARCH64_INSN_MOVEWIDE_INVERSE
181};
182
183enum aarch64_insn_bitfield_type {
184 AARCH64_INSN_BITFIELD_MOVE,
185 AARCH64_INSN_BITFIELD_MOVE_UNSIGNED,
186 AARCH64_INSN_BITFIELD_MOVE_SIGNED
187};
188
189enum aarch64_insn_data1_type {
190 AARCH64_INSN_DATA1_REVERSE_16,
191 AARCH64_INSN_DATA1_REVERSE_32,
192 AARCH64_INSN_DATA1_REVERSE_64,
193};
194
195enum aarch64_insn_data2_type {
196 AARCH64_INSN_DATA2_UDIV,
197 AARCH64_INSN_DATA2_SDIV,
198 AARCH64_INSN_DATA2_LSLV,
199 AARCH64_INSN_DATA2_LSRV,
200 AARCH64_INSN_DATA2_ASRV,
201 AARCH64_INSN_DATA2_RORV,
202};
203
204enum aarch64_insn_data3_type {
205 AARCH64_INSN_DATA3_MADD,
206 AARCH64_INSN_DATA3_MSUB,
207};
208
209enum aarch64_insn_logic_type {
210 AARCH64_INSN_LOGIC_AND,
211 AARCH64_INSN_LOGIC_BIC,
212 AARCH64_INSN_LOGIC_ORR,
213 AARCH64_INSN_LOGIC_ORN,
214 AARCH64_INSN_LOGIC_EOR,
215 AARCH64_INSN_LOGIC_EON,
216 AARCH64_INSN_LOGIC_AND_SETFLAGS,
217 AARCH64_INSN_LOGIC_BIC_SETFLAGS
73}; 218};
74 219
75#define __AARCH64_INSN_FUNCS(abbr, mask, val) \ 220#define __AARCH64_INSN_FUNCS(abbr, mask, val) \
@@ -78,13 +223,58 @@ static __always_inline bool aarch64_insn_is_##abbr(u32 code) \
78static __always_inline u32 aarch64_insn_get_##abbr##_value(void) \ 223static __always_inline u32 aarch64_insn_get_##abbr##_value(void) \
79{ return (val); } 224{ return (val); }
80 225
226__AARCH64_INSN_FUNCS(str_reg, 0x3FE0EC00, 0x38206800)
227__AARCH64_INSN_FUNCS(ldr_reg, 0x3FE0EC00, 0x38606800)
228__AARCH64_INSN_FUNCS(stp_post, 0x7FC00000, 0x28800000)
229__AARCH64_INSN_FUNCS(ldp_post, 0x7FC00000, 0x28C00000)
230__AARCH64_INSN_FUNCS(stp_pre, 0x7FC00000, 0x29800000)
231__AARCH64_INSN_FUNCS(ldp_pre, 0x7FC00000, 0x29C00000)
232__AARCH64_INSN_FUNCS(add_imm, 0x7F000000, 0x11000000)
233__AARCH64_INSN_FUNCS(adds_imm, 0x7F000000, 0x31000000)
234__AARCH64_INSN_FUNCS(sub_imm, 0x7F000000, 0x51000000)
235__AARCH64_INSN_FUNCS(subs_imm, 0x7F000000, 0x71000000)
236__AARCH64_INSN_FUNCS(movn, 0x7F800000, 0x12800000)
237__AARCH64_INSN_FUNCS(sbfm, 0x7F800000, 0x13000000)
238__AARCH64_INSN_FUNCS(bfm, 0x7F800000, 0x33000000)
239__AARCH64_INSN_FUNCS(movz, 0x7F800000, 0x52800000)
240__AARCH64_INSN_FUNCS(ubfm, 0x7F800000, 0x53000000)
241__AARCH64_INSN_FUNCS(movk, 0x7F800000, 0x72800000)
242__AARCH64_INSN_FUNCS(add, 0x7F200000, 0x0B000000)
243__AARCH64_INSN_FUNCS(adds, 0x7F200000, 0x2B000000)
244__AARCH64_INSN_FUNCS(sub, 0x7F200000, 0x4B000000)
245__AARCH64_INSN_FUNCS(subs, 0x7F200000, 0x6B000000)
246__AARCH64_INSN_FUNCS(madd, 0x7FE08000, 0x1B000000)
247__AARCH64_INSN_FUNCS(msub, 0x7FE08000, 0x1B008000)
248__AARCH64_INSN_FUNCS(udiv, 0x7FE0FC00, 0x1AC00800)
249__AARCH64_INSN_FUNCS(sdiv, 0x7FE0FC00, 0x1AC00C00)
250__AARCH64_INSN_FUNCS(lslv, 0x7FE0FC00, 0x1AC02000)
251__AARCH64_INSN_FUNCS(lsrv, 0x7FE0FC00, 0x1AC02400)
252__AARCH64_INSN_FUNCS(asrv, 0x7FE0FC00, 0x1AC02800)
253__AARCH64_INSN_FUNCS(rorv, 0x7FE0FC00, 0x1AC02C00)
254__AARCH64_INSN_FUNCS(rev16, 0x7FFFFC00, 0x5AC00400)
255__AARCH64_INSN_FUNCS(rev32, 0x7FFFFC00, 0x5AC00800)
256__AARCH64_INSN_FUNCS(rev64, 0x7FFFFC00, 0x5AC00C00)
257__AARCH64_INSN_FUNCS(and, 0x7F200000, 0x0A000000)
258__AARCH64_INSN_FUNCS(bic, 0x7F200000, 0x0A200000)
259__AARCH64_INSN_FUNCS(orr, 0x7F200000, 0x2A000000)
260__AARCH64_INSN_FUNCS(orn, 0x7F200000, 0x2A200000)
261__AARCH64_INSN_FUNCS(eor, 0x7F200000, 0x4A000000)
262__AARCH64_INSN_FUNCS(eon, 0x7F200000, 0x4A200000)
263__AARCH64_INSN_FUNCS(ands, 0x7F200000, 0x6A000000)
264__AARCH64_INSN_FUNCS(bics, 0x7F200000, 0x6A200000)
81__AARCH64_INSN_FUNCS(b, 0xFC000000, 0x14000000) 265__AARCH64_INSN_FUNCS(b, 0xFC000000, 0x14000000)
82__AARCH64_INSN_FUNCS(bl, 0xFC000000, 0x94000000) 266__AARCH64_INSN_FUNCS(bl, 0xFC000000, 0x94000000)
267__AARCH64_INSN_FUNCS(cbz, 0xFE000000, 0x34000000)
268__AARCH64_INSN_FUNCS(cbnz, 0xFE000000, 0x35000000)
269__AARCH64_INSN_FUNCS(bcond, 0xFF000010, 0x54000000)
83__AARCH64_INSN_FUNCS(svc, 0xFFE0001F, 0xD4000001) 270__AARCH64_INSN_FUNCS(svc, 0xFFE0001F, 0xD4000001)
84__AARCH64_INSN_FUNCS(hvc, 0xFFE0001F, 0xD4000002) 271__AARCH64_INSN_FUNCS(hvc, 0xFFE0001F, 0xD4000002)
85__AARCH64_INSN_FUNCS(smc, 0xFFE0001F, 0xD4000003) 272__AARCH64_INSN_FUNCS(smc, 0xFFE0001F, 0xD4000003)
86__AARCH64_INSN_FUNCS(brk, 0xFFE0001F, 0xD4200000) 273__AARCH64_INSN_FUNCS(brk, 0xFFE0001F, 0xD4200000)
87__AARCH64_INSN_FUNCS(hint, 0xFFFFF01F, 0xD503201F) 274__AARCH64_INSN_FUNCS(hint, 0xFFFFF01F, 0xD503201F)
275__AARCH64_INSN_FUNCS(br, 0xFFFFFC1F, 0xD61F0000)
276__AARCH64_INSN_FUNCS(blr, 0xFFFFFC1F, 0xD63F0000)
277__AARCH64_INSN_FUNCS(ret, 0xFFFFFC1F, 0xD65F0000)
88 278
89#undef __AARCH64_INSN_FUNCS 279#undef __AARCH64_INSN_FUNCS
90 280
@@ -97,8 +287,67 @@ u32 aarch64_insn_encode_immediate(enum aarch64_insn_imm_type type,
97 u32 insn, u64 imm); 287 u32 insn, u64 imm);
98u32 aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr, 288u32 aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr,
99 enum aarch64_insn_branch_type type); 289 enum aarch64_insn_branch_type type);
290u32 aarch64_insn_gen_comp_branch_imm(unsigned long pc, unsigned long addr,
291 enum aarch64_insn_register reg,
292 enum aarch64_insn_variant variant,
293 enum aarch64_insn_branch_type type);
294u32 aarch64_insn_gen_cond_branch_imm(unsigned long pc, unsigned long addr,
295 enum aarch64_insn_condition cond);
100u32 aarch64_insn_gen_hint(enum aarch64_insn_hint_op op); 296u32 aarch64_insn_gen_hint(enum aarch64_insn_hint_op op);
101u32 aarch64_insn_gen_nop(void); 297u32 aarch64_insn_gen_nop(void);
298u32 aarch64_insn_gen_branch_reg(enum aarch64_insn_register reg,
299 enum aarch64_insn_branch_type type);
300u32 aarch64_insn_gen_load_store_reg(enum aarch64_insn_register reg,
301 enum aarch64_insn_register base,
302 enum aarch64_insn_register offset,
303 enum aarch64_insn_size_type size,
304 enum aarch64_insn_ldst_type type);
305u32 aarch64_insn_gen_load_store_pair(enum aarch64_insn_register reg1,
306 enum aarch64_insn_register reg2,
307 enum aarch64_insn_register base,
308 int offset,
309 enum aarch64_insn_variant variant,
310 enum aarch64_insn_ldst_type type);
311u32 aarch64_insn_gen_add_sub_imm(enum aarch64_insn_register dst,
312 enum aarch64_insn_register src,
313 int imm, enum aarch64_insn_variant variant,
314 enum aarch64_insn_adsb_type type);
315u32 aarch64_insn_gen_bitfield(enum aarch64_insn_register dst,
316 enum aarch64_insn_register src,
317 int immr, int imms,
318 enum aarch64_insn_variant variant,
319 enum aarch64_insn_bitfield_type type);
320u32 aarch64_insn_gen_movewide(enum aarch64_insn_register dst,
321 int imm, int shift,
322 enum aarch64_insn_variant variant,
323 enum aarch64_insn_movewide_type type);
324u32 aarch64_insn_gen_add_sub_shifted_reg(enum aarch64_insn_register dst,
325 enum aarch64_insn_register src,
326 enum aarch64_insn_register reg,
327 int shift,
328 enum aarch64_insn_variant variant,
329 enum aarch64_insn_adsb_type type);
330u32 aarch64_insn_gen_data1(enum aarch64_insn_register dst,
331 enum aarch64_insn_register src,
332 enum aarch64_insn_variant variant,
333 enum aarch64_insn_data1_type type);
334u32 aarch64_insn_gen_data2(enum aarch64_insn_register dst,
335 enum aarch64_insn_register src,
336 enum aarch64_insn_register reg,
337 enum aarch64_insn_variant variant,
338 enum aarch64_insn_data2_type type);
339u32 aarch64_insn_gen_data3(enum aarch64_insn_register dst,
340 enum aarch64_insn_register src,
341 enum aarch64_insn_register reg1,
342 enum aarch64_insn_register reg2,
343 enum aarch64_insn_variant variant,
344 enum aarch64_insn_data3_type type);
345u32 aarch64_insn_gen_logical_shifted_reg(enum aarch64_insn_register dst,
346 enum aarch64_insn_register src,
347 enum aarch64_insn_register reg,
348 int shift,
349 enum aarch64_insn_variant variant,
350 enum aarch64_insn_logic_type type);
102 351
103bool aarch64_insn_hotpatch_safe(u32 old_insn, u32 new_insn); 352bool aarch64_insn_hotpatch_safe(u32 old_insn, u32 new_insn);
104 353
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index e0ecdcf6632d..79f1d519221f 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -121,7 +121,8 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
121/* 121/*
122 * I/O port access primitives. 122 * I/O port access primitives.
123 */ 123 */
124#define IO_SPACE_LIMIT 0xffff 124#define arch_has_dev_port() (1)
125#define IO_SPACE_LIMIT (SZ_32M - 1)
125#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_32M)) 126#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_32M))
126 127
127static inline u8 inb(unsigned long addr) 128static inline u8 inb(unsigned long addr)
@@ -243,7 +244,7 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
243 * (PHYS_OFFSET and PHYS_MASK taken into account). 244 * (PHYS_OFFSET and PHYS_MASK taken into account).
244 */ 245 */
245#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 246#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
246extern int valid_phys_addr_range(unsigned long addr, size_t size); 247extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
247extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 248extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
248 249
249extern int devmem_is_allowed(unsigned long pfn); 250extern int devmem_is_allowed(unsigned long pfn);
diff --git a/arch/arm64/include/asm/irq_work.h b/arch/arm64/include/asm/irq_work.h
new file mode 100644
index 000000000000..8e24ef3f7c82
--- /dev/null
+++ b/arch/arm64/include/asm/irq_work.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_IRQ_WORK_H
2#define __ASM_IRQ_WORK_H
3
4#include <asm/smp.h>
5
6static inline bool arch_irq_work_has_interrupt(void)
7{
8 return !!__smp_cross_call;
9}
10
11#endif /* __ASM_IRQ_WORK_H */
diff --git a/arch/arm64/include/asm/kgdb.h b/arch/arm64/include/asm/kgdb.h
index 3c8aafc1082f..f69f69c8120c 100644
--- a/arch/arm64/include/asm/kgdb.h
+++ b/arch/arm64/include/asm/kgdb.h
@@ -29,7 +29,7 @@
29 29
30static inline void arch_kgdb_breakpoint(void) 30static inline void arch_kgdb_breakpoint(void)
31{ 31{
32 asm ("brk %0" : : "I" (KDBG_COMPILED_DBG_BRK_IMM)); 32 asm ("brk %0" : : "I" (KGDB_COMPILED_DBG_BRK_IMM));
33} 33}
34 34
35extern void kgdb_handle_bus_error(void); 35extern void kgdb_handle_bus_error(void);
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index cc83520459ed..7fd3e27e3ccc 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -122,6 +122,17 @@
122#define VTCR_EL2_T0SZ_MASK 0x3f 122#define VTCR_EL2_T0SZ_MASK 0x3f
123#define VTCR_EL2_T0SZ_40B 24 123#define VTCR_EL2_T0SZ_40B 24
124 124
125/*
126 * We configure the Stage-2 page tables to always restrict the IPA space to be
127 * 40 bits wide (T0SZ = 24). Systems with a PARange smaller than 40 bits are
128 * not known to exist and will break with this configuration.
129 *
130 * Note that when using 4K pages, we concatenate two first level page tables
131 * together.
132 *
133 * The magic numbers used for VTTBR_X in this patch can be found in Tables
134 * D4-23 and D4-25 in ARM DDI 0487A.b.
135 */
125#ifdef CONFIG_ARM64_64K_PAGES 136#ifdef CONFIG_ARM64_64K_PAGES
126/* 137/*
127 * Stage2 translation configuration: 138 * Stage2 translation configuration:
@@ -149,7 +160,7 @@
149#endif 160#endif
150 161
151#define VTTBR_BADDR_SHIFT (VTTBR_X - 1) 162#define VTTBR_BADDR_SHIFT (VTTBR_X - 1)
152#define VTTBR_BADDR_MASK (((1LLU << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT) 163#define VTTBR_BADDR_MASK (((1LLU << (PHYS_MASK_SHIFT - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT)
153#define VTTBR_VMID_SHIFT (48LLU) 164#define VTTBR_VMID_SHIFT (48LLU)
154#define VTTBR_VMID_MASK (0xffLLU << VTTBR_VMID_SHIFT) 165#define VTTBR_VMID_MASK (0xffLLU << VTTBR_VMID_SHIFT)
155 166
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index fdc3e21abd8d..5674a55b5518 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -174,6 +174,11 @@ static inline bool kvm_vcpu_trap_is_iabt(const struct kvm_vcpu *vcpu)
174 174
175static inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu) 175static inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu)
176{ 176{
177 return kvm_vcpu_get_hsr(vcpu) & ESR_EL2_FSC;
178}
179
180static inline u8 kvm_vcpu_trap_get_fault_type(const struct kvm_vcpu *vcpu)
181{
177 return kvm_vcpu_get_hsr(vcpu) & ESR_EL2_FSC_TYPE; 182 return kvm_vcpu_get_hsr(vcpu) & ESR_EL2_FSC_TYPE;
178} 183}
179 184
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index e10c45a578e3..2012c4ba8d67 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -22,6 +22,8 @@
22#ifndef __ARM64_KVM_HOST_H__ 22#ifndef __ARM64_KVM_HOST_H__
23#define __ARM64_KVM_HOST_H__ 23#define __ARM64_KVM_HOST_H__
24 24
25#include <linux/types.h>
26#include <linux/kvm_types.h>
25#include <asm/kvm.h> 27#include <asm/kvm.h>
26#include <asm/kvm_asm.h> 28#include <asm/kvm_asm.h>
27#include <asm/kvm_mmio.h> 29#include <asm/kvm_mmio.h>
@@ -41,8 +43,7 @@
41 43
42#define KVM_VCPU_MAX_FEATURES 3 44#define KVM_VCPU_MAX_FEATURES 3
43 45
44struct kvm_vcpu; 46int __attribute_const__ kvm_target_cpu(void);
45int kvm_target_cpu(void);
46int kvm_reset_vcpu(struct kvm_vcpu *vcpu); 47int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
47int kvm_arch_dev_ioctl_check_extension(long ext); 48int kvm_arch_dev_ioctl_check_extension(long ext);
48 49
@@ -164,25 +165,23 @@ struct kvm_vcpu_stat {
164 u32 halt_wakeup; 165 u32 halt_wakeup;
165}; 166};
166 167
167struct kvm_vcpu_init;
168int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, 168int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
169 const struct kvm_vcpu_init *init); 169 const struct kvm_vcpu_init *init);
170int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init); 170int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init);
171unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu); 171unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
172int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); 172int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
173struct kvm_one_reg;
174int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg); 173int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
175int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg); 174int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
176 175
177#define KVM_ARCH_WANT_MMU_NOTIFIER 176#define KVM_ARCH_WANT_MMU_NOTIFIER
178struct kvm;
179int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); 177int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
180int kvm_unmap_hva_range(struct kvm *kvm, 178int kvm_unmap_hva_range(struct kvm *kvm,
181 unsigned long start, unsigned long end); 179 unsigned long start, unsigned long end);
182void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); 180void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
183 181
184/* We do not have shadow page tables, hence the empty hooks */ 182/* We do not have shadow page tables, hence the empty hooks */
185static inline int kvm_age_hva(struct kvm *kvm, unsigned long hva) 183static inline int kvm_age_hva(struct kvm *kvm, unsigned long start,
184 unsigned long end)
186{ 185{
187 return 0; 186 return 0;
188} 187}
@@ -192,8 +191,13 @@ static inline int kvm_test_age_hva(struct kvm *kvm, unsigned long hva)
192 return 0; 191 return 0;
193} 192}
194 193
194static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
195 unsigned long address)
196{
197}
198
195struct kvm_vcpu *kvm_arm_get_running_vcpu(void); 199struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
196struct kvm_vcpu __percpu **kvm_get_running_vcpus(void); 200struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void);
197 201
198u64 kvm_call_hyp(void *hypfn, ...); 202u64 kvm_call_hyp(void *hypfn, ...);
199 203
@@ -244,4 +248,10 @@ static inline void vgic_arch_setup(const struct vgic_params *vgic)
244 } 248 }
245} 249}
246 250
251static inline void kvm_arch_hardware_disable(void) {}
252static inline void kvm_arch_hardware_unsetup(void) {}
253static inline void kvm_arch_sync_events(struct kvm *kvm) {}
254static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {}
255static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
256
247#endif /* __ARM64_KVM_HOST_H__ */ 257#endif /* __ARM64_KVM_HOST_H__ */
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index 8e138c7c53ac..a030d163840b 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -59,10 +59,9 @@
59#define KERN_TO_HYP(kva) ((unsigned long)kva - PAGE_OFFSET + HYP_PAGE_OFFSET) 59#define KERN_TO_HYP(kva) ((unsigned long)kva - PAGE_OFFSET + HYP_PAGE_OFFSET)
60 60
61/* 61/*
62 * Align KVM with the kernel's view of physical memory. Should be 62 * We currently only support a 40bit IPA.
63 * 40bit IPA, with PGD being 8kB aligned in the 4KB page configuration.
64 */ 63 */
65#define KVM_PHYS_SHIFT PHYS_MASK_SHIFT 64#define KVM_PHYS_SHIFT (40)
66#define KVM_PHYS_SIZE (1UL << KVM_PHYS_SHIFT) 65#define KVM_PHYS_SIZE (1UL << KVM_PHYS_SHIFT)
67#define KVM_PHYS_MASK (KVM_PHYS_SIZE - 1UL) 66#define KVM_PHYS_MASK (KVM_PHYS_SIZE - 1UL)
68 67
@@ -93,19 +92,6 @@ void kvm_clear_hyp_idmap(void);
93#define kvm_set_pte(ptep, pte) set_pte(ptep, pte) 92#define kvm_set_pte(ptep, pte) set_pte(ptep, pte)
94#define kvm_set_pmd(pmdp, pmd) set_pmd(pmdp, pmd) 93#define kvm_set_pmd(pmdp, pmd) set_pmd(pmdp, pmd)
95 94
96static inline bool kvm_is_write_fault(unsigned long esr)
97{
98 unsigned long esr_ec = esr >> ESR_EL2_EC_SHIFT;
99
100 if (esr_ec == ESR_EL2_EC_IABT)
101 return false;
102
103 if ((esr & ESR_EL2_ISV) && !(esr & ESR_EL2_WNR))
104 return false;
105
106 return true;
107}
108
109static inline void kvm_clean_pgd(pgd_t *pgd) {} 95static inline void kvm_clean_pgd(pgd_t *pgd) {}
110static inline void kvm_clean_pmd_entry(pmd_t *pmd) {} 96static inline void kvm_clean_pmd_entry(pmd_t *pmd) {}
111static inline void kvm_clean_pte(pte_t *pte) {} 97static inline void kvm_clean_pte(pte_t *pte) {}
diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
new file mode 100644
index 000000000000..872ba939fcb2
--- /dev/null
+++ b/arch/arm64/include/asm/pci.h
@@ -0,0 +1,37 @@
1#ifndef __ASM_PCI_H
2#define __ASM_PCI_H
3#ifdef __KERNEL__
4
5#include <linux/types.h>
6#include <linux/slab.h>
7#include <linux/dma-mapping.h>
8
9#include <asm/io.h>
10#include <asm-generic/pci-bridge.h>
11#include <asm-generic/pci-dma-compat.h>
12
13#define PCIBIOS_MIN_IO 0x1000
14#define PCIBIOS_MIN_MEM 0
15
16/*
17 * Set to 1 if the kernel should re-assign all PCI bus numbers
18 */
19#define pcibios_assign_all_busses() \
20 (pci_has_flag(PCI_REASSIGN_ALL_BUS))
21
22/*
23 * PCI address space differs from physical memory address space
24 */
25#define PCI_DMA_BUS_IS_PHYS (0)
26
27extern int isa_dma_bridge_buggy;
28
29#ifdef CONFIG_PCI
30static inline int pci_proc_domain(struct pci_bus *bus)
31{
32 return 1;
33}
34#endif /* CONFIG_PCI */
35
36#endif /* __KERNEL__ */
37#endif /* __ASM_PCI_H */
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h
index 453a179469a3..5279e5733386 100644
--- a/arch/arm64/include/asm/percpu.h
+++ b/arch/arm64/include/asm/percpu.h
@@ -26,13 +26,13 @@ static inline void set_my_cpu_offset(unsigned long off)
26static inline unsigned long __my_cpu_offset(void) 26static inline unsigned long __my_cpu_offset(void)
27{ 27{
28 unsigned long off; 28 unsigned long off;
29 register unsigned long *sp asm ("sp");
30 29
31 /* 30 /*
32 * We want to allow caching the value, so avoid using volatile and 31 * We want to allow caching the value, so avoid using volatile and
33 * instead use a fake stack read to hazard against barrier(). 32 * instead use a fake stack read to hazard against barrier().
34 */ 33 */
35 asm("mrs %0, tpidr_el1" : "=r" (off) : "Q" (*sp)); 34 asm("mrs %0, tpidr_el1" : "=r" (off) :
35 "Q" (*(const unsigned long *)current_stack_pointer));
36 36
37 return off; 37 return off;
38} 38}
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index ffe1ba0506d1..cefd3e825612 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -149,46 +149,51 @@ extern struct page *empty_zero_page;
149#define pte_valid_not_user(pte) \ 149#define pte_valid_not_user(pte) \
150 ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) 150 ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID)
151 151
152static inline pte_t pte_wrprotect(pte_t pte) 152static inline pte_t clear_pte_bit(pte_t pte, pgprot_t prot)
153{ 153{
154 pte_val(pte) &= ~PTE_WRITE; 154 pte_val(pte) &= ~pgprot_val(prot);
155 return pte; 155 return pte;
156} 156}
157 157
158static inline pte_t pte_mkwrite(pte_t pte) 158static inline pte_t set_pte_bit(pte_t pte, pgprot_t prot)
159{ 159{
160 pte_val(pte) |= PTE_WRITE; 160 pte_val(pte) |= pgprot_val(prot);
161 return pte; 161 return pte;
162} 162}
163 163
164static inline pte_t pte_wrprotect(pte_t pte)
165{
166 return clear_pte_bit(pte, __pgprot(PTE_WRITE));
167}
168
169static inline pte_t pte_mkwrite(pte_t pte)
170{
171 return set_pte_bit(pte, __pgprot(PTE_WRITE));
172}
173
164static inline pte_t pte_mkclean(pte_t pte) 174static inline pte_t pte_mkclean(pte_t pte)
165{ 175{
166 pte_val(pte) &= ~PTE_DIRTY; 176 return clear_pte_bit(pte, __pgprot(PTE_DIRTY));
167 return pte;
168} 177}
169 178
170static inline pte_t pte_mkdirty(pte_t pte) 179static inline pte_t pte_mkdirty(pte_t pte)
171{ 180{
172 pte_val(pte) |= PTE_DIRTY; 181 return set_pte_bit(pte, __pgprot(PTE_DIRTY));
173 return pte;
174} 182}
175 183
176static inline pte_t pte_mkold(pte_t pte) 184static inline pte_t pte_mkold(pte_t pte)
177{ 185{
178 pte_val(pte) &= ~PTE_AF; 186 return clear_pte_bit(pte, __pgprot(PTE_AF));
179 return pte;
180} 187}
181 188
182static inline pte_t pte_mkyoung(pte_t pte) 189static inline pte_t pte_mkyoung(pte_t pte)
183{ 190{
184 pte_val(pte) |= PTE_AF; 191 return set_pte_bit(pte, __pgprot(PTE_AF));
185 return pte;
186} 192}
187 193
188static inline pte_t pte_mkspecial(pte_t pte) 194static inline pte_t pte_mkspecial(pte_t pte)
189{ 195{
190 pte_val(pte) |= PTE_SPECIAL; 196 return set_pte_bit(pte, __pgprot(PTE_SPECIAL));
191 return pte;
192} 197}
193 198
194static inline void set_pte(pte_t *ptep, pte_t pte) 199static inline void set_pte(pte_t *ptep, pte_t pte)
@@ -239,6 +244,16 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
239 244
240#define __HAVE_ARCH_PTE_SPECIAL 245#define __HAVE_ARCH_PTE_SPECIAL
241 246
247static inline pte_t pud_pte(pud_t pud)
248{
249 return __pte(pud_val(pud));
250}
251
252static inline pmd_t pud_pmd(pud_t pud)
253{
254 return __pmd(pud_val(pud));
255}
256
242static inline pte_t pmd_pte(pmd_t pmd) 257static inline pte_t pmd_pte(pmd_t pmd)
243{ 258{
244 return __pte(pmd_val(pmd)); 259 return __pte(pmd_val(pmd));
@@ -256,7 +271,13 @@ static inline pmd_t pte_pmd(pte_t pte)
256#ifdef CONFIG_TRANSPARENT_HUGEPAGE 271#ifdef CONFIG_TRANSPARENT_HUGEPAGE
257#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT)) 272#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT))
258#define pmd_trans_splitting(pmd) pte_special(pmd_pte(pmd)) 273#define pmd_trans_splitting(pmd) pte_special(pmd_pte(pmd))
259#endif 274#ifdef CONFIG_HAVE_RCU_TABLE_FREE
275#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH
276struct vm_area_struct;
277void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
278 pmd_t *pmdp);
279#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
280#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
260 281
261#define pmd_young(pmd) pte_young(pmd_pte(pmd)) 282#define pmd_young(pmd) pte_young(pmd_pte(pmd))
262#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd))) 283#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd)))
@@ -277,6 +298,7 @@ static inline pmd_t pte_pmd(pte_t pte)
277#define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot) 298#define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot)
278 299
279#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK)) 300#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
301#define pud_write(pud) pte_write(pud_pte(pud))
280#define pud_pfn(pud) (((pud_val(pud) & PUD_MASK) & PHYS_MASK) >> PAGE_SHIFT) 302#define pud_pfn(pud) (((pud_val(pud) & PUD_MASK) & PHYS_MASK) >> PAGE_SHIFT)
281 303
282#define set_pmd_at(mm, addr, pmdp, pmd) set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd)) 304#define set_pmd_at(mm, addr, pmdp, pmd) set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd))
@@ -296,6 +318,8 @@ static inline int has_transparent_hugepage(void)
296 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE) | PTE_PXN | PTE_UXN) 318 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE) | PTE_PXN | PTE_UXN)
297#define pgprot_writecombine(prot) \ 319#define pgprot_writecombine(prot) \
298 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN) 320 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
321#define pgprot_device(prot) \
322 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
299#define __HAVE_PHYS_MEM_ACCESS_PROT 323#define __HAVE_PHYS_MEM_ACCESS_PROT
300struct file; 324struct file;
301extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, 325extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
@@ -376,6 +400,8 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
376 return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(addr); 400 return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(addr);
377} 401}
378 402
403#define pud_page(pud) pmd_page(pud_pmd(pud))
404
379#endif /* CONFIG_ARM64_PGTABLE_LEVELS > 2 */ 405#endif /* CONFIG_ARM64_PGTABLE_LEVELS > 2 */
380 406
381#if CONFIG_ARM64_PGTABLE_LEVELS > 3 407#if CONFIG_ARM64_PGTABLE_LEVELS > 3
diff --git a/arch/arm64/include/asm/proc-fns.h b/arch/arm64/include/asm/proc-fns.h
index 0c657bb54597..9a8fd84f8fb2 100644
--- a/arch/arm64/include/asm/proc-fns.h
+++ b/arch/arm64/include/asm/proc-fns.h
@@ -32,6 +32,8 @@ extern void cpu_cache_off(void);
32extern void cpu_do_idle(void); 32extern void cpu_do_idle(void);
33extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm); 33extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
34extern void cpu_reset(unsigned long addr) __attribute__((noreturn)); 34extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
35void cpu_soft_restart(phys_addr_t cpu_reset,
36 unsigned long addr) __attribute__((noreturn));
35extern void cpu_do_suspend(struct cpu_suspend_ctx *ptr); 37extern void cpu_do_suspend(struct cpu_suspend_ctx *ptr);
36extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr); 38extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr);
37 39
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 3df21feeabdd..286b1bec547c 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -139,7 +139,7 @@ extern struct task_struct *cpu_switch_to(struct task_struct *prev,
139 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) 139 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
140 140
141#define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc) 141#define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc)
142#define KSTK_ESP(tsk) ((unsigned long)task_pt_regs(tsk)->sp) 142#define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
143 143
144/* 144/*
145 * Prefetching support 145 * Prefetching support
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index 501000fadb6f..41ed9e13795e 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -137,7 +137,7 @@ struct pt_regs {
137 (!((regs)->pstate & PSR_F_BIT)) 137 (!((regs)->pstate & PSR_F_BIT))
138 138
139#define user_stack_pointer(regs) \ 139#define user_stack_pointer(regs) \
140 (!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp) 140 (!compat_user_mode(regs) ? (regs)->sp : (regs)->compat_sp)
141 141
142static inline unsigned long regs_return_value(struct pt_regs *regs) 142static inline unsigned long regs_return_value(struct pt_regs *regs)
143{ 143{
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index a498f2cd2c2a..780f82c827b6 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -48,6 +48,8 @@ extern void smp_init_cpus(void);
48 */ 48 */
49extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int)); 49extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
50 50
51extern void (*__smp_cross_call)(const struct cpumask *, unsigned int);
52
51/* 53/*
52 * Called from the secondary holding pen, this is the secondary CPU entry point. 54 * Called from the secondary holding pen, this is the secondary CPU entry point.
53 */ 55 */
diff --git a/arch/arm64/include/asm/sparsemem.h b/arch/arm64/include/asm/sparsemem.h
index 1be62bcb9d47..74a9d301819f 100644
--- a/arch/arm64/include/asm/sparsemem.h
+++ b/arch/arm64/include/asm/sparsemem.h
@@ -17,7 +17,7 @@
17#define __ASM_SPARSEMEM_H 17#define __ASM_SPARSEMEM_H
18 18
19#ifdef CONFIG_SPARSEMEM 19#ifdef CONFIG_SPARSEMEM
20#define MAX_PHYSMEM_BITS 40 20#define MAX_PHYSMEM_BITS 48
21#define SECTION_SIZE_BITS 30 21#define SECTION_SIZE_BITS 30
22#endif 22#endif
23 23
diff --git a/arch/arm64/include/asm/suspend.h b/arch/arm64/include/asm/suspend.h
index e9c149c042e0..456d67c1f0fa 100644
--- a/arch/arm64/include/asm/suspend.h
+++ b/arch/arm64/include/asm/suspend.h
@@ -21,6 +21,7 @@ struct sleep_save_sp {
21 phys_addr_t save_ptr_stash_phys; 21 phys_addr_t save_ptr_stash_phys;
22}; 22};
23 23
24extern int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long));
24extern void cpu_resume(void); 25extern void cpu_resume(void);
25extern int cpu_suspend(unsigned long); 26extern int cpu_suspend(unsigned long);
26 27
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index 45108d802f5e..459bf8e53208 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -69,14 +69,19 @@ struct thread_info {
69#define init_stack (init_thread_union.stack) 69#define init_stack (init_thread_union.stack)
70 70
71/* 71/*
72 * how to get the current stack pointer from C
73 */
74register unsigned long current_stack_pointer asm ("sp");
75
76/*
72 * how to get the thread information struct from C 77 * how to get the thread information struct from C
73 */ 78 */
74static inline struct thread_info *current_thread_info(void) __attribute_const__; 79static inline struct thread_info *current_thread_info(void) __attribute_const__;
75 80
76static inline struct thread_info *current_thread_info(void) 81static inline struct thread_info *current_thread_info(void)
77{ 82{
78 register unsigned long sp asm ("sp"); 83 return (struct thread_info *)
79 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); 84 (current_stack_pointer & ~(THREAD_SIZE - 1));
80} 85}
81 86
82#define thread_saved_pc(tsk) \ 87#define thread_saved_pc(tsk) \
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
index 62731ef9749a..a82c0c5c8b52 100644
--- a/arch/arm64/include/asm/tlb.h
+++ b/arch/arm64/include/asm/tlb.h
@@ -23,6 +23,20 @@
23 23
24#include <asm-generic/tlb.h> 24#include <asm-generic/tlb.h>
25 25
26#include <linux/pagemap.h>
27#include <linux/swap.h>
28
29#ifdef CONFIG_HAVE_RCU_TABLE_FREE
30
31#define tlb_remove_entry(tlb, entry) tlb_remove_table(tlb, entry)
32static inline void __tlb_remove_table(void *_table)
33{
34 free_page_and_swap_cache((struct page *)_table);
35}
36#else
37#define tlb_remove_entry(tlb, entry) tlb_remove_page(tlb, entry)
38#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
39
26/* 40/*
27 * There's three ways the TLB shootdown code is used: 41 * There's three ways the TLB shootdown code is used:
28 * 1. Unmapping a range of vmas. See zap_page_range(), unmap_region(). 42 * 1. Unmapping a range of vmas. See zap_page_range(), unmap_region().
@@ -88,7 +102,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
88{ 102{
89 pgtable_page_dtor(pte); 103 pgtable_page_dtor(pte);
90 tlb_add_flush(tlb, addr); 104 tlb_add_flush(tlb, addr);
91 tlb_remove_page(tlb, pte); 105 tlb_remove_entry(tlb, pte);
92} 106}
93 107
94#if CONFIG_ARM64_PGTABLE_LEVELS > 2 108#if CONFIG_ARM64_PGTABLE_LEVELS > 2
@@ -96,7 +110,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
96 unsigned long addr) 110 unsigned long addr)
97{ 111{
98 tlb_add_flush(tlb, addr); 112 tlb_add_flush(tlb, addr);
99 tlb_remove_page(tlb, virt_to_page(pmdp)); 113 tlb_remove_entry(tlb, virt_to_page(pmdp));
100} 114}
101#endif 115#endif
102 116
@@ -105,7 +119,7 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp,
105 unsigned long addr) 119 unsigned long addr)
106{ 120{
107 tlb_add_flush(tlb, addr); 121 tlb_add_flush(tlb, addr);
108 tlb_remove_page(tlb, virt_to_page(pudp)); 122 tlb_remove_entry(tlb, virt_to_page(pudp));
109} 123}
110#endif 124#endif
111 125
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 4bc95d27e063..6d2bf419431d 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -41,7 +41,7 @@
41#define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) 41#define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2)
42#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) 42#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5)
43 43
44#define __NR_compat_syscalls 383 44#define __NR_compat_syscalls 386
45#endif 45#endif
46 46
47#define __ARCH_WANT_SYS_CLONE 47#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index e242600c4046..da1f06b535e3 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -787,3 +787,8 @@ __SYSCALL(__NR_sched_setattr, sys_sched_setattr)
787__SYSCALL(__NR_sched_getattr, sys_sched_getattr) 787__SYSCALL(__NR_sched_getattr, sys_sched_getattr)
788#define __NR_renameat2 382 788#define __NR_renameat2 382
789__SYSCALL(__NR_renameat2, sys_renameat2) 789__SYSCALL(__NR_renameat2, sys_renameat2)
790 /* 383 for seccomp */
791#define __NR_getrandom 384
792__SYSCALL(__NR_getrandom, sys_getrandom)
793#define __NR_memfd_create 385
794__SYSCALL(__NR_memfd_create, sys_memfd_create)
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
index e633ff8cdec8..8e38878c87c6 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -37,6 +37,7 @@
37 37
38#define __KVM_HAVE_GUEST_DEBUG 38#define __KVM_HAVE_GUEST_DEBUG
39#define __KVM_HAVE_IRQ_LINE 39#define __KVM_HAVE_IRQ_LINE
40#define __KVM_HAVE_READONLY_MEM
40 41
41#define KVM_REG_SIZE(id) \ 42#define KVM_REG_SIZE(id) \
42 (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) 43 (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
@@ -159,6 +160,7 @@ struct kvm_arch_memory_slot {
159#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT) 160#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT)
160#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0 161#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0
161#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT) 162#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
163#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3
162 164
163/* KVM_IRQ_LINE irq field index values */ 165/* KVM_IRQ_LINE irq field index values */
164#define KVM_ARM_IRQ_TYPE_SHIFT 24 166#define KVM_ARM_IRQ_TYPE_SHIFT 24
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index df7ef8768fc2..5bd029b43644 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -26,9 +26,11 @@ arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
26arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o 26arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
27arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 27arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
28arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o 28arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o
29arm64-obj-$(CONFIG_CPU_IDLE) += cpuidle.o
29arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o 30arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o
30arm64-obj-$(CONFIG_KGDB) += kgdb.o 31arm64-obj-$(CONFIG_KGDB) += kgdb.o
31arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o 32arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o
33arm64-obj-$(CONFIG_PCI) += pci.o
32 34
33obj-y += $(arm64-obj-y) vdso/ 35obj-y += $(arm64-obj-y) vdso/
34obj-m += $(arm64-obj-m) 36obj-m += $(arm64-obj-m)
diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c
new file mode 100644
index 000000000000..19d17f51db37
--- /dev/null
+++ b/arch/arm64/kernel/cpuidle.c
@@ -0,0 +1,31 @@
1/*
2 * ARM64 CPU idle arch support
3 *
4 * Copyright (C) 2014 ARM Ltd.
5 * Author: Lorenzo Pieralisi <lorenzo.pieralisi@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
12#include <linux/of.h>
13#include <linux/of_device.h>
14
15#include <asm/cpuidle.h>
16#include <asm/cpu_ops.h>
17
18int cpu_init_idle(unsigned int cpu)
19{
20 int ret = -EOPNOTSUPP;
21 struct device_node *cpu_node = of_cpu_device_node_get(cpu);
22
23 if (!cpu_node)
24 return -ENODEV;
25
26 if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_init_idle)
27 ret = cpu_ops[cpu]->cpu_init_idle(cpu_node, cpu);
28
29 of_node_put(cpu_node);
30 return ret;
31}
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index f798f66634af..504fdaa8367e 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -20,8 +20,10 @@
20#include <asm/cputype.h> 20#include <asm/cputype.h>
21 21
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <linux/bug.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/preempt.h>
25#include <linux/printk.h> 27#include <linux/printk.h>
26#include <linux/smp.h> 28#include <linux/smp.h>
27 29
@@ -47,9 +49,19 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
47 unsigned int cpu = smp_processor_id(); 49 unsigned int cpu = smp_processor_id();
48 u32 l1ip = CTR_L1IP(info->reg_ctr); 50 u32 l1ip = CTR_L1IP(info->reg_ctr);
49 51
50 if (l1ip != ICACHE_POLICY_PIPT) 52 if (l1ip != ICACHE_POLICY_PIPT) {
51 set_bit(ICACHEF_ALIASING, &__icache_flags); 53 /*
52 if (l1ip == ICACHE_POLICY_AIVIVT); 54 * VIPT caches are non-aliasing if the VA always equals the PA
55 * in all bit positions that are covered by the index. This is
56 * the case if the size of a way (# of sets * line size) does
57 * not exceed PAGE_SIZE.
58 */
59 u32 waysize = icache_get_numsets() * icache_get_linesize();
60
61 if (l1ip != ICACHE_POLICY_VIPT || waysize > PAGE_SIZE)
62 set_bit(ICACHEF_ALIASING, &__icache_flags);
63 }
64 if (l1ip == ICACHE_POLICY_AIVIVT)
53 set_bit(ICACHEF_AIVIVT, &__icache_flags); 65 set_bit(ICACHEF_AIVIVT, &__icache_flags);
54 66
55 pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str[l1ip], cpu); 67 pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str[l1ip], cpu);
@@ -190,3 +202,15 @@ void __init cpuinfo_store_boot_cpu(void)
190 202
191 boot_cpu_data = *info; 203 boot_cpu_data = *info;
192} 204}
205
206u64 __attribute_const__ icache_get_ccsidr(void)
207{
208 u64 ccsidr;
209
210 WARN_ON(preemptible());
211
212 /* Select L1 I-cache and read its size ID register */
213 asm("msr csselr_el1, %1; isb; mrs %0, ccsidr_el1"
214 : "=r"(ccsidr) : "r"(1L));
215 return ccsidr;
216}
diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c
index 1317fef8dde9..d27dd982ff26 100644
--- a/arch/arm64/kernel/efi-stub.c
+++ b/arch/arm64/kernel/efi-stub.c
@@ -28,20 +28,16 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
28 kernel_size = _edata - _text; 28 kernel_size = _edata - _text;
29 if (*image_addr != (dram_base + TEXT_OFFSET)) { 29 if (*image_addr != (dram_base + TEXT_OFFSET)) {
30 kernel_memsize = kernel_size + (_end - _edata); 30 kernel_memsize = kernel_size + (_end - _edata);
31 status = efi_relocate_kernel(sys_table, image_addr, 31 status = efi_low_alloc(sys_table, kernel_memsize + TEXT_OFFSET,
32 kernel_size, kernel_memsize, 32 SZ_2M, reserve_addr);
33 dram_base + TEXT_OFFSET,
34 PAGE_SIZE);
35 if (status != EFI_SUCCESS) { 33 if (status != EFI_SUCCESS) {
36 pr_efi_err(sys_table, "Failed to relocate kernel\n"); 34 pr_efi_err(sys_table, "Failed to relocate kernel\n");
37 return status; 35 return status;
38 } 36 }
39 if (*image_addr != (dram_base + TEXT_OFFSET)) { 37 memcpy((void *)*reserve_addr + TEXT_OFFSET, (void *)*image_addr,
40 pr_efi_err(sys_table, "Failed to alloc kernel memory\n"); 38 kernel_size);
41 efi_free(sys_table, kernel_memsize, *image_addr); 39 *image_addr = *reserve_addr + TEXT_OFFSET;
42 return EFI_LOAD_ERROR; 40 *reserve_size = kernel_memsize + TEXT_OFFSET;
43 }
44 *image_size = kernel_memsize;
45 } 41 }
46 42
47 43
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index e72f3100958f..03aaa99e1ea0 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -188,6 +188,8 @@ static __init void reserve_regions(void)
188 if (uefi_debug) 188 if (uefi_debug)
189 pr_cont("\n"); 189 pr_cont("\n");
190 } 190 }
191
192 set_bit(EFI_MEMMAP, &efi.flags);
191} 193}
192 194
193 195
@@ -463,6 +465,8 @@ static int __init arm64_enter_virtual_mode(void)
463 efi_native_runtime_setup(); 465 efi_native_runtime_setup();
464 set_bit(EFI_RUNTIME_SERVICES, &efi.flags); 466 set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
465 467
468 efi.runtime_version = efi.systab->hdr.revision;
469
466 return 0; 470 return 0;
467 471
468err_unmap: 472err_unmap:
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index f0b5e5120a87..726b910fe6ec 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -324,7 +324,6 @@ el1_dbg:
324 mrs x0, far_el1 324 mrs x0, far_el1
325 mov x2, sp // struct pt_regs 325 mov x2, sp // struct pt_regs
326 bl do_debug_exception 326 bl do_debug_exception
327 enable_dbg
328 kernel_exit 1 327 kernel_exit 1
329el1_inv: 328el1_inv:
330 // TODO: add support for undefined instructions in kernel mode 329 // TODO: add support for undefined instructions in kernel mode
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index ad8aebb1cdef..3dca15634e69 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -270,6 +270,7 @@ static int fpsimd_cpu_pm_notifier(struct notifier_block *self,
270 case CPU_PM_ENTER: 270 case CPU_PM_ENTER:
271 if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE)) 271 if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE))
272 fpsimd_save_state(&current->thread.fpsimd_state); 272 fpsimd_save_state(&current->thread.fpsimd_state);
273 this_cpu_write(fpsimd_last_state, NULL);
273 break; 274 break;
274 case CPU_PM_EXIT: 275 case CPU_PM_EXIT:
275 if (current->mm) 276 if (current->mm)
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index 7924d73b6476..cf8556ae09d0 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -58,7 +58,8 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
58 u32 new; 58 u32 new;
59 59
60 pc = (unsigned long)&ftrace_call; 60 pc = (unsigned long)&ftrace_call;
61 new = aarch64_insn_gen_branch_imm(pc, (unsigned long)func, true); 61 new = aarch64_insn_gen_branch_imm(pc, (unsigned long)func,
62 AARCH64_INSN_BRANCH_LINK);
62 63
63 return ftrace_modify_code(pc, 0, new, false); 64 return ftrace_modify_code(pc, 0, new, false);
64} 65}
@@ -72,7 +73,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
72 u32 old, new; 73 u32 old, new;
73 74
74 old = aarch64_insn_gen_nop(); 75 old = aarch64_insn_gen_nop();
75 new = aarch64_insn_gen_branch_imm(pc, addr, true); 76 new = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK);
76 77
77 return ftrace_modify_code(pc, old, new, true); 78 return ftrace_modify_code(pc, old, new, true);
78} 79}
@@ -86,7 +87,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
86 unsigned long pc = rec->ip; 87 unsigned long pc = rec->ip;
87 u32 old, new; 88 u32 old, new;
88 89
89 old = aarch64_insn_gen_branch_imm(pc, addr, true); 90 old = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK);
90 new = aarch64_insn_gen_nop(); 91 new = aarch64_insn_gen_nop();
91 92
92 return ftrace_modify_code(pc, old, new, true); 93 return ftrace_modify_code(pc, old, new, true);
@@ -154,7 +155,8 @@ static int ftrace_modify_graph_caller(bool enable)
154 u32 branch, nop; 155 u32 branch, nop;
155 156
156 branch = aarch64_insn_gen_branch_imm(pc, 157 branch = aarch64_insn_gen_branch_imm(pc,
157 (unsigned long)ftrace_graph_caller, false); 158 (unsigned long)ftrace_graph_caller,
159 AARCH64_INSN_BRANCH_LINK);
158 nop = aarch64_insn_gen_nop(); 160 nop = aarch64_insn_gen_nop();
159 161
160 if (enable) 162 if (enable)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 144f10567f82..0a6e4f924df8 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -38,11 +38,11 @@
38 38
39#define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET) 39#define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET)
40 40
41#if (TEXT_OFFSET & 0xf) != 0 41#if (TEXT_OFFSET & 0xfff) != 0
42#error TEXT_OFFSET must be at least 16B aligned 42#error TEXT_OFFSET must be at least 4KB aligned
43#elif (PAGE_OFFSET & 0xfffff) != 0 43#elif (PAGE_OFFSET & 0x1fffff) != 0
44#error PAGE_OFFSET must be at least 2MB aligned 44#error PAGE_OFFSET must be at least 2MB aligned
45#elif TEXT_OFFSET > 0xfffff 45#elif TEXT_OFFSET > 0x1fffff
46#error TEXT_OFFSET must be less than 2MB 46#error TEXT_OFFSET must be less than 2MB
47#endif 47#endif
48 48
@@ -151,7 +151,7 @@ optional_header:
151 .short 0x20b // PE32+ format 151 .short 0x20b // PE32+ format
152 .byte 0x02 // MajorLinkerVersion 152 .byte 0x02 // MajorLinkerVersion
153 .byte 0x14 // MinorLinkerVersion 153 .byte 0x14 // MinorLinkerVersion
154 .long _edata - stext // SizeOfCode 154 .long _end - stext // SizeOfCode
155 .long 0 // SizeOfInitializedData 155 .long 0 // SizeOfInitializedData
156 .long 0 // SizeOfUninitializedData 156 .long 0 // SizeOfUninitializedData
157 .long efi_stub_entry - efi_head // AddressOfEntryPoint 157 .long efi_stub_entry - efi_head // AddressOfEntryPoint
@@ -169,7 +169,7 @@ extra_header_fields:
169 .short 0 // MinorSubsystemVersion 169 .short 0 // MinorSubsystemVersion
170 .long 0 // Win32VersionValue 170 .long 0 // Win32VersionValue
171 171
172 .long _edata - efi_head // SizeOfImage 172 .long _end - efi_head // SizeOfImage
173 173
174 // Everything before the kernel image is considered part of the header 174 // Everything before the kernel image is considered part of the header
175 .long stext - efi_head // SizeOfHeaders 175 .long stext - efi_head // SizeOfHeaders
@@ -216,7 +216,7 @@ section_table:
216 .byte 0 216 .byte 0
217 .byte 0 217 .byte 0
218 .byte 0 // end of 0 padding of section name 218 .byte 0 // end of 0 padding of section name
219 .long _edata - stext // VirtualSize 219 .long _end - stext // VirtualSize
220 .long stext - efi_head // VirtualAddress 220 .long stext - efi_head // VirtualAddress
221 .long _edata - stext // SizeOfRawData 221 .long _edata - stext // SizeOfRawData
222 .long stext - efi_head // PointerToRawData 222 .long stext - efi_head // PointerToRawData
@@ -373,10 +373,6 @@ ENTRY(__boot_cpu_mode)
373 .long 0 373 .long 0
374 .popsection 374 .popsection
375 375
376 .align 3
3772: .quad .
378 .quad PAGE_OFFSET
379
380#ifdef CONFIG_SMP 376#ifdef CONFIG_SMP
381 .align 3 377 .align 3
3821: .quad . 3781: .quad .
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index 92f36835486b..e007714ded04 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -2,6 +2,8 @@
2 * Copyright (C) 2013 Huawei Ltd. 2 * Copyright (C) 2013 Huawei Ltd.
3 * Author: Jiang Liu <liuj97@gmail.com> 3 * Author: Jiang Liu <liuj97@gmail.com>
4 * 4 *
5 * Copyright (C) 2014 Zi Shen Lim <zlim.lnx@gmail.com>
6 *
5 * 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
6 * 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
7 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
@@ -20,9 +22,14 @@
20#include <linux/smp.h> 22#include <linux/smp.h>
21#include <linux/stop_machine.h> 23#include <linux/stop_machine.h>
22#include <linux/uaccess.h> 24#include <linux/uaccess.h>
25
23#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/debug-monitors.h>
24#include <asm/insn.h> 28#include <asm/insn.h>
25 29
30#define AARCH64_INSN_SF_BIT BIT(31)
31#define AARCH64_INSN_N_BIT BIT(22)
32
26static int aarch64_insn_encoding_class[] = { 33static int aarch64_insn_encoding_class[] = {
27 AARCH64_INSN_CLS_UNKNOWN, 34 AARCH64_INSN_CLS_UNKNOWN,
28 AARCH64_INSN_CLS_UNKNOWN, 35 AARCH64_INSN_CLS_UNKNOWN,
@@ -251,6 +258,19 @@ u32 __kprobes aarch64_insn_encode_immediate(enum aarch64_insn_imm_type type,
251 mask = BIT(9) - 1; 258 mask = BIT(9) - 1;
252 shift = 12; 259 shift = 12;
253 break; 260 break;
261 case AARCH64_INSN_IMM_7:
262 mask = BIT(7) - 1;
263 shift = 15;
264 break;
265 case AARCH64_INSN_IMM_6:
266 case AARCH64_INSN_IMM_S:
267 mask = BIT(6) - 1;
268 shift = 10;
269 break;
270 case AARCH64_INSN_IMM_R:
271 mask = BIT(6) - 1;
272 shift = 16;
273 break;
254 default: 274 default:
255 pr_err("aarch64_insn_encode_immediate: unknown immediate encoding %d\n", 275 pr_err("aarch64_insn_encode_immediate: unknown immediate encoding %d\n",
256 type); 276 type);
@@ -264,10 +284,76 @@ u32 __kprobes aarch64_insn_encode_immediate(enum aarch64_insn_imm_type type,
264 return insn; 284 return insn;
265} 285}
266 286
267u32 __kprobes aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr, 287static u32 aarch64_insn_encode_register(enum aarch64_insn_register_type type,
268 enum aarch64_insn_branch_type type) 288 u32 insn,
289 enum aarch64_insn_register reg)
290{
291 int shift;
292
293 if (reg < AARCH64_INSN_REG_0 || reg > AARCH64_INSN_REG_SP) {
294 pr_err("%s: unknown register encoding %d\n", __func__, reg);
295 return 0;
296 }
297
298 switch (type) {
299 case AARCH64_INSN_REGTYPE_RT:
300 case AARCH64_INSN_REGTYPE_RD:
301 shift = 0;
302 break;
303 case AARCH64_INSN_REGTYPE_RN:
304 shift = 5;
305 break;
306 case AARCH64_INSN_REGTYPE_RT2:
307 case AARCH64_INSN_REGTYPE_RA:
308 shift = 10;
309 break;
310 case AARCH64_INSN_REGTYPE_RM:
311 shift = 16;
312 break;
313 default:
314 pr_err("%s: unknown register type encoding %d\n", __func__,
315 type);
316 return 0;
317 }
318
319 insn &= ~(GENMASK(4, 0) << shift);
320 insn |= reg << shift;
321
322 return insn;
323}
324
325static u32 aarch64_insn_encode_ldst_size(enum aarch64_insn_size_type type,
326 u32 insn)
327{
328 u32 size;
329
330 switch (type) {
331 case AARCH64_INSN_SIZE_8:
332 size = 0;
333 break;
334 case AARCH64_INSN_SIZE_16:
335 size = 1;
336 break;
337 case AARCH64_INSN_SIZE_32:
338 size = 2;
339 break;
340 case AARCH64_INSN_SIZE_64:
341 size = 3;
342 break;
343 default:
344 pr_err("%s: unknown size encoding %d\n", __func__, type);
345 return 0;
346 }
347
348 insn &= ~GENMASK(31, 30);
349 insn |= size << 30;
350
351 return insn;
352}
353
354static inline long branch_imm_common(unsigned long pc, unsigned long addr,
355 long range)
269{ 356{
270 u32 insn;
271 long offset; 357 long offset;
272 358
273 /* 359 /*
@@ -276,23 +362,97 @@ u32 __kprobes aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr,
276 */ 362 */
277 BUG_ON((pc & 0x3) || (addr & 0x3)); 363 BUG_ON((pc & 0x3) || (addr & 0x3));
278 364
365 offset = ((long)addr - (long)pc);
366 BUG_ON(offset < -range || offset >= range);
367
368 return offset;
369}
370
371u32 __kprobes aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr,
372 enum aarch64_insn_branch_type type)
373{
374 u32 insn;
375 long offset;
376
279 /* 377 /*
280 * B/BL support [-128M, 128M) offset 378 * B/BL support [-128M, 128M) offset
281 * ARM64 virtual address arrangement guarantees all kernel and module 379 * ARM64 virtual address arrangement guarantees all kernel and module
282 * texts are within +/-128M. 380 * texts are within +/-128M.
283 */ 381 */
284 offset = ((long)addr - (long)pc); 382 offset = branch_imm_common(pc, addr, SZ_128M);
285 BUG_ON(offset < -SZ_128M || offset >= SZ_128M);
286 383
287 if (type == AARCH64_INSN_BRANCH_LINK) 384 switch (type) {
385 case AARCH64_INSN_BRANCH_LINK:
288 insn = aarch64_insn_get_bl_value(); 386 insn = aarch64_insn_get_bl_value();
289 else 387 break;
388 case AARCH64_INSN_BRANCH_NOLINK:
290 insn = aarch64_insn_get_b_value(); 389 insn = aarch64_insn_get_b_value();
390 break;
391 default:
392 BUG_ON(1);
393 return AARCH64_BREAK_FAULT;
394 }
291 395
292 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_26, insn, 396 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_26, insn,
293 offset >> 2); 397 offset >> 2);
294} 398}
295 399
400u32 aarch64_insn_gen_comp_branch_imm(unsigned long pc, unsigned long addr,
401 enum aarch64_insn_register reg,
402 enum aarch64_insn_variant variant,
403 enum aarch64_insn_branch_type type)
404{
405 u32 insn;
406 long offset;
407
408 offset = branch_imm_common(pc, addr, SZ_1M);
409
410 switch (type) {
411 case AARCH64_INSN_BRANCH_COMP_ZERO:
412 insn = aarch64_insn_get_cbz_value();
413 break;
414 case AARCH64_INSN_BRANCH_COMP_NONZERO:
415 insn = aarch64_insn_get_cbnz_value();
416 break;
417 default:
418 BUG_ON(1);
419 return AARCH64_BREAK_FAULT;
420 }
421
422 switch (variant) {
423 case AARCH64_INSN_VARIANT_32BIT:
424 break;
425 case AARCH64_INSN_VARIANT_64BIT:
426 insn |= AARCH64_INSN_SF_BIT;
427 break;
428 default:
429 BUG_ON(1);
430 return AARCH64_BREAK_FAULT;
431 }
432
433 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RT, insn, reg);
434
435 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_19, insn,
436 offset >> 2);
437}
438
439u32 aarch64_insn_gen_cond_branch_imm(unsigned long pc, unsigned long addr,
440 enum aarch64_insn_condition cond)
441{
442 u32 insn;
443 long offset;
444
445 offset = branch_imm_common(pc, addr, SZ_1M);
446
447 insn = aarch64_insn_get_bcond_value();
448
449 BUG_ON(cond < AARCH64_INSN_COND_EQ || cond > AARCH64_INSN_COND_AL);
450 insn |= cond;
451
452 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_19, insn,
453 offset >> 2);
454}
455
296u32 __kprobes aarch64_insn_gen_hint(enum aarch64_insn_hint_op op) 456u32 __kprobes aarch64_insn_gen_hint(enum aarch64_insn_hint_op op)
297{ 457{
298 return aarch64_insn_get_hint_value() | op; 458 return aarch64_insn_get_hint_value() | op;
@@ -302,3 +462,500 @@ u32 __kprobes aarch64_insn_gen_nop(void)
302{ 462{
303 return aarch64_insn_gen_hint(AARCH64_INSN_HINT_NOP); 463 return aarch64_insn_gen_hint(AARCH64_INSN_HINT_NOP);
304} 464}
465
466u32 aarch64_insn_gen_branch_reg(enum aarch64_insn_register reg,
467 enum aarch64_insn_branch_type type)
468{
469 u32 insn;
470
471 switch (type) {
472 case AARCH64_INSN_BRANCH_NOLINK:
473 insn = aarch64_insn_get_br_value();
474 break;
475 case AARCH64_INSN_BRANCH_LINK:
476 insn = aarch64_insn_get_blr_value();
477 break;
478 case AARCH64_INSN_BRANCH_RETURN:
479 insn = aarch64_insn_get_ret_value();
480 break;
481 default:
482 BUG_ON(1);
483 return AARCH64_BREAK_FAULT;
484 }
485
486 return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn, reg);
487}
488
489u32 aarch64_insn_gen_load_store_reg(enum aarch64_insn_register reg,
490 enum aarch64_insn_register base,
491 enum aarch64_insn_register offset,
492 enum aarch64_insn_size_type size,
493 enum aarch64_insn_ldst_type type)
494{
495 u32 insn;
496
497 switch (type) {
498 case AARCH64_INSN_LDST_LOAD_REG_OFFSET:
499 insn = aarch64_insn_get_ldr_reg_value();
500 break;
501 case AARCH64_INSN_LDST_STORE_REG_OFFSET:
502 insn = aarch64_insn_get_str_reg_value();
503 break;
504 default:
505 BUG_ON(1);
506 return AARCH64_BREAK_FAULT;
507 }
508
509 insn = aarch64_insn_encode_ldst_size(size, insn);
510
511 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RT, insn, reg);
512
513 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn,
514 base);
515
516 return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RM, insn,
517 offset);
518}
519
520u32 aarch64_insn_gen_load_store_pair(enum aarch64_insn_register reg1,
521 enum aarch64_insn_register reg2,
522 enum aarch64_insn_register base,
523 int offset,
524 enum aarch64_insn_variant variant,
525 enum aarch64_insn_ldst_type type)
526{
527 u32 insn;
528 int shift;
529
530 switch (type) {
531 case AARCH64_INSN_LDST_LOAD_PAIR_PRE_INDEX:
532 insn = aarch64_insn_get_ldp_pre_value();
533 break;
534 case AARCH64_INSN_LDST_STORE_PAIR_PRE_INDEX:
535 insn = aarch64_insn_get_stp_pre_value();
536 break;
537 case AARCH64_INSN_LDST_LOAD_PAIR_POST_INDEX:
538 insn = aarch64_insn_get_ldp_post_value();
539 break;
540 case AARCH64_INSN_LDST_STORE_PAIR_POST_INDEX:
541 insn = aarch64_insn_get_stp_post_value();
542 break;
543 default:
544 BUG_ON(1);
545 return AARCH64_BREAK_FAULT;
546 }
547
548 switch (variant) {
549 case AARCH64_INSN_VARIANT_32BIT:
550 /* offset must be multiples of 4 in the range [-256, 252] */
551 BUG_ON(offset & 0x3);
552 BUG_ON(offset < -256 || offset > 252);
553 shift = 2;
554 break;
555 case AARCH64_INSN_VARIANT_64BIT:
556 /* offset must be multiples of 8 in the range [-512, 504] */
557 BUG_ON(offset & 0x7);
558 BUG_ON(offset < -512 || offset > 504);
559 shift = 3;
560 insn |= AARCH64_INSN_SF_BIT;
561 break;
562 default:
563 BUG_ON(1);
564 return AARCH64_BREAK_FAULT;
565 }
566
567 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RT, insn,
568 reg1);
569
570 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RT2, insn,
571 reg2);
572
573 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn,
574 base);
575
576 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_7, insn,
577 offset >> shift);
578}
579
580u32 aarch64_insn_gen_add_sub_imm(enum aarch64_insn_register dst,
581 enum aarch64_insn_register src,
582 int imm, enum aarch64_insn_variant variant,
583 enum aarch64_insn_adsb_type type)
584{
585 u32 insn;
586
587 switch (type) {
588 case AARCH64_INSN_ADSB_ADD:
589 insn = aarch64_insn_get_add_imm_value();
590 break;
591 case AARCH64_INSN_ADSB_SUB:
592 insn = aarch64_insn_get_sub_imm_value();
593 break;
594 case AARCH64_INSN_ADSB_ADD_SETFLAGS:
595 insn = aarch64_insn_get_adds_imm_value();
596 break;
597 case AARCH64_INSN_ADSB_SUB_SETFLAGS:
598 insn = aarch64_insn_get_subs_imm_value();
599 break;
600 default:
601 BUG_ON(1);
602 return AARCH64_BREAK_FAULT;
603 }
604
605 switch (variant) {
606 case AARCH64_INSN_VARIANT_32BIT:
607 break;
608 case AARCH64_INSN_VARIANT_64BIT:
609 insn |= AARCH64_INSN_SF_BIT;
610 break;
611 default:
612 BUG_ON(1);
613 return AARCH64_BREAK_FAULT;
614 }
615
616 BUG_ON(imm & ~(SZ_4K - 1));
617
618 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
619
620 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn, src);
621
622 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_12, insn, imm);
623}
624
625u32 aarch64_insn_gen_bitfield(enum aarch64_insn_register dst,
626 enum aarch64_insn_register src,
627 int immr, int imms,
628 enum aarch64_insn_variant variant,
629 enum aarch64_insn_bitfield_type type)
630{
631 u32 insn;
632 u32 mask;
633
634 switch (type) {
635 case AARCH64_INSN_BITFIELD_MOVE:
636 insn = aarch64_insn_get_bfm_value();
637 break;
638 case AARCH64_INSN_BITFIELD_MOVE_UNSIGNED:
639 insn = aarch64_insn_get_ubfm_value();
640 break;
641 case AARCH64_INSN_BITFIELD_MOVE_SIGNED:
642 insn = aarch64_insn_get_sbfm_value();
643 break;
644 default:
645 BUG_ON(1);
646 return AARCH64_BREAK_FAULT;
647 }
648
649 switch (variant) {
650 case AARCH64_INSN_VARIANT_32BIT:
651 mask = GENMASK(4, 0);
652 break;
653 case AARCH64_INSN_VARIANT_64BIT:
654 insn |= AARCH64_INSN_SF_BIT | AARCH64_INSN_N_BIT;
655 mask = GENMASK(5, 0);
656 break;
657 default:
658 BUG_ON(1);
659 return AARCH64_BREAK_FAULT;
660 }
661
662 BUG_ON(immr & ~mask);
663 BUG_ON(imms & ~mask);
664
665 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
666
667 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn, src);
668
669 insn = aarch64_insn_encode_immediate(AARCH64_INSN_IMM_R, insn, immr);
670
671 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_S, insn, imms);
672}
673
674u32 aarch64_insn_gen_movewide(enum aarch64_insn_register dst,
675 int imm, int shift,
676 enum aarch64_insn_variant variant,
677 enum aarch64_insn_movewide_type type)
678{
679 u32 insn;
680
681 switch (type) {
682 case AARCH64_INSN_MOVEWIDE_ZERO:
683 insn = aarch64_insn_get_movz_value();
684 break;
685 case AARCH64_INSN_MOVEWIDE_KEEP:
686 insn = aarch64_insn_get_movk_value();
687 break;
688 case AARCH64_INSN_MOVEWIDE_INVERSE:
689 insn = aarch64_insn_get_movn_value();
690 break;
691 default:
692 BUG_ON(1);
693 return AARCH64_BREAK_FAULT;
694 }
695
696 BUG_ON(imm & ~(SZ_64K - 1));
697
698 switch (variant) {
699 case AARCH64_INSN_VARIANT_32BIT:
700 BUG_ON(shift != 0 && shift != 16);
701 break;
702 case AARCH64_INSN_VARIANT_64BIT:
703 insn |= AARCH64_INSN_SF_BIT;
704 BUG_ON(shift != 0 && shift != 16 && shift != 32 &&
705 shift != 48);
706 break;
707 default:
708 BUG_ON(1);
709 return AARCH64_BREAK_FAULT;
710 }
711
712 insn |= (shift >> 4) << 21;
713
714 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
715
716 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_16, insn, imm);
717}
718
719u32 aarch64_insn_gen_add_sub_shifted_reg(enum aarch64_insn_register dst,
720 enum aarch64_insn_register src,
721 enum aarch64_insn_register reg,
722 int shift,
723 enum aarch64_insn_variant variant,
724 enum aarch64_insn_adsb_type type)
725{
726 u32 insn;
727
728 switch (type) {
729 case AARCH64_INSN_ADSB_ADD:
730 insn = aarch64_insn_get_add_value();
731 break;
732 case AARCH64_INSN_ADSB_SUB:
733 insn = aarch64_insn_get_sub_value();
734 break;
735 case AARCH64_INSN_ADSB_ADD_SETFLAGS:
736 insn = aarch64_insn_get_adds_value();
737 break;
738 case AARCH64_INSN_ADSB_SUB_SETFLAGS:
739 insn = aarch64_insn_get_subs_value();
740 break;
741 default:
742 BUG_ON(1);
743 return AARCH64_BREAK_FAULT;
744 }
745
746 switch (variant) {
747 case AARCH64_INSN_VARIANT_32BIT:
748 BUG_ON(shift & ~(SZ_32 - 1));
749 break;
750 case AARCH64_INSN_VARIANT_64BIT:
751 insn |= AARCH64_INSN_SF_BIT;
752 BUG_ON(shift & ~(SZ_64 - 1));
753 break;
754 default:
755 BUG_ON(1);
756 return AARCH64_BREAK_FAULT;
757 }
758
759
760 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
761
762 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn, src);
763
764 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RM, insn, reg);
765
766 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_6, insn, shift);
767}
768
769u32 aarch64_insn_gen_data1(enum aarch64_insn_register dst,
770 enum aarch64_insn_register src,
771 enum aarch64_insn_variant variant,
772 enum aarch64_insn_data1_type type)
773{
774 u32 insn;
775
776 switch (type) {
777 case AARCH64_INSN_DATA1_REVERSE_16:
778 insn = aarch64_insn_get_rev16_value();
779 break;
780 case AARCH64_INSN_DATA1_REVERSE_32:
781 insn = aarch64_insn_get_rev32_value();
782 break;
783 case AARCH64_INSN_DATA1_REVERSE_64:
784 BUG_ON(variant != AARCH64_INSN_VARIANT_64BIT);
785 insn = aarch64_insn_get_rev64_value();
786 break;
787 default:
788 BUG_ON(1);
789 return AARCH64_BREAK_FAULT;
790 }
791
792 switch (variant) {
793 case AARCH64_INSN_VARIANT_32BIT:
794 break;
795 case AARCH64_INSN_VARIANT_64BIT:
796 insn |= AARCH64_INSN_SF_BIT;
797 break;
798 default:
799 BUG_ON(1);
800 return AARCH64_BREAK_FAULT;
801 }
802
803 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
804
805 return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn, src);
806}
807
808u32 aarch64_insn_gen_data2(enum aarch64_insn_register dst,
809 enum aarch64_insn_register src,
810 enum aarch64_insn_register reg,
811 enum aarch64_insn_variant variant,
812 enum aarch64_insn_data2_type type)
813{
814 u32 insn;
815
816 switch (type) {
817 case AARCH64_INSN_DATA2_UDIV:
818 insn = aarch64_insn_get_udiv_value();
819 break;
820 case AARCH64_INSN_DATA2_SDIV:
821 insn = aarch64_insn_get_sdiv_value();
822 break;
823 case AARCH64_INSN_DATA2_LSLV:
824 insn = aarch64_insn_get_lslv_value();
825 break;
826 case AARCH64_INSN_DATA2_LSRV:
827 insn = aarch64_insn_get_lsrv_value();
828 break;
829 case AARCH64_INSN_DATA2_ASRV:
830 insn = aarch64_insn_get_asrv_value();
831 break;
832 case AARCH64_INSN_DATA2_RORV:
833 insn = aarch64_insn_get_rorv_value();
834 break;
835 default:
836 BUG_ON(1);
837 return AARCH64_BREAK_FAULT;
838 }
839
840 switch (variant) {
841 case AARCH64_INSN_VARIANT_32BIT:
842 break;
843 case AARCH64_INSN_VARIANT_64BIT:
844 insn |= AARCH64_INSN_SF_BIT;
845 break;
846 default:
847 BUG_ON(1);
848 return AARCH64_BREAK_FAULT;
849 }
850
851 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
852
853 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn, src);
854
855 return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RM, insn, reg);
856}
857
858u32 aarch64_insn_gen_data3(enum aarch64_insn_register dst,
859 enum aarch64_insn_register src,
860 enum aarch64_insn_register reg1,
861 enum aarch64_insn_register reg2,
862 enum aarch64_insn_variant variant,
863 enum aarch64_insn_data3_type type)
864{
865 u32 insn;
866
867 switch (type) {
868 case AARCH64_INSN_DATA3_MADD:
869 insn = aarch64_insn_get_madd_value();
870 break;
871 case AARCH64_INSN_DATA3_MSUB:
872 insn = aarch64_insn_get_msub_value();
873 break;
874 default:
875 BUG_ON(1);
876 return AARCH64_BREAK_FAULT;
877 }
878
879 switch (variant) {
880 case AARCH64_INSN_VARIANT_32BIT:
881 break;
882 case AARCH64_INSN_VARIANT_64BIT:
883 insn |= AARCH64_INSN_SF_BIT;
884 break;
885 default:
886 BUG_ON(1);
887 return AARCH64_BREAK_FAULT;
888 }
889
890 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
891
892 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RA, insn, src);
893
894 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn,
895 reg1);
896
897 return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RM, insn,
898 reg2);
899}
900
901u32 aarch64_insn_gen_logical_shifted_reg(enum aarch64_insn_register dst,
902 enum aarch64_insn_register src,
903 enum aarch64_insn_register reg,
904 int shift,
905 enum aarch64_insn_variant variant,
906 enum aarch64_insn_logic_type type)
907{
908 u32 insn;
909
910 switch (type) {
911 case AARCH64_INSN_LOGIC_AND:
912 insn = aarch64_insn_get_and_value();
913 break;
914 case AARCH64_INSN_LOGIC_BIC:
915 insn = aarch64_insn_get_bic_value();
916 break;
917 case AARCH64_INSN_LOGIC_ORR:
918 insn = aarch64_insn_get_orr_value();
919 break;
920 case AARCH64_INSN_LOGIC_ORN:
921 insn = aarch64_insn_get_orn_value();
922 break;
923 case AARCH64_INSN_LOGIC_EOR:
924 insn = aarch64_insn_get_eor_value();
925 break;
926 case AARCH64_INSN_LOGIC_EON:
927 insn = aarch64_insn_get_eon_value();
928 break;
929 case AARCH64_INSN_LOGIC_AND_SETFLAGS:
930 insn = aarch64_insn_get_ands_value();
931 break;
932 case AARCH64_INSN_LOGIC_BIC_SETFLAGS:
933 insn = aarch64_insn_get_bics_value();
934 break;
935 default:
936 BUG_ON(1);
937 return AARCH64_BREAK_FAULT;
938 }
939
940 switch (variant) {
941 case AARCH64_INSN_VARIANT_32BIT:
942 BUG_ON(shift & ~(SZ_32 - 1));
943 break;
944 case AARCH64_INSN_VARIANT_64BIT:
945 insn |= AARCH64_INSN_SF_BIT;
946 BUG_ON(shift & ~(SZ_64 - 1));
947 break;
948 default:
949 BUG_ON(1);
950 return AARCH64_BREAK_FAULT;
951 }
952
953
954 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RD, insn, dst);
955
956 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RN, insn, src);
957
958 insn = aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RM, insn, reg);
959
960 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_6, insn, shift);
961}
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c
index 0f08dfd69ebc..071a6ec13bd8 100644
--- a/arch/arm64/kernel/irq.c
+++ b/arch/arm64/kernel/irq.c
@@ -40,33 +40,6 @@ int arch_show_interrupts(struct seq_file *p, int prec)
40 return 0; 40 return 0;
41} 41}
42 42
43/*
44 * handle_IRQ handles all hardware IRQ's. Decoded IRQs should
45 * not come via this function. Instead, they should provide their
46 * own 'handler'. Used by platform code implementing C-based 1st
47 * level decoding.
48 */
49void handle_IRQ(unsigned int irq, struct pt_regs *regs)
50{
51 struct pt_regs *old_regs = set_irq_regs(regs);
52
53 irq_enter();
54
55 /*
56 * Some hardware gives randomly wrong interrupts. Rather
57 * than crashing, do something sensible.
58 */
59 if (unlikely(irq >= nr_irqs)) {
60 pr_warn_ratelimited("Bad IRQ%u\n", irq);
61 ack_bad_irq(irq);
62 } else {
63 generic_handle_irq(irq);
64 }
65
66 irq_exit();
67 set_irq_regs(old_regs);
68}
69
70void __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) 43void __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
71{ 44{
72 if (handle_arch_irq) 45 if (handle_arch_irq)
@@ -97,19 +70,15 @@ static bool migrate_one_irq(struct irq_desc *desc)
97 if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) 70 if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
98 return false; 71 return false;
99 72
100 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) 73 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
74 affinity = cpu_online_mask;
101 ret = true; 75 ret = true;
76 }
102 77
103 /*
104 * when using forced irq_set_affinity we must ensure that the cpu
105 * being offlined is not present in the affinity mask, it may be
106 * selected as the target CPU otherwise
107 */
108 affinity = cpu_online_mask;
109 c = irq_data_get_irq_chip(d); 78 c = irq_data_get_irq_chip(d);
110 if (!c->irq_set_affinity) 79 if (!c->irq_set_affinity)
111 pr_debug("IRQ%u: unable to set affinity\n", d->irq); 80 pr_debug("IRQ%u: unable to set affinity\n", d->irq);
112 else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) 81 else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret)
113 cpumask_copy(d->affinity, affinity); 82 cpumask_copy(d->affinity, affinity);
114 83
115 return ret; 84 return ret;
diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c
index 75c9cf1aafee..a0d10c55f307 100644
--- a/arch/arm64/kernel/kgdb.c
+++ b/arch/arm64/kernel/kgdb.c
@@ -235,13 +235,13 @@ static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned int esr)
235 235
236static struct break_hook kgdb_brkpt_hook = { 236static struct break_hook kgdb_brkpt_hook = {
237 .esr_mask = 0xffffffff, 237 .esr_mask = 0xffffffff,
238 .esr_val = DBG_ESR_VAL_BRK(KGDB_DYN_DGB_BRK_IMM), 238 .esr_val = DBG_ESR_VAL_BRK(KGDB_DYN_DBG_BRK_IMM),
239 .fn = kgdb_brk_fn 239 .fn = kgdb_brk_fn
240}; 240};
241 241
242static struct break_hook kgdb_compiled_brkpt_hook = { 242static struct break_hook kgdb_compiled_brkpt_hook = {
243 .esr_mask = 0xffffffff, 243 .esr_mask = 0xffffffff,
244 .esr_val = DBG_ESR_VAL_BRK(KDBG_COMPILED_DBG_BRK_IMM), 244 .esr_val = DBG_ESR_VAL_BRK(KGDB_COMPILED_DBG_BRK_IMM),
245 .fn = kgdb_compiled_brk_fn 245 .fn = kgdb_compiled_brk_fn
246}; 246};
247 247
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
new file mode 100644
index 000000000000..ce5836c14ec1
--- /dev/null
+++ b/arch/arm64/kernel/pci.c
@@ -0,0 +1,70 @@
1/*
2 * Code borrowed from powerpc/kernel/pci-common.c
3 *
4 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
5 * Copyright (C) 2014 ARM Ltd.
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 * version 2 as published by the Free Software Foundation.
10 *
11 */
12
13#include <linux/init.h>
14#include <linux/io.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17#include <linux/of_pci.h>
18#include <linux/of_platform.h>
19#include <linux/slab.h>
20
21#include <asm/pci-bridge.h>
22
23/*
24 * Called after each bus is probed, but before its children are examined
25 */
26void pcibios_fixup_bus(struct pci_bus *bus)
27{
28 /* nothing to do, expected to be removed in the future */
29}
30
31/*
32 * We don't have to worry about legacy ISA devices, so nothing to do here
33 */
34resource_size_t pcibios_align_resource(void *data, const struct resource *res,
35 resource_size_t size, resource_size_t align)
36{
37 return res->start;
38}
39
40/*
41 * Try to assign the IRQ number from DT when adding a new device
42 */
43int pcibios_add_device(struct pci_dev *dev)
44{
45 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
46
47 return 0;
48}
49
50
51#ifdef CONFIG_PCI_DOMAINS_GENERIC
52static bool dt_domain_found = false;
53
54void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
55{
56 int domain = of_get_pci_domain_nr(parent->of_node);
57
58 if (domain >= 0) {
59 dt_domain_found = true;
60 } else if (dt_domain_found == true) {
61 dev_err(parent, "Node %s is missing \"linux,pci-domain\" property in DT\n",
62 parent->of_node->full_name);
63 return;
64 } else {
65 domain = pci_get_new_domain_nr();
66 }
67
68 bus->domain_nr = domain;
69}
70#endif
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index baf5afb7e6a0..aa29ecb4f800 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -1276,7 +1276,7 @@ arch_initcall(cpu_pmu_reset);
1276/* 1276/*
1277 * PMU platform driver and devicetree bindings. 1277 * PMU platform driver and devicetree bindings.
1278 */ 1278 */
1279static struct of_device_id armpmu_of_device_ids[] = { 1279static const struct of_device_id armpmu_of_device_ids[] = {
1280 {.compatible = "arm,armv8-pmuv3"}, 1280 {.compatible = "arm,armv8-pmuv3"},
1281 {}, 1281 {},
1282}; 1282};
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
index 422ebd63b619..6762ad705587 100644
--- a/arch/arm64/kernel/perf_regs.c
+++ b/arch/arm64/kernel/perf_regs.c
@@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
24 return regs->compat_lr; 24 return regs->compat_lr;
25 } 25 }
26 26
27 if ((u32)idx == PERF_REG_ARM64_SP)
28 return regs->sp;
29
30 if ((u32)idx == PERF_REG_ARM64_PC)
31 return regs->pc;
32
27 return regs->regs[idx]; 33 return regs->regs[idx];
28} 34}
29 35
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 1309d64aa926..89f41f7d27dd 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -57,36 +57,10 @@ unsigned long __stack_chk_guard __read_mostly;
57EXPORT_SYMBOL(__stack_chk_guard); 57EXPORT_SYMBOL(__stack_chk_guard);
58#endif 58#endif
59 59
60static void setup_restart(void)
61{
62 /*
63 * Tell the mm system that we are going to reboot -
64 * we may need it to insert some 1:1 mappings so that
65 * soft boot works.
66 */
67 setup_mm_for_reboot();
68
69 /* Clean and invalidate caches */
70 flush_cache_all();
71
72 /* Turn D-cache off */
73 cpu_cache_off();
74
75 /* Push out any further dirty data, and ensure cache is empty */
76 flush_cache_all();
77}
78
79void soft_restart(unsigned long addr) 60void soft_restart(unsigned long addr)
80{ 61{
81 typedef void (*phys_reset_t)(unsigned long); 62 setup_mm_for_reboot();
82 phys_reset_t phys_reset; 63 cpu_soft_restart(virt_to_phys(cpu_reset), addr);
83
84 setup_restart();
85
86 /* Switch to the identity mapping */
87 phys_reset = (phys_reset_t)virt_to_phys(cpu_reset);
88 phys_reset(addr);
89
90 /* Should never get here */ 64 /* Should never get here */
91 BUG(); 65 BUG();
92} 66}
@@ -230,9 +204,27 @@ void exit_thread(void)
230{ 204{
231} 205}
232 206
207static void tls_thread_flush(void)
208{
209 asm ("msr tpidr_el0, xzr");
210
211 if (is_compat_task()) {
212 current->thread.tp_value = 0;
213
214 /*
215 * We need to ensure ordering between the shadow state and the
216 * hardware state, so that we don't corrupt the hardware state
217 * with a stale shadow state during context switch.
218 */
219 barrier();
220 asm ("msr tpidrro_el0, xzr");
221 }
222}
223
233void flush_thread(void) 224void flush_thread(void)
234{ 225{
235 fpsimd_flush_thread(); 226 fpsimd_flush_thread();
227 tls_thread_flush();
236 flush_ptrace_hw_breakpoint(current); 228 flush_ptrace_hw_breakpoint(current);
237} 229}
238 230
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 553954771a67..866c1c821860 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -21,6 +21,7 @@
21#include <linux/reboot.h> 21#include <linux/reboot.h>
22#include <linux/pm.h> 22#include <linux/pm.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/slab.h>
24#include <uapi/linux/psci.h> 25#include <uapi/linux/psci.h>
25 26
26#include <asm/compiler.h> 27#include <asm/compiler.h>
@@ -28,6 +29,7 @@
28#include <asm/errno.h> 29#include <asm/errno.h>
29#include <asm/psci.h> 30#include <asm/psci.h>
30#include <asm/smp_plat.h> 31#include <asm/smp_plat.h>
32#include <asm/suspend.h>
31#include <asm/system_misc.h> 33#include <asm/system_misc.h>
32 34
33#define PSCI_POWER_STATE_TYPE_STANDBY 0 35#define PSCI_POWER_STATE_TYPE_STANDBY 0
@@ -65,6 +67,8 @@ enum psci_function {
65 PSCI_FN_MAX, 67 PSCI_FN_MAX,
66}; 68};
67 69
70static DEFINE_PER_CPU_READ_MOSTLY(struct psci_power_state *, psci_power_state);
71
68static u32 psci_function_id[PSCI_FN_MAX]; 72static u32 psci_function_id[PSCI_FN_MAX];
69 73
70static int psci_to_linux_errno(int errno) 74static int psci_to_linux_errno(int errno)
@@ -93,6 +97,18 @@ static u32 psci_power_state_pack(struct psci_power_state state)
93 & PSCI_0_2_POWER_STATE_AFFL_MASK); 97 & PSCI_0_2_POWER_STATE_AFFL_MASK);
94} 98}
95 99
100static void psci_power_state_unpack(u32 power_state,
101 struct psci_power_state *state)
102{
103 state->id = (power_state & PSCI_0_2_POWER_STATE_ID_MASK) >>
104 PSCI_0_2_POWER_STATE_ID_SHIFT;
105 state->type = (power_state & PSCI_0_2_POWER_STATE_TYPE_MASK) >>
106 PSCI_0_2_POWER_STATE_TYPE_SHIFT;
107 state->affinity_level =
108 (power_state & PSCI_0_2_POWER_STATE_AFFL_MASK) >>
109 PSCI_0_2_POWER_STATE_AFFL_SHIFT;
110}
111
96/* 112/*
97 * The following two functions are invoked via the invoke_psci_fn pointer 113 * The following two functions are invoked via the invoke_psci_fn pointer
98 * and will not be inlined, allowing us to piggyback on the AAPCS. 114 * and will not be inlined, allowing us to piggyback on the AAPCS.
@@ -199,6 +215,63 @@ static int psci_migrate_info_type(void)
199 return err; 215 return err;
200} 216}
201 217
218static int __maybe_unused cpu_psci_cpu_init_idle(struct device_node *cpu_node,
219 unsigned int cpu)
220{
221 int i, ret, count = 0;
222 struct psci_power_state *psci_states;
223 struct device_node *state_node;
224
225 /*
226 * If the PSCI cpu_suspend function hook has not been initialized
227 * idle states must not be enabled, so bail out
228 */
229 if (!psci_ops.cpu_suspend)
230 return -EOPNOTSUPP;
231
232 /* Count idle states */
233 while ((state_node = of_parse_phandle(cpu_node, "cpu-idle-states",
234 count))) {
235 count++;
236 of_node_put(state_node);
237 }
238
239 if (!count)
240 return -ENODEV;
241
242 psci_states = kcalloc(count, sizeof(*psci_states), GFP_KERNEL);
243 if (!psci_states)
244 return -ENOMEM;
245
246 for (i = 0; i < count; i++) {
247 u32 psci_power_state;
248
249 state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i);
250
251 ret = of_property_read_u32(state_node,
252 "arm,psci-suspend-param",
253 &psci_power_state);
254 if (ret) {
255 pr_warn(" * %s missing arm,psci-suspend-param property\n",
256 state_node->full_name);
257 of_node_put(state_node);
258 goto free_mem;
259 }
260
261 of_node_put(state_node);
262 pr_debug("psci-power-state %#x index %d\n", psci_power_state,
263 i);
264 psci_power_state_unpack(psci_power_state, &psci_states[i]);
265 }
266 /* Idle states parsed correctly, initialize per-cpu pointer */
267 per_cpu(psci_power_state, cpu) = psci_states;
268 return 0;
269
270free_mem:
271 kfree(psci_states);
272 return ret;
273}
274
202static int get_set_conduit_method(struct device_node *np) 275static int get_set_conduit_method(struct device_node *np)
203{ 276{
204 const char *method; 277 const char *method;
@@ -436,8 +509,39 @@ static int cpu_psci_cpu_kill(unsigned int cpu)
436#endif 509#endif
437#endif 510#endif
438 511
512static int psci_suspend_finisher(unsigned long index)
513{
514 struct psci_power_state *state = __get_cpu_var(psci_power_state);
515
516 return psci_ops.cpu_suspend(state[index - 1],
517 virt_to_phys(cpu_resume));
518}
519
520static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index)
521{
522 int ret;
523 struct psci_power_state *state = __get_cpu_var(psci_power_state);
524 /*
525 * idle state index 0 corresponds to wfi, should never be called
526 * from the cpu_suspend operations
527 */
528 if (WARN_ON_ONCE(!index))
529 return -EINVAL;
530
531 if (state->type == PSCI_POWER_STATE_TYPE_STANDBY)
532 ret = psci_ops.cpu_suspend(state[index - 1], 0);
533 else
534 ret = __cpu_suspend(index, psci_suspend_finisher);
535
536 return ret;
537}
538
439const struct cpu_operations cpu_psci_ops = { 539const struct cpu_operations cpu_psci_ops = {
440 .name = "psci", 540 .name = "psci",
541#ifdef CONFIG_CPU_IDLE
542 .cpu_init_idle = cpu_psci_cpu_init_idle,
543 .cpu_suspend = cpu_psci_cpu_suspend,
544#endif
441#ifdef CONFIG_SMP 545#ifdef CONFIG_SMP
442 .cpu_init = cpu_psci_cpu_init, 546 .cpu_init = cpu_psci_cpu_init,
443 .cpu_prepare = cpu_psci_cpu_prepare, 547 .cpu_prepare = cpu_psci_cpu_prepare,
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 0310811bd77d..fe63ac5e9bf5 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -87,7 +87,8 @@ static void ptrace_hbptriggered(struct perf_event *bp,
87 break; 87 break;
88 } 88 }
89 } 89 }
90 for (i = ARM_MAX_BRP; i < ARM_MAX_HBP_SLOTS && !bp; ++i) { 90
91 for (i = 0; i < ARM_MAX_WRP; ++i) {
91 if (current->thread.debug.hbp_watch[i] == bp) { 92 if (current->thread.debug.hbp_watch[i] == bp) {
92 info.si_errno = -((i << 1) + 1); 93 info.si_errno = -((i << 1) + 1);
93 break; 94 break;
@@ -662,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target,
662 kbuf += sizeof(reg); 663 kbuf += sizeof(reg);
663 } else { 664 } else {
664 ret = copy_to_user(ubuf, &reg, sizeof(reg)); 665 ret = copy_to_user(ubuf, &reg, sizeof(reg));
665 if (ret) 666 if (ret) {
667 ret = -EFAULT;
666 break; 668 break;
669 }
667 670
668 ubuf += sizeof(reg); 671 ubuf += sizeof(reg);
669 } 672 }
@@ -701,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target,
701 kbuf += sizeof(reg); 704 kbuf += sizeof(reg);
702 } else { 705 } else {
703 ret = copy_from_user(&reg, ubuf, sizeof(reg)); 706 ret = copy_from_user(&reg, ubuf, sizeof(reg));
704 if (ret) 707 if (ret) {
705 return ret; 708 ret = -EFAULT;
709 break;
710 }
706 711
707 ubuf += sizeof(reg); 712 ubuf += sizeof(reg);
708 } 713 }
@@ -1115,19 +1120,15 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1115 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 1120 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
1116 trace_sys_enter(regs, regs->syscallno); 1121 trace_sys_enter(regs, regs->syscallno);
1117 1122
1118#ifdef CONFIG_AUDITSYSCALL
1119 audit_syscall_entry(syscall_get_arch(), regs->syscallno, 1123 audit_syscall_entry(syscall_get_arch(), regs->syscallno,
1120 regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]); 1124 regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]);
1121#endif
1122 1125
1123 return regs->syscallno; 1126 return regs->syscallno;
1124} 1127}
1125 1128
1126asmlinkage void syscall_trace_exit(struct pt_regs *regs) 1129asmlinkage void syscall_trace_exit(struct pt_regs *regs)
1127{ 1130{
1128#ifdef CONFIG_AUDITSYSCALL
1129 audit_syscall_exit(regs); 1131 audit_syscall_exit(regs);
1130#endif
1131 1132
1132 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 1133 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
1133 trace_sys_exit(regs, regs_return_value(regs)); 1134 trace_sys_exit(regs, regs_return_value(regs));
diff --git a/arch/arm64/kernel/return_address.c b/arch/arm64/kernel/return_address.c
index 89102a6ffad5..6c4fd2810ecb 100644
--- a/arch/arm64/kernel/return_address.c
+++ b/arch/arm64/kernel/return_address.c
@@ -36,13 +36,12 @@ void *return_address(unsigned int level)
36{ 36{
37 struct return_address_data data; 37 struct return_address_data data;
38 struct stackframe frame; 38 struct stackframe frame;
39 register unsigned long current_sp asm ("sp");
40 39
41 data.level = level + 2; 40 data.level = level + 2;
42 data.addr = NULL; 41 data.addr = NULL;
43 42
44 frame.fp = (unsigned long)__builtin_frame_address(0); 43 frame.fp = (unsigned long)__builtin_frame_address(0);
45 frame.sp = current_sp; 44 frame.sp = current_stack_pointer;
46 frame.pc = (unsigned long)return_address; /* dummy */ 45 frame.pc = (unsigned long)return_address; /* dummy */
47 46
48 walk_stackframe(&frame, save_return_addr, &data); 47 walk_stackframe(&frame, save_return_addr, &data);
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index f6f0ccf35ae6..2437196cc5d4 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -78,6 +78,7 @@ unsigned int compat_elf_hwcap2 __read_mostly;
78#endif 78#endif
79 79
80static const char *cpu_name; 80static const char *cpu_name;
81static const char *machine_name;
81phys_addr_t __fdt_pointer __initdata; 82phys_addr_t __fdt_pointer __initdata;
82 83
83/* 84/*
@@ -309,6 +310,8 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
309 while (true) 310 while (true)
310 cpu_relax(); 311 cpu_relax();
311 } 312 }
313
314 machine_name = of_flat_dt_get_machine_name();
312} 315}
313 316
314/* 317/*
@@ -362,11 +365,6 @@ u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
362 365
363void __init setup_arch(char **cmdline_p) 366void __init setup_arch(char **cmdline_p)
364{ 367{
365 /*
366 * Unmask asynchronous aborts early to catch possible system errors.
367 */
368 local_async_enable();
369
370 setup_processor(); 368 setup_processor();
371 369
372 setup_machine_fdt(__fdt_pointer); 370 setup_machine_fdt(__fdt_pointer);
@@ -382,6 +380,12 @@ void __init setup_arch(char **cmdline_p)
382 380
383 parse_early_param(); 381 parse_early_param();
384 382
383 /*
384 * Unmask asynchronous aborts after bringing up possible earlycon.
385 * (Report possible System Errors once we can report this occurred)
386 */
387 local_async_enable();
388
385 efi_init(); 389 efi_init();
386 arm64_memblock_init(); 390 arm64_memblock_init();
387 391
@@ -447,21 +451,10 @@ static int c_show(struct seq_file *m, void *v)
447{ 451{
448 int i; 452 int i;
449 453
450 /* 454 seq_printf(m, "Processor\t: %s rev %d (%s)\n",
451 * Dump out the common processor features in a single line. Userspace 455 cpu_name, read_cpuid_id() & 15, ELF_PLATFORM);
452 * should read the hwcaps with getauxval(AT_HWCAP) rather than
453 * attempting to parse this.
454 */
455 seq_puts(m, "features\t:");
456 for (i = 0; hwcap_str[i]; i++)
457 if (elf_hwcap & (1 << i))
458 seq_printf(m, " %s", hwcap_str[i]);
459 seq_puts(m, "\n\n");
460 456
461 for_each_online_cpu(i) { 457 for_each_online_cpu(i) {
462 struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
463 u32 midr = cpuinfo->reg_midr;
464
465 /* 458 /*
466 * glibc reads /proc/cpuinfo to determine the number of 459 * glibc reads /proc/cpuinfo to determine the number of
467 * online processors, looking for lines beginning with 460 * online processors, looking for lines beginning with
@@ -470,13 +463,25 @@ static int c_show(struct seq_file *m, void *v)
470#ifdef CONFIG_SMP 463#ifdef CONFIG_SMP
471 seq_printf(m, "processor\t: %d\n", i); 464 seq_printf(m, "processor\t: %d\n", i);
472#endif 465#endif
473 seq_printf(m, "implementer\t: 0x%02x\n",
474 MIDR_IMPLEMENTOR(midr));
475 seq_printf(m, "variant\t\t: 0x%x\n", MIDR_VARIANT(midr));
476 seq_printf(m, "partnum\t\t: 0x%03x\n", MIDR_PARTNUM(midr));
477 seq_printf(m, "revision\t: 0x%x\n\n", MIDR_REVISION(midr));
478 } 466 }
479 467
468 /* dump out the processor features */
469 seq_puts(m, "Features\t: ");
470
471 for (i = 0; hwcap_str[i]; i++)
472 if (elf_hwcap & (1 << i))
473 seq_printf(m, "%s ", hwcap_str[i]);
474
475 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24);
476 seq_printf(m, "CPU architecture: AArch64\n");
477 seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15);
478 seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff);
479 seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
480
481 seq_puts(m, "\n");
482
483 seq_printf(m, "Hardware\t: %s\n", machine_name);
484
480 return 0; 485 return 0;
481} 486}
482 487
diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
index b1925729c692..a564b440416a 100644
--- a/arch/arm64/kernel/sleep.S
+++ b/arch/arm64/kernel/sleep.S
@@ -49,28 +49,39 @@
49 orr \dst, \dst, \mask // dst|=(aff3>>rs3) 49 orr \dst, \dst, \mask // dst|=(aff3>>rs3)
50 .endm 50 .endm
51/* 51/*
52 * Save CPU state for a suspend. This saves callee registers, and allocates 52 * Save CPU state for a suspend and execute the suspend finisher.
53 * space on the kernel stack to save the CPU specific registers + some 53 * On success it will return 0 through cpu_resume - ie through a CPU
54 * other data for resume. 54 * soft/hard reboot from the reset vector.
55 * On failure it returns the suspend finisher return value or force
56 * -EOPNOTSUPP if the finisher erroneously returns 0 (the suspend finisher
57 * is not allowed to return, if it does this must be considered failure).
58 * It saves callee registers, and allocates space on the kernel stack
59 * to save the CPU specific registers + some other data for resume.
55 * 60 *
56 * x0 = suspend finisher argument 61 * x0 = suspend finisher argument
62 * x1 = suspend finisher function pointer
57 */ 63 */
58ENTRY(__cpu_suspend) 64ENTRY(__cpu_suspend_enter)
59 stp x29, lr, [sp, #-96]! 65 stp x29, lr, [sp, #-96]!
60 stp x19, x20, [sp,#16] 66 stp x19, x20, [sp,#16]
61 stp x21, x22, [sp,#32] 67 stp x21, x22, [sp,#32]
62 stp x23, x24, [sp,#48] 68 stp x23, x24, [sp,#48]
63 stp x25, x26, [sp,#64] 69 stp x25, x26, [sp,#64]
64 stp x27, x28, [sp,#80] 70 stp x27, x28, [sp,#80]
71 /*
72 * Stash suspend finisher and its argument in x20 and x19
73 */
74 mov x19, x0
75 mov x20, x1
65 mov x2, sp 76 mov x2, sp
66 sub sp, sp, #CPU_SUSPEND_SZ // allocate cpu_suspend_ctx 77 sub sp, sp, #CPU_SUSPEND_SZ // allocate cpu_suspend_ctx
67 mov x1, sp 78 mov x0, sp
68 /* 79 /*
69 * x1 now points to struct cpu_suspend_ctx allocated on the stack 80 * x0 now points to struct cpu_suspend_ctx allocated on the stack
70 */ 81 */
71 str x2, [x1, #CPU_CTX_SP] 82 str x2, [x0, #CPU_CTX_SP]
72 ldr x2, =sleep_save_sp 83 ldr x1, =sleep_save_sp
73 ldr x2, [x2, #SLEEP_SAVE_SP_VIRT] 84 ldr x1, [x1, #SLEEP_SAVE_SP_VIRT]
74#ifdef CONFIG_SMP 85#ifdef CONFIG_SMP
75 mrs x7, mpidr_el1 86 mrs x7, mpidr_el1
76 ldr x9, =mpidr_hash 87 ldr x9, =mpidr_hash
@@ -82,11 +93,21 @@ ENTRY(__cpu_suspend)
82 ldp w3, w4, [x9, #MPIDR_HASH_SHIFTS] 93 ldp w3, w4, [x9, #MPIDR_HASH_SHIFTS]
83 ldp w5, w6, [x9, #(MPIDR_HASH_SHIFTS + 8)] 94 ldp w5, w6, [x9, #(MPIDR_HASH_SHIFTS + 8)]
84 compute_mpidr_hash x8, x3, x4, x5, x6, x7, x10 95 compute_mpidr_hash x8, x3, x4, x5, x6, x7, x10
85 add x2, x2, x8, lsl #3 96 add x1, x1, x8, lsl #3
86#endif 97#endif
87 bl __cpu_suspend_finisher 98 bl __cpu_suspend_save
99 /*
100 * Grab suspend finisher in x20 and its argument in x19
101 */
102 mov x0, x19
103 mov x1, x20
104 /*
105 * We are ready for power down, fire off the suspend finisher
106 * in x1, with argument in x0
107 */
108 blr x1
88 /* 109 /*
89 * Never gets here, unless suspend fails. 110 * Never gets here, unless suspend finisher fails.
90 * Successful cpu_suspend should return from cpu_resume, returning 111 * Successful cpu_suspend should return from cpu_resume, returning
91 * through this code path is considered an error 112 * through this code path is considered an error
92 * If the return value is set to 0 force x0 = -EOPNOTSUPP 113 * If the return value is set to 0 force x0 = -EOPNOTSUPP
@@ -103,7 +124,7 @@ ENTRY(__cpu_suspend)
103 ldp x27, x28, [sp, #80] 124 ldp x27, x28, [sp, #80]
104 ldp x29, lr, [sp], #96 125 ldp x29, lr, [sp], #96
105 ret 126 ret
106ENDPROC(__cpu_suspend) 127ENDPROC(__cpu_suspend_enter)
107 .ltorg 128 .ltorg
108 129
109/* 130/*
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 474339718105..b06d1d90ee8c 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -470,7 +470,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
470 } 470 }
471} 471}
472 472
473static void (*__smp_cross_call)(const struct cpumask *, unsigned int); 473void (*__smp_cross_call)(const struct cpumask *, unsigned int);
474 474
475void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int)) 475void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int))
476{ 476{
diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index 0347d38eea29..4f93c67e63de 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/types.h>
23 24
24#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
25#include <asm/cpu_ops.h> 26#include <asm/cpu_ops.h>
@@ -65,12 +66,21 @@ static int smp_spin_table_cpu_init(struct device_node *dn, unsigned int cpu)
65 66
66static int smp_spin_table_cpu_prepare(unsigned int cpu) 67static int smp_spin_table_cpu_prepare(unsigned int cpu)
67{ 68{
68 void **release_addr; 69 __le64 __iomem *release_addr;
69 70
70 if (!cpu_release_addr[cpu]) 71 if (!cpu_release_addr[cpu])
71 return -ENODEV; 72 return -ENODEV;
72 73
73 release_addr = __va(cpu_release_addr[cpu]); 74 /*
75 * The cpu-release-addr may or may not be inside the linear mapping.
76 * As ioremap_cache will either give us a new mapping or reuse the
77 * existing linear mapping, we can use it to cover both cases. In
78 * either case the memory will be MT_NORMAL.
79 */
80 release_addr = ioremap_cache(cpu_release_addr[cpu],
81 sizeof(*release_addr));
82 if (!release_addr)
83 return -ENOMEM;
74 84
75 /* 85 /*
76 * We write the release address as LE regardless of the native 86 * We write the release address as LE regardless of the native
@@ -79,15 +89,17 @@ static int smp_spin_table_cpu_prepare(unsigned int cpu)
79 * boot-loader's endianess before jumping. This is mandated by 89 * boot-loader's endianess before jumping. This is mandated by
80 * the boot protocol. 90 * the boot protocol.
81 */ 91 */
82 release_addr[0] = (void *) cpu_to_le64(__pa(secondary_holding_pen)); 92 writeq_relaxed(__pa(secondary_holding_pen), release_addr);
83 93 __flush_dcache_area((__force void *)release_addr,
84 __flush_dcache_area(release_addr, sizeof(release_addr[0])); 94 sizeof(*release_addr));
85 95
86 /* 96 /*
87 * Send an event to wake up the secondary CPU. 97 * Send an event to wake up the secondary CPU.
88 */ 98 */
89 sev(); 99 sev();
90 100
101 iounmap(release_addr);
102
91 return 0; 103 return 0;
92} 104}
93 105
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index 55437ba1f5a4..407991bf79f5 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -111,10 +111,9 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
111 frame.sp = thread_saved_sp(tsk); 111 frame.sp = thread_saved_sp(tsk);
112 frame.pc = thread_saved_pc(tsk); 112 frame.pc = thread_saved_pc(tsk);
113 } else { 113 } else {
114 register unsigned long current_sp asm("sp");
115 data.no_sched_functions = 0; 114 data.no_sched_functions = 0;
116 frame.fp = (unsigned long)__builtin_frame_address(0); 115 frame.fp = (unsigned long)__builtin_frame_address(0);
117 frame.sp = current_sp; 116 frame.sp = current_stack_pointer;
118 frame.pc = (unsigned long)save_stack_trace_tsk; 117 frame.pc = (unsigned long)save_stack_trace_tsk;
119 } 118 }
120 119
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index 55a99b9a97e0..13ad4dbb1615 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -9,22 +9,19 @@
9#include <asm/suspend.h> 9#include <asm/suspend.h>
10#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
11 11
12extern int __cpu_suspend(unsigned long); 12extern int __cpu_suspend_enter(unsigned long arg, int (*fn)(unsigned long));
13/* 13/*
14 * This is called by __cpu_suspend() to save the state, and do whatever 14 * This is called by __cpu_suspend_enter() to save the state, and do whatever
15 * flushing is required to ensure that when the CPU goes to sleep we have 15 * flushing is required to ensure that when the CPU goes to sleep we have
16 * the necessary data available when the caches are not searched. 16 * the necessary data available when the caches are not searched.
17 * 17 *
18 * @arg: Argument to pass to suspend operations 18 * ptr: CPU context virtual address
19 * @ptr: CPU context virtual address 19 * save_ptr: address of the location where the context physical address
20 * @save_ptr: address of the location where the context physical address 20 * must be saved
21 * must be saved
22 */ 21 */
23int __cpu_suspend_finisher(unsigned long arg, struct cpu_suspend_ctx *ptr, 22void notrace __cpu_suspend_save(struct cpu_suspend_ctx *ptr,
24 phys_addr_t *save_ptr) 23 phys_addr_t *save_ptr)
25{ 24{
26 int cpu = smp_processor_id();
27
28 *save_ptr = virt_to_phys(ptr); 25 *save_ptr = virt_to_phys(ptr);
29 26
30 cpu_do_suspend(ptr); 27 cpu_do_suspend(ptr);
@@ -35,8 +32,6 @@ int __cpu_suspend_finisher(unsigned long arg, struct cpu_suspend_ctx *ptr,
35 */ 32 */
36 __flush_dcache_area(ptr, sizeof(*ptr)); 33 __flush_dcache_area(ptr, sizeof(*ptr));
37 __flush_dcache_area(save_ptr, sizeof(*save_ptr)); 34 __flush_dcache_area(save_ptr, sizeof(*save_ptr));
38
39 return cpu_ops[cpu]->cpu_suspend(arg);
40} 35}
41 36
42/* 37/*
@@ -56,15 +51,15 @@ void __init cpu_suspend_set_dbg_restorer(void (*hw_bp_restore)(void *))
56} 51}
57 52
58/** 53/**
59 * cpu_suspend 54 * cpu_suspend() - function to enter a low-power state
55 * @arg: argument to pass to CPU suspend operations
60 * 56 *
61 * @arg: argument to pass to the finisher function 57 * Return: 0 on success, -EOPNOTSUPP if CPU suspend hook not initialized, CPU
58 * operations back-end error code otherwise.
62 */ 59 */
63int cpu_suspend(unsigned long arg) 60int cpu_suspend(unsigned long arg)
64{ 61{
65 struct mm_struct *mm = current->active_mm; 62 int cpu = smp_processor_id();
66 int ret, cpu = smp_processor_id();
67 unsigned long flags;
68 63
69 /* 64 /*
70 * If cpu_ops have not been registered or suspend 65 * If cpu_ops have not been registered or suspend
@@ -72,6 +67,21 @@ int cpu_suspend(unsigned long arg)
72 */ 67 */
73 if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_suspend) 68 if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_suspend)
74 return -EOPNOTSUPP; 69 return -EOPNOTSUPP;
70 return cpu_ops[cpu]->cpu_suspend(arg);
71}
72
73/*
74 * __cpu_suspend
75 *
76 * arg: argument to pass to the finisher function
77 * fn: finisher function pointer
78 *
79 */
80int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
81{
82 struct mm_struct *mm = current->active_mm;
83 int ret;
84 unsigned long flags;
75 85
76 /* 86 /*
77 * From this point debug exceptions are disabled to prevent 87 * From this point debug exceptions are disabled to prevent
@@ -86,7 +96,7 @@ int cpu_suspend(unsigned long arg)
86 * page tables, so that the thread address space is properly 96 * page tables, so that the thread address space is properly
87 * set-up on function return. 97 * set-up on function return.
88 */ 98 */
89 ret = __cpu_suspend(arg); 99 ret = __cpu_suspend_enter(arg, fn);
90 if (ret == 0) { 100 if (ret == 0) {
91 cpu_switch_mm(mm->pgd, mm); 101 cpu_switch_mm(mm->pgd, mm);
92 flush_tlb_all(); 102 flush_tlb_all();
@@ -95,7 +105,7 @@ int cpu_suspend(unsigned long arg)
95 * Restore per-cpu offset before any kernel 105 * Restore per-cpu offset before any kernel
96 * subsystem relying on it has a chance to run. 106 * subsystem relying on it has a chance to run.
97 */ 107 */
98 set_my_cpu_offset(per_cpu_offset(cpu)); 108 set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
99 109
100 /* 110 /*
101 * Restore HW breakpoint registers to sane values 111 * Restore HW breakpoint registers to sane values
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c
index de2b0226e06d..dc47e53e9e28 100644
--- a/arch/arm64/kernel/sys_compat.c
+++ b/arch/arm64/kernel/sys_compat.c
@@ -79,6 +79,12 @@ long compat_arm_syscall(struct pt_regs *regs)
79 79
80 case __ARM_NR_compat_set_tls: 80 case __ARM_NR_compat_set_tls:
81 current->thread.tp_value = regs->regs[0]; 81 current->thread.tp_value = regs->regs[0];
82
83 /*
84 * Protect against register corruption from context switch.
85 * See comment in tls_thread_flush.
86 */
87 barrier();
82 asm ("msr tpidrro_el0, %0" : : "r" (regs->regs[0])); 88 asm ("msr tpidrro_el0, %0" : : "r" (regs->regs[0]));
83 return 0; 89 return 0;
84 90
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 02cd3f023e9a..de1b085e7963 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -132,7 +132,6 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
132static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) 132static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
133{ 133{
134 struct stackframe frame; 134 struct stackframe frame;
135 const register unsigned long current_sp asm ("sp");
136 135
137 pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk); 136 pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk);
138 137
@@ -145,7 +144,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
145 frame.pc = regs->pc; 144 frame.pc = regs->pc;
146 } else if (tsk == current) { 145 } else if (tsk == current) {
147 frame.fp = (unsigned long)__builtin_frame_address(0); 146 frame.fp = (unsigned long)__builtin_frame_address(0);
148 frame.sp = current_sp; 147 frame.sp = current_stack_pointer;
149 frame.pc = (unsigned long)dump_backtrace; 148 frame.pc = (unsigned long)dump_backtrace;
150 } else { 149 } else {
151 /* 150 /*
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 97f0c0429dfa..edf8715ba39b 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -97,9 +97,9 @@ SECTIONS
97 97
98 PERCPU_SECTION(64) 98 PERCPU_SECTION(64)
99 99
100 . = ALIGN(PAGE_SIZE);
100 __init_end = .; 101 __init_end = .;
101 102
102 . = ALIGN(PAGE_SIZE);
103 _data = .; 103 _data = .;
104 _sdata = .; 104 _sdata = .;
105 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE) 105 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 8d1ec2887a26..76794692c20b 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -174,7 +174,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
174 174
175 ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id)); 175 ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id));
176 if (ret != 0) 176 if (ret != 0)
177 return ret; 177 return -EFAULT;
178 178
179 return kvm_arm_timer_set_reg(vcpu, reg->id, val); 179 return kvm_arm_timer_set_reg(vcpu, reg->id, val);
180} 180}
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
index e28be510380c..34b8bd0711e9 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -66,6 +66,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run)
66 else 66 else
67 kvm_vcpu_block(vcpu); 67 kvm_vcpu_block(vcpu);
68 68
69 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
70
69 return 1; 71 return 1;
70} 72}
71 73
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
index d968796f4b2d..c3191168a994 100644
--- a/arch/arm64/kvm/hyp-init.S
+++ b/arch/arm64/kvm/hyp-init.S
@@ -80,6 +80,10 @@ __do_hyp_init:
80 msr mair_el2, x4 80 msr mair_el2, x4
81 isb 81 isb
82 82
83 /* Invalidate the stale TLBs from Bootloader */
84 tlbi alle2
85 dsb sy
86
83 mrs x4, sctlr_el2 87 mrs x4, sctlr_el2
84 and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2 88 and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2
85 ldr x5, =SCTLR_EL2_FLAGS 89 ldr x5, =SCTLR_EL2_FLAGS
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 5805e7c4a4dd..4cc3b719208e 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -1218,7 +1218,7 @@ static bool is_valid_cache(u32 val)
1218 u32 level, ctype; 1218 u32 level, ctype;
1219 1219
1220 if (val >= CSSELR_MAX) 1220 if (val >= CSSELR_MAX)
1221 return -ENOENT; 1221 return false;
1222 1222
1223 /* Bottom bit is Instruction or Data bit. Next 3 bits are level. */ 1223 /* Bottom bit is Instruction or Data bit. Next 3 bits are level. */
1224 level = (val >> 1); 1224 level = (val >> 1);
diff --git a/arch/arm64/mm/Makefile b/arch/arm64/mm/Makefile
index 3ecb56c624d3..c56179ed2c09 100644
--- a/arch/arm64/mm/Makefile
+++ b/arch/arm64/mm/Makefile
@@ -1,5 +1,5 @@
1obj-y := dma-mapping.o extable.o fault.o init.o \ 1obj-y := dma-mapping.o extable.o fault.o init.o \
2 cache.o copypage.o flush.o \ 2 cache.o copypage.o flush.o \
3 ioremap.o mmap.o pgd.o mmu.o \ 3 ioremap.o mmap.o pgd.o mmu.o \
4 context.o proc.o 4 context.o proc.o pageattr.o
5obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 5obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 4164c5ace9f8..d92094203913 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -20,13 +20,11 @@
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/export.h> 21#include <linux/export.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/genalloc.h>
23#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
24#include <linux/dma-contiguous.h> 25#include <linux/dma-contiguous.h>
25#include <linux/of.h>
26#include <linux/platform_device.h>
27#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
28#include <linux/swiotlb.h> 27#include <linux/swiotlb.h>
29#include <linux/amba/bus.h>
30 28
31#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
32 30
@@ -41,6 +39,54 @@ static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot,
41 return prot; 39 return prot;
42} 40}
43 41
42static struct gen_pool *atomic_pool;
43
44#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
45static size_t atomic_pool_size = DEFAULT_DMA_COHERENT_POOL_SIZE;
46
47static int __init early_coherent_pool(char *p)
48{
49 atomic_pool_size = memparse(p, &p);
50 return 0;
51}
52early_param("coherent_pool", early_coherent_pool);
53
54static void *__alloc_from_pool(size_t size, struct page **ret_page)
55{
56 unsigned long val;
57 void *ptr = NULL;
58
59 if (!atomic_pool) {
60 WARN(1, "coherent pool not initialised!\n");
61 return NULL;
62 }
63
64 val = gen_pool_alloc(atomic_pool, size);
65 if (val) {
66 phys_addr_t phys = gen_pool_virt_to_phys(atomic_pool, val);
67
68 *ret_page = phys_to_page(phys);
69 ptr = (void *)val;
70 }
71
72 return ptr;
73}
74
75static bool __in_atomic_pool(void *start, size_t size)
76{
77 return addr_in_gen_pool(atomic_pool, (unsigned long)start, size);
78}
79
80static int __free_from_pool(void *start, size_t size)
81{
82 if (!__in_atomic_pool(start, size))
83 return 0;
84
85 gen_pool_free(atomic_pool, (unsigned long)start, size);
86
87 return 1;
88}
89
44static void *__dma_alloc_coherent(struct device *dev, size_t size, 90static void *__dma_alloc_coherent(struct device *dev, size_t size,
45 dma_addr_t *dma_handle, gfp_t flags, 91 dma_addr_t *dma_handle, gfp_t flags,
46 struct dma_attrs *attrs) 92 struct dma_attrs *attrs)
@@ -53,7 +99,7 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,
53 if (IS_ENABLED(CONFIG_ZONE_DMA) && 99 if (IS_ENABLED(CONFIG_ZONE_DMA) &&
54 dev->coherent_dma_mask <= DMA_BIT_MASK(32)) 100 dev->coherent_dma_mask <= DMA_BIT_MASK(32))
55 flags |= GFP_DMA; 101 flags |= GFP_DMA;
56 if (IS_ENABLED(CONFIG_DMA_CMA)) { 102 if (IS_ENABLED(CONFIG_DMA_CMA) && (flags & __GFP_WAIT)) {
57 struct page *page; 103 struct page *page;
58 104
59 size = PAGE_ALIGN(size); 105 size = PAGE_ALIGN(size);
@@ -73,50 +119,54 @@ static void __dma_free_coherent(struct device *dev, size_t size,
73 void *vaddr, dma_addr_t dma_handle, 119 void *vaddr, dma_addr_t dma_handle,
74 struct dma_attrs *attrs) 120 struct dma_attrs *attrs)
75{ 121{
122 bool freed;
123 phys_addr_t paddr = dma_to_phys(dev, dma_handle);
124
76 if (dev == NULL) { 125 if (dev == NULL) {
77 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n"); 126 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
78 return; 127 return;
79 } 128 }
80 129
81 if (IS_ENABLED(CONFIG_DMA_CMA)) { 130 freed = dma_release_from_contiguous(dev,
82 phys_addr_t paddr = dma_to_phys(dev, dma_handle);
83
84 dma_release_from_contiguous(dev,
85 phys_to_page(paddr), 131 phys_to_page(paddr),
86 size >> PAGE_SHIFT); 132 size >> PAGE_SHIFT);
87 } else { 133 if (!freed)
88 swiotlb_free_coherent(dev, size, vaddr, dma_handle); 134 swiotlb_free_coherent(dev, size, vaddr, dma_handle);
89 }
90} 135}
91 136
92static void *__dma_alloc_noncoherent(struct device *dev, size_t size, 137static void *__dma_alloc_noncoherent(struct device *dev, size_t size,
93 dma_addr_t *dma_handle, gfp_t flags, 138 dma_addr_t *dma_handle, gfp_t flags,
94 struct dma_attrs *attrs) 139 struct dma_attrs *attrs)
95{ 140{
96 struct page *page, **map; 141 struct page *page;
97 void *ptr, *coherent_ptr; 142 void *ptr, *coherent_ptr;
98 int order, i;
99 143
100 size = PAGE_ALIGN(size); 144 size = PAGE_ALIGN(size);
101 order = get_order(size); 145
146 if (!(flags & __GFP_WAIT)) {
147 struct page *page = NULL;
148 void *addr = __alloc_from_pool(size, &page);
149
150 if (addr)
151 *dma_handle = phys_to_dma(dev, page_to_phys(page));
152
153 return addr;
154
155 }
102 156
103 ptr = __dma_alloc_coherent(dev, size, dma_handle, flags, attrs); 157 ptr = __dma_alloc_coherent(dev, size, dma_handle, flags, attrs);
104 if (!ptr) 158 if (!ptr)
105 goto no_mem; 159 goto no_mem;
106 map = kmalloc(sizeof(struct page *) << order, flags & ~GFP_DMA);
107 if (!map)
108 goto no_map;
109 160
110 /* remove any dirty cache lines on the kernel alias */ 161 /* remove any dirty cache lines on the kernel alias */
111 __dma_flush_range(ptr, ptr + size); 162 __dma_flush_range(ptr, ptr + size);
112 163
113 /* create a coherent mapping */ 164 /* create a coherent mapping */
114 page = virt_to_page(ptr); 165 page = virt_to_page(ptr);
115 for (i = 0; i < (size >> PAGE_SHIFT); i++) 166 coherent_ptr = dma_common_contiguous_remap(page, size, VM_USERMAP,
116 map[i] = page + i; 167 __get_dma_pgprot(attrs,
117 coherent_ptr = vmap(map, size >> PAGE_SHIFT, VM_MAP, 168 __pgprot(PROT_NORMAL_NC), false),
118 __get_dma_pgprot(attrs, __pgprot(PROT_NORMAL_NC), false)); 169 NULL);
119 kfree(map);
120 if (!coherent_ptr) 170 if (!coherent_ptr)
121 goto no_map; 171 goto no_map;
122 172
@@ -125,7 +175,7 @@ static void *__dma_alloc_noncoherent(struct device *dev, size_t size,
125no_map: 175no_map:
126 __dma_free_coherent(dev, size, ptr, *dma_handle, attrs); 176 __dma_free_coherent(dev, size, ptr, *dma_handle, attrs);
127no_mem: 177no_mem:
128 *dma_handle = ~0; 178 *dma_handle = DMA_ERROR_CODE;
129 return NULL; 179 return NULL;
130} 180}
131 181
@@ -135,6 +185,8 @@ static void __dma_free_noncoherent(struct device *dev, size_t size,
135{ 185{
136 void *swiotlb_addr = phys_to_virt(dma_to_phys(dev, dma_handle)); 186 void *swiotlb_addr = phys_to_virt(dma_to_phys(dev, dma_handle));
137 187
188 if (__free_from_pool(vaddr, size))
189 return;
138 vunmap(vaddr); 190 vunmap(vaddr);
139 __dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs); 191 __dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs);
140} 192}
@@ -308,45 +360,88 @@ struct dma_map_ops coherent_swiotlb_dma_ops = {
308}; 360};
309EXPORT_SYMBOL(coherent_swiotlb_dma_ops); 361EXPORT_SYMBOL(coherent_swiotlb_dma_ops);
310 362
311static int dma_bus_notifier(struct notifier_block *nb, 363extern int swiotlb_late_init_with_default_size(size_t default_size);
312 unsigned long event, void *_dev)
313{
314 struct device *dev = _dev;
315
316 if (event != BUS_NOTIFY_ADD_DEVICE)
317 return NOTIFY_DONE;
318
319 if (of_property_read_bool(dev->of_node, "dma-coherent"))
320 set_dma_ops(dev, &coherent_swiotlb_dma_ops);
321 364
322 return NOTIFY_OK; 365static int __init atomic_pool_init(void)
366{
367 pgprot_t prot = __pgprot(PROT_NORMAL_NC);
368 unsigned long nr_pages = atomic_pool_size >> PAGE_SHIFT;
369 struct page *page;
370 void *addr;
371 unsigned int pool_size_order = get_order(atomic_pool_size);
372
373 if (dev_get_cma_area(NULL))
374 page = dma_alloc_from_contiguous(NULL, nr_pages,
375 pool_size_order);
376 else
377 page = alloc_pages(GFP_DMA, pool_size_order);
378
379 if (page) {
380 int ret;
381 void *page_addr = page_address(page);
382
383 memset(page_addr, 0, atomic_pool_size);
384 __dma_flush_range(page_addr, page_addr + atomic_pool_size);
385
386 atomic_pool = gen_pool_create(PAGE_SHIFT, -1);
387 if (!atomic_pool)
388 goto free_page;
389
390 addr = dma_common_contiguous_remap(page, atomic_pool_size,
391 VM_USERMAP, prot, atomic_pool_init);
392
393 if (!addr)
394 goto destroy_genpool;
395
396 ret = gen_pool_add_virt(atomic_pool, (unsigned long)addr,
397 page_to_phys(page),
398 atomic_pool_size, -1);
399 if (ret)
400 goto remove_mapping;
401
402 gen_pool_set_algo(atomic_pool,
403 gen_pool_first_fit_order_align,
404 (void *)PAGE_SHIFT);
405
406 pr_info("DMA: preallocated %zu KiB pool for atomic allocations\n",
407 atomic_pool_size / 1024);
408 return 0;
409 }
410 goto out;
411
412remove_mapping:
413 dma_common_free_remap(addr, atomic_pool_size, VM_USERMAP);
414destroy_genpool:
415 gen_pool_destroy(atomic_pool);
416 atomic_pool = NULL;
417free_page:
418 if (!dma_release_from_contiguous(NULL, page, nr_pages))
419 __free_pages(page, pool_size_order);
420out:
421 pr_err("DMA: failed to allocate %zu KiB pool for atomic coherent allocation\n",
422 atomic_pool_size / 1024);
423 return -ENOMEM;
323} 424}
324 425
325static struct notifier_block platform_bus_nb = {
326 .notifier_call = dma_bus_notifier,
327};
328
329static struct notifier_block amba_bus_nb = {
330 .notifier_call = dma_bus_notifier,
331};
332
333extern int swiotlb_late_init_with_default_size(size_t default_size);
334
335static int __init swiotlb_late_init(void) 426static int __init swiotlb_late_init(void)
336{ 427{
337 size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT); 428 size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT);
338 429
339 /*
340 * These must be registered before of_platform_populate().
341 */
342 bus_register_notifier(&platform_bus_type, &platform_bus_nb);
343 bus_register_notifier(&amba_bustype, &amba_bus_nb);
344
345 dma_ops = &noncoherent_swiotlb_dma_ops; 430 dma_ops = &noncoherent_swiotlb_dma_ops;
346 431
347 return swiotlb_late_init_with_default_size(swiotlb_size); 432 return swiotlb_late_init_with_default_size(swiotlb_size);
348} 433}
349arch_initcall(swiotlb_late_init); 434
435static int __init arm64_dma_init(void)
436{
437 int ret = 0;
438
439 ret |= swiotlb_late_init();
440 ret |= atomic_pool_init();
441
442 return ret;
443}
444arch_initcall(arm64_dma_init);
350 445
351#define PREALLOC_DMA_DEBUG_ENTRIES 4096 446#define PREALLOC_DMA_DEBUG_ENTRIES 4096
352 447
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index 0d64089d28b5..b6f14e8d2121 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -104,3 +104,19 @@ EXPORT_SYMBOL(flush_dcache_page);
104 */ 104 */
105EXPORT_SYMBOL(flush_cache_all); 105EXPORT_SYMBOL(flush_cache_all);
106EXPORT_SYMBOL(flush_icache_range); 106EXPORT_SYMBOL(flush_icache_range);
107
108#ifdef CONFIG_TRANSPARENT_HUGEPAGE
109#ifdef CONFIG_HAVE_RCU_TABLE_FREE
110void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
111 pmd_t *pmdp)
112{
113 pmd_t pmd = pmd_mksplitting(*pmdp);
114
115 VM_BUG_ON(address & ~PMD_MASK);
116 set_pmd_at(vma->vm_mm, address, pmdp, pmd);
117
118 /* dummy IPI to serialise against fast_gup */
119 kick_all_cpus_sync();
120}
121#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
122#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 5b4526ee3a01..494297c698ca 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -32,6 +32,7 @@
32#include <linux/of_fdt.h> 32#include <linux/of_fdt.h>
33#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
34#include <linux/dma-contiguous.h> 34#include <linux/dma-contiguous.h>
35#include <linux/efi.h>
35 36
36#include <asm/fixmap.h> 37#include <asm/fixmap.h>
37#include <asm/sections.h> 38#include <asm/sections.h>
@@ -254,7 +255,7 @@ static void __init free_unused_memmap(void)
254 */ 255 */
255void __init mem_init(void) 256void __init mem_init(void)
256{ 257{
257 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 258 set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
258 259
259#ifndef CONFIG_SPARSEMEM_VMEMMAP 260#ifndef CONFIG_SPARSEMEM_VMEMMAP
260 free_unused_memmap(); 261 free_unused_memmap();
@@ -332,8 +333,14 @@ static int keep_initrd;
332 333
333void free_initrd_mem(unsigned long start, unsigned long end) 334void free_initrd_mem(unsigned long start, unsigned long end)
334{ 335{
335 if (!keep_initrd) 336 if (!keep_initrd) {
337 if (start == initrd_start)
338 start = round_down(start, PAGE_SIZE);
339 if (end == initrd_end)
340 end = round_up(end, PAGE_SIZE);
341
336 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 342 free_reserved_area((void *)start, (void *)end, 0, "initrd");
343 }
337} 344}
338 345
339static int __init keepinitrd_setup(char *__unused) 346static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 8ed6cb1a900f..1d73662f00ff 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
102 * You really shouldn't be using read() or write() on /dev/mem. This might go 102 * You really shouldn't be using read() or write() on /dev/mem. This might go
103 * away in the future. 103 * away in the future.
104 */ 104 */
105int valid_phys_addr_range(unsigned long addr, size_t size) 105int valid_phys_addr_range(phys_addr_t addr, size_t size)
106{ 106{
107 if (addr < PHYS_OFFSET) 107 if (addr < PHYS_OFFSET)
108 return 0; 108 return 0;
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index c55567283cde..6894ef3e6234 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -94,7 +94,7 @@ static int __init early_cachepolicy(char *p)
94 */ 94 */
95 asm volatile( 95 asm volatile(
96 " mrs %0, mair_el1\n" 96 " mrs %0, mair_el1\n"
97 " bfi %0, %1, #%2, #8\n" 97 " bfi %0, %1, %2, #8\n"
98 " msr mair_el1, %0\n" 98 " msr mair_el1, %0\n"
99 " isb\n" 99 " isb\n"
100 : "=&r" (tmp) 100 : "=&r" (tmp)
diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
new file mode 100644
index 000000000000..bb0ea94c4ba1
--- /dev/null
+++ b/arch/arm64/mm/pageattr.c
@@ -0,0 +1,97 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. 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 and
6 * only version 2 as 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#include <linux/kernel.h>
14#include <linux/mm.h>
15#include <linux/module.h>
16#include <linux/sched.h>
17
18#include <asm/pgtable.h>
19#include <asm/tlbflush.h>
20
21struct page_change_data {
22 pgprot_t set_mask;
23 pgprot_t clear_mask;
24};
25
26static int change_page_range(pte_t *ptep, pgtable_t token, unsigned long addr,
27 void *data)
28{
29 struct page_change_data *cdata = data;
30 pte_t pte = *ptep;
31
32 pte = clear_pte_bit(pte, cdata->clear_mask);
33 pte = set_pte_bit(pte, cdata->set_mask);
34
35 set_pte(ptep, pte);
36 return 0;
37}
38
39static int change_memory_common(unsigned long addr, int numpages,
40 pgprot_t set_mask, pgprot_t clear_mask)
41{
42 unsigned long start = addr;
43 unsigned long size = PAGE_SIZE*numpages;
44 unsigned long end = start + size;
45 int ret;
46 struct page_change_data data;
47
48 if (!IS_ALIGNED(addr, PAGE_SIZE)) {
49 start &= PAGE_MASK;
50 end = start + size;
51 WARN_ON_ONCE(1);
52 }
53
54 if (!is_module_address(start) || !is_module_address(end - 1))
55 return -EINVAL;
56
57 data.set_mask = set_mask;
58 data.clear_mask = clear_mask;
59
60 ret = apply_to_page_range(&init_mm, start, size, change_page_range,
61 &data);
62
63 flush_tlb_kernel_range(start, end);
64 return ret;
65}
66
67int set_memory_ro(unsigned long addr, int numpages)
68{
69 return change_memory_common(addr, numpages,
70 __pgprot(PTE_RDONLY),
71 __pgprot(PTE_WRITE));
72}
73EXPORT_SYMBOL_GPL(set_memory_ro);
74
75int set_memory_rw(unsigned long addr, int numpages)
76{
77 return change_memory_common(addr, numpages,
78 __pgprot(PTE_WRITE),
79 __pgprot(PTE_RDONLY));
80}
81EXPORT_SYMBOL_GPL(set_memory_rw);
82
83int set_memory_nx(unsigned long addr, int numpages)
84{
85 return change_memory_common(addr, numpages,
86 __pgprot(PTE_PXN),
87 __pgprot(0));
88}
89EXPORT_SYMBOL_GPL(set_memory_nx);
90
91int set_memory_x(unsigned long addr, int numpages)
92{
93 return change_memory_common(addr, numpages,
94 __pgprot(0),
95 __pgprot(PTE_PXN));
96}
97EXPORT_SYMBOL_GPL(set_memory_x);
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index 7736779c9809..4e778b13291b 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -76,6 +76,21 @@ ENTRY(cpu_reset)
76 ret x0 76 ret x0
77ENDPROC(cpu_reset) 77ENDPROC(cpu_reset)
78 78
79ENTRY(cpu_soft_restart)
80 /* Save address of cpu_reset() and reset address */
81 mov x19, x0
82 mov x20, x1
83
84 /* Turn D-cache off */
85 bl cpu_cache_off
86
87 /* Push out all dirty data, and ensure cache is empty */
88 bl flush_cache_all
89
90 mov x0, x20
91 ret x19
92ENDPROC(cpu_soft_restart)
93
79/* 94/*
80 * cpu_do_idle() 95 * cpu_do_idle()
81 * 96 *
diff --git a/arch/arm64/net/Makefile b/arch/arm64/net/Makefile
new file mode 100644
index 000000000000..da9763378284
--- /dev/null
+++ b/arch/arm64/net/Makefile
@@ -0,0 +1,4 @@
1#
2# ARM64 networking code
3#
4obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o
diff --git a/arch/arm64/net/bpf_jit.h b/arch/arm64/net/bpf_jit.h
new file mode 100644
index 000000000000..2134f7e6c288
--- /dev/null
+++ b/arch/arm64/net/bpf_jit.h
@@ -0,0 +1,169 @@
1/*
2 * BPF JIT compiler for ARM64
3 *
4 * Copyright (C) 2014 Zi Shen Lim <zlim.lnx@gmail.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 * 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#ifndef _BPF_JIT_H
19#define _BPF_JIT_H
20
21#include <asm/insn.h>
22
23/* 5-bit Register Operand */
24#define A64_R(x) AARCH64_INSN_REG_##x
25#define A64_FP AARCH64_INSN_REG_FP
26#define A64_LR AARCH64_INSN_REG_LR
27#define A64_ZR AARCH64_INSN_REG_ZR
28#define A64_SP AARCH64_INSN_REG_SP
29
30#define A64_VARIANT(sf) \
31 ((sf) ? AARCH64_INSN_VARIANT_64BIT : AARCH64_INSN_VARIANT_32BIT)
32
33/* Compare & branch (immediate) */
34#define A64_COMP_BRANCH(sf, Rt, offset, type) \
35 aarch64_insn_gen_comp_branch_imm(0, offset, Rt, A64_VARIANT(sf), \
36 AARCH64_INSN_BRANCH_COMP_##type)
37#define A64_CBZ(sf, Rt, imm19) A64_COMP_BRANCH(sf, Rt, (imm19) << 2, ZERO)
38
39/* Conditional branch (immediate) */
40#define A64_COND_BRANCH(cond, offset) \
41 aarch64_insn_gen_cond_branch_imm(0, offset, cond)
42#define A64_COND_EQ AARCH64_INSN_COND_EQ /* == */
43#define A64_COND_NE AARCH64_INSN_COND_NE /* != */
44#define A64_COND_CS AARCH64_INSN_COND_CS /* unsigned >= */
45#define A64_COND_HI AARCH64_INSN_COND_HI /* unsigned > */
46#define A64_COND_GE AARCH64_INSN_COND_GE /* signed >= */
47#define A64_COND_GT AARCH64_INSN_COND_GT /* signed > */
48#define A64_B_(cond, imm19) A64_COND_BRANCH(cond, (imm19) << 2)
49
50/* Unconditional branch (immediate) */
51#define A64_BRANCH(offset, type) aarch64_insn_gen_branch_imm(0, offset, \
52 AARCH64_INSN_BRANCH_##type)
53#define A64_B(imm26) A64_BRANCH((imm26) << 2, NOLINK)
54#define A64_BL(imm26) A64_BRANCH((imm26) << 2, LINK)
55
56/* Unconditional branch (register) */
57#define A64_BLR(Rn) aarch64_insn_gen_branch_reg(Rn, AARCH64_INSN_BRANCH_LINK)
58#define A64_RET(Rn) aarch64_insn_gen_branch_reg(Rn, AARCH64_INSN_BRANCH_RETURN)
59
60/* Load/store register (register offset) */
61#define A64_LS_REG(Rt, Rn, Rm, size, type) \
62 aarch64_insn_gen_load_store_reg(Rt, Rn, Rm, \
63 AARCH64_INSN_SIZE_##size, \
64 AARCH64_INSN_LDST_##type##_REG_OFFSET)
65#define A64_STRB(Wt, Xn, Xm) A64_LS_REG(Wt, Xn, Xm, 8, STORE)
66#define A64_LDRB(Wt, Xn, Xm) A64_LS_REG(Wt, Xn, Xm, 8, LOAD)
67#define A64_STRH(Wt, Xn, Xm) A64_LS_REG(Wt, Xn, Xm, 16, STORE)
68#define A64_LDRH(Wt, Xn, Xm) A64_LS_REG(Wt, Xn, Xm, 16, LOAD)
69#define A64_STR32(Wt, Xn, Xm) A64_LS_REG(Wt, Xn, Xm, 32, STORE)
70#define A64_LDR32(Wt, Xn, Xm) A64_LS_REG(Wt, Xn, Xm, 32, LOAD)
71#define A64_STR64(Xt, Xn, Xm) A64_LS_REG(Xt, Xn, Xm, 64, STORE)
72#define A64_LDR64(Xt, Xn, Xm) A64_LS_REG(Xt, Xn, Xm, 64, LOAD)
73
74/* Load/store register pair */
75#define A64_LS_PAIR(Rt, Rt2, Rn, offset, ls, type) \
76 aarch64_insn_gen_load_store_pair(Rt, Rt2, Rn, offset, \
77 AARCH64_INSN_VARIANT_64BIT, \
78 AARCH64_INSN_LDST_##ls##_PAIR_##type)
79/* Rn -= 16; Rn[0] = Rt; Rn[8] = Rt2; */
80#define A64_PUSH(Rt, Rt2, Rn) A64_LS_PAIR(Rt, Rt2, Rn, -16, STORE, PRE_INDEX)
81/* Rt = Rn[0]; Rt2 = Rn[8]; Rn += 16; */
82#define A64_POP(Rt, Rt2, Rn) A64_LS_PAIR(Rt, Rt2, Rn, 16, LOAD, POST_INDEX)
83
84/* Add/subtract (immediate) */
85#define A64_ADDSUB_IMM(sf, Rd, Rn, imm12, type) \
86 aarch64_insn_gen_add_sub_imm(Rd, Rn, imm12, \
87 A64_VARIANT(sf), AARCH64_INSN_ADSB_##type)
88/* Rd = Rn OP imm12 */
89#define A64_ADD_I(sf, Rd, Rn, imm12) A64_ADDSUB_IMM(sf, Rd, Rn, imm12, ADD)
90#define A64_SUB_I(sf, Rd, Rn, imm12) A64_ADDSUB_IMM(sf, Rd, Rn, imm12, SUB)
91/* Rd = Rn */
92#define A64_MOV(sf, Rd, Rn) A64_ADD_I(sf, Rd, Rn, 0)
93
94/* Bitfield move */
95#define A64_BITFIELD(sf, Rd, Rn, immr, imms, type) \
96 aarch64_insn_gen_bitfield(Rd, Rn, immr, imms, \
97 A64_VARIANT(sf), AARCH64_INSN_BITFIELD_MOVE_##type)
98/* Signed, with sign replication to left and zeros to right */
99#define A64_SBFM(sf, Rd, Rn, ir, is) A64_BITFIELD(sf, Rd, Rn, ir, is, SIGNED)
100/* Unsigned, with zeros to left and right */
101#define A64_UBFM(sf, Rd, Rn, ir, is) A64_BITFIELD(sf, Rd, Rn, ir, is, UNSIGNED)
102
103/* Rd = Rn << shift */
104#define A64_LSL(sf, Rd, Rn, shift) ({ \
105 int sz = (sf) ? 64 : 32; \
106 A64_UBFM(sf, Rd, Rn, (unsigned)-(shift) % sz, sz - 1 - (shift)); \
107})
108/* Rd = Rn >> shift */
109#define A64_LSR(sf, Rd, Rn, shift) A64_UBFM(sf, Rd, Rn, shift, (sf) ? 63 : 31)
110/* Rd = Rn >> shift; signed */
111#define A64_ASR(sf, Rd, Rn, shift) A64_SBFM(sf, Rd, Rn, shift, (sf) ? 63 : 31)
112
113/* Move wide (immediate) */
114#define A64_MOVEW(sf, Rd, imm16, shift, type) \
115 aarch64_insn_gen_movewide(Rd, imm16, shift, \
116 A64_VARIANT(sf), AARCH64_INSN_MOVEWIDE_##type)
117/* Rd = Zeros (for MOVZ);
118 * Rd |= imm16 << shift (where shift is {0, 16, 32, 48});
119 * Rd = ~Rd; (for MOVN); */
120#define A64_MOVN(sf, Rd, imm16, shift) A64_MOVEW(sf, Rd, imm16, shift, INVERSE)
121#define A64_MOVZ(sf, Rd, imm16, shift) A64_MOVEW(sf, Rd, imm16, shift, ZERO)
122#define A64_MOVK(sf, Rd, imm16, shift) A64_MOVEW(sf, Rd, imm16, shift, KEEP)
123
124/* Add/subtract (shifted register) */
125#define A64_ADDSUB_SREG(sf, Rd, Rn, Rm, type) \
126 aarch64_insn_gen_add_sub_shifted_reg(Rd, Rn, Rm, 0, \
127 A64_VARIANT(sf), AARCH64_INSN_ADSB_##type)
128/* Rd = Rn OP Rm */
129#define A64_ADD(sf, Rd, Rn, Rm) A64_ADDSUB_SREG(sf, Rd, Rn, Rm, ADD)
130#define A64_SUB(sf, Rd, Rn, Rm) A64_ADDSUB_SREG(sf, Rd, Rn, Rm, SUB)
131#define A64_SUBS(sf, Rd, Rn, Rm) A64_ADDSUB_SREG(sf, Rd, Rn, Rm, SUB_SETFLAGS)
132/* Rd = -Rm */
133#define A64_NEG(sf, Rd, Rm) A64_SUB(sf, Rd, A64_ZR, Rm)
134/* Rn - Rm; set condition flags */
135#define A64_CMP(sf, Rn, Rm) A64_SUBS(sf, A64_ZR, Rn, Rm)
136
137/* Data-processing (1 source) */
138#define A64_DATA1(sf, Rd, Rn, type) aarch64_insn_gen_data1(Rd, Rn, \
139 A64_VARIANT(sf), AARCH64_INSN_DATA1_##type)
140/* Rd = BSWAPx(Rn) */
141#define A64_REV16(sf, Rd, Rn) A64_DATA1(sf, Rd, Rn, REVERSE_16)
142#define A64_REV32(sf, Rd, Rn) A64_DATA1(sf, Rd, Rn, REVERSE_32)
143#define A64_REV64(Rd, Rn) A64_DATA1(1, Rd, Rn, REVERSE_64)
144
145/* Data-processing (2 source) */
146/* Rd = Rn OP Rm */
147#define A64_UDIV(sf, Rd, Rn, Rm) aarch64_insn_gen_data2(Rd, Rn, Rm, \
148 A64_VARIANT(sf), AARCH64_INSN_DATA2_UDIV)
149
150/* Data-processing (3 source) */
151/* Rd = Ra + Rn * Rm */
152#define A64_MADD(sf, Rd, Ra, Rn, Rm) aarch64_insn_gen_data3(Rd, Ra, Rn, Rm, \
153 A64_VARIANT(sf), AARCH64_INSN_DATA3_MADD)
154/* Rd = Rn * Rm */
155#define A64_MUL(sf, Rd, Rn, Rm) A64_MADD(sf, Rd, A64_ZR, Rn, Rm)
156
157/* Logical (shifted register) */
158#define A64_LOGIC_SREG(sf, Rd, Rn, Rm, type) \
159 aarch64_insn_gen_logical_shifted_reg(Rd, Rn, Rm, 0, \
160 A64_VARIANT(sf), AARCH64_INSN_LOGIC_##type)
161/* Rd = Rn OP Rm */
162#define A64_AND(sf, Rd, Rn, Rm) A64_LOGIC_SREG(sf, Rd, Rn, Rm, AND)
163#define A64_ORR(sf, Rd, Rn, Rm) A64_LOGIC_SREG(sf, Rd, Rn, Rm, ORR)
164#define A64_EOR(sf, Rd, Rn, Rm) A64_LOGIC_SREG(sf, Rd, Rn, Rm, EOR)
165#define A64_ANDS(sf, Rd, Rn, Rm) A64_LOGIC_SREG(sf, Rd, Rn, Rm, AND_SETFLAGS)
166/* Rn & Rm; set condition flags */
167#define A64_TST(sf, Rn, Rm) A64_ANDS(sf, A64_ZR, Rn, Rm)
168
169#endif /* _BPF_JIT_H */
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
new file mode 100644
index 000000000000..7ae33545535b
--- /dev/null
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -0,0 +1,679 @@
1/*
2 * BPF JIT compiler for ARM64
3 *
4 * Copyright (C) 2014 Zi Shen Lim <zlim.lnx@gmail.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 * 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#define pr_fmt(fmt) "bpf_jit: " fmt
20
21#include <linux/filter.h>
22#include <linux/moduleloader.h>
23#include <linux/printk.h>
24#include <linux/skbuff.h>
25#include <linux/slab.h>
26#include <asm/byteorder.h>
27#include <asm/cacheflush.h>
28
29#include "bpf_jit.h"
30
31int bpf_jit_enable __read_mostly;
32
33#define TMP_REG_1 (MAX_BPF_REG + 0)
34#define TMP_REG_2 (MAX_BPF_REG + 1)
35
36/* Map BPF registers to A64 registers */
37static const int bpf2a64[] = {
38 /* return value from in-kernel function, and exit value from eBPF */
39 [BPF_REG_0] = A64_R(7),
40 /* arguments from eBPF program to in-kernel function */
41 [BPF_REG_1] = A64_R(0),
42 [BPF_REG_2] = A64_R(1),
43 [BPF_REG_3] = A64_R(2),
44 [BPF_REG_4] = A64_R(3),
45 [BPF_REG_5] = A64_R(4),
46 /* callee saved registers that in-kernel function will preserve */
47 [BPF_REG_6] = A64_R(19),
48 [BPF_REG_7] = A64_R(20),
49 [BPF_REG_8] = A64_R(21),
50 [BPF_REG_9] = A64_R(22),
51 /* read-only frame pointer to access stack */
52 [BPF_REG_FP] = A64_FP,
53 /* temporary register for internal BPF JIT */
54 [TMP_REG_1] = A64_R(23),
55 [TMP_REG_2] = A64_R(24),
56};
57
58struct jit_ctx {
59 const struct bpf_prog *prog;
60 int idx;
61 int tmp_used;
62 int body_offset;
63 int *offset;
64 u32 *image;
65};
66
67static inline void emit(const u32 insn, struct jit_ctx *ctx)
68{
69 if (ctx->image != NULL)
70 ctx->image[ctx->idx] = cpu_to_le32(insn);
71
72 ctx->idx++;
73}
74
75static inline void emit_a64_mov_i64(const int reg, const u64 val,
76 struct jit_ctx *ctx)
77{
78 u64 tmp = val;
79 int shift = 0;
80
81 emit(A64_MOVZ(1, reg, tmp & 0xffff, shift), ctx);
82 tmp >>= 16;
83 shift += 16;
84 while (tmp) {
85 if (tmp & 0xffff)
86 emit(A64_MOVK(1, reg, tmp & 0xffff, shift), ctx);
87 tmp >>= 16;
88 shift += 16;
89 }
90}
91
92static inline void emit_a64_mov_i(const int is64, const int reg,
93 const s32 val, struct jit_ctx *ctx)
94{
95 u16 hi = val >> 16;
96 u16 lo = val & 0xffff;
97
98 if (hi & 0x8000) {
99 if (hi == 0xffff) {
100 emit(A64_MOVN(is64, reg, (u16)~lo, 0), ctx);
101 } else {
102 emit(A64_MOVN(is64, reg, (u16)~hi, 16), ctx);
103 emit(A64_MOVK(is64, reg, lo, 0), ctx);
104 }
105 } else {
106 emit(A64_MOVZ(is64, reg, lo, 0), ctx);
107 if (hi)
108 emit(A64_MOVK(is64, reg, hi, 16), ctx);
109 }
110}
111
112static inline int bpf2a64_offset(int bpf_to, int bpf_from,
113 const struct jit_ctx *ctx)
114{
115 int to = ctx->offset[bpf_to + 1];
116 /* -1 to account for the Branch instruction */
117 int from = ctx->offset[bpf_from + 1] - 1;
118
119 return to - from;
120}
121
122static inline int epilogue_offset(const struct jit_ctx *ctx)
123{
124 int to = ctx->offset[ctx->prog->len - 1];
125 int from = ctx->idx - ctx->body_offset;
126
127 return to - from;
128}
129
130/* Stack must be multiples of 16B */
131#define STACK_ALIGN(sz) (((sz) + 15) & ~15)
132
133static void build_prologue(struct jit_ctx *ctx)
134{
135 const u8 r6 = bpf2a64[BPF_REG_6];
136 const u8 r7 = bpf2a64[BPF_REG_7];
137 const u8 r8 = bpf2a64[BPF_REG_8];
138 const u8 r9 = bpf2a64[BPF_REG_9];
139 const u8 fp = bpf2a64[BPF_REG_FP];
140 const u8 ra = bpf2a64[BPF_REG_A];
141 const u8 rx = bpf2a64[BPF_REG_X];
142 const u8 tmp1 = bpf2a64[TMP_REG_1];
143 const u8 tmp2 = bpf2a64[TMP_REG_2];
144 int stack_size = MAX_BPF_STACK;
145
146 stack_size += 4; /* extra for skb_copy_bits buffer */
147 stack_size = STACK_ALIGN(stack_size);
148
149 /* Save callee-saved register */
150 emit(A64_PUSH(r6, r7, A64_SP), ctx);
151 emit(A64_PUSH(r8, r9, A64_SP), ctx);
152 if (ctx->tmp_used)
153 emit(A64_PUSH(tmp1, tmp2, A64_SP), ctx);
154
155 /* Set up BPF stack */
156 emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx);
157
158 /* Set up frame pointer */
159 emit(A64_MOV(1, fp, A64_SP), ctx);
160
161 /* Clear registers A and X */
162 emit_a64_mov_i64(ra, 0, ctx);
163 emit_a64_mov_i64(rx, 0, ctx);
164}
165
166static void build_epilogue(struct jit_ctx *ctx)
167{
168 const u8 r0 = bpf2a64[BPF_REG_0];
169 const u8 r6 = bpf2a64[BPF_REG_6];
170 const u8 r7 = bpf2a64[BPF_REG_7];
171 const u8 r8 = bpf2a64[BPF_REG_8];
172 const u8 r9 = bpf2a64[BPF_REG_9];
173 const u8 fp = bpf2a64[BPF_REG_FP];
174 const u8 tmp1 = bpf2a64[TMP_REG_1];
175 const u8 tmp2 = bpf2a64[TMP_REG_2];
176 int stack_size = MAX_BPF_STACK;
177
178 stack_size += 4; /* extra for skb_copy_bits buffer */
179 stack_size = STACK_ALIGN(stack_size);
180
181 /* We're done with BPF stack */
182 emit(A64_ADD_I(1, A64_SP, A64_SP, stack_size), ctx);
183
184 /* Restore callee-saved register */
185 if (ctx->tmp_used)
186 emit(A64_POP(tmp1, tmp2, A64_SP), ctx);
187 emit(A64_POP(r8, r9, A64_SP), ctx);
188 emit(A64_POP(r6, r7, A64_SP), ctx);
189
190 /* Restore frame pointer */
191 emit(A64_MOV(1, fp, A64_SP), ctx);
192
193 /* Set return value */
194 emit(A64_MOV(1, A64_R(0), r0), ctx);
195
196 emit(A64_RET(A64_LR), ctx);
197}
198
199static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
200{
201 const u8 code = insn->code;
202 const u8 dst = bpf2a64[insn->dst_reg];
203 const u8 src = bpf2a64[insn->src_reg];
204 const u8 tmp = bpf2a64[TMP_REG_1];
205 const u8 tmp2 = bpf2a64[TMP_REG_2];
206 const s16 off = insn->off;
207 const s32 imm = insn->imm;
208 const int i = insn - ctx->prog->insnsi;
209 const bool is64 = BPF_CLASS(code) == BPF_ALU64;
210 u8 jmp_cond;
211 s32 jmp_offset;
212
213 switch (code) {
214 /* dst = src */
215 case BPF_ALU | BPF_MOV | BPF_X:
216 case BPF_ALU64 | BPF_MOV | BPF_X:
217 emit(A64_MOV(is64, dst, src), ctx);
218 break;
219 /* dst = dst OP src */
220 case BPF_ALU | BPF_ADD | BPF_X:
221 case BPF_ALU64 | BPF_ADD | BPF_X:
222 emit(A64_ADD(is64, dst, dst, src), ctx);
223 break;
224 case BPF_ALU | BPF_SUB | BPF_X:
225 case BPF_ALU64 | BPF_SUB | BPF_X:
226 emit(A64_SUB(is64, dst, dst, src), ctx);
227 break;
228 case BPF_ALU | BPF_AND | BPF_X:
229 case BPF_ALU64 | BPF_AND | BPF_X:
230 emit(A64_AND(is64, dst, dst, src), ctx);
231 break;
232 case BPF_ALU | BPF_OR | BPF_X:
233 case BPF_ALU64 | BPF_OR | BPF_X:
234 emit(A64_ORR(is64, dst, dst, src), ctx);
235 break;
236 case BPF_ALU | BPF_XOR | BPF_X:
237 case BPF_ALU64 | BPF_XOR | BPF_X:
238 emit(A64_EOR(is64, dst, dst, src), ctx);
239 break;
240 case BPF_ALU | BPF_MUL | BPF_X:
241 case BPF_ALU64 | BPF_MUL | BPF_X:
242 emit(A64_MUL(is64, dst, dst, src), ctx);
243 break;
244 case BPF_ALU | BPF_DIV | BPF_X:
245 case BPF_ALU64 | BPF_DIV | BPF_X:
246 emit(A64_UDIV(is64, dst, dst, src), ctx);
247 break;
248 case BPF_ALU | BPF_MOD | BPF_X:
249 case BPF_ALU64 | BPF_MOD | BPF_X:
250 ctx->tmp_used = 1;
251 emit(A64_UDIV(is64, tmp, dst, src), ctx);
252 emit(A64_MUL(is64, tmp, tmp, src), ctx);
253 emit(A64_SUB(is64, dst, dst, tmp), ctx);
254 break;
255 /* dst = -dst */
256 case BPF_ALU | BPF_NEG:
257 case BPF_ALU64 | BPF_NEG:
258 emit(A64_NEG(is64, dst, dst), ctx);
259 break;
260 /* dst = BSWAP##imm(dst) */
261 case BPF_ALU | BPF_END | BPF_FROM_LE:
262 case BPF_ALU | BPF_END | BPF_FROM_BE:
263#ifdef CONFIG_CPU_BIG_ENDIAN
264 if (BPF_SRC(code) == BPF_FROM_BE)
265 break;
266#else /* !CONFIG_CPU_BIG_ENDIAN */
267 if (BPF_SRC(code) == BPF_FROM_LE)
268 break;
269#endif
270 switch (imm) {
271 case 16:
272 emit(A64_REV16(is64, dst, dst), ctx);
273 break;
274 case 32:
275 emit(A64_REV32(is64, dst, dst), ctx);
276 break;
277 case 64:
278 emit(A64_REV64(dst, dst), ctx);
279 break;
280 }
281 break;
282 /* dst = imm */
283 case BPF_ALU | BPF_MOV | BPF_K:
284 case BPF_ALU64 | BPF_MOV | BPF_K:
285 emit_a64_mov_i(is64, dst, imm, ctx);
286 break;
287 /* dst = dst OP imm */
288 case BPF_ALU | BPF_ADD | BPF_K:
289 case BPF_ALU64 | BPF_ADD | BPF_K:
290 ctx->tmp_used = 1;
291 emit_a64_mov_i(is64, tmp, imm, ctx);
292 emit(A64_ADD(is64, dst, dst, tmp), ctx);
293 break;
294 case BPF_ALU | BPF_SUB | BPF_K:
295 case BPF_ALU64 | BPF_SUB | BPF_K:
296 ctx->tmp_used = 1;
297 emit_a64_mov_i(is64, tmp, imm, ctx);
298 emit(A64_SUB(is64, dst, dst, tmp), ctx);
299 break;
300 case BPF_ALU | BPF_AND | BPF_K:
301 case BPF_ALU64 | BPF_AND | BPF_K:
302 ctx->tmp_used = 1;
303 emit_a64_mov_i(is64, tmp, imm, ctx);
304 emit(A64_AND(is64, dst, dst, tmp), ctx);
305 break;
306 case BPF_ALU | BPF_OR | BPF_K:
307 case BPF_ALU64 | BPF_OR | BPF_K:
308 ctx->tmp_used = 1;
309 emit_a64_mov_i(is64, tmp, imm, ctx);
310 emit(A64_ORR(is64, dst, dst, tmp), ctx);
311 break;
312 case BPF_ALU | BPF_XOR | BPF_K:
313 case BPF_ALU64 | BPF_XOR | BPF_K:
314 ctx->tmp_used = 1;
315 emit_a64_mov_i(is64, tmp, imm, ctx);
316 emit(A64_EOR(is64, dst, dst, tmp), ctx);
317 break;
318 case BPF_ALU | BPF_MUL | BPF_K:
319 case BPF_ALU64 | BPF_MUL | BPF_K:
320 ctx->tmp_used = 1;
321 emit_a64_mov_i(is64, tmp, imm, ctx);
322 emit(A64_MUL(is64, dst, dst, tmp), ctx);
323 break;
324 case BPF_ALU | BPF_DIV | BPF_K:
325 case BPF_ALU64 | BPF_DIV | BPF_K:
326 ctx->tmp_used = 1;
327 emit_a64_mov_i(is64, tmp, imm, ctx);
328 emit(A64_UDIV(is64, dst, dst, tmp), ctx);
329 break;
330 case BPF_ALU | BPF_MOD | BPF_K:
331 case BPF_ALU64 | BPF_MOD | BPF_K:
332 ctx->tmp_used = 1;
333 emit_a64_mov_i(is64, tmp2, imm, ctx);
334 emit(A64_UDIV(is64, tmp, dst, tmp2), ctx);
335 emit(A64_MUL(is64, tmp, tmp, tmp2), ctx);
336 emit(A64_SUB(is64, dst, dst, tmp), ctx);
337 break;
338 case BPF_ALU | BPF_LSH | BPF_K:
339 case BPF_ALU64 | BPF_LSH | BPF_K:
340 emit(A64_LSL(is64, dst, dst, imm), ctx);
341 break;
342 case BPF_ALU | BPF_RSH | BPF_K:
343 case BPF_ALU64 | BPF_RSH | BPF_K:
344 emit(A64_LSR(is64, dst, dst, imm), ctx);
345 break;
346 case BPF_ALU | BPF_ARSH | BPF_K:
347 case BPF_ALU64 | BPF_ARSH | BPF_K:
348 emit(A64_ASR(is64, dst, dst, imm), ctx);
349 break;
350
351#define check_imm(bits, imm) do { \
352 if ((((imm) > 0) && ((imm) >> (bits))) || \
353 (((imm) < 0) && (~(imm) >> (bits)))) { \
354 pr_info("[%2d] imm=%d(0x%x) out of range\n", \
355 i, imm, imm); \
356 return -EINVAL; \
357 } \
358} while (0)
359#define check_imm19(imm) check_imm(19, imm)
360#define check_imm26(imm) check_imm(26, imm)
361
362 /* JUMP off */
363 case BPF_JMP | BPF_JA:
364 jmp_offset = bpf2a64_offset(i + off, i, ctx);
365 check_imm26(jmp_offset);
366 emit(A64_B(jmp_offset), ctx);
367 break;
368 /* IF (dst COND src) JUMP off */
369 case BPF_JMP | BPF_JEQ | BPF_X:
370 case BPF_JMP | BPF_JGT | BPF_X:
371 case BPF_JMP | BPF_JGE | BPF_X:
372 case BPF_JMP | BPF_JNE | BPF_X:
373 case BPF_JMP | BPF_JSGT | BPF_X:
374 case BPF_JMP | BPF_JSGE | BPF_X:
375 emit(A64_CMP(1, dst, src), ctx);
376emit_cond_jmp:
377 jmp_offset = bpf2a64_offset(i + off, i, ctx);
378 check_imm19(jmp_offset);
379 switch (BPF_OP(code)) {
380 case BPF_JEQ:
381 jmp_cond = A64_COND_EQ;
382 break;
383 case BPF_JGT:
384 jmp_cond = A64_COND_HI;
385 break;
386 case BPF_JGE:
387 jmp_cond = A64_COND_CS;
388 break;
389 case BPF_JNE:
390 jmp_cond = A64_COND_NE;
391 break;
392 case BPF_JSGT:
393 jmp_cond = A64_COND_GT;
394 break;
395 case BPF_JSGE:
396 jmp_cond = A64_COND_GE;
397 break;
398 default:
399 return -EFAULT;
400 }
401 emit(A64_B_(jmp_cond, jmp_offset), ctx);
402 break;
403 case BPF_JMP | BPF_JSET | BPF_X:
404 emit(A64_TST(1, dst, src), ctx);
405 goto emit_cond_jmp;
406 /* IF (dst COND imm) JUMP off */
407 case BPF_JMP | BPF_JEQ | BPF_K:
408 case BPF_JMP | BPF_JGT | BPF_K:
409 case BPF_JMP | BPF_JGE | BPF_K:
410 case BPF_JMP | BPF_JNE | BPF_K:
411 case BPF_JMP | BPF_JSGT | BPF_K:
412 case BPF_JMP | BPF_JSGE | BPF_K:
413 ctx->tmp_used = 1;
414 emit_a64_mov_i(1, tmp, imm, ctx);
415 emit(A64_CMP(1, dst, tmp), ctx);
416 goto emit_cond_jmp;
417 case BPF_JMP | BPF_JSET | BPF_K:
418 ctx->tmp_used = 1;
419 emit_a64_mov_i(1, tmp, imm, ctx);
420 emit(A64_TST(1, dst, tmp), ctx);
421 goto emit_cond_jmp;
422 /* function call */
423 case BPF_JMP | BPF_CALL:
424 {
425 const u8 r0 = bpf2a64[BPF_REG_0];
426 const u64 func = (u64)__bpf_call_base + imm;
427
428 ctx->tmp_used = 1;
429 emit_a64_mov_i64(tmp, func, ctx);
430 emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
431 emit(A64_MOV(1, A64_FP, A64_SP), ctx);
432 emit(A64_BLR(tmp), ctx);
433 emit(A64_MOV(1, r0, A64_R(0)), ctx);
434 emit(A64_POP(A64_FP, A64_LR, A64_SP), ctx);
435 break;
436 }
437 /* function return */
438 case BPF_JMP | BPF_EXIT:
439 if (i == ctx->prog->len - 1)
440 break;
441 jmp_offset = epilogue_offset(ctx);
442 check_imm26(jmp_offset);
443 emit(A64_B(jmp_offset), ctx);
444 break;
445
446 /* LDX: dst = *(size *)(src + off) */
447 case BPF_LDX | BPF_MEM | BPF_W:
448 case BPF_LDX | BPF_MEM | BPF_H:
449 case BPF_LDX | BPF_MEM | BPF_B:
450 case BPF_LDX | BPF_MEM | BPF_DW:
451 ctx->tmp_used = 1;
452 emit_a64_mov_i(1, tmp, off, ctx);
453 switch (BPF_SIZE(code)) {
454 case BPF_W:
455 emit(A64_LDR32(dst, src, tmp), ctx);
456 break;
457 case BPF_H:
458 emit(A64_LDRH(dst, src, tmp), ctx);
459 break;
460 case BPF_B:
461 emit(A64_LDRB(dst, src, tmp), ctx);
462 break;
463 case BPF_DW:
464 emit(A64_LDR64(dst, src, tmp), ctx);
465 break;
466 }
467 break;
468
469 /* ST: *(size *)(dst + off) = imm */
470 case BPF_ST | BPF_MEM | BPF_W:
471 case BPF_ST | BPF_MEM | BPF_H:
472 case BPF_ST | BPF_MEM | BPF_B:
473 case BPF_ST | BPF_MEM | BPF_DW:
474 goto notyet;
475
476 /* STX: *(size *)(dst + off) = src */
477 case BPF_STX | BPF_MEM | BPF_W:
478 case BPF_STX | BPF_MEM | BPF_H:
479 case BPF_STX | BPF_MEM | BPF_B:
480 case BPF_STX | BPF_MEM | BPF_DW:
481 ctx->tmp_used = 1;
482 emit_a64_mov_i(1, tmp, off, ctx);
483 switch (BPF_SIZE(code)) {
484 case BPF_W:
485 emit(A64_STR32(src, dst, tmp), ctx);
486 break;
487 case BPF_H:
488 emit(A64_STRH(src, dst, tmp), ctx);
489 break;
490 case BPF_B:
491 emit(A64_STRB(src, dst, tmp), ctx);
492 break;
493 case BPF_DW:
494 emit(A64_STR64(src, dst, tmp), ctx);
495 break;
496 }
497 break;
498 /* STX XADD: lock *(u32 *)(dst + off) += src */
499 case BPF_STX | BPF_XADD | BPF_W:
500 /* STX XADD: lock *(u64 *)(dst + off) += src */
501 case BPF_STX | BPF_XADD | BPF_DW:
502 goto notyet;
503
504 /* R0 = ntohx(*(size *)(((struct sk_buff *)R6)->data + imm)) */
505 case BPF_LD | BPF_ABS | BPF_W:
506 case BPF_LD | BPF_ABS | BPF_H:
507 case BPF_LD | BPF_ABS | BPF_B:
508 /* R0 = ntohx(*(size *)(((struct sk_buff *)R6)->data + src + imm)) */
509 case BPF_LD | BPF_IND | BPF_W:
510 case BPF_LD | BPF_IND | BPF_H:
511 case BPF_LD | BPF_IND | BPF_B:
512 {
513 const u8 r0 = bpf2a64[BPF_REG_0]; /* r0 = return value */
514 const u8 r6 = bpf2a64[BPF_REG_6]; /* r6 = pointer to sk_buff */
515 const u8 fp = bpf2a64[BPF_REG_FP];
516 const u8 r1 = bpf2a64[BPF_REG_1]; /* r1: struct sk_buff *skb */
517 const u8 r2 = bpf2a64[BPF_REG_2]; /* r2: int k */
518 const u8 r3 = bpf2a64[BPF_REG_3]; /* r3: unsigned int size */
519 const u8 r4 = bpf2a64[BPF_REG_4]; /* r4: void *buffer */
520 const u8 r5 = bpf2a64[BPF_REG_5]; /* r5: void *(*func)(...) */
521 int size;
522
523 emit(A64_MOV(1, r1, r6), ctx);
524 emit_a64_mov_i(0, r2, imm, ctx);
525 if (BPF_MODE(code) == BPF_IND)
526 emit(A64_ADD(0, r2, r2, src), ctx);
527 switch (BPF_SIZE(code)) {
528 case BPF_W:
529 size = 4;
530 break;
531 case BPF_H:
532 size = 2;
533 break;
534 case BPF_B:
535 size = 1;
536 break;
537 default:
538 return -EINVAL;
539 }
540 emit_a64_mov_i64(r3, size, ctx);
541 emit(A64_ADD_I(1, r4, fp, MAX_BPF_STACK), ctx);
542 emit_a64_mov_i64(r5, (unsigned long)bpf_load_pointer, ctx);
543 emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
544 emit(A64_MOV(1, A64_FP, A64_SP), ctx);
545 emit(A64_BLR(r5), ctx);
546 emit(A64_MOV(1, r0, A64_R(0)), ctx);
547 emit(A64_POP(A64_FP, A64_LR, A64_SP), ctx);
548
549 jmp_offset = epilogue_offset(ctx);
550 check_imm19(jmp_offset);
551 emit(A64_CBZ(1, r0, jmp_offset), ctx);
552 emit(A64_MOV(1, r5, r0), ctx);
553 switch (BPF_SIZE(code)) {
554 case BPF_W:
555 emit(A64_LDR32(r0, r5, A64_ZR), ctx);
556#ifndef CONFIG_CPU_BIG_ENDIAN
557 emit(A64_REV32(0, r0, r0), ctx);
558#endif
559 break;
560 case BPF_H:
561 emit(A64_LDRH(r0, r5, A64_ZR), ctx);
562#ifndef CONFIG_CPU_BIG_ENDIAN
563 emit(A64_REV16(0, r0, r0), ctx);
564#endif
565 break;
566 case BPF_B:
567 emit(A64_LDRB(r0, r5, A64_ZR), ctx);
568 break;
569 }
570 break;
571 }
572notyet:
573 pr_info_once("*** NOT YET: opcode %02x ***\n", code);
574 return -EFAULT;
575
576 default:
577 pr_err_once("unknown opcode %02x\n", code);
578 return -EINVAL;
579 }
580
581 return 0;
582}
583
584static int build_body(struct jit_ctx *ctx)
585{
586 const struct bpf_prog *prog = ctx->prog;
587 int i;
588
589 for (i = 0; i < prog->len; i++) {
590 const struct bpf_insn *insn = &prog->insnsi[i];
591 int ret;
592
593 if (ctx->image == NULL)
594 ctx->offset[i] = ctx->idx;
595
596 ret = build_insn(insn, ctx);
597 if (ret)
598 return ret;
599 }
600
601 return 0;
602}
603
604static inline void bpf_flush_icache(void *start, void *end)
605{
606 flush_icache_range((unsigned long)start, (unsigned long)end);
607}
608
609void bpf_jit_compile(struct bpf_prog *prog)
610{
611 /* Nothing to do here. We support Internal BPF. */
612}
613
614void bpf_int_jit_compile(struct bpf_prog *prog)
615{
616 struct jit_ctx ctx;
617 int image_size;
618
619 if (!bpf_jit_enable)
620 return;
621
622 if (!prog || !prog->len)
623 return;
624
625 memset(&ctx, 0, sizeof(ctx));
626 ctx.prog = prog;
627
628 ctx.offset = kcalloc(prog->len, sizeof(int), GFP_KERNEL);
629 if (ctx.offset == NULL)
630 return;
631
632 /* 1. Initial fake pass to compute ctx->idx. */
633
634 /* Fake pass to fill in ctx->offset. */
635 if (build_body(&ctx))
636 goto out;
637
638 build_prologue(&ctx);
639
640 build_epilogue(&ctx);
641
642 /* Now we know the actual image size. */
643 image_size = sizeof(u32) * ctx.idx;
644 ctx.image = module_alloc(image_size);
645 if (unlikely(ctx.image == NULL))
646 goto out;
647
648 /* 2. Now, the actual pass. */
649
650 ctx.idx = 0;
651 build_prologue(&ctx);
652
653 ctx.body_offset = ctx.idx;
654 if (build_body(&ctx)) {
655 module_free(NULL, ctx.image);
656 goto out;
657 }
658
659 build_epilogue(&ctx);
660
661 /* And we're done. */
662 if (bpf_jit_enable > 1)
663 bpf_jit_dump(prog->len, image_size, 2, ctx.image);
664
665 bpf_flush_icache(ctx.image, ctx.image + ctx.idx);
666 prog->bpf_func = (void *)ctx.image;
667 prog->jited = 1;
668
669out:
670 kfree(ctx.offset);
671}
672
673void bpf_jit_free(struct bpf_prog *prog)
674{
675 if (prog->jited)
676 module_free(NULL, prog->bpf_func);
677
678 kfree(prog);
679}
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 00a0f3ccd6eb..2a71b1cb9848 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -9,6 +9,7 @@ generic-y += exec.h
9generic-y += futex.h 9generic-y += futex.h
10generic-y += hash.h 10generic-y += hash.h
11generic-y += irq_regs.h 11generic-y += irq_regs.h
12generic-y += irq_work.h
12generic-y += local.h 13generic-y += local.h
13generic-y += local64.h 14generic-y += local64.h
14generic-y += mcs_spinlock.h 15generic-y += mcs_spinlock.h
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index ed30699cc635..af76634f8d98 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -671,7 +671,7 @@ config TICKSOURCE_CORETMR
671 default y 671 default y
672endmenu 672endmenu
673 673
674menu "Clock souce" 674menu "Clock source"
675 depends on GENERIC_CLOCKEVENTS 675 depends on GENERIC_CLOCKEVENTS
676config CYCLES_CLOCKSOURCE 676config CYCLES_CLOCKSOURCE
677 bool "CYCLES" 677 bool "CYCLES"
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index 0d93b9a79ca9..46ed6bb9c679 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -15,6 +15,7 @@ generic-y += hw_irq.h
15generic-y += ioctl.h 15generic-y += ioctl.h
16generic-y += ipcbuf.h 16generic-y += ipcbuf.h
17generic-y += irq_regs.h 17generic-y += irq_regs.h
18generic-y += irq_work.h
18generic-y += kdebug.h 19generic-y += kdebug.h
19generic-y += kmap_types.h 20generic-y += kmap_types.h
20generic-y += kvm_para.h 21generic-y += kvm_para.h
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537e.c b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
index 1e7290ef3525..1e1014df5e9e 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537e.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
@@ -733,7 +733,6 @@ static struct platform_device bfin_mac_device = {
733 733
734static struct pata_platform_info bfin_pata_platform_data = { 734static struct pata_platform_info bfin_pata_platform_data = {
735 .ioport_shift = 2, 735 .ioport_shift = 2,
736 .irq_type = IRQF_TRIGGER_HIGH,
737}; 736};
738 737
739static struct resource bfin_pata_resources[] = { 738static struct resource bfin_pata_resources[] = {
@@ -750,7 +749,7 @@ static struct resource bfin_pata_resources[] = {
750 { 749 {
751 .start = PATA_INT, 750 .start = PATA_INT,
752 .end = PATA_INT, 751 .end = PATA_INT,
753 .flags = IORESOURCE_IRQ, 752 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
754 }, 753 },
755}; 754};
756 755
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537u.c b/arch/blackfin/mach-bf537/boards/cm_bf537u.c
index c7495dc74690..d056db9e5592 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537u.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537u.c
@@ -587,7 +587,6 @@ static struct platform_device bfin_mac_device = {
587 587
588static struct pata_platform_info bfin_pata_platform_data = { 588static struct pata_platform_info bfin_pata_platform_data = {
589 .ioport_shift = 2, 589 .ioport_shift = 2,
590 .irq_type = IRQF_TRIGGER_HIGH,
591}; 590};
592 591
593static struct resource bfin_pata_resources[] = { 592static struct resource bfin_pata_resources[] = {
@@ -604,7 +603,7 @@ static struct resource bfin_pata_resources[] = {
604 { 603 {
605 .start = PATA_INT, 604 .start = PATA_INT,
606 .end = PATA_INT, 605 .end = PATA_INT,
607 .flags = IORESOURCE_IRQ, 606 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
608 }, 607 },
609}; 608};
610 609
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index de19b8a56007..88a19fc9844d 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -2462,7 +2462,6 @@ static struct platform_device bfin_sport0_device = {
2462#define PATA_INT IRQ_PF5 2462#define PATA_INT IRQ_PF5
2463static struct pata_platform_info bfin_pata_platform_data = { 2463static struct pata_platform_info bfin_pata_platform_data = {
2464 .ioport_shift = 1, 2464 .ioport_shift = 1,
2465 .irq_flags = IRQF_TRIGGER_HIGH,
2466}; 2465};
2467 2466
2468static struct resource bfin_pata_resources[] = { 2467static struct resource bfin_pata_resources[] = {
@@ -2479,7 +2478,7 @@ static struct resource bfin_pata_resources[] = {
2479 { 2478 {
2480 .start = PATA_INT, 2479 .start = PATA_INT,
2481 .end = PATA_INT, 2480 .end = PATA_INT,
2482 .flags = IORESOURCE_IRQ, 2481 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
2483 }, 2482 },
2484}; 2483};
2485#elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE) 2484#elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
index 6b988ad653d8..ed309c9a62b6 100644
--- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
@@ -589,7 +589,6 @@ static struct platform_device bfin_mac_device = {
589 589
590static struct pata_platform_info bfin_pata_platform_data = { 590static struct pata_platform_info bfin_pata_platform_data = {
591 .ioport_shift = 2, 591 .ioport_shift = 2,
592 .irq_type = IRQF_TRIGGER_HIGH,
593}; 592};
594 593
595static struct resource bfin_pata_resources[] = { 594static struct resource bfin_pata_resources[] = {
@@ -606,7 +605,7 @@ static struct resource bfin_pata_resources[] = {
606 { 605 {
607 .start = PATA_INT, 606 .start = PATA_INT,
608 .end = PATA_INT, 607 .end = PATA_INT,
609 .flags = IORESOURCE_IRQ, 608 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
610 }, 609 },
611}; 610};
612 611
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index e862f7823e68..c6db52ba3a06 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -354,7 +354,6 @@ static struct platform_device bfin_sir0_device = {
354 354
355static struct pata_platform_info bfin_pata_platform_data = { 355static struct pata_platform_info bfin_pata_platform_data = {
356 .ioport_shift = 2, 356 .ioport_shift = 2,
357 .irq_type = IRQF_TRIGGER_HIGH,
358}; 357};
359 358
360static struct resource bfin_pata_resources[] = { 359static struct resource bfin_pata_resources[] = {
@@ -371,7 +370,7 @@ static struct resource bfin_pata_resources[] = {
371 { 370 {
372 .start = PATA_INT, 371 .start = PATA_INT,
373 .end = PATA_INT, 372 .end = PATA_INT,
374 .flags = IORESOURCE_IRQ, 373 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
375 }, 374 },
376}; 375};
377 376
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 1f94784eab6d..694619365265 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -455,7 +455,7 @@ void handle_sec_sci_fault(uint32_t gstat)
455 printk(KERN_DEBUG "sec ack err\n"); 455 printk(KERN_DEBUG "sec ack err\n");
456 break; 456 break;
457 default: 457 default:
458 printk(KERN_DEBUG "sec sci unknow err\n"); 458 printk(KERN_DEBUG "sec sci unknown err\n");
459 } 459 }
460 } 460 }
461 461
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index 8dbdce8421b0..e77e0c1dbe75 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -22,6 +22,7 @@ generic-y += ioctl.h
22generic-y += ioctls.h 22generic-y += ioctls.h
23generic-y += ipcbuf.h 23generic-y += ipcbuf.h
24generic-y += irq_regs.h 24generic-y += irq_regs.h
25generic-y += irq_work.h
25generic-y += kdebug.h 26generic-y += kdebug.h
26generic-y += kmap_types.h 27generic-y += kmap_types.h
27generic-y += local.h 28generic-y += local.h
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 31742dfadff9..2ca489eaadd3 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -8,12 +8,14 @@ generic-y += clkdev.h
8generic-y += cputime.h 8generic-y += cputime.h
9generic-y += exec.h 9generic-y += exec.h
10generic-y += hash.h 10generic-y += hash.h
11generic-y += irq_work.h
11generic-y += kvm_para.h 12generic-y += kvm_para.h
12generic-y += linkage.h 13generic-y += linkage.h
13generic-y += mcs_spinlock.h 14generic-y += mcs_spinlock.h
14generic-y += module.h 15generic-y += module.h
15generic-y += preempt.h 16generic-y += preempt.h
16generic-y += scatterlist.h 17generic-y += scatterlist.h
18generic-y += sections.h
17generic-y += trace_clock.h 19generic-y += trace_clock.h
18generic-y += vga.h 20generic-y += vga.h
19generic-y += xor.h 21generic-y += xor.h
diff --git a/arch/cris/include/asm/sections.h b/arch/cris/include/asm/sections.h
deleted file mode 100644
index 2c998ce8967b..000000000000
--- a/arch/cris/include/asm/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _CRIS_SECTIONS_H
2#define _CRIS_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7#endif
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild
index 5b73921b6e9d..3caf05cabfc5 100644
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/include/asm/Kbuild
@@ -3,6 +3,7 @@ generic-y += clkdev.h
3generic-y += cputime.h 3generic-y += cputime.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += hash.h 5generic-y += hash.h
6generic-y += irq_work.h
6generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
7generic-y += preempt.h 8generic-y += preempt.h
8generic-y += scatterlist.h 9generic-y += scatterlist.h
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h
index a34f309e5801..ae8d423e79d9 100644
--- a/arch/frv/include/asm/processor.h
+++ b/arch/frv/include/asm/processor.h
@@ -35,22 +35,6 @@
35struct task_struct; 35struct task_struct;
36 36
37/* 37/*
38 * CPU type and hardware bug flags. Kept separately for each CPU.
39 */
40struct cpuinfo_frv {
41#ifdef CONFIG_MMU
42 unsigned long *pgd_quick;
43 unsigned long *pte_quick;
44 unsigned long pgtable_cache_sz;
45#endif
46} __cacheline_aligned;
47
48extern struct cpuinfo_frv __nongprelbss boot_cpu_data;
49
50#define cpu_data (&boot_cpu_data)
51#define current_cpu_data boot_cpu_data
52
53/*
54 * Bus types 38 * Bus types
55 */ 39 */
56#define EISA_bus 0 40#define EISA_bus 0
@@ -129,7 +113,8 @@ unsigned long get_wchan(struct task_struct *p);
129#define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) 113#define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc)
130#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) 114#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp)
131 115
132#define cpu_relax() barrier() 116#define cpu_relax() barrier()
117#define cpu_relax_lowlatency() cpu_relax()
133 118
134/* data cache prefetch */ 119/* data cache prefetch */
135#define ARCH_HAS_PREFETCH 120#define ARCH_HAS_PREFETCH
diff --git a/arch/frv/kernel/irq-mb93091.c b/arch/frv/kernel/irq-mb93091.c
index 2cc327a1ca44..091b2839be90 100644
--- a/arch/frv/kernel/irq-mb93091.c
+++ b/arch/frv/kernel/irq-mb93091.c
@@ -107,25 +107,25 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask)
107static struct irqaction fpga_irq[4] = { 107static struct irqaction fpga_irq[4] = {
108 [0] = { 108 [0] = {
109 .handler = fpga_interrupt, 109 .handler = fpga_interrupt,
110 .flags = IRQF_DISABLED | IRQF_SHARED, 110 .flags = IRQF_SHARED,
111 .name = "fpga.0", 111 .name = "fpga.0",
112 .dev_id = (void *) 0x0028UL, 112 .dev_id = (void *) 0x0028UL,
113 }, 113 },
114 [1] = { 114 [1] = {
115 .handler = fpga_interrupt, 115 .handler = fpga_interrupt,
116 .flags = IRQF_DISABLED | IRQF_SHARED, 116 .flags = IRQF_SHARED,
117 .name = "fpga.1", 117 .name = "fpga.1",
118 .dev_id = (void *) 0x0050UL, 118 .dev_id = (void *) 0x0050UL,
119 }, 119 },
120 [2] = { 120 [2] = {
121 .handler = fpga_interrupt, 121 .handler = fpga_interrupt,
122 .flags = IRQF_DISABLED | IRQF_SHARED, 122 .flags = IRQF_SHARED,
123 .name = "fpga.2", 123 .name = "fpga.2",
124 .dev_id = (void *) 0x1c00UL, 124 .dev_id = (void *) 0x1c00UL,
125 }, 125 },
126 [3] = { 126 [3] = {
127 .handler = fpga_interrupt, 127 .handler = fpga_interrupt,
128 .flags = IRQF_DISABLED | IRQF_SHARED, 128 .flags = IRQF_SHARED,
129 .name = "fpga.3", 129 .name = "fpga.3",
130 .dev_id = (void *) 0x6386UL, 130 .dev_id = (void *) 0x6386UL,
131 } 131 }
diff --git a/arch/frv/kernel/irq-mb93093.c b/arch/frv/kernel/irq-mb93093.c
index 95e4eb4f1f38..1f3015cf80f5 100644
--- a/arch/frv/kernel/irq-mb93093.c
+++ b/arch/frv/kernel/irq-mb93093.c
@@ -105,7 +105,6 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask)
105static struct irqaction fpga_irq[1] = { 105static struct irqaction fpga_irq[1] = {
106 [0] = { 106 [0] = {
107 .handler = fpga_interrupt, 107 .handler = fpga_interrupt,
108 .flags = IRQF_DISABLED,
109 .name = "fpga.0", 108 .name = "fpga.0",
110 .dev_id = (void *) 0x0700UL, 109 .dev_id = (void *) 0x0700UL,
111 } 110 }
diff --git a/arch/frv/kernel/irq-mb93493.c b/arch/frv/kernel/irq-mb93493.c
index ba648da0932d..8ca5aa4ff595 100644
--- a/arch/frv/kernel/irq-mb93493.c
+++ b/arch/frv/kernel/irq-mb93493.c
@@ -118,13 +118,13 @@ static irqreturn_t mb93493_interrupt(int irq, void *_piqsr)
118static struct irqaction mb93493_irq[2] = { 118static struct irqaction mb93493_irq[2] = {
119 [0] = { 119 [0] = {
120 .handler = mb93493_interrupt, 120 .handler = mb93493_interrupt,
121 .flags = IRQF_DISABLED | IRQF_SHARED, 121 .flags = IRQF_SHARED,
122 .name = "mb93493.0", 122 .name = "mb93493.0",
123 .dev_id = (void *) __addr_MB93493_IQSR(0), 123 .dev_id = (void *) __addr_MB93493_IQSR(0),
124 }, 124 },
125 [1] = { 125 [1] = {
126 .handler = mb93493_interrupt, 126 .handler = mb93493_interrupt,
127 .flags = IRQF_DISABLED | IRQF_SHARED, 127 .flags = IRQF_SHARED,
128 .name = "mb93493.1", 128 .name = "mb93493.1",
129 .dev_id = (void *) __addr_MB93493_IQSR(1), 129 .dev_id = (void *) __addr_MB93493_IQSR(1),
130 } 130 }
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 9f3a7a62d787..9f4a9a607dbe 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -104,8 +104,6 @@ unsigned long __nongprelbss dma_coherent_mem_end;
104unsigned long __initdata __sdram_old_base; 104unsigned long __initdata __sdram_old_base;
105unsigned long __initdata num_mappedpages; 105unsigned long __initdata num_mappedpages;
106 106
107struct cpuinfo_frv __nongprelbss boot_cpu_data;
108
109char __initdata command_line[COMMAND_LINE_SIZE]; 107char __initdata command_line[COMMAND_LINE_SIZE];
110char __initdata redboot_command_line[COMMAND_LINE_SIZE]; 108char __initdata redboot_command_line[COMMAND_LINE_SIZE];
111 109
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index b457de496b70..332e00bf9d06 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -44,7 +44,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy);
44 44
45static struct irqaction timer_irq = { 45static struct irqaction timer_irq = {
46 .handler = timer_interrupt, 46 .handler = timer_interrupt,
47 .flags = IRQF_DISABLED,
48 .name = "timer", 47 .name = "timer",
49}; 48};
50 49
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index 0e69796b58c7..5f234a5a2320 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -23,6 +23,7 @@ generic-y += ioctls.h
23generic-y += iomap.h 23generic-y += iomap.h
24generic-y += ipcbuf.h 24generic-y += ipcbuf.h
25generic-y += irq_regs.h 25generic-y += irq_regs.h
26generic-y += irq_work.h
26generic-y += kdebug.h 27generic-y += kdebug.h
27generic-y += kmap_types.h 28generic-y += kmap_types.h
28generic-y += local.h 29generic-y += local.h
diff --git a/arch/hexagon/mm/cache.c b/arch/hexagon/mm/cache.c
index fe14ccf28561..0c76c802e31c 100644
--- a/arch/hexagon/mm/cache.c
+++ b/arch/hexagon/mm/cache.c
@@ -68,6 +68,7 @@ void flush_icache_range(unsigned long start, unsigned long end)
68 ); 68 );
69 local_irq_restore(flags); 69 local_irq_restore(flags);
70} 70}
71EXPORT_SYMBOL(flush_icache_range);
71 72
72void hexagon_clean_dcache_range(unsigned long start, unsigned long end) 73void hexagon_clean_dcache_range(unsigned long start, unsigned long end)
73{ 74{
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 64aefb76bd69..c84c88bbbbd7 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -549,8 +549,6 @@ source "drivers/sn/Kconfig"
549config KEXEC 549config KEXEC
550 bool "kexec system call" 550 bool "kexec system call"
551 depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU) 551 depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU)
552 select CRYPTO
553 select CRYPTO_SHA256
554 help 552 help
555 kexec is a system call that implements the ability to shutdown your 553 kexec is a system call that implements the ability to shutdown your
556 current kernel, and to start another kernel. It is like a reboot 554 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig
index 4c4ac163c600..b6bda1838629 100644
--- a/arch/ia64/configs/bigsur_defconfig
+++ b/arch/ia64/configs/bigsur_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
4CONFIG_LOG_BUF_SHIFT=16 3CONFIG_LOG_BUF_SHIFT=16
@@ -6,6 +5,8 @@ CONFIG_PROFILING=y
6CONFIG_OPROFILE=y 5CONFIG_OPROFILE=y
7CONFIG_MODULES=y 6CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y 7CONFIG_MODULE_UNLOAD=y
8CONFIG_PARTITION_ADVANCED=y
9CONFIG_SGI_PARTITION=y
9CONFIG_IA64_DIG=y 10CONFIG_IA64_DIG=y
10CONFIG_SMP=y 11CONFIG_SMP=y
11CONFIG_NR_CPUS=2 12CONFIG_NR_CPUS=2
@@ -51,9 +52,6 @@ CONFIG_DM_MIRROR=m
51CONFIG_DM_ZERO=m 52CONFIG_DM_ZERO=m
52CONFIG_NETDEVICES=y 53CONFIG_NETDEVICES=y
53CONFIG_DUMMY=y 54CONFIG_DUMMY=y
54CONFIG_NET_ETHERNET=y
55CONFIG_MII=y
56CONFIG_NET_PCI=y
57CONFIG_INPUT_EVDEV=y 55CONFIG_INPUT_EVDEV=y
58CONFIG_SERIAL_8250=y 56CONFIG_SERIAL_8250=y
59CONFIG_SERIAL_8250_CONSOLE=y 57CONFIG_SERIAL_8250_CONSOLE=y
@@ -85,7 +83,6 @@ CONFIG_EXT3_FS=y
85CONFIG_XFS_FS=y 83CONFIG_XFS_FS=y
86CONFIG_XFS_QUOTA=y 84CONFIG_XFS_QUOTA=y
87CONFIG_XFS_POSIX_ACL=y 85CONFIG_XFS_POSIX_ACL=y
88CONFIG_AUTOFS_FS=m
89CONFIG_AUTOFS4_FS=m 86CONFIG_AUTOFS4_FS=m
90CONFIG_ISO9660_FS=m 87CONFIG_ISO9660_FS=m
91CONFIG_JOLIET=y 88CONFIG_JOLIET=y
@@ -95,17 +92,13 @@ CONFIG_PROC_KCORE=y
95CONFIG_TMPFS=y 92CONFIG_TMPFS=y
96CONFIG_HUGETLBFS=y 93CONFIG_HUGETLBFS=y
97CONFIG_NFS_FS=m 94CONFIG_NFS_FS=m
98CONFIG_NFS_V3=y 95CONFIG_NFS_V4=m
99CONFIG_NFS_V4=y
100CONFIG_NFSD=m 96CONFIG_NFSD=m
101CONFIG_NFSD_V4=y 97CONFIG_NFSD_V4=y
102CONFIG_CIFS=m 98CONFIG_CIFS=m
103CONFIG_CIFS_STATS=y 99CONFIG_CIFS_STATS=y
104CONFIG_CIFS_XATTR=y 100CONFIG_CIFS_XATTR=y
105CONFIG_CIFS_POSIX=y 101CONFIG_CIFS_POSIX=y
106CONFIG_PARTITION_ADVANCED=y
107CONFIG_SGI_PARTITION=y
108CONFIG_EFI_PARTITION=y
109CONFIG_NLS_CODEPAGE_437=y 102CONFIG_NLS_CODEPAGE_437=y
110CONFIG_NLS_ISO8859_1=y 103CONFIG_NLS_ISO8859_1=y
111CONFIG_NLS_UTF8=m 104CONFIG_NLS_UTF8=m
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index e8ed3ae70aae..81f686dee53c 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
4CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
@@ -6,13 +5,13 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=20 5CONFIG_LOG_BUF_SHIFT=20
7CONFIG_CGROUPS=y 6CONFIG_CGROUPS=y
8CONFIG_CPUSETS=y 7CONFIG_CPUSETS=y
9CONFIG_SYSFS_DEPRECATED_V2=y
10CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
11CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
12CONFIG_MODULES=y 10CONFIG_MODULES=y
13CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
14CONFIG_MODVERSIONS=y 12CONFIG_MODVERSIONS=y
15# CONFIG_BLK_DEV_BSG is not set 13CONFIG_PARTITION_ADVANCED=y
14CONFIG_SGI_PARTITION=y
16CONFIG_MCKINLEY=y 15CONFIG_MCKINLEY=y
17CONFIG_IA64_PAGE_SIZE_64KB=y 16CONFIG_IA64_PAGE_SIZE_64KB=y
18CONFIG_IA64_CYCLONE=y 17CONFIG_IA64_CYCLONE=y
@@ -29,14 +28,13 @@ CONFIG_ACPI_BUTTON=m
29CONFIG_ACPI_FAN=m 28CONFIG_ACPI_FAN=m
30CONFIG_ACPI_DOCK=y 29CONFIG_ACPI_DOCK=y
31CONFIG_ACPI_PROCESSOR=m 30CONFIG_ACPI_PROCESSOR=m
32CONFIG_ACPI_CONTAINER=y
33CONFIG_HOTPLUG_PCI=y 31CONFIG_HOTPLUG_PCI=y
34CONFIG_HOTPLUG_PCI_ACPI=y 32CONFIG_HOTPLUG_PCI_ACPI=y
33CONFIG_NET=y
35CONFIG_PACKET=y 34CONFIG_PACKET=y
36CONFIG_UNIX=y 35CONFIG_UNIX=y
37CONFIG_INET=y 36CONFIG_INET=y
38CONFIG_IP_MULTICAST=y 37CONFIG_IP_MULTICAST=y
39CONFIG_ARPD=y
40CONFIG_SYN_COOKIES=y 38CONFIG_SYN_COOKIES=y
41# CONFIG_IPV6 is not set 39# CONFIG_IPV6 is not set
42CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 40CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
@@ -82,16 +80,13 @@ CONFIG_FUSION_FC=m
82CONFIG_FUSION_SAS=y 80CONFIG_FUSION_SAS=y
83CONFIG_NETDEVICES=y 81CONFIG_NETDEVICES=y
84CONFIG_DUMMY=m 82CONFIG_DUMMY=m
85CONFIG_NET_ETHERNET=y 83CONFIG_NETCONSOLE=y
84CONFIG_TIGON3=y
86CONFIG_NET_TULIP=y 85CONFIG_NET_TULIP=y
87CONFIG_TULIP=m 86CONFIG_TULIP=m
88CONFIG_NET_PCI=y
89CONFIG_NET_VENDOR_INTEL=y
90CONFIG_E100=m 87CONFIG_E100=m
91CONFIG_E1000=y 88CONFIG_E1000=y
92CONFIG_IGB=y 89CONFIG_IGB=y
93CONFIG_TIGON3=y
94CONFIG_NETCONSOLE=y
95# CONFIG_SERIO_SERPORT is not set 90# CONFIG_SERIO_SERPORT is not set
96CONFIG_GAMEPORT=m 91CONFIG_GAMEPORT=m
97CONFIG_SERIAL_NONSTANDARD=y 92CONFIG_SERIAL_NONSTANDARD=y
@@ -151,6 +146,7 @@ CONFIG_USB_STORAGE=m
151CONFIG_INFINIBAND=m 146CONFIG_INFINIBAND=m
152CONFIG_INFINIBAND_MTHCA=m 147CONFIG_INFINIBAND_MTHCA=m
153CONFIG_INFINIBAND_IPOIB=m 148CONFIG_INFINIBAND_IPOIB=m
149CONFIG_INTEL_IOMMU=y
154CONFIG_MSPEC=m 150CONFIG_MSPEC=m
155CONFIG_EXT2_FS=y 151CONFIG_EXT2_FS=y
156CONFIG_EXT2_FS_XATTR=y 152CONFIG_EXT2_FS_XATTR=y
@@ -164,7 +160,6 @@ CONFIG_REISERFS_FS_XATTR=y
164CONFIG_REISERFS_FS_POSIX_ACL=y 160CONFIG_REISERFS_FS_POSIX_ACL=y
165CONFIG_REISERFS_FS_SECURITY=y 161CONFIG_REISERFS_FS_SECURITY=y
166CONFIG_XFS_FS=y 162CONFIG_XFS_FS=y
167CONFIG_AUTOFS_FS=m
168CONFIG_AUTOFS4_FS=m 163CONFIG_AUTOFS4_FS=m
169CONFIG_ISO9660_FS=m 164CONFIG_ISO9660_FS=m
170CONFIG_JOLIET=y 165CONFIG_JOLIET=y
@@ -175,16 +170,10 @@ CONFIG_PROC_KCORE=y
175CONFIG_TMPFS=y 170CONFIG_TMPFS=y
176CONFIG_HUGETLBFS=y 171CONFIG_HUGETLBFS=y
177CONFIG_NFS_FS=m 172CONFIG_NFS_FS=m
178CONFIG_NFS_V3=y 173CONFIG_NFS_V4=m
179CONFIG_NFS_V4=y
180CONFIG_NFSD=m 174CONFIG_NFSD=m
181CONFIG_NFSD_V4=y 175CONFIG_NFSD_V4=y
182CONFIG_SMB_FS=m
183CONFIG_SMB_NLS_DEFAULT=y
184CONFIG_CIFS=m 176CONFIG_CIFS=m
185CONFIG_PARTITION_ADVANCED=y
186CONFIG_SGI_PARTITION=y
187CONFIG_EFI_PARTITION=y
188CONFIG_NLS_CODEPAGE_437=y 177CONFIG_NLS_CODEPAGE_437=y
189CONFIG_NLS_CODEPAGE_737=m 178CONFIG_NLS_CODEPAGE_737=m
190CONFIG_NLS_CODEPAGE_775=m 179CONFIG_NLS_CODEPAGE_775=m
@@ -225,11 +214,7 @@ CONFIG_NLS_UTF8=m
225CONFIG_MAGIC_SYSRQ=y 214CONFIG_MAGIC_SYSRQ=y
226CONFIG_DEBUG_KERNEL=y 215CONFIG_DEBUG_KERNEL=y
227CONFIG_DEBUG_MUTEXES=y 216CONFIG_DEBUG_MUTEXES=y
228# CONFIG_RCU_CPU_STALL_DETECTOR is not set
229CONFIG_SYSCTL_SYSCALL_CHECK=y
230CONFIG_CRYPTO_ECB=m
231CONFIG_CRYPTO_PCBC=m 217CONFIG_CRYPTO_PCBC=m
232CONFIG_CRYPTO_MD5=y 218CONFIG_CRYPTO_MD5=y
233# CONFIG_CRYPTO_ANSI_CPRNG is not set 219# CONFIG_CRYPTO_ANSI_CPRNG is not set
234CONFIG_CRC_T10DIF=y 220CONFIG_CRC_T10DIF=y
235CONFIG_INTEL_IOMMU=y
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig
index d663efd1e4db..5b4fcdd51457 100644
--- a/arch/ia64/configs/gensparse_defconfig
+++ b/arch/ia64/configs/gensparse_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
4CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
@@ -9,6 +8,8 @@ CONFIG_KALLSYMS_ALL=y
9CONFIG_MODULES=y 8CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
11CONFIG_MODVERSIONS=y 10CONFIG_MODVERSIONS=y
11CONFIG_PARTITION_ADVANCED=y
12CONFIG_SGI_PARTITION=y
12CONFIG_MCKINLEY=y 13CONFIG_MCKINLEY=y
13CONFIG_IA64_CYCLONE=y 14CONFIG_IA64_CYCLONE=y
14CONFIG_SMP=y 15CONFIG_SMP=y
@@ -24,14 +25,12 @@ CONFIG_BINFMT_MISC=m
24CONFIG_ACPI_BUTTON=m 25CONFIG_ACPI_BUTTON=m
25CONFIG_ACPI_FAN=m 26CONFIG_ACPI_FAN=m
26CONFIG_ACPI_PROCESSOR=m 27CONFIG_ACPI_PROCESSOR=m
27CONFIG_ACPI_CONTAINER=m
28CONFIG_HOTPLUG_PCI=y 28CONFIG_HOTPLUG_PCI=y
29CONFIG_HOTPLUG_PCI_ACPI=m 29CONFIG_NET=y
30CONFIG_PACKET=y 30CONFIG_PACKET=y
31CONFIG_UNIX=y 31CONFIG_UNIX=y
32CONFIG_INET=y 32CONFIG_INET=y
33CONFIG_IP_MULTICAST=y 33CONFIG_IP_MULTICAST=y
34CONFIG_ARPD=y
35CONFIG_SYN_COOKIES=y 34CONFIG_SYN_COOKIES=y
36# CONFIG_IPV6 is not set 35# CONFIG_IPV6 is not set
37CONFIG_BLK_DEV_LOOP=m 36CONFIG_BLK_DEV_LOOP=m
@@ -71,15 +70,12 @@ CONFIG_FUSION_SPI=y
71CONFIG_FUSION_FC=m 70CONFIG_FUSION_FC=m
72CONFIG_NETDEVICES=y 71CONFIG_NETDEVICES=y
73CONFIG_DUMMY=m 72CONFIG_DUMMY=m
74CONFIG_NET_ETHERNET=y 73CONFIG_NETCONSOLE=y
74CONFIG_TIGON3=y
75CONFIG_NET_TULIP=y 75CONFIG_NET_TULIP=y
76CONFIG_TULIP=m 76CONFIG_TULIP=m
77CONFIG_NET_PCI=y
78CONFIG_NET_VENDOR_INTEL=y
79CONFIG_E100=m 77CONFIG_E100=m
80CONFIG_E1000=y 78CONFIG_E1000=y
81CONFIG_TIGON3=y
82CONFIG_NETCONSOLE=y
83# CONFIG_SERIO_SERPORT is not set 79# CONFIG_SERIO_SERPORT is not set
84CONFIG_GAMEPORT=m 80CONFIG_GAMEPORT=m
85CONFIG_SERIAL_NONSTANDARD=y 81CONFIG_SERIAL_NONSTANDARD=y
@@ -146,7 +142,6 @@ CONFIG_REISERFS_FS_XATTR=y
146CONFIG_REISERFS_FS_POSIX_ACL=y 142CONFIG_REISERFS_FS_POSIX_ACL=y
147CONFIG_REISERFS_FS_SECURITY=y 143CONFIG_REISERFS_FS_SECURITY=y
148CONFIG_XFS_FS=y 144CONFIG_XFS_FS=y
149CONFIG_AUTOFS_FS=y
150CONFIG_AUTOFS4_FS=y 145CONFIG_AUTOFS4_FS=y
151CONFIG_ISO9660_FS=m 146CONFIG_ISO9660_FS=m
152CONFIG_JOLIET=y 147CONFIG_JOLIET=y
@@ -157,16 +152,10 @@ CONFIG_PROC_KCORE=y
157CONFIG_TMPFS=y 152CONFIG_TMPFS=y
158CONFIG_HUGETLBFS=y 153CONFIG_HUGETLBFS=y
159CONFIG_NFS_FS=m 154CONFIG_NFS_FS=m
160CONFIG_NFS_V3=y 155CONFIG_NFS_V4=m
161CONFIG_NFS_V4=y
162CONFIG_NFSD=m 156CONFIG_NFSD=m
163CONFIG_NFSD_V4=y 157CONFIG_NFSD_V4=y
164CONFIG_SMB_FS=m
165CONFIG_SMB_NLS_DEFAULT=y
166CONFIG_CIFS=m 158CONFIG_CIFS=m
167CONFIG_PARTITION_ADVANCED=y
168CONFIG_SGI_PARTITION=y
169CONFIG_EFI_PARTITION=y
170CONFIG_NLS_CODEPAGE_437=y 159CONFIG_NLS_CODEPAGE_437=y
171CONFIG_NLS_CODEPAGE_737=m 160CONFIG_NLS_CODEPAGE_737=m
172CONFIG_NLS_CODEPAGE_775=m 161CONFIG_NLS_CODEPAGE_775=m
diff --git a/arch/ia64/configs/sim_defconfig b/arch/ia64/configs/sim_defconfig
index b4548a3e82d5..f0f69fdbddae 100644
--- a/arch/ia64/configs/sim_defconfig
+++ b/arch/ia64/configs/sim_defconfig
@@ -1,13 +1,12 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 2CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 3CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16 4CONFIG_LOG_BUF_SHIFT=16
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_MODULES=y 5CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y 6CONFIG_MODULE_UNLOAD=y
9CONFIG_MODULE_FORCE_UNLOAD=y 7CONFIG_MODULE_FORCE_UNLOAD=y
10CONFIG_MODVERSIONS=y 8CONFIG_MODVERSIONS=y
9CONFIG_PARTITION_ADVANCED=y
11CONFIG_IA64_HP_SIM=y 10CONFIG_IA64_HP_SIM=y
12CONFIG_MCKINLEY=y 11CONFIG_MCKINLEY=y
13CONFIG_IA64_PAGE_SIZE_64KB=y 12CONFIG_IA64_PAGE_SIZE_64KB=y
@@ -27,7 +26,6 @@ CONFIG_BLK_DEV_LOOP=y
27CONFIG_BLK_DEV_RAM=y 26CONFIG_BLK_DEV_RAM=y
28CONFIG_SCSI=y 27CONFIG_SCSI=y
29CONFIG_BLK_DEV_SD=y 28CONFIG_BLK_DEV_SD=y
30CONFIG_SCSI_MULTI_LUN=y
31CONFIG_SCSI_CONSTANTS=y 29CONFIG_SCSI_CONSTANTS=y
32CONFIG_SCSI_LOGGING=y 30CONFIG_SCSI_LOGGING=y
33CONFIG_SCSI_SPI_ATTRS=y 31CONFIG_SCSI_SPI_ATTRS=y
@@ -49,8 +47,6 @@ CONFIG_HUGETLBFS=y
49CONFIG_NFS_FS=y 47CONFIG_NFS_FS=y
50CONFIG_NFSD=y 48CONFIG_NFSD=y
51CONFIG_NFSD_V3=y 49CONFIG_NFSD_V3=y
52CONFIG_PARTITION_ADVANCED=y 50CONFIG_DEBUG_INFO=y
53CONFIG_EFI_PARTITION=y
54CONFIG_DEBUG_KERNEL=y 51CONFIG_DEBUG_KERNEL=y
55CONFIG_DEBUG_MUTEXES=y 52CONFIG_DEBUG_MUTEXES=y
56CONFIG_DEBUG_INFO=y
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index c8a3f40e77f6..192ed157c9ce 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
4CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
@@ -11,6 +10,8 @@ CONFIG_MODULE_UNLOAD=y
11CONFIG_MODVERSIONS=y 10CONFIG_MODVERSIONS=y
12CONFIG_MODULE_SRCVERSION_ALL=y 11CONFIG_MODULE_SRCVERSION_ALL=y
13# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
13CONFIG_PARTITION_ADVANCED=y
14CONFIG_SGI_PARTITION=y
14CONFIG_IA64_DIG=y 15CONFIG_IA64_DIG=y
15CONFIG_MCKINLEY=y 16CONFIG_MCKINLEY=y
16CONFIG_IA64_PAGE_SIZE_64KB=y 17CONFIG_IA64_PAGE_SIZE_64KB=y
@@ -29,14 +30,12 @@ CONFIG_BINFMT_MISC=m
29CONFIG_ACPI_BUTTON=m 30CONFIG_ACPI_BUTTON=m
30CONFIG_ACPI_FAN=m 31CONFIG_ACPI_FAN=m
31CONFIG_ACPI_PROCESSOR=m 32CONFIG_ACPI_PROCESSOR=m
32CONFIG_ACPI_CONTAINER=m
33CONFIG_HOTPLUG_PCI=y 33CONFIG_HOTPLUG_PCI=y
34CONFIG_HOTPLUG_PCI_ACPI=m 34CONFIG_NET=y
35CONFIG_PACKET=y 35CONFIG_PACKET=y
36CONFIG_UNIX=y 36CONFIG_UNIX=y
37CONFIG_INET=y 37CONFIG_INET=y
38CONFIG_IP_MULTICAST=y 38CONFIG_IP_MULTICAST=y
39CONFIG_ARPD=y
40CONFIG_SYN_COOKIES=y 39CONFIG_SYN_COOKIES=y
41# CONFIG_IPV6 is not set 40# CONFIG_IPV6 is not set
42CONFIG_BLK_DEV_LOOP=m 41CONFIG_BLK_DEV_LOOP=m
@@ -53,6 +52,7 @@ CONFIG_BLK_DEV_SD=y
53CONFIG_CHR_DEV_ST=m 52CONFIG_CHR_DEV_ST=m
54CONFIG_BLK_DEV_SR=m 53CONFIG_BLK_DEV_SR=m
55CONFIG_CHR_DEV_SG=m 54CONFIG_CHR_DEV_SG=m
55CONFIG_SCSI_FC_ATTRS=y
56CONFIG_SCSI_SYM53C8XX_2=y 56CONFIG_SCSI_SYM53C8XX_2=y
57CONFIG_SCSI_QLOGIC_1280=y 57CONFIG_SCSI_QLOGIC_1280=y
58CONFIG_MD=y 58CONFIG_MD=y
@@ -72,15 +72,12 @@ CONFIG_FUSION_FC=y
72CONFIG_FUSION_CTL=y 72CONFIG_FUSION_CTL=y
73CONFIG_NETDEVICES=y 73CONFIG_NETDEVICES=y
74CONFIG_DUMMY=m 74CONFIG_DUMMY=m
75CONFIG_NET_ETHERNET=y 75CONFIG_NETCONSOLE=y
76CONFIG_TIGON3=y
76CONFIG_NET_TULIP=y 77CONFIG_NET_TULIP=y
77CONFIG_TULIP=m 78CONFIG_TULIP=m
78CONFIG_NET_PCI=y
79CONFIG_NET_VENDOR_INTEL=y
80CONFIG_E100=m 79CONFIG_E100=m
81CONFIG_E1000=y 80CONFIG_E1000=y
82CONFIG_TIGON3=y
83CONFIG_NETCONSOLE=y
84# CONFIG_SERIO_SERPORT is not set 81# CONFIG_SERIO_SERPORT is not set
85CONFIG_GAMEPORT=m 82CONFIG_GAMEPORT=m
86CONFIG_SERIAL_NONSTANDARD=y 83CONFIG_SERIAL_NONSTANDARD=y
@@ -118,7 +115,6 @@ CONFIG_REISERFS_FS_XATTR=y
118CONFIG_REISERFS_FS_POSIX_ACL=y 115CONFIG_REISERFS_FS_POSIX_ACL=y
119CONFIG_REISERFS_FS_SECURITY=y 116CONFIG_REISERFS_FS_SECURITY=y
120CONFIG_XFS_FS=y 117CONFIG_XFS_FS=y
121CONFIG_AUTOFS_FS=y
122CONFIG_AUTOFS4_FS=y 118CONFIG_AUTOFS4_FS=y
123CONFIG_ISO9660_FS=m 119CONFIG_ISO9660_FS=m
124CONFIG_JOLIET=y 120CONFIG_JOLIET=y
@@ -129,16 +125,10 @@ CONFIG_PROC_KCORE=y
129CONFIG_TMPFS=y 125CONFIG_TMPFS=y
130CONFIG_HUGETLBFS=y 126CONFIG_HUGETLBFS=y
131CONFIG_NFS_FS=m 127CONFIG_NFS_FS=m
132CONFIG_NFS_V3=y 128CONFIG_NFS_V4=m
133CONFIG_NFS_V4=y
134CONFIG_NFSD=m 129CONFIG_NFSD=m
135CONFIG_NFSD_V4=y 130CONFIG_NFSD_V4=y
136CONFIG_SMB_FS=m
137CONFIG_SMB_NLS_DEFAULT=y
138CONFIG_CIFS=m 131CONFIG_CIFS=m
139CONFIG_PARTITION_ADVANCED=y
140CONFIG_SGI_PARTITION=y
141CONFIG_EFI_PARTITION=y
142CONFIG_NLS_CODEPAGE_437=y 132CONFIG_NLS_CODEPAGE_437=y
143CONFIG_NLS_CODEPAGE_737=m 133CONFIG_NLS_CODEPAGE_737=m
144CONFIG_NLS_CODEPAGE_775=m 134CONFIG_NLS_CODEPAGE_775=m
@@ -180,6 +170,5 @@ CONFIG_MAGIC_SYSRQ=y
180CONFIG_DEBUG_KERNEL=y 170CONFIG_DEBUG_KERNEL=y
181CONFIG_DEBUG_MUTEXES=y 171CONFIG_DEBUG_MUTEXES=y
182CONFIG_IA64_GRANULE_16MB=y 172CONFIG_IA64_GRANULE_16MB=y
183CONFIG_CRYPTO_ECB=m
184CONFIG_CRYPTO_PCBC=m 173CONFIG_CRYPTO_PCBC=m
185CONFIG_CRYPTO_MD5=y 174CONFIG_CRYPTO_MD5=y
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 54bc72eda30d..b504c8e2fd52 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -1,9 +1,9 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 2CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_BLK_DEV_INITRD=y 3CONFIG_BLK_DEV_INITRD=y
5CONFIG_KPROBES=y 4CONFIG_KPROBES=y
6CONFIG_MODULES=y 5CONFIG_MODULES=y
6CONFIG_PARTITION_ADVANCED=y
7CONFIG_IA64_HP_ZX1=y 7CONFIG_IA64_HP_ZX1=y
8CONFIG_MCKINLEY=y 8CONFIG_MCKINLEY=y
9CONFIG_SMP=y 9CONFIG_SMP=y
@@ -18,6 +18,7 @@ CONFIG_EFI_VARS=y
18CONFIG_BINFMT_MISC=y 18CONFIG_BINFMT_MISC=y
19CONFIG_HOTPLUG_PCI=y 19CONFIG_HOTPLUG_PCI=y
20CONFIG_HOTPLUG_PCI_ACPI=y 20CONFIG_HOTPLUG_PCI_ACPI=y
21CONFIG_NET=y
21CONFIG_PACKET=y 22CONFIG_PACKET=y
22CONFIG_UNIX=y 23CONFIG_UNIX=y
23CONFIG_INET=y 24CONFIG_INET=y
@@ -37,9 +38,9 @@ CONFIG_CHR_DEV_OSST=y
37CONFIG_BLK_DEV_SR=y 38CONFIG_BLK_DEV_SR=y
38CONFIG_BLK_DEV_SR_VENDOR=y 39CONFIG_BLK_DEV_SR_VENDOR=y
39CONFIG_CHR_DEV_SG=y 40CONFIG_CHR_DEV_SG=y
40CONFIG_SCSI_MULTI_LUN=y
41CONFIG_SCSI_CONSTANTS=y 41CONFIG_SCSI_CONSTANTS=y
42CONFIG_SCSI_LOGGING=y 42CONFIG_SCSI_LOGGING=y
43CONFIG_SCSI_FC_ATTRS=y
43CONFIG_SCSI_SYM53C8XX_2=y 44CONFIG_SCSI_SYM53C8XX_2=y
44CONFIG_SCSI_QLOGIC_1280=y 45CONFIG_SCSI_QLOGIC_1280=y
45CONFIG_FUSION=y 46CONFIG_FUSION=y
@@ -48,18 +49,15 @@ CONFIG_FUSION_FC=y
48CONFIG_FUSION_CTL=m 49CONFIG_FUSION_CTL=m
49CONFIG_NETDEVICES=y 50CONFIG_NETDEVICES=y
50CONFIG_DUMMY=y 51CONFIG_DUMMY=y
51CONFIG_NET_ETHERNET=y 52CONFIG_TIGON3=y
52CONFIG_NET_TULIP=y 53CONFIG_NET_TULIP=y
53CONFIG_TULIP=y 54CONFIG_TULIP=y
54CONFIG_TULIP_MWI=y 55CONFIG_TULIP_MWI=y
55CONFIG_TULIP_MMIO=y 56CONFIG_TULIP_MMIO=y
56CONFIG_TULIP_NAPI=y 57CONFIG_TULIP_NAPI=y
57CONFIG_TULIP_NAPI_HW_MITIGATION=y 58CONFIG_TULIP_NAPI_HW_MITIGATION=y
58CONFIG_NET_PCI=y
59CONFIG_NET_VENDOR_INTEL=y
60CONFIG_E100=y 59CONFIG_E100=y
61CONFIG_E1000=y 60CONFIG_E1000=y
62CONFIG_TIGON3=y
63CONFIG_INPUT_JOYDEV=y 61CONFIG_INPUT_JOYDEV=y
64CONFIG_INPUT_EVDEV=y 62CONFIG_INPUT_EVDEV=y
65# CONFIG_INPUT_KEYBOARD is not set 63# CONFIG_INPUT_KEYBOARD is not set
@@ -100,7 +98,6 @@ CONFIG_USB_STORAGE=y
100CONFIG_EXT2_FS=y 98CONFIG_EXT2_FS=y
101CONFIG_EXT2_FS_XATTR=y 99CONFIG_EXT2_FS_XATTR=y
102CONFIG_EXT3_FS=y 100CONFIG_EXT3_FS=y
103CONFIG_AUTOFS_FS=y
104CONFIG_ISO9660_FS=y 101CONFIG_ISO9660_FS=y
105CONFIG_JOLIET=y 102CONFIG_JOLIET=y
106CONFIG_UDF_FS=y 103CONFIG_UDF_FS=y
@@ -110,12 +107,9 @@ CONFIG_PROC_KCORE=y
110CONFIG_TMPFS=y 107CONFIG_TMPFS=y
111CONFIG_HUGETLBFS=y 108CONFIG_HUGETLBFS=y
112CONFIG_NFS_FS=y 109CONFIG_NFS_FS=y
113CONFIG_NFS_V3=y
114CONFIG_NFS_V4=y 110CONFIG_NFS_V4=y
115CONFIG_NFSD=y 111CONFIG_NFSD=y
116CONFIG_NFSD_V3=y 112CONFIG_NFSD_V3=y
117CONFIG_PARTITION_ADVANCED=y
118CONFIG_EFI_PARTITION=y
119CONFIG_NLS_CODEPAGE_437=y 113CONFIG_NLS_CODEPAGE_437=y
120CONFIG_NLS_CODEPAGE_737=y 114CONFIG_NLS_CODEPAGE_737=y
121CONFIG_NLS_CODEPAGE_775=y 115CONFIG_NLS_CODEPAGE_775=y
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index e8317d2d6c8d..747320be9d0e 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -2,6 +2,7 @@
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += hash.h 4generic-y += hash.h
5generic-y += irq_work.h
5generic-y += kvm_para.h 6generic-y += kvm_para.h
6generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
7generic-y += preempt.h 8generic-y += preempt.h
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index db95f570705f..4729752b7256 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -234,9 +234,6 @@ struct kvm_vm_data {
234#define KVM_REQ_PTC_G 32 234#define KVM_REQ_PTC_G 32
235#define KVM_REQ_RESUME 33 235#define KVM_REQ_RESUME 33
236 236
237struct kvm;
238struct kvm_vcpu;
239
240struct kvm_mmio_req { 237struct kvm_mmio_req {
241 uint64_t addr; /* physical address */ 238 uint64_t addr; /* physical address */
242 uint64_t size; /* size in bytes */ 239 uint64_t size; /* size in bytes */
@@ -595,6 +592,18 @@ void kvm_sal_emul(struct kvm_vcpu *vcpu);
595struct kvm *kvm_arch_alloc_vm(void); 592struct kvm *kvm_arch_alloc_vm(void);
596void kvm_arch_free_vm(struct kvm *kvm); 593void kvm_arch_free_vm(struct kvm *kvm);
597 594
595static inline void kvm_arch_sync_events(struct kvm *kvm) {}
596static inline void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) {}
597static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu) {}
598static inline void kvm_arch_free_memslot(struct kvm *kvm,
599 struct kvm_memory_slot *free, struct kvm_memory_slot *dont) {}
600static inline void kvm_arch_memslots_updated(struct kvm *kvm) {}
601static inline void kvm_arch_commit_memory_region(struct kvm *kvm,
602 struct kvm_userspace_memory_region *mem,
603 const struct kvm_memory_slot *old,
604 enum kvm_mr_change change) {}
605static inline void kvm_arch_hardware_unsetup(void) {}
606
598#endif /* __ASSEMBLY__*/ 607#endif /* __ASSEMBLY__*/
599 608
600#endif 609#endif
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 4254f5d3218c..10a14ead70b9 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -11,7 +11,7 @@
11 11
12 12
13 13
14#define NR_syscalls 316 /* length of syscall table */ 14#define NR_syscalls 317 /* length of syscall table */
15 15
16/* 16/*
17 * The following defines stop scripts/checksyscalls.sh from complaining about 17 * The following defines stop scripts/checksyscalls.sh from complaining about
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index 99801c3be914..18026b2eb582 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -329,5 +329,6 @@
329#define __NR_sched_getattr 1337 329#define __NR_sched_getattr 1337
330#define __NR_renameat2 1338 330#define __NR_renameat2 1338
331#define __NR_getrandom 1339 331#define __NR_getrandom 1339
332#define __NR_memfd_create 1340
332 333
333#endif /* _UAPI_ASM_IA64_UNISTD_H */ 334#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 4c13837a9269..01edf242eb29 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1777,6 +1777,7 @@ sys_call_table:
1777 data8 sys_sched_getattr 1777 data8 sys_sched_getattr
1778 data8 sys_renameat2 1778 data8 sys_renameat2
1779 data8 sys_getrandom 1779 data8 sys_getrandom
1780 data8 sys_memfd_create // 1340
1780 1781
1781 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1782 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
1782#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ 1783#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index c430f9198d1b..8c3730c3c63d 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -23,7 +23,7 @@ static int ia64_set_msi_irq_affinity(struct irq_data *idata,
23 if (irq_prepare_move(irq, cpu)) 23 if (irq_prepare_move(irq, cpu))
24 return -1; 24 return -1;
25 25
26 get_cached_msi_msg(irq, &msg); 26 __get_cached_msi_msg(idata->msi_desc, &msg);
27 27
28 addr = msg.address_lo; 28 addr = msg.address_lo;
29 addr &= MSI_ADDR_DEST_ID_MASK; 29 addr &= MSI_ADDR_DEST_ID_MASK;
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 0729ba6acddf..ec6b9acb6bea 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -125,7 +125,7 @@ long ia64_pal_vp_create(u64 *vpd, u64 *host_iva, u64 *opt_handler)
125 125
126static DEFINE_SPINLOCK(vp_lock); 126static DEFINE_SPINLOCK(vp_lock);
127 127
128int kvm_arch_hardware_enable(void *garbage) 128int kvm_arch_hardware_enable(void)
129{ 129{
130 long status; 130 long status;
131 long tmp_base; 131 long tmp_base;
@@ -160,7 +160,7 @@ int kvm_arch_hardware_enable(void *garbage)
160 return 0; 160 return 0;
161} 161}
162 162
163void kvm_arch_hardware_disable(void *garbage) 163void kvm_arch_hardware_disable(void)
164{ 164{
165 165
166 long status; 166 long status;
@@ -1364,10 +1364,6 @@ static void kvm_release_vm_pages(struct kvm *kvm)
1364 } 1364 }
1365} 1365}
1366 1366
1367void kvm_arch_sync_events(struct kvm *kvm)
1368{
1369}
1370
1371void kvm_arch_destroy_vm(struct kvm *kvm) 1367void kvm_arch_destroy_vm(struct kvm *kvm)
1372{ 1368{
1373 kvm_iommu_unmap_guest(kvm); 1369 kvm_iommu_unmap_guest(kvm);
@@ -1376,10 +1372,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
1376 kvm_release_vm_pages(kvm); 1372 kvm_release_vm_pages(kvm);
1377} 1373}
1378 1374
1379void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
1380{
1381}
1382
1383void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 1375void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1384{ 1376{
1385 if (cpu != vcpu->cpu) { 1377 if (cpu != vcpu->cpu) {
@@ -1468,7 +1460,6 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
1468 kfree(vcpu->arch.apic); 1460 kfree(vcpu->arch.apic);
1469} 1461}
1470 1462
1471
1472long kvm_arch_vcpu_ioctl(struct file *filp, 1463long kvm_arch_vcpu_ioctl(struct file *filp,
1473 unsigned int ioctl, unsigned long arg) 1464 unsigned int ioctl, unsigned long arg)
1474{ 1465{
@@ -1551,21 +1542,12 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
1551 return VM_FAULT_SIGBUS; 1542 return VM_FAULT_SIGBUS;
1552} 1543}
1553 1544
1554void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1555 struct kvm_memory_slot *dont)
1556{
1557}
1558
1559int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot, 1545int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1560 unsigned long npages) 1546 unsigned long npages)
1561{ 1547{
1562 return 0; 1548 return 0;
1563} 1549}
1564 1550
1565void kvm_arch_memslots_updated(struct kvm *kvm)
1566{
1567}
1568
1569int kvm_arch_prepare_memory_region(struct kvm *kvm, 1551int kvm_arch_prepare_memory_region(struct kvm *kvm,
1570 struct kvm_memory_slot *memslot, 1552 struct kvm_memory_slot *memslot,
1571 struct kvm_userspace_memory_region *mem, 1553 struct kvm_userspace_memory_region *mem,
@@ -1597,14 +1579,6 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
1597 return 0; 1579 return 0;
1598} 1580}
1599 1581
1600void kvm_arch_commit_memory_region(struct kvm *kvm,
1601 struct kvm_userspace_memory_region *mem,
1602 const struct kvm_memory_slot *old,
1603 enum kvm_mr_change change)
1604{
1605 return;
1606}
1607
1608void kvm_arch_flush_shadow_all(struct kvm *kvm) 1582void kvm_arch_flush_shadow_all(struct kvm *kvm)
1609{ 1583{
1610 kvm_flush_remote_tlbs(kvm); 1584 kvm_flush_remote_tlbs(kvm);
@@ -1853,10 +1827,6 @@ int kvm_arch_hardware_setup(void)
1853 return 0; 1827 return 0;
1854} 1828}
1855 1829
1856void kvm_arch_hardware_unsetup(void)
1857{
1858}
1859
1860int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq) 1830int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq)
1861{ 1831{
1862 return __apic_accept_irq(vcpu, irq->vector); 1832 return __apic_accept_irq(vcpu, irq->vector);
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index ec73b2cf912a..fc505d58f078 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -38,27 +38,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
38 return; 38 return;
39 /* Maybe, this machine supports legacy memory map. */ 39 /* Maybe, this machine supports legacy memory map. */
40 40
41 if (!vga_default_device()) {
42 resource_size_t start, end;
43 int i;
44
45 /* Does firmware framebuffer belong to us? */
46 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
47 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
48 continue;
49
50 start = pci_resource_start(pdev, i);
51 end = pci_resource_end(pdev, i);
52
53 if (!start || !end)
54 continue;
55
56 if (screen_info.lfb_base >= start &&
57 (screen_info.lfb_base + screen_info.lfb_size) < end)
58 vga_set_default_device(pdev);
59 }
60 }
61
62 /* Is VGA routed to us? */ 41 /* Is VGA routed to us? */
63 bus = pdev->bus; 42 bus = pdev->bus;
64 while (bus) { 43 while (bus) {
@@ -83,8 +62,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
83 pci_read_config_word(pdev, PCI_COMMAND, &config); 62 pci_read_config_word(pdev, PCI_COMMAND, &config);
84 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 63 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
85 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 64 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
86 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 65 dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
87 vga_set_default_device(pdev);
88 } 66 }
89 } 67 }
90} 68}
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index afc58d2799ad..446e7799928c 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -175,8 +175,8 @@ static int sn_set_msi_irq_affinity(struct irq_data *data,
175 * Release XIO resources for the old MSI PCI address 175 * Release XIO resources for the old MSI PCI address
176 */ 176 */
177 177
178 get_cached_msi_msg(irq, &msg); 178 __get_cached_msi_msg(data->msi_desc, &msg);
179 sn_pdev = (struct pcidev_info *)sn_irq_info->irq_pciioinfo; 179 sn_pdev = (struct pcidev_info *)sn_irq_info->irq_pciioinfo;
180 pdev = sn_pdev->pdi_linux_pcidev; 180 pdev = sn_pdev->pdi_linux_pcidev;
181 provider = SN_PCIDEV_BUSPROVIDER(pdev); 181 provider = SN_PCIDEV_BUSPROVIDER(pdev);
182 182
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index accc10a3dc78..3796801d6e0c 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -3,8 +3,10 @@ generic-y += clkdev.h
3generic-y += cputime.h 3generic-y += cputime.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += hash.h 5generic-y += hash.h
6generic-y += irq_work.h
6generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
7generic-y += module.h 8generic-y += module.h
8generic-y += preempt.h 9generic-y += preempt.h
9generic-y += scatterlist.h 10generic-y += scatterlist.h
11generic-y += sections.h
10generic-y += trace_clock.h 12generic-y += trace_clock.h
diff --git a/arch/m32r/include/asm/sections.h b/arch/m32r/include/asm/sections.h
deleted file mode 100644
index 5e5d21c4908a..000000000000
--- a/arch/m32r/include/asm/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _M32R_SECTIONS_H
2#define _M32R_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7#endif /* _M32R_SECTIONS_H */
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 1a15f81ea1bd..093f2761aa51 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -134,7 +134,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
134 134
135static struct irqaction irq0 = { 135static struct irqaction irq0 = {
136 .handler = timer_interrupt, 136 .handler = timer_interrupt,
137 .flags = IRQF_DISABLED,
138 .name = "MFT2", 137 .name = "MFT2",
139}; 138};
140 139
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 3ff8c9a25335..87b7c7581b1d 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -91,8 +91,6 @@ config MMU_SUN3
91config KEXEC 91config KEXEC
92 bool "kexec system call" 92 bool "kexec system call"
93 depends on M68KCLASSIC 93 depends on M68KCLASSIC
94 select CRYPTO
95 select CRYPTO_SHA256
96 help 94 help
97 kexec is a system call that implements the ability to shutdown your 95 kexec is a system call that implements the ability to shutdown your
98 current kernel, and to start another kernel. It is like a reboot 96 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices
index d163991c5717..42b6fcfc30ef 100644
--- a/arch/m68k/Kconfig.devices
+++ b/arch/m68k/Kconfig.devices
@@ -73,7 +73,7 @@ config ATARI_ETHERNEC
73 ROM port. The driver works by polling instead of interrupts, so it 73 ROM port. The driver works by polling instead of interrupts, so it
74 is quite slow. 74 is quite slow.
75 75
76 This driver also suppports the ethernet part of the NetUSBee ROM 76 This driver also supports the ethernet part of the NetUSBee ROM
77 port combined Ethernet/USB adapter. 77 port combined Ethernet/USB adapter.
78 78
79 To compile the actual ethernet driver, choose Y or M in for the NE2000 79 To compile the actual ethernet driver, choose Y or M in for the NE2000
@@ -95,7 +95,7 @@ config ATARI_DSP56K
95 95
96config AMIGA_BUILTIN_SERIAL 96config AMIGA_BUILTIN_SERIAL
97 tristate "Amiga builtin serial support" 97 tristate "Amiga builtin serial support"
98 depends on AMIGA 98 depends on AMIGA && TTY
99 help 99 help
100 If you want to use your Amiga's built-in serial port in Linux, 100 If you want to use your Amiga's built-in serial port in Linux,
101 answer Y. 101 answer Y.
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 5f8cb5a234d9..c83d66442612 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -21,6 +21,7 @@
21#include <linux/mount.h> 21#include <linux/mount.h>
22#include <linux/blkdev.h> 22#include <linux/blkdev.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/ioport.h>
24 25
25#include <asm/setup.h> 26#include <asm/setup.h>
26#include <asm/machdep.h> 27#include <asm/machdep.h>
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index c67c94a2d672..dbaf9f3065e8 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -11,6 +11,7 @@ generic-y += hw_irq.h
11generic-y += ioctl.h 11generic-y += ioctl.h
12generic-y += ipcbuf.h 12generic-y += ipcbuf.h
13generic-y += irq_regs.h 13generic-y += irq_regs.h
14generic-y += irq_work.h
14generic-y += kdebug.h 15generic-y += kdebug.h
15generic-y += kmap_types.h 16generic-y += kmap_types.h
16generic-y += kvm_para.h 17generic-y += kvm_para.h
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index ffdf54f44bc6..8955b40a5dc4 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -510,6 +510,13 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
510 */ 510 */
511#define xlate_dev_kmem_ptr(p) p 511#define xlate_dev_kmem_ptr(p) p
512 512
513#define ioport_map(port, nr) ((void __iomem *)(port)) 513static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
514{
515 return (void __iomem *) port;
516}
517
518static inline void ioport_unmap(void __iomem *p)
519{
520}
514 521
515#endif /* _IO_H */ 522#endif /* _IO_H */
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 1fcdd344c7ad..4ef7a54813e6 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -4,7 +4,7 @@
4#include <uapi/asm/unistd.h> 4#include <uapi/asm/unistd.h>
5 5
6 6
7#define NR_syscalls 352 7#define NR_syscalls 354
8 8
9#define __ARCH_WANT_OLD_READDIR 9#define __ARCH_WANT_OLD_READDIR
10#define __ARCH_WANT_OLD_STAT 10#define __ARCH_WANT_OLD_STAT
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h
index 9cd82fbc7817..b419c6b7ac37 100644
--- a/arch/m68k/include/uapi/asm/unistd.h
+++ b/arch/m68k/include/uapi/asm/unistd.h
@@ -357,5 +357,7 @@
357#define __NR_sched_setattr 349 357#define __NR_sched_setattr 349
358#define __NR_sched_getattr 350 358#define __NR_sched_getattr 350
359#define __NR_renameat2 351 359#define __NR_renameat2 351
360#define __NR_getrandom 352
361#define __NR_memfd_create 353
360 362
361#endif /* _UAPI_ASM_M68K_UNISTD_H_ */ 363#endif /* _UAPI_ASM_M68K_UNISTD_H_ */
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 3a480b3df0d6..9aa01adb407f 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -376,7 +376,6 @@ cache_flush_060 (unsigned long addr, int scope, int cache, unsigned long len)
376asmlinkage int 376asmlinkage int
377sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) 377sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
378{ 378{
379 struct vm_area_struct *vma;
380 int ret = -EINVAL; 379 int ret = -EINVAL;
381 380
382 if (scope < FLUSH_SCOPE_LINE || scope > FLUSH_SCOPE_ALL || 381 if (scope < FLUSH_SCOPE_LINE || scope > FLUSH_SCOPE_ALL ||
@@ -389,17 +388,21 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
389 if (!capable(CAP_SYS_ADMIN)) 388 if (!capable(CAP_SYS_ADMIN))
390 goto out; 389 goto out;
391 } else { 390 } else {
391 struct vm_area_struct *vma;
392
393 /* Check for overflow. */
394 if (addr + len < addr)
395 goto out;
396
392 /* 397 /*
393 * Verify that the specified address region actually belongs 398 * Verify that the specified address region actually belongs
394 * to this process. 399 * to this process.
395 */ 400 */
396 vma = find_vma (current->mm, addr);
397 ret = -EINVAL; 401 ret = -EINVAL;
398 /* Check for overflow. */ 402 down_read(&current->mm->mmap_sem);
399 if (addr + len < addr) 403 vma = find_vma(current->mm, addr);
400 goto out; 404 if (!vma || addr < vma->vm_start || addr + len > vma->vm_end)
401 if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) 405 goto out_unlock;
402 goto out;
403 } 406 }
404 407
405 if (CPU_IS_020_OR_030) { 408 if (CPU_IS_020_OR_030) {
@@ -429,7 +432,7 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
429 __asm__ __volatile__ ("movec %0, %%cacr" : : "r" (cacr)); 432 __asm__ __volatile__ ("movec %0, %%cacr" : : "r" (cacr));
430 } 433 }
431 ret = 0; 434 ret = 0;
432 goto out; 435 goto out_unlock;
433 } else { 436 } else {
434 /* 437 /*
435 * 040 or 060: don't blindly trust 'scope', someone could 438 * 040 or 060: don't blindly trust 'scope', someone could
@@ -446,6 +449,8 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
446 ret = cache_flush_060 (addr, scope, cache, len); 449 ret = cache_flush_060 (addr, scope, cache, len);
447 } 450 }
448 } 451 }
452out_unlock:
453 up_read(&current->mm->mmap_sem);
449out: 454out:
450 return ret; 455 return ret;
451} 456}
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
index 501e10212789..05b46c2b08b8 100644
--- a/arch/m68k/kernel/syscalltable.S
+++ b/arch/m68k/kernel/syscalltable.S
@@ -372,4 +372,6 @@ ENTRY(sys_call_table)
372 .long sys_sched_setattr 372 .long sys_sched_setattr
373 .long sys_sched_getattr /* 350 */ 373 .long sys_sched_getattr /* 350 */
374 .long sys_renameat2 374 .long sys_renameat2
375 .long sys_getrandom
376 .long sys_memfd_create
375 377
diff --git a/arch/m68k/mm/hwtest.c b/arch/m68k/mm/hwtest.c
index 2c7dde3c6430..fb8be4dd38c4 100644
--- a/arch/m68k/mm/hwtest.c
+++ b/arch/m68k/mm/hwtest.c
@@ -25,29 +25,32 @@
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27 27
28int hwreg_present( volatile void *regp ) 28int hwreg_present(volatile void *regp)
29{ 29{
30 int ret = 0; 30 int ret = 0;
31 long save_sp, save_vbr; 31 unsigned long flags;
32 long tmp_vectors[3]; 32 long save_sp, save_vbr;
33 long tmp_vectors[3];
33 34
34 __asm__ __volatile__ 35 local_irq_save(flags);
35 ( "movec %/vbr,%2\n\t" 36 __asm__ __volatile__ (
36 "movel #Lberr1,%4@(8)\n\t" 37 "movec %/vbr,%2\n\t"
37 "movec %4,%/vbr\n\t" 38 "movel #Lberr1,%4@(8)\n\t"
38 "movel %/sp,%1\n\t" 39 "movec %4,%/vbr\n\t"
39 "moveq #0,%0\n\t" 40 "movel %/sp,%1\n\t"
40 "tstb %3@\n\t" 41 "moveq #0,%0\n\t"
42 "tstb %3@\n\t"
41 "nop\n\t" 43 "nop\n\t"
42 "moveq #1,%0\n" 44 "moveq #1,%0\n"
43 "Lberr1:\n\t" 45 "Lberr1:\n\t"
44 "movel %1,%/sp\n\t" 46 "movel %1,%/sp\n\t"
45 "movec %2,%/vbr" 47 "movec %2,%/vbr"
46 : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) 48 : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr)
47 : "a" (regp), "a" (tmp_vectors) 49 : "a" (regp), "a" (tmp_vectors)
48 ); 50 );
51 local_irq_restore(flags);
49 52
50 return( ret ); 53 return ret;
51} 54}
52EXPORT_SYMBOL(hwreg_present); 55EXPORT_SYMBOL(hwreg_present);
53 56
@@ -55,31 +58,36 @@ EXPORT_SYMBOL(hwreg_present);
55 * by a bus error handler. Returns 1 if successful, 0 otherwise. 58 * by a bus error handler. Returns 1 if successful, 0 otherwise.
56 */ 59 */
57 60
58int hwreg_write( volatile void *regp, unsigned short val ) 61int hwreg_write(volatile void *regp, unsigned short val)
59{ 62{
60 int ret; 63 int ret;
61 long save_sp, save_vbr; 64 unsigned long flags;
62 long tmp_vectors[3]; 65 long save_sp, save_vbr;
66 long tmp_vectors[3];
63 67
64 __asm__ __volatile__ 68 local_irq_save(flags);
65 ( "movec %/vbr,%2\n\t" 69 __asm__ __volatile__ (
66 "movel #Lberr2,%4@(8)\n\t" 70 "movec %/vbr,%2\n\t"
67 "movec %4,%/vbr\n\t" 71 "movel #Lberr2,%4@(8)\n\t"
68 "movel %/sp,%1\n\t" 72 "movec %4,%/vbr\n\t"
69 "moveq #0,%0\n\t" 73 "movel %/sp,%1\n\t"
70 "movew %5,%3@\n\t" 74 "moveq #0,%0\n\t"
71 "nop \n\t" /* If this nop isn't present, 'ret' may already be 75 "movew %5,%3@\n\t"
72 * loaded with 1 at the time the bus error 76 "nop\n\t"
73 * happens! */ 77 /*
74 "moveq #1,%0\n" 78 * If this nop isn't present, 'ret' may already be loaded
79 * with 1 at the time the bus error happens!
80 */
81 "moveq #1,%0\n"
75 "Lberr2:\n\t" 82 "Lberr2:\n\t"
76 "movel %1,%/sp\n\t" 83 "movel %1,%/sp\n\t"
77 "movec %2,%/vbr" 84 "movec %2,%/vbr"
78 : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) 85 : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr)
79 : "a" (regp), "a" (tmp_vectors), "g" (val) 86 : "a" (regp), "a" (tmp_vectors), "g" (val)
80 ); 87 );
88 local_irq_restore(flags);
81 89
82 return( ret ); 90 return ret;
83} 91}
84EXPORT_SYMBOL(hwreg_write); 92EXPORT_SYMBOL(hwreg_write);
85 93
diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild
index c29ead89a317..7b8111c8f937 100644
--- a/arch/metag/include/asm/Kbuild
+++ b/arch/metag/include/asm/Kbuild
@@ -19,6 +19,7 @@ generic-y += ioctl.h
19generic-y += ioctls.h 19generic-y += ioctls.h
20generic-y += ipcbuf.h 20generic-y += ipcbuf.h
21generic-y += irq_regs.h 21generic-y += irq_regs.h
22generic-y += irq_work.h
22generic-y += kdebug.h 23generic-y += kdebug.h
23generic-y += kmap_types.h 24generic-y += kmap_types.h
24generic-y += kvm_para.h 25generic-y += kvm_para.h
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 40e1c1dd0e24..6feded3b0c4c 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -127,7 +127,7 @@ config SECCOMP
127 127
128endmenu 128endmenu
129 129
130menu "Advanced setup" 130menu "Kernel features"
131 131
132config ADVANCED_OPTIONS 132config ADVANCED_OPTIONS
133 bool "Prompt for advanced kernel configuration options" 133 bool "Prompt for advanced kernel configuration options"
@@ -248,10 +248,10 @@ config MICROBLAZE_64K_PAGES
248 248
249endchoice 249endchoice
250 250
251endmenu
252
253source "mm/Kconfig" 251source "mm/Kconfig"
254 252
253endmenu
254
255menu "Executable file formats" 255menu "Executable file formats"
256 256
257source "fs/Kconfig.binfmt" 257source "fs/Kconfig.binfmt"
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 27a3acda6c19..448143b8cabd 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += cputime.h
5generic-y += device.h 5generic-y += device.h
6generic-y += exec.h 6generic-y += exec.h
7generic-y += hash.h 7generic-y += hash.h
8generic-y += irq_work.h
8generic-y += mcs_spinlock.h 9generic-y += mcs_spinlock.h
9generic-y += preempt.h 10generic-y += preempt.h
10generic-y += scatterlist.h 11generic-y += scatterlist.h
diff --git a/arch/microblaze/include/asm/entry.h b/arch/microblaze/include/asm/entry.h
index b4a4cb150aa9..596e485ae707 100644
--- a/arch/microblaze/include/asm/entry.h
+++ b/arch/microblaze/include/asm/entry.h
@@ -15,6 +15,7 @@
15 15
16#include <asm/percpu.h> 16#include <asm/percpu.h>
17#include <asm/ptrace.h> 17#include <asm/ptrace.h>
18#include <linux/linkage.h>
18 19
19/* 20/*
20 * These are per-cpu variables required in entry.S, among other 21 * These are per-cpu variables required in entry.S, among other
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 0aa005703a0b..59a89a64a865 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -98,13 +98,13 @@ static inline int access_ok(int type, const void __user *addr,
98 98
99 if ((get_fs().seg < ((unsigned long)addr)) || 99 if ((get_fs().seg < ((unsigned long)addr)) ||
100 (get_fs().seg < ((unsigned long)addr + size - 1))) { 100 (get_fs().seg < ((unsigned long)addr + size - 1))) {
101 pr_debug("ACCESS fail: %s at 0x%08x (size 0x%x), seg 0x%08x\n", 101 pr_devel("ACCESS fail: %s at 0x%08x (size 0x%x), seg 0x%08x\n",
102 type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, 102 type ? "WRITE" : "READ ", (__force u32)addr, (u32)size,
103 (u32)get_fs().seg); 103 (u32)get_fs().seg);
104 return 0; 104 return 0;
105 } 105 }
106ok: 106ok:
107 pr_debug("ACCESS OK: %s at 0x%08x (size 0x%x), seg 0x%08x\n", 107 pr_devel("ACCESS OK: %s at 0x%08x (size 0x%x), seg 0x%08x\n",
108 type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, 108 type ? "WRITE" : "READ ", (__force u32)addr, (u32)size,
109 (u32)get_fs().seg); 109 (u32)get_fs().seg);
110 return 1; 110 return 1;
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index fd56a8f66489..ea4b233647c1 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -38,6 +38,6 @@
38 38
39#endif /* __ASSEMBLY__ */ 39#endif /* __ASSEMBLY__ */
40 40
41#define __NR_syscalls 381 41#define __NR_syscalls 387
42 42
43#endif /* _ASM_MICROBLAZE_UNISTD_H */ 43#endif /* _ASM_MICROBLAZE_UNISTD_H */
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h
index 4e1ddc930a68..1c2380bf8fe6 100644
--- a/arch/microblaze/include/uapi/asm/unistd.h
+++ b/arch/microblaze/include/uapi/asm/unistd.h
@@ -399,5 +399,8 @@
399#define __NR_sched_setattr 381 399#define __NR_sched_setattr 381
400#define __NR_sched_getattr 382 400#define __NR_sched_getattr 382
401#define __NR_renameat2 383 401#define __NR_renameat2 383
402#define __NR_seccomp 384
403#define __NR_getrandom 385
404#define __NR_memfd_create 386
402 405
403#endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ 406#endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index 1a23d5d5480c..de59ee1d7010 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -384,3 +384,6 @@ ENTRY(sys_call_table)
384 .long sys_sched_setattr 384 .long sys_sched_setattr
385 .long sys_sched_getattr 385 .long sys_sched_getattr
386 .long sys_renameat2 386 .long sys_renameat2
387 .long sys_seccomp
388 .long sys_getrandom /* 385 */
389 .long sys_memfd_create
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index df51e78a72cc..574c43000699 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -546,6 +546,7 @@ config SGI_IP28
546 # select SYS_HAS_EARLY_PRINTK 546 # select SYS_HAS_EARLY_PRINTK
547 select SYS_SUPPORTS_64BIT_KERNEL 547 select SYS_SUPPORTS_64BIT_KERNEL
548 select SYS_SUPPORTS_BIG_ENDIAN 548 select SYS_SUPPORTS_BIG_ENDIAN
549 select MIPS_L1_CACHE_SHIFT_7
549 help 550 help
550 This is the SGI Indigo2 with R10000 processor. To compile a Linux 551 This is the SGI Indigo2 with R10000 processor. To compile a Linux
551 kernel that runs on these, say Y here. 552 kernel that runs on these, say Y here.
@@ -2029,7 +2030,9 @@ config MIPS_CMP
2029 bool "MIPS CMP framework support (DEPRECATED)" 2030 bool "MIPS CMP framework support (DEPRECATED)"
2030 depends on SYS_SUPPORTS_MIPS_CMP 2031 depends on SYS_SUPPORTS_MIPS_CMP
2031 select MIPS_GIC_IPI 2032 select MIPS_GIC_IPI
2033 select SMP
2032 select SYNC_R4K 2034 select SYNC_R4K
2035 select SYS_SUPPORTS_SMP
2033 select WEAK_ORDERING 2036 select WEAK_ORDERING
2034 default n 2037 default n
2035 help 2038 help
@@ -2396,8 +2399,6 @@ source "kernel/Kconfig.preempt"
2396 2399
2397config KEXEC 2400config KEXEC
2398 bool "Kexec system call" 2401 bool "Kexec system call"
2399 select CRYPTO
2400 select CRYPTO_SHA256
2401 help 2402 help
2402 kexec is a system call that implements the ability to shutdown your 2403 kexec is a system call that implements the ability to shutdown your
2403 current kernel, and to start another kernel. It is like a reboot 2404 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 9336509f47ad..bbac51e11179 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -113,7 +113,16 @@ predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
113cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) 113cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be))
114cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) 114cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
115 115
116cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) 116# For smartmips configurations, there are hundreds of warnings due to ISA overrides
117# in assembly and header files. smartmips is only supported for MIPS32r1 onwards
118# and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or
119# similar directives in the kernel will spam the build logs with the following warnings:
120# Warning: the `smartmips' extension requires MIPS32 revision 1 or greater
121# or
122# Warning: the 64-bit MIPS architecture does not support the `smartmips' extension
123# Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has
124# been fixed properly.
125cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) -Wa,--no-warn
117cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips) 126cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips)
118 127
119cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ 128cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c
index 776188908dfc..8c13675a12e7 100644
--- a/arch/mips/alchemy/devboards/db1200.c
+++ b/arch/mips/alchemy/devboards/db1200.c
@@ -847,6 +847,7 @@ int __init db1200_dev_setup(void)
847 pr_warn("DB1200: cant get I2C close to 50MHz\n"); 847 pr_warn("DB1200: cant get I2C close to 50MHz\n");
848 else 848 else
849 clk_set_rate(c, pfc); 849 clk_set_rate(c, pfc);
850 clk_prepare_enable(c);
850 clk_put(c); 851 clk_put(c);
851 } 852 }
852 853
@@ -922,11 +923,6 @@ int __init db1200_dev_setup(void)
922 } 923 }
923 924
924 /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ 925 /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */
925 c = clk_get(NULL, "psc1_intclk");
926 if (!IS_ERR(c)) {
927 clk_prepare_enable(c);
928 clk_put(c);
929 }
930 __raw_writel(PSC_SEL_CLK_SERCLK, 926 __raw_writel(PSC_SEL_CLK_SERCLK,
931 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); 927 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
932 wmb(); 928 wmb();
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 2b63e7e7d3d3..c00585d915bc 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -59,12 +59,21 @@ static void bcm47xx_machine_restart(char *command)
59 switch (bcm47xx_bus_type) { 59 switch (bcm47xx_bus_type) {
60#ifdef CONFIG_BCM47XX_SSB 60#ifdef CONFIG_BCM47XX_SSB
61 case BCM47XX_BUS_TYPE_SSB: 61 case BCM47XX_BUS_TYPE_SSB:
62 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 3); 62 if (bcm47xx_bus.ssb.chip_id == 0x4785)
63 write_c0_diag4(1 << 22);
64 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
65 if (bcm47xx_bus.ssb.chip_id == 0x4785) {
66 __asm__ __volatile__(
67 ".set\tmips3\n\t"
68 "sync\n\t"
69 "wait\n\t"
70 ".set\tmips0");
71 }
63 break; 72 break;
64#endif 73#endif
65#ifdef CONFIG_BCM47XX_BCMA 74#ifdef CONFIG_BCM47XX_BCMA
66 case BCM47XX_BUS_TYPE_BCMA: 75 case BCM47XX_BUS_TYPE_BCMA:
67 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 3); 76 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1);
68 break; 77 break;
69#endif 78#endif
70 } 79 }
@@ -202,6 +211,10 @@ static void __init bcm47xx_register_bcma(void)
202 211
203 err = bcma_host_soc_register(&bcm47xx_bus.bcma); 212 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
204 if (err) 213 if (err)
214 panic("Failed to register BCMA bus (err %d)", err);
215
216 err = bcma_host_soc_init(&bcm47xx_bus.bcma);
217 if (err)
205 panic("Failed to initialize BCMA bus (err %d)", err); 218 panic("Failed to initialize BCMA bus (err %d)", err);
206 219
207 bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL); 220 bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index 37eb2d1fa69a..b94bf44d8d8e 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -434,7 +434,7 @@ static void bcm63xx_init_irq(void)
434 irq_stat_addr[0] += PERF_IRQSTAT_3368_REG; 434 irq_stat_addr[0] += PERF_IRQSTAT_3368_REG;
435 irq_mask_addr[0] += PERF_IRQMASK_3368_REG; 435 irq_mask_addr[0] += PERF_IRQMASK_3368_REG;
436 irq_stat_addr[1] = 0; 436 irq_stat_addr[1] = 0;
437 irq_stat_addr[1] = 0; 437 irq_mask_addr[1] = 0;
438 irq_bits = 32; 438 irq_bits = 32;
439 ext_irq_count = 4; 439 ext_irq_count = 4;
440 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; 440 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368;
@@ -443,7 +443,7 @@ static void bcm63xx_init_irq(void)
443 irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0); 443 irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0);
444 irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0); 444 irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0);
445 irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1); 445 irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1);
446 irq_stat_addr[1] += PERF_IRQMASK_6328_REG(1); 446 irq_mask_addr[1] += PERF_IRQMASK_6328_REG(1);
447 irq_bits = 64; 447 irq_bits = 64;
448 ext_irq_count = 4; 448 ext_irq_count = 4;
449 is_ext_irq_cascaded = 1; 449 is_ext_irq_cascaded = 1;
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index b49c7adbfa89..31903cf9709d 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/string.h>
16 17
17#include <asm/addrspace.h> 18#include <asm/addrspace.h>
18 19
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 602866657938..c370426a7322 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -1,7 +1,7 @@
1if CPU_CAVIUM_OCTEON 1if CPU_CAVIUM_OCTEON
2 2
3config CAVIUM_CN63XXP1 3config CAVIUM_CN63XXP1
4 bool "Enable CN63XXP1 errata worarounds" 4 bool "Enable CN63XXP1 errata workarounds"
5 default "n" 5 default "n"
6 help 6 help
7 The CN63XXP1 chip requires build time workarounds to 7 The CN63XXP1 chip requires build time workarounds to
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 008e9c8b8eac..38f4c32e2816 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -263,7 +263,6 @@ static uint64_t crashk_size, crashk_base;
263static int octeon_uart; 263static int octeon_uart;
264 264
265extern asmlinkage void handle_int(void); 265extern asmlinkage void handle_int(void);
266extern asmlinkage void plat_irq_dispatch(void);
267 266
268/** 267/**
269 * Return non zero if we are currently running in the Octeon simulator 268 * Return non zero if we are currently running in the Octeon simulator
@@ -458,6 +457,18 @@ static void octeon_halt(void)
458 octeon_kill_core(NULL); 457 octeon_kill_core(NULL);
459} 458}
460 459
460static char __read_mostly octeon_system_type[80];
461
462static int __init init_octeon_system_type(void)
463{
464 snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)",
465 cvmx_board_type_to_string(octeon_bootinfo->board_type),
466 octeon_model_get_string(read_c0_prid()));
467
468 return 0;
469}
470early_initcall(init_octeon_system_type);
471
461/** 472/**
462 * Return a string representing the system type 473 * Return a string representing the system type
463 * 474 *
@@ -465,11 +476,7 @@ static void octeon_halt(void)
465 */ 476 */
466const char *octeon_board_type_string(void) 477const char *octeon_board_type_string(void)
467{ 478{
468 static char name[80]; 479 return octeon_system_type;
469 sprintf(name, "%s (%s)",
470 cvmx_board_type_to_string(octeon_bootinfo->board_type),
471 octeon_model_get_string(read_c0_prid()));
472 return name;
473} 480}
474 481
475const char *get_system_type(void) 482const char *get_system_type(void)
diff --git a/arch/mips/configs/gpr_defconfig b/arch/mips/configs/gpr_defconfig
index 8f219dac9598..e24feb0633aa 100644
--- a/arch/mips/configs/gpr_defconfig
+++ b/arch/mips/configs/gpr_defconfig
@@ -19,6 +19,7 @@ CONFIG_MODULE_UNLOAD=y
19# CONFIG_BLK_DEV_BSG is not set 19# CONFIG_BLK_DEV_BSG is not set
20CONFIG_PCI=y 20CONFIG_PCI=y
21CONFIG_BINFMT_MISC=m 21CONFIG_BINFMT_MISC=m
22CONFIG_NET=y
22CONFIG_PACKET=y 23CONFIG_PACKET=y
23CONFIG_UNIX=y 24CONFIG_UNIX=y
24CONFIG_INET=y 25CONFIG_INET=y
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index cc0756021398..48e16d98b2cc 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -28,6 +28,7 @@ CONFIG_MIPS32_COMPAT=y
28CONFIG_MIPS32_O32=y 28CONFIG_MIPS32_O32=y
29CONFIG_MIPS32_N32=y 29CONFIG_MIPS32_N32=y
30CONFIG_PM=y 30CONFIG_PM=y
31CONFIG_NET=y
31CONFIG_PACKET=y 32CONFIG_PACKET=y
32CONFIG_UNIX=y 33CONFIG_UNIX=y
33CONFIG_XFRM_USER=m 34CONFIG_XFRM_USER=m
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig
index 2575302aa2be..4f37a5985459 100644
--- a/arch/mips/configs/jazz_defconfig
+++ b/arch/mips/configs/jazz_defconfig
@@ -18,6 +18,7 @@ CONFIG_MODULE_UNLOAD=y
18CONFIG_MODVERSIONS=y 18CONFIG_MODVERSIONS=y
19CONFIG_BINFMT_MISC=m 19CONFIG_BINFMT_MISC=m
20CONFIG_PM=y 20CONFIG_PM=y
21CONFIG_NET=y
21CONFIG_PACKET=m 22CONFIG_PACKET=m
22CONFIG_UNIX=y 23CONFIG_UNIX=y
23CONFIG_NET_KEY=m 24CONFIG_NET_KEY=m
diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig
index 4cb787ff273e..1c6191ebd583 100644
--- a/arch/mips/configs/loongson3_defconfig
+++ b/arch/mips/configs/loongson3_defconfig
@@ -59,6 +59,7 @@ CONFIG_MIPS32_COMPAT=y
59CONFIG_MIPS32_O32=y 59CONFIG_MIPS32_O32=y
60CONFIG_MIPS32_N32=y 60CONFIG_MIPS32_N32=y
61CONFIG_PM_RUNTIME=y 61CONFIG_PM_RUNTIME=y
62CONFIG_NET=y
62CONFIG_PACKET=y 63CONFIG_PACKET=y
63CONFIG_UNIX=y 64CONFIG_UNIX=y
64CONFIG_XFRM_USER=y 65CONFIG_XFRM_USER=y
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index e18741ea1771..f57b96dcf7df 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -19,6 +19,7 @@ CONFIG_MODULE_UNLOAD=y
19CONFIG_MODVERSIONS=y 19CONFIG_MODVERSIONS=y
20CONFIG_MODULE_SRCVERSION_ALL=y 20CONFIG_MODULE_SRCVERSION_ALL=y
21CONFIG_PCI=y 21CONFIG_PCI=y
22CONFIG_NET=y
22CONFIG_PACKET=y 23CONFIG_PACKET=y
23CONFIG_UNIX=y 24CONFIG_UNIX=y
24CONFIG_XFRM_USER=m 25CONFIG_XFRM_USER=m
diff --git a/arch/mips/configs/malta_kvm_defconfig b/arch/mips/configs/malta_kvm_defconfig
index cf0e01f814e1..d41742dd26c8 100644
--- a/arch/mips/configs/malta_kvm_defconfig
+++ b/arch/mips/configs/malta_kvm_defconfig
@@ -20,6 +20,7 @@ CONFIG_MODULE_UNLOAD=y
20CONFIG_MODVERSIONS=y 20CONFIG_MODVERSIONS=y
21CONFIG_MODULE_SRCVERSION_ALL=y 21CONFIG_MODULE_SRCVERSION_ALL=y
22CONFIG_PCI=y 22CONFIG_PCI=y
23CONFIG_NET=y
23CONFIG_PACKET=y 24CONFIG_PACKET=y
24CONFIG_UNIX=y 25CONFIG_UNIX=y
25CONFIG_XFRM_USER=m 26CONFIG_XFRM_USER=m
diff --git a/arch/mips/configs/malta_kvm_guest_defconfig b/arch/mips/configs/malta_kvm_guest_defconfig
index edd9ec9cb678..a7806e83ea0f 100644
--- a/arch/mips/configs/malta_kvm_guest_defconfig
+++ b/arch/mips/configs/malta_kvm_guest_defconfig
@@ -19,6 +19,7 @@ CONFIG_MODULE_UNLOAD=y
19CONFIG_MODVERSIONS=y 19CONFIG_MODVERSIONS=y
20CONFIG_MODULE_SRCVERSION_ALL=y 20CONFIG_MODULE_SRCVERSION_ALL=y
21CONFIG_PCI=y 21CONFIG_PCI=y
22CONFIG_NET=y
22CONFIG_PACKET=y 23CONFIG_PACKET=y
23CONFIG_UNIX=y 24CONFIG_UNIX=y
24CONFIG_XFRM_USER=m 25CONFIG_XFRM_USER=m
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index d269a5326a30..9b6926d6bb32 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -27,6 +27,7 @@ CONFIG_PD6729=m
27CONFIG_I82092=m 27CONFIG_I82092=m
28CONFIG_BINFMT_MISC=m 28CONFIG_BINFMT_MISC=m
29CONFIG_PM=y 29CONFIG_PM=y
30CONFIG_NET=y
30CONFIG_PACKET=m 31CONFIG_PACKET=m
31CONFIG_UNIX=y 32CONFIG_UNIX=y
32CONFIG_XFRM_USER=m 33CONFIG_XFRM_USER=m
diff --git a/arch/mips/configs/nlm_xlp_defconfig b/arch/mips/configs/nlm_xlp_defconfig
index 2f660e9a0da6..70509a48df82 100644
--- a/arch/mips/configs/nlm_xlp_defconfig
+++ b/arch/mips/configs/nlm_xlp_defconfig
@@ -63,6 +63,7 @@ CONFIG_MIPS32_O32=y
63CONFIG_MIPS32_N32=y 63CONFIG_MIPS32_N32=y
64CONFIG_PM_RUNTIME=y 64CONFIG_PM_RUNTIME=y
65CONFIG_PM_DEBUG=y 65CONFIG_PM_DEBUG=y
66CONFIG_NET=y
66CONFIG_PACKET=y 67CONFIG_PACKET=y
67CONFIG_UNIX=y 68CONFIG_UNIX=y
68CONFIG_XFRM_USER=m 69CONFIG_XFRM_USER=m
diff --git a/arch/mips/configs/nlm_xlr_defconfig b/arch/mips/configs/nlm_xlr_defconfig
index c6f84655c98a..82207e8079f3 100644
--- a/arch/mips/configs/nlm_xlr_defconfig
+++ b/arch/mips/configs/nlm_xlr_defconfig
@@ -43,6 +43,7 @@ CONFIG_PCI_DEBUG=y
43CONFIG_BINFMT_MISC=m 43CONFIG_BINFMT_MISC=m
44CONFIG_PM_RUNTIME=y 44CONFIG_PM_RUNTIME=y
45CONFIG_PM_DEBUG=y 45CONFIG_PM_DEBUG=y
46CONFIG_NET=y
46CONFIG_PACKET=y 47CONFIG_PACKET=y
47CONFIG_UNIX=y 48CONFIG_UNIX=y
48CONFIG_XFRM_USER=m 49CONFIG_XFRM_USER=m
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index 29d79ae8a823..db029f4ff759 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -20,6 +20,7 @@ CONFIG_MODVERSIONS=y
20CONFIG_PCI=y 20CONFIG_PCI=y
21CONFIG_BINFMT_MISC=m 21CONFIG_BINFMT_MISC=m
22CONFIG_PM=y 22CONFIG_PM=y
23CONFIG_NET=y
23CONFIG_PACKET=m 24CONFIG_PACKET=m
24CONFIG_UNIX=y 25CONFIG_UNIX=y
25CONFIG_NET_KEY=m 26CONFIG_NET_KEY=m
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 335e5290ec75..57012ef1f51e 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -3,6 +3,7 @@ generic-y += cputime.h
3generic-y += current.h 3generic-y += current.h
4generic-y += emergency-restart.h 4generic-y += emergency-restart.h
5generic-y += hash.h 5generic-y += hash.h
6generic-y += irq_work.h
6generic-y += local64.h 7generic-y += local64.h
7generic-y += mcs_spinlock.h 8generic-y += mcs_spinlock.h
8generic-y += mutex.h 9generic-y += mutex.h
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
index d0352983b94d..51f80bd36fcc 100644
--- a/arch/mips/include/asm/cop2.h
+++ b/arch/mips/include/asm/cop2.h
@@ -16,8 +16,8 @@
16extern void octeon_cop2_save(struct octeon_cop2_state *); 16extern void octeon_cop2_save(struct octeon_cop2_state *);
17extern void octeon_cop2_restore(struct octeon_cop2_state *); 17extern void octeon_cop2_restore(struct octeon_cop2_state *);
18 18
19#define cop2_save(r) octeon_cop2_save(r) 19#define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2)
20#define cop2_restore(r) octeon_cop2_restore(r) 20#define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2)
21 21
22#define cop2_present 1 22#define cop2_present 1
23#define cop2_lazy_restore 1 23#define cop2_lazy_restore 1
@@ -26,26 +26,26 @@ extern void octeon_cop2_restore(struct octeon_cop2_state *);
26 26
27extern void nlm_cop2_save(struct nlm_cop2_state *); 27extern void nlm_cop2_save(struct nlm_cop2_state *);
28extern void nlm_cop2_restore(struct nlm_cop2_state *); 28extern void nlm_cop2_restore(struct nlm_cop2_state *);
29#define cop2_save(r) nlm_cop2_save(r) 29
30#define cop2_restore(r) nlm_cop2_restore(r) 30#define cop2_save(r) nlm_cop2_save(&(r)->thread.cp2)
31#define cop2_restore(r) nlm_cop2_restore(&(r)->thread.cp2)
31 32
32#define cop2_present 1 33#define cop2_present 1
33#define cop2_lazy_restore 0 34#define cop2_lazy_restore 0
34 35
35#elif defined(CONFIG_CPU_LOONGSON3) 36#elif defined(CONFIG_CPU_LOONGSON3)
36 37
37#define cop2_save(r)
38#define cop2_restore(r)
39
40#define cop2_present 1 38#define cop2_present 1
41#define cop2_lazy_restore 1 39#define cop2_lazy_restore 1
40#define cop2_save(r) do { (r); } while (0)
41#define cop2_restore(r) do { (r); } while (0)
42 42
43#else 43#else
44 44
45#define cop2_present 0 45#define cop2_present 0
46#define cop2_lazy_restore 0 46#define cop2_lazy_restore 0
47#define cop2_save(r) 47#define cop2_save(r) do { (r); } while (0)
48#define cop2_restore(r) 48#define cop2_restore(r) do { (r); } while (0)
49#endif 49#endif
50 50
51enum cu2_ops { 51enum cu2_ops {
diff --git a/arch/mips/include/asm/eva.h b/arch/mips/include/asm/eva.h
new file mode 100644
index 000000000000..a3d1807f227c
--- /dev/null
+++ b/arch/mips/include/asm/eva.h
@@ -0,0 +1,43 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2014, Imagination Technologies Ltd.
7 *
8 * EVA functions for generic code
9 */
10
11#ifndef _ASM_EVA_H
12#define _ASM_EVA_H
13
14#include <kernel-entry-init.h>
15
16#ifdef __ASSEMBLY__
17
18#ifdef CONFIG_EVA
19
20/*
21 * EVA early init code
22 *
23 * Platforms must define their own 'platform_eva_init' macro in
24 * their kernel-entry-init.h header. This macro usually does the
25 * platform specific configuration of the segmentation registers,
26 * and it is normally called from assembly code.
27 *
28 */
29
30.macro eva_init
31platform_eva_init
32.endm
33
34#else
35
36.macro eva_init
37.endm
38
39#endif /* CONFIG_EVA */
40
41#endif /* __ASSEMBLY__ */
42
43#endif
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 3f20b2111d56..d7699cf7e135 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -49,7 +49,7 @@
49#endif 49#endif
50#define GICBIS(reg, mask, bits) \ 50#define GICBIS(reg, mask, bits) \
51 do { u32 data; \ 51 do { u32 data; \
52 GICREAD((reg), data); \ 52 GICREAD(reg, data); \
53 data &= ~(mask); \ 53 data &= ~(mask); \
54 data |= ((bits) & (mask)); \ 54 data |= ((bits) & (mask)); \
55 GICWRITE((reg), data); \ 55 GICWRITE((reg), data); \
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
index ae1f7b24dd1a..39f07aec640c 100644
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -26,6 +26,8 @@ static inline int irq_canonicalize(int irq)
26#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ 26#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
27#endif 27#endif
28 28
29asmlinkage void plat_irq_dispatch(void);
30
29extern void do_IRQ(unsigned int irq); 31extern void do_IRQ(unsigned int irq);
30 32
31extern void arch_init_irq(void); 33extern void arch_init_irq(void);
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index 7a3fc67bd7f9..f2c249796ea8 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -96,11 +96,6 @@
96#define CAUSEB_DC 27 96#define CAUSEB_DC 27
97#define CAUSEF_DC (_ULCAST_(1) << 27) 97#define CAUSEF_DC (_ULCAST_(1) << 27)
98 98
99struct kvm;
100struct kvm_run;
101struct kvm_vcpu;
102struct kvm_interrupt;
103
104extern atomic_t kvm_mips_instance; 99extern atomic_t kvm_mips_instance;
105extern pfn_t(*kvm_mips_gfn_to_pfn) (struct kvm *kvm, gfn_t gfn); 100extern pfn_t(*kvm_mips_gfn_to_pfn) (struct kvm *kvm, gfn_t gfn);
106extern void (*kvm_mips_release_pfn_clean) (pfn_t pfn); 101extern void (*kvm_mips_release_pfn_clean) (pfn_t pfn);
@@ -767,5 +762,16 @@ extern int kvm_mips_trans_mtc0(uint32_t inst, uint32_t *opc,
767extern void kvm_mips_dump_stats(struct kvm_vcpu *vcpu); 762extern void kvm_mips_dump_stats(struct kvm_vcpu *vcpu);
768extern unsigned long kvm_mips_get_ramsize(struct kvm *kvm); 763extern unsigned long kvm_mips_get_ramsize(struct kvm *kvm);
769 764
765static inline void kvm_arch_hardware_disable(void) {}
766static inline void kvm_arch_hardware_unsetup(void) {}
767static inline void kvm_arch_sync_events(struct kvm *kvm) {}
768static inline void kvm_arch_free_memslot(struct kvm *kvm,
769 struct kvm_memory_slot *free, struct kvm_memory_slot *dont) {}
770static inline void kvm_arch_memslots_updated(struct kvm *kvm) {}
771static inline void kvm_arch_flush_shadow_all(struct kvm *kvm) {}
772static inline void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
773 struct kvm_memory_slot *slot) {}
774static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {}
775static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
770 776
771#endif /* __MIPS_KVM_HOST_H__ */ 777#endif /* __MIPS_KVM_HOST_H__ */
diff --git a/arch/mips/include/asm/mach-ip28/spaces.h b/arch/mips/include/asm/mach-ip28/spaces.h
index 5d6a76434d00..c4a912733b65 100644
--- a/arch/mips/include/asm/mach-ip28/spaces.h
+++ b/arch/mips/include/asm/mach-ip28/spaces.h
@@ -11,15 +11,8 @@
11#ifndef _ASM_MACH_IP28_SPACES_H 11#ifndef _ASM_MACH_IP28_SPACES_H
12#define _ASM_MACH_IP28_SPACES_H 12#define _ASM_MACH_IP28_SPACES_H
13 13
14#define CAC_BASE _AC(0xa800000000000000, UL)
15
16#define HIGHMEM_START (~0UL)
17
18#define PHYS_OFFSET _AC(0x20000000, UL) 14#define PHYS_OFFSET _AC(0x20000000, UL)
19 15
20#define UNCAC_BASE _AC(0xc0000000, UL) /* 0xa0000000 + PHYS_OFFSET */
21#define IO_BASE UNCAC_BASE
22
23#include <asm/mach-generic/spaces.h> 16#include <asm/mach-generic/spaces.h>
24 17
25#endif /* _ASM_MACH_IP28_SPACES_H */ 18#endif /* _ASM_MACH_IP28_SPACES_H */
diff --git a/arch/mips/include/asm/mach-malta/kernel-entry-init.h b/arch/mips/include/asm/mach-malta/kernel-entry-init.h
index 77eeda77e73c..0cf8622db27f 100644
--- a/arch/mips/include/asm/mach-malta/kernel-entry-init.h
+++ b/arch/mips/include/asm/mach-malta/kernel-entry-init.h
@@ -10,14 +10,15 @@
10#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H 10#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
11#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H 11#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
12 12
13#include <asm/regdef.h>
14#include <asm/mipsregs.h>
15
13 /* 16 /*
14 * Prepare segments for EVA boot: 17 * Prepare segments for EVA boot:
15 * 18 *
16 * This is in case the processor boots in legacy configuration 19 * This is in case the processor boots in legacy configuration
17 * (SI_EVAReset is de-asserted and CONFIG5.K == 0) 20 * (SI_EVAReset is de-asserted and CONFIG5.K == 0)
18 * 21 *
19 * On entry, t1 is loaded with CP0_CONFIG
20 *
21 * ========================= Mappings ============================= 22 * ========================= Mappings =============================
22 * Virtual memory Physical memory Mapping 23 * Virtual memory Physical memory Mapping
23 * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg) 24 * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg)
@@ -30,12 +31,20 @@
30 * 31 *
31 * 32 *
32 * Lowmem is expanded to 2GB 33 * Lowmem is expanded to 2GB
34 *
35 * The following code uses the t0, t1, t2 and ra registers without
36 * previously preserving them.
37 *
33 */ 38 */
34 .macro eva_entry 39 .macro platform_eva_init
40
41 .set push
42 .set reorder
35 /* 43 /*
36 * Get Config.K0 value and use it to program 44 * Get Config.K0 value and use it to program
37 * the segmentation registers 45 * the segmentation registers
38 */ 46 */
47 mfc0 t1, CP0_CONFIG
39 andi t1, 0x7 /* CCA */ 48 andi t1, 0x7 /* CCA */
40 move t2, t1 49 move t2, t1
41 ins t2, t1, 16, 3 50 ins t2, t1, 16, 3
@@ -77,6 +86,8 @@
77 mtc0 t0, $16, 5 86 mtc0 t0, $16, 5
78 sync 87 sync
79 jal mips_ihb 88 jal mips_ihb
89
90 .set pop
80 .endm 91 .endm
81 92
82 .macro kernel_entry_setup 93 .macro kernel_entry_setup
@@ -95,7 +106,7 @@
95 sll t0, t0, 6 /* SC bit */ 106 sll t0, t0, 6 /* SC bit */
96 bgez t0, 9f 107 bgez t0, 9f
97 108
98 eva_entry 109 platform_eva_init
99 b 0f 110 b 0f
1009: 1119:
101 /* Assume we came from YAMON... */ 112 /* Assume we came from YAMON... */
@@ -127,8 +138,7 @@ nonsc_processor:
127#ifdef CONFIG_EVA 138#ifdef CONFIG_EVA
128 sync 139 sync
129 ehb 140 ehb
130 mfc0 t1, CP0_CONFIG 141 platform_eva_init
131 eva_entry
132#endif 142#endif
133 .endm 143 .endm
134 144
diff --git a/arch/mips/include/asm/mach-netlogic/topology.h b/arch/mips/include/asm/mach-netlogic/topology.h
index ceeb1f5e7129..0eb43c832b25 100644
--- a/arch/mips/include/asm/mach-netlogic/topology.h
+++ b/arch/mips/include/asm/mach-netlogic/topology.h
@@ -10,13 +10,6 @@
10 10
11#include <asm/mach-netlogic/multi-node.h> 11#include <asm/mach-netlogic/multi-node.h>
12 12
13#ifdef CONFIG_SMP
14#define topology_physical_package_id(cpu) cpu_to_node(cpu)
15#define topology_core_id(cpu) (cpu_logical_map(cpu) / NLM_THREADS_PER_CORE)
16#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu])
17#define topology_core_cpumask(cpu) cpumask_of_node(cpu_to_node(cpu))
18#endif
19
20#include <asm-generic/topology.h> 13#include <asm-generic/topology.h>
21 14
22#endif /* _ASM_MACH_NETLOGIC_TOPOLOGY_H */ 15#endif /* _ASM_MACH_NETLOGIC_TOPOLOGY_H */
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index 5699ec3a71af..3be81803595d 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -37,7 +37,7 @@
37 37
38/* 38/*
39 * This is used for calculating the real page sizes 39 * This is used for calculating the real page sizes
40 * for FTLB or VTLB + FTLB confugrations. 40 * for FTLB or VTLB + FTLB configurations.
41 */ 41 */
42static inline unsigned int page_size_ftlb(unsigned int mmuextdef) 42static inline unsigned int page_size_ftlb(unsigned int mmuextdef)
43{ 43{
@@ -223,7 +223,8 @@ static inline int pfn_valid(unsigned long pfn)
223 223
224#endif 224#endif
225 225
226#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr))) 226#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys((void *) \
227 (kaddr))))
227 228
228extern int __virt_addr_valid(const volatile void *kaddr); 229extern int __virt_addr_valid(const volatile void *kaddr);
229#define virt_addr_valid(kaddr) \ 230#define virt_addr_valid(kaddr) \
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 027c74db13f9..df49a308085c 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -122,6 +122,9 @@ do { \
122 } \ 122 } \
123} while(0) 123} while(0)
124 124
125extern void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
126 pte_t pteval);
127
125#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 128#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
126 129
127#define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL)) 130#define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL))
@@ -145,7 +148,6 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
145 } 148 }
146 } 149 }
147} 150}
148#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
149 151
150static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 152static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
151{ 153{
@@ -183,7 +185,6 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
183 } 185 }
184#endif 186#endif
185} 187}
186#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
187 188
188static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 189static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
189{ 190{
@@ -390,15 +391,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
390 391
391extern void __update_tlb(struct vm_area_struct *vma, unsigned long address, 392extern void __update_tlb(struct vm_area_struct *vma, unsigned long address,
392 pte_t pte); 393 pte_t pte);
393extern void __update_cache(struct vm_area_struct *vma, unsigned long address,
394 pte_t pte);
395 394
396static inline void update_mmu_cache(struct vm_area_struct *vma, 395static inline void update_mmu_cache(struct vm_area_struct *vma,
397 unsigned long address, pte_t *ptep) 396 unsigned long address, pte_t *ptep)
398{ 397{
399 pte_t pte = *ptep; 398 pte_t pte = *ptep;
400 __update_tlb(vma, address, pte); 399 __update_tlb(vma, address, pte);
401 __update_cache(vma, address, pte);
402} 400}
403 401
404static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, 402static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 1e0f20a9cdda..eacf865d21c2 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -37,11 +37,6 @@ extern int __cpu_logical_map[NR_CPUS];
37 37
38#define NO_PROC_ID (-1) 38#define NO_PROC_ID (-1)
39 39
40#define topology_physical_package_id(cpu) (cpu_data[cpu].package)
41#define topology_core_id(cpu) (cpu_data[cpu].core)
42#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
43#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu])
44
45#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ 40#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
46#define SMP_CALL_FUNCTION 0x2 41#define SMP_CALL_FUNCTION 0x2
47/* Octeon - Tell another core to flush its icache */ 42/* Octeon - Tell another core to flush its icache */
diff --git a/arch/mips/include/asm/suspend.h b/arch/mips/include/asm/suspend.h
deleted file mode 100644
index 3adac3b53d19..000000000000
--- a/arch/mips/include/asm/suspend.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_SUSPEND_H
2#define __ASM_SUSPEND_H
3
4/* References to section boundaries */
5extern const void __nosave_begin, __nosave_end;
6
7#endif /* __ASM_SUSPEND_H */
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
index 495c1041a2cc..b928b6f898cd 100644
--- a/arch/mips/include/asm/switch_to.h
+++ b/arch/mips/include/asm/switch_to.h
@@ -92,7 +92,7 @@ do { \
92 KSTK_STATUS(prev) &= ~ST0_CU2; \ 92 KSTK_STATUS(prev) &= ~ST0_CU2; \
93 __c0_stat = read_c0_status(); \ 93 __c0_stat = read_c0_status(); \
94 write_c0_status(__c0_stat | ST0_CU2); \ 94 write_c0_status(__c0_stat | ST0_CU2); \
95 cop2_save(&prev->thread.cp2); \ 95 cop2_save(prev); \
96 write_c0_status(__c0_stat & ~ST0_CU2); \ 96 write_c0_status(__c0_stat & ~ST0_CU2); \
97 } \ 97 } \
98 __clear_software_ll_bit(); \ 98 __clear_software_ll_bit(); \
@@ -111,7 +111,7 @@ do { \
111 (KSTK_STATUS(current) & ST0_CU2)) { \ 111 (KSTK_STATUS(current) & ST0_CU2)) { \
112 __c0_stat = read_c0_status(); \ 112 __c0_stat = read_c0_status(); \
113 write_c0_status(__c0_stat | ST0_CU2); \ 113 write_c0_status(__c0_stat | ST0_CU2); \
114 cop2_restore(&current->thread.cp2); \ 114 cop2_restore(current); \
115 write_c0_status(__c0_stat & ~ST0_CU2); \ 115 write_c0_status(__c0_stat & ~ST0_CU2); \
116 } \ 116 } \
117 if (cpu_has_dsp) \ 117 if (cpu_has_dsp) \
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index 17960fe7a8ce..cdf68b33bd65 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -131,10 +131,12 @@ static inline int syscall_get_arch(void)
131{ 131{
132 int arch = EM_MIPS; 132 int arch = EM_MIPS;
133#ifdef CONFIG_64BIT 133#ifdef CONFIG_64BIT
134 if (!test_thread_flag(TIF_32BIT_REGS)) 134 if (!test_thread_flag(TIF_32BIT_REGS)) {
135 arch |= __AUDIT_ARCH_64BIT; 135 arch |= __AUDIT_ARCH_64BIT;
136 if (test_thread_flag(TIF_32BIT_ADDR)) 136 /* N32 sets only TIF_32BIT_ADDR */
137 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; 137 if (test_thread_flag(TIF_32BIT_ADDR))
138 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
139 }
138#endif 140#endif
139#if defined(__LITTLE_ENDIAN) 141#if defined(__LITTLE_ENDIAN)
140 arch |= __AUDIT_ARCH_LE; 142 arch |= __AUDIT_ARCH_LE;
diff --git a/arch/mips/include/asm/topology.h b/arch/mips/include/asm/topology.h
index 20ea4859c822..3e307ec2afba 100644
--- a/arch/mips/include/asm/topology.h
+++ b/arch/mips/include/asm/topology.h
@@ -9,5 +9,13 @@
9#define __ASM_TOPOLOGY_H 9#define __ASM_TOPOLOGY_H
10 10
11#include <topology.h> 11#include <topology.h>
12#include <linux/smp.h>
13
14#ifdef CONFIG_SMP
15#define topology_physical_package_id(cpu) (cpu_data[cpu].package)
16#define topology_core_id(cpu) (cpu_data[cpu].core)
17#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
18#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu])
19#endif
12 20
13#endif /* __ASM_TOPOLOGY_H */ 21#endif /* __ASM_TOPOLOGY_H */
diff --git a/arch/mips/include/uapi/asm/ioctls.h b/arch/mips/include/uapi/asm/ioctls.h
index b1e637757fe3..740219c2c894 100644
--- a/arch/mips/include/uapi/asm/ioctls.h
+++ b/arch/mips/include/uapi/asm/ioctls.h
@@ -81,6 +81,8 @@
81#define TCSETS2 _IOW('T', 0x2B, struct termios2) 81#define TCSETS2 _IOW('T', 0x2B, struct termios2)
82#define TCSETSW2 _IOW('T', 0x2C, struct termios2) 82#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
83#define TCSETSF2 _IOW('T', 0x2D, struct termios2) 83#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
84#define TIOCGRS485 _IOR('T', 0x2E, struct serial_rs485)
85#define TIOCSRS485 _IOWR('T', 0x2F, struct serial_rs485)
84#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 86#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
85#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ 87#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
86#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */ 88#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index 9bc13eaf9d67..fdb4923777d1 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -373,16 +373,18 @@
373#define __NR_sched_getattr (__NR_Linux + 350) 373#define __NR_sched_getattr (__NR_Linux + 350)
374#define __NR_renameat2 (__NR_Linux + 351) 374#define __NR_renameat2 (__NR_Linux + 351)
375#define __NR_seccomp (__NR_Linux + 352) 375#define __NR_seccomp (__NR_Linux + 352)
376#define __NR_getrandom (__NR_Linux + 353)
377#define __NR_memfd_create (__NR_Linux + 354)
376 378
377/* 379/*
378 * Offset of the last Linux o32 flavoured syscall 380 * Offset of the last Linux o32 flavoured syscall
379 */ 381 */
380#define __NR_Linux_syscalls 352 382#define __NR_Linux_syscalls 354
381 383
382#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 384#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
383 385
384#define __NR_O32_Linux 4000 386#define __NR_O32_Linux 4000
385#define __NR_O32_Linux_syscalls 352 387#define __NR_O32_Linux_syscalls 354
386 388
387#if _MIPS_SIM == _MIPS_SIM_ABI64 389#if _MIPS_SIM == _MIPS_SIM_ABI64
388 390
@@ -703,16 +705,18 @@
703#define __NR_sched_getattr (__NR_Linux + 310) 705#define __NR_sched_getattr (__NR_Linux + 310)
704#define __NR_renameat2 (__NR_Linux + 311) 706#define __NR_renameat2 (__NR_Linux + 311)
705#define __NR_seccomp (__NR_Linux + 312) 707#define __NR_seccomp (__NR_Linux + 312)
708#define __NR_getrandom (__NR_Linux + 313)
709#define __NR_memfd_create (__NR_Linux + 314)
706 710
707/* 711/*
708 * Offset of the last Linux 64-bit flavoured syscall 712 * Offset of the last Linux 64-bit flavoured syscall
709 */ 713 */
710#define __NR_Linux_syscalls 312 714#define __NR_Linux_syscalls 314
711 715
712#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 716#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
713 717
714#define __NR_64_Linux 5000 718#define __NR_64_Linux 5000
715#define __NR_64_Linux_syscalls 312 719#define __NR_64_Linux_syscalls 314
716 720
717#if _MIPS_SIM == _MIPS_SIM_NABI32 721#if _MIPS_SIM == _MIPS_SIM_NABI32
718 722
@@ -1037,15 +1041,17 @@
1037#define __NR_sched_getattr (__NR_Linux + 314) 1041#define __NR_sched_getattr (__NR_Linux + 314)
1038#define __NR_renameat2 (__NR_Linux + 315) 1042#define __NR_renameat2 (__NR_Linux + 315)
1039#define __NR_seccomp (__NR_Linux + 316) 1043#define __NR_seccomp (__NR_Linux + 316)
1044#define __NR_getrandom (__NR_Linux + 317)
1045#define __NR_memfd_create (__NR_Linux + 318)
1040 1046
1041/* 1047/*
1042 * Offset of the last N32 flavoured syscall 1048 * Offset of the last N32 flavoured syscall
1043 */ 1049 */
1044#define __NR_Linux_syscalls 316 1050#define __NR_Linux_syscalls 318
1045 1051
1046#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1052#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
1047 1053
1048#define __NR_N32_Linux 6000 1054#define __NR_N32_Linux 6000
1049#define __NR_N32_Linux_syscalls 316 1055#define __NR_N32_Linux_syscalls 318
1050 1056
1051#endif /* _UAPI_ASM_UNISTD_H */ 1057#endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
index 6f4f739dad96..e6e97d2a5c9e 100644
--- a/arch/mips/kernel/cps-vec.S
+++ b/arch/mips/kernel/cps-vec.S
@@ -13,6 +13,7 @@
13#include <asm/asm-offsets.h> 13#include <asm/asm-offsets.h>
14#include <asm/asmmacro.h> 14#include <asm/asmmacro.h>
15#include <asm/cacheops.h> 15#include <asm/cacheops.h>
16#include <asm/eva.h>
16#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
17#include <asm/mipsmtregs.h> 18#include <asm/mipsmtregs.h>
18#include <asm/pm.h> 19#include <asm/pm.h>
@@ -166,6 +167,9 @@ dcache_done:
1661: jal mips_cps_core_init 1671: jal mips_cps_core_init
167 nop 168 nop
168 169
170 /* Do any EVA initialization if necessary */
171 eva_init
172
169 /* 173 /*
170 * Boot any other VPEs within this core that should be online, and 174 * Boot any other VPEs within this core that should be online, and
171 * deactivate this VPE if it should be offline. 175 * deactivate this VPE if it should be offline.
diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c
index 992e18474da5..50980bf3983e 100644
--- a/arch/mips/kernel/machine_kexec.c
+++ b/arch/mips/kernel/machine_kexec.c
@@ -71,8 +71,12 @@ machine_kexec(struct kimage *image)
71 kexec_start_address = 71 kexec_start_address =
72 (unsigned long) phys_to_virt(image->start); 72 (unsigned long) phys_to_virt(image->start);
73 73
74 kexec_indirection_page = 74 if (image->type == KEXEC_TYPE_DEFAULT) {
75 (unsigned long) phys_to_virt(image->head & PAGE_MASK); 75 kexec_indirection_page =
76 (unsigned long) phys_to_virt(image->head & PAGE_MASK);
77 } else {
78 kexec_indirection_page = (unsigned long)&image->head;
79 }
76 80
77 memcpy((void*)reboot_code_buffer, relocate_new_kernel, 81 memcpy((void*)reboot_code_buffer, relocate_new_kernel,
78 relocate_new_kernel_size); 82 relocate_new_kernel_size);
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 5d25462de8a6..2f7c734771f4 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -129,7 +129,11 @@ NESTED(_mcount, PT_SIZE, ra)
129 nop 129 nop
130#endif 130#endif
131 b ftrace_stub 131 b ftrace_stub
132#ifdef CONFIG_32BIT
133 addiu sp, sp, 8
134#else
132 nop 135 nop
136#endif
133 137
134static_trace: 138static_trace:
135 MCOUNT_SAVE_REGS 139 MCOUNT_SAVE_REGS
@@ -139,6 +143,9 @@ static_trace:
139 move a1, AT /* arg2: parent's return address */ 143 move a1, AT /* arg2: parent's return address */
140 144
141 MCOUNT_RESTORE_REGS 145 MCOUNT_RESTORE_REGS
146#ifdef CONFIG_32BIT
147 addiu sp, sp, 8
148#endif
142 .globl ftrace_stub 149 .globl ftrace_stub
143ftrace_stub: 150ftrace_stub:
144 RETURN_BACK 151 RETURN_BACK
@@ -183,6 +190,11 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra)
183 jal prepare_ftrace_return 190 jal prepare_ftrace_return
184 nop 191 nop
185 MCOUNT_RESTORE_REGS 192 MCOUNT_RESTORE_REGS
193#ifndef CONFIG_DYNAMIC_FTRACE
194#ifdef CONFIG_32BIT
195 addiu sp, sp, 8
196#endif
197#endif
186 RETURN_BACK 198 RETURN_BACK
187 END(ftrace_graph_caller) 199 END(ftrace_graph_caller)
188 200
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 14bf74b0f51c..b63f2482f288 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -558,7 +558,7 @@ static int mipspmu_get_irq(void)
558 if (mipspmu.irq >= 0) { 558 if (mipspmu.irq >= 0) {
559 /* Request my own irq handler. */ 559 /* Request my own irq handler. */
560 err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq, 560 err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq,
561 IRQF_PERCPU | IRQF_NOBALANCING, 561 IRQF_PERCPU | IRQF_NOBALANCING | IRQF_NO_THREAD,
562 "mips_perf_pmu", NULL); 562 "mips_perf_pmu", NULL);
563 if (err) { 563 if (err) {
564 pr_warning("Unable to request IRQ%d for MIPS " 564 pr_warning("Unable to request IRQ%d for MIPS "
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index f93b4cbec739..744cd10ba599 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -577,3 +577,5 @@ EXPORT(sys_call_table)
577 PTR sys_sched_getattr /* 4350 */ 577 PTR sys_sched_getattr /* 4350 */
578 PTR sys_renameat2 578 PTR sys_renameat2
579 PTR sys_seccomp 579 PTR sys_seccomp
580 PTR sys_getrandom
581 PTR sys_memfd_create
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 03ebd9979ad2..002b1bc09c38 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -432,4 +432,6 @@ EXPORT(sys_call_table)
432 PTR sys_sched_getattr /* 5310 */ 432 PTR sys_sched_getattr /* 5310 */
433 PTR sys_renameat2 433 PTR sys_renameat2
434 PTR sys_seccomp 434 PTR sys_seccomp
435 PTR sys_getrandom
436 PTR sys_memfd_create
435 .size sys_call_table,.-sys_call_table 437 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index ebc9228e2e15..ca6cbbe9805b 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -425,4 +425,6 @@ EXPORT(sysn32_call_table)
425 PTR sys_sched_getattr 425 PTR sys_sched_getattr
426 PTR sys_renameat2 /* 6315 */ 426 PTR sys_renameat2 /* 6315 */
427 PTR sys_seccomp 427 PTR sys_seccomp
428 PTR sys_getrandom
429 PTR sys_memfd_create
428 .size sysn32_call_table,.-sysn32_call_table 430 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 13b964fddc4a..9e10d11fbb84 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -113,15 +113,19 @@ trace_a_syscall:
113 move s0, t2 # Save syscall pointer 113 move s0, t2 # Save syscall pointer
114 move a0, sp 114 move a0, sp
115 /* 115 /*
116 * syscall number is in v0 unless we called syscall(__NR_###) 116 * absolute syscall number is in v0 unless we called syscall(__NR_###)
117 * where the real syscall number is in a0 117 * where the real syscall number is in a0
118 * note: NR_syscall is the first O32 syscall but the macro is 118 * note: NR_syscall is the first O32 syscall but the macro is
119 * only defined when compiling with -mabi=32 (CONFIG_32BIT) 119 * only defined when compiling with -mabi=32 (CONFIG_32BIT)
120 * therefore __NR_O32_Linux is used (4000) 120 * therefore __NR_O32_Linux is used (4000)
121 */ 121 */
122 addiu a1, v0, __NR_O32_Linux 122 .set push
123 bnez v0, 1f /* __NR_syscall at offset 0 */ 123 .set reorder
124 lw a1, PT_R4(sp) 124 subu t1, v0, __NR_O32_Linux
125 move a1, v0
126 bnez t1, 1f /* __NR_syscall at offset 0 */
127 lw a1, PT_R4(sp) /* Arg1 for __NR_syscall case */
128 .set pop
125 129
1261: jal syscall_trace_enter 1301: jal syscall_trace_enter
127 131
@@ -558,4 +562,6 @@ EXPORT(sys32_call_table)
558 PTR sys_sched_getattr /* 4350 */ 562 PTR sys_sched_getattr /* 4350 */
559 PTR sys_renameat2 563 PTR sys_renameat2
560 PTR sys_seccomp 564 PTR sys_seccomp
565 PTR sys_getrandom
566 PTR sys_memfd_create
561 .size sys32_call_table,.-sys32_call_table 567 .size sys32_call_table,.-sys32_call_table
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index cd7114147ae7..e3b21e51ff7e 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -77,24 +77,16 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
77 return 1; 77 return 1;
78} 78}
79 79
80int kvm_arch_hardware_enable(void *garbage) 80int kvm_arch_hardware_enable(void)
81{ 81{
82 return 0; 82 return 0;
83} 83}
84 84
85void kvm_arch_hardware_disable(void *garbage)
86{
87}
88
89int kvm_arch_hardware_setup(void) 85int kvm_arch_hardware_setup(void)
90{ 86{
91 return 0; 87 return 0;
92} 88}
93 89
94void kvm_arch_hardware_unsetup(void)
95{
96}
97
98void kvm_arch_check_processor_compat(void *rtn) 90void kvm_arch_check_processor_compat(void *rtn)
99{ 91{
100 *(int *)rtn = 0; 92 *(int *)rtn = 0;
@@ -163,10 +155,6 @@ void kvm_mips_free_vcpus(struct kvm *kvm)
163 mutex_unlock(&kvm->lock); 155 mutex_unlock(&kvm->lock);
164} 156}
165 157
166void kvm_arch_sync_events(struct kvm *kvm)
167{
168}
169
170static void kvm_mips_uninit_tlbs(void *arg) 158static void kvm_mips_uninit_tlbs(void *arg)
171{ 159{
172 /* Restore wired count */ 160 /* Restore wired count */
@@ -194,21 +182,12 @@ long kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl,
194 return -ENOIOCTLCMD; 182 return -ENOIOCTLCMD;
195} 183}
196 184
197void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
198 struct kvm_memory_slot *dont)
199{
200}
201
202int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot, 185int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
203 unsigned long npages) 186 unsigned long npages)
204{ 187{
205 return 0; 188 return 0;
206} 189}
207 190
208void kvm_arch_memslots_updated(struct kvm *kvm)
209{
210}
211
212int kvm_arch_prepare_memory_region(struct kvm *kvm, 191int kvm_arch_prepare_memory_region(struct kvm *kvm,
213 struct kvm_memory_slot *memslot, 192 struct kvm_memory_slot *memslot,
214 struct kvm_userspace_memory_region *mem, 193 struct kvm_userspace_memory_region *mem,
@@ -254,19 +233,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
254 } 233 }
255} 234}
256 235
257void kvm_arch_flush_shadow_all(struct kvm *kvm)
258{
259}
260
261void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
262 struct kvm_memory_slot *slot)
263{
264}
265
266void kvm_arch_flush_shadow(struct kvm *kvm)
267{
268}
269
270struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) 236struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
271{ 237{
272 int err, size, offset; 238 int err, size, offset;
@@ -998,10 +964,6 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
998 return 0; 964 return 0;
999} 965}
1000 966
1001void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
1002{
1003}
1004
1005int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, 967int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
1006 struct kvm_translation *tr) 968 struct kvm_translation *tr)
1007{ 969{
diff --git a/arch/mips/lantiq/falcon/sysctrl.c b/arch/mips/lantiq/falcon/sysctrl.c
index 8f1866d8124d..468ffa043607 100644
--- a/arch/mips/lantiq/falcon/sysctrl.c
+++ b/arch/mips/lantiq/falcon/sysctrl.c
@@ -221,7 +221,7 @@ void __init ltq_soc_init(void)
221 (request_mem_region(res_sys[2].start, 221 (request_mem_region(res_sys[2].start,
222 resource_size(&res_sys[2]), 222 resource_size(&res_sys[2]),
223 res_sys[2].name) < 0)) 223 res_sys[2].name) < 0))
224 pr_err("Failed to request core reources"); 224 pr_err("Failed to request core resources");
225 225
226 status_membase = ioremap_nocache(res_status.start, 226 status_membase = ioremap_nocache(res_status.start,
227 resource_size(&res_status)); 227 resource_size(&res_status));
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 51804b10a036..2b15491de494 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -318,7 +318,7 @@ void __init ltq_soc_init(void)
318 res_cgu.name) < 0) || 318 res_cgu.name) < 0) ||
319 (request_mem_region(res_ebu.start, resource_size(&res_ebu), 319 (request_mem_region(res_ebu.start, resource_size(&res_ebu),
320 res_ebu.name) < 0)) 320 res_ebu.name) < 0))
321 pr_err("Failed to request core reources"); 321 pr_err("Failed to request core resources");
322 322
323 pmu_membase = ioremap_nocache(res_pmu.start, resource_size(&res_pmu)); 323 pmu_membase = ioremap_nocache(res_pmu.start, resource_size(&res_pmu));
324 ltq_cgu_membase = ioremap_nocache(res_cgu.start, 324 ltq_cgu_membase = ioremap_nocache(res_cgu.start,
diff --git a/arch/mips/loongson/loongson-3/cop2-ex.c b/arch/mips/loongson/loongson-3/cop2-ex.c
index 9182e8d2967c..b03e37d2071a 100644
--- a/arch/mips/loongson/loongson-3/cop2-ex.c
+++ b/arch/mips/loongson/loongson-3/cop2-ex.c
@@ -22,13 +22,13 @@
22static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action, 22static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
23 void *data) 23 void *data)
24{ 24{
25 int fpu_enabled; 25 int fpu_owned;
26 int fr = !test_thread_flag(TIF_32BIT_FPREGS); 26 int fr = !test_thread_flag(TIF_32BIT_FPREGS);
27 27
28 switch (action) { 28 switch (action) {
29 case CU2_EXCEPTION: 29 case CU2_EXCEPTION:
30 preempt_disable(); 30 preempt_disable();
31 fpu_enabled = read_c0_status() & ST0_CU1; 31 fpu_owned = __is_fpu_owner();
32 if (!fr) 32 if (!fr)
33 set_c0_status(ST0_CU1 | ST0_CU2); 33 set_c0_status(ST0_CU1 | ST0_CU2);
34 else 34 else
@@ -39,8 +39,8 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
39 KSTK_STATUS(current) |= ST0_FR; 39 KSTK_STATUS(current) |= ST0_FR;
40 else 40 else
41 KSTK_STATUS(current) &= ~ST0_FR; 41 KSTK_STATUS(current) &= ~ST0_FR;
42 /* If FPU is enabled, we needn't init or restore fp */ 42 /* If FPU is owned, we needn't init or restore fp */
43 if(!fpu_enabled) { 43 if (!fpu_owned) {
44 set_thread_flag(TIF_USEDFPU); 44 set_thread_flag(TIF_USEDFPU);
45 if (!used_math()) { 45 if (!used_math()) {
46 _init_fpu(); 46 _init_fpu();
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson/loongson-3/numa.c
index ca025a6ba559..37ed184398c6 100644
--- a/arch/mips/loongson/loongson-3/numa.c
+++ b/arch/mips/loongson/loongson-3/numa.c
@@ -24,8 +24,6 @@
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/pgalloc.h> 25#include <asm/pgalloc.h>
26#include <asm/sections.h> 26#include <asm/sections.h>
27#include <linux/bootmem.h>
28#include <linux/init.h>
29#include <linux/irq.h> 27#include <linux/irq.h>
30#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
31#include <asm/mc146818-time.h> 29#include <asm/mc146818-time.h>
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index bf0fc6b16ad9..7a4727795a70 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -650,9 +650,9 @@ static inline int cop1_64bit(struct pt_regs *xcp)
650#define SIFROMREG(si, x) \ 650#define SIFROMREG(si, x) \
651do { \ 651do { \
652 if (cop1_64bit(xcp)) \ 652 if (cop1_64bit(xcp)) \
653 (si) = get_fpr32(&ctx->fpr[x], 0); \ 653 (si) = (int)get_fpr32(&ctx->fpr[x], 0); \
654 else \ 654 else \
655 (si) = get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \ 655 (si) = (int)get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \
656} while (0) 656} while (0)
657 657
658#define SITOREG(si, x) \ 658#define SITOREG(si, x) \
@@ -667,7 +667,7 @@ do { \
667 } \ 667 } \
668} while (0) 668} while (0)
669 669
670#define SIFROMHREG(si, x) ((si) = get_fpr32(&ctx->fpr[x], 1)) 670#define SIFROMHREG(si, x) ((si) = (int)get_fpr32(&ctx->fpr[x], 1))
671 671
672#define SITOHREG(si, x) \ 672#define SITOHREG(si, x) \
673do { \ 673do { \
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index f7b91d3a371d..7e3ea7766822 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -119,25 +119,36 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr)
119 119
120EXPORT_SYMBOL(__flush_anon_page); 120EXPORT_SYMBOL(__flush_anon_page);
121 121
122void __update_cache(struct vm_area_struct *vma, unsigned long address, 122static void mips_flush_dcache_from_pte(pte_t pteval, unsigned long address)
123 pte_t pte)
124{ 123{
125 struct page *page; 124 struct page *page;
126 unsigned long pfn, addr; 125 unsigned long pfn = pte_pfn(pteval);
127 int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc;
128 126
129 pfn = pte_pfn(pte);
130 if (unlikely(!pfn_valid(pfn))) 127 if (unlikely(!pfn_valid(pfn)))
131 return; 128 return;
129
132 page = pfn_to_page(pfn); 130 page = pfn_to_page(pfn);
133 if (page_mapping(page) && Page_dcache_dirty(page)) { 131 if (page_mapping(page) && Page_dcache_dirty(page)) {
134 addr = (unsigned long) page_address(page); 132 unsigned long page_addr = (unsigned long) page_address(page);
135 if (exec || pages_do_alias(addr, address & PAGE_MASK)) 133
136 flush_data_cache_page(addr); 134 if (!cpu_has_ic_fills_f_dc ||
135 pages_do_alias(page_addr, address & PAGE_MASK))
136 flush_data_cache_page(page_addr);
137 ClearPageDcacheDirty(page); 137 ClearPageDcacheDirty(page);
138 } 138 }
139} 139}
140 140
141void set_pte_at(struct mm_struct *mm, unsigned long addr,
142 pte_t *ptep, pte_t pteval)
143{
144 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) {
145 if (pte_present(pteval))
146 mips_flush_dcache_from_pte(pteval, addr);
147 }
148
149 set_pte(ptep, pteval);
150}
151
141unsigned long _page_cachable_default; 152unsigned long _page_cachable_default;
142EXPORT_SYMBOL(_page_cachable_default); 153EXPORT_SYMBOL(_page_cachable_default);
143 154
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 571aab064936..f42e35e42790 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -53,6 +53,7 @@
53 */ 53 */
54unsigned long empty_zero_page, zero_page_mask; 54unsigned long empty_zero_page, zero_page_mask;
55EXPORT_SYMBOL_GPL(empty_zero_page); 55EXPORT_SYMBOL_GPL(empty_zero_page);
56EXPORT_SYMBOL(zero_page_mask);
56 57
57/* 58/*
58 * Not static inline because used by IP27 special magic initialization code 59 * Not static inline because used by IP27 special magic initialization code
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index 0c35dee0a215..8fddd2cdbff7 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -35,13 +35,19 @@ fw_memblock_t * __init fw_getmdesc(int eva)
35 /* otherwise look in the environment */ 35 /* otherwise look in the environment */
36 36
37 memsize_str = fw_getenv("memsize"); 37 memsize_str = fw_getenv("memsize");
38 if (memsize_str) 38 if (memsize_str) {
39 tmp = kstrtol(memsize_str, 0, &memsize); 39 tmp = kstrtoul(memsize_str, 0, &memsize);
40 if (tmp)
41 pr_warn("Failed to read the 'memsize' env variable.\n");
42 }
40 if (eva) { 43 if (eva) {
41 /* Look for ememsize for EVA */ 44 /* Look for ememsize for EVA */
42 ememsize_str = fw_getenv("ememsize"); 45 ememsize_str = fw_getenv("ememsize");
43 if (ememsize_str) 46 if (ememsize_str) {
44 tmp = kstrtol(ememsize_str, 0, &ememsize); 47 tmp = kstrtoul(ememsize_str, 0, &ememsize);
48 if (tmp)
49 pr_warn("Failed to read the 'ememsize' env variable.\n");
50 }
45 } 51 }
46 if (!memsize && !ememsize) { 52 if (!memsize && !ememsize) {
47 pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); 53 pr_warn("memsize not set in YAMON, set to default (32Mb)\n");
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 05a56619ece2..7edc08398c4a 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -765,27 +765,6 @@ static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset)
765 return (u64)err << 32 | ntohl(ret); 765 return (u64)err << 32 | ntohl(ret);
766} 766}
767 767
768#ifdef __BIG_ENDIAN_BITFIELD
769#define PKT_TYPE_MAX (7 << 5)
770#else
771#define PKT_TYPE_MAX 7
772#endif
773static int pkt_type_offset(void)
774{
775 struct sk_buff skb_probe = {
776 .pkt_type = ~0,
777 };
778 u8 *ct = (u8 *)&skb_probe;
779 unsigned int off;
780
781 for (off = 0; off < sizeof(struct sk_buff); off++) {
782 if (ct[off] == PKT_TYPE_MAX)
783 return off;
784 }
785 pr_err_once("Please fix pkt_type_offset(), as pkt_type couldn't be found\n");
786 return -1;
787}
788
789static int build_body(struct jit_ctx *ctx) 768static int build_body(struct jit_ctx *ctx)
790{ 769{
791 void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w}; 770 void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w};
@@ -1332,11 +1311,7 @@ jmp_cmp:
1332 case BPF_ANC | SKF_AD_PKTTYPE: 1311 case BPF_ANC | SKF_AD_PKTTYPE:
1333 ctx->flags |= SEEN_SKB; 1312 ctx->flags |= SEEN_SKB;
1334 1313
1335 off = pkt_type_offset(); 1314 emit_load_byte(r_tmp, r_skb, PKT_TYPE_OFFSET(), ctx);
1336
1337 if (off < 0)
1338 return -1;
1339 emit_load_byte(r_tmp, r_skb, off, ctx);
1340 /* Keep only the last 3 bits */ 1315 /* Keep only the last 3 bits */
1341 emit_andi(r_A, r_tmp, PKT_TYPE_MAX, ctx); 1316 emit_andi(r_A, r_tmp, PKT_TYPE_MAX, ctx);
1342#ifdef __BIG_ENDIAN_BITFIELD 1317#ifdef __BIG_ENDIAN_BITFIELD
@@ -1417,7 +1392,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
1417 bpf_jit_dump(fp->len, alloc_size, 2, ctx.target); 1392 bpf_jit_dump(fp->len, alloc_size, 2, ctx.target);
1418 1393
1419 fp->bpf_func = (void *)ctx.target; 1394 fp->bpf_func = (void *)ctx.target;
1420 fp->jited = 1; 1395 fp->jited = true;
1421 1396
1422out: 1397out:
1423 kfree(ctx.offsets); 1398 kfree(ctx.offsets);
@@ -1427,5 +1402,6 @@ void bpf_jit_free(struct bpf_prog *fp)
1427{ 1402{
1428 if (fp->jited) 1403 if (fp->jited)
1429 module_free(NULL, fp->bpf_func); 1404 module_free(NULL, fp->bpf_func);
1430 kfree(fp); 1405
1406 bpf_prog_unlock_free(fp);
1431} 1407}
diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c
index ab0c5d14c6f7..63bbe07a1ccd 100644
--- a/arch/mips/pci/msi-octeon.c
+++ b/arch/mips/pci/msi-octeon.c
@@ -73,8 +73,7 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
73 * wants. Most devices only want 1, which will give 73 * wants. Most devices only want 1, which will give
74 * configured_private_bits and request_private_bits equal 0. 74 * configured_private_bits and request_private_bits equal 0.
75 */ 75 */
76 pci_read_config_word(dev, desc->msi_attrib.pos + PCI_MSI_FLAGS, 76 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
77 &control);
78 77
79 /* 78 /*
80 * If the number of private bits has been configured then use 79 * If the number of private bits has been configured then use
@@ -176,8 +175,7 @@ msi_irq_allocated:
176 /* Update the number of IRQs the device has available to it */ 175 /* Update the number of IRQs the device has available to it */
177 control &= ~PCI_MSI_FLAGS_QSIZE; 176 control &= ~PCI_MSI_FLAGS_QSIZE;
178 control |= request_private_bits << 4; 177 control |= request_private_bits << 4;
179 pci_write_config_word(dev, desc->msi_attrib.pos + PCI_MSI_FLAGS, 178 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
180 control);
181 179
182 irq_set_msi_desc(irq, desc); 180 irq_set_msi_desc(irq, desc);
183 write_msi_msg(irq, &msg); 181 write_msi_msg(irq, &msg);
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index cb1ef9984069..37fe8e7887e2 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -218,7 +218,7 @@ static int ltq_pci_probe(struct platform_device *pdev)
218 res_cfg = platform_get_resource(pdev, IORESOURCE_MEM, 0); 218 res_cfg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
219 res_bridge = platform_get_resource(pdev, IORESOURCE_MEM, 1); 219 res_bridge = platform_get_resource(pdev, IORESOURCE_MEM, 1);
220 if (!res_cfg || !res_bridge) { 220 if (!res_cfg || !res_bridge) {
221 dev_err(&pdev->dev, "missing memory reources\n"); 221 dev_err(&pdev->dev, "missing memory resources\n");
222 return -EINVAL; 222 return -EINVAL;
223 } 223 }
224 224
diff --git a/arch/mips/pmcs-msp71xx/msp_irq.c b/arch/mips/pmcs-msp71xx/msp_irq.c
index 941744aabb51..f914c753de21 100644
--- a/arch/mips/pmcs-msp71xx/msp_irq.c
+++ b/arch/mips/pmcs-msp71xx/msp_irq.c
@@ -51,7 +51,7 @@ static inline void sec_int_dispatch(void) { do_IRQ(MSP_INT_SEC); }
51 * the range 40-71. 51 * the range 40-71.
52 */ 52 */
53 53
54asmlinkage void plat_irq_dispatch(struct pt_regs *regs) 54asmlinkage void plat_irq_dispatch(void)
55{ 55{
56 u32 pending; 56 u32 pending;
57 57
diff --git a/arch/mips/power/cpu.c b/arch/mips/power/cpu.c
index 521e5963df05..2129e67723ff 100644
--- a/arch/mips/power/cpu.c
+++ b/arch/mips/power/cpu.c
@@ -7,7 +7,7 @@
7 * Author: Hu Hongbing <huhb@lemote.com> 7 * Author: Hu Hongbing <huhb@lemote.com>
8 * Wu Zhangjin <wuzhangjin@gmail.com> 8 * Wu Zhangjin <wuzhangjin@gmail.com>
9 */ 9 */
10#include <asm/suspend.h> 10#include <asm/sections.h>
11#include <asm/fpu.h> 11#include <asm/fpu.h>
12#include <asm/dsp.h> 12#include <asm/dsp.h>
13 13
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 9ff200ae1c9a..2791b8641df6 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -789,11 +789,11 @@ void __init txx9_iocled_init(unsigned long baseaddr,
789 if (platform_device_add(pdev)) 789 if (platform_device_add(pdev))
790 goto out_pdev; 790 goto out_pdev;
791 return; 791 return;
792
792out_pdev: 793out_pdev:
793 platform_device_put(pdev); 794 platform_device_put(pdev);
794out_gpio: 795out_gpio:
795 if (gpiochip_remove(&iocled->chip)) 796 gpiochip_remove(&iocled->chip);
796 return;
797out_unmap: 797out_unmap:
798 iounmap(iocled->mmioaddr); 798 iounmap(iocled->mmioaddr);
799out_free: 799out_free:
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index a648de1b1096..4434b54e1d87 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -181,7 +181,7 @@ endmenu
181config SMP 181config SMP
182 bool "Symmetric multi-processing support" 182 bool "Symmetric multi-processing support"
183 default y 183 default y
184 depends on MN10300_PROC_MN2WS0038 || MN10300_PROC_MN2WS0050 184 depends on MN10300_PROC_MN2WS0050
185 ---help--- 185 ---help---
186 This enables support for systems with more than one CPU. If you have 186 This enables support for systems with more than one CPU. If you have
187 a system with only one CPU, say N. If you have a system with more 187 a system with only one CPU, say N. If you have a system with more
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild
index ecbd6676bd33..54a062cb9f2c 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -4,7 +4,9 @@ generic-y += clkdev.h
4generic-y += cputime.h 4generic-y += cputime.h
5generic-y += exec.h 5generic-y += exec.h
6generic-y += hash.h 6generic-y += hash.h
7generic-y += irq_work.h
7generic-y += mcs_spinlock.h 8generic-y += mcs_spinlock.h
8generic-y += preempt.h 9generic-y += preempt.h
9generic-y += scatterlist.h 10generic-y += scatterlist.h
11generic-y += sections.h
10generic-y += trace_clock.h 12generic-y += trace_clock.h
diff --git a/arch/mn10300/include/asm/sections.h b/arch/mn10300/include/asm/sections.h
deleted file mode 100644
index 2b8c5160388f..000000000000
--- a/arch/mn10300/include/asm/sections.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/sections.h>
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 88e83368bbf5..e5a693b16da2 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -8,6 +8,7 @@ config OPENRISC
8 select OF 8 select OF
9 select OF_EARLY_FLATTREE 9 select OF_EARLY_FLATTREE
10 select IRQ_DOMAIN 10 select IRQ_DOMAIN
11 select HANDLE_DOMAIN_IRQ
11 select HAVE_MEMBLOCK 12 select HAVE_MEMBLOCK
12 select ARCH_REQUIRE_GPIOLIB 13 select ARCH_REQUIRE_GPIOLIB
13 select HAVE_ARCH_TRACEHOOK 14 select HAVE_ARCH_TRACEHOOK
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 480af0d9c2f5..89b61d7dc790 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -31,6 +31,7 @@ generic-y += ioctl.h
31generic-y += ioctls.h 31generic-y += ioctls.h
32generic-y += ipcbuf.h 32generic-y += ipcbuf.h
33generic-y += irq_regs.h 33generic-y += irq_regs.h
34generic-y += irq_work.h
34generic-y += kdebug.h 35generic-y += kdebug.h
35generic-y += kmap_types.h 36generic-y += kmap_types.h
36generic-y += kvm_para.h 37generic-y += kvm_para.h
diff --git a/arch/openrisc/include/asm/irq.h b/arch/openrisc/include/asm/irq.h
index b84634cc95eb..d9eee0a2b7b4 100644
--- a/arch/openrisc/include/asm/irq.h
+++ b/arch/openrisc/include/asm/irq.h
@@ -24,7 +24,6 @@
24 24
25#define NO_IRQ (-1) 25#define NO_IRQ (-1)
26 26
27void handle_IRQ(unsigned int, struct pt_regs *);
28extern void set_handle_irq(void (*handle_irq)(struct pt_regs *)); 27extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
29 28
30#endif /* __ASM_OPENRISC_IRQ_H__ */ 29#endif /* __ASM_OPENRISC_IRQ_H__ */
diff --git a/arch/openrisc/kernel/irq.c b/arch/openrisc/kernel/irq.c
index 967eb1430203..35e478a93116 100644
--- a/arch/openrisc/kernel/irq.c
+++ b/arch/openrisc/kernel/irq.c
@@ -48,18 +48,6 @@ void __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
48 handle_arch_irq = handle_irq; 48 handle_arch_irq = handle_irq;
49} 49}
50 50
51void handle_IRQ(unsigned int irq, struct pt_regs *regs)
52{
53 struct pt_regs *old_regs = set_irq_regs(regs);
54
55 irq_enter();
56
57 generic_handle_irq(irq);
58
59 irq_exit();
60 set_irq_regs(old_regs);
61}
62
63void __irq_entry do_IRQ(struct pt_regs *regs) 51void __irq_entry do_IRQ(struct pt_regs *regs)
64{ 52{
65 handle_arch_irq(regs); 53 handle_arch_irq(regs);
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 6e75e2030927..1554a6f2a5bb 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -321,6 +321,22 @@ source "fs/Kconfig"
321 321
322source "arch/parisc/Kconfig.debug" 322source "arch/parisc/Kconfig.debug"
323 323
324config SECCOMP
325 def_bool y
326 prompt "Enable seccomp to safely compute untrusted bytecode"
327 ---help---
328 This kernel feature is useful for number crunching applications
329 that may need to compute untrusted bytecode during their
330 execution. By using pipes or other transports made available to
331 the process as file descriptors supporting the read/write
332 syscalls, it's possible to isolate those applications in
333 their own address space using seccomp. Once seccomp is
334 enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
335 and the task is only allowed to execute a few safe syscalls
336 defined by each seccomp mode.
337
338 If unsure, say Y. Only embedded should say N here.
339
324source "security/Kconfig" 340source "security/Kconfig"
325 341
326source "crypto/Kconfig" 342source "crypto/Kconfig"
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 7187664034c3..5db8882f732c 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -48,7 +48,12 @@ cflags-y := -pipe
48 48
49# These flags should be implied by an hppa-linux configuration, but they 49# These flags should be implied by an hppa-linux configuration, but they
50# are not in gcc 3.2. 50# are not in gcc 3.2.
51cflags-y += -mno-space-regs -mfast-indirect-calls 51cflags-y += -mno-space-regs
52
53# -mfast-indirect-calls is only relevant for 32-bit kernels.
54ifndef CONFIG_64BIT
55cflags-y += -mfast-indirect-calls
56endif
52 57
53# Currently we save and restore fpregs on all kernel entry/interruption paths. 58# Currently we save and restore fpregs on all kernel entry/interruption paths.
54# If that gets optimized, we might need to disable the use of fpregs in the 59# If that gets optimized, we might need to disable the use of fpregs in the
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index 90025322b75e..0490199d7b15 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -31,6 +31,7 @@ CONFIG_PD6729=m
31CONFIG_I82092=m 31CONFIG_I82092=m
32# CONFIG_SUPERIO is not set 32# CONFIG_SUPERIO is not set
33# CONFIG_CHASSIS_LCD_LED is not set 33# CONFIG_CHASSIS_LCD_LED is not set
34CONFIG_NET=y
34CONFIG_PACKET=y 35CONFIG_PACKET=y
35CONFIG_UNIX=y 36CONFIG_UNIX=y
36CONFIG_XFRM_USER=m 37CONFIG_XFRM_USER=m
diff --git a/arch/parisc/configs/c8000_defconfig b/arch/parisc/configs/c8000_defconfig
index 8249ac9d9cfc..269c23d23fcb 100644
--- a/arch/parisc/configs/c8000_defconfig
+++ b/arch/parisc/configs/c8000_defconfig
@@ -33,6 +33,7 @@ CONFIG_PCI_LBA=y
33# CONFIG_PDC_CHASSIS_WARN is not set 33# CONFIG_PDC_CHASSIS_WARN is not set
34# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 34# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
35CONFIG_BINFMT_MISC=m 35CONFIG_BINFMT_MISC=m
36CONFIG_NET=y
36CONFIG_PACKET=y 37CONFIG_PACKET=y
37CONFIG_UNIX=y 38CONFIG_UNIX=y
38CONFIG_XFRM_USER=m 39CONFIG_XFRM_USER=m
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index d9dc6cd3b7d2..e5c4da035810 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -456,7 +456,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
456 } 456 }
457 457
458 /* String could be altered by userspace after strlen_user() */ 458 /* String could be altered by userspace after strlen_user() */
459 fsname[len] = '\0'; 459 fsname[len - 1] = '\0';
460 460
461 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); 461 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname);
462 if ( !strcmp(fsname, "hfs") ) { 462 if ( !strcmp(fsname, "hfs") ) {
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index ecf25e6678ad..ffb024b8423f 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -10,6 +10,7 @@ generic-y += exec.h
10generic-y += hash.h 10generic-y += hash.h
11generic-y += hw_irq.h 11generic-y += hw_irq.h
12generic-y += irq_regs.h 12generic-y += irq_regs.h
13generic-y += irq_work.h
13generic-y += kdebug.h 14generic-y += kdebug.h
14generic-y += kvm_para.h 15generic-y += kvm_para.h
15generic-y += local.h 16generic-y += local.h
diff --git a/arch/parisc/include/asm/seccomp.h b/arch/parisc/include/asm/seccomp.h
new file mode 100644
index 000000000000..015f7887aa29
--- /dev/null
+++ b/arch/parisc/include/asm/seccomp.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_PARISC_SECCOMP_H
2#define _ASM_PARISC_SECCOMP_H
3
4#include <linux/unistd.h>
5
6#define __NR_seccomp_read __NR_read
7#define __NR_seccomp_write __NR_write
8#define __NR_seccomp_exit __NR_exit
9#define __NR_seccomp_sigreturn __NR_rt_sigreturn
10
11#define __NR_seccomp_read_32 __NR_read
12#define __NR_seccomp_write_32 __NR_write
13#define __NR_seccomp_exit_32 __NR_exit
14#define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn
15
16#endif /* _ASM_PARISC_SECCOMP_H */
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h
index 4b9b10ce1f9d..a84611835549 100644
--- a/arch/parisc/include/asm/thread_info.h
+++ b/arch/parisc/include/asm/thread_info.h
@@ -60,6 +60,7 @@ struct thread_info {
60#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ 60#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */
61#define TIF_SINGLESTEP 9 /* single stepping? */ 61#define TIF_SINGLESTEP 9 /* single stepping? */
62#define TIF_BLOCKSTEP 10 /* branch stepping? */ 62#define TIF_BLOCKSTEP 10 /* branch stepping? */
63#define TIF_SECCOMP 11 /* secure computing */
63 64
64#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 65#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
65#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 66#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
@@ -70,11 +71,13 @@ struct thread_info {
70#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 71#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
71#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 72#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
72#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) 73#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
74#define _TIF_SECCOMP (1 << TIF_SECCOMP)
73 75
74#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ 76#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
75 _TIF_NEED_RESCHED) 77 _TIF_NEED_RESCHED)
76#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 78#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
77 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT) 79 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \
80 _TIF_SECCOMP)
78 81
79#ifdef CONFIG_64BIT 82#ifdef CONFIG_64BIT
80# ifdef CONFIG_COMPAT 83# ifdef CONFIG_COMPAT
diff --git a/arch/parisc/include/uapi/asm/ioctls.h b/arch/parisc/include/uapi/asm/ioctls.h
index 66719c38a36b..b6572f051b67 100644
--- a/arch/parisc/include/uapi/asm/ioctls.h
+++ b/arch/parisc/include/uapi/asm/ioctls.h
@@ -50,6 +50,8 @@
50#define TCSETS2 _IOW('T',0x2B, struct termios2) 50#define TCSETS2 _IOW('T',0x2B, struct termios2)
51#define TCSETSW2 _IOW('T',0x2C, struct termios2) 51#define TCSETSW2 _IOW('T',0x2C, struct termios2)
52#define TCSETSF2 _IOW('T',0x2D, struct termios2) 52#define TCSETSF2 _IOW('T',0x2D, struct termios2)
53#define TIOCGRS485 _IOR('T', 0x2E, struct serial_rs485)
54#define TIOCSRS485 _IOWR('T', 0x2F, struct serial_rs485)
53#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 55#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
54#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 56#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
55#define TIOCGDEV _IOR('T',0x32, int) /* Get primary device node of /dev/console */ 57#define TIOCGDEV _IOR('T',0x32, int) /* Get primary device node of /dev/console */
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
index 47e0e21d2272..8667f18be238 100644
--- a/arch/parisc/include/uapi/asm/unistd.h
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -830,8 +830,11 @@
830#define __NR_sched_getattr (__NR_Linux + 335) 830#define __NR_sched_getattr (__NR_Linux + 335)
831#define __NR_utimes (__NR_Linux + 336) 831#define __NR_utimes (__NR_Linux + 336)
832#define __NR_renameat2 (__NR_Linux + 337) 832#define __NR_renameat2 (__NR_Linux + 337)
833#define __NR_seccomp (__NR_Linux + 338)
834#define __NR_getrandom (__NR_Linux + 339)
835#define __NR_memfd_create (__NR_Linux + 340)
833 836
834#define __NR_Linux_syscalls (__NR_renameat2 + 1) 837#define __NR_Linux_syscalls (__NR_memfd_create + 1)
835 838
836 839
837#define __IGNORE_select /* newselect */ 840#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index e842ee233db4..92438c21d453 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -17,6 +17,7 @@
17#include <linux/user.h> 17#include <linux/user.h>
18#include <linux/personality.h> 18#include <linux/personality.h>
19#include <linux/security.h> 19#include <linux/security.h>
20#include <linux/seccomp.h>
20#include <linux/compat.h> 21#include <linux/compat.h>
21#include <linux/signal.h> 22#include <linux/signal.h>
22#include <linux/audit.h> 23#include <linux/audit.h>
@@ -270,6 +271,9 @@ long do_syscall_trace_enter(struct pt_regs *regs)
270{ 271{
271 long ret = 0; 272 long ret = 0;
272 273
274 /* Do the secure computing check first. */
275 secure_computing_strict(regs->gr[20]);
276
273 if (test_thread_flag(TIF_SYSCALL_TRACE) && 277 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
274 tracehook_report_syscall_entry(regs)) 278 tracehook_report_syscall_entry(regs))
275 ret = -1L; 279 ret = -1L;
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 838786011037..7ef22e3387e0 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -74,7 +74,7 @@ ENTRY(linux_gateway_page)
74 /* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */ 74 /* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */
75 /* Light-weight-syscall entry must always be located at 0xb0 */ 75 /* Light-weight-syscall entry must always be located at 0xb0 */
76 /* WARNING: Keep this number updated with table size changes */ 76 /* WARNING: Keep this number updated with table size changes */
77#define __NR_lws_entries (2) 77#define __NR_lws_entries (3)
78 78
79lws_entry: 79lws_entry:
80 gate lws_start, %r0 /* increase privilege */ 80 gate lws_start, %r0 /* increase privilege */
@@ -502,7 +502,7 @@ lws_exit:
502 502
503 503
504 /*************************************************** 504 /***************************************************
505 Implementing CAS as an atomic operation: 505 Implementing 32bit CAS as an atomic operation:
506 506
507 %r26 - Address to examine 507 %r26 - Address to examine
508 %r25 - Old value to check (old) 508 %r25 - Old value to check (old)
@@ -659,6 +659,230 @@ cas_action:
659 ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page) 659 ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page)
660 660
661 661
662 /***************************************************
663 New CAS implementation which uses pointers and variable size
664 information. The value pointed by old and new MUST NOT change
665 while performing CAS. The lock only protect the value at %r26.
666
667 %r26 - Address to examine
668 %r25 - Pointer to the value to check (old)
669 %r24 - Pointer to the value to set (new)
670 %r23 - Size of the variable (0/1/2/3 for 8/16/32/64 bit)
671 %r28 - Return non-zero on failure
672 %r21 - Kernel error code
673
674 %r21 has the following meanings:
675
676 EAGAIN - CAS is busy, ldcw failed, try again.
677 EFAULT - Read or write failed.
678
679 Scratch: r20, r22, r28, r29, r1, fr4 (32bit for 64bit CAS only)
680
681 ****************************************************/
682
683 /* ELF32 Process entry path */
684lws_compare_and_swap_2:
685#ifdef CONFIG_64BIT
686 /* Clip the input registers */
687 depdi 0, 31, 32, %r26
688 depdi 0, 31, 32, %r25
689 depdi 0, 31, 32, %r24
690 depdi 0, 31, 32, %r23
691#endif
692
693 /* Check the validity of the size pointer */
694 subi,>>= 4, %r23, %r0
695 b,n lws_exit_nosys
696
697 /* Jump to the functions which will load the old and new values into
698 registers depending on the their size */
699 shlw %r23, 2, %r29
700 blr %r29, %r0
701 nop
702
703 /* 8bit load */
7044: ldb 0(%sr3,%r25), %r25
705 b cas2_lock_start
7065: ldb 0(%sr3,%r24), %r24
707 nop
708 nop
709 nop
710 nop
711 nop
712
713 /* 16bit load */
7146: ldh 0(%sr3,%r25), %r25
715 b cas2_lock_start
7167: ldh 0(%sr3,%r24), %r24
717 nop
718 nop
719 nop
720 nop
721 nop
722
723 /* 32bit load */
7248: ldw 0(%sr3,%r25), %r25
725 b cas2_lock_start
7269: ldw 0(%sr3,%r24), %r24
727 nop
728 nop
729 nop
730 nop
731 nop
732
733 /* 64bit load */
734#ifdef CONFIG_64BIT
73510: ldd 0(%sr3,%r25), %r25
73611: ldd 0(%sr3,%r24), %r24
737#else
738 /* Load new value into r22/r23 - high/low */
73910: ldw 0(%sr3,%r25), %r22
74011: ldw 4(%sr3,%r25), %r23
741 /* Load new value into fr4 for atomic store later */
74212: flddx 0(%sr3,%r24), %fr4
743#endif
744
745cas2_lock_start:
746 /* Load start of lock table */
747 ldil L%lws_lock_start, %r20
748 ldo R%lws_lock_start(%r20), %r28
749
750 /* Extract four bits from r26 and hash lock (Bits 4-7) */
751 extru %r26, 27, 4, %r20
752
753 /* Find lock to use, the hash is either one of 0 to
754 15, multiplied by 16 (keep it 16-byte aligned)
755 and add to the lock table offset. */
756 shlw %r20, 4, %r20
757 add %r20, %r28, %r20
758
759 rsm PSW_SM_I, %r0 /* Disable interrupts */
760 /* COW breaks can cause contention on UP systems */
761 LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */
762 cmpb,<>,n %r0, %r28, cas2_action /* Did we get it? */
763cas2_wouldblock:
764 ldo 2(%r0), %r28 /* 2nd case */
765 ssm PSW_SM_I, %r0
766 b lws_exit /* Contended... */
767 ldo -EAGAIN(%r0), %r21 /* Spin in userspace */
768
769 /*
770 prev = *addr;
771 if ( prev == old )
772 *addr = new;
773 return prev;
774 */
775
776 /* NOTES:
777 This all works becuse intr_do_signal
778 and schedule both check the return iasq
779 and see that we are on the kernel page
780 so this process is never scheduled off
781 or is ever sent any signal of any sort,
782 thus it is wholly atomic from usrspaces
783 perspective
784 */
785cas2_action:
786 /* Jump to the correct function */
787 blr %r29, %r0
788 /* Set %r28 as non-zero for now */
789 ldo 1(%r0),%r28
790
791 /* 8bit CAS */
79213: ldb,ma 0(%sr3,%r26), %r29
793 sub,= %r29, %r25, %r0
794 b,n cas2_end
79514: stb,ma %r24, 0(%sr3,%r26)
796 b cas2_end
797 copy %r0, %r28
798 nop
799 nop
800
801 /* 16bit CAS */
80215: ldh,ma 0(%sr3,%r26), %r29
803 sub,= %r29, %r25, %r0
804 b,n cas2_end
80516: sth,ma %r24, 0(%sr3,%r26)
806 b cas2_end
807 copy %r0, %r28
808 nop
809 nop
810
811 /* 32bit CAS */
81217: ldw,ma 0(%sr3,%r26), %r29
813 sub,= %r29, %r25, %r0
814 b,n cas2_end
81518: stw,ma %r24, 0(%sr3,%r26)
816 b cas2_end
817 copy %r0, %r28
818 nop
819 nop
820
821 /* 64bit CAS */
822#ifdef CONFIG_64BIT
82319: ldd,ma 0(%sr3,%r26), %r29
824 sub,= %r29, %r25, %r0
825 b,n cas2_end
82620: std,ma %r24, 0(%sr3,%r26)
827 copy %r0, %r28
828#else
829 /* Compare first word */
83019: ldw,ma 0(%sr3,%r26), %r29
831 sub,= %r29, %r22, %r0
832 b,n cas2_end
833 /* Compare second word */
83420: ldw,ma 4(%sr3,%r26), %r29
835 sub,= %r29, %r23, %r0
836 b,n cas2_end
837 /* Perform the store */
83821: fstdx %fr4, 0(%sr3,%r26)
839 copy %r0, %r28
840#endif
841
842cas2_end:
843 /* Free lock */
844 stw,ma %r20, 0(%sr2,%r20)
845 /* Enable interrupts */
846 ssm PSW_SM_I, %r0
847 /* Return to userspace, set no error */
848 b lws_exit
849 copy %r0, %r21
850
85122:
852 /* Error occurred on load or store */
853 /* Free lock */
854 stw %r20, 0(%sr2,%r20)
855 ssm PSW_SM_I, %r0
856 ldo 1(%r0),%r28
857 b lws_exit
858 ldo -EFAULT(%r0),%r21 /* set errno */
859 nop
860 nop
861 nop
862
863 /* Exception table entries, for the load and store, return EFAULT.
864 Each of the entries must be relocated. */
865 ASM_EXCEPTIONTABLE_ENTRY(4b-linux_gateway_page, 22b-linux_gateway_page)
866 ASM_EXCEPTIONTABLE_ENTRY(5b-linux_gateway_page, 22b-linux_gateway_page)
867 ASM_EXCEPTIONTABLE_ENTRY(6b-linux_gateway_page, 22b-linux_gateway_page)
868 ASM_EXCEPTIONTABLE_ENTRY(7b-linux_gateway_page, 22b-linux_gateway_page)
869 ASM_EXCEPTIONTABLE_ENTRY(8b-linux_gateway_page, 22b-linux_gateway_page)
870 ASM_EXCEPTIONTABLE_ENTRY(9b-linux_gateway_page, 22b-linux_gateway_page)
871 ASM_EXCEPTIONTABLE_ENTRY(10b-linux_gateway_page, 22b-linux_gateway_page)
872 ASM_EXCEPTIONTABLE_ENTRY(11b-linux_gateway_page, 22b-linux_gateway_page)
873 ASM_EXCEPTIONTABLE_ENTRY(13b-linux_gateway_page, 22b-linux_gateway_page)
874 ASM_EXCEPTIONTABLE_ENTRY(14b-linux_gateway_page, 22b-linux_gateway_page)
875 ASM_EXCEPTIONTABLE_ENTRY(15b-linux_gateway_page, 22b-linux_gateway_page)
876 ASM_EXCEPTIONTABLE_ENTRY(16b-linux_gateway_page, 22b-linux_gateway_page)
877 ASM_EXCEPTIONTABLE_ENTRY(17b-linux_gateway_page, 22b-linux_gateway_page)
878 ASM_EXCEPTIONTABLE_ENTRY(18b-linux_gateway_page, 22b-linux_gateway_page)
879 ASM_EXCEPTIONTABLE_ENTRY(19b-linux_gateway_page, 22b-linux_gateway_page)
880 ASM_EXCEPTIONTABLE_ENTRY(20b-linux_gateway_page, 22b-linux_gateway_page)
881#ifndef CONFIG_64BIT
882 ASM_EXCEPTIONTABLE_ENTRY(12b-linux_gateway_page, 22b-linux_gateway_page)
883 ASM_EXCEPTIONTABLE_ENTRY(21b-linux_gateway_page, 22b-linux_gateway_page)
884#endif
885
662 /* Make sure nothing else is placed on this page */ 886 /* Make sure nothing else is placed on this page */
663 .align PAGE_SIZE 887 .align PAGE_SIZE
664END(linux_gateway_page) 888END(linux_gateway_page)
@@ -675,8 +899,9 @@ ENTRY(end_linux_gateway_page)
675 /* Light-weight-syscall table */ 899 /* Light-weight-syscall table */
676 /* Start of lws table. */ 900 /* Start of lws table. */
677ENTRY(lws_table) 901ENTRY(lws_table)
678 LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic compare and swap */ 902 LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic 32bit CAS */
679 LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */ 903 LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic 32bit CAS */
904 LWS_ENTRY(compare_and_swap_2) /* 2 - ELF32 Atomic 64bit CAS */
680END(lws_table) 905END(lws_table)
681 /* End of lws table */ 906 /* End of lws table */
682 907
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 84c5d3a58fa1..b563d9c8268b 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -433,6 +433,9 @@
433 ENTRY_SAME(sched_getattr) /* 335 */ 433 ENTRY_SAME(sched_getattr) /* 335 */
434 ENTRY_COMP(utimes) 434 ENTRY_COMP(utimes)
435 ENTRY_SAME(renameat2) 435 ENTRY_SAME(renameat2)
436 ENTRY_SAME(seccomp)
437 ENTRY_SAME(getrandom)
438 ENTRY_SAME(memfd_create) /* 340 */
436 439
437 /* Nothing yet */ 440 /* Nothing yet */
438 441
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a577609f8ed6..4bc7b62fb4b6 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -399,8 +399,6 @@ config PPC64_SUPPORTS_MEMORY_FAILURE
399config KEXEC 399config KEXEC
400 bool "kexec system call" 400 bool "kexec system call"
401 depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) 401 depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
402 select CRYPTO
403 select CRYPTO_SHA256
404 help 402 help
405 kexec is a system call that implements the ability to shutdown your 403 kexec is a system call that implements the ability to shutdown your
406 current kernel, and to start another kernel. It is like a reboot 404 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/powerpc/boot/simpleboot.c b/arch/powerpc/boot/simpleboot.c
index 21cd48074ec8..9f8c678f0d9a 100644
--- a/arch/powerpc/boot/simpleboot.c
+++ b/arch/powerpc/boot/simpleboot.c
@@ -61,7 +61,7 @@ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
61 if (*reg++ != 0) 61 if (*reg++ != 0)
62 fatal("Memory range is not based at address 0\n"); 62 fatal("Memory range is not based at address 0\n");
63 63
64 /* get the memsize and trucate it to under 4G on 32 bit machines */ 64 /* get the memsize and truncate it to under 4G on 32 bit machines */
65 memsize64 = 0; 65 memsize64 = 0;
66 for (i = 0; i < *ns; i++) 66 for (i = 0; i < *ns; i++)
67 memsize64 = (memsize64 << 32) | *reg++; 67 memsize64 = (memsize64 << 32) | *reg++;
diff --git a/arch/powerpc/configs/c2k_defconfig b/arch/powerpc/configs/c2k_defconfig
index 5e2aa43562b5..59734916986a 100644
--- a/arch/powerpc/configs/c2k_defconfig
+++ b/arch/powerpc/configs/c2k_defconfig
@@ -29,6 +29,7 @@ CONFIG_PM=y
29CONFIG_PCI_MSI=y 29CONFIG_PCI_MSI=y
30CONFIG_HOTPLUG_PCI=y 30CONFIG_HOTPLUG_PCI=y
31CONFIG_HOTPLUG_PCI_SHPC=m 31CONFIG_HOTPLUG_PCI_SHPC=m
32CONFIG_NET=y
32CONFIG_PACKET=y 33CONFIG_PACKET=y
33CONFIG_UNIX=y 34CONFIG_UNIX=y
34CONFIG_XFRM_USER=y 35CONFIG_XFRM_USER=y
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index 4bee1a6d41d0..45fd06cdc3e8 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -5,6 +5,7 @@ CONFIG_SMP=y
5CONFIG_NR_CPUS=4 5CONFIG_NR_CPUS=4
6CONFIG_EXPERIMENTAL=y 6CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 7CONFIG_SYSVIPC=y
8CONFIG_FHANDLE=y
8CONFIG_IKCONFIG=y 9CONFIG_IKCONFIG=y
9CONFIG_IKCONFIG_PROC=y 10CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=15 11CONFIG_LOG_BUF_SHIFT=15
diff --git a/arch/powerpc/configs/celleb_defconfig b/arch/powerpc/configs/celleb_defconfig
index 6d7b22f41b50..77d7bf3ca2ac 100644
--- a/arch/powerpc/configs/celleb_defconfig
+++ b/arch/powerpc/configs/celleb_defconfig
@@ -5,6 +5,7 @@ CONFIG_SMP=y
5CONFIG_NR_CPUS=4 5CONFIG_NR_CPUS=4
6CONFIG_EXPERIMENTAL=y 6CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 7CONFIG_SYSVIPC=y
8CONFIG_FHANDLE=y
8CONFIG_IKCONFIG=y 9CONFIG_IKCONFIG=y
9CONFIG_IKCONFIG_PROC=y 10CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=15 11CONFIG_LOG_BUF_SHIFT=15
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index 4b07bade1ba9..269d6e47c67d 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -4,6 +4,7 @@ CONFIG_ALTIVEC=y
4CONFIG_SMP=y 4CONFIG_SMP=y
5CONFIG_NR_CPUS=24 5CONFIG_NR_CPUS=24
6CONFIG_SYSVIPC=y 6CONFIG_SYSVIPC=y
7CONFIG_FHANDLE=y
7CONFIG_IRQ_DOMAIN_DEBUG=y 8CONFIG_IRQ_DOMAIN_DEBUG=y
8CONFIG_NO_HZ=y 9CONFIG_NO_HZ=y
9CONFIG_HIGH_RES_TIMERS=y 10CONFIG_HIGH_RES_TIMERS=y
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index 3c72fa615bd9..7594c5ac6481 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -5,6 +5,7 @@ CONFIG_NR_CPUS=4
5CONFIG_EXPERIMENTAL=y 5CONFIG_EXPERIMENTAL=y
6CONFIG_SYSVIPC=y 6CONFIG_SYSVIPC=y
7CONFIG_POSIX_MQUEUE=y 7CONFIG_POSIX_MQUEUE=y
8CONFIG_FHANDLE=y
8CONFIG_IKCONFIG=y 9CONFIG_IKCONFIG=y
9CONFIG_IKCONFIG_PROC=y 10CONFIG_IKCONFIG_PROC=y
10CONFIG_BLK_DEV_INITRD=y 11CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig
index 95e545d9f25c..c8b6a9ddb21b 100644
--- a/arch/powerpc/configs/maple_defconfig
+++ b/arch/powerpc/configs/maple_defconfig
@@ -4,6 +4,7 @@ CONFIG_NR_CPUS=4
4CONFIG_EXPERIMENTAL=y 4CONFIG_EXPERIMENTAL=y
5CONFIG_SYSVIPC=y 5CONFIG_SYSVIPC=y
6CONFIG_POSIX_MQUEUE=y 6CONFIG_POSIX_MQUEUE=y
7CONFIG_FHANDLE=y
7CONFIG_IKCONFIG=y 8CONFIG_IKCONFIG=y
8CONFIG_IKCONFIG_PROC=y 9CONFIG_IKCONFIG_PROC=y
9# CONFIG_COMPAT_BRK is not set 10# CONFIG_COMPAT_BRK is not set
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig
index cec044a3ff69..e5e7838af008 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_defconfig
@@ -3,6 +3,7 @@ CONFIG_ALTIVEC=y
3CONFIG_SMP=y 3CONFIG_SMP=y
4CONFIG_NR_CPUS=2 4CONFIG_NR_CPUS=2
5CONFIG_SYSVIPC=y 5CONFIG_SYSVIPC=y
6CONFIG_FHANDLE=y
6CONFIG_NO_HZ=y 7CONFIG_NO_HZ=y
7CONFIG_HIGH_RES_TIMERS=y 8CONFIG_HIGH_RES_TIMERS=y
8CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
index 553e66278010..0351b5ffdfef 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -31,6 +31,7 @@ CONFIG_HIBERNATION=y
31CONFIG_APM_EMULATION=y 31CONFIG_APM_EMULATION=y
32CONFIG_PCCARD=m 32CONFIG_PCCARD=m
33CONFIG_YENTA=m 33CONFIG_YENTA=m
34CONFIG_NET=y
34CONFIG_PACKET=y 35CONFIG_PACKET=y
35CONFIG_UNIX=y 36CONFIG_UNIX=y
36CONFIG_XFRM_USER=y 37CONFIG_XFRM_USER=y
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index f26b267eb71f..36518870e6b2 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -4,6 +4,7 @@ CONFIG_VSX=y
4CONFIG_SMP=y 4CONFIG_SMP=y
5CONFIG_SYSVIPC=y 5CONFIG_SYSVIPC=y
6CONFIG_POSIX_MQUEUE=y 6CONFIG_POSIX_MQUEUE=y
7CONFIG_FHANDLE=y
7CONFIG_IRQ_DOMAIN_DEBUG=y 8CONFIG_IRQ_DOMAIN_DEBUG=y
8CONFIG_NO_HZ=y 9CONFIG_NO_HZ=y
9CONFIG_HIGH_RES_TIMERS=y 10CONFIG_HIGH_RES_TIMERS=y
@@ -57,6 +58,7 @@ CONFIG_ELECTRA_CF=y
57CONFIG_HOTPLUG_PCI=y 58CONFIG_HOTPLUG_PCI=y
58CONFIG_HOTPLUG_PCI_RPA=m 59CONFIG_HOTPLUG_PCI_RPA=m
59CONFIG_HOTPLUG_PCI_RPA_DLPAR=m 60CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
61CONFIG_NET=y
60CONFIG_PACKET=y 62CONFIG_PACKET=y
61CONFIG_UNIX=y 63CONFIG_UNIX=y
62CONFIG_XFRM_USER=m 64CONFIG_XFRM_USER=m
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig
index 438e813dc9cb..c3a3269b0865 100644
--- a/arch/powerpc/configs/ppc64e_defconfig
+++ b/arch/powerpc/configs/ppc64e_defconfig
@@ -3,6 +3,7 @@ CONFIG_PPC_BOOK3E_64=y
3CONFIG_SMP=y 3CONFIG_SMP=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 5CONFIG_POSIX_MQUEUE=y
6CONFIG_FHANDLE=y
6CONFIG_NO_HZ=y 7CONFIG_NO_HZ=y
7CONFIG_HIGH_RES_TIMERS=y 8CONFIG_HIGH_RES_TIMERS=y
8CONFIG_TASKSTATS=y 9CONFIG_TASKSTATS=y
@@ -32,6 +33,7 @@ CONFIG_SPARSEMEM_MANUAL=y
32CONFIG_PCI_MSI=y 33CONFIG_PCI_MSI=y
33CONFIG_PCCARD=y 34CONFIG_PCCARD=y
34CONFIG_HOTPLUG_PCI=y 35CONFIG_HOTPLUG_PCI=y
36CONFIG_NET=y
35CONFIG_PACKET=y 37CONFIG_PACKET=y
36CONFIG_UNIX=y 38CONFIG_UNIX=y
37CONFIG_XFRM_USER=m 39CONFIG_XFRM_USER=m
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index fdee37fab81c..2e637c881d2b 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -5,6 +5,7 @@ CONFIG_SMP=y
5CONFIG_NR_CPUS=2 5CONFIG_NR_CPUS=2
6CONFIG_SYSVIPC=y 6CONFIG_SYSVIPC=y
7CONFIG_POSIX_MQUEUE=y 7CONFIG_POSIX_MQUEUE=y
8CONFIG_FHANDLE=y
8CONFIG_HIGH_RES_TIMERS=y 9CONFIG_HIGH_RES_TIMERS=y
9CONFIG_BLK_DEV_INITRD=y 10CONFIG_BLK_DEV_INITRD=y
10CONFIG_RD_LZMA=y 11CONFIG_RD_LZMA=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index a905063281cc..dd2a9cab4b50 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -5,6 +5,7 @@ CONFIG_SMP=y
5CONFIG_NR_CPUS=2048 5CONFIG_NR_CPUS=2048
6CONFIG_SYSVIPC=y 6CONFIG_SYSVIPC=y
7CONFIG_POSIX_MQUEUE=y 7CONFIG_POSIX_MQUEUE=y
8CONFIG_FHANDLE=y
8CONFIG_AUDIT=y 9CONFIG_AUDIT=y
9CONFIG_AUDITSYSCALL=y 10CONFIG_AUDITSYSCALL=y
10CONFIG_IRQ_DOMAIN_DEBUG=y 11CONFIG_IRQ_DOMAIN_DEBUG=y
@@ -52,6 +53,7 @@ CONFIG_SCHED_SMT=y
52CONFIG_HOTPLUG_PCI=y 53CONFIG_HOTPLUG_PCI=y
53CONFIG_HOTPLUG_PCI_RPA=m 54CONFIG_HOTPLUG_PCI_RPA=m
54CONFIG_HOTPLUG_PCI_RPA_DLPAR=m 55CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
56CONFIG_NET=y
55CONFIG_PACKET=y 57CONFIG_PACKET=y
56CONFIG_UNIX=y 58CONFIG_UNIX=y
57CONFIG_XFRM_USER=m 59CONFIG_XFRM_USER=m
diff --git a/arch/powerpc/configs/pseries_le_defconfig b/arch/powerpc/configs/pseries_le_defconfig
index 58e3dbf43ca4..63392f4b29a4 100644
--- a/arch/powerpc/configs/pseries_le_defconfig
+++ b/arch/powerpc/configs/pseries_le_defconfig
@@ -6,6 +6,7 @@ CONFIG_NR_CPUS=2048
6CONFIG_CPU_LITTLE_ENDIAN=y 6CONFIG_CPU_LITTLE_ENDIAN=y
7CONFIG_SYSVIPC=y 7CONFIG_SYSVIPC=y
8CONFIG_POSIX_MQUEUE=y 8CONFIG_POSIX_MQUEUE=y
9CONFIG_FHANDLE=y
9CONFIG_AUDIT=y 10CONFIG_AUDIT=y
10CONFIG_AUDITSYSCALL=y 11CONFIG_AUDITSYSCALL=y
11CONFIG_IRQ_DOMAIN_DEBUG=y 12CONFIG_IRQ_DOMAIN_DEBUG=y
@@ -54,6 +55,7 @@ CONFIG_SCHED_SMT=y
54CONFIG_HOTPLUG_PCI=y 55CONFIG_HOTPLUG_PCI=y
55CONFIG_HOTPLUG_PCI_RPA=m 56CONFIG_HOTPLUG_PCI_RPA=m
56CONFIG_HOTPLUG_PCI_RPA_DLPAR=m 57CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
58CONFIG_NET=y
57CONFIG_PACKET=y 59CONFIG_PACKET=y
58CONFIG_UNIX=y 60CONFIG_UNIX=y
59CONFIG_XFRM_USER=m 61CONFIG_XFRM_USER=m
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 7f23f162ce9c..31e8f59aff38 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -1,6 +1,7 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += hash.h 3generic-y += hash.h
4generic-y += irq_work.h
4generic-y += mcs_spinlock.h 5generic-y += mcs_spinlock.h
5generic-y += preempt.h 6generic-y += preempt.h
6generic-y += rwsem.h 7generic-y += rwsem.h
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index 465dfcb82c92..5bca220bbb60 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -53,17 +53,17 @@
53#define BOOKE_INTERRUPT_DEBUG 15 53#define BOOKE_INTERRUPT_DEBUG 15
54 54
55/* E500 */ 55/* E500 */
56#define BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL 32 56#ifdef CONFIG_SPE_POSSIBLE
57#define BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST 33 57#define BOOKE_INTERRUPT_SPE_UNAVAIL 32
58/* 58#define BOOKE_INTERRUPT_SPE_FP_DATA 33
59 * TODO: Unify 32-bit and 64-bit kernel exception handlers to use same defines
60 */
61#define BOOKE_INTERRUPT_SPE_UNAVAIL BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL
62#define BOOKE_INTERRUPT_SPE_FP_DATA BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST
63#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL
64#define BOOKE_INTERRUPT_ALTIVEC_ASSIST \
65 BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST
66#define BOOKE_INTERRUPT_SPE_FP_ROUND 34 59#define BOOKE_INTERRUPT_SPE_FP_ROUND 34
60#endif
61
62#ifdef CONFIG_PPC_E500MC
63#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL 32
64#define BOOKE_INTERRUPT_ALTIVEC_ASSIST 33
65#endif
66
67#define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35 67#define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
68#define BOOKE_INTERRUPT_DOORBELL 36 68#define BOOKE_INTERRUPT_DOORBELL 36
69#define BOOKE_INTERRUPT_DOORBELL_CRITICAL 37 69#define BOOKE_INTERRUPT_DOORBELL_CRITICAL 37
diff --git a/arch/powerpc/include/asm/kvm_booke.h b/arch/powerpc/include/asm/kvm_booke.h
index f7aa5cc395c4..3286f0d6a86c 100644
--- a/arch/powerpc/include/asm/kvm_booke.h
+++ b/arch/powerpc/include/asm/kvm_booke.h
@@ -23,15 +23,16 @@
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/kvm_host.h> 24#include <linux/kvm_host.h>
25 25
26/* LPIDs we support with this build -- runtime limit may be lower */ 26/*
27 * Number of available lpids. Only the low-order 6 bits of LPID rgister are
28 * implemented on e500mc+ cores.
29 */
27#define KVMPPC_NR_LPIDS 64 30#define KVMPPC_NR_LPIDS 64
28 31
29#define KVMPPC_INST_EHPRIV 0x7c00021c 32#define KVMPPC_INST_EHPRIV 0x7c00021c
30#define EHPRIV_OC_SHIFT 11 33#define EHPRIV_OC_SHIFT 11
31/* "ehpriv 1" : ehpriv with OC = 1 is used for debug emulation */ 34/* "ehpriv 1" : ehpriv with OC = 1 is used for debug emulation */
32#define EHPRIV_OC_DEBUG 1 35#define EHPRIV_OC_DEBUG 1
33#define KVMPPC_INST_EHPRIV_DEBUG (KVMPPC_INST_EHPRIV | \
34 (EHPRIV_OC_DEBUG << EHPRIV_OC_SHIFT))
35 36
36static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val) 37static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val)
37{ 38{
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 98d9dd50d063..047855619cc4 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -53,14 +53,18 @@
53 53
54#define KVM_ARCH_WANT_MMU_NOTIFIER 54#define KVM_ARCH_WANT_MMU_NOTIFIER
55 55
56struct kvm;
57extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); 56extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
58extern int kvm_unmap_hva_range(struct kvm *kvm, 57extern int kvm_unmap_hva_range(struct kvm *kvm,
59 unsigned long start, unsigned long end); 58 unsigned long start, unsigned long end);
60extern int kvm_age_hva(struct kvm *kvm, unsigned long hva); 59extern int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
61extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); 60extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
62extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); 61extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
63 62
63static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
64 unsigned long address)
65{
66}
67
64#define HPTEG_CACHE_NUM (1 << 15) 68#define HPTEG_CACHE_NUM (1 << 15)
65#define HPTEG_HASH_BITS_PTE 13 69#define HPTEG_HASH_BITS_PTE 13
66#define HPTEG_HASH_BITS_PTE_LONG 12 70#define HPTEG_HASH_BITS_PTE_LONG 12
@@ -76,10 +80,6 @@ extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
76/* Physical Address Mask - allowed range of real mode RAM access */ 80/* Physical Address Mask - allowed range of real mode RAM access */
77#define KVM_PAM 0x0fffffffffffffffULL 81#define KVM_PAM 0x0fffffffffffffffULL
78 82
79struct kvm;
80struct kvm_run;
81struct kvm_vcpu;
82
83struct lppaca; 83struct lppaca;
84struct slb_shadow; 84struct slb_shadow;
85struct dtl_entry; 85struct dtl_entry;
@@ -144,6 +144,7 @@ enum kvm_exit_types {
144 EMULATED_TLBWE_EXITS, 144 EMULATED_TLBWE_EXITS,
145 EMULATED_RFI_EXITS, 145 EMULATED_RFI_EXITS,
146 EMULATED_RFCI_EXITS, 146 EMULATED_RFCI_EXITS,
147 EMULATED_RFDI_EXITS,
147 DEC_EXITS, 148 DEC_EXITS,
148 EXT_INTR_EXITS, 149 EXT_INTR_EXITS,
149 HALT_WAKEUP, 150 HALT_WAKEUP,
@@ -589,8 +590,6 @@ struct kvm_vcpu_arch {
589 u32 crit_save; 590 u32 crit_save;
590 /* guest debug registers*/ 591 /* guest debug registers*/
591 struct debug_reg dbg_reg; 592 struct debug_reg dbg_reg;
592 /* hardware visible debug registers when in guest state */
593 struct debug_reg shadow_dbg_reg;
594#endif 593#endif
595 gpa_t paddr_accessed; 594 gpa_t paddr_accessed;
596 gva_t vaddr_accessed; 595 gva_t vaddr_accessed;
@@ -612,7 +611,6 @@ struct kvm_vcpu_arch {
612 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ 611 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
613 612
614 struct hrtimer dec_timer; 613 struct hrtimer dec_timer;
615 struct tasklet_struct tasklet;
616 u64 dec_jiffies; 614 u64 dec_jiffies;
617 u64 dec_expires; 615 u64 dec_expires;
618 unsigned long pending_exceptions; 616 unsigned long pending_exceptions;
@@ -687,4 +685,12 @@ struct kvm_vcpu_arch {
687#define __KVM_HAVE_ARCH_WQP 685#define __KVM_HAVE_ARCH_WQP
688#define __KVM_HAVE_CREATE_DEVICE 686#define __KVM_HAVE_CREATE_DEVICE
689 687
688static inline void kvm_arch_hardware_disable(void) {}
689static inline void kvm_arch_hardware_unsetup(void) {}
690static inline void kvm_arch_sync_events(struct kvm *kvm) {}
691static inline void kvm_arch_memslots_updated(struct kvm *kvm) {}
692static inline void kvm_arch_flush_shadow_all(struct kvm *kvm) {}
693static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
694static inline void kvm_arch_exit(void) {}
695
690#endif /* __POWERPC_KVM_HOST_H__ */ 696#endif /* __POWERPC_KVM_HOST_H__ */
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index fb86a2299d8a..a6dcdb6d13c1 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -38,6 +38,12 @@
38#include <asm/paca.h> 38#include <asm/paca.h>
39#endif 39#endif
40 40
41/*
42 * KVMPPC_INST_SW_BREAKPOINT is debug Instruction
43 * for supporting software breakpoint.
44 */
45#define KVMPPC_INST_SW_BREAKPOINT 0x00dddd00
46
41enum emulation_result { 47enum emulation_result {
42 EMULATE_DONE, /* no further processing */ 48 EMULATE_DONE, /* no further processing */
43 EMULATE_DO_MMIO, /* kvm_run filled with MMIO request */ 49 EMULATE_DO_MMIO, /* kvm_run filled with MMIO request */
@@ -89,7 +95,7 @@ extern int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu);
89extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu); 95extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu);
90extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu); 96extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu);
91extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb); 97extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb);
92extern void kvmppc_decrementer_func(unsigned long data); 98extern void kvmppc_decrementer_func(struct kvm_vcpu *vcpu);
93extern int kvmppc_sanity_check(struct kvm_vcpu *vcpu); 99extern int kvmppc_sanity_check(struct kvm_vcpu *vcpu);
94extern int kvmppc_subarch_vcpu_init(struct kvm_vcpu *vcpu); 100extern int kvmppc_subarch_vcpu_init(struct kvm_vcpu *vcpu);
95extern void kvmppc_subarch_vcpu_uninit(struct kvm_vcpu *vcpu); 101extern void kvmppc_subarch_vcpu_uninit(struct kvm_vcpu *vcpu);
@@ -206,6 +212,9 @@ extern int kvmppc_xics_get_xive(struct kvm *kvm, u32 irq, u32 *server,
206extern int kvmppc_xics_int_on(struct kvm *kvm, u32 irq); 212extern int kvmppc_xics_int_on(struct kvm *kvm, u32 irq);
207extern int kvmppc_xics_int_off(struct kvm *kvm, u32 irq); 213extern int kvmppc_xics_int_off(struct kvm *kvm, u32 irq);
208 214
215void kvmppc_core_dequeue_debug(struct kvm_vcpu *vcpu);
216void kvmppc_core_queue_debug(struct kvm_vcpu *vcpu);
217
209union kvmppc_one_reg { 218union kvmppc_one_reg {
210 u32 wval; 219 u32 wval;
211 u64 dval; 220 u64 dval;
@@ -243,7 +252,7 @@ struct kvmppc_ops {
243 int (*unmap_hva)(struct kvm *kvm, unsigned long hva); 252 int (*unmap_hva)(struct kvm *kvm, unsigned long hva);
244 int (*unmap_hva_range)(struct kvm *kvm, unsigned long start, 253 int (*unmap_hva_range)(struct kvm *kvm, unsigned long start,
245 unsigned long end); 254 unsigned long end);
246 int (*age_hva)(struct kvm *kvm, unsigned long hva); 255 int (*age_hva)(struct kvm *kvm, unsigned long start, unsigned long end);
247 int (*test_age_hva)(struct kvm *kvm, unsigned long hva); 256 int (*test_age_hva)(struct kvm *kvm, unsigned long hva);
248 void (*set_spte_hva)(struct kvm *kvm, unsigned long hva, pte_t pte); 257 void (*set_spte_hva)(struct kvm *kvm, unsigned long hva, pte_t pte);
249 void (*mmu_destroy)(struct kvm_vcpu *vcpu); 258 void (*mmu_destroy)(struct kvm_vcpu *vcpu);
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index b125ceab149c..3af721633618 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -136,8 +136,6 @@ struct machdep_calls {
136 int (*pci_setup_phb)(struct pci_controller *host); 136 int (*pci_setup_phb)(struct pci_controller *host);
137 137
138#ifdef CONFIG_PCI_MSI 138#ifdef CONFIG_PCI_MSI
139 int (*msi_check_device)(struct pci_dev* dev,
140 int nvec, int type);
141 int (*setup_msi_irqs)(struct pci_dev *dev, 139 int (*setup_msi_irqs)(struct pci_dev *dev,
142 int nvec, int type); 140 int nvec, int type);
143 void (*teardown_msi_irqs)(struct pci_dev *dev); 141 void (*teardown_msi_irqs)(struct pci_dev *dev);
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index d98c1ecc3266..f60d4ea8b50c 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -38,10 +38,9 @@ static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK)
38static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); } 38static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); }
39 39
40#ifdef CONFIG_NUMA_BALANCING 40#ifdef CONFIG_NUMA_BALANCING
41
42static inline int pte_present(pte_t pte) 41static inline int pte_present(pte_t pte)
43{ 42{
44 return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA); 43 return pte_val(pte) & _PAGE_NUMA_MASK;
45} 44}
46 45
47#define pte_present_nonuma pte_present_nonuma 46#define pte_present_nonuma pte_present_nonuma
@@ -50,37 +49,6 @@ static inline int pte_present_nonuma(pte_t pte)
50 return pte_val(pte) & (_PAGE_PRESENT); 49 return pte_val(pte) & (_PAGE_PRESENT);
51} 50}
52 51
53#define pte_numa pte_numa
54static inline int pte_numa(pte_t pte)
55{
56 return (pte_val(pte) &
57 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
58}
59
60#define pte_mknonnuma pte_mknonnuma
61static inline pte_t pte_mknonnuma(pte_t pte)
62{
63 pte_val(pte) &= ~_PAGE_NUMA;
64 pte_val(pte) |= _PAGE_PRESENT | _PAGE_ACCESSED;
65 return pte;
66}
67
68#define pte_mknuma pte_mknuma
69static inline pte_t pte_mknuma(pte_t pte)
70{
71 /*
72 * We should not set _PAGE_NUMA on non present ptes. Also clear the
73 * present bit so that hash_page will return 1 and we collect this
74 * as numa fault.
75 */
76 if (pte_present(pte)) {
77 pte_val(pte) |= _PAGE_NUMA;
78 pte_val(pte) &= ~_PAGE_PRESENT;
79 } else
80 VM_BUG_ON(1);
81 return pte;
82}
83
84#define ptep_set_numa ptep_set_numa 52#define ptep_set_numa ptep_set_numa
85static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr, 53static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr,
86 pte_t *ptep) 54 pte_t *ptep)
@@ -92,12 +60,6 @@ static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr,
92 return; 60 return;
93} 61}
94 62
95#define pmd_numa pmd_numa
96static inline int pmd_numa(pmd_t pmd)
97{
98 return pte_numa(pmd_pte(pmd));
99}
100
101#define pmdp_set_numa pmdp_set_numa 63#define pmdp_set_numa pmdp_set_numa
102static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, 64static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
103 pmd_t *pmdp) 65 pmd_t *pmdp)
@@ -109,16 +71,21 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
109 return; 71 return;
110} 72}
111 73
112#define pmd_mknonnuma pmd_mknonnuma 74/*
113static inline pmd_t pmd_mknonnuma(pmd_t pmd) 75 * Generic NUMA pte helpers expect pteval_t and pmdval_t types to exist
76 * which was inherited from x86. For the purposes of powerpc pte_basic_t and
77 * pmd_t are equivalent
78 */
79#define pteval_t pte_basic_t
80#define pmdval_t pmd_t
81static inline pteval_t ptenuma_flags(pte_t pte)
114{ 82{
115 return pte_pmd(pte_mknonnuma(pmd_pte(pmd))); 83 return pte_val(pte) & _PAGE_NUMA_MASK;
116} 84}
117 85
118#define pmd_mknuma pmd_mknuma 86static inline pmdval_t pmdnuma_flags(pmd_t pmd)
119static inline pmd_t pmd_mknuma(pmd_t pmd)
120{ 87{
121 return pte_pmd(pte_mknuma(pmd_pte(pmd))); 88 return pmd_val(pmd) & _PAGE_NUMA_MASK;
122} 89}
123 90
124# else 91# else
diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h
index 8d1569c29042..e040c3595129 100644
--- a/arch/powerpc/include/asm/pte-common.h
+++ b/arch/powerpc/include/asm/pte-common.h
@@ -98,6 +98,11 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
98 _PAGE_USER | _PAGE_ACCESSED | \ 98 _PAGE_USER | _PAGE_ACCESSED | \
99 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_EXEC) 99 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_EXEC)
100 100
101#ifdef CONFIG_NUMA_BALANCING
102/* Mask of bits that distinguish present and numa ptes */
103#define _PAGE_NUMA_MASK (_PAGE_NUMA|_PAGE_PRESENT)
104#endif
105
101/* 106/*
102 * We define 2 sets of base prot bits, one for basic pages (ie, 107 * We define 2 sets of base prot bits, one for basic pages (ie,
103 * cacheable kernel and user pages) and one for non cacheable 108 * cacheable kernel and user pages) and one for non cacheable
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 279b80f3bb29..c0c61fa9cd9e 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -47,6 +47,12 @@
47 STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) 47 STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)
48#define STACK_FRAME_MARKER 12 48#define STACK_FRAME_MARKER 12
49 49
50#if defined(_CALL_ELF) && _CALL_ELF == 2
51#define STACK_FRAME_MIN_SIZE 32
52#else
53#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD
54#endif
55
50/* Size of dummy stack frame allocated when calling signal handler. */ 56/* Size of dummy stack frame allocated when calling signal handler. */
51#define __SIGNAL_FRAMESIZE 128 57#define __SIGNAL_FRAMESIZE 128
52#define __SIGNAL_FRAMESIZE32 64 58#define __SIGNAL_FRAMESIZE32 64
@@ -60,6 +66,7 @@
60#define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) 66#define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773)
61#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD) 67#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD)
62#define STACK_FRAME_MARKER 2 68#define STACK_FRAME_MARKER 2
69#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD
63 70
64/* Size of stack frame allocated when calling signal handler. */ 71/* Size of stack frame allocated when calling signal handler. */
65#define __SIGNAL_FRAMESIZE 64 72#define __SIGNAL_FRAMESIZE 64
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 1d653308a33c..16547efa2d5a 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -319,6 +319,8 @@
319 * DBSR bits which have conflicting definitions on true Book E versus IBM 40x. 319 * DBSR bits which have conflicting definitions on true Book E versus IBM 40x.
320 */ 320 */
321#ifdef CONFIG_BOOKE 321#ifdef CONFIG_BOOKE
322#define DBSR_IDE 0x80000000 /* Imprecise Debug Event */
323#define DBSR_MRR 0x30000000 /* Most Recent Reset */
322#define DBSR_IC 0x08000000 /* Instruction Completion */ 324#define DBSR_IC 0x08000000 /* Instruction Completion */
323#define DBSR_BT 0x04000000 /* Branch Taken */ 325#define DBSR_BT 0x04000000 /* Branch Taken */
324#define DBSR_IRPT 0x02000000 /* Exception Debug Event */ 326#define DBSR_IRPT 0x02000000 /* Exception Debug Event */
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 542bc0f0673f..7d8a60068805 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -362,3 +362,6 @@ SYSCALL(ni_syscall) /* sys_kcmp */
362SYSCALL_SPU(sched_setattr) 362SYSCALL_SPU(sched_setattr)
363SYSCALL_SPU(sched_getattr) 363SYSCALL_SPU(sched_getattr)
364SYSCALL_SPU(renameat2) 364SYSCALL_SPU(renameat2)
365SYSCALL_SPU(seccomp)
366SYSCALL_SPU(getrandom)
367SYSCALL_SPU(memfd_create)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 5ce5552ab9f5..4e9af3fd43e7 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
12#include <uapi/asm/unistd.h> 12#include <uapi/asm/unistd.h>
13 13
14 14
15#define __NR_syscalls 358 15#define __NR_syscalls 361
16 16
17#define __NR__exit __NR_exit 17#define __NR__exit __NR_exit
18#define NR_syscalls __NR_syscalls 18#define NR_syscalls __NR_syscalls
diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h
index e0e49dbb145d..ab4d4732c492 100644
--- a/arch/powerpc/include/uapi/asm/kvm.h
+++ b/arch/powerpc/include/uapi/asm/kvm.h
@@ -476,6 +476,11 @@ struct kvm_get_htab_header {
476 476
477/* FP and vector status/control registers */ 477/* FP and vector status/control registers */
478#define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80) 478#define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80)
479/*
480 * VSCR register is documented as a 32-bit register in the ISA, but it can
481 * only be accesses via a vector register. Expose VSCR as a 32-bit register
482 * even though the kernel represents it as a 128-bit vector.
483 */
479#define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81) 484#define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81)
480 485
481/* Virtual processor areas */ 486/* Virtual processor areas */
@@ -557,6 +562,7 @@ struct kvm_get_htab_header {
557#define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8) 562#define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8)
558#define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9) 563#define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9)
559#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba) 564#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba)
565#define KVM_REG_PPC_DBSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbb)
560 566
561/* Transactional Memory checkpointed state: 567/* Transactional Memory checkpointed state:
562 * This is all GPRs, all VSX regs and a subset of SPRs 568 * This is all GPRs, all VSX regs and a subset of SPRs
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h
index 2d526f7b48da..0688fc06e183 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -380,5 +380,8 @@
380#define __NR_sched_setattr 355 380#define __NR_sched_setattr 355
381#define __NR_sched_getattr 356 381#define __NR_sched_getattr 356
382#define __NR_renameat2 357 382#define __NR_renameat2 357
383#define __NR_seccomp 358
384#define __NR_getrandom 359
385#define __NR_memfd_create 360
383 386
384#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ 387#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
index 4f1393d20079..dddba3e94260 100644
--- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S
+++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
@@ -91,6 +91,7 @@ _GLOBAL(setup_altivec_idle)
91 91
92 blr 92 blr
93 93
94#ifdef CONFIG_PPC_E500MC
94_GLOBAL(__setup_cpu_e6500) 95_GLOBAL(__setup_cpu_e6500)
95 mflr r6 96 mflr r6
96#ifdef CONFIG_PPC64 97#ifdef CONFIG_PPC64
@@ -107,14 +108,20 @@ _GLOBAL(__setup_cpu_e6500)
107 bl __setup_cpu_e5500 108 bl __setup_cpu_e5500
108 mtlr r6 109 mtlr r6
109 blr 110 blr
111#endif /* CONFIG_PPC_E500MC */
110 112
111#ifdef CONFIG_PPC32 113#ifdef CONFIG_PPC32
114#ifdef CONFIG_E200
112_GLOBAL(__setup_cpu_e200) 115_GLOBAL(__setup_cpu_e200)
113 /* enable dedicated debug exception handling resources (Debug APU) */ 116 /* enable dedicated debug exception handling resources (Debug APU) */
114 mfspr r3,SPRN_HID0 117 mfspr r3,SPRN_HID0
115 ori r3,r3,HID0_DAPUEN@l 118 ori r3,r3,HID0_DAPUEN@l
116 mtspr SPRN_HID0,r3 119 mtspr SPRN_HID0,r3
117 b __setup_e200_ivors 120 b __setup_e200_ivors
121#endif /* CONFIG_E200 */
122
123#ifdef CONFIG_E500
124#ifndef CONFIG_PPC_E500MC
118_GLOBAL(__setup_cpu_e500v1) 125_GLOBAL(__setup_cpu_e500v1)
119_GLOBAL(__setup_cpu_e500v2) 126_GLOBAL(__setup_cpu_e500v2)
120 mflr r4 127 mflr r4
@@ -129,6 +136,7 @@ _GLOBAL(__setup_cpu_e500v2)
129#endif 136#endif
130 mtlr r4 137 mtlr r4
131 blr 138 blr
139#else /* CONFIG_PPC_E500MC */
132_GLOBAL(__setup_cpu_e500mc) 140_GLOBAL(__setup_cpu_e500mc)
133_GLOBAL(__setup_cpu_e5500) 141_GLOBAL(__setup_cpu_e5500)
134 mflr r5 142 mflr r5
@@ -159,7 +167,9 @@ _GLOBAL(__setup_cpu_e5500)
1592: 1672:
160 mtlr r5 168 mtlr r5
161 blr 169 blr
162#endif 170#endif /* CONFIG_PPC_E500MC */
171#endif /* CONFIG_E500 */
172#endif /* CONFIG_PPC32 */
163 173
164#ifdef CONFIG_PPC_BOOK3E_64 174#ifdef CONFIG_PPC_BOOK3E_64
165_GLOBAL(__restore_cpu_e6500) 175_GLOBAL(__restore_cpu_e6500)
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 9b6dcaaec1a3..808405906336 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1961,6 +1961,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1961#endif /* CONFIG_PPC32 */ 1961#endif /* CONFIG_PPC32 */
1962#ifdef CONFIG_E500 1962#ifdef CONFIG_E500
1963#ifdef CONFIG_PPC32 1963#ifdef CONFIG_PPC32
1964#ifndef CONFIG_PPC_E500MC
1964 { /* e500 */ 1965 { /* e500 */
1965 .pvr_mask = 0xffff0000, 1966 .pvr_mask = 0xffff0000,
1966 .pvr_value = 0x80200000, 1967 .pvr_value = 0x80200000,
@@ -2000,6 +2001,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
2000 .machine_check = machine_check_e500, 2001 .machine_check = machine_check_e500,
2001 .platform = "ppc8548", 2002 .platform = "ppc8548",
2002 }, 2003 },
2004#else
2003 { /* e500mc */ 2005 { /* e500mc */
2004 .pvr_mask = 0xffff0000, 2006 .pvr_mask = 0xffff0000,
2005 .pvr_value = 0x80230000, 2007 .pvr_value = 0x80230000,
@@ -2018,7 +2020,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
2018 .machine_check = machine_check_e500mc, 2020 .machine_check = machine_check_e500mc,
2019 .platform = "ppce500mc", 2021 .platform = "ppce500mc",
2020 }, 2022 },
2023#endif /* CONFIG_PPC_E500MC */
2021#endif /* CONFIG_PPC32 */ 2024#endif /* CONFIG_PPC32 */
2025#ifdef CONFIG_PPC_E500MC
2022 { /* e5500 */ 2026 { /* e5500 */
2023 .pvr_mask = 0xffff0000, 2027 .pvr_mask = 0xffff0000,
2024 .pvr_value = 0x80240000, 2028 .pvr_value = 0x80240000,
@@ -2062,6 +2066,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
2062 .machine_check = machine_check_e500mc, 2066 .machine_check = machine_check_e500mc,
2063 .platform = "ppce6500", 2067 .platform = "ppce6500",
2064 }, 2068 },
2069#endif /* CONFIG_PPC_E500MC */
2065#ifdef CONFIG_PPC32 2070#ifdef CONFIG_PPC32
2066 { /* default match */ 2071 { /* default match */
2067 .pvr_mask = 0x00000000, 2072 .pvr_mask = 0x00000000,
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index bb9cac6c8051..3e68d1c69718 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -635,7 +635,7 @@ interrupt_end_book3e:
635 635
636/* Altivec Unavailable Interrupt */ 636/* Altivec Unavailable Interrupt */
637 START_EXCEPTION(altivec_unavailable); 637 START_EXCEPTION(altivec_unavailable);
638 NORMAL_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL, 638 NORMAL_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_ALTIVEC_UNAVAIL,
639 PROLOG_ADDITION_NONE) 639 PROLOG_ADDITION_NONE)
640 /* we can probably do a shorter exception entry for that one... */ 640 /* we can probably do a shorter exception entry for that one... */
641 EXCEPTION_COMMON(0x200) 641 EXCEPTION_COMMON(0x200)
@@ -658,7 +658,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
658/* AltiVec Assist */ 658/* AltiVec Assist */
659 START_EXCEPTION(altivec_assist); 659 START_EXCEPTION(altivec_assist);
660 NORMAL_EXCEPTION_PROLOG(0x220, 660 NORMAL_EXCEPTION_PROLOG(0x220,
661 BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST, 661 BOOKE_INTERRUPT_ALTIVEC_ASSIST,
662 PROLOG_ADDITION_NONE) 662 PROLOG_ADDITION_NONE)
663 EXCEPTION_COMMON(0x220) 663 EXCEPTION_COMMON(0x220)
664 INTS_DISABLE 664 INTS_DISABLE
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index b497188a94a1..fffd1f96bb1d 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -613,34 +613,36 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
613 mfspr r10, SPRN_SPRG_RSCRATCH0 613 mfspr r10, SPRN_SPRG_RSCRATCH0
614 b InstructionStorage 614 b InstructionStorage
615 615
616/* Define SPE handlers for e200 and e500v2 */
616#ifdef CONFIG_SPE 617#ifdef CONFIG_SPE
617 /* SPE Unavailable */ 618 /* SPE Unavailable */
618 START_EXCEPTION(SPEUnavailable) 619 START_EXCEPTION(SPEUnavailable)
619 NORMAL_EXCEPTION_PROLOG(SPE_ALTIVEC_UNAVAIL) 620 NORMAL_EXCEPTION_PROLOG(SPE_UNAVAIL)
620 beq 1f 621 beq 1f
621 bl load_up_spe 622 bl load_up_spe
622 b fast_exception_return 623 b fast_exception_return
6231: addi r3,r1,STACK_FRAME_OVERHEAD 6241: addi r3,r1,STACK_FRAME_OVERHEAD
624 EXC_XFER_EE_LITE(0x2010, KernelSPE) 625 EXC_XFER_EE_LITE(0x2010, KernelSPE)
625#else 626#elif defined(CONFIG_SPE_POSSIBLE)
626 EXCEPTION(0x2020, SPE_ALTIVEC_UNAVAIL, SPEUnavailable, \ 627 EXCEPTION(0x2020, SPE_UNAVAIL, SPEUnavailable, \
627 unknown_exception, EXC_XFER_EE) 628 unknown_exception, EXC_XFER_EE)
628#endif /* CONFIG_SPE */ 629#endif /* CONFIG_SPE_POSSIBLE */
629 630
630 /* SPE Floating Point Data */ 631 /* SPE Floating Point Data */
631#ifdef CONFIG_SPE 632#ifdef CONFIG_SPE
632 EXCEPTION(0x2030, SPE_FP_DATA_ALTIVEC_ASSIST, SPEFloatingPointData, 633 EXCEPTION(0x2030, SPE_FP_DATA, SPEFloatingPointData,
633 SPEFloatingPointException, EXC_XFER_EE) 634 SPEFloatingPointException, EXC_XFER_EE)
634 635
635 /* SPE Floating Point Round */ 636 /* SPE Floating Point Round */
636 EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \ 637 EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \
637 SPEFloatingPointRoundException, EXC_XFER_EE) 638 SPEFloatingPointRoundException, EXC_XFER_EE)
638#else 639#elif defined(CONFIG_SPE_POSSIBLE)
639 EXCEPTION(0x2040, SPE_FP_DATA_ALTIVEC_ASSIST, SPEFloatingPointData, 640 EXCEPTION(0x2040, SPE_FP_DATA, SPEFloatingPointData,
640 unknown_exception, EXC_XFER_EE) 641 unknown_exception, EXC_XFER_EE)
641 EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \ 642 EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \
642 unknown_exception, EXC_XFER_EE) 643 unknown_exception, EXC_XFER_EE)
643#endif /* CONFIG_SPE */ 644#endif /* CONFIG_SPE_POSSIBLE */
645
644 646
645 /* Performance Monitor */ 647 /* Performance Monitor */
646 EXCEPTION(0x2060, PERFORMANCE_MONITOR, PerformanceMonitor, \ 648 EXCEPTION(0x2060, PERFORMANCE_MONITOR, PerformanceMonitor, \
@@ -947,6 +949,7 @@ get_phys_addr:
947 * Global functions 949 * Global functions
948 */ 950 */
949 951
952#ifdef CONFIG_E200
950/* Adjust or setup IVORs for e200 */ 953/* Adjust or setup IVORs for e200 */
951_GLOBAL(__setup_e200_ivors) 954_GLOBAL(__setup_e200_ivors)
952 li r3,DebugDebug@l 955 li r3,DebugDebug@l
@@ -959,7 +962,10 @@ _GLOBAL(__setup_e200_ivors)
959 mtspr SPRN_IVOR34,r3 962 mtspr SPRN_IVOR34,r3
960 sync 963 sync
961 blr 964 blr
965#endif
962 966
967#ifdef CONFIG_E500
968#ifndef CONFIG_PPC_E500MC
963/* Adjust or setup IVORs for e500v1/v2 */ 969/* Adjust or setup IVORs for e500v1/v2 */
964_GLOBAL(__setup_e500_ivors) 970_GLOBAL(__setup_e500_ivors)
965 li r3,DebugCrit@l 971 li r3,DebugCrit@l
@@ -974,7 +980,7 @@ _GLOBAL(__setup_e500_ivors)
974 mtspr SPRN_IVOR35,r3 980 mtspr SPRN_IVOR35,r3
975 sync 981 sync
976 blr 982 blr
977 983#else
978/* Adjust or setup IVORs for e500mc */ 984/* Adjust or setup IVORs for e500mc */
979_GLOBAL(__setup_e500mc_ivors) 985_GLOBAL(__setup_e500mc_ivors)
980 li r3,DebugDebug@l 986 li r3,DebugDebug@l
@@ -1000,6 +1006,8 @@ _GLOBAL(__setup_ehv_ivors)
1000 mtspr SPRN_IVOR41,r3 1006 mtspr SPRN_IVOR41,r3
1001 sync 1007 sync
1002 blr 1008 blr
1009#endif /* CONFIG_PPC_E500MC */
1010#endif /* CONFIG_E500 */
1003 1011
1004#ifdef CONFIG_SPE 1012#ifdef CONFIG_SPE
1005/* 1013/*
diff --git a/arch/powerpc/kernel/msi.c b/arch/powerpc/kernel/msi.c
index 8bbc12d20f5c..71bd161640cf 100644
--- a/arch/powerpc/kernel/msi.c
+++ b/arch/powerpc/kernel/msi.c
@@ -13,7 +13,7 @@
13 13
14#include <asm/machdep.h> 14#include <asm/machdep.h>
15 15
16int arch_msi_check_device(struct pci_dev* dev, int nvec, int type) 16int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
17{ 17{
18 if (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs) { 18 if (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs) {
19 pr_debug("msi: Platform doesn't provide MSI callbacks.\n"); 19 pr_debug("msi: Platform doesn't provide MSI callbacks.\n");
@@ -24,16 +24,6 @@ int arch_msi_check_device(struct pci_dev* dev, int nvec, int type)
24 if (type == PCI_CAP_ID_MSI && nvec > 1) 24 if (type == PCI_CAP_ID_MSI && nvec > 1)
25 return 1; 25 return 1;
26 26
27 if (ppc_md.msi_check_device) {
28 pr_debug("msi: Using platform check routine.\n");
29 return ppc_md.msi_check_device(dev, nvec, type);
30 }
31
32 return 0;
33}
34
35int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
36{
37 return ppc_md.setup_msi_irqs(dev, nvec, type); 27 return ppc_md.setup_msi_irqs(dev, nvec, type);
38} 28}
39 29
diff --git a/arch/powerpc/kernel/suspend.c b/arch/powerpc/kernel/suspend.c
index 0167d53da30c..a531154cc0f3 100644
--- a/arch/powerpc/kernel/suspend.c
+++ b/arch/powerpc/kernel/suspend.c
@@ -9,9 +9,7 @@
9 9
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <asm/page.h> 11#include <asm/page.h>
12 12#include <asm/sections.h>
13/* References to section boundaries */
14extern const void __nosave_begin, __nosave_end;
15 13
16/* 14/*
17 * pfn_is_nosave - check if given pfn is in the 'nosave' section 15 * pfn_is_nosave - check if given pfn is in the 'nosave' section
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index dd03f6b299ba..b32db4b95361 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -535,174 +535,111 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
535 return -ENOTSUPP; 535 return -ENOTSUPP;
536} 536}
537 537
538int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 538int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id,
539 union kvmppc_one_reg *val)
539{ 540{
540 int r; 541 int r = 0;
541 union kvmppc_one_reg val;
542 int size;
543 long int i; 542 long int i;
544 543
545 size = one_reg_size(reg->id); 544 r = vcpu->kvm->arch.kvm_ops->get_one_reg(vcpu, id, val);
546 if (size > sizeof(val))
547 return -EINVAL;
548
549 r = vcpu->kvm->arch.kvm_ops->get_one_reg(vcpu, reg->id, &val);
550 if (r == -EINVAL) { 545 if (r == -EINVAL) {
551 r = 0; 546 r = 0;
552 switch (reg->id) { 547 switch (id) {
553 case KVM_REG_PPC_DAR: 548 case KVM_REG_PPC_DAR:
554 val = get_reg_val(reg->id, kvmppc_get_dar(vcpu)); 549 *val = get_reg_val(id, kvmppc_get_dar(vcpu));
555 break; 550 break;
556 case KVM_REG_PPC_DSISR: 551 case KVM_REG_PPC_DSISR:
557 val = get_reg_val(reg->id, kvmppc_get_dsisr(vcpu)); 552 *val = get_reg_val(id, kvmppc_get_dsisr(vcpu));
558 break; 553 break;
559 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31: 554 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
560 i = reg->id - KVM_REG_PPC_FPR0; 555 i = id - KVM_REG_PPC_FPR0;
561 val = get_reg_val(reg->id, VCPU_FPR(vcpu, i)); 556 *val = get_reg_val(id, VCPU_FPR(vcpu, i));
562 break; 557 break;
563 case KVM_REG_PPC_FPSCR: 558 case KVM_REG_PPC_FPSCR:
564 val = get_reg_val(reg->id, vcpu->arch.fp.fpscr); 559 *val = get_reg_val(id, vcpu->arch.fp.fpscr);
565 break;
566#ifdef CONFIG_ALTIVEC
567 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
568 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
569 r = -ENXIO;
570 break;
571 }
572 val.vval = vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0];
573 break;
574 case KVM_REG_PPC_VSCR:
575 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
576 r = -ENXIO;
577 break;
578 }
579 val = get_reg_val(reg->id, vcpu->arch.vr.vscr.u[3]);
580 break; 560 break;
581 case KVM_REG_PPC_VRSAVE:
582 val = get_reg_val(reg->id, vcpu->arch.vrsave);
583 break;
584#endif /* CONFIG_ALTIVEC */
585#ifdef CONFIG_VSX 561#ifdef CONFIG_VSX
586 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: 562 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31:
587 if (cpu_has_feature(CPU_FTR_VSX)) { 563 if (cpu_has_feature(CPU_FTR_VSX)) {
588 long int i = reg->id - KVM_REG_PPC_VSR0; 564 i = id - KVM_REG_PPC_VSR0;
589 val.vsxval[0] = vcpu->arch.fp.fpr[i][0]; 565 val->vsxval[0] = vcpu->arch.fp.fpr[i][0];
590 val.vsxval[1] = vcpu->arch.fp.fpr[i][1]; 566 val->vsxval[1] = vcpu->arch.fp.fpr[i][1];
591 } else { 567 } else {
592 r = -ENXIO; 568 r = -ENXIO;
593 } 569 }
594 break; 570 break;
595#endif /* CONFIG_VSX */ 571#endif /* CONFIG_VSX */
596 case KVM_REG_PPC_DEBUG_INST: { 572 case KVM_REG_PPC_DEBUG_INST:
597 u32 opcode = INS_TW; 573 *val = get_reg_val(id, INS_TW);
598 r = copy_to_user((u32 __user *)(long)reg->addr,
599 &opcode, sizeof(u32));
600 break; 574 break;
601 }
602#ifdef CONFIG_KVM_XICS 575#ifdef CONFIG_KVM_XICS
603 case KVM_REG_PPC_ICP_STATE: 576 case KVM_REG_PPC_ICP_STATE:
604 if (!vcpu->arch.icp) { 577 if (!vcpu->arch.icp) {
605 r = -ENXIO; 578 r = -ENXIO;
606 break; 579 break;
607 } 580 }
608 val = get_reg_val(reg->id, kvmppc_xics_get_icp(vcpu)); 581 *val = get_reg_val(id, kvmppc_xics_get_icp(vcpu));
609 break; 582 break;
610#endif /* CONFIG_KVM_XICS */ 583#endif /* CONFIG_KVM_XICS */
611 case KVM_REG_PPC_FSCR: 584 case KVM_REG_PPC_FSCR:
612 val = get_reg_val(reg->id, vcpu->arch.fscr); 585 *val = get_reg_val(id, vcpu->arch.fscr);
613 break; 586 break;
614 case KVM_REG_PPC_TAR: 587 case KVM_REG_PPC_TAR:
615 val = get_reg_val(reg->id, vcpu->arch.tar); 588 *val = get_reg_val(id, vcpu->arch.tar);
616 break; 589 break;
617 case KVM_REG_PPC_EBBHR: 590 case KVM_REG_PPC_EBBHR:
618 val = get_reg_val(reg->id, vcpu->arch.ebbhr); 591 *val = get_reg_val(id, vcpu->arch.ebbhr);
619 break; 592 break;
620 case KVM_REG_PPC_EBBRR: 593 case KVM_REG_PPC_EBBRR:
621 val = get_reg_val(reg->id, vcpu->arch.ebbrr); 594 *val = get_reg_val(id, vcpu->arch.ebbrr);
622 break; 595 break;
623 case KVM_REG_PPC_BESCR: 596 case KVM_REG_PPC_BESCR:
624 val = get_reg_val(reg->id, vcpu->arch.bescr); 597 *val = get_reg_val(id, vcpu->arch.bescr);
625 break; 598 break;
626 case KVM_REG_PPC_VTB: 599 case KVM_REG_PPC_VTB:
627 val = get_reg_val(reg->id, vcpu->arch.vtb); 600 *val = get_reg_val(id, vcpu->arch.vtb);
628 break; 601 break;
629 case KVM_REG_PPC_IC: 602 case KVM_REG_PPC_IC:
630 val = get_reg_val(reg->id, vcpu->arch.ic); 603 *val = get_reg_val(id, vcpu->arch.ic);
631 break; 604 break;
632 default: 605 default:
633 r = -EINVAL; 606 r = -EINVAL;
634 break; 607 break;
635 } 608 }
636 } 609 }
637 if (r)
638 return r;
639
640 if (copy_to_user((char __user *)(unsigned long)reg->addr, &val, size))
641 r = -EFAULT;
642 610
643 return r; 611 return r;
644} 612}
645 613
646int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 614int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id,
615 union kvmppc_one_reg *val)
647{ 616{
648 int r; 617 int r = 0;
649 union kvmppc_one_reg val;
650 int size;
651 long int i; 618 long int i;
652 619
653 size = one_reg_size(reg->id); 620 r = vcpu->kvm->arch.kvm_ops->set_one_reg(vcpu, id, val);
654 if (size > sizeof(val))
655 return -EINVAL;
656
657 if (copy_from_user(&val, (char __user *)(unsigned long)reg->addr, size))
658 return -EFAULT;
659
660 r = vcpu->kvm->arch.kvm_ops->set_one_reg(vcpu, reg->id, &val);
661 if (r == -EINVAL) { 621 if (r == -EINVAL) {
662 r = 0; 622 r = 0;
663 switch (reg->id) { 623 switch (id) {
664 case KVM_REG_PPC_DAR: 624 case KVM_REG_PPC_DAR:
665 kvmppc_set_dar(vcpu, set_reg_val(reg->id, val)); 625 kvmppc_set_dar(vcpu, set_reg_val(id, *val));
666 break; 626 break;
667 case KVM_REG_PPC_DSISR: 627 case KVM_REG_PPC_DSISR:
668 kvmppc_set_dsisr(vcpu, set_reg_val(reg->id, val)); 628 kvmppc_set_dsisr(vcpu, set_reg_val(id, *val));
669 break; 629 break;
670 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31: 630 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
671 i = reg->id - KVM_REG_PPC_FPR0; 631 i = id - KVM_REG_PPC_FPR0;
672 VCPU_FPR(vcpu, i) = set_reg_val(reg->id, val); 632 VCPU_FPR(vcpu, i) = set_reg_val(id, *val);
673 break; 633 break;
674 case KVM_REG_PPC_FPSCR: 634 case KVM_REG_PPC_FPSCR:
675 vcpu->arch.fp.fpscr = set_reg_val(reg->id, val); 635 vcpu->arch.fp.fpscr = set_reg_val(id, *val);
676 break;
677#ifdef CONFIG_ALTIVEC
678 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
679 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
680 r = -ENXIO;
681 break;
682 }
683 vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0] = val.vval;
684 break;
685 case KVM_REG_PPC_VSCR:
686 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
687 r = -ENXIO;
688 break;
689 }
690 vcpu->arch.vr.vscr.u[3] = set_reg_val(reg->id, val);
691 break;
692 case KVM_REG_PPC_VRSAVE:
693 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
694 r = -ENXIO;
695 break;
696 }
697 vcpu->arch.vrsave = set_reg_val(reg->id, val);
698 break; 636 break;
699#endif /* CONFIG_ALTIVEC */
700#ifdef CONFIG_VSX 637#ifdef CONFIG_VSX
701 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: 638 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31:
702 if (cpu_has_feature(CPU_FTR_VSX)) { 639 if (cpu_has_feature(CPU_FTR_VSX)) {
703 long int i = reg->id - KVM_REG_PPC_VSR0; 640 i = id - KVM_REG_PPC_VSR0;
704 vcpu->arch.fp.fpr[i][0] = val.vsxval[0]; 641 vcpu->arch.fp.fpr[i][0] = val->vsxval[0];
705 vcpu->arch.fp.fpr[i][1] = val.vsxval[1]; 642 vcpu->arch.fp.fpr[i][1] = val->vsxval[1];
706 } else { 643 } else {
707 r = -ENXIO; 644 r = -ENXIO;
708 } 645 }
@@ -715,29 +652,29 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
715 break; 652 break;
716 } 653 }
717 r = kvmppc_xics_set_icp(vcpu, 654 r = kvmppc_xics_set_icp(vcpu,
718 set_reg_val(reg->id, val)); 655 set_reg_val(id, *val));
719 break; 656 break;
720#endif /* CONFIG_KVM_XICS */ 657#endif /* CONFIG_KVM_XICS */
721 case KVM_REG_PPC_FSCR: 658 case KVM_REG_PPC_FSCR:
722 vcpu->arch.fscr = set_reg_val(reg->id, val); 659 vcpu->arch.fscr = set_reg_val(id, *val);
723 break; 660 break;
724 case KVM_REG_PPC_TAR: 661 case KVM_REG_PPC_TAR:
725 vcpu->arch.tar = set_reg_val(reg->id, val); 662 vcpu->arch.tar = set_reg_val(id, *val);
726 break; 663 break;
727 case KVM_REG_PPC_EBBHR: 664 case KVM_REG_PPC_EBBHR:
728 vcpu->arch.ebbhr = set_reg_val(reg->id, val); 665 vcpu->arch.ebbhr = set_reg_val(id, *val);
729 break; 666 break;
730 case KVM_REG_PPC_EBBRR: 667 case KVM_REG_PPC_EBBRR:
731 vcpu->arch.ebbrr = set_reg_val(reg->id, val); 668 vcpu->arch.ebbrr = set_reg_val(id, *val);
732 break; 669 break;
733 case KVM_REG_PPC_BESCR: 670 case KVM_REG_PPC_BESCR:
734 vcpu->arch.bescr = set_reg_val(reg->id, val); 671 vcpu->arch.bescr = set_reg_val(id, *val);
735 break; 672 break;
736 case KVM_REG_PPC_VTB: 673 case KVM_REG_PPC_VTB:
737 vcpu->arch.vtb = set_reg_val(reg->id, val); 674 vcpu->arch.vtb = set_reg_val(id, *val);
738 break; 675 break;
739 case KVM_REG_PPC_IC: 676 case KVM_REG_PPC_IC:
740 vcpu->arch.ic = set_reg_val(reg->id, val); 677 vcpu->arch.ic = set_reg_val(id, *val);
741 break; 678 break;
742 default: 679 default:
743 r = -EINVAL; 680 r = -EINVAL;
@@ -778,13 +715,12 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
778int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, 715int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
779 struct kvm_guest_debug *dbg) 716 struct kvm_guest_debug *dbg)
780{ 717{
781 return -EINVAL; 718 vcpu->guest_debug = dbg->control;
719 return 0;
782} 720}
783 721
784void kvmppc_decrementer_func(unsigned long data) 722void kvmppc_decrementer_func(struct kvm_vcpu *vcpu)
785{ 723{
786 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
787
788 kvmppc_core_queue_dec(vcpu); 724 kvmppc_core_queue_dec(vcpu);
789 kvm_vcpu_kick(vcpu); 725 kvm_vcpu_kick(vcpu);
790} 726}
@@ -851,9 +787,9 @@ int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
851 return kvm->arch.kvm_ops->unmap_hva_range(kvm, start, end); 787 return kvm->arch.kvm_ops->unmap_hva_range(kvm, start, end);
852} 788}
853 789
854int kvm_age_hva(struct kvm *kvm, unsigned long hva) 790int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end)
855{ 791{
856 return kvm->arch.kvm_ops->age_hva(kvm, hva); 792 return kvm->arch.kvm_ops->age_hva(kvm, start, end);
857} 793}
858 794
859int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) 795int kvm_test_age_hva(struct kvm *kvm, unsigned long hva)
diff --git a/arch/powerpc/kvm/book3s.h b/arch/powerpc/kvm/book3s.h
index 4bf956cf94d6..d2b3ec088b8c 100644
--- a/arch/powerpc/kvm/book3s.h
+++ b/arch/powerpc/kvm/book3s.h
@@ -17,7 +17,8 @@ extern void kvmppc_core_flush_memslot_hv(struct kvm *kvm,
17extern int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva); 17extern int kvm_unmap_hva_hv(struct kvm *kvm, unsigned long hva);
18extern int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, 18extern int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start,
19 unsigned long end); 19 unsigned long end);
20extern int kvm_age_hva_hv(struct kvm *kvm, unsigned long hva); 20extern int kvm_age_hva_hv(struct kvm *kvm, unsigned long start,
21 unsigned long end);
21extern int kvm_test_age_hva_hv(struct kvm *kvm, unsigned long hva); 22extern int kvm_test_age_hva_hv(struct kvm *kvm, unsigned long hva);
22extern void kvm_set_spte_hva_hv(struct kvm *kvm, unsigned long hva, pte_t pte); 23extern void kvm_set_spte_hva_hv(struct kvm *kvm, unsigned long hva, pte_t pte);
23 24
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 72c20bb16d26..d40770248b6a 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -62,10 +62,10 @@ long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp)
62 } 62 }
63 63
64 kvm->arch.hpt_cma_alloc = 0; 64 kvm->arch.hpt_cma_alloc = 0;
65 page = kvm_alloc_hpt(1 << (order - PAGE_SHIFT)); 65 page = kvm_alloc_hpt(1ul << (order - PAGE_SHIFT));
66 if (page) { 66 if (page) {
67 hpt = (unsigned long)pfn_to_kaddr(page_to_pfn(page)); 67 hpt = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
68 memset((void *)hpt, 0, (1 << order)); 68 memset((void *)hpt, 0, (1ul << order));
69 kvm->arch.hpt_cma_alloc = 1; 69 kvm->arch.hpt_cma_alloc = 1;
70 } 70 }
71 71
@@ -1002,11 +1002,11 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1002 return ret; 1002 return ret;
1003} 1003}
1004 1004
1005int kvm_age_hva_hv(struct kvm *kvm, unsigned long hva) 1005int kvm_age_hva_hv(struct kvm *kvm, unsigned long start, unsigned long end)
1006{ 1006{
1007 if (!kvm->arch.using_mmu_notifiers) 1007 if (!kvm->arch.using_mmu_notifiers)
1008 return 0; 1008 return 0;
1009 return kvm_handle_hva(kvm, hva, kvm_age_rmapp); 1009 return kvm_handle_hva_range(kvm, start, end, kvm_age_rmapp);
1010} 1010}
1011 1011
1012static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 1012static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 27cced9c7249..e63587d30b70 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -725,6 +725,30 @@ static int kvmppc_hcall_impl_hv(unsigned long cmd)
725 return kvmppc_hcall_impl_hv_realmode(cmd); 725 return kvmppc_hcall_impl_hv_realmode(cmd);
726} 726}
727 727
728static int kvmppc_emulate_debug_inst(struct kvm_run *run,
729 struct kvm_vcpu *vcpu)
730{
731 u32 last_inst;
732
733 if (kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst) !=
734 EMULATE_DONE) {
735 /*
736 * Fetch failed, so return to guest and
737 * try executing it again.
738 */
739 return RESUME_GUEST;
740 }
741
742 if (last_inst == KVMPPC_INST_SW_BREAKPOINT) {
743 run->exit_reason = KVM_EXIT_DEBUG;
744 run->debug.arch.address = kvmppc_get_pc(vcpu);
745 return RESUME_HOST;
746 } else {
747 kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
748 return RESUME_GUEST;
749 }
750}
751
728static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu, 752static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
729 struct task_struct *tsk) 753 struct task_struct *tsk)
730{ 754{
@@ -807,12 +831,18 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
807 break; 831 break;
808 /* 832 /*
809 * This occurs if the guest executes an illegal instruction. 833 * This occurs if the guest executes an illegal instruction.
810 * We just generate a program interrupt to the guest, since 834 * If the guest debug is disabled, generate a program interrupt
811 * we don't emulate any guest instructions at this stage. 835 * to the guest. If guest debug is enabled, we need to check
836 * whether the instruction is a software breakpoint instruction.
837 * Accordingly return to Guest or Host.
812 */ 838 */
813 case BOOK3S_INTERRUPT_H_EMUL_ASSIST: 839 case BOOK3S_INTERRUPT_H_EMUL_ASSIST:
814 kvmppc_core_queue_program(vcpu, SRR1_PROGILL); 840 if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP) {
815 r = RESUME_GUEST; 841 r = kvmppc_emulate_debug_inst(run, vcpu);
842 } else {
843 kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
844 r = RESUME_GUEST;
845 }
816 break; 846 break;
817 /* 847 /*
818 * This occurs if the guest (kernel or userspace), does something that 848 * This occurs if the guest (kernel or userspace), does something that
@@ -856,7 +886,9 @@ static int kvm_arch_vcpu_ioctl_set_sregs_hv(struct kvm_vcpu *vcpu,
856{ 886{
857 int i, j; 887 int i, j;
858 888
859 kvmppc_set_pvr_hv(vcpu, sregs->pvr); 889 /* Only accept the same PVR as the host's, since we can't spoof it */
890 if (sregs->pvr != vcpu->arch.pvr)
891 return -EINVAL;
860 892
861 j = 0; 893 j = 0;
862 for (i = 0; i < vcpu->arch.slb_nr; i++) { 894 for (i = 0; i < vcpu->arch.slb_nr; i++) {
@@ -922,6 +954,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
922 long int i; 954 long int i;
923 955
924 switch (id) { 956 switch (id) {
957 case KVM_REG_PPC_DEBUG_INST:
958 *val = get_reg_val(id, KVMPPC_INST_SW_BREAKPOINT);
959 break;
925 case KVM_REG_PPC_HIOR: 960 case KVM_REG_PPC_HIOR:
926 *val = get_reg_val(id, 0); 961 *val = get_reg_val(id, 0);
927 break; 962 break;
@@ -1489,7 +1524,7 @@ static void kvmppc_remove_runnable(struct kvmppc_vcore *vc,
1489static int kvmppc_grab_hwthread(int cpu) 1524static int kvmppc_grab_hwthread(int cpu)
1490{ 1525{
1491 struct paca_struct *tpaca; 1526 struct paca_struct *tpaca;
1492 long timeout = 1000; 1527 long timeout = 10000;
1493 1528
1494 tpaca = &paca[cpu]; 1529 tpaca = &paca[cpu];
1495 1530
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
index 329d7fdd0a6a..4fdc27c80f4c 100644
--- a/arch/powerpc/kvm/book3s_hv_builtin.c
+++ b/arch/powerpc/kvm/book3s_hv_builtin.c
@@ -101,7 +101,7 @@ struct kvm_rma_info *kvm_alloc_rma()
101 ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL); 101 ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL);
102 if (!ri) 102 if (!ri)
103 return NULL; 103 return NULL;
104 page = cma_alloc(kvm_cma, kvm_rma_pages, get_order(kvm_rma_pages)); 104 page = cma_alloc(kvm_cma, kvm_rma_pages, order_base_2(kvm_rma_pages));
105 if (!page) 105 if (!page)
106 goto err_out; 106 goto err_out;
107 atomic_set(&ri->use_count, 1); 107 atomic_set(&ri->use_count, 1);
@@ -135,12 +135,12 @@ struct page *kvm_alloc_hpt(unsigned long nr_pages)
135{ 135{
136 unsigned long align_pages = HPT_ALIGN_PAGES; 136 unsigned long align_pages = HPT_ALIGN_PAGES;
137 137
138 VM_BUG_ON(get_order(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT); 138 VM_BUG_ON(order_base_2(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
139 139
140 /* Old CPUs require HPT aligned on a multiple of its size */ 140 /* Old CPUs require HPT aligned on a multiple of its size */
141 if (!cpu_has_feature(CPU_FTR_ARCH_206)) 141 if (!cpu_has_feature(CPU_FTR_ARCH_206))
142 align_pages = nr_pages; 142 align_pages = nr_pages;
143 return cma_alloc(kvm_cma, nr_pages, get_order(align_pages)); 143 return cma_alloc(kvm_cma, nr_pages, order_base_2(align_pages));
144} 144}
145EXPORT_SYMBOL_GPL(kvm_alloc_hpt); 145EXPORT_SYMBOL_GPL(kvm_alloc_hpt);
146 146
@@ -163,6 +163,12 @@ void __init kvm_cma_reserve(void)
163 unsigned long align_size; 163 unsigned long align_size;
164 struct memblock_region *reg; 164 struct memblock_region *reg;
165 phys_addr_t selected_size = 0; 165 phys_addr_t selected_size = 0;
166
167 /*
168 * We need CMA reservation only when we are in HV mode
169 */
170 if (!cpu_has_feature(CPU_FTR_HVMODE))
171 return;
166 /* 172 /*
167 * We cannot use memblock_phys_mem_size() here, because 173 * We cannot use memblock_phys_mem_size() here, because
168 * memblock_analyze() has not been called yet. 174 * memblock_analyze() has not been called yet.
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index f0c4db7704c3..edb2ccdbb2ba 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -355,6 +355,7 @@ kvmppc_hv_entry:
355 * MSR = ~IR|DR 355 * MSR = ~IR|DR
356 * R13 = PACA 356 * R13 = PACA
357 * R1 = host R1 357 * R1 = host R1
358 * R2 = TOC
358 * all other volatile GPRS = free 359 * all other volatile GPRS = free
359 */ 360 */
360 mflr r0 361 mflr r0
@@ -503,7 +504,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
503toc_tlbie_lock: 504toc_tlbie_lock:
504 .tc native_tlbie_lock[TC],native_tlbie_lock 505 .tc native_tlbie_lock[TC],native_tlbie_lock
505 .previous 506 .previous
506 ld r3,toc_tlbie_lock@toc(2) 507 ld r3,toc_tlbie_lock@toc(r2)
507#ifdef __BIG_ENDIAN__ 508#ifdef __BIG_ENDIAN__
508 lwz r8,PACA_LOCK_TOKEN(r13) 509 lwz r8,PACA_LOCK_TOKEN(r13)
509#else 510#else
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index faffb27badd9..cf2eb16846d1 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -295,7 +295,8 @@ static int kvm_unmap_hva_range_pr(struct kvm *kvm, unsigned long start,
295 return 0; 295 return 0;
296} 296}
297 297
298static int kvm_age_hva_pr(struct kvm *kvm, unsigned long hva) 298static int kvm_age_hva_pr(struct kvm *kvm, unsigned long start,
299 unsigned long end)
299{ 300{
300 /* XXX could be more clever ;) */ 301 /* XXX could be more clever ;) */
301 return 0; 302 return 0;
@@ -1319,6 +1320,9 @@ static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
1319 int r = 0; 1320 int r = 0;
1320 1321
1321 switch (id) { 1322 switch (id) {
1323 case KVM_REG_PPC_DEBUG_INST:
1324 *val = get_reg_val(id, KVMPPC_INST_SW_BREAKPOINT);
1325 break;
1322 case KVM_REG_PPC_HIOR: 1326 case KVM_REG_PPC_HIOR:
1323 *val = get_reg_val(id, to_book3s(vcpu)->hior); 1327 *val = get_reg_val(id, to_book3s(vcpu)->hior);
1324 break; 1328 break;
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index b4c89fa6f109..9b55dec2d6cc 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -124,6 +124,40 @@ static void kvmppc_vcpu_sync_spe(struct kvm_vcpu *vcpu)
124} 124}
125#endif 125#endif
126 126
127/*
128 * Load up guest vcpu FP state if it's needed.
129 * It also set the MSR_FP in thread so that host know
130 * we're holding FPU, and then host can help to save
131 * guest vcpu FP state if other threads require to use FPU.
132 * This simulates an FP unavailable fault.
133 *
134 * It requires to be called with preemption disabled.
135 */
136static inline void kvmppc_load_guest_fp(struct kvm_vcpu *vcpu)
137{
138#ifdef CONFIG_PPC_FPU
139 if (!(current->thread.regs->msr & MSR_FP)) {
140 enable_kernel_fp();
141 load_fp_state(&vcpu->arch.fp);
142 current->thread.fp_save_area = &vcpu->arch.fp;
143 current->thread.regs->msr |= MSR_FP;
144 }
145#endif
146}
147
148/*
149 * Save guest vcpu FP state into thread.
150 * It requires to be called with preemption disabled.
151 */
152static inline void kvmppc_save_guest_fp(struct kvm_vcpu *vcpu)
153{
154#ifdef CONFIG_PPC_FPU
155 if (current->thread.regs->msr & MSR_FP)
156 giveup_fpu(current);
157 current->thread.fp_save_area = NULL;
158#endif
159}
160
127static void kvmppc_vcpu_sync_fpu(struct kvm_vcpu *vcpu) 161static void kvmppc_vcpu_sync_fpu(struct kvm_vcpu *vcpu)
128{ 162{
129#if defined(CONFIG_PPC_FPU) && !defined(CONFIG_KVM_BOOKE_HV) 163#if defined(CONFIG_PPC_FPU) && !defined(CONFIG_KVM_BOOKE_HV)
@@ -134,6 +168,40 @@ static void kvmppc_vcpu_sync_fpu(struct kvm_vcpu *vcpu)
134#endif 168#endif
135} 169}
136 170
171/*
172 * Simulate AltiVec unavailable fault to load guest state
173 * from thread to AltiVec unit.
174 * It requires to be called with preemption disabled.
175 */
176static inline void kvmppc_load_guest_altivec(struct kvm_vcpu *vcpu)
177{
178#ifdef CONFIG_ALTIVEC
179 if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
180 if (!(current->thread.regs->msr & MSR_VEC)) {
181 enable_kernel_altivec();
182 load_vr_state(&vcpu->arch.vr);
183 current->thread.vr_save_area = &vcpu->arch.vr;
184 current->thread.regs->msr |= MSR_VEC;
185 }
186 }
187#endif
188}
189
190/*
191 * Save guest vcpu AltiVec state into thread.
192 * It requires to be called with preemption disabled.
193 */
194static inline void kvmppc_save_guest_altivec(struct kvm_vcpu *vcpu)
195{
196#ifdef CONFIG_ALTIVEC
197 if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
198 if (current->thread.regs->msr & MSR_VEC)
199 giveup_altivec(current);
200 current->thread.vr_save_area = NULL;
201 }
202#endif
203}
204
137static void kvmppc_vcpu_sync_debug(struct kvm_vcpu *vcpu) 205static void kvmppc_vcpu_sync_debug(struct kvm_vcpu *vcpu)
138{ 206{
139 /* Synchronize guest's desire to get debug interrupts into shadow MSR */ 207 /* Synchronize guest's desire to get debug interrupts into shadow MSR */
@@ -267,6 +335,16 @@ static void kvmppc_core_dequeue_watchdog(struct kvm_vcpu *vcpu)
267 clear_bit(BOOKE_IRQPRIO_WATCHDOG, &vcpu->arch.pending_exceptions); 335 clear_bit(BOOKE_IRQPRIO_WATCHDOG, &vcpu->arch.pending_exceptions);
268} 336}
269 337
338void kvmppc_core_queue_debug(struct kvm_vcpu *vcpu)
339{
340 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DEBUG);
341}
342
343void kvmppc_core_dequeue_debug(struct kvm_vcpu *vcpu)
344{
345 clear_bit(BOOKE_IRQPRIO_DEBUG, &vcpu->arch.pending_exceptions);
346}
347
270static void set_guest_srr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1) 348static void set_guest_srr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1)
271{ 349{
272 kvmppc_set_srr0(vcpu, srr0); 350 kvmppc_set_srr0(vcpu, srr0);
@@ -341,9 +419,15 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
341 case BOOKE_IRQPRIO_ITLB_MISS: 419 case BOOKE_IRQPRIO_ITLB_MISS:
342 case BOOKE_IRQPRIO_SYSCALL: 420 case BOOKE_IRQPRIO_SYSCALL:
343 case BOOKE_IRQPRIO_FP_UNAVAIL: 421 case BOOKE_IRQPRIO_FP_UNAVAIL:
422#ifdef CONFIG_SPE_POSSIBLE
344 case BOOKE_IRQPRIO_SPE_UNAVAIL: 423 case BOOKE_IRQPRIO_SPE_UNAVAIL:
345 case BOOKE_IRQPRIO_SPE_FP_DATA: 424 case BOOKE_IRQPRIO_SPE_FP_DATA:
346 case BOOKE_IRQPRIO_SPE_FP_ROUND: 425 case BOOKE_IRQPRIO_SPE_FP_ROUND:
426#endif
427#ifdef CONFIG_ALTIVEC
428 case BOOKE_IRQPRIO_ALTIVEC_UNAVAIL:
429 case BOOKE_IRQPRIO_ALTIVEC_ASSIST:
430#endif
347 case BOOKE_IRQPRIO_AP_UNAVAIL: 431 case BOOKE_IRQPRIO_AP_UNAVAIL:
348 allowed = 1; 432 allowed = 1;
349 msr_mask = MSR_CE | MSR_ME | MSR_DE; 433 msr_mask = MSR_CE | MSR_ME | MSR_DE;
@@ -377,7 +461,11 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
377 allowed = vcpu->arch.shared->msr & MSR_DE; 461 allowed = vcpu->arch.shared->msr & MSR_DE;
378 allowed = allowed && !crit; 462 allowed = allowed && !crit;
379 msr_mask = MSR_ME; 463 msr_mask = MSR_ME;
380 int_class = INT_CLASS_CRIT; 464 if (cpu_has_feature(CPU_FTR_DEBUG_LVL_EXC))
465 int_class = INT_CLASS_DBG;
466 else
467 int_class = INT_CLASS_CRIT;
468
381 break; 469 break;
382 } 470 }
383 471
@@ -654,20 +742,27 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
654 742
655 /* 743 /*
656 * Since we can't trap on MSR_FP in GS-mode, we consider the guest 744 * Since we can't trap on MSR_FP in GS-mode, we consider the guest
657 * as always using the FPU. Kernel usage of FP (via 745 * as always using the FPU.
658 * enable_kernel_fp()) in this thread must not occur while
659 * vcpu->fpu_active is set.
660 */ 746 */
661 vcpu->fpu_active = 1;
662
663 kvmppc_load_guest_fp(vcpu); 747 kvmppc_load_guest_fp(vcpu);
664#endif 748#endif
665 749
750#ifdef CONFIG_ALTIVEC
751 /* Save userspace AltiVec state in stack */
752 if (cpu_has_feature(CPU_FTR_ALTIVEC))
753 enable_kernel_altivec();
754 /*
755 * Since we can't trap on MSR_VEC in GS-mode, we consider the guest
756 * as always using the AltiVec.
757 */
758 kvmppc_load_guest_altivec(vcpu);
759#endif
760
666 /* Switch to guest debug context */ 761 /* Switch to guest debug context */
667 debug = vcpu->arch.shadow_dbg_reg; 762 debug = vcpu->arch.dbg_reg;
668 switch_booke_debug_regs(&debug); 763 switch_booke_debug_regs(&debug);
669 debug = current->thread.debug; 764 debug = current->thread.debug;
670 current->thread.debug = vcpu->arch.shadow_dbg_reg; 765 current->thread.debug = vcpu->arch.dbg_reg;
671 766
672 vcpu->arch.pgdir = current->mm->pgd; 767 vcpu->arch.pgdir = current->mm->pgd;
673 kvmppc_fix_ee_before_entry(); 768 kvmppc_fix_ee_before_entry();
@@ -683,8 +778,10 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
683 778
684#ifdef CONFIG_PPC_FPU 779#ifdef CONFIG_PPC_FPU
685 kvmppc_save_guest_fp(vcpu); 780 kvmppc_save_guest_fp(vcpu);
781#endif
686 782
687 vcpu->fpu_active = 0; 783#ifdef CONFIG_ALTIVEC
784 kvmppc_save_guest_altivec(vcpu);
688#endif 785#endif
689 786
690out: 787out:
@@ -728,9 +825,36 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
728 825
729static int kvmppc_handle_debug(struct kvm_run *run, struct kvm_vcpu *vcpu) 826static int kvmppc_handle_debug(struct kvm_run *run, struct kvm_vcpu *vcpu)
730{ 827{
731 struct debug_reg *dbg_reg = &(vcpu->arch.shadow_dbg_reg); 828 struct debug_reg *dbg_reg = &(vcpu->arch.dbg_reg);
732 u32 dbsr = vcpu->arch.dbsr; 829 u32 dbsr = vcpu->arch.dbsr;
733 830
831 if (vcpu->guest_debug == 0) {
832 /*
833 * Debug resources belong to Guest.
834 * Imprecise debug event is not injected
835 */
836 if (dbsr & DBSR_IDE) {
837 dbsr &= ~DBSR_IDE;
838 if (!dbsr)
839 return RESUME_GUEST;
840 }
841
842 if (dbsr && (vcpu->arch.shared->msr & MSR_DE) &&
843 (vcpu->arch.dbg_reg.dbcr0 & DBCR0_IDM))
844 kvmppc_core_queue_debug(vcpu);
845
846 /* Inject a program interrupt if trap debug is not allowed */
847 if ((dbsr & DBSR_TIE) && !(vcpu->arch.shared->msr & MSR_DE))
848 kvmppc_core_queue_program(vcpu, ESR_PTR);
849
850 return RESUME_GUEST;
851 }
852
853 /*
854 * Debug resource owned by userspace.
855 * Clear guest dbsr (vcpu->arch.dbsr)
856 */
857 vcpu->arch.dbsr = 0;
734 run->debug.arch.status = 0; 858 run->debug.arch.status = 0;
735 run->debug.arch.address = vcpu->arch.pc; 859 run->debug.arch.address = vcpu->arch.pc;
736 860
@@ -868,7 +992,12 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
868 case BOOKE_INTERRUPT_DATA_STORAGE: 992 case BOOKE_INTERRUPT_DATA_STORAGE:
869 case BOOKE_INTERRUPT_DTLB_MISS: 993 case BOOKE_INTERRUPT_DTLB_MISS:
870 case BOOKE_INTERRUPT_HV_PRIV: 994 case BOOKE_INTERRUPT_HV_PRIV:
871 emulated = kvmppc_get_last_inst(vcpu, false, &last_inst); 995 emulated = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
996 break;
997 case BOOKE_INTERRUPT_PROGRAM:
998 /* SW breakpoints arrive as illegal instructions on HV */
999 if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP)
1000 emulated = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
872 break; 1001 break;
873 default: 1002 default:
874 break; 1003 break;
@@ -947,6 +1076,18 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
947 break; 1076 break;
948 1077
949 case BOOKE_INTERRUPT_PROGRAM: 1078 case BOOKE_INTERRUPT_PROGRAM:
1079 if ((vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP) &&
1080 (last_inst == KVMPPC_INST_SW_BREAKPOINT)) {
1081 /*
1082 * We are here because of an SW breakpoint instr,
1083 * so lets return to host to handle.
1084 */
1085 r = kvmppc_handle_debug(run, vcpu);
1086 run->exit_reason = KVM_EXIT_DEBUG;
1087 kvmppc_account_exit(vcpu, DEBUG_EXITS);
1088 break;
1089 }
1090
950 if (vcpu->arch.shared->msr & (MSR_PR | MSR_GS)) { 1091 if (vcpu->arch.shared->msr & (MSR_PR | MSR_GS)) {
951 /* 1092 /*
952 * Program traps generated by user-level software must 1093 * Program traps generated by user-level software must
@@ -991,7 +1132,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
991 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_SPE_FP_ROUND); 1132 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_SPE_FP_ROUND);
992 r = RESUME_GUEST; 1133 r = RESUME_GUEST;
993 break; 1134 break;
994#else 1135#elif defined(CONFIG_SPE_POSSIBLE)
995 case BOOKE_INTERRUPT_SPE_UNAVAIL: 1136 case BOOKE_INTERRUPT_SPE_UNAVAIL:
996 /* 1137 /*
997 * Guest wants SPE, but host kernel doesn't support it. Send 1138 * Guest wants SPE, but host kernel doesn't support it. Send
@@ -1012,6 +1153,22 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1012 run->hw.hardware_exit_reason = exit_nr; 1153 run->hw.hardware_exit_reason = exit_nr;
1013 r = RESUME_HOST; 1154 r = RESUME_HOST;
1014 break; 1155 break;
1156#endif /* CONFIG_SPE_POSSIBLE */
1157
1158/*
1159 * On cores with Vector category, KVM is loaded only if CONFIG_ALTIVEC,
1160 * see kvmppc_core_check_processor_compat().
1161 */
1162#ifdef CONFIG_ALTIVEC
1163 case BOOKE_INTERRUPT_ALTIVEC_UNAVAIL:
1164 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ALTIVEC_UNAVAIL);
1165 r = RESUME_GUEST;
1166 break;
1167
1168 case BOOKE_INTERRUPT_ALTIVEC_ASSIST:
1169 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ALTIVEC_ASSIST);
1170 r = RESUME_GUEST;
1171 break;
1015#endif 1172#endif
1016 1173
1017 case BOOKE_INTERRUPT_DATA_STORAGE: 1174 case BOOKE_INTERRUPT_DATA_STORAGE:
@@ -1188,6 +1345,8 @@ out:
1188 else { 1345 else {
1189 /* interrupts now hard-disabled */ 1346 /* interrupts now hard-disabled */
1190 kvmppc_fix_ee_before_entry(); 1347 kvmppc_fix_ee_before_entry();
1348 kvmppc_load_guest_fp(vcpu);
1349 kvmppc_load_guest_altivec(vcpu);
1191 } 1350 }
1192 } 1351 }
1193 1352
@@ -1243,6 +1402,11 @@ int kvmppc_subarch_vcpu_init(struct kvm_vcpu *vcpu)
1243 setup_timer(&vcpu->arch.wdt_timer, kvmppc_watchdog_func, 1402 setup_timer(&vcpu->arch.wdt_timer, kvmppc_watchdog_func,
1244 (unsigned long)vcpu); 1403 (unsigned long)vcpu);
1245 1404
1405 /*
1406 * Clear DBSR.MRR to avoid guest debug interrupt as
1407 * this is of host interest
1408 */
1409 mtspr(SPRN_DBSR, DBSR_MRR);
1246 return 0; 1410 return 0;
1247} 1411}
1248 1412
@@ -1457,144 +1621,125 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1457 return vcpu->kvm->arch.kvm_ops->set_sregs(vcpu, sregs); 1621 return vcpu->kvm->arch.kvm_ops->set_sregs(vcpu, sregs);
1458} 1622}
1459 1623
1460int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 1624int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id,
1625 union kvmppc_one_reg *val)
1461{ 1626{
1462 int r = 0; 1627 int r = 0;
1463 union kvmppc_one_reg val;
1464 int size;
1465
1466 size = one_reg_size(reg->id);
1467 if (size > sizeof(val))
1468 return -EINVAL;
1469 1628
1470 switch (reg->id) { 1629 switch (id) {
1471 case KVM_REG_PPC_IAC1: 1630 case KVM_REG_PPC_IAC1:
1472 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac1); 1631 *val = get_reg_val(id, vcpu->arch.dbg_reg.iac1);
1473 break; 1632 break;
1474 case KVM_REG_PPC_IAC2: 1633 case KVM_REG_PPC_IAC2:
1475 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac2); 1634 *val = get_reg_val(id, vcpu->arch.dbg_reg.iac2);
1476 break; 1635 break;
1477#if CONFIG_PPC_ADV_DEBUG_IACS > 2 1636#if CONFIG_PPC_ADV_DEBUG_IACS > 2
1478 case KVM_REG_PPC_IAC3: 1637 case KVM_REG_PPC_IAC3:
1479 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac3); 1638 *val = get_reg_val(id, vcpu->arch.dbg_reg.iac3);
1480 break; 1639 break;
1481 case KVM_REG_PPC_IAC4: 1640 case KVM_REG_PPC_IAC4:
1482 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac4); 1641 *val = get_reg_val(id, vcpu->arch.dbg_reg.iac4);
1483 break; 1642 break;
1484#endif 1643#endif
1485 case KVM_REG_PPC_DAC1: 1644 case KVM_REG_PPC_DAC1:
1486 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac1); 1645 *val = get_reg_val(id, vcpu->arch.dbg_reg.dac1);
1487 break; 1646 break;
1488 case KVM_REG_PPC_DAC2: 1647 case KVM_REG_PPC_DAC2:
1489 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac2); 1648 *val = get_reg_val(id, vcpu->arch.dbg_reg.dac2);
1490 break; 1649 break;
1491 case KVM_REG_PPC_EPR: { 1650 case KVM_REG_PPC_EPR: {
1492 u32 epr = kvmppc_get_epr(vcpu); 1651 u32 epr = kvmppc_get_epr(vcpu);
1493 val = get_reg_val(reg->id, epr); 1652 *val = get_reg_val(id, epr);
1494 break; 1653 break;
1495 } 1654 }
1496#if defined(CONFIG_64BIT) 1655#if defined(CONFIG_64BIT)
1497 case KVM_REG_PPC_EPCR: 1656 case KVM_REG_PPC_EPCR:
1498 val = get_reg_val(reg->id, vcpu->arch.epcr); 1657 *val = get_reg_val(id, vcpu->arch.epcr);
1499 break; 1658 break;
1500#endif 1659#endif
1501 case KVM_REG_PPC_TCR: 1660 case KVM_REG_PPC_TCR:
1502 val = get_reg_val(reg->id, vcpu->arch.tcr); 1661 *val = get_reg_val(id, vcpu->arch.tcr);
1503 break; 1662 break;
1504 case KVM_REG_PPC_TSR: 1663 case KVM_REG_PPC_TSR:
1505 val = get_reg_val(reg->id, vcpu->arch.tsr); 1664 *val = get_reg_val(id, vcpu->arch.tsr);
1506 break; 1665 break;
1507 case KVM_REG_PPC_DEBUG_INST: 1666 case KVM_REG_PPC_DEBUG_INST:
1508 val = get_reg_val(reg->id, KVMPPC_INST_EHPRIV_DEBUG); 1667 *val = get_reg_val(id, KVMPPC_INST_SW_BREAKPOINT);
1509 break; 1668 break;
1510 case KVM_REG_PPC_VRSAVE: 1669 case KVM_REG_PPC_VRSAVE:
1511 val = get_reg_val(reg->id, vcpu->arch.vrsave); 1670 *val = get_reg_val(id, vcpu->arch.vrsave);
1512 break; 1671 break;
1513 default: 1672 default:
1514 r = vcpu->kvm->arch.kvm_ops->get_one_reg(vcpu, reg->id, &val); 1673 r = vcpu->kvm->arch.kvm_ops->get_one_reg(vcpu, id, val);
1515 break; 1674 break;
1516 } 1675 }
1517 1676
1518 if (r)
1519 return r;
1520
1521 if (copy_to_user((char __user *)(unsigned long)reg->addr, &val, size))
1522 r = -EFAULT;
1523
1524 return r; 1677 return r;
1525} 1678}
1526 1679
1527int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 1680int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id,
1681 union kvmppc_one_reg *val)
1528{ 1682{
1529 int r = 0; 1683 int r = 0;
1530 union kvmppc_one_reg val;
1531 int size;
1532 1684
1533 size = one_reg_size(reg->id); 1685 switch (id) {
1534 if (size > sizeof(val))
1535 return -EINVAL;
1536
1537 if (copy_from_user(&val, (char __user *)(unsigned long)reg->addr, size))
1538 return -EFAULT;
1539
1540 switch (reg->id) {
1541 case KVM_REG_PPC_IAC1: 1686 case KVM_REG_PPC_IAC1:
1542 vcpu->arch.dbg_reg.iac1 = set_reg_val(reg->id, val); 1687 vcpu->arch.dbg_reg.iac1 = set_reg_val(id, *val);
1543 break; 1688 break;
1544 case KVM_REG_PPC_IAC2: 1689 case KVM_REG_PPC_IAC2:
1545 vcpu->arch.dbg_reg.iac2 = set_reg_val(reg->id, val); 1690 vcpu->arch.dbg_reg.iac2 = set_reg_val(id, *val);
1546 break; 1691 break;
1547#if CONFIG_PPC_ADV_DEBUG_IACS > 2 1692#if CONFIG_PPC_ADV_DEBUG_IACS > 2
1548 case KVM_REG_PPC_IAC3: 1693 case KVM_REG_PPC_IAC3:
1549 vcpu->arch.dbg_reg.iac3 = set_reg_val(reg->id, val); 1694 vcpu->arch.dbg_reg.iac3 = set_reg_val(id, *val);
1550 break; 1695 break;
1551 case KVM_REG_PPC_IAC4: 1696 case KVM_REG_PPC_IAC4:
1552 vcpu->arch.dbg_reg.iac4 = set_reg_val(reg->id, val); 1697 vcpu->arch.dbg_reg.iac4 = set_reg_val(id, *val);
1553 break; 1698 break;
1554#endif 1699#endif
1555 case KVM_REG_PPC_DAC1: 1700 case KVM_REG_PPC_DAC1:
1556 vcpu->arch.dbg_reg.dac1 = set_reg_val(reg->id, val); 1701 vcpu->arch.dbg_reg.dac1 = set_reg_val(id, *val);
1557 break; 1702 break;
1558 case KVM_REG_PPC_DAC2: 1703 case KVM_REG_PPC_DAC2:
1559 vcpu->arch.dbg_reg.dac2 = set_reg_val(reg->id, val); 1704 vcpu->arch.dbg_reg.dac2 = set_reg_val(id, *val);
1560 break; 1705 break;
1561 case KVM_REG_PPC_EPR: { 1706 case KVM_REG_PPC_EPR: {
1562 u32 new_epr = set_reg_val(reg->id, val); 1707 u32 new_epr = set_reg_val(id, *val);
1563 kvmppc_set_epr(vcpu, new_epr); 1708 kvmppc_set_epr(vcpu, new_epr);
1564 break; 1709 break;
1565 } 1710 }
1566#if defined(CONFIG_64BIT) 1711#if defined(CONFIG_64BIT)
1567 case KVM_REG_PPC_EPCR: { 1712 case KVM_REG_PPC_EPCR: {
1568 u32 new_epcr = set_reg_val(reg->id, val); 1713 u32 new_epcr = set_reg_val(id, *val);
1569 kvmppc_set_epcr(vcpu, new_epcr); 1714 kvmppc_set_epcr(vcpu, new_epcr);
1570 break; 1715 break;
1571 } 1716 }
1572#endif 1717#endif
1573 case KVM_REG_PPC_OR_TSR: { 1718 case KVM_REG_PPC_OR_TSR: {
1574 u32 tsr_bits = set_reg_val(reg->id, val); 1719 u32 tsr_bits = set_reg_val(id, *val);
1575 kvmppc_set_tsr_bits(vcpu, tsr_bits); 1720 kvmppc_set_tsr_bits(vcpu, tsr_bits);
1576 break; 1721 break;
1577 } 1722 }
1578 case KVM_REG_PPC_CLEAR_TSR: { 1723 case KVM_REG_PPC_CLEAR_TSR: {
1579 u32 tsr_bits = set_reg_val(reg->id, val); 1724 u32 tsr_bits = set_reg_val(id, *val);
1580 kvmppc_clr_tsr_bits(vcpu, tsr_bits); 1725 kvmppc_clr_tsr_bits(vcpu, tsr_bits);
1581 break; 1726 break;
1582 } 1727 }
1583 case KVM_REG_PPC_TSR: { 1728 case KVM_REG_PPC_TSR: {
1584 u32 tsr = set_reg_val(reg->id, val); 1729 u32 tsr = set_reg_val(id, *val);
1585 kvmppc_set_tsr(vcpu, tsr); 1730 kvmppc_set_tsr(vcpu, tsr);
1586 break; 1731 break;
1587 } 1732 }
1588 case KVM_REG_PPC_TCR: { 1733 case KVM_REG_PPC_TCR: {
1589 u32 tcr = set_reg_val(reg->id, val); 1734 u32 tcr = set_reg_val(id, *val);
1590 kvmppc_set_tcr(vcpu, tcr); 1735 kvmppc_set_tcr(vcpu, tcr);
1591 break; 1736 break;
1592 } 1737 }
1593 case KVM_REG_PPC_VRSAVE: 1738 case KVM_REG_PPC_VRSAVE:
1594 vcpu->arch.vrsave = set_reg_val(reg->id, val); 1739 vcpu->arch.vrsave = set_reg_val(id, *val);
1595 break; 1740 break;
1596 default: 1741 default:
1597 r = vcpu->kvm->arch.kvm_ops->set_one_reg(vcpu, reg->id, &val); 1742 r = vcpu->kvm->arch.kvm_ops->set_one_reg(vcpu, id, val);
1598 break; 1743 break;
1599 } 1744 }
1600 1745
@@ -1694,10 +1839,8 @@ void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits)
1694 update_timer_ints(vcpu); 1839 update_timer_ints(vcpu);
1695} 1840}
1696 1841
1697void kvmppc_decrementer_func(unsigned long data) 1842void kvmppc_decrementer_func(struct kvm_vcpu *vcpu)
1698{ 1843{
1699 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
1700
1701 if (vcpu->arch.tcr & TCR_ARE) { 1844 if (vcpu->arch.tcr & TCR_ARE) {
1702 vcpu->arch.dec = vcpu->arch.decar; 1845 vcpu->arch.dec = vcpu->arch.decar;
1703 kvmppc_emulate_dec(vcpu); 1846 kvmppc_emulate_dec(vcpu);
@@ -1842,7 +1985,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
1842 int n, b = 0, w = 0; 1985 int n, b = 0, w = 0;
1843 1986
1844 if (!(dbg->control & KVM_GUESTDBG_ENABLE)) { 1987 if (!(dbg->control & KVM_GUESTDBG_ENABLE)) {
1845 vcpu->arch.shadow_dbg_reg.dbcr0 = 0; 1988 vcpu->arch.dbg_reg.dbcr0 = 0;
1846 vcpu->guest_debug = 0; 1989 vcpu->guest_debug = 0;
1847 kvm_guest_protect_msr(vcpu, MSR_DE, false); 1990 kvm_guest_protect_msr(vcpu, MSR_DE, false);
1848 return 0; 1991 return 0;
@@ -1850,15 +1993,13 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
1850 1993
1851 kvm_guest_protect_msr(vcpu, MSR_DE, true); 1994 kvm_guest_protect_msr(vcpu, MSR_DE, true);
1852 vcpu->guest_debug = dbg->control; 1995 vcpu->guest_debug = dbg->control;
1853 vcpu->arch.shadow_dbg_reg.dbcr0 = 0; 1996 vcpu->arch.dbg_reg.dbcr0 = 0;
1854 /* Set DBCR0_EDM in guest visible DBCR0 register. */
1855 vcpu->arch.dbg_reg.dbcr0 = DBCR0_EDM;
1856 1997
1857 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) 1998 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
1858 vcpu->arch.shadow_dbg_reg.dbcr0 |= DBCR0_IDM | DBCR0_IC; 1999 vcpu->arch.dbg_reg.dbcr0 |= DBCR0_IDM | DBCR0_IC;
1859 2000
1860 /* Code below handles only HW breakpoints */ 2001 /* Code below handles only HW breakpoints */
1861 dbg_reg = &(vcpu->arch.shadow_dbg_reg); 2002 dbg_reg = &(vcpu->arch.dbg_reg);
1862 2003
1863#ifdef CONFIG_KVM_BOOKE_HV 2004#ifdef CONFIG_KVM_BOOKE_HV
1864 /* 2005 /*
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index f753543c56fa..22ba08ea68e9 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -32,9 +32,15 @@
32#define BOOKE_IRQPRIO_ALIGNMENT 2 32#define BOOKE_IRQPRIO_ALIGNMENT 2
33#define BOOKE_IRQPRIO_PROGRAM 3 33#define BOOKE_IRQPRIO_PROGRAM 3
34#define BOOKE_IRQPRIO_FP_UNAVAIL 4 34#define BOOKE_IRQPRIO_FP_UNAVAIL 4
35#ifdef CONFIG_SPE_POSSIBLE
35#define BOOKE_IRQPRIO_SPE_UNAVAIL 5 36#define BOOKE_IRQPRIO_SPE_UNAVAIL 5
36#define BOOKE_IRQPRIO_SPE_FP_DATA 6 37#define BOOKE_IRQPRIO_SPE_FP_DATA 6
37#define BOOKE_IRQPRIO_SPE_FP_ROUND 7 38#define BOOKE_IRQPRIO_SPE_FP_ROUND 7
39#endif
40#ifdef CONFIG_PPC_E500MC
41#define BOOKE_IRQPRIO_ALTIVEC_UNAVAIL 5
42#define BOOKE_IRQPRIO_ALTIVEC_ASSIST 6
43#endif
38#define BOOKE_IRQPRIO_SYSCALL 8 44#define BOOKE_IRQPRIO_SYSCALL 8
39#define BOOKE_IRQPRIO_AP_UNAVAIL 9 45#define BOOKE_IRQPRIO_AP_UNAVAIL 9
40#define BOOKE_IRQPRIO_DTLB_MISS 10 46#define BOOKE_IRQPRIO_DTLB_MISS 10
@@ -116,40 +122,6 @@ extern int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn,
116extern int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, 122extern int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn,
117 ulong *spr_val); 123 ulong *spr_val);
118 124
119/*
120 * Load up guest vcpu FP state if it's needed.
121 * It also set the MSR_FP in thread so that host know
122 * we're holding FPU, and then host can help to save
123 * guest vcpu FP state if other threads require to use FPU.
124 * This simulates an FP unavailable fault.
125 *
126 * It requires to be called with preemption disabled.
127 */
128static inline void kvmppc_load_guest_fp(struct kvm_vcpu *vcpu)
129{
130#ifdef CONFIG_PPC_FPU
131 if (vcpu->fpu_active && !(current->thread.regs->msr & MSR_FP)) {
132 enable_kernel_fp();
133 load_fp_state(&vcpu->arch.fp);
134 current->thread.fp_save_area = &vcpu->arch.fp;
135 current->thread.regs->msr |= MSR_FP;
136 }
137#endif
138}
139
140/*
141 * Save guest vcpu FP state into thread.
142 * It requires to be called with preemption disabled.
143 */
144static inline void kvmppc_save_guest_fp(struct kvm_vcpu *vcpu)
145{
146#ifdef CONFIG_PPC_FPU
147 if (vcpu->fpu_active && (current->thread.regs->msr & MSR_FP))
148 giveup_fpu(current);
149 current->thread.fp_save_area = NULL;
150#endif
151}
152
153static inline void kvmppc_clear_dbsr(void) 125static inline void kvmppc_clear_dbsr(void)
154{ 126{
155 mtspr(SPRN_DBSR, mfspr(SPRN_DBSR)); 127 mtspr(SPRN_DBSR, mfspr(SPRN_DBSR));
diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c
index 28c158881d23..a82f64502de1 100644
--- a/arch/powerpc/kvm/booke_emulate.c
+++ b/arch/powerpc/kvm/booke_emulate.c
@@ -25,6 +25,7 @@
25 25
26#define OP_19_XOP_RFI 50 26#define OP_19_XOP_RFI 50
27#define OP_19_XOP_RFCI 51 27#define OP_19_XOP_RFCI 51
28#define OP_19_XOP_RFDI 39
28 29
29#define OP_31_XOP_MFMSR 83 30#define OP_31_XOP_MFMSR 83
30#define OP_31_XOP_WRTEE 131 31#define OP_31_XOP_WRTEE 131
@@ -37,6 +38,12 @@ static void kvmppc_emul_rfi(struct kvm_vcpu *vcpu)
37 kvmppc_set_msr(vcpu, vcpu->arch.shared->srr1); 38 kvmppc_set_msr(vcpu, vcpu->arch.shared->srr1);
38} 39}
39 40
41static void kvmppc_emul_rfdi(struct kvm_vcpu *vcpu)
42{
43 vcpu->arch.pc = vcpu->arch.dsrr0;
44 kvmppc_set_msr(vcpu, vcpu->arch.dsrr1);
45}
46
40static void kvmppc_emul_rfci(struct kvm_vcpu *vcpu) 47static void kvmppc_emul_rfci(struct kvm_vcpu *vcpu)
41{ 48{
42 vcpu->arch.pc = vcpu->arch.csrr0; 49 vcpu->arch.pc = vcpu->arch.csrr0;
@@ -65,6 +72,12 @@ int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
65 *advance = 0; 72 *advance = 0;
66 break; 73 break;
67 74
75 case OP_19_XOP_RFDI:
76 kvmppc_emul_rfdi(vcpu);
77 kvmppc_set_exit_type(vcpu, EMULATED_RFDI_EXITS);
78 *advance = 0;
79 break;
80
68 default: 81 default:
69 emulated = EMULATE_FAIL; 82 emulated = EMULATE_FAIL;
70 break; 83 break;
@@ -118,6 +131,7 @@ int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
118int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) 131int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
119{ 132{
120 int emulated = EMULATE_DONE; 133 int emulated = EMULATE_DONE;
134 bool debug_inst = false;
121 135
122 switch (sprn) { 136 switch (sprn) {
123 case SPRN_DEAR: 137 case SPRN_DEAR:
@@ -132,14 +146,128 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
132 case SPRN_CSRR1: 146 case SPRN_CSRR1:
133 vcpu->arch.csrr1 = spr_val; 147 vcpu->arch.csrr1 = spr_val;
134 break; 148 break;
149 case SPRN_DSRR0:
150 vcpu->arch.dsrr0 = spr_val;
151 break;
152 case SPRN_DSRR1:
153 vcpu->arch.dsrr1 = spr_val;
154 break;
155 case SPRN_IAC1:
156 /*
157 * If userspace is debugging guest then guest
158 * can not access debug registers.
159 */
160 if (vcpu->guest_debug)
161 break;
162
163 debug_inst = true;
164 vcpu->arch.dbg_reg.iac1 = spr_val;
165 break;
166 case SPRN_IAC2:
167 /*
168 * If userspace is debugging guest then guest
169 * can not access debug registers.
170 */
171 if (vcpu->guest_debug)
172 break;
173
174 debug_inst = true;
175 vcpu->arch.dbg_reg.iac2 = spr_val;
176 break;
177#if CONFIG_PPC_ADV_DEBUG_IACS > 2
178 case SPRN_IAC3:
179 /*
180 * If userspace is debugging guest then guest
181 * can not access debug registers.
182 */
183 if (vcpu->guest_debug)
184 break;
185
186 debug_inst = true;
187 vcpu->arch.dbg_reg.iac3 = spr_val;
188 break;
189 case SPRN_IAC4:
190 /*
191 * If userspace is debugging guest then guest
192 * can not access debug registers.
193 */
194 if (vcpu->guest_debug)
195 break;
196
197 debug_inst = true;
198 vcpu->arch.dbg_reg.iac4 = spr_val;
199 break;
200#endif
201 case SPRN_DAC1:
202 /*
203 * If userspace is debugging guest then guest
204 * can not access debug registers.
205 */
206 if (vcpu->guest_debug)
207 break;
208
209 debug_inst = true;
210 vcpu->arch.dbg_reg.dac1 = spr_val;
211 break;
212 case SPRN_DAC2:
213 /*
214 * If userspace is debugging guest then guest
215 * can not access debug registers.
216 */
217 if (vcpu->guest_debug)
218 break;
219
220 debug_inst = true;
221 vcpu->arch.dbg_reg.dac2 = spr_val;
222 break;
135 case SPRN_DBCR0: 223 case SPRN_DBCR0:
224 /*
225 * If userspace is debugging guest then guest
226 * can not access debug registers.
227 */
228 if (vcpu->guest_debug)
229 break;
230
231 debug_inst = true;
232 spr_val &= (DBCR0_IDM | DBCR0_IC | DBCR0_BT | DBCR0_TIE |
233 DBCR0_IAC1 | DBCR0_IAC2 | DBCR0_IAC3 | DBCR0_IAC4 |
234 DBCR0_DAC1R | DBCR0_DAC1W | DBCR0_DAC2R | DBCR0_DAC2W);
235
136 vcpu->arch.dbg_reg.dbcr0 = spr_val; 236 vcpu->arch.dbg_reg.dbcr0 = spr_val;
137 break; 237 break;
138 case SPRN_DBCR1: 238 case SPRN_DBCR1:
239 /*
240 * If userspace is debugging guest then guest
241 * can not access debug registers.
242 */
243 if (vcpu->guest_debug)
244 break;
245
246 debug_inst = true;
139 vcpu->arch.dbg_reg.dbcr1 = spr_val; 247 vcpu->arch.dbg_reg.dbcr1 = spr_val;
140 break; 248 break;
249 case SPRN_DBCR2:
250 /*
251 * If userspace is debugging guest then guest
252 * can not access debug registers.
253 */
254 if (vcpu->guest_debug)
255 break;
256
257 debug_inst = true;
258 vcpu->arch.dbg_reg.dbcr2 = spr_val;
259 break;
141 case SPRN_DBSR: 260 case SPRN_DBSR:
261 /*
262 * If userspace is debugging guest then guest
263 * can not access debug registers.
264 */
265 if (vcpu->guest_debug)
266 break;
267
142 vcpu->arch.dbsr &= ~spr_val; 268 vcpu->arch.dbsr &= ~spr_val;
269 if (!(vcpu->arch.dbsr & ~DBSR_IDE))
270 kvmppc_core_dequeue_debug(vcpu);
143 break; 271 break;
144 case SPRN_TSR: 272 case SPRN_TSR:
145 kvmppc_clr_tsr_bits(vcpu, spr_val); 273 kvmppc_clr_tsr_bits(vcpu, spr_val);
@@ -252,6 +380,10 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
252 emulated = EMULATE_FAIL; 380 emulated = EMULATE_FAIL;
253 } 381 }
254 382
383 if (debug_inst) {
384 current->thread.debug = vcpu->arch.dbg_reg;
385 switch_booke_debug_regs(&vcpu->arch.dbg_reg);
386 }
255 return emulated; 387 return emulated;
256} 388}
257 389
@@ -278,12 +410,43 @@ int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
278 case SPRN_CSRR1: 410 case SPRN_CSRR1:
279 *spr_val = vcpu->arch.csrr1; 411 *spr_val = vcpu->arch.csrr1;
280 break; 412 break;
413 case SPRN_DSRR0:
414 *spr_val = vcpu->arch.dsrr0;
415 break;
416 case SPRN_DSRR1:
417 *spr_val = vcpu->arch.dsrr1;
418 break;
419 case SPRN_IAC1:
420 *spr_val = vcpu->arch.dbg_reg.iac1;
421 break;
422 case SPRN_IAC2:
423 *spr_val = vcpu->arch.dbg_reg.iac2;
424 break;
425#if CONFIG_PPC_ADV_DEBUG_IACS > 2
426 case SPRN_IAC3:
427 *spr_val = vcpu->arch.dbg_reg.iac3;
428 break;
429 case SPRN_IAC4:
430 *spr_val = vcpu->arch.dbg_reg.iac4;
431 break;
432#endif
433 case SPRN_DAC1:
434 *spr_val = vcpu->arch.dbg_reg.dac1;
435 break;
436 case SPRN_DAC2:
437 *spr_val = vcpu->arch.dbg_reg.dac2;
438 break;
281 case SPRN_DBCR0: 439 case SPRN_DBCR0:
282 *spr_val = vcpu->arch.dbg_reg.dbcr0; 440 *spr_val = vcpu->arch.dbg_reg.dbcr0;
441 if (vcpu->guest_debug)
442 *spr_val = *spr_val | DBCR0_EDM;
283 break; 443 break;
284 case SPRN_DBCR1: 444 case SPRN_DBCR1:
285 *spr_val = vcpu->arch.dbg_reg.dbcr1; 445 *spr_val = vcpu->arch.dbg_reg.dbcr1;
286 break; 446 break;
447 case SPRN_DBCR2:
448 *spr_val = vcpu->arch.dbg_reg.dbcr2;
449 break;
287 case SPRN_DBSR: 450 case SPRN_DBSR:
288 *spr_val = vcpu->arch.dbsr; 451 *spr_val = vcpu->arch.dbsr;
289 break; 452 break;
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index e9fa56a911fd..81bd8a07aa51 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -238,7 +238,7 @@ kvm_handler BOOKE_INTERRUPT_EXTERNAL, EX_PARAMS(GEN), \
238kvm_handler BOOKE_INTERRUPT_ALIGNMENT, EX_PARAMS(GEN), \ 238kvm_handler BOOKE_INTERRUPT_ALIGNMENT, EX_PARAMS(GEN), \
239 SPRN_SRR0, SPRN_SRR1,(NEED_DEAR | NEED_ESR) 239 SPRN_SRR0, SPRN_SRR1,(NEED_DEAR | NEED_ESR)
240kvm_handler BOOKE_INTERRUPT_PROGRAM, EX_PARAMS(GEN), \ 240kvm_handler BOOKE_INTERRUPT_PROGRAM, EX_PARAMS(GEN), \
241 SPRN_SRR0, SPRN_SRR1,NEED_ESR 241 SPRN_SRR0, SPRN_SRR1, (NEED_ESR | NEED_EMU)
242kvm_handler BOOKE_INTERRUPT_FP_UNAVAIL, EX_PARAMS(GEN), \ 242kvm_handler BOOKE_INTERRUPT_FP_UNAVAIL, EX_PARAMS(GEN), \
243 SPRN_SRR0, SPRN_SRR1, 0 243 SPRN_SRR0, SPRN_SRR1, 0
244kvm_handler BOOKE_INTERRUPT_AP_UNAVAIL, EX_PARAMS(GEN), \ 244kvm_handler BOOKE_INTERRUPT_AP_UNAVAIL, EX_PARAMS(GEN), \
@@ -256,11 +256,9 @@ kvm_handler BOOKE_INTERRUPT_DTLB_MISS, EX_PARAMS_TLB, \
256 SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR) 256 SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
257kvm_handler BOOKE_INTERRUPT_ITLB_MISS, EX_PARAMS_TLB, \ 257kvm_handler BOOKE_INTERRUPT_ITLB_MISS, EX_PARAMS_TLB, \
258 SPRN_SRR0, SPRN_SRR1, 0 258 SPRN_SRR0, SPRN_SRR1, 0
259kvm_handler BOOKE_INTERRUPT_SPE_UNAVAIL, EX_PARAMS(GEN), \ 259kvm_handler BOOKE_INTERRUPT_ALTIVEC_UNAVAIL, EX_PARAMS(GEN), \
260 SPRN_SRR0, SPRN_SRR1, 0 260 SPRN_SRR0, SPRN_SRR1, 0
261kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA, EX_PARAMS(GEN), \ 261kvm_handler BOOKE_INTERRUPT_ALTIVEC_ASSIST, EX_PARAMS(GEN), \
262 SPRN_SRR0, SPRN_SRR1, 0
263kvm_handler BOOKE_INTERRUPT_SPE_FP_ROUND, EX_PARAMS(GEN), \
264 SPRN_SRR0, SPRN_SRR1, 0 262 SPRN_SRR0, SPRN_SRR1, 0
265kvm_handler BOOKE_INTERRUPT_PERFORMANCE_MONITOR, EX_PARAMS(GEN), \ 263kvm_handler BOOKE_INTERRUPT_PERFORMANCE_MONITOR, EX_PARAMS(GEN), \
266 SPRN_SRR0, SPRN_SRR1, 0 264 SPRN_SRR0, SPRN_SRR1, 0
@@ -350,7 +348,7 @@ kvm_handler BOOKE_INTERRUPT_INST_STORAGE, SPRN_SRR0, SPRN_SRR1, NEED_ESR
350kvm_handler BOOKE_INTERRUPT_EXTERNAL, SPRN_SRR0, SPRN_SRR1, 0 348kvm_handler BOOKE_INTERRUPT_EXTERNAL, SPRN_SRR0, SPRN_SRR1, 0
351kvm_handler BOOKE_INTERRUPT_ALIGNMENT, \ 349kvm_handler BOOKE_INTERRUPT_ALIGNMENT, \
352 SPRN_SRR0, SPRN_SRR1, (NEED_DEAR | NEED_ESR) 350 SPRN_SRR0, SPRN_SRR1, (NEED_DEAR | NEED_ESR)
353kvm_handler BOOKE_INTERRUPT_PROGRAM, SPRN_SRR0, SPRN_SRR1, NEED_ESR 351kvm_handler BOOKE_INTERRUPT_PROGRAM, SPRN_SRR0, SPRN_SRR1, (NEED_ESR | NEED_EMU)
354kvm_handler BOOKE_INTERRUPT_FP_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0 352kvm_handler BOOKE_INTERRUPT_FP_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0
355kvm_handler BOOKE_INTERRUPT_SYSCALL, SPRN_SRR0, SPRN_SRR1, 0 353kvm_handler BOOKE_INTERRUPT_SYSCALL, SPRN_SRR0, SPRN_SRR1, 0
356kvm_handler BOOKE_INTERRUPT_AP_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0 354kvm_handler BOOKE_INTERRUPT_AP_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0
@@ -361,9 +359,6 @@ kvm_lvl_handler BOOKE_INTERRUPT_WATCHDOG, \
361kvm_handler BOOKE_INTERRUPT_DTLB_MISS, \ 359kvm_handler BOOKE_INTERRUPT_DTLB_MISS, \
362 SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR) 360 SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
363kvm_handler BOOKE_INTERRUPT_ITLB_MISS, SPRN_SRR0, SPRN_SRR1, 0 361kvm_handler BOOKE_INTERRUPT_ITLB_MISS, SPRN_SRR0, SPRN_SRR1, 0
364kvm_handler BOOKE_INTERRUPT_SPE_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0
365kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA, SPRN_SRR0, SPRN_SRR1, 0
366kvm_handler BOOKE_INTERRUPT_SPE_FP_ROUND, SPRN_SRR0, SPRN_SRR1, 0
367kvm_handler BOOKE_INTERRUPT_PERFORMANCE_MONITOR, SPRN_SRR0, SPRN_SRR1, 0 362kvm_handler BOOKE_INTERRUPT_PERFORMANCE_MONITOR, SPRN_SRR0, SPRN_SRR1, 0
368kvm_handler BOOKE_INTERRUPT_DOORBELL, SPRN_SRR0, SPRN_SRR1, 0 363kvm_handler BOOKE_INTERRUPT_DOORBELL, SPRN_SRR0, SPRN_SRR1, 0
369kvm_lvl_handler BOOKE_INTERRUPT_DOORBELL_CRITICAL, \ 364kvm_lvl_handler BOOKE_INTERRUPT_DOORBELL_CRITICAL, \
diff --git a/arch/powerpc/kvm/e500.h b/arch/powerpc/kvm/e500.h
index a326178bdea5..72920bed3ac6 100644
--- a/arch/powerpc/kvm/e500.h
+++ b/arch/powerpc/kvm/e500.h
@@ -22,6 +22,7 @@
22#include <linux/kvm_host.h> 22#include <linux/kvm_host.h>
23#include <asm/mmu-book3e.h> 23#include <asm/mmu-book3e.h>
24#include <asm/tlb.h> 24#include <asm/tlb.h>
25#include <asm/cputhreads.h>
25 26
26enum vcpu_ftr { 27enum vcpu_ftr {
27 VCPU_FTR_MMU_V2 28 VCPU_FTR_MMU_V2
@@ -289,6 +290,25 @@ void kvmppc_e500_tlbil_all(struct kvmppc_vcpu_e500 *vcpu_e500);
289#define kvmppc_e500_get_tlb_stid(vcpu, gtlbe) get_tlb_tid(gtlbe) 290#define kvmppc_e500_get_tlb_stid(vcpu, gtlbe) get_tlb_tid(gtlbe)
290#define get_tlbmiss_tid(vcpu) get_cur_pid(vcpu) 291#define get_tlbmiss_tid(vcpu) get_cur_pid(vcpu)
291#define get_tlb_sts(gtlbe) (gtlbe->mas1 & MAS1_TS) 292#define get_tlb_sts(gtlbe) (gtlbe->mas1 & MAS1_TS)
293
294/*
295 * These functions should be called with preemption disabled
296 * and the returned value is valid only in that context
297 */
298static inline int get_thread_specific_lpid(int vm_lpid)
299{
300 int vcpu_lpid = vm_lpid;
301
302 if (threads_per_core == 2)
303 vcpu_lpid |= smp_processor_id() & 1;
304
305 return vcpu_lpid;
306}
307
308static inline int get_lpid(struct kvm_vcpu *vcpu)
309{
310 return get_thread_specific_lpid(vcpu->kvm->arch.lpid);
311}
292#else 312#else
293unsigned int kvmppc_e500_get_tlb_stid(struct kvm_vcpu *vcpu, 313unsigned int kvmppc_e500_get_tlb_stid(struct kvm_vcpu *vcpu,
294 struct kvm_book3e_206_tlb_entry *gtlbe); 314 struct kvm_book3e_206_tlb_entry *gtlbe);
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index c99c40e9182a..ce7291c79f6c 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -259,6 +259,7 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
259 break; 259 break;
260 260
261 /* extra exceptions */ 261 /* extra exceptions */
262#ifdef CONFIG_SPE_POSSIBLE
262 case SPRN_IVOR32: 263 case SPRN_IVOR32:
263 vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val; 264 vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val;
264 break; 265 break;
@@ -268,6 +269,15 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
268 case SPRN_IVOR34: 269 case SPRN_IVOR34:
269 vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_ROUND] = spr_val; 270 vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_ROUND] = spr_val;
270 break; 271 break;
272#endif
273#ifdef CONFIG_ALTIVEC
274 case SPRN_IVOR32:
275 vcpu->arch.ivor[BOOKE_IRQPRIO_ALTIVEC_UNAVAIL] = spr_val;
276 break;
277 case SPRN_IVOR33:
278 vcpu->arch.ivor[BOOKE_IRQPRIO_ALTIVEC_ASSIST] = spr_val;
279 break;
280#endif
271 case SPRN_IVOR35: 281 case SPRN_IVOR35:
272 vcpu->arch.ivor[BOOKE_IRQPRIO_PERFORMANCE_MONITOR] = spr_val; 282 vcpu->arch.ivor[BOOKE_IRQPRIO_PERFORMANCE_MONITOR] = spr_val;
273 break; 283 break;
@@ -381,6 +391,7 @@ int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong *spr_v
381 break; 391 break;
382 392
383 /* extra exceptions */ 393 /* extra exceptions */
394#ifdef CONFIG_SPE_POSSIBLE
384 case SPRN_IVOR32: 395 case SPRN_IVOR32:
385 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL]; 396 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL];
386 break; 397 break;
@@ -390,6 +401,15 @@ int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong *spr_v
390 case SPRN_IVOR34: 401 case SPRN_IVOR34:
391 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_ROUND]; 402 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_ROUND];
392 break; 403 break;
404#endif
405#ifdef CONFIG_ALTIVEC
406 case SPRN_IVOR32:
407 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_ALTIVEC_UNAVAIL];
408 break;
409 case SPRN_IVOR33:
410 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_ALTIVEC_ASSIST];
411 break;
412#endif
393 case SPRN_IVOR35: 413 case SPRN_IVOR35:
394 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_PERFORMANCE_MONITOR]; 414 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_PERFORMANCE_MONITOR];
395 break; 415 break;
diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 08f14bb57897..769778f855b0 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -69,7 +69,8 @@ static inline u32 e500_shadow_mas3_attrib(u32 mas3, int usermode)
69 * writing shadow tlb entry to host TLB 69 * writing shadow tlb entry to host TLB
70 */ 70 */
71static inline void __write_host_tlbe(struct kvm_book3e_206_tlb_entry *stlbe, 71static inline void __write_host_tlbe(struct kvm_book3e_206_tlb_entry *stlbe,
72 uint32_t mas0) 72 uint32_t mas0,
73 uint32_t lpid)
73{ 74{
74 unsigned long flags; 75 unsigned long flags;
75 76
@@ -80,7 +81,7 @@ static inline void __write_host_tlbe(struct kvm_book3e_206_tlb_entry *stlbe,
80 mtspr(SPRN_MAS3, (u32)stlbe->mas7_3); 81 mtspr(SPRN_MAS3, (u32)stlbe->mas7_3);
81 mtspr(SPRN_MAS7, (u32)(stlbe->mas7_3 >> 32)); 82 mtspr(SPRN_MAS7, (u32)(stlbe->mas7_3 >> 32));
82#ifdef CONFIG_KVM_BOOKE_HV 83#ifdef CONFIG_KVM_BOOKE_HV
83 mtspr(SPRN_MAS8, stlbe->mas8); 84 mtspr(SPRN_MAS8, MAS8_TGS | get_thread_specific_lpid(lpid));
84#endif 85#endif
85 asm volatile("isync; tlbwe" : : : "memory"); 86 asm volatile("isync; tlbwe" : : : "memory");
86 87
@@ -129,11 +130,12 @@ static inline void write_host_tlbe(struct kvmppc_vcpu_e500 *vcpu_e500,
129 130
130 if (tlbsel == 0) { 131 if (tlbsel == 0) {
131 mas0 = get_host_mas0(stlbe->mas2); 132 mas0 = get_host_mas0(stlbe->mas2);
132 __write_host_tlbe(stlbe, mas0); 133 __write_host_tlbe(stlbe, mas0, vcpu_e500->vcpu.kvm->arch.lpid);
133 } else { 134 } else {
134 __write_host_tlbe(stlbe, 135 __write_host_tlbe(stlbe,
135 MAS0_TLBSEL(1) | 136 MAS0_TLBSEL(1) |
136 MAS0_ESEL(to_htlb1_esel(sesel))); 137 MAS0_ESEL(to_htlb1_esel(sesel)),
138 vcpu_e500->vcpu.kvm->arch.lpid);
137 } 139 }
138} 140}
139 141
@@ -176,7 +178,7 @@ void kvmppc_map_magic(struct kvm_vcpu *vcpu)
176 MAS3_SW | MAS3_SR | MAS3_UW | MAS3_UR; 178 MAS3_SW | MAS3_SR | MAS3_UW | MAS3_UR;
177 magic.mas8 = 0; 179 magic.mas8 = 0;
178 180
179 __write_host_tlbe(&magic, MAS0_TLBSEL(1) | MAS0_ESEL(tlbcam_index)); 181 __write_host_tlbe(&magic, MAS0_TLBSEL(1) | MAS0_ESEL(tlbcam_index), 0);
180 preempt_enable(); 182 preempt_enable();
181} 183}
182#endif 184#endif
@@ -317,10 +319,6 @@ static void kvmppc_e500_setup_stlbe(
317 stlbe->mas2 = (gvaddr & MAS2_EPN) | (ref->flags & E500_TLB_MAS2_ATTR); 319 stlbe->mas2 = (gvaddr & MAS2_EPN) | (ref->flags & E500_TLB_MAS2_ATTR);
318 stlbe->mas7_3 = ((u64)pfn << PAGE_SHIFT) | 320 stlbe->mas7_3 = ((u64)pfn << PAGE_SHIFT) |
319 e500_shadow_mas3_attrib(gtlbe->mas7_3, pr); 321 e500_shadow_mas3_attrib(gtlbe->mas7_3, pr);
320
321#ifdef CONFIG_KVM_BOOKE_HV
322 stlbe->mas8 = MAS8_TGS | vcpu->kvm->arch.lpid;
323#endif
324} 322}
325 323
326static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, 324static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
@@ -633,7 +631,7 @@ int kvmppc_load_last_inst(struct kvm_vcpu *vcpu, enum instruction_type type,
633 631
634 local_irq_save(flags); 632 local_irq_save(flags);
635 mtspr(SPRN_MAS6, (vcpu->arch.pid << MAS6_SPID_SHIFT) | addr_space); 633 mtspr(SPRN_MAS6, (vcpu->arch.pid << MAS6_SPID_SHIFT) | addr_space);
636 mtspr(SPRN_MAS5, MAS5_SGS | vcpu->kvm->arch.lpid); 634 mtspr(SPRN_MAS5, MAS5_SGS | get_lpid(vcpu));
637 asm volatile("tlbsx 0, %[geaddr]\n" : : 635 asm volatile("tlbsx 0, %[geaddr]\n" : :
638 [geaddr] "r" (geaddr)); 636 [geaddr] "r" (geaddr));
639 mtspr(SPRN_MAS5, 0); 637 mtspr(SPRN_MAS5, 0);
@@ -732,7 +730,7 @@ int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
732 return 0; 730 return 0;
733} 731}
734 732
735int kvm_age_hva(struct kvm *kvm, unsigned long hva) 733int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end)
736{ 734{
737 /* XXX could be more clever ;) */ 735 /* XXX could be more clever ;) */
738 return 0; 736 return 0;
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 164bad2a19bf..2fdc8722e324 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -48,10 +48,11 @@ void kvmppc_set_pending_interrupt(struct kvm_vcpu *vcpu, enum int_class type)
48 return; 48 return;
49 } 49 }
50 50
51 51 preempt_disable();
52 tag = PPC_DBELL_LPID(vcpu->kvm->arch.lpid) | vcpu->vcpu_id; 52 tag = PPC_DBELL_LPID(get_lpid(vcpu)) | vcpu->vcpu_id;
53 mb(); 53 mb();
54 ppc_msgsnd(dbell_type, 0, tag); 54 ppc_msgsnd(dbell_type, 0, tag);
55 preempt_enable();
55} 56}
56 57
57/* gtlbe must not be mapped by more than one host tlb entry */ 58/* gtlbe must not be mapped by more than one host tlb entry */
@@ -60,12 +61,11 @@ void kvmppc_e500_tlbil_one(struct kvmppc_vcpu_e500 *vcpu_e500,
60{ 61{
61 unsigned int tid, ts; 62 unsigned int tid, ts;
62 gva_t eaddr; 63 gva_t eaddr;
63 u32 val, lpid; 64 u32 val;
64 unsigned long flags; 65 unsigned long flags;
65 66
66 ts = get_tlb_ts(gtlbe); 67 ts = get_tlb_ts(gtlbe);
67 tid = get_tlb_tid(gtlbe); 68 tid = get_tlb_tid(gtlbe);
68 lpid = vcpu_e500->vcpu.kvm->arch.lpid;
69 69
70 /* We search the host TLB to invalidate its shadow TLB entry */ 70 /* We search the host TLB to invalidate its shadow TLB entry */
71 val = (tid << 16) | ts; 71 val = (tid << 16) | ts;
@@ -74,7 +74,7 @@ void kvmppc_e500_tlbil_one(struct kvmppc_vcpu_e500 *vcpu_e500,
74 local_irq_save(flags); 74 local_irq_save(flags);
75 75
76 mtspr(SPRN_MAS6, val); 76 mtspr(SPRN_MAS6, val);
77 mtspr(SPRN_MAS5, MAS5_SGS | lpid); 77 mtspr(SPRN_MAS5, MAS5_SGS | get_lpid(&vcpu_e500->vcpu));
78 78
79 asm volatile("tlbsx 0, %[eaddr]\n" : : [eaddr] "r" (eaddr)); 79 asm volatile("tlbsx 0, %[eaddr]\n" : : [eaddr] "r" (eaddr));
80 val = mfspr(SPRN_MAS1); 80 val = mfspr(SPRN_MAS1);
@@ -95,7 +95,7 @@ void kvmppc_e500_tlbil_all(struct kvmppc_vcpu_e500 *vcpu_e500)
95 unsigned long flags; 95 unsigned long flags;
96 96
97 local_irq_save(flags); 97 local_irq_save(flags);
98 mtspr(SPRN_MAS5, MAS5_SGS | vcpu_e500->vcpu.kvm->arch.lpid); 98 mtspr(SPRN_MAS5, MAS5_SGS | get_lpid(&vcpu_e500->vcpu));
99 asm volatile("tlbilxlpid"); 99 asm volatile("tlbilxlpid");
100 mtspr(SPRN_MAS5, 0); 100 mtspr(SPRN_MAS5, 0);
101 local_irq_restore(flags); 101 local_irq_restore(flags);
@@ -110,6 +110,7 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
110{ 110{
111} 111}
112 112
113/* We use two lpids per VM */
113static DEFINE_PER_CPU(struct kvm_vcpu *[KVMPPC_NR_LPIDS], last_vcpu_of_lpid); 114static DEFINE_PER_CPU(struct kvm_vcpu *[KVMPPC_NR_LPIDS], last_vcpu_of_lpid);
114 115
115static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu) 116static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
@@ -118,10 +119,12 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
118 119
119 kvmppc_booke_vcpu_load(vcpu, cpu); 120 kvmppc_booke_vcpu_load(vcpu, cpu);
120 121
121 mtspr(SPRN_LPID, vcpu->kvm->arch.lpid); 122 mtspr(SPRN_LPID, get_lpid(vcpu));
122 mtspr(SPRN_EPCR, vcpu->arch.shadow_epcr); 123 mtspr(SPRN_EPCR, vcpu->arch.shadow_epcr);
123 mtspr(SPRN_GPIR, vcpu->vcpu_id); 124 mtspr(SPRN_GPIR, vcpu->vcpu_id);
124 mtspr(SPRN_MSRP, vcpu->arch.shadow_msrp); 125 mtspr(SPRN_MSRP, vcpu->arch.shadow_msrp);
126 vcpu->arch.eplc = EPC_EGS | (get_lpid(vcpu) << EPC_ELPID_SHIFT);
127 vcpu->arch.epsc = vcpu->arch.eplc;
125 mtspr(SPRN_EPLC, vcpu->arch.eplc); 128 mtspr(SPRN_EPLC, vcpu->arch.eplc);
126 mtspr(SPRN_EPSC, vcpu->arch.epsc); 129 mtspr(SPRN_EPSC, vcpu->arch.epsc);
127 130
@@ -141,12 +144,10 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
141 mtspr(SPRN_GESR, vcpu->arch.shared->esr); 144 mtspr(SPRN_GESR, vcpu->arch.shared->esr);
142 145
143 if (vcpu->arch.oldpir != mfspr(SPRN_PIR) || 146 if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
144 __get_cpu_var(last_vcpu_of_lpid)[vcpu->kvm->arch.lpid] != vcpu) { 147 __get_cpu_var(last_vcpu_of_lpid)[get_lpid(vcpu)] != vcpu) {
145 kvmppc_e500_tlbil_all(vcpu_e500); 148 kvmppc_e500_tlbil_all(vcpu_e500);
146 __get_cpu_var(last_vcpu_of_lpid)[vcpu->kvm->arch.lpid] = vcpu; 149 __get_cpu_var(last_vcpu_of_lpid)[get_lpid(vcpu)] = vcpu;
147 } 150 }
148
149 kvmppc_load_guest_fp(vcpu);
150} 151}
151 152
152static void kvmppc_core_vcpu_put_e500mc(struct kvm_vcpu *vcpu) 153static void kvmppc_core_vcpu_put_e500mc(struct kvm_vcpu *vcpu)
@@ -179,6 +180,16 @@ int kvmppc_core_check_processor_compat(void)
179 r = 0; 180 r = 0;
180 else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0) 181 else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0)
181 r = 0; 182 r = 0;
183#ifdef CONFIG_ALTIVEC
184 /*
185 * Since guests have the priviledge to enable AltiVec, we need AltiVec
186 * support in the host to save/restore their context.
187 * Don't use CPU_FTR_ALTIVEC to identify cores with AltiVec unit
188 * because it's cleared in the absence of CONFIG_ALTIVEC!
189 */
190 else if (strcmp(cur_cpu_spec->cpu_name, "e6500") == 0)
191 r = 0;
192#endif
182 else 193 else
183 r = -ENOTSUPP; 194 r = -ENOTSUPP;
184 195
@@ -194,9 +205,7 @@ int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu)
194#ifdef CONFIG_64BIT 205#ifdef CONFIG_64BIT
195 vcpu->arch.shadow_epcr |= SPRN_EPCR_ICM; 206 vcpu->arch.shadow_epcr |= SPRN_EPCR_ICM;
196#endif 207#endif
197 vcpu->arch.shadow_msrp = MSRP_UCLEP | MSRP_DEP | MSRP_PMMP; 208 vcpu->arch.shadow_msrp = MSRP_UCLEP | MSRP_PMMP;
198 vcpu->arch.eplc = EPC_EGS | (vcpu->kvm->arch.lpid << EPC_ELPID_SHIFT);
199 vcpu->arch.epsc = vcpu->arch.eplc;
200 209
201 vcpu->arch.pvr = mfspr(SPRN_PVR); 210 vcpu->arch.pvr = mfspr(SPRN_PVR);
202 vcpu_e500->svr = mfspr(SPRN_SVR); 211 vcpu_e500->svr = mfspr(SPRN_SVR);
@@ -356,13 +365,26 @@ static int kvmppc_core_init_vm_e500mc(struct kvm *kvm)
356 if (lpid < 0) 365 if (lpid < 0)
357 return lpid; 366 return lpid;
358 367
368 /*
369 * Use two lpids per VM on cores with two threads like e6500. Use
370 * even numbers to speedup vcpu lpid computation with consecutive lpids
371 * per VM. vm1 will use lpids 2 and 3, vm2 lpids 4 and 5, and so on.
372 */
373 if (threads_per_core == 2)
374 lpid <<= 1;
375
359 kvm->arch.lpid = lpid; 376 kvm->arch.lpid = lpid;
360 return 0; 377 return 0;
361} 378}
362 379
363static void kvmppc_core_destroy_vm_e500mc(struct kvm *kvm) 380static void kvmppc_core_destroy_vm_e500mc(struct kvm *kvm)
364{ 381{
365 kvmppc_free_lpid(kvm->arch.lpid); 382 int lpid = kvm->arch.lpid;
383
384 if (threads_per_core == 2)
385 lpid >>= 1;
386
387 kvmppc_free_lpid(lpid);
366} 388}
367 389
368static struct kvmppc_ops kvm_ops_e500mc = { 390static struct kvmppc_ops kvm_ops_e500mc = {
@@ -390,7 +412,13 @@ static int __init kvmppc_e500mc_init(void)
390 if (r) 412 if (r)
391 goto err_out; 413 goto err_out;
392 414
393 kvmppc_init_lpid(64); 415 /*
416 * Use two lpids per VM on dual threaded processors like e6500
417 * to workarround the lack of tlb write conditional instruction.
418 * Expose half the number of available hardware lpids to the lpid
419 * allocator.
420 */
421 kvmppc_init_lpid(KVMPPC_NR_LPIDS/threads_per_core);
394 kvmppc_claim_lpid(0); /* host */ 422 kvmppc_claim_lpid(0); /* host */
395 423
396 r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); 424 r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE);
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index e96b50d0bdab..5cc2e7af3a7b 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -219,7 +219,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
219 /* this default type might be overwritten by subcategories */ 219 /* this default type might be overwritten by subcategories */
220 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS); 220 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS);
221 221
222 emulated = kvmppc_get_last_inst(vcpu, false, &inst); 222 emulated = kvmppc_get_last_inst(vcpu, INST_GENERIC, &inst);
223 if (emulated != EMULATE_DONE) 223 if (emulated != EMULATE_DONE)
224 return emulated; 224 return emulated;
225 225
@@ -274,6 +274,21 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
274 } 274 }
275 break; 275 break;
276 276
277 case 0:
278 /*
279 * Instruction with primary opcode 0. Based on PowerISA
280 * these are illegal instructions.
281 */
282 if (inst == KVMPPC_INST_SW_BREAKPOINT) {
283 run->exit_reason = KVM_EXIT_DEBUG;
284 run->debug.arch.address = kvmppc_get_pc(vcpu);
285 emulated = EMULATE_EXIT_USER;
286 advance = 0;
287 } else
288 emulated = EMULATE_FAIL;
289
290 break;
291
277 default: 292 default:
278 emulated = EMULATE_FAIL; 293 emulated = EMULATE_FAIL;
279 } 294 }
diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
index 0de4ffa175a9..6d3c0ee1d744 100644
--- a/arch/powerpc/kvm/emulate_loadstore.c
+++ b/arch/powerpc/kvm/emulate_loadstore.c
@@ -58,7 +58,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
58 /* this default type might be overwritten by subcategories */ 58 /* this default type might be overwritten by subcategories */
59 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS); 59 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS);
60 60
61 emulated = kvmppc_get_last_inst(vcpu, false, &inst); 61 emulated = kvmppc_get_last_inst(vcpu, INST_GENERIC, &inst);
62 if (emulated != EMULATE_DONE) 62 if (emulated != EMULATE_DONE)
63 return emulated; 63 return emulated;
64 64
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 4c79284b58be..c1f8f53cd312 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -294,7 +294,7 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
294 { 294 {
295 u32 last_inst; 295 u32 last_inst;
296 296
297 kvmppc_get_last_inst(vcpu, false, &last_inst); 297 kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
298 /* XXX Deliver Program interrupt to guest. */ 298 /* XXX Deliver Program interrupt to guest. */
299 pr_emerg("%s: emulation failed (%08x)\n", __func__, last_inst); 299 pr_emerg("%s: emulation failed (%08x)\n", __func__, last_inst);
300 r = RESUME_HOST; 300 r = RESUME_HOST;
@@ -384,24 +384,16 @@ int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
384} 384}
385EXPORT_SYMBOL_GPL(kvmppc_ld); 385EXPORT_SYMBOL_GPL(kvmppc_ld);
386 386
387int kvm_arch_hardware_enable(void *garbage) 387int kvm_arch_hardware_enable(void)
388{ 388{
389 return 0; 389 return 0;
390} 390}
391 391
392void kvm_arch_hardware_disable(void *garbage)
393{
394}
395
396int kvm_arch_hardware_setup(void) 392int kvm_arch_hardware_setup(void)
397{ 393{
398 return 0; 394 return 0;
399} 395}
400 396
401void kvm_arch_hardware_unsetup(void)
402{
403}
404
405void kvm_arch_check_processor_compat(void *rtn) 397void kvm_arch_check_processor_compat(void *rtn)
406{ 398{
407 *(int *)rtn = kvmppc_core_check_processor_compat(); 399 *(int *)rtn = kvmppc_core_check_processor_compat();
@@ -462,10 +454,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
462 module_put(kvm->arch.kvm_ops->owner); 454 module_put(kvm->arch.kvm_ops->owner);
463} 455}
464 456
465void kvm_arch_sync_events(struct kvm *kvm)
466{
467}
468
469int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) 457int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
470{ 458{
471 int r; 459 int r;
@@ -608,10 +596,6 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
608 return kvmppc_core_create_memslot(kvm, slot, npages); 596 return kvmppc_core_create_memslot(kvm, slot, npages);
609} 597}
610 598
611void kvm_arch_memslots_updated(struct kvm *kvm)
612{
613}
614
615int kvm_arch_prepare_memory_region(struct kvm *kvm, 599int kvm_arch_prepare_memory_region(struct kvm *kvm,
616 struct kvm_memory_slot *memslot, 600 struct kvm_memory_slot *memslot,
617 struct kvm_userspace_memory_region *mem, 601 struct kvm_userspace_memory_region *mem,
@@ -628,10 +612,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
628 kvmppc_core_commit_memory_region(kvm, mem, old); 612 kvmppc_core_commit_memory_region(kvm, mem, old);
629} 613}
630 614
631void kvm_arch_flush_shadow_all(struct kvm *kvm)
632{
633}
634
635void kvm_arch_flush_shadow_memslot(struct kvm *kvm, 615void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
636 struct kvm_memory_slot *slot) 616 struct kvm_memory_slot *slot)
637{ 617{
@@ -658,7 +638,6 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
658{ 638{
659 /* Make sure we're not using the vcpu anymore */ 639 /* Make sure we're not using the vcpu anymore */
660 hrtimer_cancel(&vcpu->arch.dec_timer); 640 hrtimer_cancel(&vcpu->arch.dec_timer);
661 tasklet_kill(&vcpu->arch.tasklet);
662 641
663 kvmppc_remove_vcpu_debugfs(vcpu); 642 kvmppc_remove_vcpu_debugfs(vcpu);
664 643
@@ -684,16 +663,12 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
684 return kvmppc_core_pending_dec(vcpu); 663 return kvmppc_core_pending_dec(vcpu);
685} 664}
686 665
687/*
688 * low level hrtimer wake routine. Because this runs in hardirq context
689 * we schedule a tasklet to do the real work.
690 */
691enum hrtimer_restart kvmppc_decrementer_wakeup(struct hrtimer *timer) 666enum hrtimer_restart kvmppc_decrementer_wakeup(struct hrtimer *timer)
692{ 667{
693 struct kvm_vcpu *vcpu; 668 struct kvm_vcpu *vcpu;
694 669
695 vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer); 670 vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer);
696 tasklet_schedule(&vcpu->arch.tasklet); 671 kvmppc_decrementer_func(vcpu);
697 672
698 return HRTIMER_NORESTART; 673 return HRTIMER_NORESTART;
699} 674}
@@ -703,7 +678,6 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
703 int ret; 678 int ret;
704 679
705 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); 680 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
706 tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu);
707 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup; 681 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;
708 vcpu->arch.dec_expires = ~(u64)0; 682 vcpu->arch.dec_expires = ~(u64)0;
709 683
@@ -927,6 +901,103 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
927} 901}
928EXPORT_SYMBOL_GPL(kvmppc_handle_store); 902EXPORT_SYMBOL_GPL(kvmppc_handle_store);
929 903
904int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
905{
906 int r = 0;
907 union kvmppc_one_reg val;
908 int size;
909
910 size = one_reg_size(reg->id);
911 if (size > sizeof(val))
912 return -EINVAL;
913
914 r = kvmppc_get_one_reg(vcpu, reg->id, &val);
915 if (r == -EINVAL) {
916 r = 0;
917 switch (reg->id) {
918#ifdef CONFIG_ALTIVEC
919 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
920 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
921 r = -ENXIO;
922 break;
923 }
924 vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0] = val.vval;
925 break;
926 case KVM_REG_PPC_VSCR:
927 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
928 r = -ENXIO;
929 break;
930 }
931 vcpu->arch.vr.vscr.u[3] = set_reg_val(reg->id, val);
932 break;
933 case KVM_REG_PPC_VRSAVE:
934 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
935 r = -ENXIO;
936 break;
937 }
938 vcpu->arch.vrsave = set_reg_val(reg->id, val);
939 break;
940#endif /* CONFIG_ALTIVEC */
941 default:
942 r = -EINVAL;
943 break;
944 }
945 }
946
947 if (r)
948 return r;
949
950 if (copy_to_user((char __user *)(unsigned long)reg->addr, &val, size))
951 r = -EFAULT;
952
953 return r;
954}
955
956int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
957{
958 int r;
959 union kvmppc_one_reg val;
960 int size;
961
962 size = one_reg_size(reg->id);
963 if (size > sizeof(val))
964 return -EINVAL;
965
966 if (copy_from_user(&val, (char __user *)(unsigned long)reg->addr, size))
967 return -EFAULT;
968
969 r = kvmppc_set_one_reg(vcpu, reg->id, &val);
970 if (r == -EINVAL) {
971 r = 0;
972 switch (reg->id) {
973#ifdef CONFIG_ALTIVEC
974 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
975 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
976 r = -ENXIO;
977 break;
978 }
979 val.vval = vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0];
980 break;
981 case KVM_REG_PPC_VSCR:
982 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
983 r = -ENXIO;
984 break;
985 }
986 val = get_reg_val(reg->id, vcpu->arch.vr.vscr.u[3]);
987 break;
988 case KVM_REG_PPC_VRSAVE:
989 val = get_reg_val(reg->id, vcpu->arch.vrsave);
990 break;
991#endif /* CONFIG_ALTIVEC */
992 default:
993 r = -EINVAL;
994 break;
995 }
996 }
997
998 return r;
999}
1000
930int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) 1001int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
931{ 1002{
932 int r; 1003 int r;
@@ -1343,9 +1414,4 @@ int kvm_arch_init(void *opaque)
1343 return 0; 1414 return 0;
1344} 1415}
1345 1416
1346void kvm_arch_exit(void)
1347{
1348
1349}
1350
1351EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_ppc_instr); 1417EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_ppc_instr);
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 3afa6f4c1957..cbae2dfd053c 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -686,7 +686,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
686 ((u64 *)image)[0] = (u64)code_base; 686 ((u64 *)image)[0] = (u64)code_base;
687 ((u64 *)image)[1] = local_paca->kernel_toc; 687 ((u64 *)image)[1] = local_paca->kernel_toc;
688 fp->bpf_func = (void *)image; 688 fp->bpf_func = (void *)image;
689 fp->jited = 1; 689 fp->jited = true;
690 } 690 }
691out: 691out:
692 kfree(addrs); 692 kfree(addrs);
@@ -697,5 +697,6 @@ void bpf_jit_free(struct bpf_prog *fp)
697{ 697{
698 if (fp->jited) 698 if (fp->jited)
699 module_free(NULL, fp->bpf_func); 699 module_free(NULL, fp->bpf_func);
700 kfree(fp); 700
701 bpf_prog_unlock_free(fp);
701} 702}
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index 74d1e780748b..2396dda282cd 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -35,7 +35,7 @@ static int valid_next_sp(unsigned long sp, unsigned long prev_sp)
35 return 0; /* must be 16-byte aligned */ 35 return 0; /* must be 16-byte aligned */
36 if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD)) 36 if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD))
37 return 0; 37 return 0;
38 if (sp >= prev_sp + STACK_FRAME_OVERHEAD) 38 if (sp >= prev_sp + STACK_FRAME_MIN_SIZE)
39 return 1; 39 return 1;
40 /* 40 /*
41 * sp could decrease when we jump off an interrupt stack 41 * sp could decrease when we jump off an interrupt stack
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index e238b6a55b15..73997027b085 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -141,7 +141,8 @@ static int mcu_gpiochip_add(struct mcu *mcu)
141 141
142static int mcu_gpiochip_remove(struct mcu *mcu) 142static int mcu_gpiochip_remove(struct mcu *mcu)
143{ 143{
144 return gpiochip_remove(&mcu->gc); 144 gpiochip_remove(&mcu->gc);
145 return 0;
145} 146}
146 147
147static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id) 148static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index e8bc40869cbd..7d9ee3d8c618 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -303,9 +303,13 @@ config PPC_ICSWX_USE_SIGILL
303 303
304 If in doubt, say N here. 304 If in doubt, say N here.
305 305
306config SPE_POSSIBLE
307 def_bool y
308 depends on E200 || (E500 && !PPC_E500MC)
309
306config SPE 310config SPE
307 bool "SPE Support" 311 bool "SPE Support"
308 depends on E200 || (E500 && !PPC_E500MC) 312 depends on SPE_POSSIBLE
309 default y 313 default y
310 ---help--- 314 ---help---
311 This option enables kernel support for the Signal Processing 315 This option enables kernel support for the Signal Processing
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index 85825b5401e5..862b32702d29 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -199,14 +199,6 @@ out_error:
199 return msic; 199 return msic;
200} 200}
201 201
202static int axon_msi_check_device(struct pci_dev *dev, int nvec, int type)
203{
204 if (!find_msi_translator(dev))
205 return -ENODEV;
206
207 return 0;
208}
209
210static int setup_msi_msg_address(struct pci_dev *dev, struct msi_msg *msg) 202static int setup_msi_msg_address(struct pci_dev *dev, struct msi_msg *msg)
211{ 203{
212 struct device_node *dn; 204 struct device_node *dn;
@@ -416,7 +408,6 @@ static int axon_msi_probe(struct platform_device *device)
416 408
417 ppc_md.setup_msi_irqs = axon_msi_setup_msi_irqs; 409 ppc_md.setup_msi_irqs = axon_msi_setup_msi_irqs;
418 ppc_md.teardown_msi_irqs = axon_msi_teardown_msi_irqs; 410 ppc_md.teardown_msi_irqs = axon_msi_teardown_msi_irqs;
419 ppc_md.msi_check_device = axon_msi_check_device;
420 411
421 axon_msi_debug_setup(dn, msic); 412 axon_msi_debug_setup(dn, msic);
422 413
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c
index 97ac8dc33667..5e1ed1575aab 100644
--- a/arch/powerpc/platforms/powernv/opal-hmi.c
+++ b/arch/powerpc/platforms/powernv/opal-hmi.c
@@ -28,6 +28,7 @@
28 28
29#include <asm/opal.h> 29#include <asm/opal.h>
30#include <asm/cputable.h> 30#include <asm/cputable.h>
31#include <asm/machdep.h>
31 32
32static int opal_hmi_handler_nb_init; 33static int opal_hmi_handler_nb_init;
33struct OpalHmiEvtNode { 34struct OpalHmiEvtNode {
@@ -185,4 +186,4 @@ static int __init opal_hmi_handler_init(void)
185 } 186 }
186 return 0; 187 return 0;
187} 188}
188subsys_initcall(opal_hmi_handler_init); 189machine_subsys_initcall(powernv, opal_hmi_handler_init);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index b44eec3e8dbd..4b005ae5dc4b 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -322,7 +322,7 @@ static void opal_handle_message(void)
322 322
323 /* check for errors. */ 323 /* check for errors. */
324 if (ret) { 324 if (ret) {
325 pr_warning("%s: Failed to retrive opal message, err=%lld\n", 325 pr_warning("%s: Failed to retrieve opal message, err=%lld\n",
326 __func__, ret); 326 __func__, ret);
327 return; 327 return;
328 } 328 }
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index b854b57ed5e1..b45c49249a5d 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -46,29 +46,21 @@
46//#define cfg_dbg(fmt...) printk(fmt) 46//#define cfg_dbg(fmt...) printk(fmt)
47 47
48#ifdef CONFIG_PCI_MSI 48#ifdef CONFIG_PCI_MSI
49static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type)
50{
51 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
52 struct pnv_phb *phb = hose->private_data;
53 struct pci_dn *pdn = pci_get_pdn(pdev);
54
55 if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
56 return -ENODEV;
57
58 return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV;
59}
60
61static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 49static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
62{ 50{
63 struct pci_controller *hose = pci_bus_to_host(pdev->bus); 51 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
64 struct pnv_phb *phb = hose->private_data; 52 struct pnv_phb *phb = hose->private_data;
53 struct pci_dn *pdn = pci_get_pdn(pdev);
65 struct msi_desc *entry; 54 struct msi_desc *entry;
66 struct msi_msg msg; 55 struct msi_msg msg;
67 int hwirq; 56 int hwirq;
68 unsigned int virq; 57 unsigned int virq;
69 int rc; 58 int rc;
70 59
71 if (WARN_ON(!phb)) 60 if (WARN_ON(!phb) || !phb->msi_bmp.bitmap)
61 return -ENODEV;
62
63 if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
72 return -ENODEV; 64 return -ENODEV;
73 65
74 list_for_each_entry(entry, &pdev->msi_list, list) { 66 list_for_each_entry(entry, &pdev->msi_list, list) {
@@ -860,7 +852,6 @@ void __init pnv_pci_init(void)
860 852
861 /* Configure MSIs */ 853 /* Configure MSIs */
862#ifdef CONFIG_PCI_MSI 854#ifdef CONFIG_PCI_MSI
863 ppc_md.msi_check_device = pnv_msi_check_device;
864 ppc_md.setup_msi_irqs = pnv_setup_msi_irqs; 855 ppc_md.setup_msi_irqs = pnv_setup_msi_irqs;
865 ppc_md.teardown_msi_irqs = pnv_teardown_msi_irqs; 856 ppc_md.teardown_msi_irqs = pnv_teardown_msi_irqs;
866#endif 857#endif
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index c904583baf4b..34064f50945e 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -113,7 +113,7 @@ out:
113static int pseries_remove_mem_node(struct device_node *np) 113static int pseries_remove_mem_node(struct device_node *np)
114{ 114{
115 const char *type; 115 const char *type;
116 const unsigned int *regs; 116 const __be32 *regs;
117 unsigned long base; 117 unsigned long base;
118 unsigned int lmb_size; 118 unsigned int lmb_size;
119 int ret = -EINVAL; 119 int ret = -EINVAL;
@@ -126,14 +126,14 @@ static int pseries_remove_mem_node(struct device_node *np)
126 return 0; 126 return 0;
127 127
128 /* 128 /*
129 * Find the bae address and size of the memblock 129 * Find the base address and size of the memblock
130 */ 130 */
131 regs = of_get_property(np, "reg", NULL); 131 regs = of_get_property(np, "reg", NULL);
132 if (!regs) 132 if (!regs)
133 return ret; 133 return ret;
134 134
135 base = *(unsigned long *)regs; 135 base = be64_to_cpu(*(unsigned long *)regs);
136 lmb_size = regs[3]; 136 lmb_size = be32_to_cpu(regs[3]);
137 137
138 pseries_remove_memblock(base, lmb_size); 138 pseries_remove_memblock(base, lmb_size);
139 return 0; 139 return 0;
@@ -153,7 +153,7 @@ static inline int pseries_remove_mem_node(struct device_node *np)
153static int pseries_add_mem_node(struct device_node *np) 153static int pseries_add_mem_node(struct device_node *np)
154{ 154{
155 const char *type; 155 const char *type;
156 const unsigned int *regs; 156 const __be32 *regs;
157 unsigned long base; 157 unsigned long base;
158 unsigned int lmb_size; 158 unsigned int lmb_size;
159 int ret = -EINVAL; 159 int ret = -EINVAL;
@@ -172,8 +172,8 @@ static int pseries_add_mem_node(struct device_node *np)
172 if (!regs) 172 if (!regs)
173 return ret; 173 return ret;
174 174
175 base = *(unsigned long *)regs; 175 base = be64_to_cpu(*(unsigned long *)regs);
176 lmb_size = regs[3]; 176 lmb_size = be32_to_cpu(regs[3]);
177 177
178 /* 178 /*
179 * Update memory region to represent the memory add 179 * Update memory region to represent the memory add
@@ -187,44 +187,46 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
187 struct of_drconf_cell *new_drmem, *old_drmem; 187 struct of_drconf_cell *new_drmem, *old_drmem;
188 unsigned long memblock_size; 188 unsigned long memblock_size;
189 u32 entries; 189 u32 entries;
190 u32 *p; 190 __be32 *p;
191 int i, rc = -EINVAL; 191 int i, rc = -EINVAL;
192 192
193 memblock_size = pseries_memory_block_size(); 193 memblock_size = pseries_memory_block_size();
194 if (!memblock_size) 194 if (!memblock_size)
195 return -EINVAL; 195 return -EINVAL;
196 196
197 p = (u32 *) pr->old_prop->value; 197 p = (__be32 *) pr->old_prop->value;
198 if (!p) 198 if (!p)
199 return -EINVAL; 199 return -EINVAL;
200 200
201 /* The first int of the property is the number of lmb's described 201 /* The first int of the property is the number of lmb's described
202 * by the property. This is followed by an array of of_drconf_cell 202 * by the property. This is followed by an array of of_drconf_cell
203 * entries. Get the niumber of entries and skip to the array of 203 * entries. Get the number of entries and skip to the array of
204 * of_drconf_cell's. 204 * of_drconf_cell's.
205 */ 205 */
206 entries = *p++; 206 entries = be32_to_cpu(*p++);
207 old_drmem = (struct of_drconf_cell *)p; 207 old_drmem = (struct of_drconf_cell *)p;
208 208
209 p = (u32 *)pr->prop->value; 209 p = (__be32 *)pr->prop->value;
210 p++; 210 p++;
211 new_drmem = (struct of_drconf_cell *)p; 211 new_drmem = (struct of_drconf_cell *)p;
212 212
213 for (i = 0; i < entries; i++) { 213 for (i = 0; i < entries; i++) {
214 if ((old_drmem[i].flags & DRCONF_MEM_ASSIGNED) && 214 if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) &&
215 (!(new_drmem[i].flags & DRCONF_MEM_ASSIGNED))) { 215 (!(be32_to_cpu(new_drmem[i].flags) & DRCONF_MEM_ASSIGNED))) {
216 rc = pseries_remove_memblock(old_drmem[i].base_addr, 216 rc = pseries_remove_memblock(
217 be64_to_cpu(old_drmem[i].base_addr),
217 memblock_size); 218 memblock_size);
218 break; 219 break;
219 } else if ((!(old_drmem[i].flags & DRCONF_MEM_ASSIGNED)) && 220 } else if ((!(be32_to_cpu(old_drmem[i].flags) &
220 (new_drmem[i].flags & DRCONF_MEM_ASSIGNED)) { 221 DRCONF_MEM_ASSIGNED)) &&
221 rc = memblock_add(old_drmem[i].base_addr, 222 (be32_to_cpu(new_drmem[i].flags) &
223 DRCONF_MEM_ASSIGNED)) {
224 rc = memblock_add(be64_to_cpu(old_drmem[i].base_addr),
222 memblock_size); 225 memblock_size);
223 rc = (rc < 0) ? -EINVAL : 0; 226 rc = (rc < 0) ? -EINVAL : 0;
224 break; 227 break;
225 } 228 }
226 } 229 }
227
228 return rc; 230 return rc;
229} 231}
230 232
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 18ff4626d74e..8ab5add4ac82 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -336,26 +336,6 @@ out:
336 return request; 336 return request;
337} 337}
338 338
339static int rtas_msi_check_device(struct pci_dev *pdev, int nvec, int type)
340{
341 int quota, rc;
342
343 if (type == PCI_CAP_ID_MSIX)
344 rc = check_req_msix(pdev, nvec);
345 else
346 rc = check_req_msi(pdev, nvec);
347
348 if (rc)
349 return rc;
350
351 quota = msi_quota_for_device(pdev, nvec);
352
353 if (quota && quota < nvec)
354 return quota;
355
356 return 0;
357}
358
359static int check_msix_entries(struct pci_dev *pdev) 339static int check_msix_entries(struct pci_dev *pdev)
360{ 340{
361 struct msi_desc *entry; 341 struct msi_desc *entry;
@@ -397,15 +377,24 @@ static void rtas_hack_32bit_msi_gen2(struct pci_dev *pdev)
397static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) 377static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
398{ 378{
399 struct pci_dn *pdn; 379 struct pci_dn *pdn;
400 int hwirq, virq, i, rc; 380 int hwirq, virq, i, quota, rc;
401 struct msi_desc *entry; 381 struct msi_desc *entry;
402 struct msi_msg msg; 382 struct msi_msg msg;
403 int nvec = nvec_in; 383 int nvec = nvec_in;
404 int use_32bit_msi_hack = 0; 384 int use_32bit_msi_hack = 0;
405 385
406 pdn = pci_get_pdn(pdev); 386 if (type == PCI_CAP_ID_MSIX)
407 if (!pdn) 387 rc = check_req_msix(pdev, nvec);
408 return -ENODEV; 388 else
389 rc = check_req_msi(pdev, nvec);
390
391 if (rc)
392 return rc;
393
394 quota = msi_quota_for_device(pdev, nvec);
395
396 if (quota && quota < nvec)
397 return quota;
409 398
410 if (type == PCI_CAP_ID_MSIX && check_msix_entries(pdev)) 399 if (type == PCI_CAP_ID_MSIX && check_msix_entries(pdev))
411 return -EINVAL; 400 return -EINVAL;
@@ -416,12 +405,14 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
416 */ 405 */
417 if (type == PCI_CAP_ID_MSIX) { 406 if (type == PCI_CAP_ID_MSIX) {
418 int m = roundup_pow_of_two(nvec); 407 int m = roundup_pow_of_two(nvec);
419 int quota = msi_quota_for_device(pdev, m); 408 quota = msi_quota_for_device(pdev, m);
420 409
421 if (quota >= m) 410 if (quota >= m)
422 nvec = m; 411 nvec = m;
423 } 412 }
424 413
414 pdn = pci_get_pdn(pdev);
415
425 /* 416 /*
426 * Try the new more explicit firmware interface, if that fails fall 417 * Try the new more explicit firmware interface, if that fails fall
427 * back to the old interface. The old interface is known to never 418 * back to the old interface. The old interface is known to never
@@ -485,7 +476,7 @@ again:
485 irq_set_msi_desc(virq, entry); 476 irq_set_msi_desc(virq, entry);
486 477
487 /* Read config space back so we can restore after reset */ 478 /* Read config space back so we can restore after reset */
488 read_msi_msg(virq, &msg); 479 __read_msi_msg(entry, &msg);
489 entry->msg = msg; 480 entry->msg = msg;
490 } 481 }
491 482
@@ -526,7 +517,6 @@ static int rtas_msi_init(void)
526 WARN_ON(ppc_md.setup_msi_irqs); 517 WARN_ON(ppc_md.setup_msi_irqs);
527 ppc_md.setup_msi_irqs = rtas_setup_msi_irqs; 518 ppc_md.setup_msi_irqs = rtas_setup_msi_irqs;
528 ppc_md.teardown_msi_irqs = rtas_teardown_msi_irqs; 519 ppc_md.teardown_msi_irqs = rtas_teardown_msi_irqs;
529 ppc_md.msi_check_device = rtas_msi_check_device;
530 520
531 WARN_ON(ppc_md.pci_irq_fixup); 521 WARN_ON(ppc_md.pci_irq_fixup);
532 ppc_md.pci_irq_fixup = rtas_msi_pci_irq_fixup; 522 ppc_md.pci_irq_fixup = rtas_msi_pci_irq_fixup;
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 77efbaec7b9c..b32e79dbef4f 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -109,14 +109,6 @@ static int fsl_msi_init_allocator(struct fsl_msi *msi_data)
109 return 0; 109 return 0;
110} 110}
111 111
112static int fsl_msi_check_device(struct pci_dev *pdev, int nvec, int type)
113{
114 if (type == PCI_CAP_ID_MSIX)
115 pr_debug("fslmsi: MSI-X untested, trying anyway.\n");
116
117 return 0;
118}
119
120static void fsl_teardown_msi_irqs(struct pci_dev *pdev) 112static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
121{ 113{
122 struct msi_desc *entry; 114 struct msi_desc *entry;
@@ -173,6 +165,9 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
173 struct msi_msg msg; 165 struct msi_msg msg;
174 struct fsl_msi *msi_data; 166 struct fsl_msi *msi_data;
175 167
168 if (type == PCI_CAP_ID_MSIX)
169 pr_debug("fslmsi: MSI-X untested, trying anyway.\n");
170
176 /* 171 /*
177 * If the PCI node has an fsl,msi property, then we need to use it 172 * If the PCI node has an fsl,msi property, then we need to use it
178 * to find the specific MSI. 173 * to find the specific MSI.
@@ -527,7 +522,6 @@ static int fsl_of_msi_probe(struct platform_device *dev)
527 if (!ppc_md.setup_msi_irqs) { 522 if (!ppc_md.setup_msi_irqs) {
528 ppc_md.setup_msi_irqs = fsl_setup_msi_irqs; 523 ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
529 ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs; 524 ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
530 ppc_md.msi_check_device = fsl_msi_check_device;
531 } else if (ppc_md.setup_msi_irqs != fsl_setup_msi_irqs) { 525 } else if (ppc_md.setup_msi_irqs != fsl_setup_msi_irqs) {
532 dev_err(&dev->dev, "Different MSI driver already installed!\n"); 526 dev_err(&dev->dev, "Different MSI driver already installed!\n");
533 err = -ENODEV; 527 err = -ENODEV;
diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c
index 38e62382070c..15dccd35fa11 100644
--- a/arch/powerpc/sysdev/mpic_pasemi_msi.c
+++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c
@@ -63,14 +63,6 @@ static struct irq_chip mpic_pasemi_msi_chip = {
63 .name = "PASEMI-MSI", 63 .name = "PASEMI-MSI",
64}; 64};
65 65
66static int pasemi_msi_check_device(struct pci_dev *pdev, int nvec, int type)
67{
68 if (type == PCI_CAP_ID_MSIX)
69 pr_debug("pasemi_msi: MSI-X untested, trying anyway\n");
70
71 return 0;
72}
73
74static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev) 66static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
75{ 67{
76 struct msi_desc *entry; 68 struct msi_desc *entry;
@@ -97,6 +89,8 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
97 struct msi_msg msg; 89 struct msi_msg msg;
98 int hwirq; 90 int hwirq;
99 91
92 if (type == PCI_CAP_ID_MSIX)
93 pr_debug("pasemi_msi: MSI-X untested, trying anyway\n");
100 pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n", 94 pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n",
101 pdev, nvec, type); 95 pdev, nvec, type);
102 96
@@ -169,7 +163,6 @@ int mpic_pasemi_msi_init(struct mpic *mpic)
169 WARN_ON(ppc_md.setup_msi_irqs); 163 WARN_ON(ppc_md.setup_msi_irqs);
170 ppc_md.setup_msi_irqs = pasemi_msi_setup_msi_irqs; 164 ppc_md.setup_msi_irqs = pasemi_msi_setup_msi_irqs;
171 ppc_md.teardown_msi_irqs = pasemi_msi_teardown_msi_irqs; 165 ppc_md.teardown_msi_irqs = pasemi_msi_teardown_msi_irqs;
172 ppc_md.msi_check_device = pasemi_msi_check_device;
173 166
174 return 0; 167 return 0;
175} 168}
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 9a7aa0ed9c1c..623d7fba15b4 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -105,22 +105,6 @@ static u64 find_u4_magic_addr(struct pci_dev *pdev, unsigned int hwirq)
105 return 0; 105 return 0;
106} 106}
107 107
108static int u3msi_msi_check_device(struct pci_dev *pdev, int nvec, int type)
109{
110 if (type == PCI_CAP_ID_MSIX)
111 pr_debug("u3msi: MSI-X untested, trying anyway.\n");
112
113 /* If we can't find a magic address then MSI ain't gonna work */
114 if (find_ht_magic_addr(pdev, 0) == 0 &&
115 find_u4_magic_addr(pdev, 0) == 0) {
116 pr_debug("u3msi: no magic address found for %s\n",
117 pci_name(pdev));
118 return -ENXIO;
119 }
120
121 return 0;
122}
123
124static void u3msi_teardown_msi_irqs(struct pci_dev *pdev) 108static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
125{ 109{
126 struct msi_desc *entry; 110 struct msi_desc *entry;
@@ -146,6 +130,17 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
146 u64 addr; 130 u64 addr;
147 int hwirq; 131 int hwirq;
148 132
133 if (type == PCI_CAP_ID_MSIX)
134 pr_debug("u3msi: MSI-X untested, trying anyway.\n");
135
136 /* If we can't find a magic address then MSI ain't gonna work */
137 if (find_ht_magic_addr(pdev, 0) == 0 &&
138 find_u4_magic_addr(pdev, 0) == 0) {
139 pr_debug("u3msi: no magic address found for %s\n",
140 pci_name(pdev));
141 return -ENXIO;
142 }
143
149 list_for_each_entry(entry, &pdev->msi_list, list) { 144 list_for_each_entry(entry, &pdev->msi_list, list) {
150 hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1); 145 hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1);
151 if (hwirq < 0) { 146 if (hwirq < 0) {
@@ -202,7 +197,6 @@ int mpic_u3msi_init(struct mpic *mpic)
202 WARN_ON(ppc_md.setup_msi_irqs); 197 WARN_ON(ppc_md.setup_msi_irqs);
203 ppc_md.setup_msi_irqs = u3msi_setup_msi_irqs; 198 ppc_md.setup_msi_irqs = u3msi_setup_msi_irqs;
204 ppc_md.teardown_msi_irqs = u3msi_teardown_msi_irqs; 199 ppc_md.teardown_msi_irqs = u3msi_teardown_msi_irqs;
205 ppc_md.msi_check_device = u3msi_msi_check_device;
206 200
207 return 0; 201 return 0;
208} 202}
diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
index 11c888416f0a..a6a4dbda9078 100644
--- a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
@@ -44,6 +44,12 @@ static int hsta_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
44 int irq, hwirq; 44 int irq, hwirq;
45 u64 addr; 45 u64 addr;
46 46
47 /* We don't support MSI-X */
48 if (type == PCI_CAP_ID_MSIX) {
49 pr_debug("%s: MSI-X not supported.\n", __func__);
50 return -EINVAL;
51 }
52
47 list_for_each_entry(entry, &dev->msi_list, list) { 53 list_for_each_entry(entry, &dev->msi_list, list) {
48 irq = msi_bitmap_alloc_hwirqs(&ppc4xx_hsta_msi.bmp, 1); 54 irq = msi_bitmap_alloc_hwirqs(&ppc4xx_hsta_msi.bmp, 1);
49 if (irq < 0) { 55 if (irq < 0) {
@@ -117,17 +123,6 @@ static void hsta_teardown_msi_irqs(struct pci_dev *dev)
117 } 123 }
118} 124}
119 125
120static int hsta_msi_check_device(struct pci_dev *pdev, int nvec, int type)
121{
122 /* We don't support MSI-X */
123 if (type == PCI_CAP_ID_MSIX) {
124 pr_debug("%s: MSI-X not supported.\n", __func__);
125 return -EINVAL;
126 }
127
128 return 0;
129}
130
131static int hsta_msi_probe(struct platform_device *pdev) 126static int hsta_msi_probe(struct platform_device *pdev)
132{ 127{
133 struct device *dev = &pdev->dev; 128 struct device *dev = &pdev->dev;
@@ -178,7 +173,6 @@ static int hsta_msi_probe(struct platform_device *pdev)
178 173
179 ppc_md.setup_msi_irqs = hsta_setup_msi_irqs; 174 ppc_md.setup_msi_irqs = hsta_setup_msi_irqs;
180 ppc_md.teardown_msi_irqs = hsta_teardown_msi_irqs; 175 ppc_md.teardown_msi_irqs = hsta_teardown_msi_irqs;
181 ppc_md.msi_check_device = hsta_msi_check_device;
182 return 0; 176 return 0;
183 177
184out2: 178out2:
diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/sysdev/ppc4xx_msi.c
index 43948da837a7..22b5200636e7 100644
--- a/arch/powerpc/sysdev/ppc4xx_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_msi.c
@@ -85,8 +85,12 @@ static int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
85 struct msi_desc *entry; 85 struct msi_desc *entry;
86 struct ppc4xx_msi *msi_data = &ppc4xx_msi; 86 struct ppc4xx_msi *msi_data = &ppc4xx_msi;
87 87
88 msi_data->msi_virqs = kmalloc((msi_irqs) * sizeof(int), 88 dev_dbg(&dev->dev, "PCIE-MSI:%s called. vec %x type %d\n",
89 GFP_KERNEL); 89 __func__, nvec, type);
90 if (type == PCI_CAP_ID_MSIX)
91 pr_debug("ppc4xx msi: MSI-X untested, trying anyway.\n");
92
93 msi_data->msi_virqs = kmalloc((msi_irqs) * sizeof(int), GFP_KERNEL);
90 if (!msi_data->msi_virqs) 94 if (!msi_data->msi_virqs)
91 return -ENOMEM; 95 return -ENOMEM;
92 96
@@ -134,16 +138,6 @@ void ppc4xx_teardown_msi_irqs(struct pci_dev *dev)
134 } 138 }
135} 139}
136 140
137static int ppc4xx_msi_check_device(struct pci_dev *pdev, int nvec, int type)
138{
139 dev_dbg(&pdev->dev, "PCIE-MSI:%s called. vec %x type %d\n",
140 __func__, nvec, type);
141 if (type == PCI_CAP_ID_MSIX)
142 pr_debug("ppc4xx msi: MSI-X untested, trying anyway.\n");
143
144 return 0;
145}
146
147static int ppc4xx_setup_pcieh_hw(struct platform_device *dev, 141static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
148 struct resource res, struct ppc4xx_msi *msi) 142 struct resource res, struct ppc4xx_msi *msi)
149{ 143{
@@ -259,7 +253,6 @@ static int ppc4xx_msi_probe(struct platform_device *dev)
259 253
260 ppc_md.setup_msi_irqs = ppc4xx_setup_msi_irqs; 254 ppc_md.setup_msi_irqs = ppc4xx_setup_msi_irqs;
261 ppc_md.teardown_msi_irqs = ppc4xx_teardown_msi_irqs; 255 ppc_md.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;
262 ppc_md.msi_check_device = ppc4xx_msi_check_device;
263 return err; 256 return err;
264 257
265error_out: 258error_out:
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index ab39ceb89ecf..05c78bb5f570 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -48,8 +48,6 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC
48 48
49config KEXEC 49config KEXEC
50 def_bool y 50 def_bool y
51 select CRYPTO
52 select CRYPTO_SHA256
53 51
54config AUDIT_ARCH 52config AUDIT_ARCH
55 def_bool y 53 def_bool y
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index 3ca1894ade09..9d94fdd9f525 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -63,6 +63,7 @@ CONFIG_CRASH_DUMP=y
63# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 63# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
64CONFIG_BINFMT_MISC=m 64CONFIG_BINFMT_MISC=m
65CONFIG_HIBERNATION=y 65CONFIG_HIBERNATION=y
66CONFIG_NET=y
66CONFIG_PACKET=y 67CONFIG_PACKET=y
67CONFIG_PACKET_DIAG=m 68CONFIG_PACKET_DIAG=m
68CONFIG_UNIX=y 69CONFIG_UNIX=y
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index 4830aa6e6f53..90f514baa37d 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -61,6 +61,7 @@ CONFIG_CRASH_DUMP=y
61# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 61# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
62CONFIG_BINFMT_MISC=m 62CONFIG_BINFMT_MISC=m
63CONFIG_HIBERNATION=y 63CONFIG_HIBERNATION=y
64CONFIG_NET=y
64CONFIG_PACKET=y 65CONFIG_PACKET=y
65CONFIG_PACKET_DIAG=m 66CONFIG_PACKET_DIAG=m
66CONFIG_UNIX=y 67CONFIG_UNIX=y
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index 61db449bf309..13559d32af69 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -59,6 +59,7 @@ CONFIG_CRASH_DUMP=y
59# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 59# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
60CONFIG_BINFMT_MISC=m 60CONFIG_BINFMT_MISC=m
61CONFIG_HIBERNATION=y 61CONFIG_HIBERNATION=y
62CONFIG_NET=y
62CONFIG_PACKET=y 63CONFIG_PACKET=y
63CONFIG_PACKET_DIAG=m 64CONFIG_PACKET_DIAG=m
64CONFIG_UNIX=y 65CONFIG_UNIX=y
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig
index 948e0e057a23..e376789f2d8d 100644
--- a/arch/s390/configs/zfcpdump_defconfig
+++ b/arch/s390/configs/zfcpdump_defconfig
@@ -23,6 +23,7 @@ CONFIG_CRASH_DUMP=y
23# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 23# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
24# CONFIG_SECCOMP is not set 24# CONFIG_SECCOMP is not set
25# CONFIG_IUCV is not set 25# CONFIG_IUCV is not set
26CONFIG_NET=y
26CONFIG_ATM=y 27CONFIG_ATM=y
27CONFIG_ATM_LANE=y 28CONFIG_ATM_LANE=y
28CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 29CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 2e56498a40df..fab35a8efa4f 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -50,6 +50,7 @@ CONFIG_CMA=y
50CONFIG_CRASH_DUMP=y 50CONFIG_CRASH_DUMP=y
51CONFIG_BINFMT_MISC=m 51CONFIG_BINFMT_MISC=m
52CONFIG_HIBERNATION=y 52CONFIG_HIBERNATION=y
53CONFIG_NET=y
53CONFIG_PACKET=y 54CONFIG_PACKET=y
54CONFIG_UNIX=y 55CONFIG_UNIX=y
55CONFIG_NET_KEY=y 56CONFIG_NET_KEY=y
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index b3fea0722ff1..773f86676588 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -2,6 +2,7 @@
2 2
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += hash.h 4generic-y += hash.h
5generic-y += irq_work.h
5generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
6generic-y += preempt.h 7generic-y += preempt.h
7generic-y += scatterlist.h 8generic-y += scatterlist.h
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
index 2fcccc0c997c..c81661e756a0 100644
--- a/arch/s390/include/asm/ipl.h
+++ b/arch/s390/include/asm/ipl.h
@@ -17,12 +17,12 @@
17#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ 17#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
18 sizeof(struct ipl_block_fcp)) 18 sizeof(struct ipl_block_fcp))
19 19
20#define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 8) 20#define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 16)
21 21
22#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ 22#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \
23 sizeof(struct ipl_block_ccw)) 23 sizeof(struct ipl_block_ccw))
24 24
25#define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 8) 25#define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 16)
26 26
27#define IPL_MAX_SUPPORTED_VERSION (0) 27#define IPL_MAX_SUPPORTED_VERSION (0)
28 28
@@ -38,10 +38,11 @@ struct ipl_list_hdr {
38 u8 pbt; 38 u8 pbt;
39 u8 flags; 39 u8 flags;
40 u16 reserved2; 40 u16 reserved2;
41 u8 loadparm[8];
41} __attribute__((packed)); 42} __attribute__((packed));
42 43
43struct ipl_block_fcp { 44struct ipl_block_fcp {
44 u8 reserved1[313-1]; 45 u8 reserved1[305-1];
45 u8 opt; 46 u8 opt;
46 u8 reserved2[3]; 47 u8 reserved2[3];
47 u16 reserved3; 48 u16 reserved3;
@@ -62,7 +63,6 @@ struct ipl_block_fcp {
62 offsetof(struct ipl_block_fcp, scp_data))) 63 offsetof(struct ipl_block_fcp, scp_data)))
63 64
64struct ipl_block_ccw { 65struct ipl_block_ccw {
65 u8 load_parm[8];
66 u8 reserved1[84]; 66 u8 reserved1[84];
67 u8 reserved2[2]; 67 u8 reserved2[2];
68 u16 devno; 68 u16 devno;
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index 773bef7614d8..2175f911a73a 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -13,8 +13,11 @@
13 13
14#ifndef ASM_KVM_HOST_H 14#ifndef ASM_KVM_HOST_H
15#define ASM_KVM_HOST_H 15#define ASM_KVM_HOST_H
16
17#include <linux/types.h>
16#include <linux/hrtimer.h> 18#include <linux/hrtimer.h>
17#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/kvm_types.h>
18#include <linux/kvm_host.h> 21#include <linux/kvm_host.h>
19#include <linux/kvm.h> 22#include <linux/kvm.h>
20#include <asm/debug.h> 23#include <asm/debug.h>
@@ -154,7 +157,9 @@ struct kvm_s390_sie_block {
154 __u8 armid; /* 0x00e3 */ 157 __u8 armid; /* 0x00e3 */
155 __u8 reservede4[4]; /* 0x00e4 */ 158 __u8 reservede4[4]; /* 0x00e4 */
156 __u64 tecmc; /* 0x00e8 */ 159 __u64 tecmc; /* 0x00e8 */
157 __u8 reservedf0[16]; /* 0x00f0 */ 160 __u8 reservedf0[12]; /* 0x00f0 */
161#define CRYCB_FORMAT1 0x00000001
162 __u32 crycbd; /* 0x00fc */
158 __u64 gcr[16]; /* 0x0100 */ 163 __u64 gcr[16]; /* 0x0100 */
159 __u64 gbea; /* 0x0180 */ 164 __u64 gbea; /* 0x0180 */
160 __u8 reserved188[24]; /* 0x0188 */ 165 __u8 reserved188[24]; /* 0x0188 */
@@ -187,6 +192,7 @@ struct kvm_vcpu_stat {
187 u32 exit_stop_request; 192 u32 exit_stop_request;
188 u32 exit_validity; 193 u32 exit_validity;
189 u32 exit_instruction; 194 u32 exit_instruction;
195 u32 halt_wakeup;
190 u32 instruction_lctl; 196 u32 instruction_lctl;
191 u32 instruction_lctlg; 197 u32 instruction_lctlg;
192 u32 instruction_stctl; 198 u32 instruction_stctl;
@@ -407,6 +413,15 @@ struct s390_io_adapter {
407#define MAX_S390_IO_ADAPTERS ((MAX_ISC + 1) * 8) 413#define MAX_S390_IO_ADAPTERS ((MAX_ISC + 1) * 8)
408#define MAX_S390_ADAPTER_MAPS 256 414#define MAX_S390_ADAPTER_MAPS 256
409 415
416struct kvm_s390_crypto {
417 struct kvm_s390_crypto_cb *crycb;
418 __u32 crycbd;
419};
420
421struct kvm_s390_crypto_cb {
422 __u8 reserved00[128]; /* 0x0000 */
423};
424
410struct kvm_arch{ 425struct kvm_arch{
411 struct sca_block *sca; 426 struct sca_block *sca;
412 debug_info_t *dbf; 427 debug_info_t *dbf;
@@ -420,6 +435,7 @@ struct kvm_arch{
420 struct s390_io_adapter *adapters[MAX_S390_IO_ADAPTERS]; 435 struct s390_io_adapter *adapters[MAX_S390_IO_ADAPTERS];
421 wait_queue_head_t ipte_wq; 436 wait_queue_head_t ipte_wq;
422 spinlock_t start_stop_lock; 437 spinlock_t start_stop_lock;
438 struct kvm_s390_crypto crypto;
423}; 439};
424 440
425#define KVM_HVA_ERR_BAD (-1UL) 441#define KVM_HVA_ERR_BAD (-1UL)
@@ -431,8 +447,6 @@ static inline bool kvm_is_error_hva(unsigned long addr)
431} 447}
432 448
433#define ASYNC_PF_PER_VCPU 64 449#define ASYNC_PF_PER_VCPU 64
434struct kvm_vcpu;
435struct kvm_async_pf;
436struct kvm_arch_async_pf { 450struct kvm_arch_async_pf {
437 unsigned long pfault_token; 451 unsigned long pfault_token;
438}; 452};
@@ -450,4 +464,18 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
450 464
451extern int sie64a(struct kvm_s390_sie_block *, u64 *); 465extern int sie64a(struct kvm_s390_sie_block *, u64 *);
452extern char sie_exit; 466extern char sie_exit;
467
468static inline void kvm_arch_hardware_disable(void) {}
469static inline void kvm_arch_check_processor_compat(void *rtn) {}
470static inline void kvm_arch_exit(void) {}
471static inline void kvm_arch_sync_events(struct kvm *kvm) {}
472static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {}
473static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
474static inline void kvm_arch_free_memslot(struct kvm *kvm,
475 struct kvm_memory_slot *free, struct kvm_memory_slot *dont) {}
476static inline void kvm_arch_memslots_updated(struct kvm *kvm) {}
477static inline void kvm_arch_flush_shadow_all(struct kvm *kvm) {}
478static inline void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
479 struct kvm_memory_slot *slot) {}
480
453#endif 481#endif
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index 9e18a61d3df3..d39a31c3cdf2 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -18,9 +18,9 @@
18unsigned long *crst_table_alloc(struct mm_struct *); 18unsigned long *crst_table_alloc(struct mm_struct *);
19void crst_table_free(struct mm_struct *, unsigned long *); 19void crst_table_free(struct mm_struct *, unsigned long *);
20 20
21unsigned long *page_table_alloc(struct mm_struct *, unsigned long); 21unsigned long *page_table_alloc(struct mm_struct *);
22void page_table_free(struct mm_struct *, unsigned long *); 22void page_table_free(struct mm_struct *, unsigned long *);
23void page_table_free_rcu(struct mmu_gather *, unsigned long *); 23void page_table_free_rcu(struct mmu_gather *, unsigned long *, unsigned long);
24 24
25void page_table_reset_pgste(struct mm_struct *, unsigned long, unsigned long, 25void page_table_reset_pgste(struct mm_struct *, unsigned long, unsigned long,
26 bool init_skey); 26 bool init_skey);
@@ -145,8 +145,8 @@ static inline void pmd_populate(struct mm_struct *mm,
145/* 145/*
146 * page table entry allocation/free routines. 146 * page table entry allocation/free routines.
147 */ 147 */
148#define pte_alloc_one_kernel(mm, vmaddr) ((pte_t *) page_table_alloc(mm, vmaddr)) 148#define pte_alloc_one_kernel(mm, vmaddr) ((pte_t *) page_table_alloc(mm))
149#define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm, vmaddr)) 149#define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm))
150 150
151#define pte_free_kernel(mm, pte) page_table_free(mm, (unsigned long *) pte) 151#define pte_free_kernel(mm, pte) page_table_free(mm, (unsigned long *) pte)
152#define pte_free(mm, pte) page_table_free(mm, (unsigned long *) pte) 152#define pte_free(mm, pte) page_table_free(mm, (unsigned long *) pte)
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index b76317c1f3eb..b7054356cc98 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -30,6 +30,7 @@
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/mm_types.h> 31#include <linux/mm_types.h>
32#include <linux/page-flags.h> 32#include <linux/page-flags.h>
33#include <linux/radix-tree.h>
33#include <asm/bug.h> 34#include <asm/bug.h>
34#include <asm/page.h> 35#include <asm/page.h>
35 36
@@ -789,82 +790,67 @@ static inline pgste_t pgste_set_pte(pte_t *ptep, pgste_t pgste, pte_t entry)
789 790
790/** 791/**
791 * struct gmap_struct - guest address space 792 * struct gmap_struct - guest address space
793 * @crst_list: list of all crst tables used in the guest address space
792 * @mm: pointer to the parent mm_struct 794 * @mm: pointer to the parent mm_struct
795 * @guest_to_host: radix tree with guest to host address translation
796 * @host_to_guest: radix tree with pointer to segment table entries
797 * @guest_table_lock: spinlock to protect all entries in the guest page table
793 * @table: pointer to the page directory 798 * @table: pointer to the page directory
794 * @asce: address space control element for gmap page table 799 * @asce: address space control element for gmap page table
795 * @crst_list: list of all crst tables used in the guest address space
796 * @pfault_enabled: defines if pfaults are applicable for the guest 800 * @pfault_enabled: defines if pfaults are applicable for the guest
797 */ 801 */
798struct gmap { 802struct gmap {
799 struct list_head list; 803 struct list_head list;
804 struct list_head crst_list;
800 struct mm_struct *mm; 805 struct mm_struct *mm;
806 struct radix_tree_root guest_to_host;
807 struct radix_tree_root host_to_guest;
808 spinlock_t guest_table_lock;
801 unsigned long *table; 809 unsigned long *table;
802 unsigned long asce; 810 unsigned long asce;
811 unsigned long asce_end;
803 void *private; 812 void *private;
804 struct list_head crst_list;
805 bool pfault_enabled; 813 bool pfault_enabled;
806}; 814};
807 815
808/** 816/**
809 * struct gmap_rmap - reverse mapping for segment table entries
810 * @gmap: pointer to the gmap_struct
811 * @entry: pointer to a segment table entry
812 * @vmaddr: virtual address in the guest address space
813 */
814struct gmap_rmap {
815 struct list_head list;
816 struct gmap *gmap;
817 unsigned long *entry;
818 unsigned long vmaddr;
819};
820
821/**
822 * struct gmap_pgtable - gmap information attached to a page table
823 * @vmaddr: address of the 1MB segment in the process virtual memory
824 * @mapper: list of segment table entries mapping a page table
825 */
826struct gmap_pgtable {
827 unsigned long vmaddr;
828 struct list_head mapper;
829};
830
831/**
832 * struct gmap_notifier - notify function block for page invalidation 817 * struct gmap_notifier - notify function block for page invalidation
833 * @notifier_call: address of callback function 818 * @notifier_call: address of callback function
834 */ 819 */
835struct gmap_notifier { 820struct gmap_notifier {
836 struct list_head list; 821 struct list_head list;
837 void (*notifier_call)(struct gmap *gmap, unsigned long address); 822 void (*notifier_call)(struct gmap *gmap, unsigned long gaddr);
838}; 823};
839 824
840struct gmap *gmap_alloc(struct mm_struct *mm); 825struct gmap *gmap_alloc(struct mm_struct *mm, unsigned long limit);
841void gmap_free(struct gmap *gmap); 826void gmap_free(struct gmap *gmap);
842void gmap_enable(struct gmap *gmap); 827void gmap_enable(struct gmap *gmap);
843void gmap_disable(struct gmap *gmap); 828void gmap_disable(struct gmap *gmap);
844int gmap_map_segment(struct gmap *gmap, unsigned long from, 829int gmap_map_segment(struct gmap *gmap, unsigned long from,
845 unsigned long to, unsigned long len); 830 unsigned long to, unsigned long len);
846int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len); 831int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len);
847unsigned long __gmap_translate(unsigned long address, struct gmap *); 832unsigned long __gmap_translate(struct gmap *, unsigned long gaddr);
848unsigned long gmap_translate(unsigned long address, struct gmap *); 833unsigned long gmap_translate(struct gmap *, unsigned long gaddr);
849unsigned long __gmap_fault(unsigned long address, struct gmap *); 834int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr);
850unsigned long gmap_fault(unsigned long address, struct gmap *); 835int gmap_fault(struct gmap *, unsigned long gaddr, unsigned int fault_flags);
851void gmap_discard(unsigned long from, unsigned long to, struct gmap *); 836void gmap_discard(struct gmap *, unsigned long from, unsigned long to);
852void __gmap_zap(unsigned long address, struct gmap *); 837void __gmap_zap(struct gmap *, unsigned long gaddr);
853bool gmap_test_and_clear_dirty(unsigned long address, struct gmap *); 838bool gmap_test_and_clear_dirty(unsigned long address, struct gmap *);
854 839
855 840
856void gmap_register_ipte_notifier(struct gmap_notifier *); 841void gmap_register_ipte_notifier(struct gmap_notifier *);
857void gmap_unregister_ipte_notifier(struct gmap_notifier *); 842void gmap_unregister_ipte_notifier(struct gmap_notifier *);
858int gmap_ipte_notify(struct gmap *, unsigned long start, unsigned long len); 843int gmap_ipte_notify(struct gmap *, unsigned long start, unsigned long len);
859void gmap_do_ipte_notify(struct mm_struct *, pte_t *); 844void gmap_do_ipte_notify(struct mm_struct *, unsigned long addr, pte_t *);
860 845
861static inline pgste_t pgste_ipte_notify(struct mm_struct *mm, 846static inline pgste_t pgste_ipte_notify(struct mm_struct *mm,
847 unsigned long addr,
862 pte_t *ptep, pgste_t pgste) 848 pte_t *ptep, pgste_t pgste)
863{ 849{
864#ifdef CONFIG_PGSTE 850#ifdef CONFIG_PGSTE
865 if (pgste_val(pgste) & PGSTE_IN_BIT) { 851 if (pgste_val(pgste) & PGSTE_IN_BIT) {
866 pgste_val(pgste) &= ~PGSTE_IN_BIT; 852 pgste_val(pgste) &= ~PGSTE_IN_BIT;
867 gmap_do_ipte_notify(mm, ptep); 853 gmap_do_ipte_notify(mm, addr, ptep);
868 } 854 }
869#endif 855#endif
870 return pgste; 856 return pgste;
@@ -1110,7 +1096,7 @@ static inline int ptep_test_and_clear_user_dirty(struct mm_struct *mm,
1110 pgste_val(pgste) &= ~PGSTE_UC_BIT; 1096 pgste_val(pgste) &= ~PGSTE_UC_BIT;
1111 pte = *ptep; 1097 pte = *ptep;
1112 if (dirty && (pte_val(pte) & _PAGE_PRESENT)) { 1098 if (dirty && (pte_val(pte) & _PAGE_PRESENT)) {
1113 pgste = pgste_ipte_notify(mm, ptep, pgste); 1099 pgste = pgste_ipte_notify(mm, addr, ptep, pgste);
1114 __ptep_ipte(addr, ptep); 1100 __ptep_ipte(addr, ptep);
1115 if (MACHINE_HAS_ESOP || !(pte_val(pte) & _PAGE_WRITE)) 1101 if (MACHINE_HAS_ESOP || !(pte_val(pte) & _PAGE_WRITE))
1116 pte_val(pte) |= _PAGE_PROTECT; 1102 pte_val(pte) |= _PAGE_PROTECT;
@@ -1127,20 +1113,21 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
1127 unsigned long addr, pte_t *ptep) 1113 unsigned long addr, pte_t *ptep)
1128{ 1114{
1129 pgste_t pgste; 1115 pgste_t pgste;
1130 pte_t pte; 1116 pte_t pte, oldpte;
1131 int young; 1117 int young;
1132 1118
1133 if (mm_has_pgste(vma->vm_mm)) { 1119 if (mm_has_pgste(vma->vm_mm)) {
1134 pgste = pgste_get_lock(ptep); 1120 pgste = pgste_get_lock(ptep);
1135 pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste); 1121 pgste = pgste_ipte_notify(vma->vm_mm, addr, ptep, pgste);
1136 } 1122 }
1137 1123
1138 pte = *ptep; 1124 oldpte = pte = *ptep;
1139 ptep_flush_direct(vma->vm_mm, addr, ptep); 1125 ptep_flush_direct(vma->vm_mm, addr, ptep);
1140 young = pte_young(pte); 1126 young = pte_young(pte);
1141 pte = pte_mkold(pte); 1127 pte = pte_mkold(pte);
1142 1128
1143 if (mm_has_pgste(vma->vm_mm)) { 1129 if (mm_has_pgste(vma->vm_mm)) {
1130 pgste = pgste_update_all(&oldpte, pgste, vma->vm_mm);
1144 pgste = pgste_set_pte(ptep, pgste, pte); 1131 pgste = pgste_set_pte(ptep, pgste, pte);
1145 pgste_set_unlock(ptep, pgste); 1132 pgste_set_unlock(ptep, pgste);
1146 } else 1133 } else
@@ -1178,7 +1165,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
1178 1165
1179 if (mm_has_pgste(mm)) { 1166 if (mm_has_pgste(mm)) {
1180 pgste = pgste_get_lock(ptep); 1167 pgste = pgste_get_lock(ptep);
1181 pgste = pgste_ipte_notify(mm, ptep, pgste); 1168 pgste = pgste_ipte_notify(mm, address, ptep, pgste);
1182 } 1169 }
1183 1170
1184 pte = *ptep; 1171 pte = *ptep;
@@ -1202,7 +1189,7 @@ static inline pte_t ptep_modify_prot_start(struct mm_struct *mm,
1202 1189
1203 if (mm_has_pgste(mm)) { 1190 if (mm_has_pgste(mm)) {
1204 pgste = pgste_get_lock(ptep); 1191 pgste = pgste_get_lock(ptep);
1205 pgste_ipte_notify(mm, ptep, pgste); 1192 pgste_ipte_notify(mm, address, ptep, pgste);
1206 } 1193 }
1207 1194
1208 pte = *ptep; 1195 pte = *ptep;
@@ -1239,7 +1226,7 @@ static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
1239 1226
1240 if (mm_has_pgste(vma->vm_mm)) { 1227 if (mm_has_pgste(vma->vm_mm)) {
1241 pgste = pgste_get_lock(ptep); 1228 pgste = pgste_get_lock(ptep);
1242 pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste); 1229 pgste = pgste_ipte_notify(vma->vm_mm, address, ptep, pgste);
1243 } 1230 }
1244 1231
1245 pte = *ptep; 1232 pte = *ptep;
@@ -1273,7 +1260,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
1273 1260
1274 if (!full && mm_has_pgste(mm)) { 1261 if (!full && mm_has_pgste(mm)) {
1275 pgste = pgste_get_lock(ptep); 1262 pgste = pgste_get_lock(ptep);
1276 pgste = pgste_ipte_notify(mm, ptep, pgste); 1263 pgste = pgste_ipte_notify(mm, address, ptep, pgste);
1277 } 1264 }
1278 1265
1279 pte = *ptep; 1266 pte = *ptep;
@@ -1298,7 +1285,7 @@ static inline pte_t ptep_set_wrprotect(struct mm_struct *mm,
1298 if (pte_write(pte)) { 1285 if (pte_write(pte)) {
1299 if (mm_has_pgste(mm)) { 1286 if (mm_has_pgste(mm)) {
1300 pgste = pgste_get_lock(ptep); 1287 pgste = pgste_get_lock(ptep);
1301 pgste = pgste_ipte_notify(mm, ptep, pgste); 1288 pgste = pgste_ipte_notify(mm, address, ptep, pgste);
1302 } 1289 }
1303 1290
1304 ptep_flush_lazy(mm, address, ptep); 1291 ptep_flush_lazy(mm, address, ptep);
@@ -1324,12 +1311,13 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
1324 return 0; 1311 return 0;
1325 if (mm_has_pgste(vma->vm_mm)) { 1312 if (mm_has_pgste(vma->vm_mm)) {
1326 pgste = pgste_get_lock(ptep); 1313 pgste = pgste_get_lock(ptep);
1327 pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste); 1314 pgste = pgste_ipte_notify(vma->vm_mm, address, ptep, pgste);
1328 } 1315 }
1329 1316
1330 ptep_flush_direct(vma->vm_mm, address, ptep); 1317 ptep_flush_direct(vma->vm_mm, address, ptep);
1331 1318
1332 if (mm_has_pgste(vma->vm_mm)) { 1319 if (mm_has_pgste(vma->vm_mm)) {
1320 pgste_set_key(ptep, pgste, entry, vma->vm_mm);
1333 pgste = pgste_set_pte(ptep, pgste, entry); 1321 pgste = pgste_set_pte(ptep, pgste, entry);
1334 pgste_set_unlock(ptep, pgste); 1322 pgste_set_unlock(ptep, pgste);
1335 } else 1323 } else
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index a25f09fbaf36..572c59949004 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -105,7 +105,7 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
105static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, 105static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
106 unsigned long address) 106 unsigned long address)
107{ 107{
108 page_table_free_rcu(tlb, (unsigned long *) pte); 108 page_table_free_rcu(tlb, (unsigned long *) pte, address);
109} 109}
110 110
111/* 111/*
diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h
index 0fc26430a1e5..48eda3ab4944 100644
--- a/arch/s390/include/uapi/asm/kvm.h
+++ b/arch/s390/include/uapi/asm/kvm.h
@@ -111,12 +111,22 @@ struct kvm_guest_debug_arch {
111#define KVM_SYNC_GPRS (1UL << 1) 111#define KVM_SYNC_GPRS (1UL << 1)
112#define KVM_SYNC_ACRS (1UL << 2) 112#define KVM_SYNC_ACRS (1UL << 2)
113#define KVM_SYNC_CRS (1UL << 3) 113#define KVM_SYNC_CRS (1UL << 3)
114#define KVM_SYNC_ARCH0 (1UL << 4)
115#define KVM_SYNC_PFAULT (1UL << 5)
114/* definition of registers in kvm_run */ 116/* definition of registers in kvm_run */
115struct kvm_sync_regs { 117struct kvm_sync_regs {
116 __u64 prefix; /* prefix register */ 118 __u64 prefix; /* prefix register */
117 __u64 gprs[16]; /* general purpose registers */ 119 __u64 gprs[16]; /* general purpose registers */
118 __u32 acrs[16]; /* access registers */ 120 __u32 acrs[16]; /* access registers */
119 __u64 crs[16]; /* control registers */ 121 __u64 crs[16]; /* control registers */
122 __u64 todpr; /* tod programmable register [ARCH0] */
123 __u64 cputm; /* cpu timer [ARCH0] */
124 __u64 ckc; /* clock comparator [ARCH0] */
125 __u64 pp; /* program parameter [ARCH0] */
126 __u64 gbea; /* guest breaking-event address [ARCH0] */
127 __u64 pft; /* pfault token [PFAULT] */
128 __u64 pfs; /* pfault select [PFAULT] */
129 __u64 pfc; /* pfault compare [PFAULT] */
120}; 130};
121 131
122#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1) 132#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h
index 3802d2d3a18d..940ac49198db 100644
--- a/arch/s390/include/uapi/asm/unistd.h
+++ b/arch/s390/include/uapi/asm/unistd.h
@@ -283,7 +283,10 @@
283#define __NR_sched_setattr 345 283#define __NR_sched_setattr 345
284#define __NR_sched_getattr 346 284#define __NR_sched_getattr 346
285#define __NR_renameat2 347 285#define __NR_renameat2 347
286#define NR_syscalls 348 286#define __NR_seccomp 348
287#define __NR_getrandom 349
288#define __NR_memfd_create 350
289#define NR_syscalls 351
287 290
288/* 291/*
289 * There are some system calls that are not present on 64 bit, some 292 * There are some system calls that are not present on 64 bit, some
diff --git a/arch/s390/kernel/compat_wrapper.c b/arch/s390/kernel/compat_wrapper.c
index 45cdb37aa6f8..faf6caa510dc 100644
--- a/arch/s390/kernel/compat_wrapper.c
+++ b/arch/s390/kernel/compat_wrapper.c
@@ -214,3 +214,6 @@ COMPAT_SYSCALL_WRAP3(finit_module, int, fd, const char __user *, uargs, int, fla
214COMPAT_SYSCALL_WRAP3(sched_setattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, flags); 214COMPAT_SYSCALL_WRAP3(sched_setattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, flags);
215COMPAT_SYSCALL_WRAP4(sched_getattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, size, unsigned int, flags); 215COMPAT_SYSCALL_WRAP4(sched_getattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, size, unsigned int, flags);
216COMPAT_SYSCALL_WRAP5(renameat2, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, unsigned int, flags); 216COMPAT_SYSCALL_WRAP5(renameat2, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, unsigned int, flags);
217COMPAT_SYSCALL_WRAP3(seccomp, unsigned int, op, unsigned int, flags, const char __user *, uargs)
218COMPAT_SYSCALL_WRAP3(getrandom, char __user *, buf, size_t, count, unsigned int, flags)
219COMPAT_SYSCALL_WRAP2(memfd_create, const char __user *, uname, unsigned int, flags)
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 633ca7504536..39badb9ca0b3 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -455,22 +455,6 @@ DEFINE_IPL_ATTR_RO(ipl_fcp, bootprog, "%lld\n", (unsigned long long)
455DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long) 455DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long)
456 IPL_PARMBLOCK_START->ipl_info.fcp.br_lba); 456 IPL_PARMBLOCK_START->ipl_info.fcp.br_lba);
457 457
458static struct attribute *ipl_fcp_attrs[] = {
459 &sys_ipl_type_attr.attr,
460 &sys_ipl_device_attr.attr,
461 &sys_ipl_fcp_wwpn_attr.attr,
462 &sys_ipl_fcp_lun_attr.attr,
463 &sys_ipl_fcp_bootprog_attr.attr,
464 &sys_ipl_fcp_br_lba_attr.attr,
465 NULL,
466};
467
468static struct attribute_group ipl_fcp_attr_group = {
469 .attrs = ipl_fcp_attrs,
470};
471
472/* CCW ipl device attributes */
473
474static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, 458static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj,
475 struct kobj_attribute *attr, char *page) 459 struct kobj_attribute *attr, char *page)
476{ 460{
@@ -487,6 +471,23 @@ static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj,
487static struct kobj_attribute sys_ipl_ccw_loadparm_attr = 471static struct kobj_attribute sys_ipl_ccw_loadparm_attr =
488 __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL); 472 __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL);
489 473
474static struct attribute *ipl_fcp_attrs[] = {
475 &sys_ipl_type_attr.attr,
476 &sys_ipl_device_attr.attr,
477 &sys_ipl_fcp_wwpn_attr.attr,
478 &sys_ipl_fcp_lun_attr.attr,
479 &sys_ipl_fcp_bootprog_attr.attr,
480 &sys_ipl_fcp_br_lba_attr.attr,
481 &sys_ipl_ccw_loadparm_attr.attr,
482 NULL,
483};
484
485static struct attribute_group ipl_fcp_attr_group = {
486 .attrs = ipl_fcp_attrs,
487};
488
489/* CCW ipl device attributes */
490
490static struct attribute *ipl_ccw_attrs_vm[] = { 491static struct attribute *ipl_ccw_attrs_vm[] = {
491 &sys_ipl_type_attr.attr, 492 &sys_ipl_type_attr.attr,
492 &sys_ipl_device_attr.attr, 493 &sys_ipl_device_attr.attr,
@@ -765,28 +766,10 @@ DEFINE_IPL_ATTR_RW(reipl_fcp, br_lba, "%lld\n", "%lld\n",
765DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n", 766DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n",
766 reipl_block_fcp->ipl_info.fcp.devno); 767 reipl_block_fcp->ipl_info.fcp.devno);
767 768
768static struct attribute *reipl_fcp_attrs[] = {
769 &sys_reipl_fcp_device_attr.attr,
770 &sys_reipl_fcp_wwpn_attr.attr,
771 &sys_reipl_fcp_lun_attr.attr,
772 &sys_reipl_fcp_bootprog_attr.attr,
773 &sys_reipl_fcp_br_lba_attr.attr,
774 NULL,
775};
776
777static struct attribute_group reipl_fcp_attr_group = {
778 .attrs = reipl_fcp_attrs,
779};
780
781/* CCW reipl device attributes */
782
783DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
784 reipl_block_ccw->ipl_info.ccw.devno);
785
786static void reipl_get_ascii_loadparm(char *loadparm, 769static void reipl_get_ascii_loadparm(char *loadparm,
787 struct ipl_parameter_block *ibp) 770 struct ipl_parameter_block *ibp)
788{ 771{
789 memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN); 772 memcpy(loadparm, ibp->hdr.loadparm, LOADPARM_LEN);
790 EBCASC(loadparm, LOADPARM_LEN); 773 EBCASC(loadparm, LOADPARM_LEN);
791 loadparm[LOADPARM_LEN] = 0; 774 loadparm[LOADPARM_LEN] = 0;
792 strim(loadparm); 775 strim(loadparm);
@@ -821,13 +804,50 @@ static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb,
821 return -EINVAL; 804 return -EINVAL;
822 } 805 }
823 /* initialize loadparm with blanks */ 806 /* initialize loadparm with blanks */
824 memset(ipb->ipl_info.ccw.load_parm, ' ', LOADPARM_LEN); 807 memset(ipb->hdr.loadparm, ' ', LOADPARM_LEN);
825 /* copy and convert to ebcdic */ 808 /* copy and convert to ebcdic */
826 memcpy(ipb->ipl_info.ccw.load_parm, buf, lp_len); 809 memcpy(ipb->hdr.loadparm, buf, lp_len);
827 ASCEBC(ipb->ipl_info.ccw.load_parm, LOADPARM_LEN); 810 ASCEBC(ipb->hdr.loadparm, LOADPARM_LEN);
828 return len; 811 return len;
829} 812}
830 813
814/* FCP wrapper */
815static ssize_t reipl_fcp_loadparm_show(struct kobject *kobj,
816 struct kobj_attribute *attr, char *page)
817{
818 return reipl_generic_loadparm_show(reipl_block_fcp, page);
819}
820
821static ssize_t reipl_fcp_loadparm_store(struct kobject *kobj,
822 struct kobj_attribute *attr,
823 const char *buf, size_t len)
824{
825 return reipl_generic_loadparm_store(reipl_block_fcp, buf, len);
826}
827
828static struct kobj_attribute sys_reipl_fcp_loadparm_attr =
829 __ATTR(loadparm, S_IRUGO | S_IWUSR, reipl_fcp_loadparm_show,
830 reipl_fcp_loadparm_store);
831
832static struct attribute *reipl_fcp_attrs[] = {
833 &sys_reipl_fcp_device_attr.attr,
834 &sys_reipl_fcp_wwpn_attr.attr,
835 &sys_reipl_fcp_lun_attr.attr,
836 &sys_reipl_fcp_bootprog_attr.attr,
837 &sys_reipl_fcp_br_lba_attr.attr,
838 &sys_reipl_fcp_loadparm_attr.attr,
839 NULL,
840};
841
842static struct attribute_group reipl_fcp_attr_group = {
843 .attrs = reipl_fcp_attrs,
844};
845
846/* CCW reipl device attributes */
847
848DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
849 reipl_block_ccw->ipl_info.ccw.devno);
850
831/* NSS wrapper */ 851/* NSS wrapper */
832static ssize_t reipl_nss_loadparm_show(struct kobject *kobj, 852static ssize_t reipl_nss_loadparm_show(struct kobject *kobj,
833 struct kobj_attribute *attr, char *page) 853 struct kobj_attribute *attr, char *page)
@@ -1125,11 +1145,10 @@ static void reipl_block_ccw_fill_parms(struct ipl_parameter_block *ipb)
1125 /* LOADPARM */ 1145 /* LOADPARM */
1126 /* check if read scp info worked and set loadparm */ 1146 /* check if read scp info worked and set loadparm */
1127 if (sclp_ipl_info.is_valid) 1147 if (sclp_ipl_info.is_valid)
1128 memcpy(ipb->ipl_info.ccw.load_parm, 1148 memcpy(ipb->hdr.loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN);
1129 &sclp_ipl_info.loadparm, LOADPARM_LEN);
1130 else 1149 else
1131 /* read scp info failed: set empty loadparm (EBCDIC blanks) */ 1150 /* read scp info failed: set empty loadparm (EBCDIC blanks) */
1132 memset(ipb->ipl_info.ccw.load_parm, 0x40, LOADPARM_LEN); 1151 memset(ipb->hdr.loadparm, 0x40, LOADPARM_LEN);
1133 ipb->hdr.flags = DIAG308_FLAGS_LP_VALID; 1152 ipb->hdr.flags = DIAG308_FLAGS_LP_VALID;
1134 1153
1135 /* VM PARM */ 1154 /* VM PARM */
@@ -1251,9 +1270,16 @@ static int __init reipl_fcp_init(void)
1251 return rc; 1270 return rc;
1252 } 1271 }
1253 1272
1254 if (ipl_info.type == IPL_TYPE_FCP) 1273 if (ipl_info.type == IPL_TYPE_FCP) {
1255 memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE); 1274 memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE);
1256 else { 1275 /*
1276 * Fix loadparm: There are systems where the (SCSI) LOADPARM
1277 * is invalid in the SCSI IPL parameter block, so take it
1278 * always from sclp_ipl_info.
1279 */
1280 memcpy(reipl_block_fcp->hdr.loadparm, sclp_ipl_info.loadparm,
1281 LOADPARM_LEN);
1282 } else {
1257 reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; 1283 reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN;
1258 reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; 1284 reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION;
1259 reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; 1285 reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN;
@@ -1864,7 +1890,23 @@ static void __init shutdown_actions_init(void)
1864 1890
1865static int __init s390_ipl_init(void) 1891static int __init s390_ipl_init(void)
1866{ 1892{
1893 char str[8] = {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40};
1894
1867 sclp_get_ipl_info(&sclp_ipl_info); 1895 sclp_get_ipl_info(&sclp_ipl_info);
1896 /*
1897 * Fix loadparm: There are systems where the (SCSI) LOADPARM
1898 * returned by read SCP info is invalid (contains EBCDIC blanks)
1899 * when the system has been booted via diag308. In that case we use
1900 * the value from diag308, if available.
1901 *
1902 * There are also systems where diag308 store does not work in
1903 * case the system is booted from HMC. Fortunately in this case
1904 * READ SCP info provides the correct value.
1905 */
1906 if (memcmp(sclp_ipl_info.loadparm, str, sizeof(str)) == 0 &&
1907 diag308_set_works)
1908 memcpy(sclp_ipl_info.loadparm, ipl_block.hdr.loadparm,
1909 LOADPARM_LEN);
1868 shutdown_actions_init(); 1910 shutdown_actions_init();
1869 shutdown_triggers_init(); 1911 shutdown_triggers_init();
1870 return 0; 1912 return 0;
@@ -2060,6 +2102,13 @@ void s390_reset_system(void (*func)(void *), void *data)
2060 S390_lowcore.program_new_psw.addr = 2102 S390_lowcore.program_new_psw.addr =
2061 PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler; 2103 PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler;
2062 2104
2105 /*
2106 * Clear subchannel ID and number to signal new kernel that no CCW or
2107 * SCSI IPL has been done (for kexec and kdump)
2108 */
2109 S390_lowcore.subchannel_id = 0;
2110 S390_lowcore.subchannel_nr = 0;
2111
2063 /* Store status at absolute zero */ 2112 /* Store status at absolute zero */
2064 store_status(); 2113 store_status();
2065 2114
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index ae1d5be7dd88..82bc113e8c1d 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -24,6 +24,7 @@
24#include <linux/stddef.h> 24#include <linux/stddef.h>
25#include <linux/unistd.h> 25#include <linux/unistd.h>
26#include <linux/ptrace.h> 26#include <linux/ptrace.h>
27#include <linux/random.h>
27#include <linux/user.h> 28#include <linux/user.h>
28#include <linux/tty.h> 29#include <linux/tty.h>
29#include <linux/ioport.h> 30#include <linux/ioport.h>
@@ -61,6 +62,7 @@
61#include <asm/diag.h> 62#include <asm/diag.h>
62#include <asm/os_info.h> 63#include <asm/os_info.h>
63#include <asm/sclp.h> 64#include <asm/sclp.h>
65#include <asm/sysinfo.h>
64#include "entry.h" 66#include "entry.h"
65 67
66/* 68/*
@@ -766,6 +768,7 @@ static void __init setup_hwcaps(void)
766#endif 768#endif
767 769
768 get_cpu_id(&cpu_id); 770 get_cpu_id(&cpu_id);
771 add_device_randomness(&cpu_id, sizeof(cpu_id));
769 switch (cpu_id.machine) { 772 switch (cpu_id.machine) {
770 case 0x9672: 773 case 0x9672:
771#if !defined(CONFIG_64BIT) 774#if !defined(CONFIG_64BIT)
@@ -804,6 +807,19 @@ static void __init setup_hwcaps(void)
804} 807}
805 808
806/* 809/*
810 * Add system information as device randomness
811 */
812static void __init setup_randomness(void)
813{
814 struct sysinfo_3_2_2 *vmms;
815
816 vmms = (struct sysinfo_3_2_2 *) alloc_page(GFP_KERNEL);
817 if (vmms && stsi(vmms, 3, 2, 2) == 0 && vmms->count)
818 add_device_randomness(&vmms, vmms->count);
819 free_page((unsigned long) vmms);
820}
821
822/*
807 * Setup function called from init/main.c just after the banner 823 * Setup function called from init/main.c just after the banner
808 * was printed. 824 * was printed.
809 */ 825 */
@@ -901,6 +917,9 @@ void __init setup_arch(char **cmdline_p)
901 917
902 /* Setup zfcpdump support */ 918 /* Setup zfcpdump support */
903 setup_zfcpdump(); 919 setup_zfcpdump();
920
921 /* Add system specific data to the random pool */
922 setup_randomness();
904} 923}
905 924
906#ifdef CONFIG_32BIT 925#ifdef CONFIG_32BIT
diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
index a7a7537ce1e7..1c4c5accd220 100644
--- a/arch/s390/kernel/suspend.c
+++ b/arch/s390/kernel/suspend.c
@@ -13,14 +13,10 @@
13#include <asm/ipl.h> 13#include <asm/ipl.h>
14#include <asm/cio.h> 14#include <asm/cio.h>
15#include <asm/pci.h> 15#include <asm/pci.h>
16#include <asm/sections.h>
16#include "entry.h" 17#include "entry.h"
17 18
18/* 19/*
19 * References to section boundaries
20 */
21extern const void __nosave_begin, __nosave_end;
22
23/*
24 * The restore of the saved pages in an hibernation image will set 20 * The restore of the saved pages in an hibernation image will set
25 * the change and referenced bits in the storage key for each page. 21 * the change and referenced bits in the storage key for each page.
26 * Overindication of the referenced bits after an hibernation cycle 22 * Overindication of the referenced bits after an hibernation cycle
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index fe5cdf29a001..6fe886ac2db5 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -356,3 +356,6 @@ SYSCALL(sys_finit_module,sys_finit_module,compat_sys_finit_module)
356SYSCALL(sys_sched_setattr,sys_sched_setattr,compat_sys_sched_setattr) /* 345 */ 356SYSCALL(sys_sched_setattr,sys_sched_setattr,compat_sys_sched_setattr) /* 345 */
357SYSCALL(sys_sched_getattr,sys_sched_getattr,compat_sys_sched_getattr) 357SYSCALL(sys_sched_getattr,sys_sched_getattr,compat_sys_sched_getattr)
358SYSCALL(sys_renameat2,sys_renameat2,compat_sys_renameat2) 358SYSCALL(sys_renameat2,sys_renameat2,compat_sys_renameat2)
359SYSCALL(sys_seccomp,sys_seccomp,compat_sys_seccomp)
360SYSCALL(sys_getrandom,sys_getrandom,compat_sys_getrandom)
361SYSCALL(sys_memfd_create,sys_memfd_create,compat_sys_memfd_create) /* 350 */
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S
index 65fc3979c2f1..7cf18f8d4cb4 100644
--- a/arch/s390/kernel/vdso32/clock_gettime.S
+++ b/arch/s390/kernel/vdso32/clock_gettime.S
@@ -22,13 +22,11 @@ __kernel_clock_gettime:
22 basr %r5,0 22 basr %r5,0
230: al %r5,21f-0b(%r5) /* get &_vdso_data */ 230: al %r5,21f-0b(%r5) /* get &_vdso_data */
24 chi %r2,__CLOCK_REALTIME 24 chi %r2,__CLOCK_REALTIME
25 je 10f 25 je 11f
26 chi %r2,__CLOCK_MONOTONIC 26 chi %r2,__CLOCK_MONOTONIC
27 jne 19f 27 jne 19f
28 28
29 /* CLOCK_MONOTONIC */ 29 /* CLOCK_MONOTONIC */
30 ltr %r3,%r3
31 jz 9f /* tp == NULL */
321: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ 301: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
33 tml %r4,0x0001 /* pending update ? loop */ 31 tml %r4,0x0001 /* pending update ? loop */
34 jnz 1b 32 jnz 1b
@@ -67,12 +65,10 @@ __kernel_clock_gettime:
67 j 6b 65 j 6b
688: st %r2,0(%r3) /* store tp->tv_sec */ 668: st %r2,0(%r3) /* store tp->tv_sec */
69 st %r1,4(%r3) /* store tp->tv_nsec */ 67 st %r1,4(%r3) /* store tp->tv_nsec */
709: lhi %r2,0 68 lhi %r2,0
71 br %r14 69 br %r14
72 70
73 /* CLOCK_REALTIME */ 71 /* CLOCK_REALTIME */
7410: ltr %r3,%r3 /* tp == NULL */
75 jz 18f
7611: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ 7211: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
77 tml %r4,0x0001 /* pending update ? loop */ 73 tml %r4,0x0001 /* pending update ? loop */
78 jnz 11b 74 jnz 11b
@@ -111,7 +107,7 @@ __kernel_clock_gettime:
111 j 15b 107 j 15b
11217: st %r2,0(%r3) /* store tp->tv_sec */ 10817: st %r2,0(%r3) /* store tp->tv_sec */
113 st %r1,4(%r3) /* store tp->tv_nsec */ 109 st %r1,4(%r3) /* store tp->tv_nsec */
11418: lhi %r2,0 110 lhi %r2,0
115 br %r14 111 br %r14
116 112
117 /* Fallback to system call */ 113 /* Fallback to system call */
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S
index 91940ed33a4a..3f34e09db5f4 100644
--- a/arch/s390/kernel/vdso64/clock_gettime.S
+++ b/arch/s390/kernel/vdso64/clock_gettime.S
@@ -21,7 +21,7 @@ __kernel_clock_gettime:
21 .cfi_startproc 21 .cfi_startproc
22 larl %r5,_vdso_data 22 larl %r5,_vdso_data
23 cghi %r2,__CLOCK_REALTIME 23 cghi %r2,__CLOCK_REALTIME
24 je 4f 24 je 5f
25 cghi %r2,__CLOCK_THREAD_CPUTIME_ID 25 cghi %r2,__CLOCK_THREAD_CPUTIME_ID
26 je 9f 26 je 9f
27 cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */ 27 cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
@@ -30,8 +30,6 @@ __kernel_clock_gettime:
30 jne 12f 30 jne 12f
31 31
32 /* CLOCK_MONOTONIC */ 32 /* CLOCK_MONOTONIC */
33 ltgr %r3,%r3
34 jz 3f /* tp == NULL */
350: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ 330: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
36 tmll %r4,0x0001 /* pending update ? loop */ 34 tmll %r4,0x0001 /* pending update ? loop */
37 jnz 0b 35 jnz 0b
@@ -53,12 +51,10 @@ __kernel_clock_gettime:
53 j 1b 51 j 1b
542: stg %r0,0(%r3) /* store tp->tv_sec */ 522: stg %r0,0(%r3) /* store tp->tv_sec */
55 stg %r1,8(%r3) /* store tp->tv_nsec */ 53 stg %r1,8(%r3) /* store tp->tv_nsec */
563: lghi %r2,0 54 lghi %r2,0
57 br %r14 55 br %r14
58 56
59 /* CLOCK_REALTIME */ 57 /* CLOCK_REALTIME */
604: ltr %r3,%r3 /* tp == NULL */
61 jz 8f
625: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ 585: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
63 tmll %r4,0x0001 /* pending update ? loop */ 59 tmll %r4,0x0001 /* pending update ? loop */
64 jnz 5b 60 jnz 5b
@@ -80,7 +76,7 @@ __kernel_clock_gettime:
80 j 6b 76 j 6b
817: stg %r0,0(%r3) /* store tp->tv_sec */ 777: stg %r0,0(%r3) /* store tp->tv_sec */
82 stg %r1,8(%r3) /* store tp->tv_nsec */ 78 stg %r1,8(%r3) /* store tp->tv_nsec */
838: lghi %r2,0 79 lghi %r2,0
84 br %r14 80 br %r14
85 81
86 /* CLOCK_THREAD_CPUTIME_ID for this thread */ 82 /* CLOCK_THREAD_CPUTIME_ID for this thread */
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 59bd8f991b98..9254afff250c 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -28,22 +28,32 @@ static int diag_release_pages(struct kvm_vcpu *vcpu)
28 start = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4]; 28 start = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4];
29 end = vcpu->run->s.regs.gprs[vcpu->arch.sie_block->ipa & 0xf] + 4096; 29 end = vcpu->run->s.regs.gprs[vcpu->arch.sie_block->ipa & 0xf] + 4096;
30 30
31 if (start & ~PAGE_MASK || end & ~PAGE_MASK || start > end 31 if (start & ~PAGE_MASK || end & ~PAGE_MASK || start >= end
32 || start < 2 * PAGE_SIZE) 32 || start < 2 * PAGE_SIZE)
33 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 33 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
34 34
35 VCPU_EVENT(vcpu, 5, "diag release pages %lX %lX", start, end); 35 VCPU_EVENT(vcpu, 5, "diag release pages %lX %lX", start, end);
36 vcpu->stat.diagnose_10++; 36 vcpu->stat.diagnose_10++;
37 37
38 /* we checked for start > end above */ 38 /*
39 if (end < prefix || start >= prefix + 2 * PAGE_SIZE) { 39 * We checked for start >= end above, so lets check for the
40 gmap_discard(start, end, vcpu->arch.gmap); 40 * fast path (no prefix swap page involved)
41 */
42 if (end <= prefix || start >= prefix + 2 * PAGE_SIZE) {
43 gmap_discard(vcpu->arch.gmap, start, end);
41 } else { 44 } else {
42 if (start < prefix) 45 /*
43 gmap_discard(start, prefix, vcpu->arch.gmap); 46 * This is slow path. gmap_discard will check for start
44 if (end >= prefix) 47 * so lets split this into before prefix, prefix, after
45 gmap_discard(prefix + 2 * PAGE_SIZE, 48 * prefix and let gmap_discard make some of these calls
46 end, vcpu->arch.gmap); 49 * NOPs.
50 */
51 gmap_discard(vcpu->arch.gmap, start, prefix);
52 if (start <= prefix)
53 gmap_discard(vcpu->arch.gmap, 0, 4096);
54 if (end > prefix + 4096)
55 gmap_discard(vcpu->arch.gmap, 4096, 8192);
56 gmap_discard(vcpu->arch.gmap, prefix + 2 * PAGE_SIZE, end);
47 } 57 }
48 return 0; 58 return 0;
49} 59}
diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c
index 4653ac6e182b..0f961a1c64b3 100644
--- a/arch/s390/kvm/gaccess.c
+++ b/arch/s390/kvm/gaccess.c
@@ -254,8 +254,7 @@ static void ipte_unlock_simple(struct kvm_vcpu *vcpu)
254 new = old = ACCESS_ONCE(*ic); 254 new = old = ACCESS_ONCE(*ic);
255 new.k = 0; 255 new.k = 0;
256 } while (cmpxchg(&ic->val, old.val, new.val) != old.val); 256 } while (cmpxchg(&ic->val, old.val, new.val) != old.val);
257 if (!ipte_lock_count) 257 wake_up(&vcpu->kvm->arch.ipte_wq);
258 wake_up(&vcpu->kvm->arch.ipte_wq);
259out: 258out:
260 mutex_unlock(&ipte_mutex); 259 mutex_unlock(&ipte_mutex);
261} 260}
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index f4c819bfc193..a39838457f01 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -26,8 +26,9 @@
26#define IOINT_SSID_MASK 0x00030000 26#define IOINT_SSID_MASK 0x00030000
27#define IOINT_CSSID_MASK 0x03fc0000 27#define IOINT_CSSID_MASK 0x03fc0000
28#define IOINT_AI_MASK 0x04000000 28#define IOINT_AI_MASK 0x04000000
29#define PFAULT_INIT 0x0600
29 30
30static void deliver_ckc_interrupt(struct kvm_vcpu *vcpu); 31static int __must_check deliver_ckc_interrupt(struct kvm_vcpu *vcpu);
31 32
32static int is_ioint(u64 type) 33static int is_ioint(u64 type)
33{ 34{
@@ -76,7 +77,7 @@ static u64 int_word_to_isc_bits(u32 int_word)
76 return (0x80 >> isc) << 24; 77 return (0x80 >> isc) << 24;
77} 78}
78 79
79static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu, 80static int __must_check __interrupt_is_deliverable(struct kvm_vcpu *vcpu,
80 struct kvm_s390_interrupt_info *inti) 81 struct kvm_s390_interrupt_info *inti)
81{ 82{
82 switch (inti->type) { 83 switch (inti->type) {
@@ -85,6 +86,7 @@ static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu,
85 return 0; 86 return 0;
86 if (vcpu->arch.sie_block->gcr[0] & 0x2000ul) 87 if (vcpu->arch.sie_block->gcr[0] & 0x2000ul)
87 return 1; 88 return 1;
89 return 0;
88 case KVM_S390_INT_EMERGENCY: 90 case KVM_S390_INT_EMERGENCY:
89 if (psw_extint_disabled(vcpu)) 91 if (psw_extint_disabled(vcpu))
90 return 0; 92 return 0;
@@ -205,11 +207,30 @@ static void __set_intercept_indicator(struct kvm_vcpu *vcpu,
205 } 207 }
206} 208}
207 209
208static int __deliver_prog_irq(struct kvm_vcpu *vcpu, 210static u16 get_ilc(struct kvm_vcpu *vcpu)
209 struct kvm_s390_pgm_info *pgm_info)
210{ 211{
211 const unsigned short table[] = { 2, 4, 4, 6 }; 212 const unsigned short table[] = { 2, 4, 4, 6 };
213
214 switch (vcpu->arch.sie_block->icptcode) {
215 case ICPT_INST:
216 case ICPT_INSTPROGI:
217 case ICPT_OPEREXC:
218 case ICPT_PARTEXEC:
219 case ICPT_IOINST:
220 /* last instruction only stored for these icptcodes */
221 return table[vcpu->arch.sie_block->ipa >> 14];
222 case ICPT_PROGI:
223 return vcpu->arch.sie_block->pgmilc;
224 default:
225 return 0;
226 }
227}
228
229static int __must_check __deliver_prog_irq(struct kvm_vcpu *vcpu,
230 struct kvm_s390_pgm_info *pgm_info)
231{
212 int rc = 0; 232 int rc = 0;
233 u16 ilc = get_ilc(vcpu);
213 234
214 switch (pgm_info->code & ~PGM_PER) { 235 switch (pgm_info->code & ~PGM_PER) {
215 case PGM_AFX_TRANSLATION: 236 case PGM_AFX_TRANSLATION:
@@ -276,25 +297,7 @@ static int __deliver_prog_irq(struct kvm_vcpu *vcpu,
276 (u8 *) __LC_PER_ACCESS_ID); 297 (u8 *) __LC_PER_ACCESS_ID);
277 } 298 }
278 299
279 switch (vcpu->arch.sie_block->icptcode) { 300 rc |= put_guest_lc(vcpu, ilc, (u16 *) __LC_PGM_ILC);
280 case ICPT_INST:
281 case ICPT_INSTPROGI:
282 case ICPT_OPEREXC:
283 case ICPT_PARTEXEC:
284 case ICPT_IOINST:
285 /* last instruction only stored for these icptcodes */
286 rc |= put_guest_lc(vcpu, table[vcpu->arch.sie_block->ipa >> 14],
287 (u16 *) __LC_PGM_ILC);
288 break;
289 case ICPT_PROGI:
290 rc |= put_guest_lc(vcpu, vcpu->arch.sie_block->pgmilc,
291 (u16 *) __LC_PGM_ILC);
292 break;
293 default:
294 rc |= put_guest_lc(vcpu, 0,
295 (u16 *) __LC_PGM_ILC);
296 }
297
298 rc |= put_guest_lc(vcpu, pgm_info->code, 301 rc |= put_guest_lc(vcpu, pgm_info->code,
299 (u16 *)__LC_PGM_INT_CODE); 302 (u16 *)__LC_PGM_INT_CODE);
300 rc |= write_guest_lc(vcpu, __LC_PGM_OLD_PSW, 303 rc |= write_guest_lc(vcpu, __LC_PGM_OLD_PSW,
@@ -305,7 +308,7 @@ static int __deliver_prog_irq(struct kvm_vcpu *vcpu,
305 return rc; 308 return rc;
306} 309}
307 310
308static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, 311static int __must_check __do_deliver_interrupt(struct kvm_vcpu *vcpu,
309 struct kvm_s390_interrupt_info *inti) 312 struct kvm_s390_interrupt_info *inti)
310{ 313{
311 const unsigned short table[] = { 2, 4, 4, 6 }; 314 const unsigned short table[] = { 2, 4, 4, 6 };
@@ -343,7 +346,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
343 case KVM_S390_INT_CLOCK_COMP: 346 case KVM_S390_INT_CLOCK_COMP:
344 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 347 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
345 inti->ext.ext_params, 0); 348 inti->ext.ext_params, 0);
346 deliver_ckc_interrupt(vcpu); 349 rc = deliver_ckc_interrupt(vcpu);
347 break; 350 break;
348 case KVM_S390_INT_CPU_TIMER: 351 case KVM_S390_INT_CPU_TIMER:
349 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 352 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
@@ -376,8 +379,9 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
376 case KVM_S390_INT_PFAULT_INIT: 379 case KVM_S390_INT_PFAULT_INIT:
377 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 0, 380 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 0,
378 inti->ext.ext_params2); 381 inti->ext.ext_params2);
379 rc = put_guest_lc(vcpu, 0x2603, (u16 *) __LC_EXT_INT_CODE); 382 rc = put_guest_lc(vcpu, EXT_IRQ_CP_SERVICE,
380 rc |= put_guest_lc(vcpu, 0x0600, (u16 *) __LC_EXT_CPU_ADDR); 383 (u16 *) __LC_EXT_INT_CODE);
384 rc |= put_guest_lc(vcpu, PFAULT_INIT, (u16 *) __LC_EXT_CPU_ADDR);
381 rc |= write_guest_lc(vcpu, __LC_EXT_OLD_PSW, 385 rc |= write_guest_lc(vcpu, __LC_EXT_OLD_PSW,
382 &vcpu->arch.sie_block->gpsw, sizeof(psw_t)); 386 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
383 rc |= read_guest_lc(vcpu, __LC_EXT_NEW_PSW, 387 rc |= read_guest_lc(vcpu, __LC_EXT_NEW_PSW,
@@ -501,14 +505,11 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
501 default: 505 default:
502 BUG(); 506 BUG();
503 } 507 }
504 if (rc) { 508
505 printk("kvm: The guest lowcore is not mapped during interrupt " 509 return rc;
506 "delivery, killing userspace\n");
507 do_exit(SIGKILL);
508 }
509} 510}
510 511
511static void deliver_ckc_interrupt(struct kvm_vcpu *vcpu) 512static int __must_check deliver_ckc_interrupt(struct kvm_vcpu *vcpu)
512{ 513{
513 int rc; 514 int rc;
514 515
@@ -518,11 +519,7 @@ static void deliver_ckc_interrupt(struct kvm_vcpu *vcpu)
518 rc |= read_guest_lc(vcpu, __LC_EXT_NEW_PSW, 519 rc |= read_guest_lc(vcpu, __LC_EXT_NEW_PSW,
519 &vcpu->arch.sie_block->gpsw, 520 &vcpu->arch.sie_block->gpsw,
520 sizeof(psw_t)); 521 sizeof(psw_t));
521 if (rc) { 522 return rc;
522 printk("kvm: The guest lowcore is not mapped during interrupt "
523 "delivery, killing userspace\n");
524 do_exit(SIGKILL);
525 }
526} 523}
527 524
528/* Check whether SIGP interpretation facility has an external call pending */ 525/* Check whether SIGP interpretation facility has an external call pending */
@@ -629,6 +626,7 @@ void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu)
629 */ 626 */
630 vcpu->preempted = true; 627 vcpu->preempted = true;
631 wake_up_interruptible(&vcpu->wq); 628 wake_up_interruptible(&vcpu->wq);
629 vcpu->stat.halt_wakeup++;
632 } 630 }
633} 631}
634 632
@@ -661,12 +659,13 @@ void kvm_s390_clear_local_irqs(struct kvm_vcpu *vcpu)
661 &vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].ctrl); 659 &vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].ctrl);
662} 660}
663 661
664void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu) 662int __must_check kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu)
665{ 663{
666 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; 664 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
667 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int; 665 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int;
668 struct kvm_s390_interrupt_info *n, *inti = NULL; 666 struct kvm_s390_interrupt_info *n, *inti = NULL;
669 int deliver; 667 int deliver;
668 int rc = 0;
670 669
671 __reset_intercept_indicators(vcpu); 670 __reset_intercept_indicators(vcpu);
672 if (atomic_read(&li->active)) { 671 if (atomic_read(&li->active)) {
@@ -685,16 +684,16 @@ void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu)
685 atomic_set(&li->active, 0); 684 atomic_set(&li->active, 0);
686 spin_unlock(&li->lock); 685 spin_unlock(&li->lock);
687 if (deliver) { 686 if (deliver) {
688 __do_deliver_interrupt(vcpu, inti); 687 rc = __do_deliver_interrupt(vcpu, inti);
689 kfree(inti); 688 kfree(inti);
690 } 689 }
691 } while (deliver); 690 } while (!rc && deliver);
692 } 691 }
693 692
694 if (kvm_cpu_has_pending_timer(vcpu)) 693 if (!rc && kvm_cpu_has_pending_timer(vcpu))
695 deliver_ckc_interrupt(vcpu); 694 rc = deliver_ckc_interrupt(vcpu);
696 695
697 if (atomic_read(&fi->active)) { 696 if (!rc && atomic_read(&fi->active)) {
698 do { 697 do {
699 deliver = 0; 698 deliver = 0;
700 spin_lock(&fi->lock); 699 spin_lock(&fi->lock);
@@ -711,67 +710,13 @@ void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu)
711 atomic_set(&fi->active, 0); 710 atomic_set(&fi->active, 0);
712 spin_unlock(&fi->lock); 711 spin_unlock(&fi->lock);
713 if (deliver) { 712 if (deliver) {
714 __do_deliver_interrupt(vcpu, inti); 713 rc = __do_deliver_interrupt(vcpu, inti);
715 kfree(inti);
716 }
717 } while (deliver);
718 }
719}
720
721void kvm_s390_deliver_pending_machine_checks(struct kvm_vcpu *vcpu)
722{
723 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
724 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int;
725 struct kvm_s390_interrupt_info *n, *inti = NULL;
726 int deliver;
727
728 __reset_intercept_indicators(vcpu);
729 if (atomic_read(&li->active)) {
730 do {
731 deliver = 0;
732 spin_lock(&li->lock);
733 list_for_each_entry_safe(inti, n, &li->list, list) {
734 if ((inti->type == KVM_S390_MCHK) &&
735 __interrupt_is_deliverable(vcpu, inti)) {
736 list_del(&inti->list);
737 deliver = 1;
738 break;
739 }
740 __set_intercept_indicator(vcpu, inti);
741 }
742 if (list_empty(&li->list))
743 atomic_set(&li->active, 0);
744 spin_unlock(&li->lock);
745 if (deliver) {
746 __do_deliver_interrupt(vcpu, inti);
747 kfree(inti); 714 kfree(inti);
748 } 715 }
749 } while (deliver); 716 } while (!rc && deliver);
750 } 717 }
751 718
752 if (atomic_read(&fi->active)) { 719 return rc;
753 do {
754 deliver = 0;
755 spin_lock(&fi->lock);
756 list_for_each_entry_safe(inti, n, &fi->list, list) {
757 if ((inti->type == KVM_S390_MCHK) &&
758 __interrupt_is_deliverable(vcpu, inti)) {
759 list_del(&inti->list);
760 fi->irq_count--;
761 deliver = 1;
762 break;
763 }
764 __set_intercept_indicator(vcpu, inti);
765 }
766 if (list_empty(&fi->list))
767 atomic_set(&fi->active, 0);
768 spin_unlock(&fi->lock);
769 if (deliver) {
770 __do_deliver_interrupt(vcpu, inti);
771 kfree(inti);
772 }
773 } while (deliver);
774 }
775} 720}
776 721
777int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code) 722int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code)
@@ -1048,7 +993,6 @@ int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
1048 trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, s390int->type, s390int->parm, 993 trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, s390int->type, s390int->parm,
1049 s390int->parm64, 2); 994 s390int->parm64, 2);
1050 995
1051 mutex_lock(&vcpu->kvm->lock);
1052 li = &vcpu->arch.local_int; 996 li = &vcpu->arch.local_int;
1053 spin_lock(&li->lock); 997 spin_lock(&li->lock);
1054 if (inti->type == KVM_S390_PROGRAM_INT) 998 if (inti->type == KVM_S390_PROGRAM_INT)
@@ -1060,7 +1004,6 @@ int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
1060 li->action_bits |= ACTION_STOP_ON_STOP; 1004 li->action_bits |= ACTION_STOP_ON_STOP;
1061 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags); 1005 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
1062 spin_unlock(&li->lock); 1006 spin_unlock(&li->lock);
1063 mutex_unlock(&vcpu->kvm->lock);
1064 kvm_s390_vcpu_wakeup(vcpu); 1007 kvm_s390_vcpu_wakeup(vcpu);
1065 return 0; 1008 return 0;
1066} 1009}
@@ -1300,7 +1243,7 @@ static int kvm_s390_adapter_map(struct kvm *kvm, unsigned int id, __u64 addr)
1300 } 1243 }
1301 INIT_LIST_HEAD(&map->list); 1244 INIT_LIST_HEAD(&map->list);
1302 map->guest_addr = addr; 1245 map->guest_addr = addr;
1303 map->addr = gmap_translate(addr, kvm->arch.gmap); 1246 map->addr = gmap_translate(kvm->arch.gmap, addr);
1304 if (map->addr == -EFAULT) { 1247 if (map->addr == -EFAULT) {
1305 ret = -EFAULT; 1248 ret = -EFAULT;
1306 goto out; 1249 goto out;
@@ -1410,7 +1353,6 @@ static int flic_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
1410 r = enqueue_floating_irq(dev, attr); 1353 r = enqueue_floating_irq(dev, attr);
1411 break; 1354 break;
1412 case KVM_DEV_FLIC_CLEAR_IRQS: 1355 case KVM_DEV_FLIC_CLEAR_IRQS:
1413 r = 0;
1414 kvm_s390_clear_float_irqs(dev->kvm); 1356 kvm_s390_clear_float_irqs(dev->kvm);
1415 break; 1357 break;
1416 case KVM_DEV_FLIC_APF_ENABLE: 1358 case KVM_DEV_FLIC_APF_ENABLE:
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ce81eb2ab76a..55aade49b6d1 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -50,6 +50,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
50 { "exit_instruction", VCPU_STAT(exit_instruction) }, 50 { "exit_instruction", VCPU_STAT(exit_instruction) },
51 { "exit_program_interruption", VCPU_STAT(exit_program_interruption) }, 51 { "exit_program_interruption", VCPU_STAT(exit_program_interruption) },
52 { "exit_instr_and_program_int", VCPU_STAT(exit_instr_and_program) }, 52 { "exit_instr_and_program_int", VCPU_STAT(exit_instr_and_program) },
53 { "halt_wakeup", VCPU_STAT(halt_wakeup) },
53 { "instruction_lctlg", VCPU_STAT(instruction_lctlg) }, 54 { "instruction_lctlg", VCPU_STAT(instruction_lctlg) },
54 { "instruction_lctl", VCPU_STAT(instruction_lctl) }, 55 { "instruction_lctl", VCPU_STAT(instruction_lctl) },
55 { "instruction_stctl", VCPU_STAT(instruction_stctl) }, 56 { "instruction_stctl", VCPU_STAT(instruction_stctl) },
@@ -100,16 +101,12 @@ int test_vfacility(unsigned long nr)
100} 101}
101 102
102/* Section: not file related */ 103/* Section: not file related */
103int kvm_arch_hardware_enable(void *garbage) 104int kvm_arch_hardware_enable(void)
104{ 105{
105 /* every s390 is virtualization enabled ;-) */ 106 /* every s390 is virtualization enabled ;-) */
106 return 0; 107 return 0;
107} 108}
108 109
109void kvm_arch_hardware_disable(void *garbage)
110{
111}
112
113static void kvm_gmap_notifier(struct gmap *gmap, unsigned long address); 110static void kvm_gmap_notifier(struct gmap *gmap, unsigned long address);
114 111
115int kvm_arch_hardware_setup(void) 112int kvm_arch_hardware_setup(void)
@@ -124,17 +121,10 @@ void kvm_arch_hardware_unsetup(void)
124 gmap_unregister_ipte_notifier(&gmap_notifier); 121 gmap_unregister_ipte_notifier(&gmap_notifier);
125} 122}
126 123
127void kvm_arch_check_processor_compat(void *rtn)
128{
129}
130
131int kvm_arch_init(void *opaque) 124int kvm_arch_init(void *opaque)
132{ 125{
133 return 0; 126 /* Register floating interrupt controller interface. */
134} 127 return kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC);
135
136void kvm_arch_exit(void)
137{
138} 128}
139 129
140/* Section: device related */ 130/* Section: device related */
@@ -404,6 +394,22 @@ long kvm_arch_vm_ioctl(struct file *filp,
404 return r; 394 return r;
405} 395}
406 396
397static int kvm_s390_crypto_init(struct kvm *kvm)
398{
399 if (!test_vfacility(76))
400 return 0;
401
402 kvm->arch.crypto.crycb = kzalloc(sizeof(*kvm->arch.crypto.crycb),
403 GFP_KERNEL | GFP_DMA);
404 if (!kvm->arch.crypto.crycb)
405 return -ENOMEM;
406
407 kvm->arch.crypto.crycbd = (__u32) (unsigned long) kvm->arch.crypto.crycb |
408 CRYCB_FORMAT1;
409
410 return 0;
411}
412
407int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) 413int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
408{ 414{
409 int rc; 415 int rc;
@@ -441,6 +447,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
441 if (!kvm->arch.dbf) 447 if (!kvm->arch.dbf)
442 goto out_nodbf; 448 goto out_nodbf;
443 449
450 if (kvm_s390_crypto_init(kvm) < 0)
451 goto out_crypto;
452
444 spin_lock_init(&kvm->arch.float_int.lock); 453 spin_lock_init(&kvm->arch.float_int.lock);
445 INIT_LIST_HEAD(&kvm->arch.float_int.list); 454 INIT_LIST_HEAD(&kvm->arch.float_int.list);
446 init_waitqueue_head(&kvm->arch.ipte_wq); 455 init_waitqueue_head(&kvm->arch.ipte_wq);
@@ -451,7 +460,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
451 if (type & KVM_VM_S390_UCONTROL) { 460 if (type & KVM_VM_S390_UCONTROL) {
452 kvm->arch.gmap = NULL; 461 kvm->arch.gmap = NULL;
453 } else { 462 } else {
454 kvm->arch.gmap = gmap_alloc(current->mm); 463 kvm->arch.gmap = gmap_alloc(current->mm, (1UL << 44) - 1);
455 if (!kvm->arch.gmap) 464 if (!kvm->arch.gmap)
456 goto out_nogmap; 465 goto out_nogmap;
457 kvm->arch.gmap->private = kvm; 466 kvm->arch.gmap->private = kvm;
@@ -465,6 +474,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
465 474
466 return 0; 475 return 0;
467out_nogmap: 476out_nogmap:
477 kfree(kvm->arch.crypto.crycb);
478out_crypto:
468 debug_unregister(kvm->arch.dbf); 479 debug_unregister(kvm->arch.dbf);
469out_nodbf: 480out_nodbf:
470 free_page((unsigned long)(kvm->arch.sca)); 481 free_page((unsigned long)(kvm->arch.sca));
@@ -514,15 +525,12 @@ static void kvm_free_vcpus(struct kvm *kvm)
514 mutex_unlock(&kvm->lock); 525 mutex_unlock(&kvm->lock);
515} 526}
516 527
517void kvm_arch_sync_events(struct kvm *kvm)
518{
519}
520
521void kvm_arch_destroy_vm(struct kvm *kvm) 528void kvm_arch_destroy_vm(struct kvm *kvm)
522{ 529{
523 kvm_free_vcpus(kvm); 530 kvm_free_vcpus(kvm);
524 free_page((unsigned long)(kvm->arch.sca)); 531 free_page((unsigned long)(kvm->arch.sca));
525 debug_unregister(kvm->arch.dbf); 532 debug_unregister(kvm->arch.dbf);
533 kfree(kvm->arch.crypto.crycb);
526 if (!kvm_is_ucontrol(kvm)) 534 if (!kvm_is_ucontrol(kvm))
527 gmap_free(kvm->arch.gmap); 535 gmap_free(kvm->arch.gmap);
528 kvm_s390_destroy_adapters(kvm); 536 kvm_s390_destroy_adapters(kvm);
@@ -535,7 +543,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
535 vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID; 543 vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID;
536 kvm_clear_async_pf_completion_queue(vcpu); 544 kvm_clear_async_pf_completion_queue(vcpu);
537 if (kvm_is_ucontrol(vcpu->kvm)) { 545 if (kvm_is_ucontrol(vcpu->kvm)) {
538 vcpu->arch.gmap = gmap_alloc(current->mm); 546 vcpu->arch.gmap = gmap_alloc(current->mm, -1UL);
539 if (!vcpu->arch.gmap) 547 if (!vcpu->arch.gmap)
540 return -ENOMEM; 548 return -ENOMEM;
541 vcpu->arch.gmap->private = vcpu->kvm; 549 vcpu->arch.gmap->private = vcpu->kvm;
@@ -546,15 +554,12 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
546 vcpu->run->kvm_valid_regs = KVM_SYNC_PREFIX | 554 vcpu->run->kvm_valid_regs = KVM_SYNC_PREFIX |
547 KVM_SYNC_GPRS | 555 KVM_SYNC_GPRS |
548 KVM_SYNC_ACRS | 556 KVM_SYNC_ACRS |
549 KVM_SYNC_CRS; 557 KVM_SYNC_CRS |
558 KVM_SYNC_ARCH0 |
559 KVM_SYNC_PFAULT;
550 return 0; 560 return 0;
551} 561}
552 562
553void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
554{
555 /* Nothing todo */
556}
557
558void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 563void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
559{ 564{
560 save_fp_ctl(&vcpu->arch.host_fpregs.fpc); 565 save_fp_ctl(&vcpu->arch.host_fpregs.fpc);
@@ -607,6 +612,14 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
607 return 0; 612 return 0;
608} 613}
609 614
615static void kvm_s390_vcpu_crypto_setup(struct kvm_vcpu *vcpu)
616{
617 if (!test_vfacility(76))
618 return;
619
620 vcpu->arch.sie_block->crycbd = vcpu->kvm->arch.crypto.crycbd;
621}
622
610void kvm_s390_vcpu_unsetup_cmma(struct kvm_vcpu *vcpu) 623void kvm_s390_vcpu_unsetup_cmma(struct kvm_vcpu *vcpu)
611{ 624{
612 free_page(vcpu->arch.sie_block->cbrlo); 625 free_page(vcpu->arch.sie_block->cbrlo);
@@ -653,6 +666,9 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
653 vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup; 666 vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup;
654 get_cpu_id(&vcpu->arch.cpu_id); 667 get_cpu_id(&vcpu->arch.cpu_id);
655 vcpu->arch.cpu_id.version = 0xff; 668 vcpu->arch.cpu_id.version = 0xff;
669
670 kvm_s390_vcpu_crypto_setup(vcpu);
671
656 return rc; 672 return rc;
657} 673}
658 674
@@ -1049,6 +1065,11 @@ retry:
1049 goto retry; 1065 goto retry;
1050 } 1066 }
1051 1067
1068 if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) {
1069 vcpu->arch.sie_block->ihcpu = 0xffff;
1070 goto retry;
1071 }
1072
1052 if (kvm_check_request(KVM_REQ_ENABLE_IBS, vcpu)) { 1073 if (kvm_check_request(KVM_REQ_ENABLE_IBS, vcpu)) {
1053 if (!ibs_enabled(vcpu)) { 1074 if (!ibs_enabled(vcpu)) {
1054 trace_kvm_s390_enable_disable_ibs(vcpu->vcpu_id, 1); 1075 trace_kvm_s390_enable_disable_ibs(vcpu->vcpu_id, 1);
@@ -1085,18 +1106,8 @@ retry:
1085 */ 1106 */
1086long kvm_arch_fault_in_page(struct kvm_vcpu *vcpu, gpa_t gpa, int writable) 1107long kvm_arch_fault_in_page(struct kvm_vcpu *vcpu, gpa_t gpa, int writable)
1087{ 1108{
1088 struct mm_struct *mm = current->mm; 1109 return gmap_fault(vcpu->arch.gmap, gpa,
1089 hva_t hva; 1110 writable ? FAULT_FLAG_WRITE : 0);
1090 long rc;
1091
1092 hva = gmap_fault(gpa, vcpu->arch.gmap);
1093 if (IS_ERR_VALUE(hva))
1094 return (long)hva;
1095 down_read(&mm->mmap_sem);
1096 rc = get_user_pages(current, mm, hva, 1, writable, 0, NULL, NULL);
1097 up_read(&mm->mmap_sem);
1098
1099 return rc < 0 ? rc : 0;
1100} 1111}
1101 1112
1102static void __kvm_inject_pfault_token(struct kvm_vcpu *vcpu, bool start_token, 1113static void __kvm_inject_pfault_token(struct kvm_vcpu *vcpu, bool start_token,
@@ -1191,8 +1202,11 @@ static int vcpu_pre_run(struct kvm_vcpu *vcpu)
1191 if (test_cpu_flag(CIF_MCCK_PENDING)) 1202 if (test_cpu_flag(CIF_MCCK_PENDING))
1192 s390_handle_mcck(); 1203 s390_handle_mcck();
1193 1204
1194 if (!kvm_is_ucontrol(vcpu->kvm)) 1205 if (!kvm_is_ucontrol(vcpu->kvm)) {
1195 kvm_s390_deliver_pending_interrupts(vcpu); 1206 rc = kvm_s390_deliver_pending_interrupts(vcpu);
1207 if (rc)
1208 return rc;
1209 }
1196 1210
1197 rc = kvm_s390_handle_requests(vcpu); 1211 rc = kvm_s390_handle_requests(vcpu);
1198 if (rc) 1212 if (rc)
@@ -1296,6 +1310,48 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
1296 return rc; 1310 return rc;
1297} 1311}
1298 1312
1313static void sync_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1314{
1315 vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
1316 vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
1317 if (kvm_run->kvm_dirty_regs & KVM_SYNC_PREFIX)
1318 kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix);
1319 if (kvm_run->kvm_dirty_regs & KVM_SYNC_CRS) {
1320 memcpy(&vcpu->arch.sie_block->gcr, &kvm_run->s.regs.crs, 128);
1321 /* some control register changes require a tlb flush */
1322 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
1323 }
1324 if (kvm_run->kvm_dirty_regs & KVM_SYNC_ARCH0) {
1325 vcpu->arch.sie_block->cputm = kvm_run->s.regs.cputm;
1326 vcpu->arch.sie_block->ckc = kvm_run->s.regs.ckc;
1327 vcpu->arch.sie_block->todpr = kvm_run->s.regs.todpr;
1328 vcpu->arch.sie_block->pp = kvm_run->s.regs.pp;
1329 vcpu->arch.sie_block->gbea = kvm_run->s.regs.gbea;
1330 }
1331 if (kvm_run->kvm_dirty_regs & KVM_SYNC_PFAULT) {
1332 vcpu->arch.pfault_token = kvm_run->s.regs.pft;
1333 vcpu->arch.pfault_select = kvm_run->s.regs.pfs;
1334 vcpu->arch.pfault_compare = kvm_run->s.regs.pfc;
1335 }
1336 kvm_run->kvm_dirty_regs = 0;
1337}
1338
1339static void store_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1340{
1341 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
1342 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
1343 kvm_run->s.regs.prefix = kvm_s390_get_prefix(vcpu);
1344 memcpy(&kvm_run->s.regs.crs, &vcpu->arch.sie_block->gcr, 128);
1345 kvm_run->s.regs.cputm = vcpu->arch.sie_block->cputm;
1346 kvm_run->s.regs.ckc = vcpu->arch.sie_block->ckc;
1347 kvm_run->s.regs.todpr = vcpu->arch.sie_block->todpr;
1348 kvm_run->s.regs.pp = vcpu->arch.sie_block->pp;
1349 kvm_run->s.regs.gbea = vcpu->arch.sie_block->gbea;
1350 kvm_run->s.regs.pft = vcpu->arch.pfault_token;
1351 kvm_run->s.regs.pfs = vcpu->arch.pfault_select;
1352 kvm_run->s.regs.pfc = vcpu->arch.pfault_compare;
1353}
1354
1299int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 1355int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1300{ 1356{
1301 int rc; 1357 int rc;
@@ -1317,30 +1373,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1317 return -EINVAL; 1373 return -EINVAL;
1318 } 1374 }
1319 1375
1320 switch (kvm_run->exit_reason) { 1376 sync_regs(vcpu, kvm_run);
1321 case KVM_EXIT_S390_SIEIC:
1322 case KVM_EXIT_UNKNOWN:
1323 case KVM_EXIT_INTR:
1324 case KVM_EXIT_S390_RESET:
1325 case KVM_EXIT_S390_UCONTROL:
1326 case KVM_EXIT_S390_TSCH:
1327 case KVM_EXIT_DEBUG:
1328 break;
1329 default:
1330 BUG();
1331 }
1332
1333 vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
1334 vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
1335 if (kvm_run->kvm_dirty_regs & KVM_SYNC_PREFIX) {
1336 kvm_run->kvm_dirty_regs &= ~KVM_SYNC_PREFIX;
1337 kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix);
1338 }
1339 if (kvm_run->kvm_dirty_regs & KVM_SYNC_CRS) {
1340 kvm_run->kvm_dirty_regs &= ~KVM_SYNC_CRS;
1341 memcpy(&vcpu->arch.sie_block->gcr, &kvm_run->s.regs.crs, 128);
1342 kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix);
1343 }
1344 1377
1345 might_fault(); 1378 might_fault();
1346 rc = __vcpu_run(vcpu); 1379 rc = __vcpu_run(vcpu);
@@ -1370,10 +1403,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1370 rc = 0; 1403 rc = 0;
1371 } 1404 }
1372 1405
1373 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask; 1406 store_regs(vcpu, kvm_run);
1374 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
1375 kvm_run->s.regs.prefix = kvm_s390_get_prefix(vcpu);
1376 memcpy(&kvm_run->s.regs.crs, &vcpu->arch.sie_block->gcr, 128);
1377 1407
1378 if (vcpu->sigset_active) 1408 if (vcpu->sigset_active)
1379 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 1409 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
@@ -1502,7 +1532,7 @@ void kvm_s390_vcpu_start(struct kvm_vcpu *vcpu)
1502 * Another VCPU might have used IBS while we were offline. 1532 * Another VCPU might have used IBS while we were offline.
1503 * Let's play safe and flush the VCPU at startup. 1533 * Let's play safe and flush the VCPU at startup.
1504 */ 1534 */
1505 vcpu->arch.sie_block->ihcpu = 0xffff; 1535 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
1506 spin_unlock(&vcpu->kvm->arch.start_stop_lock); 1536 spin_unlock(&vcpu->kvm->arch.start_stop_lock);
1507 return; 1537 return;
1508} 1538}
@@ -1657,9 +1687,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
1657 } 1687 }
1658#endif 1688#endif
1659 case KVM_S390_VCPU_FAULT: { 1689 case KVM_S390_VCPU_FAULT: {
1660 r = gmap_fault(arg, vcpu->arch.gmap); 1690 r = gmap_fault(vcpu->arch.gmap, arg, 0);
1661 if (!IS_ERR_VALUE(r))
1662 r = 0;
1663 break; 1691 break;
1664 } 1692 }
1665 case KVM_ENABLE_CAP: 1693 case KVM_ENABLE_CAP:
@@ -1690,21 +1718,12 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
1690 return VM_FAULT_SIGBUS; 1718 return VM_FAULT_SIGBUS;
1691} 1719}
1692 1720
1693void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1694 struct kvm_memory_slot *dont)
1695{
1696}
1697
1698int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot, 1721int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1699 unsigned long npages) 1722 unsigned long npages)
1700{ 1723{
1701 return 0; 1724 return 0;
1702} 1725}
1703 1726
1704void kvm_arch_memslots_updated(struct kvm *kvm)
1705{
1706}
1707
1708/* Section: memory related */ 1727/* Section: memory related */
1709int kvm_arch_prepare_memory_region(struct kvm *kvm, 1728int kvm_arch_prepare_memory_region(struct kvm *kvm,
1710 struct kvm_memory_slot *memslot, 1729 struct kvm_memory_slot *memslot,
@@ -1750,15 +1769,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
1750 return; 1769 return;
1751} 1770}
1752 1771
1753void kvm_arch_flush_shadow_all(struct kvm *kvm)
1754{
1755}
1756
1757void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
1758 struct kvm_memory_slot *slot)
1759{
1760}
1761
1762static int __init kvm_s390_init(void) 1772static int __init kvm_s390_init(void)
1763{ 1773{
1764 int ret; 1774 int ret;
@@ -1777,7 +1787,7 @@ static int __init kvm_s390_init(void)
1777 return -ENOMEM; 1787 return -ENOMEM;
1778 } 1788 }
1779 memcpy(vfacilities, S390_lowcore.stfle_fac_list, 16); 1789 memcpy(vfacilities, S390_lowcore.stfle_fac_list, 16);
1780 vfacilities[0] &= 0xff82fff3f4fc2000UL; 1790 vfacilities[0] &= 0xff82fffbf47c2000UL;
1781 vfacilities[1] &= 0x005c000000000000UL; 1791 vfacilities[1] &= 0x005c000000000000UL;
1782 return 0; 1792 return 0;
1783} 1793}
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 3862fa2cefe0..244d02303182 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -70,7 +70,7 @@ static inline u32 kvm_s390_get_prefix(struct kvm_vcpu *vcpu)
70static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix) 70static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix)
71{ 71{
72 vcpu->arch.sie_block->prefix = prefix >> GUEST_PREFIX_SHIFT; 72 vcpu->arch.sie_block->prefix = prefix >> GUEST_PREFIX_SHIFT;
73 vcpu->arch.sie_block->ihcpu = 0xffff; 73 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
74 kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu); 74 kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
75} 75}
76 76
@@ -138,8 +138,7 @@ static inline int kvm_s390_user_cpu_state_ctrl(struct kvm *kvm)
138int kvm_s390_handle_wait(struct kvm_vcpu *vcpu); 138int kvm_s390_handle_wait(struct kvm_vcpu *vcpu);
139void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu); 139void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu);
140enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer); 140enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer);
141void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu); 141int __must_check kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu);
142void kvm_s390_deliver_pending_machine_checks(struct kvm_vcpu *vcpu);
143void kvm_s390_clear_local_irqs(struct kvm_vcpu *vcpu); 142void kvm_s390_clear_local_irqs(struct kvm_vcpu *vcpu);
144void kvm_s390_clear_float_irqs(struct kvm *kvm); 143void kvm_s390_clear_float_irqs(struct kvm *kvm);
145int __must_check kvm_s390_inject_vm(struct kvm *kvm, 144int __must_check kvm_s390_inject_vm(struct kvm *kvm,
@@ -228,6 +227,7 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu);
228int psw_extint_disabled(struct kvm_vcpu *vcpu); 227int psw_extint_disabled(struct kvm_vcpu *vcpu);
229void kvm_s390_destroy_adapters(struct kvm *kvm); 228void kvm_s390_destroy_adapters(struct kvm *kvm);
230int kvm_s390_si_ext_call_pending(struct kvm_vcpu *vcpu); 229int kvm_s390_si_ext_call_pending(struct kvm_vcpu *vcpu);
230extern struct kvm_device_ops kvm_flic_ops;
231 231
232/* implemented in guestdbg.c */ 232/* implemented in guestdbg.c */
233void kvm_s390_backup_guest_per_regs(struct kvm_vcpu *vcpu); 233void kvm_s390_backup_guest_per_regs(struct kvm_vcpu *vcpu);
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index f89c1cd67751..72bb2dd8b9cd 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -352,13 +352,6 @@ static int handle_stfl(struct kvm_vcpu *vcpu)
352 return 0; 352 return 0;
353} 353}
354 354
355static void handle_new_psw(struct kvm_vcpu *vcpu)
356{
357 /* Check whether the new psw is enabled for machine checks. */
358 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_MCHECK)
359 kvm_s390_deliver_pending_machine_checks(vcpu);
360}
361
362#define PSW_MASK_ADDR_MODE (PSW_MASK_EA | PSW_MASK_BA) 355#define PSW_MASK_ADDR_MODE (PSW_MASK_EA | PSW_MASK_BA)
363#define PSW_MASK_UNASSIGNED 0xb80800fe7fffffffUL 356#define PSW_MASK_UNASSIGNED 0xb80800fe7fffffffUL
364#define PSW_ADDR_24 0x0000000000ffffffUL 357#define PSW_ADDR_24 0x0000000000ffffffUL
@@ -405,7 +398,6 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
405 gpsw->addr = new_psw.addr & ~PSW32_ADDR_AMODE; 398 gpsw->addr = new_psw.addr & ~PSW32_ADDR_AMODE;
406 if (!is_valid_psw(gpsw)) 399 if (!is_valid_psw(gpsw))
407 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 400 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
408 handle_new_psw(vcpu);
409 return 0; 401 return 0;
410} 402}
411 403
@@ -427,7 +419,6 @@ static int handle_lpswe(struct kvm_vcpu *vcpu)
427 vcpu->arch.sie_block->gpsw = new_psw; 419 vcpu->arch.sie_block->gpsw = new_psw;
428 if (!is_valid_psw(&vcpu->arch.sie_block->gpsw)) 420 if (!is_valid_psw(&vcpu->arch.sie_block->gpsw))
429 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 421 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
430 handle_new_psw(vcpu);
431 return 0; 422 return 0;
432} 423}
433 424
@@ -738,7 +729,7 @@ static int handle_essa(struct kvm_vcpu *vcpu)
738 /* invalid entry */ 729 /* invalid entry */
739 break; 730 break;
740 /* try to free backing */ 731 /* try to free backing */
741 __gmap_zap(cbrle, gmap); 732 __gmap_zap(gmap, cbrle);
742 } 733 }
743 up_read(&gmap->mm->mmap_sem); 734 up_read(&gmap->mm->mmap_sem);
744 if (i < entries) 735 if (i < entries)
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 3f3b35403d0a..a2b81d6ce8a5 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -442,18 +442,15 @@ static inline int do_exception(struct pt_regs *regs, int access)
442 down_read(&mm->mmap_sem); 442 down_read(&mm->mmap_sem);
443 443
444#ifdef CONFIG_PGSTE 444#ifdef CONFIG_PGSTE
445 gmap = (struct gmap *) 445 gmap = (current->flags & PF_VCPU) ?
446 ((current->flags & PF_VCPU) ? S390_lowcore.gmap : 0); 446 (struct gmap *) S390_lowcore.gmap : NULL;
447 if (gmap) { 447 if (gmap) {
448 address = __gmap_fault(address, gmap); 448 current->thread.gmap_addr = address;
449 address = __gmap_translate(gmap, address);
449 if (address == -EFAULT) { 450 if (address == -EFAULT) {
450 fault = VM_FAULT_BADMAP; 451 fault = VM_FAULT_BADMAP;
451 goto out_up; 452 goto out_up;
452 } 453 }
453 if (address == -ENOMEM) {
454 fault = VM_FAULT_OOM;
455 goto out_up;
456 }
457 if (gmap->pfault_enabled) 454 if (gmap->pfault_enabled)
458 flags |= FAULT_FLAG_RETRY_NOWAIT; 455 flags |= FAULT_FLAG_RETRY_NOWAIT;
459 } 456 }
@@ -530,6 +527,20 @@ retry:
530 goto retry; 527 goto retry;
531 } 528 }
532 } 529 }
530#ifdef CONFIG_PGSTE
531 if (gmap) {
532 address = __gmap_link(gmap, current->thread.gmap_addr,
533 address);
534 if (address == -EFAULT) {
535 fault = VM_FAULT_BADMAP;
536 goto out_up;
537 }
538 if (address == -ENOMEM) {
539 fault = VM_FAULT_OOM;
540 goto out_up;
541 }
542 }
543#endif
533 fault = 0; 544 fault = 0;
534out_up: 545out_up:
535 up_read(&mm->mmap_sem); 546 up_read(&mm->mmap_sem);
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 0c1073ed1e84..c7235e01fd67 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -43,6 +43,7 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
43 43
44unsigned long empty_zero_page, zero_page_mask; 44unsigned long empty_zero_page, zero_page_mask;
45EXPORT_SYMBOL(empty_zero_page); 45EXPORT_SYMBOL(empty_zero_page);
46EXPORT_SYMBOL(zero_page_mask);
46 47
47static void __init setup_zero_pages(void) 48static void __init setup_zero_pages(void)
48{ 49{
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 19daa53a3da4..296b61a4af59 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -145,30 +145,56 @@ void crst_table_downgrade(struct mm_struct *mm, unsigned long limit)
145/** 145/**
146 * gmap_alloc - allocate a guest address space 146 * gmap_alloc - allocate a guest address space
147 * @mm: pointer to the parent mm_struct 147 * @mm: pointer to the parent mm_struct
148 * @limit: maximum size of the gmap address space
148 * 149 *
149 * Returns a guest address space structure. 150 * Returns a guest address space structure.
150 */ 151 */
151struct gmap *gmap_alloc(struct mm_struct *mm) 152struct gmap *gmap_alloc(struct mm_struct *mm, unsigned long limit)
152{ 153{
153 struct gmap *gmap; 154 struct gmap *gmap;
154 struct page *page; 155 struct page *page;
155 unsigned long *table; 156 unsigned long *table;
156 157 unsigned long etype, atype;
158
159 if (limit < (1UL << 31)) {
160 limit = (1UL << 31) - 1;
161 atype = _ASCE_TYPE_SEGMENT;
162 etype = _SEGMENT_ENTRY_EMPTY;
163 } else if (limit < (1UL << 42)) {
164 limit = (1UL << 42) - 1;
165 atype = _ASCE_TYPE_REGION3;
166 etype = _REGION3_ENTRY_EMPTY;
167 } else if (limit < (1UL << 53)) {
168 limit = (1UL << 53) - 1;
169 atype = _ASCE_TYPE_REGION2;
170 etype = _REGION2_ENTRY_EMPTY;
171 } else {
172 limit = -1UL;
173 atype = _ASCE_TYPE_REGION1;
174 etype = _REGION1_ENTRY_EMPTY;
175 }
157 gmap = kzalloc(sizeof(struct gmap), GFP_KERNEL); 176 gmap = kzalloc(sizeof(struct gmap), GFP_KERNEL);
158 if (!gmap) 177 if (!gmap)
159 goto out; 178 goto out;
160 INIT_LIST_HEAD(&gmap->crst_list); 179 INIT_LIST_HEAD(&gmap->crst_list);
180 INIT_RADIX_TREE(&gmap->guest_to_host, GFP_KERNEL);
181 INIT_RADIX_TREE(&gmap->host_to_guest, GFP_ATOMIC);
182 spin_lock_init(&gmap->guest_table_lock);
161 gmap->mm = mm; 183 gmap->mm = mm;
162 page = alloc_pages(GFP_KERNEL, ALLOC_ORDER); 184 page = alloc_pages(GFP_KERNEL, ALLOC_ORDER);
163 if (!page) 185 if (!page)
164 goto out_free; 186 goto out_free;
187 page->index = 0;
165 list_add(&page->lru, &gmap->crst_list); 188 list_add(&page->lru, &gmap->crst_list);
166 table = (unsigned long *) page_to_phys(page); 189 table = (unsigned long *) page_to_phys(page);
167 crst_table_init(table, _REGION1_ENTRY_EMPTY); 190 crst_table_init(table, etype);
168 gmap->table = table; 191 gmap->table = table;
169 gmap->asce = _ASCE_TYPE_REGION1 | _ASCE_TABLE_LENGTH | 192 gmap->asce = atype | _ASCE_TABLE_LENGTH |
170 _ASCE_USER_BITS | __pa(table); 193 _ASCE_USER_BITS | __pa(table);
194 gmap->asce_end = limit;
195 down_write(&mm->mmap_sem);
171 list_add(&gmap->list, &mm->context.gmap_list); 196 list_add(&gmap->list, &mm->context.gmap_list);
197 up_write(&mm->mmap_sem);
172 return gmap; 198 return gmap;
173 199
174out_free: 200out_free:
@@ -178,36 +204,38 @@ out:
178} 204}
179EXPORT_SYMBOL_GPL(gmap_alloc); 205EXPORT_SYMBOL_GPL(gmap_alloc);
180 206
181static int gmap_unlink_segment(struct gmap *gmap, unsigned long *table)
182{
183 struct gmap_pgtable *mp;
184 struct gmap_rmap *rmap;
185 struct page *page;
186
187 if (*table & _SEGMENT_ENTRY_INVALID)
188 return 0;
189 page = pfn_to_page(*table >> PAGE_SHIFT);
190 mp = (struct gmap_pgtable *) page->index;
191 list_for_each_entry(rmap, &mp->mapper, list) {
192 if (rmap->entry != table)
193 continue;
194 list_del(&rmap->list);
195 kfree(rmap);
196 break;
197 }
198 *table = mp->vmaddr | _SEGMENT_ENTRY_INVALID | _SEGMENT_ENTRY_PROTECT;
199 return 1;
200}
201
202static void gmap_flush_tlb(struct gmap *gmap) 207static void gmap_flush_tlb(struct gmap *gmap)
203{ 208{
204 if (MACHINE_HAS_IDTE) 209 if (MACHINE_HAS_IDTE)
205 __tlb_flush_asce(gmap->mm, (unsigned long) gmap->table | 210 __tlb_flush_asce(gmap->mm, gmap->asce);
206 _ASCE_TYPE_REGION1);
207 else 211 else
208 __tlb_flush_global(); 212 __tlb_flush_global();
209} 213}
210 214
215static void gmap_radix_tree_free(struct radix_tree_root *root)
216{
217 struct radix_tree_iter iter;
218 unsigned long indices[16];
219 unsigned long index;
220 void **slot;
221 int i, nr;
222
223 /* A radix tree is freed by deleting all of its entries */
224 index = 0;
225 do {
226 nr = 0;
227 radix_tree_for_each_slot(slot, root, &iter, index) {
228 indices[nr] = iter.index;
229 if (++nr == 16)
230 break;
231 }
232 for (i = 0; i < nr; i++) {
233 index = indices[i];
234 radix_tree_delete(root, index);
235 }
236 } while (nr > 0);
237}
238
211/** 239/**
212 * gmap_free - free a guest address space 240 * gmap_free - free a guest address space
213 * @gmap: pointer to the guest address space structure 241 * @gmap: pointer to the guest address space structure
@@ -215,31 +243,21 @@ static void gmap_flush_tlb(struct gmap *gmap)
215void gmap_free(struct gmap *gmap) 243void gmap_free(struct gmap *gmap)
216{ 244{
217 struct page *page, *next; 245 struct page *page, *next;
218 unsigned long *table;
219 int i;
220
221 246
222 /* Flush tlb. */ 247 /* Flush tlb. */
223 if (MACHINE_HAS_IDTE) 248 if (MACHINE_HAS_IDTE)
224 __tlb_flush_asce(gmap->mm, (unsigned long) gmap->table | 249 __tlb_flush_asce(gmap->mm, gmap->asce);
225 _ASCE_TYPE_REGION1);
226 else 250 else
227 __tlb_flush_global(); 251 __tlb_flush_global();
228 252
229 /* Free all segment & region tables. */ 253 /* Free all segment & region tables. */
230 down_read(&gmap->mm->mmap_sem); 254 list_for_each_entry_safe(page, next, &gmap->crst_list, lru)
231 spin_lock(&gmap->mm->page_table_lock);
232 list_for_each_entry_safe(page, next, &gmap->crst_list, lru) {
233 table = (unsigned long *) page_to_phys(page);
234 if ((*table & _REGION_ENTRY_TYPE_MASK) == 0)
235 /* Remove gmap rmap structures for segment table. */
236 for (i = 0; i < PTRS_PER_PMD; i++, table++)
237 gmap_unlink_segment(gmap, table);
238 __free_pages(page, ALLOC_ORDER); 255 __free_pages(page, ALLOC_ORDER);
239 } 256 gmap_radix_tree_free(&gmap->guest_to_host);
240 spin_unlock(&gmap->mm->page_table_lock); 257 gmap_radix_tree_free(&gmap->host_to_guest);
241 up_read(&gmap->mm->mmap_sem); 258 down_write(&gmap->mm->mmap_sem);
242 list_del(&gmap->list); 259 list_del(&gmap->list);
260 up_write(&gmap->mm->mmap_sem);
243 kfree(gmap); 261 kfree(gmap);
244} 262}
245EXPORT_SYMBOL_GPL(gmap_free); 263EXPORT_SYMBOL_GPL(gmap_free);
@@ -267,42 +285,97 @@ EXPORT_SYMBOL_GPL(gmap_disable);
267/* 285/*
268 * gmap_alloc_table is assumed to be called with mmap_sem held 286 * gmap_alloc_table is assumed to be called with mmap_sem held
269 */ 287 */
270static int gmap_alloc_table(struct gmap *gmap, 288static int gmap_alloc_table(struct gmap *gmap, unsigned long *table,
271 unsigned long *table, unsigned long init) 289 unsigned long init, unsigned long gaddr)
272 __releases(&gmap->mm->page_table_lock)
273 __acquires(&gmap->mm->page_table_lock)
274{ 290{
275 struct page *page; 291 struct page *page;
276 unsigned long *new; 292 unsigned long *new;
277 293
278 /* since we dont free the gmap table until gmap_free we can unlock */ 294 /* since we dont free the gmap table until gmap_free we can unlock */
279 spin_unlock(&gmap->mm->page_table_lock);
280 page = alloc_pages(GFP_KERNEL, ALLOC_ORDER); 295 page = alloc_pages(GFP_KERNEL, ALLOC_ORDER);
281 spin_lock(&gmap->mm->page_table_lock);
282 if (!page) 296 if (!page)
283 return -ENOMEM; 297 return -ENOMEM;
284 new = (unsigned long *) page_to_phys(page); 298 new = (unsigned long *) page_to_phys(page);
285 crst_table_init(new, init); 299 crst_table_init(new, init);
300 spin_lock(&gmap->mm->page_table_lock);
286 if (*table & _REGION_ENTRY_INVALID) { 301 if (*table & _REGION_ENTRY_INVALID) {
287 list_add(&page->lru, &gmap->crst_list); 302 list_add(&page->lru, &gmap->crst_list);
288 *table = (unsigned long) new | _REGION_ENTRY_LENGTH | 303 *table = (unsigned long) new | _REGION_ENTRY_LENGTH |
289 (*table & _REGION_ENTRY_TYPE_MASK); 304 (*table & _REGION_ENTRY_TYPE_MASK);
290 } else 305 page->index = gaddr;
306 page = NULL;
307 }
308 spin_unlock(&gmap->mm->page_table_lock);
309 if (page)
291 __free_pages(page, ALLOC_ORDER); 310 __free_pages(page, ALLOC_ORDER);
292 return 0; 311 return 0;
293} 312}
294 313
295/** 314/**
315 * __gmap_segment_gaddr - find virtual address from segment pointer
316 * @entry: pointer to a segment table entry in the guest address space
317 *
318 * Returns the virtual address in the guest address space for the segment
319 */
320static unsigned long __gmap_segment_gaddr(unsigned long *entry)
321{
322 struct page *page;
323 unsigned long offset;
324
325 offset = (unsigned long) entry / sizeof(unsigned long);
326 offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE;
327 page = pmd_to_page((pmd_t *) entry);
328 return page->index + offset;
329}
330
331/**
332 * __gmap_unlink_by_vmaddr - unlink a single segment via a host address
333 * @gmap: pointer to the guest address space structure
334 * @vmaddr: address in the host process address space
335 *
336 * Returns 1 if a TLB flush is required
337 */
338static int __gmap_unlink_by_vmaddr(struct gmap *gmap, unsigned long vmaddr)
339{
340 unsigned long *entry;
341 int flush = 0;
342
343 spin_lock(&gmap->guest_table_lock);
344 entry = radix_tree_delete(&gmap->host_to_guest, vmaddr >> PMD_SHIFT);
345 if (entry) {
346 flush = (*entry != _SEGMENT_ENTRY_INVALID);
347 *entry = _SEGMENT_ENTRY_INVALID;
348 }
349 spin_unlock(&gmap->guest_table_lock);
350 return flush;
351}
352
353/**
354 * __gmap_unmap_by_gaddr - unmap a single segment via a guest address
355 * @gmap: pointer to the guest address space structure
356 * @gaddr: address in the guest address space
357 *
358 * Returns 1 if a TLB flush is required
359 */
360static int __gmap_unmap_by_gaddr(struct gmap *gmap, unsigned long gaddr)
361{
362 unsigned long vmaddr;
363
364 vmaddr = (unsigned long) radix_tree_delete(&gmap->guest_to_host,
365 gaddr >> PMD_SHIFT);
366 return vmaddr ? __gmap_unlink_by_vmaddr(gmap, vmaddr) : 0;
367}
368
369/**
296 * gmap_unmap_segment - unmap segment from the guest address space 370 * gmap_unmap_segment - unmap segment from the guest address space
297 * @gmap: pointer to the guest address space structure 371 * @gmap: pointer to the guest address space structure
298 * @addr: address in the guest address space 372 * @to: address in the guest address space
299 * @len: length of the memory area to unmap 373 * @len: length of the memory area to unmap
300 * 374 *
301 * Returns 0 if the unmap succeeded, -EINVAL if not. 375 * Returns 0 if the unmap succeeded, -EINVAL if not.
302 */ 376 */
303int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len) 377int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len)
304{ 378{
305 unsigned long *table;
306 unsigned long off; 379 unsigned long off;
307 int flush; 380 int flush;
308 381
@@ -312,31 +385,10 @@ int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len)
312 return -EINVAL; 385 return -EINVAL;
313 386
314 flush = 0; 387 flush = 0;
315 down_read(&gmap->mm->mmap_sem); 388 down_write(&gmap->mm->mmap_sem);
316 spin_lock(&gmap->mm->page_table_lock); 389 for (off = 0; off < len; off += PMD_SIZE)
317 for (off = 0; off < len; off += PMD_SIZE) { 390 flush |= __gmap_unmap_by_gaddr(gmap, to + off);
318 /* Walk the guest addr space page table */ 391 up_write(&gmap->mm->mmap_sem);
319 table = gmap->table + (((to + off) >> 53) & 0x7ff);
320 if (*table & _REGION_ENTRY_INVALID)
321 goto out;
322 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
323 table = table + (((to + off) >> 42) & 0x7ff);
324 if (*table & _REGION_ENTRY_INVALID)
325 goto out;
326 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
327 table = table + (((to + off) >> 31) & 0x7ff);
328 if (*table & _REGION_ENTRY_INVALID)
329 goto out;
330 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
331 table = table + (((to + off) >> 20) & 0x7ff);
332
333 /* Clear segment table entry in guest address space. */
334 flush |= gmap_unlink_segment(gmap, table);
335 *table = _SEGMENT_ENTRY_INVALID;
336 }
337out:
338 spin_unlock(&gmap->mm->page_table_lock);
339 up_read(&gmap->mm->mmap_sem);
340 if (flush) 392 if (flush)
341 gmap_flush_tlb(gmap); 393 gmap_flush_tlb(gmap);
342 return 0; 394 return 0;
@@ -348,87 +400,47 @@ EXPORT_SYMBOL_GPL(gmap_unmap_segment);
348 * @gmap: pointer to the guest address space structure 400 * @gmap: pointer to the guest address space structure
349 * @from: source address in the parent address space 401 * @from: source address in the parent address space
350 * @to: target address in the guest address space 402 * @to: target address in the guest address space
403 * @len: length of the memory area to map
351 * 404 *
352 * Returns 0 if the mmap succeeded, -EINVAL or -ENOMEM if not. 405 * Returns 0 if the mmap succeeded, -EINVAL or -ENOMEM if not.
353 */ 406 */
354int gmap_map_segment(struct gmap *gmap, unsigned long from, 407int gmap_map_segment(struct gmap *gmap, unsigned long from,
355 unsigned long to, unsigned long len) 408 unsigned long to, unsigned long len)
356{ 409{
357 unsigned long *table;
358 unsigned long off; 410 unsigned long off;
359 int flush; 411 int flush;
360 412
361 if ((from | to | len) & (PMD_SIZE - 1)) 413 if ((from | to | len) & (PMD_SIZE - 1))
362 return -EINVAL; 414 return -EINVAL;
363 if (len == 0 || from + len > TASK_MAX_SIZE || 415 if (len == 0 || from + len < from || to + len < to ||
364 from + len < from || to + len < to) 416 from + len > TASK_MAX_SIZE || to + len > gmap->asce_end)
365 return -EINVAL; 417 return -EINVAL;
366 418
367 flush = 0; 419 flush = 0;
368 down_read(&gmap->mm->mmap_sem); 420 down_write(&gmap->mm->mmap_sem);
369 spin_lock(&gmap->mm->page_table_lock);
370 for (off = 0; off < len; off += PMD_SIZE) { 421 for (off = 0; off < len; off += PMD_SIZE) {
371 /* Walk the gmap address space page table */ 422 /* Remove old translation */
372 table = gmap->table + (((to + off) >> 53) & 0x7ff); 423 flush |= __gmap_unmap_by_gaddr(gmap, to + off);
373 if ((*table & _REGION_ENTRY_INVALID) && 424 /* Store new translation */
374 gmap_alloc_table(gmap, table, _REGION2_ENTRY_EMPTY)) 425 if (radix_tree_insert(&gmap->guest_to_host,
375 goto out_unmap; 426 (to + off) >> PMD_SHIFT,
376 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 427 (void *) from + off))
377 table = table + (((to + off) >> 42) & 0x7ff); 428 break;
378 if ((*table & _REGION_ENTRY_INVALID) &&
379 gmap_alloc_table(gmap, table, _REGION3_ENTRY_EMPTY))
380 goto out_unmap;
381 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
382 table = table + (((to + off) >> 31) & 0x7ff);
383 if ((*table & _REGION_ENTRY_INVALID) &&
384 gmap_alloc_table(gmap, table, _SEGMENT_ENTRY_EMPTY))
385 goto out_unmap;
386 table = (unsigned long *) (*table & _REGION_ENTRY_ORIGIN);
387 table = table + (((to + off) >> 20) & 0x7ff);
388
389 /* Store 'from' address in an invalid segment table entry. */
390 flush |= gmap_unlink_segment(gmap, table);
391 *table = (from + off) | (_SEGMENT_ENTRY_INVALID |
392 _SEGMENT_ENTRY_PROTECT);
393 } 429 }
394 spin_unlock(&gmap->mm->page_table_lock); 430 up_write(&gmap->mm->mmap_sem);
395 up_read(&gmap->mm->mmap_sem);
396 if (flush) 431 if (flush)
397 gmap_flush_tlb(gmap); 432 gmap_flush_tlb(gmap);
398 return 0; 433 if (off >= len)
399 434 return 0;
400out_unmap:
401 spin_unlock(&gmap->mm->page_table_lock);
402 up_read(&gmap->mm->mmap_sem);
403 gmap_unmap_segment(gmap, to, len); 435 gmap_unmap_segment(gmap, to, len);
404 return -ENOMEM; 436 return -ENOMEM;
405} 437}
406EXPORT_SYMBOL_GPL(gmap_map_segment); 438EXPORT_SYMBOL_GPL(gmap_map_segment);
407 439
408static unsigned long *gmap_table_walk(unsigned long address, struct gmap *gmap)
409{
410 unsigned long *table;
411
412 table = gmap->table + ((address >> 53) & 0x7ff);
413 if (unlikely(*table & _REGION_ENTRY_INVALID))
414 return ERR_PTR(-EFAULT);
415 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
416 table = table + ((address >> 42) & 0x7ff);
417 if (unlikely(*table & _REGION_ENTRY_INVALID))
418 return ERR_PTR(-EFAULT);
419 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
420 table = table + ((address >> 31) & 0x7ff);
421 if (unlikely(*table & _REGION_ENTRY_INVALID))
422 return ERR_PTR(-EFAULT);
423 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
424 table = table + ((address >> 20) & 0x7ff);
425 return table;
426}
427
428/** 440/**
429 * __gmap_translate - translate a guest address to a user space address 441 * __gmap_translate - translate a guest address to a user space address
430 * @address: guest address
431 * @gmap: pointer to guest mapping meta data structure 442 * @gmap: pointer to guest mapping meta data structure
443 * @gaddr: guest address
432 * 444 *
433 * Returns user space address which corresponds to the guest address or 445 * Returns user space address which corresponds to the guest address or
434 * -EFAULT if no such mapping exists. 446 * -EFAULT if no such mapping exists.
@@ -436,168 +448,161 @@ static unsigned long *gmap_table_walk(unsigned long address, struct gmap *gmap)
436 * The mmap_sem of the mm that belongs to the address space must be held 448 * The mmap_sem of the mm that belongs to the address space must be held
437 * when this function gets called. 449 * when this function gets called.
438 */ 450 */
439unsigned long __gmap_translate(unsigned long address, struct gmap *gmap) 451unsigned long __gmap_translate(struct gmap *gmap, unsigned long gaddr)
440{ 452{
441 unsigned long *segment_ptr, vmaddr, segment; 453 unsigned long vmaddr;
442 struct gmap_pgtable *mp;
443 struct page *page;
444 454
445 current->thread.gmap_addr = address; 455 vmaddr = (unsigned long)
446 segment_ptr = gmap_table_walk(address, gmap); 456 radix_tree_lookup(&gmap->guest_to_host, gaddr >> PMD_SHIFT);
447 if (IS_ERR(segment_ptr)) 457 return vmaddr ? (vmaddr | (gaddr & ~PMD_MASK)) : -EFAULT;
448 return PTR_ERR(segment_ptr);
449 /* Convert the gmap address to an mm address. */
450 segment = *segment_ptr;
451 if (!(segment & _SEGMENT_ENTRY_INVALID)) {
452 page = pfn_to_page(segment >> PAGE_SHIFT);
453 mp = (struct gmap_pgtable *) page->index;
454 return mp->vmaddr | (address & ~PMD_MASK);
455 } else if (segment & _SEGMENT_ENTRY_PROTECT) {
456 vmaddr = segment & _SEGMENT_ENTRY_ORIGIN;
457 return vmaddr | (address & ~PMD_MASK);
458 }
459 return -EFAULT;
460} 458}
461EXPORT_SYMBOL_GPL(__gmap_translate); 459EXPORT_SYMBOL_GPL(__gmap_translate);
462 460
463/** 461/**
464 * gmap_translate - translate a guest address to a user space address 462 * gmap_translate - translate a guest address to a user space address
465 * @address: guest address
466 * @gmap: pointer to guest mapping meta data structure 463 * @gmap: pointer to guest mapping meta data structure
464 * @gaddr: guest address
467 * 465 *
468 * Returns user space address which corresponds to the guest address or 466 * Returns user space address which corresponds to the guest address or
469 * -EFAULT if no such mapping exists. 467 * -EFAULT if no such mapping exists.
470 * This function does not establish potentially missing page table entries. 468 * This function does not establish potentially missing page table entries.
471 */ 469 */
472unsigned long gmap_translate(unsigned long address, struct gmap *gmap) 470unsigned long gmap_translate(struct gmap *gmap, unsigned long gaddr)
473{ 471{
474 unsigned long rc; 472 unsigned long rc;
475 473
476 down_read(&gmap->mm->mmap_sem); 474 down_read(&gmap->mm->mmap_sem);
477 rc = __gmap_translate(address, gmap); 475 rc = __gmap_translate(gmap, gaddr);
478 up_read(&gmap->mm->mmap_sem); 476 up_read(&gmap->mm->mmap_sem);
479 return rc; 477 return rc;
480} 478}
481EXPORT_SYMBOL_GPL(gmap_translate); 479EXPORT_SYMBOL_GPL(gmap_translate);
482 480
483static int gmap_connect_pgtable(unsigned long address, unsigned long segment, 481/**
484 unsigned long *segment_ptr, struct gmap *gmap) 482 * gmap_unlink - disconnect a page table from the gmap shadow tables
483 * @gmap: pointer to guest mapping meta data structure
484 * @table: pointer to the host page table
485 * @vmaddr: vm address associated with the host page table
486 */
487static void gmap_unlink(struct mm_struct *mm, unsigned long *table,
488 unsigned long vmaddr)
489{
490 struct gmap *gmap;
491 int flush;
492
493 list_for_each_entry(gmap, &mm->context.gmap_list, list) {
494 flush = __gmap_unlink_by_vmaddr(gmap, vmaddr);
495 if (flush)
496 gmap_flush_tlb(gmap);
497 }
498}
499
500/**
501 * gmap_link - set up shadow page tables to connect a host to a guest address
502 * @gmap: pointer to guest mapping meta data structure
503 * @gaddr: guest address
504 * @vmaddr: vm address
505 *
506 * Returns 0 on success, -ENOMEM for out of memory conditions, and -EFAULT
507 * if the vm address is already mapped to a different guest segment.
508 * The mmap_sem of the mm that belongs to the address space must be held
509 * when this function gets called.
510 */
511int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr)
485{ 512{
486 unsigned long vmaddr;
487 struct vm_area_struct *vma;
488 struct gmap_pgtable *mp;
489 struct gmap_rmap *rmap;
490 struct mm_struct *mm; 513 struct mm_struct *mm;
491 struct page *page; 514 unsigned long *table;
515 spinlock_t *ptl;
492 pgd_t *pgd; 516 pgd_t *pgd;
493 pud_t *pud; 517 pud_t *pud;
494 pmd_t *pmd; 518 pmd_t *pmd;
519 int rc;
495 520
496 mm = gmap->mm; 521 /* Create higher level tables in the gmap page table */
497 vmaddr = segment & _SEGMENT_ENTRY_ORIGIN; 522 table = gmap->table;
498 vma = find_vma(mm, vmaddr); 523 if ((gmap->asce & _ASCE_TYPE_MASK) >= _ASCE_TYPE_REGION1) {
499 if (!vma || vma->vm_start > vmaddr) 524 table += (gaddr >> 53) & 0x7ff;
500 return -EFAULT; 525 if ((*table & _REGION_ENTRY_INVALID) &&
526 gmap_alloc_table(gmap, table, _REGION2_ENTRY_EMPTY,
527 gaddr & 0xffe0000000000000))
528 return -ENOMEM;
529 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
530 }
531 if ((gmap->asce & _ASCE_TYPE_MASK) >= _ASCE_TYPE_REGION2) {
532 table += (gaddr >> 42) & 0x7ff;
533 if ((*table & _REGION_ENTRY_INVALID) &&
534 gmap_alloc_table(gmap, table, _REGION3_ENTRY_EMPTY,
535 gaddr & 0xfffffc0000000000))
536 return -ENOMEM;
537 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
538 }
539 if ((gmap->asce & _ASCE_TYPE_MASK) >= _ASCE_TYPE_REGION3) {
540 table += (gaddr >> 31) & 0x7ff;
541 if ((*table & _REGION_ENTRY_INVALID) &&
542 gmap_alloc_table(gmap, table, _SEGMENT_ENTRY_EMPTY,
543 gaddr & 0xffffffff80000000))
544 return -ENOMEM;
545 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
546 }
547 table += (gaddr >> 20) & 0x7ff;
501 /* Walk the parent mm page table */ 548 /* Walk the parent mm page table */
549 mm = gmap->mm;
502 pgd = pgd_offset(mm, vmaddr); 550 pgd = pgd_offset(mm, vmaddr);
503 pud = pud_alloc(mm, pgd, vmaddr); 551 VM_BUG_ON(pgd_none(*pgd));
504 if (!pud) 552 pud = pud_offset(pgd, vmaddr);
505 return -ENOMEM; 553 VM_BUG_ON(pud_none(*pud));
506 pmd = pmd_alloc(mm, pud, vmaddr); 554 pmd = pmd_offset(pud, vmaddr);
507 if (!pmd) 555 VM_BUG_ON(pmd_none(*pmd));
508 return -ENOMEM;
509 if (!pmd_present(*pmd) &&
510 __pte_alloc(mm, vma, pmd, vmaddr))
511 return -ENOMEM;
512 /* large pmds cannot yet be handled */ 556 /* large pmds cannot yet be handled */
513 if (pmd_large(*pmd)) 557 if (pmd_large(*pmd))
514 return -EFAULT; 558 return -EFAULT;
515 /* pmd now points to a valid segment table entry. */
516 rmap = kmalloc(sizeof(*rmap), GFP_KERNEL|__GFP_REPEAT);
517 if (!rmap)
518 return -ENOMEM;
519 /* Link gmap segment table entry location to page table. */ 559 /* Link gmap segment table entry location to page table. */
520 page = pmd_page(*pmd); 560 rc = radix_tree_preload(GFP_KERNEL);
521 mp = (struct gmap_pgtable *) page->index; 561 if (rc)
522 rmap->gmap = gmap; 562 return rc;
523 rmap->entry = segment_ptr; 563 ptl = pmd_lock(mm, pmd);
524 rmap->vmaddr = address & PMD_MASK; 564 spin_lock(&gmap->guest_table_lock);
525 spin_lock(&mm->page_table_lock); 565 if (*table == _SEGMENT_ENTRY_INVALID) {
526 if (*segment_ptr == segment) { 566 rc = radix_tree_insert(&gmap->host_to_guest,
527 list_add(&rmap->list, &mp->mapper); 567 vmaddr >> PMD_SHIFT, table);
528 /* Set gmap segment table entry to page table. */ 568 if (!rc)
529 *segment_ptr = pmd_val(*pmd) & PAGE_MASK; 569 *table = pmd_val(*pmd);
530 rmap = NULL; 570 } else
531 } 571 rc = 0;
532 spin_unlock(&mm->page_table_lock); 572 spin_unlock(&gmap->guest_table_lock);
533 kfree(rmap); 573 spin_unlock(ptl);
534 return 0; 574 radix_tree_preload_end();
535} 575 return rc;
536
537static void gmap_disconnect_pgtable(struct mm_struct *mm, unsigned long *table)
538{
539 struct gmap_rmap *rmap, *next;
540 struct gmap_pgtable *mp;
541 struct page *page;
542 int flush;
543
544 flush = 0;
545 spin_lock(&mm->page_table_lock);
546 page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
547 mp = (struct gmap_pgtable *) page->index;
548 list_for_each_entry_safe(rmap, next, &mp->mapper, list) {
549 *rmap->entry = mp->vmaddr | (_SEGMENT_ENTRY_INVALID |
550 _SEGMENT_ENTRY_PROTECT);
551 list_del(&rmap->list);
552 kfree(rmap);
553 flush = 1;
554 }
555 spin_unlock(&mm->page_table_lock);
556 if (flush)
557 __tlb_flush_global();
558} 576}
559 577
560/* 578/**
561 * this function is assumed to be called with mmap_sem held 579 * gmap_fault - resolve a fault on a guest address
580 * @gmap: pointer to guest mapping meta data structure
581 * @gaddr: guest address
582 * @fault_flags: flags to pass down to handle_mm_fault()
583 *
584 * Returns 0 on success, -ENOMEM for out of memory conditions, and -EFAULT
585 * if the vm address is already mapped to a different guest segment.
562 */ 586 */
563unsigned long __gmap_fault(unsigned long address, struct gmap *gmap) 587int gmap_fault(struct gmap *gmap, unsigned long gaddr,
588 unsigned int fault_flags)
564{ 589{
565 unsigned long *segment_ptr, segment; 590 unsigned long vmaddr;
566 struct gmap_pgtable *mp;
567 struct page *page;
568 int rc; 591 int rc;
569 592
570 current->thread.gmap_addr = address;
571 segment_ptr = gmap_table_walk(address, gmap);
572 if (IS_ERR(segment_ptr))
573 return -EFAULT;
574 /* Convert the gmap address to an mm address. */
575 while (1) {
576 segment = *segment_ptr;
577 if (!(segment & _SEGMENT_ENTRY_INVALID)) {
578 /* Page table is present */
579 page = pfn_to_page(segment >> PAGE_SHIFT);
580 mp = (struct gmap_pgtable *) page->index;
581 return mp->vmaddr | (address & ~PMD_MASK);
582 }
583 if (!(segment & _SEGMENT_ENTRY_PROTECT))
584 /* Nothing mapped in the gmap address space. */
585 break;
586 rc = gmap_connect_pgtable(address, segment, segment_ptr, gmap);
587 if (rc)
588 return rc;
589 }
590 return -EFAULT;
591}
592
593unsigned long gmap_fault(unsigned long address, struct gmap *gmap)
594{
595 unsigned long rc;
596
597 down_read(&gmap->mm->mmap_sem); 593 down_read(&gmap->mm->mmap_sem);
598 rc = __gmap_fault(address, gmap); 594 vmaddr = __gmap_translate(gmap, gaddr);
595 if (IS_ERR_VALUE(vmaddr)) {
596 rc = vmaddr;
597 goto out_up;
598 }
599 if (fixup_user_fault(current, gmap->mm, vmaddr, fault_flags)) {
600 rc = -EFAULT;
601 goto out_up;
602 }
603 rc = __gmap_link(gmap, gaddr, vmaddr);
604out_up:
599 up_read(&gmap->mm->mmap_sem); 605 up_read(&gmap->mm->mmap_sem);
600
601 return rc; 606 return rc;
602} 607}
603EXPORT_SYMBOL_GPL(gmap_fault); 608EXPORT_SYMBOL_GPL(gmap_fault);
@@ -617,17 +622,24 @@ static void gmap_zap_swap_entry(swp_entry_t entry, struct mm_struct *mm)
617 free_swap_and_cache(entry); 622 free_swap_and_cache(entry);
618} 623}
619 624
620/** 625/*
621 * The mm->mmap_sem lock must be held 626 * this function is assumed to be called with mmap_sem held
622 */ 627 */
623static void gmap_zap_unused(struct mm_struct *mm, unsigned long address) 628void __gmap_zap(struct gmap *gmap, unsigned long gaddr)
624{ 629{
625 unsigned long ptev, pgstev; 630 unsigned long vmaddr, ptev, pgstev;
631 pte_t *ptep, pte;
626 spinlock_t *ptl; 632 spinlock_t *ptl;
627 pgste_t pgste; 633 pgste_t pgste;
628 pte_t *ptep, pte;
629 634
630 ptep = get_locked_pte(mm, address, &ptl); 635 /* Find the vm address for the guest address */
636 vmaddr = (unsigned long) radix_tree_lookup(&gmap->guest_to_host,
637 gaddr >> PMD_SHIFT);
638 if (!vmaddr)
639 return;
640 vmaddr |= gaddr & ~PMD_MASK;
641 /* Get pointer to the page table entry */
642 ptep = get_locked_pte(gmap->mm, vmaddr, &ptl);
631 if (unlikely(!ptep)) 643 if (unlikely(!ptep))
632 return; 644 return;
633 pte = *ptep; 645 pte = *ptep;
@@ -639,87 +651,34 @@ static void gmap_zap_unused(struct mm_struct *mm, unsigned long address)
639 ptev = pte_val(pte); 651 ptev = pte_val(pte);
640 if (((pgstev & _PGSTE_GPS_USAGE_MASK) == _PGSTE_GPS_USAGE_UNUSED) || 652 if (((pgstev & _PGSTE_GPS_USAGE_MASK) == _PGSTE_GPS_USAGE_UNUSED) ||
641 ((pgstev & _PGSTE_GPS_ZERO) && (ptev & _PAGE_INVALID))) { 653 ((pgstev & _PGSTE_GPS_ZERO) && (ptev & _PAGE_INVALID))) {
642 gmap_zap_swap_entry(pte_to_swp_entry(pte), mm); 654 gmap_zap_swap_entry(pte_to_swp_entry(pte), gmap->mm);
643 pte_clear(mm, address, ptep); 655 pte_clear(gmap->mm, vmaddr, ptep);
644 } 656 }
645 pgste_set_unlock(ptep, pgste); 657 pgste_set_unlock(ptep, pgste);
646out_pte: 658out_pte:
647 pte_unmap_unlock(*ptep, ptl); 659 pte_unmap_unlock(*ptep, ptl);
648} 660}
649
650/*
651 * this function is assumed to be called with mmap_sem held
652 */
653void __gmap_zap(unsigned long address, struct gmap *gmap)
654{
655 unsigned long *table, *segment_ptr;
656 unsigned long segment, pgstev, ptev;
657 struct gmap_pgtable *mp;
658 struct page *page;
659
660 segment_ptr = gmap_table_walk(address, gmap);
661 if (IS_ERR(segment_ptr))
662 return;
663 segment = *segment_ptr;
664 if (segment & _SEGMENT_ENTRY_INVALID)
665 return;
666 page = pfn_to_page(segment >> PAGE_SHIFT);
667 mp = (struct gmap_pgtable *) page->index;
668 address = mp->vmaddr | (address & ~PMD_MASK);
669 /* Page table is present */
670 table = (unsigned long *)(segment & _SEGMENT_ENTRY_ORIGIN);
671 table = table + ((address >> 12) & 0xff);
672 pgstev = table[PTRS_PER_PTE];
673 ptev = table[0];
674 /* quick check, checked again with locks held */
675 if (((pgstev & _PGSTE_GPS_USAGE_MASK) == _PGSTE_GPS_USAGE_UNUSED) ||
676 ((pgstev & _PGSTE_GPS_ZERO) && (ptev & _PAGE_INVALID)))
677 gmap_zap_unused(gmap->mm, address);
678}
679EXPORT_SYMBOL_GPL(__gmap_zap); 661EXPORT_SYMBOL_GPL(__gmap_zap);
680 662
681void gmap_discard(unsigned long from, unsigned long to, struct gmap *gmap) 663void gmap_discard(struct gmap *gmap, unsigned long from, unsigned long to)
682{ 664{
683 665 unsigned long gaddr, vmaddr, size;
684 unsigned long *table, address, size;
685 struct vm_area_struct *vma; 666 struct vm_area_struct *vma;
686 struct gmap_pgtable *mp;
687 struct page *page;
688 667
689 down_read(&gmap->mm->mmap_sem); 668 down_read(&gmap->mm->mmap_sem);
690 address = from; 669 for (gaddr = from; gaddr < to;
691 while (address < to) { 670 gaddr = (gaddr + PMD_SIZE) & PMD_MASK) {
692 /* Walk the gmap address space page table */ 671 /* Find the vm address for the guest address */
693 table = gmap->table + ((address >> 53) & 0x7ff); 672 vmaddr = (unsigned long)
694 if (unlikely(*table & _REGION_ENTRY_INVALID)) { 673 radix_tree_lookup(&gmap->guest_to_host,
695 address = (address + PMD_SIZE) & PMD_MASK; 674 gaddr >> PMD_SHIFT);
696 continue; 675 if (!vmaddr)
697 }
698 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
699 table = table + ((address >> 42) & 0x7ff);
700 if (unlikely(*table & _REGION_ENTRY_INVALID)) {
701 address = (address + PMD_SIZE) & PMD_MASK;
702 continue; 676 continue;
703 } 677 vmaddr |= gaddr & ~PMD_MASK;
704 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 678 /* Find vma in the parent mm */
705 table = table + ((address >> 31) & 0x7ff); 679 vma = find_vma(gmap->mm, vmaddr);
706 if (unlikely(*table & _REGION_ENTRY_INVALID)) { 680 size = min(to - gaddr, PMD_SIZE - (gaddr & ~PMD_MASK));
707 address = (address + PMD_SIZE) & PMD_MASK; 681 zap_page_range(vma, vmaddr, size, NULL);
708 continue;
709 }
710 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
711 table = table + ((address >> 20) & 0x7ff);
712 if (unlikely(*table & _SEGMENT_ENTRY_INVALID)) {
713 address = (address + PMD_SIZE) & PMD_MASK;
714 continue;
715 }
716 page = pfn_to_page(*table >> PAGE_SHIFT);
717 mp = (struct gmap_pgtable *) page->index;
718 vma = find_vma(gmap->mm, mp->vmaddr);
719 size = min(to - address, PMD_SIZE - (address & ~PMD_MASK));
720 zap_page_range(vma, mp->vmaddr | (address & ~PMD_MASK),
721 size, NULL);
722 address = (address + PMD_SIZE) & PMD_MASK;
723 } 682 }
724 up_read(&gmap->mm->mmap_sem); 683 up_read(&gmap->mm->mmap_sem);
725} 684}
@@ -755,7 +714,7 @@ EXPORT_SYMBOL_GPL(gmap_unregister_ipte_notifier);
755/** 714/**
756 * gmap_ipte_notify - mark a range of ptes for invalidation notification 715 * gmap_ipte_notify - mark a range of ptes for invalidation notification
757 * @gmap: pointer to guest mapping meta data structure 716 * @gmap: pointer to guest mapping meta data structure
758 * @start: virtual address in the guest address space 717 * @gaddr: virtual address in the guest address space
759 * @len: size of area 718 * @len: size of area
760 * 719 *
761 * Returns 0 if for each page in the given range a gmap mapping exists and 720 * Returns 0 if for each page in the given range a gmap mapping exists and
@@ -763,7 +722,7 @@ EXPORT_SYMBOL_GPL(gmap_unregister_ipte_notifier);
763 * for one or more pages -EFAULT is returned. If no memory could be allocated 722 * for one or more pages -EFAULT is returned. If no memory could be allocated
764 * -ENOMEM is returned. This function establishes missing page table entries. 723 * -ENOMEM is returned. This function establishes missing page table entries.
765 */ 724 */
766int gmap_ipte_notify(struct gmap *gmap, unsigned long start, unsigned long len) 725int gmap_ipte_notify(struct gmap *gmap, unsigned long gaddr, unsigned long len)
767{ 726{
768 unsigned long addr; 727 unsigned long addr;
769 spinlock_t *ptl; 728 spinlock_t *ptl;
@@ -771,12 +730,12 @@ int gmap_ipte_notify(struct gmap *gmap, unsigned long start, unsigned long len)
771 pgste_t pgste; 730 pgste_t pgste;
772 int rc = 0; 731 int rc = 0;
773 732
774 if ((start & ~PAGE_MASK) || (len & ~PAGE_MASK)) 733 if ((gaddr & ~PAGE_MASK) || (len & ~PAGE_MASK))
775 return -EINVAL; 734 return -EINVAL;
776 down_read(&gmap->mm->mmap_sem); 735 down_read(&gmap->mm->mmap_sem);
777 while (len) { 736 while (len) {
778 /* Convert gmap address and connect the page tables */ 737 /* Convert gmap address and connect the page tables */
779 addr = __gmap_fault(start, gmap); 738 addr = __gmap_translate(gmap, gaddr);
780 if (IS_ERR_VALUE(addr)) { 739 if (IS_ERR_VALUE(addr)) {
781 rc = addr; 740 rc = addr;
782 break; 741 break;
@@ -786,6 +745,9 @@ int gmap_ipte_notify(struct gmap *gmap, unsigned long start, unsigned long len)
786 rc = -EFAULT; 745 rc = -EFAULT;
787 break; 746 break;
788 } 747 }
748 rc = __gmap_link(gmap, gaddr, addr);
749 if (rc)
750 break;
789 /* Walk the process page table, lock and get pte pointer */ 751 /* Walk the process page table, lock and get pte pointer */
790 ptep = get_locked_pte(gmap->mm, addr, &ptl); 752 ptep = get_locked_pte(gmap->mm, addr, &ptl);
791 if (unlikely(!ptep)) 753 if (unlikely(!ptep))
@@ -796,7 +758,7 @@ int gmap_ipte_notify(struct gmap *gmap, unsigned long start, unsigned long len)
796 pgste = pgste_get_lock(ptep); 758 pgste = pgste_get_lock(ptep);
797 pgste_val(pgste) |= PGSTE_IN_BIT; 759 pgste_val(pgste) |= PGSTE_IN_BIT;
798 pgste_set_unlock(ptep, pgste); 760 pgste_set_unlock(ptep, pgste);
799 start += PAGE_SIZE; 761 gaddr += PAGE_SIZE;
800 len -= PAGE_SIZE; 762 len -= PAGE_SIZE;
801 } 763 }
802 spin_unlock(ptl); 764 spin_unlock(ptl);
@@ -809,28 +771,30 @@ EXPORT_SYMBOL_GPL(gmap_ipte_notify);
809/** 771/**
810 * gmap_do_ipte_notify - call all invalidation callbacks for a specific pte. 772 * gmap_do_ipte_notify - call all invalidation callbacks for a specific pte.
811 * @mm: pointer to the process mm_struct 773 * @mm: pointer to the process mm_struct
774 * @addr: virtual address in the process address space
812 * @pte: pointer to the page table entry 775 * @pte: pointer to the page table entry
813 * 776 *
814 * This function is assumed to be called with the page table lock held 777 * This function is assumed to be called with the page table lock held
815 * for the pte to notify. 778 * for the pte to notify.
816 */ 779 */
817void gmap_do_ipte_notify(struct mm_struct *mm, pte_t *pte) 780void gmap_do_ipte_notify(struct mm_struct *mm, unsigned long vmaddr, pte_t *pte)
818{ 781{
819 unsigned long segment_offset; 782 unsigned long offset, gaddr;
783 unsigned long *table;
820 struct gmap_notifier *nb; 784 struct gmap_notifier *nb;
821 struct gmap_pgtable *mp; 785 struct gmap *gmap;
822 struct gmap_rmap *rmap;
823 struct page *page;
824 786
825 segment_offset = ((unsigned long) pte) & (255 * sizeof(pte_t)); 787 offset = ((unsigned long) pte) & (255 * sizeof(pte_t));
826 segment_offset = segment_offset * (4096 / sizeof(pte_t)); 788 offset = offset * (4096 / sizeof(pte_t));
827 page = pfn_to_page(__pa(pte) >> PAGE_SHIFT);
828 mp = (struct gmap_pgtable *) page->index;
829 spin_lock(&gmap_notifier_lock); 789 spin_lock(&gmap_notifier_lock);
830 list_for_each_entry(rmap, &mp->mapper, list) { 790 list_for_each_entry(gmap, &mm->context.gmap_list, list) {
791 table = radix_tree_lookup(&gmap->host_to_guest,
792 vmaddr >> PMD_SHIFT);
793 if (!table)
794 continue;
795 gaddr = __gmap_segment_gaddr(table) + offset;
831 list_for_each_entry(nb, &gmap_notifier_list, list) 796 list_for_each_entry(nb, &gmap_notifier_list, list)
832 nb->notifier_call(rmap->gmap, 797 nb->notifier_call(gmap, gaddr);
833 rmap->vmaddr + segment_offset);
834 } 798 }
835 spin_unlock(&gmap_notifier_lock); 799 spin_unlock(&gmap_notifier_lock);
836} 800}
@@ -841,29 +805,18 @@ static inline int page_table_with_pgste(struct page *page)
841 return atomic_read(&page->_mapcount) == 0; 805 return atomic_read(&page->_mapcount) == 0;
842} 806}
843 807
844static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm, 808static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm)
845 unsigned long vmaddr)
846{ 809{
847 struct page *page; 810 struct page *page;
848 unsigned long *table; 811 unsigned long *table;
849 struct gmap_pgtable *mp;
850 812
851 page = alloc_page(GFP_KERNEL|__GFP_REPEAT); 813 page = alloc_page(GFP_KERNEL|__GFP_REPEAT);
852 if (!page) 814 if (!page)
853 return NULL; 815 return NULL;
854 mp = kmalloc(sizeof(*mp), GFP_KERNEL|__GFP_REPEAT);
855 if (!mp) {
856 __free_page(page);
857 return NULL;
858 }
859 if (!pgtable_page_ctor(page)) { 816 if (!pgtable_page_ctor(page)) {
860 kfree(mp);
861 __free_page(page); 817 __free_page(page);
862 return NULL; 818 return NULL;
863 } 819 }
864 mp->vmaddr = vmaddr & PMD_MASK;
865 INIT_LIST_HEAD(&mp->mapper);
866 page->index = (unsigned long) mp;
867 atomic_set(&page->_mapcount, 0); 820 atomic_set(&page->_mapcount, 0);
868 table = (unsigned long *) page_to_phys(page); 821 table = (unsigned long *) page_to_phys(page);
869 clear_table(table, _PAGE_INVALID, PAGE_SIZE/2); 822 clear_table(table, _PAGE_INVALID, PAGE_SIZE/2);
@@ -874,14 +827,10 @@ static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm,
874static inline void page_table_free_pgste(unsigned long *table) 827static inline void page_table_free_pgste(unsigned long *table)
875{ 828{
876 struct page *page; 829 struct page *page;
877 struct gmap_pgtable *mp;
878 830
879 page = pfn_to_page(__pa(table) >> PAGE_SHIFT); 831 page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
880 mp = (struct gmap_pgtable *) page->index;
881 BUG_ON(!list_empty(&mp->mapper));
882 pgtable_page_dtor(page); 832 pgtable_page_dtor(page);
883 atomic_set(&page->_mapcount, -1); 833 atomic_set(&page->_mapcount, -1);
884 kfree(mp);
885 __free_page(page); 834 __free_page(page);
886} 835}
887 836
@@ -986,11 +935,21 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
986 pte_t *ptep; 935 pte_t *ptep;
987 936
988 down_read(&mm->mmap_sem); 937 down_read(&mm->mmap_sem);
938retry:
989 ptep = get_locked_pte(current->mm, addr, &ptl); 939 ptep = get_locked_pte(current->mm, addr, &ptl);
990 if (unlikely(!ptep)) { 940 if (unlikely(!ptep)) {
991 up_read(&mm->mmap_sem); 941 up_read(&mm->mmap_sem);
992 return -EFAULT; 942 return -EFAULT;
993 } 943 }
944 if (!(pte_val(*ptep) & _PAGE_INVALID) &&
945 (pte_val(*ptep) & _PAGE_PROTECT)) {
946 pte_unmap_unlock(*ptep, ptl);
947 if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE)) {
948 up_read(&mm->mmap_sem);
949 return -EFAULT;
950 }
951 goto retry;
952 }
994 953
995 new = old = pgste_get_lock(ptep); 954 new = old = pgste_get_lock(ptep);
996 pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT | 955 pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT |
@@ -1028,8 +987,7 @@ static inline int page_table_with_pgste(struct page *page)
1028 return 0; 987 return 0;
1029} 988}
1030 989
1031static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm, 990static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm)
1032 unsigned long vmaddr)
1033{ 991{
1034 return NULL; 992 return NULL;
1035} 993}
@@ -1043,8 +1001,8 @@ static inline void page_table_free_pgste(unsigned long *table)
1043{ 1001{
1044} 1002}
1045 1003
1046static inline void gmap_disconnect_pgtable(struct mm_struct *mm, 1004static inline void gmap_unlink(struct mm_struct *mm, unsigned long *table,
1047 unsigned long *table) 1005 unsigned long vmaddr)
1048{ 1006{
1049} 1007}
1050 1008
@@ -1064,14 +1022,14 @@ static inline unsigned int atomic_xor_bits(atomic_t *v, unsigned int bits)
1064/* 1022/*
1065 * page table entry allocation/free routines. 1023 * page table entry allocation/free routines.
1066 */ 1024 */
1067unsigned long *page_table_alloc(struct mm_struct *mm, unsigned long vmaddr) 1025unsigned long *page_table_alloc(struct mm_struct *mm)
1068{ 1026{
1069 unsigned long *uninitialized_var(table); 1027 unsigned long *uninitialized_var(table);
1070 struct page *uninitialized_var(page); 1028 struct page *uninitialized_var(page);
1071 unsigned int mask, bit; 1029 unsigned int mask, bit;
1072 1030
1073 if (mm_has_pgste(mm)) 1031 if (mm_has_pgste(mm))
1074 return page_table_alloc_pgste(mm, vmaddr); 1032 return page_table_alloc_pgste(mm);
1075 /* Allocate fragments of a 4K page as 1K/2K page table */ 1033 /* Allocate fragments of a 4K page as 1K/2K page table */
1076 spin_lock_bh(&mm->context.list_lock); 1034 spin_lock_bh(&mm->context.list_lock);
1077 mask = FRAG_MASK; 1035 mask = FRAG_MASK;
@@ -1113,10 +1071,8 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
1113 unsigned int bit, mask; 1071 unsigned int bit, mask;
1114 1072
1115 page = pfn_to_page(__pa(table) >> PAGE_SHIFT); 1073 page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
1116 if (page_table_with_pgste(page)) { 1074 if (page_table_with_pgste(page))
1117 gmap_disconnect_pgtable(mm, table);
1118 return page_table_free_pgste(table); 1075 return page_table_free_pgste(table);
1119 }
1120 /* Free 1K/2K page table fragment of a 4K page */ 1076 /* Free 1K/2K page table fragment of a 4K page */
1121 bit = 1 << ((__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t))); 1077 bit = 1 << ((__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)));
1122 spin_lock_bh(&mm->context.list_lock); 1078 spin_lock_bh(&mm->context.list_lock);
@@ -1148,7 +1104,8 @@ static void __page_table_free_rcu(void *table, unsigned bit)
1148 } 1104 }
1149} 1105}
1150 1106
1151void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table) 1107void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table,
1108 unsigned long vmaddr)
1152{ 1109{
1153 struct mm_struct *mm; 1110 struct mm_struct *mm;
1154 struct page *page; 1111 struct page *page;
@@ -1157,7 +1114,7 @@ void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table)
1157 mm = tlb->mm; 1114 mm = tlb->mm;
1158 page = pfn_to_page(__pa(table) >> PAGE_SHIFT); 1115 page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
1159 if (page_table_with_pgste(page)) { 1116 if (page_table_with_pgste(page)) {
1160 gmap_disconnect_pgtable(mm, table); 1117 gmap_unlink(mm, table, vmaddr);
1161 table = (unsigned long *) (__pa(table) | FRAG_MASK); 1118 table = (unsigned long *) (__pa(table) | FRAG_MASK);
1162 tlb_remove_table(tlb, table); 1119 tlb_remove_table(tlb, table);
1163 return; 1120 return;
@@ -1293,7 +1250,7 @@ again:
1293 if (page_table_with_pgste(page)) 1250 if (page_table_with_pgste(page))
1294 continue; 1251 continue;
1295 /* Allocate new page table with pgstes */ 1252 /* Allocate new page table with pgstes */
1296 new = page_table_alloc_pgste(mm, addr); 1253 new = page_table_alloc_pgste(mm);
1297 if (!new) 1254 if (!new)
1298 return -ENOMEM; 1255 return -ENOMEM;
1299 1256
@@ -1308,7 +1265,7 @@ again:
1308 /* Establish new table */ 1265 /* Establish new table */
1309 pmd_populate(mm, pmd, (pte_t *) new); 1266 pmd_populate(mm, pmd, (pte_t *) new);
1310 /* Free old table with rcu, there might be a walker! */ 1267 /* Free old table with rcu, there might be a walker! */
1311 page_table_free_rcu(tlb, table); 1268 page_table_free_rcu(tlb, table, addr);
1312 new = NULL; 1269 new = NULL;
1313 } 1270 }
1314 spin_unlock(ptl); 1271 spin_unlock(ptl);
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index fe9012a49aa5..fdbd7888cb07 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -65,7 +65,7 @@ static pte_t __ref *vmem_pte_alloc(unsigned long address)
65 pte_t *pte; 65 pte_t *pte;
66 66
67 if (slab_is_available()) 67 if (slab_is_available())
68 pte = (pte_t *) page_table_alloc(&init_mm, address); 68 pte = (pte_t *) page_table_alloc(&init_mm);
69 else 69 else
70 pte = alloc_bootmem_align(PTRS_PER_PTE * sizeof(pte_t), 70 pte = alloc_bootmem_align(PTRS_PER_PTE * sizeof(pte_t),
71 PTRS_PER_PTE * sizeof(pte_t)); 71 PTRS_PER_PTE * sizeof(pte_t));
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 61e45b7c04d7..c52ac77408ca 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -5,11 +5,9 @@
5 * 5 *
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> 6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */ 7 */
8#include <linux/moduleloader.h>
9#include <linux/netdevice.h> 8#include <linux/netdevice.h>
10#include <linux/if_vlan.h> 9#include <linux/if_vlan.h>
11#include <linux/filter.h> 10#include <linux/filter.h>
12#include <linux/random.h>
13#include <linux/init.h> 11#include <linux/init.h>
14#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
15#include <asm/facility.h> 13#include <asm/facility.h>
@@ -148,6 +146,12 @@ struct bpf_jit {
148 ret; \ 146 ret; \
149}) 147})
150 148
149static void bpf_jit_fill_hole(void *area, unsigned int size)
150{
151 /* Fill whole space with illegal instructions */
152 memset(area, 0, size);
153}
154
151static void bpf_jit_prologue(struct bpf_jit *jit) 155static void bpf_jit_prologue(struct bpf_jit *jit)
152{ 156{
153 /* Save registers and create stack frame if necessary */ 157 /* Save registers and create stack frame if necessary */
@@ -223,37 +227,6 @@ static void bpf_jit_epilogue(struct bpf_jit *jit)
223 EMIT2(0x07fe); 227 EMIT2(0x07fe);
224} 228}
225 229
226/* Helper to find the offset of pkt_type in sk_buff
227 * Make sure its still a 3bit field starting at the MSBs within a byte.
228 */
229#define PKT_TYPE_MAX 0xe0
230static int pkt_type_offset;
231
232static int __init bpf_pkt_type_offset_init(void)
233{
234 struct sk_buff skb_probe = {
235 .pkt_type = ~0,
236 };
237 char *ct = (char *)&skb_probe;
238 int off;
239
240 pkt_type_offset = -1;
241 for (off = 0; off < sizeof(struct sk_buff); off++) {
242 if (!ct[off])
243 continue;
244 if (ct[off] == PKT_TYPE_MAX)
245 pkt_type_offset = off;
246 else {
247 /* Found non matching bit pattern, fix needed. */
248 WARN_ON_ONCE(1);
249 pkt_type_offset = -1;
250 return -1;
251 }
252 }
253 return 0;
254}
255device_initcall(bpf_pkt_type_offset_init);
256
257/* 230/*
258 * make sure we dont leak kernel information to user 231 * make sure we dont leak kernel information to user
259 */ 232 */
@@ -753,12 +726,10 @@ call_fn: /* lg %r1,<d(function)>(%r13) */
753 } 726 }
754 break; 727 break;
755 case BPF_ANC | SKF_AD_PKTTYPE: 728 case BPF_ANC | SKF_AD_PKTTYPE:
756 if (pkt_type_offset < 0)
757 goto out;
758 /* lhi %r5,0 */ 729 /* lhi %r5,0 */
759 EMIT4(0xa7580000); 730 EMIT4(0xa7580000);
760 /* ic %r5,<d(pkt_type_offset)>(%r2) */ 731 /* ic %r5,<d(pkt_type_offset)>(%r2) */
761 EMIT4_DISP(0x43502000, pkt_type_offset); 732 EMIT4_DISP(0x43502000, PKT_TYPE_OFFSET());
762 /* srl %r5,5 */ 733 /* srl %r5,5 */
763 EMIT4_DISP(0x88500000, 5); 734 EMIT4_DISP(0x88500000, 5);
764 break; 735 break;
@@ -780,38 +751,6 @@ out:
780 return -1; 751 return -1;
781} 752}
782 753
783/*
784 * Note: for security reasons, bpf code will follow a randomly
785 * sized amount of illegal instructions.
786 */
787struct bpf_binary_header {
788 unsigned int pages;
789 u8 image[];
790};
791
792static struct bpf_binary_header *bpf_alloc_binary(unsigned int bpfsize,
793 u8 **image_ptr)
794{
795 struct bpf_binary_header *header;
796 unsigned int sz, hole;
797
798 /* Most BPF filters are really small, but if some of them fill a page,
799 * allow at least 128 extra bytes for illegal instructions.
800 */
801 sz = round_up(bpfsize + sizeof(*header) + 128, PAGE_SIZE);
802 header = module_alloc(sz);
803 if (!header)
804 return NULL;
805 memset(header, 0, sz);
806 header->pages = sz / PAGE_SIZE;
807 hole = min(sz - (bpfsize + sizeof(*header)), PAGE_SIZE - sizeof(*header));
808 /* Insert random number of illegal instructions before BPF code
809 * and make sure the first instruction starts at an even address.
810 */
811 *image_ptr = &header->image[(prandom_u32() % hole) & -2];
812 return header;
813}
814
815void bpf_jit_compile(struct bpf_prog *fp) 754void bpf_jit_compile(struct bpf_prog *fp)
816{ 755{
817 struct bpf_binary_header *header = NULL; 756 struct bpf_binary_header *header = NULL;
@@ -850,7 +789,8 @@ void bpf_jit_compile(struct bpf_prog *fp)
850 size = prg_len + lit_len; 789 size = prg_len + lit_len;
851 if (size >= BPF_SIZE_MAX) 790 if (size >= BPF_SIZE_MAX)
852 goto out; 791 goto out;
853 header = bpf_alloc_binary(size, &jit.start); 792 header = bpf_jit_binary_alloc(size, &jit.start,
793 2, bpf_jit_fill_hole);
854 if (!header) 794 if (!header)
855 goto out; 795 goto out;
856 jit.prg = jit.mid = jit.start + prg_len; 796 jit.prg = jit.mid = jit.start + prg_len;
@@ -869,7 +809,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
869 if (jit.start) { 809 if (jit.start) {
870 set_memory_ro((unsigned long)header, header->pages); 810 set_memory_ro((unsigned long)header, header->pages);
871 fp->bpf_func = (void *) jit.start; 811 fp->bpf_func = (void *) jit.start;
872 fp->jited = 1; 812 fp->jited = true;
873 } 813 }
874out: 814out:
875 kfree(addrs); 815 kfree(addrs);
@@ -884,8 +824,8 @@ void bpf_jit_free(struct bpf_prog *fp)
884 goto free_filter; 824 goto free_filter;
885 825
886 set_memory_rw(addr, header->pages); 826 set_memory_rw(addr, header->pages);
887 module_free(NULL, header); 827 bpf_jit_binary_free(header);
888 828
889free_filter: 829free_filter:
890 kfree(fp); 830 bpf_prog_unlock_free(fp);
891} 831}
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index 4ac8cae5727c..366e1b599a7b 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -22,17 +22,14 @@ choice
22config ARCH_SCORE7 22config ARCH_SCORE7
23 bool "SCORE7 processor" 23 bool "SCORE7 processor"
24 select SYS_SUPPORTS_32BIT_KERNEL 24 select SYS_SUPPORTS_32BIT_KERNEL
25 select GENERIC_HAS_IOMAP
26 25
27config MACH_SPCT6600 26config MACH_SPCT6600
28 bool "SPCT6600 series based machines" 27 bool "SPCT6600 series based machines"
29 select SYS_SUPPORTS_32BIT_KERNEL 28 select SYS_SUPPORTS_32BIT_KERNEL
30 select GENERIC_HAS_IOMAP
31 29
32config SCORE_SIM 30config SCORE_SIM
33 bool "Score simulator" 31 bool "Score simulator"
34 select SYS_SUPPORTS_32BIT_KERNEL 32 select SYS_SUPPORTS_32BIT_KERNEL
35 select GENERIC_HAS_IOMAP
36endchoice 33endchoice
37 34
38endmenu 35endmenu
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index aad209199f7e..46461c19f284 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -6,8 +6,11 @@ generic-y += barrier.h
6generic-y += clkdev.h 6generic-y += clkdev.h
7generic-y += cputime.h 7generic-y += cputime.h
8generic-y += hash.h 8generic-y += hash.h
9generic-y += irq_work.h
9generic-y += mcs_spinlock.h 10generic-y += mcs_spinlock.h
10generic-y += preempt.h 11generic-y += preempt.h
11generic-y += scatterlist.h 12generic-y += scatterlist.h
13generic-y += sections.h
12generic-y += trace_clock.h 14generic-y += trace_clock.h
13generic-y += xor.h 15generic-y += xor.h
16generic-y += serial.h
diff --git a/arch/score/include/asm/sections.h b/arch/score/include/asm/sections.h
deleted file mode 100644
index 9441d23af005..000000000000
--- a/arch/score/include/asm/sections.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_SCORE_SECTIONS_H
2#define _ASM_SCORE_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6#endif /* _ASM_SCORE_SECTIONS_H */
diff --git a/arch/score/kernel/time.c b/arch/score/kernel/time.c
index f0a43affb201..24770cd9b473 100644
--- a/arch/score/kernel/time.c
+++ b/arch/score/kernel/time.c
@@ -41,7 +41,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
41 41
42static struct irqaction timer_irq = { 42static struct irqaction timer_irq = {
43 .handler = timer_interrupt, 43 .handler = timer_interrupt,
44 .flags = IRQF_DISABLED | IRQF_TIMER, 44 .flags = IRQF_TIMER,
45 .name = "timer", 45 .name = "timer",
46}; 46};
47 47
diff --git a/arch/score/lib/checksum_copy.c b/arch/score/lib/checksum_copy.c
index 04565dd3ded8..9b770b30e8a5 100644
--- a/arch/score/lib/checksum_copy.c
+++ b/arch/score/lib/checksum_copy.c
@@ -50,3 +50,4 @@ unsigned int csum_partial_copy_from_user(const char *src, char *dst,
50 50
51 return csum_partial(dst, len, sum); 51 return csum_partial(dst, len, sum);
52} 52}
53EXPORT_SYMBOL(csum_partial_copy_from_user);
diff --git a/arch/score/mm/cache.c b/arch/score/mm/cache.c
index f85ec1a7c88e..b4bcfd3e8393 100644
--- a/arch/score/mm/cache.c
+++ b/arch/score/mm/cache.c
@@ -72,6 +72,7 @@ void flush_dcache_page(struct page *page)
72 addr = (unsigned long) page_address(page); 72 addr = (unsigned long) page_address(page);
73 flush_data_cache_page(addr); 73 flush_data_cache_page(addr);
74} 74}
75EXPORT_SYMBOL(flush_dcache_page);
75 76
76/* called by update_mmu_cache. */ 77/* called by update_mmu_cache. */
77void __update_cache(struct vm_area_struct *vma, unsigned long address, 78void __update_cache(struct vm_area_struct *vma, unsigned long address,
@@ -277,3 +278,4 @@ void flush_icache_range(unsigned long start, unsigned long end)
277 start += L1_CACHE_BYTES; 278 start += L1_CACHE_BYTES;
278 } 279 }
279} 280}
281EXPORT_SYMBOL(flush_icache_range);
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 453fa5c09550..244fb4c81e25 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -172,6 +172,7 @@ menu "System type"
172# 172#
173config CPU_SH2 173config CPU_SH2
174 bool 174 bool
175 select SH_INTC
175 176
176config CPU_SH2A 177config CPU_SH2A
177 bool 178 bool
@@ -182,6 +183,7 @@ config CPU_SH3
182 bool 183 bool
183 select CPU_HAS_INTEVT 184 select CPU_HAS_INTEVT
184 select CPU_HAS_SR_RB 185 select CPU_HAS_SR_RB
186 select SH_INTC
185 select SYS_SUPPORTS_SH_TMU 187 select SYS_SUPPORTS_SH_TMU
186 188
187config CPU_SH4 189config CPU_SH4
@@ -189,6 +191,7 @@ config CPU_SH4
189 select CPU_HAS_INTEVT 191 select CPU_HAS_INTEVT
190 select CPU_HAS_SR_RB 192 select CPU_HAS_SR_RB
191 select CPU_HAS_FPU if !CPU_SH4AL_DSP 193 select CPU_HAS_FPU if !CPU_SH4AL_DSP
194 select SH_INTC
192 select SYS_SUPPORTS_SH_TMU 195 select SYS_SUPPORTS_SH_TMU
193 select SYS_SUPPORTS_HUGETLBFS if MMU 196 select SYS_SUPPORTS_HUGETLBFS if MMU
194 197
@@ -595,8 +598,6 @@ source kernel/Kconfig.hz
595config KEXEC 598config KEXEC
596 bool "kexec system call (EXPERIMENTAL)" 599 bool "kexec system call (EXPERIMENTAL)"
597 depends on SUPERH32 && MMU 600 depends on SUPERH32 && MMU
598 select CRYPTO
599 select CRYPTO_SHA256
600 help 601 help
601 kexec is a system call that implements the ability to shutdown your 602 kexec is a system call that implements the ability to shutdown your
602 current kernel, and to start another kernel. It is like a reboot 603 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c
index 3ea65e9b56e8..f035a7ac6456 100644
--- a/arch/sh/boards/mach-x3proto/gpio.c
+++ b/arch/sh/boards/mach-x3proto/gpio.c
@@ -128,10 +128,8 @@ int __init x3proto_gpio_setup(void)
128 return 0; 128 return 0;
129 129
130err_irq: 130err_irq:
131 ret = gpiochip_remove(&x3proto_gpio_chip); 131 gpiochip_remove(&x3proto_gpio_chip);
132 if (unlikely(ret)) 132 ret = 0;
133 pr_err("Failed deregistering GPIO\n");
134
135err_gpio: 133err_gpio:
136 synchronize_irq(ilsel); 134 synchronize_irq(ilsel);
137 135
diff --git a/arch/sh/configs/sdk7780_defconfig b/arch/sh/configs/sdk7780_defconfig
index 6a96b9a2f7a5..bbd4c2298708 100644
--- a/arch/sh/configs/sdk7780_defconfig
+++ b/arch/sh/configs/sdk7780_defconfig
@@ -30,6 +30,7 @@ CONFIG_PCI_DEBUG=y
30CONFIG_PCCARD=y 30CONFIG_PCCARD=y
31CONFIG_YENTA=y 31CONFIG_YENTA=y
32CONFIG_HOTPLUG_PCI=y 32CONFIG_HOTPLUG_PCI=y
33CONFIG_NET=y
33CONFIG_PACKET=y 34CONFIG_PACKET=y
34CONFIG_UNIX=y 35CONFIG_UNIX=y
35CONFIG_INET=y 36CONFIG_INET=y
diff --git a/arch/sh/configs/sh2007_defconfig b/arch/sh/configs/sh2007_defconfig
index e741b1e36acd..df25ae774ee0 100644
--- a/arch/sh/configs/sh2007_defconfig
+++ b/arch/sh/configs/sh2007_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMDLINE_OVERWRITE=y
25CONFIG_CMDLINE="console=ttySC1,115200 ip=dhcp root=/dev/nfs rw nfsroot=/nfs/rootfs,rsize=1024,wsize=1024 earlyprintk=sh-sci.1" 25CONFIG_CMDLINE="console=ttySC1,115200 ip=dhcp root=/dev/nfs rw nfsroot=/nfs/rootfs,rsize=1024,wsize=1024 earlyprintk=sh-sci.1"
26CONFIG_PCCARD=y 26CONFIG_PCCARD=y
27CONFIG_BINFMT_MISC=y 27CONFIG_BINFMT_MISC=y
28CONFIG_NET=y
28CONFIG_PACKET=y 29CONFIG_PACKET=y
29CONFIG_UNIX=y 30CONFIG_UNIX=y
30CONFIG_XFRM_USER=y 31CONFIG_XFRM_USER=y
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index c19e47dacb31..5a6c9acff0d2 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -12,6 +12,7 @@ generic-y += hash.h
12generic-y += ioctl.h 12generic-y += ioctl.h
13generic-y += ipcbuf.h 13generic-y += ipcbuf.h
14generic-y += irq_regs.h 14generic-y += irq_regs.h
15generic-y += irq_work.h
15generic-y += kvm_para.h 16generic-y += kvm_para.h
16generic-y += local.h 17generic-y += local.h
17generic-y += local64.h 18generic-y += local64.h
diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h
index 1b6199740e98..7a99e6af6372 100644
--- a/arch/sh/include/asm/sections.h
+++ b/arch/sh/include/asm/sections.h
@@ -3,7 +3,6 @@
3 3
4#include <asm-generic/sections.h> 4#include <asm-generic/sections.h>
5 5
6extern long __nosave_begin, __nosave_end;
7extern long __machvec_start, __machvec_end; 6extern long __machvec_start, __machvec_end;
8extern char __uncached_start, __uncached_end; 7extern char __uncached_start, __uncached_end;
9extern char __start_eh_frame[], __stop_eh_frame[]; 8extern char __start_eh_frame[], __stop_eh_frame[];
diff --git a/arch/sh/include/uapi/asm/ioctls.h b/arch/sh/include/uapi/asm/ioctls.h
index 342241079760..c9903e56ccf4 100644
--- a/arch/sh/include/uapi/asm/ioctls.h
+++ b/arch/sh/include/uapi/asm/ioctls.h
@@ -83,6 +83,8 @@
83#define TCSETS2 _IOW('T', 43, struct termios2) 83#define TCSETS2 _IOW('T', 43, struct termios2)
84#define TCSETSW2 _IOW('T', 44, struct termios2) 84#define TCSETSW2 _IOW('T', 44, struct termios2)
85#define TCSETSF2 _IOW('T', 45, struct termios2) 85#define TCSETSF2 _IOW('T', 45, struct termios2)
86#define TIOCGRS485 _IOR('T', 46, struct serial_rs485)
87#define TIOCSRS485 _IOWR('T', 47, struct serial_rs485)
86#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 88#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
87#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 89#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
88#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ 90#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index 097c2cdd117f..f770e3992620 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -229,6 +229,7 @@ void flush_icache_range(unsigned long start, unsigned long end)
229 229
230 cacheop_on_each_cpu(local_flush_icache_range, (void *)&data, 1); 230 cacheop_on_each_cpu(local_flush_icache_range, (void *)&data, 1);
231} 231}
232EXPORT_SYMBOL(flush_icache_range);
232 233
233void flush_icache_page(struct vm_area_struct *vma, struct page *page) 234void flush_icache_page(struct vm_area_struct *vma, struct page *page)
234{ 235{
diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c
index bf8daf9d9c9b..37458f38b220 100644
--- a/arch/sh/mm/gup.c
+++ b/arch/sh/mm/gup.c
@@ -105,6 +105,8 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
105 VM_BUG_ON(!pfn_valid(pte_pfn(pte))); 105 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
106 page = pte_page(pte); 106 page = pte_page(pte);
107 get_page(page); 107 get_page(page);
108 __flush_anon_page(page, addr);
109 flush_dcache_page(page);
108 pages[*nr] = page; 110 pages[*nr] = page;
109 (*nr)++; 111 (*nr)++;
110 112
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index 9d8521b8c854..6b68f12f29db 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -29,6 +29,7 @@ CONFIG_PCI=y
29CONFIG_PCI_MSI=y 29CONFIG_PCI_MSI=y
30CONFIG_SUN_OPENPROMFS=m 30CONFIG_SUN_OPENPROMFS=m
31CONFIG_BINFMT_MISC=m 31CONFIG_BINFMT_MISC=m
32CONFIG_NET=y
32CONFIG_PACKET=y 33CONFIG_PACKET=y
33CONFIG_UNIX=y 34CONFIG_UNIX=y
34CONFIG_XFRM_USER=m 35CONFIG_XFRM_USER=m
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index cdd1b447bb6c..f5f94ce1692c 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += emergency-restart.h
8generic-y += exec.h 8generic-y += exec.h
9generic-y += hash.h 9generic-y += hash.h
10generic-y += irq_regs.h 10generic-y += irq_regs.h
11generic-y += irq_work.h
11generic-y += linkage.h 12generic-y += linkage.h
12generic-y += local.h 13generic-y += local.h
13generic-y += local64.h 14generic-y += local64.h
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h
index e0f6c399f1d0..6b135a8ab07b 100644
--- a/arch/sparc/include/asm/vio.h
+++ b/arch/sparc/include/asm/vio.h
@@ -65,6 +65,7 @@ struct vio_dring_register {
65 u16 options; 65 u16 options;
66#define VIO_TX_DRING 0x0001 66#define VIO_TX_DRING 0x0001
67#define VIO_RX_DRING 0x0002 67#define VIO_RX_DRING 0x0002
68#define VIO_RX_DRING_DATA 0x0004
68 u16 resv; 69 u16 resv;
69 u32 num_cookies; 70 u32 num_cookies;
70 struct ldc_trans_cookie cookies[0]; 71 struct ldc_trans_cookie cookies[0];
@@ -80,6 +81,8 @@ struct vio_dring_unregister {
80#define VIO_PKT_MODE 0x01 /* Packet based transfer */ 81#define VIO_PKT_MODE 0x01 /* Packet based transfer */
81#define VIO_DESC_MODE 0x02 /* In-band descriptors */ 82#define VIO_DESC_MODE 0x02 /* In-band descriptors */
82#define VIO_DRING_MODE 0x03 /* Descriptor rings */ 83#define VIO_DRING_MODE 0x03 /* Descriptor rings */
84/* in vers >= 1.2, VIO_DRING_MODE is 0x04 and transfer mode is a bitmask */
85#define VIO_NEW_DRING_MODE 0x04
83 86
84struct vio_dring_data { 87struct vio_dring_data {
85 struct vio_msg_tag tag; 88 struct vio_msg_tag tag;
@@ -205,10 +208,20 @@ struct vio_net_attr_info {
205 u8 addr_type; 208 u8 addr_type;
206#define VNET_ADDR_ETHERMAC 0x01 209#define VNET_ADDR_ETHERMAC 0x01
207 u16 ack_freq; 210 u16 ack_freq;
208 u32 resv1; 211 u8 plnk_updt;
212#define PHYSLINK_UPDATE_NONE 0x00
213#define PHYSLINK_UPDATE_STATE 0x01
214#define PHYSLINK_UPDATE_STATE_ACK 0x02
215#define PHYSLINK_UPDATE_STATE_NACK 0x03
216 u8 options;
217 u16 resv1;
209 u64 addr; 218 u64 addr;
210 u64 mtu; 219 u64 mtu;
211 u64 resv2[3]; 220 u16 cflags;
221#define VNET_LSO_IPV4_CAPAB 0x0001
222 u16 ipv4_lso_maxlen;
223 u32 resv2;
224 u64 resv3[2];
212}; 225};
213 226
214#define VNET_NUM_MCAST 7 227#define VNET_NUM_MCAST 7
@@ -366,6 +379,33 @@ struct vio_driver_state {
366 struct vio_driver_ops *ops; 379 struct vio_driver_ops *ops;
367}; 380};
368 381
382static inline bool vio_version_before(struct vio_driver_state *vio,
383 u16 major, u16 minor)
384{
385 u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
386 u32 want = (u32)major << 16 | minor;
387
388 return have < want;
389}
390
391static inline bool vio_version_after(struct vio_driver_state *vio,
392 u16 major, u16 minor)
393{
394 u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
395 u32 want = (u32)major << 16 | minor;
396
397 return have > want;
398}
399
400static inline bool vio_version_after_eq(struct vio_driver_state *vio,
401 u16 major, u16 minor)
402{
403 u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
404 u32 want = (u32)major << 16 | minor;
405
406 return have >= want;
407}
408
369#define viodbg(TYPE, f, a...) \ 409#define viodbg(TYPE, f, a...) \
370do { if (vio->debug & VIO_DEBUG_##TYPE) \ 410do { if (vio->debug & VIO_DEBUG_##TYPE) \
371 printk(KERN_INFO "vio: ID[%lu] " f, \ 411 printk(KERN_INFO "vio: ID[%lu] " f, \
diff --git a/arch/sparc/include/uapi/asm/ioctls.h b/arch/sparc/include/uapi/asm/ioctls.h
index 897d1723fa14..06b3f6c3bb9a 100644
--- a/arch/sparc/include/uapi/asm/ioctls.h
+++ b/arch/sparc/include/uapi/asm/ioctls.h
@@ -24,6 +24,8 @@
24#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ 24#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
25#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ 25#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
26#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ 26#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
27#define TIOCGRS485 _IOR('T', 0x41, struct serial_rs485)
28#define TIOCSRS485 _IOWR('T', 0x42, struct serial_rs485)
27 29
28/* Note that all the ioctls that are not available in Linux have a 30/* Note that all the ioctls that are not available in Linux have a
29 * double underscore on the front to: a) avoid some programs to 31 * double underscore on the front to: a) avoid some programs to
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index 66dacd56bb10..0af28b984695 100644
--- a/arch/sparc/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
@@ -2159,7 +2159,7 @@ int ldc_map_single(struct ldc_channel *lp,
2159 state.pte_idx = (base - iommu->page_table); 2159 state.pte_idx = (base - iommu->page_table);
2160 state.nc = 0; 2160 state.nc = 0;
2161 fill_cookies(&state, (pa & PAGE_MASK), (pa & ~PAGE_MASK), len); 2161 fill_cookies(&state, (pa & PAGE_MASK), (pa & ~PAGE_MASK), len);
2162 BUG_ON(state.nc != 1); 2162 BUG_ON(state.nc > ncookies);
2163 2163
2164 return state.nc; 2164 return state.nc;
2165} 2165}
diff --git a/arch/sparc/kernel/viohs.c b/arch/sparc/kernel/viohs.c
index f8e7dd53e1c7..7ef081a185b1 100644
--- a/arch/sparc/kernel/viohs.c
+++ b/arch/sparc/kernel/viohs.c
@@ -426,6 +426,13 @@ static int process_dreg_info(struct vio_driver_state *vio,
426 if (vio->dr_state & VIO_DR_STATE_RXREG) 426 if (vio->dr_state & VIO_DR_STATE_RXREG)
427 goto send_nack; 427 goto send_nack;
428 428
429 /* v1.6 and higher, ACK with desired, supported mode, or NACK */
430 if (vio_version_after_eq(vio, 1, 6)) {
431 if (!(pkt->options & VIO_TX_DRING))
432 goto send_nack;
433 pkt->options = VIO_TX_DRING;
434 }
435
429 BUG_ON(vio->desc_buf); 436 BUG_ON(vio->desc_buf);
430 437
431 vio->desc_buf = kzalloc(pkt->descr_size, GFP_ATOMIC); 438 vio->desc_buf = kzalloc(pkt->descr_size, GFP_ATOMIC);
@@ -453,8 +460,11 @@ static int process_dreg_info(struct vio_driver_state *vio,
453 pkt->tag.stype = VIO_SUBTYPE_ACK; 460 pkt->tag.stype = VIO_SUBTYPE_ACK;
454 pkt->dring_ident = ++dr->ident; 461 pkt->dring_ident = ++dr->ident;
455 462
456 viodbg(HS, "SEND DRING_REG ACK ident[%llx]\n", 463 viodbg(HS, "SEND DRING_REG ACK ident[%llx] "
457 (unsigned long long) pkt->dring_ident); 464 "ndesc[%u] dsz[%u] opt[0x%x] ncookies[%u]\n",
465 (unsigned long long) pkt->dring_ident,
466 pkt->num_descr, pkt->descr_size, pkt->options,
467 pkt->num_cookies);
458 468
459 len = (sizeof(*pkt) + 469 len = (sizeof(*pkt) +
460 (dr->ncookies * sizeof(struct ldc_trans_cookie))); 470 (dr->ncookies * sizeof(struct ldc_trans_cookie)));
diff --git a/arch/sparc/net/bpf_jit_asm.S b/arch/sparc/net/bpf_jit_asm.S
index 9d016c7017f7..8c83f4b8eb15 100644
--- a/arch/sparc/net/bpf_jit_asm.S
+++ b/arch/sparc/net/bpf_jit_asm.S
@@ -6,10 +6,12 @@
6#define SAVE_SZ 176 6#define SAVE_SZ 176
7#define SCRATCH_OFF STACK_BIAS + 128 7#define SCRATCH_OFF STACK_BIAS + 128
8#define BE_PTR(label) be,pn %xcc, label 8#define BE_PTR(label) be,pn %xcc, label
9#define SIGN_EXTEND(reg) sra reg, 0, reg
9#else 10#else
10#define SAVE_SZ 96 11#define SAVE_SZ 96
11#define SCRATCH_OFF 72 12#define SCRATCH_OFF 72
12#define BE_PTR(label) be label 13#define BE_PTR(label) be label
14#define SIGN_EXTEND(reg)
13#endif 15#endif
14 16
15#define SKF_MAX_NEG_OFF (-0x200000) /* SKF_LL_OFF from filter.h */ 17#define SKF_MAX_NEG_OFF (-0x200000) /* SKF_LL_OFF from filter.h */
@@ -135,6 +137,7 @@ bpf_slow_path_byte_msh:
135 save %sp, -SAVE_SZ, %sp; \ 137 save %sp, -SAVE_SZ, %sp; \
136 mov %i0, %o0; \ 138 mov %i0, %o0; \
137 mov r_OFF, %o1; \ 139 mov r_OFF, %o1; \
140 SIGN_EXTEND(%o1); \
138 call bpf_internal_load_pointer_neg_helper; \ 141 call bpf_internal_load_pointer_neg_helper; \
139 mov (LEN), %o2; \ 142 mov (LEN), %o2; \
140 mov %o0, r_TMP; \ 143 mov %o0, r_TMP; \
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index 1f76c22a6a75..f33e7c7a3bf7 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -184,7 +184,7 @@ do { \
184 */ 184 */
185#define emit_alu_K(OPCODE, K) \ 185#define emit_alu_K(OPCODE, K) \
186do { \ 186do { \
187 if (K) { \ 187 if (K || OPCODE == AND || OPCODE == MUL) { \
188 unsigned int _insn = OPCODE; \ 188 unsigned int _insn = OPCODE; \
189 _insn |= RS1(r_A) | RD(r_A); \ 189 _insn |= RS1(r_A) | RD(r_A); \
190 if (is_simm13(K)) { \ 190 if (is_simm13(K)) { \
@@ -234,12 +234,18 @@ do { BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u8)); \
234 __emit_load8(BASE, STRUCT, FIELD, DEST); \ 234 __emit_load8(BASE, STRUCT, FIELD, DEST); \
235} while (0) 235} while (0)
236 236
237#define emit_ldmem(OFF, DEST) \ 237#ifdef CONFIG_SPARC64
238do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(DEST); \ 238#define BIAS (STACK_BIAS - 4)
239#else
240#define BIAS (-4)
241#endif
242
243#define emit_ldmem(OFF, DEST) \
244do { *prog++ = LD32I | RS1(SP) | S13(BIAS - (OFF)) | RD(DEST); \
239} while (0) 245} while (0)
240 246
241#define emit_stmem(OFF, SRC) \ 247#define emit_stmem(OFF, SRC) \
242do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(SRC); \ 248do { *prog++ = ST32I | RS1(SP) | S13(BIAS - (OFF)) | RD(SRC); \
243} while (0) 249} while (0)
244 250
245#ifdef CONFIG_SMP 251#ifdef CONFIG_SMP
@@ -579,16 +585,11 @@ void bpf_jit_compile(struct bpf_prog *fp)
579 case BPF_ANC | SKF_AD_PROTOCOL: 585 case BPF_ANC | SKF_AD_PROTOCOL:
580 emit_skb_load16(protocol, r_A); 586 emit_skb_load16(protocol, r_A);
581 break; 587 break;
582#if 0
583 /* GCC won't let us take the address of
584 * a bit field even though we very much
585 * know what we are doing here.
586 */
587 case BPF_ANC | SKF_AD_PKTTYPE: 588 case BPF_ANC | SKF_AD_PKTTYPE:
588 __emit_skb_load8(pkt_type, r_A); 589 __emit_skb_load8(__pkt_type_offset, r_A);
590 emit_andi(r_A, PKT_TYPE_MAX, r_A);
589 emit_alu_K(SRL, 5); 591 emit_alu_K(SRL, 5);
590 break; 592 break;
591#endif
592 case BPF_ANC | SKF_AD_IFINDEX: 593 case BPF_ANC | SKF_AD_IFINDEX:
593 emit_skb_loadptr(dev, r_A); 594 emit_skb_loadptr(dev, r_A);
594 emit_cmpi(r_A, 0); 595 emit_cmpi(r_A, 0);
@@ -615,14 +616,20 @@ void bpf_jit_compile(struct bpf_prog *fp)
615 case BPF_ANC | SKF_AD_VLAN_TAG: 616 case BPF_ANC | SKF_AD_VLAN_TAG:
616 case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: 617 case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
617 emit_skb_load16(vlan_tci, r_A); 618 emit_skb_load16(vlan_tci, r_A);
618 if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { 619 if (code != (BPF_ANC | SKF_AD_VLAN_TAG)) {
619 emit_andi(r_A, VLAN_VID_MASK, r_A); 620 emit_alu_K(SRL, 12);
621 emit_andi(r_A, 1, r_A);
620 } else { 622 } else {
621 emit_loadimm(VLAN_TAG_PRESENT, r_TMP); 623 emit_loadimm(~VLAN_TAG_PRESENT, r_TMP);
622 emit_and(r_A, r_TMP, r_A); 624 emit_and(r_A, r_TMP, r_A);
623 } 625 }
624 break; 626 break;
625 627 case BPF_LD | BPF_W | BPF_LEN:
628 emit_skb_load32(len, r_A);
629 break;
630 case BPF_LDX | BPF_W | BPF_LEN:
631 emit_skb_load32(len, r_X);
632 break;
626 case BPF_LD | BPF_IMM: 633 case BPF_LD | BPF_IMM:
627 emit_loadimm(K, r_A); 634 emit_loadimm(K, r_A);
628 break; 635 break;
@@ -630,15 +637,19 @@ void bpf_jit_compile(struct bpf_prog *fp)
630 emit_loadimm(K, r_X); 637 emit_loadimm(K, r_X);
631 break; 638 break;
632 case BPF_LD | BPF_MEM: 639 case BPF_LD | BPF_MEM:
640 seen |= SEEN_MEM;
633 emit_ldmem(K * 4, r_A); 641 emit_ldmem(K * 4, r_A);
634 break; 642 break;
635 case BPF_LDX | BPF_MEM: 643 case BPF_LDX | BPF_MEM:
644 seen |= SEEN_MEM | SEEN_XREG;
636 emit_ldmem(K * 4, r_X); 645 emit_ldmem(K * 4, r_X);
637 break; 646 break;
638 case BPF_ST: 647 case BPF_ST:
648 seen |= SEEN_MEM;
639 emit_stmem(K * 4, r_A); 649 emit_stmem(K * 4, r_A);
640 break; 650 break;
641 case BPF_STX: 651 case BPF_STX:
652 seen |= SEEN_MEM | SEEN_XREG;
642 emit_stmem(K * 4, r_X); 653 emit_stmem(K * 4, r_X);
643 break; 654 break;
644 655
@@ -801,7 +812,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf];
801 if (image) { 812 if (image) {
802 bpf_flush_icache(image, image + proglen); 813 bpf_flush_icache(image, image + proglen);
803 fp->bpf_func = (void *)image; 814 fp->bpf_func = (void *)image;
804 fp->jited = 1; 815 fp->jited = true;
805 } 816 }
806out: 817out:
807 kfree(addrs); 818 kfree(addrs);
@@ -812,5 +823,6 @@ void bpf_jit_free(struct bpf_prog *fp)
812{ 823{
813 if (fp->jited) 824 if (fp->jited)
814 module_free(NULL, fp->bpf_func); 825 module_free(NULL, fp->bpf_func);
815 kfree(fp); 826
827 bpf_prog_unlock_free(fp);
816} 828}
diff --git a/arch/sparc/power/hibernate.c b/arch/sparc/power/hibernate.c
index 42b0b8ce699a..17bd2e167e07 100644
--- a/arch/sparc/power/hibernate.c
+++ b/arch/sparc/power/hibernate.c
@@ -9,11 +9,9 @@
9#include <asm/hibernate.h> 9#include <asm/hibernate.h>
10#include <asm/visasm.h> 10#include <asm/visasm.h>
11#include <asm/page.h> 11#include <asm/page.h>
12#include <asm/sections.h>
12#include <asm/tlb.h> 13#include <asm/tlb.h>
13 14
14/* References to section boundaries */
15extern const void __nosave_begin, __nosave_end;
16
17struct saved_context saved_context; 15struct saved_context saved_context;
18 16
19/* 17/*
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index a3ffe2dd4832..7cca41842a9e 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -134,6 +134,7 @@ config TILEGX
134 select HAVE_KPROBES 134 select HAVE_KPROBES
135 select HAVE_KRETPROBES 135 select HAVE_KRETPROBES
136 select HAVE_ARCH_KGDB 136 select HAVE_ARCH_KGDB
137 select ARCH_SUPPORTS_ATOMIC_RMW
137 138
138config TILEPRO 139config TILEPRO
139 def_bool !TILEGX 140 def_bool !TILEGX
@@ -191,8 +192,6 @@ source "kernel/Kconfig.hz"
191 192
192config KEXEC 193config KEXEC
193 bool "kexec system call" 194 bool "kexec system call"
194 select CRYPTO
195 select CRYPTO_SHA256
196 ---help--- 195 ---help---
197 kexec is a system call that implements the ability to shutdown your 196 kexec is a system call that implements the ability to shutdown your
198 current kernel, and to start another kernel. It is like a reboot 197 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/tile/gxio/mpipe.c b/arch/tile/gxio/mpipe.c
index 5301a9ffbae1..320ff5e6e61e 100644
--- a/arch/tile/gxio/mpipe.c
+++ b/arch/tile/gxio/mpipe.c
@@ -29,6 +29,32 @@
29/* HACK: Avoid pointless "shadow" warnings. */ 29/* HACK: Avoid pointless "shadow" warnings. */
30#define link link_shadow 30#define link link_shadow
31 31
32/**
33 * strscpy - Copy a C-string into a sized buffer, but only if it fits
34 * @dest: Where to copy the string to
35 * @src: Where to copy the string from
36 * @size: size of destination buffer
37 *
38 * Use this routine to avoid copying too-long strings.
39 * The routine returns the total number of bytes copied
40 * (including the trailing NUL) or zero if the buffer wasn't
41 * big enough. To ensure that programmers pay attention
42 * to the return code, the destination has a single NUL
43 * written at the front (if size is non-zero) when the
44 * buffer is not big enough.
45 */
46static size_t strscpy(char *dest, const char *src, size_t size)
47{
48 size_t len = strnlen(src, size) + 1;
49 if (len > size) {
50 if (size)
51 dest[0] = '\0';
52 return 0;
53 }
54 memcpy(dest, src, len);
55 return len;
56}
57
32int gxio_mpipe_init(gxio_mpipe_context_t *context, unsigned int mpipe_index) 58int gxio_mpipe_init(gxio_mpipe_context_t *context, unsigned int mpipe_index)
33{ 59{
34 char file[32]; 60 char file[32];
@@ -511,8 +537,8 @@ int gxio_mpipe_link_instance(const char *link_name)
511 if (!context) 537 if (!context)
512 return GXIO_ERR_NO_DEVICE; 538 return GXIO_ERR_NO_DEVICE;
513 539
514 strncpy(name.name, link_name, sizeof(name.name)); 540 if (strscpy(name.name, link_name, sizeof(name.name)) == 0)
515 name.name[GXIO_MPIPE_LINK_NAME_LEN - 1] = '\0'; 541 return GXIO_ERR_NO_DEVICE;
516 542
517 return gxio_mpipe_info_instance_aux(context, name); 543 return gxio_mpipe_info_instance_aux(context, name);
518} 544}
@@ -529,7 +555,8 @@ int gxio_mpipe_link_enumerate_mac(int idx, char *link_name, uint8_t *link_mac)
529 555
530 rv = gxio_mpipe_info_enumerate_aux(context, idx, &name, &mac); 556 rv = gxio_mpipe_info_enumerate_aux(context, idx, &name, &mac);
531 if (rv >= 0) { 557 if (rv >= 0) {
532 strncpy(link_name, name.name, sizeof(name.name)); 558 if (strscpy(link_name, name.name, sizeof(name.name)) == 0)
559 return GXIO_ERR_INVAL_MEMORY_SIZE;
533 memcpy(link_mac, mac.mac, sizeof(mac.mac)); 560 memcpy(link_mac, mac.mac, sizeof(mac.mac));
534 } 561 }
535 562
@@ -545,8 +572,8 @@ int gxio_mpipe_link_open(gxio_mpipe_link_t *link,
545 _gxio_mpipe_link_name_t name; 572 _gxio_mpipe_link_name_t name;
546 int rv; 573 int rv;
547 574
548 strncpy(name.name, link_name, sizeof(name.name)); 575 if (strscpy(name.name, link_name, sizeof(name.name)) == 0)
549 name.name[GXIO_MPIPE_LINK_NAME_LEN - 1] = '\0'; 576 return GXIO_ERR_NO_DEVICE;
550 577
551 rv = gxio_mpipe_link_open_aux(context, name, flags); 578 rv = gxio_mpipe_link_open_aux(context, name, flags);
552 if (rv < 0) 579 if (rv < 0)
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 0aa5675e7025..e6462b8a6284 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -17,6 +17,7 @@ generic-y += ioctl.h
17generic-y += ioctls.h 17generic-y += ioctls.h
18generic-y += ipcbuf.h 18generic-y += ipcbuf.h
19generic-y += irq_regs.h 19generic-y += irq_regs.h
20generic-y += irq_work.h
20generic-y += local.h 21generic-y += local.h
21generic-y += local64.h 22generic-y += local64.h
22generic-y += mcs_spinlock.h 23generic-y += mcs_spinlock.h
diff --git a/arch/tile/include/asm/sections.h b/arch/tile/include/asm/sections.h
index 5d5d3b739a6b..86a746243dc8 100644
--- a/arch/tile/include/asm/sections.h
+++ b/arch/tile/include/asm/sections.h
@@ -19,9 +19,6 @@
19 19
20#include <asm-generic/sections.h> 20#include <asm-generic/sections.h>
21 21
22/* Text and data are at different areas in the kernel VA space. */
23extern char _sinitdata[], _einitdata[];
24
25/* Write-once data is writable only till the end of initialization. */ 22/* Write-once data is writable only till the end of initialization. */
26extern char __w1data_begin[], __w1data_end[]; 23extern char __w1data_begin[], __w1data_end[];
27 24
diff --git a/arch/tile/include/asm/vdso.h b/arch/tile/include/asm/vdso.h
index 9f6a78d665fa..9b069692153f 100644
--- a/arch/tile/include/asm/vdso.h
+++ b/arch/tile/include/asm/vdso.h
@@ -15,6 +15,7 @@
15#ifndef __TILE_VDSO_H__ 15#ifndef __TILE_VDSO_H__
16#define __TILE_VDSO_H__ 16#define __TILE_VDSO_H__
17 17
18#include <linux/seqlock.h>
18#include <linux/types.h> 19#include <linux/types.h>
19 20
20/* 21/*
@@ -26,15 +27,20 @@
26 */ 27 */
27 28
28struct vdso_data { 29struct vdso_data {
29 __u64 tz_update_count; /* Timezone atomicity ctr */ 30 seqcount_t tz_seq; /* Timezone seqlock */
30 __u64 tb_update_count; /* Timebase atomicity ctr */ 31 seqcount_t tb_seq; /* Timebase seqlock */
31 __u64 xtime_tod_stamp; /* TOD clock for xtime */ 32 __u64 cycle_last; /* TOD clock for xtime */
32 __u64 xtime_clock_sec; /* Kernel time second */ 33 __u64 mask; /* Cycle mask */
33 __u64 xtime_clock_nsec; /* Kernel time nanosecond */
34 __u64 wtom_clock_sec; /* Wall to monotonic clock second */
35 __u64 wtom_clock_nsec; /* Wall to monotonic clock nanosecond */
36 __u32 mult; /* Cycle to nanosecond multiplier */ 34 __u32 mult; /* Cycle to nanosecond multiplier */
37 __u32 shift; /* Cycle to nanosecond divisor (power of two) */ 35 __u32 shift; /* Cycle to nanosecond divisor (power of two) */
36 __u64 wall_time_sec;
37 __u64 wall_time_snsec;
38 __u64 monotonic_time_sec;
39 __u64 monotonic_time_snsec;
40 __u64 wall_time_coarse_sec;
41 __u64 wall_time_coarse_nsec;
42 __u64 monotonic_time_coarse_sec;
43 __u64 monotonic_time_coarse_nsec;
38 __u32 tz_minuteswest; /* Minutes west of Greenwich */ 44 __u32 tz_minuteswest; /* Minutes west of Greenwich */
39 __u32 tz_dsttime; /* Type of dst correction */ 45 __u32 tz_dsttime; /* Type of dst correction */
40}; 46};
diff --git a/arch/tile/include/uapi/arch/sim_def.h b/arch/tile/include/uapi/arch/sim_def.h
index 4b44a2b6a09a..1c069537ae41 100644
--- a/arch/tile/include/uapi/arch/sim_def.h
+++ b/arch/tile/include/uapi/arch/sim_def.h
@@ -360,19 +360,19 @@
360 * @{ 360 * @{
361 */ 361 */
362 362
363/** Use with with SIM_PROFILER_CHIP_xxx to control the memory controllers. */ 363/** Use with SIM_PROFILER_CHIP_xxx to control the memory controllers. */
364#define SIM_CHIP_MEMCTL 0x001 364#define SIM_CHIP_MEMCTL 0x001
365 365
366/** Use with with SIM_PROFILER_CHIP_xxx to control the XAUI interface. */ 366/** Use with SIM_PROFILER_CHIP_xxx to control the XAUI interface. */
367#define SIM_CHIP_XAUI 0x002 367#define SIM_CHIP_XAUI 0x002
368 368
369/** Use with with SIM_PROFILER_CHIP_xxx to control the PCIe interface. */ 369/** Use with SIM_PROFILER_CHIP_xxx to control the PCIe interface. */
370#define SIM_CHIP_PCIE 0x004 370#define SIM_CHIP_PCIE 0x004
371 371
372/** Use with with SIM_PROFILER_CHIP_xxx to control the MPIPE interface. */ 372/** Use with SIM_PROFILER_CHIP_xxx to control the MPIPE interface. */
373#define SIM_CHIP_MPIPE 0x008 373#define SIM_CHIP_MPIPE 0x008
374 374
375/** Use with with SIM_PROFILER_CHIP_xxx to control the TRIO interface. */ 375/** Use with SIM_PROFILER_CHIP_xxx to control the TRIO interface. */
376#define SIM_CHIP_TRIO 0x010 376#define SIM_CHIP_TRIO 0x010
377 377
378/** Reference all chip devices. */ 378/** Reference all chip devices. */
diff --git a/arch/tile/kernel/smp.c b/arch/tile/kernel/smp.c
index 01e8ab29f43a..19eaa62d456a 100644
--- a/arch/tile/kernel/smp.c
+++ b/arch/tile/kernel/smp.c
@@ -183,6 +183,7 @@ void flush_icache_range(unsigned long start, unsigned long end)
183 preempt_enable(); 183 preempt_enable();
184 } 184 }
185} 185}
186EXPORT_SYMBOL(flush_icache_range);
186 187
187 188
188/* Called when smp_send_reschedule() triggers IRQ_RESCHEDULE. */ 189/* Called when smp_send_reschedule() triggers IRQ_RESCHEDULE. */
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index d8fbc289e680..c1b362277fb7 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -249,33 +249,52 @@ cycles_t ns2cycles(unsigned long nsecs)
249 249
250void update_vsyscall_tz(void) 250void update_vsyscall_tz(void)
251{ 251{
252 /* Userspace gettimeofday will spin while this value is odd. */ 252 write_seqcount_begin(&vdso_data->tz_seq);
253 ++vdso_data->tz_update_count;
254 smp_wmb();
255 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; 253 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
256 vdso_data->tz_dsttime = sys_tz.tz_dsttime; 254 vdso_data->tz_dsttime = sys_tz.tz_dsttime;
257 smp_wmb(); 255 write_seqcount_end(&vdso_data->tz_seq);
258 ++vdso_data->tz_update_count;
259} 256}
260 257
261void update_vsyscall(struct timekeeper *tk) 258void update_vsyscall(struct timekeeper *tk)
262{ 259{
263 struct timespec *wtm = &tk->wall_to_monotonic; 260 if (tk->tkr.clock != &cycle_counter_cs)
264 struct clocksource *clock = tk->tkr.clock;
265
266 if (clock != &cycle_counter_cs)
267 return; 261 return;
268 262
269 /* Userspace gettimeofday will spin while this value is odd. */ 263 write_seqcount_begin(&vdso_data->tb_seq);
270 ++vdso_data->tb_update_count; 264
271 smp_wmb(); 265 vdso_data->cycle_last = tk->tkr.cycle_last;
272 vdso_data->xtime_tod_stamp = tk->tkr.cycle_last; 266 vdso_data->mask = tk->tkr.mask;
273 vdso_data->xtime_clock_sec = tk->xtime_sec; 267 vdso_data->mult = tk->tkr.mult;
274 vdso_data->xtime_clock_nsec = tk->tkr.xtime_nsec; 268 vdso_data->shift = tk->tkr.shift;
275 vdso_data->wtom_clock_sec = wtm->tv_sec; 269
276 vdso_data->wtom_clock_nsec = wtm->tv_nsec; 270 vdso_data->wall_time_sec = tk->xtime_sec;
277 vdso_data->mult = tk->tkr.mult; 271 vdso_data->wall_time_snsec = tk->tkr.xtime_nsec;
278 vdso_data->shift = tk->tkr.shift; 272
279 smp_wmb(); 273 vdso_data->monotonic_time_sec = tk->xtime_sec
280 ++vdso_data->tb_update_count; 274 + tk->wall_to_monotonic.tv_sec;
275 vdso_data->monotonic_time_snsec = tk->tkr.xtime_nsec
276 + ((u64)tk->wall_to_monotonic.tv_nsec
277 << tk->tkr.shift);
278 while (vdso_data->monotonic_time_snsec >=
279 (((u64)NSEC_PER_SEC) << tk->tkr.shift)) {
280 vdso_data->monotonic_time_snsec -=
281 ((u64)NSEC_PER_SEC) << tk->tkr.shift;
282 vdso_data->monotonic_time_sec++;
283 }
284
285 vdso_data->wall_time_coarse_sec = tk->xtime_sec;
286 vdso_data->wall_time_coarse_nsec = (long)(tk->tkr.xtime_nsec >>
287 tk->tkr.shift);
288
289 vdso_data->monotonic_time_coarse_sec =
290 vdso_data->wall_time_coarse_sec + tk->wall_to_monotonic.tv_sec;
291 vdso_data->monotonic_time_coarse_nsec =
292 vdso_data->wall_time_coarse_nsec + tk->wall_to_monotonic.tv_nsec;
293
294 while (vdso_data->monotonic_time_coarse_nsec >= NSEC_PER_SEC) {
295 vdso_data->monotonic_time_coarse_nsec -= NSEC_PER_SEC;
296 vdso_data->monotonic_time_coarse_sec++;
297 }
298
299 write_seqcount_end(&vdso_data->tb_seq);
281} 300}
diff --git a/arch/tile/kernel/traps.c b/arch/tile/kernel/traps.c
index f3ceb6308e42..86900ccd4977 100644
--- a/arch/tile/kernel/traps.c
+++ b/arch/tile/kernel/traps.c
@@ -277,7 +277,7 @@ void __kprobes do_trap(struct pt_regs *regs, int fault_num,
277 if (fixup_exception(regs)) /* ILL_TRANS or UNALIGN_DATA */ 277 if (fixup_exception(regs)) /* ILL_TRANS or UNALIGN_DATA */
278 return; 278 return;
279 if (fault_num >= 0 && 279 if (fault_num >= 0 &&
280 fault_num < sizeof(int_name)/sizeof(int_name[0]) && 280 fault_num < ARRAY_SIZE(int_name) &&
281 int_name[fault_num] != NULL) 281 int_name[fault_num] != NULL)
282 name = int_name[fault_num]; 282 name = int_name[fault_num];
283 else 283 else
diff --git a/arch/tile/kernel/vdso/vdso.lds.S b/arch/tile/kernel/vdso/vdso.lds.S
index 041cd6c39c83..731529f3f06f 100644
--- a/arch/tile/kernel/vdso/vdso.lds.S
+++ b/arch/tile/kernel/vdso/vdso.lds.S
@@ -82,6 +82,8 @@ VERSION
82 __vdso_rt_sigreturn; 82 __vdso_rt_sigreturn;
83 __vdso_gettimeofday; 83 __vdso_gettimeofday;
84 gettimeofday; 84 gettimeofday;
85 __vdso_clock_gettime;
86 clock_gettime;
85 local:*; 87 local:*;
86 }; 88 };
87} 89}
diff --git a/arch/tile/kernel/vdso/vgettimeofday.c b/arch/tile/kernel/vdso/vgettimeofday.c
index e933fb9fbf5c..8bb21eda07d8 100644
--- a/arch/tile/kernel/vdso/vgettimeofday.c
+++ b/arch/tile/kernel/vdso/vgettimeofday.c
@@ -15,6 +15,7 @@
15#define VDSO_BUILD /* avoid some shift warnings for -m32 in <asm/page.h> */ 15#define VDSO_BUILD /* avoid some shift warnings for -m32 in <asm/page.h> */
16#include <linux/time.h> 16#include <linux/time.h>
17#include <asm/timex.h> 17#include <asm/timex.h>
18#include <asm/unistd.h>
18#include <asm/vdso.h> 19#include <asm/vdso.h>
19 20
20#if CHIP_HAS_SPLIT_CYCLE() 21#if CHIP_HAS_SPLIT_CYCLE()
@@ -35,6 +36,11 @@ static inline cycles_t get_cycles_inline(void)
35#define get_cycles get_cycles_inline 36#define get_cycles get_cycles_inline
36#endif 37#endif
37 38
39struct syscall_return_value {
40 long value;
41 long error;
42};
43
38/* 44/*
39 * Find out the vDSO data page address in the process address space. 45 * Find out the vDSO data page address in the process address space.
40 */ 46 */
@@ -50,59 +56,143 @@ inline unsigned long get_datapage(void)
50 return ret; 56 return ret;
51} 57}
52 58
53int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 59static inline u64 vgetsns(struct vdso_data *vdso)
60{
61 return ((get_cycles() - vdso->cycle_last) & vdso->mask) * vdso->mult;
62}
63
64static inline int do_realtime(struct vdso_data *vdso, struct timespec *ts)
65{
66 unsigned count;
67 u64 ns;
68
69 do {
70 count = read_seqcount_begin(&vdso->tb_seq);
71 ts->tv_sec = vdso->wall_time_sec;
72 ns = vdso->wall_time_snsec;
73 ns += vgetsns(vdso);
74 ns >>= vdso->shift;
75 } while (unlikely(read_seqcount_retry(&vdso->tb_seq, count)));
76
77 ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns);
78 ts->tv_nsec = ns;
79
80 return 0;
81}
82
83static inline int do_monotonic(struct vdso_data *vdso, struct timespec *ts)
84{
85 unsigned count;
86 u64 ns;
87
88 do {
89 count = read_seqcount_begin(&vdso->tb_seq);
90 ts->tv_sec = vdso->monotonic_time_sec;
91 ns = vdso->monotonic_time_snsec;
92 ns += vgetsns(vdso);
93 ns >>= vdso->shift;
94 } while (unlikely(read_seqcount_retry(&vdso->tb_seq, count)));
95
96 ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns);
97 ts->tv_nsec = ns;
98
99 return 0;
100}
101
102static inline int do_realtime_coarse(struct vdso_data *vdso,
103 struct timespec *ts)
104{
105 unsigned count;
106
107 do {
108 count = read_seqcount_begin(&vdso->tb_seq);
109 ts->tv_sec = vdso->wall_time_coarse_sec;
110 ts->tv_nsec = vdso->wall_time_coarse_nsec;
111 } while (unlikely(read_seqcount_retry(&vdso->tb_seq, count)));
112
113 return 0;
114}
115
116static inline int do_monotonic_coarse(struct vdso_data *vdso,
117 struct timespec *ts)
54{ 118{
55 cycles_t cycles; 119 unsigned count;
56 unsigned long count, sec, ns; 120
57 volatile struct vdso_data *vdso_data; 121 do {
122 count = read_seqcount_begin(&vdso->tb_seq);
123 ts->tv_sec = vdso->monotonic_time_coarse_sec;
124 ts->tv_nsec = vdso->monotonic_time_coarse_nsec;
125 } while (unlikely(read_seqcount_retry(&vdso->tb_seq, count)));
126
127 return 0;
128}
129
130struct syscall_return_value __vdso_gettimeofday(struct timeval *tv,
131 struct timezone *tz)
132{
133 struct syscall_return_value ret = { 0, 0 };
134 unsigned count;
135 struct vdso_data *vdso = (struct vdso_data *)get_datapage();
58 136
59 vdso_data = (struct vdso_data *)get_datapage();
60 /* The use of the timezone is obsolete, normally tz is NULL. */ 137 /* The use of the timezone is obsolete, normally tz is NULL. */
61 if (unlikely(tz != NULL)) { 138 if (unlikely(tz != NULL)) {
62 while (1) { 139 do {
63 /* Spin until the update finish. */ 140 count = read_seqcount_begin(&vdso->tz_seq);
64 count = vdso_data->tz_update_count; 141 tz->tz_minuteswest = vdso->tz_minuteswest;
65 if (count & 1) 142 tz->tz_dsttime = vdso->tz_dsttime;
66 continue; 143 } while (unlikely(read_seqcount_retry(&vdso->tz_seq, count)));
67
68 tz->tz_minuteswest = vdso_data->tz_minuteswest;
69 tz->tz_dsttime = vdso_data->tz_dsttime;
70
71 /* Check whether updated, read again if so. */
72 if (count == vdso_data->tz_update_count)
73 break;
74 }
75 } 144 }
76 145
77 if (unlikely(tv == NULL)) 146 if (unlikely(tv == NULL))
78 return 0; 147 return ret;
79
80 while (1) {
81 /* Spin until the update finish. */
82 count = vdso_data->tb_update_count;
83 if (count & 1)
84 continue;
85
86 sec = vdso_data->xtime_clock_sec;
87 cycles = get_cycles() - vdso_data->xtime_tod_stamp;
88 ns = (cycles * vdso_data->mult) + vdso_data->xtime_clock_nsec;
89 ns >>= vdso_data->shift;
90
91 if (ns >= NSEC_PER_SEC) {
92 ns -= NSEC_PER_SEC;
93 sec += 1;
94 }
95
96 /* Check whether updated, read again if so. */
97 if (count == vdso_data->tb_update_count)
98 break;
99 }
100 148
101 tv->tv_sec = sec; 149 do_realtime(vdso, (struct timespec *)tv);
102 tv->tv_usec = ns / 1000; 150 tv->tv_usec /= 1000;
103 151
104 return 0; 152 return ret;
105} 153}
106 154
107int gettimeofday(struct timeval *tv, struct timezone *tz) 155int gettimeofday(struct timeval *tv, struct timezone *tz)
108 __attribute__((weak, alias("__vdso_gettimeofday"))); 156 __attribute__((weak, alias("__vdso_gettimeofday")));
157
158static struct syscall_return_value vdso_fallback_gettime(long clock,
159 struct timespec *ts)
160{
161 struct syscall_return_value ret;
162 __asm__ __volatile__ (
163 "swint1"
164 : "=R00" (ret.value), "=R01" (ret.error)
165 : "R10" (__NR_clock_gettime), "R00" (clock), "R01" (ts)
166 : "r2", "r3", "r4", "r5", "r6", "r7",
167 "r8", "r9", "r11", "r12", "r13", "r14", "r15",
168 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
169 "r24", "r25", "r26", "r27", "r28", "r29", "memory");
170 return ret;
171}
172
173struct syscall_return_value __vdso_clock_gettime(clockid_t clock,
174 struct timespec *ts)
175{
176 struct vdso_data *vdso = (struct vdso_data *)get_datapage();
177 struct syscall_return_value ret = { 0, 0 };
178
179 switch (clock) {
180 case CLOCK_REALTIME:
181 do_realtime(vdso, ts);
182 return ret;
183 case CLOCK_MONOTONIC:
184 do_monotonic(vdso, ts);
185 return ret;
186 case CLOCK_REALTIME_COARSE:
187 do_realtime_coarse(vdso, ts);
188 return ret;
189 case CLOCK_MONOTONIC_COARSE:
190 do_monotonic_coarse(vdso, ts);
191 return ret;
192 default:
193 return vdso_fallback_gettime(clock, ts);
194 }
195}
196
197int clock_gettime(clockid_t clock, struct timespec *ts)
198 __attribute__((weak, alias("__vdso_clock_gettime")));
diff --git a/arch/tile/kernel/vmlinux.lds.S b/arch/tile/kernel/vmlinux.lds.S
index f1819423ffc9..0e059a0101ea 100644
--- a/arch/tile/kernel/vmlinux.lds.S
+++ b/arch/tile/kernel/vmlinux.lds.S
@@ -66,11 +66,9 @@ SECTIONS
66 66
67 . = ALIGN(PAGE_SIZE); 67 . = ALIGN(PAGE_SIZE);
68 __init_begin = .; 68 __init_begin = .;
69 VMLINUX_SYMBOL(_sinitdata) = .;
70 INIT_DATA_SECTION(16) :data =0 69 INIT_DATA_SECTION(16) :data =0
71 PERCPU_SECTION(L2_CACHE_BYTES) 70 PERCPU_SECTION(L2_CACHE_BYTES)
72 . = ALIGN(PAGE_SIZE); 71 . = ALIGN(PAGE_SIZE);
73 VMLINUX_SYMBOL(_einitdata) = .;
74 __init_end = .; 72 __init_end = .;
75 73
76 _sdata = .; /* Start of data section */ 74 _sdata = .; /* Start of data section */
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index bfb3127b4df9..a092e393bd20 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -254,8 +254,8 @@ static pgprot_t __init init_pgprot(ulong address)
254 * Everything else that isn't data or bss is heap, so mark it 254 * Everything else that isn't data or bss is heap, so mark it
255 * with the initial heap home (hash-for-home, or this cpu). This 255 * with the initial heap home (hash-for-home, or this cpu). This
256 * includes any addresses after the loaded image and any address before 256 * includes any addresses after the loaded image and any address before
257 * _einitdata, since we already captured the case of text before 257 * __init_end, since we already captured the case of text before
258 * _sinittext, and __pa(einittext) is approximately __pa(sinitdata). 258 * _sinittext, and __pa(einittext) is approximately __pa(__init_begin).
259 * 259 *
260 * All the LOWMEM pages that we mark this way will get their 260 * All the LOWMEM pages that we mark this way will get their
261 * struct page homecache properly marked later, in set_page_homes(). 261 * struct page homecache properly marked later, in set_page_homes().
@@ -263,7 +263,7 @@ static pgprot_t __init init_pgprot(ulong address)
263 * homes, but with a zero free_time we don't have to actually 263 * homes, but with a zero free_time we don't have to actually
264 * do a flush action the first time we use them, either. 264 * do a flush action the first time we use them, either.
265 */ 265 */
266 if (address >= (ulong) _end || address < (ulong) _einitdata) 266 if (address >= (ulong) _end || address < (ulong) __init_end)
267 return construct_pgprot(PAGE_KERNEL, initial_heap_home()); 267 return construct_pgprot(PAGE_KERNEL, initial_heap_home());
268 268
269 /* Use hash-for-home if requested for data/bss. */ 269 /* Use hash-for-home if requested for data/bss. */
@@ -632,7 +632,7 @@ int devmem_is_allowed(unsigned long pagenr)
632{ 632{
633 return pagenr < kaddr_to_pfn(_end) && 633 return pagenr < kaddr_to_pfn(_end) &&
634 !(pagenr >= kaddr_to_pfn(&init_thread_union) || 634 !(pagenr >= kaddr_to_pfn(&init_thread_union) ||
635 pagenr < kaddr_to_pfn(_einitdata)) && 635 pagenr < kaddr_to_pfn(__init_end)) &&
636 !(pagenr >= kaddr_to_pfn(_sinittext) || 636 !(pagenr >= kaddr_to_pfn(_sinittext) ||
637 pagenr <= kaddr_to_pfn(_einittext-1)); 637 pagenr <= kaddr_to_pfn(_einittext-1));
638} 638}
@@ -975,8 +975,8 @@ void free_initmem(void)
975 975
976 /* Free the data pages that we won't use again after init. */ 976 /* Free the data pages that we won't use again after init. */
977 free_init_pages("unused kernel data", 977 free_init_pages("unused kernel data",
978 (unsigned long)_sinitdata, 978 (unsigned long)__init_begin,
979 (unsigned long)_einitdata); 979 (unsigned long)__init_end);
980 980
981 /* 981 /*
982 * Free the pages mapped from 0xc0000000 that correspond to code 982 * Free the pages mapped from 0xc0000000 that correspond to code
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index 7bd64aa2e94a..244b12c8cb39 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -14,6 +14,7 @@ generic-y += hash.h
14generic-y += hw_irq.h 14generic-y += hw_irq.h
15generic-y += io.h 15generic-y += io.h
16generic-y += irq_regs.h 16generic-y += irq_regs.h
17generic-y += irq_work.h
17generic-y += kdebug.h 18generic-y += kdebug.h
18generic-y += mcs_spinlock.h 19generic-y += mcs_spinlock.h
19generic-y += mutex.h 20generic-y += mutex.h
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild
index 1e5fb872a4aa..5a2bb53faa42 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -22,6 +22,7 @@ generic-y += ioctl.h
22generic-y += ioctls.h 22generic-y += ioctls.h
23generic-y += ipcbuf.h 23generic-y += ipcbuf.h
24generic-y += irq_regs.h 24generic-y += irq_regs.h
25generic-y += irq_work.h
25generic-y += kdebug.h 26generic-y += kdebug.h
26generic-y += kmap_types.h 27generic-y += kmap_types.h
27generic-y += local.h 28generic-y += local.h
diff --git a/arch/unicore32/include/mach/pm.h b/arch/unicore32/include/mach/pm.h
index 4dcd34ae194c..77b522694e74 100644
--- a/arch/unicore32/include/mach/pm.h
+++ b/arch/unicore32/include/mach/pm.h
@@ -36,8 +36,5 @@ extern int puv3_pm_enter(suspend_state_t state);
36/* Defined in hibernate_asm.S */ 36/* Defined in hibernate_asm.S */
37extern int restore_image(pgd_t *resume_pg_dir, struct pbe *restore_pblist); 37extern int restore_image(pgd_t *resume_pg_dir, struct pbe *restore_pblist);
38 38
39/* References to section boundaries */
40extern const void __nosave_begin, __nosave_end;
41
42extern struct pbe *restore_pblist; 39extern struct pbe *restore_pblist;
43#endif 40#endif
diff --git a/arch/unicore32/kernel/hibernate.c b/arch/unicore32/kernel/hibernate.c
index d75ef8b6cb56..9969ec374abb 100644
--- a/arch/unicore32/kernel/hibernate.c
+++ b/arch/unicore32/kernel/hibernate.c
@@ -18,6 +18,7 @@
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/pgtable.h> 19#include <asm/pgtable.h>
20#include <asm/pgalloc.h> 20#include <asm/pgalloc.h>
21#include <asm/sections.h>
21#include <asm/suspend.h> 22#include <asm/suspend.h>
22 23
23#include "mach/pm.h" 24#include "mach/pm.h"
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c
index 780d77388dec..7c8fb7018dc6 100644
--- a/arch/unicore32/kernel/signal.c
+++ b/arch/unicore32/kernel/signal.c
@@ -254,7 +254,8 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
254 254
255 err |= setup_sigframe(frame, regs, set); 255 err |= setup_sigframe(frame, regs, set);
256 if (err == 0) 256 if (err == 0)
257 err |= setup_return(regs, &ksig->ka, frame->retcode, frame, usig); 257 err |= setup_return(regs, &ksig->ka, frame->retcode, frame,
258 ksig->sig);
258 259
259 return err; 260 return err;
260} 261}
@@ -276,7 +277,8 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
276 err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp); 277 err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp);
277 err |= setup_sigframe(&frame->sig, regs, set); 278 err |= setup_sigframe(&frame->sig, regs, set);
278 if (err == 0) 279 if (err == 0)
279 err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig); 280 err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame,
281 ksig->sig);
280 282
281 if (err == 0) { 283 if (err == 0) {
282 /* 284 /*
@@ -303,7 +305,6 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs,
303 int syscall) 305 int syscall)
304{ 306{
305 struct thread_info *thread = current_thread_info(); 307 struct thread_info *thread = current_thread_info();
306 struct task_struct *tsk = current;
307 sigset_t *oldset = sigmask_to_save(); 308 sigset_t *oldset = sigmask_to_save();
308 int usig = ksig->sig; 309 int usig = ksig->sig;
309 int ret; 310 int ret;
@@ -373,7 +374,7 @@ static void do_signal(struct pt_regs *regs, int syscall)
373 if (!user_mode(regs)) 374 if (!user_mode(regs))
374 return; 375 return;
375 376
376 if (get_signsl(&ksig)) { 377 if (get_signal(&ksig)) {
377 handle_signal(&ksig, regs, syscall); 378 handle_signal(&ksig, regs, syscall);
378 return; 379 return;
379 } 380 }
diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
index 61b6d51866f8..3942f74c92d7 100644
--- a/arch/x86/Kbuild
+++ b/arch/x86/Kbuild
@@ -17,6 +17,4 @@ obj-$(CONFIG_IA32_EMULATION) += ia32/
17obj-y += platform/ 17obj-y += platform/
18obj-y += net/ 18obj-y += net/
19 19
20ifeq ($(CONFIG_X86_64),y) 20obj-$(CONFIG_KEXEC_FILE) += purgatory/
21obj-$(CONFIG_KEXEC) += purgatory/
22endif
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5d0bf1aa9dcb..3eb8a41509b3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -23,13 +23,13 @@ config X86
23 def_bool y 23 def_bool y
24 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI 24 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
25 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 25 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
26 select ARCH_HAS_FAST_MULTIPLIER
26 select ARCH_MIGHT_HAVE_PC_PARPORT 27 select ARCH_MIGHT_HAVE_PC_PARPORT
27 select ARCH_MIGHT_HAVE_PC_SERIO 28 select ARCH_MIGHT_HAVE_PC_SERIO
28 select HAVE_AOUT if X86_32 29 select HAVE_AOUT if X86_32
29 select HAVE_UNSTABLE_SCHED_CLOCK 30 select HAVE_UNSTABLE_SCHED_CLOCK
30 select ARCH_SUPPORTS_NUMA_BALANCING if X86_64 31 select ARCH_SUPPORTS_NUMA_BALANCING if X86_64
31 select ARCH_SUPPORTS_INT128 if X86_64 32 select ARCH_SUPPORTS_INT128 if X86_64
32 select ARCH_WANTS_PROT_NUMA_PROT_NONE
33 select HAVE_IDE 33 select HAVE_IDE
34 select HAVE_OPROFILE 34 select HAVE_OPROFILE
35 select HAVE_PCSPKR_PLATFORM 35 select HAVE_PCSPKR_PLATFORM
@@ -136,6 +136,7 @@ config X86
136 select HAVE_ACPI_APEI if ACPI 136 select HAVE_ACPI_APEI if ACPI
137 select HAVE_ACPI_APEI_NMI if ACPI 137 select HAVE_ACPI_APEI_NMI if ACPI
138 select ACPI_LEGACY_TABLES_LOOKUP if ACPI 138 select ACPI_LEGACY_TABLES_LOOKUP if ACPI
139 select X86_FEATURE_NAMES if PROC_FS
139 140
140config INSTRUCTION_DECODER 141config INSTRUCTION_DECODER
141 def_bool y 142 def_bool y
@@ -313,6 +314,17 @@ config SMP
313 314
314 If you don't know what to do here, say N. 315 If you don't know what to do here, say N.
315 316
317config X86_FEATURE_NAMES
318 bool "Processor feature human-readable names" if EMBEDDED
319 default y
320 ---help---
321 This option compiles in a table of x86 feature bits and corresponding
322 names. This is required to support /proc/cpuinfo and a few kernel
323 messages. You can disable this to save space, at the expense of
324 making those few kernel messages show numeric feature bits instead.
325
326 If in doubt, say Y.
327
316config X86_X2APIC 328config X86_X2APIC
317 bool "Support x2apic" 329 bool "Support x2apic"
318 depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP 330 depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
@@ -1585,9 +1597,6 @@ source kernel/Kconfig.hz
1585 1597
1586config KEXEC 1598config KEXEC
1587 bool "kexec system call" 1599 bool "kexec system call"
1588 select BUILD_BIN2C
1589 select CRYPTO
1590 select CRYPTO_SHA256
1591 ---help--- 1600 ---help---
1592 kexec is a system call that implements the ability to shutdown your 1601 kexec is a system call that implements the ability to shutdown your
1593 current kernel, and to start another kernel. It is like a reboot 1602 current kernel, and to start another kernel. It is like a reboot
@@ -1602,9 +1611,22 @@ config KEXEC
1602 interface is strongly in flux, so no good recommendation can be 1611 interface is strongly in flux, so no good recommendation can be
1603 made. 1612 made.
1604 1613
1614config KEXEC_FILE
1615 bool "kexec file based system call"
1616 select BUILD_BIN2C
1617 depends on KEXEC
1618 depends on X86_64
1619 depends on CRYPTO=y
1620 depends on CRYPTO_SHA256=y
1621 ---help---
1622 This is new version of kexec system call. This system call is
1623 file based and takes file descriptors as system call argument
1624 for kernel and initramfs as opposed to list of segments as
1625 accepted by previous system call.
1626
1605config KEXEC_VERIFY_SIG 1627config KEXEC_VERIFY_SIG
1606 bool "Verify kernel signature during kexec_file_load() syscall" 1628 bool "Verify kernel signature during kexec_file_load() syscall"
1607 depends on KEXEC 1629 depends on KEXEC_FILE
1608 ---help--- 1630 ---help---
1609 This option makes kernel signature verification mandatory for 1631 This option makes kernel signature verification mandatory for
1610 kexec_file_load() syscall. If kernel is signature can not be 1632 kexec_file_load() syscall. If kernel is signature can not be
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index c1aa36887843..5692d6ac0f18 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -184,11 +184,8 @@ archheaders:
184 $(Q)$(MAKE) $(build)=arch/x86/syscalls all 184 $(Q)$(MAKE) $(build)=arch/x86/syscalls all
185 185
186archprepare: 186archprepare:
187ifeq ($(CONFIG_KEXEC),y) 187ifeq ($(CONFIG_KEXEC_FILE),y)
188# Build only for 64bit. No loaders for 32bit yet.
189 ifeq ($(CONFIG_X86_64),y)
190 $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c 188 $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c
191 endif
192endif 189endif
193 190
194### 191###
@@ -254,12 +251,7 @@ archclean:
254 $(Q)rm -rf $(objtree)/arch/x86_64 251 $(Q)rm -rf $(objtree)/arch/x86_64
255 $(Q)$(MAKE) $(clean)=$(boot) 252 $(Q)$(MAKE) $(clean)=$(boot)
256 $(Q)$(MAKE) $(clean)=arch/x86/tools 253 $(Q)$(MAKE) $(clean)=arch/x86/tools
257 254 $(Q)$(MAKE) $(clean)=arch/x86/purgatory
258PHONY += kvmconfig
259kvmconfig:
260 $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
261 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(srctree)/arch/x86/configs/kvm_guest.config
262 $(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
263 255
264define archhelp 256define archhelp
265 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' 257 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
@@ -274,5 +266,4 @@ define archhelp
274 echo ' bzdisk/fdimage*/isoimage also accept:' 266 echo ' bzdisk/fdimage*/isoimage also accept:'
275 echo ' FDARGS="..." arguments for the booted kernel' 267 echo ' FDARGS="..." arguments for the booted kernel'
276 echo ' FDINITRD=file initrd for the booted kernel' 268 echo ' FDINITRD=file initrd for the booted kernel'
277 echo ' kvmconfig - Enable additional options for guest kernel support'
278endef 269endef
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index dbe8dd2fe247..5b016e2498f3 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -35,19 +35,22 @@ setup-y += video-vesa.o
35setup-y += video-bios.o 35setup-y += video-bios.o
36 36
37targets += $(setup-y) 37targets += $(setup-y)
38hostprogs-y := mkcpustr tools/build 38hostprogs-y := tools/build
39hostprogs-$(CONFIG_X86_FEATURE_NAMES) += mkcpustr
39 40
40HOST_EXTRACFLAGS += -I$(srctree)/tools/include \ 41HOST_EXTRACFLAGS += -I$(srctree)/tools/include \
41 -include include/generated/autoconf.h \ 42 -include include/generated/autoconf.h \
42 -D__EXPORTED_HEADERS__ 43 -D__EXPORTED_HEADERS__
43 44
45ifdef CONFIG_X86_FEATURE_NAMES
44$(obj)/cpu.o: $(obj)/cpustr.h 46$(obj)/cpu.o: $(obj)/cpustr.h
45 47
46quiet_cmd_cpustr = CPUSTR $@ 48quiet_cmd_cpustr = CPUSTR $@
47 cmd_cpustr = $(obj)/mkcpustr > $@ 49 cmd_cpustr = $(obj)/mkcpustr > $@
48targets += cpustr.h 50targets += cpustr.h
49$(obj)/cpustr.h: $(obj)/mkcpustr FORCE 51$(obj)/cpustr.h: $(obj)/mkcpustr FORCE
50 $(call if_changed,cpustr) 52 $(call if_changed,cpustr)
53endif
51 54
52# --------------------------------------------------------------------------- 55# ---------------------------------------------------------------------------
53 56
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 7a801a310e37..704f58aa79cd 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -26,18 +26,18 @@ LDFLAGS_vmlinux := -T
26hostprogs-y := mkpiggy 26hostprogs-y := mkpiggy
27HOST_EXTRACFLAGS += -I$(srctree)/tools/include 27HOST_EXTRACFLAGS += -I$(srctree)/tools/include
28 28
29VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ 29vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
30 $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \ 30 $(obj)/string.o $(obj)/cmdline.o \
31 $(obj)/piggy.o $(obj)/cpuflags.o $(obj)/aslr.o 31 $(obj)/piggy.o $(obj)/cpuflags.o
32
33vmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/early_serial_console.o
34vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o
32 35
33$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 36$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
34 37
35ifeq ($(CONFIG_EFI_STUB), y) 38vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
37 $(objtree)/drivers/firmware/efi/libstub/lib.a
38endif
39 39
40$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE 40$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
41 $(call if_changed,ld) 41 $(call if_changed,ld)
42 @: 42 @:
43 43
@@ -45,7 +45,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
45$(obj)/vmlinux.bin: vmlinux FORCE 45$(obj)/vmlinux.bin: vmlinux FORCE
46 $(call if_changed,objcopy) 46 $(call if_changed,objcopy)
47 47
48targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs 48targets += $(patsubst $(obj)/%,%,$(vmlinux-objs-y)) vmlinux.bin.all vmlinux.relocs
49 49
50CMD_RELOCS = arch/x86/tools/relocs 50CMD_RELOCS = arch/x86/tools/relocs
51quiet_cmd_relocs = RELOCS $@ 51quiet_cmd_relocs = RELOCS $@
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c
index fc6091abedb7..7c68808edeb7 100644
--- a/arch/x86/boot/compressed/aslr.c
+++ b/arch/x86/boot/compressed/aslr.c
@@ -1,6 +1,5 @@
1#include "misc.h" 1#include "misc.h"
2 2
3#ifdef CONFIG_RANDOMIZE_BASE
4#include <asm/msr.h> 3#include <asm/msr.h>
5#include <asm/archrandom.h> 4#include <asm/archrandom.h>
6#include <asm/e820.h> 5#include <asm/e820.h>
@@ -183,12 +182,27 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
183static bool mem_avoid_overlap(struct mem_vector *img) 182static bool mem_avoid_overlap(struct mem_vector *img)
184{ 183{
185 int i; 184 int i;
185 struct setup_data *ptr;
186 186
187 for (i = 0; i < MEM_AVOID_MAX; i++) { 187 for (i = 0; i < MEM_AVOID_MAX; i++) {
188 if (mem_overlaps(img, &mem_avoid[i])) 188 if (mem_overlaps(img, &mem_avoid[i]))
189 return true; 189 return true;
190 } 190 }
191 191
192 /* Avoid all entries in the setup_data linked list. */
193 ptr = (struct setup_data *)(unsigned long)real_mode->hdr.setup_data;
194 while (ptr) {
195 struct mem_vector avoid;
196
197 avoid.start = (u64)ptr;
198 avoid.size = sizeof(*ptr) + ptr->len;
199
200 if (mem_overlaps(img, &avoid))
201 return true;
202
203 ptr = (struct setup_data *)(unsigned long)ptr->next;
204 }
205
192 return false; 206 return false;
193} 207}
194 208
@@ -320,5 +334,3 @@ unsigned char *choose_kernel_location(unsigned char *input,
320out: 334out:
321 return (unsigned char *)choice; 335 return (unsigned char *)choice;
322} 336}
323
324#endif /* CONFIG_RANDOMIZE_BASE */
diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c
index d3d003cb5481..261e81fb9582 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -1,9 +1,5 @@
1#include "misc.h" 1#include "misc.h"
2 2
3#ifdef CONFIG_EARLY_PRINTK
4
5int early_serial_base; 3int early_serial_base;
6 4
7#include "../early_serial_console.c" 5#include "../early_serial_console.c"
8
9#endif
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index f277184e2ac1..de8eebd6f67c 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -19,7 +19,10 @@
19 19
20static efi_system_table_t *sys_table; 20static efi_system_table_t *sys_table;
21 21
22struct efi_config *efi_early; 22static struct efi_config *efi_early;
23
24#define efi_call_early(f, ...) \
25 efi_early->call(efi_early->f, __VA_ARGS__);
23 26
24#define BOOT_SERVICES(bits) \ 27#define BOOT_SERVICES(bits) \
25static void setup_boot_services##bits(struct efi_config *c) \ 28static void setup_boot_services##bits(struct efi_config *c) \
@@ -265,21 +268,25 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
265 268
266 offset = offsetof(typeof(*out), output_string); 269 offset = offsetof(typeof(*out), output_string);
267 output_string = efi_early->text_output + offset; 270 output_string = efi_early->text_output + offset;
271 out = (typeof(out))(unsigned long)efi_early->text_output;
268 func = (u64 *)output_string; 272 func = (u64 *)output_string;
269 273
270 efi_early->call(*func, efi_early->text_output, str); 274 efi_early->call(*func, out, str);
271 } else { 275 } else {
272 struct efi_simple_text_output_protocol_32 *out; 276 struct efi_simple_text_output_protocol_32 *out;
273 u32 *func; 277 u32 *func;
274 278
275 offset = offsetof(typeof(*out), output_string); 279 offset = offsetof(typeof(*out), output_string);
276 output_string = efi_early->text_output + offset; 280 output_string = efi_early->text_output + offset;
281 out = (typeof(out))(unsigned long)efi_early->text_output;
277 func = (u32 *)output_string; 282 func = (u32 *)output_string;
278 283
279 efi_early->call(*func, efi_early->text_output, str); 284 efi_early->call(*func, out, str);
280 } 285 }
281} 286}
282 287
288#include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c"
289
283static void find_bits(unsigned long mask, u8 *pos, u8 *size) 290static void find_bits(unsigned long mask, u8 *pos, u8 *size)
284{ 291{
285 u8 first, len; 292 u8 first, len;
@@ -360,7 +367,7 @@ free_struct:
360 return status; 367 return status;
361} 368}
362 369
363static efi_status_t 370static void
364setup_efi_pci32(struct boot_params *params, void **pci_handle, 371setup_efi_pci32(struct boot_params *params, void **pci_handle,
365 unsigned long size) 372 unsigned long size)
366{ 373{
@@ -403,8 +410,6 @@ setup_efi_pci32(struct boot_params *params, void **pci_handle,
403 data = (struct setup_data *)rom; 410 data = (struct setup_data *)rom;
404 411
405 } 412 }
406
407 return status;
408} 413}
409 414
410static efi_status_t 415static efi_status_t
@@ -463,7 +468,7 @@ free_struct:
463 468
464} 469}
465 470
466static efi_status_t 471static void
467setup_efi_pci64(struct boot_params *params, void **pci_handle, 472setup_efi_pci64(struct boot_params *params, void **pci_handle,
468 unsigned long size) 473 unsigned long size)
469{ 474{
@@ -506,11 +511,18 @@ setup_efi_pci64(struct boot_params *params, void **pci_handle,
506 data = (struct setup_data *)rom; 511 data = (struct setup_data *)rom;
507 512
508 } 513 }
509
510 return status;
511} 514}
512 515
513static efi_status_t setup_efi_pci(struct boot_params *params) 516/*
517 * There's no way to return an informative status from this function,
518 * because any analysis (and printing of error messages) needs to be
519 * done directly at the EFI function call-site.
520 *
521 * For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we
522 * just didn't find any PCI devices, but there's no way to tell outside
523 * the context of the call.
524 */
525static void setup_efi_pci(struct boot_params *params)
514{ 526{
515 efi_status_t status; 527 efi_status_t status;
516 void **pci_handle = NULL; 528 void **pci_handle = NULL;
@@ -527,7 +539,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
527 size, (void **)&pci_handle); 539 size, (void **)&pci_handle);
528 540
529 if (status != EFI_SUCCESS) 541 if (status != EFI_SUCCESS)
530 return status; 542 return;
531 543
532 status = efi_call_early(locate_handle, 544 status = efi_call_early(locate_handle,
533 EFI_LOCATE_BY_PROTOCOL, &pci_proto, 545 EFI_LOCATE_BY_PROTOCOL, &pci_proto,
@@ -538,13 +550,12 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
538 goto free_handle; 550 goto free_handle;
539 551
540 if (efi_early->is64) 552 if (efi_early->is64)
541 status = setup_efi_pci64(params, pci_handle, size); 553 setup_efi_pci64(params, pci_handle, size);
542 else 554 else
543 status = setup_efi_pci32(params, pci_handle, size); 555 setup_efi_pci32(params, pci_handle, size);
544 556
545free_handle: 557free_handle:
546 efi_call_early(free_pool, pci_handle); 558 efi_call_early(free_pool, pci_handle);
547 return status;
548} 559}
549 560
550static void 561static void
@@ -1032,7 +1043,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
1032 int i; 1043 int i;
1033 unsigned long ramdisk_addr; 1044 unsigned long ramdisk_addr;
1034 unsigned long ramdisk_size; 1045 unsigned long ramdisk_size;
1035 unsigned long initrd_addr_max;
1036 1046
1037 efi_early = c; 1047 efi_early = c;
1038 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; 1048 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table;
@@ -1095,15 +1105,20 @@ struct boot_params *make_boot_params(struct efi_config *c)
1095 1105
1096 memset(sdt, 0, sizeof(*sdt)); 1106 memset(sdt, 0, sizeof(*sdt));
1097 1107
1098 if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G)
1099 initrd_addr_max = -1UL;
1100 else
1101 initrd_addr_max = hdr->initrd_addr_max;
1102
1103 status = handle_cmdline_files(sys_table, image, 1108 status = handle_cmdline_files(sys_table, image,
1104 (char *)(unsigned long)hdr->cmd_line_ptr, 1109 (char *)(unsigned long)hdr->cmd_line_ptr,
1105 "initrd=", initrd_addr_max, 1110 "initrd=", hdr->initrd_addr_max,
1106 &ramdisk_addr, &ramdisk_size); 1111 &ramdisk_addr, &ramdisk_size);
1112
1113 if (status != EFI_SUCCESS &&
1114 hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) {
1115 efi_printk(sys_table, "Trying to load files to higher address\n");
1116 status = handle_cmdline_files(sys_table, image,
1117 (char *)(unsigned long)hdr->cmd_line_ptr,
1118 "initrd=", -1UL,
1119 &ramdisk_addr, &ramdisk_size);
1120 }
1121
1107 if (status != EFI_SUCCESS) 1122 if (status != EFI_SUCCESS)
1108 goto fail2; 1123 goto fail2;
1109 hdr->ramdisk_image = ramdisk_addr & 0xffffffff; 1124 hdr->ramdisk_image = ramdisk_addr & 0xffffffff;
@@ -1376,10 +1391,7 @@ struct boot_params *efi_main(struct efi_config *c,
1376 1391
1377 setup_graphics(boot_params); 1392 setup_graphics(boot_params);
1378 1393
1379 status = setup_efi_pci(boot_params); 1394 setup_efi_pci(boot_params);
1380 if (status != EFI_SUCCESS) {
1381 efi_printk(sys_table, "setup_efi_pci() failed!\n");
1382 }
1383 1395
1384 status = efi_call_early(allocate_pool, EFI_LOADER_DATA, 1396 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
1385 sizeof(*gdt), (void **)&gdt); 1397 sizeof(*gdt), (void **)&gdt);
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
index d487e727f1ec..c88c31ecad12 100644
--- a/arch/x86/boot/compressed/eboot.h
+++ b/arch/x86/boot/compressed/eboot.h
@@ -103,4 +103,20 @@ struct efi_uga_draw_protocol {
103 void *blt; 103 void *blt;
104}; 104};
105 105
106struct efi_config {
107 u64 image_handle;
108 u64 table;
109 u64 allocate_pool;
110 u64 allocate_pages;
111 u64 get_memory_map;
112 u64 free_pool;
113 u64 free_pages;
114 u64 locate_handle;
115 u64 handle_protocol;
116 u64 exit_boot_services;
117 u64 text_output;
118 efi_status_t (*call)(unsigned long, ...);
119 bool is64;
120} __packed;
121
106#endif /* BOOT_COMPRESSED_EBOOT_H */ 122#endif /* BOOT_COMPRESSED_EBOOT_H */
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c
index 6ec6bb6e9957..29207f69ae8c 100644
--- a/arch/x86/boot/cpu.c
+++ b/arch/x86/boot/cpu.c
@@ -16,7 +16,9 @@
16 */ 16 */
17 17
18#include "boot.h" 18#include "boot.h"
19#ifdef CONFIG_X86_FEATURE_NAMES
19#include "cpustr.h" 20#include "cpustr.h"
21#endif
20 22
21static char *cpu_name(int level) 23static char *cpu_name(int level)
22{ 24{
@@ -32,11 +34,48 @@ static char *cpu_name(int level)
32 } 34 }
33} 35}
34 36
37static void show_cap_strs(u32 *err_flags)
38{
39 int i, j;
40#ifdef CONFIG_X86_FEATURE_NAMES
41 const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs;
42 for (i = 0; i < NCAPINTS; i++) {
43 u32 e = err_flags[i];
44 for (j = 0; j < 32; j++) {
45 if (msg_strs[0] < i ||
46 (msg_strs[0] == i && msg_strs[1] < j)) {
47 /* Skip to the next string */
48 msg_strs += 2;
49 while (*msg_strs++)
50 ;
51 }
52 if (e & 1) {
53 if (msg_strs[0] == i &&
54 msg_strs[1] == j &&
55 msg_strs[2])
56 printf("%s ", msg_strs+2);
57 else
58 printf("%d:%d ", i, j);
59 }
60 e >>= 1;
61 }
62 }
63#else
64 for (i = 0; i < NCAPINTS; i++) {
65 u32 e = err_flags[i];
66 for (j = 0; j < 32; j++) {
67 if (e & 1)
68 printf("%d:%d ", i, j);
69 e >>= 1;
70 }
71 }
72#endif
73}
74
35int validate_cpu(void) 75int validate_cpu(void)
36{ 76{
37 u32 *err_flags; 77 u32 *err_flags;
38 int cpu_level, req_level; 78 int cpu_level, req_level;
39 const unsigned char *msg_strs;
40 79
41 check_cpu(&cpu_level, &req_level, &err_flags); 80 check_cpu(&cpu_level, &req_level, &err_flags);
42 81
@@ -49,34 +88,9 @@ int validate_cpu(void)
49 } 88 }
50 89
51 if (err_flags) { 90 if (err_flags) {
52 int i, j;
53 puts("This kernel requires the following features " 91 puts("This kernel requires the following features "
54 "not present on the CPU:\n"); 92 "not present on the CPU:\n");
55 93 show_cap_strs(err_flags);
56 msg_strs = (const unsigned char *)x86_cap_strs;
57
58 for (i = 0; i < NCAPINTS; i++) {
59 u32 e = err_flags[i];
60
61 for (j = 0; j < 32; j++) {
62 if (msg_strs[0] < i ||
63 (msg_strs[0] == i && msg_strs[1] < j)) {
64 /* Skip to the next string */
65 msg_strs += 2;
66 while (*msg_strs++)
67 ;
68 }
69 if (e & 1) {
70 if (msg_strs[0] == i &&
71 msg_strs[1] == j &&
72 msg_strs[2])
73 printf("%s ", msg_strs+2);
74 else
75 printf("%d:%d ", i, j);
76 }
77 e >>= 1;
78 }
79 }
80 putchar('\n'); 94 putchar('\n');
81 return -1; 95 return -1;
82 } else { 96 } else {
diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
new file mode 100644
index 000000000000..4e2ecfa23c15
--- /dev/null
+++ b/arch/x86/configs/tiny.config
@@ -0,0 +1 @@
CONFIG_NOHIGHMEM=y
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index d551165a3159..fd0f848938cc 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o
26 26
27obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o 27obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o
28obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o 28obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o
29obj-$(CONFIG_CRYPTO_SHA1_MB) += sha-mb/
29obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o 30obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o
30obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o 31obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o
31obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o 32obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
diff --git a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
index f091f122ed24..2df2a0298f5a 100644
--- a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
+++ b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
@@ -79,9 +79,6 @@
79#define xcounter %xmm8 79#define xcounter %xmm8
80#define xbyteswap %xmm9 80#define xbyteswap %xmm9
81#define xkey0 %xmm10 81#define xkey0 %xmm10
82#define xkey3 %xmm11
83#define xkey6 %xmm12
84#define xkey9 %xmm13
85#define xkey4 %xmm11 82#define xkey4 %xmm11
86#define xkey8 %xmm12 83#define xkey8 %xmm12
87#define xkey12 %xmm13 84#define xkey12 %xmm13
@@ -108,6 +105,10 @@
108 105
109byteswap_const: 106byteswap_const:
110 .octa 0x000102030405060708090A0B0C0D0E0F 107 .octa 0x000102030405060708090A0B0C0D0E0F
108ddq_low_msk:
109 .octa 0x0000000000000000FFFFFFFFFFFFFFFF
110ddq_high_add_1:
111 .octa 0x00000000000000010000000000000000
111ddq_add_1: 112ddq_add_1:
112 .octa 0x00000000000000000000000000000001 113 .octa 0x00000000000000000000000000000001
113ddq_add_2: 114ddq_add_2:
@@ -169,7 +170,12 @@ ddq_add_8:
169 .rept (by - 1) 170 .rept (by - 1)
170 club DDQ_DATA, i 171 club DDQ_DATA, i
171 club XDATA, i 172 club XDATA, i
172 vpaddd var_ddq_add(%rip), xcounter, var_xdata 173 vpaddq var_ddq_add(%rip), xcounter, var_xdata
174 vptest ddq_low_msk(%rip), var_xdata
175 jnz 1f
176 vpaddq ddq_high_add_1(%rip), var_xdata, var_xdata
177 vpaddq ddq_high_add_1(%rip), xcounter, xcounter
178 1:
173 vpshufb xbyteswap, var_xdata, var_xdata 179 vpshufb xbyteswap, var_xdata, var_xdata
174 .set i, (i +1) 180 .set i, (i +1)
175 .endr 181 .endr
@@ -178,7 +184,11 @@ ddq_add_8:
178 184
179 vpxor xkey0, xdata0, xdata0 185 vpxor xkey0, xdata0, xdata0
180 club DDQ_DATA, by 186 club DDQ_DATA, by
181 vpaddd var_ddq_add(%rip), xcounter, xcounter 187 vpaddq var_ddq_add(%rip), xcounter, xcounter
188 vptest ddq_low_msk(%rip), xcounter
189 jnz 1f
190 vpaddq ddq_high_add_1(%rip), xcounter, xcounter
191 1:
182 192
183 .set i, 1 193 .set i, 1
184 .rept (by - 1) 194 .rept (by - 1)
diff --git a/arch/x86/crypto/sha-mb/Makefile b/arch/x86/crypto/sha-mb/Makefile
new file mode 100644
index 000000000000..2f8756375df5
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/Makefile
@@ -0,0 +1,11 @@
1#
2# Arch-specific CryptoAPI modules.
3#
4
5avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\
6 $(comma)4)$(comma)%ymm2,yes,no)
7ifeq ($(avx2_supported),yes)
8 obj-$(CONFIG_CRYPTO_SHA1_MB) += sha1-mb.o
9 sha1-mb-y := sha1_mb.o sha1_mb_mgr_flush_avx2.o \
10 sha1_mb_mgr_init_avx2.o sha1_mb_mgr_submit_avx2.o sha1_x8_avx2.o
11endif
diff --git a/arch/x86/crypto/sha-mb/sha1_mb.c b/arch/x86/crypto/sha-mb/sha1_mb.c
new file mode 100644
index 000000000000..99eefd812958
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/sha1_mb.c
@@ -0,0 +1,935 @@
1/*
2 * Multi buffer SHA1 algorithm Glue Code
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2014 Intel Corporation.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * Contact Information:
21 * Tim Chen <tim.c.chen@linux.intel.com>
22 *
23 * BSD LICENSE
24 *
25 * Copyright(c) 2014 Intel Corporation.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 *
31 * * Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * * Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in
35 * the documentation and/or other materials provided with the
36 * distribution.
37 * * Neither the name of Intel Corporation nor the names of its
38 * contributors may be used to endorse or promote products derived
39 * from this software without specific prior written permission.
40 *
41 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
42 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
43 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
44 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
45 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
47 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
51 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 */
53
54#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
55
56#include <crypto/internal/hash.h>
57#include <linux/init.h>
58#include <linux/module.h>
59#include <linux/mm.h>
60#include <linux/cryptohash.h>
61#include <linux/types.h>
62#include <linux/list.h>
63#include <crypto/scatterwalk.h>
64#include <crypto/sha.h>
65#include <crypto/mcryptd.h>
66#include <crypto/crypto_wq.h>
67#include <asm/byteorder.h>
68#include <asm/i387.h>
69#include <asm/xcr.h>
70#include <asm/xsave.h>
71#include <linux/hardirq.h>
72#include <asm/fpu-internal.h>
73#include "sha_mb_ctx.h"
74
75#define FLUSH_INTERVAL 1000 /* in usec */
76
77static struct mcryptd_alg_state sha1_mb_alg_state;
78
79struct sha1_mb_ctx {
80 struct mcryptd_ahash *mcryptd_tfm;
81};
82
83static inline struct mcryptd_hash_request_ctx *cast_hash_to_mcryptd_ctx(struct sha1_hash_ctx *hash_ctx)
84{
85 struct shash_desc *desc;
86
87 desc = container_of((void *) hash_ctx, struct shash_desc, __ctx);
88 return container_of(desc, struct mcryptd_hash_request_ctx, desc);
89}
90
91static inline struct ahash_request *cast_mcryptd_ctx_to_req(struct mcryptd_hash_request_ctx *ctx)
92{
93 return container_of((void *) ctx, struct ahash_request, __ctx);
94}
95
96static void req_ctx_init(struct mcryptd_hash_request_ctx *rctx,
97 struct shash_desc *desc)
98{
99 rctx->flag = HASH_UPDATE;
100}
101
102static asmlinkage void (*sha1_job_mgr_init)(struct sha1_mb_mgr *state);
103static asmlinkage struct job_sha1* (*sha1_job_mgr_submit)(struct sha1_mb_mgr *state,
104 struct job_sha1 *job);
105static asmlinkage struct job_sha1* (*sha1_job_mgr_flush)(struct sha1_mb_mgr *state);
106static asmlinkage struct job_sha1* (*sha1_job_mgr_get_comp_job)(struct sha1_mb_mgr *state);
107
108inline void sha1_init_digest(uint32_t *digest)
109{
110 static const uint32_t initial_digest[SHA1_DIGEST_LENGTH] = {SHA1_H0,
111 SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 };
112 memcpy(digest, initial_digest, sizeof(initial_digest));
113}
114
115inline uint32_t sha1_pad(uint8_t padblock[SHA1_BLOCK_SIZE * 2],
116 uint32_t total_len)
117{
118 uint32_t i = total_len & (SHA1_BLOCK_SIZE - 1);
119
120 memset(&padblock[i], 0, SHA1_BLOCK_SIZE);
121 padblock[i] = 0x80;
122
123 i += ((SHA1_BLOCK_SIZE - 1) &
124 (0 - (total_len + SHA1_PADLENGTHFIELD_SIZE + 1)))
125 + 1 + SHA1_PADLENGTHFIELD_SIZE;
126
127#if SHA1_PADLENGTHFIELD_SIZE == 16
128 *((uint64_t *) &padblock[i - 16]) = 0;
129#endif
130
131 *((uint64_t *) &padblock[i - 8]) = cpu_to_be64(total_len << 3);
132
133 /* Number of extra blocks to hash */
134 return i >> SHA1_LOG2_BLOCK_SIZE;
135}
136
137static struct sha1_hash_ctx *sha1_ctx_mgr_resubmit(struct sha1_ctx_mgr *mgr, struct sha1_hash_ctx *ctx)
138{
139 while (ctx) {
140 if (ctx->status & HASH_CTX_STS_COMPLETE) {
141 /* Clear PROCESSING bit */
142 ctx->status = HASH_CTX_STS_COMPLETE;
143 return ctx;
144 }
145
146 /*
147 * If the extra blocks are empty, begin hashing what remains
148 * in the user's buffer.
149 */
150 if (ctx->partial_block_buffer_length == 0 &&
151 ctx->incoming_buffer_length) {
152
153 const void *buffer = ctx->incoming_buffer;
154 uint32_t len = ctx->incoming_buffer_length;
155 uint32_t copy_len;
156
157 /*
158 * Only entire blocks can be hashed.
159 * Copy remainder to extra blocks buffer.
160 */
161 copy_len = len & (SHA1_BLOCK_SIZE-1);
162
163 if (copy_len) {
164 len -= copy_len;
165 memcpy(ctx->partial_block_buffer,
166 ((const char *) buffer + len),
167 copy_len);
168 ctx->partial_block_buffer_length = copy_len;
169 }
170
171 ctx->incoming_buffer_length = 0;
172
173 /* len should be a multiple of the block size now */
174 assert((len % SHA1_BLOCK_SIZE) == 0);
175
176 /* Set len to the number of blocks to be hashed */
177 len >>= SHA1_LOG2_BLOCK_SIZE;
178
179 if (len) {
180
181 ctx->job.buffer = (uint8_t *) buffer;
182 ctx->job.len = len;
183 ctx = (struct sha1_hash_ctx *) sha1_job_mgr_submit(&mgr->mgr,
184 &ctx->job);
185 continue;
186 }
187 }
188
189 /*
190 * If the extra blocks are not empty, then we are
191 * either on the last block(s) or we need more
192 * user input before continuing.
193 */
194 if (ctx->status & HASH_CTX_STS_LAST) {
195
196 uint8_t *buf = ctx->partial_block_buffer;
197 uint32_t n_extra_blocks = sha1_pad(buf, ctx->total_length);
198
199 ctx->status = (HASH_CTX_STS_PROCESSING |
200 HASH_CTX_STS_COMPLETE);
201 ctx->job.buffer = buf;
202 ctx->job.len = (uint32_t) n_extra_blocks;
203 ctx = (struct sha1_hash_ctx *) sha1_job_mgr_submit(&mgr->mgr, &ctx->job);
204 continue;
205 }
206
207 if (ctx)
208 ctx->status = HASH_CTX_STS_IDLE;
209 return ctx;
210 }
211
212 return NULL;
213}
214
215static struct sha1_hash_ctx *sha1_ctx_mgr_get_comp_ctx(struct sha1_ctx_mgr *mgr)
216{
217 /*
218 * If get_comp_job returns NULL, there are no jobs complete.
219 * If get_comp_job returns a job, verify that it is safe to return to the user.
220 * If it is not ready, resubmit the job to finish processing.
221 * If sha1_ctx_mgr_resubmit returned a job, it is ready to be returned.
222 * Otherwise, all jobs currently being managed by the hash_ctx_mgr still need processing.
223 */
224 struct sha1_hash_ctx *ctx;
225
226 ctx = (struct sha1_hash_ctx *) sha1_job_mgr_get_comp_job(&mgr->mgr);
227 return sha1_ctx_mgr_resubmit(mgr, ctx);
228}
229
230static void sha1_ctx_mgr_init(struct sha1_ctx_mgr *mgr)
231{
232 sha1_job_mgr_init(&mgr->mgr);
233}
234
235static struct sha1_hash_ctx *sha1_ctx_mgr_submit(struct sha1_ctx_mgr *mgr,
236 struct sha1_hash_ctx *ctx,
237 const void *buffer,
238 uint32_t len,
239 int flags)
240{
241 if (flags & (~HASH_ENTIRE)) {
242 /* User should not pass anything other than FIRST, UPDATE, or LAST */
243 ctx->error = HASH_CTX_ERROR_INVALID_FLAGS;
244 return ctx;
245 }
246
247 if (ctx->status & HASH_CTX_STS_PROCESSING) {
248 /* Cannot submit to a currently processing job. */
249 ctx->error = HASH_CTX_ERROR_ALREADY_PROCESSING;
250 return ctx;
251 }
252
253 if ((ctx->status & HASH_CTX_STS_COMPLETE) && !(flags & HASH_FIRST)) {
254 /* Cannot update a finished job. */
255 ctx->error = HASH_CTX_ERROR_ALREADY_COMPLETED;
256 return ctx;
257 }
258
259
260 if (flags & HASH_FIRST) {
261 /* Init digest */
262 sha1_init_digest(ctx->job.result_digest);
263
264 /* Reset byte counter */
265 ctx->total_length = 0;
266
267 /* Clear extra blocks */
268 ctx->partial_block_buffer_length = 0;
269 }
270
271 /* If we made it here, there were no errors during this call to submit */
272 ctx->error = HASH_CTX_ERROR_NONE;
273
274 /* Store buffer ptr info from user */
275 ctx->incoming_buffer = buffer;
276 ctx->incoming_buffer_length = len;
277
278 /* Store the user's request flags and mark this ctx as currently being processed. */
279 ctx->status = (flags & HASH_LAST) ?
280 (HASH_CTX_STS_PROCESSING | HASH_CTX_STS_LAST) :
281 HASH_CTX_STS_PROCESSING;
282
283 /* Advance byte counter */
284 ctx->total_length += len;
285
286 /*
287 * If there is anything currently buffered in the extra blocks,
288 * append to it until it contains a whole block.
289 * Or if the user's buffer contains less than a whole block,
290 * append as much as possible to the extra block.
291 */
292 if ((ctx->partial_block_buffer_length) | (len < SHA1_BLOCK_SIZE)) {
293 /* Compute how many bytes to copy from user buffer into extra block */
294 uint32_t copy_len = SHA1_BLOCK_SIZE - ctx->partial_block_buffer_length;
295 if (len < copy_len)
296 copy_len = len;
297
298 if (copy_len) {
299 /* Copy and update relevant pointers and counters */
300 memcpy(&ctx->partial_block_buffer[ctx->partial_block_buffer_length],
301 buffer, copy_len);
302
303 ctx->partial_block_buffer_length += copy_len;
304 ctx->incoming_buffer = (const void *)((const char *)buffer + copy_len);
305 ctx->incoming_buffer_length = len - copy_len;
306 }
307
308 /* The extra block should never contain more than 1 block here */
309 assert(ctx->partial_block_buffer_length <= SHA1_BLOCK_SIZE);
310
311 /* If the extra block buffer contains exactly 1 block, it can be hashed. */
312 if (ctx->partial_block_buffer_length >= SHA1_BLOCK_SIZE) {
313 ctx->partial_block_buffer_length = 0;
314
315 ctx->job.buffer = ctx->partial_block_buffer;
316 ctx->job.len = 1;
317 ctx = (struct sha1_hash_ctx *) sha1_job_mgr_submit(&mgr->mgr, &ctx->job);
318 }
319 }
320
321 return sha1_ctx_mgr_resubmit(mgr, ctx);
322}
323
324static struct sha1_hash_ctx *sha1_ctx_mgr_flush(struct sha1_ctx_mgr *mgr)
325{
326 struct sha1_hash_ctx *ctx;
327
328 while (1) {
329 ctx = (struct sha1_hash_ctx *) sha1_job_mgr_flush(&mgr->mgr);
330
331 /* If flush returned 0, there are no more jobs in flight. */
332 if (!ctx)
333 return NULL;
334
335 /*
336 * If flush returned a job, resubmit the job to finish processing.
337 */
338 ctx = sha1_ctx_mgr_resubmit(mgr, ctx);
339
340 /*
341 * If sha1_ctx_mgr_resubmit returned a job, it is ready to be returned.
342 * Otherwise, all jobs currently being managed by the sha1_ctx_mgr
343 * still need processing. Loop.
344 */
345 if (ctx)
346 return ctx;
347 }
348}
349
350static int sha1_mb_init(struct shash_desc *desc)
351{
352 struct sha1_hash_ctx *sctx = shash_desc_ctx(desc);
353
354 hash_ctx_init(sctx);
355 sctx->job.result_digest[0] = SHA1_H0;
356 sctx->job.result_digest[1] = SHA1_H1;
357 sctx->job.result_digest[2] = SHA1_H2;
358 sctx->job.result_digest[3] = SHA1_H3;
359 sctx->job.result_digest[4] = SHA1_H4;
360 sctx->total_length = 0;
361 sctx->partial_block_buffer_length = 0;
362 sctx->status = HASH_CTX_STS_IDLE;
363
364 return 0;
365}
366
367static int sha1_mb_set_results(struct mcryptd_hash_request_ctx *rctx)
368{
369 int i;
370 struct sha1_hash_ctx *sctx = shash_desc_ctx(&rctx->desc);
371 __be32 *dst = (__be32 *) rctx->out;
372
373 for (i = 0; i < 5; ++i)
374 dst[i] = cpu_to_be32(sctx->job.result_digest[i]);
375
376 return 0;
377}
378
379static int sha_finish_walk(struct mcryptd_hash_request_ctx **ret_rctx,
380 struct mcryptd_alg_cstate *cstate, bool flush)
381{
382 int flag = HASH_UPDATE;
383 int nbytes, err = 0;
384 struct mcryptd_hash_request_ctx *rctx = *ret_rctx;
385 struct sha1_hash_ctx *sha_ctx;
386
387 /* more work ? */
388 while (!(rctx->flag & HASH_DONE)) {
389 nbytes = crypto_ahash_walk_done(&rctx->walk, 0);
390 if (nbytes < 0) {
391 err = nbytes;
392 goto out;
393 }
394 /* check if the walk is done */
395 if (crypto_ahash_walk_last(&rctx->walk)) {
396 rctx->flag |= HASH_DONE;
397 if (rctx->flag & HASH_FINAL)
398 flag |= HASH_LAST;
399
400 }
401 sha_ctx = (struct sha1_hash_ctx *) shash_desc_ctx(&rctx->desc);
402 kernel_fpu_begin();
403 sha_ctx = sha1_ctx_mgr_submit(cstate->mgr, sha_ctx, rctx->walk.data, nbytes, flag);
404 if (!sha_ctx) {
405 if (flush)
406 sha_ctx = sha1_ctx_mgr_flush(cstate->mgr);
407 }
408 kernel_fpu_end();
409 if (sha_ctx)
410 rctx = cast_hash_to_mcryptd_ctx(sha_ctx);
411 else {
412 rctx = NULL;
413 goto out;
414 }
415 }
416
417 /* copy the results */
418 if (rctx->flag & HASH_FINAL)
419 sha1_mb_set_results(rctx);
420
421out:
422 *ret_rctx = rctx;
423 return err;
424}
425
426static int sha_complete_job(struct mcryptd_hash_request_ctx *rctx,
427 struct mcryptd_alg_cstate *cstate,
428 int err)
429{
430 struct ahash_request *req = cast_mcryptd_ctx_to_req(rctx);
431 struct sha1_hash_ctx *sha_ctx;
432 struct mcryptd_hash_request_ctx *req_ctx;
433 int ret;
434
435 /* remove from work list */
436 spin_lock(&cstate->work_lock);
437 list_del(&rctx->waiter);
438 spin_unlock(&cstate->work_lock);
439
440 if (irqs_disabled())
441 rctx->complete(&req->base, err);
442 else {
443 local_bh_disable();
444 rctx->complete(&req->base, err);
445 local_bh_enable();
446 }
447
448 /* check to see if there are other jobs that are done */
449 sha_ctx = sha1_ctx_mgr_get_comp_ctx(cstate->mgr);
450 while (sha_ctx) {
451 req_ctx = cast_hash_to_mcryptd_ctx(sha_ctx);
452 ret = sha_finish_walk(&req_ctx, cstate, false);
453 if (req_ctx) {
454 spin_lock(&cstate->work_lock);
455 list_del(&req_ctx->waiter);
456 spin_unlock(&cstate->work_lock);
457
458 req = cast_mcryptd_ctx_to_req(req_ctx);
459 if (irqs_disabled())
460 rctx->complete(&req->base, ret);
461 else {
462 local_bh_disable();
463 rctx->complete(&req->base, ret);
464 local_bh_enable();
465 }
466 }
467 sha_ctx = sha1_ctx_mgr_get_comp_ctx(cstate->mgr);
468 }
469
470 return 0;
471}
472
473static void sha1_mb_add_list(struct mcryptd_hash_request_ctx *rctx,
474 struct mcryptd_alg_cstate *cstate)
475{
476 unsigned long next_flush;
477 unsigned long delay = usecs_to_jiffies(FLUSH_INTERVAL);
478
479 /* initialize tag */
480 rctx->tag.arrival = jiffies; /* tag the arrival time */
481 rctx->tag.seq_num = cstate->next_seq_num++;
482 next_flush = rctx->tag.arrival + delay;
483 rctx->tag.expire = next_flush;
484
485 spin_lock(&cstate->work_lock);
486 list_add_tail(&rctx->waiter, &cstate->work_list);
487 spin_unlock(&cstate->work_lock);
488
489 mcryptd_arm_flusher(cstate, delay);
490}
491
492static int sha1_mb_update(struct shash_desc *desc, const u8 *data,
493 unsigned int len)
494{
495 struct mcryptd_hash_request_ctx *rctx =
496 container_of(desc, struct mcryptd_hash_request_ctx, desc);
497 struct mcryptd_alg_cstate *cstate =
498 this_cpu_ptr(sha1_mb_alg_state.alg_cstate);
499
500 struct ahash_request *req = cast_mcryptd_ctx_to_req(rctx);
501 struct sha1_hash_ctx *sha_ctx;
502 int ret = 0, nbytes;
503
504
505 /* sanity check */
506 if (rctx->tag.cpu != smp_processor_id()) {
507 pr_err("mcryptd error: cpu clash\n");
508 goto done;
509 }
510
511 /* need to init context */
512 req_ctx_init(rctx, desc);
513
514 nbytes = crypto_ahash_walk_first(req, &rctx->walk);
515
516 if (nbytes < 0) {
517 ret = nbytes;
518 goto done;
519 }
520
521 if (crypto_ahash_walk_last(&rctx->walk))
522 rctx->flag |= HASH_DONE;
523
524 /* submit */
525 sha_ctx = (struct sha1_hash_ctx *) shash_desc_ctx(desc);
526 sha1_mb_add_list(rctx, cstate);
527 kernel_fpu_begin();
528 sha_ctx = sha1_ctx_mgr_submit(cstate->mgr, sha_ctx, rctx->walk.data, nbytes, HASH_UPDATE);
529 kernel_fpu_end();
530
531 /* check if anything is returned */
532 if (!sha_ctx)
533 return -EINPROGRESS;
534
535 if (sha_ctx->error) {
536 ret = sha_ctx->error;
537 rctx = cast_hash_to_mcryptd_ctx(sha_ctx);
538 goto done;
539 }
540
541 rctx = cast_hash_to_mcryptd_ctx(sha_ctx);
542 ret = sha_finish_walk(&rctx, cstate, false);
543
544 if (!rctx)
545 return -EINPROGRESS;
546done:
547 sha_complete_job(rctx, cstate, ret);
548 return ret;
549}
550
551static int sha1_mb_finup(struct shash_desc *desc, const u8 *data,
552 unsigned int len, u8 *out)
553{
554 struct mcryptd_hash_request_ctx *rctx =
555 container_of(desc, struct mcryptd_hash_request_ctx, desc);
556 struct mcryptd_alg_cstate *cstate =
557 this_cpu_ptr(sha1_mb_alg_state.alg_cstate);
558
559 struct ahash_request *req = cast_mcryptd_ctx_to_req(rctx);
560 struct sha1_hash_ctx *sha_ctx;
561 int ret = 0, flag = HASH_UPDATE, nbytes;
562
563 /* sanity check */
564 if (rctx->tag.cpu != smp_processor_id()) {
565 pr_err("mcryptd error: cpu clash\n");
566 goto done;
567 }
568
569 /* need to init context */
570 req_ctx_init(rctx, desc);
571
572 nbytes = crypto_ahash_walk_first(req, &rctx->walk);
573
574 if (nbytes < 0) {
575 ret = nbytes;
576 goto done;
577 }
578
579 if (crypto_ahash_walk_last(&rctx->walk)) {
580 rctx->flag |= HASH_DONE;
581 flag = HASH_LAST;
582 }
583 rctx->out = out;
584
585 /* submit */
586 rctx->flag |= HASH_FINAL;
587 sha_ctx = (struct sha1_hash_ctx *) shash_desc_ctx(desc);
588 sha1_mb_add_list(rctx, cstate);
589
590 kernel_fpu_begin();
591 sha_ctx = sha1_ctx_mgr_submit(cstate->mgr, sha_ctx, rctx->walk.data, nbytes, flag);
592 kernel_fpu_end();
593
594 /* check if anything is returned */
595 if (!sha_ctx)
596 return -EINPROGRESS;
597
598 if (sha_ctx->error) {
599 ret = sha_ctx->error;
600 goto done;
601 }
602
603 rctx = cast_hash_to_mcryptd_ctx(sha_ctx);
604 ret = sha_finish_walk(&rctx, cstate, false);
605 if (!rctx)
606 return -EINPROGRESS;
607done:
608 sha_complete_job(rctx, cstate, ret);
609 return ret;
610}
611
612static int sha1_mb_final(struct shash_desc *desc, u8 *out)
613{
614 struct mcryptd_hash_request_ctx *rctx =
615 container_of(desc, struct mcryptd_hash_request_ctx, desc);
616 struct mcryptd_alg_cstate *cstate =
617 this_cpu_ptr(sha1_mb_alg_state.alg_cstate);
618
619 struct sha1_hash_ctx *sha_ctx;
620 int ret = 0;
621 u8 data;
622
623 /* sanity check */
624 if (rctx->tag.cpu != smp_processor_id()) {
625 pr_err("mcryptd error: cpu clash\n");
626 goto done;
627 }
628
629 /* need to init context */
630 req_ctx_init(rctx, desc);
631
632 rctx->out = out;
633 rctx->flag |= HASH_DONE | HASH_FINAL;
634
635 sha_ctx = (struct sha1_hash_ctx *) shash_desc_ctx(desc);
636 /* flag HASH_FINAL and 0 data size */
637 sha1_mb_add_list(rctx, cstate);
638 kernel_fpu_begin();
639 sha_ctx = sha1_ctx_mgr_submit(cstate->mgr, sha_ctx, &data, 0, HASH_LAST);
640 kernel_fpu_end();
641
642 /* check if anything is returned */
643 if (!sha_ctx)
644 return -EINPROGRESS;
645
646 if (sha_ctx->error) {
647 ret = sha_ctx->error;
648 rctx = cast_hash_to_mcryptd_ctx(sha_ctx);
649 goto done;
650 }
651
652 rctx = cast_hash_to_mcryptd_ctx(sha_ctx);
653 ret = sha_finish_walk(&rctx, cstate, false);
654 if (!rctx)
655 return -EINPROGRESS;
656done:
657 sha_complete_job(rctx, cstate, ret);
658 return ret;
659}
660
661static int sha1_mb_export(struct shash_desc *desc, void *out)
662{
663 struct sha1_hash_ctx *sctx = shash_desc_ctx(desc);
664
665 memcpy(out, sctx, sizeof(*sctx));
666
667 return 0;
668}
669
670static int sha1_mb_import(struct shash_desc *desc, const void *in)
671{
672 struct sha1_hash_ctx *sctx = shash_desc_ctx(desc);
673
674 memcpy(sctx, in, sizeof(*sctx));
675
676 return 0;
677}
678
679
680static struct shash_alg sha1_mb_shash_alg = {
681 .digestsize = SHA1_DIGEST_SIZE,
682 .init = sha1_mb_init,
683 .update = sha1_mb_update,
684 .final = sha1_mb_final,
685 .finup = sha1_mb_finup,
686 .export = sha1_mb_export,
687 .import = sha1_mb_import,
688 .descsize = sizeof(struct sha1_hash_ctx),
689 .statesize = sizeof(struct sha1_hash_ctx),
690 .base = {
691 .cra_name = "__sha1-mb",
692 .cra_driver_name = "__intel_sha1-mb",
693 .cra_priority = 100,
694 /*
695 * use ASYNC flag as some buffers in multi-buffer
696 * algo may not have completed before hashing thread sleep
697 */
698 .cra_flags = CRYPTO_ALG_TYPE_SHASH | CRYPTO_ALG_ASYNC,
699 .cra_blocksize = SHA1_BLOCK_SIZE,
700 .cra_module = THIS_MODULE,
701 .cra_list = LIST_HEAD_INIT(sha1_mb_shash_alg.base.cra_list),
702 }
703};
704
705static int sha1_mb_async_init(struct ahash_request *req)
706{
707 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
708 struct sha1_mb_ctx *ctx = crypto_ahash_ctx(tfm);
709 struct ahash_request *mcryptd_req = ahash_request_ctx(req);
710 struct mcryptd_ahash *mcryptd_tfm = ctx->mcryptd_tfm;
711
712 memcpy(mcryptd_req, req, sizeof(*req));
713 ahash_request_set_tfm(mcryptd_req, &mcryptd_tfm->base);
714 return crypto_ahash_init(mcryptd_req);
715}
716
717static int sha1_mb_async_update(struct ahash_request *req)
718{
719 struct ahash_request *mcryptd_req = ahash_request_ctx(req);
720
721 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
722 struct sha1_mb_ctx *ctx = crypto_ahash_ctx(tfm);
723 struct mcryptd_ahash *mcryptd_tfm = ctx->mcryptd_tfm;
724
725 memcpy(mcryptd_req, req, sizeof(*req));
726 ahash_request_set_tfm(mcryptd_req, &mcryptd_tfm->base);
727 return crypto_ahash_update(mcryptd_req);
728}
729
730static int sha1_mb_async_finup(struct ahash_request *req)
731{
732 struct ahash_request *mcryptd_req = ahash_request_ctx(req);
733
734 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
735 struct sha1_mb_ctx *ctx = crypto_ahash_ctx(tfm);
736 struct mcryptd_ahash *mcryptd_tfm = ctx->mcryptd_tfm;
737
738 memcpy(mcryptd_req, req, sizeof(*req));
739 ahash_request_set_tfm(mcryptd_req, &mcryptd_tfm->base);
740 return crypto_ahash_finup(mcryptd_req);
741}
742
743static int sha1_mb_async_final(struct ahash_request *req)
744{
745 struct ahash_request *mcryptd_req = ahash_request_ctx(req);
746
747 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
748 struct sha1_mb_ctx *ctx = crypto_ahash_ctx(tfm);
749 struct mcryptd_ahash *mcryptd_tfm = ctx->mcryptd_tfm;
750
751 memcpy(mcryptd_req, req, sizeof(*req));
752 ahash_request_set_tfm(mcryptd_req, &mcryptd_tfm->base);
753 return crypto_ahash_final(mcryptd_req);
754}
755
756static int sha1_mb_async_digest(struct ahash_request *req)
757{
758 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
759 struct sha1_mb_ctx *ctx = crypto_ahash_ctx(tfm);
760 struct ahash_request *mcryptd_req = ahash_request_ctx(req);
761 struct mcryptd_ahash *mcryptd_tfm = ctx->mcryptd_tfm;
762
763 memcpy(mcryptd_req, req, sizeof(*req));
764 ahash_request_set_tfm(mcryptd_req, &mcryptd_tfm->base);
765 return crypto_ahash_digest(mcryptd_req);
766}
767
768static int sha1_mb_async_init_tfm(struct crypto_tfm *tfm)
769{
770 struct mcryptd_ahash *mcryptd_tfm;
771 struct sha1_mb_ctx *ctx = crypto_tfm_ctx(tfm);
772 struct mcryptd_hash_ctx *mctx;
773
774 mcryptd_tfm = mcryptd_alloc_ahash("__intel_sha1-mb", 0, 0);
775 if (IS_ERR(mcryptd_tfm))
776 return PTR_ERR(mcryptd_tfm);
777 mctx = crypto_ahash_ctx(&mcryptd_tfm->base);
778 mctx->alg_state = &sha1_mb_alg_state;
779 ctx->mcryptd_tfm = mcryptd_tfm;
780 crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
781 sizeof(struct ahash_request) +
782 crypto_ahash_reqsize(&mcryptd_tfm->base));
783
784 return 0;
785}
786
787static void sha1_mb_async_exit_tfm(struct crypto_tfm *tfm)
788{
789 struct sha1_mb_ctx *ctx = crypto_tfm_ctx(tfm);
790
791 mcryptd_free_ahash(ctx->mcryptd_tfm);
792}
793
794static struct ahash_alg sha1_mb_async_alg = {
795 .init = sha1_mb_async_init,
796 .update = sha1_mb_async_update,
797 .final = sha1_mb_async_final,
798 .finup = sha1_mb_async_finup,
799 .digest = sha1_mb_async_digest,
800 .halg = {
801 .digestsize = SHA1_DIGEST_SIZE,
802 .base = {
803 .cra_name = "sha1",
804 .cra_driver_name = "sha1_mb",
805 .cra_priority = 200,
806 .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
807 .cra_blocksize = SHA1_BLOCK_SIZE,
808 .cra_type = &crypto_ahash_type,
809 .cra_module = THIS_MODULE,
810 .cra_list = LIST_HEAD_INIT(sha1_mb_async_alg.halg.base.cra_list),
811 .cra_init = sha1_mb_async_init_tfm,
812 .cra_exit = sha1_mb_async_exit_tfm,
813 .cra_ctxsize = sizeof(struct sha1_mb_ctx),
814 .cra_alignmask = 0,
815 },
816 },
817};
818
819static unsigned long sha1_mb_flusher(struct mcryptd_alg_cstate *cstate)
820{
821 struct mcryptd_hash_request_ctx *rctx;
822 unsigned long cur_time;
823 unsigned long next_flush = 0;
824 struct sha1_hash_ctx *sha_ctx;
825
826
827 cur_time = jiffies;
828
829 while (!list_empty(&cstate->work_list)) {
830 rctx = list_entry(cstate->work_list.next,
831 struct mcryptd_hash_request_ctx, waiter);
832 if time_before(cur_time, rctx->tag.expire)
833 break;
834 kernel_fpu_begin();
835 sha_ctx = (struct sha1_hash_ctx *) sha1_ctx_mgr_flush(cstate->mgr);
836 kernel_fpu_end();
837 if (!sha_ctx) {
838 pr_err("sha1_mb error: nothing got flushed for non-empty list\n");
839 break;
840 }
841 rctx = cast_hash_to_mcryptd_ctx(sha_ctx);
842 sha_finish_walk(&rctx, cstate, true);
843 sha_complete_job(rctx, cstate, 0);
844 }
845
846 if (!list_empty(&cstate->work_list)) {
847 rctx = list_entry(cstate->work_list.next,
848 struct mcryptd_hash_request_ctx, waiter);
849 /* get the hash context and then flush time */
850 next_flush = rctx->tag.expire;
851 mcryptd_arm_flusher(cstate, get_delay(next_flush));
852 }
853 return next_flush;
854}
855
856static int __init sha1_mb_mod_init(void)
857{
858
859 int cpu;
860 int err;
861 struct mcryptd_alg_cstate *cpu_state;
862
863 /* check for dependent cpu features */
864 if (!boot_cpu_has(X86_FEATURE_AVX2) ||
865 !boot_cpu_has(X86_FEATURE_BMI2))
866 return -ENODEV;
867
868 /* initialize multibuffer structures */
869 sha1_mb_alg_state.alg_cstate = alloc_percpu(struct mcryptd_alg_cstate);
870
871 sha1_job_mgr_init = sha1_mb_mgr_init_avx2;
872 sha1_job_mgr_submit = sha1_mb_mgr_submit_avx2;
873 sha1_job_mgr_flush = sha1_mb_mgr_flush_avx2;
874 sha1_job_mgr_get_comp_job = sha1_mb_mgr_get_comp_job_avx2;
875
876 if (!sha1_mb_alg_state.alg_cstate)
877 return -ENOMEM;
878 for_each_possible_cpu(cpu) {
879 cpu_state = per_cpu_ptr(sha1_mb_alg_state.alg_cstate, cpu);
880 cpu_state->next_flush = 0;
881 cpu_state->next_seq_num = 0;
882 cpu_state->flusher_engaged = false;
883 INIT_DELAYED_WORK(&cpu_state->flush, mcryptd_flusher);
884 cpu_state->cpu = cpu;
885 cpu_state->alg_state = &sha1_mb_alg_state;
886 cpu_state->mgr = (struct sha1_ctx_mgr *) kzalloc(sizeof(struct sha1_ctx_mgr), GFP_KERNEL);
887 if (!cpu_state->mgr)
888 goto err2;
889 sha1_ctx_mgr_init(cpu_state->mgr);
890 INIT_LIST_HEAD(&cpu_state->work_list);
891 spin_lock_init(&cpu_state->work_lock);
892 }
893 sha1_mb_alg_state.flusher = &sha1_mb_flusher;
894
895 err = crypto_register_shash(&sha1_mb_shash_alg);
896 if (err)
897 goto err2;
898 err = crypto_register_ahash(&sha1_mb_async_alg);
899 if (err)
900 goto err1;
901
902
903 return 0;
904err1:
905 crypto_unregister_shash(&sha1_mb_shash_alg);
906err2:
907 for_each_possible_cpu(cpu) {
908 cpu_state = per_cpu_ptr(sha1_mb_alg_state.alg_cstate, cpu);
909 kfree(cpu_state->mgr);
910 }
911 free_percpu(sha1_mb_alg_state.alg_cstate);
912 return -ENODEV;
913}
914
915static void __exit sha1_mb_mod_fini(void)
916{
917 int cpu;
918 struct mcryptd_alg_cstate *cpu_state;
919
920 crypto_unregister_ahash(&sha1_mb_async_alg);
921 crypto_unregister_shash(&sha1_mb_shash_alg);
922 for_each_possible_cpu(cpu) {
923 cpu_state = per_cpu_ptr(sha1_mb_alg_state.alg_cstate, cpu);
924 kfree(cpu_state->mgr);
925 }
926 free_percpu(sha1_mb_alg_state.alg_cstate);
927}
928
929module_init(sha1_mb_mod_init);
930module_exit(sha1_mb_mod_fini);
931
932MODULE_LICENSE("GPL");
933MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, multi buffer accelerated");
934
935MODULE_ALIAS("sha1");
diff --git a/arch/x86/crypto/sha-mb/sha1_mb_mgr_datastruct.S b/arch/x86/crypto/sha-mb/sha1_mb_mgr_datastruct.S
new file mode 100644
index 000000000000..86688c6e7a25
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/sha1_mb_mgr_datastruct.S
@@ -0,0 +1,287 @@
1/*
2 * Header file for multi buffer SHA1 algorithm data structure
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2014 Intel Corporation.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * Contact Information:
21 * James Guilford <james.guilford@intel.com>
22 * Tim Chen <tim.c.chen@linux.intel.com>
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2014 Intel Corporation.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 *
32 * * Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * * Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in
36 * the documentation and/or other materials provided with the
37 * distribution.
38 * * Neither the name of Intel Corporation nor the names of its
39 * contributors may be used to endorse or promote products derived
40 * from this software without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */
54
55# Macros for defining data structures
56
57# Usage example
58
59#START_FIELDS # JOB_AES
60### name size align
61#FIELD _plaintext, 8, 8 # pointer to plaintext
62#FIELD _ciphertext, 8, 8 # pointer to ciphertext
63#FIELD _IV, 16, 8 # IV
64#FIELD _keys, 8, 8 # pointer to keys
65#FIELD _len, 4, 4 # length in bytes
66#FIELD _status, 4, 4 # status enumeration
67#FIELD _user_data, 8, 8 # pointer to user data
68#UNION _union, size1, align1, \
69# size2, align2, \
70# size3, align3, \
71# ...
72#END_FIELDS
73#%assign _JOB_AES_size _FIELD_OFFSET
74#%assign _JOB_AES_align _STRUCT_ALIGN
75
76#########################################################################
77
78# Alternate "struc-like" syntax:
79# STRUCT job_aes2
80# RES_Q .plaintext, 1
81# RES_Q .ciphertext, 1
82# RES_DQ .IV, 1
83# RES_B .nested, _JOB_AES_SIZE, _JOB_AES_ALIGN
84# RES_U .union, size1, align1, \
85# size2, align2, \
86# ...
87# ENDSTRUCT
88# # Following only needed if nesting
89# %assign job_aes2_size _FIELD_OFFSET
90# %assign job_aes2_align _STRUCT_ALIGN
91#
92# RES_* macros take a name, a count and an optional alignment.
93# The count in in terms of the base size of the macro, and the
94# default alignment is the base size.
95# The macros are:
96# Macro Base size
97# RES_B 1
98# RES_W 2
99# RES_D 4
100# RES_Q 8
101# RES_DQ 16
102# RES_Y 32
103# RES_Z 64
104#
105# RES_U defines a union. It's arguments are a name and two or more
106# pairs of "size, alignment"
107#
108# The two assigns are only needed if this structure is being nested
109# within another. Even if the assigns are not done, one can still use
110# STRUCT_NAME_size as the size of the structure.
111#
112# Note that for nesting, you still need to assign to STRUCT_NAME_size.
113#
114# The differences between this and using "struc" directly are that each
115# type is implicitly aligned to its natural length (although this can be
116# over-ridden with an explicit third parameter), and that the structure
117# is padded at the end to its overall alignment.
118#
119
120#########################################################################
121
122#ifndef _SHA1_MB_MGR_DATASTRUCT_ASM_
123#define _SHA1_MB_MGR_DATASTRUCT_ASM_
124
125## START_FIELDS
126.macro START_FIELDS
127 _FIELD_OFFSET = 0
128 _STRUCT_ALIGN = 0
129.endm
130
131## FIELD name size align
132.macro FIELD name size align
133 _FIELD_OFFSET = (_FIELD_OFFSET + (\align) - 1) & (~ ((\align)-1))
134 \name = _FIELD_OFFSET
135 _FIELD_OFFSET = _FIELD_OFFSET + (\size)
136.if (\align > _STRUCT_ALIGN)
137 _STRUCT_ALIGN = \align
138.endif
139.endm
140
141## END_FIELDS
142.macro END_FIELDS
143 _FIELD_OFFSET = (_FIELD_OFFSET + _STRUCT_ALIGN-1) & (~ (_STRUCT_ALIGN-1))
144.endm
145
146########################################################################
147
148.macro STRUCT p1
149START_FIELDS
150.struc \p1
151.endm
152
153.macro ENDSTRUCT
154 tmp = _FIELD_OFFSET
155 END_FIELDS
156 tmp = (_FIELD_OFFSET - %%tmp)
157.if (tmp > 0)
158 .lcomm tmp
159.endif
160.endstruc
161.endm
162
163## RES_int name size align
164.macro RES_int p1 p2 p3
165 name = \p1
166 size = \p2
167 align = .\p3
168
169 _FIELD_OFFSET = (_FIELD_OFFSET + (align) - 1) & (~ ((align)-1))
170.align align
171.lcomm name size
172 _FIELD_OFFSET = _FIELD_OFFSET + (size)
173.if (align > _STRUCT_ALIGN)
174 _STRUCT_ALIGN = align
175.endif
176.endm
177
178
179
180# macro RES_B name, size [, align]
181.macro RES_B _name, _size, _align=1
182RES_int _name _size _align
183.endm
184
185# macro RES_W name, size [, align]
186.macro RES_W _name, _size, _align=2
187RES_int _name 2*(_size) _align
188.endm
189
190# macro RES_D name, size [, align]
191.macro RES_D _name, _size, _align=4
192RES_int _name 4*(_size) _align
193.endm
194
195# macro RES_Q name, size [, align]
196.macro RES_Q _name, _size, _align=8
197RES_int _name 8*(_size) _align
198.endm
199
200# macro RES_DQ name, size [, align]
201.macro RES_DQ _name, _size, _align=16
202RES_int _name 16*(_size) _align
203.endm
204
205# macro RES_Y name, size [, align]
206.macro RES_Y _name, _size, _align=32
207RES_int _name 32*(_size) _align
208.endm
209
210# macro RES_Z name, size [, align]
211.macro RES_Z _name, _size, _align=64
212RES_int _name 64*(_size) _align
213.endm
214
215
216#endif
217
218########################################################################
219#### Define constants
220########################################################################
221
222########################################################################
223#### Define SHA1 Out Of Order Data Structures
224########################################################################
225
226START_FIELDS # LANE_DATA
227### name size align
228FIELD _job_in_lane, 8, 8 # pointer to job object
229END_FIELDS
230
231_LANE_DATA_size = _FIELD_OFFSET
232_LANE_DATA_align = _STRUCT_ALIGN
233
234########################################################################
235
236START_FIELDS # SHA1_ARGS_X8
237### name size align
238FIELD _digest, 4*5*8, 16 # transposed digest
239FIELD _data_ptr, 8*8, 8 # array of pointers to data
240END_FIELDS
241
242_SHA1_ARGS_X4_size = _FIELD_OFFSET
243_SHA1_ARGS_X4_align = _STRUCT_ALIGN
244_SHA1_ARGS_X8_size = _FIELD_OFFSET
245_SHA1_ARGS_X8_align = _STRUCT_ALIGN
246
247########################################################################
248
249START_FIELDS # MB_MGR
250### name size align
251FIELD _args, _SHA1_ARGS_X4_size, _SHA1_ARGS_X4_align
252FIELD _lens, 4*8, 8
253FIELD _unused_lanes, 8, 8
254FIELD _ldata, _LANE_DATA_size*8, _LANE_DATA_align
255END_FIELDS
256
257_MB_MGR_size = _FIELD_OFFSET
258_MB_MGR_align = _STRUCT_ALIGN
259
260_args_digest = _args + _digest
261_args_data_ptr = _args + _data_ptr
262
263
264########################################################################
265#### Define constants
266########################################################################
267
268#define STS_UNKNOWN 0
269#define STS_BEING_PROCESSED 1
270#define STS_COMPLETED 2
271
272########################################################################
273#### Define JOB_SHA1 structure
274########################################################################
275
276START_FIELDS # JOB_SHA1
277
278### name size align
279FIELD _buffer, 8, 8 # pointer to buffer
280FIELD _len, 4, 4 # length in bytes
281FIELD _result_digest, 5*4, 32 # Digest (output)
282FIELD _status, 4, 4
283FIELD _user_data, 8, 8
284END_FIELDS
285
286_JOB_SHA1_size = _FIELD_OFFSET
287_JOB_SHA1_align = _STRUCT_ALIGN
diff --git a/arch/x86/crypto/sha-mb/sha1_mb_mgr_flush_avx2.S b/arch/x86/crypto/sha-mb/sha1_mb_mgr_flush_avx2.S
new file mode 100644
index 000000000000..85c4e1cf7172
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/sha1_mb_mgr_flush_avx2.S
@@ -0,0 +1,327 @@
1/*
2 * Flush routine for SHA1 multibuffer
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2014 Intel Corporation.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * Contact Information:
21 * James Guilford <james.guilford@intel.com>
22 * Tim Chen <tim.c.chen@linux.intel.com>
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2014 Intel Corporation.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 *
32 * * Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * * Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in
36 * the documentation and/or other materials provided with the
37 * distribution.
38 * * Neither the name of Intel Corporation nor the names of its
39 * contributors may be used to endorse or promote products derived
40 * from this software without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */
54#include <linux/linkage.h>
55#include "sha1_mb_mgr_datastruct.S"
56
57
58.extern sha1_x8_avx2
59
60# LINUX register definitions
61#define arg1 %rdi
62#define arg2 %rsi
63
64# Common definitions
65#define state arg1
66#define job arg2
67#define len2 arg2
68
69# idx must be a register not clobbered by sha1_x8_avx2
70#define idx %r8
71#define DWORD_idx %r8d
72
73#define unused_lanes %rbx
74#define lane_data %rbx
75#define tmp2 %rbx
76#define tmp2_w %ebx
77
78#define job_rax %rax
79#define tmp1 %rax
80#define size_offset %rax
81#define tmp %rax
82#define start_offset %rax
83
84#define tmp3 %arg1
85
86#define extra_blocks %arg2
87#define p %arg2
88
89
90# STACK_SPACE needs to be an odd multiple of 8
91_XMM_SAVE_SIZE = 10*16
92_GPR_SAVE_SIZE = 8*8
93_ALIGN_SIZE = 8
94
95_XMM_SAVE = 0
96_GPR_SAVE = _XMM_SAVE + _XMM_SAVE_SIZE
97STACK_SPACE = _GPR_SAVE + _GPR_SAVE_SIZE + _ALIGN_SIZE
98
99.macro LABEL prefix n
100\prefix\n\():
101.endm
102
103.macro JNE_SKIP i
104jne skip_\i
105.endm
106
107.altmacro
108.macro SET_OFFSET _offset
109offset = \_offset
110.endm
111.noaltmacro
112
113# JOB* sha1_mb_mgr_flush_avx2(MB_MGR *state)
114# arg 1 : rcx : state
115ENTRY(sha1_mb_mgr_flush_avx2)
116 mov %rsp, %r10
117 sub $STACK_SPACE, %rsp
118 and $~31, %rsp
119 mov %rbx, _GPR_SAVE(%rsp)
120 mov %r10, _GPR_SAVE+8*1(%rsp) #save rsp
121 mov %rbp, _GPR_SAVE+8*3(%rsp)
122 mov %r12, _GPR_SAVE+8*4(%rsp)
123 mov %r13, _GPR_SAVE+8*5(%rsp)
124 mov %r14, _GPR_SAVE+8*6(%rsp)
125 mov %r15, _GPR_SAVE+8*7(%rsp)
126
127 # If bit (32+3) is set, then all lanes are empty
128 mov _unused_lanes(state), unused_lanes
129 bt $32+3, unused_lanes
130 jc return_null
131
132 # find a lane with a non-null job
133 xor idx, idx
134 offset = (_ldata + 1 * _LANE_DATA_size + _job_in_lane)
135 cmpq $0, offset(state)
136 cmovne one(%rip), idx
137 offset = (_ldata + 2 * _LANE_DATA_size + _job_in_lane)
138 cmpq $0, offset(state)
139 cmovne two(%rip), idx
140 offset = (_ldata + 3 * _LANE_DATA_size + _job_in_lane)
141 cmpq $0, offset(state)
142 cmovne three(%rip), idx
143 offset = (_ldata + 4 * _LANE_DATA_size + _job_in_lane)
144 cmpq $0, offset(state)
145 cmovne four(%rip), idx
146 offset = (_ldata + 5 * _LANE_DATA_size + _job_in_lane)
147 cmpq $0, offset(state)
148 cmovne five(%rip), idx
149 offset = (_ldata + 6 * _LANE_DATA_size + _job_in_lane)
150 cmpq $0, offset(state)
151 cmovne six(%rip), idx
152 offset = (_ldata + 7 * _LANE_DATA_size + _job_in_lane)
153 cmpq $0, offset(state)
154 cmovne seven(%rip), idx
155
156 # copy idx to empty lanes
157copy_lane_data:
158 offset = (_args + _data_ptr)
159 mov offset(state,idx,8), tmp
160
161 I = 0
162.rep 8
163 offset = (_ldata + I * _LANE_DATA_size + _job_in_lane)
164 cmpq $0, offset(state)
165.altmacro
166 JNE_SKIP %I
167 offset = (_args + _data_ptr + 8*I)
168 mov tmp, offset(state)
169 offset = (_lens + 4*I)
170 movl $0xFFFFFFFF, offset(state)
171LABEL skip_ %I
172 I = (I+1)
173.noaltmacro
174.endr
175
176 # Find min length
177 vmovdqa _lens+0*16(state), %xmm0
178 vmovdqa _lens+1*16(state), %xmm1
179
180 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
181 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
182 vpminud %xmm3, %xmm2, %xmm2 # xmm2 has {x,x,E,F}
183 vpalignr $4, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,x,E}
184 vpminud %xmm3, %xmm2, %xmm2 # xmm2 has min value in low dword
185
186 vmovd %xmm2, DWORD_idx
187 mov idx, len2
188 and $0xF, idx
189 shr $4, len2
190 jz len_is_0
191
192 vpand clear_low_nibble(%rip), %xmm2, %xmm2
193 vpshufd $0, %xmm2, %xmm2
194
195 vpsubd %xmm2, %xmm0, %xmm0
196 vpsubd %xmm2, %xmm1, %xmm1
197
198 vmovdqa %xmm0, _lens+0*16(state)
199 vmovdqa %xmm1, _lens+1*16(state)
200
201 # "state" and "args" are the same address, arg1
202 # len is arg2
203 call sha1_x8_avx2
204 # state and idx are intact
205
206
207len_is_0:
208 # process completed job "idx"
209 imul $_LANE_DATA_size, idx, lane_data
210 lea _ldata(state, lane_data), lane_data
211
212 mov _job_in_lane(lane_data), job_rax
213 movq $0, _job_in_lane(lane_data)
214 movl $STS_COMPLETED, _status(job_rax)
215 mov _unused_lanes(state), unused_lanes
216 shl $4, unused_lanes
217 or idx, unused_lanes
218 mov unused_lanes, _unused_lanes(state)
219
220 movl $0xFFFFFFFF, _lens(state, idx, 4)
221
222 vmovd _args_digest(state , idx, 4) , %xmm0
223 vpinsrd $1, _args_digest+1*32(state, idx, 4), %xmm0, %xmm0
224 vpinsrd $2, _args_digest+2*32(state, idx, 4), %xmm0, %xmm0
225 vpinsrd $3, _args_digest+3*32(state, idx, 4), %xmm0, %xmm0
226 movl _args_digest+4*32(state, idx, 4), tmp2_w
227
228 vmovdqu %xmm0, _result_digest(job_rax)
229 offset = (_result_digest + 1*16)
230 mov tmp2_w, offset(job_rax)
231
232return:
233
234 mov _GPR_SAVE(%rsp), %rbx
235 mov _GPR_SAVE+8*1(%rsp), %r10 #saved rsp
236 mov _GPR_SAVE+8*3(%rsp), %rbp
237 mov _GPR_SAVE+8*4(%rsp), %r12
238 mov _GPR_SAVE+8*5(%rsp), %r13
239 mov _GPR_SAVE+8*6(%rsp), %r14
240 mov _GPR_SAVE+8*7(%rsp), %r15
241 mov %r10, %rsp
242
243 ret
244
245return_null:
246 xor job_rax, job_rax
247 jmp return
248ENDPROC(sha1_mb_mgr_flush_avx2)
249
250
251#################################################################
252
253.align 16
254ENTRY(sha1_mb_mgr_get_comp_job_avx2)
255 push %rbx
256
257 ## if bit 32+3 is set, then all lanes are empty
258 mov _unused_lanes(state), unused_lanes
259 bt $(32+3), unused_lanes
260 jc .return_null
261
262 # Find min length
263 vmovdqa _lens(state), %xmm0
264 vmovdqa _lens+1*16(state), %xmm1
265
266 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
267 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
268 vpminud %xmm3, %xmm2, %xmm2 # xmm2 has {x,x,E,F}
269 vpalignr $4, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,x,E}
270 vpminud %xmm3, %xmm2, %xmm2 # xmm2 has min value in low dword
271
272 vmovd %xmm2, DWORD_idx
273 test $~0xF, idx
274 jnz .return_null
275
276 # process completed job "idx"
277 imul $_LANE_DATA_size, idx, lane_data
278 lea _ldata(state, lane_data), lane_data
279
280 mov _job_in_lane(lane_data), job_rax
281 movq $0, _job_in_lane(lane_data)
282 movl $STS_COMPLETED, _status(job_rax)
283 mov _unused_lanes(state), unused_lanes
284 shl $4, unused_lanes
285 or idx, unused_lanes
286 mov unused_lanes, _unused_lanes(state)
287
288 movl $0xFFFFFFFF, _lens(state, idx, 4)
289
290 vmovd _args_digest(state, idx, 4), %xmm0
291 vpinsrd $1, _args_digest+1*32(state, idx, 4), %xmm0, %xmm0
292 vpinsrd $2, _args_digest+2*32(state, idx, 4), %xmm0, %xmm0
293 vpinsrd $3, _args_digest+3*32(state, idx, 4), %xmm0, %xmm0
294 movl _args_digest+4*32(state, idx, 4), tmp2_w
295
296 vmovdqu %xmm0, _result_digest(job_rax)
297 movl tmp2_w, _result_digest+1*16(job_rax)
298
299 pop %rbx
300
301 ret
302
303.return_null:
304 xor job_rax, job_rax
305 pop %rbx
306 ret
307ENDPROC(sha1_mb_mgr_get_comp_job_avx2)
308
309.data
310
311.align 16
312clear_low_nibble:
313.octa 0x000000000000000000000000FFFFFFF0
314one:
315.quad 1
316two:
317.quad 2
318three:
319.quad 3
320four:
321.quad 4
322five:
323.quad 5
324six:
325.quad 6
326seven:
327.quad 7
diff --git a/arch/x86/crypto/sha-mb/sha1_mb_mgr_init_avx2.c b/arch/x86/crypto/sha-mb/sha1_mb_mgr_init_avx2.c
new file mode 100644
index 000000000000..4ca7e166a2aa
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/sha1_mb_mgr_init_avx2.c
@@ -0,0 +1,64 @@
1/*
2 * Initialization code for multi buffer SHA1 algorithm for AVX2
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2014 Intel Corporation.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * Contact Information:
21 * Tim Chen <tim.c.chen@linux.intel.com>
22 *
23 * BSD LICENSE
24 *
25 * Copyright(c) 2014 Intel Corporation.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 *
31 * * Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * * Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in
35 * the documentation and/or other materials provided with the
36 * distribution.
37 * * Neither the name of Intel Corporation nor the names of its
38 * contributors may be used to endorse or promote products derived
39 * from this software without specific prior written permission.
40 *
41 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
42 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
43 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
44 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
45 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
47 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
51 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 */
53
54#include "sha_mb_mgr.h"
55
56void sha1_mb_mgr_init_avx2(struct sha1_mb_mgr *state)
57{
58 unsigned int j;
59 state->unused_lanes = 0xF76543210;
60 for (j = 0; j < 8; j++) {
61 state->lens[j] = 0xFFFFFFFF;
62 state->ldata[j].job_in_lane = NULL;
63 }
64}
diff --git a/arch/x86/crypto/sha-mb/sha1_mb_mgr_submit_avx2.S b/arch/x86/crypto/sha-mb/sha1_mb_mgr_submit_avx2.S
new file mode 100644
index 000000000000..2ab9560b53c8
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/sha1_mb_mgr_submit_avx2.S
@@ -0,0 +1,228 @@
1/*
2 * Buffer submit code for multi buffer SHA1 algorithm
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2014 Intel Corporation.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * Contact Information:
21 * James Guilford <james.guilford@intel.com>
22 * Tim Chen <tim.c.chen@linux.intel.com>
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2014 Intel Corporation.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 *
32 * * Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * * Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in
36 * the documentation and/or other materials provided with the
37 * distribution.
38 * * Neither the name of Intel Corporation nor the names of its
39 * contributors may be used to endorse or promote products derived
40 * from this software without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */
54
55#include <linux/linkage.h>
56#include "sha1_mb_mgr_datastruct.S"
57
58
59.extern sha1_x8_avx
60
61# LINUX register definitions
62arg1 = %rdi
63arg2 = %rsi
64size_offset = %rcx
65tmp2 = %rcx
66extra_blocks = %rdx
67
68# Common definitions
69#define state arg1
70#define job %rsi
71#define len2 arg2
72#define p2 arg2
73
74# idx must be a register not clobberred by sha1_x8_avx2
75idx = %r8
76DWORD_idx = %r8d
77last_len = %r8
78
79p = %r11
80start_offset = %r11
81
82unused_lanes = %rbx
83BYTE_unused_lanes = %bl
84
85job_rax = %rax
86len = %rax
87DWORD_len = %eax
88
89lane = %rbp
90tmp3 = %rbp
91
92tmp = %r9
93DWORD_tmp = %r9d
94
95lane_data = %r10
96
97# STACK_SPACE needs to be an odd multiple of 8
98STACK_SPACE = 8*8 + 16*10 + 8
99
100# JOB* submit_mb_mgr_submit_avx2(MB_MGR *state, job_sha1 *job)
101# arg 1 : rcx : state
102# arg 2 : rdx : job
103ENTRY(sha1_mb_mgr_submit_avx2)
104
105 mov %rsp, %r10
106 sub $STACK_SPACE, %rsp
107 and $~31, %rsp
108
109 mov %rbx, (%rsp)
110 mov %r10, 8*2(%rsp) #save old rsp
111 mov %rbp, 8*3(%rsp)
112 mov %r12, 8*4(%rsp)
113 mov %r13, 8*5(%rsp)
114 mov %r14, 8*6(%rsp)
115 mov %r15, 8*7(%rsp)
116
117 mov _unused_lanes(state), unused_lanes
118 mov unused_lanes, lane
119 and $0xF, lane
120 shr $4, unused_lanes
121 imul $_LANE_DATA_size, lane, lane_data
122 movl $STS_BEING_PROCESSED, _status(job)
123 lea _ldata(state, lane_data), lane_data
124 mov unused_lanes, _unused_lanes(state)
125 movl _len(job), DWORD_len
126
127 mov job, _job_in_lane(lane_data)
128 shl $4, len
129 or lane, len
130
131 movl DWORD_len, _lens(state , lane, 4)
132
133 # Load digest words from result_digest
134 vmovdqu _result_digest(job), %xmm0
135 mov _result_digest+1*16(job), DWORD_tmp
136 vmovd %xmm0, _args_digest(state, lane, 4)
137 vpextrd $1, %xmm0, _args_digest+1*32(state , lane, 4)
138 vpextrd $2, %xmm0, _args_digest+2*32(state , lane, 4)
139 vpextrd $3, %xmm0, _args_digest+3*32(state , lane, 4)
140 movl DWORD_tmp, _args_digest+4*32(state , lane, 4)
141
142 mov _buffer(job), p
143 mov p, _args_data_ptr(state, lane, 8)
144
145 cmp $0xF, unused_lanes
146 jne return_null
147
148start_loop:
149 # Find min length
150 vmovdqa _lens(state), %xmm0
151 vmovdqa _lens+1*16(state), %xmm1
152
153 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
154 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
155 vpminud %xmm3, %xmm2, %xmm2 # xmm2 has {x,x,E,F}
156 vpalignr $4, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,x,E}
157 vpminud %xmm3, %xmm2, %xmm2 # xmm2 has min value in low dword
158
159 vmovd %xmm2, DWORD_idx
160 mov idx, len2
161 and $0xF, idx
162 shr $4, len2
163 jz len_is_0
164
165 vpand clear_low_nibble(%rip), %xmm2, %xmm2
166 vpshufd $0, %xmm2, %xmm2
167
168 vpsubd %xmm2, %xmm0, %xmm0
169 vpsubd %xmm2, %xmm1, %xmm1
170
171 vmovdqa %xmm0, _lens + 0*16(state)
172 vmovdqa %xmm1, _lens + 1*16(state)
173
174
175 # "state" and "args" are the same address, arg1
176 # len is arg2
177 call sha1_x8_avx2
178
179 # state and idx are intact
180
181len_is_0:
182 # process completed job "idx"
183 imul $_LANE_DATA_size, idx, lane_data
184 lea _ldata(state, lane_data), lane_data
185
186 mov _job_in_lane(lane_data), job_rax
187 mov _unused_lanes(state), unused_lanes
188 movq $0, _job_in_lane(lane_data)
189 movl $STS_COMPLETED, _status(job_rax)
190 shl $4, unused_lanes
191 or idx, unused_lanes
192 mov unused_lanes, _unused_lanes(state)
193
194 movl $0xFFFFFFFF, _lens(state, idx, 4)
195
196 vmovd _args_digest(state, idx, 4), %xmm0
197 vpinsrd $1, _args_digest+1*32(state , idx, 4), %xmm0, %xmm0
198 vpinsrd $2, _args_digest+2*32(state , idx, 4), %xmm0, %xmm0
199 vpinsrd $3, _args_digest+3*32(state , idx, 4), %xmm0, %xmm0
200 movl 4*32(state, idx, 4), DWORD_tmp
201
202 vmovdqu %xmm0, _result_digest(job_rax)
203 movl DWORD_tmp, _result_digest+1*16(job_rax)
204
205return:
206
207 mov (%rsp), %rbx
208 mov 8*2(%rsp), %r10 #save old rsp
209 mov 8*3(%rsp), %rbp
210 mov 8*4(%rsp), %r12
211 mov 8*5(%rsp), %r13
212 mov 8*6(%rsp), %r14
213 mov 8*7(%rsp), %r15
214 mov %r10, %rsp
215
216 ret
217
218return_null:
219 xor job_rax, job_rax
220 jmp return
221
222ENDPROC(sha1_mb_mgr_submit_avx2)
223
224.data
225
226.align 16
227clear_low_nibble:
228 .octa 0x000000000000000000000000FFFFFFF0
diff --git a/arch/x86/crypto/sha-mb/sha1_x8_avx2.S b/arch/x86/crypto/sha-mb/sha1_x8_avx2.S
new file mode 100644
index 000000000000..8e1b47792b31
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/sha1_x8_avx2.S
@@ -0,0 +1,472 @@
1/*
2 * Multi-buffer SHA1 algorithm hash compute routine
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2014 Intel Corporation.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * Contact Information:
21 * James Guilford <james.guilford@intel.com>
22 * Tim Chen <tim.c.chen@linux.intel.com>
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2014 Intel Corporation.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 *
32 * * Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * * Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in
36 * the documentation and/or other materials provided with the
37 * distribution.
38 * * Neither the name of Intel Corporation nor the names of its
39 * contributors may be used to endorse or promote products derived
40 * from this software without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */
54
55#include <linux/linkage.h>
56#include "sha1_mb_mgr_datastruct.S"
57
58## code to compute oct SHA1 using SSE-256
59## outer calling routine takes care of save and restore of XMM registers
60
61## Function clobbers: rax, rcx, rdx, rbx, rsi, rdi, r9-r15# ymm0-15
62##
63## Linux clobbers: rax rbx rcx rdx rsi r9 r10 r11 r12 r13 r14 r15
64## Linux preserves: rdi rbp r8
65##
66## clobbers ymm0-15
67
68
69# TRANSPOSE8 r0, r1, r2, r3, r4, r5, r6, r7, t0, t1
70# "transpose" data in {r0...r7} using temps {t0...t1}
71# Input looks like: {r0 r1 r2 r3 r4 r5 r6 r7}
72# r0 = {a7 a6 a5 a4 a3 a2 a1 a0}
73# r1 = {b7 b6 b5 b4 b3 b2 b1 b0}
74# r2 = {c7 c6 c5 c4 c3 c2 c1 c0}
75# r3 = {d7 d6 d5 d4 d3 d2 d1 d0}
76# r4 = {e7 e6 e5 e4 e3 e2 e1 e0}
77# r5 = {f7 f6 f5 f4 f3 f2 f1 f0}
78# r6 = {g7 g6 g5 g4 g3 g2 g1 g0}
79# r7 = {h7 h6 h5 h4 h3 h2 h1 h0}
80#
81# Output looks like: {r0 r1 r2 r3 r4 r5 r6 r7}
82# r0 = {h0 g0 f0 e0 d0 c0 b0 a0}
83# r1 = {h1 g1 f1 e1 d1 c1 b1 a1}
84# r2 = {h2 g2 f2 e2 d2 c2 b2 a2}
85# r3 = {h3 g3 f3 e3 d3 c3 b3 a3}
86# r4 = {h4 g4 f4 e4 d4 c4 b4 a4}
87# r5 = {h5 g5 f5 e5 d5 c5 b5 a5}
88# r6 = {h6 g6 f6 e6 d6 c6 b6 a6}
89# r7 = {h7 g7 f7 e7 d7 c7 b7 a7}
90#
91
92.macro TRANSPOSE8 r0 r1 r2 r3 r4 r5 r6 r7 t0 t1
93 # process top half (r0..r3) {a...d}
94 vshufps $0x44, \r1, \r0, \t0 # t0 = {b5 b4 a5 a4 b1 b0 a1 a0}
95 vshufps $0xEE, \r1, \r0, \r0 # r0 = {b7 b6 a7 a6 b3 b2 a3 a2}
96 vshufps $0x44, \r3, \r2, \t1 # t1 = {d5 d4 c5 c4 d1 d0 c1 c0}
97 vshufps $0xEE, \r3, \r2, \r2 # r2 = {d7 d6 c7 c6 d3 d2 c3 c2}
98 vshufps $0xDD, \t1, \t0, \r3 # r3 = {d5 c5 b5 a5 d1 c1 b1 a1}
99 vshufps $0x88, \r2, \r0, \r1 # r1 = {d6 c6 b6 a6 d2 c2 b2 a2}
100 vshufps $0xDD, \r2, \r0, \r0 # r0 = {d7 c7 b7 a7 d3 c3 b3 a3}
101 vshufps $0x88, \t1, \t0, \t0 # t0 = {d4 c4 b4 a4 d0 c0 b0 a0}
102
103 # use r2 in place of t0
104 # process bottom half (r4..r7) {e...h}
105 vshufps $0x44, \r5, \r4, \r2 # r2 = {f5 f4 e5 e4 f1 f0 e1 e0}
106 vshufps $0xEE, \r5, \r4, \r4 # r4 = {f7 f6 e7 e6 f3 f2 e3 e2}
107 vshufps $0x44, \r7, \r6, \t1 # t1 = {h5 h4 g5 g4 h1 h0 g1 g0}
108 vshufps $0xEE, \r7, \r6, \r6 # r6 = {h7 h6 g7 g6 h3 h2 g3 g2}
109 vshufps $0xDD, \t1, \r2, \r7 # r7 = {h5 g5 f5 e5 h1 g1 f1 e1}
110 vshufps $0x88, \r6, \r4, \r5 # r5 = {h6 g6 f6 e6 h2 g2 f2 e2}
111 vshufps $0xDD, \r6, \r4, \r4 # r4 = {h7 g7 f7 e7 h3 g3 f3 e3}
112 vshufps $0x88, \t1, \r2, \t1 # t1 = {h4 g4 f4 e4 h0 g0 f0 e0}
113
114 vperm2f128 $0x13, \r1, \r5, \r6 # h6...a6
115 vperm2f128 $0x02, \r1, \r5, \r2 # h2...a2
116 vperm2f128 $0x13, \r3, \r7, \r5 # h5...a5
117 vperm2f128 $0x02, \r3, \r7, \r1 # h1...a1
118 vperm2f128 $0x13, \r0, \r4, \r7 # h7...a7
119 vperm2f128 $0x02, \r0, \r4, \r3 # h3...a3
120 vperm2f128 $0x13, \t0, \t1, \r4 # h4...a4
121 vperm2f128 $0x02, \t0, \t1, \r0 # h0...a0
122
123.endm
124##
125## Magic functions defined in FIPS 180-1
126##
127# macro MAGIC_F0 F,B,C,D,T ## F = (D ^ (B & (C ^ D)))
128.macro MAGIC_F0 regF regB regC regD regT
129 vpxor \regD, \regC, \regF
130 vpand \regB, \regF, \regF
131 vpxor \regD, \regF, \regF
132.endm
133
134# macro MAGIC_F1 F,B,C,D,T ## F = (B ^ C ^ D)
135.macro MAGIC_F1 regF regB regC regD regT
136 vpxor \regC, \regD, \regF
137 vpxor \regB, \regF, \regF
138.endm
139
140# macro MAGIC_F2 F,B,C,D,T ## F = ((B & C) | (B & D) | (C & D))
141.macro MAGIC_F2 regF regB regC regD regT
142 vpor \regC, \regB, \regF
143 vpand \regC, \regB, \regT
144 vpand \regD, \regF, \regF
145 vpor \regT, \regF, \regF
146.endm
147
148# macro MAGIC_F3 F,B,C,D,T ## F = (B ^ C ^ D)
149.macro MAGIC_F3 regF regB regC regD regT
150 MAGIC_F1 \regF,\regB,\regC,\regD,\regT
151.endm
152
153# PROLD reg, imm, tmp
154.macro PROLD reg imm tmp
155 vpsrld $(32-\imm), \reg, \tmp
156 vpslld $\imm, \reg, \reg
157 vpor \tmp, \reg, \reg
158.endm
159
160.macro PROLD_nd reg imm tmp src
161 vpsrld $(32-\imm), \src, \tmp
162 vpslld $\imm, \src, \reg
163 vpor \tmp, \reg, \reg
164.endm
165
166.macro SHA1_STEP_00_15 regA regB regC regD regE regT regF memW immCNT MAGIC
167 vpaddd \immCNT, \regE, \regE
168 vpaddd \memW*32(%rsp), \regE, \regE
169 PROLD_nd \regT, 5, \regF, \regA
170 vpaddd \regT, \regE, \regE
171 \MAGIC \regF, \regB, \regC, \regD, \regT
172 PROLD \regB, 30, \regT
173 vpaddd \regF, \regE, \regE
174.endm
175
176.macro SHA1_STEP_16_79 regA regB regC regD regE regT regF memW immCNT MAGIC
177 vpaddd \immCNT, \regE, \regE
178 offset = ((\memW - 14) & 15) * 32
179 vmovdqu offset(%rsp), W14
180 vpxor W14, W16, W16
181 offset = ((\memW - 8) & 15) * 32
182 vpxor offset(%rsp), W16, W16
183 offset = ((\memW - 3) & 15) * 32
184 vpxor offset(%rsp), W16, W16
185 vpsrld $(32-1), W16, \regF
186 vpslld $1, W16, W16
187 vpor W16, \regF, \regF
188
189 ROTATE_W
190
191 offset = ((\memW - 0) & 15) * 32
192 vmovdqu \regF, offset(%rsp)
193 vpaddd \regF, \regE, \regE
194 PROLD_nd \regT, 5, \regF, \regA
195 vpaddd \regT, \regE, \regE
196 \MAGIC \regF,\regB,\regC,\regD,\regT ## FUN = MAGIC_Fi(B,C,D)
197 PROLD \regB,30, \regT
198 vpaddd \regF, \regE, \regE
199.endm
200
201########################################################################
202########################################################################
203########################################################################
204
205## FRAMESZ plus pushes must be an odd multiple of 8
206YMM_SAVE = (15-15)*32
207FRAMESZ = 32*16 + YMM_SAVE
208_YMM = FRAMESZ - YMM_SAVE
209
210#define VMOVPS vmovups
211
212IDX = %rax
213inp0 = %r9
214inp1 = %r10
215inp2 = %r11
216inp3 = %r12
217inp4 = %r13
218inp5 = %r14
219inp6 = %r15
220inp7 = %rcx
221arg1 = %rdi
222arg2 = %rsi
223RSP_SAVE = %rdx
224
225# ymm0 A
226# ymm1 B
227# ymm2 C
228# ymm3 D
229# ymm4 E
230# ymm5 F AA
231# ymm6 T0 BB
232# ymm7 T1 CC
233# ymm8 T2 DD
234# ymm9 T3 EE
235# ymm10 T4 TMP
236# ymm11 T5 FUN
237# ymm12 T6 K
238# ymm13 T7 W14
239# ymm14 T8 W15
240# ymm15 T9 W16
241
242
243A = %ymm0
244B = %ymm1
245C = %ymm2
246D = %ymm3
247E = %ymm4
248F = %ymm5
249T0 = %ymm6
250T1 = %ymm7
251T2 = %ymm8
252T3 = %ymm9
253T4 = %ymm10
254T5 = %ymm11
255T6 = %ymm12
256T7 = %ymm13
257T8 = %ymm14
258T9 = %ymm15
259
260AA = %ymm5
261BB = %ymm6
262CC = %ymm7
263DD = %ymm8
264EE = %ymm9
265TMP = %ymm10
266FUN = %ymm11
267K = %ymm12
268W14 = %ymm13
269W15 = %ymm14
270W16 = %ymm15
271
272.macro ROTATE_ARGS
273 TMP_ = E
274 E = D
275 D = C
276 C = B
277 B = A
278 A = TMP_
279.endm
280
281.macro ROTATE_W
282TMP_ = W16
283W16 = W15
284W15 = W14
285W14 = TMP_
286.endm
287
288# 8 streams x 5 32bit words per digest x 4 bytes per word
289#define DIGEST_SIZE (8*5*4)
290
291.align 32
292
293# void sha1_x8_avx2(void **input_data, UINT128 *digest, UINT32 size)
294# arg 1 : pointer to array[4] of pointer to input data
295# arg 2 : size (in blocks) ;; assumed to be >= 1
296#
297ENTRY(sha1_x8_avx2)
298
299 push RSP_SAVE
300
301 #save rsp
302 mov %rsp, RSP_SAVE
303 sub $FRAMESZ, %rsp
304
305 #align rsp to 32 Bytes
306 and $~0x1F, %rsp
307
308 ## Initialize digests
309 vmovdqu 0*32(arg1), A
310 vmovdqu 1*32(arg1), B
311 vmovdqu 2*32(arg1), C
312 vmovdqu 3*32(arg1), D
313 vmovdqu 4*32(arg1), E
314
315 ## transpose input onto stack
316 mov _data_ptr+0*8(arg1),inp0
317 mov _data_ptr+1*8(arg1),inp1
318 mov _data_ptr+2*8(arg1),inp2
319 mov _data_ptr+3*8(arg1),inp3
320 mov _data_ptr+4*8(arg1),inp4
321 mov _data_ptr+5*8(arg1),inp5
322 mov _data_ptr+6*8(arg1),inp6
323 mov _data_ptr+7*8(arg1),inp7
324
325 xor IDX, IDX
326lloop:
327 vmovdqu PSHUFFLE_BYTE_FLIP_MASK(%rip), F
328 I=0
329.rep 2
330 VMOVPS (inp0, IDX), T0
331 VMOVPS (inp1, IDX), T1
332 VMOVPS (inp2, IDX), T2
333 VMOVPS (inp3, IDX), T3
334 VMOVPS (inp4, IDX), T4
335 VMOVPS (inp5, IDX), T5
336 VMOVPS (inp6, IDX), T6
337 VMOVPS (inp7, IDX), T7
338
339 TRANSPOSE8 T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
340 vpshufb F, T0, T0
341 vmovdqu T0, (I*8)*32(%rsp)
342 vpshufb F, T1, T1
343 vmovdqu T1, (I*8+1)*32(%rsp)
344 vpshufb F, T2, T2
345 vmovdqu T2, (I*8+2)*32(%rsp)
346 vpshufb F, T3, T3
347 vmovdqu T3, (I*8+3)*32(%rsp)
348 vpshufb F, T4, T4
349 vmovdqu T4, (I*8+4)*32(%rsp)
350 vpshufb F, T5, T5
351 vmovdqu T5, (I*8+5)*32(%rsp)
352 vpshufb F, T6, T6
353 vmovdqu T6, (I*8+6)*32(%rsp)
354 vpshufb F, T7, T7
355 vmovdqu T7, (I*8+7)*32(%rsp)
356 add $32, IDX
357 I = (I+1)
358.endr
359 # save old digests
360 vmovdqu A,AA
361 vmovdqu B,BB
362 vmovdqu C,CC
363 vmovdqu D,DD
364 vmovdqu E,EE
365
366##
367## perform 0-79 steps
368##
369 vmovdqu K00_19(%rip), K
370## do rounds 0...15
371 I = 0
372.rep 16
373 SHA1_STEP_00_15 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F0
374 ROTATE_ARGS
375 I = (I+1)
376.endr
377
378## do rounds 16...19
379 vmovdqu ((16 - 16) & 15) * 32 (%rsp), W16
380 vmovdqu ((16 - 15) & 15) * 32 (%rsp), W15
381.rep 4
382 SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F0
383 ROTATE_ARGS
384 I = (I+1)
385.endr
386
387## do rounds 20...39
388 vmovdqu K20_39(%rip), K
389.rep 20
390 SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F1
391 ROTATE_ARGS
392 I = (I+1)
393.endr
394
395## do rounds 40...59
396 vmovdqu K40_59(%rip), K
397.rep 20
398 SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F2
399 ROTATE_ARGS
400 I = (I+1)
401.endr
402
403## do rounds 60...79
404 vmovdqu K60_79(%rip), K
405.rep 20
406 SHA1_STEP_16_79 A,B,C,D,E, TMP,FUN, I, K, MAGIC_F3
407 ROTATE_ARGS
408 I = (I+1)
409.endr
410
411 vpaddd AA,A,A
412 vpaddd BB,B,B
413 vpaddd CC,C,C
414 vpaddd DD,D,D
415 vpaddd EE,E,E
416
417 sub $1, arg2
418 jne lloop
419
420 # write out digests
421 vmovdqu A, 0*32(arg1)
422 vmovdqu B, 1*32(arg1)
423 vmovdqu C, 2*32(arg1)
424 vmovdqu D, 3*32(arg1)
425 vmovdqu E, 4*32(arg1)
426
427 # update input pointers
428 add IDX, inp0
429 add IDX, inp1
430 add IDX, inp2
431 add IDX, inp3
432 add IDX, inp4
433 add IDX, inp5
434 add IDX, inp6
435 add IDX, inp7
436 mov inp0, _data_ptr (arg1)
437 mov inp1, _data_ptr + 1*8(arg1)
438 mov inp2, _data_ptr + 2*8(arg1)
439 mov inp3, _data_ptr + 3*8(arg1)
440 mov inp4, _data_ptr + 4*8(arg1)
441 mov inp5, _data_ptr + 5*8(arg1)
442 mov inp6, _data_ptr + 6*8(arg1)
443 mov inp7, _data_ptr + 7*8(arg1)
444
445 ################
446 ## Postamble
447
448 mov RSP_SAVE, %rsp
449 pop RSP_SAVE
450
451 ret
452ENDPROC(sha1_x8_avx2)
453
454
455.data
456
457.align 32
458K00_19:
459.octa 0x5A8279995A8279995A8279995A827999
460.octa 0x5A8279995A8279995A8279995A827999
461K20_39:
462.octa 0x6ED9EBA16ED9EBA16ED9EBA16ED9EBA1
463.octa 0x6ED9EBA16ED9EBA16ED9EBA16ED9EBA1
464K40_59:
465.octa 0x8F1BBCDC8F1BBCDC8F1BBCDC8F1BBCDC
466.octa 0x8F1BBCDC8F1BBCDC8F1BBCDC8F1BBCDC
467K60_79:
468.octa 0xCA62C1D6CA62C1D6CA62C1D6CA62C1D6
469.octa 0xCA62C1D6CA62C1D6CA62C1D6CA62C1D6
470PSHUFFLE_BYTE_FLIP_MASK:
471.octa 0x0c0d0e0f08090a0b0405060700010203
472.octa 0x0c0d0e0f08090a0b0405060700010203
diff --git a/arch/x86/crypto/sha-mb/sha_mb_ctx.h b/arch/x86/crypto/sha-mb/sha_mb_ctx.h
new file mode 100644
index 000000000000..e36069d0c1bd
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/sha_mb_ctx.h
@@ -0,0 +1,136 @@
1/*
2 * Header file for multi buffer SHA context
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2014 Intel Corporation.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * Contact Information:
21 * Tim Chen <tim.c.chen@linux.intel.com>
22 *
23 * BSD LICENSE
24 *
25 * Copyright(c) 2014 Intel Corporation.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 *
31 * * Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * * Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in
35 * the documentation and/or other materials provided with the
36 * distribution.
37 * * Neither the name of Intel Corporation nor the names of its
38 * contributors may be used to endorse or promote products derived
39 * from this software without specific prior written permission.
40 *
41 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
42 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
43 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
44 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
45 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
47 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
51 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 */
53
54#ifndef _SHA_MB_CTX_INTERNAL_H
55#define _SHA_MB_CTX_INTERNAL_H
56
57#include "sha_mb_mgr.h"
58
59#define HASH_UPDATE 0x00
60#define HASH_FIRST 0x01
61#define HASH_LAST 0x02
62#define HASH_ENTIRE 0x03
63#define HASH_DONE 0x04
64#define HASH_FINAL 0x08
65
66#define HASH_CTX_STS_IDLE 0x00
67#define HASH_CTX_STS_PROCESSING 0x01
68#define HASH_CTX_STS_LAST 0x02
69#define HASH_CTX_STS_COMPLETE 0x04
70
71enum hash_ctx_error {
72 HASH_CTX_ERROR_NONE = 0,
73 HASH_CTX_ERROR_INVALID_FLAGS = -1,
74 HASH_CTX_ERROR_ALREADY_PROCESSING = -2,
75 HASH_CTX_ERROR_ALREADY_COMPLETED = -3,
76
77#ifdef HASH_CTX_DEBUG
78 HASH_CTX_ERROR_DEBUG_DIGEST_MISMATCH = -4,
79#endif
80};
81
82
83#define hash_ctx_user_data(ctx) ((ctx)->user_data)
84#define hash_ctx_digest(ctx) ((ctx)->job.result_digest)
85#define hash_ctx_processing(ctx) ((ctx)->status & HASH_CTX_STS_PROCESSING)
86#define hash_ctx_complete(ctx) ((ctx)->status == HASH_CTX_STS_COMPLETE)
87#define hash_ctx_status(ctx) ((ctx)->status)
88#define hash_ctx_error(ctx) ((ctx)->error)
89#define hash_ctx_init(ctx) \
90 do { \
91 (ctx)->error = HASH_CTX_ERROR_NONE; \
92 (ctx)->status = HASH_CTX_STS_COMPLETE; \
93 } while (0)
94
95
96/* Hash Constants and Typedefs */
97#define SHA1_DIGEST_LENGTH 5
98#define SHA1_LOG2_BLOCK_SIZE 6
99
100#define SHA1_PADLENGTHFIELD_SIZE 8
101
102#ifdef SHA_MB_DEBUG
103#define assert(expr) \
104do { \
105 if (unlikely(!(expr))) { \
106 printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
107 #expr, __FILE__, __func__, __LINE__); \
108 } \
109} while (0)
110#else
111#define assert(expr) do {} while (0)
112#endif
113
114struct sha1_ctx_mgr {
115 struct sha1_mb_mgr mgr;
116};
117
118/* typedef struct sha1_ctx_mgr sha1_ctx_mgr; */
119
120struct sha1_hash_ctx {
121 /* Must be at struct offset 0 */
122 struct job_sha1 job;
123 /* status flag */
124 int status;
125 /* error flag */
126 int error;
127
128 uint32_t total_length;
129 const void *incoming_buffer;
130 uint32_t incoming_buffer_length;
131 uint8_t partial_block_buffer[SHA1_BLOCK_SIZE * 2];
132 uint32_t partial_block_buffer_length;
133 void *user_data;
134};
135
136#endif
diff --git a/arch/x86/crypto/sha-mb/sha_mb_mgr.h b/arch/x86/crypto/sha-mb/sha_mb_mgr.h
new file mode 100644
index 000000000000..08ad1a9acfd7
--- /dev/null
+++ b/arch/x86/crypto/sha-mb/sha_mb_mgr.h
@@ -0,0 +1,110 @@
1/*
2 * Header file for multi buffer SHA1 algorithm manager
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2014 Intel Corporation.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * Contact Information:
21 * James Guilford <james.guilford@intel.com>
22 * Tim Chen <tim.c.chen@linux.intel.com>
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2014 Intel Corporation.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 *
32 * * Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * * Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in
36 * the documentation and/or other materials provided with the
37 * distribution.
38 * * Neither the name of Intel Corporation nor the names of its
39 * contributors may be used to endorse or promote products derived
40 * from this software without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */
54#ifndef __SHA_MB_MGR_H
55#define __SHA_MB_MGR_H
56
57
58#include <linux/types.h>
59
60#define NUM_SHA1_DIGEST_WORDS 5
61
62enum job_sts { STS_UNKNOWN = 0,
63 STS_BEING_PROCESSED = 1,
64 STS_COMPLETED = 2,
65 STS_INTERNAL_ERROR = 3,
66 STS_ERROR = 4
67};
68
69struct job_sha1 {
70 u8 *buffer;
71 u32 len;
72 u32 result_digest[NUM_SHA1_DIGEST_WORDS] __aligned(32);
73 enum job_sts status;
74 void *user_data;
75};
76
77/* SHA1 out-of-order scheduler */
78
79/* typedef uint32_t sha1_digest_array[5][8]; */
80
81struct sha1_args_x8 {
82 uint32_t digest[5][8];
83 uint8_t *data_ptr[8];
84};
85
86struct sha1_lane_data {
87 struct job_sha1 *job_in_lane;
88};
89
90struct sha1_mb_mgr {
91 struct sha1_args_x8 args;
92
93 uint32_t lens[8];
94
95 /* each byte is index (0...7) of unused lanes */
96 uint64_t unused_lanes;
97 /* byte 4 is set to FF as a flag */
98 struct sha1_lane_data ldata[8];
99};
100
101
102#define SHA1_MB_MGR_NUM_LANES_AVX2 8
103
104void sha1_mb_mgr_init_avx2(struct sha1_mb_mgr *state);
105struct job_sha1 *sha1_mb_mgr_submit_avx2(struct sha1_mb_mgr *state,
106 struct job_sha1 *job);
107struct job_sha1 *sha1_mb_mgr_flush_avx2(struct sha1_mb_mgr *state);
108struct job_sha1 *sha1_mb_mgr_get_comp_job_avx2(struct sha1_mb_mgr *state);
109
110#endif
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index afcd35d331de..cfe3b954d5e4 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -497,8 +497,6 @@ static __always_inline int fls64(__u64 x)
497 497
498#include <asm-generic/bitops/sched.h> 498#include <asm-generic/bitops/sched.h>
499 499
500#define ARCH_HAS_FAST_MULTIPLIER 1
501
502#include <asm/arch_hweight.h> 500#include <asm/arch_hweight.h>
503 501
504#include <asm-generic/bitops/const_hweight.h> 502#include <asm-generic/bitops/const_hweight.h>
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index bb9b258d60e7..094292a63e74 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -202,6 +202,7 @@
202#define X86_FEATURE_DECODEASSISTS ( 8*32+12) /* AMD Decode Assists support */ 202#define X86_FEATURE_DECODEASSISTS ( 8*32+12) /* AMD Decode Assists support */
203#define X86_FEATURE_PAUSEFILTER ( 8*32+13) /* AMD filtered pause intercept */ 203#define X86_FEATURE_PAUSEFILTER ( 8*32+13) /* AMD filtered pause intercept */
204#define X86_FEATURE_PFTHRESHOLD ( 8*32+14) /* AMD pause filter threshold */ 204#define X86_FEATURE_PFTHRESHOLD ( 8*32+14) /* AMD pause filter threshold */
205#define X86_FEATURE_VMMCALL ( 8*32+15) /* Prefer vmmcall to vmcall */
205 206
206 207
207/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ 208/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */
@@ -250,8 +251,15 @@
250#include <asm/asm.h> 251#include <asm/asm.h>
251#include <linux/bitops.h> 252#include <linux/bitops.h>
252 253
254#ifdef CONFIG_X86_FEATURE_NAMES
253extern const char * const x86_cap_flags[NCAPINTS*32]; 255extern const char * const x86_cap_flags[NCAPINTS*32];
254extern const char * const x86_power_flags[32]; 256extern const char * const x86_power_flags[32];
257#define X86_CAP_FMT "%s"
258#define x86_cap_flag(flag) x86_cap_flags[flag]
259#else
260#define X86_CAP_FMT "%d:%d"
261#define x86_cap_flag(flag) ((flag) >> 5), ((flag) & 31)
262#endif
255 263
256/* 264/*
257 * In order to save room, we index into this array by doing 265 * In order to save room, we index into this array by doing
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 044a2fd3c5fe..0ec241ede5a2 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -159,30 +159,6 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
159} 159}
160#endif /* CONFIG_EFI_MIXED */ 160#endif /* CONFIG_EFI_MIXED */
161 161
162
163/* arch specific definitions used by the stub code */
164
165struct efi_config {
166 u64 image_handle;
167 u64 table;
168 u64 allocate_pool;
169 u64 allocate_pages;
170 u64 get_memory_map;
171 u64 free_pool;
172 u64 free_pages;
173 u64 locate_handle;
174 u64 handle_protocol;
175 u64 exit_boot_services;
176 u64 text_output;
177 efi_status_t (*call)(unsigned long, ...);
178 bool is64;
179} __packed;
180
181extern struct efi_config *efi_early;
182
183#define efi_call_early(f, ...) \
184 efi_early->call(efi_early->f, __VA_ARGS__);
185
186extern bool efi_reboot_required(void); 162extern bool efi_reboot_required(void);
187 163
188#else 164#else
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index b0910f97a3ea..ffb1733ac91f 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -106,14 +106,14 @@ enum fixed_addresses {
106 __end_of_permanent_fixed_addresses, 106 __end_of_permanent_fixed_addresses,
107 107
108 /* 108 /*
109 * 256 temporary boot-time mappings, used by early_ioremap(), 109 * 512 temporary boot-time mappings, used by early_ioremap(),
110 * before ioremap() is functional. 110 * before ioremap() is functional.
111 * 111 *
112 * If necessary we round it up to the next 256 pages boundary so 112 * If necessary we round it up to the next 512 pages boundary so
113 * that we can have a single pgd entry and a single pte table: 113 * that we can have a single pgd entry and a single pte table:
114 */ 114 */
115#define NR_FIX_BTMAPS 64 115#define NR_FIX_BTMAPS 64
116#define FIX_BTMAPS_SLOTS 4 116#define FIX_BTMAPS_SLOTS 8
117#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) 117#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
118 FIX_BTMAP_END = 118 FIX_BTMAP_END =
119 (__end_of_permanent_fixed_addresses ^ 119 (__end_of_permanent_fixed_addresses ^
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 0aeed5ca356e..1733ab49ac5e 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -227,6 +227,8 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned
227 227
228extern void io_apic_eoi(unsigned int apic, unsigned int vector); 228extern void io_apic_eoi(unsigned int apic, unsigned int vector);
229 229
230extern bool mp_should_keep_irq(struct device *dev);
231
230#else /* !CONFIG_X86_IO_APIC */ 232#else /* !CONFIG_X86_IO_APIC */
231 233
232#define io_apic_assign_pci_irqs 0 234#define io_apic_assign_pci_irqs 0
@@ -237,6 +239,7 @@ static inline int mp_find_ioapic(u32 gsi) { return 0; }
237static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } 239static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; }
238static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } 240static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; }
239static inline void mp_unmap_irq(int irq) { } 241static inline void mp_unmap_irq(int irq) { }
242static inline bool mp_should_keep_irq(struct device *dev) { return 1; }
240 243
241static inline int save_ioapic_entries(void) 244static inline int save_ioapic_entries(void)
242{ 245{
diff --git a/arch/x86/include/asm/irq_work.h b/arch/x86/include/asm/irq_work.h
new file mode 100644
index 000000000000..78162f8e248b
--- /dev/null
+++ b/arch/x86/include/asm/irq_work.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_IRQ_WORK_H
2#define _ASM_IRQ_WORK_H
3
4#include <asm/processor.h>
5
6static inline bool arch_irq_work_has_interrupt(void)
7{
8 return cpu_has_apic;
9}
10
11#endif /* _ASM_IRQ_WORK_H */
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 572460175ba5..7d603a71ab3a 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -95,14 +95,10 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
95#define KVM_REFILL_PAGES 25 95#define KVM_REFILL_PAGES 25
96#define KVM_MAX_CPUID_ENTRIES 80 96#define KVM_MAX_CPUID_ENTRIES 80
97#define KVM_NR_FIXED_MTRR_REGION 88 97#define KVM_NR_FIXED_MTRR_REGION 88
98#define KVM_NR_VAR_MTRR 10 98#define KVM_NR_VAR_MTRR 8
99 99
100#define ASYNC_PF_PER_VCPU 64 100#define ASYNC_PF_PER_VCPU 64
101 101
102struct kvm_vcpu;
103struct kvm;
104struct kvm_async_pf;
105
106enum kvm_reg { 102enum kvm_reg {
107 VCPU_REGS_RAX = 0, 103 VCPU_REGS_RAX = 0,
108 VCPU_REGS_RCX = 1, 104 VCPU_REGS_RCX = 1,
@@ -266,7 +262,8 @@ struct kvm_mmu {
266 struct x86_exception *fault); 262 struct x86_exception *fault);
267 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, 263 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access,
268 struct x86_exception *exception); 264 struct x86_exception *exception);
269 gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); 265 gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
266 struct x86_exception *exception);
270 int (*sync_page)(struct kvm_vcpu *vcpu, 267 int (*sync_page)(struct kvm_vcpu *vcpu,
271 struct kvm_mmu_page *sp); 268 struct kvm_mmu_page *sp);
272 void (*invlpg)(struct kvm_vcpu *vcpu, gva_t gva); 269 void (*invlpg)(struct kvm_vcpu *vcpu, gva_t gva);
@@ -481,6 +478,7 @@ struct kvm_vcpu_arch {
481 u64 mmio_gva; 478 u64 mmio_gva;
482 unsigned access; 479 unsigned access;
483 gfn_t mmio_gfn; 480 gfn_t mmio_gfn;
481 u64 mmio_gen;
484 482
485 struct kvm_pmu pmu; 483 struct kvm_pmu pmu;
486 484
@@ -576,11 +574,10 @@ struct kvm_arch {
576 struct kvm_apic_map *apic_map; 574 struct kvm_apic_map *apic_map;
577 575
578 unsigned int tss_addr; 576 unsigned int tss_addr;
579 struct page *apic_access_page; 577 bool apic_access_page_done;
580 578
581 gpa_t wall_clock; 579 gpa_t wall_clock;
582 580
583 struct page *ept_identity_pagetable;
584 bool ept_identity_pagetable_done; 581 bool ept_identity_pagetable_done;
585 gpa_t ept_identity_map_addr; 582 gpa_t ept_identity_map_addr;
586 583
@@ -665,8 +662,8 @@ struct msr_data {
665struct kvm_x86_ops { 662struct kvm_x86_ops {
666 int (*cpu_has_kvm_support)(void); /* __init */ 663 int (*cpu_has_kvm_support)(void); /* __init */
667 int (*disabled_by_bios)(void); /* __init */ 664 int (*disabled_by_bios)(void); /* __init */
668 int (*hardware_enable)(void *dummy); 665 int (*hardware_enable)(void);
669 void (*hardware_disable)(void *dummy); 666 void (*hardware_disable)(void);
670 void (*check_processor_compatibility)(void *rtn); 667 void (*check_processor_compatibility)(void *rtn);
671 int (*hardware_setup)(void); /* __init */ 668 int (*hardware_setup)(void); /* __init */
672 void (*hardware_unsetup)(void); /* __exit */ 669 void (*hardware_unsetup)(void); /* __exit */
@@ -710,7 +707,6 @@ struct kvm_x86_ops {
710 void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg); 707 void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg);
711 unsigned long (*get_rflags)(struct kvm_vcpu *vcpu); 708 unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);
712 void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); 709 void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags);
713 void (*fpu_activate)(struct kvm_vcpu *vcpu);
714 void (*fpu_deactivate)(struct kvm_vcpu *vcpu); 710 void (*fpu_deactivate)(struct kvm_vcpu *vcpu);
715 711
716 void (*tlb_flush)(struct kvm_vcpu *vcpu); 712 void (*tlb_flush)(struct kvm_vcpu *vcpu);
@@ -740,6 +736,7 @@ struct kvm_x86_ops {
740 void (*hwapic_isr_update)(struct kvm *kvm, int isr); 736 void (*hwapic_isr_update)(struct kvm *kvm, int isr);
741 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); 737 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
742 void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set); 738 void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set);
739 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa);
743 void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector); 740 void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);
744 void (*sync_pir_to_irr)(struct kvm_vcpu *vcpu); 741 void (*sync_pir_to_irr)(struct kvm_vcpu *vcpu);
745 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); 742 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
@@ -772,6 +769,8 @@ struct kvm_x86_ops {
772 bool (*mpx_supported)(void); 769 bool (*mpx_supported)(void);
773 770
774 int (*check_nested_events)(struct kvm_vcpu *vcpu, bool external_intr); 771 int (*check_nested_events)(struct kvm_vcpu *vcpu, bool external_intr);
772
773 void (*sched_in)(struct kvm_vcpu *kvm, int cpu);
775}; 774};
776 775
777struct kvm_arch_async_pf { 776struct kvm_arch_async_pf {
@@ -895,7 +894,6 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault);
895int kvm_read_guest_page_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, 894int kvm_read_guest_page_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
896 gfn_t gfn, void *data, int offset, int len, 895 gfn_t gfn, void *data, int offset, int len,
897 u32 access); 896 u32 access);
898void kvm_propagate_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault);
899bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl); 897bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl);
900 898
901static inline int __kvm_irq_line_state(unsigned long *irq_state, 899static inline int __kvm_irq_line_state(unsigned long *irq_state,
@@ -917,7 +915,6 @@ void kvm_inject_nmi(struct kvm_vcpu *vcpu);
917 915
918int fx_init(struct kvm_vcpu *vcpu); 916int fx_init(struct kvm_vcpu *vcpu);
919 917
920void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu);
921void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, 918void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
922 const u8 *new, int bytes); 919 const u8 *new, int bytes);
923int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn); 920int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn);
@@ -926,7 +923,8 @@ void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu);
926int kvm_mmu_load(struct kvm_vcpu *vcpu); 923int kvm_mmu_load(struct kvm_vcpu *vcpu);
927void kvm_mmu_unload(struct kvm_vcpu *vcpu); 924void kvm_mmu_unload(struct kvm_vcpu *vcpu);
928void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu); 925void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu);
929gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); 926gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
927 struct x86_exception *exception);
930gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *vcpu, gva_t gva, 928gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *vcpu, gva_t gva,
931 struct x86_exception *exception); 929 struct x86_exception *exception);
932gpa_t kvm_mmu_gva_to_gpa_fetch(struct kvm_vcpu *vcpu, gva_t gva, 930gpa_t kvm_mmu_gva_to_gpa_fetch(struct kvm_vcpu *vcpu, gva_t gva,
@@ -946,7 +944,8 @@ void kvm_mmu_new_cr3(struct kvm_vcpu *vcpu);
946void kvm_enable_tdp(void); 944void kvm_enable_tdp(void);
947void kvm_disable_tdp(void); 945void kvm_disable_tdp(void);
948 946
949static inline gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access) 947static inline gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
948 struct x86_exception *exception)
950{ 949{
951 return gpa; 950 return gpa;
952} 951}
@@ -1037,7 +1036,7 @@ asmlinkage void kvm_spurious_fault(void);
1037#define KVM_ARCH_WANT_MMU_NOTIFIER 1036#define KVM_ARCH_WANT_MMU_NOTIFIER
1038int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); 1037int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
1039int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end); 1038int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end);
1040int kvm_age_hva(struct kvm *kvm, unsigned long hva); 1039int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
1041int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); 1040int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
1042void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); 1041void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
1043int cpuid_maxphyaddr(struct kvm_vcpu *vcpu); 1042int cpuid_maxphyaddr(struct kvm_vcpu *vcpu);
@@ -1046,6 +1045,9 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu);
1046int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu); 1045int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
1047int kvm_cpu_get_interrupt(struct kvm_vcpu *v); 1046int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
1048void kvm_vcpu_reset(struct kvm_vcpu *vcpu); 1047void kvm_vcpu_reset(struct kvm_vcpu *vcpu);
1048void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu);
1049void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
1050 unsigned long address);
1049 1051
1050void kvm_define_shared_msr(unsigned index, u32 msr); 1052void kvm_define_shared_msr(unsigned index, u32 msr);
1051void kvm_set_shared_msr(unsigned index, u64 val, u64 mask); 1053void kvm_set_shared_msr(unsigned index, u64 val, u64 mask);
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index c7678e43465b..e62cf897f781 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -2,6 +2,7 @@
2#define _ASM_X86_KVM_PARA_H 2#define _ASM_X86_KVM_PARA_H
3 3
4#include <asm/processor.h> 4#include <asm/processor.h>
5#include <asm/alternative.h>
5#include <uapi/asm/kvm_para.h> 6#include <uapi/asm/kvm_para.h>
6 7
7extern void kvmclock_init(void); 8extern void kvmclock_init(void);
@@ -16,10 +17,15 @@ static inline bool kvm_check_and_clear_guest_paused(void)
16} 17}
17#endif /* CONFIG_KVM_GUEST */ 18#endif /* CONFIG_KVM_GUEST */
18 19
19/* This instruction is vmcall. On non-VT architectures, it will generate a 20#ifdef CONFIG_DEBUG_RODATA
20 * trap that we will then rewrite to the appropriate instruction. 21#define KVM_HYPERCALL \
22 ALTERNATIVE(".byte 0x0f,0x01,0xc1", ".byte 0x0f,0x01,0xd9", X86_FEATURE_VMMCALL)
23#else
24/* On AMD processors, vmcall will generate a trap that we will
25 * then rewrite to the appropriate instruction.
21 */ 26 */
22#define KVM_HYPERCALL ".byte 0x0f,0x01,0xc1" 27#define KVM_HYPERCALL ".byte 0x0f,0x01,0xc1"
28#endif
23 29
24/* For KVM hypercalls, a three-byte sequence of either the vmcall or the vmmcall 30/* For KVM hypercalls, a three-byte sequence of either the vmcall or the vmmcall
25 * instruction. The hypervisor may replace it with something else but only the 31 * instruction. The hypervisor may replace it with something else but only the
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 0ec056012618..aa97a070f09f 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -131,8 +131,13 @@ static inline int pte_exec(pte_t pte)
131 131
132static inline int pte_special(pte_t pte) 132static inline int pte_special(pte_t pte)
133{ 133{
134 return (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_SPECIAL)) == 134 /*
135 (_PAGE_PRESENT|_PAGE_SPECIAL); 135 * See CONFIG_NUMA_BALANCING pte_numa in include/asm-generic/pgtable.h.
136 * On x86 we have _PAGE_BIT_NUMA == _PAGE_BIT_GLOBAL+1 ==
137 * __PAGE_BIT_SOFTW1 == _PAGE_BIT_SPECIAL.
138 */
139 return (pte_flags(pte) & _PAGE_SPECIAL) &&
140 (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_PROTNONE));
136} 141}
137 142
138static inline unsigned long pte_pfn(pte_t pte) 143static inline unsigned long pte_pfn(pte_t pte)
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 5be9063545d2..3874693c0e53 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -19,6 +19,7 @@ extern pud_t level3_ident_pgt[512];
19extern pmd_t level2_kernel_pgt[512]; 19extern pmd_t level2_kernel_pgt[512];
20extern pmd_t level2_fixmap_pgt[512]; 20extern pmd_t level2_fixmap_pgt[512];
21extern pmd_t level2_ident_pgt[512]; 21extern pmd_t level2_ident_pgt[512];
22extern pte_t level1_fixmap_pgt[512];
22extern pgd_t init_level4_pgt[]; 23extern pgd_t init_level4_pgt[];
23 24
24#define swapper_pg_dir init_level4_pgt 25#define swapper_pg_dir init_level4_pgt
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index f216963760e5..0f9724c9c510 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -325,6 +325,20 @@ static inline pteval_t pte_flags(pte_t pte)
325 return native_pte_val(pte) & PTE_FLAGS_MASK; 325 return native_pte_val(pte) & PTE_FLAGS_MASK;
326} 326}
327 327
328#ifdef CONFIG_NUMA_BALANCING
329/* Set of bits that distinguishes present, prot_none and numa ptes */
330#define _PAGE_NUMA_MASK (_PAGE_NUMA|_PAGE_PROTNONE|_PAGE_PRESENT)
331static inline pteval_t ptenuma_flags(pte_t pte)
332{
333 return pte_flags(pte) & _PAGE_NUMA_MASK;
334}
335
336static inline pmdval_t pmdnuma_flags(pmd_t pmd)
337{
338 return pmd_flags(pmd) & _PAGE_NUMA_MASK;
339}
340#endif /* CONFIG_NUMA_BALANCING */
341
328#define pgprot_val(x) ((x).pgprot) 342#define pgprot_val(x) ((x).pgprot)
329#define __pgprot(x) ((pgprot_t) { (x) } ) 343#define __pgprot(x) ((pgprot_t) { (x) } )
330 344
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index b5ea75c4a4b4..ada2e2d6be3e 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
71obj-$(CONFIG_X86_TSC) += trace_clock.o 71obj-$(CONFIG_X86_TSC) += trace_clock.o
72obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o 72obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o
73obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o 73obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
74obj-$(CONFIG_KEXEC_FILE) += kexec-bzimage64.o
74obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o 75obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
75obj-y += kprobes/ 76obj-y += kprobes/
76obj-$(CONFIG_MODULES) += module.o 77obj-$(CONFIG_MODULES) += module.o
@@ -118,5 +119,4 @@ ifeq ($(CONFIG_X86_64),y)
118 119
119 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o 120 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
120 obj-y += vsmp_64.o 121 obj-y += vsmp_64.o
121 obj-$(CONFIG_KEXEC) += kexec-bzimage64.o
122endif 122endif
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 29290f554e79..1183d545da1e 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1070,6 +1070,11 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin,
1070 } 1070 }
1071 1071
1072 if (flags & IOAPIC_MAP_ALLOC) { 1072 if (flags & IOAPIC_MAP_ALLOC) {
1073 /* special handling for legacy IRQs */
1074 if (irq < nr_legacy_irqs() && info->count == 1 &&
1075 mp_irqdomain_map(domain, irq, pin) != 0)
1076 irq = -1;
1077
1073 if (irq > 0) 1078 if (irq > 0)
1074 info->count++; 1079 info->count++;
1075 else if (info->count == 0) 1080 else if (info->count == 0)
@@ -2618,6 +2623,7 @@ static struct irq_chip ioapic_chip __read_mostly = {
2618 .irq_eoi = ack_apic_level, 2623 .irq_eoi = ack_apic_level,
2619 .irq_set_affinity = native_ioapic_set_affinity, 2624 .irq_set_affinity = native_ioapic_set_affinity,
2620 .irq_retrigger = ioapic_retrigger_irq, 2625 .irq_retrigger = ioapic_retrigger_irq,
2626 .flags = IRQCHIP_SKIP_SET_WAKE,
2621}; 2627};
2622 2628
2623static inline void init_IO_APIC_traps(void) 2629static inline void init_IO_APIC_traps(void)
@@ -3168,6 +3174,7 @@ static struct irq_chip msi_chip = {
3168 .irq_ack = ack_apic_edge, 3174 .irq_ack = ack_apic_edge,
3169 .irq_set_affinity = msi_set_affinity, 3175 .irq_set_affinity = msi_set_affinity,
3170 .irq_retrigger = ioapic_retrigger_irq, 3176 .irq_retrigger = ioapic_retrigger_irq,
3177 .flags = IRQCHIP_SKIP_SET_WAKE,
3171}; 3178};
3172 3179
3173int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, 3180int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
@@ -3266,6 +3273,7 @@ static struct irq_chip dmar_msi_type = {
3266 .irq_ack = ack_apic_edge, 3273 .irq_ack = ack_apic_edge,
3267 .irq_set_affinity = dmar_msi_set_affinity, 3274 .irq_set_affinity = dmar_msi_set_affinity,
3268 .irq_retrigger = ioapic_retrigger_irq, 3275 .irq_retrigger = ioapic_retrigger_irq,
3276 .flags = IRQCHIP_SKIP_SET_WAKE,
3269}; 3277};
3270 3278
3271int arch_setup_dmar_msi(unsigned int irq) 3279int arch_setup_dmar_msi(unsigned int irq)
@@ -3316,6 +3324,7 @@ static struct irq_chip hpet_msi_type = {
3316 .irq_ack = ack_apic_edge, 3324 .irq_ack = ack_apic_edge,
3317 .irq_set_affinity = hpet_msi_set_affinity, 3325 .irq_set_affinity = hpet_msi_set_affinity,
3318 .irq_retrigger = ioapic_retrigger_irq, 3326 .irq_retrigger = ioapic_retrigger_irq,
3327 .flags = IRQCHIP_SKIP_SET_WAKE,
3319}; 3328};
3320 3329
3321int default_setup_hpet_msi(unsigned int irq, unsigned int id) 3330int default_setup_hpet_msi(unsigned int irq, unsigned int id)
@@ -3379,6 +3388,7 @@ static struct irq_chip ht_irq_chip = {
3379 .irq_ack = ack_apic_edge, 3388 .irq_ack = ack_apic_edge,
3380 .irq_set_affinity = ht_set_affinity, 3389 .irq_set_affinity = ht_set_affinity,
3381 .irq_retrigger = ioapic_retrigger_irq, 3390 .irq_retrigger = ioapic_retrigger_irq,
3391 .flags = IRQCHIP_SKIP_SET_WAKE,
3382}; 3392};
3383 3393
3384int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev) 3394int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
@@ -3896,7 +3906,15 @@ int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
3896 info->polarity = 1; 3906 info->polarity = 1;
3897 } 3907 }
3898 info->node = NUMA_NO_NODE; 3908 info->node = NUMA_NO_NODE;
3899 info->set = 1; 3909
3910 /*
3911 * setup_IO_APIC_irqs() programs all legacy IRQs with default
3912 * trigger and polarity attributes. Don't set the flag for that
3913 * case so the first legacy IRQ user could reprogram the pin
3914 * with real trigger and polarity attributes.
3915 */
3916 if (virq >= nr_legacy_irqs() || info->count)
3917 info->set = 1;
3900 } 3918 }
3901 set_io_apic_irq_attr(&attr, ioapic, hwirq, info->trigger, 3919 set_io_apic_irq_attr(&attr, ioapic, hwirq, info->trigger,
3902 info->polarity); 3920 info->polarity);
@@ -3946,6 +3964,18 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node)
3946 return ret; 3964 return ret;
3947} 3965}
3948 3966
3967bool mp_should_keep_irq(struct device *dev)
3968{
3969 if (dev->power.is_prepared)
3970 return true;
3971#ifdef CONFIG_PM_RUNTIME
3972 if (dev->power.runtime_status == RPM_SUSPENDING)
3973 return true;
3974#endif
3975
3976 return false;
3977}
3978
3949/* Enable IOAPIC early just for system timer */ 3979/* Enable IOAPIC early just for system timer */
3950void __init pre_init_apic_IRQ0(void) 3980void __init pre_init_apic_IRQ0(void)
3951{ 3981{
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 7fd54f09b011..77dcab277710 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -13,10 +13,13 @@ nostackp := $(call cc-option, -fno-stack-protector)
13CFLAGS_common.o := $(nostackp) 13CFLAGS_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 += common.o
17obj-y += rdrand.o 17obj-y += rdrand.o
18obj-y += match.o 18obj-y += match.o
19 19
20obj-$(CONFIG_PROC_FS) += proc.o
21obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
22
20obj-$(CONFIG_X86_32) += bugs.o 23obj-$(CONFIG_X86_32) += bugs.o
21obj-$(CONFIG_X86_64) += bugs_64.o 24obj-$(CONFIG_X86_64) += bugs_64.o
22 25
@@ -48,6 +51,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o
48 51
49obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o 52obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
50 53
54ifdef CONFIG_X86_FEATURE_NAMES
51quiet_cmd_mkcapflags = MKCAP $@ 55quiet_cmd_mkcapflags = MKCAP $@
52 cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@ 56 cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@
53 57
@@ -56,3 +60,4 @@ cpufeature = $(src)/../../include/asm/cpufeature.h
56targets += capflags.c 60targets += capflags.c
57$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE 61$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE
58 $(call if_changed,mkcapflags) 62 $(call if_changed,mkcapflags)
63endif
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 60e5497681f5..813d29d00a17 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -525,6 +525,13 @@ static void early_init_amd(struct cpuinfo_x86 *c)
525 } 525 }
526#endif 526#endif
527 527
528 /*
529 * This is only needed to tell the kernel whether to use VMCALL
530 * and VMMCALL. VMMCALL is never executed except under virt, so
531 * we can set it unconditionally.
532 */
533 set_cpu_cap(c, X86_FEATURE_VMMCALL);
534
528 /* F16h erratum 793, CVE-2013-6885 */ 535 /* F16h erratum 793, CVE-2013-6885 */
529 if (c->x86 == 0x16 && c->x86_model <= 0xf) 536 if (c->x86 == 0x16 && c->x86_model <= 0xf)
530 msr_set_bit(MSR_AMD64_LS_CFG, 15); 537 msr_set_bit(MSR_AMD64_LS_CFG, 15);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index e4ab2b42bd6f..c649f236e288 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -346,8 +346,8 @@ static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
346 continue; 346 continue;
347 347
348 printk(KERN_WARNING 348 printk(KERN_WARNING
349 "CPU: CPU feature %s disabled, no CPUID level 0x%x\n", 349 "CPU: CPU feature " X86_CAP_FMT " disabled, no CPUID level 0x%x\n",
350 x86_cap_flags[df->feature], df->level); 350 x86_cap_flag(df->feature), df->level);
351 } 351 }
352} 352}
353 353
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 0553a34fa0df..a618fcd2c07d 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -182,8 +182,7 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
182 crash_save_cpu(regs, safe_smp_processor_id()); 182 crash_save_cpu(regs, safe_smp_processor_id());
183} 183}
184 184
185#ifdef CONFIG_X86_64 185#ifdef CONFIG_KEXEC_FILE
186
187static int get_nr_ram_ranges_callback(unsigned long start_pfn, 186static int get_nr_ram_ranges_callback(unsigned long start_pfn,
188 unsigned long nr_pfn, void *arg) 187 unsigned long nr_pfn, void *arg)
189{ 188{
@@ -696,5 +695,4 @@ int crash_load_segments(struct kimage *image)
696 695
697 return ret; 696 return ret;
698} 697}
699 698#endif /* CONFIG_KEXEC_FILE */
700#endif /* CONFIG_X86_64 */
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 47c410d99f5d..4b0e1dfa2226 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -683,7 +683,7 @@ END(syscall_badsys)
683sysenter_badsys: 683sysenter_badsys:
684 movl $-ENOSYS,%eax 684 movl $-ENOSYS,%eax
685 jmp sysenter_after_call 685 jmp sysenter_after_call
686END(syscall_badsys) 686END(sysenter_badsys)
687 CFI_ENDPROC 687 CFI_ENDPROC
688 688
689.macro FIXUP_ESPFIX_STACK 689.macro FIXUP_ESPFIX_STACK
diff --git a/arch/x86/kernel/irq_work.c b/arch/x86/kernel/irq_work.c
index 1de84e3ab4e0..15d741ddfeeb 100644
--- a/arch/x86/kernel/irq_work.c
+++ b/arch/x86/kernel/irq_work.c
@@ -41,7 +41,7 @@ __visible void smp_trace_irq_work_interrupt(struct pt_regs *regs)
41void arch_irq_work_raise(void) 41void arch_irq_work_raise(void)
42{ 42{
43#ifdef CONFIG_X86_LOCAL_APIC 43#ifdef CONFIG_X86_LOCAL_APIC
44 if (!cpu_has_apic) 44 if (!arch_irq_work_has_interrupt())
45 return; 45 return;
46 46
47 apic->send_IPI_self(IRQ_WORK_VECTOR); 47 apic->send_IPI_self(IRQ_WORK_VECTOR);
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 1e6cff5814fa..44f1ed42fdf2 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -203,7 +203,7 @@ void __init native_init_IRQ(void)
203 set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); 203 set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]);
204 } 204 }
205 205
206 if (!acpi_ioapic && !of_ioapic) 206 if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs())
207 setup_irq(2, &irq2); 207 setup_irq(2, &irq2);
208 208
209#ifdef CONFIG_X86_32 209#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index f304773285ae..f1314d0bcf0a 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -338,8 +338,10 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
338 * a relative jump. 338 * a relative jump.
339 */ 339 */
340 rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE; 340 rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE;
341 if (abs(rel) > 0x7fffffff) 341 if (abs(rel) > 0x7fffffff) {
342 __arch_remove_optimized_kprobe(op, 0);
342 return -ERANGE; 343 return -ERANGE;
344 }
343 345
344 buf = (u8 *)op->optinsn.insn; 346 buf = (u8 *)op->optinsn.insn;
345 347
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 8b04018e5d1f..485981059a40 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -25,9 +25,11 @@
25#include <asm/debugreg.h> 25#include <asm/debugreg.h>
26#include <asm/kexec-bzimage64.h> 26#include <asm/kexec-bzimage64.h>
27 27
28#ifdef CONFIG_KEXEC_FILE
28static struct kexec_file_ops *kexec_file_loaders[] = { 29static struct kexec_file_ops *kexec_file_loaders[] = {
29 &kexec_bzImage64_ops, 30 &kexec_bzImage64_ops,
30}; 31};
32#endif
31 33
32static void free_transition_pgtable(struct kimage *image) 34static void free_transition_pgtable(struct kimage *image)
33{ 35{
@@ -178,6 +180,7 @@ static void load_segments(void)
178 ); 180 );
179} 181}
180 182
183#ifdef CONFIG_KEXEC_FILE
181/* Update purgatory as needed after various image segments have been prepared */ 184/* Update purgatory as needed after various image segments have been prepared */
182static int arch_update_purgatory(struct kimage *image) 185static int arch_update_purgatory(struct kimage *image)
183{ 186{
@@ -209,6 +212,12 @@ static int arch_update_purgatory(struct kimage *image)
209 212
210 return ret; 213 return ret;
211} 214}
215#else /* !CONFIG_KEXEC_FILE */
216static inline int arch_update_purgatory(struct kimage *image)
217{
218 return 0;
219}
220#endif /* CONFIG_KEXEC_FILE */
212 221
213int machine_kexec_prepare(struct kimage *image) 222int machine_kexec_prepare(struct kimage *image)
214{ 223{
@@ -329,6 +338,7 @@ void arch_crash_save_vmcoreinfo(void)
329 338
330/* arch-dependent functionality related to kexec file-based syscall */ 339/* arch-dependent functionality related to kexec file-based syscall */
331 340
341#ifdef CONFIG_KEXEC_FILE
332int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, 342int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,
333 unsigned long buf_len) 343 unsigned long buf_len)
334{ 344{
@@ -522,3 +532,4 @@ overflow:
522 (int)ELF64_R_TYPE(rel[i].r_info), value); 532 (int)ELF64_R_TYPE(rel[i].r_info), value);
523 return -ENOEXEC; 533 return -ENOEXEC;
524} 534}
535#endif /* CONFIG_KEXEC_FILE */
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 2d872e08fab9..42a2dca984b3 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1284,6 +1284,9 @@ static void remove_siblinginfo(int cpu)
1284 1284
1285 for_each_cpu(sibling, cpu_sibling_mask(cpu)) 1285 for_each_cpu(sibling, cpu_sibling_mask(cpu))
1286 cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling)); 1286 cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling));
1287 for_each_cpu(sibling, cpu_llc_shared_mask(cpu))
1288 cpumask_clear_cpu(cpu, cpu_llc_shared_mask(sibling));
1289 cpumask_clear(cpu_llc_shared_mask(cpu));
1287 cpumask_clear(cpu_sibling_mask(cpu)); 1290 cpumask_clear(cpu_sibling_mask(cpu));
1288 cpumask_clear(cpu_core_mask(cpu)); 1291 cpumask_clear(cpu_core_mask(cpu));
1289 c->phys_proc_id = 0; 1292 c->phys_proc_id = 0;
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index bf7ef5ce29df..0fa29609b2c4 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -68,6 +68,8 @@ static struct irqaction irq0 = {
68 68
69void __init setup_default_timer_irq(void) 69void __init setup_default_timer_irq(void)
70{ 70{
71 if (!nr_legacy_irqs())
72 return;
71 setup_irq(0, &irq0); 73 setup_irq(0, &irq0);
72} 74}
73 75
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 38a0afe83c6b..976e3a57f9ea 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -53,14 +53,14 @@ u64 kvm_supported_xcr0(void)
53 return xcr0; 53 return xcr0;
54} 54}
55 55
56void kvm_update_cpuid(struct kvm_vcpu *vcpu) 56int kvm_update_cpuid(struct kvm_vcpu *vcpu)
57{ 57{
58 struct kvm_cpuid_entry2 *best; 58 struct kvm_cpuid_entry2 *best;
59 struct kvm_lapic *apic = vcpu->arch.apic; 59 struct kvm_lapic *apic = vcpu->arch.apic;
60 60
61 best = kvm_find_cpuid_entry(vcpu, 1, 0); 61 best = kvm_find_cpuid_entry(vcpu, 1, 0);
62 if (!best) 62 if (!best)
63 return; 63 return 0;
64 64
65 /* Update OSXSAVE bit */ 65 /* Update OSXSAVE bit */
66 if (cpu_has_xsave && best->function == 0x1) { 66 if (cpu_has_xsave && best->function == 0x1) {
@@ -88,7 +88,17 @@ void kvm_update_cpuid(struct kvm_vcpu *vcpu)
88 xstate_required_size(vcpu->arch.xcr0); 88 xstate_required_size(vcpu->arch.xcr0);
89 } 89 }
90 90
91 /*
92 * The existing code assumes virtual address is 48-bit in the canonical
93 * address checks; exit if it is ever changed.
94 */
95 best = kvm_find_cpuid_entry(vcpu, 0x80000008, 0);
96 if (best && ((best->eax & 0xff00) >> 8) != 48 &&
97 ((best->eax & 0xff00) >> 8) != 0)
98 return -EINVAL;
99
91 kvm_pmu_cpuid_update(vcpu); 100 kvm_pmu_cpuid_update(vcpu);
101 return 0;
92} 102}
93 103
94static int is_efer_nx(void) 104static int is_efer_nx(void)
@@ -112,8 +122,8 @@ static void cpuid_fix_nx_cap(struct kvm_vcpu *vcpu)
112 break; 122 break;
113 } 123 }
114 } 124 }
115 if (entry && (entry->edx & (1 << 20)) && !is_efer_nx()) { 125 if (entry && (entry->edx & bit(X86_FEATURE_NX)) && !is_efer_nx()) {
116 entry->edx &= ~(1 << 20); 126 entry->edx &= ~bit(X86_FEATURE_NX);
117 printk(KERN_INFO "kvm: guest NX capability removed\n"); 127 printk(KERN_INFO "kvm: guest NX capability removed\n");
118 } 128 }
119} 129}
@@ -151,10 +161,9 @@ int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
151 } 161 }
152 vcpu->arch.cpuid_nent = cpuid->nent; 162 vcpu->arch.cpuid_nent = cpuid->nent;
153 cpuid_fix_nx_cap(vcpu); 163 cpuid_fix_nx_cap(vcpu);
154 r = 0;
155 kvm_apic_set_version(vcpu); 164 kvm_apic_set_version(vcpu);
156 kvm_x86_ops->cpuid_update(vcpu); 165 kvm_x86_ops->cpuid_update(vcpu);
157 kvm_update_cpuid(vcpu); 166 r = kvm_update_cpuid(vcpu);
158 167
159out_free: 168out_free:
160 vfree(cpuid_entries); 169 vfree(cpuid_entries);
@@ -178,9 +187,7 @@ int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
178 vcpu->arch.cpuid_nent = cpuid->nent; 187 vcpu->arch.cpuid_nent = cpuid->nent;
179 kvm_apic_set_version(vcpu); 188 kvm_apic_set_version(vcpu);
180 kvm_x86_ops->cpuid_update(vcpu); 189 kvm_x86_ops->cpuid_update(vcpu);
181 kvm_update_cpuid(vcpu); 190 r = kvm_update_cpuid(vcpu);
182 return 0;
183
184out: 191out:
185 return r; 192 return r;
186} 193}
@@ -767,6 +774,12 @@ void kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
767 if (!best) 774 if (!best)
768 best = check_cpuid_limit(vcpu, function, index); 775 best = check_cpuid_limit(vcpu, function, index);
769 776
777 /*
778 * Perfmon not yet supported for L2 guest.
779 */
780 if (is_guest_mode(vcpu) && function == 0xa)
781 best = NULL;
782
770 if (best) { 783 if (best) {
771 *eax = best->eax; 784 *eax = best->eax;
772 *ebx = best->ebx; 785 *ebx = best->ebx;
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index a5380590ab0e..4452eedfaedd 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -3,7 +3,7 @@
3 3
4#include "x86.h" 4#include "x86.h"
5 5
6void kvm_update_cpuid(struct kvm_vcpu *vcpu); 6int kvm_update_cpuid(struct kvm_vcpu *vcpu);
7struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, 7struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
8 u32 function, u32 index); 8 u32 function, u32 index);
9int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid, 9int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
@@ -88,6 +88,14 @@ static inline bool guest_cpuid_has_x2apic(struct kvm_vcpu *vcpu)
88 return best && (best->ecx & bit(X86_FEATURE_X2APIC)); 88 return best && (best->ecx & bit(X86_FEATURE_X2APIC));
89} 89}
90 90
91static inline bool guest_cpuid_is_amd(struct kvm_vcpu *vcpu)
92{
93 struct kvm_cpuid_entry2 *best;
94
95 best = kvm_find_cpuid_entry(vcpu, 0, 0);
96 return best && best->ebx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx;
97}
98
91static inline bool guest_cpuid_has_gbpages(struct kvm_vcpu *vcpu) 99static inline bool guest_cpuid_has_gbpages(struct kvm_vcpu *vcpu)
92{ 100{
93 struct kvm_cpuid_entry2 *best; 101 struct kvm_cpuid_entry2 *best;
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 56657b0bb3bb..a46207a05835 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -527,6 +527,7 @@ static unsigned long seg_base(struct x86_emulate_ctxt *ctxt, int seg)
527static int emulate_exception(struct x86_emulate_ctxt *ctxt, int vec, 527static int emulate_exception(struct x86_emulate_ctxt *ctxt, int vec,
528 u32 error, bool valid) 528 u32 error, bool valid)
529{ 529{
530 WARN_ON(vec > 0x1f);
530 ctxt->exception.vector = vec; 531 ctxt->exception.vector = vec;
531 ctxt->exception.error_code = error; 532 ctxt->exception.error_code = error;
532 ctxt->exception.error_code_valid = valid; 533 ctxt->exception.error_code_valid = valid;
@@ -1468,7 +1469,7 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1468 return ret; 1469 return ret;
1469 1470
1470 err_code = selector & 0xfffc; 1471 err_code = selector & 0xfffc;
1471 err_vec = GP_VECTOR; 1472 err_vec = in_task_switch ? TS_VECTOR : GP_VECTOR;
1472 1473
1473 /* can't load system descriptor into segment selector */ 1474 /* can't load system descriptor into segment selector */
1474 if (seg <= VCPU_SREG_GS && !seg_desc.s) 1475 if (seg <= VCPU_SREG_GS && !seg_desc.s)
@@ -1491,9 +1492,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1491 goto exception; 1492 goto exception;
1492 break; 1493 break;
1493 case VCPU_SREG_CS: 1494 case VCPU_SREG_CS:
1494 if (in_task_switch && rpl != dpl)
1495 goto exception;
1496
1497 if (!(seg_desc.type & 8)) 1495 if (!(seg_desc.type & 8))
1498 goto exception; 1496 goto exception;
1499 1497
@@ -1506,6 +1504,15 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1506 if (rpl > cpl || dpl != cpl) 1504 if (rpl > cpl || dpl != cpl)
1507 goto exception; 1505 goto exception;
1508 } 1506 }
1507 /* in long-mode d/b must be clear if l is set */
1508 if (seg_desc.d && seg_desc.l) {
1509 u64 efer = 0;
1510
1511 ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
1512 if (efer & EFER_LMA)
1513 goto exception;
1514 }
1515
1509 /* CS(RPL) <- CPL */ 1516 /* CS(RPL) <- CPL */
1510 selector = (selector & 0xfffc) | cpl; 1517 selector = (selector & 0xfffc) | cpl;
1511 break; 1518 break;
@@ -1552,8 +1559,7 @@ load:
1552 ctxt->ops->set_segment(ctxt, selector, &seg_desc, base3, seg); 1559 ctxt->ops->set_segment(ctxt, selector, &seg_desc, base3, seg);
1553 return X86EMUL_CONTINUE; 1560 return X86EMUL_CONTINUE;
1554exception: 1561exception:
1555 emulate_exception(ctxt, err_vec, err_code, true); 1562 return emulate_exception(ctxt, err_vec, err_code, true);
1556 return X86EMUL_PROPAGATE_FAULT;
1557} 1563}
1558 1564
1559static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt, 1565static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
@@ -2726,8 +2732,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
2726 if (!next_tss_desc.p || 2732 if (!next_tss_desc.p ||
2727 ((desc_limit < 0x67 && (next_tss_desc.type & 8)) || 2733 ((desc_limit < 0x67 && (next_tss_desc.type & 8)) ||
2728 desc_limit < 0x2b)) { 2734 desc_limit < 0x2b)) {
2729 emulate_ts(ctxt, tss_selector & 0xfffc); 2735 return emulate_ts(ctxt, tss_selector & 0xfffc);
2730 return X86EMUL_PROPAGATE_FAULT;
2731 } 2736 }
2732 2737
2733 if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { 2738 if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) {
@@ -3019,7 +3024,7 @@ static int em_movbe(struct x86_emulate_ctxt *ctxt)
3019 ctxt->dst.val = swab64(ctxt->src.val); 3024 ctxt->dst.val = swab64(ctxt->src.val);
3020 break; 3025 break;
3021 default: 3026 default:
3022 return X86EMUL_PROPAGATE_FAULT; 3027 BUG();
3023 } 3028 }
3024 return X86EMUL_CONTINUE; 3029 return X86EMUL_CONTINUE;
3025} 3030}
@@ -3143,12 +3148,8 @@ static int em_clts(struct x86_emulate_ctxt *ctxt)
3143 3148
3144static int em_vmcall(struct x86_emulate_ctxt *ctxt) 3149static int em_vmcall(struct x86_emulate_ctxt *ctxt)
3145{ 3150{
3146 int rc; 3151 int rc = ctxt->ops->fix_hypercall(ctxt);
3147
3148 if (ctxt->modrm_mod != 3 || ctxt->modrm_rm != 1)
3149 return X86EMUL_UNHANDLEABLE;
3150 3152
3151 rc = ctxt->ops->fix_hypercall(ctxt);
3152 if (rc != X86EMUL_CONTINUE) 3153 if (rc != X86EMUL_CONTINUE)
3153 return rc; 3154 return rc;
3154 3155
@@ -3566,6 +3567,12 @@ static int check_perm_out(struct x86_emulate_ctxt *ctxt)
3566 F2bv(((_f) | DstReg | SrcMem | ModRM) & ~Lock, _e), \ 3567 F2bv(((_f) | DstReg | SrcMem | ModRM) & ~Lock, _e), \
3567 F2bv(((_f) & ~Lock) | DstAcc | SrcImm, _e) 3568 F2bv(((_f) & ~Lock) | DstAcc | SrcImm, _e)
3568 3569
3570static const struct opcode group7_rm0[] = {
3571 N,
3572 I(SrcNone | Priv | EmulateOnUD, em_vmcall),
3573 N, N, N, N, N, N,
3574};
3575
3569static const struct opcode group7_rm1[] = { 3576static const struct opcode group7_rm1[] = {
3570 DI(SrcNone | Priv, monitor), 3577 DI(SrcNone | Priv, monitor),
3571 DI(SrcNone | Priv, mwait), 3578 DI(SrcNone | Priv, mwait),
@@ -3659,7 +3666,7 @@ static const struct group_dual group7 = { {
3659 II(SrcMem16 | Mov | Priv, em_lmsw, lmsw), 3666 II(SrcMem16 | Mov | Priv, em_lmsw, lmsw),
3660 II(SrcMem | ByteOp | Priv | NoAccess, em_invlpg, invlpg), 3667 II(SrcMem | ByteOp | Priv | NoAccess, em_invlpg, invlpg),
3661}, { 3668}, {
3662 I(SrcNone | Priv | EmulateOnUD, em_vmcall), 3669 EXT(0, group7_rm0),
3663 EXT(0, group7_rm1), 3670 EXT(0, group7_rm1),
3664 N, EXT(0, group7_rm3), 3671 N, EXT(0, group7_rm3),
3665 II(SrcNone | DstMem | Mov, em_smsw, smsw), N, 3672 II(SrcNone | DstMem | Mov, em_smsw, smsw), N,
@@ -3690,14 +3697,18 @@ static const struct gprefix pfx_0f_6f_0f_7f = {
3690 I(Mmx, em_mov), I(Sse | Aligned, em_mov), N, I(Sse | Unaligned, em_mov), 3697 I(Mmx, em_mov), I(Sse | Aligned, em_mov), N, I(Sse | Unaligned, em_mov),
3691}; 3698};
3692 3699
3693static const struct gprefix pfx_vmovntpx = { 3700static const struct gprefix pfx_0f_2b = {
3694 I(0, em_mov), N, N, N, 3701 I(0, em_mov), I(0, em_mov), N, N,
3695}; 3702};
3696 3703
3697static const struct gprefix pfx_0f_28_0f_29 = { 3704static const struct gprefix pfx_0f_28_0f_29 = {
3698 I(Aligned, em_mov), I(Aligned, em_mov), N, N, 3705 I(Aligned, em_mov), I(Aligned, em_mov), N, N,
3699}; 3706};
3700 3707
3708static const struct gprefix pfx_0f_e7 = {
3709 N, I(Sse, em_mov), N, N,
3710};
3711
3701static const struct escape escape_d9 = { { 3712static const struct escape escape_d9 = { {
3702 N, N, N, N, N, N, N, I(DstMem, em_fnstcw), 3713 N, N, N, N, N, N, N, I(DstMem, em_fnstcw),
3703}, { 3714}, {
@@ -3904,7 +3915,7 @@ static const struct opcode twobyte_table[256] = {
3904 N, N, N, N, 3915 N, N, N, N,
3905 GP(ModRM | DstReg | SrcMem | Mov | Sse, &pfx_0f_28_0f_29), 3916 GP(ModRM | DstReg | SrcMem | Mov | Sse, &pfx_0f_28_0f_29),
3906 GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_28_0f_29), 3917 GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_28_0f_29),
3907 N, GP(ModRM | DstMem | SrcReg | Sse | Mov | Aligned, &pfx_vmovntpx), 3918 N, GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_2b),
3908 N, N, N, N, 3919 N, N, N, N,
3909 /* 0x30 - 0x3F */ 3920 /* 0x30 - 0x3F */
3910 II(ImplicitOps | Priv, em_wrmsr, wrmsr), 3921 II(ImplicitOps | Priv, em_wrmsr, wrmsr),
@@ -3968,7 +3979,8 @@ static const struct opcode twobyte_table[256] = {
3968 /* 0xD0 - 0xDF */ 3979 /* 0xD0 - 0xDF */
3969 N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, 3980 N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N,
3970 /* 0xE0 - 0xEF */ 3981 /* 0xE0 - 0xEF */
3971 N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, 3982 N, N, N, N, N, N, N, GP(SrcReg | DstMem | ModRM | Mov, &pfx_0f_e7),
3983 N, N, N, N, N, N, N, N,
3972 /* 0xF0 - 0xFF */ 3984 /* 0xF0 - 0xFF */
3973 N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N 3985 N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N
3974}; 3986};
@@ -4394,8 +4406,11 @@ done_prefixes:
4394 4406
4395 ctxt->execute = opcode.u.execute; 4407 ctxt->execute = opcode.u.execute;
4396 4408
4409 if (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD)))
4410 return EMULATION_FAILED;
4411
4397 if (unlikely(ctxt->d & 4412 if (unlikely(ctxt->d &
4398 (NotImpl|EmulateOnUD|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) { 4413 (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) {
4399 /* 4414 /*
4400 * These are copied unconditionally here, and checked unconditionally 4415 * These are copied unconditionally here, and checked unconditionally
4401 * in x86_emulate_insn. 4416 * in x86_emulate_insn.
@@ -4406,9 +4421,6 @@ done_prefixes:
4406 if (ctxt->d & NotImpl) 4421 if (ctxt->d & NotImpl)
4407 return EMULATION_FAILED; 4422 return EMULATION_FAILED;
4408 4423
4409 if (!(ctxt->d & EmulateOnUD) && ctxt->ud)
4410 return EMULATION_FAILED;
4411
4412 if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) 4424 if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack))
4413 ctxt->op_bytes = 8; 4425 ctxt->op_bytes = 8;
4414 4426
@@ -4832,8 +4844,10 @@ writeback:
4832 ctxt->eip = ctxt->_eip; 4844 ctxt->eip = ctxt->_eip;
4833 4845
4834done: 4846done:
4835 if (rc == X86EMUL_PROPAGATE_FAULT) 4847 if (rc == X86EMUL_PROPAGATE_FAULT) {
4848 WARN_ON(ctxt->exception.vector > 0x1f);
4836 ctxt->have_exception = true; 4849 ctxt->have_exception = true;
4850 }
4837 if (rc == X86EMUL_INTERCEPTED) 4851 if (rc == X86EMUL_INTERCEPTED)
4838 return EMULATION_INTERCEPTED; 4852 return EMULATION_INTERCEPTED;
4839 4853
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 08e8a899e005..b8345dd41b25 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -112,17 +112,6 @@ static inline int __apic_test_and_clear_vector(int vec, void *bitmap)
112struct static_key_deferred apic_hw_disabled __read_mostly; 112struct static_key_deferred apic_hw_disabled __read_mostly;
113struct static_key_deferred apic_sw_disabled __read_mostly; 113struct static_key_deferred apic_sw_disabled __read_mostly;
114 114
115static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val)
116{
117 if ((kvm_apic_get_reg(apic, APIC_SPIV) ^ val) & APIC_SPIV_APIC_ENABLED) {
118 if (val & APIC_SPIV_APIC_ENABLED)
119 static_key_slow_dec_deferred(&apic_sw_disabled);
120 else
121 static_key_slow_inc(&apic_sw_disabled.key);
122 }
123 apic_set_reg(apic, APIC_SPIV, val);
124}
125
126static inline int apic_enabled(struct kvm_lapic *apic) 115static inline int apic_enabled(struct kvm_lapic *apic)
127{ 116{
128 return kvm_apic_sw_enabled(apic) && kvm_apic_hw_enabled(apic); 117 return kvm_apic_sw_enabled(apic) && kvm_apic_hw_enabled(apic);
@@ -210,6 +199,20 @@ out:
210 kvm_vcpu_request_scan_ioapic(kvm); 199 kvm_vcpu_request_scan_ioapic(kvm);
211} 200}
212 201
202static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val)
203{
204 u32 prev = kvm_apic_get_reg(apic, APIC_SPIV);
205
206 apic_set_reg(apic, APIC_SPIV, val);
207 if ((prev ^ val) & APIC_SPIV_APIC_ENABLED) {
208 if (val & APIC_SPIV_APIC_ENABLED) {
209 static_key_slow_dec_deferred(&apic_sw_disabled);
210 recalculate_apic_map(apic->vcpu->kvm);
211 } else
212 static_key_slow_inc(&apic_sw_disabled.key);
213 }
214}
215
213static inline void kvm_apic_set_id(struct kvm_lapic *apic, u8 id) 216static inline void kvm_apic_set_id(struct kvm_lapic *apic, u8 id)
214{ 217{
215 apic_set_reg(apic, APIC_ID, id << 24); 218 apic_set_reg(apic, APIC_ID, id << 24);
@@ -706,6 +709,8 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
706 int result = 0; 709 int result = 0;
707 struct kvm_vcpu *vcpu = apic->vcpu; 710 struct kvm_vcpu *vcpu = apic->vcpu;
708 711
712 trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode,
713 trig_mode, vector);
709 switch (delivery_mode) { 714 switch (delivery_mode) {
710 case APIC_DM_LOWEST: 715 case APIC_DM_LOWEST:
711 vcpu->arch.apic_arb_prio++; 716 vcpu->arch.apic_arb_prio++;
@@ -727,8 +732,6 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
727 kvm_make_request(KVM_REQ_EVENT, vcpu); 732 kvm_make_request(KVM_REQ_EVENT, vcpu);
728 kvm_vcpu_kick(vcpu); 733 kvm_vcpu_kick(vcpu);
729 } 734 }
730 trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode,
731 trig_mode, vector, false);
732 break; 735 break;
733 736
734 case APIC_DM_REMRD: 737 case APIC_DM_REMRD:
@@ -1352,6 +1355,9 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data)
1352 return; 1355 return;
1353 1356
1354 hrtimer_cancel(&apic->lapic_timer.timer); 1357 hrtimer_cancel(&apic->lapic_timer.timer);
1358 /* Inject here so clearing tscdeadline won't override new value */
1359 if (apic_has_pending_timer(vcpu))
1360 kvm_inject_apic_timer_irqs(vcpu);
1355 apic->lapic_timer.tscdeadline = data; 1361 apic->lapic_timer.tscdeadline = data;
1356 start_apic_timer(apic); 1362 start_apic_timer(apic);
1357} 1363}
@@ -1639,6 +1645,8 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu)
1639 1645
1640 if (atomic_read(&apic->lapic_timer.pending) > 0) { 1646 if (atomic_read(&apic->lapic_timer.pending) > 0) {
1641 kvm_apic_local_deliver(apic, APIC_LVTT); 1647 kvm_apic_local_deliver(apic, APIC_LVTT);
1648 if (apic_lvtt_tscdeadline(apic))
1649 apic->lapic_timer.tscdeadline = 0;
1642 atomic_set(&apic->lapic_timer.pending, 0); 1650 atomic_set(&apic->lapic_timer.pending, 0);
1643 } 1651 }
1644} 1652}
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 931467881da7..3201e93ebd07 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -199,16 +199,20 @@ void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask)
199EXPORT_SYMBOL_GPL(kvm_mmu_set_mmio_spte_mask); 199EXPORT_SYMBOL_GPL(kvm_mmu_set_mmio_spte_mask);
200 200
201/* 201/*
202 * spte bits of bit 3 ~ bit 11 are used as low 9 bits of generation number, 202 * the low bit of the generation number is always presumed to be zero.
203 * the bits of bits 52 ~ bit 61 are used as high 10 bits of generation 203 * This disables mmio caching during memslot updates. The concept is
204 * number. 204 * similar to a seqcount but instead of retrying the access we just punt
205 * and ignore the cache.
206 *
207 * spte bits 3-11 are used as bits 1-9 of the generation number,
208 * the bits 52-61 are used as bits 10-19 of the generation number.
205 */ 209 */
206#define MMIO_SPTE_GEN_LOW_SHIFT 3 210#define MMIO_SPTE_GEN_LOW_SHIFT 2
207#define MMIO_SPTE_GEN_HIGH_SHIFT 52 211#define MMIO_SPTE_GEN_HIGH_SHIFT 52
208 212
209#define MMIO_GEN_SHIFT 19 213#define MMIO_GEN_SHIFT 20
210#define MMIO_GEN_LOW_SHIFT 9 214#define MMIO_GEN_LOW_SHIFT 10
211#define MMIO_GEN_LOW_MASK ((1 << MMIO_GEN_LOW_SHIFT) - 1) 215#define MMIO_GEN_LOW_MASK ((1 << MMIO_GEN_LOW_SHIFT) - 2)
212#define MMIO_GEN_MASK ((1 << MMIO_GEN_SHIFT) - 1) 216#define MMIO_GEN_MASK ((1 << MMIO_GEN_SHIFT) - 1)
213#define MMIO_MAX_GEN ((1 << MMIO_GEN_SHIFT) - 1) 217#define MMIO_MAX_GEN ((1 << MMIO_GEN_SHIFT) - 1)
214 218
@@ -236,12 +240,7 @@ static unsigned int get_mmio_spte_generation(u64 spte)
236 240
237static unsigned int kvm_current_mmio_generation(struct kvm *kvm) 241static unsigned int kvm_current_mmio_generation(struct kvm *kvm)
238{ 242{
239 /* 243 return kvm_memslots(kvm)->generation & MMIO_GEN_MASK;
240 * Init kvm generation close to MMIO_MAX_GEN to easily test the
241 * code of handling generation number wrap-around.
242 */
243 return (kvm_memslots(kvm)->generation +
244 MMIO_MAX_GEN - 150) & MMIO_GEN_MASK;
245} 244}
246 245
247static void mark_mmio_spte(struct kvm *kvm, u64 *sptep, u64 gfn, 246static void mark_mmio_spte(struct kvm *kvm, u64 *sptep, u64 gfn,
@@ -296,11 +295,6 @@ static bool check_mmio_spte(struct kvm *kvm, u64 spte)
296 return likely(kvm_gen == spte_gen); 295 return likely(kvm_gen == spte_gen);
297} 296}
298 297
299static inline u64 rsvd_bits(int s, int e)
300{
301 return ((1ULL << (e - s + 1)) - 1) << s;
302}
303
304void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, 298void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
305 u64 dirty_mask, u64 nx_mask, u64 x_mask) 299 u64 dirty_mask, u64 nx_mask, u64 x_mask)
306{ 300{
@@ -1180,7 +1174,7 @@ static void drop_large_spte(struct kvm_vcpu *vcpu, u64 *sptep)
1180 * Write-protect on the specified @sptep, @pt_protect indicates whether 1174 * Write-protect on the specified @sptep, @pt_protect indicates whether
1181 * spte write-protection is caused by protecting shadow page table. 1175 * spte write-protection is caused by protecting shadow page table.
1182 * 1176 *
1183 * Note: write protection is difference between drity logging and spte 1177 * Note: write protection is difference between dirty logging and spte
1184 * protection: 1178 * protection:
1185 * - for dirty logging, the spte can be set to writable at anytime if 1179 * - for dirty logging, the spte can be set to writable at anytime if
1186 * its dirty bitmap is properly set. 1180 * its dirty bitmap is properly set.
@@ -1268,7 +1262,8 @@ static bool rmap_write_protect(struct kvm *kvm, u64 gfn)
1268} 1262}
1269 1263
1270static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, 1264static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
1271 struct kvm_memory_slot *slot, unsigned long data) 1265 struct kvm_memory_slot *slot, gfn_t gfn, int level,
1266 unsigned long data)
1272{ 1267{
1273 u64 *sptep; 1268 u64 *sptep;
1274 struct rmap_iterator iter; 1269 struct rmap_iterator iter;
@@ -1276,7 +1271,8 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
1276 1271
1277 while ((sptep = rmap_get_first(*rmapp, &iter))) { 1272 while ((sptep = rmap_get_first(*rmapp, &iter))) {
1278 BUG_ON(!(*sptep & PT_PRESENT_MASK)); 1273 BUG_ON(!(*sptep & PT_PRESENT_MASK));
1279 rmap_printk("kvm_rmap_unmap_hva: spte %p %llx\n", sptep, *sptep); 1274 rmap_printk("kvm_rmap_unmap_hva: spte %p %llx gfn %llx (%d)\n",
1275 sptep, *sptep, gfn, level);
1280 1276
1281 drop_spte(kvm, sptep); 1277 drop_spte(kvm, sptep);
1282 need_tlb_flush = 1; 1278 need_tlb_flush = 1;
@@ -1286,7 +1282,8 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
1286} 1282}
1287 1283
1288static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, 1284static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
1289 struct kvm_memory_slot *slot, unsigned long data) 1285 struct kvm_memory_slot *slot, gfn_t gfn, int level,
1286 unsigned long data)
1290{ 1287{
1291 u64 *sptep; 1288 u64 *sptep;
1292 struct rmap_iterator iter; 1289 struct rmap_iterator iter;
@@ -1300,7 +1297,8 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
1300 1297
1301 for (sptep = rmap_get_first(*rmapp, &iter); sptep;) { 1298 for (sptep = rmap_get_first(*rmapp, &iter); sptep;) {
1302 BUG_ON(!is_shadow_present_pte(*sptep)); 1299 BUG_ON(!is_shadow_present_pte(*sptep));
1303 rmap_printk("kvm_set_pte_rmapp: spte %p %llx\n", sptep, *sptep); 1300 rmap_printk("kvm_set_pte_rmapp: spte %p %llx gfn %llx (%d)\n",
1301 sptep, *sptep, gfn, level);
1304 1302
1305 need_flush = 1; 1303 need_flush = 1;
1306 1304
@@ -1334,6 +1332,8 @@ static int kvm_handle_hva_range(struct kvm *kvm,
1334 int (*handler)(struct kvm *kvm, 1332 int (*handler)(struct kvm *kvm,
1335 unsigned long *rmapp, 1333 unsigned long *rmapp,
1336 struct kvm_memory_slot *slot, 1334 struct kvm_memory_slot *slot,
1335 gfn_t gfn,
1336 int level,
1337 unsigned long data)) 1337 unsigned long data))
1338{ 1338{
1339 int j; 1339 int j;
@@ -1363,6 +1363,7 @@ static int kvm_handle_hva_range(struct kvm *kvm,
1363 j < PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES; ++j) { 1363 j < PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES; ++j) {
1364 unsigned long idx, idx_end; 1364 unsigned long idx, idx_end;
1365 unsigned long *rmapp; 1365 unsigned long *rmapp;
1366 gfn_t gfn = gfn_start;
1366 1367
1367 /* 1368 /*
1368 * {idx(page_j) | page_j intersects with 1369 * {idx(page_j) | page_j intersects with
@@ -1373,8 +1374,10 @@ static int kvm_handle_hva_range(struct kvm *kvm,
1373 1374
1374 rmapp = __gfn_to_rmap(gfn_start, j, memslot); 1375 rmapp = __gfn_to_rmap(gfn_start, j, memslot);
1375 1376
1376 for (; idx <= idx_end; ++idx) 1377 for (; idx <= idx_end;
1377 ret |= handler(kvm, rmapp++, memslot, data); 1378 ++idx, gfn += (1UL << KVM_HPAGE_GFN_SHIFT(j)))
1379 ret |= handler(kvm, rmapp++, memslot,
1380 gfn, j, data);
1378 } 1381 }
1379 } 1382 }
1380 1383
@@ -1385,6 +1388,7 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
1385 unsigned long data, 1388 unsigned long data,
1386 int (*handler)(struct kvm *kvm, unsigned long *rmapp, 1389 int (*handler)(struct kvm *kvm, unsigned long *rmapp,
1387 struct kvm_memory_slot *slot, 1390 struct kvm_memory_slot *slot,
1391 gfn_t gfn, int level,
1388 unsigned long data)) 1392 unsigned long data))
1389{ 1393{
1390 return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler); 1394 return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler);
@@ -1406,24 +1410,14 @@ void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
1406} 1410}
1407 1411
1408static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 1412static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1409 struct kvm_memory_slot *slot, unsigned long data) 1413 struct kvm_memory_slot *slot, gfn_t gfn, int level,
1414 unsigned long data)
1410{ 1415{
1411 u64 *sptep; 1416 u64 *sptep;
1412 struct rmap_iterator uninitialized_var(iter); 1417 struct rmap_iterator uninitialized_var(iter);
1413 int young = 0; 1418 int young = 0;
1414 1419
1415 /* 1420 BUG_ON(!shadow_accessed_mask);
1416 * In case of absence of EPT Access and Dirty Bits supports,
1417 * emulate the accessed bit for EPT, by checking if this page has
1418 * an EPT mapping, and clearing it if it does. On the next access,
1419 * a new EPT mapping will be established.
1420 * This has some overhead, but not as much as the cost of swapping
1421 * out actively used pages or breaking up actively used hugepages.
1422 */
1423 if (!shadow_accessed_mask) {
1424 young = kvm_unmap_rmapp(kvm, rmapp, slot, data);
1425 goto out;
1426 }
1427 1421
1428 for (sptep = rmap_get_first(*rmapp, &iter); sptep; 1422 for (sptep = rmap_get_first(*rmapp, &iter); sptep;
1429 sptep = rmap_get_next(&iter)) { 1423 sptep = rmap_get_next(&iter)) {
@@ -1435,14 +1429,13 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1435 (unsigned long *)sptep); 1429 (unsigned long *)sptep);
1436 } 1430 }
1437 } 1431 }
1438out: 1432 trace_kvm_age_page(gfn, level, slot, young);
1439 /* @data has hva passed to kvm_age_hva(). */
1440 trace_kvm_age_page(data, slot, young);
1441 return young; 1433 return young;
1442} 1434}
1443 1435
1444static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 1436static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1445 struct kvm_memory_slot *slot, unsigned long data) 1437 struct kvm_memory_slot *slot, gfn_t gfn,
1438 int level, unsigned long data)
1446{ 1439{
1447 u64 *sptep; 1440 u64 *sptep;
1448 struct rmap_iterator iter; 1441 struct rmap_iterator iter;
@@ -1480,13 +1473,33 @@ static void rmap_recycle(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
1480 1473
1481 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level); 1474 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level);
1482 1475
1483 kvm_unmap_rmapp(vcpu->kvm, rmapp, NULL, 0); 1476 kvm_unmap_rmapp(vcpu->kvm, rmapp, NULL, gfn, sp->role.level, 0);
1484 kvm_flush_remote_tlbs(vcpu->kvm); 1477 kvm_flush_remote_tlbs(vcpu->kvm);
1485} 1478}
1486 1479
1487int kvm_age_hva(struct kvm *kvm, unsigned long hva) 1480int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end)
1488{ 1481{
1489 return kvm_handle_hva(kvm, hva, hva, kvm_age_rmapp); 1482 /*
1483 * In case of absence of EPT Access and Dirty Bits supports,
1484 * emulate the accessed bit for EPT, by checking if this page has
1485 * an EPT mapping, and clearing it if it does. On the next access,
1486 * a new EPT mapping will be established.
1487 * This has some overhead, but not as much as the cost of swapping
1488 * out actively used pages or breaking up actively used hugepages.
1489 */
1490 if (!shadow_accessed_mask) {
1491 /*
1492 * We are holding the kvm->mmu_lock, and we are blowing up
1493 * shadow PTEs. MMU notifier consumers need to be kept at bay.
1494 * This is correct as long as we don't decouple the mmu_lock
1495 * protected regions (like invalidate_range_start|end does).
1496 */
1497 kvm->mmu_notifier_seq++;
1498 return kvm_handle_hva_range(kvm, start, end, 0,
1499 kvm_unmap_rmapp);
1500 }
1501
1502 return kvm_handle_hva_range(kvm, start, end, 0, kvm_age_rmapp);
1490} 1503}
1491 1504
1492int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) 1505int kvm_test_age_hva(struct kvm *kvm, unsigned long hva)
@@ -1749,7 +1762,7 @@ static int __kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
1749 return 1; 1762 return 1;
1750 } 1763 }
1751 1764
1752 kvm_mmu_flush_tlb(vcpu); 1765 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
1753 return 0; 1766 return 0;
1754} 1767}
1755 1768
@@ -1802,7 +1815,7 @@ static void kvm_sync_pages(struct kvm_vcpu *vcpu, gfn_t gfn)
1802 1815
1803 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list); 1816 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
1804 if (flush) 1817 if (flush)
1805 kvm_mmu_flush_tlb(vcpu); 1818 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
1806} 1819}
1807 1820
1808struct mmu_page_path { 1821struct mmu_page_path {
@@ -2536,7 +2549,7 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
2536 true, host_writable)) { 2549 true, host_writable)) {
2537 if (write_fault) 2550 if (write_fault)
2538 *emulate = 1; 2551 *emulate = 1;
2539 kvm_mmu_flush_tlb(vcpu); 2552 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
2540 } 2553 }
2541 2554
2542 if (unlikely(is_mmio_spte(*sptep) && emulate)) 2555 if (unlikely(is_mmio_spte(*sptep) && emulate))
@@ -3163,7 +3176,7 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)
3163 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) 3176 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
3164 return; 3177 return;
3165 3178
3166 vcpu_clear_mmio_info(vcpu, ~0ul); 3179 vcpu_clear_mmio_info(vcpu, MMIO_GVA_ANY);
3167 kvm_mmu_audit(vcpu, AUDIT_PRE_SYNC); 3180 kvm_mmu_audit(vcpu, AUDIT_PRE_SYNC);
3168 if (vcpu->arch.mmu.root_level == PT64_ROOT_LEVEL) { 3181 if (vcpu->arch.mmu.root_level == PT64_ROOT_LEVEL) {
3169 hpa_t root = vcpu->arch.mmu.root_hpa; 3182 hpa_t root = vcpu->arch.mmu.root_hpa;
@@ -3206,7 +3219,7 @@ static gpa_t nonpaging_gva_to_gpa_nested(struct kvm_vcpu *vcpu, gva_t vaddr,
3206{ 3219{
3207 if (exception) 3220 if (exception)
3208 exception->error_code = 0; 3221 exception->error_code = 0;
3209 return vcpu->arch.nested_mmu.translate_gpa(vcpu, vaddr, access); 3222 return vcpu->arch.nested_mmu.translate_gpa(vcpu, vaddr, access, exception);
3210} 3223}
3211 3224
3212static bool quickly_check_mmio_pf(struct kvm_vcpu *vcpu, u64 addr, bool direct) 3225static bool quickly_check_mmio_pf(struct kvm_vcpu *vcpu, u64 addr, bool direct)
@@ -3450,13 +3463,6 @@ static void nonpaging_init_context(struct kvm_vcpu *vcpu,
3450 context->nx = false; 3463 context->nx = false;
3451} 3464}
3452 3465
3453void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu)
3454{
3455 ++vcpu->stat.tlb_flush;
3456 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
3457}
3458EXPORT_SYMBOL_GPL(kvm_mmu_flush_tlb);
3459
3460void kvm_mmu_new_cr3(struct kvm_vcpu *vcpu) 3466void kvm_mmu_new_cr3(struct kvm_vcpu *vcpu)
3461{ 3467{
3462 mmu_free_roots(vcpu); 3468 mmu_free_roots(vcpu);
@@ -3518,6 +3524,7 @@ static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu,
3518 int maxphyaddr = cpuid_maxphyaddr(vcpu); 3524 int maxphyaddr = cpuid_maxphyaddr(vcpu);
3519 u64 exb_bit_rsvd = 0; 3525 u64 exb_bit_rsvd = 0;
3520 u64 gbpages_bit_rsvd = 0; 3526 u64 gbpages_bit_rsvd = 0;
3527 u64 nonleaf_bit8_rsvd = 0;
3521 3528
3522 context->bad_mt_xwr = 0; 3529 context->bad_mt_xwr = 0;
3523 3530
@@ -3525,6 +3532,14 @@ static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu,
3525 exb_bit_rsvd = rsvd_bits(63, 63); 3532 exb_bit_rsvd = rsvd_bits(63, 63);
3526 if (!guest_cpuid_has_gbpages(vcpu)) 3533 if (!guest_cpuid_has_gbpages(vcpu))
3527 gbpages_bit_rsvd = rsvd_bits(7, 7); 3534 gbpages_bit_rsvd = rsvd_bits(7, 7);
3535
3536 /*
3537 * Non-leaf PML4Es and PDPEs reserve bit 8 (which would be the G bit for
3538 * leaf entries) on AMD CPUs only.
3539 */
3540 if (guest_cpuid_is_amd(vcpu))
3541 nonleaf_bit8_rsvd = rsvd_bits(8, 8);
3542
3528 switch (context->root_level) { 3543 switch (context->root_level) {
3529 case PT32_ROOT_LEVEL: 3544 case PT32_ROOT_LEVEL:
3530 /* no rsvd bits for 2 level 4K page table entries */ 3545 /* no rsvd bits for 2 level 4K page table entries */
@@ -3559,9 +3574,9 @@ static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu,
3559 break; 3574 break;
3560 case PT64_ROOT_LEVEL: 3575 case PT64_ROOT_LEVEL:
3561 context->rsvd_bits_mask[0][3] = exb_bit_rsvd | 3576 context->rsvd_bits_mask[0][3] = exb_bit_rsvd |
3562 rsvd_bits(maxphyaddr, 51) | rsvd_bits(7, 7); 3577 nonleaf_bit8_rsvd | rsvd_bits(7, 7) | rsvd_bits(maxphyaddr, 51);
3563 context->rsvd_bits_mask[0][2] = exb_bit_rsvd | 3578 context->rsvd_bits_mask[0][2] = exb_bit_rsvd |
3564 gbpages_bit_rsvd | rsvd_bits(maxphyaddr, 51); 3579 nonleaf_bit8_rsvd | gbpages_bit_rsvd | rsvd_bits(maxphyaddr, 51);
3565 context->rsvd_bits_mask[0][1] = exb_bit_rsvd | 3580 context->rsvd_bits_mask[0][1] = exb_bit_rsvd |
3566 rsvd_bits(maxphyaddr, 51); 3581 rsvd_bits(maxphyaddr, 51);
3567 context->rsvd_bits_mask[0][0] = exb_bit_rsvd | 3582 context->rsvd_bits_mask[0][0] = exb_bit_rsvd |
@@ -3962,7 +3977,7 @@ static void mmu_pte_write_flush_tlb(struct kvm_vcpu *vcpu, bool zap_page,
3962 if (remote_flush) 3977 if (remote_flush)
3963 kvm_flush_remote_tlbs(vcpu->kvm); 3978 kvm_flush_remote_tlbs(vcpu->kvm);
3964 else if (local_flush) 3979 else if (local_flush)
3965 kvm_mmu_flush_tlb(vcpu); 3980 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
3966} 3981}
3967 3982
3968static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa, 3983static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa,
@@ -4223,7 +4238,7 @@ EXPORT_SYMBOL_GPL(kvm_mmu_page_fault);
4223void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva) 4238void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva)
4224{ 4239{
4225 vcpu->arch.mmu.invlpg(vcpu, gva); 4240 vcpu->arch.mmu.invlpg(vcpu, gva);
4226 kvm_mmu_flush_tlb(vcpu); 4241 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
4227 ++vcpu->stat.invlpg; 4242 ++vcpu->stat.invlpg;
4228} 4243}
4229EXPORT_SYMBOL_GPL(kvm_mmu_invlpg); 4244EXPORT_SYMBOL_GPL(kvm_mmu_invlpg);
@@ -4433,7 +4448,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm)
4433 * The very rare case: if the generation-number is round, 4448 * The very rare case: if the generation-number is round,
4434 * zap all shadow pages. 4449 * zap all shadow pages.
4435 */ 4450 */
4436 if (unlikely(kvm_current_mmio_generation(kvm) >= MMIO_MAX_GEN)) { 4451 if (unlikely(kvm_current_mmio_generation(kvm) == 0)) {
4437 printk_ratelimited(KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound\n"); 4452 printk_ratelimited(KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound\n");
4438 kvm_mmu_invalidate_zap_all_pages(kvm); 4453 kvm_mmu_invalidate_zap_all_pages(kvm);
4439 } 4454 }
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index b982112d2ca5..bde8ee725754 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -56,6 +56,11 @@
56#define PFERR_RSVD_MASK (1U << PFERR_RSVD_BIT) 56#define PFERR_RSVD_MASK (1U << PFERR_RSVD_BIT)
57#define PFERR_FETCH_MASK (1U << PFERR_FETCH_BIT) 57#define PFERR_FETCH_MASK (1U << PFERR_FETCH_BIT)
58 58
59static inline u64 rsvd_bits(int s, int e)
60{
61 return ((1ULL << (e - s + 1)) - 1) << s;
62}
63
59int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]); 64int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]);
60void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask); 65void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask);
61 66
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 410776528265..806d58e3c320 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -298,8 +298,7 @@ retry_walk:
298 } 298 }
299#endif 299#endif
300 walker->max_level = walker->level; 300 walker->max_level = walker->level;
301 ASSERT((!is_long_mode(vcpu) && is_pae(vcpu)) || 301 ASSERT(!is_long_mode(vcpu) && is_pae(vcpu));
302 (mmu->get_cr3(vcpu) & CR3_NONPAE_RESERVED_BITS) == 0);
303 302
304 accessed_dirty = PT_GUEST_ACCESSED_MASK; 303 accessed_dirty = PT_GUEST_ACCESSED_MASK;
305 pt_access = pte_access = ACC_ALL; 304 pt_access = pte_access = ACC_ALL;
@@ -321,9 +320,22 @@ retry_walk:
321 walker->pte_gpa[walker->level - 1] = pte_gpa; 320 walker->pte_gpa[walker->level - 1] = pte_gpa;
322 321
323 real_gfn = mmu->translate_gpa(vcpu, gfn_to_gpa(table_gfn), 322 real_gfn = mmu->translate_gpa(vcpu, gfn_to_gpa(table_gfn),
324 PFERR_USER_MASK|PFERR_WRITE_MASK); 323 PFERR_USER_MASK|PFERR_WRITE_MASK,
324 &walker->fault);
325
326 /*
327 * FIXME: This can happen if emulation (for of an INS/OUTS
328 * instruction) triggers a nested page fault. The exit
329 * qualification / exit info field will incorrectly have
330 * "guest page access" as the nested page fault's cause,
331 * instead of "guest page structure access". To fix this,
332 * the x86_exception struct should be augmented with enough
333 * information to fix the exit_qualification or exit_info_1
334 * fields.
335 */
325 if (unlikely(real_gfn == UNMAPPED_GVA)) 336 if (unlikely(real_gfn == UNMAPPED_GVA))
326 goto error; 337 return 0;
338
327 real_gfn = gpa_to_gfn(real_gfn); 339 real_gfn = gpa_to_gfn(real_gfn);
328 340
329 host_addr = gfn_to_hva_prot(vcpu->kvm, real_gfn, 341 host_addr = gfn_to_hva_prot(vcpu->kvm, real_gfn,
@@ -364,7 +376,7 @@ retry_walk:
364 if (PTTYPE == 32 && walker->level == PT_DIRECTORY_LEVEL && is_cpuid_PSE36()) 376 if (PTTYPE == 32 && walker->level == PT_DIRECTORY_LEVEL && is_cpuid_PSE36())
365 gfn += pse36_gfn_delta(pte); 377 gfn += pse36_gfn_delta(pte);
366 378
367 real_gpa = mmu->translate_gpa(vcpu, gfn_to_gpa(gfn), access); 379 real_gpa = mmu->translate_gpa(vcpu, gfn_to_gpa(gfn), access, &walker->fault);
368 if (real_gpa == UNMAPPED_GVA) 380 if (real_gpa == UNMAPPED_GVA)
369 return 0; 381 return 0;
370 382
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index 3dd6accb64ec..8e6b7d869d2f 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kvm_host.h> 16#include <linux/kvm_host.h>
17#include <linux/perf_event.h> 17#include <linux/perf_event.h>
18#include <asm/perf_event.h>
18#include "x86.h" 19#include "x86.h"
19#include "cpuid.h" 20#include "cpuid.h"
20#include "lapic.h" 21#include "lapic.h"
@@ -463,7 +464,8 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu)
463{ 464{
464 struct kvm_pmu *pmu = &vcpu->arch.pmu; 465 struct kvm_pmu *pmu = &vcpu->arch.pmu;
465 struct kvm_cpuid_entry2 *entry; 466 struct kvm_cpuid_entry2 *entry;
466 unsigned bitmap_len; 467 union cpuid10_eax eax;
468 union cpuid10_edx edx;
467 469
468 pmu->nr_arch_gp_counters = 0; 470 pmu->nr_arch_gp_counters = 0;
469 pmu->nr_arch_fixed_counters = 0; 471 pmu->nr_arch_fixed_counters = 0;
@@ -475,25 +477,27 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu)
475 entry = kvm_find_cpuid_entry(vcpu, 0xa, 0); 477 entry = kvm_find_cpuid_entry(vcpu, 0xa, 0);
476 if (!entry) 478 if (!entry)
477 return; 479 return;
480 eax.full = entry->eax;
481 edx.full = entry->edx;
478 482
479 pmu->version = entry->eax & 0xff; 483 pmu->version = eax.split.version_id;
480 if (!pmu->version) 484 if (!pmu->version)
481 return; 485 return;
482 486
483 pmu->nr_arch_gp_counters = min((int)(entry->eax >> 8) & 0xff, 487 pmu->nr_arch_gp_counters = min_t(int, eax.split.num_counters,
484 INTEL_PMC_MAX_GENERIC); 488 INTEL_PMC_MAX_GENERIC);
485 pmu->counter_bitmask[KVM_PMC_GP] = 489 pmu->counter_bitmask[KVM_PMC_GP] = ((u64)1 << eax.split.bit_width) - 1;
486 ((u64)1 << ((entry->eax >> 16) & 0xff)) - 1; 490 pmu->available_event_types = ~entry->ebx &
487 bitmap_len = (entry->eax >> 24) & 0xff; 491 ((1ull << eax.split.mask_length) - 1);
488 pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1);
489 492
490 if (pmu->version == 1) { 493 if (pmu->version == 1) {
491 pmu->nr_arch_fixed_counters = 0; 494 pmu->nr_arch_fixed_counters = 0;
492 } else { 495 } else {
493 pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), 496 pmu->nr_arch_fixed_counters =
497 min_t(int, edx.split.num_counters_fixed,
494 INTEL_PMC_MAX_FIXED); 498 INTEL_PMC_MAX_FIXED);
495 pmu->counter_bitmask[KVM_PMC_FIXED] = 499 pmu->counter_bitmask[KVM_PMC_FIXED] =
496 ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1; 500 ((u64)1 << edx.split.bit_width_fixed) - 1;
497 } 501 }
498 502
499 pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) | 503 pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ddf742768ecf..f7f6a4a157a6 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -622,7 +622,7 @@ static int has_svm(void)
622 return 1; 622 return 1;
623} 623}
624 624
625static void svm_hardware_disable(void *garbage) 625static void svm_hardware_disable(void)
626{ 626{
627 /* Make sure we clean up behind us */ 627 /* Make sure we clean up behind us */
628 if (static_cpu_has(X86_FEATURE_TSCRATEMSR)) 628 if (static_cpu_has(X86_FEATURE_TSCRATEMSR))
@@ -633,7 +633,7 @@ static void svm_hardware_disable(void *garbage)
633 amd_pmu_disable_virt(); 633 amd_pmu_disable_virt();
634} 634}
635 635
636static int svm_hardware_enable(void *garbage) 636static int svm_hardware_enable(void)
637{ 637{
638 638
639 struct svm_cpu_data *sd; 639 struct svm_cpu_data *sd;
@@ -1257,7 +1257,8 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
1257 svm->asid_generation = 0; 1257 svm->asid_generation = 0;
1258 init_vmcb(svm); 1258 init_vmcb(svm);
1259 1259
1260 svm->vcpu.arch.apic_base = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; 1260 svm->vcpu.arch.apic_base = APIC_DEFAULT_PHYS_BASE |
1261 MSR_IA32_APICBASE_ENABLE;
1261 if (kvm_vcpu_is_bsp(&svm->vcpu)) 1262 if (kvm_vcpu_is_bsp(&svm->vcpu))
1262 svm->vcpu.arch.apic_base |= MSR_IA32_APICBASE_BSP; 1263 svm->vcpu.arch.apic_base |= MSR_IA32_APICBASE_BSP;
1263 1264
@@ -1974,10 +1975,26 @@ static void nested_svm_inject_npf_exit(struct kvm_vcpu *vcpu,
1974{ 1975{
1975 struct vcpu_svm *svm = to_svm(vcpu); 1976 struct vcpu_svm *svm = to_svm(vcpu);
1976 1977
1977 svm->vmcb->control.exit_code = SVM_EXIT_NPF; 1978 if (svm->vmcb->control.exit_code != SVM_EXIT_NPF) {
1978 svm->vmcb->control.exit_code_hi = 0; 1979 /*
1979 svm->vmcb->control.exit_info_1 = fault->error_code; 1980 * TODO: track the cause of the nested page fault, and
1980 svm->vmcb->control.exit_info_2 = fault->address; 1981 * correctly fill in the high bits of exit_info_1.
1982 */
1983 svm->vmcb->control.exit_code = SVM_EXIT_NPF;
1984 svm->vmcb->control.exit_code_hi = 0;
1985 svm->vmcb->control.exit_info_1 = (1ULL << 32);
1986 svm->vmcb->control.exit_info_2 = fault->address;
1987 }
1988
1989 svm->vmcb->control.exit_info_1 &= ~0xffffffffULL;
1990 svm->vmcb->control.exit_info_1 |= fault->error_code;
1991
1992 /*
1993 * The present bit is always zero for page structure faults on real
1994 * hardware.
1995 */
1996 if (svm->vmcb->control.exit_info_1 & (2ULL << 32))
1997 svm->vmcb->control.exit_info_1 &= ~1;
1981 1998
1982 nested_svm_vmexit(svm); 1999 nested_svm_vmexit(svm);
1983} 2000}
@@ -3031,7 +3048,7 @@ static int cr8_write_interception(struct vcpu_svm *svm)
3031 return 0; 3048 return 0;
3032} 3049}
3033 3050
3034u64 svm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc) 3051static u64 svm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc)
3035{ 3052{
3036 struct vmcb *vmcb = get_host_vmcb(to_svm(vcpu)); 3053 struct vmcb *vmcb = get_host_vmcb(to_svm(vcpu));
3037 return vmcb->control.tsc_offset + 3054 return vmcb->control.tsc_offset +
@@ -4305,6 +4322,10 @@ static void svm_handle_external_intr(struct kvm_vcpu *vcpu)
4305 local_irq_enable(); 4322 local_irq_enable();
4306} 4323}
4307 4324
4325static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu)
4326{
4327}
4328
4308static struct kvm_x86_ops svm_x86_ops = { 4329static struct kvm_x86_ops svm_x86_ops = {
4309 .cpu_has_kvm_support = has_svm, 4330 .cpu_has_kvm_support = has_svm,
4310 .disabled_by_bios = is_disabled, 4331 .disabled_by_bios = is_disabled,
@@ -4349,7 +4370,6 @@ static struct kvm_x86_ops svm_x86_ops = {
4349 .cache_reg = svm_cache_reg, 4370 .cache_reg = svm_cache_reg,
4350 .get_rflags = svm_get_rflags, 4371 .get_rflags = svm_get_rflags,
4351 .set_rflags = svm_set_rflags, 4372 .set_rflags = svm_set_rflags,
4352 .fpu_activate = svm_fpu_activate,
4353 .fpu_deactivate = svm_fpu_deactivate, 4373 .fpu_deactivate = svm_fpu_deactivate,
4354 4374
4355 .tlb_flush = svm_flush_tlb, 4375 .tlb_flush = svm_flush_tlb,
@@ -4406,6 +4426,8 @@ static struct kvm_x86_ops svm_x86_ops = {
4406 4426
4407 .check_intercept = svm_check_intercept, 4427 .check_intercept = svm_check_intercept,
4408 .handle_external_intr = svm_handle_external_intr, 4428 .handle_external_intr = svm_handle_external_intr,
4429
4430 .sched_in = svm_sched_in,
4409}; 4431};
4410 4432
4411static int __init svm_init(void) 4433static int __init svm_init(void)
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index e850a7d332be..6b06ab8748dd 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -415,15 +415,14 @@ TRACE_EVENT(kvm_apic_ipi,
415); 415);
416 416
417TRACE_EVENT(kvm_apic_accept_irq, 417TRACE_EVENT(kvm_apic_accept_irq,
418 TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec, bool coalesced), 418 TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec),
419 TP_ARGS(apicid, dm, tm, vec, coalesced), 419 TP_ARGS(apicid, dm, tm, vec),
420 420
421 TP_STRUCT__entry( 421 TP_STRUCT__entry(
422 __field( __u32, apicid ) 422 __field( __u32, apicid )
423 __field( __u16, dm ) 423 __field( __u16, dm )
424 __field( __u8, tm ) 424 __field( __u8, tm )
425 __field( __u8, vec ) 425 __field( __u8, vec )
426 __field( bool, coalesced )
427 ), 426 ),
428 427
429 TP_fast_assign( 428 TP_fast_assign(
@@ -431,14 +430,12 @@ TRACE_EVENT(kvm_apic_accept_irq,
431 __entry->dm = dm; 430 __entry->dm = dm;
432 __entry->tm = tm; 431 __entry->tm = tm;
433 __entry->vec = vec; 432 __entry->vec = vec;
434 __entry->coalesced = coalesced;
435 ), 433 ),
436 434
437 TP_printk("apicid %x vec %u (%s|%s)%s", 435 TP_printk("apicid %x vec %u (%s|%s)",
438 __entry->apicid, __entry->vec, 436 __entry->apicid, __entry->vec,
439 __print_symbolic((__entry->dm >> 8 & 0x7), kvm_deliver_mode), 437 __print_symbolic((__entry->dm >> 8 & 0x7), kvm_deliver_mode),
440 __entry->tm ? "level" : "edge", 438 __entry->tm ? "level" : "edge")
441 __entry->coalesced ? " (coalesced)" : "")
442); 439);
443 440
444TRACE_EVENT(kvm_eoi, 441TRACE_EVENT(kvm_eoi,
@@ -850,6 +847,36 @@ TRACE_EVENT(kvm_track_tsc,
850 847
851#endif /* CONFIG_X86_64 */ 848#endif /* CONFIG_X86_64 */
852 849
850TRACE_EVENT(kvm_ple_window,
851 TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old),
852 TP_ARGS(grow, vcpu_id, new, old),
853
854 TP_STRUCT__entry(
855 __field( bool, grow )
856 __field( unsigned int, vcpu_id )
857 __field( int, new )
858 __field( int, old )
859 ),
860
861 TP_fast_assign(
862 __entry->grow = grow;
863 __entry->vcpu_id = vcpu_id;
864 __entry->new = new;
865 __entry->old = old;
866 ),
867
868 TP_printk("vcpu %u: ple_window %d (%s %d)",
869 __entry->vcpu_id,
870 __entry->new,
871 __entry->grow ? "grow" : "shrink",
872 __entry->old)
873);
874
875#define trace_kvm_ple_window_grow(vcpu_id, new, old) \
876 trace_kvm_ple_window(true, vcpu_id, new, old)
877#define trace_kvm_ple_window_shrink(vcpu_id, new, old) \
878 trace_kvm_ple_window(false, vcpu_id, new, old)
879
853#endif /* _TRACE_KVM_H */ 880#endif /* _TRACE_KVM_H */
854 881
855#undef TRACE_INCLUDE_PATH 882#undef TRACE_INCLUDE_PATH
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bfe11cf124a1..04fa1b8298c8 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -125,14 +125,32 @@ module_param(nested, bool, S_IRUGO);
125 * Time is measured based on a counter that runs at the same rate as the TSC, 125 * Time is measured based on a counter that runs at the same rate as the TSC,
126 * refer SDM volume 3b section 21.6.13 & 22.1.3. 126 * refer SDM volume 3b section 21.6.13 & 22.1.3.
127 */ 127 */
128#define KVM_VMX_DEFAULT_PLE_GAP 128 128#define KVM_VMX_DEFAULT_PLE_GAP 128
129#define KVM_VMX_DEFAULT_PLE_WINDOW 4096 129#define KVM_VMX_DEFAULT_PLE_WINDOW 4096
130#define KVM_VMX_DEFAULT_PLE_WINDOW_GROW 2
131#define KVM_VMX_DEFAULT_PLE_WINDOW_SHRINK 0
132#define KVM_VMX_DEFAULT_PLE_WINDOW_MAX \
133 INT_MAX / KVM_VMX_DEFAULT_PLE_WINDOW_GROW
134
130static int ple_gap = KVM_VMX_DEFAULT_PLE_GAP; 135static int ple_gap = KVM_VMX_DEFAULT_PLE_GAP;
131module_param(ple_gap, int, S_IRUGO); 136module_param(ple_gap, int, S_IRUGO);
132 137
133static int ple_window = KVM_VMX_DEFAULT_PLE_WINDOW; 138static int ple_window = KVM_VMX_DEFAULT_PLE_WINDOW;
134module_param(ple_window, int, S_IRUGO); 139module_param(ple_window, int, S_IRUGO);
135 140
141/* Default doubles per-vcpu window every exit. */
142static int ple_window_grow = KVM_VMX_DEFAULT_PLE_WINDOW_GROW;
143module_param(ple_window_grow, int, S_IRUGO);
144
145/* Default resets per-vcpu window every exit to ple_window. */
146static int ple_window_shrink = KVM_VMX_DEFAULT_PLE_WINDOW_SHRINK;
147module_param(ple_window_shrink, int, S_IRUGO);
148
149/* Default is to compute the maximum so we can never overflow. */
150static int ple_window_actual_max = KVM_VMX_DEFAULT_PLE_WINDOW_MAX;
151static int ple_window_max = KVM_VMX_DEFAULT_PLE_WINDOW_MAX;
152module_param(ple_window_max, int, S_IRUGO);
153
136extern const ulong vmx_return; 154extern const ulong vmx_return;
137 155
138#define NR_AUTOLOAD_MSRS 8 156#define NR_AUTOLOAD_MSRS 8
@@ -379,6 +397,7 @@ struct nested_vmx {
379 * we must keep them pinned while L2 runs. 397 * we must keep them pinned while L2 runs.
380 */ 398 */
381 struct page *apic_access_page; 399 struct page *apic_access_page;
400 struct page *virtual_apic_page;
382 u64 msr_ia32_feature_control; 401 u64 msr_ia32_feature_control;
383 402
384 struct hrtimer preemption_timer; 403 struct hrtimer preemption_timer;
@@ -484,6 +503,10 @@ struct vcpu_vmx {
484 503
485 /* Support for a guest hypervisor (nested VMX) */ 504 /* Support for a guest hypervisor (nested VMX) */
486 struct nested_vmx nested; 505 struct nested_vmx nested;
506
507 /* Dynamic PLE window. */
508 int ple_window;
509 bool ple_window_dirty;
487}; 510};
488 511
489enum segment_cache_field { 512enum segment_cache_field {
@@ -533,6 +556,7 @@ static int max_shadow_read_only_fields =
533 ARRAY_SIZE(shadow_read_only_fields); 556 ARRAY_SIZE(shadow_read_only_fields);
534 557
535static unsigned long shadow_read_write_fields[] = { 558static unsigned long shadow_read_write_fields[] = {
559 TPR_THRESHOLD,
536 GUEST_RIP, 560 GUEST_RIP,
537 GUEST_RSP, 561 GUEST_RSP,
538 GUEST_CR0, 562 GUEST_CR0,
@@ -743,6 +767,7 @@ static u32 vmx_segment_access_rights(struct kvm_segment *var);
743static void vmx_sync_pir_to_irr_dummy(struct kvm_vcpu *vcpu); 767static void vmx_sync_pir_to_irr_dummy(struct kvm_vcpu *vcpu);
744static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx); 768static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx);
745static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx); 769static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx);
770static int alloc_identity_pagetable(struct kvm *kvm);
746 771
747static DEFINE_PER_CPU(struct vmcs *, vmxarea); 772static DEFINE_PER_CPU(struct vmcs *, vmxarea);
748static DEFINE_PER_CPU(struct vmcs *, current_vmcs); 773static DEFINE_PER_CPU(struct vmcs *, current_vmcs);
@@ -2135,7 +2160,7 @@ static u64 guest_read_tsc(void)
2135 * Like guest_read_tsc, but always returns L1's notion of the timestamp 2160 * Like guest_read_tsc, but always returns L1's notion of the timestamp
2136 * counter, even if a nested guest (L2) is currently running. 2161 * counter, even if a nested guest (L2) is currently running.
2137 */ 2162 */
2138u64 vmx_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc) 2163static u64 vmx_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc)
2139{ 2164{
2140 u64 tsc_offset; 2165 u64 tsc_offset;
2141 2166
@@ -2330,7 +2355,7 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2330 CPU_BASED_MOV_DR_EXITING | CPU_BASED_UNCOND_IO_EXITING | 2355 CPU_BASED_MOV_DR_EXITING | CPU_BASED_UNCOND_IO_EXITING |
2331 CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_EXITING | 2356 CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_EXITING |
2332 CPU_BASED_RDPMC_EXITING | CPU_BASED_RDTSC_EXITING | 2357 CPU_BASED_RDPMC_EXITING | CPU_BASED_RDTSC_EXITING |
2333 CPU_BASED_PAUSE_EXITING | 2358 CPU_BASED_PAUSE_EXITING | CPU_BASED_TPR_SHADOW |
2334 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS; 2359 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
2335 /* 2360 /*
2336 * We can allow some features even when not supported by the 2361 * We can allow some features even when not supported by the
@@ -2601,6 +2626,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2601 break; 2626 break;
2602 case MSR_IA32_CR_PAT: 2627 case MSR_IA32_CR_PAT:
2603 if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) { 2628 if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) {
2629 if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data))
2630 return 1;
2604 vmcs_write64(GUEST_IA32_PAT, data); 2631 vmcs_write64(GUEST_IA32_PAT, data);
2605 vcpu->arch.pat = data; 2632 vcpu->arch.pat = data;
2606 break; 2633 break;
@@ -2704,7 +2731,7 @@ static void kvm_cpu_vmxon(u64 addr)
2704 : "memory", "cc"); 2731 : "memory", "cc");
2705} 2732}
2706 2733
2707static int hardware_enable(void *garbage) 2734static int hardware_enable(void)
2708{ 2735{
2709 int cpu = raw_smp_processor_id(); 2736 int cpu = raw_smp_processor_id();
2710 u64 phys_addr = __pa(per_cpu(vmxarea, cpu)); 2737 u64 phys_addr = __pa(per_cpu(vmxarea, cpu));
@@ -2768,7 +2795,7 @@ static void kvm_cpu_vmxoff(void)
2768 asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc"); 2795 asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc");
2769} 2796}
2770 2797
2771static void hardware_disable(void *garbage) 2798static void hardware_disable(void)
2772{ 2799{
2773 if (vmm_exclusive) { 2800 if (vmm_exclusive) {
2774 vmclear_local_loaded_vmcss(); 2801 vmclear_local_loaded_vmcss();
@@ -3107,9 +3134,17 @@ static __init int hardware_setup(void)
3107 if (!cpu_has_vmx_unrestricted_guest()) 3134 if (!cpu_has_vmx_unrestricted_guest())
3108 enable_unrestricted_guest = 0; 3135 enable_unrestricted_guest = 0;
3109 3136
3110 if (!cpu_has_vmx_flexpriority()) 3137 if (!cpu_has_vmx_flexpriority()) {
3111 flexpriority_enabled = 0; 3138 flexpriority_enabled = 0;
3112 3139
3140 /*
3141 * set_apic_access_page_addr() is used to reload apic access
3142 * page upon invalidation. No need to do anything if the
3143 * processor does not have the APIC_ACCESS_ADDR VMCS field.
3144 */
3145 kvm_x86_ops->set_apic_access_page_addr = NULL;
3146 }
3147
3113 if (!cpu_has_vmx_tpr_shadow()) 3148 if (!cpu_has_vmx_tpr_shadow())
3114 kvm_x86_ops->update_cr8_intercept = NULL; 3149 kvm_x86_ops->update_cr8_intercept = NULL;
3115 3150
@@ -3905,7 +3940,7 @@ static int init_rmode_tss(struct kvm *kvm)
3905{ 3940{
3906 gfn_t fn; 3941 gfn_t fn;
3907 u16 data = 0; 3942 u16 data = 0;
3908 int r, idx, ret = 0; 3943 int idx, r;
3909 3944
3910 idx = srcu_read_lock(&kvm->srcu); 3945 idx = srcu_read_lock(&kvm->srcu);
3911 fn = kvm->arch.tss_addr >> PAGE_SHIFT; 3946 fn = kvm->arch.tss_addr >> PAGE_SHIFT;
@@ -3927,32 +3962,32 @@ static int init_rmode_tss(struct kvm *kvm)
3927 r = kvm_write_guest_page(kvm, fn, &data, 3962 r = kvm_write_guest_page(kvm, fn, &data,
3928 RMODE_TSS_SIZE - 2 * PAGE_SIZE - 1, 3963 RMODE_TSS_SIZE - 2 * PAGE_SIZE - 1,
3929 sizeof(u8)); 3964 sizeof(u8));
3930 if (r < 0)
3931 goto out;
3932
3933 ret = 1;
3934out: 3965out:
3935 srcu_read_unlock(&kvm->srcu, idx); 3966 srcu_read_unlock(&kvm->srcu, idx);
3936 return ret; 3967 return r;
3937} 3968}
3938 3969
3939static int init_rmode_identity_map(struct kvm *kvm) 3970static int init_rmode_identity_map(struct kvm *kvm)
3940{ 3971{
3941 int i, idx, r, ret; 3972 int i, idx, r = 0;
3942 pfn_t identity_map_pfn; 3973 pfn_t identity_map_pfn;
3943 u32 tmp; 3974 u32 tmp;
3944 3975
3945 if (!enable_ept) 3976 if (!enable_ept)
3946 return 1;
3947 if (unlikely(!kvm->arch.ept_identity_pagetable)) {
3948 printk(KERN_ERR "EPT: identity-mapping pagetable "
3949 "haven't been allocated!\n");
3950 return 0; 3977 return 0;
3951 } 3978
3979 /* Protect kvm->arch.ept_identity_pagetable_done. */
3980 mutex_lock(&kvm->slots_lock);
3981
3952 if (likely(kvm->arch.ept_identity_pagetable_done)) 3982 if (likely(kvm->arch.ept_identity_pagetable_done))
3953 return 1; 3983 goto out2;
3954 ret = 0; 3984
3955 identity_map_pfn = kvm->arch.ept_identity_map_addr >> PAGE_SHIFT; 3985 identity_map_pfn = kvm->arch.ept_identity_map_addr >> PAGE_SHIFT;
3986
3987 r = alloc_identity_pagetable(kvm);
3988 if (r < 0)
3989 goto out2;
3990
3956 idx = srcu_read_lock(&kvm->srcu); 3991 idx = srcu_read_lock(&kvm->srcu);
3957 r = kvm_clear_guest_page(kvm, identity_map_pfn, 0, PAGE_SIZE); 3992 r = kvm_clear_guest_page(kvm, identity_map_pfn, 0, PAGE_SIZE);
3958 if (r < 0) 3993 if (r < 0)
@@ -3967,10 +4002,13 @@ static int init_rmode_identity_map(struct kvm *kvm)
3967 goto out; 4002 goto out;
3968 } 4003 }
3969 kvm->arch.ept_identity_pagetable_done = true; 4004 kvm->arch.ept_identity_pagetable_done = true;
3970 ret = 1; 4005
3971out: 4006out:
3972 srcu_read_unlock(&kvm->srcu, idx); 4007 srcu_read_unlock(&kvm->srcu, idx);
3973 return ret; 4008
4009out2:
4010 mutex_unlock(&kvm->slots_lock);
4011 return r;
3974} 4012}
3975 4013
3976static void seg_setup(int seg) 4014static void seg_setup(int seg)
@@ -3995,23 +4033,28 @@ static int alloc_apic_access_page(struct kvm *kvm)
3995 int r = 0; 4033 int r = 0;
3996 4034
3997 mutex_lock(&kvm->slots_lock); 4035 mutex_lock(&kvm->slots_lock);
3998 if (kvm->arch.apic_access_page) 4036 if (kvm->arch.apic_access_page_done)
3999 goto out; 4037 goto out;
4000 kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT; 4038 kvm_userspace_mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT;
4001 kvm_userspace_mem.flags = 0; 4039 kvm_userspace_mem.flags = 0;
4002 kvm_userspace_mem.guest_phys_addr = 0xfee00000ULL; 4040 kvm_userspace_mem.guest_phys_addr = APIC_DEFAULT_PHYS_BASE;
4003 kvm_userspace_mem.memory_size = PAGE_SIZE; 4041 kvm_userspace_mem.memory_size = PAGE_SIZE;
4004 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem); 4042 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem);
4005 if (r) 4043 if (r)
4006 goto out; 4044 goto out;
4007 4045
4008 page = gfn_to_page(kvm, 0xfee00); 4046 page = gfn_to_page(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT);
4009 if (is_error_page(page)) { 4047 if (is_error_page(page)) {
4010 r = -EFAULT; 4048 r = -EFAULT;
4011 goto out; 4049 goto out;
4012 } 4050 }
4013 4051
4014 kvm->arch.apic_access_page = page; 4052 /*
4053 * Do not pin the page in memory, so that memory hot-unplug
4054 * is able to migrate it.
4055 */
4056 put_page(page);
4057 kvm->arch.apic_access_page_done = true;
4015out: 4058out:
4016 mutex_unlock(&kvm->slots_lock); 4059 mutex_unlock(&kvm->slots_lock);
4017 return r; 4060 return r;
@@ -4019,31 +4062,20 @@ out:
4019 4062
4020static int alloc_identity_pagetable(struct kvm *kvm) 4063static int alloc_identity_pagetable(struct kvm *kvm)
4021{ 4064{
4022 struct page *page; 4065 /* Called with kvm->slots_lock held. */
4066
4023 struct kvm_userspace_memory_region kvm_userspace_mem; 4067 struct kvm_userspace_memory_region kvm_userspace_mem;
4024 int r = 0; 4068 int r = 0;
4025 4069
4026 mutex_lock(&kvm->slots_lock); 4070 BUG_ON(kvm->arch.ept_identity_pagetable_done);
4027 if (kvm->arch.ept_identity_pagetable) 4071
4028 goto out;
4029 kvm_userspace_mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT; 4072 kvm_userspace_mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT;
4030 kvm_userspace_mem.flags = 0; 4073 kvm_userspace_mem.flags = 0;
4031 kvm_userspace_mem.guest_phys_addr = 4074 kvm_userspace_mem.guest_phys_addr =
4032 kvm->arch.ept_identity_map_addr; 4075 kvm->arch.ept_identity_map_addr;
4033 kvm_userspace_mem.memory_size = PAGE_SIZE; 4076 kvm_userspace_mem.memory_size = PAGE_SIZE;
4034 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem); 4077 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem);
4035 if (r)
4036 goto out;
4037
4038 page = gfn_to_page(kvm, kvm->arch.ept_identity_map_addr >> PAGE_SHIFT);
4039 if (is_error_page(page)) {
4040 r = -EFAULT;
4041 goto out;
4042 }
4043 4078
4044 kvm->arch.ept_identity_pagetable = page;
4045out:
4046 mutex_unlock(&kvm->slots_lock);
4047 return r; 4079 return r;
4048} 4080}
4049 4081
@@ -4402,7 +4434,8 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
4402 4434
4403 if (ple_gap) { 4435 if (ple_gap) {
4404 vmcs_write32(PLE_GAP, ple_gap); 4436 vmcs_write32(PLE_GAP, ple_gap);
4405 vmcs_write32(PLE_WINDOW, ple_window); 4437 vmx->ple_window = ple_window;
4438 vmx->ple_window_dirty = true;
4406 } 4439 }
4407 4440
4408 vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, 0); 4441 vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, 0);
@@ -4477,7 +4510,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4477 4510
4478 vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val(); 4511 vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val();
4479 kvm_set_cr8(&vmx->vcpu, 0); 4512 kvm_set_cr8(&vmx->vcpu, 0);
4480 apic_base_msr.data = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; 4513 apic_base_msr.data = APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE;
4481 if (kvm_vcpu_is_bsp(&vmx->vcpu)) 4514 if (kvm_vcpu_is_bsp(&vmx->vcpu))
4482 apic_base_msr.data |= MSR_IA32_APICBASE_BSP; 4515 apic_base_msr.data |= MSR_IA32_APICBASE_BSP;
4483 apic_base_msr.host_initiated = true; 4516 apic_base_msr.host_initiated = true;
@@ -4537,9 +4570,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4537 vmcs_write32(TPR_THRESHOLD, 0); 4570 vmcs_write32(TPR_THRESHOLD, 0);
4538 } 4571 }
4539 4572
4540 if (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm)) 4573 kvm_vcpu_reload_apic_access_page(vcpu);
4541 vmcs_write64(APIC_ACCESS_ADDR,
4542 page_to_phys(vmx->vcpu.kvm->arch.apic_access_page));
4543 4574
4544 if (vmx_vm_has_apicv(vcpu->kvm)) 4575 if (vmx_vm_has_apicv(vcpu->kvm))
4545 memset(&vmx->pi_desc, 0, sizeof(struct pi_desc)); 4576 memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));
@@ -4729,10 +4760,7 @@ static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr)
4729 if (ret) 4760 if (ret)
4730 return ret; 4761 return ret;
4731 kvm->arch.tss_addr = addr; 4762 kvm->arch.tss_addr = addr;
4732 if (!init_rmode_tss(kvm)) 4763 return init_rmode_tss(kvm);
4733 return -ENOMEM;
4734
4735 return 0;
4736} 4764}
4737 4765
4738static bool rmode_exception(struct kvm_vcpu *vcpu, int vec) 4766static bool rmode_exception(struct kvm_vcpu *vcpu, int vec)
@@ -5521,17 +5549,18 @@ static u64 ept_rsvd_mask(u64 spte, int level)
5521 for (i = 51; i > boot_cpu_data.x86_phys_bits; i--) 5549 for (i = 51; i > boot_cpu_data.x86_phys_bits; i--)
5522 mask |= (1ULL << i); 5550 mask |= (1ULL << i);
5523 5551
5524 if (level > 2) 5552 if (level == 4)
5525 /* bits 7:3 reserved */ 5553 /* bits 7:3 reserved */
5526 mask |= 0xf8; 5554 mask |= 0xf8;
5527 else if (level == 2) { 5555 else if (spte & (1ULL << 7))
5528 if (spte & (1ULL << 7)) 5556 /*
5529 /* 2MB ref, bits 20:12 reserved */ 5557 * 1GB/2MB page, bits 29:12 or 20:12 reserved respectively,
5530 mask |= 0x1ff000; 5558 * level == 1 if the hypervisor is using the ignored bit 7.
5531 else 5559 */
5532 /* bits 6:3 reserved */ 5560 mask |= (PAGE_SIZE << ((level - 1) * 9)) - PAGE_SIZE;
5533 mask |= 0x78; 5561 else if (level > 1)
5534 } 5562 /* bits 6:3 reserved */
5563 mask |= 0x78;
5535 5564
5536 return mask; 5565 return mask;
5537} 5566}
@@ -5561,7 +5590,8 @@ static void ept_misconfig_inspect_spte(struct kvm_vcpu *vcpu, u64 spte,
5561 WARN_ON(1); 5590 WARN_ON(1);
5562 } 5591 }
5563 5592
5564 if (level == 1 || (level == 2 && (spte & (1ULL << 7)))) { 5593 /* bits 5:3 are _not_ reserved for large page or leaf page */
5594 if ((rsvd_bits & 0x38) == 0) {
5565 u64 ept_mem_type = (spte & 0x38) >> 3; 5595 u64 ept_mem_type = (spte & 0x38) >> 3;
5566 5596
5567 if (ept_mem_type == 2 || ept_mem_type == 3 || 5597 if (ept_mem_type == 2 || ept_mem_type == 3 ||
@@ -5676,12 +5706,85 @@ out:
5676 return ret; 5706 return ret;
5677} 5707}
5678 5708
5709static int __grow_ple_window(int val)
5710{
5711 if (ple_window_grow < 1)
5712 return ple_window;
5713
5714 val = min(val, ple_window_actual_max);
5715
5716 if (ple_window_grow < ple_window)
5717 val *= ple_window_grow;
5718 else
5719 val += ple_window_grow;
5720
5721 return val;
5722}
5723
5724static int __shrink_ple_window(int val, int modifier, int minimum)
5725{
5726 if (modifier < 1)
5727 return ple_window;
5728
5729 if (modifier < ple_window)
5730 val /= modifier;
5731 else
5732 val -= modifier;
5733
5734 return max(val, minimum);
5735}
5736
5737static void grow_ple_window(struct kvm_vcpu *vcpu)
5738{
5739 struct vcpu_vmx *vmx = to_vmx(vcpu);
5740 int old = vmx->ple_window;
5741
5742 vmx->ple_window = __grow_ple_window(old);
5743
5744 if (vmx->ple_window != old)
5745 vmx->ple_window_dirty = true;
5746
5747 trace_kvm_ple_window_grow(vcpu->vcpu_id, vmx->ple_window, old);
5748}
5749
5750static void shrink_ple_window(struct kvm_vcpu *vcpu)
5751{
5752 struct vcpu_vmx *vmx = to_vmx(vcpu);
5753 int old = vmx->ple_window;
5754
5755 vmx->ple_window = __shrink_ple_window(old,
5756 ple_window_shrink, ple_window);
5757
5758 if (vmx->ple_window != old)
5759 vmx->ple_window_dirty = true;
5760
5761 trace_kvm_ple_window_shrink(vcpu->vcpu_id, vmx->ple_window, old);
5762}
5763
5764/*
5765 * ple_window_actual_max is computed to be one grow_ple_window() below
5766 * ple_window_max. (See __grow_ple_window for the reason.)
5767 * This prevents overflows, because ple_window_max is int.
5768 * ple_window_max effectively rounded down to a multiple of ple_window_grow in
5769 * this process.
5770 * ple_window_max is also prevented from setting vmx->ple_window < ple_window.
5771 */
5772static void update_ple_window_actual_max(void)
5773{
5774 ple_window_actual_max =
5775 __shrink_ple_window(max(ple_window_max, ple_window),
5776 ple_window_grow, INT_MIN);
5777}
5778
5679/* 5779/*
5680 * Indicate a busy-waiting vcpu in spinlock. We do not enable the PAUSE 5780 * Indicate a busy-waiting vcpu in spinlock. We do not enable the PAUSE
5681 * exiting, so only get here on cpu with PAUSE-Loop-Exiting. 5781 * exiting, so only get here on cpu with PAUSE-Loop-Exiting.
5682 */ 5782 */
5683static int handle_pause(struct kvm_vcpu *vcpu) 5783static int handle_pause(struct kvm_vcpu *vcpu)
5684{ 5784{
5785 if (ple_gap)
5786 grow_ple_window(vcpu);
5787
5685 skip_emulated_instruction(vcpu); 5788 skip_emulated_instruction(vcpu);
5686 kvm_vcpu_on_spin(vcpu); 5789 kvm_vcpu_on_spin(vcpu);
5687 5790
@@ -6146,7 +6249,11 @@ static void free_nested(struct vcpu_vmx *vmx)
6146 /* Unpin physical memory we referred to in current vmcs02 */ 6249 /* Unpin physical memory we referred to in current vmcs02 */
6147 if (vmx->nested.apic_access_page) { 6250 if (vmx->nested.apic_access_page) {
6148 nested_release_page(vmx->nested.apic_access_page); 6251 nested_release_page(vmx->nested.apic_access_page);
6149 vmx->nested.apic_access_page = 0; 6252 vmx->nested.apic_access_page = NULL;
6253 }
6254 if (vmx->nested.virtual_apic_page) {
6255 nested_release_page(vmx->nested.virtual_apic_page);
6256 vmx->nested.virtual_apic_page = NULL;
6150 } 6257 }
6151 6258
6152 nested_free_all_saved_vmcss(vmx); 6259 nested_free_all_saved_vmcss(vmx);
@@ -6617,7 +6724,7 @@ static int handle_invept(struct kvm_vcpu *vcpu)
6617 switch (type) { 6724 switch (type) {
6618 case VMX_EPT_EXTENT_GLOBAL: 6725 case VMX_EPT_EXTENT_GLOBAL:
6619 kvm_mmu_sync_roots(vcpu); 6726 kvm_mmu_sync_roots(vcpu);
6620 kvm_mmu_flush_tlb(vcpu); 6727 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
6621 nested_vmx_succeed(vcpu); 6728 nested_vmx_succeed(vcpu);
6622 break; 6729 break;
6623 default: 6730 default:
@@ -6892,6 +6999,8 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
6892 case EXIT_REASON_TASK_SWITCH: 6999 case EXIT_REASON_TASK_SWITCH:
6893 return 1; 7000 return 1;
6894 case EXIT_REASON_CPUID: 7001 case EXIT_REASON_CPUID:
7002 if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa)
7003 return 0;
6895 return 1; 7004 return 1;
6896 case EXIT_REASON_HLT: 7005 case EXIT_REASON_HLT:
6897 return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING); 7006 return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING);
@@ -6936,7 +7045,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
6936 case EXIT_REASON_MCE_DURING_VMENTRY: 7045 case EXIT_REASON_MCE_DURING_VMENTRY:
6937 return 0; 7046 return 0;
6938 case EXIT_REASON_TPR_BELOW_THRESHOLD: 7047 case EXIT_REASON_TPR_BELOW_THRESHOLD:
6939 return 1; 7048 return nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW);
6940 case EXIT_REASON_APIC_ACCESS: 7049 case EXIT_REASON_APIC_ACCESS:
6941 return nested_cpu_has2(vmcs12, 7050 return nested_cpu_has2(vmcs12,
6942 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); 7051 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES);
@@ -7057,6 +7166,12 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
7057 7166
7058static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) 7167static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
7059{ 7168{
7169 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
7170
7171 if (is_guest_mode(vcpu) &&
7172 nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW))
7173 return;
7174
7060 if (irr == -1 || tpr < irr) { 7175 if (irr == -1 || tpr < irr) {
7061 vmcs_write32(TPR_THRESHOLD, 0); 7176 vmcs_write32(TPR_THRESHOLD, 0);
7062 return; 7177 return;
@@ -7094,6 +7209,29 @@ static void vmx_set_virtual_x2apic_mode(struct kvm_vcpu *vcpu, bool set)
7094 vmx_set_msr_bitmap(vcpu); 7209 vmx_set_msr_bitmap(vcpu);
7095} 7210}
7096 7211
7212static void vmx_set_apic_access_page_addr(struct kvm_vcpu *vcpu, hpa_t hpa)
7213{
7214 struct vcpu_vmx *vmx = to_vmx(vcpu);
7215
7216 /*
7217 * Currently we do not handle the nested case where L2 has an
7218 * APIC access page of its own; that page is still pinned.
7219 * Hence, we skip the case where the VCPU is in guest mode _and_
7220 * L1 prepared an APIC access page for L2.
7221 *
7222 * For the case where L1 and L2 share the same APIC access page
7223 * (flexpriority=Y but SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES clear
7224 * in the vmcs12), this function will only update either the vmcs01
7225 * or the vmcs02. If the former, the vmcs02 will be updated by
7226 * prepare_vmcs02. If the latter, the vmcs01 will be updated in
7227 * the next L2->L1 exit.
7228 */
7229 if (!is_guest_mode(vcpu) ||
7230 !nested_cpu_has2(vmx->nested.current_vmcs12,
7231 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
7232 vmcs_write64(APIC_ACCESS_ADDR, hpa);
7233}
7234
7097static void vmx_hwapic_isr_update(struct kvm *kvm, int isr) 7235static void vmx_hwapic_isr_update(struct kvm *kvm, int isr)
7098{ 7236{
7099 u16 status; 7237 u16 status;
@@ -7387,6 +7525,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
7387 if (vmx->emulation_required) 7525 if (vmx->emulation_required)
7388 return; 7526 return;
7389 7527
7528 if (vmx->ple_window_dirty) {
7529 vmx->ple_window_dirty = false;
7530 vmcs_write32(PLE_WINDOW, vmx->ple_window);
7531 }
7532
7390 if (vmx->nested.sync_shadow_vmcs) { 7533 if (vmx->nested.sync_shadow_vmcs) {
7391 copy_vmcs12_to_shadow(vmx); 7534 copy_vmcs12_to_shadow(vmx);
7392 vmx->nested.sync_shadow_vmcs = false; 7535 vmx->nested.sync_shadow_vmcs = false;
@@ -7642,10 +7785,8 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
7642 if (!kvm->arch.ept_identity_map_addr) 7785 if (!kvm->arch.ept_identity_map_addr)
7643 kvm->arch.ept_identity_map_addr = 7786 kvm->arch.ept_identity_map_addr =
7644 VMX_EPT_IDENTITY_PAGETABLE_ADDR; 7787 VMX_EPT_IDENTITY_PAGETABLE_ADDR;
7645 err = -ENOMEM; 7788 err = init_rmode_identity_map(kvm);
7646 if (alloc_identity_pagetable(kvm) != 0) 7789 if (err)
7647 goto free_vmcs;
7648 if (!init_rmode_identity_map(kvm))
7649 goto free_vmcs; 7790 goto free_vmcs;
7650 } 7791 }
7651 7792
@@ -7824,6 +7965,55 @@ static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu,
7824 kvm_inject_page_fault(vcpu, fault); 7965 kvm_inject_page_fault(vcpu, fault);
7825} 7966}
7826 7967
7968static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu,
7969 struct vmcs12 *vmcs12)
7970{
7971 struct vcpu_vmx *vmx = to_vmx(vcpu);
7972
7973 if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) {
7974 /* TODO: Also verify bits beyond physical address width are 0 */
7975 if (!PAGE_ALIGNED(vmcs12->apic_access_addr))
7976 return false;
7977
7978 /*
7979 * Translate L1 physical address to host physical
7980 * address for vmcs02. Keep the page pinned, so this
7981 * physical address remains valid. We keep a reference
7982 * to it so we can release it later.
7983 */
7984 if (vmx->nested.apic_access_page) /* shouldn't happen */
7985 nested_release_page(vmx->nested.apic_access_page);
7986 vmx->nested.apic_access_page =
7987 nested_get_page(vcpu, vmcs12->apic_access_addr);
7988 }
7989
7990 if (nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW)) {
7991 /* TODO: Also verify bits beyond physical address width are 0 */
7992 if (!PAGE_ALIGNED(vmcs12->virtual_apic_page_addr))
7993 return false;
7994
7995 if (vmx->nested.virtual_apic_page) /* shouldn't happen */
7996 nested_release_page(vmx->nested.virtual_apic_page);
7997 vmx->nested.virtual_apic_page =
7998 nested_get_page(vcpu, vmcs12->virtual_apic_page_addr);
7999
8000 /*
8001 * Failing the vm entry is _not_ what the processor does
8002 * but it's basically the only possibility we have.
8003 * We could still enter the guest if CR8 load exits are
8004 * enabled, CR8 store exits are enabled, and virtualize APIC
8005 * access is disabled; in this case the processor would never
8006 * use the TPR shadow and we could simply clear the bit from
8007 * the execution control. But such a configuration is useless,
8008 * so let's keep the code simple.
8009 */
8010 if (!vmx->nested.virtual_apic_page)
8011 return false;
8012 }
8013
8014 return true;
8015}
8016
7827static void vmx_start_preemption_timer(struct kvm_vcpu *vcpu) 8017static void vmx_start_preemption_timer(struct kvm_vcpu *vcpu)
7828{ 8018{
7829 u64 preemption_timeout = get_vmcs12(vcpu)->vmx_preemption_timer_value; 8019 u64 preemption_timeout = get_vmcs12(vcpu)->vmx_preemption_timer_value;
@@ -7849,7 +8039,7 @@ static void vmx_start_preemption_timer(struct kvm_vcpu *vcpu)
7849/* 8039/*
7850 * prepare_vmcs02 is called when the L1 guest hypervisor runs its nested 8040 * prepare_vmcs02 is called when the L1 guest hypervisor runs its nested
7851 * L2 guest. L1 has a vmcs for L2 (vmcs12), and this function "merges" it 8041 * L2 guest. L1 has a vmcs for L2 (vmcs12), and this function "merges" it
7852 * with L0's requirements for its guest (a.k.a. vmsc01), so we can run the L2 8042 * with L0's requirements for its guest (a.k.a. vmcs01), so we can run the L2
7853 * guest in a way that will both be appropriate to L1's requests, and our 8043 * guest in a way that will both be appropriate to L1's requests, and our
7854 * needs. In addition to modifying the active vmcs (which is vmcs02), this 8044 * needs. In addition to modifying the active vmcs (which is vmcs02), this
7855 * function also has additional necessary side-effects, like setting various 8045 * function also has additional necessary side-effects, like setting various
@@ -7970,16 +8160,6 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7970 8160
7971 if (exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES) { 8161 if (exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES) {
7972 /* 8162 /*
7973 * Translate L1 physical address to host physical
7974 * address for vmcs02. Keep the page pinned, so this
7975 * physical address remains valid. We keep a reference
7976 * to it so we can release it later.
7977 */
7978 if (vmx->nested.apic_access_page) /* shouldn't happen */
7979 nested_release_page(vmx->nested.apic_access_page);
7980 vmx->nested.apic_access_page =
7981 nested_get_page(vcpu, vmcs12->apic_access_addr);
7982 /*
7983 * If translation failed, no matter: This feature asks 8163 * If translation failed, no matter: This feature asks
7984 * to exit when accessing the given address, and if it 8164 * to exit when accessing the given address, and if it
7985 * can never be accessed, this feature won't do 8165 * can never be accessed, this feature won't do
@@ -7994,8 +8174,7 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7994 } else if (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm)) { 8174 } else if (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm)) {
7995 exec_control |= 8175 exec_control |=
7996 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; 8176 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
7997 vmcs_write64(APIC_ACCESS_ADDR, 8177 kvm_vcpu_reload_apic_access_page(vcpu);
7998 page_to_phys(vcpu->kvm->arch.apic_access_page));
7999 } 8178 }
8000 8179
8001 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control); 8180 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
@@ -8024,6 +8203,13 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
8024 exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING; 8203 exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING;
8025 exec_control &= ~CPU_BASED_TPR_SHADOW; 8204 exec_control &= ~CPU_BASED_TPR_SHADOW;
8026 exec_control |= vmcs12->cpu_based_vm_exec_control; 8205 exec_control |= vmcs12->cpu_based_vm_exec_control;
8206
8207 if (exec_control & CPU_BASED_TPR_SHADOW) {
8208 vmcs_write64(VIRTUAL_APIC_PAGE_ADDR,
8209 page_to_phys(vmx->nested.virtual_apic_page));
8210 vmcs_write32(TPR_THRESHOLD, vmcs12->tpr_threshold);
8211 }
8212
8027 /* 8213 /*
8028 * Merging of IO and MSR bitmaps not currently supported. 8214 * Merging of IO and MSR bitmaps not currently supported.
8029 * Rather, exit every time. 8215 * Rather, exit every time.
@@ -8185,8 +8371,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
8185 return 1; 8371 return 1;
8186 } 8372 }
8187 8373
8188 if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES) && 8374 if (!nested_get_vmcs12_pages(vcpu, vmcs12)) {
8189 !PAGE_ALIGNED(vmcs12->apic_access_addr)) {
8190 /*TODO: Also verify bits beyond physical address width are 0*/ 8375 /*TODO: Also verify bits beyond physical address width are 0*/
8191 nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD); 8376 nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD);
8192 return 1; 8377 return 1;
@@ -8790,10 +8975,20 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
8790 /* Unpin physical memory we referred to in vmcs02 */ 8975 /* Unpin physical memory we referred to in vmcs02 */
8791 if (vmx->nested.apic_access_page) { 8976 if (vmx->nested.apic_access_page) {
8792 nested_release_page(vmx->nested.apic_access_page); 8977 nested_release_page(vmx->nested.apic_access_page);
8793 vmx->nested.apic_access_page = 0; 8978 vmx->nested.apic_access_page = NULL;
8979 }
8980 if (vmx->nested.virtual_apic_page) {
8981 nested_release_page(vmx->nested.virtual_apic_page);
8982 vmx->nested.virtual_apic_page = NULL;
8794 } 8983 }
8795 8984
8796 /* 8985 /*
8986 * We are now running in L2, mmu_notifier will force to reload the
8987 * page's hpa for L2 vmcs. Need to reload it for L1 before entering L1.
8988 */
8989 kvm_vcpu_reload_apic_access_page(vcpu);
8990
8991 /*
8797 * Exiting from L2 to L1, we're now back to L1 which thinks it just 8992 * Exiting from L2 to L1, we're now back to L1 which thinks it just
8798 * finished a VMLAUNCH or VMRESUME instruction, so we need to set the 8993 * finished a VMLAUNCH or VMRESUME instruction, so we need to set the
8799 * success or failure flag accordingly. 8994 * success or failure flag accordingly.
@@ -8846,6 +9041,12 @@ static int vmx_check_intercept(struct kvm_vcpu *vcpu,
8846 return X86EMUL_CONTINUE; 9041 return X86EMUL_CONTINUE;
8847} 9042}
8848 9043
9044static void vmx_sched_in(struct kvm_vcpu *vcpu, int cpu)
9045{
9046 if (ple_gap)
9047 shrink_ple_window(vcpu);
9048}
9049
8849static struct kvm_x86_ops vmx_x86_ops = { 9050static struct kvm_x86_ops vmx_x86_ops = {
8850 .cpu_has_kvm_support = cpu_has_kvm_support, 9051 .cpu_has_kvm_support = cpu_has_kvm_support,
8851 .disabled_by_bios = vmx_disabled_by_bios, 9052 .disabled_by_bios = vmx_disabled_by_bios,
@@ -8890,7 +9091,6 @@ static struct kvm_x86_ops vmx_x86_ops = {
8890 .cache_reg = vmx_cache_reg, 9091 .cache_reg = vmx_cache_reg,
8891 .get_rflags = vmx_get_rflags, 9092 .get_rflags = vmx_get_rflags,
8892 .set_rflags = vmx_set_rflags, 9093 .set_rflags = vmx_set_rflags,
8893 .fpu_activate = vmx_fpu_activate,
8894 .fpu_deactivate = vmx_fpu_deactivate, 9094 .fpu_deactivate = vmx_fpu_deactivate,
8895 9095
8896 .tlb_flush = vmx_flush_tlb, 9096 .tlb_flush = vmx_flush_tlb,
@@ -8913,6 +9113,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
8913 .enable_irq_window = enable_irq_window, 9113 .enable_irq_window = enable_irq_window,
8914 .update_cr8_intercept = update_cr8_intercept, 9114 .update_cr8_intercept = update_cr8_intercept,
8915 .set_virtual_x2apic_mode = vmx_set_virtual_x2apic_mode, 9115 .set_virtual_x2apic_mode = vmx_set_virtual_x2apic_mode,
9116 .set_apic_access_page_addr = vmx_set_apic_access_page_addr,
8916 .vm_has_apicv = vmx_vm_has_apicv, 9117 .vm_has_apicv = vmx_vm_has_apicv,
8917 .load_eoi_exitmap = vmx_load_eoi_exitmap, 9118 .load_eoi_exitmap = vmx_load_eoi_exitmap,
8918 .hwapic_irr_update = vmx_hwapic_irr_update, 9119 .hwapic_irr_update = vmx_hwapic_irr_update,
@@ -8951,6 +9152,8 @@ static struct kvm_x86_ops vmx_x86_ops = {
8951 .mpx_supported = vmx_mpx_supported, 9152 .mpx_supported = vmx_mpx_supported,
8952 9153
8953 .check_nested_events = vmx_check_nested_events, 9154 .check_nested_events = vmx_check_nested_events,
9155
9156 .sched_in = vmx_sched_in,
8954}; 9157};
8955 9158
8956static int __init vmx_init(void) 9159static int __init vmx_init(void)
@@ -9065,6 +9268,8 @@ static int __init vmx_init(void)
9065 } else 9268 } else
9066 kvm_disable_tdp(); 9269 kvm_disable_tdp();
9067 9270
9271 update_ple_window_actual_max();
9272
9068 return 0; 9273 return 0;
9069 9274
9070out7: 9275out7:
@@ -9098,7 +9303,7 @@ static void __exit vmx_exit(void)
9098 free_page((unsigned long)vmx_vmread_bitmap); 9303 free_page((unsigned long)vmx_vmread_bitmap);
9099 9304
9100#ifdef CONFIG_KEXEC 9305#ifdef CONFIG_KEXEC
9101 rcu_assign_pointer(crash_vmclear_loaded_vmcss, NULL); 9306 RCU_INIT_POINTER(crash_vmclear_loaded_vmcss, NULL);
9102 synchronize_rcu(); 9307 synchronize_rcu();
9103#endif 9308#endif
9104 9309
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8f1e22d3b286..5430e4b0af29 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -246,7 +246,7 @@ void kvm_set_shared_msr(unsigned slot, u64 value, u64 mask)
246} 246}
247EXPORT_SYMBOL_GPL(kvm_set_shared_msr); 247EXPORT_SYMBOL_GPL(kvm_set_shared_msr);
248 248
249static void drop_user_return_notifiers(void *ignore) 249static void drop_user_return_notifiers(void)
250{ 250{
251 unsigned int cpu = smp_processor_id(); 251 unsigned int cpu = smp_processor_id();
252 struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu); 252 struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu);
@@ -408,12 +408,14 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault)
408} 408}
409EXPORT_SYMBOL_GPL(kvm_inject_page_fault); 409EXPORT_SYMBOL_GPL(kvm_inject_page_fault);
410 410
411void kvm_propagate_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault) 411static bool kvm_propagate_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault)
412{ 412{
413 if (mmu_is_nested(vcpu) && !fault->nested_page_fault) 413 if (mmu_is_nested(vcpu) && !fault->nested_page_fault)
414 vcpu->arch.nested_mmu.inject_page_fault(vcpu, fault); 414 vcpu->arch.nested_mmu.inject_page_fault(vcpu, fault);
415 else 415 else
416 vcpu->arch.mmu.inject_page_fault(vcpu, fault); 416 vcpu->arch.mmu.inject_page_fault(vcpu, fault);
417
418 return fault->nested_page_fault;
417} 419}
418 420
419void kvm_inject_nmi(struct kvm_vcpu *vcpu) 421void kvm_inject_nmi(struct kvm_vcpu *vcpu)
@@ -457,11 +459,12 @@ int kvm_read_guest_page_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
457 gfn_t ngfn, void *data, int offset, int len, 459 gfn_t ngfn, void *data, int offset, int len,
458 u32 access) 460 u32 access)
459{ 461{
462 struct x86_exception exception;
460 gfn_t real_gfn; 463 gfn_t real_gfn;
461 gpa_t ngpa; 464 gpa_t ngpa;
462 465
463 ngpa = gfn_to_gpa(ngfn); 466 ngpa = gfn_to_gpa(ngfn);
464 real_gfn = mmu->translate_gpa(vcpu, ngpa, access); 467 real_gfn = mmu->translate_gpa(vcpu, ngpa, access, &exception);
465 if (real_gfn == UNMAPPED_GVA) 468 if (real_gfn == UNMAPPED_GVA)
466 return -EFAULT; 469 return -EFAULT;
467 470
@@ -726,7 +729,7 @@ int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
726{ 729{
727 if (cr3 == kvm_read_cr3(vcpu) && !pdptrs_changed(vcpu)) { 730 if (cr3 == kvm_read_cr3(vcpu) && !pdptrs_changed(vcpu)) {
728 kvm_mmu_sync_roots(vcpu); 731 kvm_mmu_sync_roots(vcpu);
729 kvm_mmu_flush_tlb(vcpu); 732 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
730 return 0; 733 return 0;
731 } 734 }
732 735
@@ -1518,7 +1521,7 @@ static void kvm_gen_update_masterclock(struct kvm *kvm)
1518 pvclock_update_vm_gtod_copy(kvm); 1521 pvclock_update_vm_gtod_copy(kvm);
1519 1522
1520 kvm_for_each_vcpu(i, vcpu, kvm) 1523 kvm_for_each_vcpu(i, vcpu, kvm)
1521 set_bit(KVM_REQ_CLOCK_UPDATE, &vcpu->requests); 1524 kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
1522 1525
1523 /* guest entries allowed */ 1526 /* guest entries allowed */
1524 kvm_for_each_vcpu(i, vcpu, kvm) 1527 kvm_for_each_vcpu(i, vcpu, kvm)
@@ -1661,7 +1664,7 @@ static void kvmclock_update_fn(struct work_struct *work)
1661 struct kvm_vcpu *vcpu; 1664 struct kvm_vcpu *vcpu;
1662 1665
1663 kvm_for_each_vcpu(i, vcpu, kvm) { 1666 kvm_for_each_vcpu(i, vcpu, kvm) {
1664 set_bit(KVM_REQ_CLOCK_UPDATE, &vcpu->requests); 1667 kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
1665 kvm_vcpu_kick(vcpu); 1668 kvm_vcpu_kick(vcpu);
1666 } 1669 }
1667} 1670}
@@ -1670,7 +1673,7 @@ static void kvm_gen_kvmclock_update(struct kvm_vcpu *v)
1670{ 1673{
1671 struct kvm *kvm = v->kvm; 1674 struct kvm *kvm = v->kvm;
1672 1675
1673 set_bit(KVM_REQ_CLOCK_UPDATE, &v->requests); 1676 kvm_make_request(KVM_REQ_CLOCK_UPDATE, v);
1674 schedule_delayed_work(&kvm->arch.kvmclock_update_work, 1677 schedule_delayed_work(&kvm->arch.kvmclock_update_work,
1675 KVMCLOCK_UPDATE_DELAY); 1678 KVMCLOCK_UPDATE_DELAY);
1676} 1679}
@@ -1723,9 +1726,10 @@ static bool valid_mtrr_type(unsigned t)
1723 return t < 8 && (1 << t) & 0x73; /* 0, 1, 4, 5, 6 */ 1726 return t < 8 && (1 << t) & 0x73; /* 0, 1, 4, 5, 6 */
1724} 1727}
1725 1728
1726static bool mtrr_valid(struct kvm_vcpu *vcpu, u32 msr, u64 data) 1729bool kvm_mtrr_valid(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1727{ 1730{
1728 int i; 1731 int i;
1732 u64 mask;
1729 1733
1730 if (!msr_mtrr_valid(msr)) 1734 if (!msr_mtrr_valid(msr))
1731 return false; 1735 return false;
@@ -1747,14 +1751,31 @@ static bool mtrr_valid(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1747 } 1751 }
1748 1752
1749 /* variable MTRRs */ 1753 /* variable MTRRs */
1750 return valid_mtrr_type(data & 0xff); 1754 WARN_ON(!(msr >= 0x200 && msr < 0x200 + 2 * KVM_NR_VAR_MTRR));
1755
1756 mask = (~0ULL) << cpuid_maxphyaddr(vcpu);
1757 if ((msr & 1) == 0) {
1758 /* MTRR base */
1759 if (!valid_mtrr_type(data & 0xff))
1760 return false;
1761 mask |= 0xf00;
1762 } else
1763 /* MTRR mask */
1764 mask |= 0x7ff;
1765 if (data & mask) {
1766 kvm_inject_gp(vcpu, 0);
1767 return false;
1768 }
1769
1770 return true;
1751} 1771}
1772EXPORT_SYMBOL_GPL(kvm_mtrr_valid);
1752 1773
1753static int set_msr_mtrr(struct kvm_vcpu *vcpu, u32 msr, u64 data) 1774static int set_msr_mtrr(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1754{ 1775{
1755 u64 *p = (u64 *)&vcpu->arch.mtrr_state.fixed_ranges; 1776 u64 *p = (u64 *)&vcpu->arch.mtrr_state.fixed_ranges;
1756 1777
1757 if (!mtrr_valid(vcpu, msr, data)) 1778 if (!kvm_mtrr_valid(vcpu, msr, data))
1758 return 1; 1779 return 1;
1759 1780
1760 if (msr == MSR_MTRRdefType) { 1781 if (msr == MSR_MTRRdefType) {
@@ -1805,7 +1826,7 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1805 break; 1826 break;
1806 default: 1827 default:
1807 if (msr >= MSR_IA32_MC0_CTL && 1828 if (msr >= MSR_IA32_MC0_CTL &&
1808 msr < MSR_IA32_MC0_CTL + 4 * bank_num) { 1829 msr < MSR_IA32_MCx_CTL(bank_num)) {
1809 u32 offset = msr - MSR_IA32_MC0_CTL; 1830 u32 offset = msr - MSR_IA32_MC0_CTL;
1810 /* only 0 or all 1s can be written to IA32_MCi_CTL 1831 /* only 0 or all 1s can be written to IA32_MCi_CTL
1811 * some Linux kernels though clear bit 10 in bank 4 to 1832 * some Linux kernels though clear bit 10 in bank 4 to
@@ -2164,7 +2185,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2164 2185
2165 case MSR_IA32_MCG_CTL: 2186 case MSR_IA32_MCG_CTL:
2166 case MSR_IA32_MCG_STATUS: 2187 case MSR_IA32_MCG_STATUS:
2167 case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1: 2188 case MSR_IA32_MC0_CTL ... MSR_IA32_MCx_CTL(KVM_MAX_MCE_BANKS) - 1:
2168 return set_msr_mce(vcpu, msr, data); 2189 return set_msr_mce(vcpu, msr, data);
2169 2190
2170 /* Performance counters are not protected by a CPUID bit, 2191 /* Performance counters are not protected by a CPUID bit,
@@ -2330,7 +2351,7 @@ static int get_msr_mce(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
2330 break; 2351 break;
2331 default: 2352 default:
2332 if (msr >= MSR_IA32_MC0_CTL && 2353 if (msr >= MSR_IA32_MC0_CTL &&
2333 msr < MSR_IA32_MC0_CTL + 4 * bank_num) { 2354 msr < MSR_IA32_MCx_CTL(bank_num)) {
2334 u32 offset = msr - MSR_IA32_MC0_CTL; 2355 u32 offset = msr - MSR_IA32_MC0_CTL;
2335 data = vcpu->arch.mce_banks[offset]; 2356 data = vcpu->arch.mce_banks[offset];
2336 break; 2357 break;
@@ -2419,7 +2440,13 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
2419 case MSR_K7_HWCR: 2440 case MSR_K7_HWCR:
2420 case MSR_VM_HSAVE_PA: 2441 case MSR_VM_HSAVE_PA:
2421 case MSR_K7_EVNTSEL0: 2442 case MSR_K7_EVNTSEL0:
2443 case MSR_K7_EVNTSEL1:
2444 case MSR_K7_EVNTSEL2:
2445 case MSR_K7_EVNTSEL3:
2422 case MSR_K7_PERFCTR0: 2446 case MSR_K7_PERFCTR0:
2447 case MSR_K7_PERFCTR1:
2448 case MSR_K7_PERFCTR2:
2449 case MSR_K7_PERFCTR3:
2423 case MSR_K8_INT_PENDING_MSG: 2450 case MSR_K8_INT_PENDING_MSG:
2424 case MSR_AMD64_NB_CFG: 2451 case MSR_AMD64_NB_CFG:
2425 case MSR_FAM10H_MMIO_CONF_BASE: 2452 case MSR_FAM10H_MMIO_CONF_BASE:
@@ -2505,7 +2532,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
2505 case MSR_IA32_MCG_CAP: 2532 case MSR_IA32_MCG_CAP:
2506 case MSR_IA32_MCG_CTL: 2533 case MSR_IA32_MCG_CTL:
2507 case MSR_IA32_MCG_STATUS: 2534 case MSR_IA32_MCG_STATUS:
2508 case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1: 2535 case MSR_IA32_MC0_CTL ... MSR_IA32_MCx_CTL(KVM_MAX_MCE_BANKS) - 1:
2509 return get_msr_mce(vcpu, msr, pdata); 2536 return get_msr_mce(vcpu, msr, pdata);
2510 case MSR_K7_CLK_CTL: 2537 case MSR_K7_CLK_CTL:
2511 /* 2538 /*
@@ -2823,7 +2850,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
2823 if (unlikely(vcpu->arch.tsc_offset_adjustment)) { 2850 if (unlikely(vcpu->arch.tsc_offset_adjustment)) {
2824 adjust_tsc_offset_host(vcpu, vcpu->arch.tsc_offset_adjustment); 2851 adjust_tsc_offset_host(vcpu, vcpu->arch.tsc_offset_adjustment);
2825 vcpu->arch.tsc_offset_adjustment = 0; 2852 vcpu->arch.tsc_offset_adjustment = 0;
2826 set_bit(KVM_REQ_CLOCK_UPDATE, &vcpu->requests); 2853 kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
2827 } 2854 }
2828 2855
2829 if (unlikely(vcpu->cpu != cpu) || check_tsc_unstable()) { 2856 if (unlikely(vcpu->cpu != cpu) || check_tsc_unstable()) {
@@ -4040,16 +4067,16 @@ void kvm_get_segment(struct kvm_vcpu *vcpu,
4040 kvm_x86_ops->get_segment(vcpu, var, seg); 4067 kvm_x86_ops->get_segment(vcpu, var, seg);
4041} 4068}
4042 4069
4043gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access) 4070gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
4071 struct x86_exception *exception)
4044{ 4072{
4045 gpa_t t_gpa; 4073 gpa_t t_gpa;
4046 struct x86_exception exception;
4047 4074
4048 BUG_ON(!mmu_is_nested(vcpu)); 4075 BUG_ON(!mmu_is_nested(vcpu));
4049 4076
4050 /* NPT walks are always user-walks */ 4077 /* NPT walks are always user-walks */
4051 access |= PFERR_USER_MASK; 4078 access |= PFERR_USER_MASK;
4052 t_gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, gpa, access, &exception); 4079 t_gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, gpa, access, exception);
4053 4080
4054 return t_gpa; 4081 return t_gpa;
4055} 4082}
@@ -4906,16 +4933,18 @@ static void toggle_interruptibility(struct kvm_vcpu *vcpu, u32 mask)
4906 } 4933 }
4907} 4934}
4908 4935
4909static void inject_emulated_exception(struct kvm_vcpu *vcpu) 4936static bool inject_emulated_exception(struct kvm_vcpu *vcpu)
4910{ 4937{
4911 struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; 4938 struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt;
4912 if (ctxt->exception.vector == PF_VECTOR) 4939 if (ctxt->exception.vector == PF_VECTOR)
4913 kvm_propagate_fault(vcpu, &ctxt->exception); 4940 return kvm_propagate_fault(vcpu, &ctxt->exception);
4914 else if (ctxt->exception.error_code_valid) 4941
4942 if (ctxt->exception.error_code_valid)
4915 kvm_queue_exception_e(vcpu, ctxt->exception.vector, 4943 kvm_queue_exception_e(vcpu, ctxt->exception.vector,
4916 ctxt->exception.error_code); 4944 ctxt->exception.error_code);
4917 else 4945 else
4918 kvm_queue_exception(vcpu, ctxt->exception.vector); 4946 kvm_queue_exception(vcpu, ctxt->exception.vector);
4947 return false;
4919} 4948}
4920 4949
4921static void init_emulate_ctxt(struct kvm_vcpu *vcpu) 4950static void init_emulate_ctxt(struct kvm_vcpu *vcpu)
@@ -4972,7 +5001,7 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu)
4972 5001
4973 ++vcpu->stat.insn_emulation_fail; 5002 ++vcpu->stat.insn_emulation_fail;
4974 trace_kvm_emulate_insn_failed(vcpu); 5003 trace_kvm_emulate_insn_failed(vcpu);
4975 if (!is_guest_mode(vcpu)) { 5004 if (!is_guest_mode(vcpu) && kvm_x86_ops->get_cpl(vcpu) == 0) {
4976 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 5005 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
4977 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; 5006 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
4978 vcpu->run->internal.ndata = 0; 5007 vcpu->run->internal.ndata = 0;
@@ -5224,6 +5253,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
5224 5253
5225 ctxt->interruptibility = 0; 5254 ctxt->interruptibility = 0;
5226 ctxt->have_exception = false; 5255 ctxt->have_exception = false;
5256 ctxt->exception.vector = -1;
5227 ctxt->perm_ok = false; 5257 ctxt->perm_ok = false;
5228 5258
5229 ctxt->ud = emulation_type & EMULTYPE_TRAP_UD; 5259 ctxt->ud = emulation_type & EMULTYPE_TRAP_UD;
@@ -5276,8 +5306,9 @@ restart:
5276 } 5306 }
5277 5307
5278 if (ctxt->have_exception) { 5308 if (ctxt->have_exception) {
5279 inject_emulated_exception(vcpu);
5280 r = EMULATE_DONE; 5309 r = EMULATE_DONE;
5310 if (inject_emulated_exception(vcpu))
5311 return r;
5281 } else if (vcpu->arch.pio.count) { 5312 } else if (vcpu->arch.pio.count) {
5282 if (!vcpu->arch.pio.in) { 5313 if (!vcpu->arch.pio.in) {
5283 /* FIXME: return into emulator if single-stepping. */ 5314 /* FIXME: return into emulator if single-stepping. */
@@ -5545,7 +5576,7 @@ static void kvm_set_mmio_spte_mask(void)
5545 * entry to generate page fault with PFER.RSV = 1. 5576 * entry to generate page fault with PFER.RSV = 1.
5546 */ 5577 */
5547 /* Mask the reserved physical address bits. */ 5578 /* Mask the reserved physical address bits. */
5548 mask = ((1ull << (51 - maxphyaddr + 1)) - 1) << maxphyaddr; 5579 mask = rsvd_bits(maxphyaddr, 51);
5549 5580
5550 /* Bit 62 is always reserved for 32bit host. */ 5581 /* Bit 62 is always reserved for 32bit host. */
5551 mask |= 0x3ull << 62; 5582 mask |= 0x3ull << 62;
@@ -5576,7 +5607,7 @@ static void pvclock_gtod_update_fn(struct work_struct *work)
5576 spin_lock(&kvm_lock); 5607 spin_lock(&kvm_lock);
5577 list_for_each_entry(kvm, &vm_list, vm_list) 5608 list_for_each_entry(kvm, &vm_list, vm_list)
5578 kvm_for_each_vcpu(i, vcpu, kvm) 5609 kvm_for_each_vcpu(i, vcpu, kvm)
5579 set_bit(KVM_REQ_MASTERCLOCK_UPDATE, &vcpu->requests); 5610 kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
5580 atomic_set(&kvm_guest_has_master_clock, 0); 5611 atomic_set(&kvm_guest_has_master_clock, 0);
5581 spin_unlock(&kvm_lock); 5612 spin_unlock(&kvm_lock);
5582} 5613}
@@ -5989,6 +6020,44 @@ static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu)
5989 kvm_apic_update_tmr(vcpu, tmr); 6020 kvm_apic_update_tmr(vcpu, tmr);
5990} 6021}
5991 6022
6023static void kvm_vcpu_flush_tlb(struct kvm_vcpu *vcpu)
6024{
6025 ++vcpu->stat.tlb_flush;
6026 kvm_x86_ops->tlb_flush(vcpu);
6027}
6028
6029void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu)
6030{
6031 struct page *page = NULL;
6032
6033 if (!irqchip_in_kernel(vcpu->kvm))
6034 return;
6035
6036 if (!kvm_x86_ops->set_apic_access_page_addr)
6037 return;
6038
6039 page = gfn_to_page(vcpu->kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT);
6040 kvm_x86_ops->set_apic_access_page_addr(vcpu, page_to_phys(page));
6041
6042 /*
6043 * Do not pin apic access page in memory, the MMU notifier
6044 * will call us again if it is migrated or swapped out.
6045 */
6046 put_page(page);
6047}
6048EXPORT_SYMBOL_GPL(kvm_vcpu_reload_apic_access_page);
6049
6050void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
6051 unsigned long address)
6052{
6053 /*
6054 * The physical address of apic access page is stored in the VMCS.
6055 * Update it when it becomes invalid.
6056 */
6057 if (address == gfn_to_hva(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT))
6058 kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD);
6059}
6060
5992/* 6061/*
5993 * Returns 1 to let __vcpu_run() continue the guest execution loop without 6062 * Returns 1 to let __vcpu_run() continue the guest execution loop without
5994 * exiting to the userspace. Otherwise, the value will be returned to the 6063 * exiting to the userspace. Otherwise, the value will be returned to the
@@ -6018,7 +6087,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
6018 if (kvm_check_request(KVM_REQ_MMU_SYNC, vcpu)) 6087 if (kvm_check_request(KVM_REQ_MMU_SYNC, vcpu))
6019 kvm_mmu_sync_roots(vcpu); 6088 kvm_mmu_sync_roots(vcpu);
6020 if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) 6089 if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu))
6021 kvm_x86_ops->tlb_flush(vcpu); 6090 kvm_vcpu_flush_tlb(vcpu);
6022 if (kvm_check_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu)) { 6091 if (kvm_check_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu)) {
6023 vcpu->run->exit_reason = KVM_EXIT_TPR_ACCESS; 6092 vcpu->run->exit_reason = KVM_EXIT_TPR_ACCESS;
6024 r = 0; 6093 r = 0;
@@ -6049,6 +6118,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
6049 kvm_deliver_pmi(vcpu); 6118 kvm_deliver_pmi(vcpu);
6050 if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu)) 6119 if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu))
6051 vcpu_scan_ioapic(vcpu); 6120 vcpu_scan_ioapic(vcpu);
6121 if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu))
6122 kvm_vcpu_reload_apic_access_page(vcpu);
6052 } 6123 }
6053 6124
6054 if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) { 6125 if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {
@@ -6934,7 +7005,7 @@ void kvm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, unsigned int vector)
6934 kvm_rip_write(vcpu, 0); 7005 kvm_rip_write(vcpu, 0);
6935} 7006}
6936 7007
6937int kvm_arch_hardware_enable(void *garbage) 7008int kvm_arch_hardware_enable(void)
6938{ 7009{
6939 struct kvm *kvm; 7010 struct kvm *kvm;
6940 struct kvm_vcpu *vcpu; 7011 struct kvm_vcpu *vcpu;
@@ -6945,7 +7016,7 @@ int kvm_arch_hardware_enable(void *garbage)
6945 bool stable, backwards_tsc = false; 7016 bool stable, backwards_tsc = false;
6946 7017
6947 kvm_shared_msr_cpu_online(); 7018 kvm_shared_msr_cpu_online();
6948 ret = kvm_x86_ops->hardware_enable(garbage); 7019 ret = kvm_x86_ops->hardware_enable();
6949 if (ret != 0) 7020 if (ret != 0)
6950 return ret; 7021 return ret;
6951 7022
@@ -6954,7 +7025,7 @@ int kvm_arch_hardware_enable(void *garbage)
6954 list_for_each_entry(kvm, &vm_list, vm_list) { 7025 list_for_each_entry(kvm, &vm_list, vm_list) {
6955 kvm_for_each_vcpu(i, vcpu, kvm) { 7026 kvm_for_each_vcpu(i, vcpu, kvm) {
6956 if (!stable && vcpu->cpu == smp_processor_id()) 7027 if (!stable && vcpu->cpu == smp_processor_id())
6957 set_bit(KVM_REQ_CLOCK_UPDATE, &vcpu->requests); 7028 kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
6958 if (stable && vcpu->arch.last_host_tsc > local_tsc) { 7029 if (stable && vcpu->arch.last_host_tsc > local_tsc) {
6959 backwards_tsc = true; 7030 backwards_tsc = true;
6960 if (vcpu->arch.last_host_tsc > max_tsc) 7031 if (vcpu->arch.last_host_tsc > max_tsc)
@@ -7008,8 +7079,7 @@ int kvm_arch_hardware_enable(void *garbage)
7008 kvm_for_each_vcpu(i, vcpu, kvm) { 7079 kvm_for_each_vcpu(i, vcpu, kvm) {
7009 vcpu->arch.tsc_offset_adjustment += delta_cyc; 7080 vcpu->arch.tsc_offset_adjustment += delta_cyc;
7010 vcpu->arch.last_host_tsc = local_tsc; 7081 vcpu->arch.last_host_tsc = local_tsc;
7011 set_bit(KVM_REQ_MASTERCLOCK_UPDATE, 7082 kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
7012 &vcpu->requests);
7013 } 7083 }
7014 7084
7015 /* 7085 /*
@@ -7026,10 +7096,10 @@ int kvm_arch_hardware_enable(void *garbage)
7026 return 0; 7096 return 0;
7027} 7097}
7028 7098
7029void kvm_arch_hardware_disable(void *garbage) 7099void kvm_arch_hardware_disable(void)
7030{ 7100{
7031 kvm_x86_ops->hardware_disable(garbage); 7101 kvm_x86_ops->hardware_disable();
7032 drop_user_return_notifiers(garbage); 7102 drop_user_return_notifiers();
7033} 7103}
7034 7104
7035int kvm_arch_hardware_setup(void) 7105int kvm_arch_hardware_setup(void)
@@ -7146,6 +7216,11 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
7146 static_key_slow_dec(&kvm_no_apic_vcpu); 7216 static_key_slow_dec(&kvm_no_apic_vcpu);
7147} 7217}
7148 7218
7219void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu)
7220{
7221 kvm_x86_ops->sched_in(vcpu, cpu);
7222}
7223
7149int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) 7224int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
7150{ 7225{
7151 if (type) 7226 if (type)
@@ -7237,10 +7312,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
7237 kfree(kvm->arch.vpic); 7312 kfree(kvm->arch.vpic);
7238 kfree(kvm->arch.vioapic); 7313 kfree(kvm->arch.vioapic);
7239 kvm_free_vcpus(kvm); 7314 kvm_free_vcpus(kvm);
7240 if (kvm->arch.apic_access_page)
7241 put_page(kvm->arch.apic_access_page);
7242 if (kvm->arch.ept_identity_pagetable)
7243 put_page(kvm->arch.ept_identity_pagetable);
7244 kfree(rcu_dereference_check(kvm->arch.apic_map, 1)); 7315 kfree(rcu_dereference_check(kvm->arch.apic_map, 1));
7245} 7316}
7246 7317
@@ -7643,3 +7714,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga);
7643EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit); 7714EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit);
7644EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intercepts); 7715EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intercepts);
7645EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_write_tsc_offset); 7716EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_write_tsc_offset);
7717EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_ple_window);
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 306a1b77581f..7cb9c45a5fe0 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -88,15 +88,23 @@ static inline void vcpu_cache_mmio_info(struct kvm_vcpu *vcpu,
88 vcpu->arch.mmio_gva = gva & PAGE_MASK; 88 vcpu->arch.mmio_gva = gva & PAGE_MASK;
89 vcpu->arch.access = access; 89 vcpu->arch.access = access;
90 vcpu->arch.mmio_gfn = gfn; 90 vcpu->arch.mmio_gfn = gfn;
91 vcpu->arch.mmio_gen = kvm_memslots(vcpu->kvm)->generation;
92}
93
94static inline bool vcpu_match_mmio_gen(struct kvm_vcpu *vcpu)
95{
96 return vcpu->arch.mmio_gen == kvm_memslots(vcpu->kvm)->generation;
91} 97}
92 98
93/* 99/*
94 * Clear the mmio cache info for the given gva, 100 * Clear the mmio cache info for the given gva. If gva is MMIO_GVA_ANY, we
95 * specially, if gva is ~0ul, we clear all mmio cache info. 101 * clear all mmio cache info.
96 */ 102 */
103#define MMIO_GVA_ANY (~(gva_t)0)
104
97static inline void vcpu_clear_mmio_info(struct kvm_vcpu *vcpu, gva_t gva) 105static inline void vcpu_clear_mmio_info(struct kvm_vcpu *vcpu, gva_t gva)
98{ 106{
99 if (gva != (~0ul) && vcpu->arch.mmio_gva != (gva & PAGE_MASK)) 107 if (gva != MMIO_GVA_ANY && vcpu->arch.mmio_gva != (gva & PAGE_MASK))
100 return; 108 return;
101 109
102 vcpu->arch.mmio_gva = 0; 110 vcpu->arch.mmio_gva = 0;
@@ -104,7 +112,8 @@ static inline void vcpu_clear_mmio_info(struct kvm_vcpu *vcpu, gva_t gva)
104 112
105static inline bool vcpu_match_mmio_gva(struct kvm_vcpu *vcpu, unsigned long gva) 113static inline bool vcpu_match_mmio_gva(struct kvm_vcpu *vcpu, unsigned long gva)
106{ 114{
107 if (vcpu->arch.mmio_gva && vcpu->arch.mmio_gva == (gva & PAGE_MASK)) 115 if (vcpu_match_mmio_gen(vcpu) && vcpu->arch.mmio_gva &&
116 vcpu->arch.mmio_gva == (gva & PAGE_MASK))
108 return true; 117 return true;
109 118
110 return false; 119 return false;
@@ -112,7 +121,8 @@ static inline bool vcpu_match_mmio_gva(struct kvm_vcpu *vcpu, unsigned long gva)
112 121
113static inline bool vcpu_match_mmio_gpa(struct kvm_vcpu *vcpu, gpa_t gpa) 122static inline bool vcpu_match_mmio_gpa(struct kvm_vcpu *vcpu, gpa_t gpa)
114{ 123{
115 if (vcpu->arch.mmio_gfn && vcpu->arch.mmio_gfn == gpa >> PAGE_SHIFT) 124 if (vcpu_match_mmio_gen(vcpu) && vcpu->arch.mmio_gfn &&
125 vcpu->arch.mmio_gfn == gpa >> PAGE_SHIFT)
116 return true; 126 return true;
117 127
118 return false; 128 return false;
@@ -149,6 +159,8 @@ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt,
149 gva_t addr, void *val, unsigned int bytes, 159 gva_t addr, void *val, unsigned int bytes,
150 struct x86_exception *exception); 160 struct x86_exception *exception);
151 161
162bool kvm_mtrr_valid(struct kvm_vcpu *vcpu, u32 msr, u64 data);
163
152#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \ 164#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \
153 | XSTATE_BNDREGS | XSTATE_BNDCSR) 165 | XSTATE_BNDREGS | XSTATE_BNDCSR)
154extern u64 host_xcr0; 166extern u64 host_xcr0;
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 167ffcac16ed..95a427e57887 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -48,7 +48,9 @@ enum address_markers_idx {
48 LOW_KERNEL_NR, 48 LOW_KERNEL_NR,
49 VMALLOC_START_NR, 49 VMALLOC_START_NR,
50 VMEMMAP_START_NR, 50 VMEMMAP_START_NR,
51# ifdef CONFIG_X86_ESPFIX64
51 ESPFIX_START_NR, 52 ESPFIX_START_NR,
53# endif
52 HIGH_KERNEL_NR, 54 HIGH_KERNEL_NR,
53 MODULES_VADDR_NR, 55 MODULES_VADDR_NR,
54 MODULES_END_NR, 56 MODULES_END_NR,
@@ -71,7 +73,9 @@ static struct addr_marker address_markers[] = {
71 { PAGE_OFFSET, "Low Kernel Mapping" }, 73 { PAGE_OFFSET, "Low Kernel Mapping" },
72 { VMALLOC_START, "vmalloc() Area" }, 74 { VMALLOC_START, "vmalloc() Area" },
73 { VMEMMAP_START, "Vmemmap" }, 75 { VMEMMAP_START, "Vmemmap" },
76# ifdef CONFIG_X86_ESPFIX64
74 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, 77 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 },
78# endif
75 { __START_KERNEL_map, "High Kernel Mapping" }, 79 { __START_KERNEL_map, "High Kernel Mapping" },
76 { MODULES_VADDR, "Modules" }, 80 { MODULES_VADDR, "Modules" },
77 { MODULES_END, "End Modules" }, 81 { MODULES_END, "End Modules" },
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 25e7e1372bb2..919b91205cd4 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -31,7 +31,7 @@
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <asm/elf.h> 32#include <asm/elf.h>
33 33
34struct __read_mostly va_alignment va_align = { 34struct va_alignment __read_mostly va_align = {
35 .flags = -1, 35 .flags = -1,
36}; 36};
37 37
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 1fe33987de02..ee61c36d64f8 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -49,7 +49,13 @@ void leave_mm(int cpu)
49 if (cpumask_test_cpu(cpu, mm_cpumask(active_mm))) { 49 if (cpumask_test_cpu(cpu, mm_cpumask(active_mm))) {
50 cpumask_clear_cpu(cpu, mm_cpumask(active_mm)); 50 cpumask_clear_cpu(cpu, mm_cpumask(active_mm));
51 load_cr3(swapper_pg_dir); 51 load_cr3(swapper_pg_dir);
52 trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL); 52 /*
53 * This gets called in the idle path where RCU
54 * functions differently. Tracing normally
55 * uses RCU, so we have to call the tracepoint
56 * specially here.
57 */
58 trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
53 } 59 }
54} 60}
55EXPORT_SYMBOL_GPL(leave_mm); 61EXPORT_SYMBOL_GPL(leave_mm);
@@ -174,7 +180,7 @@ void flush_tlb_current_task(void)
174 * 180 *
175 * This is in units of pages. 181 * This is in units of pages.
176 */ 182 */
177unsigned long tlb_single_page_flush_ceiling = 33; 183static unsigned long tlb_single_page_flush_ceiling __read_mostly = 33;
178 184
179void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, 185void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
180 unsigned long end, unsigned long vmflag) 186 unsigned long end, unsigned long vmflag)
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 5c8cb8043c5a..d56cd1f515bd 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -8,12 +8,10 @@
8 * as published by the Free Software Foundation; version 2 8 * as published by the Free Software Foundation; version 2
9 * of the License. 9 * of the License.
10 */ 10 */
11#include <linux/moduleloader.h>
12#include <asm/cacheflush.h>
13#include <linux/netdevice.h> 11#include <linux/netdevice.h>
14#include <linux/filter.h> 12#include <linux/filter.h>
15#include <linux/if_vlan.h> 13#include <linux/if_vlan.h>
16#include <linux/random.h> 14#include <asm/cacheflush.h>
17 15
18int bpf_jit_enable __read_mostly; 16int bpf_jit_enable __read_mostly;
19 17
@@ -109,39 +107,6 @@ static inline void bpf_flush_icache(void *start, void *end)
109#define CHOOSE_LOAD_FUNC(K, func) \ 107#define CHOOSE_LOAD_FUNC(K, func) \
110 ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset) 108 ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset)
111 109
112struct bpf_binary_header {
113 unsigned int pages;
114 /* Note : for security reasons, bpf code will follow a randomly
115 * sized amount of int3 instructions
116 */
117 u8 image[];
118};
119
120static struct bpf_binary_header *bpf_alloc_binary(unsigned int proglen,
121 u8 **image_ptr)
122{
123 unsigned int sz, hole;
124 struct bpf_binary_header *header;
125
126 /* Most of BPF filters are really small,
127 * but if some of them fill a page, allow at least
128 * 128 extra bytes to insert a random section of int3
129 */
130 sz = round_up(proglen + sizeof(*header) + 128, PAGE_SIZE);
131 header = module_alloc(sz);
132 if (!header)
133 return NULL;
134
135 memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
136
137 header->pages = sz / PAGE_SIZE;
138 hole = min(sz - (proglen + sizeof(*header)), PAGE_SIZE - sizeof(*header));
139
140 /* insert a random number of int3 instructions before BPF code */
141 *image_ptr = &header->image[prandom_u32() % hole];
142 return header;
143}
144
145/* pick a register outside of BPF range for JIT internal work */ 110/* pick a register outside of BPF range for JIT internal work */
146#define AUX_REG (MAX_BPF_REG + 1) 111#define AUX_REG (MAX_BPF_REG + 1)
147 112
@@ -206,6 +171,12 @@ static inline u8 add_2reg(u8 byte, u32 dst_reg, u32 src_reg)
206 return byte + reg2hex[dst_reg] + (reg2hex[src_reg] << 3); 171 return byte + reg2hex[dst_reg] + (reg2hex[src_reg] << 3);
207} 172}
208 173
174static void jit_fill_hole(void *area, unsigned int size)
175{
176 /* fill whole space with int3 instructions */
177 memset(area, 0xcc, size);
178}
179
209struct jit_context { 180struct jit_context {
210 unsigned int cleanup_addr; /* epilogue code offset */ 181 unsigned int cleanup_addr; /* epilogue code offset */
211 bool seen_ld_abs; 182 bool seen_ld_abs;
@@ -393,6 +364,23 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
393 EMIT1_off32(add_1reg(0xB8, dst_reg), imm32); 364 EMIT1_off32(add_1reg(0xB8, dst_reg), imm32);
394 break; 365 break;
395 366
367 case BPF_LD | BPF_IMM | BPF_DW:
368 if (insn[1].code != 0 || insn[1].src_reg != 0 ||
369 insn[1].dst_reg != 0 || insn[1].off != 0) {
370 /* verifier must catch invalid insns */
371 pr_err("invalid BPF_LD_IMM64 insn\n");
372 return -EINVAL;
373 }
374
375 /* movabsq %rax, imm64 */
376 EMIT2(add_1mod(0x48, dst_reg), add_1reg(0xB8, dst_reg));
377 EMIT(insn[0].imm, 4);
378 EMIT(insn[1].imm, 4);
379
380 insn++;
381 i++;
382 break;
383
396 /* dst %= src, dst /= src, dst %= imm32, dst /= imm32 */ 384 /* dst %= src, dst /= src, dst %= imm32, dst /= imm32 */
397 case BPF_ALU | BPF_MOD | BPF_X: 385 case BPF_ALU | BPF_MOD | BPF_X:
398 case BPF_ALU | BPF_DIV | BPF_X: 386 case BPF_ALU | BPF_DIV | BPF_X:
@@ -515,6 +503,48 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
515 EMIT3(0xC1, add_1reg(b3, dst_reg), imm32); 503 EMIT3(0xC1, add_1reg(b3, dst_reg), imm32);
516 break; 504 break;
517 505
506 case BPF_ALU | BPF_LSH | BPF_X:
507 case BPF_ALU | BPF_RSH | BPF_X:
508 case BPF_ALU | BPF_ARSH | BPF_X:
509 case BPF_ALU64 | BPF_LSH | BPF_X:
510 case BPF_ALU64 | BPF_RSH | BPF_X:
511 case BPF_ALU64 | BPF_ARSH | BPF_X:
512
513 /* check for bad case when dst_reg == rcx */
514 if (dst_reg == BPF_REG_4) {
515 /* mov r11, dst_reg */
516 EMIT_mov(AUX_REG, dst_reg);
517 dst_reg = AUX_REG;
518 }
519
520 if (src_reg != BPF_REG_4) { /* common case */
521 EMIT1(0x51); /* push rcx */
522
523 /* mov rcx, src_reg */
524 EMIT_mov(BPF_REG_4, src_reg);
525 }
526
527 /* shl %rax, %cl | shr %rax, %cl | sar %rax, %cl */
528 if (BPF_CLASS(insn->code) == BPF_ALU64)
529 EMIT1(add_1mod(0x48, dst_reg));
530 else if (is_ereg(dst_reg))
531 EMIT1(add_1mod(0x40, dst_reg));
532
533 switch (BPF_OP(insn->code)) {
534 case BPF_LSH: b3 = 0xE0; break;
535 case BPF_RSH: b3 = 0xE8; break;
536 case BPF_ARSH: b3 = 0xF8; break;
537 }
538 EMIT2(0xD3, add_1reg(b3, dst_reg));
539
540 if (src_reg != BPF_REG_4)
541 EMIT1(0x59); /* pop rcx */
542
543 if (insn->dst_reg == BPF_REG_4)
544 /* mov dst_reg, r11 */
545 EMIT_mov(insn->dst_reg, AUX_REG);
546 break;
547
518 case BPF_ALU | BPF_END | BPF_FROM_BE: 548 case BPF_ALU | BPF_END | BPF_FROM_BE:
519 switch (imm32) { 549 switch (imm32) {
520 case 16: 550 case 16:
@@ -900,7 +930,7 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
900 if (proglen <= 0) { 930 if (proglen <= 0) {
901 image = NULL; 931 image = NULL;
902 if (header) 932 if (header)
903 module_free(NULL, header); 933 bpf_jit_binary_free(header);
904 goto out; 934 goto out;
905 } 935 }
906 if (image) { 936 if (image) {
@@ -910,7 +940,8 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
910 break; 940 break;
911 } 941 }
912 if (proglen == oldproglen) { 942 if (proglen == oldproglen) {
913 header = bpf_alloc_binary(proglen, &image); 943 header = bpf_jit_binary_alloc(proglen, &image,
944 1, jit_fill_hole);
914 if (!header) 945 if (!header)
915 goto out; 946 goto out;
916 } 947 }
@@ -924,29 +955,23 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
924 bpf_flush_icache(header, image + proglen); 955 bpf_flush_icache(header, image + proglen);
925 set_memory_ro((unsigned long)header, header->pages); 956 set_memory_ro((unsigned long)header, header->pages);
926 prog->bpf_func = (void *)image; 957 prog->bpf_func = (void *)image;
927 prog->jited = 1; 958 prog->jited = true;
928 } 959 }
929out: 960out:
930 kfree(addrs); 961 kfree(addrs);
931} 962}
932 963
933static void bpf_jit_free_deferred(struct work_struct *work) 964void bpf_jit_free(struct bpf_prog *fp)
934{ 965{
935 struct bpf_prog *fp = container_of(work, struct bpf_prog, work);
936 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; 966 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
937 struct bpf_binary_header *header = (void *)addr; 967 struct bpf_binary_header *header = (void *)addr;
938 968
969 if (!fp->jited)
970 goto free_filter;
971
939 set_memory_rw(addr, header->pages); 972 set_memory_rw(addr, header->pages);
940 module_free(NULL, header); 973 bpf_jit_binary_free(header);
941 kfree(fp);
942}
943 974
944void bpf_jit_free(struct bpf_prog *fp) 975free_filter:
945{ 976 bpf_prog_unlock_free(fp);
946 if (fp->jited) {
947 INIT_WORK(&fp->work, bpf_jit_free_deferred);
948 schedule_work(&fp->work);
949 } else {
950 kfree(fp);
951 }
952} 977}
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 059a76c29739..7b20bccf3648 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -81,14 +81,14 @@ struct pci_ops pci_root_ops = {
81 */ 81 */
82DEFINE_RAW_SPINLOCK(pci_config_lock); 82DEFINE_RAW_SPINLOCK(pci_config_lock);
83 83
84static int can_skip_ioresource_align(const struct dmi_system_id *d) 84static int __init can_skip_ioresource_align(const struct dmi_system_id *d)
85{ 85{
86 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN; 86 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
87 printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident); 87 printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident);
88 return 0; 88 return 0;
89} 89}
90 90
91static const struct dmi_system_id can_skip_pciprobe_dmi_table[] = { 91static const struct dmi_system_id can_skip_pciprobe_dmi_table[] __initconst = {
92/* 92/*
93 * Systems where PCI IO resource ISA alignment can be skipped 93 * Systems where PCI IO resource ISA alignment can be skipped
94 * when the ISA enable bit in the bridge control is not set 94 * when the ISA enable bit in the bridge control is not set
@@ -186,7 +186,7 @@ void pcibios_remove_bus(struct pci_bus *bus)
186 * on the kernel command line (which was parsed earlier). 186 * on the kernel command line (which was parsed earlier).
187 */ 187 */
188 188
189static int set_bf_sort(const struct dmi_system_id *d) 189static int __init set_bf_sort(const struct dmi_system_id *d)
190{ 190{
191 if (pci_bf_sort == pci_bf_sort_default) { 191 if (pci_bf_sort == pci_bf_sort_default) {
192 pci_bf_sort = pci_dmi_bf; 192 pci_bf_sort = pci_dmi_bf;
@@ -195,8 +195,8 @@ static int set_bf_sort(const struct dmi_system_id *d)
195 return 0; 195 return 0;
196} 196}
197 197
198static void read_dmi_type_b1(const struct dmi_header *dm, 198static void __init read_dmi_type_b1(const struct dmi_header *dm,
199 void *private_data) 199 void *private_data)
200{ 200{
201 u8 *d = (u8 *)dm + 4; 201 u8 *d = (u8 *)dm + 4;
202 202
@@ -217,7 +217,7 @@ static void read_dmi_type_b1(const struct dmi_header *dm,
217 } 217 }
218} 218}
219 219
220static int find_sort_method(const struct dmi_system_id *d) 220static int __init find_sort_method(const struct dmi_system_id *d)
221{ 221{
222 dmi_walk(read_dmi_type_b1, NULL); 222 dmi_walk(read_dmi_type_b1, NULL);
223 223
@@ -232,7 +232,7 @@ static int find_sort_method(const struct dmi_system_id *d)
232 * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus) 232 * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus)
233 */ 233 */
234#ifdef __i386__ 234#ifdef __i386__
235static int assign_all_busses(const struct dmi_system_id *d) 235static int __init assign_all_busses(const struct dmi_system_id *d)
236{ 236{
237 pci_probe |= PCI_ASSIGN_ALL_BUSSES; 237 pci_probe |= PCI_ASSIGN_ALL_BUSSES;
238 printk(KERN_INFO "%s detected: enabling PCI bus# renumbering" 238 printk(KERN_INFO "%s detected: enabling PCI bus# renumbering"
@@ -241,7 +241,7 @@ static int assign_all_busses(const struct dmi_system_id *d)
241} 241}
242#endif 242#endif
243 243
244static int set_scan_all(const struct dmi_system_id *d) 244static int __init set_scan_all(const struct dmi_system_id *d)
245{ 245{
246 printk(KERN_INFO "PCI: %s detected, enabling pci=pcie_scan_all\n", 246 printk(KERN_INFO "PCI: %s detected, enabling pci=pcie_scan_all\n",
247 d->ident); 247 d->ident);
@@ -249,7 +249,7 @@ static int set_scan_all(const struct dmi_system_id *d)
249 return 0; 249 return 0;
250} 250}
251 251
252static const struct dmi_system_id pciprobe_dmi_table[] = { 252static const struct dmi_system_id pciprobe_dmi_table[] __initconst = {
253#ifdef __i386__ 253#ifdef __i386__
254/* 254/*
255 * Laptops which need pci=assign-busses to see Cardbus cards 255 * Laptops which need pci=assign-busses to see Cardbus cards
@@ -512,7 +512,7 @@ int __init pcibios_init(void)
512 return 0; 512 return 0;
513} 513}
514 514
515char * __init pcibios_setup(char *str) 515char *__init pcibios_setup(char *str)
516{ 516{
517 if (!strcmp(str, "off")) { 517 if (!strcmp(str, "off")) {
518 pci_probe = 0; 518 pci_probe = 0;
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index c61ea57d1ba1..9a2b7101ae8a 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -326,27 +326,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
326 struct pci_bus *bus; 326 struct pci_bus *bus;
327 u16 config; 327 u16 config;
328 328
329 if (!vga_default_device()) {
330 resource_size_t start, end;
331 int i;
332
333 /* Does firmware framebuffer belong to us? */
334 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
335 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
336 continue;
337
338 start = pci_resource_start(pdev, i);
339 end = pci_resource_end(pdev, i);
340
341 if (!start || !end)
342 continue;
343
344 if (screen_info.lfb_base >= start &&
345 (screen_info.lfb_base + screen_info.lfb_size) < end)
346 vga_set_default_device(pdev);
347 }
348 }
349
350 /* Is VGA routed to us? */ 329 /* Is VGA routed to us? */
351 bus = pdev->bus; 330 bus = pdev->bus;
352 while (bus) { 331 while (bus) {
@@ -371,8 +350,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
371 pci_read_config_word(pdev, PCI_COMMAND, &config); 350 pci_read_config_word(pdev, PCI_COMMAND, &config);
372 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 351 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
373 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 352 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
374 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 353 dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
375 vga_set_default_device(pdev);
376 } 354 }
377 } 355 }
378} 356}
diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c
index 3865116c51fb..b9958c364075 100644
--- a/arch/x86/pci/intel_mid_pci.c
+++ b/arch/x86/pci/intel_mid_pci.c
@@ -229,7 +229,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
229 229
230static void intel_mid_pci_irq_disable(struct pci_dev *dev) 230static void intel_mid_pci_irq_disable(struct pci_dev *dev)
231{ 231{
232 if (!dev->dev.power.is_prepared && dev->irq > 0) 232 if (!mp_should_keep_irq(&dev->dev) && dev->irq > 0)
233 mp_unmap_irq(dev->irq); 233 mp_unmap_irq(dev->irq);
234} 234}
235 235
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index bc1a2c341891..eb500c2592ad 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -1256,7 +1256,7 @@ static int pirq_enable_irq(struct pci_dev *dev)
1256 1256
1257static void pirq_disable_irq(struct pci_dev *dev) 1257static void pirq_disable_irq(struct pci_dev *dev)
1258{ 1258{
1259 if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared && 1259 if (io_apic_assign_pci_irqs && !mp_should_keep_irq(&dev->dev) &&
1260 dev->irq) { 1260 dev->irq) {
1261 mp_unmap_irq(dev->irq); 1261 mp_unmap_irq(dev->irq);
1262 dev->irq = 0; 1262 dev->irq = 0;
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 248642f4bab7..326198a4434e 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -31,7 +31,7 @@ static DEFINE_MUTEX(pci_mmcfg_lock);
31 31
32LIST_HEAD(pci_mmcfg_list); 32LIST_HEAD(pci_mmcfg_list);
33 33
34static __init void pci_mmconfig_remove(struct pci_mmcfg_region *cfg) 34static void __init pci_mmconfig_remove(struct pci_mmcfg_region *cfg)
35{ 35{
36 if (cfg->res.parent) 36 if (cfg->res.parent)
37 release_resource(&cfg->res); 37 release_resource(&cfg->res);
@@ -39,7 +39,7 @@ static __init void pci_mmconfig_remove(struct pci_mmcfg_region *cfg)
39 kfree(cfg); 39 kfree(cfg);
40} 40}
41 41
42static __init void free_all_mmcfg(void) 42static void __init free_all_mmcfg(void)
43{ 43{
44 struct pci_mmcfg_region *cfg, *tmp; 44 struct pci_mmcfg_region *cfg, *tmp;
45 45
@@ -93,7 +93,7 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start,
93 return new; 93 return new;
94} 94}
95 95
96static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, 96static struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
97 int end, u64 addr) 97 int end, u64 addr)
98{ 98{
99 struct pci_mmcfg_region *new; 99 struct pci_mmcfg_region *new;
@@ -125,7 +125,7 @@ struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus)
125 return NULL; 125 return NULL;
126} 126}
127 127
128static const char __init *pci_mmcfg_e7520(void) 128static const char *__init pci_mmcfg_e7520(void)
129{ 129{
130 u32 win; 130 u32 win;
131 raw_pci_ops->read(0, 0, PCI_DEVFN(0, 0), 0xce, 2, &win); 131 raw_pci_ops->read(0, 0, PCI_DEVFN(0, 0), 0xce, 2, &win);
@@ -140,7 +140,7 @@ static const char __init *pci_mmcfg_e7520(void)
140 return "Intel Corporation E7520 Memory Controller Hub"; 140 return "Intel Corporation E7520 Memory Controller Hub";
141} 141}
142 142
143static const char __init *pci_mmcfg_intel_945(void) 143static const char *__init pci_mmcfg_intel_945(void)
144{ 144{
145 u32 pciexbar, mask = 0, len = 0; 145 u32 pciexbar, mask = 0, len = 0;
146 146
@@ -184,7 +184,7 @@ static const char __init *pci_mmcfg_intel_945(void)
184 return "Intel Corporation 945G/GZ/P/PL Express Memory Controller Hub"; 184 return "Intel Corporation 945G/GZ/P/PL Express Memory Controller Hub";
185} 185}
186 186
187static const char __init *pci_mmcfg_amd_fam10h(void) 187static const char *__init pci_mmcfg_amd_fam10h(void)
188{ 188{
189 u32 low, high, address; 189 u32 low, high, address;
190 u64 base, msr; 190 u64 base, msr;
@@ -235,21 +235,25 @@ static const char __init *pci_mmcfg_amd_fam10h(void)
235} 235}
236 236
237static bool __initdata mcp55_checked; 237static bool __initdata mcp55_checked;
238static const char __init *pci_mmcfg_nvidia_mcp55(void) 238static const char *__init pci_mmcfg_nvidia_mcp55(void)
239{ 239{
240 int bus; 240 int bus;
241 int mcp55_mmconf_found = 0; 241 int mcp55_mmconf_found = 0;
242 242
243 static const u32 extcfg_regnum = 0x90; 243 static const u32 extcfg_regnum __initconst = 0x90;
244 static const u32 extcfg_regsize = 4; 244 static const u32 extcfg_regsize __initconst = 4;
245 static const u32 extcfg_enable_mask = 1<<31; 245 static const u32 extcfg_enable_mask __initconst = 1 << 31;
246 static const u32 extcfg_start_mask = 0xff<<16; 246 static const u32 extcfg_start_mask __initconst = 0xff << 16;
247 static const int extcfg_start_shift = 16; 247 static const int extcfg_start_shift __initconst = 16;
248 static const u32 extcfg_size_mask = 0x3<<28; 248 static const u32 extcfg_size_mask __initconst = 0x3 << 28;
249 static const int extcfg_size_shift = 28; 249 static const int extcfg_size_shift __initconst = 28;
250 static const int extcfg_sizebus[] = {0x100, 0x80, 0x40, 0x20}; 250 static const int extcfg_sizebus[] __initconst = {
251 static const u32 extcfg_base_mask[] = {0x7ff8, 0x7ffc, 0x7ffe, 0x7fff}; 251 0x100, 0x80, 0x40, 0x20
252 static const int extcfg_base_lshift = 25; 252 };
253 static const u32 extcfg_base_mask[] __initconst = {
254 0x7ff8, 0x7ffc, 0x7ffe, 0x7fff
255 };
256 static const int extcfg_base_lshift __initconst = 25;
253 257
254 /* 258 /*
255 * do check if amd fam10h already took over 259 * do check if amd fam10h already took over
@@ -302,7 +306,7 @@ struct pci_mmcfg_hostbridge_probe {
302 const char *(*probe)(void); 306 const char *(*probe)(void);
303}; 307};
304 308
305static struct pci_mmcfg_hostbridge_probe pci_mmcfg_probes[] __initdata = { 309static const struct pci_mmcfg_hostbridge_probe pci_mmcfg_probes[] __initconst = {
306 { 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_INTEL, 310 { 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_INTEL,
307 PCI_DEVICE_ID_INTEL_E7520_MCH, pci_mmcfg_e7520 }, 311 PCI_DEVICE_ID_INTEL_E7520_MCH, pci_mmcfg_e7520 },
308 { 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_INTEL, 312 { 0, PCI_DEVFN(0, 0), PCI_VENDOR_ID_INTEL,
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index c77b24a8b2da..9b83b9051ae7 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -79,13 +79,13 @@ union bios32 {
79static struct { 79static struct {
80 unsigned long address; 80 unsigned long address;
81 unsigned short segment; 81 unsigned short segment;
82} bios32_indirect = { 0, __KERNEL_CS }; 82} bios32_indirect __initdata = { 0, __KERNEL_CS };
83 83
84/* 84/*
85 * Returns the entry point for the given service, NULL on error 85 * Returns the entry point for the given service, NULL on error
86 */ 86 */
87 87
88static unsigned long bios32_service(unsigned long service) 88static unsigned long __init bios32_service(unsigned long service)
89{ 89{
90 unsigned char return_code; /* %al */ 90 unsigned char return_code; /* %al */
91 unsigned long address; /* %ebx */ 91 unsigned long address; /* %ebx */
@@ -124,7 +124,7 @@ static struct {
124 124
125static int pci_bios_present; 125static int pci_bios_present;
126 126
127static int check_pcibios(void) 127static int __init check_pcibios(void)
128{ 128{
129 u32 signature, eax, ebx, ecx; 129 u32 signature, eax, ebx, ecx;
130 u8 status, major_ver, minor_ver, hw_mech; 130 u8 status, major_ver, minor_ver, hw_mech;
@@ -312,7 +312,7 @@ static const struct pci_raw_ops pci_bios_access = {
312 * Try to find PCI BIOS. 312 * Try to find PCI BIOS.
313 */ 313 */
314 314
315static const struct pci_raw_ops *pci_find_bios(void) 315static const struct pci_raw_ops *__init pci_find_bios(void)
316{ 316{
317 union bios32 *check; 317 union bios32 *check;
318 unsigned char sum; 318 unsigned char sum;
diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
index 7d28c885d238..291226b952a9 100644
--- a/arch/x86/power/hibernate_32.c
+++ b/arch/x86/power/hibernate_32.c
@@ -13,13 +13,11 @@
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15#include <asm/mmzone.h> 15#include <asm/mmzone.h>
16#include <asm/sections.h>
16 17
17/* Defined in hibernate_asm_32.S */ 18/* Defined in hibernate_asm_32.S */
18extern int restore_image(void); 19extern int restore_image(void);
19 20
20/* References to section boundaries */
21extern const void __nosave_begin, __nosave_end;
22
23/* Pointer to the temporary resume page tables */ 21/* Pointer to the temporary resume page tables */
24pgd_t *resume_pg_dir; 22pgd_t *resume_pg_dir;
25 23
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index 35e2bb6c0f37..009947d419a6 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -17,11 +17,9 @@
17#include <asm/page.h> 17#include <asm/page.h>
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <asm/mtrr.h> 19#include <asm/mtrr.h>
20#include <asm/sections.h>
20#include <asm/suspend.h> 21#include <asm/suspend.h>
21 22
22/* References to section boundaries */
23extern __visible const void __nosave_begin, __nosave_end;
24
25/* Defined in hibernate_asm_64.S */ 23/* Defined in hibernate_asm_64.S */
26extern asmlinkage __visible int restore_image(void); 24extern asmlinkage __visible int restore_image(void);
27 25
diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index 7fde9ee438a4..899dd2454256 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -11,6 +11,7 @@ targets += purgatory.ro
11# sure how to relocate those. Like kexec-tools, use custom flags. 11# sure how to relocate those. Like kexec-tools, use custom flags.
12 12
13KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large 13KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large
14KBUILD_CFLAGS += -m$(BITS)
14 15
15$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE 16$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
16 $(call if_changed,ld) 17 $(call if_changed,ld)
@@ -24,7 +25,4 @@ $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
24 $(call if_changed,bin2c) 25 $(call if_changed,bin2c)
25 26
26 27
27# No loaders for 32bits yet. 28obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o
28ifeq ($(CONFIG_X86_64),y)
29 obj-$(CONFIG_KEXEC) += kexec-purgatory.o
30endif
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index 028b78168d85..9fe1b5d002f0 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -363,3 +363,4 @@
363354 i386 seccomp sys_seccomp 363354 i386 seccomp sys_seccomp
364355 i386 getrandom sys_getrandom 364355 i386 getrandom sys_getrandom
365356 i386 memfd_create sys_memfd_create 365356 i386 memfd_create sys_memfd_create
366357 i386 bpf sys_bpf
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index 35dd922727b9..281150b539a2 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -327,6 +327,7 @@
327318 common getrandom sys_getrandom 327318 common getrandom sys_getrandom
328319 common memfd_create sys_memfd_create 328319 common memfd_create sys_memfd_create
329320 common kexec_file_load sys_kexec_file_load 329320 common kexec_file_load sys_kexec_file_load
330321 common bpf sys_bpf
330 331
331# 332#
332# x32-specific system call numbers start at 512 to avoid cache impact 333# x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index e8a1201c3293..16fb0099b7f2 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1866,12 +1866,11 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end,
1866 * 1866 *
1867 * We can construct this by grafting the Xen provided pagetable into 1867 * We can construct this by grafting the Xen provided pagetable into
1868 * head_64.S's preconstructed pagetables. We copy the Xen L2's into 1868 * head_64.S's preconstructed pagetables. We copy the Xen L2's into
1869 * level2_ident_pgt, level2_kernel_pgt and level2_fixmap_pgt. This 1869 * level2_ident_pgt, and level2_kernel_pgt. This means that only the
1870 * means that only the kernel has a physical mapping to start with - 1870 * kernel has a physical mapping to start with - but that's enough to
1871 * but that's enough to get __va working. We need to fill in the rest 1871 * get __va working. We need to fill in the rest of the physical
1872 * of the physical mapping once some sort of allocator has been set 1872 * mapping once some sort of allocator has been set up. NOTE: for
1873 * up. 1873 * PVH, the page tables are native.
1874 * NOTE: for PVH, the page tables are native.
1875 */ 1874 */
1876void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 1875void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1877{ 1876{
@@ -1902,8 +1901,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1902 /* L3_i[0] -> level2_ident_pgt */ 1901 /* L3_i[0] -> level2_ident_pgt */
1903 convert_pfn_mfn(level3_ident_pgt); 1902 convert_pfn_mfn(level3_ident_pgt);
1904 /* L3_k[510] -> level2_kernel_pgt 1903 /* L3_k[510] -> level2_kernel_pgt
1905 * L3_i[511] -> level2_fixmap_pgt */ 1904 * L3_k[511] -> level2_fixmap_pgt */
1906 convert_pfn_mfn(level3_kernel_pgt); 1905 convert_pfn_mfn(level3_kernel_pgt);
1906
1907 /* L3_k[511][506] -> level1_fixmap_pgt */
1908 convert_pfn_mfn(level2_fixmap_pgt);
1907 } 1909 }
1908 /* We get [511][511] and have Xen's version of level2_kernel_pgt */ 1910 /* We get [511][511] and have Xen's version of level2_kernel_pgt */
1909 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); 1911 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd);
@@ -1913,21 +1915,15 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1913 addr[1] = (unsigned long)l3; 1915 addr[1] = (unsigned long)l3;
1914 addr[2] = (unsigned long)l2; 1916 addr[2] = (unsigned long)l2;
1915 /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: 1917 /* Graft it onto L4[272][0]. Note that we creating an aliasing problem:
1916 * Both L4[272][0] and L4[511][511] have entries that point to the same 1918 * Both L4[272][0] and L4[511][510] have entries that point to the same
1917 * L2 (PMD) tables. Meaning that if you modify it in __va space 1919 * L2 (PMD) tables. Meaning that if you modify it in __va space
1918 * it will be also modified in the __ka space! (But if you just 1920 * it will be also modified in the __ka space! (But if you just
1919 * modify the PMD table to point to other PTE's or none, then you 1921 * modify the PMD table to point to other PTE's or none, then you
1920 * are OK - which is what cleanup_highmap does) */ 1922 * are OK - which is what cleanup_highmap does) */
1921 copy_page(level2_ident_pgt, l2); 1923 copy_page(level2_ident_pgt, l2);
1922 /* Graft it onto L4[511][511] */ 1924 /* Graft it onto L4[511][510] */
1923 copy_page(level2_kernel_pgt, l2); 1925 copy_page(level2_kernel_pgt, l2);
1924 1926
1925 /* Get [511][510] and graft that in level2_fixmap_pgt */
1926 l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd);
1927 l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud);
1928 copy_page(level2_fixmap_pgt, l2);
1929 /* Note that we don't do anything with level1_fixmap_pgt which
1930 * we don't need. */
1931 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 1927 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
1932 /* Make pagetable pieces RO */ 1928 /* Make pagetable pieces RO */
1933 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); 1929 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
@@ -1937,6 +1933,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1937 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); 1933 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);
1938 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); 1934 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
1939 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); 1935 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
1936 set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO);
1940 1937
1941 /* Pin down new L4 */ 1938 /* Pin down new L4 */
1942 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, 1939 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 3a617af60d46..49c6c3d94449 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -4,24 +4,23 @@ config ZONE_DMA
4config XTENSA 4config XTENSA
5 def_bool y 5 def_bool y
6 select ARCH_WANT_FRAME_POINTERS 6 select ARCH_WANT_FRAME_POINTERS
7 select HAVE_IDE
8 select GENERIC_ATOMIC64
9 select GENERIC_CLOCKEVENTS
10 select VIRT_TO_BUS
11 select GENERIC_IRQ_SHOW
12 select GENERIC_SCHED_CLOCK
13 select MODULES_USE_ELF_RELA
14 select GENERIC_PCI_IOMAP
15 select ARCH_WANT_IPC_PARSE_VERSION 7 select ARCH_WANT_IPC_PARSE_VERSION
16 select ARCH_WANT_OPTIONAL_GPIOLIB 8 select ARCH_WANT_OPTIONAL_GPIOLIB
17 select BUILDTIME_EXTABLE_SORT 9 select BUILDTIME_EXTABLE_SORT
18 select CLONE_BACKWARDS 10 select CLONE_BACKWARDS
19 select IRQ_DOMAIN 11 select COMMON_CLK
20 select HAVE_OPROFILE 12 select GENERIC_ATOMIC64
13 select GENERIC_CLOCKEVENTS
14 select GENERIC_IRQ_SHOW
15 select GENERIC_PCI_IOMAP
16 select GENERIC_SCHED_CLOCK
21 select HAVE_FUNCTION_TRACER 17 select HAVE_FUNCTION_TRACER
22 select HAVE_IRQ_TIME_ACCOUNTING 18 select HAVE_IRQ_TIME_ACCOUNTING
19 select HAVE_OPROFILE
23 select HAVE_PERF_EVENTS 20 select HAVE_PERF_EVENTS
24 select COMMON_CLK 21 select IRQ_DOMAIN
22 select MODULES_USE_ELF_RELA
23 select VIRT_TO_BUS
25 help 24 help
26 Xtensa processors are 32-bit RISC machines designed by Tensilica 25 Xtensa processors are 32-bit RISC machines designed by Tensilica
27 primarily for embedded systems. These processors are both 26 primarily for embedded systems. These processors are both
@@ -62,7 +61,9 @@ config TRACE_IRQFLAGS_SUPPORT
62 def_bool y 61 def_bool y
63 62
64config MMU 63config MMU
65 def_bool n 64 bool
65 default n if !XTENSA_VARIANT_CUSTOM
66 default XTENSA_VARIANT_MMU if XTENSA_VARIANT_CUSTOM
66 67
67config VARIANT_IRQ_SWITCH 68config VARIANT_IRQ_SWITCH
68 def_bool n 69 def_bool n
@@ -102,8 +103,40 @@ config XTENSA_VARIANT_S6000
102 select VARIANT_IRQ_SWITCH 103 select VARIANT_IRQ_SWITCH
103 select ARCH_REQUIRE_GPIOLIB 104 select ARCH_REQUIRE_GPIOLIB
104 select XTENSA_CALIBRATE_CCOUNT 105 select XTENSA_CALIBRATE_CCOUNT
106
107config XTENSA_VARIANT_CUSTOM
108 bool "Custom Xtensa processor configuration"
109 select MAY_HAVE_SMP
110 select HAVE_XTENSA_GPIO32
111 help
112 Select this variant to use a custom Xtensa processor configuration.
113 You will be prompted for a processor variant CORENAME.
105endchoice 114endchoice
106 115
116config XTENSA_VARIANT_CUSTOM_NAME
117 string "Xtensa Processor Custom Core Variant Name"
118 depends on XTENSA_VARIANT_CUSTOM
119 help
120 Provide the name of a custom Xtensa processor variant.
121 This CORENAME selects arch/xtensa/variant/CORENAME.
122 Dont forget you have to select MMU if you have one.
123
124config XTENSA_VARIANT_NAME
125 string
126 default "dc232b" if XTENSA_VARIANT_DC232B
127 default "dc233c" if XTENSA_VARIANT_DC233C
128 default "fsf" if XTENSA_VARIANT_FSF
129 default "s6000" if XTENSA_VARIANT_S6000
130 default XTENSA_VARIANT_CUSTOM_NAME if XTENSA_VARIANT_CUSTOM
131
132config XTENSA_VARIANT_MMU
133 bool "Core variant has a Full MMU (TLB, Pages, Protection, etc)"
134 depends on XTENSA_VARIANT_CUSTOM
135 default y
136 help
137 Build a Conventional Kernel with full MMU support,
138 ie: it supports a TLB with auto-loading, page protection.
139
107config XTENSA_UNALIGNED_USER 140config XTENSA_UNALIGNED_USER
108 bool "Unaligned memory access in use space" 141 bool "Unaligned memory access in use space"
109 help 142 help
@@ -156,13 +189,9 @@ config HOTPLUG_CPU
156 189
157 Say N if you want to disable CPU hotplug. 190 Say N if you want to disable CPU hotplug.
158 191
159config MATH_EMULATION
160 bool "Math emulation"
161 help
162 Can we use information of configuration file?
163
164config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX 192config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
165 bool "Initialize Xtensa MMU inside the Linux kernel code" 193 bool "Initialize Xtensa MMU inside the Linux kernel code"
194 depends on MMU
166 default y 195 default y
167 help 196 help
168 Earlier version initialized the MMU in the exception vector 197 Earlier version initialized the MMU in the exception vector
@@ -192,6 +221,7 @@ config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
192 221
193config HIGHMEM 222config HIGHMEM
194 bool "High Memory Support" 223 bool "High Memory Support"
224 depends on MMU
195 help 225 help
196 Linux can use the full amount of RAM in the system by 226 Linux can use the full amount of RAM in the system by
197 default. However, the default MMUv2 setup only maps the 227 default. However, the default MMUv2 setup only maps the
@@ -208,6 +238,32 @@ config HIGHMEM
208 238
209 If unsure, say Y. 239 If unsure, say Y.
210 240
241config FAST_SYSCALL_XTENSA
242 bool "Enable fast atomic syscalls"
243 default n
244 help
245 fast_syscall_xtensa is a syscall that can make atomic operations
246 on UP kernel when processor has no s32c1i support.
247
248 This syscall is deprecated. It may have issues when called with
249 invalid arguments. It is provided only for backwards compatibility.
250 Only enable it if your userspace software requires it.
251
252 If unsure, say N.
253
254config FAST_SYSCALL_SPILL_REGISTERS
255 bool "Enable spill registers syscall"
256 default n
257 help
258 fast_syscall_spill_registers is a syscall that spills all active
259 register windows of a calling userspace task onto its stack.
260
261 This syscall is deprecated. It may have issues when called with
262 invalid arguments. It is provided only for backwards compatibility.
263 Only enable it if your userspace software requires it.
264
265 If unsure, say N.
266
211endmenu 267endmenu
212 268
213config XTENSA_CALIBRATE_CCOUNT 269config XTENSA_CALIBRATE_CCOUNT
@@ -250,12 +306,14 @@ config XTENSA_PLATFORM_ISS
250 306
251config XTENSA_PLATFORM_XT2000 307config XTENSA_PLATFORM_XT2000
252 bool "XT2000" 308 bool "XT2000"
309 select HAVE_IDE
253 help 310 help
254 XT2000 is the name of Tensilica's feature-rich emulation platform. 311 XT2000 is the name of Tensilica's feature-rich emulation platform.
255 This hardware is capable of running a full Linux distribution. 312 This hardware is capable of running a full Linux distribution.
256 313
257config XTENSA_PLATFORM_S6105 314config XTENSA_PLATFORM_S6105
258 bool "S6105" 315 bool "S6105"
316 select HAVE_IDE
259 select SERIAL_CONSOLE 317 select SERIAL_CONSOLE
260 select NO_IOPORT_MAP 318 select NO_IOPORT_MAP
261 319
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 81250ece3062..472533064b46 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -4,6 +4,7 @@
4# for more details. 4# for more details.
5# 5#
6# Copyright (C) 2001 - 2005 Tensilica Inc. 6# Copyright (C) 2001 - 2005 Tensilica Inc.
7# Copyright (C) 2014 Cadence Design Systems Inc.
7# 8#
8# This file is included by the global makefile so that you can add your own 9# This file is included by the global makefile so that you can add your own
9# architecture-specific flags and dependencies. Remember to do have actions 10# architecture-specific flags and dependencies. Remember to do have actions
@@ -13,11 +14,7 @@
13# Core configuration. 14# Core configuration.
14# (Use VAR=<xtensa_config> to use another default compiler.) 15# (Use VAR=<xtensa_config> to use another default compiler.)
15 16
16variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf 17variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME))
17variant-$(CONFIG_XTENSA_VARIANT_DC232B) := dc232b
18variant-$(CONFIG_XTENSA_VARIANT_DC233C) := dc233c
19variant-$(CONFIG_XTENSA_VARIANT_S6000) := s6000
20variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom
21 18
22VARIANT = $(variant-y) 19VARIANT = $(variant-y)
23export VARIANT 20export VARIANT
diff --git a/arch/xtensa/boot/dts/kc705.dts b/arch/xtensa/boot/dts/kc705.dts
index 742a347be67a..c4d17a34ab86 100644
--- a/arch/xtensa/boot/dts/kc705.dts
+++ b/arch/xtensa/boot/dts/kc705.dts
@@ -4,8 +4,11 @@
4 4
5/ { 5/ {
6 compatible = "cdns,xtensa-kc705"; 6 compatible = "cdns,xtensa-kc705";
7 chosen {
8 bootargs = "earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000";
9 };
7 memory@0 { 10 memory@0 {
8 device_type = "memory"; 11 device_type = "memory";
9 reg = <0x00000000 0x08000000>; 12 reg = <0x00000000 0x38000000>;
10 }; 13 };
11}; 14};
diff --git a/arch/xtensa/configs/common_defconfig b/arch/xtensa/configs/common_defconfig
index f6000fe05119..721df1214bc3 100644
--- a/arch/xtensa/configs/common_defconfig
+++ b/arch/xtensa/configs/common_defconfig
@@ -66,7 +66,6 @@ CONFIG_XTENSA_ARCH_LINUX_BE=y
66CONFIG_MMU=y 66CONFIG_MMU=y
67# CONFIG_XTENSA_UNALIGNED_USER is not set 67# CONFIG_XTENSA_UNALIGNED_USER is not set
68# CONFIG_PREEMPT is not set 68# CONFIG_PREEMPT is not set
69# CONFIG_MATH_EMULATION is not set
70# CONFIG_HIGHMEM is not set 69# CONFIG_HIGHMEM is not set
71 70
72# 71#
diff --git a/arch/xtensa/configs/iss_defconfig b/arch/xtensa/configs/iss_defconfig
index 1493c68352d1..b966baf82cae 100644
--- a/arch/xtensa/configs/iss_defconfig
+++ b/arch/xtensa/configs/iss_defconfig
@@ -146,7 +146,6 @@ CONFIG_XTENSA_VARIANT_FSF=y
146# CONFIG_XTENSA_VARIANT_S6000 is not set 146# CONFIG_XTENSA_VARIANT_S6000 is not set
147# CONFIG_XTENSA_UNALIGNED_USER is not set 147# CONFIG_XTENSA_UNALIGNED_USER is not set
148# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
149# CONFIG_MATH_EMULATION is not set
150CONFIG_XTENSA_CALIBRATE_CCOUNT=y 149CONFIG_XTENSA_CALIBRATE_CCOUNT=y
151CONFIG_SERIAL_CONSOLE=y 150CONFIG_SERIAL_CONSOLE=y
152CONFIG_XTENSA_ISS_NETWORK=y 151CONFIG_XTENSA_ISS_NETWORK=y
@@ -308,7 +307,7 @@ CONFIG_MISC_DEVICES=y
308# EEPROM support 307# EEPROM support
309# 308#
310# CONFIG_EEPROM_93CX6 is not set 309# CONFIG_EEPROM_93CX6 is not set
311CONFIG_HAVE_IDE=y 310# CONFIG_HAVE_IDE is not set
312# CONFIG_IDE is not set 311# CONFIG_IDE is not set
313 312
314# 313#
diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig
index 12a492ab6d17..9471265b8ca6 100644
--- a/arch/xtensa/configs/s6105_defconfig
+++ b/arch/xtensa/configs/s6105_defconfig
@@ -109,7 +109,6 @@ CONFIG_VARIANT_IRQ_SWITCH=y
109CONFIG_XTENSA_VARIANT_S6000=y 109CONFIG_XTENSA_VARIANT_S6000=y
110# CONFIG_XTENSA_UNALIGNED_USER is not set 110# CONFIG_XTENSA_UNALIGNED_USER is not set
111CONFIG_PREEMPT=y 111CONFIG_PREEMPT=y
112# CONFIG_MATH_EMULATION is not set
113# CONFIG_HIGHMEM is not set 112# CONFIG_HIGHMEM is not set
114CONFIG_XTENSA_CALIBRATE_CCOUNT=y 113CONFIG_XTENSA_CALIBRATE_CCOUNT=y
115CONFIG_SERIAL_CONSOLE=y 114CONFIG_SERIAL_CONSOLE=y
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index c3d20ba6eb86..105d38922c44 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -12,6 +12,7 @@ generic-y += hardirq.h
12generic-y += hash.h 12generic-y += hash.h
13generic-y += ioctl.h 13generic-y += ioctl.h
14generic-y += irq_regs.h 14generic-y += irq_regs.h
15generic-y += irq_work.h
15generic-y += kdebug.h 16generic-y += kdebug.h
16generic-y += kmap_types.h 17generic-y += kmap_types.h
17generic-y += kvm_para.h 18generic-y += kvm_para.h
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index 555a98a18453..e72aaca7a77f 100644
--- a/arch/xtensa/include/asm/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
@@ -37,6 +37,7 @@
37 * specials for cache aliasing: 37 * specials for cache aliasing:
38 * 38 *
39 * __flush_invalidate_dcache_page_alias(vaddr,paddr) 39 * __flush_invalidate_dcache_page_alias(vaddr,paddr)
40 * __invalidate_dcache_page_alias(vaddr,paddr)
40 * __invalidate_icache_page_alias(vaddr,paddr) 41 * __invalidate_icache_page_alias(vaddr,paddr)
41 */ 42 */
42 43
@@ -62,6 +63,7 @@ extern void __flush_invalidate_dcache_range(unsigned long, unsigned long);
62 63
63#if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE) 64#if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE)
64extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long); 65extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long);
66extern void __invalidate_dcache_page_alias(unsigned long, unsigned long);
65#else 67#else
66static inline void __flush_invalidate_dcache_page_alias(unsigned long virt, 68static inline void __flush_invalidate_dcache_page_alias(unsigned long virt,
67 unsigned long phys) { } 69 unsigned long phys) { }
diff --git a/arch/xtensa/include/asm/fixmap.h b/arch/xtensa/include/asm/fixmap.h
index 9f6c33d0428a..62b507deea9d 100644
--- a/arch/xtensa/include/asm/fixmap.h
+++ b/arch/xtensa/include/asm/fixmap.h
@@ -23,8 +23,8 @@
23 * Here we define all the compile-time 'special' virtual 23 * Here we define all the compile-time 'special' virtual
24 * addresses. The point is to have a constant address at 24 * addresses. The point is to have a constant address at
25 * compile time, but to set the physical address only 25 * compile time, but to set the physical address only
26 * in the boot process. We allocate these special addresses 26 * in the boot process. We allocate these special addresses
27 * from the end of the consistent memory region backwards. 27 * from the start of the consistent memory region upwards.
28 * Also this lets us do fail-safe vmalloc(), we 28 * Also this lets us do fail-safe vmalloc(), we
29 * can guarantee that these special addresses and 29 * can guarantee that these special addresses and
30 * vmalloc()-ed addresses never overlap. 30 * vmalloc()-ed addresses never overlap.
@@ -38,7 +38,8 @@ enum fixed_addresses {
38#ifdef CONFIG_HIGHMEM 38#ifdef CONFIG_HIGHMEM
39 /* reserved pte's for temporary kernel mappings */ 39 /* reserved pte's for temporary kernel mappings */
40 FIX_KMAP_BEGIN, 40 FIX_KMAP_BEGIN,
41 FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1, 41 FIX_KMAP_END = FIX_KMAP_BEGIN +
42 (KM_TYPE_NR * NR_CPUS * DCACHE_N_COLORS) - 1,
42#endif 43#endif
43 __end_of_fixed_addresses 44 __end_of_fixed_addresses
44}; 45};
@@ -47,7 +48,28 @@ enum fixed_addresses {
47#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 48#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
48#define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK) 49#define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK)
49 50
50#include <asm-generic/fixmap.h> 51#define __fix_to_virt(x) (FIXADDR_START + ((x) << PAGE_SHIFT))
52#define __virt_to_fix(x) (((x) - FIXADDR_START) >> PAGE_SHIFT)
53
54#ifndef __ASSEMBLY__
55/*
56 * 'index to address' translation. If anyone tries to use the idx
57 * directly without translation, we catch the bug with a NULL-deference
58 * kernel oops. Illegal ranges of incoming indices are caught too.
59 */
60static __always_inline unsigned long fix_to_virt(const unsigned int idx)
61{
62 BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
63 return __fix_to_virt(idx);
64}
65
66static inline unsigned long virt_to_fix(const unsigned long vaddr)
67{
68 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
69 return __virt_to_fix(vaddr);
70}
71
72#endif
51 73
52#define kmap_get_fixmap_pte(vaddr) \ 74#define kmap_get_fixmap_pte(vaddr) \
53 pte_offset_kernel( \ 75 pte_offset_kernel( \
diff --git a/arch/xtensa/include/asm/highmem.h b/arch/xtensa/include/asm/highmem.h
index 2653ef5d55f1..2c7901edffaf 100644
--- a/arch/xtensa/include/asm/highmem.h
+++ b/arch/xtensa/include/asm/highmem.h
@@ -12,19 +12,55 @@
12#ifndef _XTENSA_HIGHMEM_H 12#ifndef _XTENSA_HIGHMEM_H
13#define _XTENSA_HIGHMEM_H 13#define _XTENSA_HIGHMEM_H
14 14
15#include <linux/wait.h>
15#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
16#include <asm/fixmap.h> 17#include <asm/fixmap.h>
17#include <asm/kmap_types.h> 18#include <asm/kmap_types.h>
18#include <asm/pgtable.h> 19#include <asm/pgtable.h>
19 20
20#define PKMAP_BASE (FIXADDR_START - PMD_SIZE) 21#define PKMAP_BASE ((FIXADDR_START - \
21#define LAST_PKMAP PTRS_PER_PTE 22 (LAST_PKMAP + 1) * PAGE_SIZE) & PMD_MASK)
23#define LAST_PKMAP (PTRS_PER_PTE * DCACHE_N_COLORS)
22#define LAST_PKMAP_MASK (LAST_PKMAP - 1) 24#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
23#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT) 25#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
24#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 26#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
25 27
26#define kmap_prot PAGE_KERNEL 28#define kmap_prot PAGE_KERNEL
27 29
30#if DCACHE_WAY_SIZE > PAGE_SIZE
31#define get_pkmap_color get_pkmap_color
32static inline int get_pkmap_color(struct page *page)
33{
34 return DCACHE_ALIAS(page_to_phys(page));
35}
36
37extern unsigned int last_pkmap_nr_arr[];
38
39static inline unsigned int get_next_pkmap_nr(unsigned int color)
40{
41 last_pkmap_nr_arr[color] =
42 (last_pkmap_nr_arr[color] + DCACHE_N_COLORS) & LAST_PKMAP_MASK;
43 return last_pkmap_nr_arr[color] + color;
44}
45
46static inline int no_more_pkmaps(unsigned int pkmap_nr, unsigned int color)
47{
48 return pkmap_nr < DCACHE_N_COLORS;
49}
50
51static inline int get_pkmap_entries_count(unsigned int color)
52{
53 return LAST_PKMAP / DCACHE_N_COLORS;
54}
55
56extern wait_queue_head_t pkmap_map_wait_arr[];
57
58static inline wait_queue_head_t *get_pkmap_wait_queue_head(unsigned int color)
59{
60 return pkmap_map_wait_arr + color;
61}
62#endif
63
28extern pte_t *pkmap_page_table; 64extern pte_t *pkmap_page_table;
29 65
30void *kmap_high(struct page *page); 66void *kmap_high(struct page *page);
diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h
index 47f582333f6b..abe24c6f8b2f 100644
--- a/arch/xtensa/include/asm/page.h
+++ b/arch/xtensa/include/asm/page.h
@@ -78,7 +78,9 @@
78# define DCACHE_ALIAS_EQ(a,b) ((((a) ^ (b)) & DCACHE_ALIAS_MASK) == 0) 78# define DCACHE_ALIAS_EQ(a,b) ((((a) ^ (b)) & DCACHE_ALIAS_MASK) == 0)
79#else 79#else
80# define DCACHE_ALIAS_ORDER 0 80# define DCACHE_ALIAS_ORDER 0
81# define DCACHE_ALIAS(a) ((void)(a), 0)
81#endif 82#endif
83#define DCACHE_N_COLORS (1 << DCACHE_ALIAS_ORDER)
82 84
83#if ICACHE_WAY_SIZE > PAGE_SIZE 85#if ICACHE_WAY_SIZE > PAGE_SIZE
84# define ICACHE_ALIAS_ORDER (ICACHE_WAY_SHIFT - PAGE_SHIFT) 86# define ICACHE_ALIAS_ORDER (ICACHE_WAY_SHIFT - PAGE_SHIFT)
@@ -134,6 +136,7 @@ static inline __attribute_const__ int get_order(unsigned long size)
134#endif 136#endif
135 137
136struct page; 138struct page;
139struct vm_area_struct;
137extern void clear_page(void *page); 140extern void clear_page(void *page);
138extern void copy_page(void *to, void *from); 141extern void copy_page(void *to, void *from);
139 142
@@ -143,8 +146,15 @@ extern void copy_page(void *to, void *from);
143 */ 146 */
144 147
145#if DCACHE_WAY_SIZE > PAGE_SIZE 148#if DCACHE_WAY_SIZE > PAGE_SIZE
146extern void clear_user_page(void*, unsigned long, struct page*); 149extern void clear_page_alias(void *vaddr, unsigned long paddr);
147extern void copy_user_page(void*, void*, unsigned long, struct page*); 150extern void copy_page_alias(void *to, void *from,
151 unsigned long to_paddr, unsigned long from_paddr);
152
153#define clear_user_highpage clear_user_highpage
154void clear_user_highpage(struct page *page, unsigned long vaddr);
155#define __HAVE_ARCH_COPY_USER_HIGHPAGE
156void copy_user_highpage(struct page *to, struct page *from,
157 unsigned long vaddr, struct vm_area_struct *vma);
148#else 158#else
149# define clear_user_page(page, vaddr, pg) clear_page(page) 159# define clear_user_page(page, vaddr, pg) clear_page(page)
150# define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 160# define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 4b0ca35a93b1..b2173e5da601 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -67,7 +67,12 @@
67#define VMALLOC_START 0xC0000000 67#define VMALLOC_START 0xC0000000
68#define VMALLOC_END 0xC7FEFFFF 68#define VMALLOC_END 0xC7FEFFFF
69#define TLBTEMP_BASE_1 0xC7FF0000 69#define TLBTEMP_BASE_1 0xC7FF0000
70#define TLBTEMP_BASE_2 0xC7FF8000 70#define TLBTEMP_BASE_2 (TLBTEMP_BASE_1 + DCACHE_WAY_SIZE)
71#if 2 * DCACHE_WAY_SIZE > ICACHE_WAY_SIZE
72#define TLBTEMP_SIZE (2 * DCACHE_WAY_SIZE)
73#else
74#define TLBTEMP_SIZE ICACHE_WAY_SIZE
75#endif
71 76
72/* 77/*
73 * For the Xtensa architecture, the PTE layout is as follows: 78 * For the Xtensa architecture, the PTE layout is as follows:
diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h
index fd686dc45d1a..c7211e7e182d 100644
--- a/arch/xtensa/include/asm/uaccess.h
+++ b/arch/xtensa/include/asm/uaccess.h
@@ -52,7 +52,12 @@
52 */ 52 */
53 .macro get_fs ad, sp 53 .macro get_fs ad, sp
54 GET_CURRENT(\ad,\sp) 54 GET_CURRENT(\ad,\sp)
55#if THREAD_CURRENT_DS > 1020
56 addi \ad, \ad, TASK_THREAD
57 l32i \ad, \ad, THREAD_CURRENT_DS - TASK_THREAD
58#else
55 l32i \ad, \ad, THREAD_CURRENT_DS 59 l32i \ad, \ad, THREAD_CURRENT_DS
60#endif
56 .endm 61 .endm
57 62
58/* 63/*
diff --git a/arch/xtensa/include/uapi/asm/ioctls.h b/arch/xtensa/include/uapi/asm/ioctls.h
index b4cb1100c0fb..518954e74e6d 100644
--- a/arch/xtensa/include/uapi/asm/ioctls.h
+++ b/arch/xtensa/include/uapi/asm/ioctls.h
@@ -28,17 +28,17 @@
28#define TCSETSW 0x5403 28#define TCSETSW 0x5403
29#define TCSETSF 0x5404 29#define TCSETSF 0x5404
30 30
31#define TCGETA _IOR('t', 23, struct termio) 31#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */
32#define TCSETA _IOW('t', 24, struct termio) 32#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */
33#define TCSETAW _IOW('t', 25, struct termio) 33#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */
34#define TCSETAF _IOW('t', 28, struct termio) 34#define TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */
35 35
36#define TCSBRK _IO('t', 29) 36#define TCSBRK _IO('t', 29)
37#define TCXONC _IO('t', 30) 37#define TCXONC _IO('t', 30)
38#define TCFLSH _IO('t', 31) 38#define TCFLSH _IO('t', 31)
39 39
40#define TIOCSWINSZ _IOW('t', 103, struct winsize) 40#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */
41#define TIOCGWINSZ _IOR('t', 104, struct winsize) 41#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */
42#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ 42#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
43#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ 43#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
44#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ 44#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
@@ -88,7 +88,6 @@
88#define TIOCSETD _IOW('T', 35, int) 88#define TIOCSETD _IOW('T', 35, int)
89#define TIOCGETD _IOR('T', 36, int) 89#define TIOCGETD _IOR('T', 36, int)
90#define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/ 90#define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/
91#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* For debugging only*/
92#define TIOCSBRK _IO('T', 39) /* BSD compatibility */ 91#define TIOCSBRK _IO('T', 39) /* BSD compatibility */
93#define TIOCCBRK _IO('T', 40) /* BSD compatibility */ 92#define TIOCCBRK _IO('T', 40) /* BSD compatibility */
94#define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/ 93#define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/
@@ -96,6 +95,8 @@
96#define TCSETS2 _IOW('T', 43, struct termios2) 95#define TCSETS2 _IOW('T', 43, struct termios2)
97#define TCSETSW2 _IOW('T', 44, struct termios2) 96#define TCSETSW2 _IOW('T', 44, struct termios2)
98#define TCSETSF2 _IOW('T', 45, struct termios2) 97#define TCSETSF2 _IOW('T', 45, struct termios2)
98#define TIOCGRS485 _IOR('T', 46, struct serial_rs485)
99#define TIOCSRS485 _IOWR('T', 47, struct serial_rs485)
99#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 100#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
100#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 101#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
101#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ 102#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
@@ -114,8 +115,10 @@
114#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */ 115#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */
115 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 116 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
116# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 117# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
117#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* Get multiport config */ 118#define TIOCSERGETMULTI 0x80a8545a /* Get multiport config */
118#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */ 119 /* _IOR('T', 90, struct serial_multiport_struct) */
120#define TIOCSERSETMULTI 0x40a8545b /* Set multiport config */
121 /* _IOW('T', 91, struct serial_multiport_struct) */
119 122
120#define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ 123#define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */
121#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 124#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h
index b9395529f02d..8883fc877c5c 100644
--- a/arch/xtensa/include/uapi/asm/unistd.h
+++ b/arch/xtensa/include/uapi/asm/unistd.h
@@ -739,7 +739,10 @@ __SYSCALL(334, sys_sched_setattr, 2)
739#define __NR_sched_getattr 335 739#define __NR_sched_getattr 335
740__SYSCALL(335, sys_sched_getattr, 3) 740__SYSCALL(335, sys_sched_getattr, 3)
741 741
742#define __NR_syscall_count 336 742#define __NR_renameat2 336
743__SYSCALL(336, sys_renameat2, 5)
744
745#define __NR_syscall_count 337
743 746
744/* 747/*
745 * sysxtensa syscall handler 748 * sysxtensa syscall handler
diff --git a/arch/xtensa/kernel/align.S b/arch/xtensa/kernel/align.S
index d4cef6039a5c..890004af03a9 100644
--- a/arch/xtensa/kernel/align.S
+++ b/arch/xtensa/kernel/align.S
@@ -8,6 +8,7 @@
8 * this archive for more details. 8 * this archive for more details.
9 * 9 *
10 * Copyright (C) 2001 - 2005 Tensilica, Inc. 10 * Copyright (C) 2001 - 2005 Tensilica, Inc.
11 * Copyright (C) 2014 Cadence Design Systems Inc.
11 * 12 *
12 * Rewritten by Chris Zankel <chris@zankel.net> 13 * Rewritten by Chris Zankel <chris@zankel.net>
13 * 14 *
@@ -174,6 +175,10 @@ ENTRY(fast_unaligned)
174 s32i a0, a2, PT_AREG2 175 s32i a0, a2, PT_AREG2
175 s32i a3, a2, PT_AREG3 176 s32i a3, a2, PT_AREG3
176 177
178 rsr a3, excsave1
179 movi a4, fast_unaligned_fixup
180 s32i a4, a3, EXC_TABLE_FIXUP
181
177 /* Keep value of SAR in a0 */ 182 /* Keep value of SAR in a0 */
178 183
179 rsr a0, sar 184 rsr a0, sar
@@ -225,10 +230,6 @@ ENTRY(fast_unaligned)
225 addx8 a5, a6, a5 230 addx8 a5, a6, a5
226 jx a5 # jump into table 231 jx a5 # jump into table
227 232
228 /* Invalid instruction, CRITICAL! */
229.Linvalid_instruction_load:
230 j .Linvalid_instruction
231
232 /* Load: Load memory address. */ 233 /* Load: Load memory address. */
233 234
234.Lload: movi a3, ~3 235.Lload: movi a3, ~3
@@ -272,18 +273,6 @@ ENTRY(fast_unaligned)
272 /* Set target register. */ 273 /* Set target register. */
273 274
2741: 2751:
275
276#if XCHAL_HAVE_LOOPS
277 rsr a5, lend # check if we reached LEND
278 bne a7, a5, 1f
279 rsr a5, lcount # and LCOUNT != 0
280 beqz a5, 1f
281 addi a5, a5, -1 # decrement LCOUNT and set
282 rsr a7, lbeg # set PC to LBEGIN
283 wsr a5, lcount
284#endif
285
2861: wsr a7, epc1 # skip load instruction
287 extui a4, a4, INSN_T, 4 # extract target register 276 extui a4, a4, INSN_T, 4 # extract target register
288 movi a5, .Lload_table 277 movi a5, .Lload_table
289 addx8 a4, a4, a5 278 addx8 a4, a4, a5
@@ -326,6 +315,35 @@ ENTRY(fast_unaligned)
326 mov a3, a14 ; _j 1f; .align 8 315 mov a3, a14 ; _j 1f; .align 8
327 mov a3, a15 ; _j 1f; .align 8 316 mov a3, a15 ; _j 1f; .align 8
328 317
318 /* We cannot handle this exception. */
319
320 .extern _kernel_exception
321.Linvalid_instruction_load:
322.Linvalid_instruction_store:
323
324 movi a4, 0
325 rsr a3, excsave1
326 s32i a4, a3, EXC_TABLE_FIXUP
327
328 /* Restore a4...a8 and SAR, set SP, and jump to default exception. */
329
330 l32i a8, a2, PT_AREG8
331 l32i a7, a2, PT_AREG7
332 l32i a6, a2, PT_AREG6
333 l32i a5, a2, PT_AREG5
334 l32i a4, a2, PT_AREG4
335 wsr a0, sar
336 mov a1, a2
337
338 rsr a0, ps
339 bbsi.l a0, PS_UM_BIT, 2f # jump if user mode
340
341 movi a0, _kernel_exception
342 jx a0
343
3442: movi a0, _user_exception
345 jx a0
346
3291: # a7: instruction pointer, a4: instruction, a3: value 3471: # a7: instruction pointer, a4: instruction, a3: value
330 348
331 movi a6, 0 # mask: ffffffff:00000000 349 movi a6, 0 # mask: ffffffff:00000000
@@ -353,17 +371,6 @@ ENTRY(fast_unaligned)
353 /* Get memory address */ 371 /* Get memory address */
354 372
3551: 3731:
356#if XCHAL_HAVE_LOOPS
357 rsr a4, lend # check if we reached LEND
358 bne a7, a4, 1f
359 rsr a4, lcount # and LCOUNT != 0
360 beqz a4, 1f
361 addi a4, a4, -1 # decrement LCOUNT and set
362 rsr a7, lbeg # set PC to LBEGIN
363 wsr a4, lcount
364#endif
365
3661: wsr a7, epc1 # skip store instruction
367 movi a4, ~3 374 movi a4, ~3
368 and a4, a4, a8 # align memory address 375 and a4, a4, a8 # align memory address
369 376
@@ -375,25 +382,25 @@ ENTRY(fast_unaligned)
375#endif 382#endif
376 383
377 __ssa8r a8 384 __ssa8r a8
378 __src_b a7, a5, a6 # lo-mask F..F0..0 (BE) 0..0F..F (LE) 385 __src_b a8, a5, a6 # lo-mask F..F0..0 (BE) 0..0F..F (LE)
379 __src_b a6, a6, a5 # hi-mask 0..0F..F (BE) F..F0..0 (LE) 386 __src_b a6, a6, a5 # hi-mask 0..0F..F (BE) F..F0..0 (LE)
380#ifdef UNALIGNED_USER_EXCEPTION 387#ifdef UNALIGNED_USER_EXCEPTION
381 l32e a5, a4, -8 388 l32e a5, a4, -8
382#else 389#else
383 l32i a5, a4, 0 # load lower address word 390 l32i a5, a4, 0 # load lower address word
384#endif 391#endif
385 and a5, a5, a7 # mask 392 and a5, a5, a8 # mask
386 __sh a7, a3 # shift value 393 __sh a8, a3 # shift value
387 or a5, a5, a7 # or with original value 394 or a5, a5, a8 # or with original value
388#ifdef UNALIGNED_USER_EXCEPTION 395#ifdef UNALIGNED_USER_EXCEPTION
389 s32e a5, a4, -8 396 s32e a5, a4, -8
390 l32e a7, a4, -4 397 l32e a8, a4, -4
391#else 398#else
392 s32i a5, a4, 0 # store 399 s32i a5, a4, 0 # store
393 l32i a7, a4, 4 # same for upper address word 400 l32i a8, a4, 4 # same for upper address word
394#endif 401#endif
395 __sl a5, a3 402 __sl a5, a3
396 and a6, a7, a6 403 and a6, a8, a6
397 or a6, a6, a5 404 or a6, a6, a5
398#ifdef UNALIGNED_USER_EXCEPTION 405#ifdef UNALIGNED_USER_EXCEPTION
399 s32e a6, a4, -4 406 s32e a6, a4, -4
@@ -401,9 +408,27 @@ ENTRY(fast_unaligned)
401 s32i a6, a4, 4 408 s32i a6, a4, 4
402#endif 409#endif
403 410
404 /* Done. restore stack and return */
405
406.Lexit: 411.Lexit:
412#if XCHAL_HAVE_LOOPS
413 rsr a4, lend # check if we reached LEND
414 bne a7, a4, 1f
415 rsr a4, lcount # and LCOUNT != 0
416 beqz a4, 1f
417 addi a4, a4, -1 # decrement LCOUNT and set
418 rsr a7, lbeg # set PC to LBEGIN
419 wsr a4, lcount
420#endif
421
4221: wsr a7, epc1 # skip emulated instruction
423
424 /* Update icount if we're single-stepping in userspace. */
425 rsr a4, icountlevel
426 beqz a4, 1f
427 bgeui a4, LOCKLEVEL + 1, 1f
428 rsr a4, icount
429 addi a4, a4, 1
430 wsr a4, icount
4311:
407 movi a4, 0 432 movi a4, 0
408 rsr a3, excsave1 433 rsr a3, excsave1
409 s32i a4, a3, EXC_TABLE_FIXUP 434 s32i a4, a3, EXC_TABLE_FIXUP
@@ -424,31 +449,40 @@ ENTRY(fast_unaligned)
424 l32i a2, a2, PT_AREG2 449 l32i a2, a2, PT_AREG2
425 rfe 450 rfe
426 451
427 /* We cannot handle this exception. */ 452ENDPROC(fast_unaligned)
428 453
429 .extern _kernel_exception 454ENTRY(fast_unaligned_fixup)
430.Linvalid_instruction_store:
431.Linvalid_instruction:
432 455
433 /* Restore a4...a8 and SAR, set SP, and jump to default exception. */ 456 l32i a2, a3, EXC_TABLE_DOUBLE_SAVE
457 wsr a3, excsave1
434 458
435 l32i a8, a2, PT_AREG8 459 l32i a8, a2, PT_AREG8
436 l32i a7, a2, PT_AREG7 460 l32i a7, a2, PT_AREG7
437 l32i a6, a2, PT_AREG6 461 l32i a6, a2, PT_AREG6
438 l32i a5, a2, PT_AREG5 462 l32i a5, a2, PT_AREG5
439 l32i a4, a2, PT_AREG4 463 l32i a4, a2, PT_AREG4
464 l32i a0, a2, PT_AREG2
465 xsr a0, depc # restore depc and a0
440 wsr a0, sar 466 wsr a0, sar
441 mov a1, a2 467
468 rsr a0, exccause
469 s32i a0, a2, PT_DEPC # mark as a regular exception
442 470
443 rsr a0, ps 471 rsr a0, ps
444 bbsi.l a2, PS_UM_BIT, 1f # jump if user mode 472 bbsi.l a0, PS_UM_BIT, 1f # jump if user mode
445 473
446 movi a0, _kernel_exception 474 rsr a0, exccause
475 addx4 a0, a0, a3 # find entry in table
476 l32i a0, a0, EXC_TABLE_FAST_KERNEL # load handler
477 l32i a3, a2, PT_AREG3
447 jx a0 478 jx a0
448 4791:
4491: movi a0, _user_exception 480 rsr a0, exccause
481 addx4 a0, a0, a3 # find entry in table
482 l32i a0, a0, EXC_TABLE_FAST_USER # load handler
483 l32i a3, a2, PT_AREG3
450 jx a0 484 jx a0
451 485
452ENDPROC(fast_unaligned) 486ENDPROC(fast_unaligned_fixup)
453 487
454#endif /* XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION */ 488#endif /* XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION */
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index ef7f4990722b..82bbfa5a05b3 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -986,6 +986,8 @@ ENDPROC(fast_syscall_unrecoverable)
986 * j done 986 * j done
987 */ 987 */
988 988
989#ifdef CONFIG_FAST_SYSCALL_XTENSA
990
989#define TRY \ 991#define TRY \
990 .section __ex_table, "a"; \ 992 .section __ex_table, "a"; \
991 .word 66f, 67f; \ 993 .word 66f, 67f; \
@@ -1001,9 +1003,8 @@ ENTRY(fast_syscall_xtensa)
1001 movi a7, 4 # sizeof(unsigned int) 1003 movi a7, 4 # sizeof(unsigned int)
1002 access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp 1004 access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp
1003 1005
1004 addi a6, a6, -1 # assuming SYS_XTENSA_ATOMIC_SET = 1 1006 _bgeui a6, SYS_XTENSA_COUNT, .Lill
1005 _bgeui a6, SYS_XTENSA_COUNT - 1, .Lill 1007 _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP, .Lnswp
1006 _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP - 1, .Lnswp
1007 1008
1008 /* Fall through for ATOMIC_CMP_SWP. */ 1009 /* Fall through for ATOMIC_CMP_SWP. */
1009 1010
@@ -1015,27 +1016,26 @@ TRY s32i a5, a3, 0 # different, modify value
1015 l32i a7, a2, PT_AREG7 # restore a7 1016 l32i a7, a2, PT_AREG7 # restore a7
1016 l32i a0, a2, PT_AREG0 # restore a0 1017 l32i a0, a2, PT_AREG0 # restore a0
1017 movi a2, 1 # and return 1 1018 movi a2, 1 # and return 1
1018 addi a6, a6, 1 # restore a6 (really necessary?)
1019 rfe 1019 rfe
1020 1020
10211: l32i a7, a2, PT_AREG7 # restore a7 10211: l32i a7, a2, PT_AREG7 # restore a7
1022 l32i a0, a2, PT_AREG0 # restore a0 1022 l32i a0, a2, PT_AREG0 # restore a0
1023 movi a2, 0 # return 0 (note that we cannot set 1023 movi a2, 0 # return 0 (note that we cannot set
1024 addi a6, a6, 1 # restore a6 (really necessary?)
1025 rfe 1024 rfe
1026 1025
1027.Lnswp: /* Atomic set, add, and exg_add. */ 1026.Lnswp: /* Atomic set, add, and exg_add. */
1028 1027
1029TRY l32i a7, a3, 0 # orig 1028TRY l32i a7, a3, 0 # orig
1029 addi a6, a6, -SYS_XTENSA_ATOMIC_SET
1030 add a0, a4, a7 # + arg 1030 add a0, a4, a7 # + arg
1031 moveqz a0, a4, a6 # set 1031 moveqz a0, a4, a6 # set
1032 addi a6, a6, SYS_XTENSA_ATOMIC_SET
1032TRY s32i a0, a3, 0 # write new value 1033TRY s32i a0, a3, 0 # write new value
1033 1034
1034 mov a0, a2 1035 mov a0, a2
1035 mov a2, a7 1036 mov a2, a7
1036 l32i a7, a0, PT_AREG7 # restore a7 1037 l32i a7, a0, PT_AREG7 # restore a7
1037 l32i a0, a0, PT_AREG0 # restore a0 1038 l32i a0, a0, PT_AREG0 # restore a0
1038 addi a6, a6, 1 # restore a6 (really necessary?)
1039 rfe 1039 rfe
1040 1040
1041CATCH 1041CATCH
@@ -1044,13 +1044,25 @@ CATCH
1044 movi a2, -EFAULT 1044 movi a2, -EFAULT
1045 rfe 1045 rfe
1046 1046
1047.Lill: l32i a7, a2, PT_AREG0 # restore a7 1047.Lill: l32i a7, a2, PT_AREG7 # restore a7
1048 l32i a0, a2, PT_AREG0 # restore a0 1048 l32i a0, a2, PT_AREG0 # restore a0
1049 movi a2, -EINVAL 1049 movi a2, -EINVAL
1050 rfe 1050 rfe
1051 1051
1052ENDPROC(fast_syscall_xtensa) 1052ENDPROC(fast_syscall_xtensa)
1053 1053
1054#else /* CONFIG_FAST_SYSCALL_XTENSA */
1055
1056ENTRY(fast_syscall_xtensa)
1057
1058 l32i a0, a2, PT_AREG0 # restore a0
1059 movi a2, -ENOSYS
1060 rfe
1061
1062ENDPROC(fast_syscall_xtensa)
1063
1064#endif /* CONFIG_FAST_SYSCALL_XTENSA */
1065
1054 1066
1055/* fast_syscall_spill_registers. 1067/* fast_syscall_spill_registers.
1056 * 1068 *
@@ -1066,6 +1078,8 @@ ENDPROC(fast_syscall_xtensa)
1066 * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler. 1078 * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler.
1067 */ 1079 */
1068 1080
1081#ifdef CONFIG_FAST_SYSCALL_SPILL_REGISTERS
1082
1069ENTRY(fast_syscall_spill_registers) 1083ENTRY(fast_syscall_spill_registers)
1070 1084
1071 /* Register a FIXUP handler (pass current wb as a parameter) */ 1085 /* Register a FIXUP handler (pass current wb as a parameter) */
@@ -1400,6 +1414,18 @@ ENTRY(fast_syscall_spill_registers_fixup_return)
1400 1414
1401ENDPROC(fast_syscall_spill_registers_fixup_return) 1415ENDPROC(fast_syscall_spill_registers_fixup_return)
1402 1416
1417#else /* CONFIG_FAST_SYSCALL_SPILL_REGISTERS */
1418
1419ENTRY(fast_syscall_spill_registers)
1420
1421 l32i a0, a2, PT_AREG0 # restore a0
1422 movi a2, -ENOSYS
1423 rfe
1424
1425ENDPROC(fast_syscall_spill_registers)
1426
1427#endif /* CONFIG_FAST_SYSCALL_SPILL_REGISTERS */
1428
1403#ifdef CONFIG_MMU 1429#ifdef CONFIG_MMU
1404/* 1430/*
1405 * We should never get here. Bail out! 1431 * We should never get here. Bail out!
@@ -1565,7 +1591,7 @@ ENTRY(fast_second_level_miss)
1565 rsr a0, excvaddr 1591 rsr a0, excvaddr
1566 bltu a0, a3, 2f 1592 bltu a0, a3, 2f
1567 1593
1568 addi a1, a0, -(2 << (DCACHE_ALIAS_ORDER + PAGE_SHIFT)) 1594 addi a1, a0, -TLBTEMP_SIZE
1569 bgeu a1, a3, 2f 1595 bgeu a1, a3, 2f
1570 1596
1571 /* Check if we have to restore an ITLB mapping. */ 1597 /* Check if we have to restore an ITLB mapping. */
@@ -1820,7 +1846,6 @@ ENTRY(_switch_to)
1820 1846
1821 entry a1, 16 1847 entry a1, 16
1822 1848
1823 mov a10, a2 # preserve 'prev' (a2)
1824 mov a11, a3 # and 'next' (a3) 1849 mov a11, a3 # and 'next' (a3)
1825 1850
1826 l32i a4, a2, TASK_THREAD_INFO 1851 l32i a4, a2, TASK_THREAD_INFO
@@ -1828,8 +1853,14 @@ ENTRY(_switch_to)
1828 1853
1829 save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER 1854 save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER
1830 1855
1831 s32i a0, a10, THREAD_RA # save return address 1856#if THREAD_RA > 1020 || THREAD_SP > 1020
1832 s32i a1, a10, THREAD_SP # save stack pointer 1857 addi a10, a2, TASK_THREAD
1858 s32i a0, a10, THREAD_RA - TASK_THREAD # save return address
1859 s32i a1, a10, THREAD_SP - TASK_THREAD # save stack pointer
1860#else
1861 s32i a0, a2, THREAD_RA # save return address
1862 s32i a1, a2, THREAD_SP # save stack pointer
1863#endif
1833 1864
1834 /* Disable ints while we manipulate the stack pointer. */ 1865 /* Disable ints while we manipulate the stack pointer. */
1835 1866
@@ -1870,7 +1901,6 @@ ENTRY(_switch_to)
1870 load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER 1901 load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER
1871 1902
1872 wsr a14, ps 1903 wsr a14, ps
1873 mov a2, a10 # return 'prev'
1874 rsync 1904 rsync
1875 1905
1876 retw 1906 retw
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 2d9cc6dbfd78..e8b76b8e4b29 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -49,9 +49,8 @@ dma_alloc_coherent(struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag)
49 49
50 /* We currently don't support coherent memory outside KSEG */ 50 /* We currently don't support coherent memory outside KSEG */
51 51
52 if (ret < XCHAL_KSEG_CACHED_VADDR 52 BUG_ON(ret < XCHAL_KSEG_CACHED_VADDR ||
53 || ret >= XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE) 53 ret > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1);
54 BUG();
55 54
56 55
57 if (ret != 0) { 56 if (ret != 0) {
@@ -68,10 +67,11 @@ EXPORT_SYMBOL(dma_alloc_coherent);
68void dma_free_coherent(struct device *hwdev, size_t size, 67void dma_free_coherent(struct device *hwdev, size_t size,
69 void *vaddr, dma_addr_t dma_handle) 68 void *vaddr, dma_addr_t dma_handle)
70{ 69{
71 long addr=(long)vaddr+XCHAL_KSEG_CACHED_VADDR-XCHAL_KSEG_BYPASS_VADDR; 70 unsigned long addr = (unsigned long)vaddr +
71 XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR;
72 72
73 if (addr < 0 || addr >= XCHAL_KSEG_SIZE) 73 BUG_ON(addr < XCHAL_KSEG_CACHED_VADDR ||
74 BUG(); 74 addr > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1);
75 75
76 free_pages(addr, get_order(size)); 76 free_pages(addr, get_order(size));
77} 77}
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c
index 40b5a3771fb0..4d02e38514f5 100644
--- a/arch/xtensa/kernel/smp.c
+++ b/arch/xtensa/kernel/smp.c
@@ -571,6 +571,7 @@ void flush_icache_range(unsigned long start, unsigned long end)
571 }; 571 };
572 on_each_cpu(ipi_flush_icache_range, &fd, 1); 572 on_each_cpu(ipi_flush_icache_range, &fd, 1);
573} 573}
574EXPORT_SYMBOL(flush_icache_range);
574 575
575/* ------------------------------------------------------------------------- */ 576/* ------------------------------------------------------------------------- */
576 577
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index eebbfd8c26fc..9d2f45f010ef 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -101,9 +101,8 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = {
101#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION 101#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
102#ifdef CONFIG_XTENSA_UNALIGNED_USER 102#ifdef CONFIG_XTENSA_UNALIGNED_USER
103{ EXCCAUSE_UNALIGNED, USER, fast_unaligned }, 103{ EXCCAUSE_UNALIGNED, USER, fast_unaligned },
104#else
105{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user },
106#endif 104#endif
105{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user },
107{ EXCCAUSE_UNALIGNED, KRNL, fast_unaligned }, 106{ EXCCAUSE_UNALIGNED, KRNL, fast_unaligned },
108#endif 107#endif
109#ifdef CONFIG_MMU 108#ifdef CONFIG_MMU
@@ -264,7 +263,6 @@ do_illegal_instruction(struct pt_regs *regs)
264 */ 263 */
265 264
266#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION 265#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
267#ifndef CONFIG_XTENSA_UNALIGNED_USER
268void 266void
269do_unaligned_user (struct pt_regs *regs) 267do_unaligned_user (struct pt_regs *regs)
270{ 268{
@@ -286,7 +284,6 @@ do_unaligned_user (struct pt_regs *regs)
286 284
287} 285}
288#endif 286#endif
289#endif
290 287
291void 288void
292do_debug(struct pt_regs *regs) 289do_debug(struct pt_regs *regs)
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S
index 8453e6e39895..1b397a902292 100644
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -454,8 +454,14 @@ _DoubleExceptionVector_WindowOverflow:
454 s32i a0, a2, PT_DEPC 454 s32i a0, a2, PT_DEPC
455 455
456_DoubleExceptionVector_handle_exception: 456_DoubleExceptionVector_handle_exception:
457 addi a0, a0, -EXCCAUSE_UNALIGNED
458 beqz a0, 2f
457 addx4 a0, a0, a3 459 addx4 a0, a0, a3
458 l32i a0, a0, EXC_TABLE_FAST_USER 460 l32i a0, a0, EXC_TABLE_FAST_USER + 4 * EXCCAUSE_UNALIGNED
461 xsr a3, excsave1
462 jx a0
4632:
464 movi a0, user_exception
459 xsr a3, excsave1 465 xsr a3, excsave1
460 jx a0 466 jx a0
461 467
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index d16db6df86f8..fc1bc2ba8d5d 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -269,13 +269,13 @@ SECTIONS
269 .UserExceptionVector.literal) 269 .UserExceptionVector.literal)
270 SECTION_VECTOR (_DoubleExceptionVector_literal, 270 SECTION_VECTOR (_DoubleExceptionVector_literal,
271 .DoubleExceptionVector.literal, 271 .DoubleExceptionVector.literal,
272 DOUBLEEXC_VECTOR_VADDR - 40, 272 DOUBLEEXC_VECTOR_VADDR - 48,
273 SIZEOF(.UserExceptionVector.text), 273 SIZEOF(.UserExceptionVector.text),
274 .UserExceptionVector.text) 274 .UserExceptionVector.text)
275 SECTION_VECTOR (_DoubleExceptionVector_text, 275 SECTION_VECTOR (_DoubleExceptionVector_text,
276 .DoubleExceptionVector.text, 276 .DoubleExceptionVector.text,
277 DOUBLEEXC_VECTOR_VADDR, 277 DOUBLEEXC_VECTOR_VADDR,
278 40, 278 48,
279 .DoubleExceptionVector.literal) 279 .DoubleExceptionVector.literal)
280 280
281 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; 281 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c
index 63cbb867dadd..d75aa1476da7 100644
--- a/arch/xtensa/mm/cache.c
+++ b/arch/xtensa/mm/cache.c
@@ -59,9 +59,68 @@
59 * 59 *
60 */ 60 */
61 61
62#if (DCACHE_WAY_SIZE > PAGE_SIZE) && defined(CONFIG_HIGHMEM) 62#if (DCACHE_WAY_SIZE > PAGE_SIZE)
63#error "HIGHMEM is not supported on cores with aliasing cache." 63static inline void kmap_invalidate_coherent(struct page *page,
64#endif 64 unsigned long vaddr)
65{
66 if (!DCACHE_ALIAS_EQ(page_to_phys(page), vaddr)) {
67 unsigned long kvaddr;
68
69 if (!PageHighMem(page)) {
70 kvaddr = (unsigned long)page_to_virt(page);
71
72 __invalidate_dcache_page(kvaddr);
73 } else {
74 kvaddr = TLBTEMP_BASE_1 +
75 (page_to_phys(page) & DCACHE_ALIAS_MASK);
76
77 __invalidate_dcache_page_alias(kvaddr,
78 page_to_phys(page));
79 }
80 }
81}
82
83static inline void *coherent_kvaddr(struct page *page, unsigned long base,
84 unsigned long vaddr, unsigned long *paddr)
85{
86 if (PageHighMem(page) || !DCACHE_ALIAS_EQ(page_to_phys(page), vaddr)) {
87 *paddr = page_to_phys(page);
88 return (void *)(base + (vaddr & DCACHE_ALIAS_MASK));
89 } else {
90 *paddr = 0;
91 return page_to_virt(page);
92 }
93}
94
95void clear_user_highpage(struct page *page, unsigned long vaddr)
96{
97 unsigned long paddr;
98 void *kvaddr = coherent_kvaddr(page, TLBTEMP_BASE_1, vaddr, &paddr);
99
100 pagefault_disable();
101 kmap_invalidate_coherent(page, vaddr);
102 set_bit(PG_arch_1, &page->flags);
103 clear_page_alias(kvaddr, paddr);
104 pagefault_enable();
105}
106
107void copy_user_highpage(struct page *dst, struct page *src,
108 unsigned long vaddr, struct vm_area_struct *vma)
109{
110 unsigned long dst_paddr, src_paddr;
111 void *dst_vaddr = coherent_kvaddr(dst, TLBTEMP_BASE_1, vaddr,
112 &dst_paddr);
113 void *src_vaddr = coherent_kvaddr(src, TLBTEMP_BASE_2, vaddr,
114 &src_paddr);
115
116 pagefault_disable();
117 kmap_invalidate_coherent(dst, vaddr);
118 set_bit(PG_arch_1, &dst->flags);
119 copy_page_alias(dst_vaddr, src_vaddr, dst_paddr, src_paddr);
120 pagefault_enable();
121}
122
123#endif /* DCACHE_WAY_SIZE > PAGE_SIZE */
65 124
66#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK 125#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
67 126
@@ -103,7 +162,8 @@ void flush_dcache_page(struct page *page)
103 if (!alias && !mapping) 162 if (!alias && !mapping)
104 return; 163 return;
105 164
106 __flush_invalidate_dcache_page((long)page_address(page)); 165 virt = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK);
166 __flush_invalidate_dcache_page_alias(virt, phys);
107 167
108 virt = TLBTEMP_BASE_1 + (temp & DCACHE_ALIAS_MASK); 168 virt = TLBTEMP_BASE_1 + (temp & DCACHE_ALIAS_MASK);
109 169
@@ -168,13 +228,12 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep)
168#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK 228#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
169 229
170 if (!PageReserved(page) && test_bit(PG_arch_1, &page->flags)) { 230 if (!PageReserved(page) && test_bit(PG_arch_1, &page->flags)) {
171
172 unsigned long paddr = (unsigned long) page_address(page);
173 unsigned long phys = page_to_phys(page); 231 unsigned long phys = page_to_phys(page);
174 unsigned long tmp = TLBTEMP_BASE_1 + (addr & DCACHE_ALIAS_MASK); 232 unsigned long tmp;
175
176 __flush_invalidate_dcache_page(paddr);
177 233
234 tmp = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK);
235 __flush_invalidate_dcache_page_alias(tmp, phys);
236 tmp = TLBTEMP_BASE_1 + (addr & DCACHE_ALIAS_MASK);
178 __flush_invalidate_dcache_page_alias(tmp, phys); 237 __flush_invalidate_dcache_page_alias(tmp, phys);
179 __invalidate_icache_page_alias(tmp, phys); 238 __invalidate_icache_page_alias(tmp, phys);
180 239
diff --git a/arch/xtensa/mm/highmem.c b/arch/xtensa/mm/highmem.c
index 17a8c0d6fd17..8cfb71ec0937 100644
--- a/arch/xtensa/mm/highmem.c
+++ b/arch/xtensa/mm/highmem.c
@@ -14,23 +14,45 @@
14 14
15static pte_t *kmap_pte; 15static pte_t *kmap_pte;
16 16
17#if DCACHE_WAY_SIZE > PAGE_SIZE
18unsigned int last_pkmap_nr_arr[DCACHE_N_COLORS];
19wait_queue_head_t pkmap_map_wait_arr[DCACHE_N_COLORS];
20
21static void __init kmap_waitqueues_init(void)
22{
23 unsigned int i;
24
25 for (i = 0; i < ARRAY_SIZE(pkmap_map_wait_arr); ++i)
26 init_waitqueue_head(pkmap_map_wait_arr + i);
27}
28#else
29static inline void kmap_waitqueues_init(void)
30{
31}
32#endif
33
34static inline enum fixed_addresses kmap_idx(int type, unsigned long color)
35{
36 return (type + KM_TYPE_NR * smp_processor_id()) * DCACHE_N_COLORS +
37 color;
38}
39
17void *kmap_atomic(struct page *page) 40void *kmap_atomic(struct page *page)
18{ 41{
19 enum fixed_addresses idx; 42 enum fixed_addresses idx;
20 unsigned long vaddr; 43 unsigned long vaddr;
21 int type;
22 44
23 pagefault_disable(); 45 pagefault_disable();
24 if (!PageHighMem(page)) 46 if (!PageHighMem(page))
25 return page_address(page); 47 return page_address(page);
26 48
27 type = kmap_atomic_idx_push(); 49 idx = kmap_idx(kmap_atomic_idx_push(),
28 idx = type + KM_TYPE_NR * smp_processor_id(); 50 DCACHE_ALIAS(page_to_phys(page)));
29 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 51 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
30#ifdef CONFIG_DEBUG_HIGHMEM 52#ifdef CONFIG_DEBUG_HIGHMEM
31 BUG_ON(!pte_none(*(kmap_pte - idx))); 53 BUG_ON(!pte_none(*(kmap_pte + idx)));
32#endif 54#endif
33 set_pte(kmap_pte - idx, mk_pte(page, PAGE_KERNEL_EXEC)); 55 set_pte(kmap_pte + idx, mk_pte(page, PAGE_KERNEL_EXEC));
34 56
35 return (void *)vaddr; 57 return (void *)vaddr;
36} 58}
@@ -38,12 +60,10 @@ EXPORT_SYMBOL(kmap_atomic);
38 60
39void __kunmap_atomic(void *kvaddr) 61void __kunmap_atomic(void *kvaddr)
40{ 62{
41 int idx, type;
42
43 if (kvaddr >= (void *)FIXADDR_START && 63 if (kvaddr >= (void *)FIXADDR_START &&
44 kvaddr < (void *)FIXADDR_TOP) { 64 kvaddr < (void *)FIXADDR_TOP) {
45 type = kmap_atomic_idx(); 65 int idx = kmap_idx(kmap_atomic_idx(),
46 idx = type + KM_TYPE_NR * smp_processor_id(); 66 DCACHE_ALIAS((unsigned long)kvaddr));
47 67
48 /* 68 /*
49 * Force other mappings to Oops if they'll try to access this 69 * Force other mappings to Oops if they'll try to access this
@@ -51,7 +71,7 @@ void __kunmap_atomic(void *kvaddr)
51 * is a bad idea also, in case the page changes cacheability 71 * is a bad idea also, in case the page changes cacheability
52 * attributes or becomes a protected page in a hypervisor. 72 * attributes or becomes a protected page in a hypervisor.
53 */ 73 */
54 pte_clear(&init_mm, kvaddr, kmap_pte - idx); 74 pte_clear(&init_mm, kvaddr, kmap_pte + idx);
55 local_flush_tlb_kernel_range((unsigned long)kvaddr, 75 local_flush_tlb_kernel_range((unsigned long)kvaddr,
56 (unsigned long)kvaddr + PAGE_SIZE); 76 (unsigned long)kvaddr + PAGE_SIZE);
57 77
@@ -69,4 +89,5 @@ void __init kmap_init(void)
69 /* cache the first kmap pte */ 89 /* cache the first kmap pte */
70 kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); 90 kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN);
71 kmap_pte = kmap_get_fixmap_pte(kmap_vstart); 91 kmap_pte = kmap_get_fixmap_pte(kmap_vstart);
92 kmap_waitqueues_init();
72} 93}
diff --git a/arch/xtensa/mm/misc.S b/arch/xtensa/mm/misc.S
index 1f68558dbcc2..11a01c3e9cea 100644
--- a/arch/xtensa/mm/misc.S
+++ b/arch/xtensa/mm/misc.S
@@ -110,41 +110,24 @@ ENTRY(__tlbtemp_mapping_start)
110#if (DCACHE_WAY_SIZE > PAGE_SIZE) 110#if (DCACHE_WAY_SIZE > PAGE_SIZE)
111 111
112/* 112/*
113 * clear_user_page (void *addr, unsigned long vaddr, struct page *page) 113 * clear_page_alias(void *addr, unsigned long paddr)
114 * a2 a3 a4 114 * a2 a3
115 */ 115 */
116 116
117ENTRY(clear_user_page) 117ENTRY(clear_page_alias)
118 118
119 entry a1, 32 119 entry a1, 32
120 120
121 /* Mark page dirty and determine alias. */ 121 /* Skip setting up a temporary DTLB if not aliased low page. */
122 122
123 movi a7, (1 << PG_ARCH_1) 123 movi a5, PAGE_OFFSET
124 l32i a5, a4, PAGE_FLAGS 124 movi a6, 0
125 xor a6, a2, a3 125 beqz a3, 1f
126 extui a3, a3, PAGE_SHIFT, DCACHE_ALIAS_ORDER
127 extui a6, a6, PAGE_SHIFT, DCACHE_ALIAS_ORDER
128 or a5, a5, a7
129 slli a3, a3, PAGE_SHIFT
130 s32i a5, a4, PAGE_FLAGS
131 126
132 /* Skip setting up a temporary DTLB if not aliased. */ 127 /* Setup a temporary DTLB for the addr. */
133
134 beqz a6, 1f
135
136 /* Invalidate kernel page. */
137
138 mov a10, a2
139 call8 __invalidate_dcache_page
140
141 /* Setup a temporary DTLB with the color of the VPN */
142
143 movi a4, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff
144 movi a5, TLBTEMP_BASE_1 # virt
145 add a6, a2, a4 # ppn
146 add a2, a5, a3 # add 'color'
147 128
129 addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE)
130 mov a4, a2
148 wdtlb a6, a2 131 wdtlb a6, a2
149 dsync 132 dsync
150 133
@@ -165,62 +148,43 @@ ENTRY(clear_user_page)
165 148
166 /* We need to invalidate the temporary idtlb entry, if any. */ 149 /* We need to invalidate the temporary idtlb entry, if any. */
167 150
1681: addi a2, a2, -PAGE_SIZE 1511: idtlb a4
169 idtlb a2
170 dsync 152 dsync
171 153
172 retw 154 retw
173 155
174ENDPROC(clear_user_page) 156ENDPROC(clear_page_alias)
175 157
176/* 158/*
177 * copy_page_user (void *to, void *from, unsigned long vaddr, struct page *page) 159 * copy_page_alias(void *to, void *from,
178 * a2 a3 a4 a5 160 * a2 a3
161 * unsigned long to_paddr, unsigned long from_paddr)
162 * a4 a5
179 */ 163 */
180 164
181ENTRY(copy_user_page) 165ENTRY(copy_page_alias)
182 166
183 entry a1, 32 167 entry a1, 32
184 168
185 /* Mark page dirty and determine alias for destination. */ 169 /* Skip setting up a temporary DTLB for destination if not aliased. */
186
187 movi a8, (1 << PG_ARCH_1)
188 l32i a9, a5, PAGE_FLAGS
189 xor a6, a2, a4
190 xor a7, a3, a4
191 extui a4, a4, PAGE_SHIFT, DCACHE_ALIAS_ORDER
192 extui a6, a6, PAGE_SHIFT, DCACHE_ALIAS_ORDER
193 extui a7, a7, PAGE_SHIFT, DCACHE_ALIAS_ORDER
194 or a9, a9, a8
195 slli a4, a4, PAGE_SHIFT
196 s32i a9, a5, PAGE_FLAGS
197 movi a5, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff
198
199 beqz a6, 1f
200
201 /* Invalidate dcache */
202
203 mov a10, a2
204 call8 __invalidate_dcache_page
205 170
206 /* Setup a temporary DTLB with a matching color. */ 171 movi a6, 0
172 movi a7, 0
173 beqz a4, 1f
207 174
208 movi a8, TLBTEMP_BASE_1 # base 175 /* Setup a temporary DTLB for destination. */
209 add a6, a2, a5 # ppn
210 add a2, a8, a4 # add 'color'
211 176
177 addi a6, a4, (PAGE_KERNEL | _PAGE_HW_WRITE)
212 wdtlb a6, a2 178 wdtlb a6, a2
213 dsync 179 dsync
214 180
215 /* Skip setting up a temporary DTLB for destination if not aliased. */ 181 /* Skip setting up a temporary DTLB for source if not aliased. */
216 182
2171: beqz a7, 1f 1831: beqz a5, 1f
218 184
219 /* Setup a temporary DTLB with a matching color. */ 185 /* Setup a temporary DTLB for source. */
220 186
221 movi a8, TLBTEMP_BASE_2 # base 187 addi a7, a5, PAGE_KERNEL
222 add a7, a3, a5 # ppn
223 add a3, a8, a4
224 addi a8, a3, 1 # way1 188 addi a8, a3, 1 # way1
225 189
226 wdtlb a7, a8 190 wdtlb a7, a8
@@ -271,7 +235,7 @@ ENTRY(copy_user_page)
271 235
272 retw 236 retw
273 237
274ENDPROC(copy_user_page) 238ENDPROC(copy_page_alias)
275 239
276#endif 240#endif
277 241
@@ -300,6 +264,30 @@ ENTRY(__flush_invalidate_dcache_page_alias)
300 retw 264 retw
301 265
302ENDPROC(__flush_invalidate_dcache_page_alias) 266ENDPROC(__flush_invalidate_dcache_page_alias)
267
268/*
269 * void __invalidate_dcache_page_alias (addr, phys)
270 * a2 a3
271 */
272
273ENTRY(__invalidate_dcache_page_alias)
274
275 entry sp, 16
276
277 movi a7, 0 # required for exception handler
278 addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE)
279 mov a4, a2
280 wdtlb a6, a2
281 dsync
282
283 ___invalidate_dcache_page a2 a3
284
285 idtlb a4
286 dsync
287
288 retw
289
290ENDPROC(__invalidate_dcache_page_alias)
303#endif 291#endif
304 292
305ENTRY(__tlbtemp_mapping_itlb) 293ENTRY(__tlbtemp_mapping_itlb)
diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c
index 3429b483d9f8..abe4513eb0dd 100644
--- a/arch/xtensa/mm/mmu.c
+++ b/arch/xtensa/mm/mmu.c
@@ -18,32 +18,38 @@
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20#if defined(CONFIG_HIGHMEM) 20#if defined(CONFIG_HIGHMEM)
21static void * __init init_pmd(unsigned long vaddr) 21static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages)
22{ 22{
23 pgd_t *pgd = pgd_offset_k(vaddr); 23 pgd_t *pgd = pgd_offset_k(vaddr);
24 pmd_t *pmd = pmd_offset(pgd, vaddr); 24 pmd_t *pmd = pmd_offset(pgd, vaddr);
25 pte_t *pte;
26 unsigned long i;
25 27
26 if (pmd_none(*pmd)) { 28 n_pages = ALIGN(n_pages, PTRS_PER_PTE);
27 unsigned i;
28 pte_t *pte = alloc_bootmem_low_pages(PAGE_SIZE);
29 29
30 for (i = 0; i < 1024; i++) 30 pr_debug("%s: vaddr: 0x%08lx, n_pages: %ld\n",
31 pte_clear(NULL, 0, pte + i); 31 __func__, vaddr, n_pages);
32 32
33 set_pmd(pmd, __pmd(((unsigned long)pte) & PAGE_MASK)); 33 pte = alloc_bootmem_low_pages(n_pages * sizeof(pte_t));
34 BUG_ON(pte != pte_offset_kernel(pmd, 0)); 34
35 pr_debug("%s: vaddr: 0x%08lx, pmd: 0x%p, pte: 0x%p\n", 35 for (i = 0; i < n_pages; ++i)
36 __func__, vaddr, pmd, pte); 36 pte_clear(NULL, 0, pte + i);
37 return pte; 37
38 } else { 38 for (i = 0; i < n_pages; i += PTRS_PER_PTE, ++pmd) {
39 return pte_offset_kernel(pmd, 0); 39 pte_t *cur_pte = pte + i;
40
41 BUG_ON(!pmd_none(*pmd));
42 set_pmd(pmd, __pmd(((unsigned long)cur_pte) & PAGE_MASK));
43 BUG_ON(cur_pte != pte_offset_kernel(pmd, 0));
44 pr_debug("%s: pmd: 0x%p, pte: 0x%p\n",
45 __func__, pmd, cur_pte);
40 } 46 }
47 return pte;
41} 48}
42 49
43static void __init fixedrange_init(void) 50static void __init fixedrange_init(void)
44{ 51{
45 BUILD_BUG_ON(FIXADDR_SIZE > PMD_SIZE); 52 init_pmd(__fix_to_virt(0), __end_of_fixed_addresses);
46 init_pmd(__fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK);
47} 53}
48#endif 54#endif
49 55
@@ -52,7 +58,7 @@ void __init paging_init(void)
52 memset(swapper_pg_dir, 0, PAGE_SIZE); 58 memset(swapper_pg_dir, 0, PAGE_SIZE);
53#ifdef CONFIG_HIGHMEM 59#ifdef CONFIG_HIGHMEM
54 fixedrange_init(); 60 fixedrange_init();
55 pkmap_page_table = init_pmd(PKMAP_BASE); 61 pkmap_page_table = init_pmd(PKMAP_BASE, LAST_PKMAP);
56 kmap_init(); 62 kmap_init();
57#endif 63#endif
58} 64}