aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/osf_sys.c7
-rw-r--r--arch/arc/include/asm/io.h2
-rw-r--r--arch/arm/Kconfig30
-rw-r--r--arch/arm/Kconfig.debug167
-rw-r--r--arch/arm/Makefile8
-rw-r--r--arch/arm/boot/dts/Makefile80
-rw-r--r--arch/arm/boot/dts/am335x-boneblack.dts4
-rw-r--r--arch/arm/boot/dts/am335x-evm.dts17
-rw-r--r--arch/arm/boot/dts/am335x-igep0033.dtsi4
-rw-r--r--arch/arm/boot/dts/am335x-lxm.dts362
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi34
-rw-r--r--arch/arm/boot/dts/am4372.dtsi48
-rw-r--r--arch/arm/boot/dts/am437x-gp-evm.dts34
-rw-r--r--arch/arm/boot/dts/am43x-epos-evm.dts12
-rw-r--r--arch/arm/boot/dts/am57xx-beagle-x15.dts405
-rw-r--r--arch/arm/boot/dts/arm-realview-pb1176.dts412
-rw-r--r--arch/arm/boot/dts/armada-370-db.dts106
-rw-r--r--arch/arm/boot/dts/armada-370-mirabox.dts25
-rw-r--r--arch/arm/boot/dts/armada-370-netgear-rn102.dts101
-rw-r--r--arch/arm/boot/dts/armada-370-netgear-rn104.dts64
-rw-r--r--arch/arm/boot/dts/armada-370-rd.dts73
-rw-r--r--arch/arm/boot/dts/armada-370-synology-ds213j.dts316
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi14
-rw-r--r--arch/arm/boot/dts/armada-370.dtsi190
-rw-r--r--arch/arm/boot/dts/armada-375.dtsi12
-rw-r--r--arch/arm/boot/dts/armada-385-db.dts2
-rw-r--r--arch/arm/boot/dts/armada-38x.dtsi6
-rw-r--r--arch/arm/boot/dts/armada-xp-axpwifiap.dts57
-rw-r--r--arch/arm/boot/dts/armada-xp-gp.dts19
-rw-r--r--arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts75
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78230.dtsi15
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78260.dtsi15
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78460.dtsi15
-rw-r--r--arch/arm/boot/dts/armada-xp-netgear-rn2120.dts166
-rw-r--r--arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts14
-rw-r--r--arch/arm/boot/dts/armada-xp-synology-ds414.dts330
-rw-r--r--arch/arm/boot/dts/armada-xp.dtsi71
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi19
-rw-r--r--arch/arm/boot/dts/at91sam9x25.dtsi1
-rw-r--r--arch/arm/boot/dts/at91sam9x35.dtsi1
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi12
-rw-r--r--arch/arm/boot/dts/at91sam9x5_can.dtsi50
-rw-r--r--arch/arm/boot/dts/at91sam9x5_usart3.dtsi3
-rw-r--r--arch/arm/boot/dts/atlas6.dtsi15
-rw-r--r--arch/arm/boot/dts/bcm-cygnus-clock.dtsi91
-rw-r--r--arch/arm/boot/dts/bcm-cygnus.dtsi140
-rw-r--r--arch/arm/boot/dts/bcm2835-rpi-b-plus.dts30
-rw-r--r--arch/arm/boot/dts/bcm2835-rpi-b.dts46
-rw-r--r--arch/arm/boot/dts/bcm2835-rpi.dtsi51
-rw-r--r--arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts64
-rw-r--r--arch/arm/boot/dts/bcm4708-netgear-r6250.dts59
-rw-r--r--arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts84
-rw-r--r--arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts78
-rw-r--r--arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts57
-rw-r--r--arch/arm/boot/dts/bcm47081.dtsi26
-rw-r--r--arch/arm/boot/dts/bcm5301x.dtsi51
-rw-r--r--arch/arm/boot/dts/bcm911360_entphn.dts53
-rw-r--r--arch/arm/boot/dts/bcm911360k.dts53
-rw-r--r--arch/arm/boot/dts/bcm958300k.dts53
-rw-r--r--arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts16
-rw-r--r--arch/arm/boot/dts/berlin2.dtsi110
-rw-r--r--arch/arm/boot/dts/berlin2cd-google-chromecast.dts30
-rw-r--r--arch/arm/boot/dts/berlin2cd.dtsi82
-rw-r--r--arch/arm/boot/dts/berlin2q-marvell-dmp.dts61
-rw-r--r--arch/arm/boot/dts/berlin2q.dtsi96
-rw-r--r--arch/arm/boot/dts/dra7-evm.dts133
-rw-r--r--arch/arm/boot/dts/dra7.dtsi202
-rw-r--r--arch/arm/boot/dts/dra72-evm.dts319
-rw-r--r--arch/arm/boot/dts/dra74x.dtsi22
-rw-r--r--arch/arm/boot/dts/emev2-kzm9d.dts63
-rw-r--r--arch/arm/boot/dts/emev2.dtsi12
-rw-r--r--arch/arm/boot/dts/exynos3250-monk.dts579
-rw-r--r--arch/arm/boot/dts/exynos3250-pinctrl.dtsi16
-rw-r--r--arch/arm/boot/dts/exynos3250-rinato.dts682
-rw-r--r--arch/arm/boot/dts/exynos3250.dtsi10
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi4
-rw-r--r--arch/arm/boot/dts/exynos4210-trats.dts16
-rw-r--r--arch/arm/boot/dts/exynos4210-universal_c210.dts16
-rw-r--r--arch/arm/boot/dts/exynos4210.dtsi17
-rw-r--r--arch/arm/boot/dts/exynos4212.dtsi17
-rw-r--r--arch/arm/boot/dts/exynos4412-odroid-common.dtsi26
-rw-r--r--arch/arm/boot/dts/exynos4412-trats2.dts412
-rw-r--r--arch/arm/boot/dts/exynos4412.dtsi29
-rw-r--r--arch/arm/boot/dts/exynos4415-pinctrl.dtsi573
-rw-r--r--arch/arm/boot/dts/exynos4415.dtsi604
-rw-r--r--arch/arm/boot/dts/exynos4x12-pinctrl.dtsi16
-rw-r--r--arch/arm/boot/dts/exynos4x12.dtsi10
-rw-r--r--arch/arm/boot/dts/exynos5250-arndale.dts907
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts618
-rw-r--r--arch/arm/boot/dts/exynos5250-snow.dts266
-rw-r--r--arch/arm/boot/dts/exynos5250-spring.dts566
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi20
-rw-r--r--arch/arm/boot/dts/exynos5420-peach-pit.dts7
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi4
-rw-r--r--arch/arm/boot/dts/exynos5800-peach-pi.dts7
-rw-r--r--arch/arm/boot/dts/hisi-x5hd2-dkb.dts33
-rw-r--r--arch/arm/boot/dts/hisi-x5hd2.dtsi390
-rw-r--r--arch/arm/boot/dts/imx51.dtsi12
-rw-r--r--arch/arm/boot/dts/imx53.dtsi25
-rw-r--r--arch/arm/boot/dts/imx6dl.dtsi8
-rw-r--r--arch/arm/boot/dts/imx6q-tbs2910.dts432
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi4
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw52xx.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw53xx.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw54xx.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-phytec-pbab01.dtsi131
-rw-r--r--arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi97
-rw-r--r--arch/arm/boot/dts/imx6qdl-rex.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabresd.dtsi12
-rw-r--r--arch/arm/boot/dts/imx6qdl.dtsi14
-rw-r--r--arch/arm/boot/dts/imx6sl-evk.dts4
-rw-r--r--arch/arm/boot/dts/imx6sl.dtsi6
-rw-r--r--arch/arm/boot/dts/imx6sx-sdb.dts66
-rw-r--r--arch/arm/boot/dts/imx6sx.dtsi8
-rw-r--r--arch/arm/boot/dts/integrator.dtsi48
-rw-r--r--arch/arm/boot/dts/k2e-evm.dts12
-rw-r--r--arch/arm/boot/dts/k2e.dtsi45
-rw-r--r--arch/arm/boot/dts/k2l-evm.dts12
-rw-r--r--arch/arm/boot/dts/keystone.dtsi45
-rw-r--r--arch/arm/boot/dts/kirkwood-dir665.dts278
-rw-r--r--arch/arm/boot/dts/kirkwood-synology.dtsi2
-rw-r--r--arch/arm/boot/dts/ls1021a-qds.dts240
-rw-r--r--arch/arm/boot/dts/ls1021a-twr.dts127
-rw-r--r--arch/arm/boot/dts/ls1021a.dtsi408
-rw-r--r--arch/arm/boot/dts/meson.dtsi44
-rw-r--r--arch/arm/boot/dts/meson6-atv1200.dts2
-rw-r--r--arch/arm/boot/dts/meson6.dtsi2
-rw-r--r--arch/arm/boot/dts/meson8.dtsi92
-rw-r--r--arch/arm/boot/dts/mt6592-evb.dts26
-rw-r--r--arch/arm/boot/dts/mt6592.dtsi98
-rw-r--r--arch/arm/boot/dts/mt8127-moose.dts25
-rw-r--r--arch/arm/boot/dts/mt8127.dtsi94
-rw-r--r--arch/arm/boot/dts/mt8135-evbp1.dts25
-rw-r--r--arch/arm/boot/dts/mt8135.dtsi116
-rw-r--r--arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi41
-rw-r--r--arch/arm/boot/dts/omap-zoom-common.dtsi62
-rw-r--r--arch/arm/boot/dts/omap2420-n8x0-common.dtsi4
-rw-r--r--arch/arm/boot/dts/omap2420.dtsi1
-rw-r--r--arch/arm/boot/dts/omap2430-sdp.dts28
-rw-r--r--arch/arm/boot/dts/omap2430.dtsi1
-rw-r--r--arch/arm/boot/dts/omap3-cm-t3517.dts11
-rw-r--r--arch/arm/boot/dts/omap3-cm-t3530.dts11
-rw-r--r--arch/arm/boot/dts/omap3-cm-t3730.dts24
-rw-r--r--arch/arm/boot/dts/omap3-cm-t3x.dtsi151
-rw-r--r--arch/arm/boot/dts/omap3-cm-t3x30.dtsi35
-rw-r--r--arch/arm/boot/dts/omap3-devkit8000.dts4
-rw-r--r--arch/arm/boot/dts/omap3-evm-37xx.dts5
-rw-r--r--arch/arm/boot/dts/omap3-evm-common.dtsi21
-rw-r--r--arch/arm/boot/dts/omap3-gta04.dtsi86
-rw-r--r--arch/arm/boot/dts/omap3-igep.dtsi103
-rw-r--r--arch/arm/boot/dts/omap3-igep0020-common.dtsi246
-rw-r--r--arch/arm/boot/dts/omap3-igep0020-rev-f.dts45
-rw-r--r--arch/arm/boot/dts/omap3-igep0020.dts285
-rw-r--r--arch/arm/boot/dts/omap3-igep0030-common.dtsi60
-rw-r--r--arch/arm/boot/dts/omap3-igep0030-rev-g.dts67
-rw-r--r--arch/arm/boot/dts/omap3-igep0030.dts123
-rw-r--r--arch/arm/boot/dts/omap3-ldp.dts26
-rw-r--r--arch/arm/boot/dts/omap3-lilly-a83x.dtsi2
-rw-r--r--arch/arm/boot/dts/omap3-n900.dts51
-rw-r--r--arch/arm/boot/dts/omap3-n950-n9.dtsi4
-rw-r--r--arch/arm/boot/dts/omap3-sb-t35.dtsi126
-rw-r--r--arch/arm/boot/dts/omap3-sbc-t3517.dts15
-rw-r--r--arch/arm/boot/dts/omap3-sbc-t3530.dts15
-rw-r--r--arch/arm/boot/dts/omap3-sbc-t3730.dts15
-rw-r--r--arch/arm/boot/dts/omap3-tao3530.dtsi2
-rw-r--r--arch/arm/boot/dts/omap3.dtsi3
-rw-r--r--arch/arm/boot/dts/omap3430-sdp.dts8
-rw-r--r--arch/arm/boot/dts/omap4-duovero-parlor.dts1
-rw-r--r--arch/arm/boot/dts/omap4.dtsi3
-rw-r--r--arch/arm/boot/dts/omap44xx-clocks.dtsi8
-rw-r--r--arch/arm/boot/dts/omap5.dtsi1
-rw-r--r--arch/arm/boot/dts/prima2.dtsi33
-rw-r--r--arch/arm/boot/dts/r7s72100-genmai.dts3
-rw-r--r--arch/arm/boot/dts/r7s72100.dtsi202
-rw-r--r--arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts7
-rw-r--r--arch/arm/boot/dts/r8a73a4.dtsi263
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva.dts7
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi44
-rw-r--r--arch/arm/boot/dts/r8a7778-bockw-reference.dts7
-rw-r--r--arch/arm/boot/dts/r8a7778.dtsi42
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen.dts84
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi34
-rw-r--r--arch/arm/boot/dts/r8a7790-lager.dts185
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi279
-rw-r--r--arch/arm/boot/dts/r8a7791-henninger.dts12
-rw-r--r--arch/arm/boot/dts/r8a7791-koelsch.dts118
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi255
-rw-r--r--arch/arm/boot/dts/r8a7794-alt.dts3
-rw-r--r--arch/arm/boot/dts/r8a7794.dtsi29
-rw-r--r--arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi41
-rw-r--r--arch/arm/boot/dts/rk3066a-bqcurie2.dts4
-rw-r--r--arch/arm/boot/dts/rk3066a-marsboard.dts206
-rw-r--r--arch/arm/boot/dts/rk3066a.dtsi115
-rw-r--r--arch/arm/boot/dts/rk3188-radxarock.dts23
-rw-r--r--arch/arm/boot/dts/rk3188.dtsi45
-rw-r--r--arch/arm/boot/dts/rk3288-evb-rk808.dts6
-rw-r--r--arch/arm/boot/dts/rk3288-evb.dtsi6
-rw-r--r--arch/arm/boot/dts/rk3288-thermal.dtsi74
-rw-r--r--arch/arm/boot/dts/rk3288.dtsi99
-rw-r--r--arch/arm/boot/dts/rk3xxx.dtsi17
-rw-r--r--arch/arm/boot/dts/s3c6410-mini6410.dts4
-rw-r--r--arch/arm/boot/dts/s3c64xx.dtsi1
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts9
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi10
-rw-r--r--arch/arm/boot/dts/socfpga.dtsi27
-rw-r--r--arch/arm/boot/dts/socfpga_arria10.dtsi374
-rwxr-xr-xarch/arm/boot/dts/socfpga_arria10_socdk.dts48
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5.dtsi4
-rw-r--r--arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi64
-rw-r--r--arch/arm/boot/dts/ste-dbx5x0.dtsi22
-rw-r--r--arch/arm/boot/dts/ste-href-ab8500.dtsi162
-rw-r--r--arch/arm/boot/dts/ste-href-ab8505.dtsi90
-rw-r--r--arch/arm/boot/dts/ste-href-family-pinctrl.dtsi230
-rw-r--r--arch/arm/boot/dts/ste-href-stuib.dtsi4
-rw-r--r--arch/arm/boot/dts/ste-href-tvk1281618.dtsi12
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60.dtsi20
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus.dtsi42
-rw-r--r--arch/arm/boot/dts/ste-nomadik-nhk15.dts151
-rw-r--r--arch/arm/boot/dts/ste-nomadik-s8815.dts64
-rw-r--r--arch/arm/boot/dts/ste-nomadik-stn8815.dtsi73
-rw-r--r--arch/arm/boot/dts/ste-snowball.dts36
-rw-r--r--arch/arm/boot/dts/stih407-b2120.dts55
-rw-r--r--arch/arm/boot/dts/stih407-clock.dtsi293
-rw-r--r--arch/arm/boot/dts/stih407-family.dtsi (renamed from arch/arm/boot/dts/stih407.dtsi)35
-rw-r--r--arch/arm/boot/dts/stih410-b2120.dts29
-rw-r--r--arch/arm/boot/dts/stih410-clock.dtsi338
-rw-r--r--arch/arm/boot/dts/stih410-pinctrl.dtsi34
-rw-r--r--arch/arm/boot/dts/stih410.dtsi14
-rw-r--r--arch/arm/boot/dts/stih415-pinctrl.dtsi361
-rw-r--r--arch/arm/boot/dts/stih415.dtsi12
-rw-r--r--arch/arm/boot/dts/stih416-b2020.dts22
-rw-r--r--arch/arm/boot/dts/stih416-b2020e.dts26
-rw-r--r--arch/arm/boot/dts/stih416-pinctrl.dtsi415
-rw-r--r--arch/arm/boot/dts/stih416.dtsi209
-rw-r--r--arch/arm/boot/dts/stih41x-b2000.dtsi6
-rw-r--r--arch/arm/boot/dts/stih41x-b2020.dtsi10
-rw-r--r--arch/arm/boot/dts/stih41x-b2020x.dtsi4
-rw-r--r--arch/arm/boot/dts/stihxxx-b2120.dtsi59
-rw-r--r--arch/arm/boot/dts/sun4i-a10-a1000.dts46
-rw-r--r--arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts46
-rw-r--r--arch/arm/boot/dts/sun4i-a10-cubieboard.dts46
-rw-r--r--arch/arm/boot/dts/sun4i-a10-hackberry.dts46
-rw-r--r--arch/arm/boot/dts/sun4i-a10-inet97fv2.dts46
-rw-r--r--arch/arm/boot/dts/sun4i-a10-mini-xplus.dts46
-rw-r--r--arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts46
-rw-r--r--arch/arm/boot/dts/sun4i-a10-pcduino.dts46
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi14
-rw-r--r--arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts46
-rw-r--r--arch/arm/boot/dts/sun5i-a10s-r7-tv-dongle.dts46
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi14
-rw-r--r--arch/arm/boot/dts/sun5i-a13-hsg-h702.dts6
-rw-r--r--arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts48
-rw-r--r--arch/arm/boot/dts/sun5i-a13-olinuxino.dts46
-rw-r--r--arch/arm/boot/dts/sun6i-a31-app4-evb1.dts46
-rw-r--r--arch/arm/boot/dts/sun6i-a31-colombus.dts46
-rw-r--r--arch/arm/boot/dts/sun6i-a31-hummingbird.dts46
-rw-r--r--arch/arm/boot/dts/sun6i-a31-m9.dts103
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi46
-rw-r--r--arch/arm/boot/dts/sun7i-a20-bananapi.dts214
-rw-r--r--arch/arm/boot/dts/sun7i-a20-cubietruck.dts14
-rw-r--r--arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts46
-rw-r--r--arch/arm/boot/dts/sun7i-a20-m3.dts168
-rw-r--r--arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts46
-rw-r--r--arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts228
-rw-r--r--arch/arm/boot/dts/sun7i-a20-pcduino3.dts46
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi45
-rw-r--r--arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts46
-rw-r--r--arch/arm/boot/dts/sun8i-a23.dtsi6
-rw-r--r--arch/arm/boot/dts/sun9i-a80-optimus.dts119
-rw-r--r--arch/arm/boot/dts/sun9i-a80.dtsi514
-rw-r--r--arch/arm/boot/dts/sunxi-common-regulators.dtsi66
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi2
-rw-r--r--arch/arm/boot/dts/vf-colibri-eval-v3.dtsi96
-rw-r--r--arch/arm/boot/dts/vf-colibri.dtsi186
-rw-r--r--arch/arm/boot/dts/vf500-colibri-eval-v3.dts17
-rw-r--r--arch/arm/boot/dts/vf500-colibri.dtsi20
-rw-r--r--arch/arm/boot/dts/vf500.dtsi171
-rw-r--r--arch/arm/boot/dts/vf610-colibri-eval-v3.dts33
-rw-r--r--arch/arm/boot/dts/vf610-colibri.dtsi100
-rw-r--r--arch/arm/boot/dts/vf610-cosmic.dts14
-rw-r--r--arch/arm/boot/dts/vf610-twr.dts46
-rw-r--r--arch/arm/boot/dts/vf610.dtsi486
-rw-r--r--arch/arm/boot/dts/vfxxx.dtsi437
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi1
-rw-r--r--arch/arm/boot/dts/zynq-parallella.dts1
-rw-r--r--arch/arm/boot/dts/zynq-zc702.dts4
-rw-r--r--arch/arm/boot/dts/zynq-zc706.dts4
-rw-r--r--arch/arm/boot/dts/zynq-zed.dts4
-rw-r--r--arch/arm/boot/dts/zynq-zybo.dts52
-rw-r--r--arch/arm/common/edma.c54
-rw-r--r--arch/arm/configs/ape6evm_defconfig1
-rw-r--r--arch/arm/configs/at91_dt_defconfig3
-rw-r--r--arch/arm/configs/at91rm9200_defconfig161
-rw-r--r--arch/arm/configs/at91sam9260_9g20_defconfig145
-rw-r--r--arch/arm/configs/at91sam9261_9g10_defconfig147
-rw-r--r--arch/arm/configs/at91sam9263_defconfig151
-rw-r--r--arch/arm/configs/at91sam9g45_defconfig175
-rw-r--r--arch/arm/configs/at91sam9rl_defconfig92
-rw-r--r--arch/arm/configs/at91x40_defconfig48
-rw-r--r--arch/arm/configs/bcm_defconfig3
-rw-r--r--arch/arm/configs/exynos_defconfig1
-rw-r--r--arch/arm/configs/hisi_defconfig19
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig10
-rw-r--r--arch/arm/configs/integrator_defconfig3
-rw-r--r--arch/arm/configs/keystone_defconfig7
-rw-r--r--arch/arm/configs/koelsch_defconfig113
-rw-r--r--arch/arm/configs/multi_v5_defconfig2
-rw-r--r--arch/arm/configs/multi_v7_defconfig36
-rw-r--r--arch/arm/configs/mvebu_v5_defconfig2
-rw-r--r--arch/arm/configs/mvebu_v7_defconfig9
-rw-r--r--arch/arm/configs/nhk8815_defconfig11
-rw-r--r--arch/arm/configs/omap2plus_defconfig22
-rw-r--r--arch/arm/configs/sama5_defconfig7
-rw-r--r--arch/arm/configs/shmobile_defconfig4
-rw-r--r--arch/arm/configs/tegra_defconfig2
-rw-r--r--arch/arm/include/asm/arch_timer.h9
-rw-r--r--arch/arm/include/asm/cpuidle.h1
-rw-r--r--arch/arm/include/asm/firmware.h10
-rw-r--r--arch/arm/include/asm/io.h89
-rw-r--r--arch/arm/include/asm/mach/pci.h10
-rw-r--r--arch/arm/include/asm/memory.h4
-rw-r--r--arch/arm/include/asm/perf_event.h2
-rw-r--r--arch/arm/include/asm/pmu.h36
-rw-r--r--arch/arm/include/debug/asm9260.S29
-rw-r--r--arch/arm/include/debug/renesas-scif.S52
-rw-r--r--arch/arm/include/debug/sa1100.S (renamed from arch/arm/mach-sa1100/include/mach/debug-macro.S)10
-rw-r--r--arch/arm/kernel/Makefile2
-rw-r--r--arch/arm/kernel/bios32.c28
-rw-r--r--arch/arm/kernel/perf_callchain.c136
-rw-r--r--arch/arm/kernel/perf_event.c162
-rw-r--r--arch/arm/kernel/perf_event_cpu.c181
-rw-r--r--arch/arm/kernel/perf_event_v6.c12
-rw-r--r--arch/arm/kernel/perf_event_v7.c72
-rw-r--r--arch/arm/kernel/perf_event_xscale.c20
-rw-r--r--arch/arm/mach-asm9260/Kconfig6
-rw-r--r--arch/arm/mach-at91/Kconfig72
-rw-r--r--arch/arm/mach-at91/Kconfig.non_dt344
-rw-r--r--arch/arm/mach-at91/Makefile67
-rw-r--r--arch/arm/mach-at91/Makefile.boot6
-rw-r--r--arch/arm/mach-at91/at91_aic.h99
-rw-r--r--arch/arm/mach-at91/at91_tc.h146
-rw-r--r--arch/arm/mach-at91/at91rm9200.c341
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c1212
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c23
-rw-r--r--arch/arm/mach-at91/at91sam9260.c397
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c1364
-rw-r--r--arch/arm/mach-at91/at91sam9261.c375
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c1098
-rw-r--r--arch/arm/mach-at91/at91sam9263.c399
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c1538
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c456
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c1915
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c213
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c378
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c1260
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c311
-rw-r--r--arch/arm/mach-at91/at91x40.c93
-rw-r--r--arch/arm/mach-at91/at91x40_time.c85
-rw-r--r--arch/arm/mach-at91/board-1arm.c99
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c223
-rw-r--r--arch/arm/mach-at91/board-cam60.c199
-rw-r--r--arch/arm/mach-at91/board-carmeva.c167
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c386
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c189
-rw-r--r--arch/arm/mach-at91/board-csb337.c260
-rw-r--r--arch/arm/mach-at91/board-csb637.c142
-rw-r--r--arch/arm/mach-at91/board-dt-rm9200.c3
-rw-r--r--arch/arm/mach-at91/board-dt-sam9.c2
-rw-r--r--arch/arm/mach-at91/board-dt-sama5.c1
-rw-r--r--arch/arm/mach-at91/board-eb01.c52
-rw-r--r--arch/arm/mach-at91/board-eb9200.c126
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c191
-rw-r--r--arch/arm/mach-at91/board-eco920.c160
-rw-r--r--arch/arm/mach-at91/board-flexibity.c171
-rw-r--r--arch/arm/mach-at91/board-gsia18s.c585
-rw-r--r--arch/arm/mach-at91/board-kafa.c113
-rw-r--r--arch/arm/mach-at91/board-kb9202.c159
-rw-r--r--arch/arm/mach-at91/board-pcontrol-g20.c228
-rw-r--r--arch/arm/mach-at91/board-picotux200.c129
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c196
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c230
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c354
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c623
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c493
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c429
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c527
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c333
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c191
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c294
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c597
-rw-r--r--arch/arm/mach-at91/board.h127
-rw-r--r--arch/arm/mach-at91/clock.c977
-rw-r--r--arch/arm/mach-at91/clock.h49
-rw-r--r--arch/arm/mach-at91/generic.h53
-rw-r--r--arch/arm/mach-at91/gpio.c982
-rw-r--r--arch/arm/mach-at91/gpio.h214
-rw-r--r--arch/arm/mach-at91/gsia18s.h33
-rw-r--r--arch/arm/mach-at91/include/mach/at91_dbgu.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_ramc.h6
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h63
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h124
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_sdramc.h85
-rw-r--r--arch/arm/mach-at91/include/mach/at91x40.h60
-rw-r--r--arch/arm/mach-at91/include/mach/atmel-mci.h17
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h1
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h10
-rw-r--r--arch/arm/mach-at91/include/mach/uncompress.h7
-rw-r--r--arch/arm/mach-at91/irq.c296
-rw-r--r--arch/arm/mach-at91/leds.c56
-rw-r--r--arch/arm/mach-at91/pm.c33
-rw-r--r--arch/arm/mach-at91/pm.h1
-rw-r--r--arch/arm/mach-at91/setup.c67
-rw-r--r--arch/arm/mach-at91/soc.h6
-rw-r--r--arch/arm/mach-at91/stamp9g20.h7
-rw-r--r--arch/arm/mach-bcm/Kconfig97
-rw-r--r--arch/arm/mach-bcm/Makefile5
-rw-r--r--arch/arm/mach-bcm/bcm_cygnus.c25
-rw-r--r--arch/arm/mach-bcm/brcmstb.h19
-rw-r--r--arch/arm/mach-bcm/headsmp-brcmstb.S33
-rw-r--r--arch/arm/mach-bcm/platsmp-brcmstb.c329
-rw-r--r--arch/arm/mach-berlin/Kconfig3
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c89
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c9
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c4
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c10
-rw-r--r--arch/arm/mach-davinci/board-mityomapl138.c45
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c5
-rw-r--r--arch/arm/mach-davinci/clock.c2
-rw-r--r--arch/arm/mach-davinci/cpuidle.c1
-rw-r--r--arch/arm/mach-davinci/dm355.c7
-rw-r--r--arch/arm/mach-davinci/dm365.c7
-rw-r--r--arch/arm/mach-davinci/mux.c15
-rw-r--r--arch/arm/mach-davinci/time.c13
-rw-r--r--arch/arm/mach-ebsa110/include/mach/io.h25
-rw-r--r--arch/arm/mach-ebsa110/io.c14
-rw-r--r--arch/arm/mach-ep93xx/dma.c12
-rw-r--r--arch/arm/mach-exynos/Kconfig11
-rw-r--r--arch/arm/mach-exynos/Makefile7
-rw-r--r--arch/arm/mach-exynos/common.h33
-rw-r--r--arch/arm/mach-exynos/exynos-pmu.h24
-rw-r--r--arch/arm/mach-exynos/exynos.c80
-rw-r--r--arch/arm/mach-exynos/firmware.c67
-rw-r--r--arch/arm/mach-exynos/hotplug.c91
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h23
-rw-r--r--arch/arm/mach-exynos/mcpm-exynos.c32
-rw-r--r--arch/arm/mach-exynos/platsmp.c148
-rw-r--r--arch/arm/mach-exynos/pm.c311
-rw-r--r--arch/arm/mach-exynos/pmu.c675
-rw-r--r--arch/arm/mach-exynos/regs-pmu.h361
-rw-r--r--arch/arm/mach-exynos/sleep.S28
-rw-r--r--arch/arm/mach-exynos/smc.h4
-rw-r--r--arch/arm/mach-exynos/suspend.c566
-rw-r--r--arch/arm/mach-imx/Kconfig31
-rw-r--r--arch/arm/mach-imx/Makefile6
-rw-r--r--arch/arm/mach-imx/anatop.c34
-rw-r--r--arch/arm/mach-imx/clk-cpu.c107
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c14
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c2
-rw-r--r--arch/arm/mach-imx/clk-pllv3.c7
-rw-r--r--arch/arm/mach-imx/clk-vf610.c21
-rw-r--r--arch/arm/mach-imx/clk.h4
-rw-r--r--arch/arm/mach-imx/common.h7
-rw-r--r--arch/arm/mach-imx/cpuidle-imx5.c1
-rw-r--r--arch/arm/mach-imx/cpuidle-imx6q.c3
-rw-r--r--arch/arm/mach-imx/cpuidle-imx6sl.c3
-rw-r--r--arch/arm/mach-imx/gpc.c42
-rw-r--r--arch/arm/mach-imx/imx25-dt.c9
-rw-r--r--arch/arm/mach-imx/imx27-dt.c3
-rw-r--r--arch/arm/mach-imx/imx31-dt.c9
-rw-r--r--arch/arm/mach-imx/imx35-dt.c10
-rw-r--r--arch/arm/mach-imx/iomux-imx31.c8
-rw-r--r--arch/arm/mach-imx/iomux-mx3.h2
-rw-r--r--arch/arm/mach-imx/mach-imx50.c9
-rw-r--r--arch/arm/mach-imx/mach-imx51.c2
-rw-r--r--arch/arm/mach-imx/mach-imx53.c4
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c3
-rw-r--r--arch/arm/mach-imx/mach-imx6sl.c4
-rw-r--r--arch/arm/mach-imx/mach-imx6sx.c55
-rw-r--r--arch/arm/mach-imx/mach-ls1021a.c22
-rw-r--r--arch/arm/mach-imx/mach-vf610.c10
-rw-r--r--arch/arm/mach-imx/mmdc.c17
-rw-r--r--arch/arm/mach-imx/mxc.h2
-rw-r--r--arch/arm/mach-imx/platsmp.c33
-rw-r--r--arch/arm/mach-imx/pm-imx6.c15
-rw-r--r--arch/arm/mach-imx/suspend-imx6.S14
-rw-r--r--arch/arm/mach-imx/system.c15
-rw-r--r--arch/arm/mach-integrator/Kconfig23
-rw-r--r--arch/arm/mach-integrator/Makefile2
-rw-r--r--arch/arm/mach-integrator/cm.h1
-rw-r--r--arch/arm/mach-integrator/common.h2
-rw-r--r--arch/arm/mach-integrator/core.c103
-rw-r--r--arch/arm/mach-integrator/include/mach/uncompress.h48
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c218
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c28
-rw-r--r--arch/arm/mach-integrator/leds.c124
-rw-r--r--arch/arm/mach-iop13xx/msi.c10
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h24
-rw-r--r--arch/arm/mach-keystone/Kconfig2
-rw-r--r--arch/arm/mach-mediatek/Kconfig4
-rw-r--r--arch/arm/mach-mediatek/mediatek.c3
-rw-r--r--arch/arm/mach-meson/Kconfig6
-rw-r--r--arch/arm/mach-meson/meson.c10
-rw-r--r--arch/arm/mach-mvebu/Makefile2
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.h6
-rw-r--r--arch/arm/mach-mvebu/board-v7.c122
-rw-r--r--arch/arm/mach-mvebu/coherency.c221
-rw-r--r--arch/arm/mach-mvebu/coherency_ll.S21
-rw-r--r--arch/arm/mach-mvebu/common.h2
-rw-r--r--arch/arm/mach-mvebu/cpu-reset.c1
-rw-r--r--arch/arm/mach-mvebu/headsmp-a9.S1
-rw-r--r--arch/arm/mach-mvebu/platsmp-a9.c53
-rw-r--r--arch/arm/mach-mvebu/platsmp.c33
-rw-r--r--arch/arm/mach-mvebu/pm-board.c141
-rw-r--r--arch/arm/mach-mvebu/pm.c218
-rw-r--r--arch/arm/mach-mvebu/pmsu.c11
-rw-r--r--arch/arm/mach-mvebu/pmsu.h3
-rw-r--r--arch/arm/mach-mvebu/pmsu_ll.S28
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c1
-rw-r--r--arch/arm/mach-omap2/Kconfig18
-rw-r--r--arch/arm/mach-omap2/Makefile10
-rw-r--r--arch/arm/mach-omap2/am33xx-restart.c12
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c632
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c1
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c3
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c3
-rw-r--r--arch/arm/mach-omap2/board-flash.c3
-rw-r--r--arch/arm/mach-omap2/board-flash.h1
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c4
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c2
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c107
-rw-r--r--arch/arm/mach-omap2/board-ti8168evm.c62
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c6
-rw-r--r--arch/arm/mach-omap2/clock.c7
-rw-r--r--arch/arm/mach-omap2/clock.h1
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c38
-rw-r--r--arch/arm/mach-omap2/cm.h18
-rw-r--r--arch/arm/mach-omap2/cm1_44xx.h2
-rw-r--r--arch/arm/mach-omap2/cm1_54xx.h2
-rw-r--r--arch/arm/mach-omap2/cm1_7xx.h2
-rw-r--r--arch/arm/mach-omap2/cm2_44xx.h2
-rw-r--r--arch/arm/mach-omap2/cm2_54xx.h2
-rw-r--r--arch/arm/mach-omap2/cm2_7xx.h2
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c17
-rw-r--r--arch/arm/mach-omap2/cm2xxx.h10
-rw-r--r--arch/arm/mach-omap2/cm33xx.c61
-rw-r--r--arch/arm/mach-omap2/cm33xx.h37
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c19
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h12
-rw-r--r--arch/arm/mach-omap2/cm44xx.c49
-rw-r--r--arch/arm/mach-omap2/cm44xx.h3
-rw-r--r--arch/arm/mach-omap2/cm_44xx_54xx.h36
-rw-r--r--arch/arm/mach-omap2/cm_common.c82
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c80
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h43
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c7
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c5
-rw-r--r--arch/arm/mach-omap2/devices.c93
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c179
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c41
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c3
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.h27
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c3
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.h24
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.c186
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.h42
-rw-r--r--arch/arm/mach-omap2/gpmc.c1891
-rw-r--r--arch/arm/mach-omap2/gpmc.h227
-rw-r--r--arch/arm/mach-omap2/hsmmc.c158
-rw-r--r--arch/arm/mach-omap2/hsmmc.h9
-rw-r--r--arch/arm/mach-omap2/io.c11
-rw-r--r--arch/arm/mach-omap2/mmc.h10
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c4
-rw-r--r--arch/arm/mach-omap2/omap2-restart.c5
-rw-r--r--arch/arm/mach-omap2/omap3-restart.c7
-rw-r--r--arch/arm/mach-omap2/omap4-common.c1
-rw-r--r--arch/arm/mach-omap2/omap4-restart.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c272
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_43xx_data.c39
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c29
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c9
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_7xx_data.c104
-rw-r--r--arch/arm/mach-omap2/omap_phy_internal.c8
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c39
-rw-r--r--arch/arm/mach-omap2/pm34xx.c2
-rw-r--r--arch/arm/mach-omap2/pm44xx.c146
-rw-r--r--arch/arm/mach-omap2/prm.h16
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c6
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h1
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c19
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h9
-rw-r--r--arch/arm/mach-omap2/prm33xx.c64
-rw-r--r--arch/arm/mach-omap2/prm33xx.h11
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c32
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h16
-rw-r--r--arch/arm/mach-omap2/prm44xx.c36
-rw-r--r--arch/arm/mach-omap2/prm44xx_54xx.h19
-rw-r--r--arch/arm/mach-omap2/prm_common.c99
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c10
-rw-r--r--arch/arm/mach-omap2/prminst44xx.h5
-rw-r--r--arch/arm/mach-omap2/serial.c3
-rw-r--r--arch/arm/mach-pxa/Kconfig11
-rw-r--r--arch/arm/mach-pxa/Makefile1
-rw-r--r--arch/arm/mach-pxa/em-x270.c4
-rw-r--r--arch/arm/mach-pxa/generic.h65
-rw-r--r--arch/arm/mach-pxa/gumstix.c3
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa25x.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa27x.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa3xx.h5
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c12
-rw-r--r--arch/arm/mach-pxa/poodle.c2
-rw-r--r--arch/arm/mach-pxa/pxa-dt.c18
-rw-r--r--arch/arm/mach-pxa/pxa27x.c6
-rw-r--r--arch/arm/mach-pxa/pxa3xx-ulpi.c6
-rw-r--r--arch/arm/mach-pxa/raumfeld.c26
-rw-r--r--arch/arm/mach-pxa/spitz.c9
-rw-r--r--arch/arm/mach-pxa/tosa.c41
-rw-r--r--arch/arm/mach-realview/Kconfig13
-rw-r--r--arch/arm/mach-realview/Makefile1
-rw-r--r--arch/arm/mach-realview/realview-dt.c32
-rw-r--r--arch/arm/mach-rockchip/headsmp.S5
-rw-r--r--arch/arm/mach-rockchip/platsmp.c223
-rw-r--r--arch/arm/mach-rockchip/rockchip.c7
-rw-r--r--arch/arm/mach-s3c24xx/h1940-bluetooth.c4
-rw-r--r--arch/arm/mach-s3c24xx/h1940.h4
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c3
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c3
-rw-r--r--arch/arm/mach-s3c64xx/cpuidle.c1
-rw-r--r--arch/arm/mach-sa1100/pci-nanoengine.c8
-rw-r--r--arch/arm/mach-shmobile/Kconfig22
-rw-r--r--arch/arm/mach-shmobile/Makefile6
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot1
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm-reference.c5
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c4
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c57
-rw-r--r--arch/arm/mach-shmobile/board-bockw-reference.c4
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c4
-rw-r--r--arch/arm/mach-shmobile/board-koelsch-reference.c117
-rw-r--r--arch/arm/mach-shmobile/board-koelsch.c527
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c12
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c4
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c84
-rw-r--r--arch/arm/mach-shmobile/board-lager.c4
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c6
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c5
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7791.c342
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c4
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c4
-rw-r--r--arch/arm/mach-shmobile/clock.c36
-rw-r--r--arch/arm/mach-shmobile/clock.h14
-rw-r--r--arch/arm/mach-shmobile/common.h5
-rw-r--r--arch/arm/mach-shmobile/console.c4
-rw-r--r--arch/arm/mach-shmobile/headsmp-scu.S5
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c4
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c4
-rw-r--r--arch/arm/mach-shmobile/platsmp-apmu.c27
-rw-r--r--arch/arm/mach-shmobile/platsmp-apmu.h32
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7740.c44
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7779.c3
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c3
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c4
-rw-r--r--arch/arm/mach-shmobile/r8a73a4.h1
-rw-r--r--arch/arm/mach-shmobile/r8a7740.h4
-rw-r--r--arch/arm/mach-shmobile/r8a7778.h5
-rw-r--r--arch/arm/mach-shmobile/r8a7791.h3
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c4
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c4
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c13
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c16
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c14
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c11
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c4
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c185
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c76
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c8
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c24
-rw-r--r--arch/arm/mach-shmobile/sh73a0.h1
-rw-r--r--arch/arm/mach-shmobile/sleep-sh7372.S5
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c4
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7790.c16
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7791.c12
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c4
-rw-r--r--arch/arm/mach-shmobile/timer.c28
-rw-r--r--arch/arm/mach-socfpga/core.h3
-rw-r--r--arch/arm/mach-socfpga/platsmp.c19
-rw-r--r--arch/arm/mach-sti/Kconfig10
-rw-r--r--arch/arm/mach-sunxi/Kconfig7
-rw-r--r--arch/arm/mach-sunxi/platsmp.c2
-rw-r--r--arch/arm/mach-sunxi/sunxi.c9
-rw-r--r--arch/arm/mach-tegra/Kconfig9
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra114.c3
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra20.c3
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra30.c1
-rw-r--r--arch/arm/mach-tegra/reset-handler.S1
-rw-r--r--arch/arm/mach-u300/dummyspichip.c65
-rw-r--r--arch/arm/mach-ux500/Kconfig1
-rw-r--r--arch/arm/mach-ux500/Makefile1
-rw-r--r--arch/arm/mach-ux500/pm.c4
-rw-r--r--arch/arm/mach-ux500/pm_domains.c79
-rw-r--r--arch/arm/mach-ux500/pm_domains.h17
-rw-r--r--arch/arm/mach-vexpress/Kconfig4
-rw-r--r--arch/arm/mach-vexpress/Makefile3
-rw-r--r--arch/arm/mach-vexpress/core.h7
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c212
-rw-r--r--arch/arm/mach-vexpress/include/mach/ct-ca9x4.h47
-rw-r--r--arch/arm/mach-vexpress/include/mach/hardware.h1
-rw-r--r--arch/arm/mach-vexpress/include/mach/irqs.h6
-rw-r--r--arch/arm/mach-vexpress/include/mach/motherboard.h88
-rw-r--r--arch/arm/mach-vexpress/platsmp.c42
-rw-r--r--arch/arm/mach-vexpress/v2m.c374
-rw-r--r--arch/arm/mach-zynq/Makefile2
-rw-r--r--arch/arm/mach-zynq/common.h1
-rw-r--r--arch/arm/mach-zynq/hotplug.c14
-rw-r--r--arch/arm/mm/Kconfig28
-rw-r--r--arch/arm/plat-orion/gpio.c11
-rw-r--r--arch/arm/plat-orion/include/plat/orion-gpio.h5
-rw-r--r--arch/arm/plat-samsung/Makefile1
-rw-r--r--arch/arm/plat-samsung/include/plat/map-s5p.h21
-rw-r--r--arch/arm/plat-versatile/Kconfig2
-rw-r--r--arch/arm64/Kconfig197
-rw-r--r--arch/arm64/Kconfig.debug12
-rw-r--r--arch/arm64/Makefile10
-rw-r--r--arch/arm64/boot/dts/Makefile16
-rw-r--r--arch/arm64/boot/dts/amd/Makefile5
-rw-r--r--arch/arm64/boot/dts/amd/amd-overdrive.dts66
-rw-r--r--arch/arm64/boot/dts/amd/amd-seattle-clks.dtsi54
-rw-r--r--arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi172
-rw-r--r--arch/arm64/boot/dts/apm/Makefile5
-rw-r--r--arch/arm64/boot/dts/apm/apm-mustang.dts (renamed from arch/arm64/boot/dts/apm-mustang.dts)0
-rw-r--r--arch/arm64/boot/dts/apm/apm-storm.dtsi (renamed from arch/arm64/boot/dts/apm-storm.dtsi)0
-rw-r--r--arch/arm64/boot/dts/arm/Makefile7
-rw-r--r--arch/arm64/boot/dts/arm/foundation-v8.dts (renamed from arch/arm64/boot/dts/foundation-v8.dts)8
-rw-r--r--arch/arm64/boot/dts/arm/juno-clocks.dtsi44
-rw-r--r--arch/arm64/boot/dts/arm/juno-motherboard.dtsi129
-rw-r--r--arch/arm64/boot/dts/arm/juno.dts218
-rw-r--r--arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts (renamed from arch/arm64/boot/dts/rtsm_ve-aemv8a.dts)8
-rw-r--r--arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi (renamed from arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi)0
-rw-r--r--arch/arm64/boot/dts/cavium/Makefile5
-rw-r--r--arch/arm64/boot/dts/cavium/thunder-88xx.dts (renamed from arch/arm64/boot/dts/thunder-88xx.dts)0
-rw-r--r--arch/arm64/boot/dts/cavium/thunder-88xx.dtsi (renamed from arch/arm64/boot/dts/thunder-88xx.dtsi)0
l---------arch/arm64/boot/dts/include/dt-bindings1
-rw-r--r--arch/arm64/crypto/Kconfig5
-rw-r--r--arch/arm64/crypto/aes-ce-ccm-glue.c4
-rw-r--r--arch/arm64/crypto/aes-ce-cipher.c112
-rw-r--r--arch/arm64/crypto/aes-ce-setkey.h5
-rw-r--r--arch/arm64/crypto/aes-glue.c18
-rw-r--r--arch/arm64/include/asm/alternative-asm.h29
-rw-r--r--arch/arm64/include/asm/alternative.h44
-rw-r--r--arch/arm64/include/asm/arch_timer.h9
-rw-r--r--arch/arm64/include/asm/cache.h2
-rw-r--r--arch/arm64/include/asm/cacheflush.h2
-rw-r--r--arch/arm64/include/asm/cmpxchg.h73
-rw-r--r--arch/arm64/include/asm/compat.h7
-rw-r--r--arch/arm64/include/asm/cpu.h2
-rw-r--r--arch/arm64/include/asm/cpufeature.h29
-rw-r--r--arch/arm64/include/asm/cputype.h5
-rw-r--r--arch/arm64/include/asm/dmi.h31
-rw-r--r--arch/arm64/include/asm/fixmap.h8
-rw-r--r--arch/arm64/include/asm/hwcap.h1
-rw-r--r--arch/arm64/include/asm/insn.h10
-rw-r--r--arch/arm64/include/asm/io.h145
-rw-r--r--arch/arm64/include/asm/irq.h3
-rw-r--r--arch/arm64/include/asm/kvm_arm.h21
-rw-r--r--arch/arm64/include/asm/memory.h2
-rw-r--r--arch/arm64/include/asm/opcodes.h1
-rw-r--r--arch/arm64/include/asm/percpu.h215
-rw-r--r--arch/arm64/include/asm/pgalloc.h8
-rw-r--r--arch/arm64/include/asm/pgtable.h1
-rw-r--r--arch/arm64/include/asm/seccomp.h25
-rw-r--r--arch/arm64/include/asm/tlb.h67
-rw-r--r--arch/arm64/include/asm/traps.h16
-rw-r--r--arch/arm64/include/asm/unistd.h3
-rw-r--r--arch/arm64/include/asm/unistd32.h3
-rw-r--r--arch/arm64/kernel/Makefile7
-rw-r--r--arch/arm64/kernel/alternative.c85
-rw-r--r--arch/arm64/kernel/armv8_deprecated.c553
-rw-r--r--arch/arm64/kernel/cpu_errata.c111
-rw-r--r--arch/arm64/kernel/cpuinfo.c23
-rw-r--r--arch/arm64/kernel/efi-entry.S3
-rw-r--r--arch/arm64/kernel/efi.c37
-rw-r--r--arch/arm64/kernel/entry-ftrace.S21
-rw-r--r--arch/arm64/kernel/entry.S138
-rw-r--r--arch/arm64/kernel/head.S434
-rw-r--r--arch/arm64/kernel/insn.c26
-rw-r--r--arch/arm64/kernel/io.c66
-rw-r--r--arch/arm64/kernel/irq.c2
-rw-r--r--arch/arm64/kernel/jump_label.c23
-rw-r--r--arch/arm64/kernel/module.c18
-rw-r--r--arch/arm64/kernel/perf_event.c10
-rw-r--r--arch/arm64/kernel/ptrace.c40
-rw-r--r--arch/arm64/kernel/setup.c108
-rw-r--r--arch/arm64/kernel/signal32.c6
-rw-r--r--arch/arm64/kernel/sleep.S36
-rw-r--r--arch/arm64/kernel/smp.c2
-rw-r--r--arch/arm64/kernel/suspend.c4
-rw-r--r--arch/arm64/kernel/sys_compat.c49
-rw-r--r--arch/arm64/kernel/topology.c7
-rw-r--r--arch/arm64/kernel/trace-events-emulation.h35
-rw-r--r--arch/arm64/kernel/traps.c66
-rw-r--r--arch/arm64/kernel/vmlinux.lds.S33
-rw-r--r--arch/arm64/kvm/hyp.S4
-rw-r--r--arch/arm64/mm/Makefile1
-rw-r--r--arch/arm64/mm/cache.S10
-rw-r--r--arch/arm64/mm/dump.c332
-rw-r--r--arch/arm64/mm/fault.c2
-rw-r--r--arch/arm64/mm/init.c2
-rw-r--r--arch/arm64/mm/ioremap.c93
-rw-r--r--arch/arm64/mm/mm.h1
-rw-r--r--arch/arm64/mm/mmap.c12
-rw-r--r--arch/arm64/mm/mmu.c94
-rw-r--r--arch/arm64/mm/pgd.c4
-rw-r--r--arch/arm64/net/bpf_jit_comp.c13
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c2
-rw-r--r--arch/avr32/mach-at32ap/include/mach/atmel-mci.h17
-rw-r--r--arch/cris/include/asm/io.h3
-rw-r--r--arch/frv/include/asm/io.h3
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/include/asm/io.h4
-rw-r--r--arch/ia64/include/asm/uaccess.h16
-rw-r--r--arch/ia64/include/uapi/asm/siginfo.h8
-rw-r--r--arch/ia64/kernel/msi_ia64.c8
-rw-r--r--arch/ia64/kernel/perfmon.c2
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c8
-rw-r--r--arch/m32r/include/asm/io.h3
-rw-r--r--arch/m68k/atari/config.c27
-rw-r--r--arch/m68k/atari/stdma.c61
-rw-r--r--arch/m68k/include/asm/atari_stdma.h4
-rw-r--r--arch/m68k/include/asm/io.h8
-rw-r--r--arch/m68k/include/asm/io_no.h4
-rw-r--r--arch/m68k/include/asm/macintosh.h4
-rw-r--r--arch/m68k/mac/config.c146
-rw-r--r--arch/m68k/mm/init.c1
-rw-r--r--arch/m68k/sun3/config.c60
-rw-r--r--arch/microblaze/include/asm/io.h8
-rw-r--r--arch/microblaze/include/asm/tlb.h3
-rw-r--r--arch/mips/include/asm/idle.h1
-rw-r--r--arch/mips/include/uapi/asm/siginfo.h4
-rw-r--r--arch/mips/pci/msi-octeon.c2
-rw-r--r--arch/mips/pci/msi-xlp.c12
-rw-r--r--arch/mips/pci/pci-xlr.c2
-rw-r--r--arch/mn10300/include/asm/io.h4
-rw-r--r--arch/nios2/Kconfig206
-rw-r--r--arch/nios2/Kconfig.debug17
-rw-r--r--arch/nios2/Makefile73
-rw-r--r--arch/nios2/boot/Makefile52
-rw-r--r--arch/nios2/boot/dts/3c120_devboard.dts164
-rw-r--r--arch/nios2/boot/install.sh52
-rw-r--r--arch/nios2/boot/linked_dtb.S19
-rw-r--r--arch/nios2/configs/3c120_defconfig77
-rw-r--r--arch/nios2/include/asm/Kbuild65
-rw-r--r--arch/nios2/include/asm/asm-macros.h309
-rw-r--r--arch/nios2/include/asm/asm-offsets.h20
-rw-r--r--arch/nios2/include/asm/cache.h36
-rw-r--r--arch/nios2/include/asm/cacheflush.h52
-rw-r--r--arch/nios2/include/asm/checksum.h78
-rw-r--r--arch/nios2/include/asm/cmpxchg.h61
-rw-r--r--arch/nios2/include/asm/cpuinfo.h57
-rw-r--r--arch/nios2/include/asm/delay.h21
-rw-r--r--arch/nios2/include/asm/dma-mapping.h140
-rw-r--r--arch/nios2/include/asm/elf.h101
-rw-r--r--arch/nios2/include/asm/entry.h120
-rw-r--r--arch/nios2/include/asm/io.h61
-rw-r--r--arch/nios2/include/asm/irq.h28
-rw-r--r--arch/nios2/include/asm/irqflags.h72
-rw-r--r--arch/nios2/include/asm/linkage.h25
-rw-r--r--arch/nios2/include/asm/mmu.h16
-rw-r--r--arch/nios2/include/asm/mmu_context.h66
-rw-r--r--arch/nios2/include/asm/mutex.h1
-rw-r--r--arch/nios2/include/asm/page.h109
-rw-r--r--arch/nios2/include/asm/pgalloc.h86
-rw-r--r--arch/nios2/include/asm/pgtable-bits.h35
-rw-r--r--arch/nios2/include/asm/pgtable.h310
-rw-r--r--arch/nios2/include/asm/processor.h103
-rw-r--r--arch/nios2/include/asm/ptrace.h33
-rw-r--r--arch/nios2/include/asm/registers.h71
-rw-r--r--arch/nios2/include/asm/setup.h38
-rw-r--r--arch/nios2/include/asm/signal.h22
-rw-r--r--arch/nios2/include/asm/string.h24
-rw-r--r--arch/nios2/include/asm/switch_to.h31
-rw-r--r--arch/nios2/include/asm/syscall.h138
-rw-r--r--arch/nios2/include/asm/syscalls.h25
-rw-r--r--arch/nios2/include/asm/thread_info.h120
-rw-r--r--arch/nios2/include/asm/timex.h24
-rw-r--r--arch/nios2/include/asm/tlb.h34
-rw-r--r--arch/nios2/include/asm/tlbflush.h46
-rw-r--r--arch/nios2/include/asm/traps.h19
-rw-r--r--arch/nios2/include/asm/uaccess.h231
-rw-r--r--arch/nios2/include/asm/ucontext.h32
-rw-r--r--arch/nios2/include/uapi/asm/Kbuild4
-rw-r--r--arch/nios2/include/uapi/asm/byteorder.h22
-rw-r--r--arch/nios2/include/uapi/asm/elf.h67
-rw-r--r--arch/nios2/include/uapi/asm/ptrace.h120
-rw-r--r--arch/nios2/include/uapi/asm/sigcontext.h28
-rw-r--r--arch/nios2/include/uapi/asm/signal.h23
-rw-r--r--arch/nios2/include/uapi/asm/swab.h37
-rw-r--r--arch/nios2/include/uapi/asm/unistd.h25
-rw-r--r--arch/nios2/kernel/Makefile24
-rw-r--r--arch/nios2/kernel/asm-offsets.c87
-rw-r--r--arch/nios2/kernel/cpuinfo.c197
-rw-r--r--arch/nios2/kernel/entry.S555
-rw-r--r--arch/nios2/kernel/head.S175
-rw-r--r--arch/nios2/kernel/insnemu.S592
-rw-r--r--arch/nios2/kernel/irq.c93
-rw-r--r--arch/nios2/kernel/misaligned.c256
-rw-r--r--arch/nios2/kernel/module.c138
-rw-r--r--arch/nios2/kernel/nios2_ksyms.c33
-rw-r--r--arch/nios2/kernel/process.c258
-rw-r--r--arch/nios2/kernel/prom.c65
-rw-r--r--arch/nios2/kernel/ptrace.c166
-rw-r--r--arch/nios2/kernel/setup.c218
-rw-r--r--arch/nios2/kernel/signal.c323
-rw-r--r--arch/nios2/kernel/sys_nios2.c53
-rw-r--r--arch/nios2/kernel/syscall_table.c29
-rw-r--r--arch/nios2/kernel/time.c308
-rw-r--r--arch/nios2/kernel/traps.c185
-rw-r--r--arch/nios2/kernel/vmlinux.lds.S75
-rw-r--r--arch/nios2/lib/Makefile8
-rw-r--r--arch/nios2/lib/delay.c52
-rw-r--r--arch/nios2/lib/memcpy.c202
-rw-r--r--arch/nios2/lib/memmove.c82
-rw-r--r--arch/nios2/lib/memset.c81
-rw-r--r--arch/nios2/mm/Makefile14
-rw-r--r--arch/nios2/mm/cacheflush.c271
-rw-r--r--arch/nios2/mm/dma-mapping.c186
-rw-r--r--arch/nios2/mm/extable.c25
-rw-r--r--arch/nios2/mm/fault.c251
-rw-r--r--arch/nios2/mm/init.c142
-rw-r--r--arch/nios2/mm/ioremap.c187
-rw-r--r--arch/nios2/mm/mmu_context.c116
-rw-r--r--arch/nios2/mm/pgtable.c74
-rw-r--r--arch/nios2/mm/tlb.c275
-rw-r--r--arch/nios2/mm/uaccess.c163
-rw-r--r--arch/nios2/platform/Kconfig.platform129
-rw-r--r--arch/nios2/platform/Makefile1
-rw-r--r--arch/nios2/platform/platform.c46
-rw-r--r--arch/parisc/hpux/fs.c7
-rw-r--r--arch/parisc/include/asm/io.h12
-rw-r--r--arch/powerpc/include/asm/io.h12
-rw-r--r--arch/powerpc/include/asm/iommu.h17
-rw-r--r--arch/powerpc/include/asm/pgalloc.h3
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h1
-rw-r--r--arch/powerpc/include/asm/tlb.h1
-rw-r--r--arch/powerpc/kernel/dma-iommu.c8
-rw-r--r--arch/powerpc/kernel/ftrace.c2
-rw-r--r--arch/powerpc/kernel/iommu.c16
-rw-r--r--arch/powerpc/mm/hugetlbpage.c2
-rw-r--r--arch/powerpc/mm/numa.c3
-rw-r--r--arch/powerpc/oprofile/cell/spu_task_sync.c10
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c8
-rw-r--r--arch/powerpc/platforms/cell/iommu.c9
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c6
-rw-r--r--arch/powerpc/platforms/powernv/opal-sensor.c20
-rw-r--r--arch/powerpc/platforms/powernv/pci.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c7
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c15
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c5
-rw-r--r--arch/powerpc/platforms/pseries/msi.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c5
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c6
-rw-r--r--arch/powerpc/sysdev/mpic_pasemi_msi.c6
-rw-r--r--arch/powerpc/sysdev/mpic_u3msi.c6
-rw-r--r--arch/powerpc/sysdev/ppc4xx_hsta_msi.c2
-rw-r--r--arch/powerpc/sysdev/ppc4xx_msi.c2
-rw-r--r--arch/powerpc/sysdev/xics/ics-opal.c2
-rw-r--r--arch/powerpc/sysdev/xics/ics-rtas.c2
-rw-r--r--arch/s390/hypfs/hypfs_dbfs.c3
-rw-r--r--arch/s390/include/asm/io.h10
-rw-r--r--arch/s390/include/asm/mmu_context.h11
-rw-r--r--arch/s390/mm/maccess.c4
-rw-r--r--arch/s390/pci/pci.c10
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c2
-rw-r--r--arch/sh/kernel/cpu/shmobile/cpuidle.c3
-rw-r--r--arch/sh/mm/numa.c2
-rw-r--r--arch/sparc/include/asm/io_32.h4
-rw-r--r--arch/sparc/include/asm/io_64.h14
-rw-r--r--arch/sparc/include/asm/pgtable_64.h7
-rw-r--r--arch/sparc/kernel/pci_msi.c10
-rw-r--r--arch/tile/include/asm/io.h4
-rw-r--r--arch/tile/kernel/early_printk.c19
-rw-r--r--arch/tile/kernel/pci_gx.c8
-rw-r--r--arch/tile/kernel/setup.c45
-rw-r--r--arch/um/include/asm/mmu_context.h24
-rw-r--r--arch/unicore32/include/asm/mmu_context.h11
-rw-r--r--arch/x86/Kconfig22
-rw-r--r--arch/x86/boot/compressed/Makefile17
-rw-r--r--arch/x86/boot/compressed/eboot.c8
-rw-r--r--arch/x86/boot/compressed/eboot.h16
-rw-r--r--arch/x86/boot/compressed/misc.c14
-rw-r--r--arch/x86/configs/i386_defconfig1
-rw-r--r--arch/x86/configs/x86_64_defconfig1
-rw-r--r--arch/x86/ia32/ia32_aout.c8
-rw-r--r--arch/x86/include/asm/cacheflush.h59
-rw-r--r--arch/x86/include/asm/cpufeature.h5
-rw-r--r--arch/x86/include/asm/disabled-features.h8
-rw-r--r--arch/x86/include/asm/efi.h24
-rw-r--r--arch/x86/include/asm/fb.h6
-rw-r--r--arch/x86/include/asm/fixmap.h4
-rw-r--r--arch/x86/include/asm/ftrace.h33
-rw-r--r--arch/x86/include/asm/highmem.h25
-rw-r--r--arch/x86/include/asm/insn.h10
-rw-r--r--arch/x86/include/asm/io.h10
-rw-r--r--arch/x86/include/asm/mce.h5
-rw-r--r--arch/x86/include/asm/microcode.h2
-rw-r--r--arch/x86/include/asm/microcode_amd.h4
-rw-r--r--arch/x86/include/asm/microcode_intel.h2
-rw-r--r--arch/x86/include/asm/mmu_context.h37
-rw-r--r--arch/x86/include/asm/mpx.h103
-rw-r--r--arch/x86/include/asm/page_64.h4
-rw-r--r--arch/x86/include/asm/paravirt.h16
-rw-r--r--arch/x86/include/asm/pat.h7
-rw-r--r--arch/x86/include/asm/percpu.h61
-rw-r--r--arch/x86/include/asm/perf_event.h3
-rw-r--r--arch/x86/include/asm/pgtable.h24
-rw-r--r--arch/x86/include/asm/pgtable_32_types.h2
-rw-r--r--arch/x86/include/asm/pgtable_64_types.h2
-rw-r--r--arch/x86/include/asm/pgtable_types.h96
-rw-r--r--arch/x86/include/asm/platform_sst_audio.h62
-rw-r--r--arch/x86/include/asm/preempt.h3
-rw-r--r--arch/x86/include/asm/processor.h45
-rw-r--r--arch/x86/include/asm/spinlock.h14
-rw-r--r--arch/x86/include/asm/switch_to.h12
-rw-r--r--arch/x86/include/asm/uv/uv_bau.h4
-rw-r--r--arch/x86/include/asm/vgtod.h19
-rw-r--r--arch/x86/include/asm/vsyscall.h33
-rw-r--r--arch/x86/include/asm/vvar.h2
-rw-r--r--arch/x86/include/asm/x86_init.h3
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h42
-rw-r--r--arch/x86/kernel/Makefile3
-rw-r--r--arch/x86/kernel/amd_nb.c2
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c26
-rw-r--r--arch/x86/kernel/apic/hw_nmi.c91
-rw-r--r--arch/x86/kernel/apic/io_apic.c8
-rw-r--r--arch/x86/kernel/apm_32.c1
-rw-r--r--arch/x86/kernel/asm-offsets_64.c1
-rw-r--r--arch/x86/kernel/cpu/amd.c23
-rw-r--r--arch/x86/kernel/cpu/common.c10
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-internal.h4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-severity.c23
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c72
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c54
-rw-r--r--arch/x86/kernel/cpu/microcode/amd.c8
-rw-r--r--arch/x86/kernel/cpu/microcode/amd_early.c20
-rw-r--r--arch/x86/kernel/cpu/microcode/core.c10
-rw-r--r--arch/x86/kernel/cpu/microcode/core_early.c21
-rw-r--r--arch/x86/kernel/cpu/microcode/intel_early.c42
-rw-r--r--arch/x86/kernel/cpu/perf_event.h4
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_ibs.c15
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c98
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c25
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c8
-rw-r--r--arch/x86/kernel/cpu/proc.c10
-rw-r--r--arch/x86/kernel/cpu/scattered.c5
-rw-r--r--arch/x86/kernel/cpuid.c2
-rw-r--r--arch/x86/kernel/espfix_64.c3
-rw-r--r--arch/x86/kernel/ftrace.c288
-rw-r--r--arch/x86/kernel/irq.c30
-rw-r--r--arch/x86/kernel/kprobes/core.c8
-rw-r--r--arch/x86/kernel/kprobes/ftrace.c9
-rw-r--r--arch/x86/kernel/kprobes/opt.c4
-rw-r--r--arch/x86/kernel/mcount_64.S224
-rw-r--r--arch/x86/kernel/msr.c11
-rw-r--r--arch/x86/kernel/setup.c4
-rw-r--r--arch/x86/kernel/setup_percpu.c2
-rw-r--r--arch/x86/kernel/smpboot.c2
-rw-r--r--arch/x86/kernel/sysfb.c2
-rw-r--r--arch/x86/kernel/sysfb_simplefb.c5
-rw-r--r--arch/x86/kernel/time.c2
-rw-r--r--arch/x86/kernel/traps.c90
-rw-r--r--arch/x86/kernel/uprobes.c2
-rw-r--r--arch/x86/kernel/vmlinux.lds.S2
-rw-r--r--arch/x86/kernel/vsyscall_64.c147
-rw-r--r--arch/x86/kernel/x86_init.c10
-rw-r--r--arch/x86/kvm/mmutrace.h4
-rw-r--r--arch/x86/lib/insn.c5
-rw-r--r--arch/x86/mm/Makefile2
-rw-r--r--arch/x86/mm/dump_pagetables.c27
-rw-r--r--arch/x86/mm/init.c37
-rw-r--r--arch/x86/mm/init_64.c65
-rw-r--r--arch/x86/mm/iomap_32.c12
-rw-r--r--arch/x86/mm/ioremap.c67
-rw-r--r--arch/x86/mm/mm_internal.h2
-rw-r--r--arch/x86/mm/mpx.c928
-rw-r--r--arch/x86/mm/pageattr.c84
-rw-r--r--arch/x86/mm/pat.c247
-rw-r--r--arch/x86/mm/pat_internal.h22
-rw-r--r--arch/x86/mm/pat_rbtree.c8
-rw-r--r--arch/x86/pci/i386.c4
-rw-r--r--arch/x86/pci/numachip.c2
-rw-r--r--arch/x86/pci/xen.c19
-rw-r--r--arch/x86/platform/efi/efi_64.c3
-rw-r--r--arch/x86/platform/uv/tlb_uv.c30
-rw-r--r--arch/x86/purgatory/Makefile1
-rw-r--r--arch/x86/tools/insn_sanity.c2
-rw-r--r--arch/x86/tools/relocs.c36
-rw-r--r--arch/x86/tools/test_get_len.c2
-rw-r--r--arch/x86/vdso/vgetcpu.c2
-rw-r--r--arch/x86/vdso/vma.c83
-rw-r--r--arch/x86/xen/enlighten.c25
-rw-r--r--arch/x86/xen/mmu.c53
-rw-r--r--arch/x86/xen/xen-ops.h1
-rw-r--r--arch/xtensa/include/asm/io.h7
1115 files changed, 44903 insertions, 39177 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index f9c732e18284..e51f578636a5 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -104,11 +104,12 @@ struct osf_dirent_callback {
104}; 104};
105 105
106static int 106static int
107osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, 107osf_filldir(struct dir_context *ctx, const char *name, int namlen,
108 u64 ino, unsigned int d_type) 108 loff_t offset, u64 ino, unsigned int d_type)
109{ 109{
110 struct osf_dirent __user *dirent; 110 struct osf_dirent __user *dirent;
111 struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; 111 struct osf_dirent_callback *buf =
112 container_of(ctx, struct osf_dirent_callback, ctx);
112 unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32)); 113 unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32));
113 unsigned int d_ino; 114 unsigned int d_ino;
114 115
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 334ce7017a18..cabd518cb253 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -13,8 +13,6 @@
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <asm/page.h> 14#include <asm/page.h>
15 15
16#define PCI_IOBASE ((void __iomem *)0)
17
18extern void __iomem *ioremap(unsigned long physaddr, unsigned long size); 16extern void __iomem *ioremap(unsigned long physaddr, unsigned long size);
19extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size, 17extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
20 unsigned long flags); 18 unsigned long flags);
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 89c4b5ccc68d..c8424a85bc04 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -320,24 +320,6 @@ config ARCH_MULTIPLATFORM
320 select SPARSE_IRQ 320 select SPARSE_IRQ
321 select USE_OF 321 select USE_OF
322 322
323config ARCH_INTEGRATOR
324 bool "ARM Ltd. Integrator family"
325 select ARM_AMBA
326 select ARM_PATCH_PHYS_VIRT if MMU
327 select AUTO_ZRELADDR
328 select COMMON_CLK
329 select COMMON_CLK_VERSATILE
330 select GENERIC_CLOCKEVENTS
331 select HAVE_TCM
332 select ICST
333 select MULTI_IRQ_HANDLER
334 select PLAT_VERSATILE
335 select SPARSE_IRQ
336 select USE_OF
337 select VERSATILE_FPGA_IRQ
338 help
339 Support for ARM's Integrator platform.
340
341config ARCH_REALVIEW 323config ARCH_REALVIEW
342 bool "ARM Ltd. RealView family" 324 bool "ARM Ltd. RealView family"
343 select ARCH_WANT_OPTIONAL_GPIOLIB 325 select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -350,6 +332,7 @@ config ARCH_REALVIEW
350 select ICST 332 select ICST
351 select NEED_MACH_MEMORY_H 333 select NEED_MACH_MEMORY_H
352 select PLAT_VERSATILE 334 select PLAT_VERSATILE
335 select PLAT_VERSATILE_SCHED_CLOCK
353 help 336 help
354 This enables support for ARM Ltd RealView boards. 337 This enables support for ARM Ltd RealView boards.
355 338
@@ -365,6 +348,7 @@ config ARCH_VERSATILE
365 select ICST 348 select ICST
366 select PLAT_VERSATILE 349 select PLAT_VERSATILE
367 select PLAT_VERSATILE_CLOCK 350 select PLAT_VERSATILE_CLOCK
351 select PLAT_VERSATILE_SCHED_CLOCK
368 select VERSATILE_FPGA_IRQ 352 select VERSATILE_FPGA_IRQ
369 help 353 help
370 This enables support for ARM Ltd Versatile board. 354 This enables support for ARM Ltd Versatile board.
@@ -376,10 +360,11 @@ config ARCH_AT91
376 select IRQ_DOMAIN 360 select IRQ_DOMAIN
377 select NEED_MACH_IO_H if PCCARD 361 select NEED_MACH_IO_H if PCCARD
378 select PINCTRL 362 select PINCTRL
379 select PINCTRL_AT91 if USE_OF 363 select PINCTRL_AT91
364 select USE_OF
380 help 365 help
381 This enables support for systems based on Atmel 366 This enables support for systems based on Atmel
382 AT91RM9200 and AT91SAM9* processors. 367 AT91RM9200, AT91SAM9 and SAMA5 processors.
383 368
384config ARCH_CLPS711X 369config ARCH_CLPS711X
385 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" 370 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
@@ -854,6 +839,8 @@ config ARCH_VIRT
854# 839#
855source "arch/arm/mach-mvebu/Kconfig" 840source "arch/arm/mach-mvebu/Kconfig"
856 841
842source "arch/arm/mach-asm9260/Kconfig"
843
857source "arch/arm/mach-at91/Kconfig" 844source "arch/arm/mach-at91/Kconfig"
858 845
859source "arch/arm/mach-axxia/Kconfig" 846source "arch/arm/mach-axxia/Kconfig"
@@ -1259,9 +1246,6 @@ source "arch/arm/common/Kconfig"
1259 1246
1260menu "Bus support" 1247menu "Bus support"
1261 1248
1262config ARM_AMBA
1263 bool
1264
1265config ISA 1249config ISA
1266 bool 1250 bool
1267 help 1251 help
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index d8f6a2ec3d4e..f9295a4e1036 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -93,6 +93,27 @@ choice
93 prompt "Kernel low-level debugging port" 93 prompt "Kernel low-level debugging port"
94 depends on DEBUG_LL 94 depends on DEBUG_LL
95 95
96 config DEBUG_ASM9260_UART
97 bool "Kernel low-level debugging via asm9260 UART"
98 depends on MACH_ASM9260
99 help
100 Say Y here if you want the debug print routines to direct
101 their output to an UART or USART port on asm9260 based
102 machines.
103
104 DEBUG_UART_PHYS | DEBUG_UART_VIRT
105
106 0x80000000 | 0xf0000000 | UART0
107 0x80004000 | 0xf0004000 | UART1
108 0x80008000 | 0xf0008000 | UART2
109 0x8000c000 | 0xf000c000 | UART3
110 0x80010000 | 0xf0010000 | UART4
111 0x80014000 | 0xf0014000 | UART5
112 0x80018000 | 0xf0018000 | UART6
113 0x8001c000 | 0xf001c000 | UART7
114 0x80020000 | 0xf0020000 | UART8
115 0x80024000 | 0xf0024000 | UART9
116
96 config AT91_DEBUG_LL_DBGU0 117 config AT91_DEBUG_LL_DBGU0
97 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" 118 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl"
98 depends on HAVE_AT91_DBGU0 119 depends on HAVE_AT91_DBGU0
@@ -113,7 +134,7 @@ choice
113 config DEBUG_BCM_5301X 134 config DEBUG_BCM_5301X
114 bool "Kernel low-level debugging on BCM5301X UART1" 135 bool "Kernel low-level debugging on BCM5301X UART1"
115 depends on ARCH_BCM_5301X 136 depends on ARCH_BCM_5301X
116 select DEBUG_UART_PL01X 137 select DEBUG_UART_8250
117 138
118 config DEBUG_BCM_KONA_UART 139 config DEBUG_BCM_KONA_UART
119 bool "Kernel low-level debugging messages via BCM KONA UART" 140 bool "Kernel low-level debugging messages via BCM KONA UART"
@@ -139,6 +160,17 @@ choice
139 Say Y here if you want kernel low-level debugging support 160 Say Y here if you want kernel low-level debugging support
140 on Marvell Berlin SoC based platforms. 161 on Marvell Berlin SoC based platforms.
141 162
163 config DEBUG_BRCMSTB_UART
164 bool "Use BRCMSTB UART for low-level debug"
165 depends on ARCH_BRCMSTB
166 select DEBUG_UART_8250
167 help
168 Say Y here if you want the debug print routines to direct
169 their output to the first serial port on these devices.
170
171 If you have a Broadcom STB chip and would like early print
172 messages to appear over the UART, select this option.
173
142 config DEBUG_CLPS711X_UART1 174 config DEBUG_CLPS711X_UART1
143 bool "Kernel low-level debugging messages via UART1" 175 bool "Kernel low-level debugging messages via UART1"
144 depends on ARCH_CLPS711X 176 depends on ARCH_CLPS711X
@@ -653,6 +685,64 @@ choice
653 Say Y here if you want kernel low-level debugging support 685 Say Y here if you want kernel low-level debugging support
654 on Rockchip RK32xx based platforms. 686 on Rockchip RK32xx based platforms.
655 687
688 config DEBUG_R7S72100_SCIF2
689 bool "Kernel low-level debugging messages via SCIF2 on R7S72100"
690 depends on ARCH_R7S72100
691 help
692 Say Y here if you want kernel low-level debugging support
693 via SCIF2 on Renesas RZ/A1H (R7S72100).
694
695 config DEBUG_RCAR_GEN1_SCIF0
696 bool "Kernel low-level debugging messages via SCIF0 on R8A7778"
697 depends on ARCH_R8A7778
698 help
699 Say Y here if you want kernel low-level debugging support
700 via SCIF0 on Renesas R-Car M1A (R8A7778).
701
702 config DEBUG_RCAR_GEN1_SCIF2
703 bool "Kernel low-level debugging messages via SCIF2 on R8A7779"
704 depends on ARCH_R8A7779
705 help
706 Say Y here if you want kernel low-level debugging support
707 via SCIF2 on Renesas R-Car H1 (R8A7779).
708
709 config DEBUG_RCAR_GEN2_SCIF0
710 bool "Kernel low-level debugging messages via SCIF0 on R8A7790/R8A7791/R8A7793)"
711 depends on ARCH_R8A7790 || ARCH_R8A7791 || ARCH_R8A7793
712 help
713 Say Y here if you want kernel low-level debugging support
714 via SCIF0 on Renesas R-Car H2 (R8A7790), M2-W (R8A7791), or
715 M2-N (R8A7793).
716
717 config DEBUG_RCAR_GEN2_SCIF2
718 bool "Kernel low-level debugging messages via SCIF2 on R8A7794"
719 depends on ARCH_R8A7794
720 help
721 Say Y here if you want kernel low-level debugging support
722 via SCIF2 on Renesas R-Car E2 (R8A7794).
723
724 config DEBUG_RMOBILE_SCIFA0
725 bool "Kernel low-level debugging messages via SCIFA0 on R8A73A4/SH7372"
726 depends on ARCH_R8A73A4 || ARCH_SH7372
727 help
728 Say Y here if you want kernel low-level debugging support
729 via SCIFA0 on Renesas R-Mobile APE6 (R8A73A4) or SH-Mobile
730 AP4 (SH7372).
731
732 config DEBUG_RMOBILE_SCIFA1
733 bool "Kernel low-level debugging messages via SCIFA1 on R8A7740"
734 depends on ARCH_R8A7740
735 help
736 Say Y here if you want kernel low-level debugging support
737 via SCIFA1 on Renesas R-Mobile A1 (R8A7740).
738
739 config DEBUG_RMOBILE_SCIFA4
740 bool "Kernel low-level debugging messages via SCIFA4 on SH73A0"
741 depends on ARCH_SH73A0
742 help
743 Say Y here if you want kernel low-level debugging support
744 via SCIFA4 on Renesas SH-Mobile AG5 (SH73A0).
745
656 config DEBUG_S3C_UART0 746 config DEBUG_S3C_UART0
657 depends on PLAT_SAMSUNG 747 depends on PLAT_SAMSUNG
658 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 748 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
@@ -723,6 +813,14 @@ choice
723 their output to UART 2. The port must have been initialised 813 their output to UART 2. The port must have been initialised
724 by the boot-loader before use. 814 by the boot-loader before use.
725 815
816 config DEBUG_SA1100
817 depends on ARCH_SA1100
818 bool "Use SA1100 UARTs for low-level debug"
819 help
820 Say Y here if you want kernel low-level debugging support
821 on SA-11x0 UART ports. The kernel will check for the first
822 enabled UART in a sequence 3-1-2.
823
726 config DEBUG_SOCFPGA_UART 824 config DEBUG_SOCFPGA_UART
727 depends on ARCH_SOCFPGA 825 depends on ARCH_SOCFPGA
728 bool "Use SOCFPGA UART for low-level debug" 826 bool "Use SOCFPGA UART for low-level debug"
@@ -731,6 +829,14 @@ choice
731 Say Y here if you want kernel low-level debugging support 829 Say Y here if you want kernel low-level debugging support
732 on SOCFPGA based platforms. 830 on SOCFPGA based platforms.
733 831
832 config DEBUG_SUN9I_UART0
833 bool "Kernel low-level debugging messages via sun9i UART0"
834 depends on MACH_SUN9I
835 select DEBUG_UART_8250
836 help
837 Say Y here if you want kernel low-level debugging support
838 on Allwinner A80 based platforms on the UART0.
839
734 config DEBUG_SUNXI_UART0 840 config DEBUG_SUNXI_UART0
735 bool "Kernel low-level debugging messages via sunXi UART0" 841 bool "Kernel low-level debugging messages via sunXi UART0"
736 depends on ARCH_SUNXI 842 depends on ARCH_SUNXI
@@ -866,6 +972,22 @@ choice
866 Say Y here if you want kernel low-level debugging support 972 Say Y here if you want kernel low-level debugging support
867 for Mediatek mt6589 based platforms on UART0. 973 for Mediatek mt6589 based platforms on UART0.
868 974
975 config DEBUG_MT8127_UART0
976 bool "Mediatek mt8127 UART0"
977 depends on ARCH_MEDIATEK
978 select DEBUG_UART_8250
979 help
980 Say Y here if you want kernel low-level debugging support
981 for Mediatek mt8127 based platforms on UART0.
982
983 config DEBUG_MT8135_UART3
984 bool "Mediatek mt8135 UART3"
985 depends on ARCH_MEDIATEK
986 select DEBUG_UART_8250
987 help
988 Say Y here if you want kernel low-level debugging support
989 for Mediatek mt8135 based platforms on UART3.
990
869 config DEBUG_VEXPRESS_UART0_DETECT 991 config DEBUG_VEXPRESS_UART0_DETECT
870 bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" 992 bool "Autodetect UART0 on Versatile Express Cortex-A core tiles"
871 depends on ARCH_VEXPRESS && CPU_CP15_MMU 993 depends on ARCH_VEXPRESS && CPU_CP15_MMU
@@ -1041,7 +1163,9 @@ config DEBUG_STI_UART
1041 1163
1042config DEBUG_LL_INCLUDE 1164config DEBUG_LL_INCLUDE
1043 string 1165 string
1166 default "debug/sa1100.S" if DEBUG_SA1100
1044 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 1167 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
1168 default "debug/asm9260.S" if DEBUG_ASM9260_UART
1045 default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 1169 default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2
1046 default "debug/meson.S" if DEBUG_MESON_UARTAO 1170 default "debug/meson.S" if DEBUG_MESON_UARTAO
1047 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X 1171 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X
@@ -1061,6 +1185,14 @@ config DEBUG_LL_INCLUDE
1061 DEBUG_IMX6SX_UART 1185 DEBUG_IMX6SX_UART
1062 default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM 1186 default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM
1063 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 1187 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
1188 default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2
1189 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0
1190 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF2
1191 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF0
1192 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF2
1193 default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA0
1194 default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA1
1195 default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA4
1064 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART 1196 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART
1065 default "debug/s5pv210.S" if DEBUG_S5PV210_UART 1197 default "debug/s5pv210.S" if DEBUG_S5PV210_UART
1066 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 1198 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
@@ -1106,6 +1238,7 @@ config DEBUG_UART_PHYS
1106 default 0x02530c00 if DEBUG_KEYSTONE_UART0 1238 default 0x02530c00 if DEBUG_KEYSTONE_UART0
1107 default 0x02531000 if DEBUG_KEYSTONE_UART1 1239 default 0x02531000 if DEBUG_KEYSTONE_UART1
1108 default 0x03010fe0 if ARCH_RPC 1240 default 0x03010fe0 if ARCH_RPC
1241 default 0x07000000 if DEBUG_SUN9I_UART0
1109 default 0x10009000 if DEBUG_REALVIEW_STD_PORT || \ 1242 default 0x10009000 if DEBUG_REALVIEW_STD_PORT || \
1110 DEBUG_VEXPRESS_UART0_CA9 1243 DEBUG_VEXPRESS_UART0_CA9
1111 default 0x1010c000 if DEBUG_REALVIEW_PB1176_PORT 1244 default 0x1010c000 if DEBUG_REALVIEW_PB1176_PORT
@@ -1113,7 +1246,9 @@ config DEBUG_UART_PHYS
1113 default 0x10126000 if DEBUG_RK3X_UART1 1246 default 0x10126000 if DEBUG_RK3X_UART1
1114 default 0x101f1000 if ARCH_VERSATILE 1247 default 0x101f1000 if ARCH_VERSATILE
1115 default 0x101fb000 if DEBUG_NOMADIK_UART 1248 default 0x101fb000 if DEBUG_NOMADIK_UART
1249 default 0x11002000 if DEBUG_MT8127_UART0
1116 default 0x11006000 if DEBUG_MT6589_UART0 1250 default 0x11006000 if DEBUG_MT6589_UART0
1251 default 0x11009000 if DEBUG_MT8135_UART3
1117 default 0x16000000 if ARCH_INTEGRATOR 1252 default 0x16000000 if ARCH_INTEGRATOR
1118 default 0x18000300 if DEBUG_BCM_5301X 1253 default 0x18000300 if DEBUG_BCM_5301X
1119 default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1 1254 default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1
@@ -1135,6 +1270,7 @@ config DEBUG_UART_PHYS
1135 default 0x78000000 if DEBUG_CNS3XXX 1270 default 0x78000000 if DEBUG_CNS3XXX
1136 default 0x7c0003f8 if FOOTBRIDGE 1271 default 0x7c0003f8 if FOOTBRIDGE
1137 default 0x78000000 if DEBUG_CNS3XXX 1272 default 0x78000000 if DEBUG_CNS3XXX
1273 default 0x80010000 if DEBUG_ASM9260_UART
1138 default 0x80070000 if DEBUG_IMX23_UART 1274 default 0x80070000 if DEBUG_IMX23_UART
1139 default 0x80074000 if DEBUG_IMX28_UART 1275 default 0x80074000 if DEBUG_IMX28_UART
1140 default 0x80230000 if DEBUG_PICOXCELL_UART 1276 default 0x80230000 if DEBUG_PICOXCELL_UART
@@ -1152,7 +1288,14 @@ config DEBUG_UART_PHYS
1152 default 0xd4018000 if DEBUG_MMP_UART3 1288 default 0xd4018000 if DEBUG_MMP_UART3
1153 default 0xe0000000 if ARCH_SPEAR13XX 1289 default 0xe0000000 if ARCH_SPEAR13XX
1154 default 0xe4007000 if DEBUG_HIP04_UART 1290 default 0xe4007000 if DEBUG_HIP04_UART
1291 default 0xe6c40000 if DEBUG_RMOBILE_SCIFA0
1292 default 0xe6c50000 if DEBUG_RMOBILE_SCIFA1
1293 default 0xe6c80000 if DEBUG_RMOBILE_SCIFA4
1294 default 0xe6e58000 if DEBUG_RCAR_GEN2_SCIF2
1295 default 0xe6e60000 if DEBUG_RCAR_GEN2_SCIF0
1296 default 0xe8008000 if DEBUG_R7S72100_SCIF2
1155 default 0xf0000be0 if ARCH_EBSA110 1297 default 0xf0000be0 if ARCH_EBSA110
1298 default 0xf040ab00 if DEBUG_BRCMSTB_UART
1156 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE 1299 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
1157 default 0xf1012000 if ARCH_DOVE || ARCH_MV78XX0 || \ 1300 default 0xf1012000 if ARCH_DOVE || ARCH_MV78XX0 || \
1158 ARCH_ORION5X 1301 ARCH_ORION5X
@@ -1164,24 +1307,33 @@ config DEBUG_UART_PHYS
1164 default 0xff690000 if DEBUG_RK32_UART2 1307 default 0xff690000 if DEBUG_RK32_UART2
1165 default 0xffc02000 if DEBUG_SOCFPGA_UART 1308 default 0xffc02000 if DEBUG_SOCFPGA_UART
1166 default 0xffd82340 if ARCH_IOP13XX 1309 default 0xffd82340 if ARCH_IOP13XX
1310 default 0xffe40000 if DEBUG_RCAR_GEN1_SCIF0
1311 default 0xffe42000 if DEBUG_RCAR_GEN1_SCIF2
1167 default 0xfff36000 if DEBUG_HIGHBANK_UART 1312 default 0xfff36000 if DEBUG_HIGHBANK_UART
1168 default 0xfffe8600 if DEBUG_UART_BCM63XX 1313 default 0xfffe8600 if DEBUG_UART_BCM63XX
1169 default 0xfffff700 if ARCH_IOP33X 1314 default 0xfffff700 if ARCH_IOP33X
1170 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1315 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1171 DEBUG_LL_UART_EFM32 || \ 1316 DEBUG_LL_UART_EFM32 || \
1172 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ 1317 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
1173 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ 1318 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \
1174 DEBUG_UART_BCM63XX 1319 DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \
1320 DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \
1321 DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \
1322 DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \
1323 DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART
1175 1324
1176config DEBUG_UART_VIRT 1325config DEBUG_UART_VIRT
1177 hex "Virtual base address of debug UART" 1326 hex "Virtual base address of debug UART"
1178 default 0xe0010fe0 if ARCH_RPC 1327 default 0xe0010fe0 if ARCH_RPC
1179 default 0xe1000000 if DEBUG_MSM_UART 1328 default 0xe1000000 if DEBUG_MSM_UART
1180 default 0xf0000be0 if ARCH_EBSA110 1329 default 0xf0000be0 if ARCH_EBSA110
1330 default 0xf0010000 if DEBUG_ASM9260_UART
1181 default 0xf01fb000 if DEBUG_NOMADIK_UART 1331 default 0xf01fb000 if DEBUG_NOMADIK_UART
1182 default 0xf0201000 if DEBUG_BCM2835 1332 default 0xf0201000 if DEBUG_BCM2835
1183 default 0xf1000300 if DEBUG_BCM_5301X 1333 default 0xf1000300 if DEBUG_BCM_5301X
1334 default 0xf1002000 if DEBUG_MT8127_UART0
1184 default 0xf1006000 if DEBUG_MT6589_UART0 1335 default 0xf1006000 if DEBUG_MT6589_UART0
1336 default 0xf1009000 if DEBUG_MT8135_UART3
1185 default 0xf11f1000 if ARCH_VERSATILE 1337 default 0xf11f1000 if ARCH_VERSATILE
1186 default 0xf1600000 if ARCH_INTEGRATOR 1338 default 0xf1600000 if ARCH_INTEGRATOR
1187 default 0xf1c28000 if DEBUG_SUNXI_UART0 1339 default 0xf1c28000 if DEBUG_SUNXI_UART0
@@ -1190,6 +1342,7 @@ config DEBUG_UART_VIRT
1190 default 0xf6200000 if DEBUG_PXA_UART1 1342 default 0xf6200000 if DEBUG_PXA_UART1
1191 default 0xf4090000 if ARCH_LPC32XX 1343 default 0xf4090000 if ARCH_LPC32XX
1192 default 0xf4200000 if ARCH_GEMINI 1344 default 0xf4200000 if ARCH_GEMINI
1345 default 0xf7000000 if DEBUG_SUN9I_UART0
1193 default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \ 1346 default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
1194 DEBUG_S3C2410_UART0) 1347 DEBUG_S3C2410_UART0)
1195 default 0xf7004000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART1 || \ 1348 default 0xf7004000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART1 || \
@@ -1204,6 +1357,7 @@ config DEBUG_UART_VIRT
1204 default 0xfb002000 if DEBUG_CNS3XXX 1357 default 0xfb002000 if DEBUG_CNS3XXX
1205 default 0xfb009000 if DEBUG_REALVIEW_STD_PORT 1358 default 0xfb009000 if DEBUG_REALVIEW_STD_PORT
1206 default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT 1359 default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT
1360 default 0xfc40ab00 if DEBUG_BRCMSTB_UART
1207 default 0xfcfe8600 if DEBUG_UART_BCM63XX 1361 default 0xfcfe8600 if DEBUG_UART_BCM63XX
1208 default 0xfd000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX 1362 default 0xfd000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX
1209 default 0xfd000000 if ARCH_SPEAR13XX 1363 default 0xfd000000 if ARCH_SPEAR13XX
@@ -1244,12 +1398,12 @@ config DEBUG_UART_VIRT
1244 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1398 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1245 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ 1399 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
1246 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ 1400 DEBUG_MSM_UART || DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \
1247 DEBUG_UART_BCM63XX 1401 DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART
1248 1402
1249config DEBUG_UART_8250_SHIFT 1403config DEBUG_UART_8250_SHIFT
1250 int "Register offset shift for the 8250 debug UART" 1404 int "Register offset shift for the 8250 debug UART"
1251 depends on DEBUG_LL_UART_8250 || DEBUG_UART_8250 1405 depends on DEBUG_LL_UART_8250 || DEBUG_UART_8250
1252 default 0 if FOOTBRIDGE || ARCH_IOP32X 1406 default 0 if FOOTBRIDGE || ARCH_IOP32X || DEBUG_BCM_5301X
1253 default 2 1407 default 2
1254 1408
1255config DEBUG_UART_8250_WORD 1409config DEBUG_UART_8250_WORD
@@ -1260,7 +1414,8 @@ config DEBUG_UART_8250_WORD
1260 ARCH_KEYSTONE || \ 1414 ARCH_KEYSTONE || \
1261 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \ 1415 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \
1262 DEBUG_DAVINCI_DA8XX_UART2 || \ 1416 DEBUG_DAVINCI_DA8XX_UART2 || \
1263 DEBUG_BCM_KONA_UART || DEBUG_RK32_UART2 1417 DEBUG_BCM_KONA_UART || DEBUG_RK32_UART2 || \
1418 DEBUG_BRCMSTB_UART
1264 1419
1265config DEBUG_UART_8250_FLOW_CONTROL 1420config DEBUG_UART_8250_FLOW_CONTROL
1266 bool "Enable flow control for 8250 UART" 1421 bool "Enable flow control for 8250 UART"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 034a94904d69..c1785eec2cf7 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -312,8 +312,12 @@ $(INSTALL_TARGETS):
312 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ 312 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
313 313
314PHONY += dtbs dtbs_install 314PHONY += dtbs dtbs_install
315dtbs dtbs_install: prepare scripts 315
316 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $@ 316dtbs: prepare scripts
317 $(Q)$(MAKE) $(build)=$(boot)/dts
318
319dtbs_install:
320 $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
317 321
318# We use MRPROPER_FILES and CLEAN_FILES now 322# We use MRPROPER_FILES and CLEAN_FILES now
319archclean: 323archclean:
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 38c89cafa1ab..6a3d9a6c4497 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -54,8 +54,17 @@ dtb-$(CONFIG_ARCH_AT91) += at91-sama5d4ek.dtb
54dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb 54dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
55dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb 55dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
56dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 56dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
57dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb 57dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b-plus.dtb
58dtb-$(CONFIG_ARCH_BCM_5301X) += \
59 bcm4708-buffalo-wzr-1750dhp.dtb \
60 bcm4708-netgear-r6250.dtb \
61 bcm4708-netgear-r6300-v2.dtb \
62 bcm47081-asus-rt-n18u.dtb \
63 bcm47081-buffalo-wzr-600dhp2.dtb
58dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb 64dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
65dtb-$(CONFIG_ARCH_BCM_CYGNUS) += bcm911360_entphn.dtb \
66 bcm911360k.dtb \
67 bcm958300k.dtb
59dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \ 68dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \
60 bcm21664-garnet.dtb 69 bcm21664-garnet.dtb
61dtb-$(CONFIG_ARCH_BERLIN) += \ 70dtb-$(CONFIG_ARCH_BERLIN) += \
@@ -67,7 +76,9 @@ dtb-$(CONFIG_ARCH_BRCMSTB) += \
67dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ 76dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
68 da850-evm.dtb 77 da850-evm.dtb
69dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb 78dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb
70dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ 79dtb-$(CONFIG_ARCH_EXYNOS) += exynos3250-monk.dtb \
80 exynos3250-rinato.dtb \
81 exynos4210-origen.dtb \
71 exynos4210-smdkv310.dtb \ 82 exynos4210-smdkv310.dtb \
72 exynos4210-trats.dtb \ 83 exynos4210-trats.dtb \
73 exynos4210-universal_c210.dtb \ 84 exynos4210-universal_c210.dtb \
@@ -81,6 +92,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
81 exynos5250-arndale.dtb \ 92 exynos5250-arndale.dtb \
82 exynos5250-smdk5250.dtb \ 93 exynos5250-smdk5250.dtb \
83 exynos5250-snow.dtb \ 94 exynos5250-snow.dtb \
95 exynos5250-spring.dtb \
84 exynos5260-xyref5260.dtb \ 96 exynos5260-xyref5260.dtb \
85 exynos5410-smdk5410.dtb \ 97 exynos5410-smdk5410.dtb \
86 exynos5420-arndale-octa.dtb \ 98 exynos5420-arndale-octa.dtb \
@@ -104,6 +116,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += kirkwood-b3.dtb \
104 kirkwood-d2net.dtb \ 116 kirkwood-d2net.dtb \
105 kirkwood-db-88f6281.dtb \ 117 kirkwood-db-88f6281.dtb \
106 kirkwood-db-88f6282.dtb \ 118 kirkwood-db-88f6282.dtb \
119 kirkwood-dir665.dtb \
107 kirkwood-dns320.dtb \ 120 kirkwood-dns320.dtb \
108 kirkwood-dns325.dtb \ 121 kirkwood-dns325.dtb \
109 kirkwood-dockstar.dtb \ 122 kirkwood-dockstar.dtb \
@@ -240,6 +253,7 @@ dtb-$(CONFIG_ARCH_MXC) += \
240 imx6q-sabrelite.dtb \ 253 imx6q-sabrelite.dtb \
241 imx6q-sabresd.dtb \ 254 imx6q-sabresd.dtb \
242 imx6q-sbc6x.dtb \ 255 imx6q-sbc6x.dtb \
256 imx6q-tbs2910.dtb \
243 imx6q-udoo.dtb \ 257 imx6q-udoo.dtb \
244 imx6q-wandboard.dtb \ 258 imx6q-wandboard.dtb \
245 imx6q-wandboard-revb1.dtb \ 259 imx6q-wandboard-revb1.dtb \
@@ -250,6 +264,9 @@ dtb-$(CONFIG_ARCH_MXC) += \
250 imx6q-tx6q-1110.dtb \ 264 imx6q-tx6q-1110.dtb \
251 imx6sl-evk.dtb \ 265 imx6sl-evk.dtb \
252 imx6sx-sdb.dtb \ 266 imx6sx-sdb.dtb \
267 ls1021a-qds.dtb \
268 ls1021a-twr.dtb \
269 vf500-colibri-eval-v3.dtb \
253 vf610-colibri-eval-v3.dtb \ 270 vf610-colibri-eval-v3.dtb \
254 vf610-cosmic.dtb \ 271 vf610-cosmic.dtb \
255 vf610-twr.dtb 272 vf610-twr.dtb
@@ -274,7 +291,8 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
274 imx28-m28evk.dtb \ 291 imx28-m28evk.dtb \
275 imx28-sps1.dtb \ 292 imx28-sps1.dtb \
276 imx28-tx28.dtb 293 imx28-tx28.dtb
277dtb-$(CONFIG_ARCH_NOMADIK) += ste-nomadik-s8815.dtb 294dtb-$(CONFIG_ARCH_NOMADIK) += ste-nomadik-s8815.dtb \
295 ste-nomadik-nhk15.dtb
278dtb-$(CONFIG_ARCH_NSPIRE) += nspire-cx.dtb \ 296dtb-$(CONFIG_ARCH_NSPIRE) += nspire-cx.dtb \
279 nspire-tp.dtb \ 297 nspire-tp.dtb \
280 nspire-clp.dtb 298 nspire-clp.dtb
@@ -302,7 +320,9 @@ dtb-$(CONFIG_ARCH_OMAP3) += am3517-craneboard.dtb \
302 omap3-ha.dtb \ 320 omap3-ha.dtb \
303 omap3-ha-lcd.dtb \ 321 omap3-ha-lcd.dtb \
304 omap3-igep0020.dtb \ 322 omap3-igep0020.dtb \
323 omap3-igep0020-rev-f.dtb \
305 omap3-igep0030.dtb \ 324 omap3-igep0030.dtb \
325 omap3-igep0030-rev-g.dtb \
306 omap3-ldp.dtb \ 326 omap3-ldp.dtb \
307 omap3-lilly-dbb056.dtb \ 327 omap3-lilly-dbb056.dtb \
308 omap3-n900.dtb \ 328 omap3-n900.dtb \
@@ -331,7 +351,8 @@ dtb-$(CONFIG_SOC_AM33XX) += am335x-base0033.dtb \
331 am335x-evm.dtb \ 351 am335x-evm.dtb \
332 am335x-evmsk.dtb \ 352 am335x-evmsk.dtb \
333 am335x-nano.dtb \ 353 am335x-nano.dtb \
334 am335x-pepper.dtb 354 am335x-pepper.dtb \
355 am335x-lxm.dtb
335dtb-$(CONFIG_ARCH_OMAP4) += omap4-duovero-parlor.dtb \ 356dtb-$(CONFIG_ARCH_OMAP4) += omap4-duovero-parlor.dtb \
336 omap4-panda.dtb \ 357 omap4-panda.dtb \
337 omap4-panda-a4.dtb \ 358 omap4-panda-a4.dtb \
@@ -347,6 +368,7 @@ dtb-$(CONFIG_SOC_OMAP5) += omap5-cm-t54.dtb \
347 omap5-sbc-t54.dtb \ 368 omap5-sbc-t54.dtb \
348 omap5-uevm.dtb 369 omap5-uevm.dtb
349dtb-$(CONFIG_SOC_DRA7XX) += dra7-evm.dtb \ 370dtb-$(CONFIG_SOC_DRA7XX) += dra7-evm.dtb \
371 am57xx-beagle-x15.dtb \
350 dra72-evm.dtb 372 dra72-evm.dtb
351dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-d2-network.dtb \ 373dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-d2-network.dtb \
352 orion5x-lacie-ethernet-disk-mini-v2.dtb \ 374 orion5x-lacie-ethernet-disk-mini-v2.dtb \
@@ -363,8 +385,10 @@ dtb-$(CONFIG_ARCH_QCOM) += \
363 qcom-msm8660-surf.dtb \ 385 qcom-msm8660-surf.dtb \
364 qcom-msm8960-cdp.dtb \ 386 qcom-msm8960-cdp.dtb \
365 qcom-msm8974-sony-xperia-honami.dtb 387 qcom-msm8974-sony-xperia-honami.dtb
388dtb-$(CONFIG_ARCH_REALVIEW) += arm-realview-pb1176.dtb
366dtb-$(CONFIG_ARCH_ROCKCHIP) += \ 389dtb-$(CONFIG_ARCH_ROCKCHIP) += \
367 rk3066a-bqcurie2.dtb \ 390 rk3066a-bqcurie2.dtb \
391 rk3066a-marsboard.dtb \
368 rk3188-radxarock.dtb \ 392 rk3188-radxarock.dtb \
369 rk3288-evb-act8846.dtb \ 393 rk3288-evb-act8846.dtb \
370 rk3288-evb-rk808.dtb 394 rk3288-evb-rk808.dtb
@@ -376,27 +400,27 @@ dtb-$(CONFIG_ARCH_S5PV210) += s5pv210-aquila.dtb \
376 s5pv210-smdkc110.dtb \ 400 s5pv210-smdkc110.dtb \
377 s5pv210-smdkv210.dtb \ 401 s5pv210-smdkv210.dtb \
378 s5pv210-torbreck.dtb 402 s5pv210-torbreck.dtb
379dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += r7s72100-genmai.dtb \ 403dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += \
404 r8a73a4-ape6evm.dtb \
405 r8a73a4-ape6evm-reference.dtb \
380 r8a7740-armadillo800eva.dtb \ 406 r8a7740-armadillo800eva.dtb \
381 r8a7778-bockw.dtb \ 407 r8a7778-bockw.dtb \
382 r8a7778-bockw-reference.dtb \ 408 r8a7778-bockw-reference.dtb \
383 r8a7779-marzen.dtb \ 409 r8a7779-marzen.dtb \
384 r8a7791-koelsch.dtb \
385 r8a7790-lager.dtb \ 410 r8a7790-lager.dtb \
411 sh7372-mackerel.dtb \
386 sh73a0-kzm9g.dtb \ 412 sh73a0-kzm9g.dtb \
387 sh73a0-kzm9g-reference.dtb \ 413 sh73a0-kzm9g-reference.dtb
388 r8a73a4-ape6evm.dtb \
389 r8a73a4-ape6evm-reference.dtb \
390 sh7372-mackerel.dtb
391dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \ 414dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
392 r7s72100-genmai.dtb \ 415 r7s72100-genmai.dtb \
393 r8a7740-armadillo800eva.dtb \ 416 r8a7740-armadillo800eva.dtb \
417 r8a7779-marzen.dtb \
418 r8a7790-lager.dtb \
394 r8a7791-henninger.dtb \ 419 r8a7791-henninger.dtb \
395 r8a7791-koelsch.dtb \ 420 r8a7791-koelsch.dtb \
396 r8a7790-lager.dtb \
397 r8a7779-marzen.dtb \
398 r8a7794-alt.dtb 421 r8a7794-alt.dtb
399dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \ 422dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
423 socfpga_arria10_socdk.dtb \
400 socfpga_cyclone5_socdk.dtb \ 424 socfpga_cyclone5_socdk.dtb \
401 socfpga_cyclone5_sockit.dtb \ 425 socfpga_cyclone5_sockit.dtb \
402 socfpga_cyclone5_socrates.dtb \ 426 socfpga_cyclone5_socrates.dtb \
@@ -409,6 +433,7 @@ dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \
409 spear320-hmi.dtb 433 spear320-hmi.dtb
410dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb 434dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb
411dtb-$(CONFIG_ARCH_STI)+= stih407-b2120.dtb \ 435dtb-$(CONFIG_ARCH_STI)+= stih407-b2120.dtb \
436 stih410-b2120.dtb \
412 stih415-b2000.dtb \ 437 stih415-b2000.dtb \
413 stih415-b2020.dtb \ 438 stih415-b2020.dtb \
414 stih416-b2000.dtb \ 439 stih416-b2000.dtb \
@@ -435,15 +460,20 @@ dtb-$(CONFIG_MACH_SUN6I) += \
435 sun6i-a31-hummingbird.dtb \ 460 sun6i-a31-hummingbird.dtb \
436 sun6i-a31-m9.dtb 461 sun6i-a31-m9.dtb
437dtb-$(CONFIG_MACH_SUN7I) += \ 462dtb-$(CONFIG_MACH_SUN7I) += \
463 sun7i-a20-bananapi.dtb \
438 sun7i-a20-cubieboard2.dtb \ 464 sun7i-a20-cubieboard2.dtb \
439 sun7i-a20-cubietruck.dtb \ 465 sun7i-a20-cubietruck.dtb \
440 sun7i-a20-hummingbird.dtb \ 466 sun7i-a20-hummingbird.dtb \
441 sun7i-a20-i12-tvbox.dtb \ 467 sun7i-a20-i12-tvbox.dtb \
468 sun7i-a20-m3.dtb \
442 sun7i-a20-olinuxino-lime.dtb \ 469 sun7i-a20-olinuxino-lime.dtb \
470 sun7i-a20-olinuxino-lime2.dtb \
443 sun7i-a20-olinuxino-micro.dtb \ 471 sun7i-a20-olinuxino-micro.dtb \
444 sun7i-a20-pcduino3.dtb 472 sun7i-a20-pcduino3.dtb
445dtb-$(CONFIG_MACH_SUN8I) += \ 473dtb-$(CONFIG_MACH_SUN8I) += \
446 sun8i-a23-ippo-q8h-v5.dtb 474 sun8i-a23-ippo-q8h-v5.dtb
475dtb-$(CONFIG_MACH_SUN9I) += \
476 sun9i-a80-optimus.dtb
447dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ 477dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
448 tegra20-iris-512.dtb \ 478 tegra20-iris-512.dtb \
449 tegra20-medcom-wide.dtb \ 479 tegra20-medcom-wide.dtb \
@@ -489,13 +519,15 @@ dtb-$(CONFIG_ARCH_ZYNQ) += \
489 zynq-parallella.dtb \ 519 zynq-parallella.dtb \
490 zynq-zc702.dtb \ 520 zynq-zc702.dtb \
491 zynq-zc706.dtb \ 521 zynq-zc706.dtb \
492 zynq-zed.dtb 522 zynq-zed.dtb \
523 zynq-zybo.dtb
493dtb-$(CONFIG_MACH_ARMADA_370) += \ 524dtb-$(CONFIG_MACH_ARMADA_370) += \
494 armada-370-db.dtb \ 525 armada-370-db.dtb \
495 armada-370-mirabox.dtb \ 526 armada-370-mirabox.dtb \
496 armada-370-netgear-rn102.dtb \ 527 armada-370-netgear-rn102.dtb \
497 armada-370-netgear-rn104.dtb \ 528 armada-370-netgear-rn104.dtb \
498 armada-370-rd.dtb 529 armada-370-rd.dtb \
530 armada-370-synology-ds213j.dtb
499dtb-$(CONFIG_MACH_ARMADA_375) += \ 531dtb-$(CONFIG_MACH_ARMADA_375) += \
500 armada-375-db.dtb 532 armada-375-db.dtb
501dtb-$(CONFIG_MACH_ARMADA_38X) += \ 533dtb-$(CONFIG_MACH_ARMADA_38X) += \
@@ -508,24 +540,20 @@ dtb-$(CONFIG_MACH_ARMADA_XP) += \
508 armada-xp-lenovo-ix4-300d.dtb \ 540 armada-xp-lenovo-ix4-300d.dtb \
509 armada-xp-matrix.dtb \ 541 armada-xp-matrix.dtb \
510 armada-xp-netgear-rn2120.dtb \ 542 armada-xp-netgear-rn2120.dtb \
511 armada-xp-openblocks-ax3-4.dtb 543 armada-xp-openblocks-ax3-4.dtb \
544 armada-xp-synology-ds414.dtb
512dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \ 545dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \
513 dove-cubox.dtb \ 546 dove-cubox.dtb \
514 dove-cubox-es.dtb \ 547 dove-cubox-es.dtb \
515 dove-d2plug.dtb \ 548 dove-d2plug.dtb \
516 dove-d3plug.dtb \ 549 dove-d3plug.dtb \
517 dove-dove-db.dtb 550 dove-dove-db.dtb
518dtb-$(CONFIG_ARCH_MEDIATEK) += mt6589-aquaris5.dtb 551dtb-$(CONFIG_ARCH_MEDIATEK) += mt6589-aquaris5.dtb \
552 mt6592-evb.dtb \
553 mt8127-moose.dtb \
554 mt8135-evbp1.dtb
519 555
520targets += dtbs dtbs_install
521targets += $(dtb-y)
522endif 556endif
523 557
524# *.dtb used to be generated in the directory above. Clean out the 558always := $(dtb-y)
525# old build results so people don't accidentally use them. 559clean-files := *.dtb
526dtbs: $(addprefix $(obj)/, $(dtb-y))
527 $(Q)rm -f $(obj)/../*.dtb
528
529clean-files := *.dtb
530
531dtbs_install: $(addsuffix _dtbinst_, $(dtb-y))
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
index 901739fcb85a..5c42d259fa68 100644
--- a/arch/arm/boot/dts/am335x-boneblack.dts
+++ b/arch/arm/boot/dts/am335x-boneblack.dts
@@ -80,3 +80,7 @@
80 status = "okay"; 80 status = "okay";
81 }; 81 };
82}; 82};
83
84&rtc {
85 system-power-controller;
86};
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index c4b968f0feb5..54f118c08db8 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -307,6 +307,13 @@
307 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ 307 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
308 >; 308 >;
309 }; 309 };
310
311 dcan1_pins_default: dcan1_pins_default {
312 pinctrl-single,pins = <
313 0x168 (PIN_OUTPUT | MUX_MODE2) /* uart0_ctsn.d_can1_tx */
314 0x16c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* uart0_rtsn.d_can1_rx */
315 >;
316 };
310}; 317};
311 318
312&uart0 { 319&uart0 {
@@ -437,9 +444,9 @@
437 status = "okay"; 444 status = "okay";
438 pinctrl-names = "default"; 445 pinctrl-names = "default";
439 pinctrl-0 = <&nandflash_pins_s0>; 446 pinctrl-0 = <&nandflash_pins_s0>;
440 ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */ 447 ranges = <0 0 0x08000000 0x1000000>; /* CS0: 16MB for NAND */
441 nand@0,0 { 448 nand@0,0 {
442 reg = <0 0 0>; /* CS0, offset 0 */ 449 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
443 ti,nand-ecc-opt = "bch8"; 450 ti,nand-ecc-opt = "bch8";
444 ti,elm-id = <&elm>; 451 ti,elm-id = <&elm>;
445 nand-bus-width = <8>; 452 nand-bus-width = <8>;
@@ -664,3 +671,9 @@
664&aes { 671&aes {
665 status = "okay"; 672 status = "okay";
666}; 673};
674
675&dcan1 {
676 status = "disabled"; /* Enable only if Profile 1 is selected */
677 pinctrl-names = "default";
678 pinctrl-0 = <&dcan1_pins_default>;
679};
diff --git a/arch/arm/boot/dts/am335x-igep0033.dtsi b/arch/arm/boot/dts/am335x-igep0033.dtsi
index a1a0cc5eb35c..c0e1135256cc 100644
--- a/arch/arm/boot/dts/am335x-igep0033.dtsi
+++ b/arch/arm/boot/dts/am335x-igep0033.dtsi
@@ -126,10 +126,10 @@
126 pinctrl-names = "default"; 126 pinctrl-names = "default";
127 pinctrl-0 = <&nandflash_pins>; 127 pinctrl-0 = <&nandflash_pins>;
128 128
129 ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */ 129 ranges = <0 0 0x08000000 0x1000000>; /* CS0: 16MB for NAND */
130 130
131 nand@0,0 { 131 nand@0,0 {
132 reg = <0 0 0>; /* CS0, offset 0 */ 132 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
133 nand-bus-width = <8>; 133 nand-bus-width = <8>;
134 ti,nand-ecc-opt = "bch8"; 134 ti,nand-ecc-opt = "bch8";
135 gpmc,device-width = <1>; 135 gpmc,device-width = <1>;
diff --git a/arch/arm/boot/dts/am335x-lxm.dts b/arch/arm/boot/dts/am335x-lxm.dts
new file mode 100644
index 000000000000..7266a00aab2e
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-lxm.dts
@@ -0,0 +1,362 @@
1/*
2 * Copyright (C) 2014 NovaTech LLC - http://www.novatechweb.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/dts-v1/;
9
10#include "am33xx.dtsi"
11
12/ {
13 model = "NovaTech OrionLXm";
14 compatible = "novatech,am335x-lxm", "ti,am33xx";
15
16 cpus {
17 cpu@0 {
18 cpu0-supply = <&vdd1_reg>;
19 };
20 };
21
22 memory {
23 device_type = "memory";
24 reg = <0x80000000 0x20000000>; /* 512 MB */
25 };
26
27 /* Power supply provides a fixed 5V @2A */
28 vbat: fixedregulator@0 {
29 compatible = "regulator-fixed";
30 regulator-name = "vbat";
31 regulator-min-microvolt = <5000000>;
32 regulator-max-microvolt = <5000000>;
33 regulator-boot-on;
34 };
35
36 /* Power supply provides a fixed 3.3V @3A */
37 vmmcsd_fixed: fixedregulator@1 {
38 compatible = "regulator-fixed";
39 regulator-name = "vmmcsd_fixed";
40 regulator-min-microvolt = <3300000>;
41 regulator-max-microvolt = <3300000>;
42 regulator-boot-on;
43 };
44};
45
46&am33xx_pinmux {
47 mmc1_pins: pinmux_mmc1_pins {
48 pinctrl-single,pins = <
49 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3 */
50 0xf4 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2 */
51 0xf8 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1 */
52 0xfc (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0 */
53 0x100 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk */
54 0x104 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd */
55 >;
56 };
57
58 i2c0_pins: pinmux_i2c0_pins {
59 pinctrl-single,pins = <
60 0x188 (PIN_INPUT | MUX_MODE0) /* i2c0_sda.i2c0_sda */
61 0x18c (PIN_INPUT | MUX_MODE0) /* i2c0_scl.i2c0_scl */
62 >;
63 };
64
65 cpsw_default: cpsw_default {
66 pinctrl-single,pins = <
67 /* Slave 1 */
68 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_int */
69 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE1) /* rmii1_crs_dv */
70 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* rmii1_rxer */
71 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* rmii1_txen */
72 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* rmii1_td1 */
73 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* rmii1_td0 */
74 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE1) /* rmii1_rd1 */
75 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* rmii1_rd0 */
76 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii1_refclk */
77
78 /* Slave 2 */
79 0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* rmii2_txen */
80 0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* rmii2_td1 */
81 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* rmii2_td0 */
82 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* rmii2_rd1 */
83 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE3) /* rmii2_rd0 */
84 0x70 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* rmii2_crs_dv */
85 0x74 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* rmii2_rxer */
86 0x78 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_int */
87 0x108 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* rmii2_refclk */
88 >;
89 };
90
91 cpsw_sleep: cpsw_sleep {
92 pinctrl-single,pins = <
93 /* Slave 1 reset value */
94 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_int */
95 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_crs_dv */
96 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_rxer */
97 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_txen */
98 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_td1 */
99 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_td0 */
100 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_rd1 */
101 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_rd0 */
102 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii1_refclk */
103
104 /* Slave 2 reset value*/
105 0x40 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_txen */
106 0x50 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_td1 */
107 0x54 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_td0 */
108 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_rd1 */
109 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_rd0 */
110 0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_crs_dv */
111 0x74 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_rxer */
112 0x78 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_int */
113 0x108 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* rmii2_refclk */
114 >;
115 };
116
117 davinci_mdio_default: davinci_mdio_default {
118 pinctrl-single,pins = <
119 /* MDIO */
120 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
121 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
122 >;
123 };
124
125 davinci_mdio_sleep: davinci_mdio_sleep {
126 pinctrl-single,pins = <
127 /* MDIO reset value */
128 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
129 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
130 >;
131 };
132
133 emmc_pins: pinmux_emmc_pins {
134 pinctrl-single,pins = <
135 0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
136 0x84 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
137 0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
138 0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
139 0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
140 0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
141 0x10 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
142 0x14 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
143 0x18 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
144 0x1c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
145 >;
146 };
147
148 uart0_pins: pinmux_uart0_pins {
149 pinctrl-single,pins = <
150 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
151 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
152 >;
153 };
154};
155
156&i2c0 {
157 pinctrl-names = "default";
158 pinctrl-0 = <&i2c0_pins>;
159
160 status = "okay";
161 clock-frequency = <400000>;
162
163 serial_config1: serial_config1@20 {
164 compatible = "nxp,pca9539";
165 reg = <0x20>;
166 };
167
168 serial_config2: serial_config2@21 {
169 compatible = "nxp,pca9539";
170 reg = <0x21>;
171 };
172
173 tps: tps@2d {
174 compatible = "ti,tps65910";
175 reg = <0x2d>;
176 };
177};
178
179/include/ "tps65910.dtsi"
180
181&tps {
182 vcc1-supply = <&vbat>;
183 vcc2-supply = <&vbat>;
184 vcc3-supply = <&vbat>;
185 vcc4-supply = <&vbat>;
186 vcc5-supply = <&vbat>;
187 vcc6-supply = <&vbat>;
188 vcc7-supply = <&vbat>;
189 vccio-supply = <&vbat>;
190
191 regulators {
192 /* vrtc - unused */
193
194 vio_reg: regulator@1 {
195 regulator-name = "vio_1v5,ddr";
196 regulator-min-microvolt = <1500000>;
197 regulator-max-microvolt = <1500000>;
198 regulator-boot-on;
199 regulator-always-on;
200 };
201
202 vdd1_reg: regulator@2 {
203 regulator-name = "vdd1,mpu";
204 regulator-min-microvolt = <600000>;
205 regulator-max-microvolt = <1500000>;
206 regulator-boot-on;
207 regulator-always-on;
208 };
209
210 vdd2_reg: regulator@3 {
211 regulator-name = "vdd2_1v1,core";
212 regulator-min-microvolt = <1100000>;
213 regulator-max-microvolt = <1100000>;
214 regulator-boot-on;
215 regulator-always-on;
216 };
217
218 /* vdd3 - unused */
219
220 /* vdig1 - unused */
221
222 vdig2_reg: regulator@6 {
223 regulator-name = "vdig2_1v8,vdds_pll";
224 regulator-min-microvolt = <1800000>;
225 regulator-max-microvolt = <1800000>;
226 regulator-boot-on;
227 regulator-always-on;
228 };
229
230 /* vpll - unused */
231
232 vdac_reg: regulator@8 {
233 regulator-name = "vdac_1v8,vdds";
234 regulator-min-microvolt = <1800000>;
235 regulator-max-microvolt = <1800000>;
236 regulator-boot-on;
237 regulator-always-on;
238 };
239
240 vaux1_reg: regulator@9 {
241 regulator-name = "vaux1_1v8,usb";
242 regulator-min-microvolt = <1800000>;
243 regulator-max-microvolt = <1800000>;
244 regulator-boot-on;
245 regulator-always-on;
246 };
247
248 vaux2_reg: regulator@10 {
249 regulator-name = "vaux2_3v3,io";
250 regulator-min-microvolt = <3300000>;
251 regulator-max-microvolt = <3300000>;
252 regulator-boot-on;
253 regulator-always-on;
254 };
255
256 vaux33_reg: regulator@11 {
257 regulator-name = "vaux33_3v3,usb";
258 regulator-min-microvolt = <3300000>;
259 regulator-max-microvolt = <3300000>;
260 regulator-boot-on;
261 regulator-always-on;
262 };
263
264 vmmc_reg: regulator@12 {
265 regulator-name = "vmmc_3v3,io";
266 regulator-min-microvolt = <3300000>;
267 regulator-max-microvolt = <3300000>;
268 regulator-boot-on;
269 regulator-always-on;
270 };
271 };
272};
273
274&sham {
275 status = "okay";
276};
277
278&aes {
279 status = "okay";
280};
281
282&uart0 {
283 pinctrl-names = "default";
284 pinctrl-0 = <&uart0_pins>;
285
286 status = "okay";
287};
288
289&usb {
290 status = "okay";
291};
292
293&usb_ctrl_mod {
294 status = "okay";
295};
296
297&usb0_phy {
298 status = "okay";
299};
300
301&usb1_phy {
302 status = "okay";
303};
304
305&usb0 {
306 status = "okay";
307 dr_mode = "host";
308};
309
310&usb1 {
311 status = "okay";
312 dr_mode = "host";
313};
314
315&cppi41dma {
316 status = "okay";
317};
318
319&cpsw_emac0 {
320 phy_id = <&davinci_mdio>, <5>;
321 phy-mode = "rmii";
322 dual_emac_res_vlan = <2>;
323};
324
325&cpsw_emac1 {
326 phy_id = <&davinci_mdio>, <4>;
327 phy-mode = "rmii";
328 dual_emac_res_vlan = <3>;
329};
330
331&mac {
332 pinctrl-names = "default", "sleep";
333 pinctrl-0 = <&cpsw_default>;
334 pinctrl-1 = <&cpsw_sleep>;
335 dual_emac = <1>;
336 status = "okay";
337};
338
339&davinci_mdio {
340 pinctrl-names = "default", "sleep";
341 pinctrl-0 = <&davinci_mdio_default>;
342 pinctrl-1 = <&davinci_mdio_sleep>;
343 status = "okay";
344};
345
346&mmc1 {
347 pinctrl-names = "default";
348 pinctrl-0 = <&mmc1_pins>;
349 vmmc-supply = <&vmmcsd_fixed>;
350 bus-width = <4>;
351 status = "okay";
352};
353
354&mmc2 {
355 pinctrl-names = "default";
356 pinctrl-0 = <&emmc_pins>;
357 vmmc-supply = <&vmmcsd_fixed>;
358 bus-width = <8>;
359 ti,non-removable;
360 status = "okay";
361};
362
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 831810583823..acd37057bca9 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -83,6 +83,11 @@
83 }; 83 };
84 }; 84 };
85 85
86 am33xx_control_module: control_module@4a002000 {
87 compatible = "syscon";
88 reg = <0x44e10000 0x7fc>;
89 };
90
86 am33xx_pinmux: pinmux@44e10800 { 91 am33xx_pinmux: pinmux@44e10800 {
87 compatible = "pinctrl-single"; 92 compatible = "pinctrl-single";
88 reg = <0x44e10800 0x0238>; 93 reg = <0x44e10800 0x0238>;
@@ -204,6 +209,8 @@
204 reg = <0x44e09000 0x2000>; 209 reg = <0x44e09000 0x2000>;
205 interrupts = <72>; 210 interrupts = <72>;
206 status = "disabled"; 211 status = "disabled";
212 dmas = <&edma 26>, <&edma 27>;
213 dma-names = "tx", "rx";
207 }; 214 };
208 215
209 uart1: serial@48022000 { 216 uart1: serial@48022000 {
@@ -213,6 +220,8 @@
213 reg = <0x48022000 0x2000>; 220 reg = <0x48022000 0x2000>;
214 interrupts = <73>; 221 interrupts = <73>;
215 status = "disabled"; 222 status = "disabled";
223 dmas = <&edma 28>, <&edma 29>;
224 dma-names = "tx", "rx";
216 }; 225 };
217 226
218 uart2: serial@48024000 { 227 uart2: serial@48024000 {
@@ -222,6 +231,8 @@
222 reg = <0x48024000 0x2000>; 231 reg = <0x48024000 0x2000>;
223 interrupts = <74>; 232 interrupts = <74>;
224 status = "disabled"; 233 status = "disabled";
234 dmas = <&edma 30>, <&edma 31>;
235 dma-names = "tx", "rx";
225 }; 236 };
226 237
227 uart3: serial@481a6000 { 238 uart3: serial@481a6000 {
@@ -333,20 +344,24 @@
333 interrupts = <91>; 344 interrupts = <91>;
334 }; 345 };
335 346
336 dcan0: d_can@481cc000 { 347 dcan0: can@481cc000 {
337 compatible = "bosch,d_can"; 348 compatible = "ti,am3352-d_can";
338 ti,hwmods = "d_can0"; 349 ti,hwmods = "d_can0";
339 reg = <0x481cc000 0x2000 350 reg = <0x481cc000 0x2000>;
340 0x44e10644 0x4>; 351 clocks = <&dcan0_fck>;
352 clock-names = "fck";
353 syscon-raminit = <&am33xx_control_module 0x644 0>;
341 interrupts = <52>; 354 interrupts = <52>;
342 status = "disabled"; 355 status = "disabled";
343 }; 356 };
344 357
345 dcan1: d_can@481d0000 { 358 dcan1: can@481d0000 {
346 compatible = "bosch,d_can"; 359 compatible = "ti,am3352-d_can";
347 ti,hwmods = "d_can1"; 360 ti,hwmods = "d_can1";
348 reg = <0x481d0000 0x2000 361 reg = <0x481d0000 0x2000>;
349 0x44e10644 0x4>; 362 clocks = <&dcan1_fck>;
363 clock-names = "fck";
364 syscon-raminit = <&am33xx_control_module 0x644 1>;
350 interrupts = <55>; 365 interrupts = <55>;
351 status = "disabled"; 366 status = "disabled";
352 }; 367 };
@@ -356,6 +371,7 @@
356 reg = <0x480C8000 0x200>; 371 reg = <0x480C8000 0x200>;
357 interrupts = <77>; 372 interrupts = <77>;
358 ti,hwmods = "mailbox"; 373 ti,hwmods = "mailbox";
374 #mbox-cells = <1>;
359 ti,mbox-num-users = <4>; 375 ti,mbox-num-users = <4>;
360 ti,mbox-num-fifos = <8>; 376 ti,mbox-num-fifos = <8>;
361 mbox_wkupm3: wkup_m3 { 377 mbox_wkupm3: wkup_m3 {
@@ -419,7 +435,7 @@
419 }; 435 };
420 436
421 rtc: rtc@44e3e000 { 437 rtc: rtc@44e3e000 {
422 compatible = "ti,da830-rtc"; 438 compatible = "ti,am3352-rtc", "ti,da830-rtc";
423 reg = <0x44e3e000 0x1000>; 439 reg = <0x44e3e000 0x1000>;
424 interrupts = <75 440 interrupts = <75
425 76>; 441 76>;
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 46660ffd2b65..d42d7865dd53 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -57,6 +57,11 @@
57 cache-level = <2>; 57 cache-level = <2>;
58 }; 58 };
59 59
60 am43xx_control_module: control_module@4a002000 {
61 compatible = "syscon";
62 reg = <0x44e10000 0x7f4>;
63 };
64
60 am43xx_pinmux: pinmux@44e10800 { 65 am43xx_pinmux: pinmux@44e10800 {
61 compatible = "ti,am437-padconf", "pinctrl-single"; 66 compatible = "ti,am437-padconf", "pinctrl-single";
62 reg = <0x44e10800 0x31c>; 67 reg = <0x44e10800 0x31c>;
@@ -168,6 +173,7 @@
168 reg = <0x480C8000 0x200>; 173 reg = <0x480C8000 0x200>;
169 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>; 174 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
170 ti,hwmods = "mailbox"; 175 ti,hwmods = "mailbox";
176 #mbox-cells = <1>;
171 ti,mbox-num-users = <4>; 177 ti,mbox-num-users = <4>;
172 ti,mbox-num-fifos = <8>; 178 ti,mbox-num-fifos = <8>;
173 mbox_wkupm3: wkup_m3 { 179 mbox_wkupm3: wkup_m3 {
@@ -667,6 +673,26 @@
667 }; 673 };
668 }; 674 };
669 675
676 tscadc: tscadc@44e0d000 {
677 compatible = "ti,am3359-tscadc";
678 reg = <0x44e0d000 0x1000>;
679 ti,hwmods = "adc_tsc";
680 interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
681 clocks = <&adc_tsc_fck>;
682 clock-names = "fck";
683 status = "disabled";
684
685 tsc {
686 compatible = "ti,am3359-tsc";
687 };
688
689 adc {
690 #io-channel-cells = <1>;
691 compatible = "ti,am3359-adc";
692 };
693
694 };
695
670 sham: sham@53100000 { 696 sham: sham@53100000 {
671 compatible = "ti,omap5-sham"; 697 compatible = "ti,omap5-sham";
672 ti,hwmods = "sham"; 698 ti,hwmods = "sham";
@@ -896,6 +922,28 @@
896 compatible = "mmio-sram"; 922 compatible = "mmio-sram";
897 reg = <0x40300000 0x40000>; /* 256k */ 923 reg = <0x40300000 0x40000>; /* 256k */
898 }; 924 };
925
926 dcan0: can@481cc000 {
927 compatible = "ti,am4372-d_can", "ti,am3352-d_can";
928 ti,hwmods = "d_can0";
929 clocks = <&dcan0_fck>;
930 clock-names = "fck";
931 reg = <0x481cc000 0x2000>;
932 syscon-raminit = <&am43xx_control_module 0x644 0>;
933 interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
934 status = "disabled";
935 };
936
937 dcan1: can@481d0000 {
938 compatible = "ti,am4372-d_can", "ti,am3352-d_can";
939 ti,hwmods = "d_can1";
940 clocks = <&dcan1_fck>;
941 clock-names = "fck";
942 reg = <0x481d0000 0x2000>;
943 syscon-raminit = <&am43xx_control_module 0x644 1>;
944 interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
945 status = "disabled";
946 };
899 }; 947 };
900}; 948};
901 949
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
index a521ac0a7d5a..7eaae4cf9f89 100644
--- a/arch/arm/boot/dts/am437x-gp-evm.dts
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -254,6 +254,20 @@
254 0x238 (PIN_OUTPUT_PULLUP | MUX_MODE7) 254 0x238 (PIN_OUTPUT_PULLUP | MUX_MODE7)
255 >; 255 >;
256 }; 256 };
257
258 dcan0_default: dcan0_default_pins {
259 pinctrl-single,pins = <
260 0x178 (PIN_OUTPUT | MUX_MODE2) /* uart1_ctsn.d_can0_tx */
261 0x17c (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_rtsn.d_can0_rx */
262 >;
263 };
264
265 dcan1_default: dcan1_default_pins {
266 pinctrl-single,pins = <
267 0x180 (PIN_OUTPUT | MUX_MODE2) /* uart1_rxd.d_can1_tx */
268 0x184 (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_txd.d_can1_rx */
269 >;
270 };
257}; 271};
258 272
259&i2c0 { 273&i2c0 {
@@ -343,6 +357,14 @@
343 status = "okay"; 357 status = "okay";
344}; 358};
345 359
360&tscadc {
361 status = "okay";
362
363 adc {
364 ti,adc-channels = <0 1 2 3 4 5 6 7>;
365 };
366};
367
346&ecap0 { 368&ecap0 {
347 status = "okay"; 369 status = "okay";
348 pinctrl-names = "default"; 370 pinctrl-names = "default";
@@ -511,3 +533,15 @@
511 }; 533 };
512 }; 534 };
513}; 535};
536
537&dcan0 {
538 pinctrl-names = "default";
539 pinctrl-0 = <&dcan0_default>;
540 status = "okay";
541};
542
543&dcan1 {
544 pinctrl-names = "default";
545 pinctrl-0 = <&dcan1_default>;
546 status = "okay";
547};
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
index f7e9bba10bd6..662261d6b2ca 100644
--- a/arch/arm/boot/dts/am43x-epos-evm.dts
+++ b/arch/arm/boot/dts/am43x-epos-evm.dts
@@ -438,9 +438,9 @@
438 status = "okay"; /* Disable QSPI when enabling GPMC (NAND) */ 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 0x1000000>; /* CS0: 16MB for NAND */
442 nand@0,0 { 442 nand@0,0 {
443 reg = <0 0 0>; /* CS0, offset 0 */ 443 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
444 ti,nand-ecc-opt = "bch16"; 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>;
@@ -519,6 +519,14 @@
519 status = "okay"; 519 status = "okay";
520}; 520};
521 521
522&tscadc {
523 status = "okay";
524
525 adc {
526 ti,adc-channels = <0 1 2 3 4 5 6 7>;
527 };
528};
529
522&ecap0 { 530&ecap0 {
523 status = "okay"; 531 status = "okay";
524 pinctrl-names = "default"; 532 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts
new file mode 100644
index 000000000000..49edbda68cd5
--- /dev/null
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -0,0 +1,405 @@
1/*
2 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10#include "dra74x.dtsi"
11#include <dt-bindings/clk/ti-dra7-atl.h>
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/interrupt-controller/irq.h>
14
15/ {
16 model = "TI AM5728 BeagleBoard-X15";
17 compatible = "ti,am572x-beagle-x15", "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7";
18
19 aliases {
20 rtc0 = &mcp_rtc;
21 rtc1 = &tps659038_rtc;
22 };
23
24 memory {
25 device_type = "memory";
26 reg = <0x80000000 0x80000000>;
27 };
28
29 vdd_3v3: fixedregulator-vdd_3v3 {
30 compatible = "regulator-fixed";
31 regulator-name = "vdd_3v3";
32 vin-supply = <&regen1>;
33 regulator-min-microvolt = <3300000>;
34 regulator-max-microvolt = <3300000>;
35 };
36
37 vtt_fixed: fixedregulator-vtt {
38 /* TPS51200 */
39 compatible = "regulator-fixed";
40 regulator-name = "vtt_fixed";
41 vin-supply = <&smps3_reg>;
42 regulator-min-microvolt = <3300000>;
43 regulator-max-microvolt = <3300000>;
44 regulator-always-on;
45 regulator-boot-on;
46 enable-active-high;
47 gpio = <&gpio7 11 GPIO_ACTIVE_HIGH>;
48 };
49
50 leds {
51 compatible = "gpio-leds";
52 pinctrl-names = "default";
53 pinctrl-0 = <&leds_pins_default>;
54
55 led@0 {
56 label = "beagle-x15:usr0";
57 gpios = <&gpio7 9 GPIO_ACTIVE_HIGH>;
58 linux,default-trigger = "heartbeat";
59 default-state = "off";
60 };
61
62 led@1 {
63 label = "beagle-x15:usr1";
64 gpios = <&gpio7 8 GPIO_ACTIVE_HIGH>;
65 linux,default-trigger = "cpu0";
66 default-state = "off";
67 };
68
69 led@2 {
70 label = "beagle-x15:usr2";
71 gpios = <&gpio7 14 GPIO_ACTIVE_HIGH>;
72 linux,default-trigger = "mmc0";
73 default-state = "off";
74 };
75
76 led@3 {
77 label = "beagle-x15:usr3";
78 gpios = <&gpio7 15 GPIO_ACTIVE_HIGH>;
79 linux,default-trigger = "ide-disk";
80 default-state = "off";
81 };
82 };
83};
84
85&dra7_pmx_core {
86 leds_pins_default: leds_pins_default {
87 pinctrl-single,pins = <
88 0x3a8 (PIN_OUTPUT | MUX_MODE14) /* spi1_d1.gpio7_8 */
89 0x3ac (PIN_OUTPUT | MUX_MODE14) /* spi1_d0.gpio7_9 */
90 0x3c0 (PIN_OUTPUT | MUX_MODE14) /* spi2_sclk.gpio7_14 */
91 0x3c4 (PIN_OUTPUT | MUX_MODE14) /* spi2_d1.gpio7_15 */
92 >;
93 };
94
95 i2c1_pins_default: i2c1_pins_default {
96 pinctrl-single,pins = <
97 0x400 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda.sda */
98 0x404 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl.scl */
99 >;
100 };
101
102 i2c3_pins_default: i2c3_pins_default {
103 pinctrl-single,pins = <
104 0x2a4 (PIN_INPUT| MUX_MODE10) /* mcasp1_aclkx.i2c3_sda */
105 0x2a8 (PIN_INPUT| MUX_MODE10) /* mcasp1_fsx.i2c3_scl */
106 >;
107 };
108
109 uart3_pins_default: uart3_pins_default {
110 pinctrl-single,pins = <
111 0x248 (PIN_INPUT_SLEW | MUX_MODE0) /* uart3_rxd.rxd */
112 0x24c (PIN_INPUT_SLEW | MUX_MODE0) /* uart3_txd.txd */
113 >;
114 };
115
116 mmc1_pins_default: mmc1_pins_default {
117 pinctrl-single,pins = <
118 0x36c (PIN_INPUT | MUX_MODE14) /* mmc1sdcd.gpio219 */
119 0x354 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_clk.clk */
120 0x358 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_cmd.cmd */
121 0x35c (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_dat0.dat0 */
122 0x360 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_dat1.dat1 */
123 0x364 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_dat2.dat2 */
124 0x368 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_dat3.dat3 */
125 >;
126 };
127
128 mmc2_pins_default: mmc2_pins_default {
129 pinctrl-single,pins = <
130 0x9c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a23.mmc2_clk */
131 0xb0 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_cs1.mmc2_cmd */
132 0xa0 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a24.mmc2_dat0 */
133 0xa4 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a25.mmc2_dat1 */
134 0xa8 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a26.mmc2_dat2 */
135 0xac (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a27.mmc2_dat3 */
136 0x8c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a19.mmc2_dat4 */
137 0x90 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a20.mmc2_dat5 */
138 0x94 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a21.mmc2_dat6 */
139 0x98 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a22.mmc2_dat7 */
140 >;
141 };
142
143 tps659038_pins_default: tps659038_pins_default {
144 pinctrl-single,pins = <
145 0x418 (PIN_INPUT_PULLUP | MUX_MODE14) /* wakeup0.gpio1_0 */
146 >;
147 };
148
149 tmp102_pins_default: tmp102_pins_default {
150 pinctrl-single,pins = <
151 0x3C8 (PIN_INPUT_PULLUP | MUX_MODE14) /* spi2_d0.gpio7_16 */
152 >;
153 };
154
155 mcp79410_pins_default: mcp79410_pins_default {
156 pinctrl-single,pins = <
157 0x424 (PIN_INPUT_PULLUP | MUX_MODE1) /* wakeup3.sys_nirq1 */
158 >;
159 };
160
161 usb1_pins: pinmux_usb1_pins {
162 pinctrl-single,pins = <
163 0x280 (PIN_INPUT_SLEW | MUX_MODE0) /* usb1_drvvbus */
164 >;
165 };
166
167};
168
169&i2c1 {
170 status = "okay";
171 pinctrl-names = "default";
172 pinctrl-0 = <&i2c1_pins_default>;
173 clock-frequency = <400000>;
174
175 tps659038: tps659038@58 {
176 compatible = "ti,tps659038";
177 reg = <0x58>;
178 interrupt-parent = <&gpio1>;
179 interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
180
181 pinctrl-names = "default";
182 pinctrl-0 = <&tps659038_pins_default>;
183
184 #interrupt-cells = <2>;
185 interrupt-controller;
186
187 ti,system-power-controller;
188
189 tps659038_pmic {
190 compatible = "ti,tps659038-pmic";
191
192 regulators {
193 smps12_reg: smps12 {
194 /* VDD_MPU */
195 regulator-name = "smps12";
196 regulator-min-microvolt = < 850000>;
197 regulator-max-microvolt = <1250000>;
198 regulator-always-on;
199 regulator-boot-on;
200 };
201
202 smps3_reg: smps3 {
203 /* VDD_DDR */
204 regulator-name = "smps3";
205 regulator-min-microvolt = <1350000>;
206 regulator-max-microvolt = <1350000>;
207 regulator-always-on;
208 regulator-boot-on;
209 };
210
211 smps45_reg: smps45 {
212 /* VDD_DSPEVE, VDD_IVA, VDD_GPU */
213 regulator-name = "smps45";
214 regulator-min-microvolt = < 850000>;
215 regulator-max-microvolt = <1150000>;
216 regulator-always-on;
217 regulator-boot-on;
218 };
219
220 smps6_reg: smps6 {
221 /* VDD_CORE */
222 regulator-name = "smps6";
223 regulator-min-microvolt = <850000>;
224 regulator-max-microvolt = <1030000>;
225 regulator-always-on;
226 regulator-boot-on;
227 };
228
229 /* SMPS7 unused */
230
231 smps8_reg: smps8 {
232 /* VDD_1V8 */
233 regulator-name = "smps8";
234 regulator-min-microvolt = <1800000>;
235 regulator-max-microvolt = <1800000>;
236 regulator-always-on;
237 regulator-boot-on;
238 };
239
240 /* SMPS9 unused */
241
242 ldo1_reg: ldo1 {
243 /* VDD_SD */
244 regulator-name = "ldo1";
245 regulator-min-microvolt = <1800000>;
246 regulator-max-microvolt = <3300000>;
247 regulator-boot-on;
248 };
249
250 ldo2_reg: ldo2 {
251 /* VDD_SHV5 */
252 regulator-name = "ldo2";
253 regulator-min-microvolt = <3300000>;
254 regulator-max-microvolt = <3300000>;
255 regulator-always-on;
256 regulator-boot-on;
257 };
258
259 ldo3_reg: ldo3 {
260 /* VDDA_1V8_PHY */
261 regulator-name = "ldo3";
262 regulator-min-microvolt = <1800000>;
263 regulator-max-microvolt = <1800000>;
264 regulator-always-on;
265 regulator-boot-on;
266 };
267
268 ldo9_reg: ldo9 {
269 /* VDD_RTC */
270 regulator-name = "ldo9";
271 regulator-min-microvolt = <1050000>;
272 regulator-max-microvolt = <1050000>;
273 regulator-always-on;
274 regulator-boot-on;
275 };
276
277 ldoln_reg: ldoln {
278 /* VDDA_1V8_PLL */
279 regulator-name = "ldoln";
280 regulator-min-microvolt = <1800000>;
281 regulator-max-microvolt = <1800000>;
282 regulator-always-on;
283 regulator-boot-on;
284 };
285
286 ldousb_reg: ldousb {
287 /* VDDA_3V_USB: VDDA_USBHS33 */
288 regulator-name = "ldousb";
289 regulator-min-microvolt = <3300000>;
290 regulator-max-microvolt = <3300000>;
291 regulator-boot-on;
292 };
293
294 regen1: regen1 {
295 /* VDD_3V3_ON */
296 regulator-name = "regen1";
297 regulator-boot-on;
298 regulator-always-on;
299 };
300 };
301 };
302
303 tps659038_rtc: tps659038_rtc {
304 compatible = "ti,palmas-rtc";
305 interrupt-parent = <&tps659038>;
306 interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
307 wakeup-source;
308 };
309
310 tps659038_pwr_button: tps659038_pwr_button {
311 compatible = "ti,palmas-pwrbutton";
312 interrupt-parent = <&tps659038>;
313 interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
314 wakeup-source;
315 ti,palmas-long-press-seconds = <12>;
316 };
317 };
318
319 tmp102: tmp102@48 {
320 compatible = "ti,tmp102";
321 reg = <0x48>;
322 pinctrl-names = "default";
323 pinctrl-0 = <&tmp102_pins_default>;
324 interrupt-parent = <&gpio7>;
325 interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
326 };
327};
328
329&i2c3 {
330 status = "okay";
331 pinctrl-names = "default";
332 pinctrl-0 = <&i2c3_pins_default>;
333 clock-frequency = <400000>;
334
335 mcp_rtc: rtc@6f {
336 compatible = "microchip,mcp7941x";
337 reg = <0x6f>;
338 interrupt-parent = <&gic>;
339 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_LOW>; /* IRQ_SYS_1N */
340
341 pinctrl-names = "default";
342 pinctrl-0 = <&mcp79410_pins_default>;
343
344 vcc-supply = <&vdd_3v3>;
345 wakeup-source;
346 };
347};
348
349&gpio7 {
350 ti,no-reset-on-init;
351 ti,no-idle-on-init;
352};
353
354&cpu0 {
355 cpu0-supply = <&smps12_reg>;
356 voltage-tolerance = <1>;
357};
358
359&uart3 {
360 status = "okay";
361 interrupts-extended = <&gic GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>,
362 <&dra7_pmx_core 0x248>;
363
364 pinctrl-names = "default";
365 pinctrl-0 = <&uart3_pins_default>;
366};
367
368&mmc1 {
369 status = "okay";
370
371 pinctrl-names = "default";
372 pinctrl-0 = <&mmc1_pins_default>;
373
374 vmmc-supply = <&ldo1_reg>;
375 vmmc_aux-supply = <&vdd_3v3>;
376 pbias-supply = <&pbias_mmc_reg>;
377 bus-width = <4>;
378 cd-gpios = <&gpio6 27 0>; /* gpio 219 */
379};
380
381&mmc2 {
382 status = "okay";
383
384 pinctrl-names = "default";
385 pinctrl-0 = <&mmc2_pins_default>;
386
387 vmmc-supply = <&vdd_3v3>;
388 bus-width = <8>;
389 ti,non-removable;
390 cap-mmc-dual-data-rate;
391};
392
393&sata {
394 status = "okay";
395};
396
397&usb2_phy1 {
398 phy-supply = <&ldousb_reg>;
399};
400
401&usb1 {
402 dr_mode = "host";
403 pinctrl-names = "default";
404 pinctrl-0 = <&usb1_pins>;
405};
diff --git a/arch/arm/boot/dts/arm-realview-pb1176.dts b/arch/arm/boot/dts/arm-realview-pb1176.dts
new file mode 100644
index 000000000000..ff26c7ed8c41
--- /dev/null
+++ b/arch/arm/boot/dts/arm-realview-pb1176.dts
@@ -0,0 +1,412 @@
1/*
2 * Copyright 2014 Linaro Ltd
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23/dts-v1/;
24#include <dt-bindings/interrupt-controller/irq.h>
25#include <dt-bindings/gpio/gpio.h>
26#include "skeleton.dtsi"
27
28/ {
29 model = "ARM RealView PB1176";
30 compatible = "arm,realview-pb1176";
31
32 chosen { };
33
34 aliases {
35 serial0 = &pb1176_serial0;
36 serial1 = &pb1176_serial1;
37 serial2 = &pb1176_serial2;
38 serial3 = &pb1176_serial3;
39 serial4 = &fpga_serial;
40 };
41
42 memory {
43 /* 128 MiB memory @ 0x0 */
44 reg = <0x00000000 0x08000000>;
45 };
46
47 /* The voltage to the MMC card is hardwired at 3.3V */
48 vmmc: fixedregulator@0 {
49 compatible = "regulator-fixed";
50 regulator-name = "vmmc";
51 regulator-min-microvolt = <3300000>;
52 regulator-max-microvolt = <3300000>;
53 regulator-boot-on;
54 };
55
56 xtal24mhz: xtal24mhz@24M {
57 #clock-cells = <0>;
58 compatible = "fixed-clock";
59 clock-frequency = <24000000>;
60 };
61
62 timclk: timclk@1M {
63 #clock-cells = <0>;
64 compatible = "fixed-factor-clock";
65 clock-div = <24>;
66 clock-mult = <1>;
67 clocks = <&xtal24mhz>;
68 };
69
70 mclk: mclk@24M {
71 #clock-cells = <0>;
72 compatible = "fixed-factor-clock";
73 clock-div = <1>;
74 clock-mult = <1>;
75 clocks = <&xtal24mhz>;
76 };
77
78 kmiclk: kmiclk@24M {
79 #clock-cells = <0>;
80 compatible = "fixed-factor-clock";
81 clock-div = <1>;
82 clock-mult = <1>;
83 clocks = <&xtal24mhz>;
84 };
85
86 sspclk: sspclk@24M {
87 #clock-cells = <0>;
88 compatible = "fixed-factor-clock";
89 clock-div = <1>;
90 clock-mult = <1>;
91 clocks = <&xtal24mhz>;
92 };
93
94 uartclk: uartclk@24M {
95 #clock-cells = <0>;
96 compatible = "fixed-factor-clock";
97 clock-div = <1>;
98 clock-mult = <1>;
99 clocks = <&xtal24mhz>;
100 };
101
102 /* FIXME: this actually hangs off the PLL clocks */
103 pclk: pclk@0 {
104 #clock-cells = <0>;
105 compatible = "fixed-clock";
106 clock-frequency = <0>;
107 };
108
109 soc {
110 #address-cells = <1>;
111 #size-cells = <1>;
112 compatible = "arm,realview-pb1176-soc", "simple-bus";
113 regmap = <&syscon>;
114 ranges;
115
116 syscon: syscon@10000000 {
117 compatible = "arm,realview-pb1176-syscon", "syscon";
118 reg = <0x10000000 0x1000>;
119
120 led@08.0 {
121 compatible = "register-bit-led";
122 offset = <0x08>;
123 mask = <0x01>;
124 label = "versatile:0";
125 linux,default-trigger = "heartbeat";
126 default-state = "on";
127 };
128 led@08.1 {
129 compatible = "register-bit-led";
130 offset = <0x08>;
131 mask = <0x02>;
132 label = "versatile:1";
133 linux,default-trigger = "mmc0";
134 default-state = "off";
135 };
136 led@08.2 {
137 compatible = "register-bit-led";
138 offset = <0x08>;
139 mask = <0x04>;
140 label = "versatile:2";
141 linux,default-trigger = "cpu0";
142 default-state = "off";
143 };
144 led@08.3 {
145 compatible = "register-bit-led";
146 offset = <0x08>;
147 mask = <0x08>;
148 label = "versatile:3";
149 default-state = "off";
150 };
151 led@08.4 {
152 compatible = "register-bit-led";
153 offset = <0x08>;
154 mask = <0x10>;
155 label = "versatile:4";
156 default-state = "off";
157 };
158 led@08.5 {
159 compatible = "register-bit-led";
160 offset = <0x08>;
161 mask = <0x20>;
162 label = "versatile:5";
163 default-state = "off";
164 };
165 led@08.6 {
166 compatible = "register-bit-led";
167 offset = <0x08>;
168 mask = <0x40>;
169 label = "versatile:6";
170 default-state = "off";
171 };
172 led@08.7 {
173 compatible = "register-bit-led";
174 offset = <0x08>;
175 mask = <0x80>;
176 label = "versatile:7";
177 default-state = "off";
178 };
179 };
180
181 /* Primary DevChip GIC synthesized with the CPU */
182 intc_dc1176: interrupt-controller@10120000 {
183 compatible = "arm,arm1176jzf-devchip-gic", "arm,arm11mp-gic";
184 #interrupt-cells = <3>;
185 #address-cells = <1>;
186 interrupt-controller;
187 reg = <0x10121000 0x1000>,
188 <0x10120000 0x100>;
189 };
190
191 L2: l2-cache {
192 compatible = "arm,l220-cache";
193 reg = <0x10110000 0x1000>;
194 interrupt-parent = <&intc_dc1176>;
195 interrupts = <0 13 IRQ_TYPE_LEVEL_HIGH>;
196 cache-unified;
197 cache-level = <2>;
198 /*
199 * Override default cache size, sets and
200 * associativity as these may be erroneously set
201 * up by boot loader(s).
202 */
203 arm,override-auxreg;
204 cache-size = <131072>; // 128kB
205 cache-sets = <512>;
206 cache-line-size = <32>;
207 };
208
209 pmu {
210 compatible = "arm,arm1176-pmu";
211 interrupt-parent = <&intc_dc1176>;
212 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
213 };
214
215 timer01: timer@10104000 {
216 compatible = "arm,sp804", "arm,primecell";
217 reg = <0x10104000 0x1000>;
218 interrupt-parent = <&intc_dc1176>;
219 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>, <0 9 IRQ_TYPE_LEVEL_HIGH>;
220 clocks = <&timclk>, <&timclk>, <&pclk>;
221 clock-names = "timer1", "timer2", "apb_pclk";
222 };
223
224 timer23: timer@10105000 {
225 compatible = "arm,sp804", "arm,primecell";
226 reg = <0x10105000 0x1000>;
227 interrupt-parent = <&intc_dc1176>;
228 interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>;
229 arm,sp804-has-irq = <1>;
230 clocks = <&timclk>, <&timclk>, <&pclk>;
231 clock-names = "timer1", "timer2", "apb_pclk";
232 };
233
234 pb1176_rtc: rtc@10108000 {
235 compatible = "arm,pl031", "arm,primecell";
236 reg = <0x10108000 0x1000>;
237 interrupt-parent = <&intc_dc1176>;
238 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
239 clocks = <&pclk>;
240 clock-names = "apb_pclk";
241 };
242
243 pb1176_gpio0: gpio@1010a000 {
244 compatible = "arm,pl061", "arm,primecell";
245 reg = <0x1010a000 0x1000>;
246 gpio-controller;
247 interrupt-parent = <&intc_dc1176>;
248 interrupts = <0 16 IRQ_TYPE_LEVEL_HIGH>;
249 #gpio-cells = <2>;
250 interrupt-controller;
251 #interrupt-cells = <2>;
252 clocks = <&pclk>;
253 clock-names = "apb_pclk";
254 };
255
256 pb1176_ssp: ssp@1010b000 {
257 compatible = "arm,pl022", "arm,primecell";
258 reg = <0x1010b000 0x1000>;
259 interrupt-parent = <&intc_dc1176>;
260 interrupts = <0 17 IRQ_TYPE_LEVEL_HIGH>;
261 clocks = <&sspclk>, <&pclk>;
262 clock-names = "SSPCLK", "apb_pclk";
263 };
264
265 pb1176_serial0: serial@1010c000 {
266 compatible = "arm,pl011", "arm,primecell";
267 reg = <0x1010c000 0x1000>;
268 interrupt-parent = <&intc_dc1176>;
269 interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>;
270 clocks = <&uartclk>, <&pclk>;
271 clock-names = "uartclk", "apb_pclk";
272 };
273
274 pb1176_serial1: serial@1010d000 {
275 compatible = "arm,pl011", "arm,primecell";
276 reg = <0x1010d000 0x1000>;
277 interrupt-parent = <&intc_dc1176>;
278 interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>;
279 clocks = <&uartclk>, <&pclk>;
280 clock-names = "uartclk", "apb_pclk";
281 };
282
283 pb1176_serial2: serial@1010e000 {
284 compatible = "arm,pl011", "arm,primecell";
285 reg = <0x1010e000 0x1000>;
286 interrupt-parent = <&intc_dc1176>;
287 interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>;
288 clocks = <&uartclk>, <&pclk>;
289 clock-names = "uartclk", "apb_pclk";
290 };
291
292 pb1176_serial3: serial@1010f000 {
293 compatible = "arm,pl011", "arm,primecell";
294 reg = <0x1010f000 0x1000>;
295 interrupt-parent = <&intc_dc1176>;
296 interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>;
297 clocks = <&uartclk>, <&pclk>;
298 clock-names = "uartclk", "apb_pclk";
299 };
300 };
301
302 /* These peripherals are inside the FPGA rather than the DevChip */
303 fpga {
304 #address-cells = <1>;
305 #size-cells = <1>;
306 compatible = "simple-bus";
307 ranges;
308
309 fpga_mci: mmcsd@10005000 {
310 compatible = "arm,pl18x", "arm,primecell";
311 reg = <0x10005000 0x1000>;
312 interrupt-parent = <&intc_fpga1176>;
313 interrupts = <0 1 IRQ_TYPE_LEVEL_HIGH>,
314 <0 2 IRQ_TYPE_LEVEL_HIGH>;
315 /* Due to frequent FIFO overruns, use just 500 kHz */
316 max-frequency = <500000>;
317 bus-width = <4>;
318 cap-sd-highspeed;
319 cap-mmc-highspeed;
320 clocks = <&mclk>, <&pclk>;
321 clock-names = "mclk", "apb_pclk";
322 vmmc-supply = <&vmmc>;
323 cd-gpios = <&fpga_gpio1 0 GPIO_ACTIVE_LOW>;
324 wp-gpios = <&fpga_gpio1 1 GPIO_ACTIVE_HIGH>;
325 };
326
327 fpga_kmi0: kmi@10006000 {
328 compatible = "arm,pl050", "arm,primecell";
329 reg = <0x10006000 0x1000>;
330 interrupt-parent = <&intc_fpga1176>;
331 interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>;
332 clocks = <&kmiclk>, <&pclk>;
333 clock-names = "KMIREFCLK", "apb_pclk";
334 };
335
336 fpga_kmi1: kmi@10007000 {
337 compatible = "arm,pl050", "arm,primecell";
338 reg = <0x10007000 0x1000>;
339 interrupt-parent = <&intc_fpga1176>;
340 interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>;
341 clocks = <&kmiclk>, <&pclk>;
342 clock-names = "KMIREFCLK", "apb_pclk";
343 };
344
345 fpga_charlcd: charlcd@10008000 {
346 compatible = "arm,versatile-lcd";
347 reg = <0x10008000 0x1000>;
348 interrupt-parent = <&intc_fpga1176>;
349 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
350 clocks = <&pclk>;
351 clock-names = "apb_pclk";
352 };
353
354 fpga_serial: serial@10009000 {
355 compatible = "arm,pl011", "arm,primecell";
356 reg = <0x10009000 0x1000>;
357 interrupt-parent = <&intc_fpga1176>;
358 interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>;
359 clocks = <&uartclk>, <&pclk>;
360 clock-names = "uartclk", "apb_pclk";
361 };
362
363 /* This GIC on the board is cascaded off the DevChip GIC */
364 intc_fpga1176: interrupt-controller@10040000 {
365 compatible = "arm,arm1176jzf-devchip-gic", "arm,arm11mp-gic";
366 #interrupt-cells = <3>;
367 #address-cells = <1>;
368 interrupt-controller;
369 reg = <0x10041000 0x1000>,
370 <0x10040000 0x100>;
371 interrupt-parent = <&intc_dc1176>;
372 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
373 };
374
375 fpga_gpio0: gpio@10014000 {
376 compatible = "arm,pl061", "arm,primecell";
377 reg = <0x10014000 0x1000>;
378 gpio-controller;
379 interrupt-parent = <&intc_fpga1176>;
380 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
381 #gpio-cells = <2>;
382 interrupt-controller;
383 #interrupt-cells = <2>;
384 clocks = <&pclk>;
385 clock-names = "apb_pclk";
386 };
387
388 fpga_gpio1: gpio@10015000 {
389 compatible = "arm,pl061", "arm,primecell";
390 reg = <0x10015000 0x1000>;
391 gpio-controller;
392 interrupt-parent = <&intc_fpga1176>;
393 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
394 #gpio-cells = <2>;
395 interrupt-controller;
396 #interrupt-cells = <2>;
397 clocks = <&pclk>;
398 clock-names = "apb_pclk";
399 };
400
401 fpga_rtc: rtc@10017000 {
402 compatible = "arm,pl031", "arm,primecell";
403 reg = <0x10017000 0x1000>;
404 interrupt-parent = <&intc_fpga1176>;
405 interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>;
406 clocks = <&pclk>;
407 clock-names = "apb_pclk";
408 };
409
410
411 };
412};
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index a495e5821ab8..1466580be295 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -75,6 +75,7 @@
75 clock-frequency = <100000>; 75 clock-frequency = <100000>;
76 status = "okay"; 76 status = "okay";
77 audio_codec: audio-codec@4a { 77 audio_codec: audio-codec@4a {
78 #sound-dai-cells = <0>;
78 compatible = "cirrus,cs42l51"; 79 compatible = "cirrus,cs42l51";
79 reg = <0x4a>; 80 reg = <0x4a>;
80 }; 81 };
@@ -102,30 +103,6 @@
102 broken-cd; 103 broken-cd;
103 }; 104 };
104 105
105 pinctrl {
106 /*
107 * These pins might be muxed as I2S by
108 * the bootloader, but it conflicts
109 * with the real I2S pins that are
110 * muxed using i2s_pins. We must mux
111 * those pins to a function other than
112 * I2S.
113 */
114 pinctrl-0 = <&hog_pins1 &hog_pins2>;
115 pinctrl-names = "default";
116
117 hog_pins1: hog-pins1 {
118 marvell,pins = "mpp6", "mpp8", "mpp10",
119 "mpp12", "mpp13";
120 marvell,function = "gpio";
121 };
122
123 hog_pins2: hog-pins2 {
124 marvell,pins = "mpp5", "mpp7", "mpp9";
125 marvell,function = "gpo";
126 };
127 };
128
129 usb@50000 { 106 usb@50000 {
130 status = "okay"; 107 status = "okay";
131 }; 108 };
@@ -135,6 +112,8 @@
135 }; 112 };
136 113
137 spi0: spi@10600 { 114 spi0: spi@10600 {
115 pinctrl-0 = <&spi0_pins2>;
116 pinctrl-names = "default";
138 status = "okay"; 117 status = "okay";
139 118
140 spi-flash@0 { 119 spi-flash@0 {
@@ -167,17 +146,84 @@
167 }; 146 };
168 147
169 sound { 148 sound {
170 compatible = "marvell,a370db-audio"; 149 compatible = "simple-audio-card";
171 marvell,audio-controller = <&audio_controller>; 150 simple-audio-card,name = "Armada 370 DB Audio";
172 marvell,audio-codec = <&audio_codec &spdif_out &spdif_in>; 151 simple-audio-card,mclk-fs = <256>;
173 status = "okay"; 152 simple-audio-card,widgets =
153 "Headphone", "Out Jack",
154 "Line", "In Jack";
155 simple-audio-card,routing =
156 "Out Jack", "HPL",
157 "Out Jack", "HPR",
158 "AIN1L", "In Jack",
159 "AIN1L", "In Jack";
160 status = "okay";
161
162 simple-audio-card,dai-link@0 {
163 format = "i2s";
164 cpu {
165 sound-dai = <&audio_controller 0>;
166 };
167
168 codec {
169 sound-dai = <&audio_codec>;
170 };
171 };
172
173 simple-audio-card,dai-link@1 {
174 format = "i2s";
175 cpu {
176 sound-dai = <&audio_controller 1>;
177 };
178
179 codec {
180 sound-dai = <&spdif_out>;
181 };
182 };
183
184 simple-audio-card,dai-link@2 {
185 format = "i2s";
186 cpu {
187 sound-dai = <&audio_controller 1>;
188 };
189
190 codec {
191 sound-dai = <&spdif_in>;
192 };
193 };
174 }; 194 };
175 195
176 spdif_out: spdif-out { 196 spdif_out: spdif-out {
177 compatible = "linux,spdif-dit"; 197 #sound-dai-cells = <0>;
198 compatible = "linux,spdif-dit";
178 }; 199 };
179 200
180 spdif_in: spdif-in { 201 spdif_in: spdif-in {
181 compatible = "linux,spdif-dir"; 202 #sound-dai-cells = <0>;
203 compatible = "linux,spdif-dir";
204 };
205};
206
207&pinctrl {
208 /*
209 * These pins might be muxed as I2S by
210 * the bootloader, but it conflicts
211 * with the real I2S pins that are
212 * muxed using i2s_pins. We must mux
213 * those pins to a function other than
214 * I2S.
215 */
216 pinctrl-0 = <&hog_pins1 &hog_pins2>;
217 pinctrl-names = "default";
218
219 hog_pins1: hog-pins1 {
220 marvell,pins = "mpp6", "mpp8", "mpp10",
221 "mpp12", "mpp13";
222 marvell,function = "gpio";
223 };
224
225 hog_pins2: hog-pins2 {
226 marvell,pins = "mpp5", "mpp7", "mpp9";
227 marvell,function = "gpo";
182 }; 228 };
183}; 229};
diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts
index 2b6d24e0d1e8..e1b0eb6b091f 100644
--- a/arch/arm/boot/dts/armada-370-mirabox.dts
+++ b/arch/arm/boot/dts/armada-370-mirabox.dts
@@ -54,18 +54,6 @@
54 status = "okay"; 54 status = "okay";
55 }; 55 };
56 56
57 pinctrl {
58 pwr_led_pin: pwr-led-pin {
59 marvell,pins = "mpp63";
60 marvell,function = "gpo";
61 };
62
63 stat_led_pins: stat-led-pins {
64 marvell,pins = "mpp64", "mpp65";
65 marvell,function = "gpio";
66 };
67 };
68
69 gpio_leds { 57 gpio_leds {
70 compatible = "gpio-leds"; 58 compatible = "gpio-leds";
71 pinctrl-names = "default"; 59 pinctrl-names = "default";
@@ -169,3 +157,16 @@
169 }; 157 };
170 }; 158 };
171}; 159};
160
161&pinctrl {
162 pwr_led_pin: pwr-led-pin {
163 marvell,pins = "mpp63";
164 marvell,function = "gpo";
165 };
166
167 stat_led_pins: stat-led-pins {
168 marvell,pins = "mpp64", "mpp65";
169 marvell,function = "gpio";
170 };
171};
172
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn102.dts b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
index 3aebd93cc33c..4e24932c6e30 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn102.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
@@ -35,7 +35,7 @@
35 pcie-controller { 35 pcie-controller {
36 status = "okay"; 36 status = "okay";
37 37
38 /* Connected to Marvell SATA controller */ 38 /* Connected to Marvell 88SE9170 SATA controller */
39 pcie@1,0 { 39 pcie@1,0 {
40 /* Port 0, Lane 0 */ 40 /* Port 0, Lane 0 */
41 status = "okay"; 41 status = "okay";
@@ -53,53 +53,12 @@
53 status = "okay"; 53 status = "okay";
54 }; 54 };
55 55
56 /* eSATA interface */
56 sata@a0000 { 57 sata@a0000 {
57 nr-ports = <2>; 58 nr-ports = <1>;
58 status = "okay"; 59 status = "okay";
59 }; 60 };
60 61
61 pinctrl {
62 power_led_pin: power-led-pin {
63 marvell,pins = "mpp57";
64 marvell,function = "gpio";
65 };
66
67 sata1_led_pin: sata1-led-pin {
68 marvell,pins = "mpp15";
69 marvell,function = "gpio";
70 };
71
72 sata2_led_pin: sata2-led-pin {
73 marvell,pins = "mpp14";
74 marvell,function = "gpio";
75 };
76
77 backup_led_pin: backup-led-pin {
78 marvell,pins = "mpp56";
79 marvell,function = "gpio";
80 };
81
82 backup_button_pin: backup-button-pin {
83 marvell,pins = "mpp58";
84 marvell,function = "gpio";
85 };
86
87 power_button_pin: power-button-pin {
88 marvell,pins = "mpp62";
89 marvell,function = "gpio";
90 };
91
92 reset_button_pin: reset-button-pin {
93 marvell,pins = "mpp6";
94 marvell,function = "gpio";
95 };
96
97 poweroff: poweroff {
98 marvell,pins = "mpp8";
99 marvell,function = "gpio";
100 };
101 };
102
103 mdio { 62 mdio {
104 pinctrl-0 = <&mdio_pins>; 63 pinctrl-0 = <&mdio_pins>;
105 pinctrl-names = "default"; 64 pinctrl-names = "default";
@@ -204,20 +163,20 @@
204 default-state = "keep"; 163 default-state = "keep";
205 }; 164 };
206 165
207 green-sata1-led { 166 blue-sata1-led {
208 label = "rn102:green:sata1"; 167 label = "rn102:blue:sata1";
209 gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; 168 gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
210 default-state = "on"; 169 default-state = "on";
211 }; 170 };
212 171
213 green-sata2-led { 172 blue-sata2-led {
214 label = "rn102:green:sata2"; 173 label = "rn102:blue:sata2";
215 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; 174 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
216 default-state = "on"; 175 default-state = "on";
217 }; 176 };
218 177
219 green-backup-led { 178 blue-backup-led {
220 label = "rn102:green:backup"; 179 label = "rn102:blue:backup";
221 gpios = <&gpio1 24 GPIO_ACTIVE_LOW>; 180 gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
222 default-state = "on"; 181 default-state = "on";
223 }; 182 };
@@ -256,3 +215,45 @@
256 gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; 215 gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
257 }; 216 };
258}; 217};
218
219&pinctrl {
220 power_led_pin: power-led-pin {
221 marvell,pins = "mpp57";
222 marvell,function = "gpio";
223 };
224
225 sata1_led_pin: sata1-led-pin {
226 marvell,pins = "mpp15";
227 marvell,function = "gpio";
228 };
229
230 sata2_led_pin: sata2-led-pin {
231 marvell,pins = "mpp14";
232 marvell,function = "gpio";
233 };
234
235 backup_led_pin: backup-led-pin {
236 marvell,pins = "mpp56";
237 marvell,function = "gpio";
238 };
239
240 backup_button_pin: backup-button-pin {
241 marvell,pins = "mpp58";
242 marvell,function = "gpio";
243 };
244
245 power_button_pin: power-button-pin {
246 marvell,pins = "mpp62";
247 marvell,function = "gpio";
248 };
249
250 reset_button_pin: reset-button-pin {
251 marvell,pins = "mpp6";
252 marvell,function = "gpio";
253 };
254
255 poweroff: poweroff {
256 marvell,pins = "mpp8";
257 marvell,function = "gpio";
258 };
259};
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
index c2f414bb9aba..30586e47986a 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn104.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
@@ -53,38 +53,6 @@
53 status = "okay"; 53 status = "okay";
54 }; 54 };
55 55
56 pinctrl {
57 poweroff: poweroff {
58 marvell,pins = "mpp60";
59 marvell,function = "gpio";
60 };
61
62 backup_button_pin: backup-button-pin {
63 marvell,pins = "mpp52";
64 marvell,function = "gpio";
65 };
66
67 power_button_pin: power-button-pin {
68 marvell,pins = "mpp62";
69 marvell,function = "gpio";
70 };
71
72 backup_led_pin: backup-led-pin {
73 marvell,pins = "mpp63";
74 marvell,function = "gpo";
75 };
76
77 power_led_pin: power-led-pin {
78 marvell,pins = "mpp64";
79 marvell,function = "gpio";
80 };
81
82 reset_button_pin: reset-button-pin {
83 marvell,pins = "mpp65";
84 marvell,function = "gpio";
85 };
86 };
87
88 mdio { 56 mdio {
89 pinctrl-0 = <&mdio_pins>; 57 pinctrl-0 = <&mdio_pins>;
90 pinctrl-names = "default"; 58 pinctrl-names = "default";
@@ -269,3 +237,35 @@
269 gpios = <&gpio1 28 GPIO_ACTIVE_LOW>; 237 gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
270 }; 238 };
271}; 239};
240
241&pinctrl {
242 poweroff: poweroff {
243 marvell,pins = "mpp60";
244 marvell,function = "gpio";
245 };
246
247 backup_button_pin: backup-button-pin {
248 marvell,pins = "mpp52";
249 marvell,function = "gpio";
250 };
251
252 power_button_pin: power-button-pin {
253 marvell,pins = "mpp62";
254 marvell,function = "gpio";
255 };
256
257 backup_led_pin: backup-led-pin {
258 marvell,pins = "mpp63";
259 marvell,function = "gpo";
260 };
261
262 power_led_pin: power-led-pin {
263 marvell,pins = "mpp64";
264 marvell,function = "gpio";
265 };
266
267 reset_button_pin: reset-button-pin {
268 marvell,pins = "mpp65";
269 marvell,function = "gpio";
270 };
271};
diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
index f57a8f841498..394308951ed9 100644
--- a/arch/arm/boot/dts/armada-370-rd.dts
+++ b/arch/arm/boot/dts/armada-370-rd.dts
@@ -59,18 +59,6 @@
59 }; 59 };
60 60
61 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
74 serial@12000 { 62 serial@12000 {
75 status = "okay"; 63 status = "okay";
76 }; 64 };
@@ -85,10 +73,6 @@
85 phy0: ethernet-phy@0 { 73 phy0: ethernet-phy@0 {
86 reg = <0>; 74 reg = <0>;
87 }; 75 };
88
89 phy1: ethernet-phy@1 {
90 reg = <1>;
91 };
92 }; 76 };
93 77
94 ethernet@70000 { 78 ethernet@70000 {
@@ -100,8 +84,11 @@
100 pinctrl-0 = <&ge1_rgmii_pins>; 84 pinctrl-0 = <&ge1_rgmii_pins>;
101 pinctrl-names = "default"; 85 pinctrl-names = "default";
102 status = "okay"; 86 status = "okay";
103 phy = <&phy1>;
104 phy-mode = "rgmii-id"; 87 phy-mode = "rgmii-id";
88 fixed-link {
89 speed = <1000>;
90 full-duplex;
91 };
105 }; 92 };
106 93
107 mvsdio@d4000 { 94 mvsdio@d4000 {
@@ -173,4 +160,56 @@
173 }; 160 };
174 }; 161 };
175 }; 162 };
163
164 dsa@0 {
165 compatible = "marvell,dsa";
166 #address-cells = <2>;
167 #size-cells = <0>;
168
169 dsa,ethernet = <&eth1>;
170 dsa,mii-bus = <&mdio>;
171
172 switch@0 {
173 #address-cells = <1>;
174 #size-cells = <0>;
175 reg = <0x10 0>; /* MDIO address 16, switch 0 in tree */
176
177 port@0 {
178 reg = <0>;
179 label = "lan0";
180 };
181
182 port@1 {
183 reg = <1>;
184 label = "lan1";
185 };
186
187 port@2 {
188 reg = <2>;
189 label = "lan2";
190 };
191
192 port@3 {
193 reg = <3>;
194 label = "lan3";
195 };
196
197 port@5 {
198 reg = <5>;
199 label = "cpu";
200 };
201 };
202 };
176 }; 203 };
204
205&pinctrl {
206 fan_pins: fan-pins {
207 marvell,pins = "mpp8";
208 marvell,function = "gpio";
209 };
210
211 led_pins: led-pins {
212 marvell,pins = "mpp32";
213 marvell,function = "gpio";
214 };
215};
diff --git a/arch/arm/boot/dts/armada-370-synology-ds213j.dts b/arch/arm/boot/dts/armada-370-synology-ds213j.dts
new file mode 100644
index 000000000000..70fecde76ccb
--- /dev/null
+++ b/arch/arm/boot/dts/armada-370-synology-ds213j.dts
@@ -0,0 +1,316 @@
1/*
2 * Device Tree file for Synology DS213j
3 *
4 * Copyright (C) 2014, Arnaud EBALARD <arno@natisbad.org>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * Note: this Device Tree assumes that the bootloader has remapped the
12 * internal registers to 0xf1000000 (instead of the old 0xd0000000).
13 * The 0xf1000000 is the default used by the recent, DT-capable, U-Boot
14 * bootloaders provided by Marvell. It is used in recent versions of
15 * DSM software provided by Synology. Nonetheless, some earlier boards
16 * were delivered with an older version of u-boot that left internal
17 * registers mapped at 0xd0000000. If you have such a device you will
18 * not be able to directly boot a kernel based on this Device Tree. In
19 * that case, the preferred solution is to update your bootloader (e.g.
20 * by upgrading to latest version of DSM, or building a new one and
21 * installing it from u-boot prompt) or adjust the Devive Tree
22 * (s/0xf1000000/0xd0000000/ in 'ranges' below).
23 */
24
25/dts-v1/;
26
27#include <dt-bindings/input/input.h>
28#include <dt-bindings/gpio/gpio.h>
29#include "armada-370.dtsi"
30
31/ {
32 model = "Synology DS213j";
33 compatible = "synology,ds213j", "marvell,armada370",
34 "marvell,armada-370-xp";
35
36 chosen {
37 bootargs = "console=ttyS0,115200 earlyprintk";
38 stdout-path = &uart0;
39 };
40
41 memory {
42 device_type = "memory";
43 reg = <0x00000000 0x20000000>; /* 512 MB */
44 };
45
46 soc {
47 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
48 MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000>;
49
50 internal-regs {
51
52 /* RTC provided by Seiko S-35390A I2C RTC chip below */
53 rtc@10300 {
54 status = "disabled";
55 };
56
57 spi0: spi@10600 {
58 status = "okay";
59
60 spi-flash@0 {
61 #address-cells = <1>;
62 #size-cells = <1>;
63 compatible = "micron,n25q064";
64 reg = <0>; /* Chip select 0 */
65 spi-max-frequency = <20000000>;
66
67 /*
68 * Warning!
69 *
70 * Synology u-boot uses its compiled-in environment
71 * and it seems Synology did not care to change u-boot
72 * default configuration in order to allow saving a
73 * modified environment at a sensible location. So,
74 * if you do a 'saveenv' under u-boot, your modified
75 * environment will be saved at 1MB after the start
76 * of the flash, i.e. in the middle of the uImage.
77 * For that reason, it is strongly advised not to
78 * change the default environment, unless you know
79 * what you are doing.
80 */
81 partition@00000000 { /* u-boot */
82 label = "RedBoot";
83 reg = <0x00000000 0x000c0000>; /* 768KB */
84 };
85
86 partition@000c0000 { /* uImage */
87 label = "zImage";
88 reg = <0x000c0000 0x002d0000>; /* 2880KB */
89 };
90
91 partition@00390000 { /* uInitramfs */
92 label = "rd.gz";
93 reg = <0x00390000 0x00440000>; /* 4250KB */
94 };
95
96 partition@007d0000 { /* MAC address and serial number */
97 label = "vendor";
98 reg = <0x007d0000 0x00010000>; /* 64KB */
99 };
100
101 partition@007e0000 {
102 label = "RedBoot config";
103 reg = <0x007e0000 0x00010000>; /* 64KB */
104 };
105
106 partition@007f0000 {
107 label = "FIS directory";
108 reg = <0x007f0000 0x00010000>; /* 64KB */
109 };
110 };
111 };
112
113 i2c@11000 {
114 compatible = "marvell,mv64xxx-i2c";
115 pinctrl-0 = <&i2c0_pins>;
116 pinctrl-names = "default";
117 clock-frequency = <400000>;
118 status = "okay";
119
120 /* Main device RTC chip */
121 s35390a: s35390a@30 {
122 compatible = "sii,s35390a";
123 reg = <0x30>;
124 };
125 };
126
127 /* Connected to a header on device's PCB */
128 serial@12000 {
129 status = "okay";
130 };
131
132 /* Connected to a TI MSP430F2111 for power control */
133 serial@12100 {
134 status = "okay";
135 };
136
137 poweroff@12100 {
138 compatible = "synology,power-off";
139 reg = <0x12100 0x100>;
140 clocks = <&coreclk 0>;
141 };
142
143 /* rear USB port, near reset button */
144 usb@50000 {
145 status = "okay";
146 };
147
148 /* rear USB port, near RJ45 port */
149 usb@51000 {
150 status = "okay";
151 };
152
153 mdio {
154 phy1: ethernet-phy@1 { /* Marvell 88E1512 */
155 reg = <1>;
156 };
157 };
158
159 ethernet@70000 {
160 status = "okay";
161 phy = <&phy1>;
162 phy-mode = "sgmii";
163 };
164
165 sata@a0000 {
166 nr-ports = <2>;
167 status = "okay";
168 };
169 };
170 };
171
172 gpio-fan-32-38 {
173 status = "okay";
174 compatible = "gpio-fan";
175 pinctrl-0 = <&fan_ctrl_low_pin &fan_ctrl_mid_pin
176 &fan_ctrl_high_pin &fan_alarm_pin>;
177 pinctrl-names = "default";
178 gpios = <&gpio1 31 GPIO_ACTIVE_HIGH
179 &gpio2 0 GPIO_ACTIVE_HIGH
180 &gpio2 1 GPIO_ACTIVE_HIGH>;
181 alarm-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
182 gpio-fan,speed-map = < 0 0
183 1000 1
184 1150 2
185 1350 4
186 1500 3
187 1650 5
188 1750 6
189 1900 7 >;
190 };
191
192 gpio-leds {
193 compatible = "gpio-leds";
194 pinctrl-0 = <&disk1_led_pin
195 &disk2_led_pin>;
196 pinctrl-names = "default";
197
198 disk1-led-amber {
199 label = "synology:amber:disk1";
200 gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
201 default-state = "keep";
202 };
203
204 disk2-led-amber {
205 label = "synology:amber:disk2";
206 gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
207 default-state = "keep";
208 };
209 };
210
211 regulators {
212 compatible = "simple-bus";
213 #address-cells = <1>;
214 #size-cells = <0>;
215 pinctrl-0 = <&sata1_pwr_pin &sata2_pwr_pin>;
216 pinctrl-names = "default";
217
218 sata1_regulator: sata1-regulator {
219 compatible = "regulator-fixed";
220 reg = <1>;
221 regulator-name = "SATA1 Power";
222 regulator-min-microvolt = <5000000>;
223 regulator-max-microvolt = <5000000>;
224 startup-delay-us = <2000000>;
225 enable-active-high;
226 regulator-always-on;
227 regulator-boot-on;
228 gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>;
229 };
230
231 sata2_regulator: sata2-regulator {
232 compatible = "regulator-fixed";
233 reg = <2>;
234 regulator-name = "SATA2 Power";
235 regulator-min-microvolt = <5000000>;
236 regulator-max-microvolt = <5000000>;
237 startup-delay-us = <4000000>;
238 enable-active-high;
239 regulator-always-on;
240 regulator-boot-on;
241 gpio = <&gpio1 30 GPIO_ACTIVE_HIGH>;
242 };
243 };
244};
245
246&pinctrl {
247 disk1_led_pin: disk1-led-pin {
248 marvell,pins = "mpp31";
249 marvell,function = "gpio";
250 };
251
252 disk2_led_pin: disk2-led-pin {
253 marvell,pins = "mpp32";
254 marvell,function = "gpio";
255 };
256
257 sata1_pwr_pin: sata1-pwr-pin {
258 marvell,pins = "mpp37";
259 marvell,function = "gpio";
260 };
261
262 sata2_pwr_pin: sata2-pwr-pin {
263 marvell,pins = "mpp62";
264 marvell,function = "gpio";
265 };
266
267 sata1_pres_pin: sata1-pres-pin {
268 marvell,pins = "mpp60";
269 marvell,function = "gpio";
270 };
271
272 sata2_pres_pin: sata2-pres-pin {
273 marvell,pins = "mpp48";
274 marvell,function = "gpio";
275 };
276
277 syno_id_bit0_pin: syno-id-bit0-pin {
278 marvell,pins = "mpp55";
279 marvell,function = "gpio";
280 };
281
282 syno_id_bit1_pin: syno-id-bit1-pin {
283 marvell,pins = "mpp56";
284 marvell,function = "gpio";
285 };
286
287 syno_id_bit2_pin: syno-id-bit2-pin {
288 marvell,pins = "mpp57";
289 marvell,function = "gpio";
290 };
291
292 syno_id_bit3_pin: syno-id-bit3-pin {
293 marvell,pins = "mpp58";
294 marvell,function = "gpio";
295 };
296
297 fan_ctrl_low_pin: fan-ctrl-low-pin {
298 marvell,pins = "mpp65";
299 marvell,function = "gpio";
300 };
301
302 fan_ctrl_mid_pin: fan-ctrl-mid-pin {
303 marvell,pins = "mpp64";
304 marvell,function = "gpio";
305 };
306
307 fan_ctrl_high_pin: fan-ctrl-high-pin {
308 marvell,pins = "mpp63";
309 marvell,function = "gpo";
310 };
311
312 fan_alarm_pin: fan-alarm-pin {
313 marvell,pins = "mpp38";
314 marvell,function = "gpio";
315 };
316};
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 83286ec9702c..1af428602748 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -151,7 +151,7 @@
151 status = "disabled"; 151 status = "disabled";
152 }; 152 };
153 153
154 serial@12000 { 154 uart0: serial@12000 {
155 compatible = "snps,dw-apb-uart"; 155 compatible = "snps,dw-apb-uart";
156 reg = <0x12000 0x100>; 156 reg = <0x12000 0x100>;
157 reg-shift = <2>; 157 reg-shift = <2>;
@@ -160,7 +160,8 @@
160 clocks = <&coreclk 0>; 160 clocks = <&coreclk 0>;
161 status = "disabled"; 161 status = "disabled";
162 }; 162 };
163 serial@12100 { 163
164 uart1: serial@12100 {
164 compatible = "snps,dw-apb-uart"; 165 compatible = "snps,dw-apb-uart";
165 reg = <0x12100 0x100>; 166 reg = <0x12100 0x100>;
166 reg-shift = <2>; 167 reg-shift = <2>;
@@ -170,6 +171,10 @@
170 status = "disabled"; 171 status = "disabled";
171 }; 172 };
172 173
174 pinctrl: pin-ctrl@18000 {
175 reg = <0x18000 0x38>;
176 };
177
173 coredivclk: corediv-clock@18740 { 178 coredivclk: corediv-clock@18740 {
174 compatible = "marvell,armada-370-corediv-clock"; 179 compatible = "marvell,armada-370-corediv-clock";
175 reg = <0x18740 0xc>; 180 reg = <0x18740 0xc>;
@@ -180,7 +185,8 @@
180 185
181 mbusc: mbus-controller@20000 { 186 mbusc: mbus-controller@20000 {
182 compatible = "marvell,mbus-controller"; 187 compatible = "marvell,mbus-controller";
183 reg = <0x20000 0x100>, <0x20180 0x20>; 188 reg = <0x20000 0x100>, <0x20180 0x20>,
189 <0x20250 0x8>;
184 }; 190 };
185 191
186 mpic: interrupt-controller@20000 { 192 mpic: interrupt-controller@20000 {
@@ -232,7 +238,7 @@
232 status = "disabled"; 238 status = "disabled";
233 }; 239 };
234 240
235 mdio { 241 mdio: mdio {
236 #address-cells = <1>; 242 #address-cells = <1>;
237 #size-cells = <0>; 243 #size-cells = <0>;
238 compatible = "marvell,orion-mdio"; 244 compatible = "marvell,orion-mdio";
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index 6b3c23b1e138..fdb3c12a6139 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -95,81 +95,30 @@
95 compatible = "marvell,aurora-outer-cache"; 95 compatible = "marvell,aurora-outer-cache";
96 reg = <0x08000 0x1000>; 96 reg = <0x08000 0x1000>;
97 cache-id-part = <0x100>; 97 cache-id-part = <0x100>;
98 cache-unified;
98 wt-override; 99 wt-override;
99 }; 100 };
100 101
101 i2c0: i2c@11000 { 102 /*
102 reg = <0x11000 0x20>; 103 * Default SPI pinctrl setting, can be overwritten on
104 * board level if a different configuration is used.
105 */
106 spi0: spi@10600 {
107 pinctrl-0 = <&spi0_pins1>;
108 pinctrl-names = "default";
103 }; 109 };
104 110
105 i2c1: i2c@11100 { 111 spi1: spi@10680 {
106 reg = <0x11100 0x20>; 112 pinctrl-0 = <&spi1_pins>;
113 pinctrl-names = "default";
107 }; 114 };
108 115
109 system-controller@18200 { 116 i2c0: i2c@11000 {
110 compatible = "marvell,armada-370-xp-system-controller"; 117 reg = <0x11000 0x20>;
111 reg = <0x18200 0x100>;
112 }; 118 };
113 119
114 pinctrl { 120 i2c1: i2c@11100 {
115 compatible = "marvell,mv88f6710-pinctrl"; 121 reg = <0x11100 0x20>;
116 reg = <0x18000 0x38>;
117
118 sdio_pins1: sdio-pins1 {
119 marvell,pins = "mpp9", "mpp11", "mpp12",
120 "mpp13", "mpp14", "mpp15";
121 marvell,function = "sd0";
122 };
123
124 sdio_pins2: sdio-pins2 {
125 marvell,pins = "mpp47", "mpp48", "mpp49",
126 "mpp50", "mpp51", "mpp52";
127 marvell,function = "sd0";
128 };
129
130 sdio_pins3: sdio-pins3 {
131 marvell,pins = "mpp48", "mpp49", "mpp50",
132 "mpp51", "mpp52", "mpp53";
133 marvell,function = "sd0";
134 };
135
136 i2c0_pins: i2c0-pins {
137 marvell,pins = "mpp2", "mpp3";
138 marvell,function = "i2c0";
139 };
140
141 i2s_pins1: i2s-pins1 {
142 marvell,pins = "mpp5", "mpp6", "mpp7",
143 "mpp8", "mpp9", "mpp10",
144 "mpp12", "mpp13";
145 marvell,function = "audio";
146 };
147
148 i2s_pins2: i2s-pins2 {
149 marvell,pins = "mpp49", "mpp47", "mpp50",
150 "mpp59", "mpp57", "mpp61",
151 "mpp62", "mpp60", "mpp58";
152 marvell,function = "audio";
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 };
173 }; 122 };
174 123
175 gpio0: gpio@18100 { 124 gpio0: gpio@18100 {
@@ -205,6 +154,26 @@
205 interrupts = <91>; 154 interrupts = <91>;
206 }; 155 };
207 156
157 /*
158 * Default UART pinctrl setting without RTS/CTS, can
159 * be overwritten on board level if a different
160 * configuration is used.
161 */
162 uart0: serial@12000 {
163 pinctrl-0 = <&uart0_pins>;
164 pinctrl-names = "default";
165 };
166
167 uart1: serial@12100 {
168 pinctrl-0 = <&uart1_pins>;
169 pinctrl-names = "default";
170 };
171
172 system-controller@18200 {
173 compatible = "marvell,armada-370-xp-system-controller";
174 reg = <0x18200 0x100>;
175 };
176
208 gateclk: clock-gating-control@18220 { 177 gateclk: clock-gating-control@18220 {
209 compatible = "marvell,armada-370-gating-clock"; 178 compatible = "marvell,armada-370-gating-clock";
210 reg = <0x18220 0x4>; 179 reg = <0x18220 0x4>;
@@ -249,6 +218,7 @@
249 }; 218 };
250 219
251 audio_controller: audio-controller@30000 { 220 audio_controller: audio-controller@30000 {
221 #sound-dai-cells = <1>;
252 compatible = "marvell,armada370-audio"; 222 compatible = "marvell,armada370-audio";
253 reg = <0x30000 0x4000>; 223 reg = <0x30000 0x4000>;
254 interrupts = <93>; 224 interrupts = <93>;
@@ -305,3 +275,91 @@
305 }; 275 };
306 }; 276 };
307}; 277};
278
279&pinctrl {
280 compatible = "marvell,mv88f6710-pinctrl";
281
282 spi0_pins1: spi0-pins1 {
283 marvell,pins = "mpp33", "mpp34",
284 "mpp35", "mpp36";
285 marvell,function = "spi0";
286 };
287
288 spi0_pins2: spi0_pins2 {
289 marvell,pins = "mpp32", "mpp63",
290 "mpp64", "mpp65";
291 marvell,function = "spi0";
292 };
293
294 spi1_pins: spi1-pins {
295 marvell,pins = "mpp49", "mpp50",
296 "mpp51", "mpp52";
297 marvell,function = "spi1";
298 };
299
300 uart0_pins: uart0-pins {
301 marvell,pins = "mpp0", "mpp1";
302 marvell,function = "uart0";
303 };
304
305 uart1_pins: uart1-pins {
306 marvell,pins = "mpp41", "mpp42";
307 marvell,function = "uart1";
308 };
309
310 sdio_pins1: sdio-pins1 {
311 marvell,pins = "mpp9", "mpp11", "mpp12",
312 "mpp13", "mpp14", "mpp15";
313 marvell,function = "sd0";
314 };
315
316 sdio_pins2: sdio-pins2 {
317 marvell,pins = "mpp47", "mpp48", "mpp49",
318 "mpp50", "mpp51", "mpp52";
319 marvell,function = "sd0";
320 };
321
322 sdio_pins3: sdio-pins3 {
323 marvell,pins = "mpp48", "mpp49", "mpp50",
324 "mpp51", "mpp52", "mpp53";
325 marvell,function = "sd0";
326 };
327
328 i2c0_pins: i2c0-pins {
329 marvell,pins = "mpp2", "mpp3";
330 marvell,function = "i2c0";
331 };
332
333 i2s_pins1: i2s-pins1 {
334 marvell,pins = "mpp5", "mpp6", "mpp7",
335 "mpp8", "mpp9", "mpp10",
336 "mpp12", "mpp13";
337 marvell,function = "audio";
338 };
339
340 i2s_pins2: i2s-pins2 {
341 marvell,pins = "mpp49", "mpp47", "mpp50",
342 "mpp59", "mpp57", "mpp61",
343 "mpp62", "mpp60", "mpp58";
344 marvell,function = "audio";
345 };
346
347 mdio_pins: mdio-pins {
348 marvell,pins = "mpp17", "mpp18";
349 marvell,function = "ge";
350 };
351
352 ge0_rgmii_pins: ge0-rgmii-pins {
353 marvell,pins = "mpp5", "mpp6", "mpp7", "mpp8",
354 "mpp9", "mpp10", "mpp11", "mpp12",
355 "mpp13", "mpp14", "mpp15", "mpp16";
356 marvell,function = "ge0";
357 };
358
359 ge1_rgmii_pins: ge1-rgmii-pins {
360 marvell,pins = "mpp19", "mpp20", "mpp21", "mpp22",
361 "mpp23", "mpp24", "mpp25", "mpp26",
362 "mpp27", "mpp28", "mpp29", "mpp30";
363 marvell,function = "ge1";
364 };
365};
diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index de6571445cef..9721e55384ce 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -36,6 +36,12 @@
36 #clock-cells = <0>; 36 #clock-cells = <0>;
37 clock-frequency = <2000000000>; 37 clock-frequency = <2000000000>;
38 }; 38 };
39 /* 25 MHz reference crystal */
40 refclk: oscillator {
41 compatible = "fixed-clock";
42 #clock-cells = <0>;
43 clock-frequency = <25000000>;
44 };
39 }; 45 };
40 46
41 cpus { 47 cpus {
@@ -366,13 +372,15 @@
366 <&gic GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, 372 <&gic GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
367 <&mpic 5>, 373 <&mpic 5>,
368 <&mpic 6>; 374 <&mpic 6>;
369 clocks = <&coreclk 0>; 375 clocks = <&coreclk 0>, <&refclk>;
376 clock-names = "nbclk", "fixed";
370 }; 377 };
371 378
372 watchdog@20300 { 379 watchdog@20300 {
373 compatible = "marvell,armada-375-wdt"; 380 compatible = "marvell,armada-375-wdt";
374 reg = <0x20300 0x34>, <0x20704 0x4>, <0x18254 0x4>; 381 reg = <0x20300 0x34>, <0x20704 0x4>, <0x18254 0x4>;
375 clocks = <&coreclk 0>; 382 clocks = <&coreclk 0>, <&refclk>;
383 clock-names = "nbclk", "fixed";
376 }; 384 };
377 385
378 cpurst@20800 { 386 cpurst@20800 {
diff --git a/arch/arm/boot/dts/armada-385-db.dts b/arch/arm/boot/dts/armada-385-db.dts
index 1af886f1e486..2aaa9d2ac284 100644
--- a/arch/arm/boot/dts/armada-385-db.dts
+++ b/arch/arm/boot/dts/armada-385-db.dts
@@ -116,11 +116,11 @@
116 }; 116 };
117 117
118 sdhci@d8000 { 118 sdhci@d8000 {
119 clock-frequency = <200000000>;
120 broken-cd; 119 broken-cd;
121 wp-inverted; 120 wp-inverted;
122 bus-width = <8>; 121 bus-width = <8>;
123 status = "okay"; 122 status = "okay";
123 no-1-8-v;
124 }; 124 };
125 125
126 usb3@f0000 { 126 usb3@f0000 {
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index 242d0ecc99f3..74391dace9e7 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -25,9 +25,9 @@
25 aliases { 25 aliases {
26 gpio0 = &gpio0; 26 gpio0 = &gpio0;
27 gpio1 = &gpio1; 27 gpio1 = &gpio1;
28 eth0 = &eth0; 28 ethernet0 = &eth0;
29 eth1 = &eth1; 29 ethernet1 = &eth1;
30 eth2 = &eth2; 30 ethernet2 = &eth2;
31 }; 31 };
32 32
33 soc { 33 soc {
diff --git a/arch/arm/boot/dts/armada-xp-axpwifiap.dts b/arch/arm/boot/dts/armada-xp-axpwifiap.dts
index a55a97a70505..ca0200e20751 100644
--- a/arch/arm/boot/dts/armada-xp-axpwifiap.dts
+++ b/arch/arm/boot/dts/armada-xp-axpwifiap.dts
@@ -60,40 +60,6 @@
60 }; 60 };
61 61
62 internal-regs { 62 internal-regs {
63 pinctrl {
64 pinctrl-0 = <&pmx_phy_int>;
65 pinctrl-names = "default";
66
67 pmx_ge0: pmx-ge0 {
68 marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3",
69 "mpp4", "mpp5", "mpp6", "mpp7",
70 "mpp8", "mpp9", "mpp10", "mpp11";
71 marvell,function = "ge0";
72 };
73
74 pmx_ge1: pmx-ge1 {
75 marvell,pins = "mpp12", "mpp13", "mpp14", "mpp15",
76 "mpp16", "mpp17", "mpp18", "mpp19",
77 "mpp20", "mpp21", "mpp22", "mpp23";
78 marvell,function = "ge1";
79 };
80
81 pmx_keys: pmx-keys {
82 marvell,pins = "mpp33";
83 marvell,function = "gpio";
84 };
85
86 pmx_spi: pmx-spi {
87 marvell,pins = "mpp36", "mpp37", "mpp38", "mpp39";
88 marvell,function = "spi";
89 };
90
91 pmx_phy_int: pmx-phy-int {
92 marvell,pins = "mpp32";
93 marvell,function = "gpio";
94 };
95 };
96
97 serial@12000 { 63 serial@12000 {
98 status = "okay"; 64 status = "okay";
99 }; 65 };
@@ -118,14 +84,14 @@
118 }; 84 };
119 85
120 ethernet@70000 { 86 ethernet@70000 {
121 pinctrl-0 = <&pmx_ge0>; 87 pinctrl-0 = <&ge0_rgmii_pins>;
122 pinctrl-names = "default"; 88 pinctrl-names = "default";
123 status = "okay"; 89 status = "okay";
124 phy = <&phy0>; 90 phy = <&phy0>;
125 phy-mode = "rgmii-id"; 91 phy-mode = "rgmii-id";
126 }; 92 };
127 ethernet@74000 { 93 ethernet@74000 {
128 pinctrl-0 = <&pmx_ge1>; 94 pinctrl-0 = <&ge1_rgmii_pins>;
129 pinctrl-names = "default"; 95 pinctrl-names = "default";
130 status = "okay"; 96 status = "okay";
131 phy = <&phy1>; 97 phy = <&phy1>;
@@ -134,8 +100,6 @@
134 100
135 spi0: spi@10600 { 101 spi0: spi@10600 {
136 status = "okay"; 102 status = "okay";
137 pinctrl-0 = <&pmx_spi>;
138 pinctrl-names = "default";
139 103
140 spi-flash@0 { 104 spi-flash@0 {
141 #address-cells = <1>; 105 #address-cells = <1>;
@@ -152,7 +116,7 @@
152 compatible = "gpio-keys"; 116 compatible = "gpio-keys";
153 #address-cells = <1>; 117 #address-cells = <1>;
154 #size-cells = <0>; 118 #size-cells = <0>;
155 pinctrl-0 = <&pmx_keys>; 119 pinctrl-0 = <&keys_pin>;
156 pinctrl-names = "default"; 120 pinctrl-names = "default";
157 121
158 button@1 { 122 button@1 {
@@ -162,3 +126,18 @@
162 }; 126 };
163 }; 127 };
164}; 128};
129
130&pinctrl {
131 pinctrl-0 = <&phy_int_pin>;
132 pinctrl-names = "default";
133
134 keys_pin: keys-pin {
135 marvell,pins = "mpp33";
136 marvell,function = "gpio";
137 };
138
139 phy_int_pin: phy-int-pin {
140 marvell,pins = "mpp32";
141 marvell,function = "gpio";
142 };
143};
diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
index 0478c55ca656..ea8673647494 100644
--- a/arch/arm/boot/dts/armada-xp-gp.dts
+++ b/arch/arm/boot/dts/armada-xp-gp.dts
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25/dts-v1/; 25/dts-v1/;
26#include <dt-bindings/gpio/gpio.h>
26#include "armada-xp-mv78460.dtsi" 27#include "armada-xp-mv78460.dtsi"
27 28
28/ { 29/ {
@@ -48,6 +49,14 @@
48 <0x00000001 0x00000000 0x00000001 0x00000000>; 49 <0x00000001 0x00000000 0x00000001 0x00000000>;
49 }; 50 };
50 51
52 cpus {
53 pm_pic {
54 ctrl-gpios = <&gpio0 16 GPIO_ACTIVE_LOW>,
55 <&gpio0 17 GPIO_ACTIVE_LOW>,
56 <&gpio0 18 GPIO_ACTIVE_LOW>;
57 };
58 };
59
51 soc { 60 soc {
52 ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000 61 ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
53 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000 62 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
@@ -115,7 +124,15 @@
115 serial@12300 { 124 serial@12300 {
116 status = "okay"; 125 status = "okay";
117 }; 126 };
118 127 pinctrl {
128 pinctrl-0 = <&pic_pins>;
129 pinctrl-names = "default";
130 pic_pins: pic-pins-0 {
131 marvell,pins = "mpp16", "mpp17",
132 "mpp18";
133 marvell,function = "gpio";
134 };
135 };
119 sata@a0000 { 136 sata@a0000 {
120 nr-ports = <2>; 137 nr-ports = <2>;
121 status = "okay"; 138 status = "okay";
diff --git a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
index 469cf7137595..a2ef93c1eb10 100644
--- a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
+++ b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
@@ -22,7 +22,7 @@
22 22
23 chosen { 23 chosen {
24 bootargs = "console=ttyS0,115200 earlyprintk"; 24 bootargs = "console=ttyS0,115200 earlyprintk";
25 stdout-path = "/soc/internal-regs/serial@12000"; 25 stdout-path = &uart0;
26 }; 26 };
27 27
28 memory { 28 memory {
@@ -51,37 +51,6 @@
51 }; 51 };
52 52
53 internal-regs { 53 internal-regs {
54 pinctrl {
55 poweroff_pin: poweroff-pin {
56 marvell,pins = "mpp24";
57 marvell,function = "gpio";
58 };
59
60 power_button_pin: power-button-pin {
61 marvell,pins = "mpp44";
62 marvell,function = "gpio";
63 };
64
65 reset_button_pin: reset-button-pin {
66 marvell,pins = "mpp45";
67 marvell,function = "gpio";
68 };
69 select_button_pin: select-button-pin {
70 marvell,pins = "mpp41";
71 marvell,function = "gpio";
72 };
73
74 scroll_button_pin: scroll-button-pin {
75 marvell,pins = "mpp42";
76 marvell,function = "gpio";
77 };
78
79 hdd_led_pin: hdd-led-pin {
80 marvell,pins = "mpp26";
81 marvell,function = "gpio";
82 };
83 };
84
85 serial@12000 { 54 serial@12000 {
86 status = "okay"; 55 status = "okay";
87 }; 56 };
@@ -97,12 +66,16 @@
97 }; 66 };
98 67
99 ethernet@70000 { 68 ethernet@70000 {
69 pinctrl-0 = <&ge0_rgmii_pins>;
70 pinctrl-names = "default";
100 status = "okay"; 71 status = "okay";
101 phy = <&phy0>; 72 phy = <&phy0>;
102 phy-mode = "rgmii-id"; 73 phy-mode = "rgmii-id";
103 }; 74 };
104 75
105 ethernet@74000 { 76 ethernet@74000 {
77 pinctrl-0 = <&ge1_rgmii_pins>;
78 pinctrl-names = "default";
106 status = "okay"; 79 status = "okay";
107 phy = <&phy1>; 80 phy = <&phy1>;
108 phy-mode = "rgmii-id"; 81 phy-mode = "rgmii-id";
@@ -125,6 +98,11 @@
125 reg = <0x2e>; 98 reg = <0x2e>;
126 }; 99 };
127 100
101 eeprom@50 {
102 compatible = "atmel,24c64";
103 reg = <0x50>;
104 };
105
128 pcf8563@51 { 106 pcf8563@51 {
129 compatible = "nxp,pcf8563"; 107 compatible = "nxp,pcf8563";
130 reg = <0x51>; 108 reg = <0x51>;
@@ -226,7 +204,7 @@
226 gpio-controller; 204 gpio-controller;
227 #gpio-cells = <2>; 205 #gpio-cells = <2>;
228 reg = <0>; 206 reg = <0>;
229 registers-number = <2>; 207 registers-number = <1>;
230 spi-max-frequency = <100000>; 208 spi-max-frequency = <100000>;
231 }; 209 };
232 }; 210 };
@@ -282,3 +260,34 @@
282 gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>; 260 gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
283 }; 261 };
284}; 262};
263
264&pinctrl {
265 poweroff_pin: poweroff-pin {
266 marvell,pins = "mpp24";
267 marvell,function = "gpio";
268 };
269
270 power_button_pin: power-button-pin {
271 marvell,pins = "mpp44";
272 marvell,function = "gpio";
273 };
274
275 reset_button_pin: reset-button-pin {
276 marvell,pins = "mpp45";
277 marvell,function = "gpio";
278 };
279 select_button_pin: select-button-pin {
280 marvell,pins = "mpp41";
281 marvell,function = "gpio";
282 };
283
284 scroll_button_pin: scroll-button-pin {
285 marvell,pins = "mpp42";
286 marvell,function = "gpio";
287 };
288
289 hdd_led_pin: hdd-led-pin {
290 marvell,pins = "mpp26";
291 marvell,function = "gpio";
292 };
293};
diff --git a/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
index 2592e1c13560..281ccd24295c 100644
--- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
@@ -167,17 +167,6 @@
167 }; 167 };
168 168
169 internal-regs { 169 internal-regs {
170 pinctrl {
171 compatible = "marvell,mv78230-pinctrl";
172 reg = <0x18000 0x38>;
173
174 sdio_pins: sdio-pins {
175 marvell,pins = "mpp30", "mpp31", "mpp32",
176 "mpp33", "mpp34", "mpp35";
177 marvell,function = "sd0";
178 };
179 };
180
181 gpio0: gpio@18100 { 170 gpio0: gpio@18100 {
182 compatible = "marvell,orion-gpio"; 171 compatible = "marvell,orion-gpio";
183 reg = <0x18100 0x40>; 172 reg = <0x18100 0x40>;
@@ -202,3 +191,7 @@
202 }; 191 };
203 }; 192 };
204}; 193};
194
195&pinctrl {
196 compatible = "marvell,mv78230-pinctrl";
197};
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
index 480e237a870f..d7a8d0b0f385 100644
--- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
@@ -251,17 +251,6 @@
251 }; 251 };
252 252
253 internal-regs { 253 internal-regs {
254 pinctrl {
255 compatible = "marvell,mv78260-pinctrl";
256 reg = <0x18000 0x38>;
257
258 sdio_pins: sdio-pins {
259 marvell,pins = "mpp30", "mpp31", "mpp32",
260 "mpp33", "mpp34", "mpp35";
261 marvell,function = "sd0";
262 };
263 };
264
265 gpio0: gpio@18100 { 254 gpio0: gpio@18100 {
266 compatible = "marvell,orion-gpio"; 255 compatible = "marvell,orion-gpio";
267 reg = <0x18100 0x40>; 256 reg = <0x18100 0x40>;
@@ -305,3 +294,7 @@
305 }; 294 };
306 }; 295 };
307}; 296};
297
298&pinctrl {
299 compatible = "marvell,mv78260-pinctrl";
300};
diff --git a/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
index 2c7b1fef4703..9c40c130d11a 100644
--- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
@@ -289,17 +289,6 @@
289 }; 289 };
290 290
291 internal-regs { 291 internal-regs {
292 pinctrl {
293 compatible = "marvell,mv78460-pinctrl";
294 reg = <0x18000 0x38>;
295
296 sdio_pins: sdio-pins {
297 marvell,pins = "mpp30", "mpp31", "mpp32",
298 "mpp33", "mpp34", "mpp35";
299 marvell,function = "sd0";
300 };
301 };
302
303 gpio0: gpio@18100 { 292 gpio0: gpio@18100 {
304 compatible = "marvell,orion-gpio"; 293 compatible = "marvell,orion-gpio";
305 reg = <0x18100 0x40>; 294 reg = <0x18100 0x40>;
@@ -343,3 +332,7 @@
343 }; 332 };
344 }; 333 };
345}; 334};
335
336&pinctrl {
337 compatible = "marvell,mv78460-pinctrl";
338};
diff --git a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
index 7d8f32873e82..d81430aa4ab3 100644
--- a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
+++ b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
@@ -55,86 +55,10 @@
55 }; 55 };
56 56
57 internal-regs { 57 internal-regs {
58 pinctrl { 58 /* Two rear eSATA ports */
59 poweroff: poweroff { 59 sata@a0000 {
60 marvell,pins = "mpp42"; 60 nr-ports = <2>;
61 marvell,function = "gpio"; 61 status = "okay";
62 };
63
64 power_button_pin: power-button-pin {
65 marvell,pins = "mpp27";
66 marvell,function = "gpio";
67 };
68
69 reset_button_pin: reset-button-pin {
70 marvell,pins = "mpp41";
71 marvell,function = "gpio";
72 };
73
74 sata1_led_pin: sata1-led-pin {
75 marvell,pins = "mpp31";
76 marvell,function = "gpio";
77 };
78
79 sata2_led_pin: sata2-led-pin {
80 marvell,pins = "mpp40";
81 marvell,function = "gpio";
82 };
83
84 sata3_led_pin: sata3-led-pin {
85 marvell,pins = "mpp44";
86 marvell,function = "gpio";
87 };
88
89 sata4_led_pin: sata4-led-pin {
90 marvell,pins = "mpp47";
91 marvell,function = "gpio";
92 };
93
94 sata1_power_pin: sata1-power-pin {
95 marvell,pins = "mpp24";
96 marvell,function = "gpio";
97 };
98
99 sata2_power_pin: sata2-power-pin {
100 marvell,pins = "mpp25";
101 marvell,function = "gpio";
102 };
103
104 sata3_power_pin: sata3-power-pin {
105 marvell,pins = "mpp26";
106 marvell,function = "gpio";
107 };
108
109 sata4_power_pin: sata4-power-pin {
110 marvell,pins = "mpp28";
111 marvell,function = "gpio";
112 };
113
114 sata1_pres_pin: sata1-pres-pin {
115 marvell,pins = "mpp32";
116 marvell,function = "gpio";
117 };
118
119 sata2_pres_pin: sata2-pres-pin {
120 marvell,pins = "mpp33";
121 marvell,function = "gpio";
122 };
123
124 sata3_pres_pin: sata3-pres-pin {
125 marvell,pins = "mpp34";
126 marvell,function = "gpio";
127 };
128
129 sata4_pres_pin: sata4-pres-pin {
130 marvell,pins = "mpp35";
131 marvell,function = "gpio";
132 };
133
134 err_led_pin: err-led-pin {
135 marvell,pins = "mpp45";
136 marvell,function = "gpio";
137 };
138 }; 62 };
139 63
140 serial@12000 { 64 serial@12000 {
@@ -328,3 +252,85 @@
328 gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; 252 gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
329 }; 253 };
330}; 254};
255
256&pinctrl {
257 poweroff: poweroff {
258 marvell,pins = "mpp42";
259 marvell,function = "gpio";
260 };
261
262 power_button_pin: power-button-pin {
263 marvell,pins = "mpp27";
264 marvell,function = "gpio";
265 };
266
267 reset_button_pin: reset-button-pin {
268 marvell,pins = "mpp41";
269 marvell,function = "gpio";
270 };
271
272 sata1_led_pin: sata1-led-pin {
273 marvell,pins = "mpp31";
274 marvell,function = "gpio";
275 };
276
277 sata2_led_pin: sata2-led-pin {
278 marvell,pins = "mpp40";
279 marvell,function = "gpio";
280 };
281
282 sata3_led_pin: sata3-led-pin {
283 marvell,pins = "mpp44";
284 marvell,function = "gpio";
285 };
286
287 sata4_led_pin: sata4-led-pin {
288 marvell,pins = "mpp47";
289 marvell,function = "gpio";
290 };
291
292 sata1_power_pin: sata1-power-pin {
293 marvell,pins = "mpp24";
294 marvell,function = "gpio";
295 };
296
297 sata2_power_pin: sata2-power-pin {
298 marvell,pins = "mpp25";
299 marvell,function = "gpio";
300 };
301
302 sata3_power_pin: sata3-power-pin {
303 marvell,pins = "mpp26";
304 marvell,function = "gpio";
305 };
306
307 sata4_power_pin: sata4-power-pin {
308 marvell,pins = "mpp28";
309 marvell,function = "gpio";
310 };
311
312 sata1_pres_pin: sata1-pres-pin {
313 marvell,pins = "mpp32";
314 marvell,function = "gpio";
315 };
316
317 sata2_pres_pin: sata2-pres-pin {
318 marvell,pins = "mpp33";
319 marvell,function = "gpio";
320 };
321
322 sata3_pres_pin: sata3-pres-pin {
323 marvell,pins = "mpp34";
324 marvell,function = "gpio";
325 };
326
327 sata4_pres_pin: sata4-pres-pin {
328 marvell,pins = "mpp35";
329 marvell,function = "gpio";
330 };
331
332 err_led_pin: err-led-pin {
333 marvell,pins = "mpp45";
334 marvell,function = "gpio";
335 };
336};
diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
index 4e5a59ee1501..6f6b0916df48 100644
--- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
+++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
@@ -77,12 +77,7 @@
77 serial@12100 { 77 serial@12100 {
78 status = "okay"; 78 status = "okay";
79 }; 79 };
80 pinctrl { 80
81 led_pins: led-pins-0 {
82 marvell,pins = "mpp49", "mpp51", "mpp53";
83 marvell,function = "gpio";
84 };
85 };
86 leds { 81 leds {
87 compatible = "gpio-leds"; 82 compatible = "gpio-leds";
88 pinctrl-names = "default"; 83 pinctrl-names = "default";
@@ -187,3 +182,10 @@
187 }; 182 };
188 }; 183 };
189}; 184};
185
186&pinctrl {
187 led_pins: led-pins-0 {
188 marvell,pins = "mpp49", "mpp51", "mpp53";
189 marvell,function = "gpio";
190 };
191};
diff --git a/arch/arm/boot/dts/armada-xp-synology-ds414.dts b/arch/arm/boot/dts/armada-xp-synology-ds414.dts
new file mode 100644
index 000000000000..749fdba5a642
--- /dev/null
+++ b/arch/arm/boot/dts/armada-xp-synology-ds414.dts
@@ -0,0 +1,330 @@
1/*
2 * Device Tree file for Synology DS414
3 *
4 * Copyright (C) 2014, Arnaud EBALARD <arno@natisbad.org>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * Note: this Device Tree assumes that the bootloader has remapped the
12 * internal registers to 0xf1000000 (instead of the old 0xd0000000).
13 * The 0xf1000000 is the default used by the recent, DT-capable, U-Boot
14 * bootloaders provided by Marvell. It is used in recent versions of
15 * DSM software provided by Synology. Nonetheless, some earlier boards
16 * were delivered with an older version of u-boot that left internal
17 * registers mapped at 0xd0000000. If you have such a device you will
18 * not be able to directly boot a kernel based on this Device Tree. In
19 * that case, the preferred solution is to update your bootloader (e.g.
20 * by upgrading to latest version of DSM, or building a new one and
21 * installing it from u-boot prompt) or adjust the Devive Tree
22 * (s/0xf1000000/0xd0000000/ in 'ranges' below).
23 */
24
25/dts-v1/;
26
27#include <dt-bindings/input/input.h>
28#include <dt-bindings/gpio/gpio.h>
29#include "armada-xp-mv78230.dtsi"
30
31/ {
32 model = "Synology DS414";
33 compatible = "synology,ds414", "marvell,armadaxp-mv78230",
34 "marvell,armadaxp", "marvell,armada-370-xp";
35
36 chosen {
37 bootargs = "console=ttyS0,115200 earlyprintk";
38 stdout-path = &uart0;
39 };
40
41 memory {
42 device_type = "memory";
43 reg = <0 0x00000000 0 0x40000000>; /* 1GB */
44 };
45
46 soc {
47 ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
48 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000>;
49
50 pcie-controller {
51 status = "okay";
52
53 /*
54 * Connected to Marvell 88SX7042 SATA-II controller
55 * handling the four disks.
56 */
57 pcie@1,0 {
58 /* Port 0, Lane 0 */
59 status = "okay";
60 };
61
62 /*
63 * Connected to EtronTech EJ168A XHCI controller
64 * providing the two rear USB 3.0 ports.
65 */
66 pcie@5,0 {
67 /* Port 1, Lane 0 */
68 status = "okay";
69 };
70 };
71
72 internal-regs {
73
74 /* RTC is provided by Seiko S-35390A below */
75 rtc@10300 {
76 status = "disabled";
77 };
78
79 spi0: spi@10600 {
80 status = "okay";
81
82 spi-flash@0 {
83 #address-cells = <1>;
84 #size-cells = <1>;
85 compatible = "micron,n25q064";
86 reg = <0>; /* Chip select 0 */
87 spi-max-frequency = <20000000>;
88
89 /*
90 * Warning!
91 *
92 * Synology u-boot uses its compiled-in environment
93 * and it seems Synology did not care to change u-boot
94 * default configuration in order to allow saving a
95 * modified environment at a sensible location. So,
96 * if you do a 'saveenv' under u-boot, your modified
97 * environment will be saved at 1MB after the start
98 * of the flash, i.e. in the middle of the uImage.
99 * For that reason, it is strongly advised not to
100 * change the default environment, unless you know
101 * what you are doing.
102 */
103 partition@00000000 { /* u-boot */
104 label = "RedBoot";
105 reg = <0x00000000 0x000d0000>; /* 832KB */
106 };
107
108 partition@000c0000 { /* uImage */
109 label = "zImage";
110 reg = <0x000d0000 0x002d0000>; /* 2880KB */
111 };
112
113 partition@003a0000 { /* uInitramfs */
114 label = "rd.gz";
115 reg = <0x003a0000 0x00430000>; /* 4250KB */
116 };
117
118 partition@007d0000 { /* MAC address and serial number */
119 label = "vendor";
120 reg = <0x007d0000 0x00010000>; /* 64KB */
121 };
122
123 partition@007e0000 {
124 label = "RedBoot config";
125 reg = <0x007e0000 0x00010000>; /* 64KB */
126 };
127
128 partition@007f0000 {
129 label = "FIS directory";
130 reg = <0x007f0000 0x00010000>; /* 64KB */
131 };
132 };
133 };
134
135 i2c@11000 {
136 clock-frequency = <400000>;
137 status = "okay";
138
139 s35390a: s35390a@30 {
140 compatible = "sii,s35390a";
141 reg = <0x30>;
142 };
143 };
144
145 /* Connected to a header on device's PCB. This
146 * provides the main console for the device.
147 *
148 * Warning: the device may not boot with a 3.3V
149 * USB-serial converter connected when the power
150 * button is pressed. The converter needs to be
151 * connected a few seconds after pressing the
152 * power button. This is possibly due to UART0_TXD
153 * pin being sampled at reset (bit 0 of SAR).
154 */
155 serial@12000 {
156 status = "okay";
157 };
158
159 /* Connected to a Microchip PIC16F883 for power control */
160 serial@12100 {
161 status = "okay";
162 };
163
164 poweroff@12100 {
165 compatible = "synology,power-off";
166 reg = <0x12100 0x100>;
167 clocks = <&coreclk 0>;
168 };
169
170 /* Front USB 2.0 port */
171 usb@50000 {
172 status = "okay";
173 };
174
175 mdio {
176 phy0: ethernet-phy@0 { /* Marvell 88E1512 */
177 reg = <0>;
178 };
179
180 phy1: ethernet-phy@1 { /* Marvell 88E1512 */
181 reg = <1>;
182 };
183 };
184
185 ethernet@70000 {
186 status = "okay";
187 pinctrl-0 = <&ge0_rgmii_pins>;
188 pinctrl-names = "default";
189 phy = <&phy1>;
190 phy-mode = "rgmii-id";
191 };
192
193 ethernet@74000 {
194 pinctrl-0 = <&ge1_rgmii_pins>;
195 pinctrl-names = "default";
196 status = "okay";
197 phy = <&phy0>;
198 phy-mode = "rgmii-id";
199 };
200 };
201 };
202
203 regulators {
204 compatible = "simple-bus";
205 #address-cells = <1>;
206 #size-cells = <0>;
207 pinctrl-0 = <&sata1_pwr_pin &sata2_pwr_pin
208 &sata3_pwr_pin &sata4_pwr_pin>;
209 pinctrl-names = "default";
210
211 sata1_regulator: sata1-regulator {
212 compatible = "regulator-fixed";
213 reg = <1>;
214 regulator-name = "SATA1 Power";
215 regulator-min-microvolt = <5000000>;
216 regulator-max-microvolt = <5000000>;
217 startup-delay-us = <2000000>;
218 enable-active-high;
219 regulator-always-on;
220 regulator-boot-on;
221 gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
222 };
223
224 sata2_regulator: sata2-regulator {
225 compatible = "regulator-fixed";
226 reg = <2>;
227 regulator-name = "SATA2 Power";
228 regulator-min-microvolt = <5000000>;
229 regulator-max-microvolt = <5000000>;
230 startup-delay-us = <4000000>;
231 enable-active-high;
232 regulator-always-on;
233 regulator-boot-on;
234 gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
235 };
236
237 sata3_regulator: sata3-regulator {
238 compatible = "regulator-fixed";
239 reg = <3>;
240 regulator-name = "SATA3 Power";
241 regulator-min-microvolt = <5000000>;
242 regulator-max-microvolt = <5000000>;
243 startup-delay-us = <6000000>;
244 enable-active-high;
245 regulator-always-on;
246 regulator-boot-on;
247 gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
248 };
249
250 sata4_regulator: sata4-regulator {
251 compatible = "regulator-fixed";
252 reg = <4>;
253 regulator-name = "SATA4 Power";
254 regulator-min-microvolt = <5000000>;
255 regulator-max-microvolt = <5000000>;
256 startup-delay-us = <8000000>;
257 enable-active-high;
258 regulator-always-on;
259 regulator-boot-on;
260 gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
261 };
262 };
263};
264
265&pinctrl {
266 sata1_pwr_pin: sata1-pwr-pin {
267 marvell,pins = "mpp42";
268 marvell,function = "gpio";
269 };
270
271 sata2_pwr_pin: sata2-pwr-pin {
272 marvell,pins = "mpp44";
273 marvell,function = "gpio";
274 };
275
276 sata3_pwr_pin: sata3-pwr-pin {
277 marvell,pins = "mpp45";
278 marvell,function = "gpio";
279 };
280
281 sata4_pwr_pin: sata4-pwr-pin {
282 marvell,pins = "mpp46";
283 marvell,function = "gpio";
284 };
285
286 sata1_pres_pin: sata1-pres-pin {
287 marvell,pins = "mpp34";
288 marvell,function = "gpio";
289 };
290
291 sata2_pres_pin: sata2-pres-pin {
292 marvell,pins = "mpp35";
293 marvell,function = "gpio";
294 };
295
296 sata3_pres_pin: sata3-pres-pin {
297 marvell,pins = "mpp40";
298 marvell,function = "gpio";
299 };
300
301 sata4_pres_pin: sata4-pres-pin {
302 marvell,pins = "mpp41";
303 marvell,function = "gpio";
304 };
305
306 syno_id_bit0_pin: syno-id-bit0-pin {
307 marvell,pins = "mpp26";
308 marvell,function = "gpio";
309 };
310
311 syno_id_bit1_pin: syno-id-bit1-pin {
312 marvell,pins = "mpp28";
313 marvell,function = "gpio";
314 };
315
316 syno_id_bit2_pin: syno-id-bit2-pin {
317 marvell,pins = "mpp29";
318 marvell,function = "gpio";
319 };
320
321 fan1_alarm_pin: fan1-alarm-pin {
322 marvell,pins = "mpp33";
323 marvell,function = "gpio";
324 };
325
326 fan2_alarm_pin: fan2-alarm-pin {
327 marvell,pins = "mpp32";
328 marvell,function = "gpio";
329 };
330};
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index bff9f6c18db1..62c3ba958b39 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -35,13 +35,24 @@
35 }; 35 };
36 36
37 internal-regs { 37 internal-regs {
38 sdramc@1400 {
39 compatible = "marvell,armada-xp-sdram-controller";
40 reg = <0x1400 0x500>;
41 };
42
38 L2: l2-cache { 43 L2: l2-cache {
39 compatible = "marvell,aurora-system-cache"; 44 compatible = "marvell,aurora-system-cache";
40 reg = <0x08000 0x1000>; 45 reg = <0x08000 0x1000>;
41 cache-id-part = <0x100>; 46 cache-id-part = <0x100>;
47 cache-unified;
42 wt-override; 48 wt-override;
43 }; 49 };
44 50
51 spi0: spi@10600 {
52 pinctrl-0 = <&spi0_pins>;
53 pinctrl-names = "default";
54 };
55
45 i2c0: i2c@11000 { 56 i2c0: i2c@11000 {
46 compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c"; 57 compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
47 reg = <0x11000 0x100>; 58 reg = <0x11000 0x100>;
@@ -52,8 +63,10 @@
52 reg = <0x11100 0x100>; 63 reg = <0x11100 0x100>;
53 }; 64 };
54 65
55 serial@12200 { 66 uart2: serial@12200 {
56 compatible = "snps,dw-apb-uart"; 67 compatible = "snps,dw-apb-uart";
68 pinctrl-0 = <&uart2_pins>;
69 pinctrl-names = "default";
57 reg = <0x12200 0x100>; 70 reg = <0x12200 0x100>;
58 reg-shift = <2>; 71 reg-shift = <2>;
59 interrupts = <43>; 72 interrupts = <43>;
@@ -61,8 +74,11 @@
61 clocks = <&coreclk 0>; 74 clocks = <&coreclk 0>;
62 status = "disabled"; 75 status = "disabled";
63 }; 76 };
64 serial@12300 { 77
78 uart3: serial@12300 {
65 compatible = "snps,dw-apb-uart"; 79 compatible = "snps,dw-apb-uart";
80 pinctrl-0 = <&uart3_pins>;
81 pinctrl-names = "default";
66 reg = <0x12300 0x100>; 82 reg = <0x12300 0x100>;
67 reg-shift = <2>; 83 reg-shift = <2>;
68 interrupts = <44>; 84 interrupts = <44>;
@@ -199,3 +215,54 @@
199 }; 215 };
200 }; 216 };
201}; 217};
218
219&pinctrl {
220 ge0_gmii_pins: ge0-gmii-pins {
221 marvell,pins =
222 "mpp0", "mpp1", "mpp2", "mpp3",
223 "mpp4", "mpp5", "mpp6", "mpp7",
224 "mpp8", "mpp9", "mpp10", "mpp11",
225 "mpp12", "mpp13", "mpp14", "mpp15",
226 "mpp16", "mpp17", "mpp18", "mpp19",
227 "mpp20", "mpp21", "mpp22", "mpp23";
228 marvell,function = "ge0";
229 };
230
231 ge0_rgmii_pins: ge0-rgmii-pins {
232 marvell,pins =
233 "mpp0", "mpp1", "mpp2", "mpp3",
234 "mpp4", "mpp5", "mpp6", "mpp7",
235 "mpp8", "mpp9", "mpp10", "mpp11";
236 marvell,function = "ge0";
237 };
238
239 ge1_rgmii_pins: ge1-rgmii-pins {
240 marvell,pins =
241 "mpp12", "mpp13", "mpp14", "mpp15",
242 "mpp16", "mpp17", "mpp18", "mpp19",
243 "mpp20", "mpp21", "mpp22", "mpp23";
244 marvell,function = "ge1";
245 };
246
247 sdio_pins: sdio-pins {
248 marvell,pins = "mpp30", "mpp31", "mpp32",
249 "mpp33", "mpp34", "mpp35";
250 marvell,function = "sd0";
251 };
252
253 spi0_pins: spi0-pins {
254 marvell,pins = "mpp36", "mpp37",
255 "mpp38", "mpp39";
256 marvell,function = "spi";
257 };
258
259 uart2_pins: uart2-pins {
260 marvell,pins = "mpp42", "mpp43";
261 marvell,function = "uart2";
262 };
263
264 uart3_pins: uart3-pins {
265 marvell,pins = "mpp44", "mpp45";
266 marvell,function = "uart3";
267 };
268};
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 51416c7d0625..653e4395b7cb 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -677,6 +677,14 @@
677 }; 677 };
678 }; 678 };
679 679
680 can {
681 pinctrl_can_rx_tx: can_rx_tx {
682 atmel,pins =
683 <AT91_PIOA 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* CANRX, conflicts with IRQ0 */
684 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* CANTX, conflicts with PCK0 */
685 };
686 };
687
680 pioA: gpio@fffff200 { 688 pioA: gpio@fffff200 {
681 compatible = "atmel,at91rm9200-gpio"; 689 compatible = "atmel,at91rm9200-gpio";
682 reg = <0xfffff200 0x200>; 690 reg = <0xfffff200 0x200>;
@@ -905,6 +913,17 @@
905 clock-names = "pwm_clk"; 913 clock-names = "pwm_clk";
906 status = "disabled"; 914 status = "disabled";
907 }; 915 };
916
917 can: can@fffac000 {
918 compatible = "atmel,at91sam9263-can";
919 reg = <0xfffac000 0x300>;
920 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 3>;
921 pinctrl-names = "default";
922 pinctrl-0 = <&pinctrl_can_rx_tx>;
923 clocks = <&can_clk>;
924 clock-names = "can_clk";
925 status = "disabled";
926 };
908 }; 927 };
909 928
910 fb0: fb@0x00700000 { 929 fb0: fb@0x00700000 {
diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi b/arch/arm/boot/dts/at91sam9x25.dtsi
index c2554219f7a4..3c5fa3388997 100644
--- a/arch/arm/boot/dts/at91sam9x25.dtsi
+++ b/arch/arm/boot/dts/at91sam9x25.dtsi
@@ -10,6 +10,7 @@
10#include "at91sam9x5_usart3.dtsi" 10#include "at91sam9x5_usart3.dtsi"
11#include "at91sam9x5_macb0.dtsi" 11#include "at91sam9x5_macb0.dtsi"
12#include "at91sam9x5_macb1.dtsi" 12#include "at91sam9x5_macb1.dtsi"
13#include "at91sam9x5_can.dtsi"
13 14
14/ { 15/ {
15 model = "Atmel AT91SAM9X25 SoC"; 16 model = "Atmel AT91SAM9X25 SoC";
diff --git a/arch/arm/boot/dts/at91sam9x35.dtsi b/arch/arm/boot/dts/at91sam9x35.dtsi
index 8eac66ce0ab7..499cdc81f4c0 100644
--- a/arch/arm/boot/dts/at91sam9x35.dtsi
+++ b/arch/arm/boot/dts/at91sam9x35.dtsi
@@ -8,6 +8,7 @@
8 8
9#include "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10#include "at91sam9x5_macb0.dtsi" 10#include "at91sam9x5_macb0.dtsi"
11#include "at91sam9x5_can.dtsi"
11 12
12/ { 13/ {
13 model = "Atmel AT91SAM9X35 SoC"; 14 model = "Atmel AT91SAM9X35 SoC";
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 726274f7959b..bbb3ba65165f 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -860,6 +860,9 @@
860 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 860 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
861 pinctrl-names = "default"; 861 pinctrl-names = "default";
862 pinctrl-0 = <&pinctrl_dbgu>; 862 pinctrl-0 = <&pinctrl_dbgu>;
863 dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(8)>,
864 <&dma1 1 (AT91_DMA_CFG_PER_ID(9) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
865 dma-names = "tx", "rx";
863 clocks = <&mck>; 866 clocks = <&mck>;
864 clock-names = "usart"; 867 clock-names = "usart";
865 status = "disabled"; 868 status = "disabled";
@@ -871,6 +874,9 @@
871 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 5>; 874 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 5>;
872 pinctrl-names = "default"; 875 pinctrl-names = "default";
873 pinctrl-0 = <&pinctrl_usart0>; 876 pinctrl-0 = <&pinctrl_usart0>;
877 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(3)>,
878 <&dma0 1 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
879 dma-names = "tx", "rx";
874 clocks = <&usart0_clk>; 880 clocks = <&usart0_clk>;
875 clock-names = "usart"; 881 clock-names = "usart";
876 status = "disabled"; 882 status = "disabled";
@@ -882,6 +888,9 @@
882 interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>; 888 interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>;
883 pinctrl-names = "default"; 889 pinctrl-names = "default";
884 pinctrl-0 = <&pinctrl_usart1>; 890 pinctrl-0 = <&pinctrl_usart1>;
891 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(5)>,
892 <&dma0 1 (AT91_DMA_CFG_PER_ID(6) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
893 dma-names = "tx", "rx";
885 clocks = <&usart1_clk>; 894 clocks = <&usart1_clk>;
886 clock-names = "usart"; 895 clock-names = "usart";
887 status = "disabled"; 896 status = "disabled";
@@ -893,6 +902,9 @@
893 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>; 902 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
894 pinctrl-names = "default"; 903 pinctrl-names = "default";
895 pinctrl-0 = <&pinctrl_usart2>; 904 pinctrl-0 = <&pinctrl_usart2>;
905 dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(12)>,
906 <&dma1 1 (AT91_DMA_CFG_PER_ID(13) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
907 dma-names = "tx", "rx";
896 clocks = <&usart2_clk>; 908 clocks = <&usart2_clk>;
897 clock-names = "usart"; 909 clock-names = "usart";
898 status = "disabled"; 910 status = "disabled";
diff --git a/arch/arm/boot/dts/at91sam9x5_can.dtsi b/arch/arm/boot/dts/at91sam9x5_can.dtsi
index f44ab7702a12..8eb2f9c1b978 100644
--- a/arch/arm/boot/dts/at91sam9x5_can.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5_can.dtsi
@@ -1,5 +1,5 @@
1/* 1/*
2 * at91sam9x5_macb0.dtsi - Device Tree Include file for AT91SAM9x5 SoC with 1 2 * at91sam9x5_can.dtsi - Device Tree Include file for AT91SAM9x5 SoC with 1
3 * Ethernet interface. 3 * Ethernet interface.
4 * 4 *
5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 5 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
@@ -20,10 +20,50 @@
20 reg = <29>; 20 reg = <29>;
21 }; 21 };
22 22
23 can1_clk: can1_clk { 23 can1_clk: can1_clk {
24 #clock-cells = <0>; 24 #clock-cells = <0>;
25 reg = <30>; 25 reg = <30>;
26 }; 26 };
27 };
28 };
29
30 can0: can@f8000000 {
31 compatible = "atmel,at91sam9x5-can";
32 reg = <0xf8000000 0x300>;
33 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 3>;
34 pinctrl-names = "default";
35 pinctrl-0 = <&pinctrl_can0_rx_tx>;
36 clocks = <&can0_clk>;
37 clock-names = "can_clk";
38 status = "disabled";
39 };
40
41 can1: can@f8004000 {
42 compatible = "atmel,at91sam9x5-can";
43 reg = <0xf8004000 0x300>;
44 interrupts = <30 IRQ_TYPE_LEVEL_HIGH 3>;
45 pinctrl-names = "default";
46 pinctrl-0 = <&pinctrl_can1_rx_tx>;
47 clocks = <&can1_clk>;
48 clock-names = "can_clk";
49 status = "disabled";
50 };
51
52 pinctrl@fffff400 {
53 can0 {
54 pinctrl_can0_rx_tx: can0_rx_tx {
55 atmel,pins =
56 <AT91_PIOA 9 AT91_PERIPH_B AT91_PINCTRL_NONE /* CANRX0, conflicts with DRXD */
57 AT91_PIOA 10 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* CANTX0, conflicts with DTXD */
58 };
59 };
60
61 can1 {
62 pinctrl_can1_rx_tx: can1_rx_tx {
63 atmel,pins =
64 <AT91_PIOA 6 AT91_PERIPH_B AT91_PINCTRL_NONE /* CANRX1, conflicts with RXD1 */
65 AT91_PIOA 5 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* CANTX1, conflicts with TXD1 */
66 };
27 }; 67 };
28 }; 68 };
29 }; 69 };
diff --git a/arch/arm/boot/dts/at91sam9x5_usart3.dtsi b/arch/arm/boot/dts/at91sam9x5_usart3.dtsi
index 140217a54384..43bb5b51caa6 100644
--- a/arch/arm/boot/dts/at91sam9x5_usart3.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5_usart3.dtsi
@@ -57,6 +57,9 @@
57 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>; 57 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
58 pinctrl-names = "default"; 58 pinctrl-names = "default";
59 pinctrl-0 = <&pinctrl_usart3>; 59 pinctrl-0 = <&pinctrl_usart3>;
60 dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(14)>,
61 <&dma1 1 (AT91_DMA_CFG_PER_ID(15) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
62 dma-names = "tx", "rx";
60 clocks = <&usart3_clk>; 63 clocks = <&usart3_clk>;
61 clock-names = "usart"; 64 clock-names = "usart";
62 status = "disabled"; 65 status = "disabled";
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi
index bb22842a0826..29598667420b 100644
--- a/arch/arm/boot/dts/atlas6.dtsi
+++ b/arch/arm/boot/dts/atlas6.dtsi
@@ -131,6 +131,7 @@
131 reg = <0x90020000 0x10000>; 131 reg = <0x90020000 0x10000>;
132 interrupts = <31>; 132 interrupts = <31>;
133 clocks = <&clks 35>; 133 clocks = <&clks 35>;
134 resets = <&rstc 6>;
134 }; 135 };
135 }; 136 };
136 137
@@ -312,6 +313,7 @@
312 #address-cells = <1>; 313 #address-cells = <1>;
313 #size-cells = <0>; 314 #size-cells = <0>;
314 clocks = <&clks 19>; 315 clocks = <&clks 19>;
316 resets = <&rstc 26>;
315 status = "disabled"; 317 status = "disabled";
316 }; 318 };
317 319
@@ -327,6 +329,7 @@
327 #address-cells = <1>; 329 #address-cells = <1>;
328 #size-cells = <0>; 330 #size-cells = <0>;
329 clocks = <&clks 20>; 331 clocks = <&clks 20>;
332 resets = <&rstc 27>;
330 status = "disabled"; 333 status = "disabled";
331 }; 334 };
332 335
@@ -522,6 +525,18 @@
522 sirf,function = "sdmmc5"; 525 sirf,function = "sdmmc5";
523 }; 526 };
524 }; 527 };
528 i2s_mclk_pins_a: i2s_mclk@0 {
529 i2s_mclk {
530 sirf,pins = "i2smclkgrp";
531 sirf,function = "i2s_mclk";
532 };
533 };
534 i2s_ext_clk_input_pins_a: i2s_ext_clk_input@0 {
535 i2s_ext_clk_input {
536 sirf,pins = "i2s_ext_clk_inputgrp";
537 sirf,function = "i2s_ext_clk_input";
538 };
539 };
525 i2s_pins_a: i2s@0 { 540 i2s_pins_a: i2s@0 {
526 i2s { 541 i2s {
527 sirf,pins = "i2sgrp"; 542 sirf,pins = "i2sgrp";
diff --git a/arch/arm/boot/dts/bcm-cygnus-clock.dtsi b/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
new file mode 100644
index 000000000000..60d8389fdb6c
--- /dev/null
+++ b/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
@@ -0,0 +1,91 @@
1/*
2 * BSD LICENSE
3 *
4 * Copyright(c) 2014 Broadcom Corporation. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Broadcom Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33clocks {
34 #address-cells = <1>;
35 #size-cells = <1>;
36 ranges;
37
38 osc: oscillator {
39 compatible = "fixed-clock";
40 #clock-cells = <1>;
41 clock-frequency = <25000000>;
42 };
43
44 apb_clk: apb_clk {
45 compatible = "fixed-clock";
46 #clock-cells = <0>;
47 clock-frequency = <1000000000>;
48 };
49
50 periph_clk: periph_clk {
51 compatible = "fixed-clock";
52 #clock-cells = <0>;
53 clock-frequency = <500000000>;
54 };
55
56 sdio_clk: lcpll_ch2 {
57 compatible = "fixed-clock";
58 #clock-cells = <0>;
59 clock-frequency = <200000000>;
60 };
61
62 axi81_clk: axi81_clk {
63 compatible = "fixed-clock";
64 #clock-cells = <0>;
65 clock-frequency = <100000000>;
66 };
67
68 keypad_clk: keypad_clk {
69 compatible = "fixed-clock";
70 #clock-cells = <0>;
71 clock-frequency = <31806>;
72 };
73
74 adc_clk: adc_clk {
75 compatible = "fixed-clock";
76 #clock-cells = <0>;
77 clock-frequency = <1562500>;
78 };
79
80 pwm_clk: pwm_clk {
81 compatible = "fixed-clock";
82 #clock-cells = <0>;
83 clock-frequency = <1000000>;
84 };
85
86 lcd_clk: mipipll_ch1 {
87 compatible = "fixed-clock";
88 #clock-cells = <0>;
89 clock-frequency = <100000000>;
90 };
91};
diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi b/arch/arm/boot/dts/bcm-cygnus.dtsi
new file mode 100644
index 000000000000..5126f9e77a98
--- /dev/null
+++ b/arch/arm/boot/dts/bcm-cygnus.dtsi
@@ -0,0 +1,140 @@
1/*
2 * BSD LICENSE
3 *
4 * Copyright(c) 2014 Broadcom Corporation. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Broadcom Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <dt-bindings/interrupt-controller/arm-gic.h>
34#include <dt-bindings/interrupt-controller/irq.h>
35
36#include "skeleton.dtsi"
37
38/ {
39 compatible = "brcm,cygnus";
40 model = "Broadcom Cygnus SoC";
41 interrupt-parent = <&gic>;
42
43 cpus {
44 #address-cells = <1>;
45 #size-cells = <0>;
46
47 cpu@0 {
48 device_type = "cpu";
49 compatible = "arm,cortex-a9";
50 next-level-cache = <&L2>;
51 reg = <0x0>;
52 };
53 };
54
55 /include/ "bcm-cygnus-clock.dtsi"
56
57 amba {
58 #address-cells = <1>;
59 #size-cells = <1>;
60 compatible = "arm,amba-bus", "simple-bus";
61 interrupt-parent = <&gic>;
62 ranges;
63
64 wdt@18009000 {
65 compatible = "arm,sp805" , "arm,primecell";
66 reg = <0x18009000 0x1000>;
67 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
68 clocks = <&axi81_clk>;
69 clock-names = "apb_pclk";
70 };
71 };
72
73 uart0: serial@18020000 {
74 compatible = "snps,dw-apb-uart";
75 reg = <0x18020000 0x100>;
76 reg-shift = <2>;
77 reg-io-width = <4>;
78 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
79 clocks = <&axi81_clk>;
80 clock-frequency = <100000000>;
81 status = "disabled";
82 };
83
84 uart1: serial@18021000 {
85 compatible = "snps,dw-apb-uart";
86 reg = <0x18021000 0x100>;
87 reg-shift = <2>;
88 reg-io-width = <4>;
89 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
90 clocks = <&axi81_clk>;
91 clock-frequency = <100000000>;
92 status = "disabled";
93 };
94
95 uart2: serial@18022000 {
96 compatible = "snps,dw-apb-uart";
97 reg = <0x18020000 0x100>;
98 reg-shift = <2>;
99 reg-io-width = <4>;
100 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
101 clocks = <&axi81_clk>;
102 clock-frequency = <100000000>;
103 status = "disabled";
104 };
105
106 uart3: serial@18023000 {
107 compatible = "snps,dw-apb-uart";
108 reg = <0x18023000 0x100>;
109 reg-shift = <2>;
110 reg-io-width = <4>;
111 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
112 clocks = <&axi81_clk>;
113 clock-frequency = <100000000>;
114 status = "disabled";
115 };
116
117 gic: interrupt-controller@19021000 {
118 compatible = "arm,cortex-a9-gic";
119 #interrupt-cells = <3>;
120 #address-cells = <0>;
121 interrupt-controller;
122 reg = <0x19021000 0x1000>,
123 <0x19020100 0x100>;
124 };
125
126 L2: l2-cache {
127 compatible = "arm,pl310-cache";
128 reg = <0x19022000 0x1000>;
129 cache-unified;
130 cache-level = <2>;
131 };
132
133 timer@19020200 {
134 compatible = "arm,cortex-a9-global-timer";
135 reg = <0x19020200 0x100>;
136 interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
137 clocks = <&periph_clk>;
138 };
139
140};
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
new file mode 100644
index 000000000000..e479515099c3
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -0,0 +1,30 @@
1/dts-v1/;
2/include/ "bcm2835-rpi.dtsi"
3
4/ {
5 compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
6 model = "Raspberry Pi Model B+";
7
8 leds {
9 act {
10 gpios = <&gpio 47 0>;
11 };
12
13 pwr {
14 label = "PWR";
15 gpios = <&gpio 35 0>;
16 default-state = "keep";
17 linux,default-trigger = "default-on";
18 };
19 };
20};
21
22&gpio {
23 pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>;
24
25 /* I2S interface */
26 i2s_alt0: i2s_alt0 {
27 brcm,pins = <18 19 20 21>;
28 brcm,function = <4>; /* alt0 */
29 };
30};
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index 58a0d60b95f1..bafa46fc226a 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -1,63 +1,23 @@
1/dts-v1/; 1/dts-v1/;
2/include/ "bcm2835.dtsi" 2/include/ "bcm2835-rpi.dtsi"
3 3
4/ { 4/ {
5 compatible = "raspberrypi,model-b", "brcm,bcm2835"; 5 compatible = "raspberrypi,model-b", "brcm,bcm2835";
6 model = "Raspberry Pi Model B"; 6 model = "Raspberry Pi Model B";
7 7
8 memory {
9 reg = <0 0x10000000>;
10 };
11
12 leds { 8 leds {
13 compatible = "gpio-leds";
14
15 act { 9 act {
16 label = "ACT";
17 gpios = <&gpio 16 1>; 10 gpios = <&gpio 16 1>;
18 default-state = "keep";
19 linux,default-trigger = "heartbeat";
20 }; 11 };
21 }; 12 };
22}; 13};
23 14
24&gpio { 15&gpio {
25 pinctrl-names = "default"; 16 pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>;
26 pinctrl-0 = <&gpioout &alt0 &alt2 &alt3>;
27
28 gpioout: gpioout {
29 brcm,pins = <6>;
30 brcm,function = <1>; /* GPIO out */
31 };
32
33 alt0: alt0 {
34 brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
35 brcm,function = <4>; /* alt0 */
36 };
37
38 alt3: alt3 {
39 brcm,pins = <48 49 50 51 52 53>;
40 brcm,function = <7>; /* alt3 */
41 };
42 17
43 /* I2S interface */ 18 /* I2S interface */
44 alt2: alt2 { 19 i2s_alt2: i2s_alt2 {
45 brcm,pins = <28 29 30 31>; 20 brcm,pins = <28 29 30 31>;
46 brcm,function = <6>; /* alt2 */ 21 brcm,function = <6>; /* alt2 */
47 }; 22 };
48}; 23};
49
50&i2c0 {
51 status = "okay";
52 clock-frequency = <100000>;
53};
54
55&i2c1 {
56 status = "okay";
57 clock-frequency = <100000>;
58};
59
60&sdhci {
61 status = "okay";
62 bus-width = <4>;
63};
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
new file mode 100644
index 000000000000..c7064487017d
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -0,0 +1,51 @@
1/include/ "bcm2835.dtsi"
2
3/ {
4 memory {
5 reg = <0 0x10000000>;
6 };
7
8 leds {
9 compatible = "gpio-leds";
10
11 act {
12 label = "ACT";
13 default-state = "keep";
14 linux,default-trigger = "heartbeat";
15 };
16 };
17};
18
19&gpio {
20 pinctrl-names = "default";
21
22 gpioout: gpioout {
23 brcm,pins = <6>;
24 brcm,function = <1>; /* GPIO out */
25 };
26
27 alt0: alt0 {
28 brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
29 brcm,function = <4>; /* alt0 */
30 };
31
32 alt3: alt3 {
33 brcm,pins = <48 49 50 51 52 53>;
34 brcm,function = <7>; /* alt3 */
35 };
36};
37
38&i2c0 {
39 status = "okay";
40 clock-frequency = <100000>;
41};
42
43&i2c1 {
44 status = "okay";
45 clock-frequency = <100000>;
46};
47
48&sdhci {
49 status = "okay";
50 bus-width = <4>;
51};
diff --git a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts
new file mode 100644
index 000000000000..5fc0fae03092
--- /dev/null
+++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts
@@ -0,0 +1,64 @@
1/*
2 * Broadcom BCM470X / BCM5301X ARM platform code.
3 * DTS for Buffalo WZR-1750DHP
4 *
5 * Copyright (C) 2014 Rafał Miłecki <zajec5@gmail.com>
6 *
7 * Licensed under the GNU/GPL. See COPYING for details.
8 */
9
10/dts-v1/;
11
12#include "bcm4708.dtsi"
13
14/ {
15 compatible = "buffalo,wzr-1750dhp", "brcm,bcm4708";
16 model = "Buffalo WZR-1750DHP (BCM4708)";
17
18 chosen {
19 bootargs = "console=ttyS0,115200";
20 };
21
22 memory {
23 reg = <0x00000000 0x08000000>;
24 };
25
26 gpio-keys {
27 compatible = "gpio-keys";
28 #address-cells = <1>;
29 #size-cells = <0>;
30 poll-interval = <200>;
31
32 restart {
33 label = "Reset";
34 linux,code = <KEY_RESTART>;
35 gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
36 };
37
38 aoss {
39 label = "AOSS";
40 linux,code = <KEY_WPS_BUTTON>;
41 gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>;
42 };
43
44 /* Commit mode set by switch? */
45 mode {
46 label = "Mode";
47 linux,code = <KEY_SETUP>;
48 gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>;
49 };
50
51 /* Switch: AP mode */
52 sw_ap {
53 label = "AP";
54 linux,code = <BTN_0>;
55 gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
56 };
57
58 eject {
59 label = "USB eject";
60 linux,code = <KEY_EJECTCD>;
61 gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>;
62 };
63 };
64};
diff --git a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts
index 3b5259de5a38..4ed7de1058b7 100644
--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts
+++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts
@@ -32,4 +32,63 @@
32 status = "okay"; 32 status = "okay";
33 }; 33 };
34 }; 34 };
35
36 leds {
37 compatible = "gpio-leds";
38
39 logo {
40 label = "bcm53xx:white:logo";
41 gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>;
42 linux,default-trigger = "default-on";
43 };
44
45 power0 {
46 label = "bcm53xx:green:power";
47 gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>;
48 linux,default-trigger = "default-off";
49 };
50
51 power1 {
52 label = "bcm53xx:amber:power";
53 gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
54 linux,default-trigger = "default-on";
55 };
56
57 usb {
58 label = "bcm53xx:blue:usb";
59 gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>;
60 linux,default-trigger = "default-off";
61 };
62
63 wireless {
64 label = "bcm53xx:blue:wireless";
65 gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
66 linux,default-trigger = "default-off";
67 };
68 };
69
70 gpio-keys {
71 compatible = "gpio-keys";
72 #address-cells = <1>;
73 #size-cells = <0>;
74 poll-interval = <200>;
75
76 wps {
77 label = "WPS";
78 linux,code = <KEY_WPS_BUTTON>;
79 gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>;
80 };
81
82 rfkill {
83 label = "WiFi";
84 linux,code = <KEY_RFKILL>;
85 gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>;
86 };
87
88 restart {
89 label = "Reset";
90 linux,code = <KEY_RESTART>;
91 gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>;
92 };
93 };
35}; 94};
diff --git a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts
new file mode 100644
index 000000000000..12fc2a01e6ab
--- /dev/null
+++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts
@@ -0,0 +1,84 @@
1/*
2 * Broadcom BCM470X / BCM5301X ARM platform code.
3 * DTS for Netgear R6300 V2
4 *
5 * Copyright (C) 2014 Rafał Miłecki <zajec5@gmail.com>
6 *
7 * Licensed under the GNU/GPL. See COPYING for details.
8 */
9
10/dts-v1/;
11
12#include "bcm4708.dtsi"
13
14/ {
15 compatible = "netgear,r6300v2", "brcm,bcm4708";
16 model = "Netgear R6300 V2 (BCM4708)";
17
18 chosen {
19 bootargs = "console=ttyS0,115200";
20 };
21
22 memory {
23 reg = <0x00000000 0x08000000>;
24 };
25
26 leds {
27 compatible = "gpio-leds";
28
29 logo {
30 label = "bcm53xx:white:logo";
31 gpios = <&chipcommon 1 GPIO_ACTIVE_HIGH>;
32 linux,default-trigger = "default-on";
33 };
34
35 power0 {
36 label = "bcm53xx:green:power";
37 gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>;
38 linux,default-trigger = "default-off";
39 };
40
41 power1 {
42 label = "bcm53xx:amber:power";
43 gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
44 linux,default-trigger = "default-on";
45 };
46
47 usb {
48 label = "bcm53xx:blue:usb";
49 gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>;
50 linux,default-trigger = "default-off";
51 };
52
53 wireless {
54 label = "bcm53xx:blue:wireless";
55 gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
56 linux,default-trigger = "default-off";
57 };
58 };
59
60 gpio-keys {
61 compatible = "gpio-keys";
62 #address-cells = <1>;
63 #size-cells = <0>;
64 poll-interval = <200>;
65
66 wps {
67 label = "WPS";
68 linux,code = <KEY_WPS_BUTTON>;
69 gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>;
70 };
71
72 rfkill {
73 label = "WiFi";
74 linux,code = <KEY_RFKILL>;
75 gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>;
76 };
77
78 restart {
79 label = "Reset";
80 linux,code = <KEY_RESTART>;
81 gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>;
82 };
83 };
84};
diff --git a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts
new file mode 100644
index 000000000000..fb76378bd511
--- /dev/null
+++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts
@@ -0,0 +1,78 @@
1/*
2 * Broadcom BCM470X / BCM5301X ARM platform code.
3 * DTS for Asus RT-N18U
4 *
5 * Copyright (C) 2014 Rafał Miłecki <zajec5@gmail.com>
6 *
7 * Licensed under the GNU/GPL. See COPYING for details.
8 */
9
10/dts-v1/;
11
12#include "bcm47081.dtsi"
13
14/ {
15 compatible = "asus,rt-n18u", "brcm,bcm47081", "brcm,bcm4708";
16 model = "Asus RT-N18U (BCM47081)";
17
18 chosen {
19 bootargs = "console=ttyS0,115200";
20 };
21
22 memory {
23 reg = <0x00000000 0x08000000>;
24 };
25
26 leds {
27 compatible = "gpio-leds";
28
29 power {
30 label = "bcm53xx:blue:power";
31 gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>;
32 linux,default-trigger = "default-on";
33 };
34
35 usb2 {
36 label = "bcm53xx:blue:usb2";
37 gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>;
38 linux,default-trigger = "default-off";
39 };
40
41 wan {
42 label = "bcm53xx:blue:wan";
43 gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>;
44 linux,default-trigger = "default-on";
45 };
46
47 lan {
48 label = "bcm53xx:blue:lan";
49 gpios = <&chipcommon 9 GPIO_ACTIVE_LOW>;
50 linux,default-trigger = "default-on";
51 };
52
53 usb3 {
54 label = "bcm53xx:blue:usb3";
55 gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
56 linux,default-trigger = "default-off";
57 };
58 };
59
60 gpio-keys {
61 compatible = "gpio-keys";
62 #address-cells = <1>;
63 #size-cells = <0>;
64 poll-interval = <200>;
65
66 restart {
67 label = "Reset";
68 linux,code = <KEY_RESTART>;
69 gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>;
70 };
71
72 wps {
73 label = "WPS";
74 linux,code = <KEY_WPS_BUTTON>;
75 gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
76 };
77 };
78};
diff --git a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts
new file mode 100644
index 000000000000..bbb414fbad65
--- /dev/null
+++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts
@@ -0,0 +1,57 @@
1/*
2 * Broadcom BCM470X / BCM5301X ARM platform code.
3 * DTS for Buffalo WZR-600DHP2
4 *
5 * Copyright (C) 2014 Rafał Miłecki <zajec5@gmail.com>
6 *
7 * Licensed under the GNU/GPL. See COPYING for details.
8 */
9
10/dts-v1/;
11
12#include "bcm47081.dtsi"
13
14/ {
15 compatible = "buffalo,wzr-600dhp2", "brcm,bcm47081", "brcm,bcm4708";
16 model = "Buffalo WZR-600DHP2 (BCM47081)";
17
18 chosen {
19 bootargs = "console=ttyS0,115200";
20 };
21
22 memory {
23 reg = <0x00000000 0x08000000>;
24 };
25
26 gpio-keys {
27 compatible = "gpio-keys";
28 #address-cells = <1>;
29 #size-cells = <0>;
30 poll-interval = <200>;
31
32 aoss {
33 label = "AOSS";
34 linux,code = <KEY_WPS_BUTTON>;
35 gpios = <&chipcommon 9 GPIO_ACTIVE_LOW>;
36 };
37
38 restart {
39 label = "Reset";
40 linux,code = <KEY_RESTART>;
41 gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
42 };
43
44 /* Switch device mode? */
45 mode {
46 label = "Mode";
47 linux,code = <KEY_SETUP>;
48 gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
49 };
50
51 eject {
52 label = "USB eject";
53 linux,code = <KEY_EJECTCD>;
54 gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>;
55 };
56 };
57};
diff --git a/arch/arm/boot/dts/bcm47081.dtsi b/arch/arm/boot/dts/bcm47081.dtsi
new file mode 100644
index 000000000000..f720012ee5ed
--- /dev/null
+++ b/arch/arm/boot/dts/bcm47081.dtsi
@@ -0,0 +1,26 @@
1/*
2 * Broadcom BCM470X / BCM5301X ARM platform code.
3 * DTS for BCM47081 SoC.
4 *
5 * Copyright © 2014 Rafał Miłecki <zajec5@gmail.com>
6 *
7 * Licensed under the GNU/GPL. See COPYING for details.
8 */
9
10#include "bcm5301x.dtsi"
11
12/ {
13 compatible = "brcm,bcm47081";
14
15 cpus {
16 #address-cells = <1>;
17 #size-cells = <0>;
18
19 cpu@0 {
20 device_type = "cpu";
21 compatible = "arm,cortex-a9";
22 next-level-cache = <&L2>;
23 reg = <0x0>;
24 };
25 };
26};
diff --git a/arch/arm/boot/dts/bcm5301x.dtsi b/arch/arm/boot/dts/bcm5301x.dtsi
index 53c624f766b4..78aec6270c2f 100644
--- a/arch/arm/boot/dts/bcm5301x.dtsi
+++ b/arch/arm/boot/dts/bcm5301x.dtsi
@@ -8,6 +8,8 @@
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
10 10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/input/input.h>
11#include <dt-bindings/interrupt-controller/irq.h> 13#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/interrupt-controller/arm-gic.h> 14#include <dt-bindings/interrupt-controller/arm-gic.h>
13#include "skeleton.dtsi" 15#include "skeleton.dtsi"
@@ -92,4 +94,53 @@
92 clock-frequency = <400000000>; 94 clock-frequency = <400000000>;
93 }; 95 };
94 }; 96 };
97
98 axi@18000000 {
99 compatible = "brcm,bus-axi";
100 reg = <0x18000000 0x1000>;
101 ranges = <0x00000000 0x18000000 0x00100000>;
102 #address-cells = <1>;
103 #size-cells = <1>;
104
105 #interrupt-cells = <1>;
106 interrupt-map-mask = <0x000fffff 0xffff>;
107 interrupt-map =
108 /* ChipCommon */
109 <0x00000000 0 &gic GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>,
110
111 /* USB 2.0 Controller */
112 <0x00021000 0 &gic GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>,
113
114 /* USB 3.0 Controller */
115 <0x00023000 0 &gic GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>,
116
117 /* Ethernet Controller 0 */
118 <0x00024000 0 &gic GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>,
119
120 /* Ethernet Controller 1 */
121 <0x00025000 0 &gic GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>,
122
123 /* Ethernet Controller 2 */
124 <0x00026000 0 &gic GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>,
125
126 /* Ethernet Controller 3 */
127 <0x00027000 0 &gic GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>,
128
129 /* NAND Controller */
130 <0x00028000 0 &gic GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>,
131 <0x00028000 1 &gic GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>,
132 <0x00028000 2 &gic GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>,
133 <0x00028000 3 &gic GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>,
134 <0x00028000 4 &gic GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>,
135 <0x00028000 5 &gic GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>,
136 <0x00028000 6 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>,
137 <0x00028000 7 &gic GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
138
139 chipcommon: chipcommon@0 {
140 reg = <0x00000000 0x1000>;
141
142 gpio-controller;
143 #gpio-cells = <2>;
144 };
145 };
95}; 146};
diff --git a/arch/arm/boot/dts/bcm911360_entphn.dts b/arch/arm/boot/dts/bcm911360_entphn.dts
new file mode 100644
index 000000000000..d2ee95280548
--- /dev/null
+++ b/arch/arm/boot/dts/bcm911360_entphn.dts
@@ -0,0 +1,53 @@
1/*
2 * BSD LICENSE
3 *
4 * Copyright(c) 2014 Broadcom Corporation. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Broadcom Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/dts-v1/;
34
35#include "bcm-cygnus.dtsi"
36
37/ {
38 model = "Cygnus Enterprise Phone (BCM911360_ENTPHN)";
39 compatible = "brcm,bcm11360", "brcm,cygnus";
40
41 aliases {
42 serial0 = &uart3;
43 };
44
45 chosen {
46 stdout-path = &uart3;
47 bootargs = "console=ttyS0,115200";
48 };
49
50 uart3: serial@18023000 {
51 status = "okay";
52 };
53};
diff --git a/arch/arm/boot/dts/bcm911360k.dts b/arch/arm/boot/dts/bcm911360k.dts
new file mode 100644
index 000000000000..9658d4f62d59
--- /dev/null
+++ b/arch/arm/boot/dts/bcm911360k.dts
@@ -0,0 +1,53 @@
1/*
2 * BSD LICENSE
3 *
4 * Copyright(c) 2014 Broadcom Corporation. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Broadcom Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/dts-v1/;
34
35#include "bcm-cygnus.dtsi"
36
37/ {
38 model = "Cygnus SVK (BCM911360K)";
39 compatible = "brcm,bcm11360", "brcm,cygnus";
40
41 aliases {
42 serial0 = &uart3;
43 };
44
45 chosen {
46 stdout-path = &uart3;
47 bootargs = "console=ttyS0,115200";
48 };
49
50 uart3: serial@18023000 {
51 status = "okay";
52 };
53};
diff --git a/arch/arm/boot/dts/bcm958300k.dts b/arch/arm/boot/dts/bcm958300k.dts
new file mode 100644
index 000000000000..f1bb36f3975c
--- /dev/null
+++ b/arch/arm/boot/dts/bcm958300k.dts
@@ -0,0 +1,53 @@
1/*
2 * BSD LICENSE
3 *
4 * Copyright(c) 2014 Broadcom Corporation. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Broadcom Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/dts-v1/;
34
35#include "bcm-cygnus.dtsi"
36
37/ {
38 model = "Cygnus SVK (BCM958300K)";
39 compatible = "brcm,bcm58300", "brcm,cygnus";
40
41 aliases {
42 serial0 = &uart3;
43 };
44
45 chosen {
46 stdout-path = &uart3;
47 bootargs = "console=ttyS0,115200";
48 };
49
50 uart3: serial@18023000 {
51 status = "okay";
52 };
53};
diff --git a/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
index c72bfd468d10..86d85d8896a3 100644
--- a/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
+++ b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
@@ -26,4 +26,20 @@
26 }; 26 };
27}; 27};
28 28
29&ahci { status = "okay"; };
30
31&eth1 { status = "okay"; };
32
33/* Unpopulated SATA plug on solder side */
34&sata0 { status = "okay"; };
35
36&sata_phy { status = "okay"; };
37
38/* Samsung M8G2FA 8GB eMMC */
39&sdhci2 {
40 non-removable;
41 bus-width = <8>;
42 status = "okay";
43};
44
29&uart0 { status = "okay"; }; 45&uart0 { status = "okay"; };
diff --git a/arch/arm/boot/dts/berlin2.dtsi b/arch/arm/boot/dts/berlin2.dtsi
index 9d7c810ebd0b..015a06c67c91 100644
--- a/arch/arm/boot/dts/berlin2.dtsi
+++ b/arch/arm/boot/dts/berlin2.dtsi
@@ -53,6 +53,35 @@
53 53
54 ranges = <0 0xf7000000 0x1000000>; 54 ranges = <0 0xf7000000 0x1000000>;
55 55
56 sdhci0: sdhci@ab0000 {
57 compatible = "mrvl,pxav3-mmc";
58 reg = <0xab0000 0x200>;
59 clocks = <&chip CLKID_SDIO0XIN>, <&chip CLKID_SDIO0>;
60 clock-names = "io", "core";
61 interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
62 status = "disabled";
63 };
64
65 sdhci1: sdhci@ab0800 {
66 compatible = "mrvl,pxav3-mmc";
67 reg = <0xab0800 0x200>;
68 clocks = <&chip CLKID_SDIO1XIN>, <&chip CLKID_SDIO1>;
69 clock-names = "io", "core";
70 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
71 status = "disabled";
72 };
73
74 sdhci2: sdhci@ab1000 {
75 compatible = "mrvl,pxav3-mmc";
76 reg = <0xab1000 0x200>;
77 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
78 clocks = <&chip CLKID_NFC_ECC>, <&chip CLKID_NFC>;
79 clock-names = "io", "core";
80 pinctrl-0 = <&emmc_pmux>;
81 pinctrl-names = "default";
82 status = "disabled";
83 };
84
56 l2: l2-cache-controller@ac0000 { 85 l2: l2-cache-controller@ac0000 {
57 compatible = "marvell,tauros3-cache", "arm,pl310-cache"; 86 compatible = "marvell,tauros3-cache", "arm,pl310-cache";
58 reg = <0xac0000 0x1000>; 87 reg = <0xac0000 0x1000>;
@@ -79,11 +108,47 @@
79 clocks = <&chip CLKID_TWD>; 108 clocks = <&chip CLKID_TWD>;
80 }; 109 };
81 110
111 eth1: ethernet@b90000 {
112 compatible = "marvell,pxa168-eth";
113 reg = <0xb90000 0x10000>;
114 clocks = <&chip CLKID_GETH1>;
115 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
116 /* set by bootloader */
117 local-mac-address = [00 00 00 00 00 00];
118 #address-cells = <1>;
119 #size-cells = <0>;
120 phy-connection-type = "mii";
121 phy-handle = <&ethphy1>;
122 status = "disabled";
123
124 ethphy1: ethernet-phy@0 {
125 reg = <0>;
126 };
127 };
128
82 cpu-ctrl@dd0000 { 129 cpu-ctrl@dd0000 {
83 compatible = "marvell,berlin-cpu-ctrl"; 130 compatible = "marvell,berlin-cpu-ctrl";
84 reg = <0xdd0000 0x10000>; 131 reg = <0xdd0000 0x10000>;
85 }; 132 };
86 133
134 eth0: ethernet@e50000 {
135 compatible = "marvell,pxa168-eth";
136 reg = <0xe50000 0x10000>;
137 clocks = <&chip CLKID_GETH0>;
138 interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
139 /* set by bootloader */
140 local-mac-address = [00 00 00 00 00 00];
141 #address-cells = <1>;
142 #size-cells = <0>;
143 phy-connection-type = "mii";
144 phy-handle = <&ethphy0>;
145 status = "disabled";
146
147 ethphy0: ethernet-phy@0 {
148 reg = <0>;
149 };
150 };
151
87 apb@e80000 { 152 apb@e80000 {
88 compatible = "simple-bus"; 153 compatible = "simple-bus";
89 #address-cells = <1>; 154 #address-cells = <1>;
@@ -246,12 +311,57 @@
246 }; 311 };
247 }; 312 };
248 313
314 ahci: sata@e90000 {
315 compatible = "marvell,berlin2-ahci", "generic-ahci";
316 reg = <0xe90000 0x1000>;
317 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
318 clocks = <&chip CLKID_SATA>;
319 #address-cells = <1>;
320 #size-cells = <0>;
321
322 sata0: sata-port@0 {
323 reg = <0>;
324 phys = <&sata_phy 0>;
325 status = "disabled";
326 };
327
328 sata1: sata-port@1 {
329 reg = <1>;
330 phys = <&sata_phy 1>;
331 status = "disabled";
332 };
333 };
334
335 sata_phy: phy@e900a0 {
336 compatible = "marvell,berlin2-sata-phy";
337 reg = <0xe900a0 0x200>;
338 clocks = <&chip CLKID_SATA>;
339 #address-cells = <1>;
340 #size-cells = <0>;
341 #phy-cells = <1>;
342 status = "disabled";
343
344 sata-phy@0 {
345 reg = <0>;
346 };
347
348 sata-phy@1 {
349 reg = <1>;
350 };
351 };
352
249 chip: chip-control@ea0000 { 353 chip: chip-control@ea0000 {
250 compatible = "marvell,berlin2-chip-ctrl"; 354 compatible = "marvell,berlin2-chip-ctrl";
251 #clock-cells = <1>; 355 #clock-cells = <1>;
356 #reset-cells = <2>;
252 reg = <0xea0000 0x400>; 357 reg = <0xea0000 0x400>;
253 clocks = <&refclk>; 358 clocks = <&refclk>;
254 clock-names = "refclk"; 359 clock-names = "refclk";
360
361 emmc_pmux: emmc-pmux {
362 groups = "G26";
363 function = "emmc";
364 };
255 }; 365 };
256 366
257 apb@fc0000 { 367 apb@fc0000 {
diff --git a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
index bcd81ffc495d..30270be4d0c9 100644
--- a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
+++ b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
@@ -11,6 +11,7 @@
11/dts-v1/; 11/dts-v1/;
12 12
13#include "berlin2cd.dtsi" 13#include "berlin2cd.dtsi"
14#include <dt-bindings/gpio/gpio.h>
14 15
15/ { 16/ {
16 model = "Google Chromecast"; 17 model = "Google Chromecast";
@@ -24,6 +25,35 @@
24 device_type = "memory"; 25 device_type = "memory";
25 reg = <0x00000000 0x20000000>; /* 512 MB */ 26 reg = <0x00000000 0x20000000>; /* 512 MB */
26 }; 27 };
28
29 leds {
30 compatible = "gpio-leds";
31
32 white {
33 label = "white";
34 gpios = <&portc 1 GPIO_ACTIVE_HIGH>;
35 default-state = "keep";
36 };
37
38 red {
39 label = "red";
40 gpios = <&portc 2 GPIO_ACTIVE_HIGH>;
41 default-state = "keep";
42 };
43 };
44};
45
46/*
47 * AzureWave AW-NH387 (Marvell 88W8787)
48 * 802.11b/g/n + Bluetooth 2.1
49 */
50&sdhci0 {
51 non-removable;
52 status = "okay";
27}; 53};
28 54
29&uart0 { status = "okay"; }; 55&uart0 { status = "okay"; };
56
57&usb_phy1 { status = "okay"; };
58
59&usb1 { status = "okay"; };
diff --git a/arch/arm/boot/dts/berlin2cd.dtsi b/arch/arm/boot/dts/berlin2cd.dtsi
index cc1df65da504..230df3b1770e 100644
--- a/arch/arm/boot/dts/berlin2cd.dtsi
+++ b/arch/arm/boot/dts/berlin2cd.dtsi
@@ -45,6 +45,15 @@
45 45
46 ranges = <0 0xf7000000 0x1000000>; 46 ranges = <0 0xf7000000 0x1000000>;
47 47
48 sdhci0: sdhci@ab0000 {
49 compatible = "mrvl,pxav3-mmc";
50 reg = <0xab0000 0x200>;
51 clocks = <&chip CLKID_SDIO0XIN>, <&chip CLKID_SDIO0>;
52 clock-names = "io", "core";
53 interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
54 status = "disabled";
55 };
56
48 l2: l2-cache-controller@ac0000 { 57 l2: l2-cache-controller@ac0000 {
49 compatible = "arm,pl310-cache"; 58 compatible = "arm,pl310-cache";
50 reg = <0xac0000 0x1000>; 59 reg = <0xac0000 0x1000>;
@@ -66,6 +75,58 @@
66 clocks = <&chip CLKID_TWD>; 75 clocks = <&chip CLKID_TWD>;
67 }; 76 };
68 77
78 usb_phy0: usb-phy@b74000 {
79 compatible = "marvell,berlin2cd-usb-phy";
80 reg = <0xb74000 0x128>;
81 #phy-cells = <0>;
82 resets = <&chip 0x178 23>;
83 status = "disabled";
84 };
85
86 usb_phy1: usb-phy@b78000 {
87 compatible = "marvell,berlin2cd-usb-phy";
88 reg = <0xb78000 0x128>;
89 #phy-cells = <0>;
90 resets = <&chip 0x178 24>;
91 status = "disabled";
92 };
93
94 eth1: ethernet@b90000 {
95 compatible = "marvell,pxa168-eth";
96 reg = <0xb90000 0x10000>;
97 clocks = <&chip CLKID_GETH1>;
98 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
99 /* set by bootloader */
100 local-mac-address = [00 00 00 00 00 00];
101 #address-cells = <1>;
102 #size-cells = <0>;
103 phy-connection-type = "mii";
104 phy-handle = <&ethphy1>;
105 status = "disabled";
106
107 ethphy1: ethernet-phy@0 {
108 reg = <0>;
109 };
110 };
111
112 eth0: ethernet@e50000 {
113 compatible = "marvell,pxa168-eth";
114 reg = <0xe50000 0x10000>;
115 clocks = <&chip CLKID_GETH0>;
116 interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
117 /* set by bootloader */
118 local-mac-address = [00 00 00 00 00 00];
119 #address-cells = <1>;
120 #size-cells = <0>;
121 phy-connection-type = "mii";
122 phy-handle = <&ethphy0>;
123 status = "disabled";
124
125 ethphy0: ethernet-phy@0 {
126 reg = <0>;
127 };
128 };
129
69 apb@e80000 { 130 apb@e80000 {
70 compatible = "simple-bus"; 131 compatible = "simple-bus";
71 #address-cells = <1>; 132 #address-cells = <1>;
@@ -231,6 +292,7 @@
231 chip: chip-control@ea0000 { 292 chip: chip-control@ea0000 {
232 compatible = "marvell,berlin2cd-chip-ctrl"; 293 compatible = "marvell,berlin2cd-chip-ctrl";
233 #clock-cells = <1>; 294 #clock-cells = <1>;
295 #reset-cells = <2>;
234 reg = <0xea0000 0x400>; 296 reg = <0xea0000 0x400>;
235 clocks = <&refclk>; 297 clocks = <&refclk>;
236 clock-names = "refclk"; 298 clock-names = "refclk";
@@ -241,6 +303,26 @@
241 }; 303 };
242 }; 304 };
243 305
306 usb0: usb@ed0000 {
307 compatible = "chipidea,usb2";
308 reg = <0xed0000 0x200>;
309 interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
310 clocks = <&chip CLKID_USB0>;
311 phys = <&usb_phy0>;
312 phy-names = "usb-phy";
313 status = "disabled";
314 };
315
316 usb1: usb@ee0000 {
317 compatible = "chipidea,usb2";
318 reg = <0xee0000 0x200>;
319 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
320 clocks = <&chip CLKID_USB1>;
321 phys = <&usb_phy1>;
322 phy-names = "usb-phy";
323 status = "disabled";
324 };
325
244 apb@fc0000 { 326 apb@fc0000 {
245 compatible = "simple-bus"; 327 compatible = "simple-bus";
246 #address-cells = <1>; 328 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
index ea1f99b8eed6..28e7e2060c33 100644
--- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
+++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
@@ -7,6 +7,8 @@
7 */ 7 */
8 8
9/dts-v1/; 9/dts-v1/;
10
11#include <dt-bindings/gpio/gpio.h>
10#include "berlin2q.dtsi" 12#include "berlin2q.dtsi"
11 13
12/ { 14/ {
@@ -21,6 +23,39 @@
21 choosen { 23 choosen {
22 bootargs = "console=ttyS0,115200 earlyprintk"; 24 bootargs = "console=ttyS0,115200 earlyprintk";
23 }; 25 };
26
27 regulators {
28 compatible = "simple-bus";
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 reg_usb0_vbus: regulator@0 {
33 compatible = "regulator-fixed";
34 regulator-name = "usb0_vbus";
35 regulator-min-microvolt = <5000000>;
36 regulator-max-microvolt = <5000000>;
37 gpio = <&portb 8 GPIO_ACTIVE_HIGH>;
38 enable-active-high;
39 };
40
41 reg_usb1_vbus: regulator@1 {
42 compatible = "regulator-fixed";
43 regulator-name = "usb1_vbus";
44 regulator-min-microvolt = <5000000>;
45 regulator-max-microvolt = <5000000>;
46 gpio = <&portb 10 GPIO_ACTIVE_HIGH>;
47 enable-active-high;
48 };
49
50 reg_usb2_vbus: regulator@2 {
51 compatible = "regulator-fixed";
52 regulator-name = "usb2_vbus";
53 regulator-min-microvolt = <5000000>;
54 regulator-max-microvolt = <5000000>;
55 gpio = <&portb 12 GPIO_ACTIVE_HIGH>;
56 enable-active-high;
57 };
58 };
24}; 59};
25 60
26&sdhci1 { 61&sdhci1 {
@@ -46,6 +81,32 @@
46 status = "okay"; 81 status = "okay";
47}; 82};
48 83
84&usb_phy0 {
85 status = "okay";
86};
87
88&usb_phy2 {
89 status = "okay";
90};
91
92&usb0 {
93 vbus-supply = <&reg_usb0_vbus>;
94 status = "okay";
95};
96
97&usb2 {
98 vbus-supply = <&reg_usb2_vbus>;
99 status = "okay";
100};
101
49&eth0 { 102&eth0 {
50 status = "okay"; 103 status = "okay";
51}; 104};
105
106&sata0 {
107 status = "okay";
108};
109
110&sata_phy {
111 status = "okay";
112};
diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index 891d56b03922..35253c947a7c 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -114,6 +114,40 @@
114 #interrupt-cells = <3>; 114 #interrupt-cells = <3>;
115 }; 115 };
116 116
117 usb_phy2: phy@a2f400 {
118 compatible = "marvell,berlin2-usb-phy";
119 reg = <0xa2f400 0x128>;
120 #phy-cells = <0>;
121 resets = <&chip 0x104 14>;
122 status = "disabled";
123 };
124
125 usb2: usb@a30000 {
126 compatible = "chipidea,usb2";
127 reg = <0xa30000 0x10000>;
128 interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
129 clocks = <&chip CLKID_USB2>;
130 phys = <&usb_phy2>;
131 phy-names = "usb-phy";
132 status = "disabled";
133 };
134
135 usb_phy0: phy@b74000 {
136 compatible = "marvell,berlin2-usb-phy";
137 reg = <0xb74000 0x128>;
138 #phy-cells = <0>;
139 resets = <&chip 0x104 12>;
140 status = "disabled";
141 };
142
143 usb_phy1: phy@b78000 {
144 compatible = "marvell,berlin2-usb-phy";
145 reg = <0xb78000 0x128>;
146 #phy-cells = <0>;
147 resets = <&chip 0x104 13>;
148 status = "disabled";
149 };
150
117 eth0: ethernet@b90000 { 151 eth0: ethernet@b90000 {
118 compatible = "marvell,pxa168-eth"; 152 compatible = "marvell,pxa168-eth";
119 reg = <0xb90000 0x10000>; 153 reg = <0xb90000 0x10000>;
@@ -123,6 +157,7 @@
123 local-mac-address = [00 00 00 00 00 00]; 157 local-mac-address = [00 00 00 00 00 00];
124 #address-cells = <1>; 158 #address-cells = <1>;
125 #size-cells = <0>; 159 #size-cells = <0>;
160 phy-connection-type = "mii";
126 phy-handle = <&ethphy0>; 161 phy-handle = <&ethphy0>;
127 status = "disabled"; 162 status = "disabled";
128 163
@@ -255,7 +290,6 @@
255 reg = <0x2c14 0x14>; 290 reg = <0x2c14 0x14>;
256 clocks = <&chip CLKID_CFG>; 291 clocks = <&chip CLKID_CFG>;
257 clock-names = "timer"; 292 clock-names = "timer";
258 status = "disabled";
259 }; 293 };
260 294
261 timer2: timer@2c28 { 295 timer2: timer@2c28 {
@@ -349,6 +383,7 @@
349 chip: chip-control@ea0000 { 383 chip: chip-control@ea0000 {
350 compatible = "marvell,berlin2q-chip-ctrl"; 384 compatible = "marvell,berlin2q-chip-ctrl";
351 #clock-cells = <1>; 385 #clock-cells = <1>;
386 #reset-cells = <2>;
352 reg = <0xea0000 0x400>, <0xdd0170 0x10>; 387 reg = <0xea0000 0x400>, <0xdd0170 0x10>;
353 clocks = <&refclk>; 388 clocks = <&refclk>;
354 clock-names = "refclk"; 389 clock-names = "refclk";
@@ -364,6 +399,65 @@
364 }; 399 };
365 }; 400 };
366 401
402 ahci: sata@e90000 {
403 compatible = "marvell,berlin2q-ahci", "generic-ahci";
404 reg = <0xe90000 0x1000>;
405 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
406 clocks = <&chip CLKID_SATA>;
407 #address-cells = <1>;
408 #size-cells = <0>;
409
410 sata0: sata-port@0 {
411 reg = <0>;
412 phys = <&sata_phy 0>;
413 status = "disabled";
414 };
415
416 sata1: sata-port@1 {
417 reg = <1>;
418 phys = <&sata_phy 1>;
419 status = "disabled";
420 };
421 };
422
423 sata_phy: phy@e900a0 {
424 compatible = "marvell,berlin2q-sata-phy";
425 reg = <0xe900a0 0x200>;
426 clocks = <&chip CLKID_SATA>;
427 #address-cells = <1>;
428 #size-cells = <0>;
429 #phy-cells = <1>;
430 status = "disabled";
431
432 sata-phy@0 {
433 reg = <0>;
434 };
435
436 sata-phy@1 {
437 reg = <1>;
438 };
439 };
440
441 usb0: usb@ed0000 {
442 compatible = "chipidea,usb2";
443 reg = <0xed0000 0x10000>;
444 interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
445 clocks = <&chip CLKID_USB0>;
446 phys = <&usb_phy0>;
447 phy-names = "usb-phy";
448 status = "disabled";
449 };
450
451 usb1: usb@ee0000 {
452 compatible = "chipidea,usb2";
453 reg = <0xee0000 0x10000>;
454 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
455 clocks = <&chip CLKID_USB1>;
456 phys = <&usb_phy1>;
457 phy-names = "usb-phy";
458 status = "disabled";
459 };
460
367 apb@fc0000 { 461 apb@fc0000 {
368 compatible = "simple-bus"; 462 compatible = "simple-bus";
369 #address-cells = <1>; 463 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index c6ce6258434f..736092b1a535 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -171,6 +171,101 @@
171 0xd0 (PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle */ 171 0xd0 (PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle */
172 >; 172 >;
173 }; 173 };
174
175 cpsw_default: cpsw_default {
176 pinctrl-single,pins = <
177 /* Slave 1 */
178 0x250 (PIN_OUTPUT | MUX_MODE0) /* rgmii0_txc.rgmii0_txc */
179 0x254 (PIN_OUTPUT | MUX_MODE0) /* rgmii0_txctl.rgmii0_txctl */
180 0x258 (PIN_OUTPUT | MUX_MODE0) /* rgmii0_td3.rgmii0_txd3 */
181 0x25c (PIN_OUTPUT | MUX_MODE0) /* rgmii0_txd2.rgmii0_txd2 */
182 0x260 (PIN_OUTPUT | MUX_MODE0) /* rgmii0_txd1.rgmii0_txd1 */
183 0x264 (PIN_OUTPUT | MUX_MODE0) /* rgmii0_txd0.rgmii0_txd0 */
184 0x268 (PIN_INPUT | MUX_MODE0) /* rgmii0_rxc.rgmii0_rxc */
185 0x26c (PIN_INPUT | MUX_MODE0) /* rgmii0_rxctl.rgmii0_rxctl */
186 0x270 (PIN_INPUT | MUX_MODE0) /* rgmii0_rxd3.rgmii0_rxd3 */
187 0x274 (PIN_INPUT | MUX_MODE0) /* rgmii0_rxd2.rgmii0_rxd2 */
188 0x278 (PIN_INPUT | MUX_MODE0) /* rgmii0_rxd1.rgmii0_rxd1 */
189 0x27c (PIN_INPUT | MUX_MODE0) /* rgmii0_rxd0.rgmii0_rxd0 */
190
191 /* Slave 2 */
192 0x198 (PIN_OUTPUT | MUX_MODE3) /* vin2a_d12.rgmii1_txc */
193 0x19c (PIN_OUTPUT | MUX_MODE3) /* vin2a_d13.rgmii1_tctl */
194 0x1a0 (PIN_OUTPUT | MUX_MODE3) /* vin2a_d14.rgmii1_td3 */
195 0x1a4 (PIN_OUTPUT | MUX_MODE3) /* vin2a_d15.rgmii1_td2 */
196 0x1a8 (PIN_OUTPUT | MUX_MODE3) /* vin2a_d16.rgmii1_td1 */
197 0x1ac (PIN_OUTPUT | MUX_MODE3) /* vin2a_d17.rgmii1_td0 */
198 0x1b0 (PIN_INPUT | MUX_MODE3) /* vin2a_d18.rgmii1_rclk */
199 0x1b4 (PIN_INPUT | MUX_MODE3) /* vin2a_d19.rgmii1_rctl */
200 0x1b8 (PIN_INPUT | MUX_MODE3) /* vin2a_d20.rgmii1_rd3 */
201 0x1bc (PIN_INPUT | MUX_MODE3) /* vin2a_d21.rgmii1_rd2 */
202 0x1c0 (PIN_INPUT | MUX_MODE3) /* vin2a_d22.rgmii1_rd1 */
203 0x1c4 (PIN_INPUT | MUX_MODE3) /* vin2a_d23.rgmii1_rd0 */
204 >;
205
206 };
207
208 cpsw_sleep: cpsw_sleep {
209 pinctrl-single,pins = <
210 /* Slave 1 */
211 0x250 (MUX_MODE15)
212 0x254 (MUX_MODE15)
213 0x258 (MUX_MODE15)
214 0x25c (MUX_MODE15)
215 0x260 (MUX_MODE15)
216 0x264 (MUX_MODE15)
217 0x268 (MUX_MODE15)
218 0x26c (MUX_MODE15)
219 0x270 (MUX_MODE15)
220 0x274 (MUX_MODE15)
221 0x278 (MUX_MODE15)
222 0x27c (MUX_MODE15)
223
224 /* Slave 2 */
225 0x198 (MUX_MODE15)
226 0x19c (MUX_MODE15)
227 0x1a0 (MUX_MODE15)
228 0x1a4 (MUX_MODE15)
229 0x1a8 (MUX_MODE15)
230 0x1ac (MUX_MODE15)
231 0x1b0 (MUX_MODE15)
232 0x1b4 (MUX_MODE15)
233 0x1b8 (MUX_MODE15)
234 0x1bc (MUX_MODE15)
235 0x1c0 (MUX_MODE15)
236 0x1c4 (MUX_MODE15)
237 >;
238 };
239
240 davinci_mdio_default: davinci_mdio_default {
241 pinctrl-single,pins = <
242 0x23c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_d.mdio_d */
243 0x240 (PIN_INPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
244 >;
245 };
246
247 davinci_mdio_sleep: davinci_mdio_sleep {
248 pinctrl-single,pins = <
249 0x23c (MUX_MODE15)
250 0x240 (MUX_MODE15)
251 >;
252 };
253
254 dcan1_pins_default: dcan1_pins_default {
255 pinctrl-single,pins = <
256 0x3d0 (PIN_OUTPUT | MUX_MODE0) /* dcan1_tx */
257 0x3d4 (MUX_MODE15) /* dcan1_rx.off */
258 0x418 (PULL_DIS | MUX_MODE1) /* wakeup0.dcan1_rx */
259 >;
260 };
261
262 dcan1_pins_sleep: dcan1_pins_sleep {
263 pinctrl-single,pins = <
264 0x3d0 (MUX_MODE15) /* dcan1_tx.off */
265 0x3d4 (MUX_MODE15) /* dcan1_rx.off */
266 0x418 (MUX_MODE15) /* wakeup0.off */
267 >;
268 };
174}; 269};
175 270
176&i2c1 { 271&i2c1 {
@@ -201,6 +296,7 @@
201 regulator-name = "smps45"; 296 regulator-name = "smps45";
202 regulator-min-microvolt = < 850000>; 297 regulator-min-microvolt = < 850000>;
203 regulator-max-microvolt = <1150000>; 298 regulator-max-microvolt = <1150000>;
299 regulator-always-on;
204 regulator-boot-on; 300 regulator-boot-on;
205 }; 301 };
206 302
@@ -209,6 +305,7 @@
209 regulator-name = "smps6"; 305 regulator-name = "smps6";
210 regulator-min-microvolt = <850000>; 306 regulator-min-microvolt = <850000>;
211 regulator-max-microvolt = <12500000>; 307 regulator-max-microvolt = <12500000>;
308 regulator-always-on;
212 regulator-boot-on; 309 regulator-boot-on;
213 }; 310 };
214 311
@@ -226,6 +323,7 @@
226 regulator-name = "smps8"; 323 regulator-name = "smps8";
227 regulator-min-microvolt = < 850000>; 324 regulator-min-microvolt = < 850000>;
228 regulator-max-microvolt = <1250000>; 325 regulator-max-microvolt = <1250000>;
326 regulator-always-on;
229 regulator-boot-on; 327 regulator-boot-on;
230 }; 328 };
231 329
@@ -252,6 +350,7 @@
252 regulator-name = "ldo2"; 350 regulator-name = "ldo2";
253 regulator-min-microvolt = <3300000>; 351 regulator-min-microvolt = <3300000>;
254 regulator-max-microvolt = <3300000>; 352 regulator-max-microvolt = <3300000>;
353 regulator-always-on;
255 regulator-boot-on; 354 regulator-boot-on;
256 }; 355 };
257 356
@@ -269,6 +368,7 @@
269 regulator-name = "ldo9"; 368 regulator-name = "ldo9";
270 regulator-min-microvolt = <1050000>; 369 regulator-min-microvolt = <1050000>;
271 regulator-max-microvolt = <1050000>; 370 regulator-max-microvolt = <1050000>;
371 regulator-always-on;
272 regulator-boot-on; 372 regulator-boot-on;
273 }; 373 };
274 374
@@ -528,3 +628,36 @@
528 ti,no-reset-on-init; 628 ti,no-reset-on-init;
529 ti,no-idle-on-init; 629 ti,no-idle-on-init;
530}; 630};
631
632&mac {
633 status = "okay";
634 pinctrl-names = "default", "sleep";
635 pinctrl-0 = <&cpsw_default>;
636 pinctrl-1 = <&cpsw_sleep>;
637 dual_emac;
638};
639
640&cpsw_emac0 {
641 phy_id = <&davinci_mdio>, <2>;
642 phy-mode = "rgmii";
643 dual_emac_res_vlan = <1>;
644};
645
646&cpsw_emac1 {
647 phy_id = <&davinci_mdio>, <3>;
648 phy-mode = "rgmii";
649 dual_emac_res_vlan = <2>;
650};
651
652&davinci_mdio {
653 pinctrl-names = "default", "sleep";
654 pinctrl-0 = <&davinci_mdio_default>;
655 pinctrl-1 = <&davinci_mdio_sleep>;
656};
657
658&dcan1 {
659 status = "ok";
660 pinctrl-names = "default", "sleep";
661 pinctrl-0 = <&dcan1_pins_default>;
662 pinctrl-1 = <&dcan1_pins_sleep>;
663};
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 9cc98436a982..63bf99be1762 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -34,6 +34,14 @@
34 serial3 = &uart4; 34 serial3 = &uart4;
35 serial4 = &uart5; 35 serial4 = &uart5;
36 serial5 = &uart6; 36 serial5 = &uart6;
37 serial6 = &uart7;
38 serial7 = &uart8;
39 serial8 = &uart9;
40 serial9 = &uart10;
41 ethernet0 = &cpsw_emac0;
42 ethernet1 = &cpsw_emac1;
43 d_can0 = &dcan1;
44 d_can1 = &dcan2;
37 }; 45 };
38 46
39 timer { 47 timer {
@@ -201,6 +209,11 @@
201 ti,hwmods = "counter_32k"; 209 ti,hwmods = "counter_32k";
202 }; 210 };
203 211
212 dra7_ctrl_core: ctrl_core@4a002000 {
213 compatible = "syscon";
214 reg = <0x4a002000 0x6d0>;
215 };
216
204 dra7_ctrl_general: tisyscon@4a002e00 { 217 dra7_ctrl_general: tisyscon@4a002e00 {
205 compatible = "syscon"; 218 compatible = "syscon";
206 reg = <0x4a002e00 0x7c>; 219 reg = <0x4a002e00 0x7c>;
@@ -335,6 +348,8 @@
335 ti,hwmods = "uart1"; 348 ti,hwmods = "uart1";
336 clock-frequency = <48000000>; 349 clock-frequency = <48000000>;
337 status = "disabled"; 350 status = "disabled";
351 dmas = <&sdma 49>, <&sdma 50>;
352 dma-names = "tx", "rx";
338 }; 353 };
339 354
340 uart2: serial@4806c000 { 355 uart2: serial@4806c000 {
@@ -344,6 +359,8 @@
344 ti,hwmods = "uart2"; 359 ti,hwmods = "uart2";
345 clock-frequency = <48000000>; 360 clock-frequency = <48000000>;
346 status = "disabled"; 361 status = "disabled";
362 dmas = <&sdma 51>, <&sdma 52>;
363 dma-names = "tx", "rx";
347 }; 364 };
348 365
349 uart3: serial@48020000 { 366 uart3: serial@48020000 {
@@ -353,6 +370,8 @@
353 ti,hwmods = "uart3"; 370 ti,hwmods = "uart3";
354 clock-frequency = <48000000>; 371 clock-frequency = <48000000>;
355 status = "disabled"; 372 status = "disabled";
373 dmas = <&sdma 53>, <&sdma 54>;
374 dma-names = "tx", "rx";
356 }; 375 };
357 376
358 uart4: serial@4806e000 { 377 uart4: serial@4806e000 {
@@ -362,6 +381,8 @@
362 ti,hwmods = "uart4"; 381 ti,hwmods = "uart4";
363 clock-frequency = <48000000>; 382 clock-frequency = <48000000>;
364 status = "disabled"; 383 status = "disabled";
384 dmas = <&sdma 55>, <&sdma 56>;
385 dma-names = "tx", "rx";
365 }; 386 };
366 387
367 uart5: serial@48066000 { 388 uart5: serial@48066000 {
@@ -371,6 +392,8 @@
371 ti,hwmods = "uart5"; 392 ti,hwmods = "uart5";
372 clock-frequency = <48000000>; 393 clock-frequency = <48000000>;
373 status = "disabled"; 394 status = "disabled";
395 dmas = <&sdma 63>, <&sdma 64>;
396 dma-names = "tx", "rx";
374 }; 397 };
375 398
376 uart6: serial@48068000 { 399 uart6: serial@48068000 {
@@ -380,6 +403,8 @@
380 ti,hwmods = "uart6"; 403 ti,hwmods = "uart6";
381 clock-frequency = <48000000>; 404 clock-frequency = <48000000>;
382 status = "disabled"; 405 status = "disabled";
406 dmas = <&sdma 79>, <&sdma 80>;
407 dma-names = "tx", "rx";
383 }; 408 };
384 409
385 uart7: serial@48420000 { 410 uart7: serial@48420000 {
@@ -421,7 +446,11 @@
421 mailbox1: mailbox@4a0f4000 { 446 mailbox1: mailbox@4a0f4000 {
422 compatible = "ti,omap4-mailbox"; 447 compatible = "ti,omap4-mailbox";
423 reg = <0x4a0f4000 0x200>; 448 reg = <0x4a0f4000 0x200>;
449 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>,
450 <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
451 <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
424 ti,hwmods = "mailbox1"; 452 ti,hwmods = "mailbox1";
453 #mbox-cells = <1>;
425 ti,mbox-num-users = <3>; 454 ti,mbox-num-users = <3>;
426 ti,mbox-num-fifos = <8>; 455 ti,mbox-num-fifos = <8>;
427 status = "disabled"; 456 status = "disabled";
@@ -430,7 +459,12 @@
430 mailbox2: mailbox@4883a000 { 459 mailbox2: mailbox@4883a000 {
431 compatible = "ti,omap4-mailbox"; 460 compatible = "ti,omap4-mailbox";
432 reg = <0x4883a000 0x200>; 461 reg = <0x4883a000 0x200>;
462 interrupts = <GIC_SPI 237 IRQ_TYPE_LEVEL_HIGH>,
463 <GIC_SPI 238 IRQ_TYPE_LEVEL_HIGH>,
464 <GIC_SPI 239 IRQ_TYPE_LEVEL_HIGH>,
465 <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>;
433 ti,hwmods = "mailbox2"; 466 ti,hwmods = "mailbox2";
467 #mbox-cells = <1>;
434 ti,mbox-num-users = <4>; 468 ti,mbox-num-users = <4>;
435 ti,mbox-num-fifos = <12>; 469 ti,mbox-num-fifos = <12>;
436 status = "disabled"; 470 status = "disabled";
@@ -439,7 +473,12 @@
439 mailbox3: mailbox@4883c000 { 473 mailbox3: mailbox@4883c000 {
440 compatible = "ti,omap4-mailbox"; 474 compatible = "ti,omap4-mailbox";
441 reg = <0x4883c000 0x200>; 475 reg = <0x4883c000 0x200>;
476 interrupts = <GIC_SPI 241 IRQ_TYPE_LEVEL_HIGH>,
477 <GIC_SPI 242 IRQ_TYPE_LEVEL_HIGH>,
478 <GIC_SPI 243 IRQ_TYPE_LEVEL_HIGH>,
479 <GIC_SPI 244 IRQ_TYPE_LEVEL_HIGH>;
442 ti,hwmods = "mailbox3"; 480 ti,hwmods = "mailbox3";
481 #mbox-cells = <1>;
443 ti,mbox-num-users = <4>; 482 ti,mbox-num-users = <4>;
444 ti,mbox-num-fifos = <12>; 483 ti,mbox-num-fifos = <12>;
445 status = "disabled"; 484 status = "disabled";
@@ -448,7 +487,12 @@
448 mailbox4: mailbox@4883e000 { 487 mailbox4: mailbox@4883e000 {
449 compatible = "ti,omap4-mailbox"; 488 compatible = "ti,omap4-mailbox";
450 reg = <0x4883e000 0x200>; 489 reg = <0x4883e000 0x200>;
490 interrupts = <GIC_SPI 245 IRQ_TYPE_LEVEL_HIGH>,
491 <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>,
492 <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>,
493 <GIC_SPI 248 IRQ_TYPE_LEVEL_HIGH>;
451 ti,hwmods = "mailbox4"; 494 ti,hwmods = "mailbox4";
495 #mbox-cells = <1>;
452 ti,mbox-num-users = <4>; 496 ti,mbox-num-users = <4>;
453 ti,mbox-num-fifos = <12>; 497 ti,mbox-num-fifos = <12>;
454 status = "disabled"; 498 status = "disabled";
@@ -457,7 +501,12 @@
457 mailbox5: mailbox@48840000 { 501 mailbox5: mailbox@48840000 {
458 compatible = "ti,omap4-mailbox"; 502 compatible = "ti,omap4-mailbox";
459 reg = <0x48840000 0x200>; 503 reg = <0x48840000 0x200>;
504 interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH>,
505 <GIC_SPI 250 IRQ_TYPE_LEVEL_HIGH>,
506 <GIC_SPI 251 IRQ_TYPE_LEVEL_HIGH>,
507 <GIC_SPI 252 IRQ_TYPE_LEVEL_HIGH>;
460 ti,hwmods = "mailbox5"; 508 ti,hwmods = "mailbox5";
509 #mbox-cells = <1>;
461 ti,mbox-num-users = <4>; 510 ti,mbox-num-users = <4>;
462 ti,mbox-num-fifos = <12>; 511 ti,mbox-num-fifos = <12>;
463 status = "disabled"; 512 status = "disabled";
@@ -466,7 +515,12 @@
466 mailbox6: mailbox@48842000 { 515 mailbox6: mailbox@48842000 {
467 compatible = "ti,omap4-mailbox"; 516 compatible = "ti,omap4-mailbox";
468 reg = <0x48842000 0x200>; 517 reg = <0x48842000 0x200>;
518 interrupts = <GIC_SPI 253 IRQ_TYPE_LEVEL_HIGH>,
519 <GIC_SPI 254 IRQ_TYPE_LEVEL_HIGH>,
520 <GIC_SPI 255 IRQ_TYPE_LEVEL_HIGH>,
521 <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>;
469 ti,hwmods = "mailbox6"; 522 ti,hwmods = "mailbox6";
523 #mbox-cells = <1>;
470 ti,mbox-num-users = <4>; 524 ti,mbox-num-users = <4>;
471 ti,mbox-num-fifos = <12>; 525 ti,mbox-num-fifos = <12>;
472 status = "disabled"; 526 status = "disabled";
@@ -475,7 +529,12 @@
475 mailbox7: mailbox@48844000 { 529 mailbox7: mailbox@48844000 {
476 compatible = "ti,omap4-mailbox"; 530 compatible = "ti,omap4-mailbox";
477 reg = <0x48844000 0x200>; 531 reg = <0x48844000 0x200>;
532 interrupts = <GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>,
533 <GIC_SPI 258 IRQ_TYPE_LEVEL_HIGH>,
534 <GIC_SPI 259 IRQ_TYPE_LEVEL_HIGH>,
535 <GIC_SPI 260 IRQ_TYPE_LEVEL_HIGH>;
478 ti,hwmods = "mailbox7"; 536 ti,hwmods = "mailbox7";
537 #mbox-cells = <1>;
479 ti,mbox-num-users = <4>; 538 ti,mbox-num-users = <4>;
480 ti,mbox-num-fifos = <12>; 539 ti,mbox-num-fifos = <12>;
481 status = "disabled"; 540 status = "disabled";
@@ -484,7 +543,12 @@
484 mailbox8: mailbox@48846000 { 543 mailbox8: mailbox@48846000 {
485 compatible = "ti,omap4-mailbox"; 544 compatible = "ti,omap4-mailbox";
486 reg = <0x48846000 0x200>; 545 reg = <0x48846000 0x200>;
546 interrupts = <GIC_SPI 261 IRQ_TYPE_LEVEL_HIGH>,
547 <GIC_SPI 262 IRQ_TYPE_LEVEL_HIGH>,
548 <GIC_SPI 263 IRQ_TYPE_LEVEL_HIGH>,
549 <GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>;
487 ti,hwmods = "mailbox8"; 550 ti,hwmods = "mailbox8";
551 #mbox-cells = <1>;
488 ti,mbox-num-users = <4>; 552 ti,mbox-num-users = <4>;
489 ti,mbox-num-fifos = <12>; 553 ti,mbox-num-fifos = <12>;
490 status = "disabled"; 554 status = "disabled";
@@ -493,7 +557,12 @@
493 mailbox9: mailbox@4885e000 { 557 mailbox9: mailbox@4885e000 {
494 compatible = "ti,omap4-mailbox"; 558 compatible = "ti,omap4-mailbox";
495 reg = <0x4885e000 0x200>; 559 reg = <0x4885e000 0x200>;
560 interrupts = <GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>,
561 <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>,
562 <GIC_SPI 267 IRQ_TYPE_LEVEL_HIGH>,
563 <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>;
496 ti,hwmods = "mailbox9"; 564 ti,hwmods = "mailbox9";
565 #mbox-cells = <1>;
497 ti,mbox-num-users = <4>; 566 ti,mbox-num-users = <4>;
498 ti,mbox-num-fifos = <12>; 567 ti,mbox-num-fifos = <12>;
499 status = "disabled"; 568 status = "disabled";
@@ -502,7 +571,12 @@
502 mailbox10: mailbox@48860000 { 571 mailbox10: mailbox@48860000 {
503 compatible = "ti,omap4-mailbox"; 572 compatible = "ti,omap4-mailbox";
504 reg = <0x48860000 0x200>; 573 reg = <0x48860000 0x200>;
574 interrupts = <GIC_SPI 269 IRQ_TYPE_LEVEL_HIGH>,
575 <GIC_SPI 270 IRQ_TYPE_LEVEL_HIGH>,
576 <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
577 <GIC_SPI 272 IRQ_TYPE_LEVEL_HIGH>;
505 ti,hwmods = "mailbox10"; 578 ti,hwmods = "mailbox10";
579 #mbox-cells = <1>;
506 ti,mbox-num-users = <4>; 580 ti,mbox-num-users = <4>;
507 ti,mbox-num-fifos = <12>; 581 ti,mbox-num-fifos = <12>;
508 status = "disabled"; 582 status = "disabled";
@@ -511,7 +585,12 @@
511 mailbox11: mailbox@48862000 { 585 mailbox11: mailbox@48862000 {
512 compatible = "ti,omap4-mailbox"; 586 compatible = "ti,omap4-mailbox";
513 reg = <0x48862000 0x200>; 587 reg = <0x48862000 0x200>;
588 interrupts = <GIC_SPI 273 IRQ_TYPE_LEVEL_HIGH>,
589 <GIC_SPI 274 IRQ_TYPE_LEVEL_HIGH>,
590 <GIC_SPI 275 IRQ_TYPE_LEVEL_HIGH>,
591 <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH>;
514 ti,hwmods = "mailbox11"; 592 ti,hwmods = "mailbox11";
593 #mbox-cells = <1>;
515 ti,mbox-num-users = <4>; 594 ti,mbox-num-users = <4>;
516 ti,mbox-num-fifos = <12>; 595 ti,mbox-num-fifos = <12>;
517 status = "disabled"; 596 status = "disabled";
@@ -520,7 +599,12 @@
520 mailbox12: mailbox@48864000 { 599 mailbox12: mailbox@48864000 {
521 compatible = "ti,omap4-mailbox"; 600 compatible = "ti,omap4-mailbox";
522 reg = <0x48864000 0x200>; 601 reg = <0x48864000 0x200>;
602 interrupts = <GIC_SPI 277 IRQ_TYPE_LEVEL_HIGH>,
603 <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>,
604 <GIC_SPI 279 IRQ_TYPE_LEVEL_HIGH>,
605 <GIC_SPI 280 IRQ_TYPE_LEVEL_HIGH>;
523 ti,hwmods = "mailbox12"; 606 ti,hwmods = "mailbox12";
607 #mbox-cells = <1>;
524 ti,mbox-num-users = <4>; 608 ti,mbox-num-users = <4>;
525 ti,mbox-num-fifos = <12>; 609 ti,mbox-num-fifos = <12>;
526 status = "disabled"; 610 status = "disabled";
@@ -529,7 +613,12 @@
529 mailbox13: mailbox@48802000 { 613 mailbox13: mailbox@48802000 {
530 compatible = "ti,omap4-mailbox"; 614 compatible = "ti,omap4-mailbox";
531 reg = <0x48802000 0x200>; 615 reg = <0x48802000 0x200>;
616 interrupts = <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>,
617 <GIC_SPI 380 IRQ_TYPE_LEVEL_HIGH>,
618 <GIC_SPI 381 IRQ_TYPE_LEVEL_HIGH>,
619 <GIC_SPI 382 IRQ_TYPE_LEVEL_HIGH>;
532 ti,hwmods = "mailbox13"; 620 ti,hwmods = "mailbox13";
621 #mbox-cells = <1>;
533 ti,mbox-num-users = <4>; 622 ti,mbox-num-users = <4>;
534 ti,mbox-num-fifos = <12>; 623 ti,mbox-num-fifos = <12>;
535 status = "disabled"; 624 status = "disabled";
@@ -1075,6 +1164,15 @@
1075 status = "disabled"; 1164 status = "disabled";
1076 }; 1165 };
1077 1166
1167 rtc@48838000 {
1168 compatible = "ti,am3352-rtc";
1169 reg = <0x48838000 0x100>;
1170 interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>,
1171 <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>;
1172 ti,hwmods = "rtcss";
1173 clocks = <&sys_32k_ck>;
1174 };
1175
1078 omap_control_usb2phy1: control-phy@4a002300 { 1176 omap_control_usb2phy1: control-phy@4a002300 {
1079 compatible = "ti,control-phy-usb2"; 1177 compatible = "ti,control-phy-usb2";
1080 reg = <0x4a002300 0x4>; 1178 reg = <0x4a002300 0x4>;
@@ -1141,7 +1239,7 @@
1141 }; 1239 };
1142 }; 1240 };
1143 1241
1144 omap_dwc3_1@48880000 { 1242 omap_dwc3_1: omap_dwc3_1@48880000 {
1145 compatible = "ti,dwc3"; 1243 compatible = "ti,dwc3";
1146 ti,hwmods = "usb_otg_ss1"; 1244 ti,hwmods = "usb_otg_ss1";
1147 reg = <0x48880000 0x10000>; 1245 reg = <0x48880000 0x10000>;
@@ -1162,7 +1260,7 @@
1162 }; 1260 };
1163 }; 1261 };
1164 1262
1165 omap_dwc3_2@488c0000 { 1263 omap_dwc3_2: omap_dwc3_2@488c0000 {
1166 compatible = "ti,dwc3"; 1264 compatible = "ti,dwc3";
1167 ti,hwmods = "usb_otg_ss2"; 1265 ti,hwmods = "usb_otg_ss2";
1168 reg = <0x488c0000 0x10000>; 1266 reg = <0x488c0000 0x10000>;
@@ -1184,7 +1282,7 @@
1184 }; 1282 };
1185 1283
1186 /* IRQ for DWC3_3 and DWC3_4 need IRQ crossbar */ 1284 /* IRQ for DWC3_3 and DWC3_4 need IRQ crossbar */
1187 omap_dwc3_3@48900000 { 1285 omap_dwc3_3: omap_dwc3_3@48900000 {
1188 compatible = "ti,dwc3"; 1286 compatible = "ti,dwc3";
1189 ti,hwmods = "usb_otg_ss3"; 1287 ti,hwmods = "usb_otg_ss3";
1190 reg = <0x48900000 0x10000>; 1288 reg = <0x48900000 0x10000>;
@@ -1204,26 +1302,6 @@
1204 }; 1302 };
1205 }; 1303 };
1206 1304
1207 omap_dwc3_4@48940000 {
1208 compatible = "ti,dwc3";
1209 ti,hwmods = "usb_otg_ss4";
1210 reg = <0x48940000 0x10000>;
1211 interrupts = <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH>;
1212 #address-cells = <1>;
1213 #size-cells = <1>;
1214 utmi-mode = <2>;
1215 ranges;
1216 status = "disabled";
1217 usb4: usb@48950000 {
1218 compatible = "snps,dwc3";
1219 reg = <0x48950000 0x17000>;
1220 interrupts = <GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>;
1221 tx-fifo-resize;
1222 maximum-speed = "high-speed";
1223 dr_mode = "otg";
1224 };
1225 };
1226
1227 elm: elm@48078000 { 1305 elm: elm@48078000 {
1228 compatible = "ti,am3352-elm"; 1306 compatible = "ti,am3352-elm";
1229 reg = <0x48078000 0xfc0>; /* device IO registers */ 1307 reg = <0x48078000 0xfc0>; /* device IO registers */
@@ -1265,6 +1343,84 @@
1265 ti,irqs-skip = <10 133 139 140>; 1343 ti,irqs-skip = <10 133 139 140>;
1266 ti,irqs-safe-map = <0>; 1344 ti,irqs-safe-map = <0>;
1267 }; 1345 };
1346
1347 mac: ethernet@4a100000 {
1348 compatible = "ti,cpsw";
1349 ti,hwmods = "gmac";
1350 clocks = <&dpll_gmac_ck>, <&gmac_gmii_ref_clk_div>;
1351 clock-names = "fck", "cpts";
1352 cpdma_channels = <8>;
1353 ale_entries = <1024>;
1354 bd_ram_size = <0x2000>;
1355 no_bd_ram = <0>;
1356 rx_descs = <64>;
1357 mac_control = <0x20>;
1358 slaves = <2>;
1359 active_slave = <0>;
1360 cpts_clock_mult = <0x80000000>;
1361 cpts_clock_shift = <29>;
1362 reg = <0x48484000 0x1000
1363 0x48485200 0x2E00>;
1364 #address-cells = <1>;
1365 #size-cells = <1>;
1366 /*
1367 * rx_thresh_pend
1368 * rx_pend
1369 * tx_pend
1370 * misc_pend
1371 */
1372 interrupts = <GIC_SPI 334 IRQ_TYPE_LEVEL_HIGH>,
1373 <GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>,
1374 <GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH>,
1375 <GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH>;
1376 ranges;
1377 status = "disabled";
1378
1379 davinci_mdio: mdio@48485000 {
1380 compatible = "ti,davinci_mdio";
1381 #address-cells = <1>;
1382 #size-cells = <0>;
1383 ti,hwmods = "davinci_mdio";
1384 bus_freq = <1000000>;
1385 reg = <0x48485000 0x100>;
1386 };
1387
1388 cpsw_emac0: slave@48480200 {
1389 /* Filled in by U-Boot */
1390 mac-address = [ 00 00 00 00 00 00 ];
1391 };
1392
1393 cpsw_emac1: slave@48480300 {
1394 /* Filled in by U-Boot */
1395 mac-address = [ 00 00 00 00 00 00 ];
1396 };
1397
1398 phy_sel: cpsw-phy-sel@4a002554 {
1399 compatible = "ti,dra7xx-cpsw-phy-sel";
1400 reg= <0x4a002554 0x4>;
1401 reg-names = "gmii-sel";
1402 };
1403 };
1404
1405 dcan1: can@481cc000 {
1406 compatible = "ti,dra7-d_can";
1407 ti,hwmods = "dcan1";
1408 reg = <0x4ae3c000 0x2000>;
1409 syscon-raminit = <&dra7_ctrl_core 0x558 0>;
1410 interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>;
1411 clocks = <&dcan1_sys_clk_mux>;
1412 status = "disabled";
1413 };
1414
1415 dcan2: can@481d0000 {
1416 compatible = "ti,dra7-d_can";
1417 ti,hwmods = "dcan2";
1418 reg = <0x48480000 0x2000>;
1419 syscon-raminit = <&dra7_ctrl_core 0x558 1>;
1420 interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
1421 clocks = <&sys_clkin1>;
1422 status = "disabled";
1423 };
1268 }; 1424 };
1269}; 1425};
1270 1426
diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts
index 41074288adfa..afc74fd4bb5e 100644
--- a/arch/arm/boot/dts/dra72-evm.dts
+++ b/arch/arm/boot/dts/dra72-evm.dts
@@ -17,6 +17,13 @@
17 device_type = "memory"; 17 device_type = "memory";
18 reg = <0x80000000 0x40000000>; /* 1024 MB */ 18 reg = <0x80000000 0x40000000>; /* 1024 MB */
19 }; 19 };
20
21 evm_3v3: fixedregulator-evm_3v3 {
22 compatible = "regulator-fixed";
23 regulator-name = "evm_3v3";
24 regulator-min-microvolt = <3300000>;
25 regulator-max-microvolt = <3300000>;
26 };
20}; 27};
21 28
22&dra7_pmx_core { 29&dra7_pmx_core {
@@ -26,6 +33,94 @@
26 0x404 (PIN_INPUT | MUX_MODE0) /* i2c1_scl.i2c1_scl */ 33 0x404 (PIN_INPUT | MUX_MODE0) /* i2c1_scl.i2c1_scl */
27 >; 34 >;
28 }; 35 };
36
37 nand_default: nand_default {
38 pinctrl-single,pins = <
39 0x0 (PIN_INPUT | MUX_MODE0) /* gpmc_ad0 */
40 0x4 (PIN_INPUT | MUX_MODE0) /* gpmc_ad1 */
41 0x8 (PIN_INPUT | MUX_MODE0) /* gpmc_ad2 */
42 0xc (PIN_INPUT | MUX_MODE0) /* gpmc_ad3 */
43 0x10 (PIN_INPUT | MUX_MODE0) /* gpmc_ad4 */
44 0x14 (PIN_INPUT | MUX_MODE0) /* gpmc_ad5 */
45 0x18 (PIN_INPUT | MUX_MODE0) /* gpmc_ad6 */
46 0x1c (PIN_INPUT | MUX_MODE0) /* gpmc_ad7 */
47 0x20 (PIN_INPUT | MUX_MODE0) /* gpmc_ad8 */
48 0x24 (PIN_INPUT | MUX_MODE0) /* gpmc_ad9 */
49 0x28 (PIN_INPUT | MUX_MODE0) /* gpmc_ad10 */
50 0x2c (PIN_INPUT | MUX_MODE0) /* gpmc_ad11 */
51 0x30 (PIN_INPUT | MUX_MODE0) /* gpmc_ad12 */
52 0x34 (PIN_INPUT | MUX_MODE0) /* gpmc_ad13 */
53 0x38 (PIN_INPUT | MUX_MODE0) /* gpmc_ad14 */
54 0x3c (PIN_INPUT | MUX_MODE0) /* gpmc_ad15 */
55 0xb4 (PIN_OUTPUT | MUX_MODE0) /* gpmc_cs0 */
56 0xc4 (PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale */
57 0xcc (PIN_OUTPUT | MUX_MODE0) /* gpmc_wen */
58 0xc8 (PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren */
59 0xd0 (PIN_OUTPUT | MUX_MODE0) /* gpmc_ben0 */
60 0xd8 (PIN_INPUT | MUX_MODE0) /* gpmc_wait0 */
61 >;
62 };
63
64 usb1_pins: pinmux_usb1_pins {
65 pinctrl-single,pins = <
66 0x280 (PIN_INPUT_SLEW | MUX_MODE0) /* usb1_drvvbus */
67 >;
68 };
69
70 usb2_pins: pinmux_usb2_pins {
71 pinctrl-single,pins = <
72 0x284 (PIN_INPUT_SLEW | MUX_MODE0) /* usb2_drvvbus */
73 >;
74 };
75
76 tps65917_pins_default: tps65917_pins_default {
77 pinctrl-single,pins = <
78 0x424 (PIN_INPUT_PULLUP | MUX_MODE1) /* wakeup3.sys_nirq1 */
79 >;
80 };
81
82 mmc1_pins_default: mmc1_pins_default {
83 pinctrl-single,pins = <
84 0x36c (PIN_INPUT | MUX_MODE14) /* mmc1sdcd.gpio219 */
85 0x354 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_clk.clk */
86 0x358 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_cmd.cmd */
87 0x35c (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_dat0.dat0 */
88 0x360 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_dat1.dat1 */
89 0x364 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_dat2.dat2 */
90 0x368 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc1_dat3.dat3 */
91 >;
92 };
93
94 mmc2_pins_default: mmc2_pins_default {
95 pinctrl-single,pins = <
96 0x9c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a23.mmc2_clk */
97 0xb0 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_cs1.mmc2_cmd */
98 0xa0 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a24.mmc2_dat0 */
99 0xa4 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a25.mmc2_dat1 */
100 0xa8 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a26.mmc2_dat2 */
101 0xac (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a27.mmc2_dat3 */
102 0x8c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a19.mmc2_dat4 */
103 0x90 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a20.mmc2_dat5 */
104 0x94 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a21.mmc2_dat6 */
105 0x98 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_a22.mmc2_dat7 */
106 >;
107 };
108
109 dcan1_pins_default: dcan1_pins_default {
110 pinctrl-single,pins = <
111 0x3d0 (PIN_OUTPUT | MUX_MODE0) /* dcan1_tx */
112 0x3d4 (MUX_MODE15) /* dcan1_rx.off */
113 0x418 (PULL_DIS | MUX_MODE1) /* wakeup0.dcan1_rx */
114 >;
115 };
116
117 dcan1_pins_sleep: dcan1_pins_sleep {
118 pinctrl-single,pins = <
119 0x3d0 (MUX_MODE15) /* dcan1_tx.off */
120 0x3d4 (MUX_MODE15) /* dcan1_rx.off */
121 0x418 (MUX_MODE15) /* wakeup0.off */
122 >;
123 };
29}; 124};
30 125
31&i2c1 { 126&i2c1 {
@@ -38,6 +133,9 @@
38 compatible = "ti,tps65917"; 133 compatible = "ti,tps65917";
39 reg = <0x58>; 134 reg = <0x58>;
40 135
136 pinctrl-names = "default";
137 pinctrl-0 = <&tps65917_pins_default>;
138
41 interrupts = <GIC_SPI 2 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */ 139 interrupts = <GIC_SPI 2 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
42 interrupt-parent = <&gic>; 140 interrupt-parent = <&gic>;
43 interrupt-controller; 141 interrupt-controller;
@@ -136,9 +234,230 @@
136 }; 234 };
137 }; 235 };
138 }; 236 };
237
238 tps65917_power_button {
239 compatible = "ti,palmas-pwrbutton";
240 interrupt-parent = <&tps65917>;
241 interrupts = <1 IRQ_TYPE_NONE>;
242 wakeup-source;
243 ti,palmas-long-press-seconds = <6>;
244 };
139 }; 245 };
140}; 246};
141 247
142&uart1 { 248&uart1 {
143 status = "okay"; 249 status = "okay";
144}; 250};
251
252&elm {
253 status = "okay";
254};
255
256&gpmc {
257 status = "okay";
258 pinctrl-names = "default";
259 pinctrl-0 = <&nand_default>;
260 ranges = <0 0 0 0x01000000>; /* minimum GPMC partition = 16MB */
261 nand@0,0 {
262 /* To use NAND, DIP switch SW5 must be set like so:
263 * SW5.1 (NAND_SELn) = ON (LOW)
264 * SW5.9 (GPMC_WPN) = OFF (HIGH)
265 */
266 reg = <0 0 4>; /* device IO registers */
267 ti,nand-ecc-opt = "bch8";
268 ti,elm-id = <&elm>;
269 nand-bus-width = <16>;
270 gpmc,device-width = <2>;
271 gpmc,sync-clk-ps = <0>;
272 gpmc,cs-on-ns = <0>;
273 gpmc,cs-rd-off-ns = <80>;
274 gpmc,cs-wr-off-ns = <80>;
275 gpmc,adv-on-ns = <0>;
276 gpmc,adv-rd-off-ns = <60>;
277 gpmc,adv-wr-off-ns = <60>;
278 gpmc,we-on-ns = <10>;
279 gpmc,we-off-ns = <50>;
280 gpmc,oe-on-ns = <4>;
281 gpmc,oe-off-ns = <40>;
282 gpmc,access-ns = <40>;
283 gpmc,wr-access-ns = <80>;
284 gpmc,rd-cycle-ns = <80>;
285 gpmc,wr-cycle-ns = <80>;
286 gpmc,bus-turnaround-ns = <0>;
287 gpmc,cycle2cycle-delay-ns = <0>;
288 gpmc,clk-activation-ns = <0>;
289 gpmc,wait-monitoring-ns = <0>;
290 gpmc,wr-data-mux-bus-ns = <0>;
291 /* MTD partition table */
292 /* All SPL-* partitions are sized to minimal length
293 * which can be independently programmable. For
294 * NAND flash this is equal to size of erase-block */
295 #address-cells = <1>;
296 #size-cells = <1>;
297 partition@0 {
298 label = "NAND.SPL";
299 reg = <0x00000000 0x000020000>;
300 };
301 partition@1 {
302 label = "NAND.SPL.backup1";
303 reg = <0x00020000 0x00020000>;
304 };
305 partition@2 {
306 label = "NAND.SPL.backup2";
307 reg = <0x00040000 0x00020000>;
308 };
309 partition@3 {
310 label = "NAND.SPL.backup3";
311 reg = <0x00060000 0x00020000>;
312 };
313 partition@4 {
314 label = "NAND.u-boot-spl-os";
315 reg = <0x00080000 0x00040000>;
316 };
317 partition@5 {
318 label = "NAND.u-boot";
319 reg = <0x000c0000 0x00100000>;
320 };
321 partition@6 {
322 label = "NAND.u-boot-env";
323 reg = <0x001c0000 0x00020000>;
324 };
325 partition@7 {
326 label = "NAND.u-boot-env.backup1";
327 reg = <0x001e0000 0x00020000>;
328 };
329 partition@8 {
330 label = "NAND.kernel";
331 reg = <0x00200000 0x00800000>;
332 };
333 partition@9 {
334 label = "NAND.file-system";
335 reg = <0x00a00000 0x0f600000>;
336 };
337 };
338};
339
340&usb2_phy1 {
341 phy-supply = <&ldo4_reg>;
342};
343
344&usb2_phy2 {
345 phy-supply = <&ldo4_reg>;
346};
347
348&usb1 {
349 dr_mode = "peripheral";
350 pinctrl-names = "default";
351 pinctrl-0 = <&usb1_pins>;
352};
353
354&usb2 {
355 dr_mode = "host";
356 pinctrl-names = "default";
357 pinctrl-0 = <&usb2_pins>;
358};
359
360&mmc1 {
361 status = "okay";
362 pinctrl-names = "default";
363 pinctrl-0 = <&mmc1_pins_default>;
364
365 vmmc-supply = <&ldo1_reg>;
366 bus-width = <4>;
367 /*
368 * SDCD signal is not being used here - using the fact that GPIO mode
369 * is a viable alternative
370 */
371 cd-gpios = <&gpio6 27 0>;
372};
373
374&mmc2 {
375 /* SW5-3 in ON position */
376 status = "okay";
377 pinctrl-names = "default";
378 pinctrl-0 = <&mmc2_pins_default>;
379
380 vmmc-supply = <&evm_3v3>;
381 bus-width = <8>;
382 ti,non-removable;
383};
384
385&dra7_pmx_core {
386 cpsw_default: cpsw_default {
387 pinctrl-single,pins = <
388 /* Slave 2 */
389 0x198 (PIN_OUTPUT | MUX_MODE3) /* vin2a_d12.rgmii1_txc */
390 0x19c (PIN_OUTPUT | MUX_MODE3) /* vin2a_d13.rgmii1_tctl */
391 0x1a0 (PIN_OUTPUT | MUX_MODE3) /* vin2a_d14.rgmii1_td3 */
392 0x1a4 (PIN_OUTPUT | MUX_MODE3) /* vin2a_d15.rgmii1_td2 */
393 0x1a8 (PIN_OUTPUT | MUX_MODE3) /* vin2a_d16.rgmii1_td1 */
394 0x1ac (PIN_OUTPUT | MUX_MODE3) /* vin2a_d17.rgmii1_td0 */
395 0x1b0 (PIN_INPUT | MUX_MODE3) /* vin2a_d18.rgmii1_rclk */
396 0x1b4 (PIN_INPUT | MUX_MODE3) /* vin2a_d19.rgmii1_rctl */
397 0x1b8 (PIN_INPUT | MUX_MODE3) /* vin2a_d20.rgmii1_rd3 */
398 0x1bc (PIN_INPUT | MUX_MODE3) /* vin2a_d21.rgmii1_rd2 */
399 0x1c0 (PIN_INPUT | MUX_MODE3) /* vin2a_d22.rgmii1_rd1 */
400 0x1c4 (PIN_INPUT | MUX_MODE3) /* vin2a_d23.rgmii1_rd0 */
401 >;
402
403 };
404
405 cpsw_sleep: cpsw_sleep {
406 pinctrl-single,pins = <
407 /* Slave 2 */
408 0x198 (MUX_MODE15)
409 0x19c (MUX_MODE15)
410 0x1a0 (MUX_MODE15)
411 0x1a4 (MUX_MODE15)
412 0x1a8 (MUX_MODE15)
413 0x1ac (MUX_MODE15)
414 0x1b0 (MUX_MODE15)
415 0x1b4 (MUX_MODE15)
416 0x1b8 (MUX_MODE15)
417 0x1bc (MUX_MODE15)
418 0x1c0 (MUX_MODE15)
419 0x1c4 (MUX_MODE15)
420 >;
421 };
422
423 davinci_mdio_default: davinci_mdio_default {
424 pinctrl-single,pins = <
425 /* MDIO */
426 0x23c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_d.mdio_d */
427 0x240 (PIN_INPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
428 >;
429 };
430
431 davinci_mdio_sleep: davinci_mdio_sleep {
432 pinctrl-single,pins = <
433 0x23c (MUX_MODE15)
434 0x240 (MUX_MODE15)
435 >;
436 };
437};
438
439&mac {
440 status = "okay";
441 pinctrl-names = "default", "sleep";
442 pinctrl-0 = <&cpsw_default>;
443 pinctrl-1 = <&cpsw_sleep>;
444};
445
446&cpsw_emac1 {
447 phy_id = <&davinci_mdio>, <3>;
448 phy-mode = "rgmii";
449};
450
451&davinci_mdio {
452 pinctrl-names = "default", "sleep";
453 pinctrl-0 = <&davinci_mdio_default>;
454 pinctrl-1 = <&davinci_mdio_sleep>;
455 active_slave = <1>;
456};
457
458&dcan1 {
459 status = "ok";
460 pinctrl-names = "default", "sleep";
461 pinctrl-0 = <&dcan1_pins_default>;
462 pinctrl-1 = <&dcan1_pins_sleep>;
463};
diff --git a/arch/arm/boot/dts/dra74x.dtsi b/arch/arm/boot/dts/dra74x.dtsi
index 3be544c4891f..10173fab1a15 100644
--- a/arch/arm/boot/dts/dra74x.dtsi
+++ b/arch/arm/boot/dts/dra74x.dtsi
@@ -44,4 +44,26 @@
44 interrupts = <GIC_SPI DIRECT_IRQ(131) IRQ_TYPE_LEVEL_HIGH>, 44 interrupts = <GIC_SPI DIRECT_IRQ(131) IRQ_TYPE_LEVEL_HIGH>,
45 <GIC_SPI DIRECT_IRQ(132) IRQ_TYPE_LEVEL_HIGH>; 45 <GIC_SPI DIRECT_IRQ(132) IRQ_TYPE_LEVEL_HIGH>;
46 }; 46 };
47
48 ocp {
49 omap_dwc3_4: omap_dwc3_4@48940000 {
50 compatible = "ti,dwc3";
51 ti,hwmods = "usb_otg_ss4";
52 reg = <0x48940000 0x10000>;
53 interrupts = <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH>;
54 #address-cells = <1>;
55 #size-cells = <1>;
56 utmi-mode = <2>;
57 ranges;
58 status = "disabled";
59 usb4: usb@48950000 {
60 compatible = "snps,dwc3";
61 reg = <0x48950000 0x17000>;
62 interrupts = <GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>;
63 tx-fifo-resize;
64 maximum-speed = "high-speed";
65 dr_mode = "otg";
66 };
67 };
68 };
47}; 69};
diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts b/arch/arm/boot/dts/emev2-kzm9d.dts
index 50ccd151091e..667d323e80a3 100644
--- a/arch/arm/boot/dts/emev2-kzm9d.dts
+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
@@ -25,37 +25,7 @@
25 25
26 chosen { 26 chosen {
27 bootargs = "console=ttyS1,115200n81 ignore_loglevel root=/dev/nfs ip=dhcp"; 27 bootargs = "console=ttyS1,115200n81 ignore_loglevel root=/dev/nfs ip=dhcp";
28 }; 28 stdout-path = &uart1;
29
30 reg_1p8v: regulator@0 {
31 compatible = "regulator-fixed";
32 regulator-name = "fixed-1.8V";
33 regulator-min-microvolt = <1800000>;
34 regulator-max-microvolt = <1800000>;
35 regulator-always-on;
36 regulator-boot-on;
37 };
38
39 reg_3p3v: regulator@1 {
40 compatible = "regulator-fixed";
41 regulator-name = "fixed-3.3V";
42 regulator-min-microvolt = <3300000>;
43 regulator-max-microvolt = <3300000>;
44 regulator-always-on;
45 regulator-boot-on;
46 };
47
48 lan9220@20000000 {
49 compatible = "smsc,lan9220", "smsc,lan9115";
50 reg = <0x20000000 0x10000>;
51 phy-mode = "mii";
52 interrupt-parent = <&gpio0>;
53 interrupts = <1 IRQ_TYPE_EDGE_RISING>;
54 reg-io-width = <4>;
55 smsc,irq-active-high;
56 smsc,irq-push-pull;
57 vddvario-supply = <&reg_1p8v>;
58 vdd33a-supply = <&reg_3p3v>;
59 }; 29 };
60 30
61 gpio_keys { 31 gpio_keys {
@@ -92,4 +62,35 @@
92 gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>; 62 gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
93 }; 63 };
94 }; 64 };
65
66 reg_1p8v: regulator@0 {
67 compatible = "regulator-fixed";
68 regulator-name = "fixed-1.8V";
69 regulator-min-microvolt = <1800000>;
70 regulator-max-microvolt = <1800000>;
71 regulator-always-on;
72 regulator-boot-on;
73 };
74
75 reg_3p3v: regulator@1 {
76 compatible = "regulator-fixed";
77 regulator-name = "fixed-3.3V";
78 regulator-min-microvolt = <3300000>;
79 regulator-max-microvolt = <3300000>;
80 regulator-always-on;
81 regulator-boot-on;
82 };
83
84 lan9220@20000000 {
85 compatible = "smsc,lan9220", "smsc,lan9115";
86 reg = <0x20000000 0x10000>;
87 phy-mode = "mii";
88 interrupt-parent = <&gpio0>;
89 interrupts = <1 IRQ_TYPE_EDGE_RISING>;
90 reg-io-width = <4>;
91 smsc,irq-active-high;
92 smsc,irq-push-pull;
93 vddvario-supply = <&reg_1p8v>;
94 vdd33a-supply = <&reg_3p3v>;
95 };
95}; 96};
diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
index 00eeed3721b6..cc7bfe0ba40a 100644
--- a/arch/arm/boot/dts/emev2.dtsi
+++ b/arch/arm/boot/dts/emev2.dtsi
@@ -55,7 +55,7 @@
55 <0 121 IRQ_TYPE_LEVEL_HIGH>; 55 <0 121 IRQ_TYPE_LEVEL_HIGH>;
56 }; 56 };
57 57
58 smu@e0110000 { 58 clocks@e0110000 {
59 compatible = "renesas,emev2-smu"; 59 compatible = "renesas,emev2-smu";
60 reg = <0xe0110000 0x10000>; 60 reg = <0xe0110000 0x10000>;
61 #address-cells = <2>; 61 #address-cells = <2>;
@@ -129,7 +129,7 @@
129 }; 129 };
130 }; 130 };
131 131
132 sti@e0180000 { 132 timer@e0180000 {
133 compatible = "renesas,em-sti"; 133 compatible = "renesas,em-sti";
134 reg = <0xe0180000 0x54>; 134 reg = <0xe0180000 0x54>;
135 interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH>; 135 interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH>;
@@ -137,7 +137,7 @@
137 clock-names = "sclk"; 137 clock-names = "sclk";
138 }; 138 };
139 139
140 uart@e1020000 { 140 uart0: serial@e1020000 {
141 compatible = "renesas,em-uart"; 141 compatible = "renesas,em-uart";
142 reg = <0xe1020000 0x38>; 142 reg = <0xe1020000 0x38>;
143 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>; 143 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
@@ -145,7 +145,7 @@
145 clock-names = "sclk"; 145 clock-names = "sclk";
146 }; 146 };
147 147
148 uart@e1030000 { 148 uart1: serial@e1030000 {
149 compatible = "renesas,em-uart"; 149 compatible = "renesas,em-uart";
150 reg = <0xe1030000 0x38>; 150 reg = <0xe1030000 0x38>;
151 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>; 151 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
@@ -153,7 +153,7 @@
153 clock-names = "sclk"; 153 clock-names = "sclk";
154 }; 154 };
155 155
156 uart@e1040000 { 156 uart2: serial@e1040000 {
157 compatible = "renesas,em-uart"; 157 compatible = "renesas,em-uart";
158 reg = <0xe1040000 0x38>; 158 reg = <0xe1040000 0x38>;
159 interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>; 159 interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>;
@@ -161,7 +161,7 @@
161 clock-names = "sclk"; 161 clock-names = "sclk";
162 }; 162 };
163 163
164 uart@e1050000 { 164 uart3: serial@e1050000 {
165 compatible = "renesas,em-uart"; 165 compatible = "renesas,em-uart";
166 reg = <0xe1050000 0x38>; 166 reg = <0xe1050000 0x38>;
167 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>; 167 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/boot/dts/exynos3250-monk.dts b/arch/arm/boot/dts/exynos3250-monk.dts
new file mode 100644
index 000000000000..24822aa98057
--- /dev/null
+++ b/arch/arm/boot/dts/exynos3250-monk.dts
@@ -0,0 +1,579 @@
1/*
2 * Samsung's Exynos3250 based Monk board device tree source
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Device tree source file for Samsung's Monk board which is based on
8 * Samsung Exynos3250 SoC.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15/dts-v1/;
16#include "exynos3250.dtsi"
17#include <dt-bindings/input/input.h>
18
19/ {
20 model = "Samsung Monk board";
21 compatible = "samsung,monk", "samsung,exynos3250", "samsung,exynos3";
22
23 aliases {
24 i2c7 = &i2c_max77836;
25 };
26
27 memory {
28 reg = <0x40000000 0x1ff00000>;
29 };
30
31 firmware@0205F000 {
32 compatible = "samsung,secure-firmware";
33 reg = <0x0205F000 0x1000>;
34 };
35
36 gpio_keys {
37 compatible = "gpio-keys";
38
39 power_key {
40 interrupt-parent = <&gpx2>;
41 interrupts = <7 0>;
42 gpios = <&gpx2 7 1>;
43 linux,code = <KEY_POWER>;
44 label = "power key";
45 debounce-interval = <10>;
46 gpio-key,wakeup;
47 };
48 };
49
50 vemmc_reg: voltage-regulator-0 {
51 compatible = "regulator-fixed";
52 regulator-name = "V_EMMC_2.8V-fixed";
53 regulator-min-microvolt = <2800000>;
54 regulator-max-microvolt = <2800000>;
55 gpio = <&gpk0 2 0>;
56 enable-active-high;
57 };
58
59 i2c_max77836: i2c-gpio-0 {
60 compatible = "i2c-gpio";
61 gpios = <&gpd0 2 0>, <&gpd0 3 0>;
62 #address-cells = <1>;
63 #size-cells = <0>;
64
65 max77836: subpmic@25 {
66 compatible = "maxim,max77836";
67 interrupt-parent = <&gpx1>;
68 interrupts = <5 0>;
69 reg = <0x25>;
70 wakeup;
71
72 muic: max77836-muic {
73 compatible = "maxim,max77836-muic";
74 };
75
76 regulators {
77 compatible = "maxim,max77836-regulator";
78 safeout_reg: SAFEOUT {
79 regulator-name = "SAFEOUT";
80 };
81
82 charger_reg: CHARGER {
83 regulator-name = "CHARGER";
84 regulator-min-microamp = <45000>;
85 regulator-max-microamp = <475000>;
86 regulator-boot-on;
87 };
88
89 motor_reg: LDO1 {
90 regulator-name = "MOT_2.7V";
91 regulator-min-microvolt = <1100000>;
92 regulator-max-microvolt = <2700000>;
93 };
94
95 LDO2 {
96 regulator-name = "UNUSED_LDO2";
97 regulator-min-microvolt = <800000>;
98 regulator-max-microvolt = <3950000>;
99 };
100 };
101
102 charger {
103 compatible = "maxim,max77836-charger";
104
105 maxim,constant-uvolt = <4350000>;
106 maxim,fast-charge-uamp = <225000>;
107 maxim,eoc-uamp = <7500>;
108 maxim,ovp-uvolt = <6500000>;
109 };
110 };
111 };
112};
113
114&adc {
115 vdd-supply = <&ldo3_reg>;
116 status = "okay";
117 assigned-clocks = <&cmu CLK_SCLK_TSADC>;
118 assigned-clock-rates = <6000000>;
119
120 thermistor-ap {
121 compatible = "ntc,ncp15wb473";
122 pullup-uv = <1800000>;
123 pullup-ohm = <100000>;
124 pulldown-ohm = <100000>;
125 io-channels = <&adc 0>;
126 };
127
128 thermistor-battery {
129 compatible = "ntc,ncp15wb473";
130 pullup-uv = <1800000>;
131 pullup-ohm = <100000>;
132 pulldown-ohm = <100000>;
133 io-channels = <&adc 1>;
134 };
135};
136
137&i2c_0 {
138 #address-cells = <1>;
139 #size-cells = <0>;
140 samsung,i2c-sda-delay = <100>;
141 samsung,i2c-slave-addr = <0x10>;
142 samsung,i2c-max-bus-freq = <100000>;
143 status = "okay";
144
145 s2mps14_pmic@66 {
146 compatible = "samsung,s2mps14-pmic";
147 interrupt-parent = <&gpx0>;
148 interrupts = <7 0>;
149 reg = <0x66>;
150 wakeup;
151
152 s2mps14_osc: clocks {
153 compatible = "samsung,s2mps14-clk";
154 #clock-cells = <1>;
155 clock-output-names = "s2mps14_ap", "unused",
156 "s2mps14_bt";
157 };
158
159 regulators {
160 ldo1_reg: LDO1 {
161 regulator-name = "VAP_ALIVE_1.0V";
162 regulator-min-microvolt = <1000000>;
163 regulator-max-microvolt = <1000000>;
164 regulator-always-on;
165 };
166
167 ldo2_reg: LDO2 {
168 regulator-name = "VAP_M1_1.2V";
169 regulator-min-microvolt = <1200000>;
170 regulator-max-microvolt = <1200000>;
171 regulator-always-on;
172 };
173
174 ldo3_reg: LDO3 {
175 regulator-name = "VCC_AP_1.8V";
176 regulator-min-microvolt = <1800000>;
177 regulator-max-microvolt = <1800000>;
178 regulator-always-on;
179 };
180
181 ldo4_reg: LDO4 {
182 regulator-name = "VAP_AVDD_PLL1";
183 regulator-min-microvolt = <1800000>;
184 regulator-max-microvolt = <1800000>;
185 regulator-always-on;
186 };
187
188 ldo5_reg: LDO5 {
189 regulator-name = "VAP_PLL_ISO_1.0V";
190 regulator-min-microvolt = <1000000>;
191 regulator-max-microvolt = <1000000>;
192 regulator-always-on;
193 };
194
195 ldo6_reg: LDO6 {
196 regulator-name = "VAP_MIPI_1.0V";
197 regulator-min-microvolt = <1000000>;
198 regulator-max-microvolt = <1000000>;
199 };
200
201 ldo7_reg: LDO7 {
202 regulator-name = "VAP_AVDD_1.8V";
203 regulator-min-microvolt = <1800000>;
204 regulator-max-microvolt = <1800000>;
205 regulator-always-on;
206 };
207
208 ldo8_reg: LDO8 {
209 regulator-name = "VAP_USB_3.0V";
210 regulator-min-microvolt = <3000000>;
211 regulator-max-microvolt = <3000000>;
212 regulator-always-on;
213 };
214
215 ldo9_reg: LDO9 {
216 regulator-name = "V_LPDDR_1.2V";
217 regulator-min-microvolt = <1200000>;
218 regulator-max-microvolt = <1200000>;
219 regulator-always-on;
220 };
221
222 ldo10_reg: LDO10 {
223 regulator-name = "UNUSED_LDO10";
224 regulator-min-microvolt = <1000000>;
225 regulator-max-microvolt = <1000000>;
226 };
227
228 ldo11_reg: LDO11 {
229 regulator-name = "V_EMMC_1.8V";
230 regulator-min-microvolt = <1800000>;
231 regulator-max-microvolt = <1800000>;
232 samsung,ext-control-gpios = <&gpk0 2 0>;
233 };
234
235 ldo12_reg: LDO12 {
236 regulator-name = "V_EMMC_2.8V";
237 regulator-min-microvolt = <2800000>;
238 regulator-max-microvolt = <2800000>;
239 samsung,ext-control-gpios = <&gpk0 2 0>;
240 };
241
242 ldo13_reg: LDO13 {
243 regulator-name = "VSENSOR_2.85V";
244 regulator-min-microvolt = <2850000>;
245 regulator-max-microvolt = <2850000>;
246 regulator-always-on;
247 };
248
249 ldo14_reg: LDO14 {
250 regulator-name = "UNUSED_LDO14";
251 regulator-min-microvolt = <1800000>;
252 regulator-max-microvolt = <1800000>;
253 };
254
255 ldo15_reg: LDO15 {
256 regulator-name = "TSP_AVDD_3.3V";
257 regulator-min-microvolt = <3300000>;
258 regulator-max-microvolt = <3300000>;
259 };
260
261 ldo16_reg: LDO16 {
262 regulator-name = "LCD_VDD_3.3V";
263 regulator-min-microvolt = <3300000>;
264 regulator-max-microvolt = <3300000>;
265 };
266
267 ldo17_reg: LDO17 {
268 regulator-name = "UNUSED_LDO17";
269 regulator-min-microvolt = <1800000>;
270 regulator-max-microvolt = <1800000>;
271 };
272
273 ldo18_reg: LDO18 {
274 regulator-name = "UNUSED_LDO18";
275 regulator-min-microvolt = <1800000>;
276 regulator-max-microvolt = <1800000>;
277 };
278
279 ldo19_reg: LDO19 {
280 regulator-name = "TSP_VDD_1.8V";
281 regulator-min-microvolt = <1800000>;
282 regulator-max-microvolt = <1800000>;
283 };
284
285 ldo20_reg: LDO20 {
286 regulator-name = "LCD_VDD_1.8V";
287 regulator-min-microvolt = <1800000>;
288 regulator-max-microvolt = <1800000>;
289 };
290
291 ldo21_reg: LDO21 {
292 regulator-name = "UNUSED_LDO21";
293 regulator-min-microvolt = <1000000>;
294 regulator-max-microvolt = <1000000>;
295 };
296
297 ldo22_reg: LDO22 {
298 regulator-name = "UNUSED_LDO22";
299 regulator-min-microvolt = <1000000>;
300 regulator-max-microvolt = <1000000>;
301 };
302
303 ldo23_reg: LDO23 {
304 regulator-name = "UNUSED_LDO23";
305 regulator-min-microvolt = <1000000>;
306 regulator-max-microvolt = <1000000>;
307 regulator-always-on;
308 };
309
310 ldo24_reg: LDO24 {
311 regulator-name = "UNUSED_LDO24";
312 regulator-min-microvolt = <1800000>;
313 regulator-max-microvolt = <1800000>;
314 };
315
316 ldo25_reg: LDO25 {
317 regulator-name = "UNUSED_LDO25";
318 regulator-min-microvolt = <1800000>;
319 regulator-max-microvolt = <1800000>;
320 };
321
322 buck1_reg: BUCK1 {
323 regulator-name = "VAP_MIF_1.0V";
324 regulator-min-microvolt = <800000>;
325 regulator-max-microvolt = <900000>;
326 regulator-always-on;
327 };
328
329 buck2_reg: BUCK2 {
330 regulator-name = "VAP_ARM_1.0V";
331 regulator-min-microvolt = <850000>;
332 regulator-max-microvolt = <1150000>;
333 regulator-always-on;
334 };
335
336 buck3_reg: BUCK3 {
337 regulator-name = "VAP_INT3D_1.0V";
338 regulator-min-microvolt = <850000>;
339 regulator-max-microvolt = <1000000>;
340 regulator-always-on;
341 };
342
343 buck4_reg: BUCK4 {
344 regulator-name = "VCC_SUB_1.95V";
345 regulator-min-microvolt = <1950000>;
346 regulator-max-microvolt = <1950000>;
347 regulator-always-on;
348 };
349
350 buck5_reg: BUCK5 {
351 regulator-name = "VCC_SUB_1.35V";
352 regulator-min-microvolt = <1350000>;
353 regulator-max-microvolt = <1350000>;
354 regulator-always-on;
355 };
356 };
357 };
358};
359
360&i2c_1 {
361 #address-cells = <1>;
362 #size-cells = <0>;
363 samsung,i2c-sda-delay = <100>;
364 samsung,i2c-slave-addr = <0x10>;
365 samsung,i2c-max-bus-freq = <400000>;
366 status = "okay";
367
368 fuelgauge@36 {
369 compatible = "maxim,max77836-battery";
370 interrupt-parent = <&gpx1>;
371 interrupts = <2 8>;
372 reg = <0x36>;
373 };
374};
375
376&i2s2 {
377 status = "okay";
378};
379
380&mshc_0 {
381 #address-cells = <1>;
382 #size-cells = <0>;
383 num-slots = <1>;
384 broken-cd;
385 non-removable;
386 cap-mmc-highspeed;
387 desc-num = <4>;
388 mmc-hs200-1_8v;
389 card-detect-delay = <200>;
390 vmmc-supply = <&vemmc_reg>;
391 clock-frequency = <100000000>;
392 clock-freq-min-max = <400000 100000000>;
393 samsung,dw-mshc-ciu-div = <1>;
394 samsung,dw-mshc-sdr-timing = <0 1>;
395 samsung,dw-mshc-ddr-timing = <1 2>;
396 pinctrl-names = "default";
397 pinctrl-0 = <&sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8>;
398 bus-width = <8>;
399 status = "okay";
400};
401
402&serial_0 {
403 assigned-clocks = <&cmu CLK_SCLK_UART0>;
404 assigned-clock-rates = <100000000>;
405 status = "okay";
406};
407
408&serial_1 {
409 status = "okay";
410};
411
412&tmu {
413 vtmu-supply = <&ldo7_reg>;
414 status = "okay";
415};
416
417&rtc {
418 clocks = <&cmu CLK_RTC>, <&s2mps14_osc 0>;
419 clock-names = "rtc", "rtc_src";
420 status = "okay";
421};
422
423&xusbxti {
424 clock-frequency = <24000000>;
425};
426
427&pinctrl_0 {
428 pinctrl-names = "default";
429 pinctrl-0 = <&sleep0>;
430
431 sleep0: sleep-state {
432 PIN_SLP(gpa0-0, INPUT, DOWN);
433 PIN_SLP(gpa0-1, INPUT, DOWN);
434 PIN_SLP(gpa0-2, INPUT, DOWN);
435 PIN_SLP(gpa0-3, INPUT, DOWN);
436 PIN_SLP(gpa0-4, INPUT, DOWN);
437 PIN_SLP(gpa0-5, INPUT, DOWN);
438 PIN_SLP(gpa0-6, INPUT, DOWN);
439 PIN_SLP(gpa0-7, INPUT, DOWN);
440
441 PIN_SLP(gpa1-0, INPUT, DOWN);
442 PIN_SLP(gpa1-1, INPUT, DOWN);
443 PIN_SLP(gpa1-2, INPUT, DOWN);
444 PIN_SLP(gpa1-3, INPUT, DOWN);
445 PIN_SLP(gpa1-4, INPUT, DOWN);
446 PIN_SLP(gpa1-5, INPUT, DOWN);
447
448 PIN_SLP(gpb-0, PREV, NONE);
449 PIN_SLP(gpb-1, PREV, NONE);
450 PIN_SLP(gpb-2, PREV, NONE);
451 PIN_SLP(gpb-3, PREV, NONE);
452 PIN_SLP(gpb-4, INPUT, DOWN);
453 PIN_SLP(gpb-5, INPUT, DOWN);
454 PIN_SLP(gpb-6, INPUT, DOWN);
455 PIN_SLP(gpb-7, INPUT, DOWN);
456
457 PIN_SLP(gpc0-0, INPUT, DOWN);
458 PIN_SLP(gpc0-1, INPUT, DOWN);
459 PIN_SLP(gpc0-2, INPUT, DOWN);
460 PIN_SLP(gpc0-3, INPUT, DOWN);
461 PIN_SLP(gpc0-4, INPUT, DOWN);
462
463 PIN_SLP(gpc1-0, INPUT, DOWN);
464 PIN_SLP(gpc1-1, INPUT, DOWN);
465 PIN_SLP(gpc1-2, INPUT, DOWN);
466 PIN_SLP(gpc1-3, INPUT, DOWN);
467 PIN_SLP(gpc1-4, INPUT, DOWN);
468
469 PIN_SLP(gpd0-0, INPUT, DOWN);
470 PIN_SLP(gpd0-1, INPUT, DOWN);
471 PIN_SLP(gpd0-2, INPUT, NONE);
472 PIN_SLP(gpd0-3, INPUT, NONE);
473
474 PIN_SLP(gpd1-0, INPUT, NONE);
475 PIN_SLP(gpd1-1, INPUT, NONE);
476 PIN_SLP(gpd1-2, INPUT, NONE);
477 PIN_SLP(gpd1-3, INPUT, NONE);
478 };
479};
480
481&pinctrl_1 {
482 pinctrl-names = "default";
483 pinctrl-0 = <&sleep1>;
484
485 sleep1: sleep-state {
486 PIN_SLP(gpe0-0, PREV, NONE);
487 PIN_SLP(gpe0-1, PREV, NONE);
488 PIN_SLP(gpe0-2, INPUT, DOWN);
489 PIN_SLP(gpe0-3, INPUT, DOWN);
490 PIN_SLP(gpe0-4, PREV, NONE);
491 PIN_SLP(gpe0-5, INPUT, DOWN);
492 PIN_SLP(gpe0-6, INPUT, DOWN);
493 PIN_SLP(gpe0-7, INPUT, DOWN);
494
495 PIN_SLP(gpe1-0, INPUT, DOWN);
496 PIN_SLP(gpe1-1, PREV, NONE);
497 PIN_SLP(gpe1-2, INPUT, DOWN);
498 PIN_SLP(gpe1-3, INPUT, DOWN);
499 PIN_SLP(gpe1-4, INPUT, DOWN);
500 PIN_SLP(gpe1-5, INPUT, DOWN);
501 PIN_SLP(gpe1-6, INPUT, DOWN);
502 PIN_SLP(gpe1-7, INPUT, NONE);
503
504 PIN_SLP(gpe2-0, INPUT, NONE);
505 PIN_SLP(gpe2-1, INPUT, NONE);
506 PIN_SLP(gpe2-2, INPUT, NONE);
507
508 PIN_SLP(gpk0-0, INPUT, DOWN);
509 PIN_SLP(gpk0-1, INPUT, DOWN);
510 PIN_SLP(gpk0-2, OUT0, NONE);
511 PIN_SLP(gpk0-3, INPUT, DOWN);
512 PIN_SLP(gpk0-4, INPUT, DOWN);
513 PIN_SLP(gpk0-5, INPUT, DOWN);
514 PIN_SLP(gpk0-6, INPUT, DOWN);
515 PIN_SLP(gpk0-7, INPUT, DOWN);
516
517 PIN_SLP(gpk1-0, PREV, NONE);
518 PIN_SLP(gpk1-1, PREV, NONE);
519 PIN_SLP(gpk1-2, INPUT, DOWN);
520 PIN_SLP(gpk1-3, PREV, NONE);
521 PIN_SLP(gpk1-4, PREV, NONE);
522 PIN_SLP(gpk1-5, PREV, NONE);
523 PIN_SLP(gpk1-6, PREV, NONE);
524
525 PIN_SLP(gpk2-0, INPUT, DOWN);
526 PIN_SLP(gpk2-1, INPUT, DOWN);
527 PIN_SLP(gpk2-2, INPUT, DOWN);
528 PIN_SLP(gpk2-3, INPUT, DOWN);
529 PIN_SLP(gpk2-4, INPUT, DOWN);
530 PIN_SLP(gpk2-5, INPUT, DOWN);
531 PIN_SLP(gpk2-6, INPUT, DOWN);
532
533 PIN_SLP(gpl0-0, INPUT, DOWN);
534 PIN_SLP(gpl0-1, INPUT, DOWN);
535 PIN_SLP(gpl0-2, INPUT, DOWN);
536 PIN_SLP(gpl0-3, INPUT, DOWN);
537
538 PIN_SLP(gpm0-0, INPUT, DOWN);
539 PIN_SLP(gpm0-1, INPUT, DOWN);
540 PIN_SLP(gpm0-2, INPUT, DOWN);
541 PIN_SLP(gpm0-3, INPUT, DOWN);
542 PIN_SLP(gpm0-4, INPUT, DOWN);
543 PIN_SLP(gpm0-5, INPUT, DOWN);
544 PIN_SLP(gpm0-6, INPUT, DOWN);
545 PIN_SLP(gpm0-7, INPUT, DOWN);
546
547 PIN_SLP(gpm1-0, INPUT, DOWN);
548 PIN_SLP(gpm1-1, INPUT, DOWN);
549 PIN_SLP(gpm1-2, INPUT, DOWN);
550 PIN_SLP(gpm1-3, INPUT, DOWN);
551 PIN_SLP(gpm1-4, INPUT, DOWN);
552 PIN_SLP(gpm1-5, INPUT, DOWN);
553 PIN_SLP(gpm1-6, INPUT, DOWN);
554
555 PIN_SLP(gpm2-0, INPUT, DOWN);
556 PIN_SLP(gpm2-1, INPUT, DOWN);
557 PIN_SLP(gpm2-2, INPUT, DOWN);
558 PIN_SLP(gpm2-3, INPUT, DOWN);
559 PIN_SLP(gpm2-4, INPUT, DOWN);
560
561 PIN_SLP(gpm3-0, INPUT, DOWN);
562 PIN_SLP(gpm3-1, INPUT, DOWN);
563 PIN_SLP(gpm3-2, INPUT, DOWN);
564 PIN_SLP(gpm3-3, INPUT, DOWN);
565 PIN_SLP(gpm3-4, INPUT, DOWN);
566 PIN_SLP(gpm3-5, INPUT, DOWN);
567 PIN_SLP(gpm3-6, INPUT, DOWN);
568 PIN_SLP(gpm3-7, INPUT, DOWN);
569
570 PIN_SLP(gpm4-0, INPUT, DOWN);
571 PIN_SLP(gpm4-1, INPUT, DOWN);
572 PIN_SLP(gpm4-2, INPUT, DOWN);
573 PIN_SLP(gpm4-3, INPUT, DOWN);
574 PIN_SLP(gpm4-4, INPUT, DOWN);
575 PIN_SLP(gpm4-5, INPUT, DOWN);
576 PIN_SLP(gpm4-6, INPUT, DOWN);
577 PIN_SLP(gpm4-7, INPUT, DOWN);
578 };
579};
diff --git a/arch/arm/boot/dts/exynos3250-pinctrl.dtsi b/arch/arm/boot/dts/exynos3250-pinctrl.dtsi
index 47b92c150f4e..5ab81c39e2c9 100644
--- a/arch/arm/boot/dts/exynos3250-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos3250-pinctrl.dtsi
@@ -12,6 +12,22 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13*/ 13*/
14 14
15#define PIN_PULL_NONE 0
16#define PIN_PULL_DOWN 1
17#define PIN_PULL_UP 3
18
19#define PIN_PDN_OUT0 0
20#define PIN_PDN_OUT1 1
21#define PIN_PDN_INPUT 2
22#define PIN_PDN_PREV 3
23
24#define PIN_SLP(_pin, _mode, _pull) \
25 _pin { \
26 samsung,pins = #_pin; \
27 samsung,pin-con-pdn = <PIN_PDN_ ##_mode>; \
28 samsung,pin-pud-pdn = <PIN_PULL_ ##_pull>; \
29 }
30
15&pinctrl_0 { 31&pinctrl_0 {
16 gpa0: gpa0 { 32 gpa0: gpa0 {
17 gpio-controller; 33 gpio-controller;
diff --git a/arch/arm/boot/dts/exynos3250-rinato.dts b/arch/arm/boot/dts/exynos3250-rinato.dts
new file mode 100644
index 000000000000..80aa8b4c4a3d
--- /dev/null
+++ b/arch/arm/boot/dts/exynos3250-rinato.dts
@@ -0,0 +1,682 @@
1/*
2 * Samsung's Exynos3250 based Rinato board device tree source
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Device tree source file for Samsung's Rinato board which is based on
8 * Samsung Exynos3250 SoC.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15/dts-v1/;
16#include "exynos3250.dtsi"
17#include <dt-bindings/input/input.h>
18
19/ {
20 model = "Samsung Rinato board";
21 compatible = "samsung,rinato", "samsung,exynos3250", "samsung,exynos3";
22
23 aliases {
24 i2c7 = &i2c_max77836;
25 };
26
27 memory {
28 reg = <0x40000000 0x1ff00000>;
29 };
30
31 firmware@0205F000 {
32 compatible = "samsung,secure-firmware";
33 reg = <0x0205F000 0x1000>;
34 };
35
36 gpio_keys {
37 compatible = "gpio-keys";
38
39 power_key {
40 interrupt-parent = <&gpx2>;
41 interrupts = <7 0>;
42 gpios = <&gpx2 7 1>;
43 linux,code = <KEY_POWER>;
44 label = "power key";
45 debounce-interval = <10>;
46 gpio-key,wakeup;
47 };
48 };
49
50 i2c_max77836: i2c-gpio-0 {
51 compatible = "i2c-gpio";
52 gpios = <&gpd0 2 0>, <&gpd0 3 0>;
53 #address-cells = <1>;
54 #size-cells = <0>;
55
56 max77836: subpmic@25 {
57 compatible = "maxim,max77836";
58 interrupt-parent = <&gpx1>;
59 interrupts = <5 0>;
60 reg = <0x25>;
61 wakeup;
62
63 muic: max77836-muic {
64 compatible = "maxim,max77836-muic";
65 };
66
67 regulators {
68 compatible = "maxim,max77836-regulator";
69 safeout_reg: SAFEOUT {
70 regulator-name = "SAFEOUT";
71 };
72
73 charger_reg: CHARGER {
74 regulator-name = "CHARGER";
75 regulator-min-microamp = <45000>;
76 regulator-max-microamp = <475000>;
77 regulator-boot-on;
78 };
79
80 motor_reg: LDO1 {
81 regulator-name = "MOT_2.7V";
82 regulator-min-microvolt = <1100000>;
83 regulator-max-microvolt = <2700000>;
84 };
85
86 LDO2 {
87 regulator-name = "UNUSED_LDO2";
88 regulator-min-microvolt = <800000>;
89 regulator-max-microvolt = <3950000>;
90 };
91 };
92
93 charger {
94 compatible = "maxim,max77836-charger";
95
96 maxim,constant-uvolt = <4350000>;
97 maxim,fast-charge-uamp = <225000>;
98 maxim,eoc-uamp = <7500>;
99 maxim,ovp-uvolt = <6500000>;
100 };
101 };
102 };
103};
104
105&adc {
106 vdd-supply = <&ldo3_reg>;
107 status = "okay";
108 assigned-clocks = <&cmu CLK_SCLK_TSADC>;
109 assigned-clock-rates = <6000000>;
110
111 thermistor-ap {
112 compatible = "ntc,ncp15wb473";
113 pullup-uv = <1800000>;
114 pullup-ohm = <100000>;
115 pulldown-ohm = <100000>;
116 io-channels = <&adc 0>;
117 };
118
119 thermistor-battery {
120 compatible = "ntc,ncp15wb473";
121 pullup-uv = <1800000>;
122 pullup-ohm = <100000>;
123 pulldown-ohm = <100000>;
124 io-channels = <&adc 1>;
125 };
126};
127
128&i2c_0 {
129 #address-cells = <1>;
130 #size-cells = <0>;
131 samsung,i2c-sda-delay = <100>;
132 samsung,i2c-slave-addr = <0x10>;
133 samsung,i2c-max-bus-freq = <100000>;
134 status = "okay";
135
136 s2mps14_pmic@66 {
137 compatible = "samsung,s2mps14-pmic";
138 interrupt-parent = <&gpx0>;
139 interrupts = <7 0>;
140 reg = <0x66>;
141 wakeup;
142
143 s2mps14_osc: clocks {
144 compatible = "samsung,s2mps14-clk";
145 #clock-cells = <1>;
146 clock-output-names = "s2mps14_ap", "unused",
147 "s2mps14_bt";
148 };
149
150 regulators {
151 ldo1_reg: LDO1 {
152 regulator-name = "VAP_ALIVE_1.0V";
153 regulator-min-microvolt = <1000000>;
154 regulator-max-microvolt = <1000000>;
155 regulator-always-on;
156
157 regulator-state-mem {
158 regulator-on-in-suspend;
159 };
160 };
161
162 ldo2_reg: LDO2 {
163 regulator-name = "VAP_M1_1.2V";
164 regulator-min-microvolt = <1200000>;
165 regulator-max-microvolt = <1200000>;
166 regulator-always-on;
167
168 regulator-state-mem {
169 regulator-off-in-suspend;
170 };
171 };
172
173 ldo3_reg: LDO3 {
174 regulator-name = "VCC_AP_1.8V";
175 regulator-min-microvolt = <1800000>;
176 regulator-max-microvolt = <1800000>;
177 regulator-always-on;
178
179 regulator-state-mem {
180 regulator-off-in-suspend;
181 };
182 };
183
184 ldo4_reg: LDO4 {
185 regulator-name = "VAP_AVDD_PLL1";
186 regulator-min-microvolt = <1800000>;
187 regulator-max-microvolt = <1800000>;
188 regulator-always-on;
189
190 regulator-state-mem {
191 regulator-off-in-suspend;
192 };
193 };
194
195 ldo5_reg: LDO5 {
196 regulator-name = "VAP_PLL_ISO_1.0V";
197 regulator-min-microvolt = <1000000>;
198 regulator-max-microvolt = <1000000>;
199 regulator-always-on;
200
201 regulator-state-mem {
202 regulator-off-in-suspend;
203 };
204 };
205
206 ldo6_reg: LDO6 {
207 regulator-name = "VAP_VMIPI_1.0V";
208 regulator-min-microvolt = <1000000>;
209 regulator-max-microvolt = <1000000>;
210 regulator-always-on;
211
212 regulator-state-mem {
213 regulator-off-in-suspend;
214 };
215 };
216
217 ldo7_reg: LDO7 {
218 regulator-name = "VAP_AVDD_1.8V";
219 regulator-min-microvolt = <1800000>;
220 regulator-max-microvolt = <1800000>;
221 regulator-always-on;
222
223 regulator-state-mem {
224 regulator-off-in-suspend;
225 };
226 };
227
228 ldo8_reg: LDO8 {
229 regulator-name = "VAP_USB_3.0V";
230 regulator-min-microvolt = <3000000>;
231 regulator-max-microvolt = <3000000>;
232 regulator-always-on;
233
234 regulator-state-mem {
235 regulator-off-in-suspend;
236 };
237 };
238
239 ldo9_reg: LDO9 {
240 regulator-name = "V_LPDDR_1.2V";
241 regulator-min-microvolt = <1200000>;
242 regulator-max-microvolt = <1200000>;
243 regulator-always-on;
244
245 regulator-state-mem {
246 regulator-on-in-suspend;
247 };
248 };
249
250 ldo10_reg: LDO10 {
251 regulator-name = "UNUSED_LDO10";
252 regulator-min-microvolt = <1000000>;
253 regulator-max-microvolt = <1000000>;
254
255 regulator-state-mem {
256 regulator-off-in-suspend;
257 };
258 };
259
260 ldo11_reg: LDO11 {
261 regulator-name = "V_EMMC_1.8V";
262 regulator-min-microvolt = <1800000>;
263 regulator-max-microvolt = <1800000>;
264 samsung,ext-control-gpios = <&gpk0 2 0>;
265 };
266
267 ldo12_reg: LDO12 {
268 regulator-name = "V_EMMC_2.8V";
269 regulator-min-microvolt = <2800000>;
270 regulator-max-microvolt = <2800000>;
271 samsung,ext-control-gpios = <&gpk0 2 0>;
272 };
273
274 ldo13_reg: LDO13 {
275 regulator-name = "CAM_AVDD_2.8V";
276 regulator-min-microvolt = <2800000>;
277 regulator-max-microvolt = <2800000>;
278
279 regulator-state-mem {
280 regulator-off-in-suspend;
281 };
282 };
283
284 ldo14_reg: LDO14 {
285 regulator-name = "UNUSED_LDO14";
286 regulator-min-microvolt = <2700000>;
287 regulator-max-microvolt = <2700000>;
288
289 regulator-state-mem {
290 regulator-off-in-suspend;
291 };
292 };
293
294 ldo15_reg: LDO15 {
295 regulator-name = "TSP_AVDD_3.3V";
296 regulator-min-microvolt = <3300000>;
297 regulator-max-microvolt = <3300000>;
298
299 regulator-state-mem {
300 regulator-off-in-suspend;
301 };
302 };
303
304 ldo16_reg: LDO16 {
305 regulator-name = "LCD_VDD_3.3V";
306 regulator-min-microvolt = <3300000>;
307 regulator-max-microvolt = <3300000>;
308
309 regulator-state-mem {
310 regulator-off-in-suspend;
311 };
312 };
313
314 ldo17_reg: LDO17 {
315 regulator-name = "V_IRLED_3.3V";
316 regulator-min-microvolt = <3300000>;
317 regulator-max-microvolt = <3300000>;
318
319 regulator-state-mem {
320 regulator-off-in-suspend;
321 };
322 };
323
324 ldo18_reg: LDO18 {
325 regulator-name = "CAM_AF_2.8V";
326 regulator-min-microvolt = <2800000>;
327 regulator-max-microvolt = <2800000>;
328
329 regulator-state-mem {
330 regulator-off-in-suspend;
331 };
332 };
333
334 ldo19_reg: LDO19 {
335 regulator-name = "TSP_VDD_1.8V";
336 regulator-min-microvolt = <1800000>;
337 regulator-max-microvolt = <1800000>;
338
339 regulator-state-mem {
340 regulator-off-in-suspend;
341 };
342 };
343
344 ldo20_reg: LDO20 {
345 regulator-name = "LCD_VDD_1.8V";
346 regulator-min-microvolt = <1800000>;
347 regulator-max-microvolt = <1800000>;
348
349 regulator-state-mem {
350 regulator-off-in-suspend;
351 };
352 };
353
354 ldo21_reg: LDO21 {
355 regulator-name = "CAM_IO_1.8V";
356 regulator-min-microvolt = <1800000>;
357 regulator-max-microvolt = <1800000>;
358
359 regulator-state-mem {
360 regulator-off-in-suspend;
361 };
362 };
363
364 ldo22_reg: LDO22 {
365 regulator-name = "CAM_DVDD_1.2V";
366 regulator-min-microvolt = <1200000>;
367 regulator-max-microvolt = <1200000>;
368
369 regulator-state-mem {
370 regulator-off-in-suspend;
371 };
372 };
373
374 ldo23_reg: LDO23 {
375 regulator-name = "HRM_VCC_1.8V";
376 regulator-min-microvolt = <1800000>;
377 regulator-max-microvolt = <1800000>;
378 regulator-always-on;
379 };
380
381 ldo24_reg: LDO24 {
382 regulator-name = "HRM_VCC_3.3V";
383 regulator-min-microvolt = <3000000>;
384 regulator-max-microvolt = <3000000>;
385
386 regulator-state-mem {
387 regulator-off-in-suspend;
388 };
389 };
390
391 ldo25_reg: LDO25 {
392 regulator-name = "UNUSED_LDO25";
393 regulator-min-microvolt = <3000000>;
394 regulator-max-microvolt = <3000000>;
395
396 regulator-state-mem {
397 regulator-off-in-suspend;
398 };
399 };
400
401 buck1_reg: BUCK1 {
402 regulator-name = "VAP_MIF_1.0V";
403 regulator-min-microvolt = <800000>;
404 regulator-max-microvolt = <900000>;
405 regulator-always-on;
406
407 regulator-state-mem {
408 regulator-off-in-suspend;
409 };
410 };
411
412 buck2_reg: BUCK2 {
413 regulator-name = "VAP_ARM_1.0V";
414 regulator-min-microvolt = <850000>;
415 regulator-max-microvolt = <1150000>;
416 regulator-always-on;
417
418 regulator-state-mem {
419 regulator-off-in-suspend;
420 };
421 };
422
423 buck3_reg: BUCK3 {
424 regulator-name = "VAP_INT3D_1.0V";
425 regulator-min-microvolt = <850000>;
426 regulator-max-microvolt = <1000000>;
427 regulator-always-on;
428
429 regulator-state-mem {
430 regulator-off-in-suspend;
431 };
432 };
433
434 buck4_reg: BUCK4 {
435 regulator-name = "VCC_SUB_1.95V";
436 regulator-min-microvolt = <1950000>;
437 regulator-max-microvolt = <1950000>;
438 regulator-always-on;
439
440 regulator-state-mem {
441 regulator-on-in-suspend;
442 };
443 };
444
445 buck5_reg: BUCK5 {
446 regulator-name = "VCC_SUB_1.35V";
447 regulator-min-microvolt = <1350000>;
448 regulator-max-microvolt = <1350000>;
449 regulator-always-on;
450
451 regulator-state-mem {
452 regulator-on-in-suspend;
453 };
454 };
455 };
456 };
457};
458
459&i2c_1 {
460 #address-cells = <1>;
461 #size-cells = <0>;
462 samsung,i2c-sda-delay = <100>;
463 samsung,i2c-slave-addr = <0x10>;
464 samsung,i2c-max-bus-freq = <400000>;
465 status = "okay";
466
467 fuelgauge@36 {
468 compatible = "maxim,max77836-battery";
469 interrupt-parent = <&gpx1>;
470 interrupts = <2 8>;
471 reg = <0x36>;
472 };
473};
474
475&i2s2 {
476 status = "okay";
477};
478
479&mfc {
480 status = "okay";
481};
482
483&mshc_0 {
484 #address-cells = <1>;
485 #size-cells = <0>;
486 num-slots = <1>;
487 broken-cd;
488 non-removable;
489 cap-mmc-highspeed;
490 desc-num = <4>;
491 mmc-hs200-1_8v;
492 card-detect-delay = <200>;
493 vmmc-supply = <&ldo12_reg>;
494 clock-frequency = <100000000>;
495 clock-freq-min-max = <400000 100000000>;
496 samsung,dw-mshc-ciu-div = <1>;
497 samsung,dw-mshc-sdr-timing = <0 1>;
498 samsung,dw-mshc-ddr-timing = <1 2>;
499 pinctrl-names = "default";
500 pinctrl-0 = <&sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8>;
501 bus-width = <8>;
502 status = "okay";
503};
504
505&serial_0 {
506 assigned-clocks = <&cmu CLK_SCLK_UART0>;
507 assigned-clock-rates = <100000000>;
508 status = "okay";
509};
510
511&serial_1 {
512 status = "okay";
513};
514
515&tmu {
516 vtmu-supply = <&ldo7_reg>;
517 status = "okay";
518};
519
520&rtc {
521 clocks = <&cmu CLK_RTC>, <&s2mps14_osc 0>;
522 clock-names = "rtc", "rtc_src";
523 status = "okay";
524};
525
526&xusbxti {
527 clock-frequency = <24000000>;
528};
529
530&pinctrl_0 {
531 pinctrl-names = "default";
532 pinctrl-0 = <&sleep0>;
533
534 sleep0: sleep-state {
535 PIN_SLP(gpa0-0, INPUT, DOWN);
536 PIN_SLP(gpa0-1, INPUT, DOWN);
537 PIN_SLP(gpa0-2, INPUT, DOWN);
538 PIN_SLP(gpa0-3, INPUT, DOWN);
539 PIN_SLP(gpa0-4, INPUT, DOWN);
540 PIN_SLP(gpa0-5, INPUT, DOWN);
541 PIN_SLP(gpa0-6, INPUT, DOWN);
542 PIN_SLP(gpa0-7, INPUT, DOWN);
543
544 PIN_SLP(gpa1-0, INPUT, DOWN);
545 PIN_SLP(gpa1-1, INPUT, DOWN);
546 PIN_SLP(gpa1-2, INPUT, DOWN);
547 PIN_SLP(gpa1-3, INPUT, DOWN);
548 PIN_SLP(gpa1-4, INPUT, DOWN);
549 PIN_SLP(gpa1-5, INPUT, DOWN);
550
551 PIN_SLP(gpb-0, PREV, NONE);
552 PIN_SLP(gpb-1, PREV, NONE);
553 PIN_SLP(gpb-2, PREV, NONE);
554 PIN_SLP(gpb-3, PREV, NONE);
555 PIN_SLP(gpb-4, INPUT, DOWN);
556 PIN_SLP(gpb-5, INPUT, DOWN);
557 PIN_SLP(gpb-6, INPUT, DOWN);
558 PIN_SLP(gpb-7, INPUT, DOWN);
559
560 PIN_SLP(gpc0-0, INPUT, DOWN);
561 PIN_SLP(gpc0-1, INPUT, DOWN);
562 PIN_SLP(gpc0-2, INPUT, DOWN);
563 PIN_SLP(gpc0-3, INPUT, DOWN);
564 PIN_SLP(gpc0-4, INPUT, DOWN);
565
566 PIN_SLP(gpc1-0, INPUT, DOWN);
567 PIN_SLP(gpc1-1, INPUT, DOWN);
568 PIN_SLP(gpc1-2, INPUT, DOWN);
569 PIN_SLP(gpc1-3, INPUT, DOWN);
570 PIN_SLP(gpc1-4, INPUT, DOWN);
571
572 PIN_SLP(gpd0-0, INPUT, DOWN);
573 PIN_SLP(gpd0-1, INPUT, DOWN);
574 PIN_SLP(gpd0-2, INPUT, NONE);
575 PIN_SLP(gpd0-3, INPUT, NONE);
576
577 PIN_SLP(gpd1-0, INPUT, NONE);
578 PIN_SLP(gpd1-1, INPUT, NONE);
579 PIN_SLP(gpd1-2, INPUT, NONE);
580 PIN_SLP(gpd1-3, INPUT, NONE);
581 };
582};
583
584&pinctrl_1 {
585 pinctrl-names = "default";
586 pinctrl-0 = <&sleep1>;
587
588 sleep1: sleep-state {
589 PIN_SLP(gpe0-0, PREV, NONE);
590 PIN_SLP(gpe0-1, PREV, NONE);
591 PIN_SLP(gpe0-2, INPUT, DOWN);
592 PIN_SLP(gpe0-3, INPUT, UP);
593 PIN_SLP(gpe0-4, INPUT, DOWN);
594 PIN_SLP(gpe0-5, INPUT, DOWN);
595 PIN_SLP(gpe0-6, INPUT, DOWN);
596 PIN_SLP(gpe0-7, INPUT, DOWN);
597
598 PIN_SLP(gpe1-0, INPUT, DOWN);
599 PIN_SLP(gpe1-1, PREV, NONE);
600 PIN_SLP(gpe1-2, INPUT, DOWN);
601 PIN_SLP(gpe1-3, INPUT, DOWN);
602 PIN_SLP(gpe1-4, INPUT, DOWN);
603 PIN_SLP(gpe1-5, INPUT, DOWN);
604 PIN_SLP(gpe1-6, INPUT, DOWN);
605 PIN_SLP(gpe1-7, INPUT, NONE);
606
607 PIN_SLP(gpe2-0, INPUT, NONE);
608 PIN_SLP(gpe2-1, INPUT, NONE);
609 PIN_SLP(gpe2-2, INPUT, NONE);
610
611 PIN_SLP(gpk0-0, INPUT, DOWN);
612 PIN_SLP(gpk0-1, INPUT, DOWN);
613 PIN_SLP(gpk0-2, OUT0, NONE);
614 PIN_SLP(gpk0-3, INPUT, DOWN);
615 PIN_SLP(gpk0-4, INPUT, DOWN);
616 PIN_SLP(gpk0-5, INPUT, DOWN);
617 PIN_SLP(gpk0-6, INPUT, DOWN);
618 PIN_SLP(gpk0-7, INPUT, DOWN);
619
620 PIN_SLP(gpk1-0, INPUT, DOWN);
621 PIN_SLP(gpk1-1, INPUT, DOWN);
622 PIN_SLP(gpk1-2, INPUT, DOWN);
623 PIN_SLP(gpk1-3, INPUT, DOWN);
624 PIN_SLP(gpk1-4, INPUT, DOWN);
625 PIN_SLP(gpk1-5, INPUT, DOWN);
626 PIN_SLP(gpk1-6, INPUT, DOWN);
627
628 PIN_SLP(gpk2-0, INPUT, DOWN);
629 PIN_SLP(gpk2-1, INPUT, DOWN);
630 PIN_SLP(gpk2-2, INPUT, DOWN);
631 PIN_SLP(gpk2-3, INPUT, DOWN);
632 PIN_SLP(gpk2-4, INPUT, DOWN);
633 PIN_SLP(gpk2-5, INPUT, DOWN);
634 PIN_SLP(gpk2-6, INPUT, DOWN);
635
636 PIN_SLP(gpl0-0, INPUT, DOWN);
637 PIN_SLP(gpl0-1, INPUT, DOWN);
638 PIN_SLP(gpl0-2, INPUT, DOWN);
639 PIN_SLP(gpl0-3, INPUT, DOWN);
640
641 PIN_SLP(gpm0-0, INPUT, DOWN);
642 PIN_SLP(gpm0-1, INPUT, DOWN);
643 PIN_SLP(gpm0-2, INPUT, DOWN);
644 PIN_SLP(gpm0-3, INPUT, DOWN);
645 PIN_SLP(gpm0-4, INPUT, DOWN);
646 PIN_SLP(gpm0-5, INPUT, DOWN);
647 PIN_SLP(gpm0-6, INPUT, DOWN);
648 PIN_SLP(gpm0-7, INPUT, DOWN);
649
650 PIN_SLP(gpm1-0, INPUT, DOWN);
651 PIN_SLP(gpm1-1, INPUT, DOWN);
652 PIN_SLP(gpm1-2, INPUT, DOWN);
653 PIN_SLP(gpm1-3, INPUT, DOWN);
654 PIN_SLP(gpm1-4, INPUT, DOWN);
655 PIN_SLP(gpm1-5, INPUT, DOWN);
656 PIN_SLP(gpm1-6, INPUT, DOWN);
657
658 PIN_SLP(gpm2-0, INPUT, DOWN);
659 PIN_SLP(gpm2-1, INPUT, DOWN);
660 PIN_SLP(gpm2-2, INPUT, DOWN);
661 PIN_SLP(gpm2-3, INPUT, DOWN);
662 PIN_SLP(gpm2-4, INPUT, DOWN);
663
664 PIN_SLP(gpm3-0, INPUT, DOWN);
665 PIN_SLP(gpm3-1, INPUT, DOWN);
666 PIN_SLP(gpm3-2, INPUT, DOWN);
667 PIN_SLP(gpm3-3, INPUT, DOWN);
668 PIN_SLP(gpm3-4, INPUT, DOWN);
669 PIN_SLP(gpm3-5, INPUT, DOWN);
670 PIN_SLP(gpm3-6, INPUT, DOWN);
671 PIN_SLP(gpm3-7, INPUT, DOWN);
672
673 PIN_SLP(gpm4-0, INPUT, DOWN);
674 PIN_SLP(gpm4-1, INPUT, DOWN);
675 PIN_SLP(gpm4-2, INPUT, DOWN);
676 PIN_SLP(gpm4-3, INPUT, DOWN);
677 PIN_SLP(gpm4-4, INPUT, DOWN);
678 PIN_SLP(gpm4-5, INPUT, DOWN);
679 PIN_SLP(gpm4-6, INPUT, DOWN);
680 PIN_SLP(gpm4-7, INPUT, DOWN);
681 };
682};
diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi
index 693a3275606f..242ddda0a8cd 100644
--- a/arch/arm/boot/dts/exynos3250.dtsi
+++ b/arch/arm/boot/dts/exynos3250.dtsi
@@ -320,6 +320,16 @@
320 status = "disabled"; 320 status = "disabled";
321 }; 321 };
322 322
323 mfc: codec@13400000 {
324 compatible = "samsung,mfc-v7";
325 reg = <0x13400000 0x10000>;
326 interrupts = <0 102 0>;
327 clock-names = "mfc", "sclk_mfc";
328 clocks = <&cmu CLK_MFC>, <&cmu CLK_SCLK_MFC>;
329 samsung,power-domain = <&pd_mfc>;
330 status = "disabled";
331 };
332
323 serial_0: serial@13800000 { 333 serial_0: serial@13800000 {
324 compatible = "samsung,exynos4210-uart"; 334 compatible = "samsung,exynos4210-uart";
325 reg = <0x13800000 0x100>; 335 reg = <0x13800000 0x100>;
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index e0278ecbc816..b8168f1f8139 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -392,8 +392,8 @@
392 reg = <0x13400000 0x10000>; 392 reg = <0x13400000 0x10000>;
393 interrupts = <0 94 0>; 393 interrupts = <0 94 0>;
394 samsung,power-domain = <&pd_mfc>; 394 samsung,power-domain = <&pd_mfc>;
395 clocks = <&clock CLK_MFC>; 395 clocks = <&clock CLK_MFC>, <&clock CLK_SCLK_MFC>;
396 clock-names = "mfc"; 396 clock-names = "mfc", "sclk_mfc";
397 status = "disabled"; 397 status = "disabled";
398 }; 398 };
399 399
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts
index f516da9e8b3a..720836205546 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -431,18 +431,34 @@
431 431
432 fimc_0: fimc@11800000 { 432 fimc_0: fimc@11800000 {
433 status = "okay"; 433 status = "okay";
434 assigned-clocks = <&clock CLK_MOUT_FIMC0>,
435 <&clock CLK_SCLK_FIMC0>;
436 assigned-clock-parents = <&clock CLK_SCLK_MPLL>;
437 assigned-clock-rates = <0>, <160000000>;
434 }; 438 };
435 439
436 fimc_1: fimc@11810000 { 440 fimc_1: fimc@11810000 {
437 status = "okay"; 441 status = "okay";
442 assigned-clocks = <&clock CLK_MOUT_FIMC1>,
443 <&clock CLK_SCLK_FIMC1>;
444 assigned-clock-parents = <&clock CLK_SCLK_MPLL>;
445 assigned-clock-rates = <0>, <160000000>;
438 }; 446 };
439 447
440 fimc_2: fimc@11820000 { 448 fimc_2: fimc@11820000 {
441 status = "okay"; 449 status = "okay";
450 assigned-clocks = <&clock CLK_MOUT_FIMC2>,
451 <&clock CLK_SCLK_FIMC2>;
452 assigned-clock-parents = <&clock CLK_SCLK_MPLL>;
453 assigned-clock-rates = <0>, <160000000>;
442 }; 454 };
443 455
444 fimc_3: fimc@11830000 { 456 fimc_3: fimc@11830000 {
445 status = "okay"; 457 status = "okay";
458 assigned-clocks = <&clock CLK_MOUT_FIMC3>,
459 <&clock CLK_SCLK_FIMC3>;
460 assigned-clock-parents = <&clock CLK_SCLK_MPLL>;
461 assigned-clock-rates = <0>, <160000000>;
446 }; 462 };
447 }; 463 };
448}; 464};
diff --git a/arch/arm/boot/dts/exynos4210-universal_c210.dts b/arch/arm/boot/dts/exynos4210-universal_c210.dts
index d50eb3aa708e..aaf0cae4f5e8 100644
--- a/arch/arm/boot/dts/exynos4210-universal_c210.dts
+++ b/arch/arm/boot/dts/exynos4210-universal_c210.dts
@@ -473,18 +473,34 @@
473 473
474 fimc_0: fimc@11800000 { 474 fimc_0: fimc@11800000 {
475 status = "okay"; 475 status = "okay";
476 assigned-clocks = <&clock CLK_MOUT_FIMC0>,
477 <&clock CLK_SCLK_FIMC0>;
478 assigned-clock-parents = <&clock CLK_SCLK_MPLL>;
479 assigned-clock-rates = <0>, <160000000>;
476 }; 480 };
477 481
478 fimc_1: fimc@11810000 { 482 fimc_1: fimc@11810000 {
479 status = "okay"; 483 status = "okay";
484 assigned-clocks = <&clock CLK_MOUT_FIMC1>,
485 <&clock CLK_SCLK_FIMC1>;
486 assigned-clock-parents = <&clock CLK_SCLK_MPLL>;
487 assigned-clock-rates = <0>, <160000000>;
480 }; 488 };
481 489
482 fimc_2: fimc@11820000 { 490 fimc_2: fimc@11820000 {
483 status = "okay"; 491 status = "okay";
492 assigned-clocks = <&clock CLK_MOUT_FIMC2>,
493 <&clock CLK_SCLK_FIMC2>;
494 assigned-clock-parents = <&clock CLK_SCLK_MPLL>;
495 assigned-clock-rates = <0>, <160000000>;
484 }; 496 };
485 497
486 fimc_3: fimc@11830000 { 498 fimc_3: fimc@11830000 {
487 status = "okay"; 499 status = "okay";
500 assigned-clocks = <&clock CLK_MOUT_FIMC3>,
501 <&clock CLK_SCLK_FIMC3>;
502 assigned-clock-parents = <&clock CLK_SCLK_MPLL>;
503 assigned-clock-rates = <0>, <160000000>;
488 }; 504 };
489 }; 505 };
490}; 506};
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 807bb5bf91fc..bcc9e63c8070 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -31,6 +31,23 @@
31 pinctrl2 = &pinctrl_2; 31 pinctrl2 = &pinctrl_2;
32 }; 32 };
33 33
34 cpus {
35 #address-cells = <1>;
36 #size-cells = <0>;
37
38 cpu@900 {
39 device_type = "cpu";
40 compatible = "arm,cortex-a9";
41 reg = <0x900>;
42 };
43
44 cpu@901 {
45 device_type = "cpu";
46 compatible = "arm,cortex-a9";
47 reg = <0x901>;
48 };
49 };
50
34 pmu_system_controller: system-controller@10020000 { 51 pmu_system_controller: system-controller@10020000 {
35 clock-names = "clkout0", "clkout1", "clkout2", "clkout3", 52 clock-names = "clkout0", "clkout1", "clkout2", "clkout3",
36 "clkout4", "clkout8", "clkout9"; 53 "clkout4", "clkout8", "clkout9";
diff --git a/arch/arm/boot/dts/exynos4212.dtsi b/arch/arm/boot/dts/exynos4212.dtsi
index 3c00e6ec9302..dd0a43ec56da 100644
--- a/arch/arm/boot/dts/exynos4212.dtsi
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -22,6 +22,23 @@
22/ { 22/ {
23 compatible = "samsung,exynos4212", "samsung,exynos4"; 23 compatible = "samsung,exynos4212", "samsung,exynos4";
24 24
25 cpus {
26 #address-cells = <1>;
27 #size-cells = <0>;
28
29 cpu@A00 {
30 device_type = "cpu";
31 compatible = "arm,cortex-a9";
32 reg = <0xA00>;
33 };
34
35 cpu@A01 {
36 device_type = "cpu";
37 compatible = "arm,cortex-a9";
38 reg = <0xA01>;
39 };
40 };
41
25 combiner: interrupt-controller@10440000 { 42 combiner: interrupt-controller@10440000 {
26 samsung,combiner-nr = <18>; 43 samsung,combiner-nr = <18>;
27 }; 44 };
diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index c697ff01ae8d..3fbf588682b9 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -45,6 +45,16 @@
45 compatible = "samsung,odroidx2-audio"; 45 compatible = "samsung,odroidx2-audio";
46 samsung,i2s-controller = <&i2s0>; 46 samsung,i2s-controller = <&i2s0>;
47 samsung,audio-codec = <&max98090>; 47 samsung,audio-codec = <&max98090>;
48 assigned-clocks = <&clock_audss EXYNOS_MOUT_AUDSS>,
49 <&clock_audss EXYNOS_MOUT_I2S>,
50 <&clock_audss EXYNOS_DOUT_SRP>,
51 <&clock_audss EXYNOS_DOUT_AUD_BUS>;
52 assigned-clock-parents = <&clock CLK_FOUT_EPLL>,
53 <&clock_audss EXYNOS_MOUT_AUDSS>;
54 assigned-clock-rates = <0>,
55 <0>,
56 <192000000>,
57 <19200000>;
48 }; 58 };
49 59
50 mmc@12550000 { 60 mmc@12550000 {
@@ -82,18 +92,34 @@
82 92
83 fimc_0: fimc@11800000 { 93 fimc_0: fimc@11800000 {
84 status = "okay"; 94 status = "okay";
95 assigned-clocks = <&clock CLK_MOUT_FIMC0>,
96 <&clock CLK_SCLK_FIMC0>;
97 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
98 assigned-clock-rates = <0>, <176000000>;
85 }; 99 };
86 100
87 fimc_1: fimc@11810000 { 101 fimc_1: fimc@11810000 {
88 status = "okay"; 102 status = "okay";
103 assigned-clocks = <&clock CLK_MOUT_FIMC1>,
104 <&clock CLK_SCLK_FIMC1>;
105 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
106 assigned-clock-rates = <0>, <176000000>;
89 }; 107 };
90 108
91 fimc_2: fimc@11820000 { 109 fimc_2: fimc@11820000 {
92 status = "okay"; 110 status = "okay";
111 assigned-clocks = <&clock CLK_MOUT_FIMC2>,
112 <&clock CLK_SCLK_FIMC2>;
113 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
114 assigned-clock-rates = <0>, <176000000>;
93 }; 115 };
94 116
95 fimc_3: fimc@11830000 { 117 fimc_3: fimc@11830000 {
96 status = "okay"; 118 status = "okay";
119 assigned-clocks = <&clock CLK_MOUT_FIMC3>,
120 <&clock CLK_SCLK_FIMC3>;
121 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
122 assigned-clock-rates = <0>, <176000000>;
97 }; 123 };
98 }; 124 };
99 125
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 5e066cd87f66..29231b452643 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -14,6 +14,7 @@
14 14
15/dts-v1/; 15/dts-v1/;
16#include "exynos4412.dtsi" 16#include "exynos4412.dtsi"
17#include <dt-bindings/gpio/gpio.h>
17 18
18/ { 19/ {
19 model = "Samsung Trats 2 based on Exynos4412"; 20 model = "Samsung Trats 2 based on Exynos4412";
@@ -22,6 +23,7 @@
22 aliases { 23 aliases {
23 i2c9 = &i2c_ak8975; 24 i2c9 = &i2c_ak8975;
24 i2c10 = &i2c_cm36651; 25 i2c10 = &i2c_cm36651;
26 i2c11 = &i2c_max77693;
25 }; 27 };
26 28
27 memory { 29 memory {
@@ -399,8 +401,6 @@
399 regulator-name = "VMEM_VDD_2.8V"; 401 regulator-name = "VMEM_VDD_2.8V";
400 regulator-min-microvolt = <2800000>; 402 regulator-min-microvolt = <2800000>;
401 regulator-max-microvolt = <2800000>; 403 regulator-max-microvolt = <2800000>;
402 regulator-always-on;
403 regulator-mem-off;
404 }; 404 };
405 405
406 ldo23_reg: ldo23 { 406 ldo23_reg: ldo23 {
@@ -503,8 +503,6 @@
503 regulator-name = "VMEM_VDDF_3.0V"; 503 regulator-name = "VMEM_VDDF_3.0V";
504 regulator-min-microvolt = <2850000>; 504 regulator-min-microvolt = <2850000>;
505 regulator-max-microvolt = <2850000>; 505 regulator-max-microvolt = <2850000>;
506 regulator-always-on;
507 regulator-mem-off;
508 }; 506 };
509 507
510 buck9_reg: buck9 { 508 buck9_reg: buck9 {
@@ -518,6 +516,42 @@
518 }; 516 };
519 }; 517 };
520 518
519 i2c_max77693: i2c-gpio-1 {
520 compatible = "i2c-gpio";
521 gpios = <&gpm2 0 GPIO_ACTIVE_HIGH>, <&gpm2 1 GPIO_ACTIVE_HIGH>;
522 i2c-gpio,delay-us = <2>;
523 #address-cells = <1>;
524 #size-cells = <0>;
525 status = "okay";
526
527 max77693@66 {
528 compatible = "maxim,max77693";
529 interrupt-parent = <&gpx1>;
530 interrupts = <5 2>;
531 reg = <0x66>;
532
533 regulators {
534 esafeout1_reg: ESAFEOUT1@1 {
535 regulator-name = "ESAFEOUT1";
536 };
537 esafeout2_reg: ESAFEOUT2@2 {
538 regulator-name = "ESAFEOUT2";
539 };
540 charger_reg: CHARGER@0 {
541 regulator-name = "CHARGER";
542 regulator-min-microamp = <60000>;
543 regulator-max-microamp = <2580000>;
544 };
545 };
546
547 max77693_haptic {
548 compatible = "maxim,max77693-haptic";
549 haptic-supply = <&ldo26_reg>;
550 pwms = <&pwm 0 38022 0>;
551 };
552 };
553 };
554
521 mmc@12550000 { 555 mmc@12550000 {
522 num-slots = <1>; 556 num-slots = <1>;
523 broken-cd; 557 broken-cd;
@@ -535,6 +569,16 @@
535 cap-mmc-highspeed; 569 cap-mmc-highspeed;
536 }; 570 };
537 571
572 sdhci@12530000 {
573 bus-width = <4>;
574 cd-gpios = <&gpx3 4 0>;
575 cd-inverted;
576 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4>;
577 pinctrl-names = "default";
578 vmmc-supply = <&ldo21_reg>;
579 status = "okay";
580 };
581
538 serial@13800000 { 582 serial@13800000 {
539 status = "okay"; 583 status = "okay";
540 }; 584 };
@@ -551,6 +595,11 @@
551 status = "okay"; 595 status = "okay";
552 }; 596 };
553 597
598 tmu@100C0000 {
599 vtmu-supply = <&ldo10_reg>;
600 status = "okay";
601 };
602
554 i2c_ak8975: i2c-gpio-0 { 603 i2c_ak8975: i2c-gpio-0 {
555 compatible = "i2c-gpio"; 604 compatible = "i2c-gpio";
556 gpios = <&gpy2 4 0>, <&gpy2 5 0>; 605 gpios = <&gpy2 4 0>, <&gpy2 5 0>;
@@ -598,6 +647,13 @@
598 }; 647 };
599 }; 648 };
600 649
650 pwm: pwm@139D0000 {
651 pinctrl-0 = <&pwm0_out>;
652 pinctrl-names = "default";
653 samsung,pwm-outputs = <0>;
654 status = "okay";
655 };
656
601 dsi_0: dsi@11C80000 { 657 dsi_0: dsi@11C80000 {
602 vddcore-supply = <&ldo8_reg>; 658 vddcore-supply = <&ldo8_reg>;
603 vddio-supply = <&ldo10_reg>; 659 vddio-supply = <&ldo10_reg>;
@@ -663,28 +719,51 @@
663 pinctrl-0 = <&cam_port_a_clk_active &cam_port_b_clk_active>; 719 pinctrl-0 = <&cam_port_a_clk_active &cam_port_b_clk_active>;
664 pinctrl-names = "default"; 720 pinctrl-names = "default";
665 status = "okay"; 721 status = "okay";
722 assigned-clocks = <&clock CLK_MOUT_CAM0>,
723 <&clock CLK_MOUT_CAM1>;
724 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>,
725 <&clock CLK_MOUT_MPLL_USER_T>;
666 726
667 fimc_0: fimc@11800000 { 727 fimc_0: fimc@11800000 {
668 status = "okay"; 728 status = "okay";
729 assigned-clocks = <&clock CLK_MOUT_FIMC0>,
730 <&clock CLK_SCLK_FIMC0>;
731 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
732 assigned-clock-rates = <0>, <176000000>;
669 }; 733 };
670 734
671 fimc_1: fimc@11810000 { 735 fimc_1: fimc@11810000 {
672 status = "okay"; 736 status = "okay";
737 assigned-clocks = <&clock CLK_MOUT_FIMC1>,
738 <&clock CLK_SCLK_FIMC1>;
739 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
740 assigned-clock-rates = <0>, <176000000>;
673 }; 741 };
674 742
675 fimc_2: fimc@11820000 { 743 fimc_2: fimc@11820000 {
676 status = "okay"; 744 status = "okay";
745 assigned-clocks = <&clock CLK_MOUT_FIMC2>,
746 <&clock CLK_SCLK_FIMC2>;
747 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
748 assigned-clock-rates = <0>, <176000000>;
677 }; 749 };
678 750
679 fimc_3: fimc@11830000 { 751 fimc_3: fimc@11830000 {
680 status = "okay"; 752 status = "okay";
753 assigned-clocks = <&clock CLK_MOUT_FIMC3>,
754 <&clock CLK_SCLK_FIMC3>;
755 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
756 assigned-clock-rates = <0>, <176000000>;
681 }; 757 };
682 758
683 csis_0: csis@11880000 { 759 csis_0: csis@11880000 {
684 status = "okay"; 760 status = "okay";
685 vddcore-supply = <&ldo8_reg>; 761 vddcore-supply = <&ldo8_reg>;
686 vddio-supply = <&ldo10_reg>; 762 vddio-supply = <&ldo10_reg>;
687 clock-frequency = <176000000>; 763 assigned-clocks = <&clock CLK_MOUT_CSIS0>,
764 <&clock CLK_SCLK_CSIS0>;
765 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
766 assigned-clock-rates = <0>, <176000000>;
688 767
689 /* Camera C (3) MIPI CSI-2 (CSIS0) */ 768 /* Camera C (3) MIPI CSI-2 (CSIS0) */
690 port@3 { 769 port@3 {
@@ -698,10 +777,13 @@
698 }; 777 };
699 778
700 csis_1: csis@11890000 { 779 csis_1: csis@11890000 {
780 status = "okay";
701 vddcore-supply = <&ldo8_reg>; 781 vddcore-supply = <&ldo8_reg>;
702 vddio-supply = <&ldo10_reg>; 782 vddio-supply = <&ldo10_reg>;
703 clock-frequency = <160000000>; 783 assigned-clocks = <&clock CLK_MOUT_CSIS1>,
704 status = "okay"; 784 <&clock CLK_SCLK_CSIS1>;
785 assigned-clock-parents = <&clock CLK_MOUT_MPLL_USER_T>;
786 assigned-clock-rates = <0>, <176000000>;
705 787
706 /* Camera D (4) MIPI CSI-2 (CSIS1) */ 788 /* Camera D (4) MIPI CSI-2 (CSIS1) */
707 port@4 { 789 port@4 {
@@ -782,3 +864,319 @@
782 io-channels = <&adc 2>; /* Battery temperature */ 864 io-channels = <&adc 2>; /* Battery temperature */
783 }; 865 };
784}; 866};
867
868&pinctrl_0 {
869 pinctrl-names = "default";
870 pinctrl-0 = <&sleep0>;
871
872 sleep0: sleep-states {
873 PIN_SLP(gpa0-0, INPUT, NONE);
874 PIN_SLP(gpa0-1, OUT0, NONE);
875 PIN_SLP(gpa0-2, INPUT, NONE);
876 PIN_SLP(gpa0-3, INPUT, UP);
877 PIN_SLP(gpa0-4, INPUT, NONE);
878 PIN_SLP(gpa0-5, INPUT, DOWN);
879 PIN_SLP(gpa0-6, INPUT, DOWN);
880 PIN_SLP(gpa0-7, INPUT, UP);
881
882 PIN_SLP(gpa1-0, INPUT, DOWN);
883 PIN_SLP(gpa1-1, INPUT, DOWN);
884 PIN_SLP(gpa1-2, INPUT, DOWN);
885 PIN_SLP(gpa1-3, INPUT, DOWN);
886 PIN_SLP(gpa1-4, INPUT, DOWN);
887 PIN_SLP(gpa1-5, INPUT, DOWN);
888
889 PIN_SLP(gpb-0, INPUT, NONE);
890 PIN_SLP(gpb-1, INPUT, NONE);
891 PIN_SLP(gpb-2, INPUT, NONE);
892 PIN_SLP(gpb-3, INPUT, NONE);
893 PIN_SLP(gpb-4, INPUT, DOWN);
894 PIN_SLP(gpb-5, INPUT, UP);
895 PIN_SLP(gpb-6, INPUT, DOWN);
896 PIN_SLP(gpb-7, INPUT, DOWN);
897
898 PIN_SLP(gpc0-0, INPUT, DOWN);
899 PIN_SLP(gpc0-1, INPUT, DOWN);
900 PIN_SLP(gpc0-2, INPUT, DOWN);
901 PIN_SLP(gpc0-3, INPUT, DOWN);
902 PIN_SLP(gpc0-4, INPUT, DOWN);
903
904 PIN_SLP(gpc1-0, INPUT, NONE);
905 PIN_SLP(gpc1-1, PREV, NONE);
906 PIN_SLP(gpc1-2, INPUT, NONE);
907 PIN_SLP(gpc1-3, INPUT, NONE);
908 PIN_SLP(gpc1-4, INPUT, NONE);
909
910 PIN_SLP(gpd0-0, INPUT, DOWN);
911 PIN_SLP(gpd0-1, INPUT, DOWN);
912 PIN_SLP(gpd0-2, INPUT, NONE);
913 PIN_SLP(gpd0-3, INPUT, NONE);
914
915 PIN_SLP(gpd1-0, INPUT, DOWN);
916 PIN_SLP(gpd1-1, INPUT, DOWN);
917 PIN_SLP(gpd1-2, INPUT, NONE);
918 PIN_SLP(gpd1-3, INPUT, NONE);
919
920 PIN_SLP(gpf0-0, INPUT, NONE);
921 PIN_SLP(gpf0-1, INPUT, NONE);
922 PIN_SLP(gpf0-2, INPUT, DOWN);
923 PIN_SLP(gpf0-3, INPUT, DOWN);
924 PIN_SLP(gpf0-4, INPUT, NONE);
925 PIN_SLP(gpf0-5, INPUT, DOWN);
926 PIN_SLP(gpf0-6, INPUT, NONE);
927 PIN_SLP(gpf0-7, INPUT, DOWN);
928
929 PIN_SLP(gpf1-0, INPUT, DOWN);
930 PIN_SLP(gpf1-1, INPUT, DOWN);
931 PIN_SLP(gpf1-2, INPUT, DOWN);
932 PIN_SLP(gpf1-3, INPUT, DOWN);
933 PIN_SLP(gpf1-4, INPUT, NONE);
934 PIN_SLP(gpf1-5, INPUT, NONE);
935 PIN_SLP(gpf1-6, INPUT, DOWN);
936 PIN_SLP(gpf1-7, PREV, NONE);
937
938 PIN_SLP(gpf2-0, PREV, NONE);
939 PIN_SLP(gpf2-1, INPUT, DOWN);
940 PIN_SLP(gpf2-2, INPUT, DOWN);
941 PIN_SLP(gpf2-3, INPUT, DOWN);
942 PIN_SLP(gpf2-4, INPUT, DOWN);
943 PIN_SLP(gpf2-5, INPUT, DOWN);
944 PIN_SLP(gpf2-6, INPUT, NONE);
945 PIN_SLP(gpf2-7, INPUT, NONE);
946
947 PIN_SLP(gpf3-0, INPUT, NONE);
948 PIN_SLP(gpf3-1, PREV, NONE);
949 PIN_SLP(gpf3-2, PREV, NONE);
950 PIN_SLP(gpf3-3, PREV, NONE);
951 PIN_SLP(gpf3-4, OUT1, NONE);
952 PIN_SLP(gpf3-5, INPUT, DOWN);
953
954 PIN_SLP(gpj0-0, PREV, NONE);
955 PIN_SLP(gpj0-1, PREV, NONE);
956 PIN_SLP(gpj0-2, PREV, NONE);
957 PIN_SLP(gpj0-3, INPUT, DOWN);
958 PIN_SLP(gpj0-4, PREV, NONE);
959 PIN_SLP(gpj0-5, PREV, NONE);
960 PIN_SLP(gpj0-6, INPUT, DOWN);
961 PIN_SLP(gpj0-7, INPUT, DOWN);
962
963 PIN_SLP(gpj1-0, INPUT, DOWN);
964 PIN_SLP(gpj1-1, PREV, NONE);
965 PIN_SLP(gpj1-2, PREV, NONE);
966 PIN_SLP(gpj1-3, INPUT, DOWN);
967 PIN_SLP(gpj1-4, INPUT, DOWN);
968 };
969};
970
971&pinctrl_1 {
972 pinctrl-names = "default";
973 pinctrl-0 = <&sleep1>;
974
975 sleep1: sleep-states {
976 PIN_SLP(gpk0-0, PREV, NONE);
977 PIN_SLP(gpk0-1, PREV, NONE);
978 PIN_SLP(gpk0-2, OUT0, NONE);
979 PIN_SLP(gpk0-3, PREV, NONE);
980 PIN_SLP(gpk0-4, PREV, NONE);
981 PIN_SLP(gpk0-5, PREV, NONE);
982 PIN_SLP(gpk0-6, PREV, NONE);
983
984 PIN_SLP(gpk1-0, INPUT, DOWN);
985 PIN_SLP(gpk1-1, INPUT, DOWN);
986 PIN_SLP(gpk1-2, INPUT, DOWN);
987 PIN_SLP(gpk1-3, PREV, NONE);
988 PIN_SLP(gpk1-4, PREV, NONE);
989 PIN_SLP(gpk1-5, PREV, NONE);
990 PIN_SLP(gpk1-6, PREV, NONE);
991
992 PIN_SLP(gpk2-0, INPUT, DOWN);
993 PIN_SLP(gpk2-1, INPUT, DOWN);
994 PIN_SLP(gpk2-2, INPUT, DOWN);
995 PIN_SLP(gpk2-3, INPUT, DOWN);
996 PIN_SLP(gpk2-4, INPUT, DOWN);
997 PIN_SLP(gpk2-5, INPUT, DOWN);
998 PIN_SLP(gpk2-6, INPUT, DOWN);
999
1000 PIN_SLP(gpk3-0, OUT0, NONE);
1001 PIN_SLP(gpk3-1, INPUT, NONE);
1002 PIN_SLP(gpk3-2, INPUT, DOWN);
1003 PIN_SLP(gpk3-3, INPUT, NONE);
1004 PIN_SLP(gpk3-4, INPUT, NONE);
1005 PIN_SLP(gpk3-5, INPUT, NONE);
1006 PIN_SLP(gpk3-6, INPUT, NONE);
1007
1008 PIN_SLP(gpl0-0, INPUT, DOWN);
1009 PIN_SLP(gpl0-1, INPUT, DOWN);
1010 PIN_SLP(gpl0-2, INPUT, DOWN);
1011 PIN_SLP(gpl0-3, INPUT, DOWN);
1012 PIN_SLP(gpl0-4, PREV, NONE);
1013 PIN_SLP(gpl0-6, PREV, NONE);
1014
1015 PIN_SLP(gpl1-0, INPUT, DOWN);
1016 PIN_SLP(gpl1-1, INPUT, DOWN);
1017 PIN_SLP(gpl2-0, INPUT, DOWN);
1018 PIN_SLP(gpl2-1, INPUT, DOWN);
1019 PIN_SLP(gpl2-2, INPUT, DOWN);
1020 PIN_SLP(gpl2-3, INPUT, DOWN);
1021 PIN_SLP(gpl2-4, INPUT, DOWN);
1022 PIN_SLP(gpl2-5, INPUT, DOWN);
1023 PIN_SLP(gpl2-6, PREV, NONE);
1024 PIN_SLP(gpl2-7, INPUT, DOWN);
1025
1026 PIN_SLP(gpm0-0, INPUT, DOWN);
1027 PIN_SLP(gpm0-1, INPUT, DOWN);
1028 PIN_SLP(gpm0-2, INPUT, DOWN);
1029 PIN_SLP(gpm0-3, INPUT, DOWN);
1030 PIN_SLP(gpm0-4, INPUT, DOWN);
1031 PIN_SLP(gpm0-5, INPUT, DOWN);
1032 PIN_SLP(gpm0-6, INPUT, DOWN);
1033 PIN_SLP(gpm0-7, INPUT, DOWN);
1034
1035 PIN_SLP(gpm1-0, INPUT, DOWN);
1036 PIN_SLP(gpm1-1, INPUT, DOWN);
1037 PIN_SLP(gpm1-2, INPUT, NONE);
1038 PIN_SLP(gpm1-3, INPUT, NONE);
1039 PIN_SLP(gpm1-4, INPUT, NONE);
1040 PIN_SLP(gpm1-5, INPUT, NONE);
1041 PIN_SLP(gpm1-6, INPUT, DOWN);
1042
1043 PIN_SLP(gpm2-0, INPUT, NONE);
1044 PIN_SLP(gpm2-1, INPUT, NONE);
1045 PIN_SLP(gpm2-2, INPUT, DOWN);
1046 PIN_SLP(gpm2-3, INPUT, DOWN);
1047 PIN_SLP(gpm2-4, INPUT, DOWN);
1048
1049 PIN_SLP(gpm3-0, PREV, NONE);
1050 PIN_SLP(gpm3-1, PREV, NONE);
1051 PIN_SLP(gpm3-2, PREV, NONE);
1052 PIN_SLP(gpm3-3, OUT1, NONE);
1053 PIN_SLP(gpm3-4, INPUT, DOWN);
1054 PIN_SLP(gpm3-5, INPUT, DOWN);
1055 PIN_SLP(gpm3-6, INPUT, DOWN);
1056 PIN_SLP(gpm3-7, INPUT, DOWN);
1057
1058 PIN_SLP(gpm4-0, INPUT, DOWN);
1059 PIN_SLP(gpm4-1, INPUT, DOWN);
1060 PIN_SLP(gpm4-2, INPUT, DOWN);
1061 PIN_SLP(gpm4-3, INPUT, DOWN);
1062 PIN_SLP(gpm4-4, INPUT, DOWN);
1063 PIN_SLP(gpm4-5, INPUT, DOWN);
1064 PIN_SLP(gpm4-6, INPUT, DOWN);
1065 PIN_SLP(gpm4-7, INPUT, DOWN);
1066
1067 PIN_SLP(gpy0-0, INPUT, DOWN);
1068 PIN_SLP(gpy0-1, INPUT, DOWN);
1069 PIN_SLP(gpy0-2, INPUT, DOWN);
1070 PIN_SLP(gpy0-3, INPUT, DOWN);
1071 PIN_SLP(gpy0-4, INPUT, DOWN);
1072 PIN_SLP(gpy0-5, INPUT, DOWN);
1073
1074 PIN_SLP(gpy1-0, INPUT, DOWN);
1075 PIN_SLP(gpy1-1, INPUT, DOWN);
1076 PIN_SLP(gpy1-2, INPUT, DOWN);
1077 PIN_SLP(gpy1-3, INPUT, DOWN);
1078
1079 PIN_SLP(gpy2-0, PREV, NONE);
1080 PIN_SLP(gpy2-1, INPUT, DOWN);
1081 PIN_SLP(gpy2-2, INPUT, NONE);
1082 PIN_SLP(gpy2-3, INPUT, NONE);
1083 PIN_SLP(gpy2-4, INPUT, NONE);
1084 PIN_SLP(gpy2-5, INPUT, NONE);
1085
1086 PIN_SLP(gpy3-0, INPUT, DOWN);
1087 PIN_SLP(gpy3-1, INPUT, DOWN);
1088 PIN_SLP(gpy3-2, INPUT, DOWN);
1089 PIN_SLP(gpy3-3, INPUT, DOWN);
1090 PIN_SLP(gpy3-4, INPUT, DOWN);
1091 PIN_SLP(gpy3-5, INPUT, DOWN);
1092 PIN_SLP(gpy3-6, INPUT, DOWN);
1093 PIN_SLP(gpy3-7, INPUT, DOWN);
1094
1095 PIN_SLP(gpy4-0, INPUT, DOWN);
1096 PIN_SLP(gpy4-1, INPUT, DOWN);
1097 PIN_SLP(gpy4-2, INPUT, DOWN);
1098 PIN_SLP(gpy4-3, INPUT, DOWN);
1099 PIN_SLP(gpy4-4, INPUT, DOWN);
1100 PIN_SLP(gpy4-5, INPUT, DOWN);
1101 PIN_SLP(gpy4-6, INPUT, DOWN);
1102 PIN_SLP(gpy4-7, INPUT, DOWN);
1103
1104 PIN_SLP(gpy5-0, INPUT, DOWN);
1105 PIN_SLP(gpy5-1, INPUT, DOWN);
1106 PIN_SLP(gpy5-2, INPUT, DOWN);
1107 PIN_SLP(gpy5-3, INPUT, DOWN);
1108 PIN_SLP(gpy5-4, INPUT, DOWN);
1109 PIN_SLP(gpy5-5, INPUT, DOWN);
1110 PIN_SLP(gpy5-6, INPUT, DOWN);
1111 PIN_SLP(gpy5-7, INPUT, DOWN);
1112
1113 PIN_SLP(gpy6-0, INPUT, DOWN);
1114 PIN_SLP(gpy6-1, INPUT, DOWN);
1115 PIN_SLP(gpy6-2, INPUT, DOWN);
1116 PIN_SLP(gpy6-3, INPUT, DOWN);
1117 PIN_SLP(gpy6-4, INPUT, DOWN);
1118 PIN_SLP(gpy6-5, INPUT, DOWN);
1119 PIN_SLP(gpy6-6, INPUT, DOWN);
1120 PIN_SLP(gpy6-7, INPUT, DOWN);
1121 };
1122};
1123
1124&pinctrl_2 {
1125 pinctrl-names = "default";
1126 pinctrl-0 = <&sleep2>;
1127
1128 sleep2: sleep-states {
1129 PIN_SLP(gpz-0, INPUT, DOWN);
1130 PIN_SLP(gpz-1, INPUT, DOWN);
1131 PIN_SLP(gpz-2, INPUT, DOWN);
1132 PIN_SLP(gpz-3, INPUT, DOWN);
1133 PIN_SLP(gpz-4, INPUT, DOWN);
1134 PIN_SLP(gpz-5, INPUT, DOWN);
1135 PIN_SLP(gpz-6, INPUT, DOWN);
1136 };
1137};
1138
1139&pinctrl_3 {
1140 pinctrl-names = "default";
1141 pinctrl-0 = <&sleep3>;
1142
1143 sleep3: sleep-states {
1144 PIN_SLP(gpv0-0, INPUT, DOWN);
1145 PIN_SLP(gpv0-1, INPUT, DOWN);
1146 PIN_SLP(gpv0-2, INPUT, DOWN);
1147 PIN_SLP(gpv0-3, INPUT, DOWN);
1148 PIN_SLP(gpv0-4, INPUT, DOWN);
1149 PIN_SLP(gpv0-5, INPUT, DOWN);
1150 PIN_SLP(gpv0-6, INPUT, DOWN);
1151 PIN_SLP(gpv0-7, INPUT, DOWN);
1152
1153 PIN_SLP(gpv1-0, INPUT, DOWN);
1154 PIN_SLP(gpv1-1, INPUT, DOWN);
1155 PIN_SLP(gpv1-2, INPUT, DOWN);
1156 PIN_SLP(gpv1-3, INPUT, DOWN);
1157 PIN_SLP(gpv1-4, INPUT, DOWN);
1158 PIN_SLP(gpv1-5, INPUT, DOWN);
1159 PIN_SLP(gpv1-6, INPUT, DOWN);
1160 PIN_SLP(gpv1-7, INPUT, DOWN);
1161
1162 PIN_SLP(gpv2-0, INPUT, DOWN);
1163 PIN_SLP(gpv2-1, INPUT, DOWN);
1164 PIN_SLP(gpv2-2, INPUT, DOWN);
1165 PIN_SLP(gpv2-3, INPUT, DOWN);
1166 PIN_SLP(gpv2-4, INPUT, DOWN);
1167 PIN_SLP(gpv2-5, INPUT, DOWN);
1168 PIN_SLP(gpv2-6, INPUT, DOWN);
1169 PIN_SLP(gpv2-7, INPUT, DOWN);
1170
1171 PIN_SLP(gpv3-0, INPUT, DOWN);
1172 PIN_SLP(gpv3-1, INPUT, DOWN);
1173 PIN_SLP(gpv3-2, INPUT, DOWN);
1174 PIN_SLP(gpv3-3, INPUT, DOWN);
1175 PIN_SLP(gpv3-4, INPUT, DOWN);
1176 PIN_SLP(gpv3-5, INPUT, DOWN);
1177 PIN_SLP(gpv3-6, INPUT, DOWN);
1178 PIN_SLP(gpv3-7, INPUT, DOWN);
1179
1180 PIN_SLP(gpv4-0, INPUT, DOWN);
1181 };
1182};
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index d8bc059e172f..0f6ec93bb1d8 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -22,6 +22,35 @@
22/ { 22/ {
23 compatible = "samsung,exynos4412", "samsung,exynos4"; 23 compatible = "samsung,exynos4412", "samsung,exynos4";
24 24
25 cpus {
26 #address-cells = <1>;
27 #size-cells = <0>;
28
29 cpu@A00 {
30 device_type = "cpu";
31 compatible = "arm,cortex-a9";
32 reg = <0xA00>;
33 };
34
35 cpu@A01 {
36 device_type = "cpu";
37 compatible = "arm,cortex-a9";
38 reg = <0xA01>;
39 };
40
41 cpu@A02 {
42 device_type = "cpu";
43 compatible = "arm,cortex-a9";
44 reg = <0xA02>;
45 };
46
47 cpu@A03 {
48 device_type = "cpu";
49 compatible = "arm,cortex-a9";
50 reg = <0xA03>;
51 };
52 };
53
25 combiner: interrupt-controller@10440000 { 54 combiner: interrupt-controller@10440000 {
26 samsung,combiner-nr = <20>; 55 samsung,combiner-nr = <20>;
27 }; 56 };
diff --git a/arch/arm/boot/dts/exynos4415-pinctrl.dtsi b/arch/arm/boot/dts/exynos4415-pinctrl.dtsi
new file mode 100644
index 000000000000..75af9c56123e
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4415-pinctrl.dtsi
@@ -0,0 +1,573 @@
1/*
2 * Samsung's Exynos4415 SoCs pin-mux and pin-config device tree source
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 *
6 * Samsung's Exynos4415 SoCs pin-mux and pin-config optiosn are listed as device
7 * tree nodes are listed in this file.
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&pinctrl_0 {
15 gpa0: gpa0 {
16 gpio-controller;
17 #gpio-cells = <2>;
18
19 interrupt-controller;
20 #interrupt-cells = <2>;
21 };
22
23 gpa1: gpa1 {
24 gpio-controller;
25 #gpio-cells = <2>;
26
27 interrupt-controller;
28 #interrupt-cells = <2>;
29 };
30
31 gpb: gpb {
32 gpio-controller;
33 #gpio-cells = <2>;
34
35 interrupt-controller;
36 #interrupt-cells = <2>;
37 };
38
39 gpc0: gpc0 {
40 gpio-controller;
41 #gpio-cells = <2>;
42
43 interrupt-controller;
44 #interrupt-cells = <2>;
45 };
46
47 gpc1: gpc1 {
48 gpio-controller;
49 #gpio-cells = <2>;
50
51 interrupt-controller;
52 #interrupt-cells = <2>;
53 };
54
55 gpd0: gpd0 {
56 gpio-controller;
57 #gpio-cells = <2>;
58
59 interrupt-controller;
60 #interrupt-cells = <2>;
61 };
62
63 gpd1: gpd1 {
64 gpio-controller;
65 #gpio-cells = <2>;
66
67 interrupt-controller;
68 #interrupt-cells = <2>;
69 };
70
71 gpf0: gpf0 {
72 gpio-controller;
73 #gpio-cells = <2>;
74
75 interrupt-controller;
76 #interrupt-cells = <2>;
77 };
78
79 gpf1: gpf1 {
80 gpio-controller;
81 #gpio-cells = <2>;
82
83 interrupt-controller;
84 #interrupt-cells = <2>;
85 };
86
87 gpf2: gpf2 {
88 gpio-controller;
89 #gpio-cells = <2>;
90
91 interrupt-controller;
92 #interrupt-cells = <2>;
93 };
94
95 uart0_data: uart0-data {
96 samsung,pins = "gpa0-0", "gpa0-1";
97 samsung,pin-function = <0x2>;
98 samsung,pin-pud = <0>;
99 samsung,pin-drv = <0>;
100 };
101
102 uart0_fctl: uart0-fctl {
103 samsung,pins = "gpa0-2", "gpa0-3";
104 samsung,pin-function = <2>;
105 samsung,pin-pud = <0>;
106 samsung,pin-drv = <0>;
107 };
108
109 uart1_data: uart1-data {
110 samsung,pins = "gpa0-4", "gpa0-5";
111 samsung,pin-function = <2>;
112 samsung,pin-pud = <0>;
113 samsung,pin-drv = <0>;
114 };
115
116 uart1_fctl: uart1-fctl {
117 samsung,pins = "gpa0-6", "gpa0-7";
118 samsung,pin-function = <2>;
119 samsung,pin-pud = <0>;
120 samsung,pin-drv = <0>;
121 };
122
123 uart2_data: uart2-data {
124 samsung,pins = "gpa1-0", "gpa1-1";
125 samsung,pin-function = <2>;
126 samsung,pin-pud = <0>;
127 samsung,pin-drv = <0>;
128 };
129
130 uart2_fctl: uart2-fctl {
131 samsung,pins = "gpa1-2", "gpa1-3";
132 samsung,pin-function = <2>;
133 samsung,pin-pud = <0>;
134 samsung,pin-drv = <0>;
135 };
136
137 uart3_data: uart3-data {
138 samsung,pins = "gpa1-4", "gpa1-5";
139 samsung,pin-function = <2>;
140 samsung,pin-pud = <0>;
141 samsung,pin-drv = <0>;
142 };
143
144 i2c2_bus: i2c2-bus {
145 samsung,pins = "gpa0-6", "gpa0-7";
146 samsung,pin-function = <3>;
147 samsung,pin-pud = <3>;
148 samsung,pin-drv = <0>;
149 };
150
151 i2c3_bus: i2c3-bus {
152 samsung,pins = "gpa1-2", "gpa1-3";
153 samsung,pin-function = <3>;
154 samsung,pin-pud = <3>;
155 samsung,pin-drv = <0>;
156 };
157
158 spi0_bus: spi0-bus {
159 samsung,pins = "gpb-0", "gpb-2", "gpb-3";
160 samsung,pin-function = <2>;
161 samsung,pin-pud = <3>;
162 samsung,pin-drv = <0>;
163 };
164
165 i2c4_bus: i2c4-bus {
166 samsung,pins = "gpb-0", "gpb-1";
167 samsung,pin-function = <3>;
168 samsung,pin-pud = <3>;
169 samsung,pin-drv = <0>;
170 };
171
172 spi1_bus: spi1-bus {
173 samsung,pins = "gpb-4", "gpb-6", "gpb-7";
174 samsung,pin-function = <2>;
175 samsung,pin-pud = <3>;
176 samsung,pin-drv = <0>;
177 };
178
179 i2c5_bus: i2c5-bus {
180 samsung,pins = "gpb-2", "gpb-3";
181 samsung,pin-function = <3>;
182 samsung,pin-pud = <3>;
183 samsung,pin-drv = <0>;
184 };
185
186 i2s1_bus: i2s1-bus {
187 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
188 "gpc0-4";
189 samsung,pin-function = <2>;
190 samsung,pin-pud = <0>;
191 samsung,pin-drv = <0>;
192 };
193
194 i2s2_bus: i2s2-bus {
195 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
196 "gpc1-4";
197 samsung,pin-function = <2>;
198 samsung,pin-pud = <0>;
199 samsung,pin-drv = <0>;
200 };
201
202 pcm2_bus: pcm2-bus {
203 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
204 "gpc1-4";
205 samsung,pin-function = <3>;
206 samsung,pin-pud = <0>;
207 samsung,pin-drv = <0>;
208 };
209
210 i2c6_bus: i2c6-bus {
211 samsung,pins = "gpc1-3", "gpc1-4";
212 samsung,pin-function = <4>;
213 samsung,pin-pud = <3>;
214 samsung,pin-drv = <0>;
215 };
216
217 spi2_bus: spi2-bus {
218 samsung,pins = "gpc1-1", "gpc1-3", "gpc1-4";
219 samsung,pin-function = <5>;
220 samsung,pin-pud = <3>;
221 samsung,pin-drv = <0>;
222 };
223
224 pwm0_out: pwm0-out {
225 samsung,pins = "gpd0-0";
226 samsung,pin-function = <2>;
227 samsung,pin-pud = <0>;
228 samsung,pin-drv = <0>;
229 };
230
231 pwm1_out: pwm1-out {
232 samsung,pins = "gpd0-1";
233 samsung,pin-function = <2>;
234 samsung,pin-pud = <0>;
235 samsung,pin-drv = <0>;
236 };
237
238 pwm2_out: pwm2-out {
239 samsung,pins = "gpd0-2";
240 samsung,pin-function = <2>;
241 samsung,pin-pud = <0>;
242 samsung,pin-drv = <0>;
243 };
244
245 pwm3_out: pwm3-out {
246 samsung,pins = "gpd0-3";
247 samsung,pin-function = <2>;
248 samsung,pin-pud = <0>;
249 samsung,pin-drv = <0>;
250 };
251
252 i2c7_bus: i2c7-bus {
253 samsung,pins = "gpd0-2", "gpd0-3";
254 samsung,pin-function = <3>;
255 samsung,pin-pud = <3>;
256 samsung,pin-drv = <0>;
257 };
258
259 i2c0_bus: i2c0-bus {
260 samsung,pins = "gpd1-0", "gpd1-1";
261 samsung,pin-function = <2>;
262 samsung,pin-pud = <3>;
263 samsung,pin-drv = <0>;
264 };
265
266 i2c1_bus: i2c1-bus {
267 samsung,pins = "gpd1-2", "gpd1-3";
268 samsung,pin-function = <2>;
269 samsung,pin-pud = <3>;
270 samsung,pin-drv = <0>;
271 };
272};
273
274&pinctrl_1 {
275 gpk0: gpk0 {
276 gpio-controller;
277 #gpio-cells = <2>;
278
279 interrupt-controller;
280 #interrupt-cells = <2>;
281 };
282
283 gpk1: gpk1 {
284 gpio-controller;
285 #gpio-cells = <2>;
286
287 interrupt-controller;
288 #interrupt-cells = <2>;
289 };
290
291 gpk2: gpk2 {
292 gpio-controller;
293 #gpio-cells = <2>;
294
295 interrupt-controller;
296 #interrupt-cells = <2>;
297 };
298
299 gpk3: gpk3 {
300 gpio-controller;
301 #gpio-cells = <2>;
302
303 interrupt-controller;
304 #interrupt-cells = <2>;
305 };
306
307 gpl0: gpl0 {
308 gpio-controller;
309 #gpio-cells = <2>;
310
311 interrupt-controller;
312 #interrupt-cells = <2>;
313 };
314
315 gpm0: gpm0 {
316 gpio-controller;
317 #gpio-cells = <2>;
318
319 interrupt-controller;
320 #interrupt-cells = <2>;
321 };
322
323 gpm1: gpm1 {
324 gpio-controller;
325 #gpio-cells = <2>;
326
327 interrupt-controller;
328 #interrupt-cells = <2>;
329 };
330
331 gpm2: gpm2 {
332 gpio-controller;
333 #gpio-cells = <2>;
334
335 interrupt-controller;
336 #interrupt-cells = <2>;
337 };
338
339 gpm3: gpm3 {
340 gpio-controller;
341 #gpio-cells = <2>;
342
343 interrupt-controller;
344 #interrupt-cells = <2>;
345 };
346
347 gpm4: gpm4 {
348 gpio-controller;
349 #gpio-cells = <2>;
350
351 interrupt-controller;
352 #interrupt-cells = <2>;
353 };
354
355 gpx0: gpx0 {
356 gpio-controller;
357 #gpio-cells = <2>;
358
359 interrupt-controller;
360 interrupt-parent = <&gic>;
361 interrupts = <0 32 0>, <0 33 0>, <0 34 0>, <0 35 0>,
362 <0 36 0>, <0 37 0>, <0 38 0>, <0 39 0>;
363 #interrupt-cells = <2>;
364 };
365
366 gpx1: gpx1 {
367 gpio-controller;
368 #gpio-cells = <2>;
369
370 interrupt-controller;
371 interrupt-parent = <&gic>;
372 interrupts = <0 40 0>, <0 41 0>, <0 42 0>, <0 43 0>,
373 <0 44 0>, <0 45 0>, <0 46 0>, <0 47 0>;
374 #interrupt-cells = <2>;
375 };
376
377 gpx2: gpx2 {
378 gpio-controller;
379 #gpio-cells = <2>;
380
381 interrupt-controller;
382 #interrupt-cells = <2>;
383 };
384
385 gpx3: gpx3 {
386 gpio-controller;
387 #gpio-cells = <2>;
388
389 interrupt-controller;
390 #interrupt-cells = <2>;
391 };
392
393 sd0_clk: sd0-clk {
394 samsung,pins = "gpk0-0";
395 samsung,pin-function = <2>;
396 samsung,pin-pud = <0>;
397 samsung,pin-drv = <3>;
398 };
399
400 sd0_cmd: sd0-cmd {
401 samsung,pins = "gpk0-1";
402 samsung,pin-function = <2>;
403 samsung,pin-pud = <0>;
404 samsung,pin-drv = <3>;
405 };
406
407 sd0_cd: sd0-cd {
408 samsung,pins = "gpk0-2";
409 samsung,pin-function = <2>;
410 samsung,pin-pud = <3>;
411 samsung,pin-drv = <3>;
412 };
413
414 sd0_rdqs: sd0-rdqs {
415 samsung,pins = "gpk0-7";
416 samsung,pin-function = <2>;
417 samsung,pin-pud = <0>;
418 samsung,pin-drv = <3>;
419 };
420
421 sd0_bus1: sd0-bus-width1 {
422 samsung,pins = "gpk0-3";
423 samsung,pin-function = <2>;
424 samsung,pin-pud = <3>;
425 samsung,pin-drv = <3>;
426 };
427
428 sd0_bus4: sd0-bus-width4 {
429 samsung,pins = "gpk0-4", "gpk0-5", "gpk0-6";
430 samsung,pin-function = <2>;
431 samsung,pin-pud = <3>;
432 samsung,pin-drv = <3>;
433 };
434
435 sd0_bus8: sd0-bus-width8 {
436 samsung,pins = "gpl0-0", "gpl0-1", "gpl0-2", "gpl0-3";
437 samsung,pin-function = <2>;
438 samsung,pin-pud = <3>;
439 samsung,pin-drv = <3>;
440 };
441
442 sd1_clk: sd1-clk {
443 samsung,pins = "gpk1-0";
444 samsung,pin-function = <2>;
445 samsung,pin-pud = <0>;
446 samsung,pin-drv = <3>;
447 };
448
449 sd1_cmd: sd1-cmd {
450 samsung,pins = "gpk1-1";
451 samsung,pin-function = <2>;
452 samsung,pin-pud = <0>;
453 samsung,pin-drv = <3>;
454 };
455
456 sd1_cd: sd1-cd {
457 samsung,pins = "gpk1-2";
458 samsung,pin-function = <2>;
459 samsung,pin-pud = <3>;
460 samsung,pin-drv = <3>;
461 };
462
463 sd1_bus1: sd1-bus-width1 {
464 samsung,pins = "gpk1-3";
465 samsung,pin-function = <2>;
466 samsung,pin-pud = <3>;
467 samsung,pin-drv = <3>;
468 };
469
470 sd1_bus4: sd1-bus-width4 {
471 samsung,pins = "gpk1-4", "gpk1-5", "gpk1-6";
472 samsung,pin-function = <2>;
473 samsung,pin-pud = <3>;
474 samsung,pin-drv = <3>;
475 };
476
477 sd2_clk: sd2-clk {
478 samsung,pins = "gpk2-0";
479 samsung,pin-function = <2>;
480 samsung,pin-pud = <0>;
481 samsung,pin-drv = <4>;
482 };
483
484 sd2_cmd: sd2-cmd {
485 samsung,pins = "gpk2-1";
486 samsung,pin-function = <2>;
487 samsung,pin-pud = <0>;
488 samsung,pin-drv = <4>;
489 };
490
491 sd2_cd: sd2-cd {
492 samsung,pins = "gpk2-2";
493 samsung,pin-function = <2>;
494 samsung,pin-pud = <3>;
495 samsung,pin-drv = <3>;
496 };
497
498 sd2_bus1: sd2-bus-width1 {
499 samsung,pins = "gpk2-3";
500 samsung,pin-function = <2>;
501 samsung,pin-pud = <3>;
502 samsung,pin-drv = <4>;
503 };
504
505 sd2_bus4: sd2-bus-width4 {
506 samsung,pins = "gpk2-4", "gpk2-5", "gpk2-6";
507 samsung,pin-function = <2>;
508 samsung,pin-pud = <3>;
509 samsung,pin-drv = <4>;
510 };
511
512 cam_port_b_io: cam-port-b-io {
513 samsung,pins = "gpm0-0", "gpm0-1", "gpm0-2", "gpm0-3",
514 "gpm0-4", "gpm0-5", "gpm0-6", "gpm0-7",
515 "gpm1-0", "gpm1-1", "gpm2-0", "gpm2-1";
516 samsung,pin-function = <3>;
517 samsung,pin-pud = <3>;
518 samsung,pin-drv = <0>;
519 };
520
521 cam_port_b_clk_active: cam-port-b-clk-active {
522 samsung,pins = "gpm2-2";
523 samsung,pin-function = <3>;
524 samsung,pin-pud = <0>;
525 samsung,pin-drv = <3>;
526 };
527
528 cam_port_b_clk_idle: cam-port-b-clk-idle {
529 samsung,pins = "gpm2-2";
530 samsung,pin-function = <0>;
531 samsung,pin-pud = <0>;
532 samsung,pin-drv = <0>;
533 };
534
535 fimc_is_i2c0: fimc-is-i2c0 {
536 samsung,pins = "gpm4-0", "gpm4-1";
537 samsung,pin-function = <2>;
538 samsung,pin-pud = <0>;
539 samsung,pin-drv = <0>;
540 };
541
542 fimc_is_i2c1: fimc-is-i2c1 {
543 samsung,pins = "gpm4-2", "gpm4-3";
544 samsung,pin-function = <2>;
545 samsung,pin-pud = <0>;
546 samsung,pin-drv = <0>;
547 };
548
549 fimc_is_uart: fimc-is-uart {
550 samsung,pins = "gpm3-5", "gpm3-7";
551 samsung,pin-function = <3>;
552 samsung,pin-pud = <0>;
553 samsung,pin-drv = <0>;
554 };
555};
556
557&pinctrl_2 {
558 gpz: gpz {
559 gpio-controller;
560 #gpio-cells = <2>;
561
562 interrupt-controller;
563 #interrupt-cells = <2>;
564 };
565
566 i2s0_bus: i2s0-bus {
567 samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3",
568 "gpz-4", "gpz-5", "gpz-6";
569 samsung,pin-function = <2>;
570 samsung,pin-pud = <0>;
571 samsung,pin-drv = <0>;
572 };
573};
diff --git a/arch/arm/boot/dts/exynos4415.dtsi b/arch/arm/boot/dts/exynos4415.dtsi
new file mode 100644
index 000000000000..c1c9b37340d9
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4415.dtsi
@@ -0,0 +1,604 @@
1/*
2 * Samsung's Exynos4415 SoC device tree source
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 *
6 * Samsung's Exynos4415 SoC device nodes are listed in this file. Exynos4415
7 * based board files can include this file and provide values for board
8 * specific bindings.
9 *
10 * Note: This file does not include device nodes for all the controllers in
11 * Exynos4415 SoC. As device tree coverage for Exynos4415 increases, additional
12 * nodes can be added to this file.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#include "skeleton.dtsi"
20#include <dt-bindings/clock/exynos4415.h>
21#include <dt-bindings/clock/exynos-audss-clk.h>
22
23/ {
24 compatible = "samsung,exynos4415";
25 interrupt-parent = <&gic>;
26
27 aliases {
28 pinctrl0 = &pinctrl_0;
29 pinctrl1 = &pinctrl_1;
30 pinctrl2 = &pinctrl_2;
31 mshc0 = &mshc_0;
32 mshc1 = &mshc_1;
33 mshc2 = &mshc_2;
34 spi0 = &spi_0;
35 spi1 = &spi_1;
36 spi2 = &spi_2;
37 i2c0 = &i2c_0;
38 i2c1 = &i2c_1;
39 i2c2 = &i2c_2;
40 i2c3 = &i2c_3;
41 i2c4 = &i2c_4;
42 i2c5 = &i2c_5;
43 i2c6 = &i2c_6;
44 i2c7 = &i2c_7;
45 };
46
47 cpus {
48 #address-cells = <1>;
49 #size-cells = <0>;
50
51 cpu0: cpu@a00 {
52 device_type = "cpu";
53 compatible = "arm,cortex-a9";
54 reg = <0xa00>;
55 clock-frequency = <1600000000>;
56 };
57
58 cpu1: cpu@a01 {
59 device_type = "cpu";
60 compatible = "arm,cortex-a9";
61 reg = <0xa01>;
62 clock-frequency = <1600000000>;
63 };
64
65 cpu2: cpu@a02 {
66 device_type = "cpu";
67 compatible = "arm,cortex-a9";
68 reg = <0xa02>;
69 clock-frequency = <1600000000>;
70 };
71
72 cpu3: cpu@a03 {
73 device_type = "cpu";
74 compatible = "arm,cortex-a9";
75 reg = <0xa03>;
76 clock-frequency = <1600000000>;
77 };
78 };
79
80 soc: soc {
81 compatible = "simple-bus";
82 #address-cells = <1>;
83 #size-cells = <1>;
84 ranges;
85
86 sysram@02020000 {
87 compatible = "mmio-sram";
88 reg = <0x02020000 0x50000>;
89 #address-cells = <1>;
90 #size-cells = <1>;
91 ranges = <0 0x02020000 0x50000>;
92
93 smp-sysram@0 {
94 compatible = "samsung,exynos4210-sysram";
95 reg = <0x0 0x1000>;
96 };
97
98 smp-sysram@4f000 {
99 compatible = "samsung,exynos4210-sysram-ns";
100 reg = <0x4f000 0x1000>;
101 };
102 };
103
104 pinctrl_2: pinctrl@03860000 {
105 compatible = "samsung,exynos4415-pinctrl";
106 reg = <0x03860000 0x1000>;
107 interrupts = <0 242 0>;
108 };
109
110 chipid@10000000 {
111 compatible = "samsung,exynos4210-chipid";
112 reg = <0x10000000 0x100>;
113 };
114
115 sysreg_system_controller: syscon@10010000 {
116 compatible = "samsung,exynos4-sysreg", "syscon";
117 reg = <0x10010000 0x400>;
118 };
119
120 pmu_system_controller: system-controller@10020000 {
121 compatible = "samsung,exynos4415-pmu", "syscon";
122 reg = <0x10020000 0x4000>;
123 };
124
125 mipi_phy: video-phy@10020710 {
126 compatible = "samsung,s5pv210-mipi-video-phy";
127 reg = <0x10020710 8>;
128 #phy-cells = <1>;
129 };
130
131 pd_cam: cam-power-domain@10024000 {
132 compatible = "samsung,exynos4210-pd";
133 reg = <0x10024000 0x20>;
134 };
135
136 pd_tv: tv-power-domain@10024020 {
137 compatible = "samsung,exynos4210-pd";
138 reg = <0x10024020 0x20>;
139 };
140
141 pd_mfc: mfc-power-domain@10024040 {
142 compatible = "samsung,exynos4210-pd";
143 reg = <0x10024040 0x20>;
144 };
145
146 pd_g3d: g3d-power-domain@10024060 {
147 compatible = "samsung,exynos4210-pd";
148 reg = <0x10024060 0x20>;
149 };
150
151 pd_lcd0: lcd0-power-domain@10024080 {
152 compatible = "samsung,exynos4210-pd";
153 reg = <0x10024080 0x20>;
154 };
155
156 pd_isp0: isp0-power-domain@100240A0 {
157 compatible = "samsung,exynos4210-pd";
158 reg = <0x100240A0 0x20>;
159 };
160
161 pd_isp1: isp1-power-domain@100240E0 {
162 compatible = "samsung,exynos4210-pd";
163 reg = <0x100240E0 0x20>;
164 };
165
166 cmu: clock-controller@10030000 {
167 compatible = "samsung,exynos4415-cmu";
168 reg = <0x10030000 0x18000>;
169 #clock-cells = <1>;
170 };
171
172 rtc: rtc@10070000 {
173 compatible = "samsung,exynos3250-rtc";
174 reg = <0x10070000 0x100>;
175 interrupts = <0 73 0>, <0 74 0>;
176 status = "disabled";
177 };
178
179 mct@10050000 {
180 compatible = "samsung,exynos4210-mct";
181 reg = <0x10050000 0x800>;
182 interrupts = <0 218 0>, <0 219 0>, <0 220 0>, <0 221 0>,
183 <0 223 0>, <0 226 0>, <0 227 0>, <0 228 0>;
184 clocks = <&cmu CLK_FIN_PLL>, <&cmu CLK_MCT>;
185 clock-names = "fin_pll", "mct";
186 };
187
188 gic: interrupt-controller@10481000 {
189 compatible = "arm,cortex-a9-gic";
190 #interrupt-cells = <3>;
191 interrupt-controller;
192 reg = <0x10481000 0x1000>,
193 <0x10482000 0x1000>,
194 <0x10484000 0x2000>,
195 <0x10486000 0x2000>;
196 interrupts = <1 9 0xf04>;
197 };
198
199 l2c: l2-cache-controller@10502000 {
200 compatible = "arm,pl310-cache";
201 reg = <0x10502000 0x1000>;
202 cache-unified;
203 cache-level = <2>;
204 arm,tag-latency = <2 2 1>;
205 arm,data-latency = <3 2 1>;
206 arm,double-linefill = <1>;
207 arm,double-linefill-incr = <0>;
208 arm,double-linefill-wrap = <1>;
209 arm,prefetch-drop = <1>;
210 arm,prefetch-offset = <7>;
211 };
212
213 cmu_dmc: clock-controller@105C0000 {
214 compatible = "samsung,exynos4415-cmu-dmc";
215 reg = <0x105C0000 0x3000>;
216 #clock-cells = <1>;
217 };
218
219 pinctrl_1: pinctrl@11000000 {
220 compatible = "samsung,exynos4415-pinctrl";
221 reg = <0x11000000 0x1000>;
222 interrupts = <0 225 0>;
223
224 wakeup-interrupt-controller {
225 compatible = "samsung,exynos4210-wakeup-eint";
226 interrupt-parent = <&gic>;
227 interrupts = <0 48 0>;
228 };
229 };
230
231 pinctrl_0: pinctrl@11400000 {
232 compatible = "samsung,exynos4415-pinctrl";
233 reg = <0x11400000 0x1000>;
234 interrupts = <0 240 0>;
235 };
236
237 hsotg: hsotg@12480000 {
238 compatible = "samsung,s3c6400-hsotg";
239 reg = <0x12480000 0x20000>;
240 interrupts = <0 141 0>;
241 clocks = <&cmu CLK_USBDEVICE>;
242 clock-names = "otg";
243 phys = <&exynos_usbphy 0>;
244 phy-names = "usb2-phy";
245 status = "disabled";
246 };
247
248 mshc_0: mshc@12510000 {
249 compatible = "samsung,exynos5250-dw-mshc";
250 reg = <0x12510000 0x1000>;
251 interrupts = <0 142 0>;
252 clocks = <&cmu CLK_SDMMC0>, <&cmu CLK_SCLK_MMC0>;
253 clock-names = "biu", "ciu";
254 fifo-depth = <0x80>;
255 #address-cells = <1>;
256 #size-cells = <0>;
257 status = "disabled";
258 };
259
260 mshc_1: mshc@12520000 {
261 compatible = "samsung,exynos5250-dw-mshc";
262 reg = <0x12520000 0x1000>;
263 interrupts = <0 143 0>;
264 clocks = <&cmu CLK_SDMMC1>, <&cmu CLK_SCLK_MMC1>;
265 clock-names = "biu", "ciu";
266 fifo-depth = <0x80>;
267 #address-cells = <1>;
268 #size-cells = <0>;
269 status = "disabled";
270 };
271
272 mshc_2: mshc@12530000 {
273 compatible = "samsung,exynos5250-dw-mshc";
274 reg = <0x12530000 0x1000>;
275 interrupts = <0 144 0>;
276 clocks = <&cmu CLK_SDMMC2>, <&cmu CLK_SCLK_MMC2>;
277 clock-names = "biu", "ciu";
278 fifo-depth = <0x80>;
279 #address-cells = <1>;
280 #size-cells = <0>;
281 status = "disabled";
282 };
283
284 ehci: ehci@12580000 {
285 compatible = "samsung,exynos4210-ehci";
286 reg = <0x12580000 0x100>;
287 interrupts = <0 140 0>;
288 clocks = <&cmu CLK_USBHOST>;
289 clock-names = "usbhost";
290 status = "disabled";
291 #address-cells = <1>;
292 #size-cells = <0>;
293 port@0 {
294 reg = <0>;
295 phys = <&exynos_usbphy 1>;
296 status = "disabled";
297 };
298 port@1 {
299 reg = <1>;
300 phys = <&exynos_usbphy 2>;
301 status = "disabled";
302 };
303 port@2 {
304 reg = <2>;
305 phys = <&exynos_usbphy 3>;
306 status = "disabled";
307 };
308 };
309
310 ohci: ohci@12590000 {
311 compatible = "samsung,exynos4210-ohci";
312 reg = <0x12590000 0x100>;
313 interrupts = <0 140 0>;
314 clocks = <&cmu CLK_USBHOST>;
315 clock-names = "usbhost";
316 status = "disabled";
317 #address-cells = <1>;
318 #size-cells = <0>;
319 port@0 {
320 reg = <0>;
321 phys = <&exynos_usbphy 1>;
322 status = "disabled";
323 };
324 };
325
326 exynos_usbphy: exynos-usbphy@125B0000 {
327 compatible = "samsung,exynos4x12-usb2-phy";
328 reg = <0x125B0000 0x100>;
329 samsung,pmureg-phandle = <&pmu_system_controller>;
330 samsung,sysreg-phandle = <&sysreg_system_controller>;
331 clocks = <&cmu CLK_USBDEVICE>, <&xusbxti>;
332 clock-names = "phy", "ref";
333 #phy-cells = <1>;
334 status = "disabled";
335 };
336
337 amba {
338 compatible = "arm,amba-bus";
339 #address-cells = <1>;
340 #size-cells = <1>;
341 interrupt-parent = <&gic>;
342 ranges;
343
344 pdma0: pdma@12680000 {
345 compatible = "arm,pl330", "arm,primecell";
346 reg = <0x12680000 0x1000>;
347 interrupts = <0 138 0>;
348 clocks = <&cmu CLK_PDMA0>;
349 clock-names = "apb_pclk";
350 #dma-cells = <1>;
351 #dma-channels = <8>;
352 #dma-requests = <32>;
353 };
354
355 pdma1: pdma@12690000 {
356 compatible = "arm,pl330", "arm,primecell";
357 reg = <0x12690000 0x1000>;
358 interrupts = <0 139 0>;
359 clocks = <&cmu CLK_PDMA1>;
360 clock-names = "apb_pclk";
361 #dma-cells = <1>;
362 #dma-channels = <8>;
363 #dma-requests = <32>;
364 };
365 };
366
367 adc: adc@126C0000 {
368 compatible = "samsung,exynos3250-adc",
369 "samsung,exynos-adc-v2";
370 reg = <0x126C0000 0x100>, <0x10020718 0x4>;
371 interrupts = <0 137 0>;
372 clock-names = "adc", "sclk";
373 clocks = <&cmu CLK_TSADC>, <&cmu CLK_SCLK_TSADC>;
374 #io-channel-cells = <1>;
375 io-channel-ranges;
376 status = "disabled";
377 };
378
379 serial_0: serial@13800000 {
380 compatible = "samsung,exynos4210-uart";
381 reg = <0x13800000 0x100>;
382 interrupts = <0 109 0>;
383 clocks = <&cmu CLK_UART0>, <&cmu CLK_SCLK_UART0>;
384 clock-names = "uart", "clk_uart_baud0";
385 status = "disabled";
386 };
387
388 serial_1: serial@13810000 {
389 compatible = "samsung,exynos4210-uart";
390 reg = <0x13810000 0x100>;
391 interrupts = <0 110 0>;
392 clocks = <&cmu CLK_UART1>, <&cmu CLK_SCLK_UART1>;
393 clock-names = "uart", "clk_uart_baud0";
394 status = "disabled";
395 };
396
397 serial_2: serial@13820000 {
398 compatible = "samsung,exynos4210-uart";
399 reg = <0x13820000 0x100>;
400 interrupts = <0 111 0>;
401 clocks = <&cmu CLK_UART2>, <&cmu CLK_SCLK_UART2>;
402 clock-names = "uart", "clk_uart_baud0";
403 status = "disabled";
404 };
405
406 serial_3: serial@13830000 {
407 compatible = "samsung,exynos4210-uart";
408 reg = <0x13830000 0x100>;
409 interrupts = <0 112 0>;
410 clocks = <&cmu CLK_UART3>, <&cmu CLK_SCLK_UART3>;
411 clock-names = "uart", "clk_uart_baud0";
412 status = "disabled";
413 };
414
415 i2c_0: i2c@13860000 {
416 #address-cells = <1>;
417 #size-cells = <0>;
418 compatible = "samsung,s3c2440-i2c";
419 reg = <0x13860000 0x100>;
420 interrupts = <0 113 0>;
421 clocks = <&cmu CLK_I2C0>;
422 clock-names = "i2c";
423 pinctrl-names = "default";
424 pinctrl-0 = <&i2c0_bus>;
425 status = "disabled";
426 };
427
428 i2c_1: i2c@13870000 {
429 #address-cells = <1>;
430 #size-cells = <0>;
431 compatible = "samsung,s3c2440-i2c";
432 reg = <0x13870000 0x100>;
433 interrupts = <0 114 0>;
434 clocks = <&cmu CLK_I2C1>;
435 clock-names = "i2c";
436 pinctrl-names = "default";
437 pinctrl-0 = <&i2c1_bus>;
438 status = "disabled";
439 };
440
441 i2c_2: i2c@13880000 {
442 #address-cells = <1>;
443 #size-cells = <0>;
444 compatible = "samsung,s3c2440-i2c";
445 reg = <0x13880000 0x100>;
446 interrupts = <0 115 0>;
447 clocks = <&cmu CLK_I2C2>;
448 clock-names = "i2c";
449 pinctrl-names = "default";
450 pinctrl-0 = <&i2c2_bus>;
451 status = "disabled";
452 };
453
454 i2c_3: i2c@13890000 {
455 #address-cells = <1>;
456 #size-cells = <0>;
457 compatible = "samsung,s3c2440-i2c";
458 reg = <0x13890000 0x100>;
459 interrupts = <0 116 0>;
460 clocks = <&cmu CLK_I2C3>;
461 clock-names = "i2c";
462 pinctrl-names = "default";
463 pinctrl-0 = <&i2c3_bus>;
464 status = "disabled";
465 };
466
467 i2c_4: i2c@138A0000 {
468 #address-cells = <1>;
469 #size-cells = <0>;
470 compatible = "samsung,s3c2440-i2c";
471 reg = <0x138A0000 0x100>;
472 interrupts = <0 117 0>;
473 clocks = <&cmu CLK_I2C4>;
474 clock-names = "i2c";
475 pinctrl-names = "default";
476 pinctrl-0 = <&i2c4_bus>;
477 status = "disabled";
478 };
479
480 i2c_5: i2c@138B0000 {
481 #address-cells = <1>;
482 #size-cells = <0>;
483 compatible = "samsung,s3c2440-i2c";
484 reg = <0x138B0000 0x100>;
485 interrupts = <0 118 0>;
486 clocks = <&cmu CLK_I2C5>;
487 clock-names = "i2c";
488 pinctrl-names = "default";
489 pinctrl-0 = <&i2c5_bus>;
490 status = "disabled";
491 };
492
493 i2c_6: i2c@138C0000 {
494 #address-cells = <1>;
495 #size-cells = <0>;
496 compatible = "samsung,s3c2440-i2c";
497 reg = <0x138C0000 0x100>;
498 interrupts = <0 119 0>;
499 clocks = <&cmu CLK_I2C6>;
500 clock-names = "i2c";
501 pinctrl-names = "default";
502 pinctrl-0 = <&i2c6_bus>;
503 status = "disabled";
504 };
505
506 i2c_7: i2c@138D0000 {
507 #address-cells = <1>;
508 #size-cells = <0>;
509 compatible = "samsung,s3c2440-i2c";
510 reg = <0x138D0000 0x100>;
511 interrupts = <0 120 0>;
512 clocks = <&cmu CLK_I2C7>;
513 clock-names = "i2c";
514 pinctrl-names = "default";
515 pinctrl-0 = <&i2c7_bus>;
516 status = "disabled";
517 };
518
519 spi_0: spi@13920000 {
520 compatible = "samsung,exynos4210-spi";
521 reg = <0x13920000 0x100>;
522 interrupts = <0 121 0>;
523 dmas = <&pdma0 7>, <&pdma0 6>;
524 dma-names = "tx", "rx";
525 #address-cells = <1>;
526 #size-cells = <0>;
527 clocks = <&cmu CLK_SPI0>, <&cmu CLK_SCLK_SPI0>;
528 clock-names = "spi", "spi_busclk0";
529 samsung,spi-src-clk = <0>;
530 pinctrl-names = "default";
531 pinctrl-0 = <&spi0_bus>;
532 status = "disabled";
533 };
534
535 spi_1: spi@13930000 {
536 compatible = "samsung,exynos4210-spi";
537 reg = <0x13930000 0x100>;
538 interrupts = <0 122 0>;
539 dmas = <&pdma1 7>, <&pdma1 6>;
540 dma-names = "tx", "rx";
541 #address-cells = <1>;
542 #size-cells = <0>;
543 clocks = <&cmu CLK_SPI1>, <&cmu CLK_SCLK_SPI1>;
544 clock-names = "spi", "spi_busclk0";
545 samsung,spi-src-clk = <0>;
546 pinctrl-names = "default";
547 pinctrl-0 = <&spi1_bus>;
548 status = "disabled";
549 };
550
551 spi_2: spi@13940000 {
552 compatible = "samsung,exynos4210-spi";
553 reg = <0x13940000 0x100>;
554 interrupts = <0 123 0>;
555 dmas = <&pdma0 9>, <&pdma0 8>;
556 dma-names = "tx", "rx";
557 #address-cells = <1>;
558 #size-cells = <0>;
559 clocks = <&cmu CLK_SPI2>, <&cmu CLK_SCLK_SPI2>;
560 clock-names = "spi", "spi_busclk0";
561 samsung,spi-src-clk = <0>;
562 pinctrl-names = "default";
563 pinctrl-0 = <&spi2_bus>;
564 status = "disabled";
565 };
566
567 clock_audss: clock-controller@03810000 {
568 compatible = "samsung,exynos4210-audss-clock";
569 reg = <0x03810000 0x0C>;
570 #clock-cells = <1>;
571 };
572
573 i2s0: i2s@3830000 {
574 compatible = "samsung,s5pv210-i2s";
575 reg = <0x03830000 0x100>;
576 interrupts = <0 124 0>;
577 clocks = <&clock_audss EXYNOS_I2S_BUS>,
578 <&clock_audss EXYNOS_SCLK_I2S>;
579 clock-names = "iis", "i2s_opclk0";
580 dmas = <&pdma1 10>, <&pdma1 9>, <&pdma1 8>;
581 dma-names = "tx", "rx", "tx-sec";
582 pinctrl-names = "default";
583 pinctrl-0 = <&i2s0_bus>;
584 samsung,idma-addr = <0x03000000>;
585 status = "disabled";
586 };
587
588 pwm: pwm@139D0000 {
589 compatible = "samsung,exynos4210-pwm";
590 reg = <0x139D0000 0x1000>;
591 interrupts = <0 104 0>, <0 105 0>, <0 106 0>,
592 <0 107 0>, <0 108 0>;
593 #pwm-cells = <3>;
594 status = "disabled";
595 };
596
597 pmu {
598 compatible = "arm,cortex-a9-pmu";
599 interrupts = <0 18 0>, <0 19 0>, <0 20 0>, <0 21 0>;
600 };
601 };
602};
603
604#include "exynos4415-pinctrl.dtsi"
diff --git a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
index 0865a2e33f97..c141931378e7 100644
--- a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
@@ -12,6 +12,22 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13*/ 13*/
14 14
15#define PIN_PULL_NONE 0
16#define PIN_PULL_DOWN 1
17#define PIN_PULL_UP 3
18
19#define PIN_PDN_OUT0 0
20#define PIN_PDN_OUT1 1
21#define PIN_PDN_INPUT 2
22#define PIN_PDN_PREV 3
23
24#define PIN_SLP(_pin, _mode, _pull) \
25 _pin { \
26 samsung,pins = #_pin; \
27 samsung,pin-con-pdn = <PIN_PDN_ ##_mode>; \
28 samsung,pin-pud-pdn = <PIN_PULL_ ##_pull>; \
29 }
30
15/ { 31/ {
16 pinctrl@11400000 { 32 pinctrl@11400000 {
17 gpa0: gpa0 { 33 gpa0: gpa0 {
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index 861bb919f6d3..2e9f1f7be77b 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -271,4 +271,14 @@
271 compatible = "samsung,exynos4x12-usb2-phy"; 271 compatible = "samsung,exynos4x12-usb2-phy";
272 samsung,sysreg-phandle = <&sys_reg>; 272 samsung,sysreg-phandle = <&sys_reg>;
273 }; 273 };
274
275 tmu@100C0000 {
276 compatible = "samsung,exynos4412-tmu";
277 interrupt-parent = <&combiner>;
278 interrupts = <2 4>;
279 reg = <0x100C0000 0x100>;
280 clocks = <&clock 383>;
281 clock-names = "tmu_apbif";
282 status = "disabled";
283 };
274}; 284};
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index 3acd97eb6630..7e728a1b5559 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -7,12 +7,13 @@
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10*/ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include "exynos5250.dtsi" 13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/interrupt-controller/irq.h> 14#include <dt-bindings/interrupt-controller/irq.h>
15#include <dt-bindings/input/input.h> 15#include <dt-bindings/input/input.h>
16#include "exynos5250.dtsi"
16 17
17/ { 18/ {
18 model = "Insignal Arndale evaluation board based on EXYNOS5250"; 19 model = "Insignal Arndale evaluation board based on EXYNOS5250";
@@ -26,465 +27,52 @@
26 bootargs = "console=ttySAC2,115200"; 27 bootargs = "console=ttySAC2,115200";
27 }; 28 };
28 29
29 rtc@101E0000 {
30 status = "okay";
31 };
32
33 codec@11000000 {
34 samsung,mfc-r = <0x43000000 0x800000>;
35 samsung,mfc-l = <0x51000000 0x800000>;
36 };
37
38 i2c@12C60000 {
39 samsung,i2c-sda-delay = <100>;
40 samsung,i2c-max-bus-freq = <20000>;
41 samsung,i2c-slave-addr = <0x66>;
42 status = "okay";
43
44 s5m8767_pmic@66 {
45 compatible = "samsung,s5m8767-pmic";
46 reg = <0x66>;
47 interrupt-parent = <&gpx3>;
48 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
49
50 vinb1-supply = <&main_dc_reg>;
51 vinb2-supply = <&main_dc_reg>;
52 vinb3-supply = <&main_dc_reg>;
53 vinb4-supply = <&main_dc_reg>;
54 vinb5-supply = <&main_dc_reg>;
55 vinb6-supply = <&main_dc_reg>;
56 vinb7-supply = <&main_dc_reg>;
57 vinb8-supply = <&main_dc_reg>;
58 vinb9-supply = <&main_dc_reg>;
59
60 vinl1-supply = <&buck7_reg>;
61 vinl2-supply = <&buck7_reg>;
62 vinl3-supply = <&buck7_reg>;
63 vinl4-supply = <&main_dc_reg>;
64 vinl5-supply = <&main_dc_reg>;
65 vinl6-supply = <&main_dc_reg>;
66 vinl7-supply = <&main_dc_reg>;
67 vinl8-supply = <&buck8_reg>;
68 vinl9-supply = <&buck8_reg>;
69
70 s5m8767,pmic-buck2-dvs-voltage = <1300000>;
71 s5m8767,pmic-buck3-dvs-voltage = <1100000>;
72 s5m8767,pmic-buck4-dvs-voltage = <1200000>;
73 s5m8767,pmic-buck-dvs-gpios = <&gpd1 0 0>,
74 <&gpd1 1 0>,
75 <&gpd1 2 0>;
76 s5m8767,pmic-buck-ds-gpios = <&gpx2 3 0>,
77 <&gpx2 4 0>,
78 <&gpx2 5 0>;
79 regulators {
80 ldo1_reg: LDO1 {
81 regulator-name = "VDD_ALIVE_1.0V";
82 regulator-min-microvolt = <1100000>;
83 regulator-max-microvolt = <1100000>;
84 regulator-always-on;
85 regulator-boot-on;
86 op_mode = <1>;
87 };
88
89 ldo2_reg: LDO2 {
90 regulator-name = "VDD_28IO_DP_1.35V";
91 regulator-min-microvolt = <1200000>;
92 regulator-max-microvolt = <1200000>;
93 regulator-always-on;
94 regulator-boot-on;
95 op_mode = <1>;
96 };
97
98 ldo3_reg: LDO3 {
99 regulator-name = "VDD_COMMON1_1.8V";
100 regulator-min-microvolt = <1800000>;
101 regulator-max-microvolt = <1800000>;
102 regulator-always-on;
103 regulator-boot-on;
104 op_mode = <1>;
105 };
106
107 ldo4_reg: LDO4 {
108 regulator-name = "VDD_IOPERI_1.8V";
109 regulator-min-microvolt = <1800000>;
110 regulator-max-microvolt = <1800000>;
111 regulator-always-on;
112 op_mode = <1>;
113 };
114
115 ldo5_reg: LDO5 {
116 regulator-name = "VDD_EXT_1.8V";
117 regulator-min-microvolt = <1800000>;
118 regulator-max-microvolt = <1800000>;
119 regulator-always-on;
120 regulator-boot-on;
121 op_mode = <1>;
122 };
123
124 ldo6_reg: LDO6 {
125 regulator-name = "VDD_MPLL_1.1V";
126 regulator-min-microvolt = <1100000>;
127 regulator-max-microvolt = <1100000>;
128 regulator-always-on;
129 regulator-boot-on;
130 op_mode = <1>;
131 };
132
133 ldo7_reg: LDO7 {
134 regulator-name = "VDD_XPLL_1.1V";
135 regulator-min-microvolt = <1100000>;
136 regulator-max-microvolt = <1100000>;
137 regulator-always-on;
138 regulator-boot-on;
139 op_mode = <1>;
140 };
141
142 ldo8_reg: LDO8 {
143 regulator-name = "VDD_COMMON2_1.0V";
144 regulator-min-microvolt = <1000000>;
145 regulator-max-microvolt = <1000000>;
146 regulator-always-on;
147 regulator-boot-on;
148 op_mode = <1>;
149 };
150
151 ldo9_reg: LDO9 {
152 regulator-name = "VDD_33ON_3.0V";
153 regulator-min-microvolt = <3000000>;
154 regulator-max-microvolt = <3000000>;
155 op_mode = <1>;
156 };
157
158 ldo10_reg: LDO10 {
159 regulator-name = "VDD_COMMON3_1.8V";
160 regulator-min-microvolt = <1800000>;
161 regulator-max-microvolt = <1800000>;
162 regulator-always-on;
163 regulator-boot-on;
164 op_mode = <1>;
165 };
166
167 ldo11_reg: LDO11 {
168 regulator-name = "VDD_ABB2_1.8V";
169 regulator-min-microvolt = <1800000>;
170 regulator-max-microvolt = <1800000>;
171 regulator-always-on;
172 regulator-boot-on;
173 op_mode = <1>;
174 };
175
176 ldo12_reg: LDO12 {
177 regulator-name = "VDD_USB_3.0V";
178 regulator-min-microvolt = <3000000>;
179 regulator-max-microvolt = <3000000>;
180 regulator-always-on;
181 regulator-boot-on;
182 op_mode = <1>;
183 };
184
185 ldo13_reg: LDO13 {
186 regulator-name = "VDDQ_C2C_W_1.8V";
187 regulator-min-microvolt = <1800000>;
188 regulator-max-microvolt = <1800000>;
189 regulator-always-on;
190 regulator-boot-on;
191 op_mode = <1>;
192 };
193
194 ldo14_reg: LDO14 {
195 regulator-name = "VDD18_ABB0_3_1.8V";
196 regulator-min-microvolt = <1800000>;
197 regulator-max-microvolt = <1800000>;
198 regulator-always-on;
199 regulator-boot-on;
200 op_mode = <1>;
201 };
202
203 ldo15_reg: LDO15 {
204 regulator-name = "VDD10_COMMON4_1.0V";
205 regulator-min-microvolt = <1000000>;
206 regulator-max-microvolt = <1000000>;
207 regulator-always-on;
208 regulator-boot-on;
209 op_mode = <1>;
210 };
211
212 ldo16_reg: LDO16 {
213 regulator-name = "VDD18_HSIC_1.8V";
214 regulator-min-microvolt = <1800000>;
215 regulator-max-microvolt = <1800000>;
216 regulator-always-on;
217 regulator-boot-on;
218 op_mode = <1>;
219 };
220
221 ldo17_reg: LDO17 {
222 regulator-name = "VDDQ_MMC2_3_2.8V";
223 regulator-min-microvolt = <2800000>;
224 regulator-max-microvolt = <2800000>;
225 regulator-always-on;
226 regulator-boot-on;
227 op_mode = <1>;
228 };
229
230 ldo18_reg: LDO18 {
231 regulator-name = "VDD_33ON_2.8V";
232 regulator-min-microvolt = <2800000>;
233 regulator-max-microvolt = <2800000>;
234 op_mode = <1>;
235 };
236
237 ldo22_reg: LDO22 {
238 regulator-name = "EXT_33_OFF";
239 regulator-min-microvolt = <3300000>;
240 regulator-max-microvolt = <3300000>;
241 op_mode = <1>;
242 };
243
244 ldo23_reg: LDO23 {
245 regulator-name = "EXT_28_OFF";
246 regulator-min-microvolt = <2800000>;
247 regulator-max-microvolt = <2800000>;
248 op_mode = <1>;
249 };
250
251 ldo25_reg: LDO25 {
252 regulator-name = "PVDD_LDO25";
253 regulator-min-microvolt = <1200000>;
254 regulator-max-microvolt = <1200000>;
255 op_mode = <1>;
256 };
257
258 ldo26_reg: LDO26 {
259 regulator-name = "EXT_18_OFF";
260 regulator-min-microvolt = <1800000>;
261 regulator-max-microvolt = <1800000>;
262 op_mode = <1>;
263 };
264
265 buck1_reg: BUCK1 {
266 regulator-name = "vdd_mif";
267 regulator-min-microvolt = <950000>;
268 regulator-max-microvolt = <1200000>;
269 regulator-always-on;
270 regulator-boot-on;
271 op_mode = <1>;
272 };
273
274 buck2_reg: BUCK2 {
275 regulator-name = "vdd_arm";
276 regulator-min-microvolt = <912500>;
277 regulator-max-microvolt = <1300000>;
278 regulator-always-on;
279 regulator-boot-on;
280 op_mode = <1>;
281 };
282
283 buck3_reg: BUCK3 {
284 regulator-name = "vdd_int";
285 regulator-min-microvolt = <900000>;
286 regulator-max-microvolt = <1200000>;
287 regulator-always-on;
288 regulator-boot-on;
289 op_mode = <1>;
290 };
291
292 buck4_reg: BUCK4 {
293 regulator-name = "vdd_g3d";
294 regulator-min-microvolt = <1000000>;
295 regulator-max-microvolt = <1000000>;
296 regulator-always-on;
297 regulator-boot-on;
298 op_mode = <1>;
299 };
300
301 buck5_reg: BUCK5 {
302 regulator-name = "VDD_MEM_1.35V";
303 regulator-min-microvolt = <750000>;
304 regulator-max-microvolt = <1355000>;
305 regulator-always-on;
306 regulator-boot-on;
307 op_mode = <1>;
308 };
309
310 buck7_reg: BUCK7 {
311 regulator-name = "PVDD_BUCK7";
312 regulator-always-on;
313 op_mode = <1>;
314 };
315
316 buck8_reg: BUCK8 {
317 regulator-name = "PVDD_BUCK8";
318 regulator-always-on;
319 op_mode = <1>;
320 };
321
322 buck9_reg: BUCK9 {
323 regulator-name = "VDD_33_OFF_EXT1";
324 regulator-min-microvolt = <750000>;
325 regulator-max-microvolt = <3000000>;
326 op_mode = <1>;
327 };
328 };
329 };
330 };
331
332 i2c@12C80000 {
333 status = "okay";
334
335 samsung,i2c-sda-delay = <100>;
336 samsung,i2c-max-bus-freq = <66000>;
337 samsung,i2c-slave-addr = <0x50>;
338
339 hdmiddc@50 {
340 compatible = "samsung,exynos4210-hdmiddc";
341 reg = <0x50>;
342 };
343 };
344
345 i2c@12C90000 {
346 status = "okay";
347
348 wm1811a@1a {
349
350 compatible = "wlf,wm1811";
351 reg = <0x1a>;
352
353 AVDD2-supply = <&main_dc_reg>;
354 CPVDD-supply = <&main_dc_reg>;
355 DBVDD1-supply = <&main_dc_reg>;
356 DBVDD2-supply = <&main_dc_reg>;
357 DBVDD3-supply = <&main_dc_reg>;
358 LDO1VDD-supply = <&main_dc_reg>;
359 SPKVDD1-supply = <&main_dc_reg>;
360 SPKVDD2-supply = <&main_dc_reg>;
361
362 wlf,ldo1ena = <&gpb0 0 0>;
363 wlf,ldo2ena = <&gpb0 1 0>;
364 };
365 };
366
367 i2c@12CE0000 {
368 status = "okay";
369
370 samsung,i2c-sda-delay = <100>;
371 samsung,i2c-max-bus-freq = <66000>;
372 samsung,i2c-slave-addr = <0x38>;
373
374 hdmiphy@38 {
375 compatible = "samsung,exynos4212-hdmiphy";
376 reg = <0x38>;
377 };
378 };
379
380 i2c@121D0000 {
381 status = "okay";
382 samsung,i2c-sda-delay = <100>;
383 samsung,i2c-max-bus-freq = <40000>;
384 samsung,i2c-slave-addr = <0x38>;
385
386 sata_phy_i2c:sata-phy@38 {
387 compatible = "samsung,exynos-sataphy-i2c";
388 reg = <0x38>;
389 };
390 };
391
392 sata@122F0000 {
393 status = "okay";
394 };
395
396 sata-phy@12170000 {
397 status = "okay";
398 samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
399 };
400
401 mmc_0: mmc@12200000 {
402 status = "okay";
403 num-slots = <1>;
404 broken-cd;
405 card-detect-delay = <200>;
406 samsung,dw-mshc-ciu-div = <3>;
407 samsung,dw-mshc-sdr-timing = <2 3>;
408 samsung,dw-mshc-ddr-timing = <1 2>;
409 vmmc-supply = <&mmc_reg>;
410 pinctrl-names = "default";
411 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
412 bus-width = <8>;
413 cap-mmc-highspeed;
414 };
415
416 mmc_2: mmc@12220000 {
417 status = "okay";
418 num-slots = <1>;
419 card-detect-delay = <200>;
420 samsung,dw-mshc-ciu-div = <3>;
421 samsung,dw-mshc-sdr-timing = <2 3>;
422 samsung,dw-mshc-ddr-timing = <1 2>;
423 vmmc-supply = <&mmc_reg>;
424 pinctrl-names = "default";
425 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
426 bus-width = <4>;
427 disable-wp;
428 cap-sd-highspeed;
429 };
430
431 i2s0: i2s@03830000 {
432 status = "okay";
433 };
434
435 gpio_keys { 30 gpio_keys {
436 compatible = "gpio-keys"; 31 compatible = "gpio-keys";
437 32
438 menu { 33 menu {
439 label = "SW-TACT2"; 34 label = "SW-TACT2";
440 gpios = <&gpx1 4 1>; 35 gpios = <&gpx1 4 GPIO_ACTIVE_LOW>;
441 linux,code = <KEY_MENU>; 36 linux,code = <KEY_MENU>;
442 gpio-key,wakeup; 37 gpio-key,wakeup;
443 }; 38 };
444 39
445 home { 40 home {
446 label = "SW-TACT3"; 41 label = "SW-TACT3";
447 gpios = <&gpx1 5 1>; 42 gpios = <&gpx1 5 GPIO_ACTIVE_LOW>;
448 linux,code = <KEY_HOME>; 43 linux,code = <KEY_HOME>;
449 gpio-key,wakeup; 44 gpio-key,wakeup;
450 }; 45 };
451 46
452 up { 47 up {
453 label = "SW-TACT4"; 48 label = "SW-TACT4";
454 gpios = <&gpx1 6 1>; 49 gpios = <&gpx1 6 GPIO_ACTIVE_LOW>;
455 linux,code = <KEY_UP>; 50 linux,code = <KEY_UP>;
456 gpio-key,wakeup; 51 gpio-key,wakeup;
457 }; 52 };
458 53
459 down { 54 down {
460 label = "SW-TACT5"; 55 label = "SW-TACT5";
461 gpios = <&gpx1 7 1>; 56 gpios = <&gpx1 7 GPIO_ACTIVE_LOW>;
462 linux,code = <KEY_DOWN>; 57 linux,code = <KEY_DOWN>;
463 gpio-key,wakeup; 58 gpio-key,wakeup;
464 }; 59 };
465 60
466 back { 61 back {
467 label = "SW-TACT6"; 62 label = "SW-TACT6";
468 gpios = <&gpx2 0 1>; 63 gpios = <&gpx2 0 GPIO_ACTIVE_LOW>;
469 linux,code = <KEY_BACK>; 64 linux,code = <KEY_BACK>;
470 gpio-key,wakeup; 65 gpio-key,wakeup;
471 }; 66 };
472 67
473 wakeup { 68 wakeup {
474 label = "SW-TACT7"; 69 label = "SW-TACT7";
475 gpios = <&gpx2 1 1>; 70 gpios = <&gpx2 1 GPIO_ACTIVE_LOW>;
476 linux,code = <KEY_WAKEUP>; 71 linux,code = <KEY_WAKEUP>;
477 gpio-key,wakeup; 72 gpio-key,wakeup;
478 }; 73 };
479 }; 74 };
480 75
481 hdmi {
482 hpd-gpio = <&gpx3 7 2>;
483 vdd_osc-supply = <&ldo10_reg>;
484 vdd_pll-supply = <&ldo8_reg>;
485 vdd-supply = <&ldo8_reg>;
486 };
487
488 regulators { 76 regulators {
489 compatible = "simple-bus"; 77 compatible = "simple-bus";
490 #address-cells = <1>; 78 #address-cells = <1>;
@@ -502,7 +90,7 @@
502 regulator-name = "VDD_33ON_2.8V"; 90 regulator-name = "VDD_33ON_2.8V";
503 regulator-min-microvolt = <2800000>; 91 regulator-min-microvolt = <2800000>;
504 regulator-max-microvolt = <2800000>; 92 regulator-max-microvolt = <2800000>;
505 gpio = <&gpx1 1 1>; 93 gpio = <&gpx1 1 GPIO_ACTIVE_LOW>;
506 enable-active-high; 94 enable-active-high;
507 }; 95 };
508 96
@@ -520,46 +108,455 @@
520 }; 108 };
521 }; 109 };
522 110
523 dp-controller@145B0000 { 111 // SMSC USB3503 connected in hardware only mode as a PHY
524 samsung,color-space = <0>; 112 usb_hub: usb-hub {
525 samsung,dynamic-range = <0>; 113 compatible = "smsc,usb3503a";
526 samsung,ycbcr-coeff = <0>; 114
527 samsung,color-depth = <1>; 115 reset-gpios = <&gpx3 5 GPIO_ACTIVE_LOW>;
528 samsung,link-rate = <0x0a>; 116 connect-gpios = <&gpd1 7 GPIO_ACTIVE_LOW>;
529 samsung,lane-count = <4>;
530 status = "okay";
531 }; 117 };
118};
532 119
533 fimd: fimd@14400000 { 120&dp {
534 status = "okay"; 121 status = "okay";
535 display-timings { 122 samsung,color-space = <0>;
536 native-mode = <&timing0>; 123 samsung,dynamic-range = <0>;
537 timing0: timing@0 { 124 samsung,ycbcr-coeff = <0>;
538 /* 2560x1600 DP panel */ 125 samsung,color-depth = <1>;
539 clock-frequency = <50000>; 126 samsung,link-rate = <0x0a>;
540 hactive = <2560>; 127 samsung,lane-count = <4>;
541 vactive = <1600>; 128};
542 hfront-porch = <48>; 129
543 hback-porch = <80>; 130&fimd {
544 hsync-len = <32>; 131 status = "okay";
545 vback-porch = <16>; 132
546 vfront-porch = <8>; 133 display-timings {
547 vsync-len = <6>; 134 native-mode = <&timing0>;
548 }; 135
136 timing0: timing@0 {
137 /* 2560x1600 DP panel */
138 clock-frequency = <50000>;
139 hactive = <2560>;
140 vactive = <1600>;
141 hfront-porch = <48>;
142 hback-porch = <80>;
143 hsync-len = <32>;
144 vback-porch = <16>;
145 vfront-porch = <8>;
146 vsync-len = <6>;
549 }; 147 };
550 }; 148 };
149};
551 150
552 usb_hub_bus { 151&hdmi {
553 compatible = "simple-bus"; 152 hpd-gpio = <&gpx3 7 GPIO_ACTIVE_LOW>;
554 #address-cells = <1>; 153 vdd_osc-supply = <&ldo10_reg>;
555 #size-cells = <0>; 154 vdd_pll-supply = <&ldo8_reg>;
155 vdd-supply = <&ldo8_reg>;
156};
157
158&i2c_0 {
159 status = "okay";
160 samsung,i2c-sda-delay = <100>;
161 samsung,i2c-max-bus-freq = <20000>;
162 samsung,i2c-slave-addr = <0x66>;
163
164 s5m8767_pmic@66 {
165 compatible = "samsung,s5m8767-pmic";
166 reg = <0x66>;
167 interrupt-parent = <&gpx3>;
168 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
169
170 vinb1-supply = <&main_dc_reg>;
171 vinb2-supply = <&main_dc_reg>;
172 vinb3-supply = <&main_dc_reg>;
173 vinb4-supply = <&main_dc_reg>;
174 vinb5-supply = <&main_dc_reg>;
175 vinb6-supply = <&main_dc_reg>;
176 vinb7-supply = <&main_dc_reg>;
177 vinb8-supply = <&main_dc_reg>;
178 vinb9-supply = <&main_dc_reg>;
179
180 vinl1-supply = <&buck7_reg>;
181 vinl2-supply = <&buck7_reg>;
182 vinl3-supply = <&buck7_reg>;
183 vinl4-supply = <&main_dc_reg>;
184 vinl5-supply = <&main_dc_reg>;
185 vinl6-supply = <&main_dc_reg>;
186 vinl7-supply = <&main_dc_reg>;
187 vinl8-supply = <&buck8_reg>;
188 vinl9-supply = <&buck8_reg>;
189
190 s5m8767,pmic-buck2-dvs-voltage = <1300000>;
191 s5m8767,pmic-buck3-dvs-voltage = <1100000>;
192 s5m8767,pmic-buck4-dvs-voltage = <1200000>;
193 s5m8767,pmic-buck-dvs-gpios = <&gpd1 0 GPIO_ACTIVE_HIGH>,
194 <&gpd1 1 GPIO_ACTIVE_HIGH>,
195 <&gpd1 2 GPIO_ACTIVE_HIGH>;
196 s5m8767,pmic-buck-ds-gpios = <&gpx2 3 GPIO_ACTIVE_HIGH>,
197 <&gpx2 4 GPIO_ACTIVE_HIGH>,
198 <&gpx2 5 GPIO_ACTIVE_HIGH>;
199
200 regulators {
201 ldo1_reg: LDO1 {
202 regulator-name = "VDD_ALIVE_1.0V";
203 regulator-min-microvolt = <1100000>;
204 regulator-max-microvolt = <1100000>;
205 regulator-always-on;
206 regulator-boot-on;
207 op_mode = <1>;
208 };
556 209
557 // SMSC USB3503 connected in hardware only mode as a PHY 210 ldo2_reg: LDO2 {
558 usb_hub: usb_hub { 211 regulator-name = "VDD_28IO_DP_1.35V";
559 compatible = "smsc,usb3503a"; 212 regulator-min-microvolt = <1200000>;
213 regulator-max-microvolt = <1200000>;
214 regulator-always-on;
215 regulator-boot-on;
216 op_mode = <1>;
217 };
218
219 ldo3_reg: LDO3 {
220 regulator-name = "VDD_COMMON1_1.8V";
221 regulator-min-microvolt = <1800000>;
222 regulator-max-microvolt = <1800000>;
223 regulator-always-on;
224 regulator-boot-on;
225 op_mode = <1>;
226 };
227
228 ldo4_reg: LDO4 {
229 regulator-name = "VDD_IOPERI_1.8V";
230 regulator-min-microvolt = <1800000>;
231 regulator-max-microvolt = <1800000>;
232 regulator-always-on;
233 op_mode = <1>;
234 };
235
236 ldo5_reg: LDO5 {
237 regulator-name = "VDD_EXT_1.8V";
238 regulator-min-microvolt = <1800000>;
239 regulator-max-microvolt = <1800000>;
240 regulator-always-on;
241 regulator-boot-on;
242 op_mode = <1>;
243 };
244
245 ldo6_reg: LDO6 {
246 regulator-name = "VDD_MPLL_1.1V";
247 regulator-min-microvolt = <1100000>;
248 regulator-max-microvolt = <1100000>;
249 regulator-always-on;
250 regulator-boot-on;
251 op_mode = <1>;
252 };
560 253
561 reset-gpios = <&gpx3 5 1>; 254 ldo7_reg: LDO7 {
562 connect-gpios = <&gpd1 7 1>; 255 regulator-name = "VDD_XPLL_1.1V";
256 regulator-min-microvolt = <1100000>;
257 regulator-max-microvolt = <1100000>;
258 regulator-always-on;
259 regulator-boot-on;
260 op_mode = <1>;
261 };
262
263 ldo8_reg: LDO8 {
264 regulator-name = "VDD_COMMON2_1.0V";
265 regulator-min-microvolt = <1000000>;
266 regulator-max-microvolt = <1000000>;
267 regulator-always-on;
268 regulator-boot-on;
269 op_mode = <1>;
270 };
271
272 ldo9_reg: LDO9 {
273 regulator-name = "VDD_33ON_3.0V";
274 regulator-min-microvolt = <3000000>;
275 regulator-max-microvolt = <3000000>;
276 op_mode = <1>;
277 };
278
279 ldo10_reg: LDO10 {
280 regulator-name = "VDD_COMMON3_1.8V";
281 regulator-min-microvolt = <1800000>;
282 regulator-max-microvolt = <1800000>;
283 regulator-always-on;
284 regulator-boot-on;
285 op_mode = <1>;
286 };
287
288 ldo11_reg: LDO11 {
289 regulator-name = "VDD_ABB2_1.8V";
290 regulator-min-microvolt = <1800000>;
291 regulator-max-microvolt = <1800000>;
292 regulator-always-on;
293 regulator-boot-on;
294 op_mode = <1>;
295 };
296
297 ldo12_reg: LDO12 {
298 regulator-name = "VDD_USB_3.0V";
299 regulator-min-microvolt = <3000000>;
300 regulator-max-microvolt = <3000000>;
301 regulator-always-on;
302 regulator-boot-on;
303 op_mode = <1>;
304 };
305
306 ldo13_reg: LDO13 {
307 regulator-name = "VDDQ_C2C_W_1.8V";
308 regulator-min-microvolt = <1800000>;
309 regulator-max-microvolt = <1800000>;
310 regulator-always-on;
311 regulator-boot-on;
312 op_mode = <1>;
313 };
314
315 ldo14_reg: LDO14 {
316 regulator-name = "VDD18_ABB0_3_1.8V";
317 regulator-min-microvolt = <1800000>;
318 regulator-max-microvolt = <1800000>;
319 regulator-always-on;
320 regulator-boot-on;
321 op_mode = <1>;
322 };
323
324 ldo15_reg: LDO15 {
325 regulator-name = "VDD10_COMMON4_1.0V";
326 regulator-min-microvolt = <1000000>;
327 regulator-max-microvolt = <1000000>;
328 regulator-always-on;
329 regulator-boot-on;
330 op_mode = <1>;
331 };
332
333 ldo16_reg: LDO16 {
334 regulator-name = "VDD18_HSIC_1.8V";
335 regulator-min-microvolt = <1800000>;
336 regulator-max-microvolt = <1800000>;
337 regulator-always-on;
338 regulator-boot-on;
339 op_mode = <1>;
340 };
341
342 ldo17_reg: LDO17 {
343 regulator-name = "VDDQ_MMC2_3_2.8V";
344 regulator-min-microvolt = <2800000>;
345 regulator-max-microvolt = <2800000>;
346 regulator-always-on;
347 regulator-boot-on;
348 op_mode = <1>;
349 };
350
351 ldo18_reg: LDO18 {
352 regulator-name = "VDD_33ON_2.8V";
353 regulator-min-microvolt = <2800000>;
354 regulator-max-microvolt = <2800000>;
355 op_mode = <1>;
356 };
357
358 ldo22_reg: LDO22 {
359 regulator-name = "EXT_33_OFF";
360 regulator-min-microvolt = <3300000>;
361 regulator-max-microvolt = <3300000>;
362 op_mode = <1>;
363 };
364
365 ldo23_reg: LDO23 {
366 regulator-name = "EXT_28_OFF";
367 regulator-min-microvolt = <2800000>;
368 regulator-max-microvolt = <2800000>;
369 op_mode = <1>;
370 };
371
372 ldo25_reg: LDO25 {
373 regulator-name = "PVDD_LDO25";
374 regulator-min-microvolt = <1200000>;
375 regulator-max-microvolt = <1200000>;
376 op_mode = <1>;
377 };
378
379 ldo26_reg: LDO26 {
380 regulator-name = "EXT_18_OFF";
381 regulator-min-microvolt = <1800000>;
382 regulator-max-microvolt = <1800000>;
383 op_mode = <1>;
384 };
385
386 buck1_reg: BUCK1 {
387 regulator-name = "vdd_mif";
388 regulator-min-microvolt = <950000>;
389 regulator-max-microvolt = <1200000>;
390 regulator-always-on;
391 regulator-boot-on;
392 op_mode = <1>;
393 };
394
395 buck2_reg: BUCK2 {
396 regulator-name = "vdd_arm";
397 regulator-min-microvolt = <912500>;
398 regulator-max-microvolt = <1300000>;
399 regulator-always-on;
400 regulator-boot-on;
401 op_mode = <1>;
402 };
403
404 buck3_reg: BUCK3 {
405 regulator-name = "vdd_int";
406 regulator-min-microvolt = <900000>;
407 regulator-max-microvolt = <1200000>;
408 regulator-always-on;
409 regulator-boot-on;
410 op_mode = <1>;
411 };
412
413 buck4_reg: BUCK4 {
414 regulator-name = "vdd_g3d";
415 regulator-min-microvolt = <1000000>;
416 regulator-max-microvolt = <1000000>;
417 regulator-always-on;
418 regulator-boot-on;
419 op_mode = <1>;
420 };
421
422 buck5_reg: BUCK5 {
423 regulator-name = "VDD_MEM_1.35V";
424 regulator-min-microvolt = <750000>;
425 regulator-max-microvolt = <1355000>;
426 regulator-always-on;
427 regulator-boot-on;
428 op_mode = <1>;
429 };
430
431 buck7_reg: BUCK7 {
432 regulator-name = "PVDD_BUCK7";
433 regulator-always-on;
434 op_mode = <1>;
435 };
436
437 buck8_reg: BUCK8 {
438 regulator-name = "PVDD_BUCK8";
439 regulator-always-on;
440 op_mode = <1>;
441 };
442
443 buck9_reg: BUCK9 {
444 regulator-name = "VDD_33_OFF_EXT1";
445 regulator-min-microvolt = <750000>;
446 regulator-max-microvolt = <3000000>;
447 op_mode = <1>;
448 };
563 }; 449 };
564 }; 450 };
565}; 451};
452
453&i2c_2 {
454 status = "okay";
455
456 samsung,i2c-sda-delay = <100>;
457 samsung,i2c-max-bus-freq = <66000>;
458 samsung,i2c-slave-addr = <0x50>;
459
460 hdmiddc@50 {
461 compatible = "samsung,exynos4210-hdmiddc";
462 reg = <0x50>;
463 };
464};
465
466&i2c_3 {
467 status = "okay";
468
469 wm1811a@1a {
470 compatible = "wlf,wm1811";
471 reg = <0x1a>;
472
473 AVDD2-supply = <&main_dc_reg>;
474 CPVDD-supply = <&main_dc_reg>;
475 DBVDD1-supply = <&main_dc_reg>;
476 DBVDD2-supply = <&main_dc_reg>;
477 DBVDD3-supply = <&main_dc_reg>;
478 LDO1VDD-supply = <&main_dc_reg>;
479 SPKVDD1-supply = <&main_dc_reg>;
480 SPKVDD2-supply = <&main_dc_reg>;
481
482 wlf,ldo1ena = <&gpb0 0 GPIO_ACTIVE_HIGH>;
483 wlf,ldo2ena = <&gpb0 1 GPIO_ACTIVE_HIGH>;
484 };
485};
486
487&i2c_8 {
488 status = "okay";
489
490 samsung,i2c-sda-delay = <100>;
491 samsung,i2c-max-bus-freq = <66000>;
492 samsung,i2c-slave-addr = <0x38>;
493
494 hdmiphy@38 {
495 compatible = "samsung,exynos4212-hdmiphy";
496 reg = <0x38>;
497 };
498};
499
500&i2c_9 {
501 status = "okay";
502 samsung,i2c-sda-delay = <100>;
503 samsung,i2c-max-bus-freq = <40000>;
504 samsung,i2c-slave-addr = <0x38>;
505
506 sata_phy_i2c:sata-phy@38 {
507 compatible = "samsung,exynos-sataphy-i2c";
508 reg = <0x38>;
509 };
510};
511
512&i2s0 {
513 status = "okay";
514};
515
516&mfc {
517 samsung,mfc-r = <0x43000000 0x800000>;
518 samsung,mfc-l = <0x51000000 0x800000>;
519};
520
521&mmc_0 {
522 status = "okay";
523 num-slots = <1>;
524 broken-cd;
525 card-detect-delay = <200>;
526 samsung,dw-mshc-ciu-div = <3>;
527 samsung,dw-mshc-sdr-timing = <2 3>;
528 samsung,dw-mshc-ddr-timing = <1 2>;
529 vmmc-supply = <&mmc_reg>;
530 pinctrl-names = "default";
531 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
532 bus-width = <8>;
533 cap-mmc-highspeed;
534};
535
536&mmc_2 {
537 status = "okay";
538 num-slots = <1>;
539 card-detect-delay = <200>;
540 samsung,dw-mshc-ciu-div = <3>;
541 samsung,dw-mshc-sdr-timing = <2 3>;
542 samsung,dw-mshc-ddr-timing = <1 2>;
543 vmmc-supply = <&mmc_reg>;
544 pinctrl-names = "default";
545 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
546 bus-width = <4>;
547 disable-wp;
548 cap-sd-highspeed;
549};
550
551&rtc {
552 status = "okay";
553};
554
555&sata {
556 status = "okay";
557};
558
559&sata_phy {
560 status = "okay";
561 samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
562};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 6a0f4c0ff763..bc27cc2558fe 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -7,9 +7,11 @@
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10*/ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/interrupt-controller/irq.h>
13#include "exynos5250.dtsi" 15#include "exynos5250.dtsi"
14 16
15/ { 17/ {
@@ -27,165 +29,6 @@
27 bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc"; 29 bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc";
28 }; 30 };
29 31
30 rtc@101E0000 {
31 status = "okay";
32 };
33
34 i2c@12C60000 {
35 samsung,i2c-sda-delay = <100>;
36 samsung,i2c-max-bus-freq = <20000>;
37 status = "okay";
38
39 eeprom@50 {
40 compatible = "samsung,s524ad0xd1";
41 reg = <0x50>;
42 };
43
44 max77686@09 {
45 compatible = "maxim,max77686";
46 reg = <0x09>;
47 interrupt-parent = <&gpx3>;
48 interrupts = <2 0>;
49
50 voltage-regulators {
51 ldo1_reg: LDO1 {
52 regulator-name = "P1.0V_LDO_OUT1";
53 regulator-min-microvolt = <1000000>;
54 regulator-max-microvolt = <1000000>;
55 regulator-always-on;
56 };
57
58 ldo2_reg: LDO2 {
59 regulator-name = "P1.2V_LDO_OUT2";
60 regulator-min-microvolt = <1200000>;
61 regulator-max-microvolt = <1200000>;
62 regulator-always-on;
63 };
64
65 ldo3_reg: LDO3 {
66 regulator-name = "P1.8V_LDO_OUT3";
67 regulator-min-microvolt = <1800000>;
68 regulator-max-microvolt = <1800000>;
69 regulator-always-on;
70 };
71
72 ldo4_reg: LDO4 {
73 regulator-name = "P2.8V_LDO_OUT4";
74 regulator-min-microvolt = <2800000>;
75 regulator-max-microvolt = <2800000>;
76 };
77
78 ldo5_reg: LDO5 {
79 regulator-name = "P1.8V_LDO_OUT5";
80 regulator-min-microvolt = <1800000>;
81 regulator-max-microvolt = <1800000>;
82 };
83
84 ldo6_reg: LDO6 {
85 regulator-name = "P1.1V_LDO_OUT6";
86 regulator-min-microvolt = <1100000>;
87 regulator-max-microvolt = <1100000>;
88 regulator-always-on;
89 };
90
91 ldo7_reg: LDO7 {
92 regulator-name = "P1.1V_LDO_OUT7";
93 regulator-min-microvolt = <1100000>;
94 regulator-max-microvolt = <1100000>;
95 regulator-always-on;
96 };
97
98 ldo8_reg: LDO8 {
99 regulator-name = "P1.0V_LDO_OUT8";
100 regulator-min-microvolt = <1000000>;
101 regulator-max-microvolt = <1000000>;
102 };
103
104 ldo10_reg: LDO10 {
105 regulator-name = "P1.8V_LDO_OUT10";
106 regulator-min-microvolt = <1800000>;
107 regulator-max-microvolt = <1800000>;
108 };
109
110 ldo11_reg: LDO11 {
111 regulator-name = "P1.8V_LDO_OUT11";
112 regulator-min-microvolt = <1800000>;
113 regulator-max-microvolt = <1800000>;
114 };
115
116 ldo12_reg: LDO12 {
117 regulator-name = "P3.0V_LDO_OUT12";
118 regulator-min-microvolt = <3000000>;
119 regulator-max-microvolt = <3000000>;
120 };
121
122 ldo13_reg: LDO13 {
123 regulator-name = "P1.8V_LDO_OUT13";
124 regulator-min-microvolt = <1800000>;
125 regulator-max-microvolt = <1800000>;
126 };
127
128 ldo14_reg: LDO14 {
129 regulator-name = "P1.8V_LDO_OUT14";
130 regulator-min-microvolt = <1800000>;
131 regulator-max-microvolt = <1800000>;
132 };
133
134 ldo15_reg: LDO15 {
135 regulator-name = "P1.0V_LDO_OUT15";
136 regulator-min-microvolt = <1000000>;
137 regulator-max-microvolt = <1000000>;
138 };
139
140 ldo16_reg: LDO16 {
141 regulator-name = "P1.8V_LDO_OUT16";
142 regulator-min-microvolt = <1800000>;
143 regulator-max-microvolt = <1800000>;
144 };
145
146 buck1_reg: BUCK1 {
147 regulator-name = "vdd_mif";
148 regulator-min-microvolt = <950000>;
149 regulator-max-microvolt = <1300000>;
150 regulator-always-on;
151 regulator-boot-on;
152 };
153
154 buck2_reg: BUCK2 {
155 regulator-name = "vdd_arm";
156 regulator-min-microvolt = <850000>;
157 regulator-max-microvolt = <1350000>;
158 regulator-always-on;
159 regulator-boot-on;
160 };
161
162 buck3_reg: BUCK3 {
163 regulator-name = "vdd_int";
164 regulator-min-microvolt = <900000>;
165 regulator-max-microvolt = <1200000>;
166 regulator-always-on;
167 regulator-boot-on;
168 };
169
170 buck4_reg: BUCK4 {
171 regulator-name = "vdd_g3d";
172 regulator-min-microvolt = <850000>;
173 regulator-max-microvolt = <1300000>;
174 regulator-always-on;
175 regulator-boot-on;
176 };
177
178 buck5_reg: BUCK5 {
179 regulator-name = "P1.8V_BUCK_OUT5";
180 regulator-min-microvolt = <1800000>;
181 regulator-max-microvolt = <1800000>;
182 regulator-always-on;
183 regulator-boot-on;
184 };
185 };
186 };
187 };
188
189 vdd: fixed-regulator@0 { 32 vdd: fixed-regulator@0 {
190 compatible = "regulator-fixed"; 33 compatible = "regulator-fixed";
191 regulator-name = "vdd-supply"; 34 regulator-name = "vdd-supply";
@@ -210,199 +53,360 @@
210 regulator-always-on; 53 regulator-always-on;
211 }; 54 };
212 55
213 i2c@12C70000 { 56 sound {
214 samsung,i2c-sda-delay = <100>; 57 compatible = "samsung,smdk-wm8994";
215 samsung,i2c-max-bus-freq = <20000>;
216 status = "okay";
217 58
218 eeprom@51 { 59 samsung,i2s-controller = <&i2s0>;
219 compatible = "samsung,s524ad0xd1"; 60 samsung,audio-codec = <&wm8994>;
220 reg = <0x51>; 61 };
62
63 fixed-rate-clocks {
64 xxti {
65 compatible = "samsung,clock-xxti";
66 clock-frequency = <24000000>;
221 }; 67 };
222 68
223 wm8994: wm8994@1a { 69 codec_mclk: codec-mclk {
224 compatible = "wlf,wm8994"; 70 compatible = "fixed-clock";
225 reg = <0x1a>; 71 #clock-cells = <0>;
72 clock-frequency = <16934000>;
73 };
74 };
75};
226 76
227 gpio-controller; 77&dp {
228 #gpio-cells = <2>; 78 samsung,color-space = <0>;
79 samsung,dynamic-range = <0>;
80 samsung,ycbcr-coeff = <0>;
81 samsung,color-depth = <1>;
82 samsung,link-rate = <0x0a>;
83 samsung,lane-count = <4>;
84
85 pinctrl-names = "default";
86 pinctrl-0 = <&dp_hpd>;
87 status = "okay";
88};
229 89
230 clocks = <&codec_mclk>; 90&ehci {
231 clock-names = "MCLK1"; 91 samsung,vbus-gpio = <&gpx2 6 GPIO_ACTIVE_HIGH>;
92};
232 93
233 AVDD2-supply = <&vdd>; 94&fimd {
234 CPVDD-supply = <&vdd>; 95 status = "okay";
235 DBVDD-supply = <&dbvdd>; 96
236 SPKVDD1-supply = <&spkvdd>; 97 display-timings {
237 SPKVDD2-supply = <&spkvdd>; 98 native-mode = <&timing0>;
99
100 timing0: timing@0 {
101 /* 1280x800 */
102 clock-frequency = <50000>;
103 hactive = <1280>;
104 vactive = <800>;
105 hfront-porch = <4>;
106 hback-porch = <4>;
107 hsync-len = <4>;
108 vback-porch = <4>;
109 vfront-porch = <4>;
110 vsync-len = <4>;
238 }; 111 };
239 }; 112 };
113};
240 114
241 i2c@121D0000 { 115&hdmi {
242 samsung,i2c-sda-delay = <100>; 116 hpd-gpio = <&gpx3 7 GPIO_ACTIVE_HIGH>;
243 samsung,i2c-max-bus-freq = <40000>; 117};
244 samsung,i2c-slave-addr = <0x38>;
245 status = "okay";
246 118
247 sata_phy_i2c:sata-phy@38 { 119&i2c_0 {
248 compatible = "samsung,exynos-sataphy-i2c"; 120 status = "okay";
249 reg = <0x38>; 121 samsung,i2c-sda-delay = <100>;
250 }; 122 samsung,i2c-max-bus-freq = <20000>;
123
124 eeprom@50 {
125 compatible = "samsung,s524ad0xd1";
126 reg = <0x50>;
251 }; 127 };
252 128
253 i2c@12C80000 { 129 max77686@09 {
254 samsung,i2c-sda-delay = <100>; 130 compatible = "maxim,max77686";
255 samsung,i2c-max-bus-freq = <66000>; 131 reg = <0x09>;
256 status = "okay"; 132 interrupt-parent = <&gpx3>;
133 interrupts = <2 IRQ_TYPE_NONE>;
134
135 voltage-regulators {
136 ldo1_reg: LDO1 {
137 regulator-name = "P1.0V_LDO_OUT1";
138 regulator-min-microvolt = <1000000>;
139 regulator-max-microvolt = <1000000>;
140 regulator-always-on;
141 };
257 142
258 hdmiddc@50 { 143 ldo2_reg: LDO2 {
259 compatible = "samsung,exynos4210-hdmiddc"; 144 regulator-name = "P1.2V_LDO_OUT2";
260 reg = <0x50>; 145 regulator-min-microvolt = <1200000>;
261 }; 146 regulator-max-microvolt = <1200000>;
262 }; 147 regulator-always-on;
148 };
263 149
264 i2c@12CE0000 { 150 ldo3_reg: LDO3 {
265 samsung,i2c-sda-delay = <100>; 151 regulator-name = "P1.8V_LDO_OUT3";
266 samsung,i2c-max-bus-freq = <66000>; 152 regulator-min-microvolt = <1800000>;
267 status = "okay"; 153 regulator-max-microvolt = <1800000>;
154 regulator-always-on;
155 };
268 156
269 hdmiphy@38 { 157 ldo4_reg: LDO4 {
270 compatible = "samsung,exynos4212-hdmiphy"; 158 regulator-name = "P2.8V_LDO_OUT4";
271 reg = <0x38>; 159 regulator-min-microvolt = <2800000>;
272 }; 160 regulator-max-microvolt = <2800000>;
273 }; 161 };
274 162
275 sata@122F0000 { 163 ldo5_reg: LDO5 {
276 status = "okay"; 164 regulator-name = "P1.8V_LDO_OUT5";
277 }; 165 regulator-min-microvolt = <1800000>;
166 regulator-max-microvolt = <1800000>;
167 };
278 168
279 sata-phy@12170000 { 169 ldo6_reg: LDO6 {
280 status = "okay"; 170 regulator-name = "P1.1V_LDO_OUT6";
281 samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>; 171 regulator-min-microvolt = <1100000>;
282 }; 172 regulator-max-microvolt = <1100000>;
173 regulator-always-on;
174 };
283 175
284 mmc@12200000 { 176 ldo7_reg: LDO7 {
285 status = "okay"; 177 regulator-name = "P1.1V_LDO_OUT7";
286 num-slots = <1>; 178 regulator-min-microvolt = <1100000>;
287 broken-cd; 179 regulator-max-microvolt = <1100000>;
288 card-detect-delay = <200>; 180 regulator-always-on;
289 samsung,dw-mshc-ciu-div = <3>; 181 };
290 samsung,dw-mshc-sdr-timing = <2 3>;
291 samsung,dw-mshc-ddr-timing = <1 2>;
292 pinctrl-names = "default";
293 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
294 bus-width = <8>;
295 cap-mmc-highspeed;
296 };
297 182
298 mmc@12220000 { 183 ldo8_reg: LDO8 {
299 status = "okay"; 184 regulator-name = "P1.0V_LDO_OUT8";
300 num-slots = <1>; 185 regulator-min-microvolt = <1000000>;
301 card-detect-delay = <200>; 186 regulator-max-microvolt = <1000000>;
302 samsung,dw-mshc-ciu-div = <3>; 187 };
303 samsung,dw-mshc-sdr-timing = <2 3>; 188
304 samsung,dw-mshc-ddr-timing = <1 2>; 189 ldo10_reg: LDO10 {
305 pinctrl-names = "default"; 190 regulator-name = "P1.8V_LDO_OUT10";
306 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 191 regulator-min-microvolt = <1800000>;
307 bus-width = <4>; 192 regulator-max-microvolt = <1800000>;
308 disable-wp; 193 };
309 cap-sd-highspeed;
310 };
311 194
312 spi_1: spi@12d30000 { 195 ldo11_reg: LDO11 {
313 cs-gpios = <&gpa2 5 0>; 196 regulator-name = "P1.8V_LDO_OUT11";
314 status = "okay"; 197 regulator-min-microvolt = <1800000>;
198 regulator-max-microvolt = <1800000>;
199 };
315 200
316 w25q80bw@0 { 201 ldo12_reg: LDO12 {
317 #address-cells = <1>; 202 regulator-name = "P3.0V_LDO_OUT12";
318 #size-cells = <1>; 203 regulator-min-microvolt = <3000000>;
319 compatible = "w25x80"; 204 regulator-max-microvolt = <3000000>;
320 reg = <0>; 205 };
321 spi-max-frequency = <1000000>;
322 206
323 controller-data { 207 ldo13_reg: LDO13 {
324 samsung,spi-feedback-delay = <0>; 208 regulator-name = "P1.8V_LDO_OUT13";
209 regulator-min-microvolt = <1800000>;
210 regulator-max-microvolt = <1800000>;
325 }; 211 };
326 212
327 partition@0 { 213 ldo14_reg: LDO14 {
328 label = "U-Boot"; 214 regulator-name = "P1.8V_LDO_OUT14";
329 reg = <0x0 0x40000>; 215 regulator-min-microvolt = <1800000>;
330 read-only; 216 regulator-max-microvolt = <1800000>;
331 }; 217 };
332 218
333 partition@40000 { 219 ldo15_reg: LDO15 {
334 label = "Kernel"; 220 regulator-name = "P1.0V_LDO_OUT15";
335 reg = <0x40000 0xc0000>; 221 regulator-min-microvolt = <1000000>;
222 regulator-max-microvolt = <1000000>;
223 };
224
225 ldo16_reg: LDO16 {
226 regulator-name = "P1.8V_LDO_OUT16";
227 regulator-min-microvolt = <1800000>;
228 regulator-max-microvolt = <1800000>;
229 };
230
231 buck1_reg: BUCK1 {
232 regulator-name = "vdd_mif";
233 regulator-min-microvolt = <950000>;
234 regulator-max-microvolt = <1300000>;
235 regulator-always-on;
236 regulator-boot-on;
237 };
238
239 buck2_reg: BUCK2 {
240 regulator-name = "vdd_arm";
241 regulator-min-microvolt = <850000>;
242 regulator-max-microvolt = <1350000>;
243 regulator-always-on;
244 regulator-boot-on;
245 };
246
247 buck3_reg: BUCK3 {
248 regulator-name = "vdd_int";
249 regulator-min-microvolt = <900000>;
250 regulator-max-microvolt = <1200000>;
251 regulator-always-on;
252 regulator-boot-on;
253 };
254
255 buck4_reg: BUCK4 {
256 regulator-name = "vdd_g3d";
257 regulator-min-microvolt = <850000>;
258 regulator-max-microvolt = <1300000>;
259 regulator-always-on;
260 regulator-boot-on;
261 };
262
263 buck5_reg: BUCK5 {
264 regulator-name = "P1.8V_BUCK_OUT5";
265 regulator-min-microvolt = <1800000>;
266 regulator-max-microvolt = <1800000>;
267 regulator-always-on;
268 regulator-boot-on;
336 }; 269 };
337 }; 270 };
338 }; 271 };
272};
339 273
340 hdmi { 274&i2c_1 {
341 hpd-gpio = <&gpx3 7 0>; 275 status = "okay";
342 }; 276 samsung,i2c-sda-delay = <100>;
277 samsung,i2c-max-bus-freq = <20000>;
343 278
344 codec@11000000 { 279 eeprom@51 {
345 samsung,mfc-r = <0x43000000 0x800000>; 280 compatible = "samsung,s524ad0xd1";
346 samsung,mfc-l = <0x51000000 0x800000>; 281 reg = <0x51>;
347 }; 282 };
348 283
349 i2s0: i2s@03830000 { 284 wm8994: wm8994@1a {
350 status = "okay"; 285 compatible = "wlf,wm8994";
286 reg = <0x1a>;
287
288 gpio-controller;
289 #gpio-cells = <2>;
290
291 clocks = <&codec_mclk>;
292 clock-names = "MCLK1";
293
294 AVDD2-supply = <&vdd>;
295 CPVDD-supply = <&vdd>;
296 DBVDD-supply = <&dbvdd>;
297 SPKVDD1-supply = <&spkvdd>;
298 SPKVDD2-supply = <&spkvdd>;
351 }; 299 };
300};
352 301
353 sound { 302&i2c_2 {
354 compatible = "samsung,smdk-wm8994"; 303 status = "okay";
304 samsung,i2c-sda-delay = <100>;
305 samsung,i2c-max-bus-freq = <66000>;
355 306
356 samsung,i2s-controller = <&i2s0>; 307 hdmiddc@50 {
357 samsung,audio-codec = <&wm8994>; 308 compatible = "samsung,exynos4210-hdmiddc";
309 reg = <0x50>;
358 }; 310 };
311};
312
313&i2c_8 {
314 status = "okay";
315 samsung,i2c-sda-delay = <100>;
316 samsung,i2c-max-bus-freq = <66000>;
359 317
360 usb@12110000 { 318 hdmiphy@38 {
361 samsung,vbus-gpio = <&gpx2 6 0>; 319 compatible = "samsung,exynos4212-hdmiphy";
320 reg = <0x38>;
362 }; 321 };
322};
323
324&i2c_9 {
325 status = "okay";
326 samsung,i2c-sda-delay = <100>;
327 samsung,i2c-max-bus-freq = <40000>;
328 samsung,i2c-slave-addr = <0x38>;
363 329
364 dp-controller@145B0000 { 330 sata_phy_i2c: sata-phy@38 {
365 samsung,color-space = <0>; 331 compatible = "samsung,exynos-sataphy-i2c";
366 samsung,dynamic-range = <0>; 332 reg = <0x38>;
367 samsung,ycbcr-coeff = <0>;
368 samsung,color-depth = <1>;
369 samsung,link-rate = <0x0a>;
370 samsung,lane-count = <4>;
371
372 pinctrl-names = "default";
373 pinctrl-0 = <&dp_hpd>;
374 status = "okay";
375 }; 333 };
334};
376 335
377 fimd@14400000 { 336&i2s0 {
378 status = "okay"; 337 status = "okay";
379 display-timings { 338};
380 native-mode = <&timing0>; 339
381 timing0: timing@0 { 340&mfc {
382 /* 1280x800 */ 341 samsung,mfc-r = <0x43000000 0x800000>;
383 clock-frequency = <50000>; 342 samsung,mfc-l = <0x51000000 0x800000>;
384 hactive = <1280>; 343};
385 vactive = <800>; 344
386 hfront-porch = <4>; 345&mmc_0 {
387 hback-porch = <4>; 346 status = "okay";
388 hsync-len = <4>; 347 num-slots = <1>;
389 vback-porch = <4>; 348 broken-cd;
390 vfront-porch = <4>; 349 card-detect-delay = <200>;
391 vsync-len = <4>; 350 samsung,dw-mshc-ciu-div = <3>;
392 }; 351 samsung,dw-mshc-sdr-timing = <2 3>;
352 samsung,dw-mshc-ddr-timing = <1 2>;
353 pinctrl-names = "default";
354 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
355 bus-width = <8>;
356 cap-mmc-highspeed;
357};
358
359&mmc_2 {
360 status = "okay";
361 num-slots = <1>;
362 card-detect-delay = <200>;
363 samsung,dw-mshc-ciu-div = <3>;
364 samsung,dw-mshc-sdr-timing = <2 3>;
365 samsung,dw-mshc-ddr-timing = <1 2>;
366 pinctrl-names = "default";
367 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
368 bus-width = <4>;
369 disable-wp;
370 cap-sd-highspeed;
371};
372
373&rtc {
374 status = "okay";
375};
376
377&sata {
378 status = "okay";
379};
380
381&sata_phy {
382 status = "okay";
383 samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
384};
385
386&spi_1 {
387 status = "okay";
388 cs-gpios = <&gpa2 5 GPIO_ACTIVE_HIGH>;
389
390 w25q80bw@0 {
391 #address-cells = <1>;
392 #size-cells = <1>;
393 compatible = "w25x80";
394 reg = <0>;
395 spi-max-frequency = <1000000>;
396
397 controller-data {
398 samsung,spi-feedback-delay = <0>;
393 }; 399 };
394 };
395 400
396 fixed-rate-clocks { 401 partition@0 {
397 xxti { 402 label = "U-Boot";
398 compatible = "samsung,clock-xxti"; 403 reg = <0x0 0x40000>;
399 clock-frequency = <24000000>; 404 read-only;
400 }; 405 };
401 406
402 codec_mclk: codec-mclk { 407 partition@40000 {
403 compatible = "fixed-clock"; 408 label = "Kernel";
404 #clock-cells = <0>; 409 reg = <0x40000 0xc0000>;
405 clock-frequency = <16934000>;
406 }; 410 };
407 }; 411 };
408}; 412};
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts
index 60429ad1c5d8..effaf2af41bc 100644
--- a/arch/arm/boot/dts/exynos5250-snow.dts
+++ b/arch/arm/boot/dts/exynos5250-snow.dts
@@ -6,10 +6,13 @@
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9*/ 9 */
10 10
11/dts-v1/; 11/dts-v1/;
12#include <dt-bindings/gpio/gpio.h> 12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/clock/maxim,max77686.h>
14#include <dt-bindings/interrupt-controller/irq.h>
15#include <dt-bindings/input/input.h>
13#include "exynos5250.dtsi" 16#include "exynos5250.dtsi"
14 17
15/ { 18/ {
@@ -25,76 +28,7 @@
25 }; 28 };
26 29
27 chosen { 30 chosen {
28 }; 31 bootargs = "console=tty1";
29
30 rtc@101E0000 {
31 status = "okay";
32 };
33
34 pinctrl@11400000 {
35 ec_irq: ec-irq {
36 samsung,pins = "gpx1-6";
37 samsung,pin-function = <0>;
38 samsung,pin-pud = <0>;
39 samsung,pin-drv = <0>;
40 };
41
42 sd3_clk: sd3-clk {
43 samsung,pin-drv = <0>;
44 };
45
46 sd3_cmd: sd3-cmd {
47 samsung,pin-pud = <3>;
48 samsung,pin-drv = <0>;
49 };
50
51 sd3_bus4: sd3-bus-width4 {
52 samsung,pin-drv = <0>;
53 };
54
55 max98095_en: max98095-en {
56 samsung,pins = "gpx1-7";
57 samsung,pin-function = <0>;
58 samsung,pin-pud = <3>;
59 samsung,pin-drv = <0>;
60 };
61
62 tps65090_irq: tps65090-irq {
63 samsung,pins = "gpx2-6";
64 samsung,pin-function = <0>;
65 samsung,pin-pud = <0>;
66 samsung,pin-drv = <0>;
67 };
68
69 usb3_vbus_en: usb3-vbus-en {
70 samsung,pins = "gpx2-7";
71 samsung,pin-function = <1>;
72 samsung,pin-pud = <0>;
73 samsung,pin-drv = <0>;
74 };
75
76 hdmi_hpd_irq: hdmi-hpd-irq {
77 samsung,pins = "gpx3-7";
78 samsung,pin-function = <0>;
79 samsung,pin-pud = <1>;
80 samsung,pin-drv = <0>;
81 };
82 };
83
84 pinctrl@13400000 {
85 arb_their_claim: arb-their-claim {
86 samsung,pins = "gpe0-4";
87 samsung,pin-function = <0>;
88 samsung,pin-pud = <3>;
89 samsung,pin-drv = <0>;
90 };
91
92 arb_our_claim: arb-our-claim {
93 samsung,pins = "gpf0-3";
94 samsung,pin-function = <1>;
95 samsung,pin-pud = <0>;
96 samsung,pin-drv = <0>;
97 };
98 }; 32 };
99 33
100 gpio-keys { 34 gpio-keys {
@@ -102,14 +36,14 @@
102 36
103 power { 37 power {
104 label = "Power"; 38 label = "Power";
105 gpios = <&gpx1 3 1>; 39 gpios = <&gpx1 3 GPIO_ACTIVE_LOW>;
106 linux,code = <116>; /* KEY_POWER */ 40 linux,code = <KEY_POWER>;
107 gpio-key,wakeup; 41 gpio-key,wakeup;
108 }; 42 };
109 43
110 lid-switch { 44 lid-switch {
111 label = "Lid"; 45 label = "Lid";
112 gpios = <&gpx3 5 1>; 46 gpios = <&gpx3 5 GPIO_ACTIVE_LOW>;
113 linux,input-type = <5>; /* EV_SW */ 47 linux,input-type = <5>; /* EV_SW */
114 linux,code = <0>; /* SW_LID */ 48 linux,code = <0>; /* SW_LID */
115 debounce-interval = <1>; 49 debounce-interval = <1>;
@@ -130,8 +64,8 @@
130 64
131 i2c-parent = <&{/i2c@12CA0000}>; 65 i2c-parent = <&{/i2c@12CA0000}>;
132 66
133 our-claim-gpio = <&gpf0 3 1>; 67 our-claim-gpio = <&gpf0 3 GPIO_ACTIVE_LOW>;
134 their-claim-gpios = <&gpe0 4 1>; 68 their-claim-gpios = <&gpe0 4 GPIO_ACTIVE_LOW>;
135 slew-delay-us = <10>; 69 slew-delay-us = <10>;
136 wait-retry-us = <3000>; 70 wait-retry-us = <3000>;
137 wait-free-us = <50000>; 71 wait-free-us = <50000>;
@@ -154,7 +88,7 @@
154 cros_ec: embedded-controller { 88 cros_ec: embedded-controller {
155 compatible = "google,cros-ec-i2c"; 89 compatible = "google,cros-ec-i2c";
156 reg = <0x1e>; 90 reg = <0x1e>;
157 interrupts = <6 0>; 91 interrupts = <6 IRQ_TYPE_NONE>;
158 interrupt-parent = <&gpx1>; 92 interrupt-parent = <&gpx1>;
159 pinctrl-names = "default"; 93 pinctrl-names = "default";
160 pinctrl-0 = <&ec_irq>; 94 pinctrl-0 = <&ec_irq>;
@@ -241,13 +175,6 @@
241 }; 175 };
242 176
243 i2c@12CD0000 { 177 i2c@12CD0000 {
244 max98095: codec@11 {
245 compatible = "maxim,max98095";
246 reg = <0x11>;
247 pinctrl-0 = <&max98095_en>;
248 pinctrl-names = "default";
249 };
250
251 ptn3460: lvds-bridge@20 { 178 ptn3460: lvds-bridge@20 {
252 compatible = "nxp,ptn3460"; 179 compatible = "nxp,ptn3460";
253 reg = <0x20>; 180 reg = <0x20>;
@@ -258,10 +185,6 @@
258 }; 185 };
259 }; 186 };
260 187
261 i2s0: i2s@03830000 {
262 status = "okay";
263 };
264
265 sound { 188 sound {
266 compatible = "google,snow-audio-max98095"; 189 compatible = "google,snow-audio-max98095";
267 190
@@ -275,20 +198,12 @@
275 regulator-name = "P5.0V_USB3CON"; 198 regulator-name = "P5.0V_USB3CON";
276 regulator-min-microvolt = <5000000>; 199 regulator-min-microvolt = <5000000>;
277 regulator-max-microvolt = <5000000>; 200 regulator-max-microvolt = <5000000>;
278 gpio = <&gpx2 7 0>; 201 gpio = <&gpx2 7 GPIO_ACTIVE_HIGH>;
279 pinctrl-names = "default"; 202 pinctrl-names = "default";
280 pinctrl-0 = <&usb3_vbus_en>; 203 pinctrl-0 = <&usb3_vbus_en>;
281 enable-active-high; 204 enable-active-high;
282 }; 205 };
283 206
284 phy@12100000 {
285 vbus-supply = <&usb3_vbus_reg>;
286 };
287
288 usb@12110000 {
289 samsung,vbus-gpio = <&gpx1 1 0>;
290 };
291
292 fixed-rate-clocks { 207 fixed-rate-clocks {
293 xxti { 208 xxti {
294 compatible = "samsung,clock-xxti"; 209 compatible = "samsung,clock-xxti";
@@ -296,18 +211,6 @@
296 }; 211 };
297 }; 212 };
298 213
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>;
305 hdmi-en-supply = <&tps65090_fet7>;
306 vdd-supply = <&ldo8_reg>;
307 vdd_osc-supply = <&ldo10_reg>;
308 vdd_pll-supply = <&ldo8_reg>;
309 };
310
311 backlight: backlight { 214 backlight: backlight {
312 compatible = "pwm-backlight"; 215 compatible = "pwm-backlight";
313 pwms = <&pwm 0 1000000 0>; 216 pwms = <&pwm 0 1000000 0>;
@@ -319,30 +222,46 @@
319 pinctrl-names = "default"; 222 pinctrl-names = "default";
320 }; 223 };
321 224
322 fimd@14400000 {
323 status = "okay";
324 samsung,invert-vclk;
325 };
326
327 panel: panel { 225 panel: panel {
328 compatible = "auo,b116xw03"; 226 compatible = "auo,b116xw03";
329 power-supply = <&fet6>; 227 power-supply = <&fet6>;
330 backlight = <&backlight>; 228 backlight = <&backlight>;
331 }; 229 };
230};
332 231
333 dp-controller@145B0000 { 232&dp {
334 status = "okay"; 233 status = "okay";
335 pinctrl-names = "default"; 234 pinctrl-names = "default";
336 pinctrl-0 = <&dp_hpd>; 235 pinctrl-0 = <&dp_hpd>;
337 samsung,color-space = <0>; 236 samsung,color-space = <0>;
338 samsung,dynamic-range = <0>; 237 samsung,dynamic-range = <0>;
339 samsung,ycbcr-coeff = <0>; 238 samsung,ycbcr-coeff = <0>;
340 samsung,color-depth = <1>; 239 samsung,color-depth = <1>;
341 samsung,link-rate = <0x0a>; 240 samsung,link-rate = <0x0a>;
342 samsung,lane-count = <2>; 241 samsung,lane-count = <2>;
343 samsung,hpd-gpio = <&gpx0 7 0>; 242 samsung,hpd-gpio = <&gpx0 7 GPIO_ACTIVE_HIGH>;
344 bridge = <&ptn3460>; 243 bridge = <&ptn3460>;
345 }; 244};
245
246&ehci {
247 samsung,vbus-gpio = <&gpx1 1 GPIO_ACTIVE_HIGH>;
248};
249
250&fimd {
251 status = "okay";
252 samsung,invert-vclk;
253};
254
255&hdmi {
256 hpd-gpio = <&gpx3 7 GPIO_ACTIVE_HIGH>;
257 pinctrl-names = "default";
258 pinctrl-0 = <&hdmi_hpd_irq>;
259 phy = <&hdmiphy>;
260 ddc = <&i2c_2>;
261 hdmi-en-supply = <&tps65090_fet7>;
262 vdd-supply = <&ldo8_reg>;
263 vdd_osc-supply = <&ldo10_reg>;
264 vdd_pll-supply = <&ldo8_reg>;
346}; 265};
347 266
348&i2c_0 { 267&i2c_0 {
@@ -350,10 +269,10 @@
350 samsung,i2c-sda-delay = <100>; 269 samsung,i2c-sda-delay = <100>;
351 samsung,i2c-max-bus-freq = <378000>; 270 samsung,i2c-max-bus-freq = <378000>;
352 271
353 max77686@09 { 272 max77686: max77686@09 {
354 compatible = "maxim,max77686"; 273 compatible = "maxim,max77686";
355 interrupt-parent = <&gpx3>; 274 interrupt-parent = <&gpx3>;
356 interrupts = <2 0>; 275 interrupts = <2 IRQ_TYPE_NONE>;
357 pinctrl-names = "default"; 276 pinctrl-names = "default";
358 pinctrl-0 = <&max77686_irq>; 277 pinctrl-0 = <&max77686_irq>;
359 wakeup-source; 278 wakeup-source;
@@ -503,7 +422,7 @@
503 trackpad { 422 trackpad {
504 reg = <0x67>; 423 reg = <0x67>;
505 compatible = "cypress,cyapa"; 424 compatible = "cypress,cyapa";
506 interrupts = <2 0>; 425 interrupts = <2 IRQ_TYPE_NONE>;
507 interrupt-parent = <&gpx1>; 426 interrupt-parent = <&gpx1>;
508 wakeup-source; 427 wakeup-source;
509 }; 428 };
@@ -550,6 +469,13 @@
550 status = "okay"; 469 status = "okay";
551 samsung,i2c-sda-delay = <100>; 470 samsung,i2c-sda-delay = <100>;
552 samsung,i2c-max-bus-freq = <66000>; 471 samsung,i2c-max-bus-freq = <66000>;
472
473 max98095: codec@11 {
474 compatible = "maxim,max98095";
475 reg = <0x11>;
476 pinctrl-0 = <&max98095_en>;
477 pinctrl-names = "default";
478 };
553}; 479};
554 480
555&i2c_8 { 481&i2c_8 {
@@ -563,6 +489,10 @@
563 }; 489 };
564}; 490};
565 491
492&i2s0 {
493 status = "okay";
494};
495
566&mmc_0 { 496&mmc_0 {
567 status = "okay"; 497 status = "okay";
568 num-slots = <1>; 498 num-slots = <1>;
@@ -587,7 +517,7 @@
587 pinctrl-names = "default"; 517 pinctrl-names = "default";
588 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 518 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
589 bus-width = <4>; 519 bus-width = <4>;
590 wp-gpios = <&gpc2 1 0>; 520 wp-gpios = <&gpc2 1 GPIO_ACTIVE_HIGH>;
591 cap-sd-highspeed; 521 cap-sd-highspeed;
592}; 522};
593 523
@@ -610,12 +540,82 @@
610}; 540};
611 541
612&pinctrl_0 { 542&pinctrl_0 {
543 ec_irq: ec-irq {
544 samsung,pins = "gpx1-6";
545 samsung,pin-function = <0>;
546 samsung,pin-pud = <0>;
547 samsung,pin-drv = <0>;
548 };
549
550 max98095_en: max98095-en {
551 samsung,pins = "gpx1-7";
552 samsung,pin-function = <0>;
553 samsung,pin-pud = <3>;
554 samsung,pin-drv = <0>;
555 };
556
557 tps65090_irq: tps65090-irq {
558 samsung,pins = "gpx2-6";
559 samsung,pin-function = <0>;
560 samsung,pin-pud = <0>;
561 samsung,pin-drv = <0>;
562 };
563
564 usb3_vbus_en: usb3-vbus-en {
565 samsung,pins = "gpx2-7";
566 samsung,pin-function = <1>;
567 samsung,pin-pud = <0>;
568 samsung,pin-drv = <0>;
569 };
570
613 max77686_irq: max77686-irq { 571 max77686_irq: max77686-irq {
614 samsung,pins = "gpx3-2"; 572 samsung,pins = "gpx3-2";
615 samsung,pin-function = <0>; 573 samsung,pin-function = <0>;
616 samsung,pin-pud = <0>; 574 samsung,pin-pud = <0>;
617 samsung,pin-drv = <0>; 575 samsung,pin-drv = <0>;
618 }; 576 };
577
578 hdmi_hpd_irq: hdmi-hpd-irq {
579 samsung,pins = "gpx3-7";
580 samsung,pin-function = <0>;
581 samsung,pin-pud = <1>;
582 samsung,pin-drv = <0>;
583 };
584};
585
586&pinctrl_1 {
587 arb_their_claim: arb-their-claim {
588 samsung,pins = "gpe0-4";
589 samsung,pin-function = <0>;
590 samsung,pin-pud = <3>;
591 samsung,pin-drv = <0>;
592 };
593
594 arb_our_claim: arb-our-claim {
595 samsung,pins = "gpf0-3";
596 samsung,pin-function = <1>;
597 samsung,pin-pud = <0>;
598 samsung,pin-drv = <0>;
599 };
600};
601
602&rtc {
603 status = "okay";
604 clocks = <&clock CLK_RTC>, <&max77686 MAX77686_CLK_AP>;
605 clock-names = "rtc", "rtc_src";
606};
607
608&sd3_bus4 {
609 samsung,pin-drv = <0>;
610};
611
612&sd3_clk {
613 samsung,pin-drv = <0>;
614};
615
616&sd3_cmd {
617 samsung,pin-pud = <3>;
618 samsung,pin-drv = <0>;
619}; 619};
620 620
621&spi_1 { 621&spi_1 {
@@ -628,4 +628,8 @@
628 dr_mode = "host"; 628 dr_mode = "host";
629}; 629};
630 630
631&usbdrd_phy {
632 vbus-supply = <&usb3_vbus_reg>;
633};
634
631#include "cros-ec-keyboard.dtsi" 635#include "cros-ec-keyboard.dtsi"
diff --git a/arch/arm/boot/dts/exynos5250-spring.dts b/arch/arm/boot/dts/exynos5250-spring.dts
new file mode 100644
index 000000000000..f02775487cd4
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5250-spring.dts
@@ -0,0 +1,566 @@
1/*
2 * Google Spring board device tree source
3 *
4 * Copyright (c) 2013 Google, Inc
5 * Copyright (c) 2014 SUSE LINUX Products GmbH
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12/dts-v1/;
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/interrupt-controller/irq.h>
15#include <dt-bindings/input/input.h>
16#include "exynos5250.dtsi"
17
18/ {
19 model = "Google Spring";
20 compatible = "google,spring", "samsung,exynos5250", "samsung,exynos5";
21
22 memory {
23 reg = <0x40000000 0x80000000>;
24 };
25
26 chosen {
27 bootargs = "console=tty1";
28 };
29
30 gpio-keys {
31 compatible = "gpio-keys";
32 pinctrl-names = "default";
33 pinctrl-0 = <&power_key_irq>, <&lid_irq>;
34
35 power {
36 label = "Power";
37 gpios = <&gpx1 3 GPIO_ACTIVE_LOW>;
38 linux,code = <KEY_POWER>;
39 gpio-key,wakeup;
40 };
41
42 lid-switch {
43 label = "Lid";
44 gpios = <&gpx3 5 GPIO_ACTIVE_LOW>;
45 linux,input-type = <5>; /* EV_SW */
46 linux,code = <0>; /* SW_LID */
47 debounce-interval = <1>;
48 gpio-key,wakeup;
49 };
50 };
51
52 usb-hub {
53 compatible = "smsc,usb3503a";
54 reset-gpios = <&gpe1 0 GPIO_ACTIVE_LOW>;
55 pinctrl-names = "default";
56 pinctrl-0 = <&hsic_reset>;
57 };
58
59 fixed-rate-clocks {
60 xxti {
61 compatible = "samsung,clock-xxti";
62 clock-frequency = <24000000>;
63 };
64 };
65};
66
67&dp {
68 status = "okay";
69 pinctrl-names = "default";
70 pinctrl-0 = <&dp_hpd_gpio>;
71 samsung,color-space = <0>;
72 samsung,dynamic-range = <0>;
73 samsung,ycbcr-coeff = <0>;
74 samsung,color-depth = <1>;
75 samsung,link-rate = <0x0a>;
76 samsung,lane-count = <1>;
77 samsung,hpd-gpio = <&gpc3 0 GPIO_ACTIVE_HIGH>;
78};
79
80&ehci {
81 samsung,vbus-gpio = <&gpx1 1 GPIO_ACTIVE_HIGH>;
82};
83
84&fimd {
85 status = "okay";
86 samsung,invert-vclk;
87};
88
89&hdmi {
90 hpd-gpio = <&gpx3 7 GPIO_ACTIVE_HIGH>;
91 pinctrl-names = "default";
92 pinctrl-0 = <&hdmi_hpd_irq>;
93 phy = <&hdmiphy>;
94 ddc = <&i2c_2>;
95 hdmi-en-supply = <&ldo8_reg>;
96 vdd-supply = <&ldo8_reg>;
97 vdd_osc-supply = <&ldo10_reg>;
98 vdd_pll-supply = <&ldo8_reg>;
99};
100
101&i2c_0 {
102 status = "okay";
103 samsung,i2c-sda-delay = <100>;
104 samsung,i2c-max-bus-freq = <378000>;
105
106 s5m8767-pmic@66 {
107 compatible = "samsung,s5m8767-pmic";
108 reg = <0x66>;
109 interrupt-parent = <&gpx3>;
110 interrupts = <2 IRQ_TYPE_NONE>;
111 pinctrl-names = "default";
112 pinctrl-0 = <&s5m8767_irq &s5m8767_dvs &s5m8767_ds>;
113 wakeup-source;
114
115 s5m8767,pmic-buck-dvs-gpios = <&gpd1 0 GPIO_ACTIVE_LOW>, /* DVS1 */
116 <&gpd1 1 GPIO_ACTIVE_LOW>, /* DVS2 */
117 <&gpd1 2 GPIO_ACTIVE_LOW>; /* DVS3 */
118
119 s5m8767,pmic-buck-ds-gpios = <&gpx2 3 GPIO_ACTIVE_LOW>, /* SET1 */
120 <&gpx2 4 GPIO_ACTIVE_LOW>, /* SET2 */
121 <&gpx2 5 GPIO_ACTIVE_LOW>; /* SET3 */
122
123 /*
124 * The following arrays of DVS voltages are not used, since we are
125 * not using GPIOs to control PMIC bucks, but they must be defined
126 * to please the driver.
127 */
128 s5m8767,pmic-buck2-dvs-voltage = <1350000>, <1300000>,
129 <1250000>, <1200000>,
130 <1150000>, <1100000>,
131 <1000000>, <950000>;
132
133 s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>,
134 <1100000>, <1100000>,
135 <1000000>, <1000000>,
136 <1000000>, <1000000>;
137
138 s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>,
139 <1200000>, <1200000>,
140 <1200000>, <1200000>,
141 <1200000>, <1200000>;
142
143 clocks {
144 compatible = "samsung,s5m8767-clk";
145 #clock-cells = <1>;
146 clock-output-names = "en32khz_ap",
147 "en32khz_cp",
148 "en32khz_bt";
149 };
150
151 regulators {
152 ldo4_reg: LDO4 {
153 regulator-name = "P1.0V_LDO_OUT4";
154 regulator-min-microvolt = <1000000>;
155 regulator-max-microvolt = <1000000>;
156 regulator-always-on;
157 op_mode = <0>;
158 };
159
160 ldo5_reg: LDO5 {
161 regulator-name = "P1.0V_LDO_OUT5";
162 regulator-min-microvolt = <1000000>;
163 regulator-max-microvolt = <1000000>;
164 regulator-always-on;
165 op_mode = <0>;
166 };
167
168 ldo6_reg: LDO6 {
169 regulator-name = "vdd_mydp";
170 regulator-min-microvolt = <1000000>;
171 regulator-max-microvolt = <1000000>;
172 regulator-always-on;
173 op_mode = <3>;
174 };
175
176 ldo7_reg: LDO7 {
177 regulator-name = "P1.1V_LDO_OUT7";
178 regulator-min-microvolt = <1100000>;
179 regulator-max-microvolt = <1100000>;
180 regulator-always-on;
181 op_mode = <3>;
182 };
183
184 ldo8_reg: LDO8 {
185 regulator-name = "P1.0V_LDO_OUT8";
186 regulator-min-microvolt = <1000000>;
187 regulator-max-microvolt = <1000000>;
188 regulator-always-on;
189 op_mode = <3>;
190 };
191
192 ldo10_reg: LDO10 {
193 regulator-name = "P1.8V_LDO_OUT10";
194 regulator-min-microvolt = <1800000>;
195 regulator-max-microvolt = <1800000>;
196 regulator-always-on;
197 op_mode = <3>;
198 };
199
200 ldo11_reg: LDO11 {
201 regulator-name = "P1.8V_LDO_OUT11";
202 regulator-min-microvolt = <1800000>;
203 regulator-max-microvolt = <1800000>;
204 regulator-always-on;
205 op_mode = <0>;
206 };
207
208 ldo12_reg: LDO12 {
209 regulator-name = "P3.0V_LDO_OUT12";
210 regulator-min-microvolt = <3000000>;
211 regulator-max-microvolt = <3000000>;
212 regulator-always-on;
213 op_mode = <3>;
214 };
215
216 ldo13_reg: LDO13 {
217 regulator-name = "P1.8V_LDO_OUT13";
218 regulator-min-microvolt = <1800000>;
219 regulator-max-microvolt = <1800000>;
220 regulator-always-on;
221 op_mode = <0>;
222 };
223
224 ldo14_reg: LDO14 {
225 regulator-name = "P1.8V_LDO_OUT14";
226 regulator-min-microvolt = <1800000>;
227 regulator-max-microvolt = <1800000>;
228 regulator-always-on;
229 op_mode = <3>;
230 };
231
232 ldo15_reg: LDO15 {
233 regulator-name = "P1.0V_LDO_OUT15";
234 regulator-min-microvolt = <1000000>;
235 regulator-max-microvolt = <1000000>;
236 regulator-always-on;
237 op_mode = <3>;
238 };
239
240 ldo16_reg: LDO16 {
241 regulator-name = "P1.8V_LDO_OUT16";
242 regulator-min-microvolt = <1800000>;
243 regulator-max-microvolt = <1800000>;
244 regulator-always-on;
245 op_mode = <3>;
246 };
247
248 ldo17_reg: LDO17 {
249 regulator-name = "P2.8V_LDO_OUT17";
250 regulator-min-microvolt = <2800000>;
251 regulator-max-microvolt = <2800000>;
252 regulator-always-on;
253 op_mode = <0>;
254 };
255
256 ldo25_reg: LDO25 {
257 regulator-name = "vdd_bridge";
258 regulator-min-microvolt = <1200000>;
259 regulator-max-microvolt = <1200000>;
260 regulator-always-on;
261 op_mode = <1>;
262 };
263
264 buck1_reg: BUCK1 {
265 regulator-name = "vdd_mif";
266 regulator-min-microvolt = <950000>;
267 regulator-max-microvolt = <1300000>;
268 regulator-always-on;
269 regulator-boot-on;
270 op_mode = <3>;
271 };
272
273 buck2_reg: BUCK2 {
274 regulator-name = "vdd_arm";
275 regulator-min-microvolt = <850000>;
276 regulator-max-microvolt = <1350000>;
277 regulator-always-on;
278 regulator-boot-on;
279 op_mode = <3>;
280 };
281
282 buck3_reg: BUCK3 {
283 regulator-name = "vdd_int";
284 regulator-min-microvolt = <900000>;
285 regulator-max-microvolt = <1200000>;
286 regulator-always-on;
287 regulator-boot-on;
288 op_mode = <3>;
289 };
290
291 buck4_reg: BUCK4 {
292 regulator-name = "vdd_g3d";
293 regulator-min-microvolt = <850000>;
294 regulator-max-microvolt = <1300000>;
295 regulator-boot-on;
296 op_mode = <3>;
297 };
298
299 buck5_reg: BUCK5 {
300 regulator-name = "P1.8V_BUCK_OUT5";
301 regulator-min-microvolt = <1800000>;
302 regulator-max-microvolt = <1800000>;
303 regulator-always-on;
304 regulator-boot-on;
305 op_mode = <1>;
306 };
307
308 buck6_reg: BUCK6 {
309 regulator-name = "P1.2V_BUCK_OUT6";
310 regulator-min-microvolt = <1200000>;
311 regulator-max-microvolt = <1200000>;
312 regulator-always-on;
313 regulator-boot-on;
314 op_mode = <0>;
315 };
316
317 buck9_reg: BUCK9 {
318 regulator-name = "vdd_ummc";
319 regulator-min-microvolt = <950000>;
320 regulator-max-microvolt = <3000000>;
321 regulator-always-on;
322 regulator-boot-on;
323 op_mode = <3>;
324 };
325 };
326 };
327};
328
329&i2c_1 {
330 status = "okay";
331 samsung,i2c-sda-delay = <100>;
332 samsung,i2c-max-bus-freq = <378000>;
333
334 trackpad@4b {
335 compatible = "atmel,maxtouch";
336 reg = <0x4b>;
337 interrupt-parent = <&gpx1>;
338 interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
339 pinctrl-names = "default";
340 pinctrl-0 = <&trackpad_irq>;
341 linux,gpio-keymap = <KEY_RESERVED
342 KEY_RESERVED
343 KEY_RESERVED
344 KEY_RESERVED
345 KEY_RESERVED
346 BTN_LEFT>;
347 wakeup-source;
348 };
349};
350
351/*
352 * Disabled pullups since external part has its own pullups and
353 * double-pulling gets us out of spec in some cases.
354 */
355&i2c2_bus {
356 samsung,pin-pud = <0>;
357};
358
359&i2c_2 {
360 status = "okay";
361 samsung,i2c-sda-delay = <100>;
362 samsung,i2c-max-bus-freq = <66000>;
363
364 hdmiddc@50 {
365 compatible = "samsung,exynos4210-hdmiddc";
366 reg = <0x50>;
367 };
368};
369
370&i2c_3 {
371 status = "okay";
372 samsung,i2c-sda-delay = <100>;
373 samsung,i2c-max-bus-freq = <66000>;
374};
375
376&i2c_4 {
377 status = "okay";
378 samsung,i2c-sda-delay = <100>;
379 samsung,i2c-max-bus-freq = <66000>;
380
381 cros_ec: embedded-controller {
382 compatible = "google,cros-ec-i2c";
383 reg = <0x1e>;
384 interrupts = <6 IRQ_TYPE_NONE>;
385 interrupt-parent = <&gpx1>;
386 wakeup-source;
387 pinctrl-names = "default";
388 pinctrl-0 = <&ec_irq>;
389 };
390};
391
392&i2c_5 {
393 status = "okay";
394 samsung,i2c-sda-delay = <100>;
395 samsung,i2c-max-bus-freq = <66000>;
396};
397
398&i2c_7 {
399 status = "okay";
400 samsung,i2c-sda-delay = <100>;
401 samsung,i2c-max-bus-freq = <66000>;
402
403 temperature-sensor@4c {
404 compatible = "gmt,g781";
405 reg = <0x4c>;
406 };
407};
408
409&i2c_8 {
410 status = "okay";
411 samsung,i2c-sda-delay = <100>;
412 samsung,i2c-max-bus-freq = <378000>;
413
414 hdmiphy: hdmiphy@38 {
415 compatible = "samsung,exynos4212-hdmiphy";
416 reg = <0x38>;
417 };
418};
419
420&i2s0 {
421 status = "okay";
422};
423
424&mfc {
425 samsung,mfc-r = <0x43000000 0x800000>;
426 samsung,mfc-l = <0x51000000 0x800000>;
427};
428
429&mmc_0 {
430 status = "okay";
431 num-slots = <1>;
432 supports-highspeed;
433 broken-cd;
434 card-detect-delay = <200>;
435 samsung,dw-mshc-ciu-div = <3>;
436 samsung,dw-mshc-sdr-timing = <2 3>;
437 samsung,dw-mshc-ddr-timing = <1 2>;
438 pinctrl-names = "default";
439 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4 &sd0_bus8>;
440
441 slot@0 {
442 reg = <0>;
443 bus-width = <8>;
444 };
445};
446
447/*
448 * On Spring we've got SIP WiFi and so can keep drive strengths low to
449 * reduce EMI.
450 */
451&mmc_1 {
452 status = "okay";
453 num-slots = <1>;
454 supports-highspeed;
455 broken-cd;
456 card-detect-delay = <200>;
457 samsung,dw-mshc-ciu-div = <3>;
458 samsung,dw-mshc-sdr-timing = <2 3>;
459 samsung,dw-mshc-ddr-timing = <1 2>;
460 pinctrl-names = "default";
461 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_cd &sd1_bus4>;
462
463 slot@0 {
464 reg = <0>;
465 bus-width = <4>;
466 };
467};
468
469&pinctrl_0 {
470 s5m8767_dvs: s5m8767-dvs {
471 samsung,pins = "gpd1-0", "gpd1-1", "gpd1-2";
472 samsung,pin-function = <0>;
473 samsung,pin-pud = <1>;
474 samsung,pin-drv = <0>;
475 };
476
477 dp_hpd_gpio: dp-hpd-gpio {
478 samsung,pins = "gpc3-0";
479 samsung,pin-function = <0>;
480 samsung,pin-pud = <3>;
481 samsung,pin-drv = <0>;
482 };
483
484 trackpad_irq: trackpad-irq {
485 samsung,pins = "gpx1-2";
486 samsung,pin-function = <0xf>;
487 samsung,pin-pud = <0>;
488 samsung,pin-drv = <0>;
489 };
490
491 power_key_irq: power-key-irq {
492 samsung,pins = "gpx1-3";
493 samsung,pin-function = <0>;
494 samsung,pin-pud = <0>;
495 samsung,pin-drv = <0>;
496 };
497
498 ec_irq: ec-irq {
499 samsung,pins = "gpx1-6";
500 samsung,pin-function = <0>;
501 samsung,pin-pud = <0>;
502 samsung,pin-drv = <0>;
503 };
504
505 s5m8767_ds: s5m8767-ds {
506 samsung,pins = "gpx2-3", "gpx2-4", "gpx2-5";
507 samsung,pin-function = <0>;
508 samsung,pin-pud = <1>;
509 samsung,pin-drv = <0>;
510 };
511
512 s5m8767_irq: s5m8767-irq {
513 samsung,pins = "gpx3-2";
514 samsung,pin-function = <0>;
515 samsung,pin-pud = <0>;
516 samsung,pin-drv = <0>;
517 };
518
519 lid_irq: lid-irq {
520 samsung,pins = "gpx3-5";
521 samsung,pin-function = <0>;
522 samsung,pin-pud = <0>;
523 samsung,pin-drv = <0>;
524 };
525
526 hdmi_hpd_irq: hdmi-hpd-irq {
527 samsung,pins = "gpx3-7";
528 samsung,pin-function = <0>;
529 samsung,pin-pud = <1>;
530 samsung,pin-drv = <0>;
531 };
532};
533
534&pinctrl_1 {
535 hsic_reset: hsic-reset {
536 samsung,pins = "gpe1-0";
537 samsung,pin-function = <1>;
538 samsung,pin-pud = <0>;
539 samsung,pin-drv = <0>;
540 };
541};
542
543&sd1_bus4 {
544 samsung,pin-drv = <0>;
545};
546
547&sd1_cd {
548 samsung,pin-drv = <0>;
549};
550
551&sd1_clk {
552 samsung,pin-drv = <0>;
553};
554
555&sd1_cmd {
556 samsung,pin-pud = <3>;
557 samsung,pin-drv = <0>;
558};
559
560&spi_1 {
561 status = "okay";
562 samsung,spi-src-clk = <0>;
563 num-cs = <1>;
564};
565
566#include "cros-ec-keyboard.dtsi"
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index d55c1a2eb798..d45a07ea3402 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -218,7 +218,7 @@
218 clock-names = "fimg2d"; 218 clock-names = "fimg2d";
219 }; 219 };
220 220
221 codec@11000000 { 221 mfc: codec@11000000 {
222 compatible = "samsung,mfc-v6"; 222 compatible = "samsung,mfc-v6";
223 reg = <0x11000000 0x10000>; 223 reg = <0x11000000 0x10000>;
224 interrupts = <0 96 0>; 224 interrupts = <0 96 0>;
@@ -227,7 +227,7 @@
227 clock-names = "mfc"; 227 clock-names = "mfc";
228 }; 228 };
229 229
230 rtc@101E0000 { 230 rtc: rtc@101E0000 {
231 clocks = <&clock CLK_RTC>; 231 clocks = <&clock CLK_RTC>;
232 clock-names = "rtc"; 232 clock-names = "rtc";
233 status = "disabled"; 233 status = "disabled";
@@ -261,7 +261,7 @@
261 clock-names = "uart", "clk_uart_baud0"; 261 clock-names = "uart", "clk_uart_baud0";
262 }; 262 };
263 263
264 sata@122F0000 { 264 sata: sata@122F0000 {
265 compatible = "snps,dwc-ahci"; 265 compatible = "snps,dwc-ahci";
266 samsung,sata-freq = <66>; 266 samsung,sata-freq = <66>;
267 reg = <0x122F0000 0x1ff>; 267 reg = <0x122F0000 0x1ff>;
@@ -293,6 +293,7 @@
293 clock-names = "i2c"; 293 clock-names = "i2c";
294 pinctrl-names = "default"; 294 pinctrl-names = "default";
295 pinctrl-0 = <&i2c0_bus>; 295 pinctrl-0 = <&i2c0_bus>;
296 samsung,sysreg-phandle = <&sysreg_system_controller>;
296 status = "disabled"; 297 status = "disabled";
297 }; 298 };
298 299
@@ -306,6 +307,7 @@
306 clock-names = "i2c"; 307 clock-names = "i2c";
307 pinctrl-names = "default"; 308 pinctrl-names = "default";
308 pinctrl-0 = <&i2c1_bus>; 309 pinctrl-0 = <&i2c1_bus>;
310 samsung,sysreg-phandle = <&sysreg_system_controller>;
309 status = "disabled"; 311 status = "disabled";
310 }; 312 };
311 313
@@ -319,6 +321,7 @@
319 clock-names = "i2c"; 321 clock-names = "i2c";
320 pinctrl-names = "default"; 322 pinctrl-names = "default";
321 pinctrl-0 = <&i2c2_bus>; 323 pinctrl-0 = <&i2c2_bus>;
324 samsung,sysreg-phandle = <&sysreg_system_controller>;
322 status = "disabled"; 325 status = "disabled";
323 }; 326 };
324 327
@@ -332,6 +335,7 @@
332 clock-names = "i2c"; 335 clock-names = "i2c";
333 pinctrl-names = "default"; 336 pinctrl-names = "default";
334 pinctrl-0 = <&i2c3_bus>; 337 pinctrl-0 = <&i2c3_bus>;
338 samsung,sysreg-phandle = <&sysreg_system_controller>;
335 status = "disabled"; 339 status = "disabled";
336 }; 340 };
337 341
@@ -573,7 +577,7 @@
573 #phy-cells = <1>; 577 #phy-cells = <1>;
574 }; 578 };
575 579
576 usb@12110000 { 580 ehci: usb@12110000 {
577 compatible = "samsung,exynos4210-ehci"; 581 compatible = "samsung,exynos4210-ehci";
578 reg = <0x12110000 0x100>; 582 reg = <0x12110000 0x100>;
579 interrupts = <0 71 0>; 583 interrupts = <0 71 0>;
@@ -588,7 +592,7 @@
588 }; 592 };
589 }; 593 };
590 594
591 usb@12120000 { 595 ohci: usb@12120000 {
592 compatible = "samsung,exynos4210-ohci"; 596 compatible = "samsung,exynos4210-ohci";
593 reg = <0x12120000 0x100>; 597 reg = <0x12120000 0x100>;
594 interrupts = <0 71 0>; 598 interrupts = <0 71 0>;
@@ -710,7 +714,7 @@
710 clock-names = "gscl"; 714 clock-names = "gscl";
711 }; 715 };
712 716
713 hdmi { 717 hdmi: hdmi {
714 compatible = "samsung,exynos4212-hdmi"; 718 compatible = "samsung,exynos4212-hdmi";
715 reg = <0x14530000 0x70000>; 719 reg = <0x14530000 0x70000>;
716 interrupts = <0 95 0>; 720 interrupts = <0 95 0>;
@@ -736,14 +740,14 @@
736 #phy-cells = <0>; 740 #phy-cells = <0>;
737 }; 741 };
738 742
739 dp-controller@145B0000 { 743 dp: dp-controller@145B0000 {
740 clocks = <&clock CLK_DP>; 744 clocks = <&clock CLK_DP>;
741 clock-names = "dp"; 745 clock-names = "dp";
742 phys = <&dp_phy>; 746 phys = <&dp_phy>;
743 phy-names = "dp"; 747 phy-names = "dp";
744 }; 748 };
745 749
746 fimd@14400000 { 750 fimd: fimd@14400000 {
747 clocks = <&clock CLK_SCLK_FIMD1>, <&clock CLK_FIMD1>; 751 clocks = <&clock CLK_SCLK_FIMD1>, <&clock CLK_FIMD1>;
748 clock-names = "sclk_fimd", "fimd"; 752 clock-names = "sclk_fimd", "fimd";
749 }; 753 };
diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
index 82cdb74484cc..9a050e19a4dc 100644
--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
+++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
@@ -12,6 +12,7 @@
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 <dt-bindings/interrupt-controller/irq.h>
15#include <dt-bindings/clock/maxim,max77802.h>
15#include "exynos5420.dtsi" 16#include "exynos5420.dtsi"
16 17
17/ { 18/ {
@@ -151,7 +152,7 @@
151 status = "okay"; 152 status = "okay";
152 clock-frequency = <400000>; 153 clock-frequency = <400000>;
153 154
154 max77802-pmic@9 { 155 max77802: max77802-pmic@9 {
155 compatible = "maxim,max77802"; 156 compatible = "maxim,max77802";
156 interrupt-parent = <&gpx3>; 157 interrupt-parent = <&gpx3>;
157 interrupts = <1 IRQ_TYPE_NONE>; 158 interrupts = <1 IRQ_TYPE_NONE>;
@@ -560,7 +561,7 @@
560 status = "okay"; 561 status = "okay";
561 num-slots = <1>; 562 num-slots = <1>;
562 broken-cd; 563 broken-cd;
563 caps2-mmc-hs200-1_8v; 564 mmc-hs200-1_8v;
564 cap-mmc-highspeed; 565 cap-mmc-highspeed;
565 non-removable; 566 non-removable;
566 card-detect-delay = <200>; 567 card-detect-delay = <200>;
@@ -727,6 +728,8 @@
727 728
728&rtc { 729&rtc {
729 status = "okay"; 730 status = "okay";
731 clocks = <&clock CLK_RTC>, <&max77802 MAX77802_CLK_32K_AP>;
732 clock-names = "rtc", "rtc_src";
730}; 733};
731 734
732&spi_2 { 735&spi_2 {
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index 8617a031cbc0..90bf4011e319 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -560,6 +560,7 @@
560 clock-names = "i2c"; 560 clock-names = "i2c";
561 pinctrl-names = "default"; 561 pinctrl-names = "default";
562 pinctrl-0 = <&i2c0_bus>; 562 pinctrl-0 = <&i2c0_bus>;
563 samsung,sysreg-phandle = <&sysreg_system_controller>;
563 status = "disabled"; 564 status = "disabled";
564 }; 565 };
565 566
@@ -573,6 +574,7 @@
573 clock-names = "i2c"; 574 clock-names = "i2c";
574 pinctrl-names = "default"; 575 pinctrl-names = "default";
575 pinctrl-0 = <&i2c1_bus>; 576 pinctrl-0 = <&i2c1_bus>;
577 samsung,sysreg-phandle = <&sysreg_system_controller>;
576 status = "disabled"; 578 status = "disabled";
577 }; 579 };
578 580
@@ -586,6 +588,7 @@
586 clock-names = "i2c"; 588 clock-names = "i2c";
587 pinctrl-names = "default"; 589 pinctrl-names = "default";
588 pinctrl-0 = <&i2c2_bus>; 590 pinctrl-0 = <&i2c2_bus>;
591 samsung,sysreg-phandle = <&sysreg_system_controller>;
589 status = "disabled"; 592 status = "disabled";
590 }; 593 };
591 594
@@ -599,6 +602,7 @@
599 clock-names = "i2c"; 602 clock-names = "i2c";
600 pinctrl-names = "default"; 603 pinctrl-names = "default";
601 pinctrl-0 = <&i2c3_bus>; 604 pinctrl-0 = <&i2c3_bus>;
605 samsung,sysreg-phandle = <&sysreg_system_controller>;
602 status = "disabled"; 606 status = "disabled";
603 }; 607 };
604 608
diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
index 7bb1c8dd42dd..e8fdda827fc9 100644
--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
@@ -12,6 +12,7 @@
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 <dt-bindings/interrupt-controller/irq.h>
15#include <dt-bindings/clock/maxim,max77802.h>
15#include "exynos5800.dtsi" 16#include "exynos5800.dtsi"
16 17
17/ { 18/ {
@@ -150,7 +151,7 @@
150 status = "okay"; 151 status = "okay";
151 clock-frequency = <400000>; 152 clock-frequency = <400000>;
152 153
153 max77802-pmic@9 { 154 max77802: max77802-pmic@9 {
154 compatible = "maxim,max77802"; 155 compatible = "maxim,max77802";
155 interrupt-parent = <&gpx3>; 156 interrupt-parent = <&gpx3>;
156 interrupts = <1 IRQ_TYPE_NONE>; 157 interrupts = <1 IRQ_TYPE_NONE>;
@@ -548,7 +549,7 @@
548 status = "okay"; 549 status = "okay";
549 num-slots = <1>; 550 num-slots = <1>;
550 broken-cd; 551 broken-cd;
551 caps2-mmc-hs200-1_8v; 552 mmc-hs200-1_8v;
552 cap-mmc-highspeed; 553 cap-mmc-highspeed;
553 non-removable; 554 non-removable;
554 card-detect-delay = <200>; 555 card-detect-delay = <200>;
@@ -715,6 +716,8 @@
715 716
716&rtc { 717&rtc {
717 status = "okay"; 718 status = "okay";
719 clocks = <&clock CLK_RTC>, <&max77802 MAX77802_CLK_32K_AP>;
720 clock-names = "rtc", "rtc_src";
718}; 721};
719 722
720&spi_2 { 723&spi_2 {
diff --git a/arch/arm/boot/dts/hisi-x5hd2-dkb.dts b/arch/arm/boot/dts/hisi-x5hd2-dkb.dts
index 05b44c272c9a..721b09238f58 100644
--- a/arch/arm/boot/dts/hisi-x5hd2-dkb.dts
+++ b/arch/arm/boot/dts/hisi-x5hd2-dkb.dts
@@ -51,3 +51,36 @@
51&uart0 { 51&uart0 {
52 status = "okay"; 52 status = "okay";
53}; 53};
54
55&gmac0 {
56 #address-cells = <1>;
57 #size-cells = <0>;
58 phy-handle = <&phy2>;
59 phy-mode = "mii";
60 /* Placeholder, overwritten by bootloader */
61 mac-address = [00 00 00 00 00 00];
62 status = "okay";
63
64 phy2: ethernet-phy@2 {
65 reg = <2>;
66 };
67};
68
69&gmac1 {
70 #address-cells = <1>;
71 #size-cells = <0>;
72 phy-handle = <&phy1>;
73 phy-mode = "rgmii";
74 /* Placeholder, overwritten by bootloader */
75 mac-address = [00 00 00 00 00 00];
76 status = "okay";
77
78 phy1: ethernet-phy@1 {
79 reg = <1>;
80 };
81};
82
83&ahci {
84 phys = <&sata_phy>;
85 phy-names = "sata-phy";
86};
diff --git a/arch/arm/boot/dts/hisi-x5hd2.dtsi b/arch/arm/boot/dts/hisi-x5hd2.dtsi
index f85ba2924ff7..c52722b14e4a 100644
--- a/arch/arm/boot/dts/hisi-x5hd2.dtsi
+++ b/arch/arm/boot/dts/hisi-x5hd2.dtsi
@@ -131,6 +131,249 @@
131 clock-names = "apb_pclk"; 131 clock-names = "apb_pclk";
132 status = "disabled"; 132 status = "disabled";
133 }; 133 };
134
135 gpio0: gpio@b20000 {
136 compatible = "arm,pl061", "arm,primecell";
137 reg = <0xb20000 0x1000>;
138 interrupts = <0 108 0x4>;
139 gpio-controller;
140 #gpio-cells = <2>;
141 clocks = <&clock HIX5HD2_FIXED_100M>;
142 clock-names = "apb_pclk";
143 interrupt-controller;
144 #interrupt-cells = <2>;
145 status = "disabled";
146 };
147
148 gpio1: gpio@b21000 {
149 compatible = "arm,pl061", "arm,primecell";
150 reg = <0xb21000 0x1000>;
151 interrupts = <0 109 0x4>;
152 gpio-controller;
153 #gpio-cells = <2>;
154 clocks = <&clock HIX5HD2_FIXED_100M>;
155 clock-names = "apb_pclk";
156 interrupt-controller;
157 #interrupt-cells = <2>;
158 status = "disabled";
159 };
160
161 gpio2: gpio@b22000 {
162 compatible = "arm,pl061", "arm,primecell";
163 reg = <0xb22000 0x1000>;
164 interrupts = <0 110 0x4>;
165 gpio-controller;
166 #gpio-cells = <2>;
167 clocks = <&clock HIX5HD2_FIXED_100M>;
168 clock-names = "apb_pclk";
169 interrupt-controller;
170 #interrupt-cells = <2>;
171 status = "disabled";
172 };
173
174 gpio3: gpio@b23000 {
175 compatible = "arm,pl061", "arm,primecell";
176 reg = <0xb23000 0x1000>;
177 interrupts = <0 111 0x4>;
178 gpio-controller;
179 #gpio-cells = <2>;
180 clocks = <&clock HIX5HD2_FIXED_100M>;
181 clock-names = "apb_pclk";
182 interrupt-controller;
183 #interrupt-cells = <2>;
184 status = "disabled";
185 };
186
187 gpio4: gpio@b24000 {
188 compatible = "arm,pl061", "arm,primecell";
189 reg = <0xb24000 0x1000>;
190 interrupts = <0 112 0x4>;
191 gpio-controller;
192 #gpio-cells = <2>;
193 clocks = <&clock HIX5HD2_FIXED_100M>;
194 clock-names = "apb_pclk";
195 interrupt-controller;
196 #interrupt-cells = <2>;
197 status = "disabled";
198 };
199
200 gpio5: gpio@004000 {
201 compatible = "arm,pl061", "arm,primecell";
202 reg = <0x004000 0x1000>;
203 interrupts = <0 113 0x4>;
204 gpio-controller;
205 #gpio-cells = <2>;
206 clocks = <&clock HIX5HD2_FIXED_100M>;
207 clock-names = "apb_pclk";
208 interrupt-controller;
209 #interrupt-cells = <2>;
210 status = "disabled";
211 };
212
213 gpio6: gpio@b26000 {
214 compatible = "arm,pl061", "arm,primecell";
215 reg = <0xb26000 0x1000>;
216 interrupts = <0 114 0x4>;
217 gpio-controller;
218 #gpio-cells = <2>;
219 clocks = <&clock HIX5HD2_FIXED_100M>;
220 clock-names = "apb_pclk";
221 interrupt-controller;
222 #interrupt-cells = <2>;
223 status = "disabled";
224 };
225
226 gpio7: gpio@b27000 {
227 compatible = "arm,pl061", "arm,primecell";
228 reg = <0xb27000 0x1000>;
229 interrupts = <0 115 0x4>;
230 gpio-controller;
231 #gpio-cells = <2>;
232 clocks = <&clock HIX5HD2_FIXED_100M>;
233 clock-names = "apb_pclk";
234 interrupt-controller;
235 #interrupt-cells = <2>;
236 status = "disabled";
237 };
238
239 gpio8: gpio@b28000 {
240 compatible = "arm,pl061", "arm,primecell";
241 reg = <0xb28000 0x1000>;
242 interrupts = <0 116 0x4>;
243 gpio-controller;
244 #gpio-cells = <2>;
245 clocks = <&clock HIX5HD2_FIXED_100M>;
246 clock-names = "apb_pclk";
247 interrupt-controller;
248 #interrupt-cells = <2>;
249 status = "disabled";
250 };
251
252 gpio9: gpio@b29000 {
253 compatible = "arm,pl061", "arm,primecell";
254 reg = <0xb29000 0x1000>;
255 interrupts = <0 117 0x4>;
256 gpio-controller;
257 #gpio-cells = <2>;
258 clocks = <&clock HIX5HD2_FIXED_100M>;
259 clock-names = "apb_pclk";
260 interrupt-controller;
261 #interrupt-cells = <2>;
262 status = "disabled";
263 };
264
265 gpio10: gpio@b2a000 {
266 compatible = "arm,pl061", "arm,primecell";
267 reg = <0xb2a000 0x1000>;
268 interrupts = <0 118 0x4>;
269 gpio-controller;
270 #gpio-cells = <2>;
271 clocks = <&clock HIX5HD2_FIXED_100M>;
272 clock-names = "apb_pclk";
273 interrupt-controller;
274 #interrupt-cells = <2>;
275 status = "disabled";
276 };
277
278 gpio11: gpio@b2b000 {
279 compatible = "arm,pl061", "arm,primecell";
280 reg = <0xb2b000 0x1000>;
281 interrupts = <0 119 0x4>;
282 gpio-controller;
283 #gpio-cells = <2>;
284 clocks = <&clock HIX5HD2_FIXED_100M>;
285 clock-names = "apb_pclk";
286 interrupt-controller;
287 #interrupt-cells = <2>;
288 status = "disabled";
289 };
290
291 gpio12: gpio@b2c000 {
292 compatible = "arm,pl061", "arm,primecell";
293 reg = <0xb2c000 0x1000>;
294 interrupts = <0 120 0x4>;
295 gpio-controller;
296 #gpio-cells = <2>;
297 clocks = <&clock HIX5HD2_FIXED_100M>;
298 clock-names = "apb_pclk";
299 interrupt-controller;
300 #interrupt-cells = <2>;
301 status = "disabled";
302 };
303
304 gpio13: gpio@b2d000 {
305 compatible = "arm,pl061", "arm,primecell";
306 reg = <0xb2d000 0x1000>;
307 interrupts = <0 121 0x4>;
308 gpio-controller;
309 #gpio-cells = <2>;
310 clocks = <&clock HIX5HD2_FIXED_100M>;
311 clock-names = "apb_pclk";
312 interrupt-controller;
313 #interrupt-cells = <2>;
314 status = "disabled";
315 };
316
317 gpio14: gpio@b2e000 {
318 compatible = "arm,pl061", "arm,primecell";
319 reg = <0xb2e000 0x1000>;
320 interrupts = <0 122 0x4>;
321 gpio-controller;
322 #gpio-cells = <2>;
323 clocks = <&clock HIX5HD2_FIXED_100M>;
324 clock-names = "apb_pclk";
325 interrupt-controller;
326 #interrupt-cells = <2>;
327 status = "disabled";
328 };
329
330 gpio15: gpio@b2f000 {
331 compatible = "arm,pl061", "arm,primecell";
332 reg = <0xb2f000 0x1000>;
333 interrupts = <0 123 0x4>;
334 gpio-controller;
335 #gpio-cells = <2>;
336 clocks = <&clock HIX5HD2_FIXED_100M>;
337 clock-names = "apb_pclk";
338 interrupt-controller;
339 #interrupt-cells = <2>;
340 status = "disabled";
341 };
342
343 gpio16: gpio@b30000 {
344 compatible = "arm,pl061", "arm,primecell";
345 reg = <0xb30000 0x1000>;
346 interrupts = <0 124 0x4>;
347 gpio-controller;
348 #gpio-cells = <2>;
349 clocks = <&clock HIX5HD2_FIXED_100M>;
350 clock-names = "apb_pclk";
351 interrupt-controller;
352 #interrupt-cells = <2>;
353 status = "disabled";
354 };
355
356 gpio17: gpio@b31000 {
357 compatible = "arm,pl061", "arm,primecell";
358 reg = <0xb31000 0x1000>;
359 interrupts = <0 125 0x4>;
360 gpio-controller;
361 #gpio-cells = <2>;
362 clocks = <&clock HIX5HD2_FIXED_100M>;
363 clock-names = "apb_pclk";
364 interrupt-controller;
365 #interrupt-cells = <2>;
366 status = "disabled";
367 };
368
369 wdt0: watchdog@a2c000 {
370 compatible = "arm,sp805", "arm,primecell";
371 arm,primecell-periphid = <0x00141805>;
372 reg = <0xa2c000 0x1000>;
373 interrupts = <0 29 4>;
374 clocks = <&clock HIX5HD2_WDG0_RST>;
375 clock-names = "apb_pclk";
376 };
134 }; 377 };
135 378
136 local_timer@00a00600 { 379 local_timer@00a00600 {
@@ -148,9 +391,15 @@
148 }; 391 };
149 392
150 sysctrl: system-controller@00000000 { 393 sysctrl: system-controller@00000000 {
151 compatible = "hisilicon,sysctrl"; 394 compatible = "hisilicon,sysctrl", "syscon";
152 reg = <0x00000000 0x1000>; 395 reg = <0x00000000 0x1000>;
153 reboot-offset = <0x4>; 396 };
397
398 reboot {
399 compatible = "syscon-reboot";
400 regmap = <&sysctrl>;
401 offset = <0x4>;
402 mask = <0xdeadbeef>;
154 }; 403 };
155 404
156 cpuctrl@00a22000 { 405 cpuctrl@00a22000 {
@@ -166,5 +415,142 @@
166 #clock-cells = <1>; 415 #clock-cells = <1>;
167 }; 416 };
168 }; 417 };
418
419 /* unremovable emmc as mmcblk0 */
420 mmc: mmc@1830000 {
421 compatible = "snps,dw-mshc";
422 reg = <0x1830000 0x1000>;
423 interrupts = <0 35 4>;
424 clocks = <&clock HIX5HD2_MMC_CIU_RST>,
425 <&clock HIX5HD2_MMC_BIU_CLK>;
426 clock-names = "ciu", "biu";
427 };
428
429 sd: mmc@1820000 {
430 compatible = "snps,dw-mshc";
431 reg = <0x1820000 0x1000>;
432 interrupts = <0 34 4>;
433 clocks = <&clock HIX5HD2_SD_CIU_RST>,
434 <&clock HIX5HD2_SD_BIU_CLK>;
435 clock-names = "ciu","biu";
436 };
437
438 gmac0: ethernet@1840000 {
439 compatible = "hisilicon,hix5hd2-gmac";
440 reg = <0x1840000 0x1000>,<0x184300c 0x4>;
441 interrupts = <0 71 4>;
442 clocks = <&clock HIX5HD2_MAC0_CLK>;
443 status = "disabled";
444 };
445
446 gmac1: ethernet@1841000 {
447 compatible = "hisilicon,hix5hd2-gmac";
448 reg = <0x1841000 0x1000>,<0x1843010 0x4>;
449 interrupts = <0 72 4>;
450 clocks = <&clock HIX5HD2_MAC1_CLK>;
451 status = "disabled";
452 };
453
454 usb0: ehci@1890000 {
455 compatible = "generic-ehci";
456 reg = <0x1890000 0x1000>;
457 interrupts = <0 66 4>;
458 clocks = <&clock HIX5HD2_USB_CLK>;
459 };
460
461 usb1: ohci@1880000 {
462 compatible = "generic-ohci";
463 reg = <0x1880000 0x1000>;
464 interrupts = <0 67 4>;
465 clocks = <&clock HIX5HD2_USB_CLK>;
466 };
467
468 peripheral_ctrl: syscon@a20000 {
469 compatible = "syscon";
470 reg = <0xa20000 0x1000>;
471 };
472
473 sata_phy: phy@1900000 {
474 compatible = "hisilicon,hix5hd2-sata-phy";
475 reg = <0x1900000 0x10000>;
476 #phy-cells = <0>;
477 hisilicon,peripheral-syscon = <&peripheral_ctrl>;
478 hisilicon,power-reg = <0x8 10>;
479 };
480
481 ahci: sata@1900000 {
482 compatible = "hisilicon,hisi-ahci";
483 reg = <0x1900000 0x10000>;
484 interrupts = <0 70 4>;
485 clocks = <&clock HIX5HD2_SATA_CLK>;
486 };
487
488 ir: ir@001000 {
489 compatible = "hisilicon,hix5hd2-ir";
490 reg = <0x001000 0x1000>;
491 interrupts = <0 47 4>;
492 clocks = <&clock HIX5HD2_FIXED_24M>;
493 hisilicon,power-syscon = <&sysctrl>;
494 };
495
496 i2c0: i2c@b10000 {
497 compatible = "hisilicon,hix5hd2-i2c";
498 reg = <0xb10000 0x1000>;
499 interrupts = <0 38 4>;
500 clocks = <&clock HIX5HD2_I2C0_RST>;
501 #address-cells = <1>;
502 #size-cells = <0>;
503 status = "disabled";
504 };
505
506 i2c1: i2c@b11000 {
507 compatible = "hisilicon,hix5hd2-i2c";
508 reg = <0xb11000 0x1000>;
509 interrupts = <0 39 4>;
510 clocks = <&clock HIX5HD2_I2C1_RST>;
511 #address-cells = <1>;
512 #size-cells = <0>;
513 status = "disabled";
514 };
515
516 i2c2: i2c@b12000 {
517 compatible = "hisilicon,hix5hd2-i2c";
518 reg = <0xb12000 0x1000>;
519 interrupts = <0 40 4>;
520 clocks = <&clock HIX5HD2_I2C2_RST>;
521 #address-cells = <1>;
522 #size-cells = <0>;
523 status = "disabled";
524 };
525
526 i2c3: i2c@b13000 {
527 compatible = "hisilicon,hix5hd2-i2c";
528 reg = <0xb13000 0x1000>;
529 interrupts = <0 41 4>;
530 clocks = <&clock HIX5HD2_I2C3_RST>;
531 #address-cells = <1>;
532 #size-cells = <0>;
533 status = "disabled";
534 };
535
536 i2c4: i2c@b16000 {
537 compatible = "hisilicon,hix5hd2-i2c";
538 reg = <0xb16000 0x1000>;
539 interrupts = <0 43 4>;
540 clocks = <&clock HIX5HD2_I2C4_RST>;
541 #address-cells = <1>;
542 #size-cells = <0>;
543 status = "disabled";
544 };
545
546 i2c5: i2c@b17000 {
547 compatible = "hisilicon,hix5hd2-i2c";
548 reg = <0xb17000 0x1000>;
549 interrupts = <0 44 4>;
550 clocks = <&clock HIX5HD2_I2C5_RST>;
551 #address-cells = <1>;
552 #size-cells = <0>;
553 status = "disabled";
554 };
169 }; 555 };
170}; 556};
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 92660e1fe1fc..c0116cffc513 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -214,7 +214,9 @@
214 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 214 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
215 reg = <0x70014000 0x4000>; 215 reg = <0x70014000 0x4000>;
216 interrupts = <30>; 216 interrupts = <30>;
217 clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>; 217 clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>,
218 <&clks IMX5_CLK_SSI2_ROOT_GATE>;
219 clock-names = "ipg", "baud";
218 dmas = <&sdma 24 1 0>, 220 dmas = <&sdma 24 1 0>,
219 <&sdma 25 1 0>; 221 <&sdma 25 1 0>;
220 dma-names = "rx", "tx"; 222 dma-names = "rx", "tx";
@@ -504,7 +506,9 @@
504 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 506 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
505 reg = <0x83fcc000 0x4000>; 507 reg = <0x83fcc000 0x4000>;
506 interrupts = <29>; 508 interrupts = <29>;
507 clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>; 509 clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>,
510 <&clks IMX5_CLK_SSI1_ROOT_GATE>;
511 clock-names = "ipg", "baud";
508 dmas = <&sdma 28 0 0>, 512 dmas = <&sdma 28 0 0>,
509 <&sdma 29 0 0>; 513 <&sdma 29 0 0>;
510 dma-names = "rx", "tx"; 514 dma-names = "rx", "tx";
@@ -560,7 +564,9 @@
560 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 564 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
561 reg = <0x83fe8000 0x4000>; 565 reg = <0x83fe8000 0x4000>;
562 interrupts = <96>; 566 interrupts = <96>;
563 clocks = <&clks IMX5_CLK_SSI3_IPG_GATE>; 567 clocks = <&clks IMX5_CLK_SSI3_IPG_GATE>,
568 <&clks IMX5_CLK_SSI3_ROOT_GATE>;
569 clock-names = "ipg", "baud";
564 dmas = <&sdma 46 0 0>, 570 dmas = <&sdma 46 0 0>,
565 <&sdma 47 0 0>; 571 <&sdma 47 0 0>;
566 dma-names = "rx", "tx"; 572 dma-names = "rx", "tx";
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index f91725b2e8ab..a30bddfdbdb6 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -46,10 +46,21 @@
46 cpus { 46 cpus {
47 #address-cells = <1>; 47 #address-cells = <1>;
48 #size-cells = <0>; 48 #size-cells = <0>;
49 cpu@0 { 49 cpu0: cpu@0 {
50 device_type = "cpu"; 50 device_type = "cpu";
51 compatible = "arm,cortex-a8"; 51 compatible = "arm,cortex-a8";
52 reg = <0x0>; 52 reg = <0x0>;
53 clocks = <&clks IMX5_CLK_ARM>;
54 clock-latency = <61036>;
55 voltage-tolerance = <5>;
56 operating-points = <
57 /* kHz */
58 166666 850000
59 400000 900000
60 800000 1050000
61 1000000 1200000
62 1200000 1300000
63 >;
53 }; 64 };
54 }; 65 };
55 66
@@ -227,7 +238,9 @@
227 "fsl,imx21-ssi"; 238 "fsl,imx21-ssi";
228 reg = <0x50014000 0x4000>; 239 reg = <0x50014000 0x4000>;
229 interrupts = <30>; 240 interrupts = <30>;
230 clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>; 241 clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>,
242 <&clks IMX5_CLK_SSI2_ROOT_GATE>;
243 clock-names = "ipg", "baud";
231 dmas = <&sdma 24 1 0>, 244 dmas = <&sdma 24 1 0>,
232 <&sdma 25 1 0>; 245 <&sdma 25 1 0>;
233 dma-names = "rx", "tx"; 246 dma-names = "rx", "tx";
@@ -675,7 +688,9 @@
675 "fsl,imx21-ssi"; 688 "fsl,imx21-ssi";
676 reg = <0x63fcc000 0x4000>; 689 reg = <0x63fcc000 0x4000>;
677 interrupts = <29>; 690 interrupts = <29>;
678 clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>; 691 clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>,
692 <&clks IMX5_CLK_SSI1_ROOT_GATE>;
693 clock-names = "ipg", "baud";
679 dmas = <&sdma 28 0 0>, 694 dmas = <&sdma 28 0 0>,
680 <&sdma 29 0 0>; 695 <&sdma 29 0 0>;
681 dma-names = "rx", "tx"; 696 dma-names = "rx", "tx";
@@ -703,7 +718,9 @@
703 "fsl,imx21-ssi"; 718 "fsl,imx21-ssi";
704 reg = <0x63fe8000 0x4000>; 719 reg = <0x63fe8000 0x4000>;
705 interrupts = <96>; 720 interrupts = <96>;
706 clocks = <&clks IMX5_CLK_SSI3_IPG_GATE>; 721 clocks = <&clks IMX5_CLK_SSI3_IPG_GATE>,
722 <&clks IMX5_CLK_SSI3_ROOT_GATE>;
723 clock-names = "ipg", "baud";
707 dmas = <&sdma 46 0 0>, 724 dmas = <&sdma 46 0 0>,
708 <&sdma 47 0 0>; 725 <&sdma 47 0 0>;
709 dma-names = "rx", "tx"; 726 dma-names = "rx", "tx";
diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi
index b453e0e28aee..1ac2fe732867 100644
--- a/arch/arm/boot/dts/imx6dl.dtsi
+++ b/arch/arm/boot/dts/imx6dl.dtsi
@@ -13,6 +13,10 @@
13#include "imx6qdl.dtsi" 13#include "imx6qdl.dtsi"
14 14
15/ { 15/ {
16 aliases {
17 i2c3 = &i2c4;
18 };
19
16 cpus { 20 cpus {
17 #address-cells = <1>; 21 #address-cells = <1>;
18 #size-cells = <0>; 22 #size-cells = <0>;
@@ -114,3 +118,7 @@
114 "di0_sel", "di1_sel", 118 "di0_sel", "di1_sel",
115 "di0", "di1"; 119 "di0", "di1";
116}; 120};
121
122&vpu {
123 compatible = "fsl,imx6dl-vpu", "cnm,coda960";
124};
diff --git a/arch/arm/boot/dts/imx6q-tbs2910.dts b/arch/arm/boot/dts/imx6q-tbs2910.dts
new file mode 100644
index 000000000000..a43abfa21e33
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-tbs2910.dts
@@ -0,0 +1,432 @@
1/*
2 * Copyright 2014 Soeren Moch <smoch@web.de>
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 file 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
12 * the License, or (at your option) any later version.
13 *
14 * This file 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 file; 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
50#include "imx6q.dtsi"
51#include <dt-bindings/gpio/gpio.h>
52#include <dt-bindings/input/input.h>
53
54/ {
55 model = "TBS2910 Matrix ARM mini PC";
56 compatible = "tbs,imx6q-tbs2910", "fsl,imx6q";
57
58 chosen {
59 stdout-path = &uart1;
60 };
61
62 memory {
63 reg = <0x10000000 0x80000000>;
64 };
65
66 fan {
67 compatible = "gpio-fan";
68 pinctrl-names = "default";
69 pinctrl-0 = <&pinctrl_gpio_fan>;
70 gpios = <&gpio3 28 GPIO_ACTIVE_HIGH>;
71 gpio-fan,speed-map = <0 0
72 3000 1>;
73 };
74
75 ir_recv {
76 compatible = "gpio-ir-receiver";
77 gpios = <&gpio3 18 GPIO_ACTIVE_LOW>;
78 pinctrl-names = "default";
79 pinctrl-0 = <&pinctrl_ir>;
80 };
81
82 leds {
83 compatible = "gpio-leds";
84 pinctrl-names = "default";
85 pinctrl-0 = <&pinctrl_gpio_leds>;
86
87 blue {
88 label = "blue_status_led";
89 gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
90 default-state = "keep";
91 };
92 };
93
94 regulators {
95 compatible = "simple-bus";
96 #address-cells = <1>;
97 #size-cells = <0>;
98
99 reg_2p5v: regulator@0 {
100 compatible = "regulator-fixed";
101 reg = <0>;
102 regulator-name = "2P5V";
103 regulator-min-microvolt = <2500000>;
104 regulator-max-microvolt = <2500000>;
105 };
106
107 reg_3p3v: regulator@1 {
108 compatible = "regulator-fixed";
109 reg = <1>;
110 regulator-name = "3P3V";
111 regulator-min-microvolt = <3300000>;
112 regulator-max-microvolt = <3300000>;
113 };
114
115 reg_5p0v: regulator@2 {
116 compatible = "regulator-fixed";
117 reg = <2>;
118 regulator-name = "5P0V";
119 regulator-min-microvolt = <5000000>;
120 regulator-max-microvolt = <5000000>;
121 };
122 };
123
124 sound-sgtl5000 {
125 audio-codec = <&sgtl5000>;
126 audio-routing =
127 "MIC_IN", "Mic Jack",
128 "Mic Jack", "Mic Bias",
129 "Headphone Jack", "HP_OUT";
130 compatible = "fsl,imx-audio-sgtl5000";
131 model = "On-board Codec";
132 mux-ext-port = <3>;
133 mux-int-port = <1>;
134 ssi-controller = <&ssi1>;
135 };
136
137 sound-spdif {
138 compatible = "fsl,imx-audio-spdif";
139 model = "On-board SPDIF";
140 spdif-controller = <&spdif>;
141 spdif-out;
142 };
143};
144
145&audmux {
146 status = "okay";
147};
148
149&fec {
150 pinctrl-names = "default";
151 pinctrl-0 = <&pinctrl_enet>;
152 phy-mode = "rgmii";
153 phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>;
154 status = "okay";
155};
156
157&hdmi {
158 pinctrl-names = "default";
159 pinctrl-0 = <&pinctrl_hdmi>;
160 ddc-i2c-bus = <&i2c2>;
161 status = "okay";
162};
163
164&i2c1 {
165 clock-frequency = <100000>;
166 pinctrl-names = "default";
167 pinctrl-0 = <&pinctrl_i2c1>;
168 status = "okay";
169
170 sgtl5000: sgtl5000@0a {
171 clocks = <&clks 201>;
172 compatible = "fsl,sgtl5000";
173 pinctrl-names = "default";
174 pinctrl-0 = <&pinctrl_sgtl5000>;
175 reg = <0x0a>;
176 VDDA-supply = <&reg_2p5v>;
177 VDDIO-supply = <&reg_3p3v>;
178 };
179};
180
181&i2c2 {
182 clock-frequency = <100000>;
183 pinctrl-names = "default";
184 pinctrl-0 = <&pinctrl_i2c2>;
185 status = "okay";
186};
187
188&i2c3 {
189 clock-frequency = <100000>;
190 pinctrl-names = "default";
191 pinctrl-0 = <&pinctrl_i2c3>;
192 status = "okay";
193
194 rtc: ds1307@68 {
195 compatible = "dallas,ds1307";
196 reg = <0x68>;
197 };
198};
199
200&pcie {
201 pinctrl-names = "default";
202 pinctrl-0 = <&pinctrl_pcie>;
203 reset-gpio = <&gpio7 12 GPIO_ACTIVE_HIGH>;
204 status = "okay";
205};
206
207&sata {
208 status = "okay";
209};
210
211&snvs_poweroff {
212 status = "okay";
213};
214
215&spdif {
216 pinctrl-names = "default";
217 pinctrl-0 = <&pinctrl_spdif>;
218 status = "okay";
219};
220
221&ssi1 {
222 status = "okay";
223};
224
225&uart1 {
226 pinctrl-names = "default";
227 pinctrl-0 = <&pinctrl_uart1>;
228 status = "okay";
229};
230
231&uart2 {
232 pinctrl-names = "default";
233 pinctrl-0 = <&pinctrl_uart2>;
234 status = "okay";
235};
236
237&usbh1 {
238 vbus-supply = <&reg_5p0v>;
239 status = "okay";
240};
241
242&usbotg {
243 vbus-supply = <&reg_5p0v>;
244 pinctrl-names = "default";
245 pinctrl-0 = <&pinctrl_usbotg>;
246 disable-over-current;
247 status = "okay";
248};
249
250&usdhc2 {
251 pinctrl-names = "default";
252 pinctrl-0 = <&pinctrl_usdhc2>;
253 bus-width = <4>;
254 cd-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
255 vmmc-supply = <&reg_3p3v>;
256 status = "okay";
257};
258
259&usdhc3 {
260 pinctrl-names = "default";
261 pinctrl-0 = <&pinctrl_usdhc3>;
262 bus-width = <4>;
263 cd-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
264 wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
265 vmmc-supply = <&reg_3p3v>;
266 status = "okay";
267};
268
269&usdhc4 {
270 pinctrl-names = "default";
271 pinctrl-0 = <&pinctrl_usdhc4>;
272 bus-width = <8>;
273 non-removable;
274 no-1-8-v;
275 status = "okay";
276};
277
278&iomuxc {
279 imx6q-tbs2910 {
280 pinctrl_enet: enetgrp {
281 fsl,pins = <
282 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
283 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
284 MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
285 MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
286 MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
287 MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
288 MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
289 MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
290 MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
291 MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
292 MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0
293 MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0
294 MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
295 MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
296 MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
297 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
298 MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x1b059
299 >;
300 };
301
302 pinctrl_hdmi: hdmigrp {
303 fsl,pins = <
304 MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x1f8b0
305 >;
306 };
307
308 pinctrl_i2c1: i2c1grp {
309 fsl,pins = <
310 MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1
311 MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1
312 >;
313 };
314
315 pinctrl_i2c2: i2c2grp {
316 fsl,pins = <
317 MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
318 MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
319 >;
320 };
321
322 pinctrl_i2c3: i2c3grp {
323 fsl,pins = <
324 MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1
325 MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1
326 >;
327 };
328
329 pinctrl_ir: irgrp {
330 fsl,pins = <
331 MX6QDL_PAD_EIM_D18__GPIO3_IO18 0x17059
332 >;
333 };
334
335 pinctrl_pcie: pciegrp {
336 fsl,pins = <
337 MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x17059
338 >;
339 };
340
341 pinctrl_sgtl5000: sgtl5000grp {
342 fsl,pins = <
343 MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
344 MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
345 MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x110b0
346 MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
347 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0
348 >;
349 };
350
351 pinctrl_spdif: spdifgrp {
352 fsl,pins = <MX6QDL_PAD_GPIO_19__SPDIF_OUT 0x13091
353 >;
354 };
355
356 pinctrl_uart1: uart1grp {
357 fsl,pins = <
358 MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA 0x1b0b1
359 MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1
360 >;
361 };
362
363 pinctrl_uart2: uart2grp {
364 fsl,pins = <
365 MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1
366 MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1
367 >;
368 };
369
370 pinctrl_usbotg: usbotggrp {
371 fsl,pins = <
372 MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x17059
373 >;
374 };
375
376 pinctrl_usdhc2: usdhc2grp {
377 fsl,pins = <
378 MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
379 MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
380 MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
381 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
382 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
383 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059
384 MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x17059
385 >;
386 };
387
388 pinctrl_usdhc3: usdhc3grp {
389 fsl,pins = <
390 MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059
391 MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059
392 MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059
393 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
394 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
395 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
396 MX6QDL_PAD_NANDF_D0__GPIO2_IO00 0x17059
397 MX6QDL_PAD_NANDF_D1__GPIO2_IO01 0x17059
398 >;
399 };
400
401 pinctrl_usdhc4: usdhc4grp {
402 fsl,pins = <
403 MX6QDL_PAD_SD4_CMD__SD4_CMD 0x17059
404 MX6QDL_PAD_SD4_CLK__SD4_CLK 0x10059
405 MX6QDL_PAD_SD4_DAT0__SD4_DATA0 0x17059
406 MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x17059
407 MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x17059
408 MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x17059
409 MX6QDL_PAD_SD4_DAT4__SD4_DATA4 0x17059
410 MX6QDL_PAD_SD4_DAT5__SD4_DATA5 0x17059
411 MX6QDL_PAD_SD4_DAT6__SD4_DATA6 0x17059
412 MX6QDL_PAD_SD4_DAT7__SD4_DATA7 0x17059
413 >;
414 };
415 };
416
417 gpio_fan {
418 pinctrl_gpio_fan: gpiofangrp {
419 fsl,pins = <
420 MX6QDL_PAD_EIM_D28__GPIO3_IO28 0x130b1
421 >;
422 };
423 };
424
425 gpio_leds {
426 pinctrl_gpio_leds: gpioledsgrp {
427 fsl,pins = <
428 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x130b1
429 >;
430 };
431 };
432};
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index e9f3646d1760..85f72e6b5bad 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -308,3 +308,7 @@
308 }; 308 };
309 }; 309 };
310}; 310};
311
312&vpu {
313 compatible = "fsl,imx6q-vpu", "cnm,coda960";
314};
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
index d3c0bf5c84e3..b5756c21ea1d 100644
--- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
@@ -282,7 +282,6 @@
282}; 282};
283 283
284&ssi1 { 284&ssi1 {
285 fsl,mode = "i2s-slave";
286 status = "okay"; 285 status = "okay";
287}; 286};
288 287
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
index cade1bdc97e9..86f03c1b147c 100644
--- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
@@ -287,7 +287,6 @@
287}; 287};
288 288
289&ssi1 { 289&ssi1 {
290 fsl,mode = "i2s-slave";
291 status = "okay"; 290 status = "okay";
292}; 291};
293 292
diff --git a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
index cf13239a1619..4a8d97f47759 100644
--- a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
@@ -376,12 +376,10 @@
376}; 376};
377 377
378&ssi1 { 378&ssi1 {
379 fsl,mode = "i2s-slave";
380 status = "okay"; 379 status = "okay";
381}; 380};
382 381
383&ssi2 { 382&ssi2 {
384 fsl,mode = "i2s-slave";
385 status = "okay"; 383 status = "okay";
386}; 384};
387 385
diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pbab01.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pbab01.dtsi
index 584721264121..585b4f6986c1 100644
--- a/arch/arm/boot/dts/imx6qdl-phytec-pbab01.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-phytec-pbab01.dtsi
@@ -9,17 +9,103 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12#include <dt-bindings/sound/fsl-imx-audmux.h>
13
12/ { 14/ {
13 chosen { 15 chosen {
14 linux,stdout-path = &uart4; 16 linux,stdout-path = &uart4;
15 }; 17 };
18
19 regulators {
20 sound_1v8: regulator@2 {
21 compatible = "regulator-fixed";
22 reg = <2>;
23 regulator-name = "i2s-audio-1v8";
24 regulator-min-microvolt = <1800000>;
25 regulator-max-microvolt = <1800000>;
26 };
27
28 sound_3v3: regulator@3 {
29 compatible = "regulator-fixed";
30 reg = <3>;
31 regulator-name = "i2s-audio-3v3";
32 regulator-min-microvolt = <3300000>;
33 regulator-max-microvolt = <3300000>;
34 };
35 };
36
37 tlv320_mclk: oscillator {
38 compatible = "fixed-clock";
39 #clock-cells = <0>;
40 clock-frequency = <19200000>;
41 clock-output-names = "tlv320-mclk";
42 };
43
44 sound {
45 compatible = "simple-audio-card";
46 simple-audio-card,name = "OnboardTLV320AIC3007";
47 simple-audio-card,format = "i2s";
48 simple-audio-card,bitclock-master = <&dailink_master>;
49 simple-audio-card,frame-master = <&dailink_master>;
50 simple-audio-card,widgets =
51 "Microphone", "Mic Jack",
52 "Line", "Line In",
53 "Line", "Line Out",
54 "Speaker", "Speaker",
55 "Headphone", "Headphone Jack";
56 simple-audio-card,routing =
57 "Line Out", "LLOUT",
58 "Line Out", "RLOUT",
59 "Speaker", "SPOP",
60 "Speaker", "SPOM",
61 "Headphone Jack", "HPLOUT",
62 "Headphone Jack", "HPROUT",
63 "MIC3L", "Mic Jack",
64 "MIC3R", "Mic Jack",
65 "Mic Jack", "Mic Bias",
66 "LINE1L", "Line In",
67 "LINE1R", "Line In";
68
69 simple-audio-card,cpu {
70 sound-dai = <&ssi2>;
71 };
72
73 dailink_master: simple-audio-card,codec {
74 sound-dai = <&codec>;
75 clocks = <&tlv320_mclk>;
76 };
77 };
78
16}; 79};
17 80
18&fec { 81&audmux {
19 status = "okay"; 82 status = "okay";
83
84 ssi2 {
85 fsl,audmux-port = <1>;
86 fsl,port-config = <
87 (IMX_AUDMUX_V2_PTCR_TFSDIR |
88 IMX_AUDMUX_V2_PTCR_TFSEL(4) |
89 IMX_AUDMUX_V2_PTCR_TCLKDIR |
90 IMX_AUDMUX_V2_PTCR_TCSEL(4))
91 IMX_AUDMUX_V2_PDCR_RXDSEL(4)
92 >;
93 };
94
95 pins5 {
96 fsl,audmux-port = <4>;
97 fsl,port-config = <
98 0x00000000
99 IMX_AUDMUX_V2_PDCR_RXDSEL(1)
100 >;
101 };
20}; 102};
21 103
22&gpmi { 104&can1 {
105 status = "okay";
106};
107
108&fec {
23 status = "okay"; 109 status = "okay";
24}; 110};
25 111
@@ -28,14 +114,18 @@
28}; 114};
29 115
30&i2c2 { 116&i2c2 {
31 pinctrl-names = "default";
32 pinctrl-0 = <&pinctrl_i2c2>;
33 clock-frequency = <100000>;
34 status = "okay"; 117 status = "okay";
35 118
36 tlv320@18 { 119 codec: tlv320@18 {
37 compatible = "ti,tlv320aic3x"; 120 compatible = "ti,tlv320aic3007";
121 #sound-dai-cells = <0>;
38 reg = <0x18>; 122 reg = <0x18>;
123 ai3x-micbias-vg = <2>;
124
125 AVDD-supply = <&sound_3v3>;
126 IOVDD-supply = <&sound_3v3>;
127 DRVDD-supply = <&sound_3v3>;
128 DVDD-supply = <&sound_1v8>;
39 }; 129 };
40 130
41 stmpe@41 { 131 stmpe@41 {
@@ -55,9 +145,14 @@
55}; 145};
56 146
57&i2c3 { 147&i2c3 {
58 pinctrl-names = "default"; 148 status = "okay";
59 pinctrl-0 = <&pinctrl_i2c3>; 149};
60 clock-frequency = <100000>; 150
151&pcie {
152 status = "okay";
153};
154
155&ssi2 {
61 status = "okay"; 156 status = "okay";
62}; 157};
63 158
@@ -84,19 +179,3 @@
84&usdhc3 { 179&usdhc3 {
85 status = "okay"; 180 status = "okay";
86}; 181};
87
88&iomuxc {
89 pinctrl_i2c2: i2c2grp {
90 fsl,pins = <
91 MX6QDL_PAD_EIM_EB2__I2C2_SCL 0x4001b8b1
92 MX6QDL_PAD_EIM_D16__I2C2_SDA 0x4001b8b1
93 >;
94 };
95
96 pinctrl_i2c3: i2c3grp {
97 fsl,pins = <
98 MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
99 MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
100 >;
101 };
102};
diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
index 0e50bb0a6b94..19cc269a08d4 100644
--- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
@@ -58,6 +58,18 @@
58 }; 58 };
59}; 59};
60 60
61&audmux {
62 pinctrl-names = "default";
63 pinctrl-0 = <&pinctrl_audmux>;
64 status = "disabled";
65};
66
67&can1 {
68 pinctrl-names = "default";
69 pinctrl-0 = <&pinctrl_flexcan1>;
70 status = "disabled";
71};
72
61&ecspi3 { 73&ecspi3 {
62 pinctrl-names = "default"; 74 pinctrl-names = "default";
63 pinctrl-0 = <&pinctrl_ecspi3>; 75 pinctrl-0 = <&pinctrl_ecspi3>;
@@ -72,6 +84,22 @@
72 }; 84 };
73}; 85};
74 86
87&fec {
88 pinctrl-names = "default";
89 pinctrl-0 = <&pinctrl_enet>;
90 phy-mode = "rgmii";
91 phy-reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>;
92 phy-supply = <&vdd_eth_io_reg>;
93 status = "disabled";
94};
95
96&gpmi {
97 pinctrl-names = "default";
98 pinctrl-0 = <&pinctrl_gpmi_nand>;
99 nand-on-flash-bbt;
100 status = "okay";
101};
102
75&i2c1 { 103&i2c1 {
76 pinctrl-names = "default"; 104 pinctrl-names = "default";
77 pinctrl-0 = <&pinctrl_i2c1>; 105 pinctrl-0 = <&pinctrl_i2c1>;
@@ -85,8 +113,8 @@
85 pmic@58 { 113 pmic@58 {
86 compatible = "dlg,da9063"; 114 compatible = "dlg,da9063";
87 reg = <0x58>; 115 reg = <0x58>;
88 interrupt-parent = <&gpio4>; 116 interrupt-parent = <&gpio2>;
89 interrupts = <17 0x8>; /* active-low GPIO4_17 */ 117 interrupts = <9 0x8>; /* active-low GPIO2_9 */
90 118
91 regulators { 119 regulators {
92 vddcore_reg: bcore1 { 120 vddcore_reg: bcore1 {
@@ -162,6 +190,18 @@
162 }; 190 };
163}; 191};
164 192
193&i2c2 {
194 pinctrl-names = "default";
195 pinctrl-0 = <&pinctrl_i2c2>;
196 clock-frequency = <100000>;
197};
198
199&i2c3 {
200 pinctrl-names = "default";
201 pinctrl-0 = <&pinctrl_i2c3>;
202 clock-frequency = <100000>;
203};
204
165&iomuxc { 205&iomuxc {
166 pinctrl-names = "default"; 206 pinctrl-names = "default";
167 pinctrl-0 = <&pinctrl_hog>; 207 pinctrl-0 = <&pinctrl_hog>;
@@ -171,7 +211,7 @@
171 fsl,pins = < 211 fsl,pins = <
172 MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x80000000 212 MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x80000000
173 MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24 0x80000000 /* SPI NOR chipselect */ 213 MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24 0x80000000 /* SPI NOR chipselect */
174 MX6QDL_PAD_DI0_PIN15__GPIO4_IO17 0x80000000 /* PMIC interrupt */ 214 MX6QDL_PAD_SD4_DAT1__GPIO2_IO09 0x80000000 /* PMIC interrupt */
175 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* Green LED */ 215 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* Green LED */
176 MX6QDL_PAD_EIM_EB3__GPIO2_IO31 0x80000000 /* Red LED */ 216 MX6QDL_PAD_EIM_EB3__GPIO2_IO31 0x80000000 /* Red LED */
177 >; 217 >;
@@ -206,6 +246,13 @@
206 >; 246 >;
207 }; 247 };
208 248
249 pinctrl_flexcan1: flexcan1grp {
250 fsl,pins = <
251 MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x1b0b0
252 MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x1b0b0
253 >;
254 };
255
209 pinctrl_gpmi_nand: gpminandgrp { 256 pinctrl_gpmi_nand: gpminandgrp {
210 fsl,pins = < 257 fsl,pins = <
211 MX6QDL_PAD_NANDF_CLE__NAND_CLE 0xb0b1 258 MX6QDL_PAD_NANDF_CLE__NAND_CLE 0xb0b1
@@ -235,6 +282,24 @@
235 >; 282 >;
236 }; 283 };
237 284
285 pinctrl_i2c2: i2c2grp {
286 fsl,pins = <
287 MX6QDL_PAD_EIM_EB2__I2C2_SCL 0x4001b8b1
288 MX6QDL_PAD_EIM_D16__I2C2_SDA 0x4001b8b1
289 >;
290 };
291
292 pinctrl_i2c3: i2c3grp {
293 fsl,pins = <
294 MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
295 MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
296 >;
297 };
298
299 pinctrl_pcie: pciegrp {
300 fsl,pins = <MX6QDL_PAD_DI0_PIN15__GPIO4_IO17 0x80000000>;
301 };
302
238 pinctrl_uart3: uart3grp { 303 pinctrl_uart3: uart3grp {
239 fsl,pins = < 304 fsl,pins = <
240 MX6QDL_PAD_EIM_D24__UART3_TX_DATA 0x1b0b1 305 MX6QDL_PAD_EIM_D24__UART3_TX_DATA 0x1b0b1
@@ -293,22 +358,22 @@
293 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 358 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000
294 >; 359 >;
295 }; 360 };
296 };
297};
298 361
299&fec { 362 pinctrl_audmux: audmuxgrp {
300 pinctrl-names = "default"; 363 fsl,pins = <
301 pinctrl-0 = <&pinctrl_enet>; 364 MX6QDL_PAD_DISP0_DAT16__AUD5_TXC 0x130b0
302 phy-mode = "rgmii"; 365 MX6QDL_PAD_DISP0_DAT17__AUD5_TXD 0x110b0
303 phy-reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>; 366 MX6QDL_PAD_DISP0_DAT18__AUD5_TXFS 0x130b0
304 phy-supply = <&vdd_eth_io_reg>; 367 MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
305 status = "disabled"; 368 >;
369 };
370 };
306}; 371};
307 372
308&gpmi { 373&pcie {
309 pinctrl-names = "default"; 374 pinctrl-name = "default";
310 pinctrl-0 = <&pinctrl_gpmi_nand>; 375 pinctrl-0 = <&pinctrl_pcie>;
311 nand-on-flash-bbt; 376 reset-gpio = <&gpio4 17 0>;
312 status = "disabled"; 377 status = "disabled";
313}; 378};
314 379
diff --git a/arch/arm/boot/dts/imx6qdl-rex.dtsi b/arch/arm/boot/dts/imx6qdl-rex.dtsi
index df7bcf86c156..488a640796ac 100644
--- a/arch/arm/boot/dts/imx6qdl-rex.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-rex.dtsi
@@ -308,7 +308,6 @@
308}; 308};
309 309
310&ssi1 { 310&ssi1 {
311 fsl,mode = "i2s-slave";
312 status = "okay"; 311 status = "okay";
313}; 312};
314 313
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index baf2f00d519a..f1cd2147421d 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -107,10 +107,8 @@
107 "Headphone Jack", "HPOUTR", 107 "Headphone Jack", "HPOUTR",
108 "Ext Spk", "SPKOUTL", 108 "Ext Spk", "SPKOUTL",
109 "Ext Spk", "SPKOUTR", 109 "Ext Spk", "SPKOUTR",
110 "MICBIAS", "AMIC", 110 "AMIC", "MICBIAS",
111 "IN3R", "MICBIAS", 111 "IN3R", "AMIC";
112 "DMIC", "MICBIAS",
113 "DMICDAT", "DMIC";
114 mux-int-port = <2>; 112 mux-int-port = <2>;
115 mux-ext-port = <3>; 113 mux-ext-port = <3>;
116 }; 114 };
@@ -179,7 +177,7 @@
179 codec: wm8962@1a { 177 codec: wm8962@1a {
180 compatible = "wlf,wm8962"; 178 compatible = "wlf,wm8962";
181 reg = <0x1a>; 179 reg = <0x1a>;
182 clocks = <&clks 201>; 180 clocks = <&clks IMX6QDL_CLK_CKO>;
183 DCVDD-supply = <&reg_audio>; 181 DCVDD-supply = <&reg_audio>;
184 DBVDD-supply = <&reg_audio>; 182 DBVDD-supply = <&reg_audio>;
185 AVDD-supply = <&reg_audio>; 183 AVDD-supply = <&reg_audio>;
@@ -531,6 +529,10 @@
531 status = "okay"; 529 status = "okay";
532}; 530};
533 531
532&snvs_poweroff {
533 status = "okay";
534};
535
534&ssi2 { 536&ssi2 {
535 status = "okay"; 537 status = "okay";
536}; 538};
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 9596ed5867e6..4fc03b7f1cee 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -333,9 +333,17 @@
333 }; 333 };
334 334
335 vpu: vpu@02040000 { 335 vpu: vpu@02040000 {
336 compatible = "cnm,coda960";
336 reg = <0x02040000 0x3c000>; 337 reg = <0x02040000 0x3c000>;
337 interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>, 338 interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>,
338 <0 12 IRQ_TYPE_LEVEL_HIGH>; 339 <0 12 IRQ_TYPE_LEVEL_HIGH>;
340 interrupt-names = "bit", "jpeg";
341 clocks = <&clks IMX6QDL_CLK_VPU_AXI>,
342 <&clks IMX6QDL_CLK_MMDC_CH0_AXI>,
343 <&clks IMX6QDL_CLK_OCRAM>;
344 clock-names = "per", "ahb", "ocram";
345 resets = <&src 1>;
346 iram = <&ocram>;
339 }; 347 };
340 348
341 aipstz@0207c000 { /* AIPSTZ1 */ 349 aipstz@0207c000 { /* AIPSTZ1 */
@@ -657,6 +665,12 @@
657 interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>, 665 interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
658 <0 20 IRQ_TYPE_LEVEL_HIGH>; 666 <0 20 IRQ_TYPE_LEVEL_HIGH>;
659 }; 667 };
668
669 snvs_poweroff: snvs-poweroff@38 {
670 compatible = "fsl,sec-v4.0-poweroff";
671 reg = <0x38 0x4>;
672 status = "disabled";
673 };
660 }; 674 };
661 675
662 epit1: epit@020d0000 { /* EPIT1 */ 676 epit1: epit@020d0000 { /* EPIT1 */
diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
index 898d14fd765f..fda4932faefd 100644
--- a/arch/arm/boot/dts/imx6sl-evk.dts
+++ b/arch/arm/boot/dts/imx6sl-evk.dts
@@ -580,6 +580,10 @@
580 status = "okay"; 580 status = "okay";
581}; 581};
582 582
583&snvs_poweroff {
584 status = "okay";
585};
586
583&ssi2 { 587&ssi2 {
584 status = "okay"; 588 status = "okay";
585}; 589};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index dfd83e6d8087..36ab8e054cee 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -574,6 +574,12 @@
574 interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>, 574 interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
575 <0 20 IRQ_TYPE_LEVEL_HIGH>; 575 <0 20 IRQ_TYPE_LEVEL_HIGH>;
576 }; 576 };
577
578 snvs_poweroff: snvs-poweroff@38 {
579 compatible = "fsl,sec-v4.0-poweroff";
580 reg = <0x38 0x4>;
581 status = "disabled";
582 };
577 }; 583 };
578 584
579 epit1: epit@020d0000 { 585 epit1: epit@020d0000 {
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
index 82d6b34527b7..1e6e5cc1c14c 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -105,6 +105,30 @@
105 gpio = <&gpio3 27 0>; 105 gpio = <&gpio3 27 0>;
106 enable-active-high; 106 enable-active-high;
107 }; 107 };
108
109 reg_peri_3v3: regulator@5 {
110 compatible = "regulator-fixed";
111 reg = <5>;
112 pinctrl-names = "default";
113 pinctrl-0 = <&pinctrl_peri_3v3>;
114 regulator-name = "peri_3v3";
115 regulator-min-microvolt = <3300000>;
116 regulator-max-microvolt = <3300000>;
117 gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>;
118 enable-active-high;
119 regulator-always-on;
120 };
121
122 reg_enet_3v3: regulator@6 {
123 compatible = "regulator-fixed";
124 reg = <6>;
125 pinctrl-names = "default";
126 pinctrl-0 = <&pinctrl_enet_3v3>;
127 regulator-name = "enet_3v3";
128 regulator-min-microvolt = <3300000>;
129 regulator-max-microvolt = <3300000>;
130 gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
131 };
108 }; 132 };
109 133
110 sound { 134 sound {
@@ -133,6 +157,14 @@
133&fec1 { 157&fec1 {
134 pinctrl-names = "default"; 158 pinctrl-names = "default";
135 pinctrl-0 = <&pinctrl_enet1>; 159 pinctrl-0 = <&pinctrl_enet1>;
160 phy-supply = <&reg_enet_3v3>;
161 phy-mode = "rgmii";
162 status = "okay";
163};
164
165&fec2 {
166 pinctrl-names = "default";
167 pinctrl-0 = <&pinctrl_enet2>;
136 phy-mode = "rgmii"; 168 phy-mode = "rgmii";
137 status = "okay"; 169 status = "okay";
138}; 170};
@@ -304,6 +336,10 @@
304 status = "okay"; 336 status = "okay";
305}; 337};
306 338
339&snvs_poweroff {
340 status = "okay";
341};
342
307&ssi2 { 343&ssi2 {
308 status = "okay"; 344 status = "okay";
309}; 345};
@@ -394,6 +430,30 @@
394 MX6SX_PAD_RGMII1_RD2__ENET1_RX_DATA_2 0x3081 430 MX6SX_PAD_RGMII1_RD2__ENET1_RX_DATA_2 0x3081
395 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 0x3081 431 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 0x3081
396 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN 0x3081 432 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN 0x3081
433 MX6SX_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M 0x91
434 >;
435 };
436
437 pinctrl_enet_3v3: enet3v3grp {
438 fsl,pins = <
439 MX6SX_PAD_ENET2_COL__GPIO2_IO_6 0x80000000
440 >;
441 };
442
443 pinctrl_enet2: enet2grp {
444 fsl,pins = <
445 MX6SX_PAD_RGMII2_TXC__ENET2_RGMII_TXC 0xa0b9
446 MX6SX_PAD_RGMII2_TD0__ENET2_TX_DATA_0 0xa0b1
447 MX6SX_PAD_RGMII2_TD1__ENET2_TX_DATA_1 0xa0b1
448 MX6SX_PAD_RGMII2_TD2__ENET2_TX_DATA_2 0xa0b1
449 MX6SX_PAD_RGMII2_TD3__ENET2_TX_DATA_3 0xa0b1
450 MX6SX_PAD_RGMII2_TX_CTL__ENET2_TX_EN 0xa0b1
451 MX6SX_PAD_RGMII2_RXC__ENET2_RX_CLK 0x3081
452 MX6SX_PAD_RGMII2_RD0__ENET2_RX_DATA_0 0x3081
453 MX6SX_PAD_RGMII2_RD1__ENET2_RX_DATA_1 0x3081
454 MX6SX_PAD_RGMII2_RD2__ENET2_RX_DATA_2 0x3081
455 MX6SX_PAD_RGMII2_RD3__ENET2_RX_DATA_3 0x3081
456 MX6SX_PAD_RGMII2_RX_CTL__ENET2_RX_EN 0x3081
397 >; 457 >;
398 }; 458 };
399 459
@@ -452,6 +512,12 @@
452 >; 512 >;
453 }; 513 };
454 514
515 pinctrl_peri_3v3: peri3v3grp {
516 fsl,pins = <
517 MX6SX_PAD_QSPI1A_DATA0__GPIO4_IO_16 0x80000000
518 >;
519 };
520
455 pinctrl_pwm3: pwm3grp-1 { 521 pinctrl_pwm3: pwm3grp-1 {
456 fsl,pins = < 522 fsl,pins = <
457 MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x110b0 523 MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x110b0
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index f3e88c03b1e4..7a24fee1e7ae 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -671,6 +671,12 @@
671 reg = <0x34 0x58>; 671 reg = <0x34 0x58>;
672 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; 672 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
673 }; 673 };
674
675 snvs_poweroff: snvs-poweroff@38 {
676 compatible = "fsl,sec-v4.0-poweroff";
677 reg = <0x38 0x4>;
678 status = "disabled";
679 };
674 }; 680 };
675 681
676 epit1: epit@020d0000 { 682 epit1: epit@020d0000 {
@@ -877,7 +883,7 @@
877 }; 883 };
878 884
879 fec2: ethernet@021b4000 { 885 fec2: ethernet@021b4000 {
880 compatible = "fsl,imx6sx-fec"; 886 compatible = "fsl,imx6sx-fec", "fsl,imx6q-fec";
881 reg = <0x021b4000 0x4000>; 887 reg = <0x021b4000 0x4000>;
882 interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>, 888 interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
883 <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; 889 <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/boot/dts/integrator.dtsi b/arch/arm/boot/dts/integrator.dtsi
index 88e3d477bf16..28e38f8c6b0f 100644
--- a/arch/arm/boot/dts/integrator.dtsi
+++ b/arch/arm/boot/dts/integrator.dtsi
@@ -6,8 +6,18 @@
6 6
7/ { 7/ {
8 core-module@10000000 { 8 core-module@10000000 {
9 compatible = "arm,core-module-integrator"; 9 compatible = "arm,core-module-integrator", "syscon";
10 reg = <0x10000000 0x200>; 10 reg = <0x10000000 0x200>;
11
12 /* Use core module LED to indicate CPU load */
13 led@0c.0 {
14 compatible = "register-bit-led";
15 offset = <0x0c>;
16 mask = <0x01>;
17 label = "integrator:core_module";
18 linux,default-trigger = "cpu0";
19 default-state = "on";
20 };
11 }; 21 };
12 22
13 ebi@12000000 { 23 ebi@12000000 {
@@ -82,5 +92,41 @@
82 reg = <0x19000000 0x1000>; 92 reg = <0x19000000 0x1000>;
83 interrupts = <4>; 93 interrupts = <4>;
84 }; 94 };
95
96 syscon {
97 /* Debug registers mapped as syscon */
98 compatible = "syscon";
99 reg = <0x1a000000 0x10>;
100
101 led@04.0 {
102 compatible = "register-bit-led";
103 offset = <0x04>;
104 mask = <0x01>;
105 label = "integrator:green0";
106 linux,default-trigger = "heartbeat";
107 default-state = "on";
108 };
109 led@04.1 {
110 compatible = "register-bit-led";
111 offset = <0x04>;
112 mask = <0x02>;
113 label = "integrator:yellow";
114 default-state = "off";
115 };
116 led@04.2 {
117 compatible = "register-bit-led";
118 offset = <0x04>;
119 mask = <0x04>;
120 label = "integrator:red";
121 default-state = "off";
122 };
123 led@04.3 {
124 compatible = "register-bit-led";
125 offset = <0x04>;
126 mask = <0x08>;
127 label = "integrator:green1";
128 default-state = "off";
129 };
130 };
85 }; 131 };
86}; 132};
diff --git a/arch/arm/boot/dts/k2e-evm.dts b/arch/arm/boot/dts/k2e-evm.dts
index c568f067604d..560d62150ade 100644
--- a/arch/arm/boot/dts/k2e-evm.dts
+++ b/arch/arm/boot/dts/k2e-evm.dts
@@ -139,3 +139,15 @@
139 }; 139 };
140 }; 140 };
141}; 141};
142
143&mdio {
144 ethphy0: ethernet-phy@0 {
145 compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
146 reg = <0>;
147 };
148
149 ethphy1: ethernet-phy@1 {
150 compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
151 reg = <1>;
152 };
153};
diff --git a/arch/arm/boot/dts/k2e.dtsi b/arch/arm/boot/dts/k2e.dtsi
index c358b4b9a073..5fc14683d6df 100644
--- a/arch/arm/boot/dts/k2e.dtsi
+++ b/arch/arm/boot/dts/k2e.dtsi
@@ -85,6 +85,51 @@
85 #gpio-cells = <2>; 85 #gpio-cells = <2>;
86 gpio,syscon-dev = <&devctrl 0x240>; 86 gpio,syscon-dev = <&devctrl 0x240>;
87 }; 87 };
88
89 pcie@21020000 {
90 compatible = "ti,keystone-pcie","snps,dw-pcie";
91 clocks = <&clkpcie1>;
92 clock-names = "pcie";
93 #address-cells = <3>;
94 #size-cells = <2>;
95 reg = <0x21021000 0x2000>, <0x21020000 0x1000>, <0x02620128 4>;
96 ranges = <0x81000000 0 0 0x23260000 0x4000 0x4000
97 0x82000000 0 0x60000000 0x60000000 0 0x10000000>;
98
99 device_type = "pci";
100 num-lanes = <2>;
101
102 #interrupt-cells = <1>;
103 interrupt-map-mask = <0 0 0 7>;
104 interrupt-map = <0 0 0 1 &pcie_intc1 0>, /* INT A */
105 <0 0 0 2 &pcie_intc1 1>, /* INT B */
106 <0 0 0 3 &pcie_intc1 2>, /* INT C */
107 <0 0 0 4 &pcie_intc1 3>; /* INT D */
108
109 pcie_msi_intc1: msi-interrupt-controller {
110 interrupt-controller;
111 #interrupt-cells = <1>;
112 interrupt-parent = <&gic>;
113 interrupts = <GIC_SPI 377 IRQ_TYPE_EDGE_RISING>,
114 <GIC_SPI 378 IRQ_TYPE_EDGE_RISING>,
115 <GIC_SPI 379 IRQ_TYPE_EDGE_RISING>,
116 <GIC_SPI 380 IRQ_TYPE_EDGE_RISING>,
117 <GIC_SPI 381 IRQ_TYPE_EDGE_RISING>,
118 <GIC_SPI 382 IRQ_TYPE_EDGE_RISING>,
119 <GIC_SPI 383 IRQ_TYPE_EDGE_RISING>,
120 <GIC_SPI 384 IRQ_TYPE_EDGE_RISING>;
121 };
122
123 pcie_intc1: legacy-interrupt-controller {
124 interrupt-controller;
125 #interrupt-cells = <1>;
126 interrupt-parent = <&gic>;
127 interrupts = <GIC_SPI 373 IRQ_TYPE_EDGE_RISING>,
128 <GIC_SPI 374 IRQ_TYPE_EDGE_RISING>,
129 <GIC_SPI 375 IRQ_TYPE_EDGE_RISING>,
130 <GIC_SPI 376 IRQ_TYPE_EDGE_RISING>;
131 };
132 };
88 }; 133 };
89}; 134};
90 135
diff --git a/arch/arm/boot/dts/k2l-evm.dts b/arch/arm/boot/dts/k2l-evm.dts
index fec43128a2e0..85cc7f2872d7 100644
--- a/arch/arm/boot/dts/k2l-evm.dts
+++ b/arch/arm/boot/dts/k2l-evm.dts
@@ -116,3 +116,15 @@
116 }; 116 };
117 }; 117 };
118}; 118};
119
120&mdio {
121 ethphy0: ethernet-phy@0 {
122 compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
123 reg = <0>;
124 };
125
126 ethphy1: ethernet-phy@1 {
127 compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
128 reg = <1>;
129 };
130};
diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi
index 5d3e83fa2242..c06542b2c954 100644
--- a/arch/arm/boot/dts/keystone.dtsi
+++ b/arch/arm/boot/dts/keystone.dtsi
@@ -285,5 +285,50 @@
285 #interrupt-cells = <1>; 285 #interrupt-cells = <1>;
286 ti,syscon-dev = <&devctrl 0x2a0>; 286 ti,syscon-dev = <&devctrl 0x2a0>;
287 }; 287 };
288
289 pcie@21800000 {
290 compatible = "ti,keystone-pcie", "snps,dw-pcie";
291 clocks = <&clkpcie>;
292 clock-names = "pcie";
293 #address-cells = <3>;
294 #size-cells = <2>;
295 reg = <0x21801000 0x2000>, <0x21800000 0x1000>, <0x02620128 4>;
296 ranges = <0x81000000 0 0 0x23250000 0 0x4000
297 0x82000000 0 0x50000000 0x50000000 0 0x10000000>;
298
299 device_type = "pci";
300 num-lanes = <2>;
301
302 #interrupt-cells = <1>;
303 interrupt-map-mask = <0 0 0 7>;
304 interrupt-map = <0 0 0 1 &pcie_intc0 0>, /* INT A */
305 <0 0 0 2 &pcie_intc0 1>, /* INT B */
306 <0 0 0 3 &pcie_intc0 2>, /* INT C */
307 <0 0 0 4 &pcie_intc0 3>; /* INT D */
308
309 pcie_msi_intc0: msi-interrupt-controller {
310 interrupt-controller;
311 #interrupt-cells = <1>;
312 interrupt-parent = <&gic>;
313 interrupts = <GIC_SPI 30 IRQ_TYPE_EDGE_RISING>,
314 <GIC_SPI 31 IRQ_TYPE_EDGE_RISING>,
315 <GIC_SPI 32 IRQ_TYPE_EDGE_RISING>,
316 <GIC_SPI 33 IRQ_TYPE_EDGE_RISING>,
317 <GIC_SPI 34 IRQ_TYPE_EDGE_RISING>,
318 <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>,
319 <GIC_SPI 36 IRQ_TYPE_EDGE_RISING>,
320 <GIC_SPI 37 IRQ_TYPE_EDGE_RISING>;
321 };
322
323 pcie_intc0: legacy-interrupt-controller {
324 interrupt-controller;
325 #interrupt-cells = <1>;
326 interrupt-parent = <&gic>;
327 interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>,
328 <GIC_SPI 27 IRQ_TYPE_EDGE_RISING>,
329 <GIC_SPI 28 IRQ_TYPE_EDGE_RISING>,
330 <GIC_SPI 29 IRQ_TYPE_EDGE_RISING>;
331 };
332 };
288 }; 333 };
289}; 334};
diff --git a/arch/arm/boot/dts/kirkwood-dir665.dts b/arch/arm/boot/dts/kirkwood-dir665.dts
new file mode 100644
index 000000000000..786959ee9cbe
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dir665.dts
@@ -0,0 +1,278 @@
1/*
2 * Copyright (C) 2014 Claudio Leite <leitec@staticky.com>
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9/dts-v1/;
10
11#include "kirkwood.dtsi"
12#include "kirkwood-6281.dtsi"
13
14/ {
15 model = "D-Link DIR-665";
16 compatible = "dlink,dir-665", "marvell,kirkwood-88f6281", "marvell,kirkwood";
17
18 memory {
19 device_type = "memory";
20 reg = <0x00000000 0x8000000>; /* 128 MB */
21 };
22
23 chosen {
24 bootargs = "console=ttyS0,115200n8 earlyprintk";
25 stdout-path = &uart0;
26 };
27
28 mbus {
29 pcie-controller {
30 status = "okay";
31
32 pcie@1,0 {
33 status = "okay";
34 };
35 };
36 };
37
38 ocp@f1000000 {
39 pinctrl: pin-controller@10000 {
40 pinctrl-0 =< &pmx_led_usb
41 &pmx_led_internet_blue
42 &pmx_led_internet_amber
43 &pmx_led_5g &pmx_led_status_blue
44 &pmx_led_wps &pmx_led_status_amber
45 &pmx_led_24g
46 &pmx_btn_restart &pmx_btn_wps>;
47 pinctrl-names = "default";
48
49 pmx_led_usb: pmx-led-usb {
50 marvell,pins = "mpp12";
51 marvell,function = "gpio";
52 };
53 pmx_led_internet_blue: pmx-led-internet-blue {
54 marvell,pins = "mpp42";
55 marvell,function = "gpio";
56 };
57 pmx_led_internet_amber: pmx-led-internet-amber {
58 marvell,pins = "mpp43";
59 marvell,function = "gpio";
60 };
61 pmx_led_5g: pmx-led-5g {
62 marvell,pins = "mpp44";
63 marvell,function = "gpio";
64 };
65 pmx_led_status_blue: pmx-led-status-blue {
66 marvell,pins = "mpp45";
67 marvell,function = "gpio";
68 };
69 pmx_led_wps: pmx-led-wps {
70 marvell,pins = "mpp47";
71 marvell,function = "gpio";
72 };
73 pmx_led_status_amber: pmx-led-status-amber {
74 marvell,pins = "mpp48";
75 marvell,function = "gpio";
76 };
77 pmx_led_24g: pmx-led-24g {
78 marvell,pins = "mpp49";
79 marvell,function = "gpio";
80 };
81 pmx_btn_restart: pmx-btn-restart {
82 marvell,pins = "mpp28";
83 marvell,function = "gpio";
84 };
85 pmx_btn_wps: pmx-btn-wps {
86 marvell,pins = "mpp46";
87 marvell,function = "gpio";
88 };
89 };
90
91 spi@10600 {
92 status = "okay";
93 m25p80@0 {
94 #address-cells = <1>;
95 #size-cells = <1>;
96 compatible = "mxicy,mx25l12805d";
97 spi-max-frequency = <50000000>;
98 reg = <0>;
99
100 partition@0 {
101 label = "uboot";
102 reg = <0x0 0x30000>;
103 read-only;
104 };
105
106 partition@30000 {
107 label = "nvram";
108 reg = <0x30000 0x10000>;
109 read-only;
110 };
111
112 partition@40000 {
113 label = "kernel";
114 reg = <0x40000 0x180000>;
115 };
116
117 partition@1c0000 {
118 label = "rootfs";
119 reg = <0x1c0000 0xe00000>;
120 };
121
122 cal_data: partition@fc0000 {
123 label = "cal_data";
124 reg = <0xfc0000 0x10000>;
125 read-only;
126 };
127
128 partition@fd0000 {
129 label = "lang_pack";
130 reg = <0xfd0000 0x30000>;
131 read-only;
132 };
133 };
134 };
135
136 serial@12000 {
137 status = "okay";
138 };
139
140 i2c@11000 {
141 status = "okay";
142 };
143
144 ehci@50000 {
145 status = "okay";
146 };
147 };
148
149 gpio-leds {
150 compatible = "gpio-leds";
151
152 blue-usb {
153 label = "dir665:blue:usb";
154 gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
155 };
156 blue-internet {
157 /* Can only be turned on if the Internet
158 * Ethernet port has Link
159 */
160 label = "dir665:blue:internet";
161 gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
162 };
163 amber-internet {
164 label = "dir665:amber:internet";
165 gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
166 };
167 blue-wifi5g {
168 label = "dir665:blue:5g";
169 gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
170 };
171 blue-status {
172 label = "dir665:blue:status";
173 gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
174 };
175 blue-wps {
176 label = "dir665:blue:wps";
177 gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
178 };
179 amber-status {
180 label = "dir665:amber:status";
181 gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
182 };
183 blue-24g {
184 label = "dir665:blue:24g";
185 gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
186 };
187 };
188
189 gpio-keys {
190 compatible = "gpio-keys";
191 #address-cells = <1>;
192 #size-cells = <0>;
193
194 reset {
195 label = "reset";
196 linux,code = <KEY_RESTART>;
197 gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
198 };
199 wps {
200 label = "wps";
201 linux,code = <KEY_WPS_BUTTON>;
202 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
203 };
204 };
205
206 dsa@0 {
207 compatible = "marvell,dsa";
208 #address-cells = <2>;
209 #size-cells = <0>;
210
211 dsa,ethernet = <&eth0port>;
212 dsa,mii-bus = <&mdio>;
213
214 switch@0 {
215 #address-cells = <1>;
216 #size-cells = <0>;
217 reg = <0 0>; /* MDIO address 0, switch 0 in tree */
218
219 port@0 {
220 reg = <0>;
221 label = "lan4";
222 };
223
224 port@1 {
225 reg = <1>;
226 label = "lan3";
227 };
228
229 port@2 {
230 reg = <2>;
231 label = "lan2";
232 };
233
234 port@3 {
235 reg = <3>;
236 label = "lan1";
237 };
238
239 port@4 {
240 reg = <4>;
241 label = "wan";
242 };
243
244 port@6 {
245 reg = <6>;
246 label = "cpu";
247 };
248 };
249 };
250};
251
252&mdio {
253 status = "okay";
254};
255
256/* eth0 is connected to a Marvell 88E6171 switch, without a PHY. So set
257 * fixed speed and duplex. */
258&eth0 {
259 status = "okay";
260
261 ethernet0-port@0 {
262 speed = <1000>;
263 duplex = <1>;
264 };
265};
266
267/* eth1 is connected to the switch as well. However DSA only supports a
268 * single CPU port. So leave this port disabled to avoid confusion. */
269
270&eth1 {
271 status = "disabled";
272};
273
274/* There is no battery on the boards, so the RTC does not keep time
275 * when there is no power, making it useless. */
276&rtc {
277 status = "disabled";
278};
diff --git a/arch/arm/boot/dts/kirkwood-synology.dtsi b/arch/arm/boot/dts/kirkwood-synology.dtsi
index 811e0971fc58..8be5b2e4626e 100644
--- a/arch/arm/boot/dts/kirkwood-synology.dtsi
+++ b/arch/arm/boot/dts/kirkwood-synology.dtsi
@@ -266,7 +266,7 @@
266 266
267 s35390a: s35390a@30 { 267 s35390a: s35390a@30 {
268 status = "disabled"; 268 status = "disabled";
269 compatible = "ssi,s35390a"; 269 compatible = "sii,s35390a";
270 reg = <0x30>; 270 reg = <0x30>;
271 }; 271 };
272 }; 272 };
diff --git a/arch/arm/boot/dts/ls1021a-qds.dts b/arch/arm/boot/dts/ls1021a-qds.dts
new file mode 100644
index 000000000000..9c5e16ba8c95
--- /dev/null
+++ b/arch/arm/boot/dts/ls1021a-qds.dts
@@ -0,0 +1,240 @@
1/*
2 * Copyright 2013-2014 Freescale Semiconductor, Inc.
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 file 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
12 * the License, or (at your option) any later version.
13 *
14 * This file 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 file; 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 "ls1021a.dtsi"
50
51/ {
52 model = "LS1021A QDS Board";
53
54 aliases {
55 enet0_rgmii_phy = &rgmii_phy1;
56 enet1_rgmii_phy = &rgmii_phy2;
57 enet2_rgmii_phy = &rgmii_phy3;
58 enet0_sgmii_phy = &sgmii_phy1c;
59 enet1_sgmii_phy = &sgmii_phy1d;
60 };
61};
62
63&dspi0 {
64 bus-num = <0>;
65 status = "okay";
66
67 dspiflash: at45db021d@0 {
68 #address-cells = <1>;
69 #size-cells = <1>;
70 compatible = "atmel,at45db021d", "atmel,at45", "atmel,dataflash";
71 spi-max-frequency = <16000000>;
72 spi-cpol;
73 spi-cpha;
74 reg = <0>;
75 };
76};
77
78&i2c0 {
79 status = "okay";
80
81 pca9547: mux@77 {
82 reg = <0x77>;
83 #address-cells = <1>;
84 #size-cells = <0>;
85
86 i2c@0 {
87 #address-cells = <1>;
88 #size-cells = <0>;
89 reg = <0x0>;
90
91 ds3232: rtc@68 {
92 compatible = "dallas,ds3232";
93 reg = <0x68>;
94 interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
95 };
96 };
97
98 i2c@2 {
99 #address-cells = <1>;
100 #size-cells = <0>;
101 reg = <0x2>;
102
103 ina220@40 {
104 compatible = "ti,ina220";
105 reg = <0x40>;
106 shunt-resistor = <1000>;
107 };
108
109 ina220@41 {
110 compatible = "ti,ina220";
111 reg = <0x41>;
112 shunt-resistor = <1000>;
113 };
114 };
115
116 i2c@3 {
117 #address-cells = <1>;
118 #size-cells = <0>;
119 reg = <0x3>;
120
121 eeprom@56 {
122 compatible = "atmel,24c512";
123 reg = <0x56>;
124 };
125
126 eeprom@57 {
127 compatible = "atmel,24c512";
128 reg = <0x57>;
129 };
130
131 adt7461a@4c {
132 compatible = "adi,adt7461a";
133 reg = <0x4c>;
134 };
135 };
136 };
137};
138
139&ifc {
140 #address-cells = <2>;
141 #size-cells = <1>;
142 /* NOR, NAND Flashes and FPGA on board */
143 ranges = <0x0 0x0 0x0 0x60000000 0x08000000
144 0x2 0x0 0x0 0x7e800000 0x00010000
145 0x3 0x0 0x0 0x7fb00000 0x00000100>;
146 status = "okay";
147
148 nor@0,0 {
149 #address-cells = <1>;
150 #size-cells = <1>;
151 compatible = "cfi-flash";
152 reg = <0x0 0x0 0x8000000>;
153 bank-width = <2>;
154 device-width = <1>;
155 };
156
157 fpga: board-control@3,0 {
158 #address-cells = <1>;
159 #size-cells = <1>;
160 compatible = "simple-bus";
161 reg = <0x3 0x0 0x0000100>;
162 bank-width = <1>;
163 device-width = <1>;
164 ranges = <0 3 0 0x100>;
165
166 mdio-mux-emi1 {
167 compatible = "mdio-mux-mmioreg";
168 mdio-parent-bus = <&mdio0>;
169 #address-cells = <1>;
170 #size-cells = <0>;
171 reg = <0x54 1>; /* BRDCFG4 */
172 mux-mask = <0xe0>; /* EMI1[2:0] */
173
174 /* Onboard PHYs */
175 ls1021amdio0: mdio@0 {
176 reg = <0>;
177 #address-cells = <1>;
178 #size-cells = <0>;
179 rgmii_phy1: ethernet-phy@1 {
180 reg = <0x1>;
181 };
182 };
183
184 ls1021amdio1: mdio@20 {
185 reg = <0x20>;
186 #address-cells = <1>;
187 #size-cells = <0>;
188 rgmii_phy2: ethernet-phy@2 {
189 reg = <0x2>;
190 };
191 };
192
193 ls1021amdio2: mdio@40 {
194 reg = <0x40>;
195 #address-cells = <1>;
196 #size-cells = <0>;
197 rgmii_phy3: ethernet-phy@3 {
198 reg = <0x3>;
199 };
200 };
201
202 ls1021amdio3: mdio@60 {
203 reg = <0x60>;
204 #address-cells = <1>;
205 #size-cells = <0>;
206 sgmii_phy1c: ethernet-phy@1c {
207 reg = <0x1c>;
208 };
209 };
210
211 ls1021amdio4: mdio@80 {
212 reg = <0x80>;
213 #address-cells = <1>;
214 #size-cells = <0>;
215 sgmii_phy1d: ethernet-phy@1d {
216 reg = <0x1d>;
217 };
218 };
219 };
220 };
221};
222
223&lpuart0 {
224 status = "okay";
225};
226
227&mdio0 {
228 tbi0: tbi-phy@8 {
229 reg = <0x8>;
230 device_type = "tbi-phy";
231 };
232};
233
234&uart0 {
235 status = "okay";
236};
237
238&uart1 {
239 status = "okay";
240};
diff --git a/arch/arm/boot/dts/ls1021a-twr.dts b/arch/arm/boot/dts/ls1021a-twr.dts
new file mode 100644
index 000000000000..a2c591e2d918
--- /dev/null
+++ b/arch/arm/boot/dts/ls1021a-twr.dts
@@ -0,0 +1,127 @@
1/*
2 * Copyright 2013-2014 Freescale Semiconductor, Inc.
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 file 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
12 * the License, or (at your option) any later version.
13 *
14 * This file 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 file; 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 "ls1021a.dtsi"
50
51/ {
52 model = "LS1021A TWR Board";
53
54 aliases {
55 enet2_rgmii_phy = &rgmii_phy1;
56 enet0_sgmii_phy = &sgmii_phy2;
57 enet1_sgmii_phy = &sgmii_phy0;
58 };
59};
60
61&dspi1 {
62 bus-num = <0>;
63 status = "okay";
64
65 dspiflash: s25fl064k@0 {
66 #address-cells = <1>;
67 #size-cells = <1>;
68 compatible = "spansion,s25fl064k";
69 spi-max-frequency = <16000000>;
70 spi-cpol;
71 spi-cpha;
72 reg = <0>;
73 };
74};
75
76&i2c0 {
77 status = "okay";
78};
79
80&i2c1 {
81 status = "okay";
82};
83
84&ifc {
85 #address-cells = <2>;
86 #size-cells = <1>;
87 /* NOR Flash on board */
88 ranges = <0x0 0x0 0x0 0x60000000 0x08000000>;
89 status = "okay";
90
91 nor@0,0 {
92 #address-cells = <1>;
93 #size-cells = <1>;
94 compatible = "cfi-flash";
95 reg = <0x0 0x0 0x8000000>;
96 bank-width = <2>;
97 device-width = <1>;
98 };
99};
100
101&lpuart0 {
102 status = "okay";
103};
104
105&mdio0 {
106 sgmii_phy0: ethernet-phy@0 {
107 reg = <0x0>;
108 };
109 rgmii_phy1: ethernet-phy@1 {
110 reg = <0x1>;
111 };
112 sgmii_phy2: ethernet-phy@2 {
113 reg = <0x2>;
114 };
115 tbi1: tbi-phy@1f {
116 reg = <0x1f>;
117 device_type = "tbi-phy";
118 };
119};
120
121&uart0 {
122 status = "okay";
123};
124
125&uart1 {
126 status = "okay";
127};
diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
new file mode 100644
index 000000000000..657da14cb4b5
--- /dev/null
+++ b/arch/arm/boot/dts/ls1021a.dtsi
@@ -0,0 +1,408 @@
1/*
2 * Copyright 2013-2014 Freescale Semiconductor, Inc.
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 file 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
12 * the License, or (at your option) any later version.
13 *
14 * This file 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 file; 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 "skeleton64.dtsi"
49#include <dt-bindings/interrupt-controller/arm-gic.h>
50
51/ {
52 compatible = "fsl,ls1021a";
53 interrupt-parent = <&gic>;
54
55 aliases {
56 serial0 = &lpuart0;
57 serial1 = &lpuart1;
58 serial2 = &lpuart2;
59 serial3 = &lpuart3;
60 serial4 = &lpuart4;
61 serial5 = &lpuart5;
62 sysclk = &sysclk;
63 };
64
65 cpus {
66 #address-cells = <1>;
67 #size-cells = <0>;
68
69 cpu@f00 {
70 compatible = "arm,cortex-a7";
71 device_type = "cpu";
72 reg = <0xf00>;
73 clocks = <&cluster1_clk>;
74 };
75
76 cpu@f01 {
77 compatible = "arm,cortex-a7";
78 device_type = "cpu";
79 reg = <0xf01>;
80 clocks = <&cluster1_clk>;
81 };
82 };
83
84 timer {
85 compatible = "arm,armv7-timer";
86 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
87 <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
88 <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
89 <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>;
90 };
91
92 pmu {
93 compatible = "arm,cortex-a7-pmu";
94 interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>,
95 <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>;
96 };
97
98 soc {
99 compatible = "simple-bus";
100 #address-cells = <2>;
101 #size-cells = <2>;
102 device_type = "soc";
103 interrupt-parent = <&gic>;
104 ranges;
105
106 gic: interrupt-controller@1400000 {
107 compatible = "arm,cortex-a7-gic";
108 #interrupt-cells = <3>;
109 interrupt-controller;
110 reg = <0x0 0x1401000 0x0 0x1000>,
111 <0x0 0x1402000 0x0 0x1000>,
112 <0x0 0x1404000 0x0 0x2000>,
113 <0x0 0x1406000 0x0 0x2000>;
114 interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
115
116 };
117
118 ifc: ifc@1530000 {
119 compatible = "fsl,ifc", "simple-bus";
120 reg = <0x0 0x1530000 0x0 0x10000>;
121 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
122 };
123
124 dcfg: dcfg@1ee0000 {
125 compatible = "fsl,ls1021a-dcfg", "syscon";
126 reg = <0x0 0x1ee0000 0x0 0x10000>;
127 big-endian;
128 };
129
130 esdhc: esdhc@1560000 {
131 compatible = "fsl,esdhc";
132 reg = <0x0 0x1560000 0x0 0x10000>;
133 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
134 clock-frequency = <0>;
135 voltage-ranges = <1800 1800 3300 3300>;
136 sdhci,auto-cmd12;
137 big-endian;
138 bus-width = <4>;
139 status = "disabled";
140 };
141
142 scfg: scfg@1570000 {
143 compatible = "fsl,ls1021a-scfg", "syscon";
144 reg = <0x0 0x1570000 0x0 0x10000>;
145 };
146
147 clockgen: clocking@1ee1000 {
148 #address-cells = <1>;
149 #size-cells = <1>;
150 ranges = <0x0 0x0 0x1ee1000 0x10000>;
151
152 sysclk: sysclk {
153 compatible = "fixed-clock";
154 #clock-cells = <0>;
155 clock-output-names = "sysclk";
156 };
157
158 cga_pll1: pll@800 {
159 compatible = "fsl,qoriq-core-pll-2.0";
160 #clock-cells = <1>;
161 reg = <0x800 0x10>;
162 clocks = <&sysclk>;
163 clock-output-names = "cga-pll1", "cga-pll1-div2",
164 "cga-pll1-div4";
165 };
166
167 platform_clk: pll@c00 {
168 compatible = "fsl,qoriq-core-pll-2.0";
169 #clock-cells = <1>;
170 reg = <0xc00 0x10>;
171 clocks = <&sysclk>;
172 clock-output-names = "platform-clk", "platform-clk-div2";
173 };
174
175 cluster1_clk: clk0c0@0 {
176 compatible = "fsl,qoriq-core-mux-2.0";
177 #clock-cells = <0>;
178 reg = <0x0 0x10>;
179 clock-names = "pll1cga", "pll1cga-div2", "pll1cga-div4";
180 clocks = <&cga_pll1 0>, <&cga_pll1 1>, <&cga_pll1 2>;
181 clock-output-names = "cluster1-clk";
182 };
183 };
184
185 dspi0: dspi@2100000 {
186 compatible = "fsl,vf610-dspi";
187 #address-cells = <1>;
188 #size-cells = <0>;
189 reg = <0x0 0x2100000 0x0 0x10000>;
190 interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
191 clock-names = "dspi";
192 clocks = <&platform_clk 1>;
193 spi-num-chipselects = <5>;
194 big-endian;
195 status = "disabled";
196 };
197
198 dspi1: dspi@2110000 {
199 compatible = "fsl,vf610-dspi";
200 #address-cells = <1>;
201 #size-cells = <0>;
202 reg = <0x0 0x2110000 0x0 0x10000>;
203 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
204 clock-names = "dspi";
205 clocks = <&platform_clk 1>;
206 spi-num-chipselects = <5>;
207 big-endian;
208 status = "disabled";
209 };
210
211 i2c0: i2c@2180000 {
212 compatible = "fsl,vf610-i2c";
213 #address-cells = <1>;
214 #size-cells = <0>;
215 reg = <0x0 0x2180000 0x0 0x10000>;
216 interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
217 clock-names = "i2c";
218 clocks = <&platform_clk 1>;
219 status = "disabled";
220 };
221
222 i2c1: i2c@2190000 {
223 compatible = "fsl,vf610-i2c";
224 #address-cells = <1>;
225 #size-cells = <0>;
226 reg = <0x0 0x2190000 0x0 0x10000>;
227 interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
228 clock-names = "i2c";
229 clocks = <&platform_clk 1>;
230 status = "disabled";
231 };
232
233 i2c2: i2c@21a0000 {
234 compatible = "fsl,vf610-i2c";
235 #address-cells = <1>;
236 #size-cells = <0>;
237 reg = <0x0 0x21a0000 0x0 0x10000>;
238 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
239 clock-names = "i2c";
240 clocks = <&platform_clk 1>;
241 status = "disabled";
242 };
243
244 uart0: serial@21c0500 {
245 compatible = "fsl,16550-FIFO64", "ns16550a";
246 reg = <0x0 0x21c0500 0x0 0x100>;
247 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
248 clock-frequency = <0>;
249 fifo-size = <15>;
250 status = "disabled";
251 };
252
253 uart1: serial@21c0600 {
254 compatible = "fsl,16550-FIFO64", "ns16550a";
255 reg = <0x0 0x21c0600 0x0 0x100>;
256 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
257 clock-frequency = <0>;
258 fifo-size = <15>;
259 status = "disabled";
260 };
261
262 uart2: serial@21d0500 {
263 compatible = "fsl,16550-FIFO64", "ns16550a";
264 reg = <0x0 0x21d0500 0x0 0x100>;
265 interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
266 clock-frequency = <0>;
267 fifo-size = <15>;
268 status = "disabled";
269 };
270
271 uart3: serial@21d0600 {
272 compatible = "fsl,16550-FIFO64", "ns16550a";
273 reg = <0x0 0x21d0600 0x0 0x100>;
274 interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
275 clock-frequency = <0>;
276 fifo-size = <15>;
277 status = "disabled";
278 };
279
280 lpuart0: serial@2950000 {
281 compatible = "fsl,ls1021a-lpuart";
282 reg = <0x0 0x2950000 0x0 0x1000>;
283 interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
284 clocks = <&sysclk>;
285 clock-names = "ipg";
286 status = "disabled";
287 };
288
289 lpuart1: serial@2960000 {
290 compatible = "fsl,ls1021a-lpuart";
291 reg = <0x0 0x2960000 0x0 0x1000>;
292 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
293 clocks = <&platform_clk 1>;
294 clock-names = "ipg";
295 status = "disabled";
296 };
297
298 lpuart2: serial@2970000 {
299 compatible = "fsl,ls1021a-lpuart";
300 reg = <0x0 0x2970000 0x0 0x1000>;
301 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
302 clocks = <&platform_clk 1>;
303 clock-names = "ipg";
304 status = "disabled";
305 };
306
307 lpuart3: serial@2980000 {
308 compatible = "fsl,ls1021a-lpuart";
309 reg = <0x0 0x2980000 0x0 0x1000>;
310 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
311 clocks = <&platform_clk 1>;
312 clock-names = "ipg";
313 status = "disabled";
314 };
315
316 lpuart4: serial@2990000 {
317 compatible = "fsl,ls1021a-lpuart";
318 reg = <0x0 0x2990000 0x0 0x1000>;
319 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
320 clocks = <&platform_clk 1>;
321 clock-names = "ipg";
322 status = "disabled";
323 };
324
325 lpuart5: serial@29a0000 {
326 compatible = "fsl,ls1021a-lpuart";
327 reg = <0x0 0x29a0000 0x0 0x1000>;
328 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
329 clocks = <&platform_clk 1>;
330 clock-names = "ipg";
331 status = "disabled";
332 };
333
334 wdog0: watchdog@2ad0000 {
335 compatible = "fsl,imx21-wdt";
336 reg = <0x0 0x2ad0000 0x0 0x10000>;
337 interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
338 clocks = <&platform_clk 1>;
339 clock-names = "wdog-en";
340 big-endian;
341 };
342
343 sai1: sai@2b50000 {
344 compatible = "fsl,vf610-sai";
345 reg = <0x0 0x2b50000 0x0 0x10000>;
346 interrupts = <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>;
347 clocks = <&platform_clk 1>;
348 clock-names = "sai";
349 dma-names = "tx", "rx";
350 dmas = <&edma0 1 47>,
351 <&edma0 1 46>;
352 big-endian;
353 status = "disabled";
354 };
355
356 sai2: sai@2b60000 {
357 compatible = "fsl,vf610-sai";
358 reg = <0x0 0x2b60000 0x0 0x10000>;
359 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
360 clocks = <&platform_clk 1>;
361 clock-names = "sai";
362 dma-names = "tx", "rx";
363 dmas = <&edma0 1 45>,
364 <&edma0 1 44>;
365 big-endian;
366 status = "disabled";
367 };
368
369 edma0: edma@2c00000 {
370 #dma-cells = <2>;
371 compatible = "fsl,vf610-edma";
372 reg = <0x0 0x2c00000 0x0 0x10000>,
373 <0x0 0x2c10000 0x0 0x10000>,
374 <0x0 0x2c20000 0x0 0x10000>;
375 interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
376 <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>;
377 interrupt-names = "edma-tx", "edma-err";
378 dma-channels = <32>;
379 big-endian;
380 clock-names = "dmamux0", "dmamux1";
381 clocks = <&platform_clk 1>,
382 <&platform_clk 1>;
383 };
384
385 mdio0: mdio@2d24000 {
386 compatible = "gianfar";
387 device_type = "mdio";
388 #address-cells = <1>;
389 #size-cells = <0>;
390 reg = <0x0 0x2d24000 0x0 0x4000>;
391 };
392
393 usb@8600000 {
394 compatible = "fsl-usb2-dr-v2.5", "fsl-usb2-dr";
395 reg = <0x0 0x8600000 0x0 0x1000>;
396 interrupts = <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>;
397 dr_mode = "host";
398 phy_type = "ulpi";
399 };
400
401 usb3@3100000 {
402 compatible = "snps,dwc3";
403 reg = <0x0 0x3100000 0x0 0x10000>;
404 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
405 dr_mode = "host";
406 };
407 };
408};
diff --git a/arch/arm/boot/dts/meson.dtsi b/arch/arm/boot/dts/meson.dtsi
index e6539ea5a711..b67ede515bcd 100644
--- a/arch/arm/boot/dts/meson.dtsi
+++ b/arch/arm/boot/dts/meson.dtsi
@@ -50,6 +50,13 @@
50/ { 50/ {
51 interrupt-parent = <&gic>; 51 interrupt-parent = <&gic>;
52 52
53 L2: l2-cache-controller@c4200000 {
54 compatible = "arm,pl310-cache";
55 reg = <0xc4200000 0x1000>;
56 cache-unified;
57 cache-level = <2>;
58 };
59
53 gic: interrupt-controller@c4301000 { 60 gic: interrupt-controller@c4301000 {
54 compatible = "arm,cortex-a9-gic"; 61 compatible = "arm,cortex-a9-gic";
55 reg = <0xc4301000 0x1000>, 62 reg = <0xc4301000 0x1000>,
@@ -106,5 +113,42 @@
106 clocks = <&clk81>; 113 clocks = <&clk81>;
107 status = "disabled"; 114 status = "disabled";
108 }; 115 };
116
117 i2c_AO: i2c@c8100500 {
118 compatible = "amlogic,meson6-i2c";
119 reg = <0xc8100500 0x20>;
120 interrupts = <0 92 1>;
121 clocks = <&clk81>;
122 #address-cells = <1>;
123 #size-cells = <0>;
124 status = "disabled";
125 };
126
127 i2c_A: i2c@c1108500 {
128 compatible = "amlogic,meson6-i2c";
129 reg = <0xc1108500 0x20>;
130 interrupts = <0 21 1>;
131 clocks = <&clk81>;
132 #address-cells = <1>;
133 #size-cells = <0>;
134 status = "disabled";
135 };
136
137 i2c_B: i2c@c11087c0 {
138 compatible = "amlogic,meson6-i2c";
139 reg = <0xc11087c0 0x20>;
140 interrupts = <0 128 1>;
141 clocks = <&clk81>;
142 #address-cells = <1>;
143 #size-cells = <0>;
144 status = "disabled";
145 };
146
147 ir_receiver: ir-receiver@c8100480 {
148 compatible= "amlogic,meson6-ir";
149 reg = <0xc8100480 0x20>;
150 interrupts = <0 15 1>;
151 status = "disabled";
152 };
109 }; 153 };
110}; /* end of / */ 154}; /* end of / */
diff --git a/arch/arm/boot/dts/meson6-atv1200.dts b/arch/arm/boot/dts/meson6-atv1200.dts
index dc2541faf1ec..d7d351a68944 100644
--- a/arch/arm/boot/dts/meson6-atv1200.dts
+++ b/arch/arm/boot/dts/meson6-atv1200.dts
@@ -50,7 +50,7 @@
50 50
51/ { 51/ {
52 model = "Geniatech ATV1200"; 52 model = "Geniatech ATV1200";
53 compatible = "geniatech,atv1200"; 53 compatible = "geniatech,atv1200", "amlogic,meson6";
54 54
55 aliases { 55 aliases {
56 serial0 = &uart_AO; 56 serial0 = &uart_AO;
diff --git a/arch/arm/boot/dts/meson6.dtsi b/arch/arm/boot/dts/meson6.dtsi
index 4ba49127779f..8b33be15af94 100644
--- a/arch/arm/boot/dts/meson6.dtsi
+++ b/arch/arm/boot/dts/meson6.dtsi
@@ -60,12 +60,14 @@
60 cpu@200 { 60 cpu@200 {
61 device_type = "cpu"; 61 device_type = "cpu";
62 compatible = "arm,cortex-a9"; 62 compatible = "arm,cortex-a9";
63 next-level-cache = <&L2>;
63 reg = <0x200>; 64 reg = <0x200>;
64 }; 65 };
65 66
66 cpu@201 { 67 cpu@201 {
67 device_type = "cpu"; 68 device_type = "cpu";
68 compatible = "arm,cortex-a9"; 69 compatible = "arm,cortex-a9";
70 next-level-cache = <&L2>;
69 reg = <0x201>; 71 reg = <0x201>;
70 }; 72 };
71 }; 73 };
diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi
new file mode 100644
index 000000000000..1f442a7fe03b
--- /dev/null
+++ b/arch/arm/boot/dts/meson8.dtsi
@@ -0,0 +1,92 @@
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 License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
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/ "meson.dtsi"
47
48/ {
49 model = "Amlogic Meson8 SoC";
50 compatible = "amlogic,meson8";
51
52 interrupt-parent = <&gic>;
53
54 cpus {
55 #address-cells = <1>;
56 #size-cells = <0>;
57
58 cpu@200 {
59 device_type = "cpu";
60 compatible = "arm,cortex-a9";
61 next-level-cache = <&L2>;
62 reg = <0x200>;
63 };
64
65 cpu@201 {
66 device_type = "cpu";
67 compatible = "arm,cortex-a9";
68 next-level-cache = <&L2>;
69 reg = <0x201>;
70 };
71
72 cpu@202 {
73 device_type = "cpu";
74 compatible = "arm,cortex-a9";
75 next-level-cache = <&L2>;
76 reg = <0x202>;
77 };
78
79 cpu@203 {
80 device_type = "cpu";
81 compatible = "arm,cortex-a9";
82 next-level-cache = <&L2>;
83 reg = <0x203>;
84 };
85 };
86
87 clk81: clk@0 {
88 #clock-cells = <0>;
89 compatible = "fixed-clock";
90 clock-frequency = <141666666>;
91 };
92}; /* end of / */
diff --git a/arch/arm/boot/dts/mt6592-evb.dts b/arch/arm/boot/dts/mt6592-evb.dts
new file mode 100644
index 000000000000..b57237e6394a
--- /dev/null
+++ b/arch/arm/boot/dts/mt6592-evb.dts
@@ -0,0 +1,26 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Howard Chen <ibanezchen@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15/dts-v1/;
16#include "mt6592.dtsi"
17
18/ {
19 model = "mt6592 evb";
20 compatible = "mediatek,mt6592-evb", "mediatek,mt6592";
21
22 memory {
23 reg = <0x80000000 0x40000000>;
24 };
25};
26
diff --git a/arch/arm/boot/dts/mt6592.dtsi b/arch/arm/boot/dts/mt6592.dtsi
new file mode 100644
index 000000000000..31e5a0979d78
--- /dev/null
+++ b/arch/arm/boot/dts/mt6592.dtsi
@@ -0,0 +1,98 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Howard Chen <ibanezchen@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/interrupt-controller/arm-gic.h>
17#include "skeleton.dtsi"
18
19/ {
20 compatible = "mediatek,mt6592";
21 interrupt-parent = <&gic>;
22
23 cpus {
24 #address-cells = <1>;
25 #size-cells = <0>;
26
27 cpu@0 {
28 device_type = "cpu";
29 compatible = "arm,cortex-a7";
30 reg = <0x0>;
31 };
32 cpu@1 {
33 device_type = "cpu";
34 compatible = "arm,cortex-a7";
35 reg = <0x1>;
36 };
37 cpu@2 {
38 device_type = "cpu";
39 compatible = "arm,cortex-a7";
40 reg = <0x2>;
41 };
42 cpu@3 {
43 device_type = "cpu";
44 compatible = "arm,cortex-a7";
45 reg = <0x3>;
46 };
47 cpu@4 {
48 device_type = "cpu";
49 compatible = "arm,cortex-a7";
50 reg = <0x4>;
51 };
52 cpu@5 {
53 device_type = "cpu";
54 compatible = "arm,cortex-a7";
55 reg = <0x5>;
56 };
57 cpu@6 {
58 device_type = "cpu";
59 compatible = "arm,cortex-a7";
60 reg = <0x6>;
61 };
62 cpu@7 {
63 device_type = "cpu";
64 compatible = "arm,cortex-a7";
65 reg = <0x7>;
66 };
67 };
68
69 system_clk: dummy13m {
70 compatible = "fixed-clock";
71 clock-frequency = <13000000>;
72 #clock-cells = <0>;
73 };
74
75 rtc_clk: dummy32k {
76 compatible = "fixed-clock";
77 clock-frequency = <32000>;
78 #clock-cells = <0>;
79 };
80
81 timer: timer@10008000 {
82 compatible = "mediatek,mt6577-timer";
83 reg = <0x10008000 0x80>;
84 interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
85 clocks = <&system_clk>, <&rtc_clk>;
86 clock-names = "system-clk", "rtc-clk";
87 };
88
89 gic: interrupt-controller@10211000 {
90 compatible = "arm,cortex-a7-gic";
91 interrupt-controller;
92 #interrupt-cells = <3>;
93 reg = <0x10211000 0x1000>,
94 <0x10212000 0x1000>;
95 };
96
97};
98
diff --git a/arch/arm/boot/dts/mt8127-moose.dts b/arch/arm/boot/dts/mt8127-moose.dts
new file mode 100644
index 000000000000..13cba0e77e08
--- /dev/null
+++ b/arch/arm/boot/dts/mt8127-moose.dts
@@ -0,0 +1,25 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Joe.C <yingjoe.chen@mediatek.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15/dts-v1/;
16#include "mt8127.dtsi"
17
18/ {
19 model = "MediaTek MT8127 Moose Board";
20 compatible = "mediatek,mt8127-moose", "mediatek,mt8127";
21
22 memory {
23 reg = <0 0x80000000 0 0x40000000>;
24 };
25};
diff --git a/arch/arm/boot/dts/mt8127.dtsi b/arch/arm/boot/dts/mt8127.dtsi
new file mode 100644
index 000000000000..b24c0a2f3c44
--- /dev/null
+++ b/arch/arm/boot/dts/mt8127.dtsi
@@ -0,0 +1,94 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Joe.C <yingjoe.chen@mediatek.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/interrupt-controller/arm-gic.h>
17#include "skeleton64.dtsi"
18
19/ {
20 compatible = "mediatek,mt8127";
21 interrupt-parent = <&gic>;
22
23 cpus {
24 #address-cells = <1>;
25 #size-cells = <0>;
26
27 cpu@0 {
28 device_type = "cpu";
29 compatible = "arm,cortex-a7";
30 reg = <0x0>;
31 };
32 cpu@1 {
33 device_type = "cpu";
34 compatible = "arm,cortex-a7";
35 reg = <0x1>;
36 };
37 cpu@2 {
38 device_type = "cpu";
39 compatible = "arm,cortex-a7";
40 reg = <0x2>;
41 };
42 cpu@3 {
43 device_type = "cpu";
44 compatible = "arm,cortex-a7";
45 reg = <0x3>;
46 };
47
48 };
49
50 clocks {
51 #address-cells = <2>;
52 #size-cells = <2>;
53 compatible = "simple-bus";
54 ranges;
55
56 system_clk: dummy13m {
57 compatible = "fixed-clock";
58 clock-frequency = <13000000>;
59 #clock-cells = <0>;
60 };
61
62 rtc_clk: dummy32k {
63 compatible = "fixed-clock";
64 clock-frequency = <32000>;
65 #clock-cells = <0>;
66 };
67 };
68
69 soc {
70 #address-cells = <2>;
71 #size-cells = <2>;
72 compatible = "simple-bus";
73 ranges;
74
75 timer: timer@10008000 {
76 compatible = "mediatek,mt8127-timer",
77 "mediatek,mt6577-timer";
78 reg = <0 0x10008000 0 0x80>;
79 interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
80 clocks = <&system_clk>, <&rtc_clk>;
81 clock-names = "system-clk", "rtc-clk";
82 };
83
84 gic: interrupt-controller@10211000 {
85 compatible = "arm,cortex-a7-gic";
86 interrupt-controller;
87 #interrupt-cells = <3>;
88 reg = <0 0x10211000 0 0x1000>,
89 <0 0x10212000 0 0x1000>,
90 <0 0x10214000 0 0x2000>,
91 <0 0x10216000 0 0x2000>;
92 };
93 };
94};
diff --git a/arch/arm/boot/dts/mt8135-evbp1.dts b/arch/arm/boot/dts/mt8135-evbp1.dts
new file mode 100644
index 000000000000..a5adf9742308
--- /dev/null
+++ b/arch/arm/boot/dts/mt8135-evbp1.dts
@@ -0,0 +1,25 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Joe.C <yingjoe.chen@mediatek.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15/dts-v1/;
16#include "mt8135.dtsi"
17
18/ {
19 model = "MediaTek MT8135 evaluation board";
20 compatible = "mediatek,mt8135-evbp1", "mediatek,mt8135";
21
22 memory {
23 reg = <0 0x80000000 0 0x40000000>;
24 };
25};
diff --git a/arch/arm/boot/dts/mt8135.dtsi b/arch/arm/boot/dts/mt8135.dtsi
new file mode 100644
index 000000000000..7d56a986358e
--- /dev/null
+++ b/arch/arm/boot/dts/mt8135.dtsi
@@ -0,0 +1,116 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Joe.C <yingjoe.chen@mediatek.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/interrupt-controller/arm-gic.h>
17#include "skeleton64.dtsi"
18
19/ {
20 compatible = "mediatek,mt8135";
21 interrupt-parent = <&gic>;
22
23 cpu-map {
24 cluster0 {
25 core0 {
26 cpu = <&cpu0>;
27 };
28 core1 {
29 cpu = <&cpu1>;
30 };
31 };
32
33 cluster1 {
34 core0 {
35 cpu = <&cpu2>;
36 };
37 core1 {
38 cpu = <&cpu3>;
39 };
40 };
41 };
42
43 cpus {
44 #address-cells = <1>;
45 #size-cells = <0>;
46
47 cpu0: cpu@0 {
48 device_type = "cpu";
49 compatible = "arm,cortex-a7";
50 reg = <0x000>;
51 };
52
53 cpu1: cpu@1 {
54 device_type = "cpu";
55 compatible = "arm,cortex-a7";
56 reg = <0x001>;
57 };
58
59 cpu2: cpu@100 {
60 device_type = "cpu";
61 compatible = "arm,cortex-a15";
62 reg = <0x100>;
63 };
64
65 cpu3: cpu@101 {
66 device_type = "cpu";
67 compatible = "arm,cortex-a15";
68 reg = <0x101>;
69 };
70 };
71
72 clocks {
73 #address-cells = <2>;
74 #size-cells = <2>;
75 compatible = "simple-bus";
76 ranges;
77
78 system_clk: dummy13m {
79 compatible = "fixed-clock";
80 clock-frequency = <13000000>;
81 #clock-cells = <0>;
82 };
83
84 rtc_clk: dummy32k {
85 compatible = "fixed-clock";
86 clock-frequency = <32000>;
87 #clock-cells = <0>;
88 };
89 };
90
91 soc {
92 #address-cells = <2>;
93 #size-cells = <2>;
94 compatible = "simple-bus";
95 ranges;
96
97 timer: timer@10008000 {
98 compatible = "mediatek,mt8135-timer",
99 "mediatek,mt6577-timer";
100 reg = <0 0x10008000 0 0x80>;
101 interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
102 clocks = <&system_clk>, <&rtc_clk>;
103 clock-names = "system-clk", "rtc-clk";
104 };
105
106 gic: interrupt-controller@10211000 {
107 compatible = "arm,cortex-a15-gic";
108 interrupt-controller;
109 #interrupt-cells = <3>;
110 reg = <0 0x10211000 0 0x1000>,
111 <0 0x10212000 0 0x1000>,
112 <0 0x10214000 0 0x2000>,
113 <0 0x10216000 0 0x2000>;
114 };
115 };
116};
diff --git a/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi b/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
index 521c587acaee..445fafc73254 100644
--- a/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
+++ b/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
@@ -23,24 +23,29 @@
23 ethernet@gpmc { 23 ethernet@gpmc {
24 compatible = "smsc,lan9221", "smsc,lan9115"; 24 compatible = "smsc,lan9221", "smsc,lan9115";
25 bank-width = <2>; 25 bank-width = <2>;
26 gpmc,mux-add-data; 26 gpmc,device-width = <1>;
27 gpmc,cs-on-ns = <1>; 27 gpmc,cycle2cycle-samecsen = <1>;
28 gpmc,cs-rd-off-ns = <180>; 28 gpmc,cycle2cycle-diffcsen = <1>;
29 gpmc,cs-wr-off-ns = <180>; 29 gpmc,cs-on-ns = <5>;
30 gpmc,adv-rd-off-ns = <18>; 30 gpmc,cs-rd-off-ns = <150>;
31 gpmc,adv-wr-off-ns = <48>; 31 gpmc,cs-wr-off-ns = <150>;
32 gpmc,oe-on-ns = <54>; 32 gpmc,adv-on-ns = <0>;
33 gpmc,oe-off-ns = <168>; 33 gpmc,adv-rd-off-ns = <15>;
34 gpmc,we-on-ns = <54>; 34 gpmc,adv-wr-off-ns = <40>;
35 gpmc,we-off-ns = <168>; 35 gpmc,oe-on-ns = <45>;
36 gpmc,rd-cycle-ns = <186>; 36 gpmc,oe-off-ns = <140>;
37 gpmc,wr-cycle-ns = <186>; 37 gpmc,we-on-ns = <45>;
38 gpmc,access-ns = <144>; 38 gpmc,we-off-ns = <140>;
39 gpmc,page-burst-access-ns = <24>; 39 gpmc,rd-cycle-ns = <155>;
40 gpmc,bus-turnaround-ns = <90>; 40 gpmc,wr-cycle-ns = <155>;
41 gpmc,cycle2cycle-delay-ns = <90>; 41 gpmc,access-ns = <120>;
42 gpmc,cycle2cycle-samecsen; 42 gpmc,page-burst-access-ns = <20>;
43 gpmc,cycle2cycle-diffcsen; 43 gpmc,bus-turnaround-ns = <75>;
44 gpmc,cycle2cycle-delay-ns = <75>;
45 gpmc,wait-monitoring-ns = <0>;
46 gpmc,clk-activation-ns = <0>;
47 gpmc,wr-data-mux-bus-ns = <0>;
48 gpmc,wr-access-ns = <0>;
44 vddvario-supply = <&vddvario>; 49 vddvario-supply = <&vddvario>;
45 vdd33a-supply = <&vdd33a>; 50 vdd33a-supply = <&vdd33a>;
46 reg-io-width = <4>; 51 reg-io-width = <4>;
diff --git a/arch/arm/boot/dts/omap-zoom-common.dtsi b/arch/arm/boot/dts/omap-zoom-common.dtsi
index 68221fab978d..46ef3e443861 100644
--- a/arch/arm/boot/dts/omap-zoom-common.dtsi
+++ b/arch/arm/boot/dts/omap-zoom-common.dtsi
@@ -5,7 +5,7 @@
5#include "omap-gpmc-smsc911x.dtsi" 5#include "omap-gpmc-smsc911x.dtsi"
6 6
7&gpmc { 7&gpmc {
8 ranges = <3 0 0x10000000 0x00000400>, 8 ranges = <3 0 0x10000000 0x1000000>, /* CS3: 16MB for UART */
9 <7 0 0x2c000000 0x01000000>; 9 <7 0 0x2c000000 0x01000000>;
10 10
11 /* 11 /*
@@ -15,7 +15,65 @@
15 */ 15 */
16 uart@3,0 { 16 uart@3,0 {
17 compatible = "ns16550a"; 17 compatible = "ns16550a";
18 reg = <3 0 0x100>; 18 reg = <3 0 8>; /* CS3, offset 0, IO size 8 */
19 bank-width = <2>;
20 reg-shift = <1>;
21 reg-io-width = <1>;
22 interrupt-parent = <&gpio4>;
23 interrupts = <6 IRQ_TYPE_EDGE_RISING>; /* gpio102 */
24 clock-frequency = <1843200>;
25 current-speed = <115200>;
26 gpmc,mux-add-data = <0>;
27 gpmc,device-width = <1>;
28 gpmc,wait-pin = <1>;
29 gpmc,cycle2cycle-samecsen = <1>;
30 gpmc,cycle2cycle-diffcsen = <1>;
31 gpmc,cs-on-ns = <5>;
32 gpmc,cs-rd-off-ns = <155>;
33 gpmc,cs-wr-off-ns = <155>;
34 gpmc,adv-on-ns = <15>;
35 gpmc,adv-rd-off-ns = <40>;
36 gpmc,adv-wr-off-ns = <40>;
37 gpmc,oe-on-ns = <45>;
38 gpmc,oe-off-ns = <145>;
39 gpmc,we-on-ns = <45>;
40 gpmc,we-off-ns = <145>;
41 gpmc,rd-cycle-ns = <155>;
42 gpmc,wr-cycle-ns = <155>;
43 gpmc,access-ns = <145>;
44 gpmc,page-burst-access-ns = <20>;
45 gpmc,bus-turnaround-ns = <20>;
46 gpmc,cycle2cycle-delay-ns = <20>;
47 gpmc,wait-monitoring-ns = <0>;
48 gpmc,clk-activation-ns = <0>;
49 gpmc,wr-data-mux-bus-ns = <45>;
50 gpmc,wr-access-ns = <145>;
51 };
52 uart@3,1 {
53 compatible = "ns16550a";
54 reg = <3 0x100 8>; /* CS3, offset 0x100, IO size 8 */
55 bank-width = <2>;
56 reg-shift = <1>;
57 reg-io-width = <1>;
58 interrupt-parent = <&gpio4>;
59 interrupts = <6 IRQ_TYPE_EDGE_RISING>; /* gpio102 */
60 clock-frequency = <1843200>;
61 current-speed = <115200>;
62 };
63 uart@3,2 {
64 compatible = "ns16550a";
65 reg = <3 0x200 8>; /* CS3, offset 0x200, IO size 8 */
66 bank-width = <2>;
67 reg-shift = <1>;
68 reg-io-width = <1>;
69 interrupt-parent = <&gpio4>;
70 interrupts = <6 IRQ_TYPE_EDGE_RISING>; /* gpio102 */
71 clock-frequency = <1843200>;
72 current-speed = <115200>;
73 };
74 uart@3,3 {
75 compatible = "ns16550a";
76 reg = <3 0x300 8>; /* CS3, offset 0x300, IO size 8 */
19 bank-width = <2>; 77 bank-width = <2>;
20 reg-shift = <1>; 78 reg-shift = <1>;
21 reg-io-width = <1>; 79 reg-io-width = <1>;
diff --git a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
index 24c50db2a478..c9f1e93a95ae 100644
--- a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
+++ b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
@@ -40,14 +40,14 @@
40}; 40};
41 41
42&gpmc { 42&gpmc {
43 ranges = <0 0 0x04000000 0x10000000>; 43 ranges = <0 0 0x04000000 0x1000000>; /* CS0: 16MB for OneNAND */
44 44
45 /* gpio-irq for dma: 26 */ 45 /* gpio-irq for dma: 26 */
46 46
47 onenand@0,0 { 47 onenand@0,0 {
48 #address-cells = <1>; 48 #address-cells = <1>;
49 #size-cells = <1>; 49 #size-cells = <1>;
50 reg = <0 0 0x10000000>; 50 reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */
51 51
52 gpmc,sync-read; 52 gpmc,sync-read;
53 gpmc,burst-length = <16>; 53 gpmc,burst-length = <16>;
diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
index ae89aad01595..e2b2e93d7b61 100644
--- a/arch/arm/boot/dts/omap2420.dtsi
+++ b/arch/arm/boot/dts/omap2420.dtsi
@@ -157,6 +157,7 @@
157 interrupts = <26>, <34>; 157 interrupts = <26>, <34>;
158 interrupt-names = "dsp", "iva"; 158 interrupt-names = "dsp", "iva";
159 ti,hwmods = "mailbox"; 159 ti,hwmods = "mailbox";
160 #mbox-cells = <1>;
160 ti,mbox-num-users = <4>; 161 ti,mbox-num-users = <4>;
161 ti,mbox-num-fifos = <6>; 162 ti,mbox-num-fifos = <6>;
162 mbox_dsp: dsp { 163 mbox_dsp: dsp {
diff --git a/arch/arm/boot/dts/omap2430-sdp.dts b/arch/arm/boot/dts/omap2430-sdp.dts
index 2c90d29b4cad..05eca2e4430f 100644
--- a/arch/arm/boot/dts/omap2430-sdp.dts
+++ b/arch/arm/boot/dts/omap2430-sdp.dts
@@ -43,7 +43,31 @@
43 interrupts = <21 IRQ_TYPE_LEVEL_LOW>; /* gpio149 */ 43 interrupts = <21 IRQ_TYPE_LEVEL_LOW>; /* gpio149 */
44 reg = <5 0x300 0xf>; 44 reg = <5 0x300 0xf>;
45 bank-width = <2>; 45 bank-width = <2>;
46 gpmc,mux-add-data; 46 gpmc,sync-clk-ps = <0>;
47 }; 47 gpmc,mux-add-data = <2>;
48 gpmc,device-width = <1>;
49 gpmc,cycle2cycle-samecsen = <1>;
50 gpmc,cycle2cycle-diffcsen = <1>;
51 gpmc,cs-on-ns = <7>;
52 gpmc,cs-rd-off-ns = <233>;
53 gpmc,cs-wr-off-ns = <233>;
54 gpmc,adv-on-ns = <22>;
55 gpmc,adv-rd-off-ns = <60>;
56 gpmc,adv-wr-off-ns = <60>;
57 gpmc,oe-on-ns = <67>;
58 gpmc,oe-off-ns = <210>;
59 gpmc,we-on-ns = <67>;
60 gpmc,we-off-ns = <210>;
61 gpmc,rd-cycle-ns = <233>;
62 gpmc,wr-cycle-ns = <233>;
63 gpmc,access-ns = <233>;
64 gpmc,page-burst-access-ns = <30>;
65 gpmc,bus-turnaround-ns = <30>;
66 gpmc,cycle2cycle-delay-ns = <30>;
67 gpmc,wait-monitoring-ns = <0>;
68 gpmc,clk-activation-ns = <0>;
69 gpmc,wr-data-mux-bus-ns = <0>;
70 gpmc,wr-access-ns = <0>;
71 };
48}; 72};
49 73
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index b56d71611026..0dc8de2782b1 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -247,6 +247,7 @@
247 reg = <0x48094000 0x200>; 247 reg = <0x48094000 0x200>;
248 interrupts = <26>; 248 interrupts = <26>;
249 ti,hwmods = "mailbox"; 249 ti,hwmods = "mailbox";
250 #mbox-cells = <1>;
250 ti,mbox-num-users = <4>; 251 ti,mbox-num-users = <4>;
251 ti,mbox-num-fifos = <6>; 252 ti,mbox-num-fifos = <6>;
252 mbox_dsp: dsp { 253 mbox_dsp: dsp {
diff --git a/arch/arm/boot/dts/omap3-cm-t3517.dts b/arch/arm/boot/dts/omap3-cm-t3517.dts
index d00502f4fd9b..0ab748cf7749 100644
--- a/arch/arm/boot/dts/omap3-cm-t3517.dts
+++ b/arch/arm/boot/dts/omap3-cm-t3517.dts
@@ -134,3 +134,14 @@
134 bus-width = <4>; 134 bus-width = <4>;
135 cap-power-off-card; 135 cap-power-off-card;
136}; 136};
137
138&dss {
139 status = "ok";
140
141 pinctrl-names = "default";
142 pinctrl-0 = <
143 &dss_dpi_pins_common
144 &dss_dpi_pins_cm_t35x
145 >;
146};
147
diff --git a/arch/arm/boot/dts/omap3-cm-t3530.dts b/arch/arm/boot/dts/omap3-cm-t3530.dts
index d1458496520e..8dd14fcf6825 100644
--- a/arch/arm/boot/dts/omap3-cm-t3530.dts
+++ b/arch/arm/boot/dts/omap3-cm-t3530.dts
@@ -46,3 +46,14 @@
46 bus-width = <4>; 46 bus-width = <4>;
47 cap-power-off-card; 47 cap-power-off-card;
48}; 48};
49
50&dss {
51 status = "ok";
52
53 pinctrl-names = "default";
54 pinctrl-0 = <
55 &dss_dpi_pins_common
56 &dss_dpi_pins_cm_t35x
57 >;
58};
59
diff --git a/arch/arm/boot/dts/omap3-cm-t3730.dts b/arch/arm/boot/dts/omap3-cm-t3730.dts
index b3f9a50b3bc8..46eadb21b5ef 100644
--- a/arch/arm/boot/dts/omap3-cm-t3730.dts
+++ b/arch/arm/boot/dts/omap3-cm-t3730.dts
@@ -31,6 +31,19 @@
31 }; 31 };
32}; 32};
33 33
34&omap3_pmx_wkup {
35 dss_dpi_pins_cm_t3730: pinmux_dss_dpi_pins_cm_t3730 {
36 pinctrl-single,pins = <
37 OMAP3_WKUP_IOPAD(0x2a08, PIN_OUTPUT | MUX_MODE3) /* sys_boot0.dss_data18 */
38 OMAP3_WKUP_IOPAD(0x2a0c, PIN_OUTPUT | MUX_MODE3) /* sys_boot1.dss_data19 */
39 OMAP3_WKUP_IOPAD(0x2a10, PIN_OUTPUT | MUX_MODE3) /* sys_boot3.dss_data20 */
40 OMAP3_WKUP_IOPAD(0x2a12, PIN_OUTPUT | MUX_MODE3) /* sys_boot4.dss_data21 */
41 OMAP3_WKUP_IOPAD(0x2a14, PIN_OUTPUT | MUX_MODE3) /* sys_boot5.dss_data22 */
42 OMAP3_WKUP_IOPAD(0x2a16, PIN_OUTPUT | MUX_MODE3) /* sys_boot6.dss_data23 */
43 >;
44 };
45};
46
34&omap3_pmx_core { 47&omap3_pmx_core {
35 48
36 mmc2_pins: pinmux_mmc2_pins { 49 mmc2_pins: pinmux_mmc2_pins {
@@ -61,3 +74,14 @@
61 bus-width = <4>; 74 bus-width = <4>;
62 cap-power-off-card; 75 cap-power-off-card;
63}; 76};
77
78&dss {
79 status = "ok";
80
81 pinctrl-names = "default";
82 pinctrl-0 = <
83 &dss_dpi_pins_common
84 &dss_dpi_pins_cm_t3730
85 >;
86};
87
diff --git a/arch/arm/boot/dts/omap3-cm-t3x.dtsi b/arch/arm/boot/dts/omap3-cm-t3x.dtsi
index c671a2299ea8..6ea6d460db30 100644
--- a/arch/arm/boot/dts/omap3-cm-t3x.dtsi
+++ b/arch/arm/boot/dts/omap3-cm-t3x.dtsi
@@ -49,6 +49,24 @@
49 compatible = "usb-nop-xceiv"; 49 compatible = "usb-nop-xceiv";
50 vcc-supply = <&hsusb2_power>; 50 vcc-supply = <&hsusb2_power>;
51 }; 51 };
52
53 ads7846reg: ads7846-reg {
54 compatible = "regulator-fixed";
55 regulator-name = "ads7846-reg";
56 regulator-min-microvolt = <3300000>;
57 regulator-max-microvolt = <3300000>;
58 };
59
60 tv0: connector@1 {
61 compatible = "svideo-connector";
62 label = "tv";
63
64 port {
65 tv_connector_in: endpoint {
66 remote-endpoint = <&venc_out>;
67 };
68 };
69 };
52}; 70};
53 71
54&omap3_pmx_core { 72&omap3_pmx_core {
@@ -76,6 +94,76 @@
76 OMAP3_CORE1_IOPAD(0x21e2, PIN_OUTPUT | MUX_MODE4) /* sys_clkout2.gpio_186 */ 94 OMAP3_CORE1_IOPAD(0x21e2, PIN_OUTPUT | MUX_MODE4) /* sys_clkout2.gpio_186 */
77 >; 95 >;
78 }; 96 };
97
98 dss_dpi_pins_common: pinmux_dss_dpi_pins_common {
99 pinctrl-single,pins = <
100 OMAP3_CORE1_IOPAD(0x20d4, PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */
101 OMAP3_CORE1_IOPAD(0x20d6, PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */
102 OMAP3_CORE1_IOPAD(0x20d8, PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */
103 OMAP3_CORE1_IOPAD(0x20da, PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */
104
105 OMAP3_CORE1_IOPAD(0x20e8, PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */
106 OMAP3_CORE1_IOPAD(0x20ea, PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */
107 OMAP3_CORE1_IOPAD(0x20ec, PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */
108 OMAP3_CORE1_IOPAD(0x20ee, PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */
109 OMAP3_CORE1_IOPAD(0x20f0, PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */
110 OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */
111 OMAP3_CORE1_IOPAD(0x20f4, PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */
112 OMAP3_CORE1_IOPAD(0x20f6, PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */
113 OMAP3_CORE1_IOPAD(0x20f8, PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */
114 OMAP3_CORE1_IOPAD(0x20fa, PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */
115 OMAP3_CORE1_IOPAD(0x20fc, PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */
116 OMAP3_CORE1_IOPAD(0x20fe, PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */
117 OMAP3_CORE1_IOPAD(0x2100, PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */
118 OMAP3_CORE1_IOPAD(0x2102, PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */
119 OMAP3_CORE1_IOPAD(0x2104, PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */
120 OMAP3_CORE1_IOPAD(0x2106, PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */
121 OMAP3_CORE1_IOPAD(0x2108, PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */
122 OMAP3_CORE1_IOPAD(0x210a, PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */
123 >;
124 };
125
126 dss_dpi_pins_cm_t35x: pinmux_dss_dpi_pins_cm_t35x {
127 pinctrl-single,pins = <
128 OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */
129 OMAP3_CORE1_IOPAD(0x20de, PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */
130 OMAP3_CORE1_IOPAD(0x20e0, PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */
131 OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */
132 OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */
133 OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */
134 >;
135 };
136
137 ads7846_pins: pinmux_ads7846_pins {
138 pinctrl-single,pins = <
139 OMAP3_CORE1_IOPAD(0x20ba, PIN_INPUT_PULLUP | MUX_MODE4) /* gpmc_ncs6.gpio_57 */
140 >;
141 };
142
143 mcspi1_pins: pinmux_mcspi1_pins {
144 pinctrl-single,pins = <
145 OMAP3_CORE1_IOPAD(0x21c8, PIN_INPUT | MUX_MODE0) /* mcspi1_clk */
146 OMAP3_CORE1_IOPAD(0x21ca, PIN_INPUT | MUX_MODE0) /* mcspi1_simo */
147 OMAP3_CORE1_IOPAD(0x21cc, PIN_INPUT | MUX_MODE0) /* mcspi1_somi */
148 OMAP3_CORE1_IOPAD(0x21ce, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcspi1_cs0 */
149 >;
150 };
151
152 i2c1_pins: pinmux_i2c1_pins {
153 pinctrl-single,pins = <
154 OMAP3_CORE1_IOPAD(0x21ba, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */
155 OMAP3_CORE1_IOPAD(0x21bc, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */
156 >;
157 };
158
159 mcbsp2_pins: pinmux_mcbsp2_pins {
160 pinctrl-single,pins = <
161 OMAP3_CORE1_IOPAD(0x213c, PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx */
162 OMAP3_CORE1_IOPAD(0x213e, PIN_INPUT | MUX_MODE0) /* mcbsp2_clkx */
163 OMAP3_CORE1_IOPAD(0x2140, PIN_INPUT | MUX_MODE0) /* mcbsp2_dr */
164 OMAP3_CORE1_IOPAD(0x2142, PIN_OUTPUT | MUX_MODE0) /* mcbsp2_dx */
165 >;
166 };
79}; 167};
80 168
81&uart3 { 169&uart3 {
@@ -94,12 +182,22 @@
94}; 182};
95 183
96&i2c1 { 184&i2c1 {
185 pinctrl-names = "default";
186 pinctrl-0 = <&i2c1_pins>;
187
97 clock-frequency = <400000>; 188 clock-frequency = <400000>;
189
190 at24@50 {
191 compatible = "at24,24c02";
192 pagesize = <16>;
193 reg = <0x50>;
194 };
98}; 195};
99 196
100&i2c3 { 197&i2c3 {
101 clock-frequency = <400000>; 198 clock-frequency = <400000>;
102}; 199};
200
103&usbhshost { 201&usbhshost {
104 port1-mode = "ehci-phy"; 202 port1-mode = "ehci-phy";
105 port2-mode = "ehci-phy"; 203 port2-mode = "ehci-phy";
@@ -108,3 +206,56 @@
108&usbhsehci { 206&usbhsehci {
109 phys = <&hsusb1_phy &hsusb2_phy>; 207 phys = <&hsusb1_phy &hsusb2_phy>;
110}; 208};
209
210&mcspi1 {
211 pinctrl-names = "default";
212 pinctrl-0 = <&mcspi1_pins>;
213
214 /* touch controller */
215 ads7846@0 {
216 pinctrl-names = "default";
217 pinctrl-0 = <&ads7846_pins>;
218
219 compatible = "ti,ads7846";
220 vcc-supply = <&ads7846reg>;
221
222 reg = <0>; /* CS0 */
223 spi-max-frequency = <1500000>;
224
225 interrupt-parent = <&gpio2>;
226 interrupts = <25 0>; /* gpio_57 */
227 pendown-gpio = <&gpio2 25 0>;
228
229 ti,x-min = /bits/ 16 <0x0>;
230 ti,x-max = /bits/ 16 <0x0fff>;
231 ti,y-min = /bits/ 16 <0x0>;
232 ti,y-max = /bits/ 16 <0x0fff>;
233
234 ti,x-plate-ohms = /bits/ 16 <180>;
235 ti,pressure-max = /bits/ 16 <255>;
236
237 ti,debounce-max = /bits/ 16 <30>;
238 ti,debounce-tol = /bits/ 16 <10>;
239 ti,debounce-rep = /bits/ 16 <1>;
240
241 linux,wakeup;
242 };
243};
244
245&venc {
246 status = "ok";
247
248 port {
249 venc_out: endpoint {
250 remote-endpoint = <&tv_connector_in>;
251 ti,channels = <2>;
252 };
253 };
254};
255
256&mcbsp2 {
257 status = "ok";
258
259 pinctrl-names = "default";
260 pinctrl-0 = <&mcbsp2_pins>;
261};
diff --git a/arch/arm/boot/dts/omap3-cm-t3x30.dtsi b/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
index 25ba08331d88..9a4a3ab9af78 100644
--- a/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
+++ b/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
@@ -10,6 +10,14 @@
10 cpu0-supply = <&vcc>; 10 cpu0-supply = <&vcc>;
11 }; 11 };
12 }; 12 };
13
14 sound {
15 compatible = "ti,omap-twl4030";
16 ti,model = "cm-t35";
17
18 ti,mcbsp = <&mcbsp2>;
19 ti,codec = <&twl_audio>;
20 };
13}; 21};
14 22
15&omap3_pmx_core { 23&omap3_pmx_core {
@@ -59,11 +67,22 @@
59 reg = <0x48>; 67 reg = <0x48>;
60 interrupts = <7>; /* SYS_NIRQ cascaded to intc */ 68 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
61 interrupt-parent = <&intc>; 69 interrupt-parent = <&intc>;
70
71 twl_audio: audio {
72 compatible = "ti,twl4030-audio";
73 codec {
74 };
75 };
62 }; 76 };
63}; 77};
64 78
65#include "twl4030.dtsi" 79#include "twl4030.dtsi"
66#include "twl4030_omap3.dtsi" 80#include "twl4030_omap3.dtsi"
81#include <dt-bindings/input/input.h>
82
83&venc {
84 vdda-supply = <&vdac>;
85};
67 86
68&mmc1 { 87&mmc1 {
69 vmmc-supply = <&vmmc1>; 88 vmmc-supply = <&vmmc1>;
@@ -75,6 +94,22 @@
75 ti,pullups = <0x000001>; 94 ti,pullups = <0x000001>;
76}; 95};
77 96
97&twl_keypad {
98 linux,keymap = <
99 MATRIX_KEY(0x00, 0x01, KEY_A)
100 MATRIX_KEY(0x00, 0x02, KEY_B)
101 MATRIX_KEY(0x00, 0x03, KEY_LEFT)
102
103 MATRIX_KEY(0x01, 0x01, KEY_UP)
104 MATRIX_KEY(0x01, 0x02, KEY_ENTER)
105 MATRIX_KEY(0x01, 0x03, KEY_DOWN)
106
107 MATRIX_KEY(0x02, 0x01, KEY_RIGHT)
108 MATRIX_KEY(0x02, 0x02, KEY_C)
109 MATRIX_KEY(0x02, 0x03, KEY_D)
110 >;
111};
112
78&hsusb1_phy { 113&hsusb1_phy {
79 reset-gpios = <&twl_gpio 6 GPIO_ACTIVE_LOW>; 114 reset-gpios = <&twl_gpio 6 GPIO_ACTIVE_LOW>;
80}; 115};
diff --git a/arch/arm/boot/dts/omap3-devkit8000.dts b/arch/arm/boot/dts/omap3-devkit8000.dts
index da402f0fdab4..169037e5ff53 100644
--- a/arch/arm/boot/dts/omap3-devkit8000.dts
+++ b/arch/arm/boot/dts/omap3-devkit8000.dts
@@ -106,10 +106,10 @@
106}; 106};
107 107
108&gpmc { 108&gpmc {
109 ranges = <0 0 0x30000000 0x04>; /* CS0: NAND */ 109 ranges = <0 0 0x30000000 0x1000000>; /* CS0: 16MB for NAND */
110 110
111 nand@0,0 { 111 nand@0,0 {
112 reg = <0 0 0>; /* CS0, offset 0 */ 112 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
113 nand-bus-width = <16>; 113 nand-bus-width = <16>;
114 114
115 gpmc,sync-clk-ps = <0>; 115 gpmc,sync-clk-ps = <0>;
diff --git a/arch/arm/boot/dts/omap3-evm-37xx.dts b/arch/arm/boot/dts/omap3-evm-37xx.dts
index a8bd4349c7d2..16e8ce350dda 100644
--- a/arch/arm/boot/dts/omap3-evm-37xx.dts
+++ b/arch/arm/boot/dts/omap3-evm-37xx.dts
@@ -154,13 +154,14 @@
154}; 154};
155 155
156&gpmc { 156&gpmc {
157 ranges = <0 0 0x00000000 0x20000000>, 157 ranges = <0 0 0x00000000 0x1000000>, /* CS0: 16MB for NAND */
158 <5 0 0x2c000000 0x01000000>; 158 <5 0 0x2c000000 0x01000000>;
159 159
160 nand@0,0 { 160 nand@0,0 {
161 linux,mtd-name= "hynix,h8kds0un0mer-4em"; 161 linux,mtd-name= "hynix,h8kds0un0mer-4em";
162 reg = <0 0 0>; 162 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
163 nand-bus-width = <16>; 163 nand-bus-width = <16>;
164 gpmc,device-width = <2>;
164 ti,nand-ecc-opt = "bch8"; 165 ti,nand-ecc-opt = "bch8";
165 166
166 gpmc,sync-clk-ps = <0>; 167 gpmc,sync-clk-ps = <0>;
diff --git a/arch/arm/boot/dts/omap3-evm-common.dtsi b/arch/arm/boot/dts/omap3-evm-common.dtsi
index c8747c7f1cc8..127f3e7c10c4 100644
--- a/arch/arm/boot/dts/omap3-evm-common.dtsi
+++ b/arch/arm/boot/dts/omap3-evm-common.dtsi
@@ -2,6 +2,7 @@
2 * Common support for omap3 EVM boards 2 * Common support for omap3 EVM boards
3 */ 3 */
4 4
5#include <dt-bindings/input/input.h>
5#include "omap-gpmc-smsc911x.dtsi" 6#include "omap-gpmc-smsc911x.dtsi"
6 7
7/ { 8/ {
@@ -111,6 +112,26 @@
111 ti,use-leds; 112 ti,use-leds;
112}; 113};
113 114
115&twl_keypad {
116 linux,keymap = <
117 MATRIX_KEY(2, 2, KEY_1)
118 MATRIX_KEY(1, 1, KEY_2)
119 MATRIX_KEY(0, 0, KEY_3)
120 MATRIX_KEY(3, 2, KEY_4)
121 MATRIX_KEY(2, 1, KEY_5)
122 MATRIX_KEY(1, 0, KEY_6)
123 MATRIX_KEY(1, 3, KEY_7)
124 MATRIX_KEY(3, 1, KEY_8)
125 MATRIX_KEY(2, 0, KEY_9)
126 MATRIX_KEY(2, 3, KEY_KPASTERISK)
127 MATRIX_KEY(0, 2, KEY_0)
128 MATRIX_KEY(3, 0, KEY_KPDOT)
129 /* s4 not wired */
130 MATRIX_KEY(1, 2, KEY_BACKSPACE)
131 MATRIX_KEY(0, 1, KEY_ENTER)
132 >;
133};
134
114&usb_otg_hs { 135&usb_otg_hs {
115 interface-type = <0>; 136 interface-type = <0>;
116 usb-phy = <&usb2_phy>; 137 usb-phy = <&usb2_phy>;
diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
index fd34f913ace3..655d6e920a86 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -104,67 +104,67 @@
104 104
105 uart1_pins: pinmux_uart1_pins { 105 uart1_pins: pinmux_uart1_pins {
106 pinctrl-single,pins = < 106 pinctrl-single,pins = <
107 0x152 (PIN_INPUT | MUX_MODE0) /* uart1_rx.uart1_rx */ 107 OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | MUX_MODE0) /* uart1_rx.uart1_rx */
108 0x14c (PIN_OUTPUT |MUX_MODE0) /* uart1_tx.uart1_tx */ 108 OMAP3_CORE1_IOPAD(0x217c, PIN_OUTPUT | MUX_MODE0) /* uart1_tx.uart1_tx */
109 >; 109 >;
110 }; 110 };
111 111
112 uart2_pins: pinmux_uart2_pins { 112 uart2_pins: pinmux_uart2_pins {
113 pinctrl-single,pins = < 113 pinctrl-single,pins = <
114 0x14a (PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */ 114 OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
115 0x148 (PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */ 115 OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
116 >; 116 >;
117 }; 117 };
118 118
119 uart3_pins: pinmux_uart3_pins { 119 uart3_pins: pinmux_uart3_pins {
120 pinctrl-single,pins = < 120 pinctrl-single,pins = <
121 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx.uart3_rx */ 121 OMAP3_CORE1_IOPAD(0x219e, PIN_INPUT | MUX_MODE0) /* uart3_rx.uart3_rx */
122 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx.uart3_tx */ 122 OMAP3_CORE1_IOPAD(0x21a0, PIN_OUTPUT | MUX_MODE0) /* uart3_tx.uart3_tx */
123 >; 123 >;
124 }; 124 };
125 125
126 mmc1_pins: pinmux_mmc1_pins { 126 mmc1_pins: pinmux_mmc1_pins {
127 pinctrl-single,pins = < 127 pinctrl-single,pins = <
128 0x114 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */ 128 OMAP3_CORE1_IOPAD(0x2144, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
129 0x116 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */ 129 OMAP3_CORE1_IOPAD(0x2146, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
130 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */ 130 OMAP3_CORE1_IOPAD(0x2148, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
131 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */ 131 OMAP3_CORE1_IOPAD(0x214a, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
132 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */ 132 OMAP3_CORE1_IOPAD(0x214c, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
133 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */ 133 OMAP3_CORE1_IOPAD(0x214e, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
134 >; 134 >;
135 }; 135 };
136 136
137 dss_dpi_pins: pinmux_dss_dpi_pins { 137 dss_dpi_pins: pinmux_dss_dpi_pins {
138 pinctrl-single,pins = < 138 pinctrl-single,pins = <
139 0x0a4 (PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */ 139 OMAP3_CORE1_IOPAD(0x20d4, PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */
140 0x0a6 (PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */ 140 OMAP3_CORE1_IOPAD(0x20d6, PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */
141 0x0a8 (PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */ 141 OMAP3_CORE1_IOPAD(0x20d8, PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */
142 0x0aa (PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */ 142 OMAP3_CORE1_IOPAD(0x20da, PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */
143 0x0ac (PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */ 143 OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */
144 0x0ae (PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */ 144 OMAP3_CORE1_IOPAD(0x20de, PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */
145 0x0b0 (PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */ 145 OMAP3_CORE1_IOPAD(0x20e0, PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */
146 0x0b2 (PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */ 146 OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */
147 0x0b4 (PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */ 147 OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */
148 0x0b6 (PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */ 148 OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */
149 0x0b8 (PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */ 149 OMAP3_CORE1_IOPAD(0x20e8, PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */
150 0x0ba (PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */ 150 OMAP3_CORE1_IOPAD(0x20ea, PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */
151 0x0bc (PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */ 151 OMAP3_CORE1_IOPAD(0x20ec, PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */
152 0x0be (PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */ 152 OMAP3_CORE1_IOPAD(0x20ee, PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */
153 0x0c0 (PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */ 153 OMAP3_CORE1_IOPAD(0x20f0, PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */
154 0x0c2 (PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */ 154 OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */
155 0x0c4 (PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */ 155 OMAP3_CORE1_IOPAD(0x20f4, PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */
156 0x0c6 (PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */ 156 OMAP3_CORE1_IOPAD(0x20f6, PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */
157 0x0c8 (PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */ 157 OMAP3_CORE1_IOPAD(0x20f8, PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */
158 0x0ca (PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */ 158 OMAP3_CORE1_IOPAD(0x20fa, PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */
159 0x0cc (PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */ 159 OMAP3_CORE1_IOPAD(0x20fc, PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */
160 0x0ce (PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */ 160 OMAP3_CORE1_IOPAD(0x20fe, PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */
161 0x0d0 (PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */ 161 OMAP3_CORE1_IOPAD(0x2100, PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */
162 0x0d2 (PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */ 162 OMAP3_CORE1_IOPAD(0x2102, PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */
163 0x0d4 (PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */ 163 OMAP3_CORE1_IOPAD(0x2104, PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */
164 0x0d6 (PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */ 164 OMAP3_CORE1_IOPAD(0x2106, PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */
165 0x0d8 (PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */ 165 OMAP3_CORE1_IOPAD(0x2108, PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */
166 0x0da (PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */ 166 OMAP3_CORE1_IOPAD(0x210a, PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */
167 >; 167 >;
168 }; 168 };
169}; 169};
170 170
@@ -397,10 +397,10 @@
397}; 397};
398 398
399&gpmc { 399&gpmc {
400 ranges = <0 0 0x30000000 0x04>; /* CS0: NAND */ 400 ranges = <0 0 0x30000000 0x1000000>; /* CS0: 16MB for NAND */
401 401
402 nand@0,0 { 402 nand@0,0 {
403 reg = <0 0 0>; /* CS0, offset 0 */ 403 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
404 nand-bus-width = <16>; 404 nand-bus-width = <16>;
405 ti,nand-ecc-opt = "bch8"; 405 ti,nand-ecc-opt = "bch8";
406 406
diff --git a/arch/arm/boot/dts/omap3-igep.dtsi b/arch/arm/boot/dts/omap3-igep.dtsi
index e2d163bf0619..8a63ad2286aa 100644
--- a/arch/arm/boot/dts/omap3-igep.dtsi
+++ b/arch/arm/boot/dts/omap3-igep.dtsi
@@ -31,18 +31,6 @@
31 regulator-always-on; 31 regulator-always-on;
32 }; 32 };
33 33
34 lbee1usjyc_vmmc: lbee1usjyc_vmmc {
35 pinctrl-names = "default";
36 pinctrl-0 = <&lbee1usjyc_pins>;
37 compatible = "regulator-fixed";
38 regulator-name = "regulator-lbee1usjyc";
39 regulator-min-microvolt = <3300000>;
40 regulator-max-microvolt = <3300000>;
41 gpio = <&gpio5 10 GPIO_ACTIVE_HIGH>; /* gpio_138 WIFI_PDN */
42 startup-delay-us = <10000>;
43 enable-active-high;
44 vin-supply = <&vdd33>;
45 };
46}; 34};
47 35
48&omap3_pmx_core { 36&omap3_pmx_core {
@@ -53,13 +41,6 @@
53 >; 41 >;
54 }; 42 };
55 43
56 uart2_pins: pinmux_uart2_pins {
57 pinctrl-single,pins = <
58 0x14a (PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
59 0x148 (PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
60 >;
61 };
62
63 uart3_pins: pinmux_uart3_pins { 44 uart3_pins: pinmux_uart3_pins {
64 pinctrl-single,pins = < 45 pinctrl-single,pins = <
65 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx.uart3_rx */ 46 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx.uart3_rx */
@@ -67,15 +48,6 @@
67 >; 48 >;
68 }; 49 };
69 50
70 /* WiFi/BT combo */
71 lbee1usjyc_pins: pinmux_lbee1usjyc_pins {
72 pinctrl-single,pins = <
73 0x136 (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat5.gpio_137 */
74 0x138 (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat6.gpio_138 */
75 0x13a (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 */
76 >;
77 };
78
79 mcbsp2_pins: pinmux_mcbsp2_pins { 51 mcbsp2_pins: pinmux_mcbsp2_pins {
80 pinctrl-single,pins = < 52 pinctrl-single,pins = <
81 0x10c (PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx.mcbsp2_fsx */ 53 0x10c (PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx.mcbsp2_fsx */
@@ -120,13 +92,6 @@
120 >; 92 >;
121 }; 93 };
122 94
123 i2c2_pins: pinmux_i2c2_pins {
124 pinctrl-single,pins = <
125 0x18e (PIN_INPUT | MUX_MODE0) /* i2c2_scl.i2c2_scl */
126 0x190 (PIN_INPUT | MUX_MODE0) /* i2c2_sda.i2c2_sda */
127 >;
128 };
129
130 i2c3_pins: pinmux_i2c3_pins { 95 i2c3_pins: pinmux_i2c3_pins {
131 pinctrl-single,pins = < 96 pinctrl-single,pins = <
132 0x192 (PIN_INPUT | MUX_MODE0) /* i2c3_scl.i2c3_scl */ 97 0x192 (PIN_INPUT | MUX_MODE0) /* i2c3_scl.i2c3_scl */
@@ -135,6 +100,55 @@
135 }; 100 };
136}; 101};
137 102
103&gpmc {
104 nand@0,0 {
105 linux,mtd-name= "micron,mt29c4g96maz";
106 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
107 nand-bus-width = <16>;
108 gpmc,device-width = <2>;
109 ti,nand-ecc-opt = "bch8";
110
111 gpmc,sync-clk-ps = <0>;
112 gpmc,cs-on-ns = <0>;
113 gpmc,cs-rd-off-ns = <44>;
114 gpmc,cs-wr-off-ns = <44>;
115 gpmc,adv-on-ns = <6>;
116 gpmc,adv-rd-off-ns = <34>;
117 gpmc,adv-wr-off-ns = <44>;
118 gpmc,we-off-ns = <40>;
119 gpmc,oe-off-ns = <54>;
120 gpmc,access-ns = <64>;
121 gpmc,rd-cycle-ns = <82>;
122 gpmc,wr-cycle-ns = <82>;
123 gpmc,wr-access-ns = <40>;
124 gpmc,wr-data-mux-bus-ns = <0>;
125
126 #address-cells = <1>;
127 #size-cells = <1>;
128
129 partition@0 {
130 label = "SPL";
131 reg = <0 0x100000>;
132 };
133 partition@80000 {
134 label = "U-Boot";
135 reg = <0x100000 0x180000>;
136 };
137 partition@1c0000 {
138 label = "Environment";
139 reg = <0x280000 0x100000>;
140 };
141 partition@280000 {
142 label = "Kernel";
143 reg = <0x380000 0x300000>;
144 };
145 partition@780000 {
146 label = "Filesystem";
147 reg = <0x680000 0x1f980000>;
148 };
149 };
150};
151
138&i2c1 { 152&i2c1 {
139 pinctrl-names = "default"; 153 pinctrl-names = "default";
140 pinctrl-0 = <&i2c1_pins>; 154 pinctrl-0 = <&i2c1_pins>;
@@ -156,12 +170,6 @@
156#include "twl4030.dtsi" 170#include "twl4030.dtsi"
157#include "twl4030_omap3.dtsi" 171#include "twl4030_omap3.dtsi"
158 172
159&i2c2 {
160 pinctrl-names = "default";
161 pinctrl-0 = <&i2c2_pins>;
162 clock-frequency = <400000>;
163};
164
165&i2c3 { 173&i2c3 {
166 pinctrl-names = "default"; 174 pinctrl-names = "default";
167 pinctrl-0 = <&i2c3_pins>; 175 pinctrl-0 = <&i2c3_pins>;
@@ -181,14 +189,6 @@
181 bus-width = <4>; 189 bus-width = <4>;
182}; 190};
183 191
184&mmc2 {
185 pinctrl-names = "default";
186 pinctrl-0 = <&mmc2_pins>;
187 vmmc-supply = <&lbee1usjyc_vmmc>;
188 bus-width = <4>;
189 non-removable;
190};
191
192&mmc3 { 192&mmc3 {
193 status = "disabled"; 193 status = "disabled";
194}; 194};
@@ -198,11 +198,6 @@
198 pinctrl-0 = <&uart1_pins>; 198 pinctrl-0 = <&uart1_pins>;
199}; 199};
200 200
201&uart2 {
202 pinctrl-names = "default";
203 pinctrl-0 = <&uart2_pins>;
204};
205
206&uart3 { 201&uart3 {
207 pinctrl-names = "default"; 202 pinctrl-names = "default";
208 pinctrl-0 = <&uart3_pins>; 203 pinctrl-0 = <&uart3_pins>;
diff --git a/arch/arm/boot/dts/omap3-igep0020-common.dtsi b/arch/arm/boot/dts/omap3-igep0020-common.dtsi
new file mode 100644
index 000000000000..e458c2185e3c
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-igep0020-common.dtsi
@@ -0,0 +1,246 @@
1/*
2 * Common Device Tree Source for IGEPv2
3 *
4 * Copyright (C) 2014 Javier Martinez Canillas <javier@collabora.co.uk>
5 * Copyright (C) 2014 Enric Balletbo i Serra <eballetbo@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include "omap3-igep.dtsi"
13#include "omap-gpmc-smsc9221.dtsi"
14
15/ {
16
17 leds {
18 pinctrl-names = "default";
19 pinctrl-0 = <&leds_pins>;
20 compatible = "gpio-leds";
21
22 boot {
23 label = "omap3:green:boot";
24 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
25 default-state = "on";
26 };
27
28 user0 {
29 label = "omap3:red:user0";
30 gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
31 default-state = "off";
32 };
33
34 user1 {
35 label = "omap3:red:user1";
36 gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
37 default-state = "off";
38 };
39
40 user2 {
41 label = "omap3:green:user1";
42 gpios = <&twl_gpio 19 GPIO_ACTIVE_LOW>;
43 };
44 };
45
46 /* HS USB Port 1 Power */
47 hsusb1_power: hsusb1_power_reg {
48 compatible = "regulator-fixed";
49 regulator-name = "hsusb1_vbus";
50 regulator-min-microvolt = <3300000>;
51 regulator-max-microvolt = <3300000>;
52 gpio = <&twl_gpio 18 GPIO_ACTIVE_LOW>; /* GPIO LEDA */
53 startup-delay-us = <70000>;
54 };
55
56 /* HS USB Host PHY on PORT 1 */
57 hsusb1_phy: hsusb1_phy {
58 compatible = "usb-nop-xceiv";
59 reset-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>; /* gpio_24 */
60 vcc-supply = <&hsusb1_power>;
61 };
62
63 tfp410: encoder@0 {
64 compatible = "ti,tfp410";
65 powerdown-gpios = <&gpio6 10 GPIO_ACTIVE_LOW>; /* gpio_170 */
66
67 ports {
68 #address-cells = <1>;
69 #size-cells = <0>;
70
71 port@0 {
72 reg = <0>;
73
74 tfp410_in: endpoint@0 {
75 remote-endpoint = <&dpi_out>;
76 };
77 };
78
79 port@1 {
80 reg = <1>;
81
82 tfp410_out: endpoint@0 {
83 remote-endpoint = <&dvi_connector_in>;
84 };
85 };
86 };
87 };
88
89 dvi0: connector@0 {
90 compatible = "dvi-connector";
91 label = "dvi";
92
93 digital;
94
95 ddc-i2c-bus = <&i2c3>;
96
97 port {
98 dvi_connector_in: endpoint {
99 remote-endpoint = <&tfp410_out>;
100 };
101 };
102 };
103};
104
105&omap3_pmx_core {
106 pinctrl-names = "default";
107 pinctrl-0 = <
108 &tfp410_pins
109 &dss_dpi_pins
110 >;
111
112 tfp410_pins: pinmux_tfp410_pins {
113 pinctrl-single,pins = <
114 0x196 (PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */
115 >;
116 };
117
118 dss_dpi_pins: pinmux_dss_dpi_pins {
119 pinctrl-single,pins = <
120 0x0a4 (PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */
121 0x0a6 (PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */
122 0x0a8 (PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */
123 0x0aa (PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */
124 0x0ac (PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */
125 0x0ae (PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */
126 0x0b0 (PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */
127 0x0b2 (PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */
128 0x0b4 (PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */
129 0x0b6 (PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */
130 0x0b8 (PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */
131 0x0ba (PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */
132 0x0bc (PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */
133 0x0be (PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */
134 0x0c0 (PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */
135 0x0c2 (PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */
136 0x0c4 (PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */
137 0x0c6 (PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */
138 0x0c8 (PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */
139 0x0ca (PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */
140 0x0cc (PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */
141 0x0ce (PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */
142 0x0d0 (PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */
143 0x0d2 (PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */
144 0x0d4 (PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */
145 0x0d6 (PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */
146 0x0d8 (PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */
147 0x0da (PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */
148 >;
149 };
150
151 uart2_pins: pinmux_uart2_pins {
152 pinctrl-single,pins = <
153 OMAP3_CORE1_IOPAD(0x2174, PIN_INPUT | MUX_MODE0) /* uart2_cts.uart2_cts */
154 OMAP3_CORE1_IOPAD(0x2176, PIN_OUTPUT | MUX_MODE0) /* uart2_rts .uart2_rts*/
155 OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
156 OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
157 >;
158 };
159};
160
161&omap3_pmx_core2 {
162 pinctrl-names = "default";
163 pinctrl-0 = <
164 &hsusbb1_pins
165 >;
166
167 hsusbb1_pins: pinmux_hsusbb1_pins {
168 pinctrl-single,pins = <
169 OMAP3630_CORE2_IOPAD(0x25da, PIN_OUTPUT | MUX_MODE3) /* etk_ctl.hsusb1_clk */
170 OMAP3630_CORE2_IOPAD(0x25d8, PIN_OUTPUT | MUX_MODE3) /* etk_clk.hsusb1_stp */
171 OMAP3630_CORE2_IOPAD(0x25ec, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d8.hsusb1_dir */
172 OMAP3630_CORE2_IOPAD(0x25ee, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d9.hsusb1_nxt */
173 OMAP3630_CORE2_IOPAD(0x25dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d0.hsusb1_data0 */
174 OMAP3630_CORE2_IOPAD(0x25de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d1.hsusb1_data1 */
175 OMAP3630_CORE2_IOPAD(0x25e0, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d2.hsusb1_data2 */
176 OMAP3630_CORE2_IOPAD(0x25e2, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d3.hsusb1_data7 */
177 OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d4.hsusb1_data4 */
178 OMAP3630_CORE2_IOPAD(0x25e6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d5.hsusb1_data5 */
179 OMAP3630_CORE2_IOPAD(0x25e8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d6.hsusb1_data6 */
180 OMAP3630_CORE2_IOPAD(0x25ea, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */
181 >;
182 };
183
184 leds_pins: pinmux_leds_pins {
185 pinctrl-single,pins = <
186 OMAP3630_CORE2_IOPAD(0x25f4, PIN_OUTPUT | MUX_MODE4) /* etk_d12.gpio_26 */
187 OMAP3630_CORE2_IOPAD(0x25f6, PIN_OUTPUT | MUX_MODE4) /* etk_d13.gpio_27 */
188 OMAP3630_CORE2_IOPAD(0x25f8, PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
189 >;
190 };
191};
192
193&i2c3 {
194 clock-frequency = <100000>;
195
196 /*
197 * Display monitor features are burnt in the EEPROM
198 * as EDID data.
199 */
200 eeprom@50 {
201 compatible = "ti,eeprom";
202 reg = <0x50>;
203 };
204};
205
206&gpmc {
207 ranges = <0 0 0x00000000 0x20000000>,
208 <5 0 0x2c000000 0x01000000>;
209
210 ethernet@gpmc {
211 pinctrl-names = "default";
212 pinctrl-0 = <&smsc9221_pins>;
213 reg = <5 0 0xff>;
214 interrupt-parent = <&gpio6>;
215 interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
216 };
217};
218
219&uart2 {
220 pinctrl-names = "default";
221 pinctrl-0 = <&uart2_pins>;
222};
223
224&usbhshost {
225 port1-mode = "ehci-phy";
226};
227
228&usbhsehci {
229 phys = <&hsusb1_phy>;
230};
231
232&vpll2 {
233 /* Needed for DSS */
234 regulator-name = "vdds_dsi";
235};
236
237&dss {
238 status = "ok";
239
240 port {
241 dpi_out: endpoint {
242 remote-endpoint = <&tfp410_in>;
243 data-lines = <24>;
244 };
245 };
246};
diff --git a/arch/arm/boot/dts/omap3-igep0020-rev-f.dts b/arch/arm/boot/dts/omap3-igep0020-rev-f.dts
new file mode 100644
index 000000000000..cc8bd0cd8cf8
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-igep0020-rev-f.dts
@@ -0,0 +1,45 @@
1/*
2 * Device Tree Source for IGEPv2 Rev. F (TI OMAP AM/DM37x)
3 *
4 * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk>
5 * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include "omap3-igep0020-common.dtsi"
13
14/ {
15 model = "IGEPv2 Rev. F (TI OMAP AM/DM37x)";
16 compatible = "isee,omap3-igep0020-rev-f", "ti,omap36xx", "ti,omap3";
17
18 /* Regulator to trigger the WL_EN signal of the Wifi module */
19 lbep5clwmc_wlen: regulator-lbep5clwmc-wlen {
20 compatible = "regulator-fixed";
21 regulator-name = "regulator-lbep5clwmc-wlen";
22 regulator-min-microvolt = <3300000>;
23 regulator-max-microvolt = <3300000>;
24 gpio = <&gpio5 11 GPIO_ACTIVE_HIGH>; /* gpio_139 - WL_EN */
25 enable-active-high;
26 };
27};
28
29&omap3_pmx_core {
30 lbep5clwmc_pins: pinmux_lbep5clwmc_pins {
31 pinctrl-single,pins = <
32 OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT | MUX_MODE4) /* mcspi1_cs3.gpio_177 - W_IRQ */
33 OMAP3_CORE1_IOPAD(0x2166, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat5.gpio_137 - BT_EN */
34 OMAP3_CORE1_IOPAD(0x216a, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 - WL_EN */
35 >;
36 };
37};
38
39&mmc2 {
40 pinctrl-names = "default";
41 pinctrl-0 = <&mmc2_pins &lbep5clwmc_pins>;
42 vmmc-supply = <&lbep5clwmc_wlen>;
43 bus-width = <4>;
44 non-removable;
45};
diff --git a/arch/arm/boot/dts/omap3-igep0020.dts b/arch/arm/boot/dts/omap3-igep0020.dts
index b22caaaf774b..fea7f7edb45d 100644
--- a/arch/arm/boot/dts/omap3-igep0020.dts
+++ b/arch/arm/boot/dts/omap3-igep0020.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * Device Tree Source for IGEPv2 Rev. (TI OMAP AM/DM37x) 2 * Device Tree Source for IGEPv2 Rev. C (TI OMAP AM/DM37x)
3 * 3 *
4 * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> 4 * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk>
5 * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> 5 * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com>
@@ -9,272 +9,59 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include "omap3-igep.dtsi" 12#include "omap3-igep0020-common.dtsi"
13#include "omap-gpmc-smsc9221.dtsi"
14 13
15/ { 14/ {
16 model = "IGEPv2 (TI OMAP AM/DM37x)"; 15 model = "IGEPv2 Rev. C (TI OMAP AM/DM37x)";
17 compatible = "isee,omap3-igep0020", "ti,omap36xx", "ti,omap3"; 16 compatible = "isee,omap3-igep0020", "ti,omap36xx", "ti,omap3";
18 17
19 leds { 18 /* Regulator to trigger the WIFI_PDN signal of the Wifi module */
20 pinctrl-names = "default"; 19 lbee1usjyc_pdn: lbee1usjyc_pdn {
21 pinctrl-0 = <&leds_pins>; 20 compatible = "regulator-fixed";
22 compatible = "gpio-leds"; 21 regulator-name = "regulator-lbee1usjyc-pdn";
23 22 regulator-min-microvolt = <3300000>;
24 boot { 23 regulator-max-microvolt = <3300000>;
25 label = "omap3:green:boot"; 24 gpio = <&gpio5 10 GPIO_ACTIVE_HIGH>; /* gpio_138 - WIFI_PDN */
26 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; 25 startup-delay-us = <10000>;
27 default-state = "on"; 26 enable-active-high;
28 };
29
30 user0 {
31 label = "omap3:red:user0";
32 gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
33 default-state = "off";
34 };
35
36 user1 {
37 label = "omap3:red:user1";
38 gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
39 default-state = "off";
40 };
41
42 user2 {
43 label = "omap3:green:user1";
44 gpios = <&twl_gpio 19 GPIO_ACTIVE_LOW>;
45 };
46 }; 27 };
47 28
48 /* HS USB Port 1 Power */ 29 /* Regulator to trigger the RESET_N_W signal of the Wifi module */
49 hsusb1_power: hsusb1_power_reg { 30 lbee1usjyc_reset_n_w: lbee1usjyc_reset_n_w {
50 compatible = "regulator-fixed"; 31 compatible = "regulator-fixed";
51 regulator-name = "hsusb1_vbus"; 32 regulator-name = "regulator-lbee1usjyc-reset-n-w";
52 regulator-min-microvolt = <3300000>; 33 regulator-min-microvolt = <3300000>;
53 regulator-max-microvolt = <3300000>; 34 regulator-max-microvolt = <3300000>;
54 gpio = <&twl_gpio 18 GPIO_ACTIVE_LOW>; /* GPIO LEDA */ 35 gpio = <&gpio5 11 GPIO_ACTIVE_HIGH>; /* gpio_139 - RESET_N_W */
55 startup-delay-us = <70000>; 36 enable-active-high;
56 };
57
58 /* HS USB Host PHY on PORT 1 */
59 hsusb1_phy: hsusb1_phy {
60 compatible = "usb-nop-xceiv";
61 reset-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>; /* gpio_24 */
62 vcc-supply = <&hsusb1_power>;
63 };
64
65 tfp410: encoder@0 {
66 compatible = "ti,tfp410";
67 powerdown-gpios = <&gpio6 10 GPIO_ACTIVE_LOW>; /* gpio_170 */
68
69 ports {
70 #address-cells = <1>;
71 #size-cells = <0>;
72
73 port@0 {
74 reg = <0>;
75
76 tfp410_in: endpoint@0 {
77 remote-endpoint = <&dpi_out>;
78 };
79 };
80
81 port@1 {
82 reg = <1>;
83
84 tfp410_out: endpoint@0 {
85 remote-endpoint = <&dvi_connector_in>;
86 };
87 };
88 };
89 };
90
91 dvi0: connector@0 {
92 compatible = "dvi-connector";
93 label = "dvi";
94
95 digital;
96
97 ddc-i2c-bus = <&i2c3>;
98
99 port {
100 dvi_connector_in: endpoint {
101 remote-endpoint = <&tfp410_out>;
102 };
103 };
104 }; 37 };
105}; 38};
106 39
107&omap3_pmx_core { 40&omap3_pmx_core {
108 pinctrl-names = "default"; 41 lbee1usjyc_pins: pinmux_lbee1usjyc_pins {
109 pinctrl-0 = <
110 &tfp410_pins
111 &dss_dpi_pins
112 >;
113
114 tfp410_pins: pinmux_tfp410_pins {
115 pinctrl-single,pins = < 42 pinctrl-single,pins = <
116 0x196 (PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */ 43 OMAP3_CORE1_IOPAD(0x2166, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat5.gpio_137 - RESET_N_W */
44 OMAP3_CORE1_IOPAD(0x2168, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat6.gpio_138 - WIFI_PDN */
45 OMAP3_CORE1_IOPAD(0x216a, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 - RST_N_B */
117 >; 46 >;
118 }; 47 };
119 48
120 dss_dpi_pins: pinmux_dss_dpi_pins { 49 uart2_pins: pinmux_uart2_pins {
121 pinctrl-single,pins = < 50 pinctrl-single,pins = <
122 0x0a4 (PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */ 51 OMAP3_CORE1_IOPAD(0x2174, PIN_INPUT | MUX_MODE0) /* uart2_cts.uart2_cts */
123 0x0a6 (PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */ 52 OMAP3_CORE1_IOPAD(0x2176, PIN_OUTPUT | MUX_MODE0) /* uart2_rts .uart2_rts*/
124 0x0a8 (PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */ 53 OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
125 0x0aa (PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */ 54 OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
126 0x0ac (PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */
127 0x0ae (PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */
128 0x0b0 (PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */
129 0x0b2 (PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */
130 0x0b4 (PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */
131 0x0b6 (PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */
132 0x0b8 (PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */
133 0x0ba (PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */
134 0x0bc (PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */
135 0x0be (PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */
136 0x0c0 (PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */
137 0x0c2 (PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */
138 0x0c4 (PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */
139 0x0c6 (PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */
140 0x0c8 (PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */
141 0x0ca (PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */
142 0x0cc (PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */
143 0x0ce (PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */
144 0x0d0 (PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */
145 0x0d2 (PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */
146 0x0d4 (PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */
147 0x0d6 (PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */
148 0x0d8 (PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */
149 0x0da (PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */
150 >; 55 >;
151 }; 56 };
152}; 57};
153 58
154&omap3_pmx_core2 { 59/* On board Wifi module */
60&mmc2 {
155 pinctrl-names = "default"; 61 pinctrl-names = "default";
156 pinctrl-0 = < 62 pinctrl-0 = <&mmc2_pins &lbee1usjyc_pins>;
157 &hsusbb1_pins 63 vmmc-supply = <&lbee1usjyc_pdn>;
158 >; 64 vmmc_aux-supply = <&lbee1usjyc_reset_n_w>;
159 65 bus-width = <4>;
160 hsusbb1_pins: pinmux_hsusbb1_pins { 66 non-removable;
161 pinctrl-single,pins = <
162 OMAP3630_CORE2_IOPAD(0x25da, PIN_OUTPUT | MUX_MODE3) /* etk_ctl.hsusb1_clk */
163 OMAP3630_CORE2_IOPAD(0x25d8, PIN_OUTPUT | MUX_MODE3) /* etk_clk.hsusb1_stp */
164 OMAP3630_CORE2_IOPAD(0x25ec, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d8.hsusb1_dir */
165 OMAP3630_CORE2_IOPAD(0x25ee, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d9.hsusb1_nxt */
166 OMAP3630_CORE2_IOPAD(0x25dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d0.hsusb1_data0 */
167 OMAP3630_CORE2_IOPAD(0x25de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d1.hsusb1_data1 */
168 OMAP3630_CORE2_IOPAD(0x25e0, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d2.hsusb1_data2 */
169 OMAP3630_CORE2_IOPAD(0x25e2, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d3.hsusb1_data7 */
170 OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d4.hsusb1_data4 */
171 OMAP3630_CORE2_IOPAD(0x25e6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d5.hsusb1_data5 */
172 OMAP3630_CORE2_IOPAD(0x25e8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d6.hsusb1_data6 */
173 OMAP3630_CORE2_IOPAD(0x25ea, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */
174 >;
175 };
176
177 leds_pins: pinmux_leds_pins {
178 pinctrl-single,pins = <
179 OMAP3630_CORE2_IOPAD(0x25f4, PIN_OUTPUT | MUX_MODE4) /* etk_d12.gpio_26 */
180 OMAP3630_CORE2_IOPAD(0x25f6, PIN_OUTPUT | MUX_MODE4) /* etk_d13.gpio_27 */
181 OMAP3630_CORE2_IOPAD(0x25f8, PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
182 >;
183 };
184};
185
186&i2c3 {
187 clock-frequency = <100000>;
188
189 /*
190 * Display monitor features are burnt in the EEPROM
191 * as EDID data.
192 */
193 eeprom@50 {
194 compatible = "ti,eeprom";
195 reg = <0x50>;
196 };
197};
198
199&gpmc {
200 ranges = <0 0 0x00000000 0x20000000>,
201 <5 0 0x2c000000 0x01000000>;
202
203 nand@0,0 {
204 linux,mtd-name= "micron,mt29c4g96maz";
205 reg = <0 0 0>;
206 nand-bus-width = <16>;
207 ti,nand-ecc-opt = "bch8";
208
209 gpmc,sync-clk-ps = <0>;
210 gpmc,cs-on-ns = <0>;
211 gpmc,cs-rd-off-ns = <44>;
212 gpmc,cs-wr-off-ns = <44>;
213 gpmc,adv-on-ns = <6>;
214 gpmc,adv-rd-off-ns = <34>;
215 gpmc,adv-wr-off-ns = <44>;
216 gpmc,we-off-ns = <40>;
217 gpmc,oe-off-ns = <54>;
218 gpmc,access-ns = <64>;
219 gpmc,rd-cycle-ns = <82>;
220 gpmc,wr-cycle-ns = <82>;
221 gpmc,wr-access-ns = <40>;
222 gpmc,wr-data-mux-bus-ns = <0>;
223
224 #address-cells = <1>;
225 #size-cells = <1>;
226
227 partition@0 {
228 label = "SPL";
229 reg = <0 0x100000>;
230 };
231 partition@80000 {
232 label = "U-Boot";
233 reg = <0x100000 0x180000>;
234 };
235 partition@1c0000 {
236 label = "Environment";
237 reg = <0x280000 0x100000>;
238 };
239 partition@280000 {
240 label = "Kernel";
241 reg = <0x380000 0x300000>;
242 };
243 partition@780000 {
244 label = "Filesystem";
245 reg = <0x680000 0x1f980000>;
246 };
247 };
248
249 ethernet@gpmc {
250 pinctrl-names = "default";
251 pinctrl-0 = <&smsc9221_pins>;
252 reg = <5 0 0xff>;
253 interrupt-parent = <&gpio6>;
254 interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
255 };
256};
257
258&usbhshost {
259 port1-mode = "ehci-phy";
260};
261
262&usbhsehci {
263 phys = <&hsusb1_phy>;
264};
265
266&vpll2 {
267 /* Needed for DSS */
268 regulator-name = "vdds_dsi";
269};
270
271&dss {
272 status = "ok";
273
274 port {
275 dpi_out: endpoint {
276 remote-endpoint = <&tfp410_in>;
277 data-lines = <24>;
278 };
279 };
280}; 67};
diff --git a/arch/arm/boot/dts/omap3-igep0030-common.dtsi b/arch/arm/boot/dts/omap3-igep0030-common.dtsi
new file mode 100644
index 000000000000..0cb1527c39d4
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-igep0030-common.dtsi
@@ -0,0 +1,60 @@
1/*
2 * Common Device Tree Source for IGEP COM MODULE
3 *
4 * Copyright (C) 2014 Javier Martinez Canillas <javier@collabora.co.uk>
5 * Copyright (C) 2014 Enric Balletbo i Serra <eballetbo@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include "omap3-igep.dtsi"
13
14/ {
15 leds: gpio_leds {
16 compatible = "gpio-leds";
17
18 user0 {
19 label = "omap3:red:user0";
20 gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>; /* LEDA */
21 default-state = "off";
22 };
23
24 user1 {
25 label = "omap3:green:user1";
26 gpios = <&twl_gpio 19 GPIO_ACTIVE_LOW>; /* LEDB */
27 default-state = "off";
28 };
29
30 user2 {
31 label = "omap3:red:user1";
32 gpios = <&gpio1 16 GPIO_ACTIVE_LOW>; /* gpio_16 */
33 default-state = "off";
34 };
35 };
36};
37
38&omap3_pmx_core {
39 uart2_pins: pinmux_uart2_pins {
40 pinctrl-single,pins = <
41 OMAP3_CORE1_IOPAD(0x216c, PIN_INPUT | MUX_MODE1) /* mcbsp3_dx.uart2_cts */
42 OMAP3_CORE1_IOPAD(0x216e, PIN_OUTPUT | MUX_MODE1) /* mcbsp3_dr.uart2_rts */
43 OMAP3_CORE1_IOPAD(0x2170, PIN_OUTPUT | MUX_MODE1) /* mcbsp3_clk.uart2_tx */
44 OMAP3_CORE1_IOPAD(0x2172, PIN_INPUT | MUX_MODE1) /* mcbsp3_fsx.uart2_rx */
45 >;
46 };
47};
48
49&omap3_pmx_core2 {
50 leds_core2_pins: pinmux_leds_core2_pins {
51 pinctrl-single,pins = <
52 OMAP3630_CORE2_IOPAD(0x25e0, PIN_OUTPUT | MUX_MODE4) /* etk_d2.gpio_16 */
53 >;
54 };
55};
56
57&uart2 {
58 pinctrl-names = "default";
59 pinctrl-0 = <&uart2_pins>;
60};
diff --git a/arch/arm/boot/dts/omap3-igep0030-rev-g.dts b/arch/arm/boot/dts/omap3-igep0030-rev-g.dts
new file mode 100644
index 000000000000..9326b282c94a
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-igep0030-rev-g.dts
@@ -0,0 +1,67 @@
1/*
2 * Device Tree Source for IGEP COM MODULE Rev. G (TI OMAP AM/DM37x)
3 *
4 * Copyright (C) 2014 Javier Martinez Canillas <javier@collabora.co.uk>
5 * Copyright (C) 2014 Enric Balletbo i Serra <eballetbo@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include "omap3-igep0030-common.dtsi"
13
14/ {
15 model = "IGEP COM MODULE Rev. G (TI OMAP AM/DM37x)";
16 compatible = "isee,omap3-igep0030-rev-g", "ti,omap36xx", "ti,omap3";
17
18 /* Regulator to trigger the WL_EN signal of the Wifi module */
19 lbep5clwmc_wlen: regulator-lbep5clwmc-wlen {
20 compatible = "regulator-fixed";
21 regulator-name = "regulator-lbep5clwmc-wlen";
22 regulator-min-microvolt = <3300000>;
23 regulator-max-microvolt = <3300000>;
24 gpio = <&gpio5 11 GPIO_ACTIVE_HIGH>; /* gpio_139 - WL_EN */
25 enable-active-high;
26 };
27};
28
29&omap3_pmx_core {
30 lbep5clwmc_pins: pinmux_lbep5clwmc_pins {
31 pinctrl-single,pins = <
32 OMAP3_CORE1_IOPAD(0x2164, PIN_INPUT | MUX_MODE4) /* sdmmc2_dat4.gpio_136 - W_IRQ */
33 OMAP3_CORE1_IOPAD(0x2166, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat5.gpio_137 - BT_EN */
34 OMAP3_CORE1_IOPAD(0x216a, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 - WL_EN */
35 >;
36 };
37
38 leds_pins: pinmux_leds_pins {
39 pinctrl-single,pins = <
40 OMAP3_CORE1_IOPAD(0x21be, PIN_OUTPUT | MUX_MODE4) /* i2c2_scl.gpio_168 */
41 >;
42 };
43
44};
45
46&i2c2 {
47 status = "disabled";
48};
49
50&leds {
51 pinctrl-names = "default";
52 pinctrl-0 = <&leds_pins &leds_core2_pins>;
53
54 boot {
55 label = "omap3:green:boot";
56 gpios = <&gpio6 8 GPIO_ACTIVE_HIGH>;
57 default-state = "on";
58 };
59};
60
61&mmc2 {
62 pinctrl-names = "default";
63 pinctrl-0 = <&mmc2_pins &lbep5clwmc_pins>;
64 vmmc-supply = <&lbep5clwmc_wlen>;
65 bus-width = <4>;
66 non-removable;
67};
diff --git a/arch/arm/boot/dts/omap3-igep0030.dts b/arch/arm/boot/dts/omap3-igep0030.dts
index 2793749eb1ba..8150f47ccdf5 100644
--- a/arch/arm/boot/dts/omap3-igep0030.dts
+++ b/arch/arm/boot/dts/omap3-igep0030.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * Device Tree Source for IGEP COM MODULE (TI OMAP AM/DM37x) 2 * Device Tree Source for IGEP COM MODULE Rev. E (TI OMAP AM/DM37x)
3 * 3 *
4 * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> 4 * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk>
5 * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> 5 * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com>
@@ -9,97 +9,62 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include "omap3-igep.dtsi" 12#include "omap3-igep0030-common.dtsi"
13 13
14/ { 14/ {
15 model = "IGEP COM MODULE (TI OMAP AM/DM37x)"; 15 model = "IGEP COM MODULE Rev. E (TI OMAP AM/DM37x)";
16 compatible = "isee,omap3-igep0030", "ti,omap36xx", "ti,omap3"; 16 compatible = "isee,omap3-igep0030", "ti,omap36xx", "ti,omap3";
17 17
18 leds { 18 /* Regulator to trigger the WIFI_PDN signal of the Wifi module */
19 pinctrl-names = "default"; 19 lbee1usjyc_pdn: lbee1usjyc_pdn {
20 pinctrl-0 = <&leds_pins>; 20 compatible = "regulator-fixed";
21 compatible = "gpio-leds"; 21 regulator-name = "regulator-lbee1usjyc-pdn";
22 22 regulator-min-microvolt = <3300000>;
23 boot { 23 regulator-max-microvolt = <3300000>;
24 label = "omap3:green:boot"; 24 gpio = <&gpio5 10 GPIO_ACTIVE_HIGH>; /* gpio_138 - WIFI_PDN */
25 gpios = <&twl_gpio 13 GPIO_ACTIVE_LOW>; 25 startup-delay-us = <10000>;
26 default-state = "on"; 26 enable-active-high;
27 }; 27 };
28
29 user0 {
30 label = "omap3:red:user0";
31 gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>; /* LEDA */
32 default-state = "off";
33 };
34
35 user1 {
36 label = "omap3:green:user1";
37 gpios = <&twl_gpio 19 GPIO_ACTIVE_LOW>; /* LEDB */
38 default-state = "off";
39 };
40 28
41 user2 { 29 /* Regulator to trigger the RESET_N_W signal of the Wifi module */
42 label = "omap3:red:user1"; 30 lbee1usjyc_reset_n_w: lbee1usjyc_reset_n_w {
43 gpios = <&gpio1 16 GPIO_ACTIVE_LOW>; 31 compatible = "regulator-fixed";
44 default-state = "off"; 32 regulator-name = "regulator-lbee1usjyc-reset-n-w";
45 }; 33 regulator-min-microvolt = <3300000>;
34 regulator-max-microvolt = <3300000>;
35 gpio = <&gpio5 11 GPIO_ACTIVE_HIGH>; /* gpio_139 - RESET_N_W */
36 enable-active-high;
46 }; 37 };
47}; 38};
48 39
49&omap3_pmx_core2 { 40&omap3_pmx_core {
50 leds_pins: pinmux_leds_pins { 41 lbee1usjyc_pins: pinmux_lbee1usjyc_pins {
51 pinctrl-single,pins = < 42 pinctrl-single,pins = <
52 OMAP3630_CORE2_IOPAD(0x25e0, PIN_OUTPUT | MUX_MODE4) /* etk_d2.gpio_16 */ 43 OMAP3_CORE1_IOPAD(0x2166, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat5.gpio_137 - RESET_N_W */
44 OMAP3_CORE1_IOPAD(0x2168, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat6.gpio_138 - WIFI_PDN */
45 OMAP3_CORE1_IOPAD(0x216a, PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 - RST_N_B */
53 >; 46 >;
54 }; 47 };
55}; 48};
56 49
57&gpmc { 50&leds {
58 ranges = <0 0 0x00000000 0x20000000>; 51 pinctrl-names = "default";
59 52 pinctrl-0 = <&leds_core2_pins>;
60 nand@0,0 {
61 linux,mtd-name= "micron,mt29c4g96maz";
62 reg = <0 0 0>;
63 nand-bus-width = <16>;
64 ti,nand-ecc-opt = "bch8";
65 53
66 gpmc,sync-clk-ps = <0>; 54 boot {
67 gpmc,cs-on-ns = <0>; 55 label = "omap3:green:boot";
68 gpmc,cs-rd-off-ns = <44>; 56 gpios = <&twl_gpio 13 GPIO_ACTIVE_LOW>; /* LEDSYNC */
69 gpmc,cs-wr-off-ns = <44>; 57 default-state = "on";
70 gpmc,adv-on-ns = <6>;
71 gpmc,adv-rd-off-ns = <34>;
72 gpmc,adv-wr-off-ns = <44>;
73 gpmc,we-off-ns = <40>;
74 gpmc,oe-off-ns = <54>;
75 gpmc,access-ns = <64>;
76 gpmc,rd-cycle-ns = <82>;
77 gpmc,wr-cycle-ns = <82>;
78 gpmc,wr-access-ns = <40>;
79 gpmc,wr-data-mux-bus-ns = <0>;
80
81 #address-cells = <1>;
82 #size-cells = <1>;
83
84 partition@0 {
85 label = "SPL";
86 reg = <0 0x100000>;
87 };
88 partition@80000 {
89 label = "U-Boot";
90 reg = <0x100000 0x180000>;
91 };
92 partition@1c0000 {
93 label = "Environment";
94 reg = <0x280000 0x100000>;
95 };
96 partition@280000 {
97 label = "Kernel";
98 reg = <0x380000 0x300000>;
99 };
100 partition@780000 {
101 label = "Filesystem";
102 reg = <0x680000 0x1f980000>;
103 };
104 }; 58 };
105}; 59};
60
61/* On board Wifi module */
62&mmc2 {
63 pinctrl-names = "default";
64 pinctrl-0 = <&mmc2_pins &lbee1usjyc_pins>;
65 vmmc-supply = <&lbee1usjyc_pdn>;
66 vmmc_aux-supply = <&lbee1usjyc_reset_n_w>;
67 bus-width = <4>;
68 non-removable;
69};
70
diff --git a/arch/arm/boot/dts/omap3-ldp.dts b/arch/arm/boot/dts/omap3-ldp.dts
index 72dca0b7904d..b699bc48f242 100644
--- a/arch/arm/boot/dts/omap3-ldp.dts
+++ b/arch/arm/boot/dts/omap3-ldp.dts
@@ -7,6 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10#include <dt-bindings/input/input.h>
10#include "omap34xx.dtsi" 11#include "omap34xx.dtsi"
11#include "omap-gpmc-smsc911x.dtsi" 12#include "omap-gpmc-smsc911x.dtsi"
12 13
@@ -101,8 +102,9 @@
101 102
102 nand@0,0 { 103 nand@0,0 {
103 linux,mtd-name= "micron,nand"; 104 linux,mtd-name= "micron,nand";
104 reg = <0 0 0>; 105 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
105 nand-bus-width = <16>; 106 nand-bus-width = <16>;
107 gpmc,device-width = <2>;
106 ti,nand-ecc-opt = "bch8"; 108 ti,nand-ecc-opt = "bch8";
107 109
108 gpmc,sync-clk-ps = <0>; 110 gpmc,sync-clk-ps = <0>;
@@ -141,7 +143,7 @@
141 }; 143 };
142 partition@2000000 { 144 partition@2000000 {
143 label = "Filesystem"; 145 label = "Filesystem";
144 reg = <0x2000000 0xe000000>; 146 reg = <0x2000000 0x6000000>;
145 }; 147 };
146 }; 148 };
147 149
@@ -263,6 +265,26 @@
263 }; 265 };
264}; 266};
265 267
268&twl_keypad {
269 linux,keymap = <MATRIX_KEY(0, 0, KEY_1)
270 MATRIX_KEY(0, 1, KEY_2)
271 MATRIX_KEY(0, 2, KEY_3)
272 MATRIX_KEY(1, 0, KEY_4)
273 MATRIX_KEY(1, 1, KEY_5)
274 MATRIX_KEY(1, 2, KEY_6)
275 MATRIX_KEY(1, 3, KEY_F5)
276 MATRIX_KEY(2, 0, KEY_7)
277 MATRIX_KEY(2, 1, KEY_8)
278 MATRIX_KEY(2, 2, KEY_9)
279 MATRIX_KEY(2, 3, KEY_F6)
280 MATRIX_KEY(3, 0, KEY_F7)
281 MATRIX_KEY(3, 1, KEY_0)
282 MATRIX_KEY(3, 2, KEY_F8)
283 MATRIX_KEY(5, 4, KEY_RESERVED)
284 MATRIX_KEY(4, 4, KEY_VOLUMEUP)
285 MATRIX_KEY(5, 5, KEY_VOLUMEDOWN)>;
286};
287
266&uart3 { 288&uart3 {
267 interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>; 289 interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
268}; 290};
diff --git a/arch/arm/boot/dts/omap3-lilly-a83x.dtsi b/arch/arm/boot/dts/omap3-lilly-a83x.dtsi
index d97308896f0c..e81fb651d5d0 100644
--- a/arch/arm/boot/dts/omap3-lilly-a83x.dtsi
+++ b/arch/arm/boot/dts/omap3-lilly-a83x.dtsi
@@ -363,7 +363,7 @@
363 <7 0 0x15000000 0x01000000>; 363 <7 0 0x15000000 0x01000000>;
364 364
365 nand@0,0 { 365 nand@0,0 {
366 reg = <0 0 0x1000000>; 366 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
367 nand-bus-width = <16>; 367 nand-bus-width = <16>;
368 ti,nand-ecc-opt = "bch8"; 368 ti,nand-ecc-opt = "bch8";
369 /* no elm on omap3 */ 369 /* no elm on omap3 */
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index bc82a12d4c2c..53f3ca064140 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -115,6 +115,12 @@
115 eci-switch-gpios = <&gpio6 22 GPIO_ACTIVE_HIGH>; /* 182 */ 115 eci-switch-gpios = <&gpio6 22 GPIO_ACTIVE_HIGH>; /* 182 */
116 speaker-amplifier-gpios = <&twl_gpio 7 GPIO_ACTIVE_HIGH>; 116 speaker-amplifier-gpios = <&twl_gpio 7 GPIO_ACTIVE_HIGH>;
117 }; 117 };
118
119 battery: n900-battery {
120 compatible = "nokia,n900-battery";
121 io-channels = <&twl_madc 0>, <&twl_madc 4>, <&twl_madc 12>;
122 io-channel-names = "temp", "bsi", "vbat";
123 };
118}; 124};
119 125
120&omap3_pmx_core { 126&omap3_pmx_core {
@@ -142,6 +148,33 @@
142 >; 148 >;
143 }; 149 };
144 150
151 gpmc_pins: pinmux_gpmc_pins {
152 pinctrl-single,pins = <
153
154 /* address lines */
155 OMAP3_CORE1_IOPAD(0x207a, PIN_OUTPUT | MUX_MODE0) /* gpmc_a1.gpmc_a1 */
156 OMAP3_CORE1_IOPAD(0x207c, PIN_OUTPUT | MUX_MODE0) /* gpmc_a2.gpmc_a2 */
157 OMAP3_CORE1_IOPAD(0x207e, PIN_OUTPUT | MUX_MODE0) /* gpmc_a3.gpmc_a3 */
158
159 /* data lines, gpmc_d0..d7 not muxable according to TRM */
160 OMAP3_CORE1_IOPAD(0x209e, PIN_INPUT | MUX_MODE0) /* gpmc_d8.gpmc_d8 */
161 OMAP3_CORE1_IOPAD(0x20a0, PIN_INPUT | MUX_MODE0) /* gpmc_d9.gpmc_d9 */
162 OMAP3_CORE1_IOPAD(0x20a2, PIN_INPUT | MUX_MODE0) /* gpmc_d10.gpmc_d10 */
163 OMAP3_CORE1_IOPAD(0x20a4, PIN_INPUT | MUX_MODE0) /* gpmc_d11.gpmc_d11 */
164 OMAP3_CORE1_IOPAD(0x20a6, PIN_INPUT | MUX_MODE0) /* gpmc_d12.gpmc_d12 */
165 OMAP3_CORE1_IOPAD(0x20a8, PIN_INPUT | MUX_MODE0) /* gpmc_d13.gpmc_d13 */
166 OMAP3_CORE1_IOPAD(0x20aa, PIN_INPUT | MUX_MODE0) /* gpmc_d14.gpmc_d14 */
167 OMAP3_CORE1_IOPAD(0x20ac, PIN_INPUT | MUX_MODE0) /* gpmc_d15.gpmc_d15 */
168
169 /*
170 * gpmc_ncs0, gpmc_nadv_ale, gpmc_noe, gpmc_nwe, gpmc_wait0 not muxable
171 * according to TRM. OneNAND seems to require PIN_INPUT on clock.
172 */
173 OMAP3_CORE1_IOPAD(0x20b0, PIN_OUTPUT | MUX_MODE0) /* gpmc_ncs1.gpmc_ncs1 */
174 OMAP3_CORE1_IOPAD(0x20be, PIN_INPUT | MUX_MODE0) /* gpmc_clk.gpmc_clk */
175 >;
176 };
177
145 i2c1_pins: pinmux_i2c1_pins { 178 i2c1_pins: pinmux_i2c1_pins {
146 pinctrl-single,pins = < 179 pinctrl-single,pins = <
147 0x18a (PIN_INPUT | MUX_MODE0) /* i2c1_scl */ 180 0x18a (PIN_INPUT | MUX_MODE0) /* i2c1_scl */
@@ -540,6 +573,16 @@
540 power-gpio = <&gpio4 2 GPIO_ACTIVE_HIGH>; /* 98 */ 573 power-gpio = <&gpio4 2 GPIO_ACTIVE_HIGH>; /* 98 */
541 }; 574 };
542 575
576 si4713: si4713@63 {
577 compatible = "silabs,si4713";
578 reg = <0x63>;
579
580 interrupts-extended = <&gpio2 21 IRQ_TYPE_EDGE_FALLING>; /* 53 */
581 reset-gpios = <&gpio6 3 GPIO_ACTIVE_HIGH>; /* 163 */
582 vio-supply = <&vio>;
583 vdd-supply = <&vaux1>;
584 };
585
543 bq24150a: bq24150a@6b { 586 bq24150a: bq24150a@6b {
544 compatible = "ti,bq24150a"; 587 compatible = "ti,bq24150a";
545 reg = <0x6b>; 588 reg = <0x6b>;
@@ -585,16 +628,16 @@
585}; 628};
586 629
587&gpmc { 630&gpmc {
588 ranges = <0 0 0x04000000 0x10000000>; /* 256MB */
589 ranges = <0 0 0x01000000 0x01000000>, /* 16 MB for OneNAND */ 631 ranges = <0 0 0x01000000 0x01000000>, /* 16 MB for OneNAND */
590 <1 0 0x02000000 0x01000000>; /* 16 MB for smc91c96 */ 632 <1 0 0x02000000 0x01000000>; /* 16 MB for smc91c96 */
633 pinctrl-names = "default";
634 pinctrl-0 = <&gpmc_pins>;
591 635
592 /* gpio-irq for dma: 65 */ 636 /* sys_ndmareq1 could be used by the driver, not as gpio65 though */
593
594 onenand@0,0 { 637 onenand@0,0 {
595 #address-cells = <1>; 638 #address-cells = <1>;
596 #size-cells = <1>; 639 #size-cells = <1>;
597 reg = <0 0 0x10000000>; 640 reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */
598 641
599 gpmc,sync-read; 642 gpmc,sync-read;
600 gpmc,sync-write; 643 gpmc,sync-write;
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi
index 70addcba37c5..1e49dfe7e212 100644
--- a/arch/arm/boot/dts/omap3-n950-n9.dtsi
+++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
@@ -115,12 +115,12 @@
115}; 115};
116 116
117&gpmc { 117&gpmc {
118 ranges = <0 0 0x04000000 0x20000000>; 118 ranges = <0 0 0x04000000 0x1000000>; /* CS0: 16MB for OneNAND */
119 119
120 onenand@0,0 { 120 onenand@0,0 {
121 #address-cells = <1>; 121 #address-cells = <1>;
122 #size-cells = <1>; 122 #size-cells = <1>;
123 reg = <0 0 0x20000000>; 123 reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */
124 124
125 gpmc,sync-read; 125 gpmc,sync-read;
126 gpmc,sync-write; 126 gpmc,sync-write;
diff --git a/arch/arm/boot/dts/omap3-sb-t35.dtsi b/arch/arm/boot/dts/omap3-sb-t35.dtsi
index d59e3de1441e..827f614261f6 100644
--- a/arch/arm/boot/dts/omap3-sb-t35.dtsi
+++ b/arch/arm/boot/dts/omap3-sb-t35.dtsi
@@ -2,6 +2,59 @@
2 * Common support for CompuLab SB-T35 used on SBC-T3530, SBC-T3517 and SBC-T3730 2 * Common support for CompuLab SB-T35 used on SBC-T3530, SBC-T3517 and SBC-T3730
3 */ 3 */
4 4
5/ {
6 tfp410: encoder@0 {
7 compatible = "ti,tfp410";
8
9 powerdown-gpios = <&gpio2 22 GPIO_ACTIVE_LOW>; /* gpio_54 */
10
11 pinctrl-names = "default";
12 pinctrl-0 = <&tfp410_pins>;
13
14 ports {
15 #address-cells = <1>;
16 #size-cells = <0>;
17
18 port@0 {
19 reg = <0>;
20
21 tfp410_in: endpoint@0 {
22 remote-endpoint = <&dpi_out>;
23 };
24 };
25
26 port@1 {
27 reg = <1>;
28
29 tfp410_out: endpoint@0 {
30 remote-endpoint = <&dvi_connector_in>;
31 };
32 };
33 };
34 };
35
36 dvi0: connector@0 {
37 compatible = "dvi-connector";
38 label = "dvi";
39
40 port {
41 dvi_connector_in: endpoint {
42 remote-endpoint = <&tfp410_out>;
43 };
44 };
45 };
46
47 audio_amp: audio_amp {
48 compatible = "regulator-fixed";
49 regulator-name = "audio_amp";
50 pinctrl-names = "default";
51 pinctrl-0 = <&sb_t35_audio_amp>;
52 gpio = <&gpio2 29 GPIO_ACTIVE_LOW>; /* gpio_61 */
53 enable-active-low;
54 regulator-always-on;
55 };
56};
57
5&omap3_pmx_core { 58&omap3_pmx_core {
6 smsc2_pins: pinmux_smsc2_pins { 59 smsc2_pins: pinmux_smsc2_pins {
7 pinctrl-single,pins = < 60 pinctrl-single,pins = <
@@ -9,6 +62,38 @@
9 OMAP3_CORE1_IOPAD(0x20d2, PIN_INPUT_PULLUP | MUX_MODE4) /* gpmc_wait3.gpio_65 */ 62 OMAP3_CORE1_IOPAD(0x20d2, PIN_INPUT_PULLUP | MUX_MODE4) /* gpmc_wait3.gpio_65 */
10 >; 63 >;
11 }; 64 };
65
66 tfp410_pins: pinmux_tfp410_pins {
67 pinctrl-single,pins = <
68 OMAP3_CORE1_IOPAD(0x20b4, PIN_OUTPUT | MUX_MODE4) /* gpmc_ncs3.gpio_54 */
69 >;
70 };
71
72 i2c3_pins: pinmux_i2c3_pins {
73 pinctrl-single,pins = <
74 OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl */
75 OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda */
76 >;
77 };
78
79 sb_t35_audio_amp: pinmux_sb_t35_audio_amp {
80 pinctrl-single,pins = <
81 OMAP3_CORE1_IOPAD(0x20c8, PIN_OUTPUT | MUX_MODE4) /* gpmc_nbe1.gpio_61 */
82 >;
83 };
84};
85
86&i2c3 {
87 pinctrl-names = "default";
88 pinctrl-0 = <&i2c3_pins>;
89
90 clock-frequency = <400000>;
91
92 at24@50 {
93 compatible = "at24,24c02";
94 pagesize = <16>;
95 reg = <0x50>;
96 };
12}; 97};
13 98
14&gpmc { 99&gpmc {
@@ -22,24 +107,29 @@
22 interrupts = <1 IRQ_TYPE_LEVEL_LOW>; 107 interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
23 reg = <4 0 0xff>; 108 reg = <4 0 0xff>;
24 bank-width = <2>; 109 bank-width = <2>;
25 gpmc,mux-add-data; 110 gpmc,device-width = <1>;
26 gpmc,cs-on-ns = <1>; 111 gpmc,cycle2cycle-samecsen = <1>;
27 gpmc,cs-rd-off-ns = <180>; 112 gpmc,cycle2cycle-diffcsen = <1>;
28 gpmc,cs-wr-off-ns = <180>; 113 gpmc,cs-on-ns = <5>;
29 gpmc,adv-rd-off-ns = <18>; 114 gpmc,cs-rd-off-ns = <150>;
30 gpmc,adv-wr-off-ns = <48>; 115 gpmc,cs-wr-off-ns = <150>;
31 gpmc,oe-on-ns = <54>; 116 gpmc,adv-on-ns = <0>;
32 gpmc,oe-off-ns = <168>; 117 gpmc,adv-rd-off-ns = <15>;
33 gpmc,we-on-ns = <54>; 118 gpmc,adv-wr-off-ns = <40>;
34 gpmc,we-off-ns = <168>; 119 gpmc,oe-on-ns = <45>;
35 gpmc,rd-cycle-ns = <186>; 120 gpmc,oe-off-ns = <140>;
36 gpmc,wr-cycle-ns = <186>; 121 gpmc,we-on-ns = <45>;
37 gpmc,access-ns = <144>; 122 gpmc,we-off-ns = <140>;
38 gpmc,page-burst-access-ns = <24>; 123 gpmc,rd-cycle-ns = <155>;
39 gpmc,bus-turnaround-ns = <90>; 124 gpmc,wr-cycle-ns = <155>;
40 gpmc,cycle2cycle-delay-ns = <90>; 125 gpmc,access-ns = <120>;
41 gpmc,cycle2cycle-samecsen; 126 gpmc,page-burst-access-ns = <20>;
42 gpmc,cycle2cycle-diffcsen; 127 gpmc,bus-turnaround-ns = <75>;
128 gpmc,cycle2cycle-delay-ns = <75>;
129 gpmc,wait-monitoring-ns = <0>;
130 gpmc,clk-activation-ns = <0>;
131 gpmc,wr-data-mux-bus-ns = <0>;
132 gpmc,wr-access-ns = <0>;
43 vddvario-supply = <&vddvario>; 133 vddvario-supply = <&vddvario>;
44 vdd33a-supply = <&vdd33a>; 134 vdd33a-supply = <&vdd33a>;
45 reg-io-width = <4>; 135 reg-io-width = <4>;
diff --git a/arch/arm/boot/dts/omap3-sbc-t3517.dts b/arch/arm/boot/dts/omap3-sbc-t3517.dts
index 42189b65d393..17986536c61f 100644
--- a/arch/arm/boot/dts/omap3-sbc-t3517.dts
+++ b/arch/arm/boot/dts/omap3-sbc-t3517.dts
@@ -9,6 +9,11 @@
9 model = "CompuLab SBC-T3517 with CM-T3517"; 9 model = "CompuLab SBC-T3517 with CM-T3517";
10 compatible = "compulab,omap3-sbc-t3517", "compulab,omap3-cm-t3517", "ti,am3517", "ti,omap3"; 10 compatible = "compulab,omap3-sbc-t3517", "compulab,omap3-cm-t3517", "ti,am3517", "ti,omap3";
11 11
12 aliases {
13 display0 = &dvi0;
14 display1 = &tv0;
15 };
16
12 /* Only one GPMC smsc9220 on SBC-T3517, CM-T3517 uses am35x Ethernet */ 17 /* Only one GPMC smsc9220 on SBC-T3517, CM-T3517 uses am35x Ethernet */
13 vddvario: regulator-vddvario-sb-t35 { 18 vddvario: regulator-vddvario-sb-t35 {
14 compatible = "regulator-fixed"; 19 compatible = "regulator-fixed";
@@ -54,3 +59,13 @@
54 wp-gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>; /* gpio_59 */ 59 wp-gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>; /* gpio_59 */
55 cd-gpios = <&gpio5 16 GPIO_ACTIVE_HIGH>; /* gpio_144 */ 60 cd-gpios = <&gpio5 16 GPIO_ACTIVE_HIGH>; /* gpio_144 */
56}; 61};
62
63&dss {
64 port {
65 dpi_out: endpoint {
66 remote-endpoint = <&tfp410_in>;
67 data-lines = <24>;
68 };
69 };
70};
71
diff --git a/arch/arm/boot/dts/omap3-sbc-t3530.dts b/arch/arm/boot/dts/omap3-sbc-t3530.dts
index bbbeea6b1988..c994f0f7e38a 100644
--- a/arch/arm/boot/dts/omap3-sbc-t3530.dts
+++ b/arch/arm/boot/dts/omap3-sbc-t3530.dts
@@ -8,6 +8,11 @@
8/ { 8/ {
9 model = "CompuLab SBC-T3530 with CM-T3530"; 9 model = "CompuLab SBC-T3530 with CM-T3530";
10 compatible = "compulab,omap3-sbc-t3530", "compulab,omap3-cm-t3530", "ti,omap34xx", "ti,omap3"; 10 compatible = "compulab,omap3-sbc-t3530", "compulab,omap3-cm-t3530", "ti,omap34xx", "ti,omap3";
11
12 aliases {
13 display0 = &dvi0;
14 display1 = &tv0;
15 };
11}; 16};
12 17
13&omap3_pmx_core { 18&omap3_pmx_core {
@@ -34,3 +39,13 @@
34&mmc1 { 39&mmc1 {
35 cd-gpios = <&twl_gpio 0 GPIO_ACTIVE_HIGH>; 40 cd-gpios = <&twl_gpio 0 GPIO_ACTIVE_HIGH>;
36}; 41};
42
43&dss {
44 port {
45 dpi_out: endpoint {
46 remote-endpoint = <&tfp410_in>;
47 data-lines = <24>;
48 };
49 };
50};
51
diff --git a/arch/arm/boot/dts/omap3-sbc-t3730.dts b/arch/arm/boot/dts/omap3-sbc-t3730.dts
index 08e4a7086f22..5bdddf29341d 100644
--- a/arch/arm/boot/dts/omap3-sbc-t3730.dts
+++ b/arch/arm/boot/dts/omap3-sbc-t3730.dts
@@ -8,6 +8,11 @@
8/ { 8/ {
9 model = "CompuLab SBC-T3730 with CM-T3730"; 9 model = "CompuLab SBC-T3730 with CM-T3730";
10 compatible = "compulab,omap3-sbc-t3730", "compulab,omap3-cm-t3730", "ti,omap36xx", "ti,omap3"; 10 compatible = "compulab,omap3-sbc-t3730", "compulab,omap3-cm-t3730", "ti,omap36xx", "ti,omap3";
11
12 aliases {
13 display0 = &dvi0;
14 display1 = &tv0;
15 };
11}; 16};
12 17
13&omap3_pmx_core { 18&omap3_pmx_core {
@@ -25,3 +30,13 @@
25 ranges = <5 0 0x2c000000 0x01000000>, 30 ranges = <5 0 0x2c000000 0x01000000>,
26 <4 0 0x2d000000 0x01000000>; 31 <4 0 0x2d000000 0x01000000>;
27}; 32};
33
34&dss {
35 port {
36 dpi_out: endpoint {
37 remote-endpoint = <&tfp410_in>;
38 data-lines = <24>;
39 };
40 };
41};
42
diff --git a/arch/arm/boot/dts/omap3-tao3530.dtsi b/arch/arm/boot/dts/omap3-tao3530.dtsi
index b30f387d3a83..e89820a6776e 100644
--- a/arch/arm/boot/dts/omap3-tao3530.dtsi
+++ b/arch/arm/boot/dts/omap3-tao3530.dtsi
@@ -270,7 +270,7 @@
270 ranges = <0 0 0x00000000 0x01000000>; 270 ranges = <0 0 0x00000000 0x01000000>;
271 271
272 nand@0,0 { 272 nand@0,0 {
273 reg = <0 0 0>; /* CS0, offset 0 */ 273 reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
274 nand-bus-width = <16>; 274 nand-bus-width = <16>;
275 gpmc,device-width = <2>; /* GPMC_DEVWIDTH_16BIT */ 275 gpmc,device-width = <2>; /* GPMC_DEVWIDTH_16BIT */
276 ti,nand-ecc-opt = "sw"; 276 ti,nand-ecc-opt = "sw";
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index d0e884d3a737..01b71111bd55 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -79,7 +79,7 @@
79 * hierarchy. 79 * hierarchy.
80 */ 80 */
81 ocp { 81 ocp {
82 compatible = "simple-bus"; 82 compatible = "ti,omap3-l3-smx", "simple-bus";
83 reg = <0x68000000 0x10000>; 83 reg = <0x68000000 0x10000>;
84 interrupts = <9 10>; 84 interrupts = <9 10>;
85 #address-cells = <1>; 85 #address-cells = <1>;
@@ -332,6 +332,7 @@
332 ti,hwmods = "mailbox"; 332 ti,hwmods = "mailbox";
333 reg = <0x48094000 0x200>; 333 reg = <0x48094000 0x200>;
334 interrupts = <26>; 334 interrupts = <26>;
335 #mbox-cells = <1>;
335 ti,mbox-num-users = <2>; 336 ti,mbox-num-users = <2>;
336 ti,mbox-num-fifos = <2>; 337 ti,mbox-num-fifos = <2>;
337 mbox_dsp: dsp { 338 mbox_dsp: dsp {
diff --git a/arch/arm/boot/dts/omap3430-sdp.dts b/arch/arm/boot/dts/omap3430-sdp.dts
index 9bad94efe1c8..16b0cdfbee9c 100644
--- a/arch/arm/boot/dts/omap3430-sdp.dts
+++ b/arch/arm/boot/dts/omap3430-sdp.dts
@@ -51,8 +51,8 @@
51 51
52&gpmc { 52&gpmc {
53 ranges = <0 0 0x10000000 0x08000000>, 53 ranges = <0 0 0x10000000 0x08000000>,
54 <1 0 0x28000000 0x08000000>, 54 <1 0 0x28000000 0x1000000>, /* CS1: 16MB for NAND */
55 <2 0 0x20000000 0x10000000>; 55 <2 0 0x20000000 0x1000000>; /* CS2: 16MB for OneNAND */
56 56
57 nor@0,0 { 57 nor@0,0 {
58 compatible = "cfi-flash"; 58 compatible = "cfi-flash";
@@ -106,7 +106,7 @@
106 linux,mtd-name= "micron,mt29f1g08abb"; 106 linux,mtd-name= "micron,mt29f1g08abb";
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 4>; /* CS1, offset 0, IO size 4 */
110 ti,nand-ecc-opt = "sw"; 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>;
@@ -150,7 +150,7 @@
150 linux,mtd-name= "samsung,kfm2g16q2m-deb8"; 150 linux,mtd-name= "samsung,kfm2g16q2m-deb8";
151 #address-cells = <1>; 151 #address-cells = <1>;
152 #size-cells = <1>; 152 #size-cells = <1>;
153 reg = <2 0 0x10000000>; 153 reg = <2 0 0x20000>; /* CS2, offset 0, IO size 4 */
154 154
155 gpmc,device-width = <2>; 155 gpmc,device-width = <2>;
156 gpmc,mux-add-data = <2>; 156 gpmc,mux-add-data = <2>;
diff --git a/arch/arm/boot/dts/omap4-duovero-parlor.dts b/arch/arm/boot/dts/omap4-duovero-parlor.dts
index 6dc84d9f9b4c..1a78f013f37a 100644
--- a/arch/arm/boot/dts/omap4-duovero-parlor.dts
+++ b/arch/arm/boot/dts/omap4-duovero-parlor.dts
@@ -177,6 +177,7 @@
177 177
178&hdmi { 178&hdmi {
179 status = "ok"; 179 status = "ok";
180 vdda-supply = <&vdac>;
180 181
181 pinctrl-names = "default"; 182 pinctrl-names = "default";
182 pinctrl-0 = <&dss_hdmi_pins>; 183 pinctrl-0 = <&dss_hdmi_pins>;
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 878c979203d0..074147cebae4 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -661,6 +661,7 @@
661 reg = <0x4a0f4000 0x200>; 661 reg = <0x4a0f4000 0x200>;
662 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; 662 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
663 ti,hwmods = "mailbox"; 663 ti,hwmods = "mailbox";
664 #mbox-cells = <1>;
664 ti,mbox-num-users = <3>; 665 ti,mbox-num-users = <3>;
665 ti,mbox-num-fifos = <8>; 666 ti,mbox-num-fifos = <8>;
666 mbox_ipu: mbox_ipu { 667 mbox_ipu: mbox_ipu {
@@ -895,7 +896,7 @@
895 reg = <0x58002000 0x1000>; 896 reg = <0x58002000 0x1000>;
896 status = "disabled"; 897 status = "disabled";
897 ti,hwmods = "dss_rfbi"; 898 ti,hwmods = "dss_rfbi";
898 clocks = <&dss_dss_clk>, <&dss_fck>; 899 clocks = <&dss_dss_clk>, <&l3_div_ck>;
899 clock-names = "fck", "ick"; 900 clock-names = "fck", "ick";
900 }; 901 };
901 902
diff --git a/arch/arm/boot/dts/omap44xx-clocks.dtsi b/arch/arm/boot/dts/omap44xx-clocks.dtsi
index c821ff5e9b8d..f2c48f09824e 100644
--- a/arch/arm/boot/dts/omap44xx-clocks.dtsi
+++ b/arch/arm/boot/dts/omap44xx-clocks.dtsi
@@ -1018,14 +1018,6 @@
1018 reg = <0x1120>; 1018 reg = <0x1120>;
1019 }; 1019 };
1020 1020
1021 dss_fck: dss_fck {
1022 #clock-cells = <0>;
1023 compatible = "ti,gate-clock";
1024 clocks = <&l3_div_ck>;
1025 ti,bit-shift = <1>;
1026 reg = <0x1120>;
1027 };
1028
1029 fdif_fck: fdif_fck { 1021 fdif_fck: fdif_fck {
1030 #clock-cells = <0>; 1022 #clock-cells = <0>;
1031 compatible = "ti,divider-clock"; 1023 compatible = "ti,divider-clock";
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 256b7f69e45b..b321fdf42c9f 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -651,6 +651,7 @@
651 reg = <0x4a0f4000 0x200>; 651 reg = <0x4a0f4000 0x200>;
652 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; 652 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
653 ti,hwmods = "mailbox"; 653 ti,hwmods = "mailbox";
654 #mbox-cells = <1>;
654 ti,mbox-num-users = <3>; 655 ti,mbox-num-users = <3>;
655 ti,mbox-num-fifos = <8>; 656 ti,mbox-num-fifos = <8>;
656 mbox_ipu: mbox_ipu { 657 mbox_ipu: mbox_ipu {
diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi
index 963b7e54ab15..1ca1a9aa953f 100644
--- a/arch/arm/boot/dts/prima2.dtsi
+++ b/arch/arm/boot/dts/prima2.dtsi
@@ -41,6 +41,11 @@
41 }; 41 };
42 }; 42 };
43 43
44 arm-pmu {
45 compatible = "arm,cortex-a9-pmu";
46 interrupts = <29>;
47 };
48
44 axi { 49 axi {
45 compatible = "simple-bus"; 50 compatible = "simple-bus";
46 #address-cells = <1>; 51 #address-cells = <1>;
@@ -132,6 +137,7 @@
132 reg = <0x90020000 0x10000>; 137 reg = <0x90020000 0x10000>;
133 interrupts = <31>; 138 interrupts = <31>;
134 clocks = <&clks 35>; 139 clocks = <&clks 35>;
140 resets = <&rstc 6>;
135 }; 141 };
136 }; 142 };
137 143
@@ -173,6 +179,7 @@
173 compatible = "sirf,prima2-dspif"; 179 compatible = "sirf,prima2-dspif";
174 reg = <0xa8000000 0x10000>; 180 reg = <0xa8000000 0x10000>;
175 interrupts = <9>; 181 interrupts = <9>;
182 resets = <&rstc 1>;
176 }; 183 };
177 184
178 gps@a8010000 { 185 gps@a8010000 {
@@ -180,6 +187,7 @@
180 reg = <0xa8010000 0x10000>; 187 reg = <0xa8010000 0x10000>;
181 interrupts = <7>; 188 interrupts = <7>;
182 clocks = <&clks 9>; 189 clocks = <&clks 9>;
190 resets = <&rstc 2>;
183 }; 191 };
184 192
185 dsp@a9000000 { 193 dsp@a9000000 {
@@ -187,6 +195,7 @@
187 reg = <0xa9000000 0x1000000>; 195 reg = <0xa9000000 0x1000000>;
188 interrupts = <8>; 196 interrupts = <8>;
189 clocks = <&clks 8>; 197 clocks = <&clks 8>;
198 resets = <&rstc 0>;
190 }; 199 };
191 }; 200 };
192 201
@@ -524,12 +533,36 @@
524 sirf,function = "sdmmc5"; 533 sirf,function = "sdmmc5";
525 }; 534 };
526 }; 535 };
536 i2s_mclk_pins_a: i2s_mclk@0 {
537 i2s_mclk {
538 sirf,pins = "i2smclkgrp";
539 sirf,function = "i2s_mclk";
540 };
541 };
542 i2s_ext_clk_input_pins_a: i2s_ext_clk_input@0 {
543 i2s_ext_clk_input {
544 sirf,pins = "i2s_ext_clk_inputgrp";
545 sirf,function = "i2s_ext_clk_input";
546 };
547 };
527 i2s_pins_a: i2s@0 { 548 i2s_pins_a: i2s@0 {
528 i2s { 549 i2s {
529 sirf,pins = "i2sgrp"; 550 sirf,pins = "i2sgrp";
530 sirf,function = "i2s"; 551 sirf,function = "i2s";
531 }; 552 };
532 }; 553 };
554 i2s_no_din_pins_a: i2s_no_din@0 {
555 i2s_no_din {
556 sirf,pins = "i2s_no_dingrp";
557 sirf,function = "i2s_no_din";
558 };
559 };
560 i2s_6chn_pins_a: i2s_6chn@0 {
561 i2s_6chn {
562 sirf,pins = "i2s_6chngrp";
563 sirf,function = "i2s_6chn";
564 };
565 };
533 ac97_pins_a: ac97@0 { 566 ac97_pins_a: ac97@0 {
534 ac97 { 567 ac97 {
535 sirf,pins = "ac97grp"; 568 sirf,pins = "ac97grp";
diff --git a/arch/arm/boot/dts/r7s72100-genmai.dts b/arch/arm/boot/dts/r7s72100-genmai.dts
index a3ed23c0a8f5..1518c5bcca33 100644
--- a/arch/arm/boot/dts/r7s72100-genmai.dts
+++ b/arch/arm/boot/dts/r7s72100-genmai.dts
@@ -21,7 +21,8 @@
21 }; 21 };
22 22
23 chosen { 23 chosen {
24 bootargs = "console=ttySC2,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp"; 24 bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
25 stdout-path = &scif2;
25 }; 26 };
26 27
27 memory { 28 memory {
diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index 801a556e264b..277e73c110e5 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -52,16 +52,6 @@
52 clock-output-names = "usb_x1"; 52 clock-output-names = "usb_x1";
53 }; 53 };
54 54
55 /* Special CPG clocks */
56 cpg_clocks: cpg_clocks@fcfe0000 {
57 #clock-cells = <1>;
58 compatible = "renesas,r7s72100-cpg-clocks",
59 "renesas,rz-cpg-clocks";
60 reg = <0xfcfe0000 0x18>;
61 clocks = <&extal_clk>, <&usb_x1_clk>;
62 clock-output-names = "pll", "i", "g";
63 };
64
65 /* Fixed factor clocks */ 55 /* Fixed factor clocks */
66 b_clk: b_clk { 56 b_clk: b_clk {
67 #clock-cells = <0>; 57 #clock-cells = <0>;
@@ -88,6 +78,16 @@
88 clock-output-names = "p0"; 78 clock-output-names = "p0";
89 }; 79 };
90 80
81 /* Special CPG clocks */
82 cpg_clocks: cpg_clocks@fcfe0000 {
83 #clock-cells = <1>;
84 compatible = "renesas,r7s72100-cpg-clocks",
85 "renesas,rz-cpg-clocks";
86 reg = <0xfcfe0000 0x18>;
87 clocks = <&extal_clk>, <&usb_x1_clk>;
88 clock-output-names = "pll", "i", "g";
89 };
90
91 /* MSTP clocks */ 91 /* MSTP clocks */
92 mstp3_clks: mstp3_clks@fcfe0420 { 92 mstp3_clks: mstp3_clks@fcfe0420 {
93 #clock-cells = <1>; 93 #clock-cells = <1>;
@@ -148,97 +148,6 @@
148 }; 148 };
149 }; 149 };
150 150
151 gic: interrupt-controller@e8201000 {
152 compatible = "arm,cortex-a9-gic";
153 #interrupt-cells = <3>;
154 #address-cells = <0>;
155 interrupt-controller;
156 reg = <0xe8201000 0x1000>,
157 <0xe8202000 0x1000>;
158 };
159
160 i2c0: i2c@fcfee000 {
161 #address-cells = <1>;
162 #size-cells = <0>;
163 compatible = "renesas,riic-r7s72100", "renesas,riic-rz";
164 reg = <0xfcfee000 0x44>;
165 interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>,
166 <0 158 IRQ_TYPE_EDGE_RISING>,
167 <0 159 IRQ_TYPE_EDGE_RISING>,
168 <0 160 IRQ_TYPE_LEVEL_HIGH>,
169 <0 161 IRQ_TYPE_LEVEL_HIGH>,
170 <0 162 IRQ_TYPE_LEVEL_HIGH>,
171 <0 163 IRQ_TYPE_LEVEL_HIGH>,
172 <0 164 IRQ_TYPE_LEVEL_HIGH>;
173 clocks = <&mstp9_clks R7S72100_CLK_I2C0>;
174 clock-frequency = <100000>;
175 status = "disabled";
176 };
177
178 i2c1: i2c@fcfee400 {
179 #address-cells = <1>;
180 #size-cells = <0>;
181 compatible = "renesas,riic-r7s72100", "renesas,riic-rz";
182 reg = <0xfcfee400 0x44>;
183 interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>,
184 <0 166 IRQ_TYPE_EDGE_RISING>,
185 <0 167 IRQ_TYPE_EDGE_RISING>,
186 <0 168 IRQ_TYPE_LEVEL_HIGH>,
187 <0 169 IRQ_TYPE_LEVEL_HIGH>,
188 <0 170 IRQ_TYPE_LEVEL_HIGH>,
189 <0 171 IRQ_TYPE_LEVEL_HIGH>,
190 <0 172 IRQ_TYPE_LEVEL_HIGH>;
191 clocks = <&mstp9_clks R7S72100_CLK_I2C1>;
192 clock-frequency = <100000>;
193 status = "disabled";
194 };
195
196 i2c2: i2c@fcfee800 {
197 #address-cells = <1>;
198 #size-cells = <0>;
199 compatible = "renesas,riic-r7s72100", "renesas,riic-rz";
200 reg = <0xfcfee800 0x44>;
201 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>,
202 <0 174 IRQ_TYPE_EDGE_RISING>,
203 <0 175 IRQ_TYPE_EDGE_RISING>,
204 <0 176 IRQ_TYPE_LEVEL_HIGH>,
205 <0 177 IRQ_TYPE_LEVEL_HIGH>,
206 <0 178 IRQ_TYPE_LEVEL_HIGH>,
207 <0 179 IRQ_TYPE_LEVEL_HIGH>,
208 <0 180 IRQ_TYPE_LEVEL_HIGH>;
209 clocks = <&mstp9_clks R7S72100_CLK_I2C2>;
210 clock-frequency = <100000>;
211 status = "disabled";
212 };
213
214 i2c3: i2c@fcfeec00 {
215 #address-cells = <1>;
216 #size-cells = <0>;
217 compatible = "renesas,riic-r7s72100", "renesas,riic-rz";
218 reg = <0xfcfeec00 0x44>;
219 interrupts = <0 181 IRQ_TYPE_LEVEL_HIGH>,
220 <0 182 IRQ_TYPE_EDGE_RISING>,
221 <0 183 IRQ_TYPE_EDGE_RISING>,
222 <0 184 IRQ_TYPE_LEVEL_HIGH>,
223 <0 185 IRQ_TYPE_LEVEL_HIGH>,
224 <0 186 IRQ_TYPE_LEVEL_HIGH>,
225 <0 187 IRQ_TYPE_LEVEL_HIGH>,
226 <0 188 IRQ_TYPE_LEVEL_HIGH>;
227 clocks = <&mstp9_clks R7S72100_CLK_I2C3>;
228 clock-frequency = <100000>;
229 status = "disabled";
230 };
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
242 scif0: serial@e8007000 { 151 scif0: serial@e8007000 {
243 compatible = "renesas,scif-r7s72100", "renesas,scif"; 152 compatible = "renesas,scif-r7s72100", "renesas,scif";
244 reg = <0xe8007000 64>; 153 reg = <0xe8007000 64>;
@@ -404,4 +313,95 @@
404 #size-cells = <0>; 313 #size-cells = <0>;
405 status = "disabled"; 314 status = "disabled";
406 }; 315 };
316
317 gic: interrupt-controller@e8201000 {
318 compatible = "arm,cortex-a9-gic";
319 #interrupt-cells = <3>;
320 #address-cells = <0>;
321 interrupt-controller;
322 reg = <0xe8201000 0x1000>,
323 <0xe8202000 0x1000>;
324 };
325
326 i2c0: i2c@fcfee000 {
327 #address-cells = <1>;
328 #size-cells = <0>;
329 compatible = "renesas,riic-r7s72100", "renesas,riic-rz";
330 reg = <0xfcfee000 0x44>;
331 interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>,
332 <0 158 IRQ_TYPE_EDGE_RISING>,
333 <0 159 IRQ_TYPE_EDGE_RISING>,
334 <0 160 IRQ_TYPE_LEVEL_HIGH>,
335 <0 161 IRQ_TYPE_LEVEL_HIGH>,
336 <0 162 IRQ_TYPE_LEVEL_HIGH>,
337 <0 163 IRQ_TYPE_LEVEL_HIGH>,
338 <0 164 IRQ_TYPE_LEVEL_HIGH>;
339 clocks = <&mstp9_clks R7S72100_CLK_I2C0>;
340 clock-frequency = <100000>;
341 status = "disabled";
342 };
343
344 i2c1: i2c@fcfee400 {
345 #address-cells = <1>;
346 #size-cells = <0>;
347 compatible = "renesas,riic-r7s72100", "renesas,riic-rz";
348 reg = <0xfcfee400 0x44>;
349 interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>,
350 <0 166 IRQ_TYPE_EDGE_RISING>,
351 <0 167 IRQ_TYPE_EDGE_RISING>,
352 <0 168 IRQ_TYPE_LEVEL_HIGH>,
353 <0 169 IRQ_TYPE_LEVEL_HIGH>,
354 <0 170 IRQ_TYPE_LEVEL_HIGH>,
355 <0 171 IRQ_TYPE_LEVEL_HIGH>,
356 <0 172 IRQ_TYPE_LEVEL_HIGH>;
357 clocks = <&mstp9_clks R7S72100_CLK_I2C1>;
358 clock-frequency = <100000>;
359 status = "disabled";
360 };
361
362 i2c2: i2c@fcfee800 {
363 #address-cells = <1>;
364 #size-cells = <0>;
365 compatible = "renesas,riic-r7s72100", "renesas,riic-rz";
366 reg = <0xfcfee800 0x44>;
367 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>,
368 <0 174 IRQ_TYPE_EDGE_RISING>,
369 <0 175 IRQ_TYPE_EDGE_RISING>,
370 <0 176 IRQ_TYPE_LEVEL_HIGH>,
371 <0 177 IRQ_TYPE_LEVEL_HIGH>,
372 <0 178 IRQ_TYPE_LEVEL_HIGH>,
373 <0 179 IRQ_TYPE_LEVEL_HIGH>,
374 <0 180 IRQ_TYPE_LEVEL_HIGH>;
375 clocks = <&mstp9_clks R7S72100_CLK_I2C2>;
376 clock-frequency = <100000>;
377 status = "disabled";
378 };
379
380 i2c3: i2c@fcfeec00 {
381 #address-cells = <1>;
382 #size-cells = <0>;
383 compatible = "renesas,riic-r7s72100", "renesas,riic-rz";
384 reg = <0xfcfeec00 0x44>;
385 interrupts = <0 181 IRQ_TYPE_LEVEL_HIGH>,
386 <0 182 IRQ_TYPE_EDGE_RISING>,
387 <0 183 IRQ_TYPE_EDGE_RISING>,
388 <0 184 IRQ_TYPE_LEVEL_HIGH>,
389 <0 185 IRQ_TYPE_LEVEL_HIGH>,
390 <0 186 IRQ_TYPE_LEVEL_HIGH>,
391 <0 187 IRQ_TYPE_LEVEL_HIGH>,
392 <0 188 IRQ_TYPE_LEVEL_HIGH>;
393 clocks = <&mstp9_clks R7S72100_CLK_I2C3>;
394 clock-frequency = <100000>;
395 status = "disabled";
396 };
397
398 mtu2: timer@fcff0000 {
399 compatible = "renesas,mtu2-r7s72100", "renesas,mtu2";
400 reg = <0xfcff0000 0x400>;
401 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
402 interrupt-names = "tgi0a";
403 clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
404 clock-names = "fck";
405 status = "disabled";
406 };
407}; 407};
diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
index a860f32bca27..84e05f713c54 100644
--- a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
+++ b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
@@ -21,7 +21,8 @@
21 }; 21 };
22 22
23 chosen { 23 chosen {
24 bootargs = "console=ttySC0,115200 ignore_loglevel rw"; 24 bootargs = "ignore_loglevel rw";
25 stdout-path = &scifa0;
25 }; 26 };
26 27
27 memory@40000000 { 28 memory@40000000 {
@@ -93,6 +94,10 @@
93 voltage-tolerance = <1>; /* 1% */ 94 voltage-tolerance = <1>; /* 1% */
94}; 95};
95 96
97&cmt1 {
98 status = "okay";
99};
100
96&pfc { 101&pfc {
97 scifa0_pins: serial0 { 102 scifa0_pins: serial0 {
98 renesas,groups = "scifa0_data"; 103 renesas,groups = "scifa0_data";
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index ef152e384822..5ac57babc3b9 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -30,18 +30,6 @@
30 }; 30 };
31 }; 31 };
32 32
33 gic: interrupt-controller@f1001000 {
34 compatible = "arm,cortex-a15-gic";
35 #interrupt-cells = <3>;
36 #address-cells = <0>;
37 interrupt-controller;
38 reg = <0 0xf1001000 0 0x1000>,
39 <0 0xf1002000 0 0x1000>,
40 <0 0xf1004000 0 0x2000>,
41 <0 0xf1006000 0 0x2000>;
42 interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
43 };
44
45 timer { 33 timer {
46 compatible = "arm,armv7-timer"; 34 compatible = "arm,armv7-timer";
47 interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 35 interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
@@ -50,6 +38,91 @@
50 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 38 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
51 }; 39 };
52 40
41 dmac: dma-multiplexer {
42 compatible = "renesas,shdma-mux";
43 #dma-cells = <1>;
44 dma-channels = <20>;
45 dma-requests = <256>;
46 #address-cells = <2>;
47 #size-cells = <2>;
48 ranges;
49
50 dma0: dma-controller@e6700020 {
51 compatible = "renesas,shdma-r8a73a4";
52 reg = <0 0xe6700020 0 0x89e0>;
53 interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH
54 0 200 IRQ_TYPE_LEVEL_HIGH
55 0 201 IRQ_TYPE_LEVEL_HIGH
56 0 202 IRQ_TYPE_LEVEL_HIGH
57 0 203 IRQ_TYPE_LEVEL_HIGH
58 0 204 IRQ_TYPE_LEVEL_HIGH
59 0 205 IRQ_TYPE_LEVEL_HIGH
60 0 206 IRQ_TYPE_LEVEL_HIGH
61 0 207 IRQ_TYPE_LEVEL_HIGH
62 0 208 IRQ_TYPE_LEVEL_HIGH
63 0 209 IRQ_TYPE_LEVEL_HIGH
64 0 210 IRQ_TYPE_LEVEL_HIGH
65 0 211 IRQ_TYPE_LEVEL_HIGH
66 0 212 IRQ_TYPE_LEVEL_HIGH
67 0 213 IRQ_TYPE_LEVEL_HIGH
68 0 214 IRQ_TYPE_LEVEL_HIGH
69 0 215 IRQ_TYPE_LEVEL_HIGH
70 0 216 IRQ_TYPE_LEVEL_HIGH
71 0 217 IRQ_TYPE_LEVEL_HIGH
72 0 218 IRQ_TYPE_LEVEL_HIGH
73 0 219 IRQ_TYPE_LEVEL_HIGH>;
74 interrupt-names = "error",
75 "ch0", "ch1", "ch2", "ch3",
76 "ch4", "ch5", "ch6", "ch7",
77 "ch8", "ch9", "ch10", "ch11",
78 "ch12", "ch13", "ch14", "ch15",
79 "ch16", "ch17", "ch18", "ch19";
80 };
81 };
82
83 pfc: pfc@e6050000 {
84 compatible = "renesas,pfc-r8a73a4";
85 reg = <0 0xe6050000 0 0x9000>;
86 gpio-controller;
87 #gpio-cells = <2>;
88 interrupts-extended =
89 <&irqc0 0 0>, <&irqc0 1 0>, <&irqc0 2 0>, <&irqc0 3 0>,
90 <&irqc0 4 0>, <&irqc0 5 0>, <&irqc0 6 0>, <&irqc0 7 0>,
91 <&irqc0 8 0>, <&irqc0 9 0>, <&irqc0 10 0>, <&irqc0 11 0>,
92 <&irqc0 12 0>, <&irqc0 13 0>, <&irqc0 14 0>, <&irqc0 15 0>,
93 <&irqc0 16 0>, <&irqc0 17 0>, <&irqc0 18 0>, <&irqc0 19 0>,
94 <&irqc0 20 0>, <&irqc0 21 0>, <&irqc0 22 0>, <&irqc0 23 0>,
95 <&irqc0 24 0>, <&irqc0 25 0>, <&irqc0 26 0>, <&irqc0 27 0>,
96 <&irqc0 28 0>, <&irqc0 29 0>, <&irqc0 30 0>, <&irqc0 31 0>,
97 <&irqc1 0 0>, <&irqc1 1 0>, <&irqc1 2 0>, <&irqc1 3 0>,
98 <&irqc1 4 0>, <&irqc1 5 0>, <&irqc1 6 0>, <&irqc1 7 0>,
99 <&irqc1 8 0>, <&irqc1 9 0>, <&irqc1 10 0>, <&irqc1 11 0>,
100 <&irqc1 12 0>, <&irqc1 13 0>, <&irqc1 14 0>, <&irqc1 15 0>,
101 <&irqc1 16 0>, <&irqc1 17 0>, <&irqc1 18 0>, <&irqc1 19 0>,
102 <&irqc1 20 0>, <&irqc1 21 0>, <&irqc1 22 0>, <&irqc1 23 0>,
103 <&irqc1 24 0>, <&irqc1 25 0>;
104 };
105
106 i2c5: i2c@e60b0000 {
107 #address-cells = <1>;
108 #size-cells = <0>;
109 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
110 reg = <0 0xe60b0000 0 0x428>;
111 interrupts = <0 179 IRQ_TYPE_LEVEL_HIGH>;
112
113 status = "disabled";
114 };
115
116 cmt1: timer@e6130000 {
117 compatible = "renesas,cmt-48-r8a73a4", "renesas,cmt-48-gen2";
118 reg = <0 0xe6130000 0 0x1004>;
119 interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>;
120
121 renesas,channels-mask = <0xff>;
122
123 status = "disabled";
124 };
125
53 irqc0: interrupt-controller@e61c0000 { 126 irqc0: interrupt-controller@e61c0000 {
54 compatible = "renesas,irqc-r8a73a4", "renesas,irqc"; 127 compatible = "renesas,irqc-r8a73a4", "renesas,irqc";
55 #interrupt-cells = <2>; 128 #interrupt-cells = <2>;
@@ -122,48 +195,6 @@
122 <0 57 IRQ_TYPE_LEVEL_HIGH>; 195 <0 57 IRQ_TYPE_LEVEL_HIGH>;
123 }; 196 };
124 197
125 dmac: dma-multiplexer@0 {
126 compatible = "renesas,shdma-mux";
127 #dma-cells = <1>;
128 dma-channels = <20>;
129 dma-requests = <256>;
130 #address-cells = <2>;
131 #size-cells = <2>;
132 ranges;
133
134 dma0: dma-controller@e6700020 {
135 compatible = "renesas,shdma-r8a73a4";
136 reg = <0 0xe6700020 0 0x89e0>;
137 interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH
138 0 200 IRQ_TYPE_LEVEL_HIGH
139 0 201 IRQ_TYPE_LEVEL_HIGH
140 0 202 IRQ_TYPE_LEVEL_HIGH
141 0 203 IRQ_TYPE_LEVEL_HIGH
142 0 204 IRQ_TYPE_LEVEL_HIGH
143 0 205 IRQ_TYPE_LEVEL_HIGH
144 0 206 IRQ_TYPE_LEVEL_HIGH
145 0 207 IRQ_TYPE_LEVEL_HIGH
146 0 208 IRQ_TYPE_LEVEL_HIGH
147 0 209 IRQ_TYPE_LEVEL_HIGH
148 0 210 IRQ_TYPE_LEVEL_HIGH
149 0 211 IRQ_TYPE_LEVEL_HIGH
150 0 212 IRQ_TYPE_LEVEL_HIGH
151 0 213 IRQ_TYPE_LEVEL_HIGH
152 0 214 IRQ_TYPE_LEVEL_HIGH
153 0 215 IRQ_TYPE_LEVEL_HIGH
154 0 216 IRQ_TYPE_LEVEL_HIGH
155 0 217 IRQ_TYPE_LEVEL_HIGH
156 0 218 IRQ_TYPE_LEVEL_HIGH
157 0 219 IRQ_TYPE_LEVEL_HIGH>;
158 interrupt-names = "error",
159 "ch0", "ch1", "ch2", "ch3",
160 "ch4", "ch5", "ch6", "ch7",
161 "ch8", "ch9", "ch10", "ch11",
162 "ch12", "ch13", "ch14", "ch15",
163 "ch16", "ch17", "ch18", "ch19";
164 };
165 };
166
167 thermal@e61f0000 { 198 thermal@e61f0000 {
168 compatible = "renesas,thermal-r8a73a4", "renesas,rcar-thermal"; 199 compatible = "renesas,thermal-r8a73a4", "renesas,rcar-thermal";
169 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>, 200 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>,
@@ -174,7 +205,7 @@
174 i2c0: i2c@e6500000 { 205 i2c0: i2c@e6500000 {
175 #address-cells = <1>; 206 #address-cells = <1>;
176 #size-cells = <0>; 207 #size-cells = <0>;
177 compatible = "renesas,rmobile-iic"; 208 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
178 reg = <0 0xe6500000 0 0x428>; 209 reg = <0 0xe6500000 0 0x428>;
179 interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>; 210 interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>;
180 status = "disabled"; 211 status = "disabled";
@@ -183,7 +214,7 @@
183 i2c1: i2c@e6510000 { 214 i2c1: i2c@e6510000 {
184 #address-cells = <1>; 215 #address-cells = <1>;
185 #size-cells = <0>; 216 #size-cells = <0>;
186 compatible = "renesas,rmobile-iic"; 217 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
187 reg = <0 0xe6510000 0 0x428>; 218 reg = <0 0xe6510000 0 0x428>;
188 interrupts = <0 175 IRQ_TYPE_LEVEL_HIGH>; 219 interrupts = <0 175 IRQ_TYPE_LEVEL_HIGH>;
189 status = "disabled"; 220 status = "disabled";
@@ -192,7 +223,7 @@
192 i2c2: i2c@e6520000 { 223 i2c2: i2c@e6520000 {
193 #address-cells = <1>; 224 #address-cells = <1>;
194 #size-cells = <0>; 225 #size-cells = <0>;
195 compatible = "renesas,rmobile-iic"; 226 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
196 reg = <0 0xe6520000 0 0x428>; 227 reg = <0 0xe6520000 0 0x428>;
197 interrupts = <0 176 IRQ_TYPE_LEVEL_HIGH>; 228 interrupts = <0 176 IRQ_TYPE_LEVEL_HIGH>;
198 status = "disabled"; 229 status = "disabled";
@@ -201,7 +232,7 @@
201 i2c3: i2c@e6530000 { 232 i2c3: i2c@e6530000 {
202 #address-cells = <1>; 233 #address-cells = <1>;
203 #size-cells = <0>; 234 #size-cells = <0>;
204 compatible = "renesas,rmobile-iic"; 235 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
205 reg = <0 0xe6530000 0 0x428>; 236 reg = <0 0xe6530000 0 0x428>;
206 interrupts = <0 177 IRQ_TYPE_LEVEL_HIGH>; 237 interrupts = <0 177 IRQ_TYPE_LEVEL_HIGH>;
207 status = "disabled"; 238 status = "disabled";
@@ -210,25 +241,16 @@
210 i2c4: i2c@e6540000 { 241 i2c4: i2c@e6540000 {
211 #address-cells = <1>; 242 #address-cells = <1>;
212 #size-cells = <0>; 243 #size-cells = <0>;
213 compatible = "renesas,rmobile-iic"; 244 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
214 reg = <0 0xe6540000 0 0x428>; 245 reg = <0 0xe6540000 0 0x428>;
215 interrupts = <0 178 IRQ_TYPE_LEVEL_HIGH>; 246 interrupts = <0 178 IRQ_TYPE_LEVEL_HIGH>;
216 status = "disabled"; 247 status = "disabled";
217 }; 248 };
218 249
219 i2c5: i2c@e60b0000 {
220 #address-cells = <1>;
221 #size-cells = <0>;
222 compatible = "renesas,rmobile-iic";
223 reg = <0 0xe60b0000 0 0x428>;
224 interrupts = <0 179 IRQ_TYPE_LEVEL_HIGH>;
225 status = "disabled";
226 };
227
228 i2c6: i2c@e6550000 { 250 i2c6: i2c@e6550000 {
229 #address-cells = <1>; 251 #address-cells = <1>;
230 #size-cells = <0>; 252 #size-cells = <0>;
231 compatible = "renesas,rmobile-iic"; 253 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
232 reg = <0 0xe6550000 0 0x428>; 254 reg = <0 0xe6550000 0 0x428>;
233 interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>; 255 interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
234 status = "disabled"; 256 status = "disabled";
@@ -237,7 +259,7 @@
237 i2c7: i2c@e6560000 { 259 i2c7: i2c@e6560000 {
238 #address-cells = <1>; 260 #address-cells = <1>;
239 #size-cells = <0>; 261 #size-cells = <0>;
240 compatible = "renesas,rmobile-iic"; 262 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
241 reg = <0 0xe6560000 0 0x428>; 263 reg = <0 0xe6560000 0 0x428>;
242 interrupts = <0 185 IRQ_TYPE_LEVEL_HIGH>; 264 interrupts = <0 185 IRQ_TYPE_LEVEL_HIGH>;
243 status = "disabled"; 265 status = "disabled";
@@ -246,12 +268,26 @@
246 i2c8: i2c@e6570000 { 268 i2c8: i2c@e6570000 {
247 #address-cells = <1>; 269 #address-cells = <1>;
248 #size-cells = <0>; 270 #size-cells = <0>;
249 compatible = "renesas,rmobile-iic"; 271 compatible = "renesas,iic-r8a73a4", "renesas,rmobile-iic";
250 reg = <0 0xe6570000 0 0x428>; 272 reg = <0 0xe6570000 0 0x428>;
251 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>; 273 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>;
252 status = "disabled"; 274 status = "disabled";
253 }; 275 };
254 276
277 scifb0: serial@e6c20000 {
278 compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
279 reg = <0 0xe6c20000 0 0x100>;
280 interrupts = <0 148 IRQ_TYPE_LEVEL_HIGH>;
281 status = "disabled";
282 };
283
284 scifb1: serial@e6c30000 {
285 compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
286 reg = <0 0xe6c30000 0 0x100>;
287 interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH>;
288 status = "disabled";
289 };
290
255 scifa0: serial@e6c40000 { 291 scifa0: serial@e6c40000 {
256 compatible = "renesas,scifa-r8a73a4", "renesas,scifa"; 292 compatible = "renesas,scifa-r8a73a4", "renesas,scifa";
257 reg = <0 0xe6c40000 0 0x100>; 293 reg = <0 0xe6c40000 0 0x100>;
@@ -266,73 +302,20 @@
266 status = "disabled"; 302 status = "disabled";
267 }; 303 };
268 304
269 scifb2: serial@e6c20000 { 305 scifb2: serial@e6ce0000 {
270 compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
271 reg = <0 0xe6c20000 0 0x100>;
272 interrupts = <0 148 IRQ_TYPE_LEVEL_HIGH>;
273 status = "disabled";
274 };
275
276 scifb3: serial@e6c30000 {
277 compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
278 reg = <0 0xe6c30000 0 0x100>;
279 interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH>;
280 status = "disabled";
281 };
282
283 scifb4: serial@e6ce0000 {
284 compatible = "renesas,scifb-r8a73a4", "renesas,scifb"; 306 compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
285 reg = <0 0xe6ce0000 0 0x100>; 307 reg = <0 0xe6ce0000 0 0x100>;
286 interrupts = <0 150 IRQ_TYPE_LEVEL_HIGH>; 308 interrupts = <0 150 IRQ_TYPE_LEVEL_HIGH>;
287 status = "disabled"; 309 status = "disabled";
288 }; 310 };
289 311
290 scifb5: serial@e6cf0000 { 312 scifb3: serial@e6cf0000 {
291 compatible = "renesas,scifb-r8a73a4", "renesas,scifb"; 313 compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
292 reg = <0 0xe6cf0000 0 0x100>; 314 reg = <0 0xe6cf0000 0 0x100>;
293 interrupts = <0 151 IRQ_TYPE_LEVEL_HIGH>; 315 interrupts = <0 151 IRQ_TYPE_LEVEL_HIGH>;
294 status = "disabled"; 316 status = "disabled";
295 }; 317 };
296 318
297 mmcif0: mmc@ee200000 {
298 compatible = "renesas,sh-mmcif";
299 reg = <0 0xee200000 0 0x80>;
300 interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
301 reg-io-width = <4>;
302 status = "disabled";
303 };
304
305 mmcif1: mmc@ee220000 {
306 compatible = "renesas,sh-mmcif";
307 reg = <0 0xee220000 0 0x80>;
308 interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>;
309 reg-io-width = <4>;
310 status = "disabled";
311 };
312
313 pfc: pfc@e6050000 {
314 compatible = "renesas,pfc-r8a73a4";
315 reg = <0 0xe6050000 0 0x9000>;
316 gpio-controller;
317 #gpio-cells = <2>;
318 interrupts-extended =
319 <&irqc0 0 0>, <&irqc0 1 0>, <&irqc0 2 0>, <&irqc0 3 0>,
320 <&irqc0 4 0>, <&irqc0 5 0>, <&irqc0 6 0>, <&irqc0 7 0>,
321 <&irqc0 8 0>, <&irqc0 9 0>, <&irqc0 10 0>, <&irqc0 11 0>,
322 <&irqc0 12 0>, <&irqc0 13 0>, <&irqc0 14 0>, <&irqc0 15 0>,
323 <&irqc0 16 0>, <&irqc0 17 0>, <&irqc0 18 0>, <&irqc0 19 0>,
324 <&irqc0 20 0>, <&irqc0 21 0>, <&irqc0 22 0>, <&irqc0 23 0>,
325 <&irqc0 24 0>, <&irqc0 25 0>, <&irqc0 26 0>, <&irqc0 27 0>,
326 <&irqc0 28 0>, <&irqc0 29 0>, <&irqc0 30 0>, <&irqc0 31 0>,
327 <&irqc1 0 0>, <&irqc1 1 0>, <&irqc1 2 0>, <&irqc1 3 0>,
328 <&irqc1 4 0>, <&irqc1 5 0>, <&irqc1 6 0>, <&irqc1 7 0>,
329 <&irqc1 8 0>, <&irqc1 9 0>, <&irqc1 10 0>, <&irqc1 11 0>,
330 <&irqc1 12 0>, <&irqc1 13 0>, <&irqc1 14 0>, <&irqc1 15 0>,
331 <&irqc1 16 0>, <&irqc1 17 0>, <&irqc1 18 0>, <&irqc1 19 0>,
332 <&irqc1 20 0>, <&irqc1 21 0>, <&irqc1 22 0>, <&irqc1 23 0>,
333 <&irqc1 24 0>, <&irqc1 25 0>;
334 };
335
336 sdhi0: sd@ee100000 { 319 sdhi0: sd@ee100000 {
337 compatible = "renesas,sdhi-r8a73a4"; 320 compatible = "renesas,sdhi-r8a73a4";
338 reg = <0 0xee100000 0 0x100>; 321 reg = <0 0xee100000 0 0x100>;
@@ -356,4 +339,32 @@
356 cap-sd-highspeed; 339 cap-sd-highspeed;
357 status = "disabled"; 340 status = "disabled";
358 }; 341 };
342
343 mmcif0: mmc@ee200000 {
344 compatible = "renesas,sh-mmcif";
345 reg = <0 0xee200000 0 0x80>;
346 interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
347 reg-io-width = <4>;
348 status = "disabled";
349 };
350
351 mmcif1: mmc@ee220000 {
352 compatible = "renesas,sh-mmcif";
353 reg = <0 0xee220000 0 0x80>;
354 interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>;
355 reg-io-width = <4>;
356 status = "disabled";
357 };
358
359 gic: interrupt-controller@f1001000 {
360 compatible = "arm,cortex-a15-gic";
361 #interrupt-cells = <3>;
362 #address-cells = <0>;
363 interrupt-controller;
364 reg = <0 0xf1001000 0 0x1000>,
365 <0 0xf1002000 0 0x1000>,
366 <0 0xf1004000 0 0x2000>,
367 <0 0xf1006000 0 0x2000>;
368 interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
369 };
359}; 370};
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
index effb7b46f131..d4af4d86c6b0 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
@@ -25,6 +25,7 @@
25 25
26 chosen { 26 chosen {
27 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";
28 stdout-path = &scifa1;
28 }; 29 };
29 30
30 memory { 31 memory {
@@ -77,7 +78,7 @@
77 regulator-boot-on; 78 regulator-boot-on;
78 }; 79 };
79 80
80 gpio-keys { 81 keyboard {
81 compatible = "gpio-keys"; 82 compatible = "gpio-keys";
82 83
83 power-key { 84 power-key {
@@ -298,3 +299,7 @@
298 299
299 status = "okay"; 300 status = "okay";
300}; 301};
302
303&tmu0 {
304 status = "okay";
305};
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index eed697a6bd6b..a8a674bafa67 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -71,6 +71,7 @@
71 0 149 IRQ_TYPE_LEVEL_HIGH 71 0 149 IRQ_TYPE_LEVEL_HIGH
72 0 149 IRQ_TYPE_LEVEL_HIGH 72 0 149 IRQ_TYPE_LEVEL_HIGH
73 0 149 IRQ_TYPE_LEVEL_HIGH>; 73 0 149 IRQ_TYPE_LEVEL_HIGH>;
74 clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
74 }; 75 };
75 76
76 /* irqpin1: IRQ8 - IRQ15 */ 77 /* irqpin1: IRQ8 - IRQ15 */
@@ -91,6 +92,7 @@
91 0 149 IRQ_TYPE_LEVEL_HIGH 92 0 149 IRQ_TYPE_LEVEL_HIGH
92 0 149 IRQ_TYPE_LEVEL_HIGH 93 0 149 IRQ_TYPE_LEVEL_HIGH
93 0 149 IRQ_TYPE_LEVEL_HIGH>; 94 0 149 IRQ_TYPE_LEVEL_HIGH>;
95 clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
94 }; 96 };
95 97
96 /* irqpin2: IRQ16 - IRQ23 */ 98 /* irqpin2: IRQ16 - IRQ23 */
@@ -111,6 +113,7 @@
111 0 149 IRQ_TYPE_LEVEL_HIGH 113 0 149 IRQ_TYPE_LEVEL_HIGH
112 0 149 IRQ_TYPE_LEVEL_HIGH 114 0 149 IRQ_TYPE_LEVEL_HIGH
113 0 149 IRQ_TYPE_LEVEL_HIGH>; 115 0 149 IRQ_TYPE_LEVEL_HIGH>;
116 clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
114 }; 117 };
115 118
116 /* irqpin3: IRQ24 - IRQ31 */ 119 /* irqpin3: IRQ24 - IRQ31 */
@@ -131,6 +134,7 @@
131 0 149 IRQ_TYPE_LEVEL_HIGH 134 0 149 IRQ_TYPE_LEVEL_HIGH
132 0 149 IRQ_TYPE_LEVEL_HIGH 135 0 149 IRQ_TYPE_LEVEL_HIGH
133 0 149 IRQ_TYPE_LEVEL_HIGH>; 136 0 149 IRQ_TYPE_LEVEL_HIGH>;
137 clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
134 }; 138 };
135 139
136 ether: ethernet@e9a00000 { 140 ether: ethernet@e9a00000 {
@@ -193,7 +197,7 @@
193 compatible = "renesas,scifa-r8a7740", "renesas,scifa"; 197 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
194 reg = <0xe6c60000 0x100>; 198 reg = <0xe6c60000 0x100>;
195 interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>; 199 interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
196 clocks = <&mstp2_clks R8A7740_CLK_SCIFA0>; 200 clocks = <&mstp2_clks R8A7740_CLK_SCIFA2>;
197 clock-names = "sci_ick"; 201 clock-names = "sci_ick";
198 status = "disabled"; 202 status = "disabled";
199 }; 203 };
@@ -331,6 +335,34 @@
331 status = "disabled"; 335 status = "disabled";
332 }; 336 };
333 337
338 tmu0: timer@fff80000 {
339 compatible = "renesas,tmu-r8a7740", "renesas,tmu";
340 reg = <0xfff80000 0x2c>;
341 interrupts = <0 198 IRQ_TYPE_LEVEL_HIGH>,
342 <0 199 IRQ_TYPE_LEVEL_HIGH>,
343 <0 200 IRQ_TYPE_LEVEL_HIGH>;
344 clocks = <&mstp1_clks R8A7740_CLK_TMU0>;
345 clock-names = "fck";
346
347 #renesas,channels = <3>;
348
349 status = "disabled";
350 };
351
352 tmu1: timer@fff90000 {
353 compatible = "renesas,tmu-r8a7740", "renesas,tmu";
354 reg = <0xfff90000 0x2c>;
355 interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>,
356 <0 171 IRQ_TYPE_LEVEL_HIGH>,
357 <0 172 IRQ_TYPE_LEVEL_HIGH>;
358 clocks = <&mstp1_clks R8A7740_CLK_TMU1>;
359 clock-names = "fck";
360
361 #renesas,channels = <3>;
362
363 status = "disabled";
364 };
365
334 clocks { 366 clocks {
335 #address-cells = <1>; 367 #address-cells = <1>;
336 #size-cells = <1>; 368 #size-cells = <1>;
@@ -448,8 +480,8 @@
448 mstp2_clks: mstp2_clks@e6150138 { 480 mstp2_clks: mstp2_clks@e6150138 {
449 compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks"; 481 compatible = "renesas,r8a7740-mstp-clocks", "renesas,cpg-mstp-clocks";
450 reg = <0xe6150138 4>, <0xe6150040 4>; 482 reg = <0xe6150138 4>, <0xe6150040 4>;
451 clocks = <&sub_clk>, <&sub_clk>, 483 clocks = <&sub_clk>, <&cpg_clocks R8A7740_CLK_HP>,
452 <&cpg_clocks R8A7740_CLK_HP>, 484 <&sub_clk>, <&cpg_clocks R8A7740_CLK_HP>,
453 <&cpg_clocks R8A7740_CLK_HP>, 485 <&cpg_clocks R8A7740_CLK_HP>,
454 <&cpg_clocks R8A7740_CLK_HP>, 486 <&cpg_clocks R8A7740_CLK_HP>,
455 <&cpg_clocks R8A7740_CLK_HP>, 487 <&cpg_clocks R8A7740_CLK_HP>,
@@ -458,7 +490,8 @@
458 <&sub_clk>; 490 <&sub_clk>;
459 #clock-cells = <1>; 491 #clock-cells = <1>;
460 renesas,clock-indices = < 492 renesas,clock-indices = <
461 R8A7740_CLK_SCIFA6 R8A7740_CLK_SCIFA7 493 R8A7740_CLK_SCIFA6 R8A7740_CLK_INTCA
494 R8A7740_CLK_SCIFA7
462 R8A7740_CLK_DMAC1 R8A7740_CLK_DMAC2 495 R8A7740_CLK_DMAC1 R8A7740_CLK_DMAC2
463 R8A7740_CLK_DMAC3 R8A7740_CLK_USBDMAC 496 R8A7740_CLK_DMAC3 R8A7740_CLK_USBDMAC
464 R8A7740_CLK_SCIFA5 R8A7740_CLK_SCIFB 497 R8A7740_CLK_SCIFA5 R8A7740_CLK_SCIFB
@@ -467,7 +500,8 @@
467 R8A7740_CLK_SCIFA4 500 R8A7740_CLK_SCIFA4
468 >; 501 >;
469 clock-output-names = 502 clock-output-names =
470 "scifa6", "scifa7", "dmac1", "dmac2", "dmac3", 503 "scifa6", "intca",
504 "scifa7", "dmac1", "dmac2", "dmac3",
471 "usbdmac", "scifa5", "scifb", "scifa0", "scifa1", 505 "usbdmac", "scifa5", "scifb", "scifa0", "scifa1",
472 "scifa2", "scifa3", "scifa4"; 506 "scifa2", "scifa3", "scifa4";
473 }; 507 };
diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index 3342c74c5de8..04c0c37bb784 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -28,7 +28,8 @@
28 }; 28 };
29 29
30 chosen { 30 chosen {
31 bootargs = "console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw"; 31 bootargs = "ignore_loglevel root=/dev/nfs ip=dhcp rw";
32 stdout-path = &scif0;
32 }; 33 };
33 34
34 memory { 35 memory {
@@ -73,6 +74,10 @@
73 status = "okay"; 74 status = "okay";
74}; 75};
75 76
77&tmu0 {
78 status = "okay";
79};
80
76&pfc { 81&pfc {
77 scif0_pins: serial0 { 82 scif0_pins: serial0 {
78 renesas,groups = "scif0_data_a", "scif0_ctrl"; 83 renesas,groups = "scif0_data_a", "scif0_ctrl";
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index 315ec62cb96b..ef8533910029 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -162,6 +162,42 @@
162 status = "disabled"; 162 status = "disabled";
163 }; 163 };
164 164
165 tmu0: timer@ffd80000 {
166 compatible = "renesas,tmu-r8a7778", "renesas,tmu";
167 reg = <0xffd80000 0x30>;
168 interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>,
169 <0 33 IRQ_TYPE_LEVEL_HIGH>,
170 <0 34 IRQ_TYPE_LEVEL_HIGH>;
171
172 #renesas,channels = <3>;
173
174 status = "disabled";
175 };
176
177 tmu1: timer@ffd81000 {
178 compatible = "renesas,tmu-r8a7778", "renesas,tmu";
179 reg = <0xffd81000 0x30>;
180 interrupts = <0 36 IRQ_TYPE_LEVEL_HIGH>,
181 <0 37 IRQ_TYPE_LEVEL_HIGH>,
182 <0 38 IRQ_TYPE_LEVEL_HIGH>;
183
184 #renesas,channels = <3>;
185
186 status = "disabled";
187 };
188
189 tmu2: timer@ffd82000 {
190 compatible = "renesas,tmu-r8a7778", "renesas,tmu";
191 reg = <0xffd82000 0x30>;
192 interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>,
193 <0 41 IRQ_TYPE_LEVEL_HIGH>,
194 <0 42 IRQ_TYPE_LEVEL_HIGH>;
195
196 #renesas,channels = <3>;
197
198 status = "disabled";
199 };
200
165 scif0: serial@ffe40000 { 201 scif0: serial@ffe40000 {
166 compatible = "renesas,scif-r8a7778", "renesas,scif"; 202 compatible = "renesas,scif-r8a7778", "renesas,scif";
167 reg = <0xffe40000 0x100>; 203 reg = <0xffe40000 0x100>;
@@ -215,8 +251,6 @@
215 compatible = "renesas,sdhi-r8a7778"; 251 compatible = "renesas,sdhi-r8a7778";
216 reg = <0xffe4c000 0x100>; 252 reg = <0xffe4c000 0x100>;
217 interrupts = <0 87 IRQ_TYPE_LEVEL_HIGH>; 253 interrupts = <0 87 IRQ_TYPE_LEVEL_HIGH>;
218 cap-sd-highspeed;
219 cap-sdio-irq;
220 status = "disabled"; 254 status = "disabled";
221 }; 255 };
222 256
@@ -224,8 +258,6 @@
224 compatible = "renesas,sdhi-r8a7778"; 258 compatible = "renesas,sdhi-r8a7778";
225 reg = <0xffe4d000 0x100>; 259 reg = <0xffe4d000 0x100>;
226 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>; 260 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
227 cap-sd-highspeed;
228 cap-sdio-irq;
229 status = "disabled"; 261 status = "disabled";
230 }; 262 };
231 263
@@ -233,8 +265,6 @@
233 compatible = "renesas,sdhi-r8a7778"; 265 compatible = "renesas,sdhi-r8a7778";
234 reg = <0xffe4f000 0x100>; 266 reg = <0xffe4f000 0x100>;
235 interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>; 267 interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
236 cap-sd-highspeed;
237 cap-sdio-irq;
238 status = "disabled"; 268 status = "disabled";
239 }; 269 };
240 270
diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
index c160404e4d40..e83d40e24bcd 100644
--- a/arch/arm/boot/dts/r8a7779-marzen.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen.dts
@@ -25,6 +25,7 @@
25 25
26 chosen { 26 chosen {
27 bootargs = "console=ttySC2,115200 ignore_loglevel root=/dev/nfs ip=on"; 27 bootargs = "console=ttySC2,115200 ignore_loglevel root=/dev/nfs ip=on";
28 stdout-path = &scif2;
28 }; 29 };
29 30
30 memory { 31 memory {
@@ -68,6 +69,78 @@
68 gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>; 69 gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;
69 }; 70 };
70 }; 71 };
72
73 vga-encoder {
74 compatible = "adi,adv7123";
75
76 ports {
77 #address-cells = <1>;
78 #size-cells = <0>;
79
80 port@0 {
81 reg = <0>;
82 vga_enc_in: endpoint {
83 remote-endpoint = <&du_out_rgb0>;
84 };
85 };
86 port@1 {
87 reg = <1>;
88 vga_enc_out: endpoint {
89 remote-endpoint = <&vga_in>;
90 };
91 };
92 };
93 };
94
95 vga {
96 compatible = "vga-connector";
97
98 port {
99 vga_in: endpoint {
100 remote-endpoint = <&vga_enc_out>;
101 };
102 };
103 };
104
105 lvds-encoder {
106 compatible = "thine,thc63lvdm83d";
107
108 ports {
109 #address-cells = <1>;
110 #size-cells = <0>;
111
112 port@0 {
113 reg = <0>;
114 lvds_enc_in: endpoint {
115 remote-endpoint = <&du_out_rgb1>;
116 };
117 };
118 port@1 {
119 reg = <1>;
120 lvds_connector: endpoint {
121 };
122 };
123 };
124 };
125};
126
127&du {
128 pinctrl-0 = <&du_pins>;
129 pinctrl-names = "default";
130 status = "okay";
131
132 ports {
133 port@0 {
134 endpoint {
135 remote-endpoint = <&vga_enc_in>;
136 };
137 };
138 port@1 {
139 endpoint {
140 remote-endpoint = <&lvds_enc_in>;
141 };
142 };
143 };
71}; 144};
72 145
73&irqpin0 { 146&irqpin0 {
@@ -83,6 +156,17 @@
83}; 156};
84 157
85&pfc { 158&pfc {
159 du_pins: du {
160 du0 {
161 renesas,groups = "du0_rgb888", "du0_sync_1", "du0_clk_out_0";
162 renesas,function = "du0";
163 };
164 du1 {
165 renesas,groups = "du1_rgb666", "du1_sync_1", "du1_clk_out";
166 renesas,function = "du1";
167 };
168 };
169
86 lan0_pins: lan0 { 170 lan0_pins: lan0 {
87 intc { 171 intc {
88 renesas,groups = "intc_irq1_b"; 172 renesas,groups = "intc_irq1_b";
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 7cfba9aa1b41..ede9a29e4bc6 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -303,7 +303,7 @@
303 }; 303 };
304 304
305 sata: sata@fc600000 { 305 sata: sata@fc600000 {
306 compatible = "renesas,rcar-sata"; 306 compatible = "renesas,sata-r8a7779", "renesas,rcar-sata";
307 reg = <0xfc600000 0x2000>; 307 reg = <0xfc600000 0x2000>;
308 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>; 308 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
309 clocks = <&mstp1_clks R8A7779_CLK_SATA>; 309 clocks = <&mstp1_clks R8A7779_CLK_SATA>;
@@ -314,8 +314,6 @@
314 reg = <0xffe4c000 0x100>; 314 reg = <0xffe4c000 0x100>;
315 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>; 315 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
316 clocks = <&mstp3_clks R8A7779_CLK_SDHI0>; 316 clocks = <&mstp3_clks R8A7779_CLK_SDHI0>;
317 cap-sd-highspeed;
318 cap-sdio-irq;
319 status = "disabled"; 317 status = "disabled";
320 }; 318 };
321 319
@@ -324,8 +322,6 @@
324 reg = <0xffe4d000 0x100>; 322 reg = <0xffe4d000 0x100>;
325 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>; 323 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
326 clocks = <&mstp3_clks R8A7779_CLK_SDHI1>; 324 clocks = <&mstp3_clks R8A7779_CLK_SDHI1>;
327 cap-sd-highspeed;
328 cap-sdio-irq;
329 status = "disabled"; 325 status = "disabled";
330 }; 326 };
331 327
@@ -334,8 +330,6 @@
334 reg = <0xffe4e000 0x100>; 330 reg = <0xffe4e000 0x100>;
335 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>; 331 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
336 clocks = <&mstp3_clks R8A7779_CLK_SDHI2>; 332 clocks = <&mstp3_clks R8A7779_CLK_SDHI2>;
337 cap-sd-highspeed;
338 cap-sdio-irq;
339 status = "disabled"; 333 status = "disabled";
340 }; 334 };
341 335
@@ -344,8 +338,6 @@
344 reg = <0xffe4f000 0x100>; 338 reg = <0xffe4f000 0x100>;
345 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>; 339 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
346 clocks = <&mstp3_clks R8A7779_CLK_SDHI3>; 340 clocks = <&mstp3_clks R8A7779_CLK_SDHI3>;
347 cap-sd-highspeed;
348 cap-sdio-irq;
349 status = "disabled"; 341 status = "disabled";
350 }; 342 };
351 343
@@ -379,6 +371,30 @@
379 status = "disabled"; 371 status = "disabled";
380 }; 372 };
381 373
374 du: display@fff80000 {
375 compatible = "renesas,du-r8a7779";
376 reg = <0 0xfff80000 0 0x40000>;
377 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
378 clocks = <&mstp1_clks R8A7779_CLK_DU>;
379 status = "disabled";
380
381 ports {
382 #address-cells = <1>;
383 #size-cells = <0>;
384
385 port@0 {
386 reg = <0>;
387 du_out_rgb0: endpoint {
388 };
389 };
390 port@1 {
391 reg = <1>;
392 du_out_rgb1: endpoint {
393 };
394 };
395 };
396 };
397
382 clocks { 398 clocks {
383 #address-cells = <1>; 399 #address-cells = <1>;
384 #size-cells = <1>; 400 #size-cells = <1>;
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 69098b906b39..636d53bb87a2 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -9,6 +9,34 @@
9 * kind, whether express or implied. 9 * kind, whether express or implied.
10 */ 10 */
11 11
12/*
13 * SSI-AK4643
14 *
15 * SW1: 1: AK4643
16 * 2: CN22
17 * 3: ADV7511
18 *
19 * This command is required when Playback/Capture
20 *
21 * amixer set "LINEOUT Mixer DACL" on
22 * amixer set "DVC Out" 100%
23 * amixer set "DVC In" 100%
24 *
25 * You can use Mute
26 *
27 * amixer set "DVC Out Mute" on
28 * amixer set "DVC In Mute" on
29 *
30 * You can use Volume Ramp
31 *
32 * amixer set "DVC Out Ramp Up Rate" "0.125 dB/64 steps"
33 * amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
34 * amixer set "DVC Out Ramp" on
35 * aplay xxx.wav &
36 * amixer set "DVC Out" 80% // Volume Down
37 * amixer set "DVC Out" 100% // Volume Up
38 */
39
12/dts-v1/; 40/dts-v1/;
13#include "r8a7790.dtsi" 41#include "r8a7790.dtsi"
14#include <dt-bindings/gpio/gpio.h> 42#include <dt-bindings/gpio/gpio.h>
@@ -19,12 +47,13 @@
19 compatible = "renesas,lager", "renesas,r8a7790"; 47 compatible = "renesas,lager", "renesas,r8a7790";
20 48
21 aliases { 49 aliases {
22 serial6 = &scif0; 50 serial6 = &scifa0;
23 serial7 = &scif1; 51 serial7 = &scifa1;
24 }; 52 };
25 53
26 chosen { 54 chosen {
27 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp"; 55 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
56 stdout-path = &scifa0;
28 }; 57 };
29 58
30 memory@40000000 { 59 memory@40000000 {
@@ -42,7 +71,7 @@
42 #size-cells = <1>; 71 #size-cells = <1>;
43 }; 72 };
44 73
45 gpio_keys { 74 keyboard {
46 compatible = "gpio-keys"; 75 compatible = "gpio-keys";
47 76
48 button@1 { 77 button@1 {
@@ -144,6 +173,73 @@
144 states = <3300000 1 173 states = <3300000 1
145 1800000 0>; 174 1800000 0>;
146 }; 175 };
176
177 sound {
178 compatible = "simple-audio-card";
179
180 simple-audio-card,format = "left_j";
181 simple-audio-card,bitclock-master = <&sndcodec>;
182 simple-audio-card,frame-master = <&sndcodec>;
183
184 sndcpu: simple-audio-card,cpu {
185 sound-dai = <&rcar_sound>;
186 };
187
188 sndcodec: simple-audio-card,codec {
189 sound-dai = <&ak4643>;
190 system-clock-frequency = <11289600>;
191 };
192 };
193
194 vga-encoder {
195 compatible = "adi,adv7123";
196
197 ports {
198 #address-cells = <1>;
199 #size-cells = <0>;
200
201 port@0 {
202 reg = <0>;
203 adv7123_in: endpoint {
204 remote-endpoint = <&du_out_rgb>;
205 };
206 };
207 port@1 {
208 reg = <1>;
209 adv7123_out: endpoint {
210 remote-endpoint = <&vga_in>;
211 };
212 };
213 };
214 };
215
216 vga {
217 compatible = "vga-connector";
218
219 port {
220 vga_in: endpoint {
221 remote-endpoint = <&adv7123_out>;
222 };
223 };
224 };
225};
226
227&du {
228 pinctrl-0 = <&du_pins>;
229 pinctrl-names = "default";
230 status = "okay";
231
232 ports {
233 port@0 {
234 endpoint {
235 remote-endpoint = <&adv7123_in>;
236 };
237 };
238 port@2 {
239 lvds_connector: endpoint {
240 };
241 };
242 };
147}; 243};
148 244
149&extal_clk { 245&extal_clk {
@@ -151,17 +247,14 @@
151}; 247};
152 248
153&pfc { 249&pfc {
154 pinctrl-0 = <&du_pins>;
155 pinctrl-names = "default";
156
157 du_pins: du { 250 du_pins: du {
158 renesas,groups = "du_rgb666", "du_sync_1", "du_clk_out_0"; 251 renesas,groups = "du_rgb666", "du_sync_1", "du_clk_out_0";
159 renesas,function = "du"; 252 renesas,function = "du";
160 }; 253 };
161 254
162 scif0_pins: serial0 { 255 scifa0_pins: serial0 {
163 renesas,groups = "scif0_data"; 256 renesas,groups = "scifa0_data";
164 renesas,function = "scif0"; 257 renesas,function = "scifa0";
165 }; 258 };
166 259
167 ether_pins: ether { 260 ether_pins: ether {
@@ -174,9 +267,9 @@
174 renesas,function = "intc"; 267 renesas,function = "intc";
175 }; 268 };
176 269
177 scif1_pins: serial1 { 270 scifa1_pins: serial1 {
178 renesas,groups = "scif1_data"; 271 renesas,groups = "scifa1_data";
179 renesas,function = "scif1"; 272 renesas,function = "scifa1";
180 }; 273 };
181 274
182 sdhi0_pins: sd0 { 275 sdhi0_pins: sd0 {
@@ -220,6 +313,11 @@
220 renesas,function = "iic3"; 313 renesas,function = "iic3";
221 }; 314 };
222 315
316 hsusb_pins: hsusb {
317 renesas,groups = "usb0_ovc_vbus";
318 renesas,function = "usb0";
319 };
320
223 usb0_pins: usb0 { 321 usb0_pins: usb0 {
224 renesas,groups = "usb0"; 322 renesas,groups = "usb0";
225 renesas,function = "usb0"; 323 renesas,function = "usb0";
@@ -239,6 +337,16 @@
239 renesas,groups = "vin1_data8", "vin1_clk"; 337 renesas,groups = "vin1_data8", "vin1_clk";
240 renesas,function = "vin1"; 338 renesas,function = "vin1";
241 }; 339 };
340
341 sound_pins: sound {
342 renesas,groups = "ssi0129_ctrl", "ssi0_data", "ssi1_data";
343 renesas,function = "ssi";
344 };
345
346 sound_clk_pins: sound_clk {
347 renesas,groups = "audio_clk_a";
348 renesas,function = "audio_clk";
349 };
242}; 350};
243 351
244&ether { 352&ether {
@@ -308,15 +416,15 @@
308 }; 416 };
309}; 417};
310 418
311&scif0 { 419&scifa0 {
312 pinctrl-0 = <&scif0_pins>; 420 pinctrl-0 = <&scifa0_pins>;
313 pinctrl-names = "default"; 421 pinctrl-names = "default";
314 422
315 status = "okay"; 423 status = "okay";
316}; 424};
317 425
318&scif1 { 426&scifa1 {
319 pinctrl-0 = <&scif1_pins>; 427 pinctrl-0 = <&scifa1_pins>;
320 pinctrl-names = "default"; 428 pinctrl-names = "default";
321 429
322 status = "okay"; 430 status = "okay";
@@ -376,6 +484,14 @@
376 pinctrl-0 = <&iic2_pins>; 484 pinctrl-0 = <&iic2_pins>;
377 pinctrl-names = "default"; 485 pinctrl-names = "default";
378 486
487 clock-frequency = <100000>;
488
489 ak4643: sound-codec@12 {
490 compatible = "asahi-kasei,ak4643";
491 #sound-dai-cells = <0>;
492 reg = <0x12>;
493 };
494
379 composite-in@20 { 495 composite-in@20 {
380 compatible = "adi,adv7180"; 496 compatible = "adi,adv7180";
381 reg = <0x20>; 497 reg = <0x20>;
@@ -418,12 +534,29 @@
418 pinctrl-names = "default"; 534 pinctrl-names = "default";
419}; 535};
420 536
537&xhci {
538 status = "okay";
539 pinctrl-0 = <&usb2_pins>;
540 pinctrl-names = "default";
541};
542
421&pci2 { 543&pci2 {
422 status = "okay"; 544 status = "okay";
423 pinctrl-0 = <&usb2_pins>; 545 pinctrl-0 = <&usb2_pins>;
424 pinctrl-names = "default"; 546 pinctrl-names = "default";
425}; 547};
426 548
549&hsusb {
550 status = "okay";
551 pinctrl-0 = <&hsusb_pins>;
552 pinctrl-names = "default";
553 renesas,enable-gpio = <&gpio5 18 GPIO_ACTIVE_HIGH>;
554};
555
556&usbphy {
557 status = "okay";
558};
559
427/* composite video input */ 560/* composite video input */
428&vin1 { 561&vin1 {
429 pinctrl-0 = <&vin1_pins>; 562 pinctrl-0 = <&vin1_pins>;
@@ -441,3 +574,23 @@
441 }; 574 };
442 }; 575 };
443}; 576};
577
578&rcar_sound {
579 pinctrl-0 = <&sound_pins &sound_clk_pins>;
580 pinctrl-names = "default";
581
582 #sound-dai-cells = <0>;
583
584 status = "okay";
585
586 rcar_sound,dai {
587 dai0 {
588 playback = <&ssi0 &src2 &dvc0>;
589 capture = <&ssi1 &src3 &dvc1>;
590 };
591 };
592};
593
594&ssi1 {
595 shared-pin;
596};
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index e20affe156c1..af7e255f629e 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -312,6 +312,70 @@
312 #dma-cells = <1>; 312 #dma-cells = <1>;
313 dma-channels = <15>; 313 dma-channels = <15>;
314 }; 314 };
315
316 audma0: dma-controller@ec700000 {
317 compatible = "renesas,rcar-dmac";
318 reg = <0 0xec700000 0 0x10000>;
319 interrupts = <0 346 IRQ_TYPE_LEVEL_HIGH
320 0 320 IRQ_TYPE_LEVEL_HIGH
321 0 321 IRQ_TYPE_LEVEL_HIGH
322 0 322 IRQ_TYPE_LEVEL_HIGH
323 0 323 IRQ_TYPE_LEVEL_HIGH
324 0 324 IRQ_TYPE_LEVEL_HIGH
325 0 325 IRQ_TYPE_LEVEL_HIGH
326 0 326 IRQ_TYPE_LEVEL_HIGH
327 0 327 IRQ_TYPE_LEVEL_HIGH
328 0 328 IRQ_TYPE_LEVEL_HIGH
329 0 329 IRQ_TYPE_LEVEL_HIGH
330 0 330 IRQ_TYPE_LEVEL_HIGH
331 0 331 IRQ_TYPE_LEVEL_HIGH
332 0 332 IRQ_TYPE_LEVEL_HIGH>;
333 interrupt-names = "error",
334 "ch0", "ch1", "ch2", "ch3",
335 "ch4", "ch5", "ch6", "ch7",
336 "ch8", "ch9", "ch10", "ch11",
337 "ch12";
338 clocks = <&mstp5_clks R8A7790_CLK_AUDIO_DMAC0>;
339 clock-names = "fck";
340 #dma-cells = <1>;
341 dma-channels = <13>;
342 };
343
344 audma1: dma-controller@ec720000 {
345 compatible = "renesas,rcar-dmac";
346 reg = <0 0xec720000 0 0x10000>;
347 interrupts = <0 347 IRQ_TYPE_LEVEL_HIGH
348 0 333 IRQ_TYPE_LEVEL_HIGH
349 0 334 IRQ_TYPE_LEVEL_HIGH
350 0 335 IRQ_TYPE_LEVEL_HIGH
351 0 336 IRQ_TYPE_LEVEL_HIGH
352 0 337 IRQ_TYPE_LEVEL_HIGH
353 0 338 IRQ_TYPE_LEVEL_HIGH
354 0 339 IRQ_TYPE_LEVEL_HIGH
355 0 340 IRQ_TYPE_LEVEL_HIGH
356 0 341 IRQ_TYPE_LEVEL_HIGH
357 0 342 IRQ_TYPE_LEVEL_HIGH
358 0 343 IRQ_TYPE_LEVEL_HIGH
359 0 344 IRQ_TYPE_LEVEL_HIGH
360 0 345 IRQ_TYPE_LEVEL_HIGH>;
361 interrupt-names = "error",
362 "ch0", "ch1", "ch2", "ch3",
363 "ch4", "ch5", "ch6", "ch7",
364 "ch8", "ch9", "ch10", "ch11",
365 "ch12";
366 clocks = <&mstp5_clks R8A7790_CLK_AUDIO_DMAC1>;
367 clock-names = "fck";
368 #dma-cells = <1>;
369 dma-channels = <13>;
370 };
371
372 audmapp: dma-controller@ec740000 {
373 compatible = "renesas,rcar-audmapp";
374 #dma-cells = <1>;
375
376 reg = <0 0xec740000 0 0x200>;
377 };
378
315 i2c0: i2c@e6508000 { 379 i2c0: i2c@e6508000 {
316 #address-cells = <1>; 380 #address-cells = <1>;
317 #size-cells = <0>; 381 #size-cells = <0>;
@@ -359,6 +423,8 @@
359 reg = <0 0xe6500000 0 0x425>; 423 reg = <0 0xe6500000 0 0x425>;
360 interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>; 424 interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>;
361 clocks = <&mstp3_clks R8A7790_CLK_IIC0>; 425 clocks = <&mstp3_clks R8A7790_CLK_IIC0>;
426 dmas = <&dmac0 0x61>, <&dmac0 0x62>;
427 dma-names = "tx", "rx";
362 status = "disabled"; 428 status = "disabled";
363 }; 429 };
364 430
@@ -369,6 +435,8 @@
369 reg = <0 0xe6510000 0 0x425>; 435 reg = <0 0xe6510000 0 0x425>;
370 interrupts = <0 175 IRQ_TYPE_LEVEL_HIGH>; 436 interrupts = <0 175 IRQ_TYPE_LEVEL_HIGH>;
371 clocks = <&mstp3_clks R8A7790_CLK_IIC1>; 437 clocks = <&mstp3_clks R8A7790_CLK_IIC1>;
438 dmas = <&dmac0 0x65>, <&dmac0 0x66>;
439 dma-names = "tx", "rx";
372 status = "disabled"; 440 status = "disabled";
373 }; 441 };
374 442
@@ -379,6 +447,8 @@
379 reg = <0 0xe6520000 0 0x425>; 447 reg = <0 0xe6520000 0 0x425>;
380 interrupts = <0 176 IRQ_TYPE_LEVEL_HIGH>; 448 interrupts = <0 176 IRQ_TYPE_LEVEL_HIGH>;
381 clocks = <&mstp3_clks R8A7790_CLK_IIC2>; 449 clocks = <&mstp3_clks R8A7790_CLK_IIC2>;
450 dmas = <&dmac0 0x69>, <&dmac0 0x6a>;
451 dma-names = "tx", "rx";
382 status = "disabled"; 452 status = "disabled";
383 }; 453 };
384 454
@@ -389,14 +459,18 @@
389 reg = <0 0xe60b0000 0 0x425>; 459 reg = <0 0xe60b0000 0 0x425>;
390 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>; 460 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>;
391 clocks = <&mstp9_clks R8A7790_CLK_IICDVFS>; 461 clocks = <&mstp9_clks R8A7790_CLK_IICDVFS>;
462 dmas = <&dmac0 0x77>, <&dmac0 0x78>;
463 dma-names = "tx", "rx";
392 status = "disabled"; 464 status = "disabled";
393 }; 465 };
394 466
395 mmcif0: mmcif@ee200000 { 467 mmcif0: mmc@ee200000 {
396 compatible = "renesas,mmcif-r8a7790", "renesas,sh-mmcif"; 468 compatible = "renesas,mmcif-r8a7790", "renesas,sh-mmcif";
397 reg = <0 0xee200000 0 0x80>; 469 reg = <0 0xee200000 0 0x80>;
398 interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>; 470 interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
399 clocks = <&mstp3_clks R8A7790_CLK_MMCIF0>; 471 clocks = <&mstp3_clks R8A7790_CLK_MMCIF0>;
472 dmas = <&dmac0 0xd1>, <&dmac0 0xd2>;
473 dma-names = "tx", "rx";
400 reg-io-width = <4>; 474 reg-io-width = <4>;
401 status = "disabled"; 475 status = "disabled";
402 }; 476 };
@@ -406,6 +480,8 @@
406 reg = <0 0xee220000 0 0x80>; 480 reg = <0 0xee220000 0 0x80>;
407 interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>; 481 interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>;
408 clocks = <&mstp3_clks R8A7790_CLK_MMCIF1>; 482 clocks = <&mstp3_clks R8A7790_CLK_MMCIF1>;
483 dmas = <&dmac0 0xe1>, <&dmac0 0xe2>;
484 dma-names = "tx", "rx";
409 reg-io-width = <4>; 485 reg-io-width = <4>;
410 status = "disabled"; 486 status = "disabled";
411 }; 487 };
@@ -420,7 +496,6 @@
420 reg = <0 0xee100000 0 0x200>; 496 reg = <0 0xee100000 0 0x200>;
421 interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>; 497 interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>;
422 clocks = <&mstp3_clks R8A7790_CLK_SDHI0>; 498 clocks = <&mstp3_clks R8A7790_CLK_SDHI0>;
423 cap-sd-highspeed;
424 status = "disabled"; 499 status = "disabled";
425 }; 500 };
426 501
@@ -429,7 +504,6 @@
429 reg = <0 0xee120000 0 0x200>; 504 reg = <0 0xee120000 0 0x200>;
430 interrupts = <0 166 IRQ_TYPE_LEVEL_HIGH>; 505 interrupts = <0 166 IRQ_TYPE_LEVEL_HIGH>;
431 clocks = <&mstp3_clks R8A7790_CLK_SDHI1>; 506 clocks = <&mstp3_clks R8A7790_CLK_SDHI1>;
432 cap-sd-highspeed;
433 status = "disabled"; 507 status = "disabled";
434 }; 508 };
435 509
@@ -438,7 +512,6 @@
438 reg = <0 0xee140000 0 0x100>; 512 reg = <0 0xee140000 0 0x100>;
439 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>; 513 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>;
440 clocks = <&mstp3_clks R8A7790_CLK_SDHI2>; 514 clocks = <&mstp3_clks R8A7790_CLK_SDHI2>;
441 cap-sd-highspeed;
442 status = "disabled"; 515 status = "disabled";
443 }; 516 };
444 517
@@ -447,7 +520,6 @@
447 reg = <0 0xee160000 0 0x100>; 520 reg = <0 0xee160000 0 0x100>;
448 interrupts = <0 168 IRQ_TYPE_LEVEL_HIGH>; 521 interrupts = <0 168 IRQ_TYPE_LEVEL_HIGH>;
449 clocks = <&mstp3_clks R8A7790_CLK_SDHI3>; 522 clocks = <&mstp3_clks R8A7790_CLK_SDHI3>;
450 cap-sd-highspeed;
451 status = "disabled"; 523 status = "disabled";
452 }; 524 };
453 525
@@ -568,6 +640,36 @@
568 status = "disabled"; 640 status = "disabled";
569 }; 641 };
570 642
643 hsusb: usb@e6590000 {
644 compatible = "renesas,usbhs-r8a7790";
645 reg = <0 0xe6590000 0 0x100>;
646 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
647 clocks = <&mstp7_clks R8A7790_CLK_HSUSB>;
648 renesas,buswait = <4>;
649 phys = <&usb0 1>;
650 phy-names = "usb";
651 status = "disabled";
652 };
653
654 usbphy: usb-phy@e6590100 {
655 compatible = "renesas,usb-phy-r8a7790";
656 reg = <0 0xe6590100 0 0x100>;
657 #address-cells = <1>;
658 #size-cells = <0>;
659 clocks = <&mstp7_clks R8A7790_CLK_HSUSB>;
660 clock-names = "usbhs";
661 status = "disabled";
662
663 usb0: usb-channel@0 {
664 reg = <0>;
665 #phy-cells = <1>;
666 };
667 usb2: usb-channel@2 {
668 reg = <2>;
669 #phy-cells = <1>;
670 };
671 };
672
571 vin0: video@e6ef0000 { 673 vin0: video@e6ef0000 {
572 compatible = "renesas,vin-r8a7790"; 674 compatible = "renesas,vin-r8a7790";
573 clocks = <&mstp8_clks R8A7790_CLK_VIN0>; 675 clocks = <&mstp8_clks R8A7790_CLK_VIN0>;
@@ -600,6 +702,96 @@
600 status = "disabled"; 702 status = "disabled";
601 }; 703 };
602 704
705 vsp1@fe920000 {
706 compatible = "renesas,vsp1";
707 reg = <0 0xfe920000 0 0x8000>;
708 interrupts = <0 266 IRQ_TYPE_LEVEL_HIGH>;
709 clocks = <&mstp1_clks R8A7790_CLK_VSP1_R>;
710
711 renesas,has-sru;
712 renesas,#rpf = <5>;
713 renesas,#uds = <1>;
714 renesas,#wpf = <4>;
715 };
716
717 vsp1@fe928000 {
718 compatible = "renesas,vsp1";
719 reg = <0 0xfe928000 0 0x8000>;
720 interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
721 clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>;
722
723 renesas,has-lut;
724 renesas,has-sru;
725 renesas,#rpf = <5>;
726 renesas,#uds = <3>;
727 renesas,#wpf = <4>;
728 };
729
730 vsp1@fe930000 {
731 compatible = "renesas,vsp1";
732 reg = <0 0xfe930000 0 0x8000>;
733 interrupts = <0 246 IRQ_TYPE_LEVEL_HIGH>;
734 clocks = <&mstp1_clks R8A7790_CLK_VSP1_DU0>;
735
736 renesas,has-lif;
737 renesas,has-lut;
738 renesas,#rpf = <4>;
739 renesas,#uds = <1>;
740 renesas,#wpf = <4>;
741 };
742
743 vsp1@fe938000 {
744 compatible = "renesas,vsp1";
745 reg = <0 0xfe938000 0 0x8000>;
746 interrupts = <0 247 IRQ_TYPE_LEVEL_HIGH>;
747 clocks = <&mstp1_clks R8A7790_CLK_VSP1_DU1>;
748
749 renesas,has-lif;
750 renesas,has-lut;
751 renesas,#rpf = <4>;
752 renesas,#uds = <1>;
753 renesas,#wpf = <4>;
754 };
755
756 du: display@feb00000 {
757 compatible = "renesas,du-r8a7790";
758 reg = <0 0xfeb00000 0 0x70000>,
759 <0 0xfeb90000 0 0x1c>,
760 <0 0xfeb94000 0 0x1c>;
761 reg-names = "du", "lvds.0", "lvds.1";
762 interrupts = <0 256 IRQ_TYPE_LEVEL_HIGH>,
763 <0 268 IRQ_TYPE_LEVEL_HIGH>,
764 <0 269 IRQ_TYPE_LEVEL_HIGH>;
765 clocks = <&mstp7_clks R8A7790_CLK_DU0>,
766 <&mstp7_clks R8A7790_CLK_DU1>,
767 <&mstp7_clks R8A7790_CLK_DU2>,
768 <&mstp7_clks R8A7790_CLK_LVDS0>,
769 <&mstp7_clks R8A7790_CLK_LVDS1>;
770 clock-names = "du.0", "du.1", "du.2", "lvds.0", "lvds.1";
771 status = "disabled";
772
773 ports {
774 #address-cells = <1>;
775 #size-cells = <0>;
776
777 port@0 {
778 reg = <0>;
779 du_out_rgb: endpoint {
780 };
781 };
782 port@1 {
783 reg = <1>;
784 du_out_lvds0: endpoint {
785 };
786 };
787 port@2 {
788 reg = <2>;
789 du_out_lvds1: endpoint {
790 };
791 };
792 };
793 };
794
603 clocks { 795 clocks {
604 #address-cells = <2>; 796 #address-cells = <2>;
605 #size-cells = <2>; 797 #size-cells = <2>;
@@ -868,18 +1060,25 @@
868 mstp1_clks: mstp1_clks@e6150134 { 1060 mstp1_clks: mstp1_clks@e6150134 {
869 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; 1061 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
870 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>; 1062 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
871 clocks = <&m2_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>, 1063 clocks = <&zs_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>, <&m2_clk>,
872 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>, 1064 <&zs_clk>, <&p_clk>, <&zg_clk>, <&zs_clk>, <&zs_clk>,
873 <&zs_clk>; 1065 <&zs_clk>, <&zs_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>,
1066 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>;
874 #clock-cells = <1>; 1067 #clock-cells = <1>;
875 renesas,clock-indices = < 1068 renesas,clock-indices = <
876 R8A7790_CLK_JPU R8A7790_CLK_TMU1 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2 1069 R8A7790_CLK_VCP1 R8A7790_CLK_VCP0 R8A7790_CLK_VPC1
877 R8A7790_CLK_CMT0 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1 1070 R8A7790_CLK_VPC0 R8A7790_CLK_JPU R8A7790_CLK_SSP1
878 R8A7790_CLK_VSP1_DU0 R8A7790_CLK_VSP1_R R8A7790_CLK_VSP1_S 1071 R8A7790_CLK_TMU1 R8A7790_CLK_3DG R8A7790_CLK_2DDMAC
1072 R8A7790_CLK_FDP1_2 R8A7790_CLK_FDP1_1 R8A7790_CLK_FDP1_0
1073 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2 R8A7790_CLK_CMT0
1074 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1 R8A7790_CLK_VSP1_DU0
1075 R8A7790_CLK_VSP1_R R8A7790_CLK_VSP1_S
879 >; 1076 >;
880 clock-output-names = 1077 clock-output-names =
881 "jpu", "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1", 1078 "vcp1", "vcp0", "vpc1", "vpc0", "jpu", "ssp1",
882 "vsp1-du0", "vsp1-rt", "vsp1-sy"; 1079 "tmu1", "3dg", "2ddmac", "fdp1-2", "fdp1-1",
1080 "fdp1-0", "tmu3", "tmu2", "cmt0", "tmu0",
1081 "vsp1-du1", "vsp1-du0", "vsp1-rt", "vsp1-sy";
883 }; 1082 };
884 mstp2_clks: mstp2_clks@e6150138 { 1083 mstp2_clks: mstp2_clks@e6150138 {
885 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; 1084 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
@@ -904,25 +1103,29 @@
904 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>; 1103 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
905 clocks = <&hp_clk>, <&cp_clk>, <&mmc1_clk>, <&sd3_clk>, 1104 clocks = <&hp_clk>, <&cp_clk>, <&mmc1_clk>, <&sd3_clk>,
906 <&sd2_clk>, <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>, <&mmc0_clk>, 1105 <&sd2_clk>, <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>, <&mmc0_clk>,
907 <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>; 1106 <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>,
1107 <&hp_clk>, <&hp_clk>;
908 #clock-cells = <1>; 1108 #clock-cells = <1>;
909 renesas,clock-indices = < 1109 renesas,clock-indices = <
910 R8A7790_CLK_IIC2 R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3 1110 R8A7790_CLK_IIC2 R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
911 R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 R8A7790_CLK_MMCIF0 1111 R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 R8A7790_CLK_MMCIF0
912 R8A7790_CLK_IIC0 R8A7790_CLK_PCIEC R8A7790_CLK_IIC1 R8A7790_CLK_SSUSB R8A7790_CLK_CMT1 1112 R8A7790_CLK_IIC0 R8A7790_CLK_PCIEC R8A7790_CLK_IIC1 R8A7790_CLK_SSUSB R8A7790_CLK_CMT1
1113 R8A7790_CLK_USBDMAC0 R8A7790_CLK_USBDMAC1
913 >; 1114 >;
914 clock-output-names = 1115 clock-output-names =
915 "iic2", "tpu0", "mmcif1", "sdhi3", 1116 "iic2", "tpu0", "mmcif1", "sdhi3",
916 "sdhi2", "sdhi1", "sdhi0", "mmcif0", 1117 "sdhi2", "sdhi1", "sdhi0", "mmcif0",
917 "iic0", "pciec", "iic1", "ssusb", "cmt1"; 1118 "iic0", "pciec", "iic1", "ssusb", "cmt1",
1119 "usbdmac0", "usbdmac1";
918 }; 1120 };
919 mstp5_clks: mstp5_clks@e6150144 { 1121 mstp5_clks: mstp5_clks@e6150144 {
920 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; 1122 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
921 reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>; 1123 reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
922 clocks = <&extal_clk>, <&p_clk>; 1124 clocks = <&hp_clk>, <&hp_clk>, <&extal_clk>, <&p_clk>;
923 #clock-cells = <1>; 1125 #clock-cells = <1>;
924 renesas,clock-indices = <R8A7790_CLK_THERMAL R8A7790_CLK_PWM>; 1126 renesas,clock-indices = <R8A7790_CLK_AUDIO_DMAC0 R8A7790_CLK_AUDIO_DMAC1
925 clock-output-names = "thermal", "pwm"; 1127 R8A7790_CLK_THERMAL R8A7790_CLK_PWM>;
1128 clock-output-names = "audmac0", "audmac1", "thermal", "pwm";
926 }; 1129 };
927 mstp7_clks: mstp7_clks@e615014c { 1130 mstp7_clks: mstp7_clks@e615014c {
928 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; 1131 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
@@ -1070,6 +1273,16 @@
1070 status = "disabled"; 1273 status = "disabled";
1071 }; 1274 };
1072 1275
1276 xhci: usb@ee000000 {
1277 compatible = "renesas,xhci-r8a7790";
1278 reg = <0 0xee000000 0 0xc00>;
1279 interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
1280 clocks = <&mstp3_clks R8A7790_CLK_SSUSB>;
1281 phys = <&usb2 1>;
1282 phy-names = "usb";
1283 status = "disabled";
1284 };
1285
1073 pci0: pci@ee090000 { 1286 pci0: pci@ee090000 {
1074 compatible = "renesas,pci-r8a7790"; 1287 compatible = "renesas,pci-r8a7790";
1075 device_type = "pci"; 1288 device_type = "pci";
@@ -1088,6 +1301,20 @@
1088 interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH 1301 interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
1089 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH 1302 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
1090 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>; 1303 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>;
1304
1305 usb@0,1 {
1306 reg = <0x800 0 0 0 0>;
1307 device_type = "pci";
1308 phys = <&usb0 0>;
1309 phy-names = "usb";
1310 };
1311
1312 usb@0,2 {
1313 reg = <0x1000 0 0 0 0>;
1314 device_type = "pci";
1315 phys = <&usb0 0>;
1316 phy-names = "usb";
1317 };
1091 }; 1318 };
1092 1319
1093 pci1: pci@ee0b0000 { 1320 pci1: pci@ee0b0000 {
@@ -1128,6 +1355,20 @@
1128 interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH 1355 interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
1129 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH 1356 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
1130 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>; 1357 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>;
1358
1359 usb@0,1 {
1360 reg = <0x800 0 0 0 0>;
1361 device_type = "pci";
1362 phys = <&usb2 0>;
1363 phy-names = "usb";
1364 };
1365
1366 usb@0,2 {
1367 reg = <0x1000 0 0 0 0>;
1368 device_type = "pci";
1369 phys = <&usb2 0>;
1370 phy-names = "usb";
1371 };
1131 }; 1372 };
1132 1373
1133 pciec: pcie@fe000000 { 1374 pciec: pcie@fe000000 {
@@ -1155,7 +1396,7 @@
1155 status = "disabled"; 1396 status = "disabled";
1156 }; 1397 };
1157 1398
1158 rcar_sound: rcar_sound@0xec500000 { 1399 rcar_sound: rcar_sound@ec500000 {
1159 #sound-dai-cells = <1>; 1400 #sound-dai-cells = <1>;
1160 compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound"; 1401 compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
1161 reg = <0 0xec500000 0 0x1000>, /* SCU */ 1402 reg = <0 0xec500000 0 0x1000>, /* SCU */
diff --git a/arch/arm/boot/dts/r8a7791-henninger.dts b/arch/arm/boot/dts/r8a7791-henninger.dts
index f1b56de10205..740e38678032 100644
--- a/arch/arm/boot/dts/r8a7791-henninger.dts
+++ b/arch/arm/boot/dts/r8a7791-henninger.dts
@@ -23,6 +23,7 @@
23 23
24 chosen { 24 chosen {
25 bootargs = "console=ttySC0,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp"; 25 bootargs = "console=ttySC0,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp";
26 stdout-path = &scif0;
26 }; 27 };
27 28
28 memory@40000000 { 29 memory@40000000 {
@@ -271,6 +272,17 @@
271 pinctrl-names = "default"; 272 pinctrl-names = "default";
272}; 273};
273 274
275&hsusb {
276 status = "okay";
277 pinctrl-0 = <&usb0_pins>;
278 pinctrl-names = "default";
279 renesas,enable-gpio = <&gpio5 31 GPIO_ACTIVE_HIGH>;
280};
281
282&usbphy {
283 status = "okay";
284};
285
274&pcie_bus_clk { 286&pcie_bus_clk {
275 status = "okay"; 287 status = "okay";
276}; 288};
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 07550e775e80..990af167c551 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -10,6 +10,34 @@
10 * kind, whether express or implied. 10 * kind, whether express or implied.
11 */ 11 */
12 12
13/*
14 * SSI-AK4643
15 *
16 * SW1: 1: AK4643
17 * 2: CN22
18 * 3: ADV7511
19 *
20 * This command is required when Playback/Capture
21 *
22 * amixer set "LINEOUT Mixer DACL" on
23 * amixer set "DVC Out" 100%
24 * amixer set "DVC In" 100%
25 *
26 * You can use Mute
27 *
28 * amixer set "DVC Out Mute" on
29 * amixer set "DVC In Mute" on
30 *
31 * You can use Volume Ramp
32 *
33 * amixer set "DVC Out Ramp Up Rate" "0.125 dB/64 steps"
34 * amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
35 * amixer set "DVC Out Ramp" on
36 * aplay xxx.wav &
37 * amixer set "DVC Out" 80% // Volume Down
38 * amixer set "DVC Out" 100% // Volume Up
39 */
40
13/dts-v1/; 41/dts-v1/;
14#include "r8a7791.dtsi" 42#include "r8a7791.dtsi"
15#include <dt-bindings/gpio/gpio.h> 43#include <dt-bindings/gpio/gpio.h>
@@ -25,7 +53,8 @@
25 }; 53 };
26 54
27 chosen { 55 chosen {
28 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp"; 56 bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
57 stdout-path = &scif0;
29 }; 58 };
30 59
31 memory@40000000 { 60 memory@40000000 {
@@ -43,7 +72,7 @@
43 #size-cells = <1>; 72 #size-cells = <1>;
44 }; 73 };
45 74
46 gpio-keys { 75 keyboard {
47 compatible = "gpio-keys"; 76 compatible = "gpio-keys";
48 77
49 key-1 { 78 key-1 {
@@ -129,12 +158,15 @@
129 compatible = "gpio-leds"; 158 compatible = "gpio-leds";
130 led6 { 159 led6 {
131 gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>; 160 gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
161 label = "LED6";
132 }; 162 };
133 led7 { 163 led7 {
134 gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>; 164 gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
165 label = "LED7";
135 }; 166 };
136 led8 { 167 led8 {
137 gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>; 168 gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
169 label = "LED8";
138 }; 170 };
139 }; 171 };
140 172
@@ -209,6 +241,36 @@
209 states = <3300000 1 241 states = <3300000 1
210 1800000 0>; 242 1800000 0>;
211 }; 243 };
244
245 sound {
246 compatible = "simple-audio-card";
247
248 simple-audio-card,format = "left_j";
249 simple-audio-card,bitclock-master = <&sndcodec>;
250 simple-audio-card,frame-master = <&sndcodec>;
251
252 sndcpu: simple-audio-card,cpu {
253 sound-dai = <&rcar_sound>;
254 };
255
256 sndcodec: simple-audio-card,codec {
257 sound-dai = <&ak4643>;
258 system-clock-frequency = <11289600>;
259 };
260 };
261};
262
263&du {
264 pinctrl-0 = <&du_pins>;
265 pinctrl-names = "default";
266 status = "okay";
267
268 ports {
269 port@1 {
270 lvds_connector: endpoint {
271 };
272 };
273 };
212}; 274};
213 275
214&extal_clk { 276&extal_clk {
@@ -216,9 +278,6 @@
216}; 278};
217 279
218&pfc { 280&pfc {
219 pinctrl-0 = <&du_pins>;
220 pinctrl-names = "default";
221
222 i2c2_pins: i2c2 { 281 i2c2_pins: i2c2 {
223 renesas,groups = "i2c2"; 282 renesas,groups = "i2c2";
224 renesas,function = "i2c2"; 283 renesas,function = "i2c2";
@@ -289,6 +348,16 @@
289 renesas,groups = "vin1_data8", "vin1_clk"; 348 renesas,groups = "vin1_data8", "vin1_clk";
290 renesas,function = "vin1"; 349 renesas,function = "vin1";
291 }; 350 };
351
352 sound_pins: sound {
353 renesas,groups = "ssi0129_ctrl", "ssi0_data", "ssi1_data";
354 renesas,function = "ssi";
355 };
356
357 sound_clk_pins: sound_clk {
358 renesas,groups = "audio_clk_a";
359 renesas,function = "audio_clk";
360 };
292}; 361};
293 362
294&ether { 363&ether {
@@ -414,7 +483,13 @@
414 pinctrl-names = "default"; 483 pinctrl-names = "default";
415 484
416 status = "okay"; 485 status = "okay";
417 clock-frequency = <400000>; 486 clock-frequency = <100000>;
487
488 ak4643: sound-codec@12 {
489 compatible = "asahi-kasei,ak4643";
490 #sound-dai-cells = <0>;
491 reg = <0x12>;
492 };
418 493
419 composite-in@20 { 494 composite-in@20 {
420 compatible = "adi,adv7180"; 495 compatible = "adi,adv7180";
@@ -463,6 +538,17 @@
463 pinctrl-names = "default"; 538 pinctrl-names = "default";
464}; 539};
465 540
541&hsusb {
542 status = "okay";
543 pinctrl-0 = <&usb0_pins>;
544 pinctrl-names = "default";
545 renesas,enable-gpio = <&gpio5 31 GPIO_ACTIVE_HIGH>;
546};
547
548&usbphy {
549 status = "okay";
550};
551
466&pcie_bus_clk { 552&pcie_bus_clk {
467 status = "okay"; 553 status = "okay";
468}; 554};
@@ -491,3 +577,23 @@
491 }; 577 };
492 }; 578 };
493}; 579};
580
581&rcar_sound {
582 pinctrl-0 = <&sound_pins &sound_clk_pins>;
583 pinctrl-names = "default";
584
585 #sound-dai-cells = <0>;
586
587 status = "okay";
588
589 rcar_sound,dai {
590 dai0 {
591 playback = <&ssi0 &src2 &dvc0>;
592 capture = <&ssi1 &src3 &dvc1>;
593 };
594 };
595};
596
597&ssi1 {
598 shared-pin;
599};
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index e06c11fa8698..77c0beeb8d7c 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * Device Tree Source for the r8a7791 SoC 2 * Device Tree Source for the r8a7791 SoC
3 * 3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation 4 * Copyright (C) 2013-2014 Renesas Electronics Corporation
5 * Copyright (C) 2013-2014 Renesas Solutions Corp. 5 * Copyright (C) 2013-2014 Renesas Solutions Corp.
6 * Copyright (C) 2014 Cogent Embedded Inc. 6 * Copyright (C) 2014 Cogent Embedded Inc.
7 * 7 *
@@ -301,6 +301,69 @@
301 dma-channels = <15>; 301 dma-channels = <15>;
302 }; 302 };
303 303
304 audma0: dma-controller@ec700000 {
305 compatible = "renesas,rcar-dmac";
306 reg = <0 0xec700000 0 0x10000>;
307 interrupts = <0 346 IRQ_TYPE_LEVEL_HIGH
308 0 320 IRQ_TYPE_LEVEL_HIGH
309 0 321 IRQ_TYPE_LEVEL_HIGH
310 0 322 IRQ_TYPE_LEVEL_HIGH
311 0 323 IRQ_TYPE_LEVEL_HIGH
312 0 324 IRQ_TYPE_LEVEL_HIGH
313 0 325 IRQ_TYPE_LEVEL_HIGH
314 0 326 IRQ_TYPE_LEVEL_HIGH
315 0 327 IRQ_TYPE_LEVEL_HIGH
316 0 328 IRQ_TYPE_LEVEL_HIGH
317 0 329 IRQ_TYPE_LEVEL_HIGH
318 0 330 IRQ_TYPE_LEVEL_HIGH
319 0 331 IRQ_TYPE_LEVEL_HIGH
320 0 332 IRQ_TYPE_LEVEL_HIGH>;
321 interrupt-names = "error",
322 "ch0", "ch1", "ch2", "ch3",
323 "ch4", "ch5", "ch6", "ch7",
324 "ch8", "ch9", "ch10", "ch11",
325 "ch12";
326 clocks = <&mstp5_clks R8A7791_CLK_AUDIO_DMAC0>;
327 clock-names = "fck";
328 #dma-cells = <1>;
329 dma-channels = <13>;
330 };
331
332 audma1: dma-controller@ec720000 {
333 compatible = "renesas,rcar-dmac";
334 reg = <0 0xec720000 0 0x10000>;
335 interrupts = <0 347 IRQ_TYPE_LEVEL_HIGH
336 0 333 IRQ_TYPE_LEVEL_HIGH
337 0 334 IRQ_TYPE_LEVEL_HIGH
338 0 335 IRQ_TYPE_LEVEL_HIGH
339 0 336 IRQ_TYPE_LEVEL_HIGH
340 0 337 IRQ_TYPE_LEVEL_HIGH
341 0 338 IRQ_TYPE_LEVEL_HIGH
342 0 339 IRQ_TYPE_LEVEL_HIGH
343 0 340 IRQ_TYPE_LEVEL_HIGH
344 0 341 IRQ_TYPE_LEVEL_HIGH
345 0 342 IRQ_TYPE_LEVEL_HIGH
346 0 343 IRQ_TYPE_LEVEL_HIGH
347 0 344 IRQ_TYPE_LEVEL_HIGH
348 0 345 IRQ_TYPE_LEVEL_HIGH>;
349 interrupt-names = "error",
350 "ch0", "ch1", "ch2", "ch3",
351 "ch4", "ch5", "ch6", "ch7",
352 "ch8", "ch9", "ch10", "ch11",
353 "ch12";
354 clocks = <&mstp5_clks R8A7791_CLK_AUDIO_DMAC1>;
355 clock-names = "fck";
356 #dma-cells = <1>;
357 dma-channels = <13>;
358 };
359
360 audmapp: dma-controller@ec740000 {
361 compatible = "renesas,rcar-audmapp";
362 #dma-cells = <1>;
363
364 reg = <0 0xec740000 0 0x200>;
365 };
366
304 /* The memory map in the User's Manual maps the cores to bus numbers */ 367 /* The memory map in the User's Manual maps the cores to bus numbers */
305 i2c0: i2c@e6508000 { 368 i2c0: i2c@e6508000 {
306 #address-cells = <1>; 369 #address-cells = <1>;
@@ -371,6 +434,8 @@
371 reg = <0 0xe60b0000 0 0x425>; 434 reg = <0 0xe60b0000 0 0x425>;
372 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>; 435 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>;
373 clocks = <&mstp9_clks R8A7791_CLK_IICDVFS>; 436 clocks = <&mstp9_clks R8A7791_CLK_IICDVFS>;
437 dmas = <&dmac0 0x77>, <&dmac0 0x78>;
438 dma-names = "tx", "rx";
374 status = "disabled"; 439 status = "disabled";
375 }; 440 };
376 441
@@ -381,6 +446,8 @@
381 reg = <0 0xe6500000 0 0x425>; 446 reg = <0 0xe6500000 0 0x425>;
382 interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>; 447 interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>;
383 clocks = <&mstp3_clks R8A7791_CLK_IIC0>; 448 clocks = <&mstp3_clks R8A7791_CLK_IIC0>;
449 dmas = <&dmac0 0x61>, <&dmac0 0x62>;
450 dma-names = "tx", "rx";
384 status = "disabled"; 451 status = "disabled";
385 }; 452 };
386 453
@@ -391,6 +458,8 @@
391 reg = <0 0xe6510000 0 0x425>; 458 reg = <0 0xe6510000 0 0x425>;
392 interrupts = <0 175 IRQ_TYPE_LEVEL_HIGH>; 459 interrupts = <0 175 IRQ_TYPE_LEVEL_HIGH>;
393 clocks = <&mstp3_clks R8A7791_CLK_IIC1>; 460 clocks = <&mstp3_clks R8A7791_CLK_IIC1>;
461 dmas = <&dmac0 0x65>, <&dmac0 0x66>;
462 dma-names = "tx", "rx";
394 status = "disabled"; 463 status = "disabled";
395 }; 464 };
396 465
@@ -400,6 +469,17 @@
400 #gpio-range-cells = <3>; 469 #gpio-range-cells = <3>;
401 }; 470 };
402 471
472 mmcif0: mmc@ee200000 {
473 compatible = "renesas,mmcif-r8a7791", "renesas,sh-mmcif";
474 reg = <0 0xee200000 0 0x80>;
475 interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
476 clocks = <&mstp3_clks R8A7791_CLK_MMCIF0>;
477 dmas = <&dmac0 0xd1>, <&dmac0 0xd2>;
478 dma-names = "tx", "rx";
479 reg-io-width = <4>;
480 status = "disabled";
481 };
482
403 sdhi0: sd@ee100000 { 483 sdhi0: sd@ee100000 {
404 compatible = "renesas,sdhi-r8a7791"; 484 compatible = "renesas,sdhi-r8a7791";
405 reg = <0 0xee100000 0 0x200>; 485 reg = <0 0xee100000 0 0x200>;
@@ -613,6 +693,36 @@
613 status = "disabled"; 693 status = "disabled";
614 }; 694 };
615 695
696 hsusb: usb@e6590000 {
697 compatible = "renesas,usbhs-r8a7791";
698 reg = <0 0xe6590000 0 0x100>;
699 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
700 clocks = <&mstp7_clks R8A7791_CLK_HSUSB>;
701 renesas,buswait = <4>;
702 phys = <&usb0 1>;
703 phy-names = "usb";
704 status = "disabled";
705 };
706
707 usbphy: usb-phy@e6590100 {
708 compatible = "renesas,usb-phy-r8a7791";
709 reg = <0 0xe6590100 0 0x100>;
710 #address-cells = <1>;
711 #size-cells = <0>;
712 clocks = <&mstp7_clks R8A7791_CLK_HSUSB>;
713 clock-names = "usbhs";
714 status = "disabled";
715
716 usb0: usb-channel@0 {
717 reg = <0>;
718 #phy-cells = <1>;
719 };
720 usb2: usb-channel@2 {
721 reg = <2>;
722 #phy-cells = <1>;
723 };
724 };
725
616 vin0: video@e6ef0000 { 726 vin0: video@e6ef0000 {
617 compatible = "renesas,vin-r8a7791"; 727 compatible = "renesas,vin-r8a7791";
618 clocks = <&mstp8_clks R8A7791_CLK_VIN0>; 728 clocks = <&mstp8_clks R8A7791_CLK_VIN0>;
@@ -637,6 +747,75 @@
637 status = "disabled"; 747 status = "disabled";
638 }; 748 };
639 749
750 vsp1@fe928000 {
751 compatible = "renesas,vsp1";
752 reg = <0 0xfe928000 0 0x8000>;
753 interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
754 clocks = <&mstp1_clks R8A7791_CLK_VSP1_S>;
755
756 renesas,has-lut;
757 renesas,has-sru;
758 renesas,#rpf = <5>;
759 renesas,#uds = <3>;
760 renesas,#wpf = <4>;
761 };
762
763 vsp1@fe930000 {
764 compatible = "renesas,vsp1";
765 reg = <0 0xfe930000 0 0x8000>;
766 interrupts = <0 246 IRQ_TYPE_LEVEL_HIGH>;
767 clocks = <&mstp1_clks R8A7791_CLK_VSP1_DU0>;
768
769 renesas,has-lif;
770 renesas,has-lut;
771 renesas,#rpf = <4>;
772 renesas,#uds = <1>;
773 renesas,#wpf = <4>;
774 };
775
776 vsp1@fe938000 {
777 compatible = "renesas,vsp1";
778 reg = <0 0xfe938000 0 0x8000>;
779 interrupts = <0 247 IRQ_TYPE_LEVEL_HIGH>;
780 clocks = <&mstp1_clks R8A7791_CLK_VSP1_DU1>;
781
782 renesas,has-lif;
783 renesas,has-lut;
784 renesas,#rpf = <4>;
785 renesas,#uds = <1>;
786 renesas,#wpf = <4>;
787 };
788
789 du: display@feb00000 {
790 compatible = "renesas,du-r8a7791";
791 reg = <0 0xfeb00000 0 0x40000>,
792 <0 0xfeb90000 0 0x1c>;
793 reg-names = "du", "lvds.0";
794 interrupts = <0 256 IRQ_TYPE_LEVEL_HIGH>,
795 <0 268 IRQ_TYPE_LEVEL_HIGH>;
796 clocks = <&mstp7_clks R8A7791_CLK_DU0>,
797 <&mstp7_clks R8A7791_CLK_DU1>,
798 <&mstp7_clks R8A7791_CLK_LVDS0>;
799 clock-names = "du.0", "du.1", "lvds.0";
800 status = "disabled";
801
802 ports {
803 #address-cells = <1>;
804 #size-cells = <0>;
805
806 port@0 {
807 reg = <0>;
808 du_out_rgb: endpoint {
809 };
810 };
811 port@1 {
812 reg = <1>;
813 du_out_lvds0: endpoint {
814 };
815 };
816 };
817 };
818
640 clocks { 819 clocks {
641 #address-cells = <2>; 820 #address-cells = <2>;
642 #size-cells = <2>; 821 #size-cells = <2>;
@@ -889,17 +1068,23 @@
889 mstp1_clks: mstp1_clks@e6150134 { 1068 mstp1_clks: mstp1_clks@e6150134 {
890 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 1069 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
891 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>; 1070 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
892 clocks = <&m2_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>, 1071 clocks = <&zs_clk>, <&zs_clk>, <&m2_clk>, <&zs_clk>, <&p_clk>,
893 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>; 1072 <&zg_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>, <&p_clk>,
1073 <&p_clk>, <&rclk_clk>, <&cp_clk>, <&zs_clk>, <&zs_clk>,
1074 <&zs_clk>;
894 #clock-cells = <1>; 1075 #clock-cells = <1>;
895 renesas,clock-indices = < 1076 renesas,clock-indices = <
896 R8A7791_CLK_JPU R8A7791_CLK_TMU1 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2 1077 R8A7791_CLK_VCP0 R8A7791_CLK_VPC0 R8A7791_CLK_JPU
897 R8A7791_CLK_CMT0 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1 1078 R8A7791_CLK_SSP1 R8A7791_CLK_TMU1 R8A7791_CLK_3DG
898 R8A7791_CLK_VSP1_DU0 R8A7791_CLK_VSP1_S 1079 R8A7791_CLK_2DDMAC R8A7791_CLK_FDP1_1 R8A7791_CLK_FDP1_0
1080 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2 R8A7791_CLK_CMT0
1081 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1 R8A7791_CLK_VSP1_DU0
1082 R8A7791_CLK_VSP1_S
899 >; 1083 >;
900 clock-output-names = 1084 clock-output-names =
901 "jpu", "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1", 1085 "vcp0", "vpc0", "jpu", "ssp1", "tmu1", "3dg",
902 "vsp1-du0", "vsp1-sy"; 1086 "2ddmac", "fdp1-1", "fdp1-0", "tmu3", "tmu2", "cmt0",
1087 "tmu0", "vsp1-du1", "vsp1-du0", "vsp1-sy";
903 }; 1088 };
904 mstp2_clks: mstp2_clks@e6150138 { 1089 mstp2_clks: mstp2_clks@e6150138 {
905 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 1090 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
@@ -923,24 +1108,28 @@
923 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 1108 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
924 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>; 1109 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
925 clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>, <&cpg_clocks R8A7791_CLK_SD0>, 1110 clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>, <&cpg_clocks R8A7791_CLK_SD0>,
926 <&mmc0_clk>, <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>; 1111 <&mmc0_clk>, <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>,
1112 <&hp_clk>, <&hp_clk>;
927 #clock-cells = <1>; 1113 #clock-cells = <1>;
928 renesas,clock-indices = < 1114 renesas,clock-indices = <
929 R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1 R8A7791_CLK_SDHI0 1115 R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1 R8A7791_CLK_SDHI0
930 R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_PCIEC R8A7791_CLK_IIC1 1116 R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_PCIEC R8A7791_CLK_IIC1
931 R8A7791_CLK_SSUSB R8A7791_CLK_CMT1 1117 R8A7791_CLK_SSUSB R8A7791_CLK_CMT1
1118 R8A7791_CLK_USBDMAC0 R8A7791_CLK_USBDMAC1
932 >; 1119 >;
933 clock-output-names = 1120 clock-output-names =
934 "tpu0", "sdhi2", "sdhi1", "sdhi0", 1121 "tpu0", "sdhi2", "sdhi1", "sdhi0",
935 "mmcif0", "i2c7", "pciec", "i2c8", "ssusb", "cmt1"; 1122 "mmcif0", "i2c7", "pciec", "i2c8", "ssusb", "cmt1",
1123 "usbdmac0", "usbdmac1";
936 }; 1124 };
937 mstp5_clks: mstp5_clks@e6150144 { 1125 mstp5_clks: mstp5_clks@e6150144 {
938 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 1126 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
939 reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>; 1127 reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
940 clocks = <&extal_clk>, <&p_clk>; 1128 clocks = <&hp_clk>, <&hp_clk>, <&extal_clk>, <&p_clk>;
941 #clock-cells = <1>; 1129 #clock-cells = <1>;
942 renesas,clock-indices = <R8A7791_CLK_THERMAL R8A7791_CLK_PWM>; 1130 renesas,clock-indices = <R8A7791_CLK_AUDIO_DMAC0 R8A7791_CLK_AUDIO_DMAC1
943 clock-output-names = "thermal", "pwm"; 1131 R8A7791_CLK_THERMAL R8A7791_CLK_PWM>;
1132 clock-output-names = "audmac0", "audmac1", "thermal", "pwm";
944 }; 1133 };
945 mstp7_clks: mstp7_clks@e615014c { 1134 mstp7_clks: mstp7_clks@e615014c {
946 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 1135 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
@@ -1088,6 +1277,16 @@
1088 status = "disabled"; 1277 status = "disabled";
1089 }; 1278 };
1090 1279
1280 xhci: usb@ee000000 {
1281 compatible = "renesas,xhci-r8a7791";
1282 reg = <0 0xee000000 0 0xc00>;
1283 interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
1284 clocks = <&mstp3_clks R8A7791_CLK_SSUSB>;
1285 phys = <&usb2 1>;
1286 phy-names = "usb";
1287 status = "disabled";
1288 };
1289
1091 pci0: pci@ee090000 { 1290 pci0: pci@ee090000 {
1092 compatible = "renesas,pci-r8a7791"; 1291 compatible = "renesas,pci-r8a7791";
1093 device_type = "pci"; 1292 device_type = "pci";
@@ -1106,6 +1305,20 @@
1106 interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH 1305 interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
1107 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH 1306 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
1108 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>; 1307 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>;
1308
1309 usb@0,1 {
1310 reg = <0x800 0 0 0 0>;
1311 device_type = "pci";
1312 phys = <&usb0 0>;
1313 phy-names = "usb";
1314 };
1315
1316 usb@0,2 {
1317 reg = <0x1000 0 0 0 0>;
1318 device_type = "pci";
1319 phys = <&usb0 0>;
1320 phy-names = "usb";
1321 };
1109 }; 1322 };
1110 1323
1111 pci1: pci@ee0d0000 { 1324 pci1: pci@ee0d0000 {
@@ -1126,6 +1339,20 @@
1126 interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH 1339 interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
1127 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH 1340 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
1128 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>; 1341 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>;
1342
1343 usb@0,1 {
1344 reg = <0x800 0 0 0 0>;
1345 device_type = "pci";
1346 phys = <&usb2 0>;
1347 phy-names = "usb";
1348 };
1349
1350 usb@0,2 {
1351 reg = <0x1000 0 0 0 0>;
1352 device_type = "pci";
1353 phys = <&usb2 0>;
1354 phy-names = "usb";
1355 };
1129 }; 1356 };
1130 1357
1131 pciec: pcie@fe000000 { 1358 pciec: pcie@fe000000 {
@@ -1153,7 +1380,7 @@
1153 status = "disabled"; 1380 status = "disabled";
1154 }; 1381 };
1155 1382
1156 rcar_sound: rcar_sound@0xec500000 { 1383 rcar_sound: rcar_sound@ec500000 {
1157 #sound-dai-cells = <1>; 1384 #sound-dai-cells = <1>;
1158 compatible = "renesas,rcar_sound-r8a7791", "renesas,rcar_sound-gen2", "renesas,rcar_sound"; 1385 compatible = "renesas,rcar_sound-r8a7791", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
1159 reg = <0 0xec500000 0 0x1000>, /* SCU */ 1386 reg = <0 0xec500000 0 0x1000>, /* SCU */
diff --git a/arch/arm/boot/dts/r8a7794-alt.dts b/arch/arm/boot/dts/r8a7794-alt.dts
index 79d06ef017a0..f2cf7576bf3f 100644
--- a/arch/arm/boot/dts/r8a7794-alt.dts
+++ b/arch/arm/boot/dts/r8a7794-alt.dts
@@ -20,7 +20,8 @@
20 }; 20 };
21 21
22 chosen { 22 chosen {
23 bootargs = "console=ttySC0,38400 ignore_loglevel rw root=/dev/nfs ip=dhcp"; 23 bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
24 stdout-path = &scif2;
24 }; 25 };
25 26
26 memory@40000000 { 27 memory@40000000 {
diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index d4e8bce1e0b7..19c9de3f2a5a 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -82,6 +82,14 @@
82 status = "disabled"; 82 status = "disabled";
83 }; 83 };
84 84
85 timer {
86 compatible = "arm,armv7-timer";
87 interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
88 <1 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
89 <1 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
90 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
91 };
92
85 irqc0: interrupt-controller@e61c0000 { 93 irqc0: interrupt-controller@e61c0000 {
86 compatible = "renesas,irqc-r8a7794", "renesas,irqc"; 94 compatible = "renesas,irqc-r8a7794", "renesas,irqc";
87 #interrupt-cells = <2>; 95 #interrupt-cells = <2>;
@@ -453,16 +461,19 @@
453 mstp1_clks: mstp1_clks@e6150134 { 461 mstp1_clks: mstp1_clks@e6150134 {
454 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks"; 462 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
455 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>; 463 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
456 clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>, 464 clocks = <&zs_clk>, <&zs_clk>, <&p_clk>, <&zg_clk>, <&zs_clk>,
457 <&cp_clk>, 465 <&zs_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>, <&cp_clk>,
458 <&zs_clk>, <&zs_clk>, <&zs_clk>; 466 <&zs_clk>, <&zs_clk>;
459 #clock-cells = <1>; 467 #clock-cells = <1>;
460 renesas,clock-indices = < 468 renesas,clock-indices = <
461 R8A7794_CLK_TMU1 R8A7794_CLK_TMU3 R8A7794_CLK_TMU2 469 R8A7794_CLK_VCP0 R8A7794_CLK_VPC0 R8A7794_CLK_TMU1
462 R8A7794_CLK_CMT0 R8A7794_CLK_TMU0 470 R8A7794_CLK_3DG R8A7794_CLK_2DDMAC R8A7794_CLK_FDP1_0
471 R8A7794_CLK_TMU3 R8A7794_CLK_TMU2 R8A7794_CLK_CMT0
472 R8A7794_CLK_TMU0 R8A7794_CLK_VSP1_DU0 R8A7794_CLK_VSP1_S
463 >; 473 >;
464 clock-output-names = 474 clock-output-names =
465 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0"; 475 "vcp0", "vpc0", "tmu1", "3dg", "2ddmac", "fdp1-0",
476 "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du0", "vsps";
466 }; 477 };
467 mstp2_clks: mstp2_clks@e6150138 { 478 mstp2_clks: mstp2_clks@e6150138 {
468 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks"; 479 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
@@ -509,13 +520,13 @@
509 mstp8_clks: mstp8_clks@e6150990 { 520 mstp8_clks: mstp8_clks@e6150990 {
510 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks"; 521 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
511 reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>; 522 reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>;
512 clocks = <&p_clk>; 523 clocks = <&zg_clk>, <&zg_clk>, <&p_clk>;
513 #clock-cells = <1>; 524 #clock-cells = <1>;
514 renesas,clock-indices = < 525 renesas,clock-indices = <
515 R8A7794_CLK_ETHER 526 R8A7794_CLK_VIN1 R8A7794_CLK_VIN0 R8A7794_CLK_ETHER
516 >; 527 >;
517 clock-output-names = 528 clock-output-names =
518 "ether"; 529 "vin1", "vin0", "ether";
519 }; 530 };
520 mstp11_clks: mstp11_clks@e615099c { 531 mstp11_clks: mstp11_clks@e615099c {
521 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks"; 532 compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
diff --git a/arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi b/arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi
new file mode 100644
index 000000000000..65cb50f0c29f
--- /dev/null
+++ b/arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Common file for the AA104XD12 panel connected to Renesas R-Car boards
3 *
4 * Copyright (C) 2014 Renesas Electronics 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/ {
12 panel {
13 compatible = "mitsubishi,aa104xd12", "panel-dpi";
14
15 width-mm = <210>;
16 height-mm = <158>;
17
18 panel-timing {
19 /* 1024x768 @65Hz */
20 clock-frequency = <65000000>;
21 hactive = <1024>;
22 vactive = <768>;
23 hsync-len = <136>;
24 hfront-porch = <20>;
25 hback-porch = <160>;
26 vfront-porch = <3>;
27 vback-porch = <29>;
28 vsync-len = <6>;
29 };
30
31 port {
32 panel_in: endpoint {
33 remote-endpoint = <&lvds_connector>;
34 };
35 };
36 };
37};
38
39&lvds_connector {
40 remote-endpoint = <&panel_in>;
41};
diff --git a/arch/arm/boot/dts/rk3066a-bqcurie2.dts b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
index d5344510c676..baf21ac6ce7f 100644
--- a/arch/arm/boot/dts/rk3066a-bqcurie2.dts
+++ b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
@@ -60,6 +60,10 @@
60 }; 60 };
61}; 61};
62 62
63&cpu0 {
64 cpu0-supply = <&vdd_arm>;
65};
66
63&i2c1 { 67&i2c1 {
64 status = "okay"; 68 status = "okay";
65 clock-frequency = <400000>; 69 clock-frequency = <400000>;
diff --git a/arch/arm/boot/dts/rk3066a-marsboard.dts b/arch/arm/boot/dts/rk3066a-marsboard.dts
new file mode 100644
index 000000000000..0a7304beb417
--- /dev/null
+++ b/arch/arm/boot/dts/rk3066a-marsboard.dts
@@ -0,0 +1,206 @@
1/*
2 * Copyright (c) 2014 Romain Perier <romain.perier@gmail.com>
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 file 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 file 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 * Or, alternatively,
20 *
21 * b) Permission is hereby granted, free of charge, to any person
22 * obtaining a copy of this software and associated documentation
23 * files (the "Software"), to deal in the Software without
24 * restriction, including without limitation the rights to use,
25 * copy, modify, merge, publish, distribute, sublicense, and/or
26 * sell copies of the Software, and to permit persons to whom the
27 * Software is furnished to do so, subject to the following
28 * conditions:
29 *
30 * The above copyright notice and this permission notice shall be
31 * included in all copies or substantial portions of the Software.
32 *
33 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40 * OTHER DEALINGS IN THE SOFTWARE.
41 */
42
43/dts-v1/;
44#include "rk3066a.dtsi"
45
46/ {
47 model = "MarsBoard RK3066";
48 compatible = "haoyu,marsboard-rk3066", "rockchip,rk3066a";
49
50 memory {
51 reg = <0x60000000 0x40000000>;
52 };
53
54 vcc_sd0: sdmmc-regulator {
55 compatible = "regulator-fixed";
56 regulator-name = "sdmmc-supply";
57 regulator-min-microvolt = <3000000>;
58 regulator-max-microvolt = <3000000>;
59 gpio = <&gpio3 7 GPIO_ACTIVE_LOW>;
60 startup-delay-us = <100000>;
61 vin-supply = <&vcc_io>;
62 };
63
64 vsys: vsys-regulator {
65 compatible = "regulator-fixed";
66 regulator-name = "vsys";
67 regulator-min-microvolt = <5000000>;
68 regulator-max-microvolt = <5000000>;
69 regulator-boot-on;
70 };
71};
72
73&i2c1 {
74 status = "okay";
75 clock-frequency = <400000>;
76
77 tps: tps@2d {
78 reg = <0x2d>;
79
80 interrupt-parent = <&gpio6>;
81 interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
82
83 vcc1-supply = <&vsys>;
84 vcc2-supply = <&vsys>;
85 vcc3-supply = <&vsys>;
86 vcc4-supply = <&vsys>;
87 vcc5-supply = <&vcc_io>;
88 vcc6-supply = <&vcc_io>;
89 vcc7-supply = <&vsys>;
90 vccio-supply = <&vsys>;
91
92 regulators {
93 vcc_rtc: regulator@0 {
94 regulator-name = "vcc_rtc";
95 regulator-always-on;
96 };
97
98 vcc_io: regulator@1 {
99 regulator-name = "vcc_io";
100 regulator-always-on;
101 };
102
103 vdd_arm: regulator@2 {
104 regulator-name = "vdd_arm";
105 regulator-min-microvolt = <600000>;
106 regulator-max-microvolt = <1500000>;
107 regulator-boot-on;
108 regulator-always-on;
109 };
110
111 vcc_ddr: regulator@3 {
112 regulator-name = "vcc_ddr";
113 regulator-min-microvolt = <600000>;
114 regulator-max-microvolt = <1500000>;
115 regulator-boot-on;
116 regulator-always-on;
117 };
118
119 vcc18_cif: regulator@5 {
120 regulator-name = "vcc18_cif";
121 regulator-always-on;
122 };
123
124 vdd_11: regulator@6 {
125 regulator-name = "vdd_11";
126 regulator-always-on;
127 };
128
129 vcc_25: regulator@7 {
130 regulator-name = "vcc_25";
131 regulator-always-on;
132 };
133
134 vcc_18: regulator@8 {
135 regulator-name = "vcc_18";
136 regulator-always-on;
137 };
138
139 vcc25_hdmi: regulator@9 {
140 regulator-name = "vcc25_hdmi";
141 regulator-always-on;
142 };
143
144 vcca_33: regulator@10 {
145 regulator-name = "vcca_33";
146 regulator-always-on;
147 };
148
149 vcc_rmii: regulator@11 {
150 regulator-name = "vcc_rmii";
151 };
152
153 vcc28_cif: regulator@12 {
154 regulator-name = "vcc28_cif";
155 regulator-always-on;
156 };
157 };
158 };
159};
160
161/* must be included after &tps gets defined */
162#include "tps65910.dtsi"
163
164&emac {
165 status = "okay";
166
167 phy = <&phy0>;
168 phy-supply = <&vcc_rmii>;
169
170 pinctrl-names = "default";
171 pinctrl-0 = <&emac_xfer>, <&emac_mdio>, <&phy_int>;
172
173 phy0: ethernet-phy@0 {
174 reg = <0>;
175 interrupt-parent = <&gpio1>;
176 interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
177 };
178};
179
180&pinctrl {
181 lan8720a {
182 phy_int: phy-int {
183 rockchip,pins = <RK_GPIO1 26 RK_FUNC_GPIO &pcfg_pull_none>;
184 };
185 };
186};
187
188&uart0 {
189 status = "okay";
190};
191
192&uart1 {
193 status = "okay";
194};
195
196&uart2 {
197 status = "okay";
198};
199
200&uart3 {
201 status = "okay";
202};
203
204&wdt {
205 status = "okay";
206};
diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi
index ad9c2db59670..41ffd4951ef3 100644
--- a/arch/arm/boot/dts/rk3066a.dtsi
+++ b/arch/arm/boot/dts/rk3066a.dtsi
@@ -26,11 +26,21 @@
26 #size-cells = <0>; 26 #size-cells = <0>;
27 enable-method = "rockchip,rk3066-smp"; 27 enable-method = "rockchip,rk3066-smp";
28 28
29 cpu@0 { 29 cpu0: cpu@0 {
30 device_type = "cpu"; 30 device_type = "cpu";
31 compatible = "arm,cortex-a9"; 31 compatible = "arm,cortex-a9";
32 next-level-cache = <&L2>; 32 next-level-cache = <&L2>;
33 reg = <0x0>; 33 reg = <0x0>;
34 operating-points = <
35 /* kHz uV */
36 1008000 1075000
37 816000 1025000
38 600000 1025000
39 504000 1000000
40 312000 975000
41 >;
42 clock-latency = <40000>;
43 clocks = <&cru ARMCLK>;
34 }; 44 };
35 cpu@1 { 45 cpu@1 {
36 device_type = "cpu"; 46 device_type = "cpu";
@@ -53,6 +63,51 @@
53 }; 63 };
54 }; 64 };
55 65
66 i2s0: i2s@10118000 {
67 compatible = "rockchip,rk3066-i2s";
68 reg = <0x10118000 0x2000>;
69 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
70 #address-cells = <1>;
71 #size-cells = <0>;
72 pinctrl-names = "default";
73 pinctrl-0 = <&i2s0_bus>;
74 dmas = <&dmac1_s 4>, <&dmac1_s 5>;
75 dma-names = "tx", "rx";
76 clock-names = "i2s_hclk", "i2s_clk";
77 clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
78 status = "disabled";
79 };
80
81 i2s1: i2s@1011a000 {
82 compatible = "rockchip,rk3066-i2s";
83 reg = <0x1011a000 0x2000>;
84 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
85 #address-cells = <1>;
86 #size-cells = <0>;
87 pinctrl-names = "default";
88 pinctrl-0 = <&i2s1_bus>;
89 dmas = <&dmac1_s 6>, <&dmac1_s 7>;
90 dma-names = "tx", "rx";
91 clock-names = "i2s_hclk", "i2s_clk";
92 clocks = <&cru HCLK_I2S1>, <&cru SCLK_I2S1>;
93 status = "disabled";
94 };
95
96 i2s2: i2s@1011c000 {
97 compatible = "rockchip,rk3066-i2s";
98 reg = <0x1011c000 0x2000>;
99 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
100 #address-cells = <1>;
101 #size-cells = <0>;
102 pinctrl-names = "default";
103 pinctrl-0 = <&i2s2_bus>;
104 dmas = <&dmac1_s 9>, <&dmac1_s 10>;
105 dma-names = "tx", "rx";
106 clock-names = "i2s_hclk", "i2s_clk";
107 clocks = <&cru HCLK_I2S2>, <&cru SCLK_I2S2>;
108 status = "disabled";
109 };
110
56 cru: clock-controller@20000000 { 111 cru: clock-controller@20000000 {
57 compatible = "rockchip,rk3066a-cru"; 112 compatible = "rockchip,rk3066a-cru";
58 reg = <0x20000000 0x1000>; 113 reg = <0x20000000 0x1000>;
@@ -179,6 +234,24 @@
179 bias-disable; 234 bias-disable;
180 }; 235 };
181 236
237 emac {
238 emac_xfer: emac-xfer {
239 rockchip,pins = <RK_GPIO1 16 RK_FUNC_2 &pcfg_pull_none>, /* mac_clk */
240 <RK_GPIO1 17 RK_FUNC_2 &pcfg_pull_none>, /* tx_en */
241 <RK_GPIO1 18 RK_FUNC_2 &pcfg_pull_none>, /* txd1 */
242 <RK_GPIO1 19 RK_FUNC_2 &pcfg_pull_none>, /* txd0 */
243 <RK_GPIO1 20 RK_FUNC_2 &pcfg_pull_none>, /* rx_err */
244 <RK_GPIO1 21 RK_FUNC_2 &pcfg_pull_none>, /* crs_dvalid */
245 <RK_GPIO1 22 RK_FUNC_2 &pcfg_pull_none>, /* rxd1 */
246 <RK_GPIO1 23 RK_FUNC_2 &pcfg_pull_none>; /* rxd0 */
247 };
248
249 emac_mdio: emac-mdio {
250 rockchip,pins = <RK_GPIO1 24 RK_FUNC_2 &pcfg_pull_none>, /* mac_md */
251 <RK_GPIO1 25 RK_FUNC_2 &pcfg_pull_none>; /* mac_mdclk */
252 };
253 };
254
182 emmc { 255 emmc {
183 emmc_clk: emmc-clk { 256 emmc_clk: emmc-clk {
184 rockchip,pins = <RK_GPIO3 31 RK_FUNC_2 &pcfg_pull_default>; 257 rockchip,pins = <RK_GPIO3 31 RK_FUNC_2 &pcfg_pull_default>;
@@ -405,6 +478,42 @@
405 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>; 478 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>;
406 }; 479 };
407 }; 480 };
481
482 i2s0 {
483 i2s0_bus: i2s0-bus {
484 rockchip,pins = <RK_GPIO0 7 RK_FUNC_1 &pcfg_pull_default>,
485 <RK_GPIO0 8 RK_FUNC_1 &pcfg_pull_default>,
486 <RK_GPIO0 9 RK_FUNC_1 &pcfg_pull_default>,
487 <RK_GPIO0 10 RK_FUNC_1 &pcfg_pull_default>,
488 <RK_GPIO0 11 RK_FUNC_1 &pcfg_pull_default>,
489 <RK_GPIO0 12 RK_FUNC_1 &pcfg_pull_default>,
490 <RK_GPIO0 13 RK_FUNC_1 &pcfg_pull_default>,
491 <RK_GPIO0 14 RK_FUNC_1 &pcfg_pull_default>,
492 <RK_GPIO0 15 RK_FUNC_1 &pcfg_pull_default>;
493 };
494 };
495
496 i2s1 {
497 i2s1_bus: i2s1-bus {
498 rockchip,pins = <RK_GPIO0 16 RK_FUNC_1 &pcfg_pull_default>,
499 <RK_GPIO0 17 RK_FUNC_1 &pcfg_pull_default>,
500 <RK_GPIO0 18 RK_FUNC_1 &pcfg_pull_default>,
501 <RK_GPIO0 19 RK_FUNC_1 &pcfg_pull_default>,
502 <RK_GPIO0 20 RK_FUNC_1 &pcfg_pull_default>,
503 <RK_GPIO0 21 RK_FUNC_1 &pcfg_pull_default>;
504 };
505 };
506
507 i2s2 {
508 i2s2_bus: i2s2-bus {
509 rockchip,pins = <RK_GPIO0 24 RK_FUNC_1 &pcfg_pull_default>,
510 <RK_GPIO0 25 RK_FUNC_1 &pcfg_pull_default>,
511 <RK_GPIO0 26 RK_FUNC_1 &pcfg_pull_default>,
512 <RK_GPIO0 27 RK_FUNC_1 &pcfg_pull_default>,
513 <RK_GPIO0 28 RK_FUNC_1 &pcfg_pull_default>,
514 <RK_GPIO0 29 RK_FUNC_1 &pcfg_pull_default>;
515 };
516 };
408 }; 517 };
409}; 518};
410 519
@@ -496,3 +605,7 @@
496&wdt { 605&wdt {
497 compatible = "rockchip,rk3066-wdt", "snps,dw-wdt"; 606 compatible = "rockchip,rk3066-wdt", "snps,dw-wdt";
498}; 607};
608
609&emac {
610 compatible = "rockchip,rk3066-emac";
611};
diff --git a/arch/arm/boot/dts/rk3188-radxarock.dts b/arch/arm/boot/dts/rk3188-radxarock.dts
index 15910c9ddbc7..9a09579b8309 100644
--- a/arch/arm/boot/dts/rk3188-radxarock.dts
+++ b/arch/arm/boot/dts/rk3188-radxarock.dts
@@ -43,16 +43,19 @@
43 compatible = "gpio-leds"; 43 compatible = "gpio-leds";
44 44
45 green { 45 green {
46 label = "rock:green:user1";
46 gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; 47 gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
47 default-state = "off"; 48 default-state = "off";
48 }; 49 };
49 50
50 yellow { 51 blue {
52 label = "rock:blue:user2";
51 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; 53 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
52 default-state = "off"; 54 default-state = "off";
53 }; 55 };
54 56
55 sleep { 57 sleep {
58 label = "rock:red:power";
56 gpios = <&gpio0 15 0>; 59 gpios = <&gpio0 15 0>;
57 default-state = "off"; 60 default-state = "off";
58 }; 61 };
@@ -118,6 +121,10 @@
118 }; 121 };
119}; 122};
120 123
124&cpu0 {
125 cpu0-supply = <&vdd_arm>;
126};
127
121&i2c1 { 128&i2c1 {
122 status = "okay"; 129 status = "okay";
123 clock-frequency = <400000>; 130 clock-frequency = <400000>;
@@ -159,7 +166,7 @@
159 vdd_arm: REG3 { 166 vdd_arm: REG3 {
160 regulator-name = "VDD_ARM"; 167 regulator-name = "VDD_ARM";
161 regulator-min-microvolt = <875000>; 168 regulator-min-microvolt = <875000>;
162 regulator-max-microvolt = <1300000>; 169 regulator-max-microvolt = <1350000>;
163 regulator-always-on; 170 regulator-always-on;
164 }; 171 };
165 172
@@ -239,6 +246,18 @@
239 disable-wp; 246 disable-wp;
240}; 247};
241 248
249&pwm1 {
250 status = "okay";
251};
252
253&pwm2 {
254 status = "okay";
255};
256
257&pwm3 {
258 status = "okay";
259};
260
242&pinctrl { 261&pinctrl {
243 pcfg_output_low: pcfg-output-low { 262 pcfg_output_low: pcfg-output-low {
244 output-low; 263 output-low;
diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index ddaada788b45..1d4d79c6688d 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -26,11 +26,24 @@
26 #size-cells = <0>; 26 #size-cells = <0>;
27 enable-method = "rockchip,rk3066-smp"; 27 enable-method = "rockchip,rk3066-smp";
28 28
29 cpu@0 { 29 cpu0: cpu@0 {
30 device_type = "cpu"; 30 device_type = "cpu";
31 compatible = "arm,cortex-a9"; 31 compatible = "arm,cortex-a9";
32 next-level-cache = <&L2>; 32 next-level-cache = <&L2>;
33 reg = <0x0>; 33 reg = <0x0>;
34 operating-points = <
35 /* kHz uV */
36 1608000 1350000
37 1416000 1250000
38 1200000 1150000
39 1008000 1075000
40 816000 975000
41 600000 950000
42 504000 925000
43 312000 875000
44 >;
45 clock-latency = <40000>;
46 clocks = <&cru ARMCLK>;
34 }; 47 };
35 cpu@1 { 48 cpu@1 {
36 device_type = "cpu"; 49 device_type = "cpu";
@@ -65,6 +78,21 @@
65 }; 78 };
66 }; 79 };
67 80
81 i2s0: i2s@1011a000 {
82 compatible = "rockchip,rk3188-i2s", "rockchip,rk3066-i2s";
83 reg = <0x1011a000 0x2000>;
84 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
85 #address-cells = <1>;
86 #size-cells = <0>;
87 pinctrl-names = "default";
88 pinctrl-0 = <&i2s0_bus>;
89 dmas = <&dmac1_s 6>, <&dmac1_s 7>;
90 dma-names = "tx", "rx";
91 clock-names = "i2s_hclk", "i2s_clk";
92 clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
93 status = "disabled";
94 };
95
68 cru: clock-controller@20000000 { 96 cru: clock-controller@20000000 {
69 compatible = "rockchip,rk3188-cru"; 97 compatible = "rockchip,rk3188-cru";
70 reg = <0x20000000 0x1000>; 98 reg = <0x20000000 0x1000>;
@@ -83,7 +111,7 @@
83 #size-cells = <1>; 111 #size-cells = <1>;
84 ranges; 112 ranges;
85 113
86 gpio0: gpio0@0x2000a000 { 114 gpio0: gpio0@2000a000 {
87 compatible = "rockchip,rk3188-gpio-bank0"; 115 compatible = "rockchip,rk3188-gpio-bank0";
88 reg = <0x2000a000 0x100>; 116 reg = <0x2000a000 0x100>;
89 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; 117 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
@@ -96,7 +124,7 @@
96 #interrupt-cells = <2>; 124 #interrupt-cells = <2>;
97 }; 125 };
98 126
99 gpio1: gpio1@0x2003c000 { 127 gpio1: gpio1@2003c000 {
100 compatible = "rockchip,gpio-bank"; 128 compatible = "rockchip,gpio-bank";
101 reg = <0x2003c000 0x100>; 129 reg = <0x2003c000 0x100>;
102 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; 130 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
@@ -395,6 +423,17 @@
395 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_none>; 423 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_none>;
396 }; 424 };
397 }; 425 };
426
427 i2s0 {
428 i2s0_bus: i2s0-bus {
429 rockchip,pins = <RK_GPIO1 16 RK_FUNC_1 &pcfg_pull_none>,
430 <RK_GPIO1 17 RK_FUNC_1 &pcfg_pull_none>,
431 <RK_GPIO1 18 RK_FUNC_1 &pcfg_pull_none>,
432 <RK_GPIO1 19 RK_FUNC_1 &pcfg_pull_none>,
433 <RK_GPIO1 20 RK_FUNC_1 &pcfg_pull_none>,
434 <RK_GPIO1 21 RK_FUNC_1 &pcfg_pull_none>;
435 };
436 };
398 }; 437 };
399}; 438};
400 439
diff --git a/arch/arm/boot/dts/rk3288-evb-rk808.dts b/arch/arm/boot/dts/rk3288-evb-rk808.dts
index ff522f8e3df4..d8c775e6d5fe 100644
--- a/arch/arm/boot/dts/rk3288-evb-rk808.dts
+++ b/arch/arm/boot/dts/rk3288-evb-rk808.dts
@@ -17,6 +17,10 @@
17 compatible = "rockchip,rk3288-evb-rk808", "rockchip,rk3288"; 17 compatible = "rockchip,rk3288-evb-rk808", "rockchip,rk3288";
18}; 18};
19 19
20&cpu0 {
21 cpu0-supply = <&vdd_cpu>;
22};
23
20&i2c0 { 24&i2c0 {
21 clock-frequency = <400000>; 25 clock-frequency = <400000>;
22 status = "okay"; 26 status = "okay";
@@ -44,7 +48,7 @@
44 regulator-always-on; 48 regulator-always-on;
45 regulator-boot-on; 49 regulator-boot-on;
46 regulator-min-microvolt = <750000>; 50 regulator-min-microvolt = <750000>;
47 regulator-max-microvolt = <1300000>; 51 regulator-max-microvolt = <1350000>;
48 regulator-name = "vdd_arm"; 52 regulator-name = "vdd_arm";
49 }; 53 };
50 54
diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi b/arch/arm/boot/dts/rk3288-evb.dtsi
index cb83cea52fa1..3e067dd65d0c 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -148,6 +148,12 @@
148 status = "okay"; 148 status = "okay";
149}; 149};
150 150
151&tsadc {
152 rockchip,hw-tshut-mode = <0>; /* tshut mode 0:CRU 1:GPIO */
153 rockchip,hw-tshut-polarity = <0>; /* tshut polarity 0:LOW 1:HIGH */
154 status = "okay";
155};
156
151&pinctrl { 157&pinctrl {
152 backlight { 158 backlight {
153 bl_en: bl-en { 159 bl_en: bl-en {
diff --git a/arch/arm/boot/dts/rk3288-thermal.dtsi b/arch/arm/boot/dts/rk3288-thermal.dtsi
new file mode 100644
index 000000000000..2695200c0af7
--- /dev/null
+++ b/arch/arm/boot/dts/rk3288-thermal.dtsi
@@ -0,0 +1,74 @@
1/*
2 * Device Tree Source for RK3288 SoC thermal
3 *
4 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#include <dt-bindings/thermal/thermal.h>
12
13reserve_thermal: reserve_thermal {
14 polling-delay-passive = <1000>; /* milliseconds */
15 polling-delay = <5000>; /* milliseconds */
16
17 thermal-sensors = <&tsadc 0>;
18};
19
20cpu_thermal: cpu_thermal {
21 polling-delay-passive = <1000>; /* milliseconds */
22 polling-delay = <5000>; /* milliseconds */
23
24 thermal-sensors = <&tsadc 1>;
25
26 trips {
27 cpu_alert0: cpu_alert0 {
28 temperature = <70000>; /* millicelsius */
29 hysteresis = <2000>; /* millicelsius */
30 type = "passive";
31 };
32 cpu_crit: cpu_crit {
33 temperature = <90000>; /* millicelsius */
34 hysteresis = <2000>; /* millicelsius */
35 type = "critical";
36 };
37 };
38
39 cooling-maps {
40 map0 {
41 trip = <&cpu_alert0>;
42 cooling-device =
43 <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
44 };
45 };
46};
47
48gpu_thermal: gpu_thermal {
49 polling-delay-passive = <1000>; /* milliseconds */
50 polling-delay = <5000>; /* milliseconds */
51
52 thermal-sensors = <&tsadc 2>;
53
54 trips {
55 gpu_alert0: gpu_alert0 {
56 temperature = <70000>; /* millicelsius */
57 hysteresis = <2000>; /* millicelsius */
58 type = "passive";
59 };
60 gpu_crit: gpu_crit {
61 temperature = <90000>; /* millicelsius */
62 hysteresis = <2000>; /* millicelsius */
63 type = "critical";
64 };
65 };
66
67 cooling-maps {
68 map0 {
69 trip = <&gpu_alert0>;
70 cooling-device =
71 <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
72 };
73 };
74};
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 874e66dbb93b..fd19f00784bd 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -15,6 +15,7 @@
15#include <dt-bindings/interrupt-controller/arm-gic.h> 15#include <dt-bindings/interrupt-controller/arm-gic.h>
16#include <dt-bindings/pinctrl/rockchip.h> 16#include <dt-bindings/pinctrl/rockchip.h>
17#include <dt-bindings/clock/rk3288-cru.h> 17#include <dt-bindings/clock/rk3288-cru.h>
18#include <dt-bindings/thermal/thermal.h>
18#include "skeleton.dtsi" 19#include "skeleton.dtsi"
19 20
20/ { 21/ {
@@ -46,26 +47,50 @@
46 cpus { 47 cpus {
47 #address-cells = <1>; 48 #address-cells = <1>;
48 #size-cells = <0>; 49 #size-cells = <0>;
50 enable-method = "rockchip,rk3066-smp";
51 rockchip,pmu = <&pmu>;
49 52
50 cpu@500 { 53 cpu0: cpu@500 {
51 device_type = "cpu"; 54 device_type = "cpu";
52 compatible = "arm,cortex-a12"; 55 compatible = "arm,cortex-a12";
53 reg = <0x500>; 56 reg = <0x500>;
57 resets = <&cru SRST_CORE0>;
58 operating-points = <
59 /* KHz uV */
60 1608000 1350000
61 1512000 1300000
62 1416000 1200000
63 1200000 1100000
64 1008000 1050000
65 816000 1000000
66 696000 950000
67 600000 900000
68 408000 900000
69 312000 900000
70 216000 900000
71 126000 900000
72 >;
73 #cooling-cells = <2>; /* min followed by max */
74 clock-latency = <40000>;
75 clocks = <&cru ARMCLK>;
54 }; 76 };
55 cpu@501 { 77 cpu@501 {
56 device_type = "cpu"; 78 device_type = "cpu";
57 compatible = "arm,cortex-a12"; 79 compatible = "arm,cortex-a12";
58 reg = <0x501>; 80 reg = <0x501>;
81 resets = <&cru SRST_CORE1>;
59 }; 82 };
60 cpu@502 { 83 cpu@502 {
61 device_type = "cpu"; 84 device_type = "cpu";
62 compatible = "arm,cortex-a12"; 85 compatible = "arm,cortex-a12";
63 reg = <0x502>; 86 reg = <0x502>;
87 resets = <&cru SRST_CORE2>;
64 }; 88 };
65 cpu@503 { 89 cpu@503 {
66 device_type = "cpu"; 90 device_type = "cpu";
67 compatible = "arm,cortex-a12"; 91 compatible = "arm,cortex-a12";
68 reg = <0x503>; 92 reg = <0x503>;
93 resets = <&cru SRST_CORE3>;
69 }; 94 };
70 }; 95 };
71 96
@@ -116,6 +141,7 @@
116 141
117 timer { 142 timer {
118 compatible = "arm,armv7-timer"; 143 compatible = "arm,armv7-timer";
144 arm,cpu-registers-not-fw-configured;
119 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, 145 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
120 <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, 146 <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
121 <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, 147 <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
@@ -177,6 +203,8 @@
177 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi"; 203 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi";
178 clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>; 204 clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>;
179 clock-names = "spiclk", "apb_pclk"; 205 clock-names = "spiclk", "apb_pclk";
206 dmas = <&dmac_peri 11>, <&dmac_peri 12>;
207 dma-names = "tx", "rx";
180 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; 208 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
181 pinctrl-names = "default"; 209 pinctrl-names = "default";
182 pinctrl-0 = <&spi0_clk &spi0_tx &spi0_rx &spi0_cs0>; 210 pinctrl-0 = <&spi0_clk &spi0_tx &spi0_rx &spi0_cs0>;
@@ -190,6 +218,8 @@
190 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi"; 218 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi";
191 clocks = <&cru SCLK_SPI1>, <&cru PCLK_SPI1>; 219 clocks = <&cru SCLK_SPI1>, <&cru PCLK_SPI1>;
192 clock-names = "spiclk", "apb_pclk"; 220 clock-names = "spiclk", "apb_pclk";
221 dmas = <&dmac_peri 13>, <&dmac_peri 14>;
222 dma-names = "tx", "rx";
193 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; 223 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
194 pinctrl-names = "default"; 224 pinctrl-names = "default";
195 pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0>; 225 pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0>;
@@ -203,6 +233,8 @@
203 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi"; 233 compatible = "rockchip,rk3288-spi", "rockchip,rk3066-spi";
204 clocks = <&cru SCLK_SPI2>, <&cru PCLK_SPI2>; 234 clocks = <&cru SCLK_SPI2>, <&cru PCLK_SPI2>;
205 clock-names = "spiclk", "apb_pclk"; 235 clock-names = "spiclk", "apb_pclk";
236 dmas = <&dmac_peri 15>, <&dmac_peri 16>;
237 dma-names = "tx", "rx";
206 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; 238 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
207 pinctrl-names = "default"; 239 pinctrl-names = "default";
208 pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0>; 240 pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0>;
@@ -329,6 +361,25 @@
329 status = "disabled"; 361 status = "disabled";
330 }; 362 };
331 363
364 thermal-zones {
365 #include "rk3288-thermal.dtsi"
366 };
367
368 tsadc: tsadc@ff280000 {
369 compatible = "rockchip,rk3288-tsadc";
370 reg = <0xff280000 0x100>;
371 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
372 clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>;
373 clock-names = "tsadc", "apb_pclk";
374 resets = <&cru SRST_TSADC>;
375 reset-names = "tsadc-apb";
376 pinctrl-names = "default";
377 pinctrl-0 = <&otp_out>;
378 #thermal-sensor-cells = <1>;
379 rockchip,hw-tshut-temp = <95000>;
380 status = "disabled";
381 };
382
332 usb_host0_ehci: usb@ff500000 { 383 usb_host0_ehci: usb@ff500000 {
333 compatible = "generic-ehci"; 384 compatible = "generic-ehci";
334 reg = <0xff500000 0x100>; 385 reg = <0xff500000 0x100>;
@@ -439,6 +490,18 @@
439 status = "disabled"; 490 status = "disabled";
440 }; 491 };
441 492
493 bus_intmem@ff700000 {
494 compatible = "mmio-sram";
495 reg = <0xff700000 0x18000>;
496 #address-cells = <1>;
497 #size-cells = <1>;
498 ranges = <0 0xff700000 0x18000>;
499 smp-sram@0 {
500 compatible = "rockchip,rk3066-smp-sram";
501 reg = <0x00 0x10>;
502 };
503 };
504
442 pmu: power-management@ff730000 { 505 pmu: power-management@ff730000 {
443 compatible = "rockchip,rk3288-pmu", "syscon"; 506 compatible = "rockchip,rk3288-pmu", "syscon";
444 reg = <0xff730000 0x100>; 507 reg = <0xff730000 0x100>;
@@ -455,6 +518,16 @@
455 rockchip,grf = <&grf>; 518 rockchip,grf = <&grf>;
456 #clock-cells = <1>; 519 #clock-cells = <1>;
457 #reset-cells = <1>; 520 #reset-cells = <1>;
521 assigned-clocks = <&cru PLL_GPLL>, <&cru PLL_CPLL>,
522 <&cru PLL_NPLL>, <&cru ACLK_CPU>,
523 <&cru HCLK_CPU>, <&cru PCLK_CPU>,
524 <&cru ACLK_PERI>, <&cru HCLK_PERI>,
525 <&cru PCLK_PERI>;
526 assigned-clock-rates = <594000000>, <400000000>,
527 <500000000>, <300000000>,
528 <150000000>, <75000000>,
529 <300000000>, <150000000>,
530 <75000000>;
458 }; 531 };
459 532
460 grf: syscon@ff770000 { 533 grf: syscon@ff770000 {
@@ -484,6 +557,24 @@
484 status = "disabled"; 557 status = "disabled";
485 }; 558 };
486 559
560 vopb_mmu: iommu@ff930300 {
561 compatible = "rockchip,iommu";
562 reg = <0xff930300 0x100>;
563 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
564 interrupt-names = "vopb_mmu";
565 #iommu-cells = <0>;
566 status = "disabled";
567 };
568
569 vopl_mmu: iommu@ff940300 {
570 compatible = "rockchip,iommu";
571 reg = <0xff940300 0x100>;
572 interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
573 interrupt-names = "vopl_mmu";
574 #iommu-cells = <0>;
575 status = "disabled";
576 };
577
487 gic: interrupt-controller@ffc01000 { 578 gic: interrupt-controller@ffc01000 {
488 compatible = "arm,gic-400"; 579 compatible = "arm,gic-400";
489 interrupt-controller; 580 interrupt-controller;
@@ -948,6 +1039,12 @@
948 }; 1039 };
949 }; 1040 };
950 1041
1042 tsadc {
1043 otp_out: otp-out {
1044 rockchip,pins = <0 10 RK_FUNC_1 &pcfg_pull_none>;
1045 };
1046 };
1047
951 pwm0 { 1048 pwm0 {
952 pwm0_pin: pwm0-pin { 1049 pwm0_pin: pwm0-pin {
953 rockchip,pins = <7 0 RK_FUNC_1 &pcfg_pull_none>; 1050 rockchip,pins = <7 0 RK_FUNC_1 &pcfg_pull_none>;
diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
index 499468d42ada..c54a9715dcfa 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -29,6 +29,10 @@
29 mshc0 = &emmc; 29 mshc0 = &emmc;
30 mshc1 = &mmc0; 30 mshc1 = &mmc0;
31 mshc2 = &mmc1; 31 mshc2 = &mmc1;
32 serial0 = &uart0;
33 serial1 = &uart1;
34 serial2 = &uart2;
35 serial3 = &uart3;
32 spi0 = &spi0; 36 spi0 = &spi0;
33 spi1 = &spi1; 37 spi1 = &spi1;
34 }; 38 };
@@ -173,10 +177,9 @@
173 compatible = "rockchip,rk2928-dw-mshc"; 177 compatible = "rockchip,rk2928-dw-mshc";
174 reg = <0x10214000 0x1000>; 178 reg = <0x10214000 0x1000>;
175 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; 179 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
176
177 clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>; 180 clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>;
178 clock-names = "biu", "ciu"; 181 clock-names = "biu", "ciu";
179 182 fifo-depth = <256>;
180 status = "disabled"; 183 status = "disabled";
181 }; 184 };
182 185
@@ -184,10 +187,9 @@
184 compatible = "rockchip,rk2928-dw-mshc"; 187 compatible = "rockchip,rk2928-dw-mshc";
185 reg = <0x10218000 0x1000>; 188 reg = <0x10218000 0x1000>;
186 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; 189 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
187
188 clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>; 190 clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>;
189 clock-names = "biu", "ciu"; 191 clock-names = "biu", "ciu";
190 192 fifo-depth = <256>;
191 status = "disabled"; 193 status = "disabled";
192 }; 194 };
193 195
@@ -195,10 +197,9 @@
195 compatible = "rockchip,rk2928-dw-mshc"; 197 compatible = "rockchip,rk2928-dw-mshc";
196 reg = <0x1021c000 0x1000>; 198 reg = <0x1021c000 0x1000>;
197 interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>; 199 interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
198
199 clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>; 200 clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>;
200 clock-names = "biu", "ciu"; 201 clock-names = "biu", "ciu";
201 202 fifo-depth = <256>;
202 status = "disabled"; 203 status = "disabled";
203 }; 204 };
204 205
@@ -367,6 +368,8 @@
367 reg = <0x20070000 0x1000>; 368 reg = <0x20070000 0x1000>;
368 #address-cells = <1>; 369 #address-cells = <1>;
369 #size-cells = <0>; 370 #size-cells = <0>;
371 dmas = <&dmac2 10>, <&dmac2 11>;
372 dma-names = "tx", "rx";
370 status = "disabled"; 373 status = "disabled";
371 }; 374 };
372 375
@@ -378,6 +381,8 @@
378 reg = <0x20074000 0x1000>; 381 reg = <0x20074000 0x1000>;
379 #address-cells = <1>; 382 #address-cells = <1>;
380 #size-cells = <0>; 383 #size-cells = <0>;
384 dmas = <&dmac2 12>, <&dmac2 13>;
385 dma-names = "tx", "rx";
381 status = "disabled"; 386 status = "disabled";
382 }; 387 };
383}; 388};
diff --git a/arch/arm/boot/dts/s3c6410-mini6410.dts b/arch/arm/boot/dts/s3c6410-mini6410.dts
index 57e00f9bce99..a25debb50401 100644
--- a/arch/arm/boot/dts/s3c6410-mini6410.dts
+++ b/arch/arm/boot/dts/s3c6410-mini6410.dts
@@ -198,10 +198,6 @@
198 status = "okay"; 198 status = "okay";
199}; 199};
200 200
201&pwm {
202 status = "okay";
203};
204
205&pinctrl0 { 201&pinctrl0 {
206 gpio_leds: gpio-leds { 202 gpio_leds: gpio-leds {
207 samsung,pins = "gpk-4", "gpk-5", "gpk-6", "gpk-7"; 203 samsung,pins = "gpk-4", "gpk-5", "gpk-6", "gpk-7";
diff --git a/arch/arm/boot/dts/s3c64xx.dtsi b/arch/arm/boot/dts/s3c64xx.dtsi
index ff5bdaac987a..0ccb414cd268 100644
--- a/arch/arm/boot/dts/s3c64xx.dtsi
+++ b/arch/arm/boot/dts/s3c64xx.dtsi
@@ -172,7 +172,6 @@
172 clocks = <&clocks PCLK_PWM>; 172 clocks = <&clocks PCLK_PWM>;
173 samsung,pwm-outputs = <0>, <1>; 173 samsung,pwm-outputs = <0>, <1>;
174 #pwm-cells = <3>; 174 #pwm-cells = <3>;
175 status = "disabled";
176 }; 175 };
177 176
178 pinctrl0: pinctrl@7f008000 { 177 pinctrl0: pinctrl@7f008000 {
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index 30ef97e99dc5..939be1299ca6 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -40,6 +40,7 @@
40 40
41 chosen { 41 chosen {
42 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel rw"; 42 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel rw";
43 stdout-path = &scifa4;
43 }; 44 };
44 45
45 memory { 46 memory {
@@ -100,19 +101,23 @@
100 compatible = "gpio-leds"; 101 compatible = "gpio-leds";
101 led1 { 102 led1 {
102 gpios = <&pfc 20 GPIO_ACTIVE_LOW>; 103 gpios = <&pfc 20 GPIO_ACTIVE_LOW>;
104 label = "LED1";
103 }; 105 };
104 led2 { 106 led2 {
105 gpios = <&pfc 21 GPIO_ACTIVE_LOW>; 107 gpios = <&pfc 21 GPIO_ACTIVE_LOW>;
108 label = "LED2";
106 }; 109 };
107 led3 { 110 led3 {
108 gpios = <&pfc 22 GPIO_ACTIVE_LOW>; 111 gpios = <&pfc 22 GPIO_ACTIVE_LOW>;
112 label = "LED3";
109 }; 113 };
110 led4 { 114 led4 {
111 gpios = <&pfc 23 GPIO_ACTIVE_LOW>; 115 gpios = <&pfc 23 GPIO_ACTIVE_LOW>;
116 label = "LED4";
112 }; 117 };
113 }; 118 };
114 119
115 gpio-keys { 120 keyboard {
116 compatible = "gpio-keys"; 121 compatible = "gpio-keys";
117 122
118 back-key { 123 back-key {
@@ -250,7 +255,7 @@
250 }; 255 };
251 }; 256 };
252 257
253 ak4648: ak4648@0x12 { 258 ak4648: ak4648@12 {
254 #sound-dai-cells = <0>; 259 #sound-dai-cells = <0>;
255 compatible = "asahi-kasei,ak4648"; 260 compatible = "asahi-kasei,ak4648";
256 reg = <0x12>; 261 reg = <0x12>;
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 030a5920312f..d8def5a529da 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -138,7 +138,7 @@
138 i2c0: i2c@e6820000 { 138 i2c0: i2c@e6820000 {
139 #address-cells = <1>; 139 #address-cells = <1>;
140 #size-cells = <0>; 140 #size-cells = <0>;
141 compatible = "renesas,rmobile-iic"; 141 compatible = "renesas,iic-sh73a0", "renesas,rmobile-iic";
142 reg = <0xe6820000 0x425>; 142 reg = <0xe6820000 0x425>;
143 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH 143 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH
144 0 168 IRQ_TYPE_LEVEL_HIGH 144 0 168 IRQ_TYPE_LEVEL_HIGH
@@ -150,7 +150,7 @@
150 i2c1: i2c@e6822000 { 150 i2c1: i2c@e6822000 {
151 #address-cells = <1>; 151 #address-cells = <1>;
152 #size-cells = <0>; 152 #size-cells = <0>;
153 compatible = "renesas,rmobile-iic"; 153 compatible = "renesas,iic-sh73a0", "renesas,rmobile-iic";
154 reg = <0xe6822000 0x425>; 154 reg = <0xe6822000 0x425>;
155 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH 155 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH
156 0 52 IRQ_TYPE_LEVEL_HIGH 156 0 52 IRQ_TYPE_LEVEL_HIGH
@@ -162,7 +162,7 @@
162 i2c2: i2c@e6824000 { 162 i2c2: i2c@e6824000 {
163 #address-cells = <1>; 163 #address-cells = <1>;
164 #size-cells = <0>; 164 #size-cells = <0>;
165 compatible = "renesas,rmobile-iic"; 165 compatible = "renesas,iic-sh73a0", "renesas,rmobile-iic";
166 reg = <0xe6824000 0x425>; 166 reg = <0xe6824000 0x425>;
167 interrupts = <0 171 IRQ_TYPE_LEVEL_HIGH 167 interrupts = <0 171 IRQ_TYPE_LEVEL_HIGH
168 0 172 IRQ_TYPE_LEVEL_HIGH 168 0 172 IRQ_TYPE_LEVEL_HIGH
@@ -174,7 +174,7 @@
174 i2c3: i2c@e6826000 { 174 i2c3: i2c@e6826000 {
175 #address-cells = <1>; 175 #address-cells = <1>;
176 #size-cells = <0>; 176 #size-cells = <0>;
177 compatible = "renesas,rmobile-iic"; 177 compatible = "renesas,iic-sh73a0", "renesas,rmobile-iic";
178 reg = <0xe6826000 0x425>; 178 reg = <0xe6826000 0x425>;
179 interrupts = <0 183 IRQ_TYPE_LEVEL_HIGH 179 interrupts = <0 183 IRQ_TYPE_LEVEL_HIGH
180 0 184 IRQ_TYPE_LEVEL_HIGH 180 0 184 IRQ_TYPE_LEVEL_HIGH
@@ -186,7 +186,7 @@
186 i2c4: i2c@e6828000 { 186 i2c4: i2c@e6828000 {
187 #address-cells = <1>; 187 #address-cells = <1>;
188 #size-cells = <0>; 188 #size-cells = <0>;
189 compatible = "renesas,rmobile-iic"; 189 compatible = "renesas,iic-sh73a0", "renesas,rmobile-iic";
190 reg = <0xe6828000 0x425>; 190 reg = <0xe6828000 0x425>;
191 interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH 191 interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH
192 0 188 IRQ_TYPE_LEVEL_HIGH 192 0 188 IRQ_TYPE_LEVEL_HIGH
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index 4472fd92685c..252c3d1bda50 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -639,6 +639,33 @@
639 clock-names = "biu", "ciu"; 639 clock-names = "biu", "ciu";
640 }; 640 };
641 641
642 ocram: sram@ffff0000 {
643 compatible = "mmio-sram";
644 reg = <0xffff0000 0x10000>;
645 };
646
647 spi0: spi@fff00000 {
648 compatible = "snps,dw-apb-ssi";
649 #address-cells = <1>;
650 #size-cells = <0>;
651 reg = <0xfff00000 0x1000>;
652 interrupts = <0 154 4>;
653 num-cs = <4>;
654 clocks = <&spi_m_clk>;
655 status = "disabled";
656 };
657
658 spi1: spi@fff01000 {
659 compatible = "snps,dw-apb-ssi";
660 #address-cells = <1>;
661 #size-cells = <0>;
662 reg = <0xfff01000 0x1000>;
663 interrupts = <0 156 4>;
664 num-cs = <4>;
665 clocks = <&spi_m_clk>;
666 status = "disabled";
667 };
668
642 /* Local timer */ 669 /* Local timer */
643 timer@fffec600 { 670 timer@fffec600 {
644 compatible = "arm,cortex-a9-twd-timer"; 671 compatible = "arm,cortex-a9-twd-timer";
diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
new file mode 100644
index 000000000000..8a05c47fd57f
--- /dev/null
+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
@@ -0,0 +1,374 @@
1/*
2 * Copyright Altera Corporation (C) 2014. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "skeleton.dtsi"
18#include <dt-bindings/interrupt-controller/arm-gic.h>
19
20/ {
21 #address-cells = <1>;
22 #size-cells = <1>;
23
24 aliases {
25 ethernet0 = &gmac0;
26 ethernet1 = &gmac1;
27 ethernet2 = &gmac2;
28 serial0 = &uart0;
29 serial1 = &uart1;
30 timer0 = &timer0;
31 timer1 = &timer1;
32 timer2 = &timer2;
33 timer3 = &timer3;
34 };
35
36 cpus {
37 #address-cells = <1>;
38 #size-cells = <0>;
39
40 cpu@0 {
41 compatible = "arm,cortex-a9";
42 device_type = "cpu";
43 reg = <0>;
44 next-level-cache = <&L2>;
45 };
46 cpu@1 {
47 compatible = "arm,cortex-a9";
48 device_type = "cpu";
49 reg = <1>;
50 next-level-cache = <&L2>;
51 };
52 };
53
54 intc: intc@ffffd000 {
55 compatible = "arm,cortex-a9-gic";
56 #interrupt-cells = <3>;
57 interrupt-controller;
58 reg = <0xffffd000 0x1000>,
59 <0xffffc100 0x100>;
60 };
61
62 soc {
63 #address-cells = <1>;
64 #size-cells = <1>;
65 compatible = "simple-bus";
66 device_type = "soc";
67 interrupt-parent = <&intc>;
68 ranges;
69
70 amba {
71 compatible = "arm,amba-bus";
72 #address-cells = <1>;
73 #size-cells = <1>;
74 ranges;
75
76 pdma: pdma@ffda1000 {
77 compatible = "arm,pl330", "arm,primecell";
78 reg = <0xffda1000 0x1000>;
79 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>,
80 <0 84 IRQ_TYPE_LEVEL_HIGH>,
81 <0 85 IRQ_TYPE_LEVEL_HIGH>,
82 <0 86 IRQ_TYPE_LEVEL_HIGH>,
83 <0 87 IRQ_TYPE_LEVEL_HIGH>,
84 <0 88 IRQ_TYPE_LEVEL_HIGH>,
85 <0 89 IRQ_TYPE_LEVEL_HIGH>,
86 <0 90 IRQ_TYPE_LEVEL_HIGH>;
87 #dma-cells = <1>;
88 #dma-channels = <8>;
89 #dma-requests = <32>;
90 };
91 };
92
93 clkmgr@ffd04000 {
94 compatible = "altr,clk-mgr";
95 reg = <0xffd04000 0x1000>;
96
97 clocks {
98 #address-cells = <1>;
99 #size-cells = <0>;
100
101 osc1: osc1 {
102 #clock-cells = <0>;
103 compatible = "fixed-clock";
104 };
105
106 main_pll: main_pll {
107 #address-cells = <1>;
108 #size-cells = <0>;
109 #clock-cells = <0>;
110 compatible = "altr,socfpga-pll-clock";
111 clocks = <&osc1>;
112 };
113
114 periph_pll: periph_pll {
115 #address-cells = <1>;
116 #size-cells = <0>;
117 #clock-cells = <0>;
118 compatible = "altr,socfpga-pll-clock";
119 clocks = <&osc1>;
120 };
121 };
122 };
123
124 gmac0: ethernet@ff800000 {
125 compatible = "altr,socfpga-stmmac", "snps,dwmac-3.72a", "snps,dwmac";
126 reg = <0xff800000 0x2000>;
127 interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
128 interrupt-names = "macirq";
129 /* Filled in by bootloader */
130 mac-address = [00 00 00 00 00 00];
131 status = "disabled";
132 };
133
134 gmac1: ethernet@ff802000 {
135 compatible = "altr,socfpga-stmmac", "snps,dwmac-3.72a", "snps,dwmac";
136 reg = <0xff802000 0x2000>;
137 interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
138 interrupt-names = "macirq";
139 /* Filled in by bootloader */
140 mac-address = [00 00 00 00 00 00];
141 status = "disabled";
142 };
143
144 gmac2: ethernet@ff804000 {
145 compatible = "altr,socfpga-stmmac", "snps,dwmac-3.72a", "snps,dwmac";
146 reg = <0xff804000 0x2000>;
147 interrupts = <0 94 IRQ_TYPE_LEVEL_HIGH>;
148 interrupt-names = "macirq";
149 /* Filled in by bootloader */
150 mac-address = [00 00 00 00 00 00];
151 status = "disabled";
152 };
153
154 gpio0: gpio@ffc02900 {
155 #address-cells = <1>;
156 #size-cells = <0>;
157 compatible = "snps,dw-apb-gpio";
158 reg = <0xffc02900 0x100>;
159 status = "disabled";
160
161 porta: gpio-controller@0 {
162 compatible = "snps,dw-apb-gpio-port";
163 gpio-controller;
164 #gpio-cells = <2>;
165 snps,nr-gpios = <29>;
166 reg = <0>;
167 interrupt-controller;
168 #interrupt-cells = <2>;
169 interrupts = <0 112 IRQ_TYPE_LEVEL_HIGH>;
170 };
171 };
172
173 gpio1: gpio@ffc02a00 {
174 #address-cells = <1>;
175 #size-cells = <0>;
176 compatible = "snps,dw-apb-gpio";
177 reg = <0xffc02a00 0x100>;
178 status = "disabled";
179
180 portb: gpio-controller@0 {
181 compatible = "snps,dw-apb-gpio-port";
182 gpio-controller;
183 #gpio-cells = <2>;
184 snps,nr-gpios = <29>;
185 reg = <0>;
186 interrupt-controller;
187 #interrupt-cells = <2>;
188 interrupts = <0 113 IRQ_TYPE_LEVEL_HIGH>;
189 };
190 };
191
192 gpio2: gpio@ffc02b00 {
193 #address-cells = <1>;
194 #size-cells = <0>;
195 compatible = "snps,dw-apb-gpio";
196 reg = <0xffc02b00 0x100>;
197 status = "disabled";
198
199 portc: gpio-controller@0 {
200 compatible = "snps,dw-apb-gpio-port";
201 gpio-controller;
202 #gpio-cells = <2>;
203 snps,nr-gpios = <27>;
204 reg = <0>;
205 interrupt-controller;
206 #interrupt-cells = <2>;
207 interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>;
208 };
209 };
210
211 i2c0: i2c@ffc02200 {
212 #address-cells = <1>;
213 #size-cells = <0>;
214 compatible = "snps,designware-i2c";
215 reg = <0xffc02200 0x100>;
216 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
217 status = "disabled";
218 };
219
220 i2c1: i2c@ffc02300 {
221 #address-cells = <1>;
222 #size-cells = <0>;
223 compatible = "snps,designware-i2c";
224 reg = <0xffc02300 0x100>;
225 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
226 status = "disabled";
227 };
228
229 i2c2: i2c@ffc02400 {
230 #address-cells = <1>;
231 #size-cells = <0>;
232 compatible = "snps,designware-i2c";
233 reg = <0xffc02400 0x100>;
234 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
235 status = "disabled";
236 };
237
238 i2c3: i2c@ffc02500 {
239 #address-cells = <1>;
240 #size-cells = <0>;
241 compatible = "snps,designware-i2c";
242 reg = <0xffc02500 0x100>;
243 interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
244 status = "disabled";
245 };
246
247 i2c4: i2c@ffc02600 {
248 #address-cells = <1>;
249 #size-cells = <0>;
250 compatible = "snps,designware-i2c";
251 reg = <0xffc02600 0x100>;
252 interrupts = <0 109 IRQ_TYPE_LEVEL_HIGH>;
253 status = "disabled";
254 };
255
256 L2: l2-cache@fffff000 {
257 compatible = "arm,pl310-cache";
258 reg = <0xfffff000 0x1000>;
259 interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>;
260 cache-unified;
261 cache-level = <2>;
262 };
263
264 mmc: dwmmc0@ff808000 {
265 #address-cells = <1>;
266 #size-cells = <0>;
267 compatible = "altr,socfpga-dw-mshc";
268 reg = <0xff808000 0x1000>;
269 interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
270 fifo-depth = <0x400>;
271 };
272
273 ocram: sram@ffe00000 {
274 compatible = "mmio-sram";
275 reg = <0xffe00000 0x40000>;
276 };
277
278 rst: rstmgr@ffd05000 {
279 #reset-cells = <1>;
280 compatible = "altr,rst-mgr";
281 reg = <0xffd05000 0x100>;
282 };
283
284 sysmgr: sysmgr@ffd06000 {
285 compatible = "altr,sys-mgr", "syscon";
286 reg = <0xffd06000 0x300>;
287 };
288
289 /* Local timer */
290 timer@ffffc600 {
291 compatible = "arm,cortex-a9-twd-timer";
292 reg = <0xffffc600 0x100>;
293 interrupts = <1 13 0xf04>;
294 };
295
296 timer0: timer0@ffc02700 {
297 compatible = "snps,dw-apb-timer";
298 interrupts = <0 115 IRQ_TYPE_LEVEL_HIGH>;
299 reg = <0xffc02700 0x100>;
300 };
301
302 timer1: timer1@ffc02800 {
303 compatible = "snps,dw-apb-timer";
304 interrupts = <0 116 IRQ_TYPE_LEVEL_HIGH>;
305 reg = <0xffc02800 0x100>;
306 };
307
308 timer2: timer2@ffd00000 {
309 compatible = "snps,dw-apb-timer";
310 interrupts = <0 117 IRQ_TYPE_LEVEL_HIGH>;
311 reg = <0xffd00000 0x100>;
312 };
313
314 timer3: timer3@ffd00100 {
315 compatible = "snps,dw-apb-timer";
316 interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>;
317 reg = <0xffd01000 0x100>;
318 };
319
320 uart0: serial0@ffc02000 {
321 compatible = "snps,dw-apb-uart";
322 reg = <0xffc02000 0x100>;
323 interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
324 reg-shift = <2>;
325 reg-io-width = <4>;
326 };
327
328 uart1: serial1@ffc02100 {
329 compatible = "snps,dw-apb-uart";
330 reg = <0xffc02100 0x100>;
331 interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>;
332 reg-shift = <2>;
333 reg-io-width = <4>;
334 };
335
336 usbphy0: usbphy@0 {
337 #phy-cells = <0>;
338 compatible = "usb-nop-xceiv";
339 status = "okay";
340 };
341
342 usb0: usb@ffb00000 {
343 compatible = "snps,dwc2";
344 reg = <0xffb00000 0xffff>;
345 interrupts = <0 95 IRQ_TYPE_LEVEL_HIGH>;
346 phys = <&usbphy0>;
347 phy-names = "usb2-phy";
348 status = "disabled";
349 };
350
351 usb1: usb@ffb40000 {
352 compatible = "snps,dwc2";
353 reg = <0xffb40000 0xffff>;
354 interrupts = <0 96 IRQ_TYPE_LEVEL_HIGH>;
355 phys = <&usbphy0>;
356 phy-names = "usb2-phy";
357 status = "disabled";
358 };
359
360 watchdog0: watchdog@ffd00200 {
361 compatible = "snps,dw-wdt";
362 reg = <0xffd00200 0x100>;
363 interrupts = <0 119 IRQ_TYPE_LEVEL_HIGH>;
364 status = "disabled";
365 };
366
367 watchdog1: watchdog@ffd00300 {
368 compatible = "snps,dw-wdt";
369 reg = <0xffd00300 0x100>;
370 interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>;
371 status = "disabled";
372 };
373 };
374};
diff --git a/arch/arm/boot/dts/socfpga_arria10_socdk.dts b/arch/arm/boot/dts/socfpga_arria10_socdk.dts
new file mode 100755
index 000000000000..3015ce8d3057
--- /dev/null
+++ b/arch/arm/boot/dts/socfpga_arria10_socdk.dts
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2014 Altera Corporation <www.altera.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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/dts-v1/;
19#include "socfpga_arria10.dtsi"
20
21/ {
22 model = "Altera SOCFPGA Arria 10";
23 compatible = "altr,socfpga-arria10", "altr,socfpga";
24
25 chosen {
26 bootargs = "console=ttyS0,115200 rootwait";
27 };
28
29 memory {
30 name = "memory";
31 device_type = "memory";
32 reg = <0x0 0x40000000>; /* 1GB */
33 };
34
35 soc {
36 clkmgr@ffd04000 {
37 clocks {
38 osc1 {
39 clock-frequency = <25000000>;
40 };
41 };
42 };
43
44 serial0@ffc02000 {
45 status = "okay";
46 };
47 };
48};
diff --git a/arch/arm/boot/dts/socfpga_cyclone5.dtsi b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
index 28c05e7a31c9..06db951e06f8 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5.dtsi
+++ b/arch/arm/boot/dts/socfpga_cyclone5.dtsi
@@ -49,3 +49,7 @@
49 }; 49 };
50 }; 50 };
51}; 51};
52
53&watchdog0 {
54 status = "okay";
55};
diff --git a/arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi b/arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi
index e0799966bc25..52dba2e39c71 100644
--- a/arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi
+++ b/arch/arm/boot/dts/ste-ccu8540-pinctrl.dtsi
@@ -16,31 +16,31 @@
16 uart0 { 16 uart0 {
17 uart0_default_mux: uart0_mux { 17 uart0_default_mux: uart0_mux {
18 default_mux { 18 default_mux {
19 ste,function = "u0"; 19 function = "u0";
20 ste,pins = "u0_a_1"; 20 groups = "u0_a_1";
21 }; 21 };
22 }; 22 };
23 23
24 uart0_default_mode: uart0_default { 24 uart0_default_mode: uart0_default {
25 default_cfg1 { 25 default_cfg1 {
26 ste,pins = "GPIO0", "GPIO2"; 26 pins = "GPIO0", "GPIO2";
27 ste,config = <&in_pu>; 27 ste,config = <&in_pu>;
28 }; 28 };
29 29
30 default_cfg2 { 30 default_cfg2 {
31 ste,pins = "GPIO1", "GPIO3"; 31 pins = "GPIO1", "GPIO3";
32 ste,config = <&out_hi>; 32 ste,config = <&out_hi>;
33 }; 33 };
34 }; 34 };
35 35
36 uart0_sleep_mode: uart0_sleep { 36 uart0_sleep_mode: uart0_sleep {
37 sleep_cfg1 { 37 sleep_cfg1 {
38 ste,pins = "GPIO0", "GPIO2"; 38 pins = "GPIO0", "GPIO2";
39 ste,config = <&slpm_in_pu>; 39 ste,config = <&slpm_in_pu>;
40 }; 40 };
41 41
42 sleep_cfg2 { 42 sleep_cfg2 {
43 ste,pins = "GPIO1", "GPIO3"; 43 pins = "GPIO1", "GPIO3";
44 ste,config = <&slpm_out_hi>; 44 ste,config = <&slpm_out_hi>;
45 }; 45 };
46 }; 46 };
@@ -49,29 +49,29 @@
49 uart2 { 49 uart2 {
50 uart2_default_mode: uart2_default { 50 uart2_default_mode: uart2_default {
51 default_mux { 51 default_mux {
52 ste,function = "u2"; 52 function = "u2";
53 ste,pins = "u2txrx_a_1"; 53 groups = "u2txrx_a_1";
54 }; 54 };
55 55
56 default_cfg1 { 56 default_cfg1 {
57 ste,pins = "GPIO120"; 57 pins = "GPIO120";
58 ste,config = <&in_pu>; 58 ste,config = <&in_pu>;
59 }; 59 };
60 60
61 default_cfg2 { 61 default_cfg2 {
62 ste,pins = "GPIO121"; 62 pins = "GPIO121";
63 ste,config = <&out_hi>; 63 ste,config = <&out_hi>;
64 }; 64 };
65 }; 65 };
66 66
67 uart2_sleep_mode: uart2_sleep { 67 uart2_sleep_mode: uart2_sleep {
68 sleep_cfg1 { 68 sleep_cfg1 {
69 ste,pins = "GPIO120"; 69 pins = "GPIO120";
70 ste,config = <&slpm_in_pu>; 70 ste,config = <&slpm_in_pu>;
71 }; 71 };
72 72
73 sleep_cfg2 { 73 sleep_cfg2 {
74 ste,pins = "GPIO121"; 74 pins = "GPIO121";
75 ste,config = <&slpm_out_hi>; 75 ste,config = <&slpm_out_hi>;
76 }; 76 };
77 }; 77 };
@@ -80,21 +80,21 @@
80 i2c0 { 80 i2c0 {
81 i2c0_default_mux: i2c_mux { 81 i2c0_default_mux: i2c_mux {
82 default_mux { 82 default_mux {
83 ste,function = "i2c0"; 83 function = "i2c0";
84 ste,pins = "i2c0_a_1"; 84 groups = "i2c0_a_1";
85 }; 85 };
86 }; 86 };
87 87
88 i2c0_default_mode: i2c_default { 88 i2c0_default_mode: i2c_default {
89 default_cfg1 { 89 default_cfg1 {
90 ste,pins = "GPIO147", "GPIO148"; 90 pins = "GPIO147", "GPIO148";
91 ste,config = <&in_pu>; 91 ste,config = <&in_pu>;
92 }; 92 };
93 }; 93 };
94 94
95 i2c0_sleep_mode: i2c_sleep { 95 i2c0_sleep_mode: i2c_sleep {
96 sleep_cfg1 { 96 sleep_cfg1 {
97 ste,pins = "GPIO147", "GPIO148"; 97 pins = "GPIO147", "GPIO148";
98 ste,config = <&slpm_in_pu>; 98 ste,config = <&slpm_in_pu>;
99 }; 99 };
100 }; 100 };
@@ -103,21 +103,21 @@
103 i2c1 { 103 i2c1 {
104 i2c1_default_mux: i2c_mux { 104 i2c1_default_mux: i2c_mux {
105 default_mux { 105 default_mux {
106 ste,function = "i2c1"; 106 function = "i2c1";
107 ste,pins = "i2c1_b_2"; 107 groups = "i2c1_b_2";
108 }; 108 };
109 }; 109 };
110 110
111 i2c1_default_mode: i2c_default { 111 i2c1_default_mode: i2c_default {
112 default_cfg1 { 112 default_cfg1 {
113 ste,pins = "GPIO16", "GPIO17"; 113 pins = "GPIO16", "GPIO17";
114 ste,config = <&in_pu>; 114 ste,config = <&in_pu>;
115 }; 115 };
116 }; 116 };
117 117
118 i2c1_sleep_mode: i2c_sleep { 118 i2c1_sleep_mode: i2c_sleep {
119 sleep_cfg1 { 119 sleep_cfg1 {
120 ste,pins = "GPIO16", "GPIO17"; 120 pins = "GPIO16", "GPIO17";
121 ste,config = <&slpm_in_pu>; 121 ste,config = <&slpm_in_pu>;
122 }; 122 };
123 }; 123 };
@@ -126,21 +126,21 @@
126 i2c2 { 126 i2c2 {
127 i2c2_default_mux: i2c_mux { 127 i2c2_default_mux: i2c_mux {
128 default_mux { 128 default_mux {
129 ste,function = "i2c2"; 129 function = "i2c2";
130 ste,pins = "i2c2_b_2"; 130 groups = "i2c2_b_2";
131 }; 131 };
132 }; 132 };
133 133
134 i2c2_default_mode: i2c_default { 134 i2c2_default_mode: i2c_default {
135 default_cfg1 { 135 default_cfg1 {
136 ste,pins = "GPIO10", "GPIO11"; 136 pins = "GPIO10", "GPIO11";
137 ste,config = <&in_pu>; 137 ste,config = <&in_pu>;
138 }; 138 };
139 }; 139 };
140 140
141 i2c2_sleep_mode: i2c_sleep { 141 i2c2_sleep_mode: i2c_sleep {
142 sleep_cfg1 { 142 sleep_cfg1 {
143 ste,pins = "GPIO11", "GPIO11"; 143 pins = "GPIO11", "GPIO11";
144 ste,config = <&slpm_in_pu>; 144 ste,config = <&slpm_in_pu>;
145 }; 145 };
146 }; 146 };
@@ -149,21 +149,21 @@
149 i2c4 { 149 i2c4 {
150 i2c4_default_mux: i2c_mux { 150 i2c4_default_mux: i2c_mux {
151 default_mux { 151 default_mux {
152 ste,function = "i2c4"; 152 function = "i2c4";
153 ste,pins = "i2c4_b_2"; 153 groups = "i2c4_b_2";
154 }; 154 };
155 }; 155 };
156 156
157 i2c4_default_mode: i2c_default { 157 i2c4_default_mode: i2c_default {
158 default_cfg1 { 158 default_cfg1 {
159 ste,pins = "GPIO122", "GPIO123"; 159 pins = "GPIO122", "GPIO123";
160 ste,config = <&in_pu>; 160 ste,config = <&in_pu>;
161 }; 161 };
162 }; 162 };
163 163
164 i2c4_sleep_mode: i2c_sleep { 164 i2c4_sleep_mode: i2c_sleep {
165 sleep_cfg1 { 165 sleep_cfg1 {
166 ste,pins = "GPIO122", "GPIO123"; 166 pins = "GPIO122", "GPIO123";
167 ste,config = <&slpm_in_pu>; 167 ste,config = <&slpm_in_pu>;
168 }; 168 };
169 }; 169 };
@@ -172,21 +172,21 @@
172 i2c5 { 172 i2c5 {
173 i2c5_default_mux: i2c_mux { 173 i2c5_default_mux: i2c_mux {
174 default_mux { 174 default_mux {
175 ste,function = "i2c5"; 175 function = "i2c5";
176 ste,pins = "i2c5_c_2"; 176 groups = "i2c5_c_2";
177 }; 177 };
178 }; 178 };
179 179
180 i2c5_default_mode: i2c_default { 180 i2c5_default_mode: i2c_default {
181 default_cfg1 { 181 default_cfg1 {
182 ste,pins = "GPIO118", "GPIO119"; 182 pins = "GPIO118", "GPIO119";
183 ste,config = <&in_pu>; 183 ste,config = <&in_pu>;
184 }; 184 };
185 }; 185 };
186 186
187 i2c5_sleep_mode: i2c_sleep { 187 i2c5_sleep_mode: i2c_sleep {
188 sleep_cfg1 { 188 sleep_cfg1 {
189 ste,pins = "GPIO118", "GPIO119"; 189 pins = "GPIO118", "GPIO119";
190 ste,config = <&slpm_in_pu>; 190 ste,config = <&slpm_in_pu>;
191 }; 191 };
192 }; 192 };
diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index 9d2323020d34..bfd3f1c734b8 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -11,6 +11,7 @@
11 11
12#include <dt-bindings/interrupt-controller/irq.h> 12#include <dt-bindings/interrupt-controller/irq.h>
13#include <dt-bindings/mfd/dbx500-prcmu.h> 13#include <dt-bindings/mfd/dbx500-prcmu.h>
14#include <dt-bindings/arm/ux500_pm_domains.h>
14#include "skeleton.dtsi" 15#include "skeleton.dtsi"
15 16
16/ { 17/ {
@@ -43,6 +44,10 @@
43 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>; 44 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
44 }; 45 };
45 46
47 pm_domains: pm_domains0 {
48 compatible = "stericsson,ux500-pm-domains";
49 #power-domain-cells = <1>;
50 };
46 51
47 clocks { 52 clocks {
48 compatible = "stericsson,u8500-clks"; 53 compatible = "stericsson,u8500-clks";
@@ -636,6 +641,7 @@
636 clock-frequency = <400000>; 641 clock-frequency = <400000>;
637 clocks = <&prcc_kclk 3 3>, <&prcc_pclk 3 3>; 642 clocks = <&prcc_kclk 3 3>, <&prcc_pclk 3 3>;
638 clock-names = "i2cclk", "apb_pclk"; 643 clock-names = "i2cclk", "apb_pclk";
644 power-domains = <&pm_domains DOMAIN_VAPE>;
639 }; 645 };
640 646
641 i2c@80122000 { 647 i2c@80122000 {
@@ -651,6 +657,7 @@
651 657
652 clocks = <&prcc_kclk 1 2>, <&prcc_pclk 1 2>; 658 clocks = <&prcc_kclk 1 2>, <&prcc_pclk 1 2>;
653 clock-names = "i2cclk", "apb_pclk"; 659 clock-names = "i2cclk", "apb_pclk";
660 power-domains = <&pm_domains DOMAIN_VAPE>;
654 }; 661 };
655 662
656 i2c@80128000 { 663 i2c@80128000 {
@@ -666,6 +673,7 @@
666 673
667 clocks = <&prcc_kclk 1 6>, <&prcc_pclk 1 6>; 674 clocks = <&prcc_kclk 1 6>, <&prcc_pclk 1 6>;
668 clock-names = "i2cclk", "apb_pclk"; 675 clock-names = "i2cclk", "apb_pclk";
676 power-domains = <&pm_domains DOMAIN_VAPE>;
669 }; 677 };
670 678
671 i2c@80110000 { 679 i2c@80110000 {
@@ -681,6 +689,7 @@
681 689
682 clocks = <&prcc_kclk 2 0>, <&prcc_pclk 2 0>; 690 clocks = <&prcc_kclk 2 0>, <&prcc_pclk 2 0>;
683 clock-names = "i2cclk", "apb_pclk"; 691 clock-names = "i2cclk", "apb_pclk";
692 power-domains = <&pm_domains DOMAIN_VAPE>;
684 }; 693 };
685 694
686 i2c@8012a000 { 695 i2c@8012a000 {
@@ -696,6 +705,7 @@
696 705
697 clocks = <&prcc_kclk 1 9>, <&prcc_pclk 1 10>; 706 clocks = <&prcc_kclk 1 9>, <&prcc_pclk 1 10>;
698 clock-names = "i2cclk", "apb_pclk"; 707 clock-names = "i2cclk", "apb_pclk";
708 power-domains = <&pm_domains DOMAIN_VAPE>;
699 }; 709 };
700 710
701 ssp@80002000 { 711 ssp@80002000 {
@@ -709,6 +719,7 @@
709 dmas = <&dma 8 0 0x2>, /* Logical - DevToMem */ 719 dmas = <&dma 8 0 0x2>, /* Logical - DevToMem */
710 <&dma 8 0 0x0>; /* Logical - MemToDev */ 720 <&dma 8 0 0x0>; /* Logical - MemToDev */
711 dma-names = "rx", "tx"; 721 dma-names = "rx", "tx";
722 power-domains = <&pm_domains DOMAIN_VAPE>;
712 }; 723 };
713 724
714 ssp@80003000 { 725 ssp@80003000 {
@@ -722,6 +733,7 @@
722 dmas = <&dma 9 0 0x2>, /* Logical - DevToMem */ 733 dmas = <&dma 9 0 0x2>, /* Logical - DevToMem */
723 <&dma 9 0 0x0>; /* Logical - MemToDev */ 734 <&dma 9 0 0x0>; /* Logical - MemToDev */
724 dma-names = "rx", "tx"; 735 dma-names = "rx", "tx";
736 power-domains = <&pm_domains DOMAIN_VAPE>;
725 }; 737 };
726 738
727 spi@8011a000 { 739 spi@8011a000 {
@@ -736,6 +748,7 @@
736 dmas = <&dma 0 0 0x2>, /* Logical - DevToMem */ 748 dmas = <&dma 0 0 0x2>, /* Logical - DevToMem */
737 <&dma 0 0 0x0>; /* Logical - MemToDev */ 749 <&dma 0 0 0x0>; /* Logical - MemToDev */
738 dma-names = "rx", "tx"; 750 dma-names = "rx", "tx";
751 power-domains = <&pm_domains DOMAIN_VAPE>;
739 }; 752 };
740 753
741 spi@80112000 { 754 spi@80112000 {
@@ -750,6 +763,7 @@
750 dmas = <&dma 35 0 0x2>, /* Logical - DevToMem */ 763 dmas = <&dma 35 0 0x2>, /* Logical - DevToMem */
751 <&dma 35 0 0x0>; /* Logical - MemToDev */ 764 <&dma 35 0 0x0>; /* Logical - MemToDev */
752 dma-names = "rx", "tx"; 765 dma-names = "rx", "tx";
766 power-domains = <&pm_domains DOMAIN_VAPE>;
753 }; 767 };
754 768
755 spi@80111000 { 769 spi@80111000 {
@@ -764,6 +778,7 @@
764 dmas = <&dma 33 0 0x2>, /* Logical - DevToMem */ 778 dmas = <&dma 33 0 0x2>, /* Logical - DevToMem */
765 <&dma 33 0 0x0>; /* Logical - MemToDev */ 779 <&dma 33 0 0x0>; /* Logical - MemToDev */
766 dma-names = "rx", "tx"; 780 dma-names = "rx", "tx";
781 power-domains = <&pm_domains DOMAIN_VAPE>;
767 }; 782 };
768 783
769 spi@80129000 { 784 spi@80129000 {
@@ -778,6 +793,7 @@
778 dmas = <&dma 40 0 0x2>, /* Logical - DevToMem */ 793 dmas = <&dma 40 0 0x2>, /* Logical - DevToMem */
779 <&dma 40 0 0x0>; /* Logical - MemToDev */ 794 <&dma 40 0 0x0>; /* Logical - MemToDev */
780 dma-names = "rx", "tx"; 795 dma-names = "rx", "tx";
796 power-domains = <&pm_domains DOMAIN_VAPE>;
781 }; 797 };
782 798
783 uart@80120000 { 799 uart@80120000 {
@@ -836,6 +852,7 @@
836 852
837 clocks = <&prcc_kclk 1 5>, <&prcc_pclk 1 5>; 853 clocks = <&prcc_kclk 1 5>, <&prcc_pclk 1 5>;
838 clock-names = "sdi", "apb_pclk"; 854 clock-names = "sdi", "apb_pclk";
855 power-domains = <&pm_domains DOMAIN_VAPE>;
839 856
840 status = "disabled"; 857 status = "disabled";
841 }; 858 };
@@ -851,6 +868,7 @@
851 868
852 clocks = <&prcc_kclk 2 4>, <&prcc_pclk 2 6>; 869 clocks = <&prcc_kclk 2 4>, <&prcc_pclk 2 6>;
853 clock-names = "sdi", "apb_pclk"; 870 clock-names = "sdi", "apb_pclk";
871 power-domains = <&pm_domains DOMAIN_VAPE>;
854 872
855 status = "disabled"; 873 status = "disabled";
856 }; 874 };
@@ -866,6 +884,7 @@
866 884
867 clocks = <&prcc_kclk 3 4>, <&prcc_pclk 3 4>; 885 clocks = <&prcc_kclk 3 4>, <&prcc_pclk 3 4>;
868 clock-names = "sdi", "apb_pclk"; 886 clock-names = "sdi", "apb_pclk";
887 power-domains = <&pm_domains DOMAIN_VAPE>;
869 888
870 status = "disabled"; 889 status = "disabled";
871 }; 890 };
@@ -881,6 +900,7 @@
881 900
882 clocks = <&prcc_kclk 2 5>, <&prcc_pclk 2 7>; 901 clocks = <&prcc_kclk 2 5>, <&prcc_pclk 2 7>;
883 clock-names = "sdi", "apb_pclk"; 902 clock-names = "sdi", "apb_pclk";
903 power-domains = <&pm_domains DOMAIN_VAPE>;
884 904
885 status = "disabled"; 905 status = "disabled";
886 }; 906 };
@@ -896,6 +916,7 @@
896 916
897 clocks = <&prcc_kclk 2 2>, <&prcc_pclk 2 4>; 917 clocks = <&prcc_kclk 2 2>, <&prcc_pclk 2 4>;
898 clock-names = "sdi", "apb_pclk"; 918 clock-names = "sdi", "apb_pclk";
919 power-domains = <&pm_domains DOMAIN_VAPE>;
899 920
900 status = "disabled"; 921 status = "disabled";
901 }; 922 };
@@ -911,6 +932,7 @@
911 932
912 clocks = <&prcc_kclk 3 7>, <&prcc_pclk 3 7>; 933 clocks = <&prcc_kclk 3 7>, <&prcc_pclk 3 7>;
913 clock-names = "sdi", "apb_pclk"; 934 clock-names = "sdi", "apb_pclk";
935 power-domains = <&pm_domains DOMAIN_VAPE>;
914 936
915 status = "disabled"; 937 status = "disabled";
916 }; 938 };
diff --git a/arch/arm/boot/dts/ste-href-ab8500.dtsi b/arch/arm/boot/dts/ste-href-ab8500.dtsi
index 30f8601da323..9b69bce9297d 100644
--- a/arch/arm/boot/dts/ste-href-ab8500.dtsi
+++ b/arch/arm/boot/dts/ste-href-ab8500.dtsi
@@ -47,11 +47,11 @@
47 gpio2 { 47 gpio2 {
48 gpio2_default_mode: gpio2_default { 48 gpio2_default_mode: gpio2_default {
49 default_mux { 49 default_mux {
50 ste,function = "gpio"; 50 function = "gpio";
51 ste,pins = "gpio2_a_1"; 51 groups = "gpio2_a_1";
52 }; 52 };
53 default_cfg { 53 default_cfg {
54 ste,pins = "GPIO2_T9"; 54 pins = "GPIO2_T9";
55 input-enable; 55 input-enable;
56 bias-pull-down; 56 bias-pull-down;
57 }; 57 };
@@ -60,11 +60,11 @@
60 gpio4 { 60 gpio4 {
61 gpio4_default_mode: gpio4_default { 61 gpio4_default_mode: gpio4_default {
62 default_mux { 62 default_mux {
63 ste,function = "gpio"; 63 function = "gpio";
64 ste,pins = "gpio4_a_1"; 64 groups = "gpio4_a_1";
65 }; 65 };
66 default_cfg { 66 default_cfg {
67 ste,pins = "GPIO4_W2"; 67 pins = "GPIO4_W2";
68 input-enable; 68 input-enable;
69 bias-pull-down; 69 bias-pull-down;
70 }; 70 };
@@ -73,11 +73,11 @@
73 gpio10 { 73 gpio10 {
74 gpio10_default_mode: gpio10_default { 74 gpio10_default_mode: gpio10_default {
75 default_mux { 75 default_mux {
76 ste,function = "gpio"; 76 function = "gpio";
77 ste,pins = "gpio10_d_1"; 77 groups = "gpio10_d_1";
78 }; 78 };
79 default_cfg { 79 default_cfg {
80 ste,pins = "GPIO10_U17"; 80 pins = "GPIO10_U17";
81 input-enable; 81 input-enable;
82 bias-pull-down; 82 bias-pull-down;
83 }; 83 };
@@ -86,11 +86,11 @@
86 gpio11 { 86 gpio11 {
87 gpio11_default_mode: gpio11_default { 87 gpio11_default_mode: gpio11_default {
88 default_mux { 88 default_mux {
89 ste,function = "gpio"; 89 function = "gpio";
90 ste,pins = "gpio11_d_1"; 90 groups = "gpio11_d_1";
91 }; 91 };
92 default_cfg { 92 default_cfg {
93 ste,pins = "GPIO11_AA18"; 93 pins = "GPIO11_AA18";
94 input-enable; 94 input-enable;
95 bias-pull-down; 95 bias-pull-down;
96 }; 96 };
@@ -99,11 +99,11 @@
99 gpio12 { 99 gpio12 {
100 gpio12_default_mode: gpio12_default { 100 gpio12_default_mode: gpio12_default {
101 default_mux { 101 default_mux {
102 ste,function = "gpio"; 102 function = "gpio";
103 ste,pins = "gpio12_d_1"; 103 groups = "gpio12_d_1";
104 }; 104 };
105 default_cfg { 105 default_cfg {
106 ste,pins = "GPIO12_U16"; 106 pins = "GPIO12_U16";
107 input-enable; 107 input-enable;
108 bias-pull-down; 108 bias-pull-down;
109 }; 109 };
@@ -112,11 +112,11 @@
112 gpio13 { 112 gpio13 {
113 gpio13_default_mode: gpio13_default { 113 gpio13_default_mode: gpio13_default {
114 default_mux { 114 default_mux {
115 ste,function = "gpio"; 115 function = "gpio";
116 ste,pins = "gpio13_d_1"; 116 groups = "gpio13_d_1";
117 }; 117 };
118 default_cfg { 118 default_cfg {
119 ste,pins = "GPIO13_W17"; 119 pins = "GPIO13_W17";
120 input-enable; 120 input-enable;
121 bias-pull-down; 121 bias-pull-down;
122 }; 122 };
@@ -125,11 +125,11 @@
125 gpio16 { 125 gpio16 {
126 gpio16_default_mode: gpio16_default { 126 gpio16_default_mode: gpio16_default {
127 default_mux { 127 default_mux {
128 ste,function = "gpio"; 128 function = "gpio";
129 ste,pins = "gpio16_a_1"; 129 groups = "gpio16_a_1";
130 }; 130 };
131 default_cfg { 131 default_cfg {
132 ste,pins = "GPIO16_F15"; 132 pins = "GPIO16_F15";
133 input-enable; 133 input-enable;
134 bias-pull-down; 134 bias-pull-down;
135 }; 135 };
@@ -138,11 +138,11 @@
138 gpio24 { 138 gpio24 {
139 gpio24_default_mode: gpio24_default { 139 gpio24_default_mode: gpio24_default {
140 default_mux { 140 default_mux {
141 ste,function = "gpio"; 141 function = "gpio";
142 ste,pins = "gpio24_a_1"; 142 groups = "gpio24_a_1";
143 }; 143 };
144 default_cfg { 144 default_cfg {
145 ste,pins = "GPIO24_T14"; 145 pins = "GPIO24_T14";
146 input-enable; 146 input-enable;
147 bias-pull-down; 147 bias-pull-down;
148 }; 148 };
@@ -151,11 +151,11 @@
151 gpio25 { 151 gpio25 {
152 gpio25_default_mode: gpio25_default { 152 gpio25_default_mode: gpio25_default {
153 default_mux { 153 default_mux {
154 ste,function = "gpio"; 154 function = "gpio";
155 ste,pins = "gpio25_a_1"; 155 groups = "gpio25_a_1";
156 }; 156 };
157 default_cfg { 157 default_cfg {
158 ste,pins = "GPIO25_R16"; 158 pins = "GPIO25_R16";
159 input-enable; 159 input-enable;
160 bias-pull-down; 160 bias-pull-down;
161 }; 161 };
@@ -164,11 +164,11 @@
164 gpio36 { 164 gpio36 {
165 gpio36_default_mode: gpio36_default { 165 gpio36_default_mode: gpio36_default {
166 default_mux { 166 default_mux {
167 ste,function = "gpio"; 167 function = "gpio";
168 ste,pins = "gpio36_a_1"; 168 groups = "gpio36_a_1";
169 }; 169 };
170 default_cfg { 170 default_cfg {
171 ste,pins = "GPIO36_A17"; 171 pins = "GPIO36_A17";
172 input-enable; 172 input-enable;
173 bias-pull-down; 173 bias-pull-down;
174 }; 174 };
@@ -177,11 +177,11 @@
177 gpio37 { 177 gpio37 {
178 gpio37_default_mode: gpio37_default { 178 gpio37_default_mode: gpio37_default {
179 default_mux { 179 default_mux {
180 ste,function = "gpio"; 180 function = "gpio";
181 ste,pins = "gpio37_a_1"; 181 groups = "gpio37_a_1";
182 }; 182 };
183 default_cfg { 183 default_cfg {
184 ste,pins = "GPIO37_E15"; 184 pins = "GPIO37_E15";
185 input-enable; 185 input-enable;
186 bias-pull-down; 186 bias-pull-down;
187 }; 187 };
@@ -190,11 +190,11 @@
190 gpio38 { 190 gpio38 {
191 gpio38_default_mode: gpio38_default { 191 gpio38_default_mode: gpio38_default {
192 default_mux { 192 default_mux {
193 ste,function = "gpio"; 193 function = "gpio";
194 ste,pins = "gpio38_a_1"; 194 groups = "gpio38_a_1";
195 }; 195 };
196 default_cfg { 196 default_cfg {
197 ste,pins = "GPIO38_C17"; 197 pins = "GPIO38_C17";
198 input-enable; 198 input-enable;
199 bias-pull-down; 199 bias-pull-down;
200 }; 200 };
@@ -203,11 +203,11 @@
203 gpio39 { 203 gpio39 {
204 gpio39_default_mode: gpio39_default { 204 gpio39_default_mode: gpio39_default {
205 default_mux { 205 default_mux {
206 ste,function = "gpio"; 206 function = "gpio";
207 ste,pins = "gpio39_a_1"; 207 groups = "gpio39_a_1";
208 }; 208 };
209 default_cfg { 209 default_cfg {
210 ste,pins = "GPIO39_E16"; 210 pins = "GPIO39_E16";
211 input-enable; 211 input-enable;
212 bias-pull-down; 212 bias-pull-down;
213 }; 213 };
@@ -216,11 +216,11 @@
216 gpio42 { 216 gpio42 {
217 gpio42_default_mode: gpio42_default { 217 gpio42_default_mode: gpio42_default {
218 default_mux { 218 default_mux {
219 ste,function = "gpio"; 219 function = "gpio";
220 ste,pins = "gpio42_a_1"; 220 groups = "gpio42_a_1";
221 }; 221 };
222 default_cfg { 222 default_cfg {
223 ste,pins = "GPIO42_U2"; 223 pins = "GPIO42_U2";
224 input-enable; 224 input-enable;
225 bias-pull-down; 225 bias-pull-down;
226 }; 226 };
@@ -232,11 +232,11 @@
232 gpio26 { 232 gpio26 {
233 gpio26_default_mode: gpio26_default { 233 gpio26_default_mode: gpio26_default {
234 default_mux { 234 default_mux {
235 ste,function = "gpio"; 235 function = "gpio";
236 ste,pins = "gpio26_d_1"; 236 groups = "gpio26_d_1";
237 }; 237 };
238 default_cfg { 238 default_cfg {
239 ste,pins = "GPIO26_M16"; 239 pins = "GPIO26_M16";
240 output-low; 240 output-low;
241 }; 241 };
242 }; 242 };
@@ -244,11 +244,11 @@
244 gpio35 { 244 gpio35 {
245 gpio35_default_mode: gpio35_default { 245 gpio35_default_mode: gpio35_default {
246 default_mux { 246 default_mux {
247 ste,function = "gpio"; 247 function = "gpio";
248 ste,pins = "gpio35_d_1"; 248 groups = "gpio35_d_1";
249 }; 249 };
250 default_cfg { 250 default_cfg {
251 ste,pins = "GPIO35_W15"; 251 pins = "GPIO35_W15";
252 output-low; 252 output-low;
253 }; 253 };
254 }; 254 };
@@ -260,11 +260,11 @@
260 ycbcr { 260 ycbcr {
261 ycbcr_default_mode: ycbcr_default { 261 ycbcr_default_mode: ycbcr_default {
262 default_mux { 262 default_mux {
263 ste,function = "ycbcr"; 263 function = "ycbcr";
264 ste,pins = "ycbcr0123_d_1"; 264 groups = "ycbcr0123_d_1";
265 }; 265 };
266 default_cfg { 266 default_cfg {
267 ste,pins = "GPIO6_Y18", 267 pins = "GPIO6_Y18",
268 "GPIO7_AA20", 268 "GPIO7_AA20",
269 "GPIO8_W18", 269 "GPIO8_W18",
270 "GPIO9_AA19"; 270 "GPIO9_AA19";
@@ -277,11 +277,11 @@
277 pwm { 277 pwm {
278 pwm_default_mode: pwm_default { 278 pwm_default_mode: pwm_default {
279 default_mux { 279 default_mux {
280 ste,function = "pwmout"; 280 function = "pwmout";
281 ste,pins = "pwmout1_d_1", "pwmout2_d_1"; 281 groups = "pwmout1_d_1", "pwmout2_d_1";
282 }; 282 };
283 default_cfg { 283 default_cfg {
284 ste,pins = "GPIO14_F14", 284 pins = "GPIO14_F14",
285 "GPIO15_B17"; 285 "GPIO15_B17";
286 input-enable; 286 input-enable;
287 bias-pull-down; 287 bias-pull-down;
@@ -292,11 +292,11 @@
292 adi1 { 292 adi1 {
293 adi1_default_mode: adi1_default { 293 adi1_default_mode: adi1_default {
294 default_mux { 294 default_mux {
295 ste,function = "adi1"; 295 function = "adi1";
296 ste,pins = "adi1_d_1"; 296 groups = "adi1_d_1";
297 }; 297 };
298 default_cfg { 298 default_cfg {
299 ste,pins = "GPIO17_P5", 299 pins = "GPIO17_P5",
300 "GPIO18_R5", 300 "GPIO18_R5",
301 "GPIO19_U5", 301 "GPIO19_U5",
302 "GPIO20_T5"; 302 "GPIO20_T5";
@@ -309,11 +309,11 @@
309 usbuicc { 309 usbuicc {
310 usbuicc_default_mode: usbuicc_default { 310 usbuicc_default_mode: usbuicc_default {
311 default_mux { 311 default_mux {
312 ste,function = "usbuicc"; 312 function = "usbuicc";
313 ste,pins = "usbuicc_d_1"; 313 groups = "usbuicc_d_1";
314 }; 314 };
315 default_cfg { 315 default_cfg {
316 ste,pins = "GPIO21_H19", 316 pins = "GPIO21_H19",
317 "GPIO22_G20", 317 "GPIO22_G20",
318 "GPIO23_G19"; 318 "GPIO23_G19";
319 input-enable; 319 input-enable;
@@ -325,13 +325,13 @@
325 dmic { 325 dmic {
326 dmic_default_mode: dmic_default { 326 dmic_default_mode: dmic_default {
327 default_mux { 327 default_mux {
328 ste,function = "dmic"; 328 function = "dmic";
329 ste,pins = "dmic12_d_1", 329 groups = "dmic12_d_1",
330 "dmic34_d_1", 330 "dmic34_d_1",
331 "dmic56_d_1"; 331 "dmic56_d_1";
332 }; 332 };
333 default_cfg { 333 default_cfg {
334 ste,pins = "GPIO27_J6", 334 pins = "GPIO27_J6",
335 "GPIO28_K6", 335 "GPIO28_K6",
336 "GPIO29_G6", 336 "GPIO29_G6",
337 "GPIO30_H6", 337 "GPIO30_H6",
@@ -345,11 +345,11 @@
345 extcpena { 345 extcpena {
346 extcpena_default_mode: extcpena_default { 346 extcpena_default_mode: extcpena_default {
347 default_mux { 347 default_mux {
348 ste,function = "extcpena"; 348 function = "extcpena";
349 ste,pins = "extcpena_d_1"; 349 groups = "extcpena_d_1";
350 }; 350 };
351 default_cfg { 351 default_cfg {
352 ste,pins = "GPIO34_R17"; 352 pins = "GPIO34_R17";
353 input-enable; 353 input-enable;
354 bias-pull-down; 354 bias-pull-down;
355 }; 355 };
@@ -359,11 +359,11 @@
359 modsclsda { 359 modsclsda {
360 modsclsda_default_mode: modsclsda_default { 360 modsclsda_default_mode: modsclsda_default {
361 default_mux { 361 default_mux {
362 ste,function = "modsclsda"; 362 function = "modsclsda";
363 ste,pins = "modsclsda_d_1"; 363 groups = "modsclsda_d_1";
364 }; 364 };
365 default_cfg { 365 default_cfg {
366 ste,pins = "GPIO40_T19", 366 pins = "GPIO40_T19",
367 "GPIO41_U19"; 367 "GPIO41_U19";
368 input-enable; 368 input-enable;
369 bias-pull-down; 369 bias-pull-down;
@@ -376,22 +376,22 @@
376 sysclkreq2 { 376 sysclkreq2 {
377 sysclkreq2_default_mode: sysclkreq2_default { 377 sysclkreq2_default_mode: sysclkreq2_default {
378 default_mux { 378 default_mux {
379 ste,function = "sysclkreq"; 379 function = "sysclkreq";
380 ste,pins = "sysclkreq2_d_1"; 380 groups = "sysclkreq2_d_1";
381 }; 381 };
382 default_cfg { 382 default_cfg {
383 ste,pins = "GPIO1_T10"; 383 pins = "GPIO1_T10";
384 input-enable; 384 input-enable;
385 bias-disable; 385 bias-disable;
386 }; 386 };
387 }; 387 };
388 sysclkreq2_sleep_mode: sysclkreq2_sleep { 388 sysclkreq2_sleep_mode: sysclkreq2_sleep {
389 default_mux { 389 default_mux {
390 ste,function = "gpio"; 390 function = "gpio";
391 ste,pins = "gpio1_a_1"; 391 groups = "gpio1_a_1";
392 }; 392 };
393 default_cfg { 393 default_cfg {
394 ste,pins = "GPIO1_T10"; 394 pins = "GPIO1_T10";
395 input-enable; 395 input-enable;
396 bias-pull-down; 396 bias-pull-down;
397 }; 397 };
@@ -400,22 +400,22 @@
400 sysclkreq4 { 400 sysclkreq4 {
401 sysclkreq4_default_mode: sysclkreq4_default { 401 sysclkreq4_default_mode: sysclkreq4_default {
402 default_mux { 402 default_mux {
403 ste,function = "sysclkreq"; 403 function = "sysclkreq";
404 ste,pins = "sysclkreq4_d_1"; 404 groups = "sysclkreq4_d_1";
405 }; 405 };
406 default_cfg { 406 default_cfg {
407 ste,pins = "GPIO3_U9"; 407 pins = "GPIO3_U9";
408 input-enable; 408 input-enable;
409 bias-disable; 409 bias-disable;
410 }; 410 };
411 }; 411 };
412 sysclkreq4_sleep_mode: sysclkreq4_sleep { 412 sysclkreq4_sleep_mode: sysclkreq4_sleep {
413 default_mux { 413 default_mux {
414 ste,function = "gpio"; 414 function = "gpio";
415 ste,pins = "gpio3_a_1"; 415 groups = "gpio3_a_1";
416 }; 416 };
417 default_cfg { 417 default_cfg {
418 ste,pins = "GPIO3_U9"; 418 pins = "GPIO3_U9";
419 input-enable; 419 input-enable;
420 bias-pull-down; 420 bias-pull-down;
421 }; 421 };
diff --git a/arch/arm/boot/dts/ste-href-ab8505.dtsi b/arch/arm/boot/dts/ste-href-ab8505.dtsi
index 6006d62086a2..ccf37a9df050 100644
--- a/arch/arm/boot/dts/ste-href-ab8505.dtsi
+++ b/arch/arm/boot/dts/ste-href-ab8505.dtsi
@@ -35,11 +35,11 @@
35 gpio2 { 35 gpio2 {
36 gpio2_default_mode: gpio2_default { 36 gpio2_default_mode: gpio2_default {
37 default_mux { 37 default_mux {
38 ste,function = "gpio"; 38 function = "gpio";
39 ste,pins = "gpio2_a_1"; 39 groups = "gpio2_a_1";
40 }; 40 };
41 default_cfg { 41 default_cfg {
42 ste,pins = "GPIO2_R5"; 42 pins = "GPIO2_R5";
43 input-enable; 43 input-enable;
44 bias-pull-down; 44 bias-pull-down;
45 }; 45 };
@@ -48,11 +48,11 @@
48 gpio10 { 48 gpio10 {
49 gpio10_default_mode: gpio10_default { 49 gpio10_default_mode: gpio10_default {
50 default_mux { 50 default_mux {
51 ste,function = "gpio"; 51 function = "gpio";
52 ste,pins = "gpio10_d_1"; 52 groups = "gpio10_d_1";
53 }; 53 };
54 default_cfg { 54 default_cfg {
55 ste,pins = "GPIO10_B16"; 55 pins = "GPIO10_B16";
56 input-enable; 56 input-enable;
57 bias-pull-down; 57 bias-pull-down;
58 }; 58 };
@@ -61,11 +61,11 @@
61 gpio11 { 61 gpio11 {
62 gpio11_default_mode: gpio11_default { 62 gpio11_default_mode: gpio11_default {
63 default_mux { 63 default_mux {
64 ste,function = "gpio"; 64 function = "gpio";
65 ste,pins = "gpio11_d_1"; 65 groups = "gpio11_d_1";
66 }; 66 };
67 default_cfg { 67 default_cfg {
68 ste,pins = "GPIO11_B17"; 68 pins = "GPIO11_B17";
69 input-enable; 69 input-enable;
70 bias-pull-down; 70 bias-pull-down;
71 }; 71 };
@@ -74,11 +74,11 @@
74 gpio13 { 74 gpio13 {
75 gpio13_default_mode: gpio13_default { 75 gpio13_default_mode: gpio13_default {
76 default_mux { 76 default_mux {
77 ste,function = "gpio"; 77 function = "gpio";
78 ste,pins = "gpio13_d_1"; 78 groups = "gpio13_d_1";
79 }; 79 };
80 default_cfg { 80 default_cfg {
81 ste,pins = "GPIO13_D17"; 81 pins = "GPIO13_D17";
82 input-enable; 82 input-enable;
83 bias-disable; 83 bias-disable;
84 }; 84 };
@@ -87,11 +87,11 @@
87 gpio34 { 87 gpio34 {
88 gpio34_default_mode: gpio34_default { 88 gpio34_default_mode: gpio34_default {
89 default_mux { 89 default_mux {
90 ste,function = "gpio"; 90 function = "gpio";
91 ste,pins = "gpio34_a_1"; 91 groups = "gpio34_a_1";
92 }; 92 };
93 default_cfg { 93 default_cfg {
94 ste,pins = "GPIO34_H14"; 94 pins = "GPIO34_H14";
95 input-enable; 95 input-enable;
96 bias-pull-down; 96 bias-pull-down;
97 }; 97 };
@@ -100,11 +100,11 @@
100 gpio50 { 100 gpio50 {
101 gpio50_default_mode: gpio50_default { 101 gpio50_default_mode: gpio50_default {
102 default_mux { 102 default_mux {
103 ste,function = "gpio"; 103 function = "gpio";
104 ste,pins = "gpio50_d_1"; 104 groups = "gpio50_d_1";
105 }; 105 };
106 default_cfg { 106 default_cfg {
107 ste,pins = "GPIO50_L4"; 107 pins = "GPIO50_L4";
108 input-enable; 108 input-enable;
109 bias-disable; 109 bias-disable;
110 }; 110 };
@@ -114,11 +114,11 @@
114 pwm { 114 pwm {
115 pwm_default_mode: pwm_default { 115 pwm_default_mode: pwm_default {
116 default_mux { 116 default_mux {
117 ste,function = "pwmout"; 117 function = "pwmout";
118 ste,pins = "pwmout1_d_1"; 118 groups = "pwmout1_d_1";
119 }; 119 };
120 default_cfg { 120 default_cfg {
121 ste,pins = "GPIO14_C16"; 121 pins = "GPIO14_C16";
122 input-enable; 122 input-enable;
123 bias-pull-down; 123 bias-pull-down;
124 }; 124 };
@@ -128,11 +128,11 @@
128 adi2 { 128 adi2 {
129 adi2_default_mode: adi2_default { 129 adi2_default_mode: adi2_default {
130 default_mux { 130 default_mux {
131 ste,function = "adi2"; 131 function = "adi2";
132 ste,pins = "adi2_d_1"; 132 groups = "adi2_d_1";
133 }; 133 };
134 default_cfg { 134 default_cfg {
135 ste,pins = "GPIO17_P2", 135 pins = "GPIO17_P2",
136 "GPIO18_N3", 136 "GPIO18_N3",
137 "GPIO19_T1", 137 "GPIO19_T1",
138 "GPIO20_P3"; 138 "GPIO20_P3";
@@ -145,11 +145,11 @@
145 modsclsda { 145 modsclsda {
146 modsclsda_default_mode: modsclsda_default { 146 modsclsda_default_mode: modsclsda_default {
147 default_mux { 147 default_mux {
148 ste,function = "modsclsda"; 148 function = "modsclsda";
149 ste,pins = "modsclsda_d_1"; 149 groups = "modsclsda_d_1";
150 }; 150 };
151 default_cfg { 151 default_cfg {
152 ste,pins = "GPIO40_J15", 152 pins = "GPIO40_J15",
153 "GPIO41_J14"; 153 "GPIO41_J14";
154 input-enable; 154 input-enable;
155 bias-pull-down; 155 bias-pull-down;
@@ -159,11 +159,11 @@
159 resethw { 159 resethw {
160 resethw_default_mode: resethw_default { 160 resethw_default_mode: resethw_default {
161 default_mux { 161 default_mux {
162 ste,function = "resethw"; 162 function = "resethw";
163 ste,pins = "resethw_d_1"; 163 groups = "resethw_d_1";
164 }; 164 };
165 default_cfg { 165 default_cfg {
166 ste,pins = "GPIO52_D16"; 166 pins = "GPIO52_D16";
167 input-enable; 167 input-enable;
168 bias-pull-down; 168 bias-pull-down;
169 }; 169 };
@@ -172,11 +172,11 @@
172 service { 172 service {
173 service_default_mode: service_default { 173 service_default_mode: service_default {
174 default_mux { 174 default_mux {
175 ste,function = "service"; 175 function = "service";
176 ste,pins = "service_d_1"; 176 groups = "service_d_1";
177 }; 177 };
178 default_cfg { 178 default_cfg {
179 ste,pins = "GPIO53_D15"; 179 pins = "GPIO53_D15";
180 input-enable; 180 input-enable;
181 bias-pull-down; 181 bias-pull-down;
182 }; 182 };
@@ -188,22 +188,22 @@
188 sysclkreq2 { 188 sysclkreq2 {
189 sysclkreq2_default_mode: sysclkreq2_default { 189 sysclkreq2_default_mode: sysclkreq2_default {
190 default_mux { 190 default_mux {
191 ste,function = "sysclkreq"; 191 function = "sysclkreq";
192 ste,pins = "sysclkreq2_d_1"; 192 groups = "sysclkreq2_d_1";
193 }; 193 };
194 default_cfg { 194 default_cfg {
195 ste,pins = "GPIO1_N4"; 195 pins = "GPIO1_N4";
196 input-enable; 196 input-enable;
197 bias-disable; 197 bias-disable;
198 }; 198 };
199 }; 199 };
200 sysclkreq2_sleep_mode: sysclkreq2_sleep { 200 sysclkreq2_sleep_mode: sysclkreq2_sleep {
201 default_mux { 201 default_mux {
202 ste,function = "gpio"; 202 function = "gpio";
203 ste,pins = "gpio1_a_1"; 203 groups = "gpio1_a_1";
204 }; 204 };
205 default_cfg { 205 default_cfg {
206 ste,pins = "GPIO1_N4"; 206 pins = "GPIO1_N4";
207 input-enable; 207 input-enable;
208 bias-pull-down; 208 bias-pull-down;
209 }; 209 };
@@ -212,22 +212,22 @@
212 sysclkreq4 { 212 sysclkreq4 {
213 sysclkreq4_default_mode: sysclkreq4_default { 213 sysclkreq4_default_mode: sysclkreq4_default {
214 default_mux { 214 default_mux {
215 ste,function = "sysclkreq"; 215 function = "sysclkreq";
216 ste,pins = "sysclkreq4_d_1"; 216 groups = "sysclkreq4_d_1";
217 }; 217 };
218 default_cfg { 218 default_cfg {
219 ste,pins = "GPIO3_P5"; 219 pins = "GPIO3_P5";
220 input-enable; 220 input-enable;
221 bias-disable; 221 bias-disable;
222 }; 222 };
223 }; 223 };
224 sysclkreq4_sleep_mode: sysclkreq4_sleep { 224 sysclkreq4_sleep_mode: sysclkreq4_sleep {
225 default_mux { 225 default_mux {
226 ste,function = "gpio"; 226 function = "gpio";
227 ste,pins = "gpio3_a_1"; 227 groups = "gpio3_a_1";
228 }; 228 };
229 default_cfg { 229 default_cfg {
230 ste,pins = "GPIO3_P5"; 230 pins = "GPIO3_P5";
231 input-enable; 231 input-enable;
232 bias-pull-down; 232 bias-pull-down;
233 }; 233 };
diff --git a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
index addfcc7c2750..5c5cea232743 100644
--- a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
+++ b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
@@ -18,33 +18,33 @@
18 uart0 { 18 uart0 {
19 uart0_default_mode: uart0_default { 19 uart0_default_mode: uart0_default {
20 default_mux { 20 default_mux {
21 ste,function = "u0"; 21 function = "u0";
22 ste,pins = "u0_a_1"; 22 groups = "u0_a_1";
23 }; 23 };
24 default_cfg1 { 24 default_cfg1 {
25 ste,pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */ 25 pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */
26 ste,config = <&in_pu>; 26 ste,config = <&in_pu>;
27 }; 27 };
28 28
29 default_cfg2 { 29 default_cfg2 {
30 ste,pins = "GPIO1_AJ3", "GPIO3_AH3"; /* RTS+TXD */ 30 pins = "GPIO1_AJ3", "GPIO3_AH3"; /* RTS+TXD */
31 ste,config = <&out_hi>; 31 ste,config = <&out_hi>;
32 }; 32 };
33 }; 33 };
34 34
35 uart0_sleep_mode: uart0_sleep { 35 uart0_sleep_mode: uart0_sleep {
36 sleep_cfg1 { 36 sleep_cfg1 {
37 ste,pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */ 37 pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */
38 ste,config = <&slpm_in_wkup_pdis>; 38 ste,config = <&slpm_in_wkup_pdis>;
39 }; 39 };
40 40
41 sleep_cfg2 { 41 sleep_cfg2 {
42 ste,pins = "GPIO1_AJ3"; /* RTS */ 42 pins = "GPIO1_AJ3"; /* RTS */
43 ste,config = <&slpm_out_hi_wkup_pdis>; 43 ste,config = <&slpm_out_hi_wkup_pdis>;
44 }; 44 };
45 45
46 sleep_cfg3 { 46 sleep_cfg3 {
47 ste,pins = "GPIO3_AH3"; /* TXD */ 47 pins = "GPIO3_AH3"; /* TXD */
48 ste,config = <&slpm_out_wkup_pdis>; 48 ste,config = <&slpm_out_wkup_pdis>;
49 }; 49 };
50 }; 50 };
@@ -53,28 +53,28 @@
53 uart1 { 53 uart1 {
54 uart1_default_mode: uart1_default { 54 uart1_default_mode: uart1_default {
55 default_mux { 55 default_mux {
56 ste,function = "u1"; 56 function = "u1";
57 ste,pins = "u1rxtx_a_1"; 57 groups = "u1rxtx_a_1";
58 }; 58 };
59 default_cfg1 { 59 default_cfg1 {
60 ste,pins = "GPIO4_AH6"; /* RXD */ 60 pins = "GPIO4_AH6"; /* RXD */
61 ste,config = <&in_pu>; 61 ste,config = <&in_pu>;
62 }; 62 };
63 63
64 default_cfg2 { 64 default_cfg2 {
65 ste,pins = "GPIO5_AG6"; /* TXD */ 65 pins = "GPIO5_AG6"; /* TXD */
66 ste,config = <&out_hi>; 66 ste,config = <&out_hi>;
67 }; 67 };
68 }; 68 };
69 69
70 uart1_sleep_mode: uart1_sleep { 70 uart1_sleep_mode: uart1_sleep {
71 sleep_cfg1 { 71 sleep_cfg1 {
72 ste,pins = "GPIO4_AH6"; /* RXD */ 72 pins = "GPIO4_AH6"; /* RXD */
73 ste,config = <&slpm_in_wkup_pdis>; 73 ste,config = <&slpm_in_wkup_pdis>;
74 }; 74 };
75 75
76 sleep_cfg2 { 76 sleep_cfg2 {
77 ste,pins = "GPIO5_AG6"; /* TXD */ 77 pins = "GPIO5_AG6"; /* TXD */
78 ste,config = <&slpm_out_wkup_pdis>; 78 ste,config = <&slpm_out_wkup_pdis>;
79 }; 79 };
80 }; 80 };
@@ -83,28 +83,28 @@
83 uart2 { 83 uart2 {
84 uart2_default_mode: uart2_default { 84 uart2_default_mode: uart2_default {
85 default_mux { 85 default_mux {
86 ste,function = "u2"; 86 function = "u2";
87 ste,pins = "u2rxtx_c_1"; 87 groups = "u2rxtx_c_1";
88 }; 88 };
89 default_cfg1 { 89 default_cfg1 {
90 ste,pins = "GPIO29_W2"; /* RXD */ 90 pins = "GPIO29_W2"; /* RXD */
91 ste,config = <&in_pu>; 91 ste,config = <&in_pu>;
92 }; 92 };
93 93
94 default_cfg2 { 94 default_cfg2 {
95 ste,pins = "GPIO30_W3"; /* TXD */ 95 pins = "GPIO30_W3"; /* TXD */
96 ste,config = <&out_hi>; 96 ste,config = <&out_hi>;
97 }; 97 };
98 }; 98 };
99 99
100 uart2_sleep_mode: uart2_sleep { 100 uart2_sleep_mode: uart2_sleep {
101 sleep_cfg1 { 101 sleep_cfg1 {
102 ste,pins = "GPIO29_W2"; /* RXD */ 102 pins = "GPIO29_W2"; /* RXD */
103 ste,config = <&in_wkup_pdis>; 103 ste,config = <&in_wkup_pdis>;
104 }; 104 };
105 105
106 sleep_cfg2 { 106 sleep_cfg2 {
107 ste,pins = "GPIO30_W3"; /* TXD */ 107 pins = "GPIO30_W3"; /* TXD */
108 ste,config = <&out_wkup_pdis>; 108 ste,config = <&out_wkup_pdis>;
109 }; 109 };
110 }; 110 };
@@ -114,18 +114,18 @@
114 i2c0 { 114 i2c0 {
115 i2c0_default_mode: i2c_default { 115 i2c0_default_mode: i2c_default {
116 default_mux { 116 default_mux {
117 ste,function = "i2c0"; 117 function = "i2c0";
118 ste,pins = "i2c0_a_1"; 118 groups = "i2c0_a_1";
119 }; 119 };
120 default_cfg1 { 120 default_cfg1 {
121 ste,pins = "GPIO147_C15", "GPIO148_B16"; /* SDA/SCL */ 121 pins = "GPIO147_C15", "GPIO148_B16"; /* SDA/SCL */
122 ste,config = <&in_pu>; 122 ste,config = <&in_pu>;
123 }; 123 };
124 }; 124 };
125 125
126 i2c0_sleep_mode: i2c_sleep { 126 i2c0_sleep_mode: i2c_sleep {
127 sleep_cfg1 { 127 sleep_cfg1 {
128 ste,pins = "GPIO147_C15", "GPIO148_B16"; /* SDA/SCL */ 128 pins = "GPIO147_C15", "GPIO148_B16"; /* SDA/SCL */
129 ste,config = <&slpm_in_wkup_pdis>; 129 ste,config = <&slpm_in_wkup_pdis>;
130 }; 130 };
131 }; 131 };
@@ -134,18 +134,18 @@
134 i2c1 { 134 i2c1 {
135 i2c1_default_mode: i2c_default { 135 i2c1_default_mode: i2c_default {
136 default_mux { 136 default_mux {
137 ste,function = "i2c1"; 137 function = "i2c1";
138 ste,pins = "i2c1_b_2"; 138 groups = "i2c1_b_2";
139 }; 139 };
140 default_cfg1 { 140 default_cfg1 {
141 ste,pins = "GPIO16_AD3", "GPIO17_AD4"; /* SDA/SCL */ 141 pins = "GPIO16_AD3", "GPIO17_AD4"; /* SDA/SCL */
142 ste,config = <&in_pu>; 142 ste,config = <&in_pu>;
143 }; 143 };
144 }; 144 };
145 145
146 i2c1_sleep_mode: i2c_sleep { 146 i2c1_sleep_mode: i2c_sleep {
147 sleep_cfg1 { 147 sleep_cfg1 {
148 ste,pins = "GPIO16_AD3", "GPIO17_AD4"; /* SDA/SCL */ 148 pins = "GPIO16_AD3", "GPIO17_AD4"; /* SDA/SCL */
149 ste,config = <&slpm_in_wkup_pdis>; 149 ste,config = <&slpm_in_wkup_pdis>;
150 }; 150 };
151 }; 151 };
@@ -154,18 +154,18 @@
154 i2c2 { 154 i2c2 {
155 i2c2_default_mode: i2c_default { 155 i2c2_default_mode: i2c_default {
156 default_mux { 156 default_mux {
157 ste,function = "i2c2"; 157 function = "i2c2";
158 ste,pins = "i2c2_b_2"; 158 groups = "i2c2_b_2";
159 }; 159 };
160 default_cfg1 { 160 default_cfg1 {
161 ste,pins = "GPIO10_AF5", "GPIO11_AG4"; /* SDA/SCL */ 161 pins = "GPIO10_AF5", "GPIO11_AG4"; /* SDA/SCL */
162 ste,config = <&in_pu>; 162 ste,config = <&in_pu>;
163 }; 163 };
164 }; 164 };
165 165
166 i2c2_sleep_mode: i2c_sleep { 166 i2c2_sleep_mode: i2c_sleep {
167 sleep_cfg1 { 167 sleep_cfg1 {
168 ste,pins = "GPIO10_AF5", "GPIO11_AG4"; /* SDA/SCL */ 168 pins = "GPIO10_AF5", "GPIO11_AG4"; /* SDA/SCL */
169 ste,config = <&slpm_in_wkup_pdis>; 169 ste,config = <&slpm_in_wkup_pdis>;
170 }; 170 };
171 }; 171 };
@@ -174,18 +174,18 @@
174 i2c3 { 174 i2c3 {
175 i2c3_default_mode: i2c_default { 175 i2c3_default_mode: i2c_default {
176 default_mux { 176 default_mux {
177 ste,function = "i2c3"; 177 function = "i2c3";
178 ste,pins = "i2c3_c_2"; 178 groups = "i2c3_c_2";
179 }; 179 };
180 default_cfg1 { 180 default_cfg1 {
181 ste,pins = "GPIO229_AG7", "GPIO230_AF7"; /* SDA/SCL */ 181 pins = "GPIO229_AG7", "GPIO230_AF7"; /* SDA/SCL */
182 ste,config = <&in_pu>; 182 ste,config = <&in_pu>;
183 }; 183 };
184 }; 184 };
185 185
186 i2c3_sleep_mode: i2c_sleep { 186 i2c3_sleep_mode: i2c_sleep {
187 sleep_cfg1 { 187 sleep_cfg1 {
188 ste,pins = "GPIO229_AG7", "GPIO230_AF7"; /* SDA/SCL */ 188 pins = "GPIO229_AG7", "GPIO230_AF7"; /* SDA/SCL */
189 ste,config = <&slpm_in_wkup_pdis>; 189 ste,config = <&slpm_in_wkup_pdis>;
190 }; 190 };
191 }; 191 };
@@ -198,18 +198,18 @@
198 i2c4 { 198 i2c4 {
199 i2c4_default_mode: i2c_default { 199 i2c4_default_mode: i2c_default {
200 default_mux { 200 default_mux {
201 ste,function = "i2c4"; 201 function = "i2c4";
202 ste,pins = "i2c4_b_1"; 202 groups = "i2c4_b_1";
203 }; 203 };
204 default_cfg1 { 204 default_cfg1 {
205 ste,pins = "GPIO4_AH6", "GPIO5_AG6"; /* SDA/SCL */ 205 pins = "GPIO4_AH6", "GPIO5_AG6"; /* SDA/SCL */
206 ste,config = <&in_pu>; 206 ste,config = <&in_pu>;
207 }; 207 };
208 }; 208 };
209 209
210 i2c4_sleep_mode: i2c_sleep { 210 i2c4_sleep_mode: i2c_sleep {
211 sleep_cfg1 { 211 sleep_cfg1 {
212 ste,pins = "GPIO4_AH6", "GPIO5_AG6"; /* SDA/SCL */ 212 pins = "GPIO4_AH6", "GPIO5_AG6"; /* SDA/SCL */
213 ste,config = <&slpm_in_wkup_pdis>; 213 ste,config = <&slpm_in_wkup_pdis>;
214 }; 214 };
215 }; 215 };
@@ -219,19 +219,19 @@
219 spi2 { 219 spi2 {
220 spi2_default_mode: spi_default { 220 spi2_default_mode: spi_default {
221 default_mux { 221 default_mux {
222 ste,function = "spi2"; 222 function = "spi2";
223 ste,pins = "spi2_oc1_2"; 223 groups = "spi2_oc1_2";
224 }; 224 };
225 default_cfg1 { 225 default_cfg1 {
226 ste,pins = "GPIO216_AG12"; /* FRM */ 226 pins = "GPIO216_AG12"; /* FRM */
227 ste,config = <&gpio_out_hi>; 227 ste,config = <&gpio_out_hi>;
228 }; 228 };
229 default_cfg2 { 229 default_cfg2 {
230 ste,pins = "GPIO218_AH11"; /* RXD */ 230 pins = "GPIO218_AH11"; /* RXD */
231 ste,config = <&in_pd>; 231 ste,config = <&in_pd>;
232 }; 232 };
233 default_cfg3 { 233 default_cfg3 {
234 ste,pins = 234 pins =
235 "GPIO215_AH13", /* TXD */ 235 "GPIO215_AH13", /* TXD */
236 "GPIO217_AH12"; /* CLK */ 236 "GPIO217_AH12"; /* CLK */
237 ste,config = <&out_lo>; 237 ste,config = <&out_lo>;
@@ -245,32 +245,32 @@
245 * as we do not state any muxing. 245 * as we do not state any muxing.
246 */ 246 */
247 idle_cfg1 { 247 idle_cfg1 {
248 ste,pins = "GPIO218_AH11"; /* RXD */ 248 pins = "GPIO218_AH11"; /* RXD */
249 ste,config = <&slpm_in_pdis>; 249 ste,config = <&slpm_in_pdis>;
250 }; 250 };
251 idle_cfg2 { 251 idle_cfg2 {
252 ste,pins = "GPIO215_AH13"; /* TXD */ 252 pins = "GPIO215_AH13"; /* TXD */
253 ste,config = <&slpm_out_lo_pdis>; 253 ste,config = <&slpm_out_lo_pdis>;
254 }; 254 };
255 idle_cfg3 { 255 idle_cfg3 {
256 ste,pins = "GPIO217_AH12"; /* CLK */ 256 pins = "GPIO217_AH12"; /* CLK */
257 ste,config = <&slpm_pdis>; 257 ste,config = <&slpm_pdis>;
258 }; 258 };
259 }; 259 };
260 260
261 spi2_sleep_mode: spi_sleep { 261 spi2_sleep_mode: spi_sleep {
262 sleep_cfg1 { 262 sleep_cfg1 {
263 ste,pins = 263 pins =
264 "GPIO216_AG12", /* FRM */ 264 "GPIO216_AG12", /* FRM */
265 "GPIO218_AH11"; /* RXD */ 265 "GPIO218_AH11"; /* RXD */
266 ste,config = <&slpm_in_wkup_pdis>; 266 ste,config = <&slpm_in_wkup_pdis>;
267 }; 267 };
268 sleep_cfg2 { 268 sleep_cfg2 {
269 ste,pins = "GPIO215_AH13"; /* TXD */ 269 pins = "GPIO215_AH13"; /* TXD */
270 ste,config = <&slpm_out_lo_wkup_pdis>; 270 ste,config = <&slpm_out_lo_wkup_pdis>;
271 }; 271 };
272 sleep_cfg3 { 272 sleep_cfg3 {
273 ste,pins = "GPIO217_AH12"; /* CLK */ 273 pins = "GPIO217_AH12"; /* CLK */
274 ste,config = <&slpm_wkup_pdis>; 274 ste,config = <&slpm_wkup_pdis>;
275 }; 275 };
276 }; 276 };
@@ -281,26 +281,26 @@
281 /* This is the external SD card slot, 4 bits wide */ 281 /* This is the external SD card slot, 4 bits wide */
282 sdi0_default_mode: sdi0_default { 282 sdi0_default_mode: sdi0_default {
283 default_mux { 283 default_mux {
284 ste,function = "mc0"; 284 function = "mc0";
285 ste,pins = "mc0_a_1"; 285 groups = "mc0_a_1";
286 }; 286 };
287 default_cfg1 { 287 default_cfg1 {
288 ste,pins = 288 pins =
289 "GPIO18_AC2", /* CMDDIR */ 289 "GPIO18_AC2", /* CMDDIR */
290 "GPIO19_AC1", /* DAT0DIR */ 290 "GPIO19_AC1", /* DAT0DIR */
291 "GPIO20_AB4"; /* DAT2DIR */ 291 "GPIO20_AB4"; /* DAT2DIR */
292 ste,config = <&out_hi>; 292 ste,config = <&out_hi>;
293 }; 293 };
294 default_cfg2 { 294 default_cfg2 {
295 ste,pins = "GPIO22_AA3"; /* FBCLK */ 295 pins = "GPIO22_AA3"; /* FBCLK */
296 ste,config = <&in_nopull>; 296 ste,config = <&in_nopull>;
297 }; 297 };
298 default_cfg3 { 298 default_cfg3 {
299 ste,pins = "GPIO23_AA4"; /* CLK */ 299 pins = "GPIO23_AA4"; /* CLK */
300 ste,config = <&out_lo>; 300 ste,config = <&out_lo>;
301 }; 301 };
302 default_cfg4 { 302 default_cfg4 {
303 ste,pins = 303 pins =
304 "GPIO24_AB2", /* CMD */ 304 "GPIO24_AB2", /* CMD */
305 "GPIO25_Y4", /* DAT0 */ 305 "GPIO25_Y4", /* DAT0 */
306 "GPIO26_Y2", /* DAT1 */ 306 "GPIO26_Y2", /* DAT1 */
@@ -312,14 +312,14 @@
312 312
313 sdi0_sleep_mode: sdi0_sleep { 313 sdi0_sleep_mode: sdi0_sleep {
314 sleep_cfg1 { 314 sleep_cfg1 {
315 ste,pins = 315 pins =
316 "GPIO18_AC2", /* CMDDIR */ 316 "GPIO18_AC2", /* CMDDIR */
317 "GPIO19_AC1", /* DAT0DIR */ 317 "GPIO19_AC1", /* DAT0DIR */
318 "GPIO20_AB4"; /* DAT2DIR */ 318 "GPIO20_AB4"; /* DAT2DIR */
319 ste,config = <&slpm_out_hi_wkup_pdis>; 319 ste,config = <&slpm_out_hi_wkup_pdis>;
320 }; 320 };
321 sleep_cfg2 { 321 sleep_cfg2 {
322 ste,pins = 322 pins =
323 "GPIO22_AA3", /* FBCLK */ 323 "GPIO22_AA3", /* FBCLK */
324 "GPIO24_AB2", /* CMD */ 324 "GPIO24_AB2", /* CMD */
325 "GPIO25_Y4", /* DAT0 */ 325 "GPIO25_Y4", /* DAT0 */
@@ -329,7 +329,7 @@
329 ste,config = <&slpm_in_wkup_pdis>; 329 ste,config = <&slpm_in_wkup_pdis>;
330 }; 330 };
331 sleep_cfg3 { 331 sleep_cfg3 {
332 ste,pins = "GPIO23_AA4"; /* CLK */ 332 pins = "GPIO23_AA4"; /* CLK */
333 ste,config = <&slpm_out_lo_wkup_pdis>; 333 ste,config = <&slpm_out_lo_wkup_pdis>;
334 }; 334 };
335 }; 335 };
@@ -339,19 +339,19 @@
339 /* This is the WLAN SDIO 4 bits wide */ 339 /* This is the WLAN SDIO 4 bits wide */
340 sdi1_default_mode: sdi1_default { 340 sdi1_default_mode: sdi1_default {
341 default_mux { 341 default_mux {
342 ste,function = "mc1"; 342 function = "mc1";
343 ste,pins = "mc1_a_1"; 343 groups = "mc1_a_1";
344 }; 344 };
345 default_cfg1 { 345 default_cfg1 {
346 ste,pins = "GPIO208_AH16"; /* CLK */ 346 pins = "GPIO208_AH16"; /* CLK */
347 ste,config = <&out_lo>; 347 ste,config = <&out_lo>;
348 }; 348 };
349 default_cfg2 { 349 default_cfg2 {
350 ste,pins = "GPIO209_AG15"; /* FBCLK */ 350 pins = "GPIO209_AG15"; /* FBCLK */
351 ste,config = <&in_nopull>; 351 ste,config = <&in_nopull>;
352 }; 352 };
353 default_cfg3 { 353 default_cfg3 {
354 ste,pins = 354 pins =
355 "GPIO210_AJ15", /* CMD */ 355 "GPIO210_AJ15", /* CMD */
356 "GPIO211_AG14", /* DAT0 */ 356 "GPIO211_AG14", /* DAT0 */
357 "GPIO212_AF13", /* DAT1 */ 357 "GPIO212_AF13", /* DAT1 */
@@ -363,11 +363,11 @@
363 363
364 sdi1_sleep_mode: sdi1_sleep { 364 sdi1_sleep_mode: sdi1_sleep {
365 sleep_cfg1 { 365 sleep_cfg1 {
366 ste,pins = "GPIO208_AH16"; /* CLK */ 366 pins = "GPIO208_AH16"; /* CLK */
367 ste,config = <&slpm_out_lo_wkup_pdis>; 367 ste,config = <&slpm_out_lo_wkup_pdis>;
368 }; 368 };
369 sleep_cfg2 { 369 sleep_cfg2 {
370 ste,pins = 370 pins =
371 "GPIO209_AG15", /* FBCLK */ 371 "GPIO209_AG15", /* FBCLK */
372 "GPIO210_AJ15", /* CMD */ 372 "GPIO210_AJ15", /* CMD */
373 "GPIO211_AG14", /* DAT0 */ 373 "GPIO211_AG14", /* DAT0 */
@@ -383,19 +383,19 @@
383 /* This is the eMMC 8 bits wide, usually PoP eMMC */ 383 /* This is the eMMC 8 bits wide, usually PoP eMMC */
384 sdi2_default_mode: sdi2_default { 384 sdi2_default_mode: sdi2_default {
385 default_mux { 385 default_mux {
386 ste,function = "mc2"; 386 function = "mc2";
387 ste,pins = "mc2_a_1"; 387 groups = "mc2_a_1";
388 }; 388 };
389 default_cfg1 { 389 default_cfg1 {
390 ste,pins = "GPIO128_A5"; /* CLK */ 390 pins = "GPIO128_A5"; /* CLK */
391 ste,config = <&out_lo>; 391 ste,config = <&out_lo>;
392 }; 392 };
393 default_cfg2 { 393 default_cfg2 {
394 ste,pins = "GPIO130_C8"; /* FBCLK */ 394 pins = "GPIO130_C8"; /* FBCLK */
395 ste,config = <&in_nopull>; 395 ste,config = <&in_nopull>;
396 }; 396 };
397 default_cfg3 { 397 default_cfg3 {
398 ste,pins = 398 pins =
399 "GPIO129_B4", /* CMD */ 399 "GPIO129_B4", /* CMD */
400 "GPIO131_A12", /* DAT0 */ 400 "GPIO131_A12", /* DAT0 */
401 "GPIO132_C10", /* DAT1 */ 401 "GPIO132_C10", /* DAT1 */
@@ -411,17 +411,17 @@
411 411
412 sdi2_sleep_mode: sdi2_sleep { 412 sdi2_sleep_mode: sdi2_sleep {
413 sleep_cfg1 { 413 sleep_cfg1 {
414 ste,pins = "GPIO128_A5"; /* CLK */ 414 pins = "GPIO128_A5"; /* CLK */
415 ste,config = <&out_lo_wkup_pdis>; 415 ste,config = <&out_lo_wkup_pdis>;
416 }; 416 };
417 sleep_cfg2 { 417 sleep_cfg2 {
418 ste,pins = 418 pins =
419 "GPIO130_C8", /* FBCLK */ 419 "GPIO130_C8", /* FBCLK */
420 "GPIO129_B4"; /* CMD */ 420 "GPIO129_B4"; /* CMD */
421 ste,config = <&in_wkup_pdis_en>; 421 ste,config = <&in_wkup_pdis_en>;
422 }; 422 };
423 sleep_cfg3 { 423 sleep_cfg3 {
424 ste,pins = 424 pins =
425 "GPIO131_A12", /* DAT0 */ 425 "GPIO131_A12", /* DAT0 */
426 "GPIO132_C10", /* DAT1 */ 426 "GPIO132_C10", /* DAT1 */
427 "GPIO133_B10", /* DAT2 */ 427 "GPIO133_B10", /* DAT2 */
@@ -439,19 +439,19 @@
439 /* This is the eMMC 8 bits wide, usually PCB-mounted eMMC */ 439 /* This is the eMMC 8 bits wide, usually PCB-mounted eMMC */
440 sdi4_default_mode: sdi4_default { 440 sdi4_default_mode: sdi4_default {
441 default_mux { 441 default_mux {
442 ste,function = "mc4"; 442 function = "mc4";
443 ste,pins = "mc4_a_1"; 443 groups = "mc4_a_1";
444 }; 444 };
445 default_cfg1 { 445 default_cfg1 {
446 ste,pins = "GPIO203_AE23"; /* CLK */ 446 pins = "GPIO203_AE23"; /* CLK */
447 ste,config = <&out_lo>; 447 ste,config = <&out_lo>;
448 }; 448 };
449 default_cfg2 { 449 default_cfg2 {
450 ste,pins = "GPIO202_AF25"; /* FBCLK */ 450 pins = "GPIO202_AF25"; /* FBCLK */
451 ste,config = <&in_nopull>; 451 ste,config = <&in_nopull>;
452 }; 452 };
453 default_cfg3 { 453 default_cfg3 {
454 ste,pins = 454 pins =
455 "GPIO201_AF24", /* CMD */ 455 "GPIO201_AF24", /* CMD */
456 "GPIO200_AH26", /* DAT0 */ 456 "GPIO200_AH26", /* DAT0 */
457 "GPIO199_AH23", /* DAT1 */ 457 "GPIO199_AH23", /* DAT1 */
@@ -467,11 +467,11 @@
467 467
468 sdi4_sleep_mode: sdi4_sleep { 468 sdi4_sleep_mode: sdi4_sleep {
469 sleep_cfg1 { 469 sleep_cfg1 {
470 ste,pins = "GPIO203_AE23"; /* CLK */ 470 pins = "GPIO203_AE23"; /* CLK */
471 ste,config = <&out_lo_wkup_pdis>; 471 ste,config = <&out_lo_wkup_pdis>;
472 }; 472 };
473 sleep_cfg2 { 473 sleep_cfg2 {
474 ste,pins = 474 pins =
475 "GPIO202_AF25", /* FBCLK */ 475 "GPIO202_AF25", /* FBCLK */
476 "GPIO201_AF24", /* CMD */ 476 "GPIO201_AF24", /* CMD */
477 "GPIO200_AH26", /* DAT0 */ 477 "GPIO200_AH26", /* DAT0 */
@@ -494,11 +494,11 @@
494 msp0 { 494 msp0 {
495 msp0_default_mode: msp0_default { 495 msp0_default_mode: msp0_default {
496 default_msp0_mux { 496 default_msp0_mux {
497 ste,function = "msp0"; 497 function = "msp0";
498 ste,pins = "msp0txrx_a_1", "msp0tfstck_a_1"; 498 groups = "msp0txrx_a_1", "msp0tfstck_a_1";
499 }; 499 };
500 default_msp0_cfg { 500 default_msp0_cfg {
501 ste,pins = 501 pins =
502 "GPIO12_AC4", /* TXD */ 502 "GPIO12_AC4", /* TXD */
503 "GPIO15_AC3", /* RXD */ 503 "GPIO15_AC3", /* RXD */
504 "GPIO13_AF3", /* TFS */ 504 "GPIO13_AF3", /* TFS */
@@ -511,15 +511,15 @@
511 msp1 { 511 msp1 {
512 msp1_default_mode: msp1_default { 512 msp1_default_mode: msp1_default {
513 default_mux { 513 default_mux {
514 ste,function = "msp1"; 514 function = "msp1";
515 ste,pins = "msp1txrx_a_1", "msp1_a_1"; 515 groups = "msp1txrx_a_1", "msp1_a_1";
516 }; 516 };
517 default_cfg1 { 517 default_cfg1 {
518 ste,pins = "GPIO33_AF2"; 518 pins = "GPIO33_AF2";
519 ste,config = <&out_lo>; 519 ste,config = <&out_lo>;
520 }; 520 };
521 default_cfg2 { 521 default_cfg2 {
522 ste,pins = 522 pins =
523 "GPIO34_AE1", 523 "GPIO34_AE1",
524 "GPIO35_AE2", 524 "GPIO35_AE2",
525 "GPIO36_AG2"; 525 "GPIO36_AG2";
@@ -533,18 +533,18 @@
533 msp2_default_mode: msp2_default { 533 msp2_default_mode: msp2_default {
534 /* MSP2 usually used for HDMI audio */ 534 /* MSP2 usually used for HDMI audio */
535 default_mux { 535 default_mux {
536 ste,function = "msp2"; 536 function = "msp2";
537 ste,pins = "msp2_a_1"; 537 groups = "msp2_a_1";
538 }; 538 };
539 default_cfg1 { 539 default_cfg1 {
540 ste,pins = 540 pins =
541 "GPIO193_AH27", /* TXD */ 541 "GPIO193_AH27", /* TXD */
542 "GPIO194_AF27", /* TCK */ 542 "GPIO194_AF27", /* TCK */
543 "GPIO195_AG28"; /* TFS */ 543 "GPIO195_AG28"; /* TFS */
544 ste,config = <&in_pd>; 544 ste,config = <&in_pd>;
545 }; 545 };
546 default_cfg2 { 546 default_cfg2 {
547 ste,pins = "GPIO196_AG26"; /* RXD */ 547 pins = "GPIO196_AG26"; /* RXD */
548 ste,config = <&out_lo>; 548 ste,config = <&out_lo>;
549 }; 549 };
550 }; 550 };
@@ -554,11 +554,11 @@
554 musb { 554 musb {
555 musb_default_mode: musb_default { 555 musb_default_mode: musb_default {
556 default_mux { 556 default_mux {
557 ste,function = "usb"; 557 function = "usb";
558 ste,pins = "usb_a_1"; 558 groups = "usb_a_1";
559 }; 559 };
560 default_cfg1 { 560 default_cfg1 {
561 ste,pins = 561 pins =
562 "GPIO256_AF28", /* NXT */ 562 "GPIO256_AF28", /* NXT */
563 "GPIO258_AD29", /* XCLK */ 563 "GPIO258_AD29", /* XCLK */
564 "GPIO259_AC29", /* DIR */ 564 "GPIO259_AC29", /* DIR */
@@ -573,25 +573,25 @@
573 ste,config = <&in_nopull>; 573 ste,config = <&in_nopull>;
574 }; 574 };
575 default_cfg2 { 575 default_cfg2 {
576 ste,pins = "GPIO257_AE29"; /* STP */ 576 pins = "GPIO257_AE29"; /* STP */
577 ste,config = <&out_hi>; 577 ste,config = <&out_hi>;
578 }; 578 };
579 }; 579 };
580 580
581 musb_sleep_mode: musb_sleep { 581 musb_sleep_mode: musb_sleep {
582 sleep_cfg1 { 582 sleep_cfg1 {
583 ste,pins = 583 pins =
584 "GPIO256_AF28", /* NXT */ 584 "GPIO256_AF28", /* NXT */
585 "GPIO258_AD29", /* XCLK */ 585 "GPIO258_AD29", /* XCLK */
586 "GPIO259_AC29"; /* DIR */ 586 "GPIO259_AC29"; /* DIR */
587 ste,config = <&slpm_wkup_pdis_en>; 587 ste,config = <&slpm_wkup_pdis_en>;
588 }; 588 };
589 sleep_cfg2 { 589 sleep_cfg2 {
590 ste,pins = "GPIO257_AE29"; /* STP */ 590 pins = "GPIO257_AE29"; /* STP */
591 ste,config = <&slpm_out_hi_wkup_pdis>; 591 ste,config = <&slpm_out_hi_wkup_pdis>;
592 }; 592 };
593 sleep_cfg3 { 593 sleep_cfg3 {
594 ste,pins = 594 pins =
595 "GPIO260_AD28", /* DAT7 */ 595 "GPIO260_AD28", /* DAT7 */
596 "GPIO261_AD26", /* DAT6 */ 596 "GPIO261_AD26", /* DAT6 */
597 "GPIO262_AE26", /* DAT5 */ 597 "GPIO262_AE26", /* DAT5 */
@@ -609,8 +609,8 @@
609 lcd_default_mode: lcd_default { 609 lcd_default_mode: lcd_default {
610 default_mux { 610 default_mux {
611 /* Mux in VSI0 and all the data lines */ 611 /* Mux in VSI0 and all the data lines */
612 ste,function = "lcd"; 612 function = "lcd";
613 ste,pins = 613 groups =
614 "lcdvsi0_a_1", /* VSI0 for LCD */ 614 "lcdvsi0_a_1", /* VSI0 for LCD */
615 "lcd_d0_d7_a_1", /* Data lines */ 615 "lcd_d0_d7_a_1", /* Data lines */
616 "lcd_d8_d11_a_1", /* TV-out */ 616 "lcd_d8_d11_a_1", /* TV-out */
@@ -618,7 +618,7 @@
618 "lcdvsi1_a_1"; /* VSI1 for HDMI */ 618 "lcdvsi1_a_1"; /* VSI1 for HDMI */
619 }; 619 };
620 default_cfg1 { 620 default_cfg1 {
621 ste,pins = 621 pins =
622 "GPIO68_E1", /* VSI0 */ 622 "GPIO68_E1", /* VSI0 */
623 "GPIO69_E2"; /* VSI1 */ 623 "GPIO69_E2"; /* VSI1 */
624 ste,config = <&in_pu>; 624 ste,config = <&in_pu>;
@@ -626,7 +626,7 @@
626 }; 626 };
627 lcd_sleep_mode: lcd_sleep { 627 lcd_sleep_mode: lcd_sleep {
628 sleep_cfg1 { 628 sleep_cfg1 {
629 ste,pins = "GPIO69_E2"; /* VSI1 */ 629 pins = "GPIO69_E2"; /* VSI1 */
630 ste,config = <&slpm_in_wkup_pdis>; 630 ste,config = <&slpm_in_wkup_pdis>;
631 }; 631 };
632 }; 632 };
@@ -636,11 +636,11 @@
636 /* SKE keys on position 2 in an 8x8 matrix */ 636 /* SKE keys on position 2 in an 8x8 matrix */
637 ske_kpa2_default_mode: ske_kpa2_default { 637 ske_kpa2_default_mode: ske_kpa2_default {
638 default_mux { 638 default_mux {
639 ste,function = "kp"; 639 function = "kp";
640 ste,pins = "kp_a_2"; 640 groups = "kp_a_2";
641 }; 641 };
642 default_cfg1 { 642 default_cfg1 {
643 ste,pins = 643 pins =
644 "GPIO153_B17", /* I7 */ 644 "GPIO153_B17", /* I7 */
645 "GPIO154_C16", /* I6 */ 645 "GPIO154_C16", /* I6 */
646 "GPIO155_C19", /* I5 */ 646 "GPIO155_C19", /* I5 */
@@ -652,7 +652,7 @@
652 ste,config = <&in_pd>; 652 ste,config = <&in_pd>;
653 }; 653 };
654 default_cfg2 { 654 default_cfg2 {
655 ste,pins = 655 pins =
656 "GPIO157_A18", /* O7 */ 656 "GPIO157_A18", /* O7 */
657 "GPIO158_C18", /* O6 */ 657 "GPIO158_C18", /* O6 */
658 "GPIO159_B19", /* O5 */ 658 "GPIO159_B19", /* O5 */
@@ -666,7 +666,7 @@
666 }; 666 };
667 ske_kpa2_sleep_mode: ske_kpa2_sleep { 667 ske_kpa2_sleep_mode: ske_kpa2_sleep {
668 sleep_cfg1 { 668 sleep_cfg1 {
669 ste,pins = 669 pins =
670 "GPIO153_B17", /* I7 */ 670 "GPIO153_B17", /* I7 */
671 "GPIO154_C16", /* I6 */ 671 "GPIO154_C16", /* I6 */
672 "GPIO155_C19", /* I5 */ 672 "GPIO155_C19", /* I5 */
@@ -678,7 +678,7 @@
678 ste,config = <&slpm_in_pu_wkup_pdis_en>; 678 ste,config = <&slpm_in_pu_wkup_pdis_en>;
679 }; 679 };
680 sleep_cfg2 { 680 sleep_cfg2 {
681 ste,pins = 681 pins =
682 "GPIO157_A18", /* O7 */ 682 "GPIO157_A18", /* O7 */
683 "GPIO158_C18", /* O6 */ 683 "GPIO158_C18", /* O6 */
684 "GPIO159_B19", /* O5 */ 684 "GPIO159_B19", /* O5 */
@@ -696,11 +696,11 @@
696 */ 696 */
697 ske_kpaoc1_default_mode: ske_kpaoc1_default { 697 ske_kpaoc1_default_mode: ske_kpaoc1_default {
698 default_mux { 698 default_mux {
699 ste,function = "kp"; 699 function = "kp";
700 ste,pins = "kp_a_1", "kp_oc1_1"; 700 groups = "kp_a_1", "kp_oc1_1";
701 }; 701 };
702 default_cfg1 { 702 default_cfg1 {
703 ste,pins = 703 pins =
704 "GPIO91_B6", /* KP_O0 */ 704 "GPIO91_B6", /* KP_O0 */
705 "GPIO90_A3", /* KP_O1 */ 705 "GPIO90_A3", /* KP_O1 */
706 "GPIO87_B3", /* KP_O2 */ 706 "GPIO87_B3", /* KP_O2 */
@@ -710,7 +710,7 @@
710 ste,config = <&out_lo>; 710 ste,config = <&out_lo>;
711 }; 711 };
712 default_cfg2 { 712 default_cfg2 {
713 ste,pins = 713 pins =
714 "GPIO93_B7", /* KP_I0 */ 714 "GPIO93_B7", /* KP_I0 */
715 "GPIO92_D6", /* KP_I1 */ 715 "GPIO92_D6", /* KP_I1 */
716 "GPIO89_E6", /* KP_I2 */ 716 "GPIO89_E6", /* KP_I2 */
@@ -729,13 +729,13 @@
729 * These are plain GPIO pins used by WLAN 729 * These are plain GPIO pins used by WLAN
730 */ 730 */
731 default_cfg1 { 731 default_cfg1 {
732 ste,pins = 732 pins =
733 "GPIO226_AF8", /* WLAN_PMU_EN */ 733 "GPIO226_AF8", /* WLAN_PMU_EN */
734 "GPIO85_D5"; /* WLAN_ENA */ 734 "GPIO85_D5"; /* WLAN_ENA */
735 ste,config = <&gpio_out_lo>; 735 ste,config = <&gpio_out_lo>;
736 }; 736 };
737 default_cfg2 { 737 default_cfg2 {
738 ste,pins = "GPIO4_AH6"; /* WLAN_IRQ on UART1 */ 738 pins = "GPIO4_AH6"; /* WLAN_IRQ on UART1 */
739 ste,config = <&gpio_in_pu>; 739 ste,config = <&gpio_in_pu>;
740 }; 740 };
741 }; 741 };
diff --git a/arch/arm/boot/dts/ste-href-stuib.dtsi b/arch/arm/boot/dts/ste-href-stuib.dtsi
index 84d7c5d883f2..7d4f8184c522 100644
--- a/arch/arm/boot/dts/ste-href-stuib.dtsi
+++ b/arch/arm/boot/dts/ste-href-stuib.dtsi
@@ -103,7 +103,7 @@
103 prox { 103 prox {
104 prox_stuib_mode: prox_stuib { 104 prox_stuib_mode: prox_stuib {
105 stuib_cfg { 105 stuib_cfg {
106 ste,pins = "GPIO217_AH12"; 106 pins = "GPIO217_AH12";
107 ste,config = <&gpio_in_pu>; 107 ste,config = <&gpio_in_pu>;
108 }; 108 };
109 }; 109 };
@@ -111,7 +111,7 @@
111 hall { 111 hall {
112 hall_stuib_mode: stuib_tvk { 112 hall_stuib_mode: stuib_tvk {
113 stuib_cfg { 113 stuib_cfg {
114 ste,pins = "GPIO145_C13"; 114 pins = "GPIO145_C13";
115 ste,config = <&gpio_in_pu>; 115 ste,config = <&gpio_in_pu>;
116 }; 116 };
117 }; 117 };
diff --git a/arch/arm/boot/dts/ste-href-tvk1281618.dtsi b/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
index 18b65d1b14f2..062c6aae3afa 100644
--- a/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
+++ b/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
@@ -130,7 +130,7 @@
130 tc35893 { 130 tc35893 {
131 tc35893_tvk_mode: tc35893_tvk { 131 tc35893_tvk_mode: tc35893_tvk {
132 tvk_cfg { 132 tvk_cfg {
133 ste,pins = "GPIO218_AH11"; 133 pins = "GPIO218_AH11";
134 ste,config = <&gpio_in_pu>; 134 ste,config = <&gpio_in_pu>;
135 }; 135 };
136 }; 136 };
@@ -138,7 +138,7 @@
138 prox { 138 prox {
139 prox_tvk_mode: prox_tvk { 139 prox_tvk_mode: prox_tvk {
140 tvk_cfg { 140 tvk_cfg {
141 ste,pins = "GPIO217_AH12"; 141 pins = "GPIO217_AH12";
142 ste,config = <&gpio_in_pu>; 142 ste,config = <&gpio_in_pu>;
143 }; 143 };
144 }; 144 };
@@ -146,7 +146,7 @@
146 hall { 146 hall {
147 hall_tvk_mode: hall_tvk { 147 hall_tvk_mode: hall_tvk {
148 tvk_cfg { 148 tvk_cfg {
149 ste,pins = "GPIO145_C13"; 149 pins = "GPIO145_C13";
150 ste,config = <&gpio_in_pu>; 150 ste,config = <&gpio_in_pu>;
151 }; 151 };
152 }; 152 };
@@ -155,7 +155,7 @@
155 accel_tvk_mode: accel_tvk { 155 accel_tvk_mode: accel_tvk {
156 /* Accelerometer interrupt lines 1 & 2 */ 156 /* Accelerometer interrupt lines 1 & 2 */
157 tvk_cfg { 157 tvk_cfg {
158 ste,pins = "GPIO82_C1", "GPIO83_D3"; 158 pins = "GPIO82_C1", "GPIO83_D3";
159 ste,config = <&gpio_in_pu>; 159 ste,config = <&gpio_in_pu>;
160 }; 160 };
161 }; 161 };
@@ -164,11 +164,11 @@
164 magneto_tvk_mode: magneto_tvk { 164 magneto_tvk_mode: magneto_tvk {
165 /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */ 165 /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
166 tvk_cfg1 { 166 tvk_cfg1 {
167 ste,pins = "GPIO31_V3"; 167 pins = "GPIO31_V3";
168 ste,config = <&gpio_in_pu>; 168 ste,config = <&gpio_in_pu>;
169 }; 169 };
170 tvk_cfg2 { 170 tvk_cfg2 {
171 ste,pins = "GPIO32_V2"; 171 pins = "GPIO32_V2";
172 ste,config = <&gpio_in_pd>; 172 ste,config = <&gpio_in_pd>;
173 }; 173 };
174 }; 174 };
diff --git a/arch/arm/boot/dts/ste-hrefprev60.dtsi b/arch/arm/boot/dts/ste-hrefprev60.dtsi
index abc762e24fcb..7f3975b58d16 100644
--- a/arch/arm/boot/dts/ste-hrefprev60.dtsi
+++ b/arch/arm/boot/dts/ste-hrefprev60.dtsi
@@ -79,11 +79,11 @@
79 ssp0 { 79 ssp0 {
80 ssp0_hrefprev60_mode: ssp0_hrefprev60_default { 80 ssp0_hrefprev60_mode: ssp0_hrefprev60_default {
81 hrefprev60_mux { 81 hrefprev60_mux {
82 ste,function = "ssp0"; 82 function = "ssp0";
83 ste,pins = "ssp0_a_1"; 83 groups = "ssp0_a_1";
84 }; 84 };
85 hrefprev60_cfg1 { 85 hrefprev60_cfg1 {
86 ste,pins = "GPIO145_C13"; /* RXD */ 86 pins = "GPIO145_C13"; /* RXD */
87 ste,config = <&in_pd>; 87 ste,config = <&in_pd>;
88 }; 88 };
89 89
@@ -93,11 +93,11 @@
93 /* This additional pin needed on early MOP500 and HREFs previous to v60 */ 93 /* This additional pin needed on early MOP500 and HREFs previous to v60 */
94 sdi0_default_mode: sdi0_default { 94 sdi0_default_mode: sdi0_default {
95 hrefprev60_mux { 95 hrefprev60_mux {
96 ste,function = "mc0"; 96 function = "mc0";
97 ste,pins = "mc0dat31dir_a_1"; 97 groups = "mc0dat31dir_a_1";
98 }; 98 };
99 hrefprev60_cfg1 { 99 hrefprev60_cfg1 {
100 ste,pins = "GPIO21_AB3"; /* DAT31DIR */ 100 pins = "GPIO21_AB3"; /* DAT31DIR */
101 ste,config = <&out_hi>; 101 ste,config = <&out_hi>;
102 }; 102 };
103 103
@@ -106,7 +106,7 @@
106 tc35892 { 106 tc35892 {
107 tc35892_hrefprev60_mode: tc35892_hrefprev60 { 107 tc35892_hrefprev60_mode: tc35892_hrefprev60 {
108 hrefprev60_cfg { 108 hrefprev60_cfg {
109 ste,pins = "GPIO217_AH12"; 109 pins = "GPIO217_AH12";
110 ste,config = <&gpio_in_pu>; 110 ste,config = <&gpio_in_pu>;
111 }; 111 };
112 }; 112 };
@@ -114,11 +114,11 @@
114 ipgpio { 114 ipgpio {
115 ipgpio_hrefprev60_mode: ipgpio_hrefprev60 { 115 ipgpio_hrefprev60_mode: ipgpio_hrefprev60 {
116 hrefprev60_mux { 116 hrefprev60_mux {
117 ste,function = "ipgpio"; 117 function = "ipgpio";
118 ste,pins = "ipgpio0_c_1", "ipgpio1_c_1"; 118 groups = "ipgpio0_c_1", "ipgpio1_c_1";
119 }; 119 };
120 hrefprev60_cfg1 { 120 hrefprev60_cfg1 {
121 ste,pins = "GPIO6_AF6", "GPIO7_AG5"; 121 pins = "GPIO6_AF6", "GPIO7_AG5";
122 ste,config = <&in_pu>; 122 ste,config = <&in_pu>;
123 }; 123 };
124 }; 124 };
diff --git a/arch/arm/boot/dts/ste-hrefv60plus.dtsi b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
index bcc1f0c37f49..a4bc9e77d640 100644
--- a/arch/arm/boot/dts/ste-hrefv60plus.dtsi
+++ b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
@@ -49,7 +49,7 @@
49 /* SD card detect GPIO pin, extend default state */ 49 /* SD card detect GPIO pin, extend default state */
50 sdi0_default_mode: sdi0_default { 50 sdi0_default_mode: sdi0_default {
51 default_hrefv60_cfg1 { 51 default_hrefv60_cfg1 {
52 ste,pins = "GPIO95_E8"; 52 pins = "GPIO95_E8";
53 ste,config = <&gpio_in_pu>; 53 ste,config = <&gpio_in_pu>;
54 }; 54 };
55 }; 55 };
@@ -64,19 +64,19 @@
64 */ 64 */
65 ipgpio_hrefv60_mode: ipgpio_hrefv60 { 65 ipgpio_hrefv60_mode: ipgpio_hrefv60 {
66 hrefv60_mux { 66 hrefv60_mux {
67 ste,function = "ipgpio"; 67 function = "ipgpio";
68 ste,pins = "ipgpio0_c_1", "ipgpio1_c_1", "ipgpio4_c_1"; 68 groups = "ipgpio0_c_1", "ipgpio1_c_1", "ipgpio4_c_1";
69 }; 69 };
70 hrefv60_cfg1 { 70 hrefv60_cfg1 {
71 ste,pins = "GPIO6_AF6", "GPIO7_AG5"; 71 pins = "GPIO6_AF6", "GPIO7_AG5";
72 ste,config = <&in_pu>; 72 ste,config = <&in_pu>;
73 }; 73 };
74 hrefv60_cfg2 { 74 hrefv60_cfg2 {
75 ste,pins = "GPIO21_AB3"; 75 pins = "GPIO21_AB3";
76 ste,config = <&gpio_out_lo>; 76 ste,config = <&gpio_out_lo>;
77 }; 77 };
78 hrefv60_cfg3 { 78 hrefv60_cfg3 {
79 ste,pins = "GPIO64_F3"; 79 pins = "GPIO64_F3";
80 ste,config = <&out_lo>; 80 ste,config = <&out_lo>;
81 }; 81 };
82 }; 82 };
@@ -89,7 +89,7 @@
89 */ 89 */
90 etm_hrefv60_mode: etm_hrefv60 { 90 etm_hrefv60_mode: etm_hrefv60 {
91 hrefv60_cfg1 { 91 hrefv60_cfg1 {
92 ste,pins = 92 pins =
93 "GPIO70_G5", 93 "GPIO70_G5",
94 "GPIO71_G4", 94 "GPIO71_G4",
95 "GPIO72_H4", 95 "GPIO72_H4",
@@ -103,11 +103,11 @@
103 nahj_hrefv60_mode: nahj_hrefv60 { 103 nahj_hrefv60_mode: nahj_hrefv60 {
104 /* NAHJ CTRL on GPIO76 to low, CTRL_INV on GPIO216 to high */ 104 /* NAHJ CTRL on GPIO76 to low, CTRL_INV on GPIO216 to high */
105 hrefv60_cfg1 { 105 hrefv60_cfg1 {
106 ste,pins = "GPIO76_J2"; 106 pins = "GPIO76_J2";
107 ste,config = <&gpio_out_lo>; 107 ste,config = <&gpio_out_lo>;
108 }; 108 };
109 hrefv60_cfg2 { 109 hrefv60_cfg2 {
110 ste,pins = "GPIO216_AG12"; 110 pins = "GPIO216_AG12";
111 ste,config = <&gpio_out_hi>; 111 ste,config = <&gpio_out_hi>;
112 }; 112 };
113 }; 113 };
@@ -116,13 +116,13 @@
116 nfc_hrefv60_mode: nfc_hrefv60 { 116 nfc_hrefv60_mode: nfc_hrefv60 {
117 /* NFC ENA and RESET to low, pulldown IRQ line */ 117 /* NFC ENA and RESET to low, pulldown IRQ line */
118 hrefv60_cfg1 { 118 hrefv60_cfg1 {
119 ste,pins = 119 pins =
120 "GPIO77_H1", /* NFC_ENA */ 120 "GPIO77_H1", /* NFC_ENA */
121 "GPIO142_C11"; /* NFC_RESET */ 121 "GPIO142_C11"; /* NFC_RESET */
122 ste,config = <&gpio_out_lo>; 122 ste,config = <&gpio_out_lo>;
123 }; 123 };
124 hrefv60_cfg2 { 124 hrefv60_cfg2 {
125 ste,pins = "GPIO144_B13"; /* NFC_IRQ */ 125 pins = "GPIO144_B13"; /* NFC_IRQ */
126 ste,config = <&gpio_in_pd>; 126 ste,config = <&gpio_in_pd>;
127 }; 127 };
128 }; 128 };
@@ -130,11 +130,11 @@
130 force { 130 force {
131 force_hrefv60_mode: force_hrefv60 { 131 force_hrefv60_mode: force_hrefv60 {
132 hrefv60_cfg1 { 132 hrefv60_cfg1 {
133 ste,pins = "GPIO91_B6"; /* FORCE_SENSING_INT */ 133 pins = "GPIO91_B6"; /* FORCE_SENSING_INT */
134 ste,config = <&gpio_in_pu>; 134 ste,config = <&gpio_in_pu>;
135 }; 135 };
136 hrefv60_cfg2 { 136 hrefv60_cfg2 {
137 ste,pins = 137 pins =
138 "GPIO92_D6", /* FORCE_SENSING_RST */ 138 "GPIO92_D6", /* FORCE_SENSING_RST */
139 "GPIO97_D9"; /* FORCE_SENSING_WU */ 139 "GPIO97_D9"; /* FORCE_SENSING_WU */
140 ste,config = <&gpio_out_lo>; 140 ste,config = <&gpio_out_lo>;
@@ -144,7 +144,7 @@
144 dipro { 144 dipro {
145 dipro_hrefv60_mode: dipro_hrefv60 { 145 dipro_hrefv60_mode: dipro_hrefv60 {
146 hrefv60_cfg1 { 146 hrefv60_cfg1 {
147 ste,pins = "GPIO139_C9"; /* DIPRO_INT */ 147 pins = "GPIO139_C9"; /* DIPRO_INT */
148 ste,config = <&gpio_in_pu>; 148 ste,config = <&gpio_in_pu>;
149 }; 149 };
150 }; 150 };
@@ -153,7 +153,7 @@
153 vaudio_hf_hrefv60_mode: vaudio_hf_hrefv60 { 153 vaudio_hf_hrefv60_mode: vaudio_hf_hrefv60 {
154 /* Audio Amplifier HF enable GPIO */ 154 /* Audio Amplifier HF enable GPIO */
155 hrefv60_cfg1 { 155 hrefv60_cfg1 {
156 ste,pins = "GPIO149_B14"; /* VAUDIO_HF_EN, enable MAX8968 */ 156 pins = "GPIO149_B14"; /* VAUDIO_HF_EN, enable MAX8968 */
157 ste,config = <&gpio_out_hi>; 157 ste,config = <&gpio_out_hi>;
158 }; 158 };
159 }; 159 };
@@ -165,7 +165,7 @@
165 * pull low to reset state 165 * pull low to reset state
166 */ 166 */
167 hrefv60_cfg1 { 167 hrefv60_cfg1 {
168 ste,pins = "GPIO171_D23"; /* GBF_ENA_RESET */ 168 pins = "GPIO171_D23"; /* GBF_ENA_RESET */
169 ste,config = <&gpio_out_lo>; 169 ste,config = <&gpio_out_lo>;
170 }; 170 };
171 }; 171 };
@@ -174,7 +174,7 @@
174 hdtv_hrefv60_mode: hdtv_hrefv60 { 174 hdtv_hrefv60_mode: hdtv_hrefv60 {
175 /* MSP : HDTV INTERFACE GPIO line */ 175 /* MSP : HDTV INTERFACE GPIO line */
176 hrefv60_cfg1 { 176 hrefv60_cfg1 {
177 ste,pins = "GPIO192_AJ27"; 177 pins = "GPIO192_AJ27";
178 ste,config = <&gpio_in_pd>; 178 ste,config = <&gpio_in_pd>;
179 }; 179 };
180 }; 180 };
@@ -187,11 +187,11 @@
187 * reset signals low. 187 * reset signals low.
188 */ 188 */
189 hrefv60_cfg1 { 189 hrefv60_cfg1 {
190 ste,pins = "GPIO143_D12", "GPIO146_D13"; 190 pins = "GPIO143_D12", "GPIO146_D13";
191 ste,config = <&gpio_out_lo>; 191 ste,config = <&gpio_out_lo>;
192 }; 192 };
193 hrefv60_cfg2 { 193 hrefv60_cfg2 {
194 ste,pins = "GPIO67_G2"; 194 pins = "GPIO67_G2";
195 ste,config = <&gpio_in_pu>; 195 ste,config = <&gpio_in_pu>;
196 }; 196 };
197 }; 197 };
@@ -204,11 +204,11 @@
204 * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset) 204 * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset)
205 */ 205 */
206 hrefv60_cfg1 { 206 hrefv60_cfg1 {
207 ste,pins ="GPIO65_F1"; 207 pins ="GPIO65_F1";
208 ste,config = <&gpio_out_hi>; 208 ste,config = <&gpio_out_hi>;
209 }; 209 };
210 hrefv60_cfg2 { 210 hrefv60_cfg2 {
211 ste,pins ="GPIO66_G3"; 211 pins ="GPIO66_G3";
212 ste,config = <&gpio_out_lo>; 212 ste,config = <&gpio_out_lo>;
213 }; 213 };
214 }; 214 };
diff --git a/arch/arm/boot/dts/ste-nomadik-nhk15.dts b/arch/arm/boot/dts/ste-nomadik-nhk15.dts
new file mode 100644
index 000000000000..a8c00ee7522a
--- /dev/null
+++ b/arch/arm/boot/dts/ste-nomadik-nhk15.dts
@@ -0,0 +1,151 @@
1/*
2 * Device Tree for the ST-Ericsson Nomadik S8815 board
3 * Produced by Calao Systems
4 */
5
6/dts-v1/;
7#include <dt-bindings/interrupt-controller/irq.h>
8#include <dt-bindings/gpio/gpio.h>
9#include "ste-nomadik-stn8815.dtsi"
10
11/ {
12 model = "Nomadik STN8815NHK";
13 compatible = "st,nomadik-nhk-15";
14
15 chosen {
16 bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk";
17 };
18
19 aliases {
20 stmpe-i2c0 = &stmpe0;
21 stmpe-i2c1 = &stmpe1;
22 };
23
24 pinctrl {
25 stmpe2401_1 {
26 stmpe2401_1_nhk_mode: stmpe2401_1_nhk {
27 nhk_cfg1 {
28 ste,pins = "GPIO76_B20"; // IRQ line
29 ste,input = <0>;
30 };
31 nhk_cfg2 {
32 ste,pins = "GPIO77_B8"; // reset line
33 ste,output = <1>;
34 };
35 };
36 };
37 stmpe2401_2 {
38 stmpe2401_2_nhk_mode: stmpe2401_2_nhk {
39 nhk_cfg1 {
40 ste,pins = "GPIO78_A8"; // IRQ line
41 ste,input = <0>;
42 };
43 nhk_cfg2 {
44 ste,pins = "GPIO79_C9"; // reset line
45 ste,output = <1>;
46 };
47 };
48 };
49 };
50
51 src@101e0000 {
52 /* These chrystal outputs are not used on this board */
53 disable-sxtalo;
54 disable-mxtalo;
55 };
56
57 /* This is where the interrupt is routed on the NHK-15 debug board */
58 external-bus@34000000 {
59 compatible = "simple-bus";
60 reg = <0x34000000 0x1000000>;
61 #address-cells = <1>;
62 #size-cells = <1>;
63 ranges = <0 0x34000000 0x1000000>;
64 ethernet@300 {
65 compatible = "smsc,lan91c111";
66 reg = <0x300 0x0fd00>;
67 reg-io-width = <2>;
68 reset-gpios = <&stmpe_gpio44 10 GPIO_ACTIVE_HIGH>;
69 interrupt-parent = <&stmpe_gpio44>;
70 interrupts = <11 IRQ_TYPE_EDGE_RISING>;
71 };
72 };
73
74 i2c0 {
75 stmpe0: stmpe2401@43 {
76 compatible = "st,stmpe2401";
77 reg = <0x43>;
78 reset-gpios = <&gpio2 13 GPIO_ACTIVE_LOW>; // GPIO77
79 interrupts = <12 IRQ_TYPE_EDGE_FALLING>; // GPIO76
80 interrupt-parent = <&gpio2>;
81 interrupt-controller;
82 wakeup-source;
83 pinctrl-names = "default";
84 pinctrl-0 = <&stmpe2401_1_nhk_mode>;
85 stmpe_gpio43: stmpe_gpio {
86 compatible = "st,stmpe-gpio";
87 gpio-controller;
88 #gpio-cells = <2>;
89 interrupt-controller;
90 #interrupt-cells = <2>;
91 /* Some pins in alternate functions */
92 st,norequest-mask = <0xf0f002>;
93 };
94 stmpe_keypad {
95 compatible = "st,stmpe-keypad";
96 debounce-interval = <64>;
97 st,scan-count = <8>;
98 st,no-autorepeat;
99 keypad,num-rows = <8>;
100 keypad,num-columns = <8>;
101 linux,keymap = <0x00020072 // Vol down
102 0x00030073 // Vol up
103 0x0100009e // Back
104 0x010100e3 // TV out
105 0x01020098 // Lock
106 0x0103013b // Start
107 0x020000a3 // Next
108 0x020100a4 // Play
109 0x020200a5 // Prev
110 0x02030160 // OK
111 0x03000069 // Left
112 0x0301006a // Right
113 0x03020067 // Up
114 0x0303006c>; // Down
115 };
116 };
117 stmpe1: stmpe2401@44 {
118 compatible = "st,stmpe2401";
119 reg = <0x44>;
120 reset-gpios = <&gpio2 15 GPIO_ACTIVE_LOW>; // GPIO79
121 interrupts = <14 IRQ_TYPE_EDGE_FALLING>; // GPIO78
122 interrupt-parent = <&gpio2>;
123 interrupt-controller;
124 wakeup-source;
125 pinctrl-names = "default";
126 pinctrl-0 = <&stmpe2401_2_nhk_mode>;
127 stmpe_gpio44: stmpe_gpio {
128 compatible = "st,stmpe-gpio";
129 gpio-controller;
130 #gpio-cells = <2>;
131 interrupt-controller;
132 #interrupt-cells = <2>;
133 };
134 };
135 };
136
137 amba {
138 mmcsd: sdi@101f6000 {
139 cd-gpios = <&stmpe_gpio44 7 GPIO_ACTIVE_LOW>;
140 wp-gpios = <&stmpe_gpio44 18 GPIO_ACTIVE_HIGH>;
141 };
142 };
143
144 /* Custom board node with GPIO pins to active etc */
145 usb-s8815 {
146 /* This will turn off SATA so that MMC/SD can thrive */
147 mmcsd-gpio {
148 gpios = <&stmpe_gpio44 2 0x1>;
149 };
150 };
151};
diff --git a/arch/arm/boot/dts/ste-nomadik-s8815.dts b/arch/arm/boot/dts/ste-nomadik-s8815.dts
index 90d8b6c7a205..85d3b95dfdba 100644
--- a/arch/arm/boot/dts/ste-nomadik-s8815.dts
+++ b/arch/arm/boot/dts/ste-nomadik-s8815.dts
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6/dts-v1/; 6/dts-v1/;
7#include <dt-bindings/interrupt-controller/irq.h>
7#include "ste-nomadik-stn8815.dtsi" 8#include "ste-nomadik-stn8815.dtsi"
8 9
9/ { 10/ {
@@ -14,14 +15,6 @@
14 bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk"; 15 bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk";
15 }; 16 };
16 17
17 /* This is where the interrupt is routed on the S8815 board */
18 external-bus@34000000 {
19 ethernet@300 {
20 interrupt-parent = <&gpio3>;
21 interrupts = <8 0x1>;
22 };
23 };
24
25 src@101e0000 { 18 src@101e0000 {
26 /* These chrystal drivers are not used on this board */ 19 /* These chrystal drivers are not used on this board */
27 disable-sxtalo; 20 disable-sxtalo;
@@ -37,20 +30,28 @@
37 cd_default_mode: cd_default { 30 cd_default_mode: cd_default {
38 cd_default_cfg1 { 31 cd_default_cfg1 {
39 /* CD input GPIO */ 32 /* CD input GPIO */
40 ste,pins = "GPIO111_H21"; 33 pins = "GPIO111_H21";
41 ste,input = <0>; 34 ste,input = <0>;
42 }; 35 };
43 cd_default_cfg2 { 36 cd_default_cfg2 {
44 /* CD GPIO biasing */ 37 /* CD GPIO biasing */
45 ste,pins = "GPIO112_J21"; 38 pins = "GPIO112_J21";
46 ste,output = <0>; 39 ste,output = <0>;
47 }; 40 };
48 }; 41 };
49 }; 42 };
43 gpioi2c {
44 gpioi2c_default_mode: gpioi2c_default {
45 gpioi2c_default_cfg {
46 pins = "GPIO73_C21", "GPIO74_C20";
47 ste,input = <0>;
48 };
49 };
50 };
50 user-led { 51 user-led {
51 user_led_default_mode: user_led_default { 52 user_led_default_mode: user_led_default {
52 user_led_default_cfg { 53 user_led_default_cfg {
53 ste,pins = "GPIO2_C5"; 54 pins = "GPIO2_C5";
54 ste,output = <1>; 55 ste,output = <1>;
55 }; 56 };
56 }; 57 };
@@ -58,13 +59,52 @@
58 user-button { 59 user-button {
59 user_button_default_mode: user_button_default { 60 user_button_default_mode: user_button_default {
60 user_button_default_cfg { 61 user_button_default_cfg {
61 ste,pins = "GPIO3_A4"; 62 pins = "GPIO3_A4";
62 ste,input = <0>; 63 ste,input = <0>;
63 }; 64 };
64 }; 65 };
65 }; 66 };
66 }; 67 };
67 68
69 /* Ethernet */
70 external-bus@34000000 {
71 compatible = "simple-bus";
72 reg = <0x34000000 0x1000000>;
73 #address-cells = <1>;
74 #size-cells = <1>;
75 ranges = <0 0x34000000 0x1000000>;
76 ethernet@300 {
77 compatible = "smsc,lan91c111";
78 reg = <0x300 0x0fd00>;
79 interrupt-parent = <&gpio3>;
80 interrupts = <8 IRQ_TYPE_EDGE_RISING>;
81 };
82 };
83
84 /* GPIO I2C connected to the USB portions of the STw4811 only */
85 gpio-i2c {
86 compatible = "i2c-gpio";
87 gpios = <&gpio2 10 0>, /* sda */
88 <&gpio2 9 0>; /* scl */
89 #address-cells = <1>;
90 #size-cells = <0>;
91 pinctrl-names = "default";
92 pinctrl-0 = <&gpioi2c_default_mode>;
93
94 stw4811@2d {
95 compatible = "st,stw4811-usb";
96 reg = <0x2d>;
97 };
98 };
99
100
101 /* Configure card detect for the uSD slot */
102 amba {
103 mmcsd: sdi@101f6000 {
104 cd-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
105 };
106 };
107
68 /* Custom board node with GPIO pins to active etc */ 108 /* Custom board node with GPIO pins to active etc */
69 usb-s8815 { 109 usb-s8815 {
70 /* This will bias the MMC/SD card detect line */ 110 /* This will bias the MMC/SD card detect line */
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
index dbcf521b017f..f182f6538e90 100644
--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
@@ -100,41 +100,41 @@
100 uart0 { 100 uart0 {
101 uart0_default_mux: uart0_mux { 101 uart0_default_mux: uart0_mux {
102 u0_default_mux { 102 u0_default_mux {
103 ste,function = "u0"; 103 function = "u0";
104 ste,pins = "u0_a_1"; 104 groups = "u0_a_1";
105 }; 105 };
106 }; 106 };
107 }; 107 };
108 uart1 { 108 uart1 {
109 uart1_default_mux: uart1_mux { 109 uart1_default_mux: uart1_mux {
110 u1_default_mux { 110 u1_default_mux {
111 ste,function = "u1"; 111 function = "u1";
112 ste,pins = "u1_a_1"; 112 groups = "u1_a_1";
113 }; 113 };
114 }; 114 };
115 }; 115 };
116 mmcsd { 116 mmcsd {
117 mmcsd_default_mux: mmcsd_mux { 117 mmcsd_default_mux: mmcsd_mux {
118 mmcsd_default_mux { 118 mmcsd_default_mux {
119 ste,function = "mmcsd"; 119 function = "mmcsd";
120 ste,pins = "mmcsd_a_1"; 120 groups = "mmcsd_a_1", "mmcsd_b_1";
121 }; 121 };
122 }; 122 };
123 mmcsd_default_mode: mmcsd_default { 123 mmcsd_default_mode: mmcsd_default {
124 mmcsd_default_cfg1 { 124 mmcsd_default_cfg1 {
125 /* MCCLK */ 125 /* MCCLK */
126 ste,pins = "GPIO8_B10"; 126 pins = "GPIO8_B10";
127 ste,output = <0>; 127 ste,output = <0>;
128 }; 128 };
129 mmcsd_default_cfg2 { 129 mmcsd_default_cfg2 {
130 /* MCCMDDIR, MCDAT0DIR, MCDAT31DIR */ 130 /* MCCMDDIR, MCDAT0DIR, MCDAT31DIR, MCDATDIR2 */
131 ste,pins = "GPIO10_C11", "GPIO15_A12", 131 pins = "GPIO10_C11", "GPIO15_A12",
132 "GPIO16_C13"; 132 "GPIO16_C13", "GPIO23_D15";
133 ste,output = <1>; 133 ste,output = <1>;
134 }; 134 };
135 mmcsd_default_cfg3 { 135 mmcsd_default_cfg3 {
136 /* MCCMD, MCDAT3-0, MCMSFBCLK */ 136 /* MCCMD, MCDAT3-0, MCMSFBCLK */
137 ste,pins = "GPIO9_A10", "GPIO11_B11", 137 pins = "GPIO9_A10", "GPIO11_B11",
138 "GPIO12_A11", "GPIO13_C12", 138 "GPIO12_A11", "GPIO13_C12",
139 "GPIO14_B12", "GPIO24_C15"; 139 "GPIO14_B12", "GPIO24_C15";
140 ste,input = <1>; 140 ste,input = <1>;
@@ -144,13 +144,13 @@
144 i2c0 { 144 i2c0 {
145 i2c0_default_mux: i2c0_mux { 145 i2c0_default_mux: i2c0_mux {
146 i2c0_default_mux { 146 i2c0_default_mux {
147 ste,function = "i2c0"; 147 function = "i2c0";
148 ste,pins = "i2c0_a_1"; 148 groups = "i2c0_a_1";
149 }; 149 };
150 }; 150 };
151 i2c0_default_mode: i2c0_default { 151 i2c0_default_mode: i2c0_default {
152 i2c0_default_cfg { 152 i2c0_default_cfg {
153 ste,pins = "GPIO62_D3", "GPIO63_D2"; 153 pins = "GPIO62_D3", "GPIO63_D2";
154 ste,input = <0>; 154 ste,input = <0>;
155 }; 155 };
156 }; 156 };
@@ -158,21 +158,13 @@
158 i2c1 { 158 i2c1 {
159 i2c1_default_mux: i2c1_mux { 159 i2c1_default_mux: i2c1_mux {
160 i2c1_default_mux { 160 i2c1_default_mux {
161 ste,function = "i2c1"; 161 function = "i2c1";
162 ste,pins = "i2c1_a_1"; 162 groups = "i2c1_a_1";
163 }; 163 };
164 }; 164 };
165 i2c1_default_mode: i2c1_default { 165 i2c1_default_mode: i2c1_default {
166 i2c1_default_cfg { 166 i2c1_default_cfg {
167 ste,pins = "GPIO53_L4", "GPIO54_L3"; 167 pins = "GPIO53_L4", "GPIO54_L3";
168 ste,input = <0>;
169 };
170 };
171 };
172 i2c2 {
173 i2c2_default_mode: i2c2_default {
174 i2c2_default_cfg {
175 ste,pins = "GPIO73_C21", "GPIO74_C20";
176 ste,input = <0>; 168 ste,input = <0>;
177 }; 169 };
178 }; 170 };
@@ -182,8 +174,6 @@
182 src: src@101e0000 { 174 src: src@101e0000 {
183 compatible = "stericsson,nomadik-src"; 175 compatible = "stericsson,nomadik-src";
184 reg = <0x101e0000 0x1000>; 176 reg = <0x101e0000 0x1000>;
185 disable-sxtalo;
186 disable-mxtalo;
187 177
188 /* 178 /*
189 * MXTAL "Main Chrystal" is a chrystal oscillator @19.2 MHz 179 * MXTAL "Main Chrystal" is a chrystal oscillator @19.2 MHz
@@ -683,18 +673,6 @@
683 }; 673 };
684 }; 674 };
685 675
686 external-bus@34000000 {
687 compatible = "simple-bus";
688 reg = <0x34000000 0x1000000>;
689 #address-cells = <1>;
690 #size-cells = <1>;
691 ranges = <0 0x34000000 0x1000000>;
692 ethernet@300 {
693 compatible = "smsc,lan91c111";
694 reg = <0x300 0x0fd00>;
695 };
696 };
697
698 /* I2C0 connected to the STw4811 power management chip */ 676 /* I2C0 connected to the STw4811 power management chip */
699 i2c0 { 677 i2c0 {
700 compatible = "st,nomadik-i2c", "arm,primecell"; 678 compatible = "st,nomadik-i2c", "arm,primecell";
@@ -749,22 +727,6 @@
749 }; 727 };
750 }; 728 };
751 729
752 /* I2C2 connected to the USB portions of the STw4811 only */
753 i2c2 {
754 compatible = "i2c-gpio";
755 gpios = <&gpio2 10 0>, /* sda */
756 <&gpio2 9 0>; /* scl */
757 #address-cells = <1>;
758 #size-cells = <0>;
759 pinctrl-names = "default";
760 pinctrl-0 = <&i2c2_default_mode>;
761
762 stw4811@2d {
763 compatible = "st,stw4811-usb";
764 reg = <0x2d>;
765 };
766 };
767
768 amba { 730 amba {
769 compatible = "arm,amba-bus"; 731 compatible = "arm,amba-bus";
770 #address-cells = <1>; 732 #address-cells = <1>;
@@ -844,7 +806,6 @@
844 bus-width = <4>; 806 bus-width = <4>;
845 cap-mmc-highspeed; 807 cap-mmc-highspeed;
846 cap-sd-highspeed; 808 cap-sd-highspeed;
847 cd-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
848 pinctrl-names = "default"; 809 pinctrl-names = "default";
849 pinctrl-0 = <&mmcsd_default_mux>, <&mmcsd_default_mode>; 810 pinctrl-0 = <&mmcsd_default_mux>, <&mmcsd_default_mode>;
850 vmmc-supply = <&vmmc_regulator>; 811 vmmc-supply = <&vmmc_regulator>;
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index 3e97a669f15e..206826a855c0 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -404,17 +404,17 @@
404 */ 404 */
405 eth_snowball_mode: eth_snowball { 405 eth_snowball_mode: eth_snowball {
406 snowball_mux { 406 snowball_mux {
407 ste,function = "sm"; 407 function = "sm";
408 ste,pins = "sm_b_1"; 408 groups = "sm_b_1";
409 }; 409 };
410 /* LAN IRQ pin */ 410 /* LAN IRQ pin */
411 snowball_cfg1 { 411 snowball_cfg1 {
412 ste,pins = "GPIO140_B11"; 412 pins = "GPIO140_B11";
413 ste,config = <&in_nopull>; 413 ste,config = <&in_nopull>;
414 }; 414 };
415 /* LAN reset pin */ 415 /* LAN reset pin */
416 snowball_cfg2 { 416 snowball_cfg2 {
417 ste,pins = "GPIO141_C12"; 417 pins = "GPIO141_C12";
418 ste,config = <&gpio_out_hi>; 418 ste,config = <&gpio_out_hi>;
419 }; 419 };
420 420
@@ -423,11 +423,11 @@
423 sdi0 { 423 sdi0 {
424 sdi0_default_mode: sdi0_default { 424 sdi0_default_mode: sdi0_default {
425 snowball_mux { 425 snowball_mux {
426 ste,function = "mc0"; 426 function = "mc0";
427 ste,pins = "mc0dat31dir_a_1"; 427 groups = "mc0dat31dir_a_1";
428 }; 428 };
429 snowball_cfg1 { 429 snowball_cfg1 {
430 ste,pins = "GPIO21_AB3"; /* DAT31DIR */ 430 pins = "GPIO21_AB3"; /* DAT31DIR */
431 ste,config = <&out_hi>; 431 ste,config = <&out_hi>;
432 }; 432 };
433 433
@@ -436,19 +436,19 @@
436 ssp0 { 436 ssp0 {
437 ssp0_snowball_mode: ssp0_snowball_default { 437 ssp0_snowball_mode: ssp0_snowball_default {
438 snowball_mux { 438 snowball_mux {
439 ste,function = "ssp0"; 439 function = "ssp0";
440 ste,pins = "ssp0_a_1"; 440 groups = "ssp0_a_1";
441 }; 441 };
442 snowball_cfg1 { 442 snowball_cfg1 {
443 ste,pins = "GPIO144_B13"; /* FRM */ 443 pins = "GPIO144_B13"; /* FRM */
444 ste,config = <&gpio_out_hi>; 444 ste,config = <&gpio_out_hi>;
445 }; 445 };
446 snowball_cfg2 { 446 snowball_cfg2 {
447 ste,pins = "GPIO145_C13"; /* RXD */ 447 pins = "GPIO145_C13"; /* RXD */
448 ste,config = <&in_pd>; 448 ste,config = <&in_pd>;
449 }; 449 };
450 snowball_cfg3 { 450 snowball_cfg3 {
451 ste,pins = 451 pins =
452 "GPIO146_D13", /* TXD */ 452 "GPIO146_D13", /* TXD */
453 "GPIO143_D12"; /* CLK */ 453 "GPIO143_D12"; /* CLK */
454 ste,config = <&out_lo>; 454 ste,config = <&out_lo>;
@@ -459,7 +459,7 @@
459 gpio_led { 459 gpio_led {
460 gpioled_snowball_mode: gpioled_default { 460 gpioled_snowball_mode: gpioled_default {
461 snowball_cfg1 { 461 snowball_cfg1 {
462 ste,pins = "GPIO142_C11"; 462 pins = "GPIO142_C11";
463 ste,config = <&gpio_out_hi>; 463 ste,config = <&gpio_out_hi>;
464 }; 464 };
465 465
@@ -469,7 +469,7 @@
469 accel_snowball_mode: accel_snowball { 469 accel_snowball_mode: accel_snowball {
470 /* Accelerometer lines */ 470 /* Accelerometer lines */
471 snowball_cfg1 { 471 snowball_cfg1 {
472 ste,pins = 472 pins =
473 "GPIO163_C20", /* ACCEL_IRQ1 */ 473 "GPIO163_C20", /* ACCEL_IRQ1 */
474 "GPIO164_B21"; /* ACCEL_IRQ2 */ 474 "GPIO164_B21"; /* ACCEL_IRQ2 */
475 ste,config = <&gpio_in_pu>; 475 ste,config = <&gpio_in_pu>;
@@ -479,7 +479,7 @@
479 magnetometer { 479 magnetometer {
480 magneto_snowball_mode: magneto_snowball { 480 magneto_snowball_mode: magneto_snowball {
481 snowball_cfg1 { 481 snowball_cfg1 {
482 ste,pins = "GPIO165_C21"; /* MAG_DRDY */ 482 pins = "GPIO165_C21"; /* MAG_DRDY */
483 ste,config = <&gpio_in_pu>; 483 ste,config = <&gpio_in_pu>;
484 }; 484 };
485 }; 485 };
@@ -491,7 +491,7 @@
491 * pull low to reset state 491 * pull low to reset state
492 */ 492 */
493 snowball_cfg1 { 493 snowball_cfg1 {
494 ste,pins = "GPIO171_D23"; /* GBF_ENA_RESET */ 494 pins = "GPIO171_D23"; /* GBF_ENA_RESET */
495 ste,config = <&gpio_out_lo>; 495 ste,config = <&gpio_out_lo>;
496 }; 496 };
497 }; 497 };
@@ -503,13 +503,13 @@
503 * These are plain GPIO pins used by WLAN 503 * These are plain GPIO pins used by WLAN
504 */ 504 */
505 snowball_cfg1 { 505 snowball_cfg1 {
506 ste,pins = 506 pins =
507 "GPIO161_D21", /* WLAN_PMU_EN */ 507 "GPIO161_D21", /* WLAN_PMU_EN */
508 "GPIO215_AH13"; /* WLAN_ENA */ 508 "GPIO215_AH13"; /* WLAN_ENA */
509 ste,config = <&gpio_out_lo>; 509 ste,config = <&gpio_out_lo>;
510 }; 510 };
511 snowball_cfg2 { 511 snowball_cfg2 {
512 ste,pins = "GPIO216_AG12"; /* WLAN_IRQ */ 512 pins = "GPIO216_AG12"; /* WLAN_IRQ */
513 ste,config = <&gpio_in_pu>; 513 ste,config = <&gpio_in_pu>;
514 }; 514 };
515 }; 515 };
diff --git a/arch/arm/boot/dts/stih407-b2120.dts b/arch/arm/boot/dts/stih407-b2120.dts
index fe69f92e5f82..261d5e2c48d2 100644
--- a/arch/arm/boot/dts/stih407-b2120.dts
+++ b/arch/arm/boot/dts/stih407-b2120.dts
@@ -7,13 +7,15 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10#include "stih407.dtsi" 10#include "stih407-clock.dtsi"
11#include "stih407-family.dtsi"
12#include "stihxxx-b2120.dtsi"
11/ { 13/ {
12 model = "STiH407 B2120"; 14 model = "STiH407 B2120";
13 compatible = "st,stih407-b2120", "st,stih407"; 15 compatible = "st,stih407-b2120", "st,stih407";
14 16
15 chosen { 17 chosen {
16 bootargs = "console=ttyAS0,115200"; 18 bootargs = "console=ttyAS0,115200 clk_ignore_unused";
17 linux,stdout-path = &sbc_serial0; 19 linux,stdout-path = &sbc_serial0;
18 }; 20 };
19 21
@@ -26,53 +28,4 @@
26 ttyAS0 = &sbc_serial0; 28 ttyAS0 = &sbc_serial0;
27 }; 29 };
28 30
29 soc {
30 sbc_serial0: serial@9530000 {
31 status = "okay";
32 };
33
34 leds {
35 compatible = "gpio-leds";
36 red {
37 #gpio-cells = <2>;
38 label = "Front Panel LED";
39 gpios = <&pio4 1 0>;
40 linux,default-trigger = "heartbeat";
41 };
42 green {
43 #gpio-cells = <2>;
44 gpios = <&pio1 3 0>;
45 default-state = "off";
46 };
47 };
48
49 i2c@9842000 {
50 status = "okay";
51 };
52
53 i2c@9843000 {
54 status = "okay";
55 };
56
57 i2c@9844000 {
58 status = "okay";
59 };
60
61 i2c@9845000 {
62 status = "okay";
63 };
64
65 i2c@9540000 {
66 status = "okay";
67 };
68
69 /* SSC11 to HDMI */
70 i2c@9541000 {
71 status = "okay";
72 /* HDMI V1.3a supports Standard mode only */
73 clock-frequency = <100000>;
74 st,i2c-min-scl-pulse-width-us = <0>;
75 st,i2c-min-sda-pulse-width-us = <5>;
76 };
77 };
78}; 31};
diff --git a/arch/arm/boot/dts/stih407-clock.dtsi b/arch/arm/boot/dts/stih407-clock.dtsi
index 800f46f009f3..e65744fc12ab 100644
--- a/arch/arm/boot/dts/stih407-clock.dtsi
+++ b/arch/arm/boot/dts/stih407-clock.dtsi
@@ -5,8 +5,13 @@
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8#include <dt-bindings/clock/stih407-clks.h>
8/ { 9/ {
9 clocks { 10 clocks {
11 #address-cells = <1>;
12 #size-cells = <1>;
13 ranges;
14
10 /* 15 /*
11 * Fixed 30MHz oscillator inputs to SoC 16 * Fixed 30MHz oscillator inputs to SoC
12 */ 17 */
@@ -19,10 +24,59 @@
19 /* 24 /*
20 * ARM Peripheral clock for timers 25 * ARM Peripheral clock for timers
21 */ 26 */
22 arm_periph_clk: arm-periph-clk { 27 arm_periph_clk: clk-m-a9-periphs {
23 #clock-cells = <0>; 28 #clock-cells = <0>;
24 compatible = "fixed-clock"; 29 compatible = "fixed-factor-clock";
25 clock-frequency = <600000000>; 30
31 clocks = <&clk_m_a9>;
32 clock-div = <2>;
33 clock-mult = <1>;
34 };
35
36 /*
37 * A9 PLL.
38 */
39 clockgen-a9@92b0000 {
40 compatible = "st,clkgen-c32";
41 reg = <0x92b0000 0xffff>;
42
43 clockgen_a9_pll: clockgen-a9-pll {
44 #clock-cells = <1>;
45 compatible = "st,stih407-plls-c32-a9", "st,clkgen-plls-c32";
46
47 clocks = <&clk_sysin>;
48
49 clock-output-names = "clockgen-a9-pll-odf";
50 };
51 };
52
53 /*
54 * ARM CPU related clocks.
55 */
56 clk_m_a9: clk-m-a9@92b0000 {
57 #clock-cells = <0>;
58 compatible = "st,stih407-clkgen-a9-mux", "st,clkgen-mux";
59 reg = <0x92b0000 0x10000>;
60
61 clocks = <&clockgen_a9_pll 0>,
62 <&clockgen_a9_pll 0>,
63 <&clk_s_c0_flexgen 13>,
64 <&clk_m_a9_ext2f_div2>;
65 };
66
67 /*
68 * ARM Peripheral clock for timers
69 */
70 clk_m_a9_ext2f_div2: clk-m-a9-ext2f-div2s {
71 #clock-cells = <0>;
72 compatible = "fixed-factor-clock";
73
74 clocks = <&clk_s_c0_flexgen 13>;
75
76 clock-output-names = "clk-m-a9-ext2f-div2";
77
78 clock-div = <2>;
79 clock-mult = <1>;
26 }; 80 };
27 81
28 /* 82 /*
@@ -35,5 +89,238 @@
35 clock-frequency = <200000000>; 89 clock-frequency = <200000000>;
36 clock-output-names = "clk-s-icn-reg-0"; 90 clock-output-names = "clk-s-icn-reg-0";
37 }; 91 };
92
93 clockgen-a@090ff000 {
94 compatible = "st,clkgen-c32";
95 reg = <0x90ff000 0x1000>;
96
97 clk_s_a0_pll: clk-s-a0-pll {
98 #clock-cells = <1>;
99 compatible = "st,stih407-plls-c32-a0", "st,clkgen-plls-c32";
100
101 clocks = <&clk_sysin>;
102
103 clock-output-names = "clk-s-a0-pll-ofd-0";
104 };
105
106 clk_s_a0_flexgen: clk-s-a0-flexgen {
107 compatible = "st,flexgen";
108
109 #clock-cells = <1>;
110
111 clocks = <&clk_s_a0_pll 0>,
112 <&clk_sysin>;
113
114 clock-output-names = "clk-ic-lmi0";
115 };
116 };
117
118 clk_s_c0_quadfs: clk-s-c0-quadfs@9103000 {
119 #clock-cells = <1>;
120 compatible = "st,stih407-quadfs660-C", "st,quadfs";
121 reg = <0x9103000 0x1000>;
122
123 clocks = <&clk_sysin>;
124
125 clock-output-names = "clk-s-c0-fs0-ch0",
126 "clk-s-c0-fs0-ch1",
127 "clk-s-c0-fs0-ch2",
128 "clk-s-c0-fs0-ch3";
129 };
130
131 clk_s_c0: clockgen-c@09103000 {
132 compatible = "st,clkgen-c32";
133 reg = <0x9103000 0x1000>;
134
135 clk_s_c0_pll0: clk-s-c0-pll0 {
136 #clock-cells = <1>;
137 compatible = "st,stih407-plls-c32-c0_0", "st,clkgen-plls-c32";
138
139 clocks = <&clk_sysin>;
140
141 clock-output-names = "clk-s-c0-pll0-odf-0";
142 };
143
144 clk_s_c0_pll1: clk-s-c0-pll1 {
145 #clock-cells = <1>;
146 compatible = "st,stih407-plls-c32-c0_1", "st,clkgen-plls-c32";
147
148 clocks = <&clk_sysin>;
149
150 clock-output-names = "clk-s-c0-pll1-odf-0";
151 };
152
153 clk_s_c0_flexgen: clk-s-c0-flexgen {
154 #clock-cells = <1>;
155 compatible = "st,flexgen";
156
157 clocks = <&clk_s_c0_pll0 0>,
158 <&clk_s_c0_pll1 0>,
159 <&clk_s_c0_quadfs 0>,
160 <&clk_s_c0_quadfs 1>,
161 <&clk_s_c0_quadfs 2>,
162 <&clk_s_c0_quadfs 3>,
163 <&clk_sysin>;
164
165 clock-output-names = "clk-icn-gpu",
166 "clk-fdma",
167 "clk-nand",
168 "clk-hva",
169 "clk-proc-stfe",
170 "clk-proc-tp",
171 "clk-rx-icn-dmu",
172 "clk-rx-icn-hva",
173 "clk-icn-cpu",
174 "clk-tx-icn-dmu",
175 "clk-mmc-0",
176 "clk-mmc-1",
177 "clk-jpegdec",
178 "clk-ext2fa9",
179 "clk-ic-bdisp-0",
180 "clk-ic-bdisp-1",
181 "clk-pp-dmu",
182 "clk-vid-dmu",
183 "clk-dss-lpc",
184 "clk-st231-aud-0",
185 "clk-st231-gp-1",
186 "clk-st231-dmu",
187 "clk-icn-lmi",
188 "clk-tx-icn-disp-1",
189 "clk-icn-sbc",
190 "clk-stfe-frc2",
191 "clk-eth-phy",
192 "clk-eth-ref-phyclk",
193 "clk-flash-promip",
194 "clk-main-disp",
195 "clk-aux-disp",
196 "clk-compo-dvp";
197 };
198 };
199
200 clk_s_d0_quadfs: clk-s-d0-quadfs@9104000 {
201 #clock-cells = <1>;
202 compatible = "st,stih407-quadfs660-D", "st,quadfs";
203 reg = <0x9104000 0x1000>;
204
205 clocks = <&clk_sysin>;
206
207 clock-output-names = "clk-s-d0-fs0-ch0",
208 "clk-s-d0-fs0-ch1",
209 "clk-s-d0-fs0-ch2",
210 "clk-s-d0-fs0-ch3";
211 };
212
213 clockgen-d0@09104000 {
214 compatible = "st,clkgen-c32";
215 reg = <0x9104000 0x1000>;
216
217 clk_s_d0_flexgen: clk-s-d0-flexgen {
218 #clock-cells = <1>;
219 compatible = "st,flexgen";
220
221 clocks = <&clk_s_d0_quadfs 0>,
222 <&clk_s_d0_quadfs 1>,
223 <&clk_s_d0_quadfs 2>,
224 <&clk_s_d0_quadfs 3>,
225 <&clk_sysin>;
226
227 clock-output-names = "clk-pcm-0",
228 "clk-pcm-1",
229 "clk-pcm-2",
230 "clk-spdiff";
231 };
232 };
233
234 clk_s_d2_quadfs: clk-s-d2-quadfs@9106000 {
235 #clock-cells = <1>;
236 compatible = "st,stih407-quadfs660-D", "st,quadfs";
237 reg = <0x9106000 0x1000>;
238
239 clocks = <&clk_sysin>;
240
241 clock-output-names = "clk-s-d2-fs0-ch0",
242 "clk-s-d2-fs0-ch1",
243 "clk-s-d2-fs0-ch2",
244 "clk-s-d2-fs0-ch3";
245 };
246
247 clk_tmdsout_hdmi: clk-tmdsout-hdmi {
248 #clock-cells = <0>;
249 compatible = "fixed-clock";
250 clock-frequency = <0>;
251 };
252
253 clockgen-d2@x9106000 {
254 compatible = "st,clkgen-c32";
255 reg = <0x9106000 0x1000>;
256
257 clk_s_d2_flexgen: clk-s-d2-flexgen {
258 #clock-cells = <1>;
259 compatible = "st,flexgen";
260
261 clocks = <&clk_s_d2_quadfs 0>,
262 <&clk_s_d2_quadfs 1>,
263 <&clk_s_d2_quadfs 2>,
264 <&clk_s_d2_quadfs 3>,
265 <&clk_sysin>,
266 <&clk_sysin>,
267 <&clk_tmdsout_hdmi>;
268
269 clock-output-names = "clk-pix-main-disp",
270 "clk-pix-pip",
271 "clk-pix-gdp1",
272 "clk-pix-gdp2",
273 "clk-pix-gdp3",
274 "clk-pix-gdp4",
275 "clk-pix-aux-disp",
276 "clk-denc",
277 "clk-pix-hddac",
278 "clk-hddac",
279 "clk-sddac",
280 "clk-pix-dvo",
281 "clk-dvo",
282 "clk-pix-hdmi",
283 "clk-tmds-hdmi",
284 "clk-ref-hdmiphy";
285 };
286 };
287
288 clk_s_d3_quadfs: clk-s-d3-quadfs@9107000 {
289 #clock-cells = <1>;
290 compatible = "st,stih407-quadfs660-D", "st,quadfs";
291 reg = <0x9107000 0x1000>;
292
293 clocks = <&clk_sysin>;
294
295 clock-output-names = "clk-s-d3-fs0-ch0",
296 "clk-s-d3-fs0-ch1",
297 "clk-s-d3-fs0-ch2",
298 "clk-s-d3-fs0-ch3";
299 };
300
301 clockgen-d3@9107000 {
302 compatible = "st,clkgen-c32";
303 reg = <0x9107000 0x1000>;
304
305 clk_s_d3_flexgen: clk-s-d3-flexgen {
306 #clock-cells = <1>;
307 compatible = "st,flexgen";
308
309 clocks = <&clk_s_d3_quadfs 0>,
310 <&clk_s_d3_quadfs 1>,
311 <&clk_s_d3_quadfs 2>,
312 <&clk_s_d3_quadfs 3>,
313 <&clk_sysin>;
314
315 clock-output-names = "clk-stfe-frc1",
316 "clk-tsout-0",
317 "clk-tsout-1",
318 "clk-mchi",
319 "clk-vsens-compo",
320 "clk-frc1-remote",
321 "clk-lpc-0",
322 "clk-lpc-1";
323 };
324 };
38 }; 325 };
39}; 326};
diff --git a/arch/arm/boot/dts/stih407.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
index 4f9024f19866..3e31d32133b8 100644
--- a/arch/arm/boot/dts/stih407.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -6,8 +6,8 @@
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation. 7 * publishhed by the Free Software Foundation.
8 */ 8 */
9#include "stih407-clock.dtsi"
10#include "stih407-pinctrl.dtsi" 9#include "stih407-pinctrl.dtsi"
10#include <dt-bindings/reset-controller/stih407-resets.h>
11/ { 11/ {
12 #address-cells = <1>; 12 #address-cells = <1>;
13 #size-cells = <1>; 13 #size-cells = <1>;
@@ -63,6 +63,21 @@
63 ranges; 63 ranges;
64 compatible = "simple-bus"; 64 compatible = "simple-bus";
65 65
66 powerdown: powerdown-controller {
67 compatible = "st,stih407-powerdown";
68 #reset-cells = <1>;
69 };
70
71 softreset: softreset-controller {
72 compatible = "st,stih407-softreset";
73 #reset-cells = <1>;
74 };
75
76 picophyreset: picophyreset-controller {
77 compatible = "st,stih407-picophyreset";
78 #reset-cells = <1>;
79 };
80
66 syscfg_sbc: sbc-syscfg@9620000 { 81 syscfg_sbc: sbc-syscfg@9620000 {
67 compatible = "st,stih407-sbc-syscfg", "syscon"; 82 compatible = "st,stih407-sbc-syscfg", "syscon";
68 reg = <0x9620000 0x1000>; 83 reg = <0x9620000 0x1000>;
@@ -104,7 +119,7 @@
104 interrupts = <GIC_SPI 122 IRQ_TYPE_NONE>; 119 interrupts = <GIC_SPI 122 IRQ_TYPE_NONE>;
105 pinctrl-names = "default"; 120 pinctrl-names = "default";
106 pinctrl-0 = <&pinctrl_serial0>; 121 pinctrl-0 = <&pinctrl_serial0>;
107 clocks = <&clk_ext2f_a9>; 122 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
108 123
109 status = "disabled"; 124 status = "disabled";
110 }; 125 };
@@ -115,7 +130,7 @@
115 interrupts = <GIC_SPI 123 IRQ_TYPE_NONE>; 130 interrupts = <GIC_SPI 123 IRQ_TYPE_NONE>;
116 pinctrl-names = "default"; 131 pinctrl-names = "default";
117 pinctrl-0 = <&pinctrl_serial1>; 132 pinctrl-0 = <&pinctrl_serial1>;
118 clocks = <&clk_ext2f_a9>; 133 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
119 134
120 status = "disabled"; 135 status = "disabled";
121 }; 136 };
@@ -126,7 +141,7 @@
126 interrupts = <GIC_SPI 124 IRQ_TYPE_NONE>; 141 interrupts = <GIC_SPI 124 IRQ_TYPE_NONE>;
127 pinctrl-names = "default"; 142 pinctrl-names = "default";
128 pinctrl-0 = <&pinctrl_serial2>; 143 pinctrl-0 = <&pinctrl_serial2>;
129 clocks = <&clk_ext2f_a9>; 144 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
130 145
131 status = "disabled"; 146 status = "disabled";
132 }; 147 };
@@ -158,7 +173,7 @@
158 compatible = "st,comms-ssc4-i2c"; 173 compatible = "st,comms-ssc4-i2c";
159 interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>; 174 interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
160 reg = <0x9840000 0x110>; 175 reg = <0x9840000 0x110>;
161 clocks = <&clk_ext2f_a9>; 176 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
162 clock-names = "ssc"; 177 clock-names = "ssc";
163 clock-frequency = <400000>; 178 clock-frequency = <400000>;
164 pinctrl-names = "default"; 179 pinctrl-names = "default";
@@ -171,7 +186,7 @@
171 compatible = "st,comms-ssc4-i2c"; 186 compatible = "st,comms-ssc4-i2c";
172 reg = <0x9841000 0x110>; 187 reg = <0x9841000 0x110>;
173 interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>; 188 interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
174 clocks = <&clk_ext2f_a9>; 189 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
175 clock-names = "ssc"; 190 clock-names = "ssc";
176 clock-frequency = <400000>; 191 clock-frequency = <400000>;
177 pinctrl-names = "default"; 192 pinctrl-names = "default";
@@ -184,7 +199,7 @@
184 compatible = "st,comms-ssc4-i2c"; 199 compatible = "st,comms-ssc4-i2c";
185 reg = <0x9842000 0x110>; 200 reg = <0x9842000 0x110>;
186 interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>; 201 interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
187 clocks = <&clk_ext2f_a9>; 202 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
188 clock-names = "ssc"; 203 clock-names = "ssc";
189 clock-frequency = <400000>; 204 clock-frequency = <400000>;
190 pinctrl-names = "default"; 205 pinctrl-names = "default";
@@ -197,7 +212,7 @@
197 compatible = "st,comms-ssc4-i2c"; 212 compatible = "st,comms-ssc4-i2c";
198 reg = <0x9843000 0x110>; 213 reg = <0x9843000 0x110>;
199 interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>; 214 interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
200 clocks = <&clk_ext2f_a9>; 215 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
201 clock-names = "ssc"; 216 clock-names = "ssc";
202 clock-frequency = <400000>; 217 clock-frequency = <400000>;
203 pinctrl-names = "default"; 218 pinctrl-names = "default";
@@ -210,7 +225,7 @@
210 compatible = "st,comms-ssc4-i2c"; 225 compatible = "st,comms-ssc4-i2c";
211 reg = <0x9844000 0x110>; 226 reg = <0x9844000 0x110>;
212 interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>; 227 interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
213 clocks = <&clk_ext2f_a9>; 228 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
214 clock-names = "ssc"; 229 clock-names = "ssc";
215 clock-frequency = <400000>; 230 clock-frequency = <400000>;
216 pinctrl-names = "default"; 231 pinctrl-names = "default";
@@ -223,7 +238,7 @@
223 compatible = "st,comms-ssc4-i2c"; 238 compatible = "st,comms-ssc4-i2c";
224 reg = <0x9845000 0x110>; 239 reg = <0x9845000 0x110>;
225 interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>; 240 interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
226 clocks = <&clk_ext2f_a9>; 241 clocks = <&clk_s_c0_flexgen CLK_EXT2F_A9>;
227 clock-names = "ssc"; 242 clock-names = "ssc";
228 clock-frequency = <400000>; 243 clock-frequency = <400000>;
229 pinctrl-names = "default"; 244 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/stih410-b2120.dts b/arch/arm/boot/dts/stih410-b2120.dts
new file mode 100644
index 000000000000..2f61a9960dee
--- /dev/null
+++ b/arch/arm/boot/dts/stih410-b2120.dts
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2014 STMicroelectronics (R&D) Limited.
3 * Author: Peter Griffin <peter.griffin@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 * published by the Free Software Foundation.
8 */
9/dts-v1/;
10#include "stih410.dtsi"
11#include "stihxxx-b2120.dtsi"
12/ {
13 model = "STiH410 B2120";
14 compatible = "st,stih410-b2120", "st,stih410";
15
16 chosen {
17 bootargs = "console=ttyAS0,115200 clk_ignore_unused";
18 linux,stdout-path = &sbc_serial0;
19 };
20
21 memory {
22 device_type = "memory";
23 reg = <0x40000000 0x80000000>;
24 };
25
26 aliases {
27 ttyAS0 = &sbc_serial0;
28 };
29};
diff --git a/arch/arm/boot/dts/stih410-clock.dtsi b/arch/arm/boot/dts/stih410-clock.dtsi
new file mode 100644
index 000000000000..6b5803a30096
--- /dev/null
+++ b/arch/arm/boot/dts/stih410-clock.dtsi
@@ -0,0 +1,338 @@
1/*
2 * Copyright (C) 2014 STMicroelectronics R&D Limited
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#include <dt-bindings/clock/stih410-clks.h>
9/ {
10 clocks {
11 #address-cells = <1>;
12 #size-cells = <1>;
13 ranges;
14
15 compatible = "st,stih410-clk", "simple-bus";
16
17 /*
18 * Fixed 30MHz oscillator inputs to SoC
19 */
20 clk_sysin: clk-sysin {
21 #clock-cells = <0>;
22 compatible = "fixed-clock";
23 clock-frequency = <30000000>;
24 clock-output-names = "CLK_SYSIN";
25 };
26
27 /*
28 * ARM Peripheral clock for timers
29 */
30 arm_periph_clk: clk-m-a9-periphs {
31 #clock-cells = <0>;
32 compatible = "fixed-factor-clock";
33 clocks = <&clk_m_a9>;
34 clock-div = <2>;
35 clock-mult = <1>;
36 };
37
38 /*
39 * A9 PLL.
40 */
41 clockgen-a9@92b0000 {
42 compatible = "st,clkgen-c32";
43 reg = <0x92b0000 0xffff>;
44
45 clockgen_a9_pll: clockgen-a9-pll {
46 #clock-cells = <1>;
47 compatible = "st,stih407-plls-c32-a9", "st,clkgen-plls-c32";
48
49 clocks = <&clk_sysin>;
50
51 clock-output-names = "clockgen-a9-pll-odf";
52 };
53 };
54
55 /*
56 * ARM CPU related clocks.
57 */
58 clk_m_a9: clk-m-a9@92b0000 {
59 #clock-cells = <0>;
60 compatible = "st,stih407-clkgen-a9-mux", "st,clkgen-mux";
61 reg = <0x92b0000 0x10000>;
62
63 clocks = <&clockgen_a9_pll 0>,
64 <&clockgen_a9_pll 0>,
65 <&clk_s_c0_flexgen 13>,
66 <&clk_m_a9_ext2f_div2>;
67 };
68
69 /*
70 * ARM Peripheral clock for timers
71 */
72 clk_m_a9_ext2f_div2: clk-m-a9-ext2f-div2s {
73 #clock-cells = <0>;
74 compatible = "fixed-factor-clock";
75
76 clocks = <&clk_s_c0_flexgen 13>;
77
78 clock-output-names = "clk-m-a9-ext2f-div2";
79
80 clock-div = <2>;
81 clock-mult = <1>;
82 };
83
84 /*
85 * Bootloader initialized system infrastructure clock for
86 * serial devices.
87 */
88 clk_ext2f_a9: clockgen-c0@13 {
89 #clock-cells = <0>;
90 compatible = "fixed-clock";
91 clock-frequency = <200000000>;
92 clock-output-names = "clk-s-icn-reg-0";
93 };
94
95 clockgen-a@090ff000 {
96 compatible = "st,clkgen-c32";
97 reg = <0x90ff000 0x1000>;
98
99 clk_s_a0_pll: clk-s-a0-pll {
100 #clock-cells = <1>;
101 compatible = "st,stih407-plls-c32-a0", "st,clkgen-plls-c32";
102
103 clocks = <&clk_sysin>;
104
105 clock-output-names = "clk-s-a0-pll-ofd-0";
106 };
107
108 clk_s_a0_flexgen: clk-s-a0-flexgen {
109 compatible = "st,flexgen";
110
111 #clock-cells = <1>;
112
113 clocks = <&clk_s_a0_pll 0>,
114 <&clk_sysin>;
115
116 clock-output-names = "clk-ic-lmi0",
117 "clk-ic-lmi1";
118 };
119 };
120
121 clk_s_c0_quadfs: clk-s-c0-quadfs@9103000 {
122 #clock-cells = <1>;
123 compatible = "st,stih407-quadfs660-C", "st,quadfs";
124 reg = <0x9103000 0x1000>;
125
126 clocks = <&clk_sysin>;
127
128 clock-output-names = "clk-s-c0-fs0-ch0",
129 "clk-s-c0-fs0-ch1",
130 "clk-s-c0-fs0-ch2",
131 "clk-s-c0-fs0-ch3";
132 };
133
134 clk_s_c0: clockgen-c@09103000 {
135 compatible = "st,clkgen-c32";
136 reg = <0x9103000 0x1000>;
137
138 clk_s_c0_pll0: clk-s-c0-pll0 {
139 #clock-cells = <1>;
140 compatible = "st,stih407-plls-c32-c0_0", "st,clkgen-plls-c32";
141
142 clocks = <&clk_sysin>;
143
144 clock-output-names = "clk-s-c0-pll0-odf-0";
145 };
146
147 clk_s_c0_pll1: clk-s-c0-pll1 {
148 #clock-cells = <1>;
149 compatible = "st,stih407-plls-c32-c0_1", "st,clkgen-plls-c32";
150
151 clocks = <&clk_sysin>;
152
153 clock-output-names = "clk-s-c0-pll1-odf-0";
154 };
155
156 clk_s_c0_flexgen: clk-s-c0-flexgen {
157 #clock-cells = <1>;
158 compatible = "st,flexgen";
159
160 clocks = <&clk_s_c0_pll0 0>,
161 <&clk_s_c0_pll1 0>,
162 <&clk_s_c0_quadfs 0>,
163 <&clk_s_c0_quadfs 1>,
164 <&clk_s_c0_quadfs 2>,
165 <&clk_s_c0_quadfs 3>,
166 <&clk_sysin>;
167
168 clock-output-names = "clk-icn-gpu",
169 "clk-fdma",
170 "clk-nand",
171 "clk-hva",
172 "clk-proc-stfe",
173 "clk-proc-tp",
174 "clk-rx-icn-dmu",
175 "clk-rx-icn-hva",
176 "clk-icn-cpu",
177 "clk-tx-icn-dmu",
178 "clk-mmc-0",
179 "clk-mmc-1",
180 "clk-jpegdec",
181 "clk-ext2fa9",
182 "clk-ic-bdisp-0",
183 "clk-ic-bdisp-1",
184 "clk-pp-dmu",
185 "clk-vid-dmu",
186 "clk-dss-lpc",
187 "clk-st231-aud-0",
188 "clk-st231-gp-1",
189 "clk-st231-dmu",
190 "clk-icn-lmi",
191 "clk-tx-icn-disp-1",
192 "clk-icn-sbc",
193 "clk-stfe-frc2",
194 "clk-eth-phy",
195 "clk-eth-ref-phyclk",
196 "clk-flash-promip",
197 "clk-main-disp",
198 "clk-aux-disp",
199 "clk-compo-dvp",
200 "clk-tx-icn-hades",
201 "clk-rx-icn-hades",
202 "clk-icn-reg-16",
203 "clk-pp-hades",
204 "clk-clust-hades",
205 "clk-hwpe-hades",
206 "clk-fc-hades";
207 };
208 };
209
210 clk_s_d0_quadfs: clk-s-d0-quadfs@9104000 {
211 #clock-cells = <1>;
212 compatible = "st,stih407-quadfs660-D", "st,quadfs";
213 reg = <0x9104000 0x1000>;
214
215 clocks = <&clk_sysin>;
216
217 clock-output-names = "clk-s-d0-fs0-ch0",
218 "clk-s-d0-fs0-ch1",
219 "clk-s-d0-fs0-ch2",
220 "clk-s-d0-fs0-ch3";
221 };
222
223 clockgen-d0@09104000 {
224 compatible = "st,clkgen-c32";
225 reg = <0x9104000 0x1000>;
226
227 clk_s_d0_flexgen: clk-s-d0-flexgen {
228 #clock-cells = <1>;
229 compatible = "st,flexgen";
230
231 clocks = <&clk_s_d0_quadfs 0>,
232 <&clk_s_d0_quadfs 1>,
233 <&clk_s_d0_quadfs 2>,
234 <&clk_s_d0_quadfs 3>,
235 <&clk_sysin>;
236
237 clock-output-names = "clk-pcm-0",
238 "clk-pcm-1",
239 "clk-pcm-2",
240 "clk-spdiff",
241 "clk-pcmr10-master",
242 "clk-usb2-phy";
243 };
244 };
245
246 clk_s_d2_quadfs: clk-s-d2-quadfs@9106000 {
247 #clock-cells = <1>;
248 compatible = "st,stih407-quadfs660-D", "st,quadfs";
249 reg = <0x9106000 0x1000>;
250
251 clocks = <&clk_sysin>;
252
253 clock-output-names = "clk-s-d2-fs0-ch0",
254 "clk-s-d2-fs0-ch1",
255 "clk-s-d2-fs0-ch2",
256 "clk-s-d2-fs0-ch3";
257 };
258
259 clk_tmdsout_hdmi: clk-tmdsout-hdmi {
260 #clock-cells = <0>;
261 compatible = "fixed-clock";
262 clock-frequency = <0>;
263 };
264
265 clockgen-d2@x9106000 {
266 compatible = "st,clkgen-c32";
267 reg = <0x9106000 0x1000>;
268
269 clk_s_d2_flexgen: clk-s-d2-flexgen {
270 #clock-cells = <1>;
271 compatible = "st,flexgen";
272
273 clocks = <&clk_s_d2_quadfs 0>,
274 <&clk_s_d2_quadfs 1>,
275 <&clk_s_d2_quadfs 2>,
276 <&clk_s_d2_quadfs 3>,
277 <&clk_sysin>,
278 <&clk_sysin>,
279 <&clk_tmdsout_hdmi>;
280
281 clock-output-names = "clk-pix-main-disp",
282 "clk-pix-pip",
283 "clk-pix-gdp1",
284 "clk-pix-gdp2",
285 "clk-pix-gdp3",
286 "clk-pix-gdp4",
287 "clk-pix-aux-disp",
288 "clk-denc",
289 "clk-pix-hddac",
290 "clk-hddac",
291 "clk-sddac",
292 "clk-pix-dvo",
293 "clk-dvo",
294 "clk-pix-hdmi",
295 "clk-tmds-hdmi",
296 "clk-ref-hdmiphy";
297 };
298 };
299
300 clk_s_d3_quadfs: clk-s-d3-quadfs@9107000 {
301 #clock-cells = <1>;
302 compatible = "st,stih407-quadfs660-D", "st,quadfs";
303 reg = <0x9107000 0x1000>;
304
305 clocks = <&clk_sysin>;
306
307 clock-output-names = "clk-s-d3-fs0-ch0",
308 "clk-s-d3-fs0-ch1",
309 "clk-s-d3-fs0-ch2",
310 "clk-s-d3-fs0-ch3";
311 };
312
313 clockgen-d3@9107000 {
314 compatible = "st,clkgen-c32";
315 reg = <0x9107000 0x1000>;
316
317 clk_s_d3_flexgen: clk-s-d3-flexgen {
318 #clock-cells = <1>;
319 compatible = "st,flexgen";
320
321 clocks = <&clk_s_d3_quadfs 0>,
322 <&clk_s_d3_quadfs 1>,
323 <&clk_s_d3_quadfs 2>,
324 <&clk_s_d3_quadfs 3>,
325 <&clk_sysin>;
326
327 clock-output-names = "clk-stfe-frc1",
328 "clk-tsout-0",
329 "clk-tsout-1",
330 "clk-mchi",
331 "clk-vsens-compo",
332 "clk-frc1-remote",
333 "clk-lpc-0",
334 "clk-lpc-1";
335 };
336 };
337 };
338};
diff --git a/arch/arm/boot/dts/stih410-pinctrl.dtsi b/arch/arm/boot/dts/stih410-pinctrl.dtsi
new file mode 100644
index 000000000000..b3e9dfc81c07
--- /dev/null
+++ b/arch/arm/boot/dts/stih410-pinctrl.dtsi
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2014 STMicroelectronics Limited.
3 * Author: Peter Griffin <peter.griffin@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#include "st-pincfg.h"
10/ {
11
12 soc {
13 pin-controller-rear {
14
15 usb0 {
16 pinctrl_usb0: usb2-0 {
17 st,pins {
18 usb-oc-detect = <&pio35 0 ALT1 IN>;
19 usb-pwr-enable = <&pio35 1 ALT1 OUT>;
20 };
21 };
22 };
23
24 usb1 {
25 pinctrl_usb1: usb2-1 {
26 st,pins {
27 usb-oc-detect = <&pio35 2 ALT1 IN>;
28 usb-pwr-enable = <&pio35 3 ALT1 OUT>;
29 };
30 };
31 };
32 };
33 };
34};
diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi
new file mode 100644
index 000000000000..c05627eb717d
--- /dev/null
+++ b/arch/arm/boot/dts/stih410.dtsi
@@ -0,0 +1,14 @@
1/*
2 * Copyright (C) 2014 STMicroelectronics Limited.
3 * Author: Peter Griffin <peter.griffin@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#include "stih410-clock.dtsi"
10#include "stih407-family.dtsi"
11#include "stih410-pinctrl.dtsi"
12/ {
13
14};
diff --git a/arch/arm/boot/dts/stih415-pinctrl.dtsi b/arch/arm/boot/dts/stih415-pinctrl.dtsi
index 8509a037ae21..3791ad95dbaf 100644
--- a/arch/arm/boot/dts/stih415-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih415-pinctrl.dtsi
@@ -11,33 +11,33 @@
11/ { 11/ {
12 12
13 aliases { 13 aliases {
14 gpio0 = &PIO0; 14 gpio0 = &pio0;
15 gpio1 = &PIO1; 15 gpio1 = &pio1;
16 gpio2 = &PIO2; 16 gpio2 = &pio2;
17 gpio3 = &PIO3; 17 gpio3 = &pio3;
18 gpio4 = &PIO4; 18 gpio4 = &pio4;
19 gpio5 = &PIO5; 19 gpio5 = &pio5;
20 gpio6 = &PIO6; 20 gpio6 = &pio6;
21 gpio7 = &PIO7; 21 gpio7 = &pio7;
22 gpio8 = &PIO8; 22 gpio8 = &pio8;
23 gpio9 = &PIO9; 23 gpio9 = &pio9;
24 gpio10 = &PIO10; 24 gpio10 = &pio10;
25 gpio11 = &PIO11; 25 gpio11 = &pio11;
26 gpio12 = &PIO12; 26 gpio12 = &pio12;
27 gpio13 = &PIO13; 27 gpio13 = &pio13;
28 gpio14 = &PIO14; 28 gpio14 = &pio14;
29 gpio15 = &PIO15; 29 gpio15 = &pio15;
30 gpio16 = &PIO16; 30 gpio16 = &pio16;
31 gpio17 = &PIO17; 31 gpio17 = &pio17;
32 gpio18 = &PIO18; 32 gpio18 = &pio18;
33 gpio19 = &PIO100; 33 gpio19 = &pio100;
34 gpio20 = &PIO101; 34 gpio20 = &pio101;
35 gpio21 = &PIO102; 35 gpio21 = &pio102;
36 gpio22 = &PIO103; 36 gpio22 = &pio103;
37 gpio23 = &PIO104; 37 gpio23 = &pio104;
38 gpio24 = &PIO105; 38 gpio24 = &pio105;
39 gpio25 = &PIO106; 39 gpio25 = &pio106;
40 gpio26 = &PIO107; 40 gpio26 = &pio107;
41 }; 41 };
42 42
43 soc { 43 soc {
@@ -52,7 +52,7 @@
52 interrupt-names = "irqmux"; 52 interrupt-names = "irqmux";
53 ranges = <0 0xfe610000 0x5000>; 53 ranges = <0 0xfe610000 0x5000>;
54 54
55 PIO0: gpio@fe610000 { 55 pio0: gpio@fe610000 {
56 gpio-controller; 56 gpio-controller;
57 #gpio-cells = <1>; 57 #gpio-cells = <1>;
58 interrupt-controller; 58 interrupt-controller;
@@ -60,7 +60,7 @@
60 reg = <0 0x100>; 60 reg = <0 0x100>;
61 st,bank-name = "PIO0"; 61 st,bank-name = "PIO0";
62 }; 62 };
63 PIO1: gpio@fe611000 { 63 pio1: gpio@fe611000 {
64 gpio-controller; 64 gpio-controller;
65 #gpio-cells = <1>; 65 #gpio-cells = <1>;
66 interrupt-controller; 66 interrupt-controller;
@@ -68,7 +68,7 @@
68 reg = <0x1000 0x100>; 68 reg = <0x1000 0x100>;
69 st,bank-name = "PIO1"; 69 st,bank-name = "PIO1";
70 }; 70 };
71 PIO2: gpio@fe612000 { 71 pio2: gpio@fe612000 {
72 gpio-controller; 72 gpio-controller;
73 #gpio-cells = <1>; 73 #gpio-cells = <1>;
74 interrupt-controller; 74 interrupt-controller;
@@ -76,7 +76,7 @@
76 reg = <0x2000 0x100>; 76 reg = <0x2000 0x100>;
77 st,bank-name = "PIO2"; 77 st,bank-name = "PIO2";
78 }; 78 };
79 PIO3: gpio@fe613000 { 79 pio3: gpio@fe613000 {
80 gpio-controller; 80 gpio-controller;
81 #gpio-cells = <1>; 81 #gpio-cells = <1>;
82 interrupt-controller; 82 interrupt-controller;
@@ -84,7 +84,7 @@
84 reg = <0x3000 0x100>; 84 reg = <0x3000 0x100>;
85 st,bank-name = "PIO3"; 85 st,bank-name = "PIO3";
86 }; 86 };
87 PIO4: gpio@fe614000 { 87 pio4: gpio@fe614000 {
88 gpio-controller; 88 gpio-controller;
89 #gpio-cells = <1>; 89 #gpio-cells = <1>;
90 interrupt-controller; 90 interrupt-controller;
@@ -96,8 +96,8 @@
96 sbc_serial1 { 96 sbc_serial1 {
97 pinctrl_sbc_serial1:sbc_serial1 { 97 pinctrl_sbc_serial1:sbc_serial1 {
98 st,pins { 98 st,pins {
99 tx = <&PIO2 6 ALT3 OUT>; 99 tx = <&pio2 6 ALT3 OUT>;
100 rx = <&PIO2 7 ALT3 IN>; 100 rx = <&pio2 7 ALT3 IN>;
101 }; 101 };
102 }; 102 };
103 }; 103 };
@@ -105,15 +105,15 @@
105 keyscan { 105 keyscan {
106 pinctrl_keyscan: keyscan { 106 pinctrl_keyscan: keyscan {
107 st,pins { 107 st,pins {
108 keyin0 = <&PIO0 2 ALT2 IN>; 108 keyin0 = <&pio0 2 ALT2 IN>;
109 keyin1 = <&PIO0 3 ALT2 IN>; 109 keyin1 = <&pio0 3 ALT2 IN>;
110 keyin2 = <&PIO0 4 ALT2 IN>; 110 keyin2 = <&pio0 4 ALT2 IN>;
111 keyin3 = <&PIO2 6 ALT2 IN>; 111 keyin3 = <&pio2 6 ALT2 IN>;
112 112
113 keyout0 = <&PIO1 6 ALT2 OUT>; 113 keyout0 = <&pio1 6 ALT2 OUT>;
114 keyout1 = <&PIO1 7 ALT2 OUT>; 114 keyout1 = <&pio1 7 ALT2 OUT>;
115 keyout2 = <&PIO0 6 ALT2 OUT>; 115 keyout2 = <&pio0 6 ALT2 OUT>;
116 keyout3 = <&PIO2 7 ALT2 OUT>; 116 keyout3 = <&pio2 7 ALT2 OUT>;
117 }; 117 };
118 }; 118 };
119 }; 119 };
@@ -121,8 +121,8 @@
121 sbc_i2c0 { 121 sbc_i2c0 {
122 pinctrl_sbc_i2c0_default: sbc_i2c0-default { 122 pinctrl_sbc_i2c0_default: sbc_i2c0-default {
123 st,pins { 123 st,pins {
124 sda = <&PIO4 6 ALT1 BIDIR>; 124 sda = <&pio4 6 ALT1 BIDIR>;
125 scl = <&PIO4 5 ALT1 BIDIR>; 125 scl = <&pio4 5 ALT1 BIDIR>;
126 }; 126 };
127 }; 127 };
128 }; 128 };
@@ -130,8 +130,8 @@
130 sbc_i2c1 { 130 sbc_i2c1 {
131 pinctrl_sbc_i2c1_default: sbc_i2c1-default { 131 pinctrl_sbc_i2c1_default: sbc_i2c1-default {
132 st,pins { 132 st,pins {
133 sda = <&PIO3 2 ALT2 BIDIR>; 133 sda = <&pio3 2 ALT2 BIDIR>;
134 scl = <&PIO3 1 ALT2 BIDIR>; 134 scl = <&pio3 1 ALT2 BIDIR>;
135 }; 135 };
136 }; 136 };
137 }; 137 };
@@ -139,7 +139,7 @@
139 rc{ 139 rc{
140 pinctrl_ir: ir0 { 140 pinctrl_ir: ir0 {
141 st,pins { 141 st,pins {
142 ir = <&PIO4 0 ALT2 IN>; 142 ir = <&pio4 0 ALT2 IN>;
143 }; 143 };
144 }; 144 };
145 }; 145 };
@@ -147,49 +147,49 @@
147 gmac1 { 147 gmac1 {
148 pinctrl_mii1: mii1 { 148 pinctrl_mii1: mii1 {
149 st,pins { 149 st,pins {
150 txd0 = <&PIO0 0 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 150 txd0 = <&pio0 0 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
151 txd1 = <&PIO0 1 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 151 txd1 = <&pio0 1 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
152 txd2 = <&PIO0 2 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 152 txd2 = <&pio0 2 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
153 txd3 = <&PIO0 3 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 153 txd3 = <&pio0 3 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
154 txer = <&PIO0 4 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 154 txer = <&pio0 4 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
155 txen = <&PIO0 5 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 155 txen = <&pio0 5 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
156 txclk = <&PIO0 6 ALT1 IN NICLK 0 CLK_A>; 156 txclk = <&pio0 6 ALT1 IN NICLK 0 CLK_A>;
157 col = <&PIO0 7 ALT1 IN BYPASS 1000>; 157 col = <&pio0 7 ALT1 IN BYPASS 1000>;
158 mdio = <&PIO1 0 ALT1 OUT BYPASS 0>; 158 mdio = <&pio1 0 ALT1 OUT BYPASS 0>;
159 mdc = <&PIO1 1 ALT1 OUT NICLK 0 CLK_A>; 159 mdc = <&pio1 1 ALT1 OUT NICLK 0 CLK_A>;
160 crs = <&PIO1 2 ALT1 IN BYPASS 1000>; 160 crs = <&pio1 2 ALT1 IN BYPASS 1000>;
161 mdint = <&PIO1 3 ALT1 IN BYPASS 0>; 161 mdint = <&pio1 3 ALT1 IN BYPASS 0>;
162 rxd0 = <&PIO1 4 ALT1 IN SE_NICLK_IO 0 CLK_A>; 162 rxd0 = <&pio1 4 ALT1 IN SE_NICLK_IO 0 CLK_A>;
163 rxd1 = <&PIO1 5 ALT1 IN SE_NICLK_IO 0 CLK_A>; 163 rxd1 = <&pio1 5 ALT1 IN SE_NICLK_IO 0 CLK_A>;
164 rxd2 = <&PIO1 6 ALT1 IN SE_NICLK_IO 0 CLK_A>; 164 rxd2 = <&pio1 6 ALT1 IN SE_NICLK_IO 0 CLK_A>;
165 rxd3 = <&PIO1 7 ALT1 IN SE_NICLK_IO 0 CLK_A>; 165 rxd3 = <&pio1 7 ALT1 IN SE_NICLK_IO 0 CLK_A>;
166 rxdv = <&PIO2 0 ALT1 IN SE_NICLK_IO 0 CLK_A>; 166 rxdv = <&pio2 0 ALT1 IN SE_NICLK_IO 0 CLK_A>;
167 rx_er = <&PIO2 1 ALT1 IN SE_NICLK_IO 0 CLK_A>; 167 rx_er = <&pio2 1 ALT1 IN SE_NICLK_IO 0 CLK_A>;
168 rxclk = <&PIO2 2 ALT1 IN NICLK 0 CLK_A>; 168 rxclk = <&pio2 2 ALT1 IN NICLK 0 CLK_A>;
169 phyclk = <&PIO2 3 ALT1 IN NICLK 1000 CLK_A>; 169 phyclk = <&pio2 3 ALT1 IN NICLK 1000 CLK_A>;
170 }; 170 };
171 }; 171 };
172 172
173 pinctrl_rgmii1: rgmii1-0 { 173 pinctrl_rgmii1: rgmii1-0 {
174 st,pins { 174 st,pins {
175 txd0 = <&PIO0 0 ALT1 OUT DE_IO 1000 CLK_A>; 175 txd0 = <&pio0 0 ALT1 OUT DE_IO 1000 CLK_A>;
176 txd1 = <&PIO0 1 ALT1 OUT DE_IO 1000 CLK_A>; 176 txd1 = <&pio0 1 ALT1 OUT DE_IO 1000 CLK_A>;
177 txd2 = <&PIO0 2 ALT1 OUT DE_IO 1000 CLK_A>; 177 txd2 = <&pio0 2 ALT1 OUT DE_IO 1000 CLK_A>;
178 txd3 = <&PIO0 3 ALT1 OUT DE_IO 1000 CLK_A>; 178 txd3 = <&pio0 3 ALT1 OUT DE_IO 1000 CLK_A>;
179 txen = <&PIO0 5 ALT1 OUT DE_IO 0 CLK_A>; 179 txen = <&pio0 5 ALT1 OUT DE_IO 0 CLK_A>;
180 txclk = <&PIO0 6 ALT1 IN NICLK 0 CLK_A>; 180 txclk = <&pio0 6 ALT1 IN NICLK 0 CLK_A>;
181 mdio = <&PIO1 0 ALT1 OUT BYPASS 0>; 181 mdio = <&pio1 0 ALT1 OUT BYPASS 0>;
182 mdc = <&PIO1 1 ALT1 OUT NICLK 0 CLK_A>; 182 mdc = <&pio1 1 ALT1 OUT NICLK 0 CLK_A>;
183 rxd0 = <&PIO1 4 ALT1 IN DE_IO 0 CLK_A>; 183 rxd0 = <&pio1 4 ALT1 IN DE_IO 0 CLK_A>;
184 rxd1 = <&PIO1 5 ALT1 IN DE_IO 0 CLK_A>; 184 rxd1 = <&pio1 5 ALT1 IN DE_IO 0 CLK_A>;
185 rxd2 = <&PIO1 6 ALT1 IN DE_IO 0 CLK_A>; 185 rxd2 = <&pio1 6 ALT1 IN DE_IO 0 CLK_A>;
186 rxd3 = <&PIO1 7 ALT1 IN DE_IO 0 CLK_A>; 186 rxd3 = <&pio1 7 ALT1 IN DE_IO 0 CLK_A>;
187 187
188 rxdv = <&PIO2 0 ALT1 IN DE_IO 500 CLK_A>; 188 rxdv = <&pio2 0 ALT1 IN DE_IO 500 CLK_A>;
189 rxclk = <&PIO2 2 ALT1 IN NICLK 0 CLK_A>; 189 rxclk = <&pio2 2 ALT1 IN NICLK 0 CLK_A>;
190 phyclk = <&PIO2 3 ALT4 OUT NICLK 0 CLK_B>; 190 phyclk = <&pio2 3 ALT4 OUT NICLK 0 CLK_B>;
191 191
192 clk125= <&PIO3 7 ALT4 IN NICLK 0 CLK_A>; 192 clk125= <&pio3 7 ALT4 IN NICLK 0 CLK_A>;
193 }; 193 };
194 }; 194 };
195 }; 195 };
@@ -206,7 +206,7 @@
206 interrupt-names = "irqmux"; 206 interrupt-names = "irqmux";
207 ranges = <0 0xfee00000 0x8000>; 207 ranges = <0 0xfee00000 0x8000>;
208 208
209 PIO5: gpio@fee00000 { 209 pio5: gpio@fee00000 {
210 gpio-controller; 210 gpio-controller;
211 #gpio-cells = <1>; 211 #gpio-cells = <1>;
212 interrupt-controller; 212 interrupt-controller;
@@ -214,7 +214,7 @@
214 reg = <0 0x100>; 214 reg = <0 0x100>;
215 st,bank-name = "PIO5"; 215 st,bank-name = "PIO5";
216 }; 216 };
217 PIO6: gpio@fee01000 { 217 pio6: gpio@fee01000 {
218 gpio-controller; 218 gpio-controller;
219 #gpio-cells = <1>; 219 #gpio-cells = <1>;
220 interrupt-controller; 220 interrupt-controller;
@@ -222,7 +222,7 @@
222 reg = <0x1000 0x100>; 222 reg = <0x1000 0x100>;
223 st,bank-name = "PIO6"; 223 st,bank-name = "PIO6";
224 }; 224 };
225 PIO7: gpio@fee02000 { 225 pio7: gpio@fee02000 {
226 gpio-controller; 226 gpio-controller;
227 #gpio-cells = <1>; 227 #gpio-cells = <1>;
228 interrupt-controller; 228 interrupt-controller;
@@ -230,7 +230,7 @@
230 reg = <0x2000 0x100>; 230 reg = <0x2000 0x100>;
231 st,bank-name = "PIO7"; 231 st,bank-name = "PIO7";
232 }; 232 };
233 PIO8: gpio@fee03000 { 233 pio8: gpio@fee03000 {
234 gpio-controller; 234 gpio-controller;
235 #gpio-cells = <1>; 235 #gpio-cells = <1>;
236 interrupt-controller; 236 interrupt-controller;
@@ -238,7 +238,7 @@
238 reg = <0x3000 0x100>; 238 reg = <0x3000 0x100>;
239 st,bank-name = "PIO8"; 239 st,bank-name = "PIO8";
240 }; 240 };
241 PIO9: gpio@fee04000 { 241 pio9: gpio@fee04000 {
242 gpio-controller; 242 gpio-controller;
243 #gpio-cells = <1>; 243 #gpio-cells = <1>;
244 interrupt-controller; 244 interrupt-controller;
@@ -246,7 +246,7 @@
246 reg = <0x4000 0x100>; 246 reg = <0x4000 0x100>;
247 st,bank-name = "PIO9"; 247 st,bank-name = "PIO9";
248 }; 248 };
249 PIO10: gpio@fee05000 { 249 pio10: gpio@fee05000 {
250 gpio-controller; 250 gpio-controller;
251 #gpio-cells = <1>; 251 #gpio-cells = <1>;
252 interrupt-controller; 252 interrupt-controller;
@@ -254,7 +254,7 @@
254 reg = <0x5000 0x100>; 254 reg = <0x5000 0x100>;
255 st,bank-name = "PIO10"; 255 st,bank-name = "PIO10";
256 }; 256 };
257 PIO11: gpio@fee06000 { 257 pio11: gpio@fee06000 {
258 gpio-controller; 258 gpio-controller;
259 #gpio-cells = <1>; 259 #gpio-cells = <1>;
260 interrupt-controller; 260 interrupt-controller;
@@ -262,7 +262,7 @@
262 reg = <0x6000 0x100>; 262 reg = <0x6000 0x100>;
263 st,bank-name = "PIO11"; 263 st,bank-name = "PIO11";
264 }; 264 };
265 PIO12: gpio@fee07000 { 265 pio12: gpio@fee07000 {
266 gpio-controller; 266 gpio-controller;
267 #gpio-cells = <1>; 267 #gpio-cells = <1>;
268 interrupt-controller; 268 interrupt-controller;
@@ -274,8 +274,8 @@
274 i2c0 { 274 i2c0 {
275 pinctrl_i2c0_default: i2c0-default { 275 pinctrl_i2c0_default: i2c0-default {
276 st,pins { 276 st,pins {
277 sda = <&PIO9 3 ALT1 BIDIR>; 277 sda = <&pio9 3 ALT1 BIDIR>;
278 scl = <&PIO9 2 ALT1 BIDIR>; 278 scl = <&pio9 2 ALT1 BIDIR>;
279 }; 279 };
280 }; 280 };
281 }; 281 };
@@ -283,8 +283,8 @@
283 i2c1 { 283 i2c1 {
284 pinctrl_i2c1_default: i2c1-default { 284 pinctrl_i2c1_default: i2c1-default {
285 st,pins { 285 st,pins {
286 sda = <&PIO12 1 ALT1 BIDIR>; 286 sda = <&pio12 1 ALT1 BIDIR>;
287 scl = <&PIO12 0 ALT1 BIDIR>; 287 scl = <&pio12 0 ALT1 BIDIR>;
288 }; 288 };
289 }; 289 };
290 }; 290 };
@@ -301,7 +301,7 @@
301 interrupt-names = "irqmux"; 301 interrupt-names = "irqmux";
302 ranges = <0 0xfe820000 0x8000>; 302 ranges = <0 0xfe820000 0x8000>;
303 303
304 PIO13: gpio@fe820000 { 304 pio13: gpio@fe820000 {
305 gpio-controller; 305 gpio-controller;
306 #gpio-cells = <1>; 306 #gpio-cells = <1>;
307 interrupt-controller; 307 interrupt-controller;
@@ -309,7 +309,7 @@
309 reg = <0 0x100>; 309 reg = <0 0x100>;
310 st,bank-name = "PIO13"; 310 st,bank-name = "PIO13";
311 }; 311 };
312 PIO14: gpio@fe821000 { 312 pio14: gpio@fe821000 {
313 gpio-controller; 313 gpio-controller;
314 #gpio-cells = <1>; 314 #gpio-cells = <1>;
315 interrupt-controller; 315 interrupt-controller;
@@ -317,7 +317,7 @@
317 reg = <0x1000 0x100>; 317 reg = <0x1000 0x100>;
318 st,bank-name = "PIO14"; 318 st,bank-name = "PIO14";
319 }; 319 };
320 PIO15: gpio@fe822000 { 320 pio15: gpio@fe822000 {
321 gpio-controller; 321 gpio-controller;
322 #gpio-cells = <1>; 322 #gpio-cells = <1>;
323 interrupt-controller; 323 interrupt-controller;
@@ -325,7 +325,7 @@
325 reg = <0x2000 0x100>; 325 reg = <0x2000 0x100>;
326 st,bank-name = "PIO15"; 326 st,bank-name = "PIO15";
327 }; 327 };
328 PIO16: gpio@fe823000 { 328 pio16: gpio@fe823000 {
329 gpio-controller; 329 gpio-controller;
330 #gpio-cells = <1>; 330 #gpio-cells = <1>;
331 interrupt-controller; 331 interrupt-controller;
@@ -333,7 +333,7 @@
333 reg = <0x3000 0x100>; 333 reg = <0x3000 0x100>;
334 st,bank-name = "PIO16"; 334 st,bank-name = "PIO16";
335 }; 335 };
336 PIO17: gpio@fe824000 { 336 pio17: gpio@fe824000 {
337 gpio-controller; 337 gpio-controller;
338 #gpio-cells = <1>; 338 #gpio-cells = <1>;
339 interrupt-controller; 339 interrupt-controller;
@@ -341,7 +341,7 @@
341 reg = <0x4000 0x100>; 341 reg = <0x4000 0x100>;
342 st,bank-name = "PIO17"; 342 st,bank-name = "PIO17";
343 }; 343 };
344 PIO18: gpio@fe825000 { 344 pio18: gpio@fe825000 {
345 gpio-controller; 345 gpio-controller;
346 #gpio-cells = <1>; 346 #gpio-cells = <1>;
347 interrupt-controller; 347 interrupt-controller;
@@ -353,8 +353,8 @@
353 serial2 { 353 serial2 {
354 pinctrl_serial2: serial2-0 { 354 pinctrl_serial2: serial2-0 {
355 st,pins { 355 st,pins {
356 tx = <&PIO17 4 ALT2 OUT>; 356 tx = <&pio17 4 ALT2 OUT>;
357 rx = <&PIO17 5 ALT2 IN>; 357 rx = <&pio17 5 ALT2 IN>;
358 }; 358 };
359 }; 359 };
360 }; 360 };
@@ -362,73 +362,94 @@
362 gmac0{ 362 gmac0{
363 pinctrl_mii0: mii0 { 363 pinctrl_mii0: mii0 {
364 st,pins { 364 st,pins {
365 mdint = <&PIO13 6 ALT2 IN BYPASS 0>; 365 mdint = <&pio13 6 ALT2 IN BYPASS 0>;
366 txen = <&PIO13 7 ALT2 OUT SE_NICLK_IO 0 CLK_A>; 366 txen = <&pio13 7 ALT2 OUT SE_NICLK_IO 0 CLK_A>;
367 367
368 txd0 = <&PIO14 0 ALT2 OUT SE_NICLK_IO 0 CLK_A>; 368 txd0 = <&pio14 0 ALT2 OUT SE_NICLK_IO 0 CLK_A>;
369 txd1 = <&PIO14 1 ALT2 OUT SE_NICLK_IO 0 CLK_A>; 369 txd1 = <&pio14 1 ALT2 OUT SE_NICLK_IO 0 CLK_A>;
370 txd2 = <&PIO14 2 ALT2 OUT SE_NICLK_IO 0 CLK_B>; 370 txd2 = <&pio14 2 ALT2 OUT SE_NICLK_IO 0 CLK_B>;
371 txd3 = <&PIO14 3 ALT2 OUT SE_NICLK_IO 0 CLK_B>; 371 txd3 = <&pio14 3 ALT2 OUT SE_NICLK_IO 0 CLK_B>;
372 372
373 txclk = <&PIO15 0 ALT2 IN NICLK 0 CLK_A>; 373 txclk = <&pio15 0 ALT2 IN NICLK 0 CLK_A>;
374 txer = <&PIO15 1 ALT2 OUT SE_NICLK_IO 0 CLK_A>; 374 txer = <&pio15 1 ALT2 OUT SE_NICLK_IO 0 CLK_A>;
375 crs = <&PIO15 2 ALT2 IN BYPASS 1000>; 375 crs = <&pio15 2 ALT2 IN BYPASS 1000>;
376 col = <&PIO15 3 ALT2 IN BYPASS 1000>; 376 col = <&pio15 3 ALT2 IN BYPASS 1000>;
377 mdio = <&PIO15 4 ALT2 OUT BYPASS 3000>; 377 mdio = <&pio15 4 ALT2 OUT BYPASS 3000>;
378 mdc = <&PIO15 5 ALT2 OUT NICLK 0 CLK_B>; 378 mdc = <&pio15 5 ALT2 OUT NICLK 0 CLK_B>;
379 379
380 rxd0 = <&PIO16 0 ALT2 IN SE_NICLK_IO 0 CLK_A>; 380 rxd0 = <&pio16 0 ALT2 IN SE_NICLK_IO 0 CLK_A>;
381 rxd1 = <&PIO16 1 ALT2 IN SE_NICLK_IO 0 CLK_A>; 381 rxd1 = <&pio16 1 ALT2 IN SE_NICLK_IO 0 CLK_A>;
382 rxd2 = <&PIO16 2 ALT2 IN SE_NICLK_IO 0 CLK_A>; 382 rxd2 = <&pio16 2 ALT2 IN SE_NICLK_IO 0 CLK_A>;
383 rxd3 = <&PIO16 3 ALT2 IN SE_NICLK_IO 0 CLK_A>; 383 rxd3 = <&pio16 3 ALT2 IN SE_NICLK_IO 0 CLK_A>;
384 rxdv = <&PIO15 6 ALT2 IN SE_NICLK_IO 0 CLK_A>; 384 rxdv = <&pio15 6 ALT2 IN SE_NICLK_IO 0 CLK_A>;
385 rx_er = <&PIO15 7 ALT2 IN SE_NICLK_IO 0 CLK_A>; 385 rx_er = <&pio15 7 ALT2 IN SE_NICLK_IO 0 CLK_A>;
386 rxclk = <&PIO17 0 ALT2 IN NICLK 0 CLK_A>; 386 rxclk = <&pio17 0 ALT2 IN NICLK 0 CLK_A>;
387 phyclk = <&PIO13 5 ALT2 OUT NICLK 1000 CLK_A>; 387 phyclk = <&pio13 5 ALT2 OUT NICLK 1000 CLK_A>;
388 388
389 }; 389 };
390 }; 390 };
391 391
392 pinctrl_gmii0: gmii0 { 392 pinctrl_gmii0: gmii0 {
393 st,pins { 393 st,pins {
394 mdint = <&PIO13 6 ALT2 IN BYPASS 0>; 394 mdint = <&pio13 6 ALT2 IN BYPASS 0>;
395 mdio = <&PIO15 4 ALT2 OUT BYPASS 3000>; 395 mdio = <&pio15 4 ALT2 OUT BYPASS 3000>;
396 mdc = <&PIO15 5 ALT2 OUT NICLK 0 CLK_B>; 396 mdc = <&pio15 5 ALT2 OUT NICLK 0 CLK_B>;
397 txen = <&PIO13 7 ALT2 OUT SE_NICLK_IO 3000 CLK_A>; 397 txen = <&pio13 7 ALT2 OUT SE_NICLK_IO 3000 CLK_A>;
398 398
399 txd0 = <&PIO14 0 ALT2 OUT SE_NICLK_IO 3000 CLK_A>; 399 txd0 = <&pio14 0 ALT2 OUT SE_NICLK_IO 3000 CLK_A>;
400 txd1 = <&PIO14 1 ALT2 OUT SE_NICLK_IO 3000 CLK_A>; 400 txd1 = <&pio14 1 ALT2 OUT SE_NICLK_IO 3000 CLK_A>;
401 txd2 = <&PIO14 2 ALT2 OUT SE_NICLK_IO 3000 CLK_B>; 401 txd2 = <&pio14 2 ALT2 OUT SE_NICLK_IO 3000 CLK_B>;
402 txd3 = <&PIO14 3 ALT2 OUT SE_NICLK_IO 3000 CLK_B>; 402 txd3 = <&pio14 3 ALT2 OUT SE_NICLK_IO 3000 CLK_B>;
403 txd4 = <&PIO14 4 ALT2 OUT SE_NICLK_IO 3000 CLK_B>; 403 txd4 = <&pio14 4 ALT2 OUT SE_NICLK_IO 3000 CLK_B>;
404 txd5 = <&PIO14 5 ALT2 OUT SE_NICLK_IO 3000 CLK_B>; 404 txd5 = <&pio14 5 ALT2 OUT SE_NICLK_IO 3000 CLK_B>;
405 txd6 = <&PIO14 6 ALT2 OUT SE_NICLK_IO 3000 CLK_B>; 405 txd6 = <&pio14 6 ALT2 OUT SE_NICLK_IO 3000 CLK_B>;
406 txd7 = <&PIO14 7 ALT2 OUT SE_NICLK_IO 3000 CLK_B>; 406 txd7 = <&pio14 7 ALT2 OUT SE_NICLK_IO 3000 CLK_B>;
407 407
408 txclk = <&PIO15 0 ALT2 IN NICLK 0 CLK_A>; 408 txclk = <&pio15 0 ALT2 IN NICLK 0 CLK_A>;
409 txer = <&PIO15 1 ALT2 OUT SE_NICLK_IO 3000 CLK_A>; 409 txer = <&pio15 1 ALT2 OUT SE_NICLK_IO 3000 CLK_A>;
410 crs = <&PIO15 2 ALT2 IN BYPASS 1000>; 410 crs = <&pio15 2 ALT2 IN BYPASS 1000>;
411 col = <&PIO15 3 ALT2 IN BYPASS 1000>; 411 col = <&pio15 3 ALT2 IN BYPASS 1000>;
412 rxdv = <&PIO15 6 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 412 rxdv = <&pio15 6 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
413 rx_er = <&PIO15 7 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 413 rx_er = <&pio15 7 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
414 414
415 rxd0 = <&PIO16 0 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 415 rxd0 = <&pio16 0 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
416 rxd1 = <&PIO16 1 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 416 rxd1 = <&pio16 1 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
417 rxd2 = <&PIO16 2 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 417 rxd2 = <&pio16 2 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
418 rxd3 = <&PIO16 3 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 418 rxd3 = <&pio16 3 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
419 rxd4 = <&PIO16 4 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 419 rxd4 = <&pio16 4 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
420 rxd5 = <&PIO16 5 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 420 rxd5 = <&pio16 5 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
421 rxd6 = <&PIO16 6 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 421 rxd6 = <&pio16 6 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
422 rxd7 = <&PIO16 7 ALT2 IN SE_NICLK_IO 1500 CLK_A>; 422 rxd7 = <&pio16 7 ALT2 IN SE_NICLK_IO 1500 CLK_A>;
423 423
424 rxclk = <&PIO17 0 ALT2 IN NICLK 0 CLK_A>; 424 rxclk = <&pio17 0 ALT2 IN NICLK 0 CLK_A>;
425 clk125 = <&PIO17 6 ALT1 IN NICLK 0 CLK_A>; 425 clk125 = <&pio17 6 ALT1 IN NICLK 0 CLK_A>;
426 phyclk = <&PIO13 5 ALT4 OUT NICLK 0 CLK_B>; 426 phyclk = <&pio13 5 ALT4 OUT NICLK 0 CLK_B>;
427 427
428 428
429 }; 429 };
430 }; 430 };
431 }; 431 };
432
433 mmc0 {
434 pinctrl_mmc0: mmc0 {
435 st,pins {
436 mmcclk = <&pio13 4 ALT4 BIDIR_PU NICLK 0 CLK_B>;
437 data0 = <&pio14 4 ALT4 BIDIR_PU BYPASS 0>;
438 data1 = <&pio14 5 ALT4 BIDIR_PU BYPASS 0>;
439 data2 = <&pio14 6 ALT4 BIDIR_PU BYPASS 0>;
440 data3 = <&pio14 7 ALT4 BIDIR_PU BYPASS 0>;
441 cmd = <&pio15 1 ALT4 BIDIR_PU BYPASS 0>;
442 wp = <&pio15 3 ALT4 IN>;
443 data4 = <&pio16 4 ALT4 BIDIR_PU BYPASS 0>;
444 data5 = <&pio16 5 ALT4 BIDIR_PU BYPASS 0>;
445 data6 = <&pio16 6 ALT4 BIDIR_PU BYPASS 0>;
446 data7 = <&pio16 7 ALT4 BIDIR_PU BYPASS 0>;
447 pwr = <&pio17 1 ALT4 OUT>;
448 cd = <&pio17 2 ALT4 IN>;
449 led = <&pio17 3 ALT4 OUT>;
450 };
451 };
452 };
432 }; 453 };
433 454
434 pin-controller-left { 455 pin-controller-left {
@@ -442,7 +463,7 @@
442 interrupt-names = "irqmux"; 463 interrupt-names = "irqmux";
443 ranges = <0 0xfd6b0000 0x3000>; 464 ranges = <0 0xfd6b0000 0x3000>;
444 465
445 PIO100: gpio@fd6b0000 { 466 pio100: gpio@fd6b0000 {
446 gpio-controller; 467 gpio-controller;
447 #gpio-cells = <1>; 468 #gpio-cells = <1>;
448 interrupt-controller; 469 interrupt-controller;
@@ -450,7 +471,7 @@
450 reg = <0 0x100>; 471 reg = <0 0x100>;
451 st,bank-name = "PIO100"; 472 st,bank-name = "PIO100";
452 }; 473 };
453 PIO101: gpio@fd6b1000 { 474 pio101: gpio@fd6b1000 {
454 gpio-controller; 475 gpio-controller;
455 #gpio-cells = <1>; 476 #gpio-cells = <1>;
456 interrupt-controller; 477 interrupt-controller;
@@ -458,7 +479,7 @@
458 reg = <0x1000 0x100>; 479 reg = <0x1000 0x100>;
459 st,bank-name = "PIO101"; 480 st,bank-name = "PIO101";
460 }; 481 };
461 PIO102: gpio@fd6b2000 { 482 pio102: gpio@fd6b2000 {
462 gpio-controller; 483 gpio-controller;
463 #gpio-cells = <1>; 484 #gpio-cells = <1>;
464 interrupt-controller; 485 interrupt-controller;
@@ -479,7 +500,7 @@
479 interrupt-names = "irqmux"; 500 interrupt-names = "irqmux";
480 ranges = <0 0xfd330000 0x5000>; 501 ranges = <0 0xfd330000 0x5000>;
481 502
482 PIO103: gpio@fd330000 { 503 pio103: gpio@fd330000 {
483 gpio-controller; 504 gpio-controller;
484 #gpio-cells = <1>; 505 #gpio-cells = <1>;
485 interrupt-controller; 506 interrupt-controller;
@@ -487,7 +508,7 @@
487 reg = <0 0x100>; 508 reg = <0 0x100>;
488 st,bank-name = "PIO103"; 509 st,bank-name = "PIO103";
489 }; 510 };
490 PIO104: gpio@fd331000 { 511 pio104: gpio@fd331000 {
491 gpio-controller; 512 gpio-controller;
492 #gpio-cells = <1>; 513 #gpio-cells = <1>;
493 interrupt-controller; 514 interrupt-controller;
@@ -495,7 +516,7 @@
495 reg = <0x1000 0x100>; 516 reg = <0x1000 0x100>;
496 st,bank-name = "PIO104"; 517 st,bank-name = "PIO104";
497 }; 518 };
498 PIO105: gpio@fd332000 { 519 pio105: gpio@fd332000 {
499 gpio-controller; 520 gpio-controller;
500 #gpio-cells = <1>; 521 #gpio-cells = <1>;
501 interrupt-controller; 522 interrupt-controller;
@@ -503,7 +524,7 @@
503 reg = <0x2000 0x100>; 524 reg = <0x2000 0x100>;
504 st,bank-name = "PIO105"; 525 st,bank-name = "PIO105";
505 }; 526 };
506 PIO106: gpio@fd333000 { 527 pio106: gpio@fd333000 {
507 gpio-controller; 528 gpio-controller;
508 #gpio-cells = <1>; 529 #gpio-cells = <1>;
509 interrupt-controller; 530 interrupt-controller;
@@ -511,7 +532,7 @@
511 reg = <0x3000 0x100>; 532 reg = <0x3000 0x100>;
512 st,bank-name = "PIO106"; 533 st,bank-name = "PIO106";
513 }; 534 };
514 PIO107: gpio@fd334000 { 535 pio107: gpio@fd334000 {
515 gpio-controller; 536 gpio-controller;
516 #gpio-cells = <1>; 537 #gpio-cells = <1>;
517 interrupt-controller; 538 interrupt-controller;
diff --git a/arch/arm/boot/dts/stih415.dtsi b/arch/arm/boot/dts/stih415.dtsi
index a0f6f75fe3b5..9198c12765ea 100644
--- a/arch/arm/boot/dts/stih415.dtsi
+++ b/arch/arm/boot/dts/stih415.dtsi
@@ -218,5 +218,17 @@
218 resets = <&powerdown STIH415_KEYSCAN_POWERDOWN>, 218 resets = <&powerdown STIH415_KEYSCAN_POWERDOWN>,
219 <&softreset STIH415_KEYSCAN_SOFTRESET>; 219 <&softreset STIH415_KEYSCAN_SOFTRESET>;
220 }; 220 };
221
222 mmc0: sdhci@fe81e000 {
223 compatible = "st,sdhci";
224 status = "disabled";
225 reg = <0xfe81e000 0x1000>;
226 interrupts = <GIC_SPI 145 IRQ_TYPE_NONE>;
227 interrupt-names = "mmcirq";
228 pinctrl-names = "default";
229 pinctrl-0 = <&pinctrl_mmc0>;
230 clock-names = "mmc";
231 clocks = <&clk_s_a1_ls 1>;
232 };
221 }; 233 };
222}; 234};
diff --git a/arch/arm/boot/dts/stih416-b2020.dts b/arch/arm/boot/dts/stih416-b2020.dts
index 4e2df66b99ea..200a81844765 100644
--- a/arch/arm/boot/dts/stih416-b2020.dts
+++ b/arch/arm/boot/dts/stih416-b2020.dts
@@ -12,4 +12,26 @@
12/ { 12/ {
13 model = "STiH416 B2020"; 13 model = "STiH416 B2020";
14 compatible = "st,stih416-b2020", "st,stih416"; 14 compatible = "st,stih416-b2020", "st,stih416";
15
16 soc {
17 mmc1: sdhci@fe81f000 {
18 status = "okay";
19 bus-width = <8>;
20 non-removable;
21 };
22
23 miphy365x_phy: phy@fe382000 {
24 phy_port0: port@fe382000 {
25 st,sata-gen = <3>;
26 };
27
28 phy_port1: port@fe38a000 {
29 st,pcie-tx-pol-inv;
30 };
31 };
32
33 sata0: sata@fe380000{
34 status = "okay";
35 };
36 };
15}; 37};
diff --git a/arch/arm/boot/dts/stih416-b2020e.dts b/arch/arm/boot/dts/stih416-b2020e.dts
index ba0fa2caaf18..961799e1dc51 100644
--- a/arch/arm/boot/dts/stih416-b2020e.dts
+++ b/arch/arm/boot/dts/stih416-b2020e.dts
@@ -19,17 +19,37 @@
19 red { 19 red {
20 #gpio-cells = <1>; 20 #gpio-cells = <1>;
21 label = "Front Panel LED"; 21 label = "Front Panel LED";
22 gpios = <&PIO4 1>; 22 gpios = <&pio4 1>;
23 linux,default-trigger = "heartbeat"; 23 linux,default-trigger = "heartbeat";
24 }; 24 };
25 green { 25 green {
26 gpios = <&PIO1 3>; 26 gpios = <&pio1 3>;
27 default-state = "off"; 27 default-state = "off";
28 }; 28 };
29 }; 29 };
30 30
31 ethernet1: dwmac@fef08000 { 31 ethernet1: dwmac@fef08000 {
32 snps,reset-gpio = <&PIO0 7>; 32 snps,reset-gpio = <&pio0 7>;
33 };
34
35 mmc1: sdhci@fe81f000 {
36 status = "okay";
37 bus-width = <8>;
38 non-removable;
39 };
40
41 miphy365x_phy: phy@fe382000 {
42 phy_port0: port@fe382000 {
43 st,sata-gen = <3>;
44 };
45
46 phy_port1: port@fe38a000 {
47 st,pcie-tx-pol-inv;
48 };
49 };
50
51 sata0: sata@fe380000{
52 status = "okay";
33 }; 53 };
34 }; 54 };
35}; 55};
diff --git a/arch/arm/boot/dts/stih416-pinctrl.dtsi b/arch/arm/boot/dts/stih416-pinctrl.dtsi
index ee6c119e261e..9cccf2d6aa26 100644
--- a/arch/arm/boot/dts/stih416-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih416-pinctrl.dtsi
@@ -12,36 +12,36 @@
12/ { 12/ {
13 13
14 aliases { 14 aliases {
15 gpio0 = &PIO0; 15 gpio0 = &pio0;
16 gpio1 = &PIO1; 16 gpio1 = &pio1;
17 gpio2 = &PIO2; 17 gpio2 = &pio2;
18 gpio3 = &PIO3; 18 gpio3 = &pio3;
19 gpio4 = &PIO4; 19 gpio4 = &pio4;
20 gpio5 = &PIO40; 20 gpio5 = &pio40;
21 gpio6 = &PIO5; 21 gpio6 = &pio5;
22 gpio7 = &PIO6; 22 gpio7 = &pio6;
23 gpio8 = &PIO7; 23 gpio8 = &pio7;
24 gpio9 = &PIO8; 24 gpio9 = &pio8;
25 gpio10 = &PIO9; 25 gpio10 = &pio9;
26 gpio11 = &PIO10; 26 gpio11 = &pio10;
27 gpio12 = &PIO11; 27 gpio12 = &pio11;
28 gpio13 = &PIO12; 28 gpio13 = &pio12;
29 gpio14 = &PIO30; 29 gpio14 = &pio30;
30 gpio15 = &PIO31; 30 gpio15 = &pio31;
31 gpio16 = &PIO13; 31 gpio16 = &pio13;
32 gpio17 = &PIO14; 32 gpio17 = &pio14;
33 gpio18 = &PIO15; 33 gpio18 = &pio15;
34 gpio19 = &PIO16; 34 gpio19 = &pio16;
35 gpio20 = &PIO17; 35 gpio20 = &pio17;
36 gpio21 = &PIO18; 36 gpio21 = &pio18;
37 gpio22 = &PIO100; 37 gpio22 = &pio100;
38 gpio23 = &PIO101; 38 gpio23 = &pio101;
39 gpio24 = &PIO102; 39 gpio24 = &pio102;
40 gpio25 = &PIO103; 40 gpio25 = &pio103;
41 gpio26 = &PIO104; 41 gpio26 = &pio104;
42 gpio27 = &PIO105; 42 gpio27 = &pio105;
43 gpio28 = &PIO106; 43 gpio28 = &pio106;
44 gpio29 = &PIO107; 44 gpio29 = &pio107;
45 }; 45 };
46 46
47 soc { 47 soc {
@@ -56,7 +56,7 @@
56 interrupt-names = "irqmux"; 56 interrupt-names = "irqmux";
57 ranges = <0 0xfe610000 0x6000>; 57 ranges = <0 0xfe610000 0x6000>;
58 58
59 PIO0: gpio@fe610000 { 59 pio0: gpio@fe610000 {
60 gpio-controller; 60 gpio-controller;
61 #gpio-cells = <1>; 61 #gpio-cells = <1>;
62 interrupt-controller; 62 interrupt-controller;
@@ -64,7 +64,7 @@
64 reg = <0 0x100>; 64 reg = <0 0x100>;
65 st,bank-name = "PIO0"; 65 st,bank-name = "PIO0";
66 }; 66 };
67 PIO1: gpio@fe611000 { 67 pio1: gpio@fe611000 {
68 gpio-controller; 68 gpio-controller;
69 #gpio-cells = <1>; 69 #gpio-cells = <1>;
70 interrupt-controller; 70 interrupt-controller;
@@ -72,7 +72,7 @@
72 reg = <0x1000 0x100>; 72 reg = <0x1000 0x100>;
73 st,bank-name = "PIO1"; 73 st,bank-name = "PIO1";
74 }; 74 };
75 PIO2: gpio@fe612000 { 75 pio2: gpio@fe612000 {
76 gpio-controller; 76 gpio-controller;
77 #gpio-cells = <1>; 77 #gpio-cells = <1>;
78 interrupt-controller; 78 interrupt-controller;
@@ -80,7 +80,7 @@
80 reg = <0x2000 0x100>; 80 reg = <0x2000 0x100>;
81 st,bank-name = "PIO2"; 81 st,bank-name = "PIO2";
82 }; 82 };
83 PIO3: gpio@fe613000 { 83 pio3: gpio@fe613000 {
84 gpio-controller; 84 gpio-controller;
85 #gpio-cells = <1>; 85 #gpio-cells = <1>;
86 interrupt-controller; 86 interrupt-controller;
@@ -88,7 +88,7 @@
88 reg = <0x3000 0x100>; 88 reg = <0x3000 0x100>;
89 st,bank-name = "PIO3"; 89 st,bank-name = "PIO3";
90 }; 90 };
91 PIO4: gpio@fe614000 { 91 pio4: gpio@fe614000 {
92 gpio-controller; 92 gpio-controller;
93 #gpio-cells = <1>; 93 #gpio-cells = <1>;
94 interrupt-controller; 94 interrupt-controller;
@@ -96,7 +96,7 @@
96 reg = <0x4000 0x100>; 96 reg = <0x4000 0x100>;
97 st,bank-name = "PIO4"; 97 st,bank-name = "PIO4";
98 }; 98 };
99 PIO40: gpio@fe615000 { 99 pio40: gpio@fe615000 {
100 gpio-controller; 100 gpio-controller;
101 #gpio-cells = <1>; 101 #gpio-cells = <1>;
102 interrupt-controller; 102 interrupt-controller;
@@ -109,15 +109,15 @@
109 rc{ 109 rc{
110 pinctrl_ir: ir0 { 110 pinctrl_ir: ir0 {
111 st,pins { 111 st,pins {
112 ir = <&PIO4 0 ALT2 IN>; 112 ir = <&pio4 0 ALT2 IN>;
113 }; 113 };
114 }; 114 };
115 }; 115 };
116 sbc_serial1 { 116 sbc_serial1 {
117 pinctrl_sbc_serial1: sbc_serial1 { 117 pinctrl_sbc_serial1: sbc_serial1 {
118 st,pins { 118 st,pins {
119 tx = <&PIO2 6 ALT3 OUT>; 119 tx = <&pio2 6 ALT3 OUT>;
120 rx = <&PIO2 7 ALT3 IN>; 120 rx = <&pio2 7 ALT3 IN>;
121 }; 121 };
122 }; 122 };
123 }; 123 };
@@ -125,15 +125,15 @@
125 keyscan { 125 keyscan {
126 pinctrl_keyscan: keyscan { 126 pinctrl_keyscan: keyscan {
127 st,pins { 127 st,pins {
128 keyin0 = <&PIO0 2 ALT2 IN>; 128 keyin0 = <&pio0 2 ALT2 IN>;
129 keyin1 = <&PIO0 3 ALT2 IN>; 129 keyin1 = <&pio0 3 ALT2 IN>;
130 keyin2 = <&PIO0 4 ALT2 IN>; 130 keyin2 = <&pio0 4 ALT2 IN>;
131 keyin3 = <&PIO2 6 ALT2 IN>; 131 keyin3 = <&pio2 6 ALT2 IN>;
132 132
133 keyout0 = <&PIO1 6 ALT2 OUT>; 133 keyout0 = <&pio1 6 ALT2 OUT>;
134 keyout1 = <&PIO1 7 ALT2 OUT>; 134 keyout1 = <&pio1 7 ALT2 OUT>;
135 keyout2 = <&PIO0 6 ALT2 OUT>; 135 keyout2 = <&pio0 6 ALT2 OUT>;
136 keyout3 = <&PIO2 7 ALT2 OUT>; 136 keyout3 = <&pio2 7 ALT2 OUT>;
137 }; 137 };
138 }; 138 };
139 }; 139 };
@@ -141,8 +141,17 @@
141 sbc_i2c0 { 141 sbc_i2c0 {
142 pinctrl_sbc_i2c0_default: sbc_i2c0-default { 142 pinctrl_sbc_i2c0_default: sbc_i2c0-default {
143 st,pins { 143 st,pins {
144 sda = <&PIO4 6 ALT1 BIDIR>; 144 sda = <&pio4 6 ALT1 BIDIR>;
145 scl = <&PIO4 5 ALT1 BIDIR>; 145 scl = <&pio4 5 ALT1 BIDIR>;
146 };
147 };
148 };
149
150 usb {
151 pinctrl_usb3: usb3 {
152 st,pins {
153 oc-detect = <&pio40 0 ALT1 IN>;
154 pwr-enable = <&pio40 1 ALT1 OUT>;
146 }; 155 };
147 }; 156 };
148 }; 157 };
@@ -150,8 +159,8 @@
150 sbc_i2c1 { 159 sbc_i2c1 {
151 pinctrl_sbc_i2c1_default: sbc_i2c1-default { 160 pinctrl_sbc_i2c1_default: sbc_i2c1-default {
152 st,pins { 161 st,pins {
153 sda = <&PIO3 2 ALT2 BIDIR>; 162 sda = <&pio3 2 ALT2 BIDIR>;
154 scl = <&PIO3 1 ALT2 BIDIR>; 163 scl = <&pio3 1 ALT2 BIDIR>;
155 }; 164 };
156 }; 165 };
157 }; 166 };
@@ -159,51 +168,51 @@
159 gmac1 { 168 gmac1 {
160 pinctrl_mii1: mii1 { 169 pinctrl_mii1: mii1 {
161 st,pins { 170 st,pins {
162 txd0 = <&PIO0 0 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 171 txd0 = <&pio0 0 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
163 txd1 = <&PIO0 1 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 172 txd1 = <&pio0 1 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
164 txd2 = <&PIO0 2 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 173 txd2 = <&pio0 2 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
165 txd3 = <&PIO0 3 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 174 txd3 = <&pio0 3 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
166 txer = <&PIO0 4 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 175 txer = <&pio0 4 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
167 txen = <&PIO0 5 ALT1 OUT SE_NICLK_IO 0 CLK_A>; 176 txen = <&pio0 5 ALT1 OUT SE_NICLK_IO 0 CLK_A>;
168 txclk = <&PIO0 6 ALT1 IN NICLK 0 CLK_A>; 177 txclk = <&pio0 6 ALT1 IN NICLK 0 CLK_A>;
169 col = <&PIO0 7 ALT1 IN BYPASS 1000>; 178 col = <&pio0 7 ALT1 IN BYPASS 1000>;
170 179
171 mdio = <&PIO1 0 ALT1 OUT BYPASS 1500>; 180 mdio = <&pio1 0 ALT1 OUT BYPASS 1500>;
172 mdc = <&PIO1 1 ALT1 OUT NICLK 0 CLK_A>; 181 mdc = <&pio1 1 ALT1 OUT NICLK 0 CLK_A>;
173 crs = <&PIO1 2 ALT1 IN BYPASS 1000>; 182 crs = <&pio1 2 ALT1 IN BYPASS 1000>;
174 mdint = <&PIO1 3 ALT1 IN BYPASS 0>; 183 mdint = <&pio1 3 ALT1 IN BYPASS 0>;
175 rxd0 = <&PIO1 4 ALT1 IN SE_NICLK_IO 0 CLK_A>; 184 rxd0 = <&pio1 4 ALT1 IN SE_NICLK_IO 0 CLK_A>;
176 rxd1 = <&PIO1 5 ALT1 IN SE_NICLK_IO 0 CLK_A>; 185 rxd1 = <&pio1 5 ALT1 IN SE_NICLK_IO 0 CLK_A>;
177 rxd2 = <&PIO1 6 ALT1 IN SE_NICLK_IO 0 CLK_A>; 186 rxd2 = <&pio1 6 ALT1 IN SE_NICLK_IO 0 CLK_A>;
178 rxd3 = <&PIO1 7 ALT1 IN SE_NICLK_IO 0 CLK_A>; 187 rxd3 = <&pio1 7 ALT1 IN SE_NICLK_IO 0 CLK_A>;
179 188
180 rxdv = <&PIO2 0 ALT1 IN SE_NICLK_IO 0 CLK_A>; 189 rxdv = <&pio2 0 ALT1 IN SE_NICLK_IO 0 CLK_A>;
181 rx_er = <&PIO2 1 ALT1 IN SE_NICLK_IO 0 CLK_A>; 190 rx_er = <&pio2 1 ALT1 IN SE_NICLK_IO 0 CLK_A>;
182 rxclk = <&PIO2 2 ALT1 IN NICLK 0 CLK_A>; 191 rxclk = <&pio2 2 ALT1 IN NICLK 0 CLK_A>;
183 phyclk = <&PIO2 3 ALT1 OUT NICLK 0 CLK_A>; 192 phyclk = <&pio2 3 ALT1 OUT NICLK 0 CLK_A>;
184 }; 193 };
185 }; 194 };
186 pinctrl_rgmii1: rgmii1-0 { 195 pinctrl_rgmii1: rgmii1-0 {
187 st,pins { 196 st,pins {
188 txd0 = <&PIO0 0 ALT1 OUT DE_IO 500 CLK_A>; 197 txd0 = <&pio0 0 ALT1 OUT DE_IO 500 CLK_A>;
189 txd1 = <&PIO0 1 ALT1 OUT DE_IO 500 CLK_A>; 198 txd1 = <&pio0 1 ALT1 OUT DE_IO 500 CLK_A>;
190 txd2 = <&PIO0 2 ALT1 OUT DE_IO 500 CLK_A>; 199 txd2 = <&pio0 2 ALT1 OUT DE_IO 500 CLK_A>;
191 txd3 = <&PIO0 3 ALT1 OUT DE_IO 500 CLK_A>; 200 txd3 = <&pio0 3 ALT1 OUT DE_IO 500 CLK_A>;
192 txen = <&PIO0 5 ALT1 OUT DE_IO 0 CLK_A>; 201 txen = <&pio0 5 ALT1 OUT DE_IO 0 CLK_A>;
193 txclk = <&PIO0 6 ALT1 IN NICLK 0 CLK_A>; 202 txclk = <&pio0 6 ALT1 IN NICLK 0 CLK_A>;
194 203
195 mdio = <&PIO1 0 ALT1 OUT BYPASS 0>; 204 mdio = <&pio1 0 ALT1 OUT BYPASS 0>;
196 mdc = <&PIO1 1 ALT1 OUT NICLK 0 CLK_A>; 205 mdc = <&pio1 1 ALT1 OUT NICLK 0 CLK_A>;
197 rxd0 = <&PIO1 4 ALT1 IN DE_IO 500 CLK_A>; 206 rxd0 = <&pio1 4 ALT1 IN DE_IO 500 CLK_A>;
198 rxd1 = <&PIO1 5 ALT1 IN DE_IO 500 CLK_A>; 207 rxd1 = <&pio1 5 ALT1 IN DE_IO 500 CLK_A>;
199 rxd2 = <&PIO1 6 ALT1 IN DE_IO 500 CLK_A>; 208 rxd2 = <&pio1 6 ALT1 IN DE_IO 500 CLK_A>;
200 rxd3 = <&PIO1 7 ALT1 IN DE_IO 500 CLK_A>; 209 rxd3 = <&pio1 7 ALT1 IN DE_IO 500 CLK_A>;
201 210
202 rxdv = <&PIO2 0 ALT1 IN DE_IO 500 CLK_A>; 211 rxdv = <&pio2 0 ALT1 IN DE_IO 500 CLK_A>;
203 rxclk = <&PIO2 2 ALT1 IN NICLK 0 CLK_A>; 212 rxclk = <&pio2 2 ALT1 IN NICLK 0 CLK_A>;
204 phyclk = <&PIO2 3 ALT4 OUT NICLK 0 CLK_B>; 213 phyclk = <&pio2 3 ALT4 OUT NICLK 0 CLK_B>;
205 214
206 clk125= <&PIO3 7 ALT4 IN NICLK 0 CLK_A>; 215 clk125= <&pio3 7 ALT4 IN NICLK 0 CLK_A>;
207 }; 216 };
208 }; 217 };
209 }; 218 };
@@ -220,7 +229,7 @@
220 interrupt-names = "irqmux"; 229 interrupt-names = "irqmux";
221 ranges = <0 0xfee00000 0x10000>; 230 ranges = <0 0xfee00000 0x10000>;
222 231
223 PIO5: gpio@fee00000 { 232 pio5: gpio@fee00000 {
224 gpio-controller; 233 gpio-controller;
225 #gpio-cells = <1>; 234 #gpio-cells = <1>;
226 interrupt-controller; 235 interrupt-controller;
@@ -228,7 +237,7 @@
228 reg = <0 0x100>; 237 reg = <0 0x100>;
229 st,bank-name = "PIO5"; 238 st,bank-name = "PIO5";
230 }; 239 };
231 PIO6: gpio@fee01000 { 240 pio6: gpio@fee01000 {
232 gpio-controller; 241 gpio-controller;
233 #gpio-cells = <1>; 242 #gpio-cells = <1>;
234 interrupt-controller; 243 interrupt-controller;
@@ -236,7 +245,7 @@
236 reg = <0x1000 0x100>; 245 reg = <0x1000 0x100>;
237 st,bank-name = "PIO6"; 246 st,bank-name = "PIO6";
238 }; 247 };
239 PIO7: gpio@fee02000 { 248 pio7: gpio@fee02000 {
240 gpio-controller; 249 gpio-controller;
241 #gpio-cells = <1>; 250 #gpio-cells = <1>;
242 interrupt-controller; 251 interrupt-controller;
@@ -244,7 +253,7 @@
244 reg = <0x2000 0x100>; 253 reg = <0x2000 0x100>;
245 st,bank-name = "PIO7"; 254 st,bank-name = "PIO7";
246 }; 255 };
247 PIO8: gpio@fee03000 { 256 pio8: gpio@fee03000 {
248 gpio-controller; 257 gpio-controller;
249 #gpio-cells = <1>; 258 #gpio-cells = <1>;
250 interrupt-controller; 259 interrupt-controller;
@@ -252,7 +261,7 @@
252 reg = <0x3000 0x100>; 261 reg = <0x3000 0x100>;
253 st,bank-name = "PIO8"; 262 st,bank-name = "PIO8";
254 }; 263 };
255 PIO9: gpio@fee04000 { 264 pio9: gpio@fee04000 {
256 gpio-controller; 265 gpio-controller;
257 #gpio-cells = <1>; 266 #gpio-cells = <1>;
258 interrupt-controller; 267 interrupt-controller;
@@ -260,7 +269,7 @@
260 reg = <0x4000 0x100>; 269 reg = <0x4000 0x100>;
261 st,bank-name = "PIO9"; 270 st,bank-name = "PIO9";
262 }; 271 };
263 PIO10: gpio@fee05000 { 272 pio10: gpio@fee05000 {
264 gpio-controller; 273 gpio-controller;
265 #gpio-cells = <1>; 274 #gpio-cells = <1>;
266 interrupt-controller; 275 interrupt-controller;
@@ -268,7 +277,7 @@
268 reg = <0x5000 0x100>; 277 reg = <0x5000 0x100>;
269 st,bank-name = "PIO10"; 278 st,bank-name = "PIO10";
270 }; 279 };
271 PIO11: gpio@fee06000 { 280 pio11: gpio@fee06000 {
272 gpio-controller; 281 gpio-controller;
273 #gpio-cells = <1>; 282 #gpio-cells = <1>;
274 interrupt-controller; 283 interrupt-controller;
@@ -276,7 +285,7 @@
276 reg = <0x6000 0x100>; 285 reg = <0x6000 0x100>;
277 st,bank-name = "PIO11"; 286 st,bank-name = "PIO11";
278 }; 287 };
279 PIO12: gpio@fee07000 { 288 pio12: gpio@fee07000 {
280 gpio-controller; 289 gpio-controller;
281 #gpio-cells = <1>; 290 #gpio-cells = <1>;
282 interrupt-controller; 291 interrupt-controller;
@@ -284,7 +293,7 @@
284 reg = <0x7000 0x100>; 293 reg = <0x7000 0x100>;
285 st,bank-name = "PIO12"; 294 st,bank-name = "PIO12";
286 }; 295 };
287 PIO30: gpio@fee08000 { 296 pio30: gpio@fee08000 {
288 gpio-controller; 297 gpio-controller;
289 #gpio-cells = <1>; 298 #gpio-cells = <1>;
290 interrupt-controller; 299 interrupt-controller;
@@ -292,7 +301,7 @@
292 reg = <0x8000 0x100>; 301 reg = <0x8000 0x100>;
293 st,bank-name = "PIO30"; 302 st,bank-name = "PIO30";
294 }; 303 };
295 PIO31: gpio@fee09000 { 304 pio31: gpio@fee09000 {
296 gpio-controller; 305 gpio-controller;
297 #gpio-cells = <1>; 306 #gpio-cells = <1>;
298 interrupt-controller; 307 interrupt-controller;
@@ -304,7 +313,7 @@
304 serial2-oe { 313 serial2-oe {
305 pinctrl_serial2_oe: serial2-1 { 314 pinctrl_serial2_oe: serial2-1 {
306 st,pins { 315 st,pins {
307 output-enable = <&PIO11 3 ALT2 OUT>; 316 output-enable = <&pio11 3 ALT2 OUT>;
308 }; 317 };
309 }; 318 };
310 }; 319 };
@@ -312,17 +321,27 @@
312 i2c0 { 321 i2c0 {
313 pinctrl_i2c0_default: i2c0-default { 322 pinctrl_i2c0_default: i2c0-default {
314 st,pins { 323 st,pins {
315 sda = <&PIO9 3 ALT1 BIDIR>; 324 sda = <&pio9 3 ALT1 BIDIR>;
316 scl = <&PIO9 2 ALT1 BIDIR>; 325 scl = <&pio9 2 ALT1 BIDIR>;
326 };
327 };
328 };
329
330 usb {
331 pinctrl_usb0: usb0 {
332 st,pins {
333 oc-detect = <&pio9 4 ALT1 IN>;
334 pwr-enable = <&pio9 5 ALT1 OUT>;
317 }; 335 };
318 }; 336 };
319 }; 337 };
320 338
339
321 i2c1 { 340 i2c1 {
322 pinctrl_i2c1_default: i2c1-default { 341 pinctrl_i2c1_default: i2c1-default {
323 st,pins { 342 st,pins {
324 sda = <&PIO12 1 ALT1 BIDIR>; 343 sda = <&pio12 1 ALT1 BIDIR>;
325 scl = <&PIO12 0 ALT1 BIDIR>; 344 scl = <&pio12 0 ALT1 BIDIR>;
326 }; 345 };
327 }; 346 };
328 }; 347 };
@@ -330,12 +349,12 @@
330 fsm { 349 fsm {
331 pinctrl_fsm: fsm { 350 pinctrl_fsm: fsm {
332 st,pins { 351 st,pins {
333 spi-fsm-clk = <&PIO12 2 ALT1 OUT>; 352 spi-fsm-clk = <&pio12 2 ALT1 OUT>;
334 spi-fsm-cs = <&PIO12 3 ALT1 OUT>; 353 spi-fsm-cs = <&pio12 3 ALT1 OUT>;
335 spi-fsm-mosi = <&PIO12 4 ALT1 OUT>; 354 spi-fsm-mosi = <&pio12 4 ALT1 OUT>;
336 spi-fsm-miso = <&PIO12 5 ALT1 IN>; 355 spi-fsm-miso = <&pio12 5 ALT1 IN>;
337 spi-fsm-hol = <&PIO12 6 ALT1 OUT>; 356 spi-fsm-hol = <&pio12 6 ALT1 OUT>;
338 spi-fsm-wp = <&PIO12 7 ALT1 OUT>; 357 spi-fsm-wp = <&pio12 7 ALT1 OUT>;
339 }; 358 };
340 }; 359 };
341 }; 360 };
@@ -352,7 +371,7 @@
352 interrupt-names = "irqmux"; 371 interrupt-names = "irqmux";
353 ranges = <0 0xfe820000 0x6000>; 372 ranges = <0 0xfe820000 0x6000>;
354 373
355 PIO13: gpio@fe820000 { 374 pio13: gpio@fe820000 {
356 gpio-controller; 375 gpio-controller;
357 #gpio-cells = <1>; 376 #gpio-cells = <1>;
358 interrupt-controller; 377 interrupt-controller;
@@ -360,7 +379,7 @@
360 reg = <0 0x100>; 379 reg = <0 0x100>;
361 st,bank-name = "PIO13"; 380 st,bank-name = "PIO13";
362 }; 381 };
363 PIO14: gpio@fe821000 { 382 pio14: gpio@fe821000 {
364 gpio-controller; 383 gpio-controller;
365 #gpio-cells = <1>; 384 #gpio-cells = <1>;
366 interrupt-controller; 385 interrupt-controller;
@@ -368,7 +387,7 @@
368 reg = <0x1000 0x100>; 387 reg = <0x1000 0x100>;
369 st,bank-name = "PIO14"; 388 st,bank-name = "PIO14";
370 }; 389 };
371 PIO15: gpio@fe822000 { 390 pio15: gpio@fe822000 {
372 gpio-controller; 391 gpio-controller;
373 #gpio-cells = <1>; 392 #gpio-cells = <1>;
374 interrupt-controller; 393 interrupt-controller;
@@ -376,7 +395,7 @@
376 reg = <0x2000 0x100>; 395 reg = <0x2000 0x100>;
377 st,bank-name = "PIO15"; 396 st,bank-name = "PIO15";
378 }; 397 };
379 PIO16: gpio@fe823000 { 398 pio16: gpio@fe823000 {
380 gpio-controller; 399 gpio-controller;
381 #gpio-cells = <1>; 400 #gpio-cells = <1>;
382 interrupt-controller; 401 interrupt-controller;
@@ -384,7 +403,7 @@
384 reg = <0x3000 0x100>; 403 reg = <0x3000 0x100>;
385 st,bank-name = "PIO16"; 404 st,bank-name = "PIO16";
386 }; 405 };
387 PIO17: gpio@fe824000 { 406 pio17: gpio@fe824000 {
388 gpio-controller; 407 gpio-controller;
389 #gpio-cells = <1>; 408 #gpio-cells = <1>;
390 interrupt-controller; 409 interrupt-controller;
@@ -392,7 +411,7 @@
392 reg = <0x4000 0x100>; 411 reg = <0x4000 0x100>;
393 st,bank-name = "PIO17"; 412 st,bank-name = "PIO17";
394 }; 413 };
395 PIO18: gpio@fe825000 { 414 pio18: gpio@fe825000 {
396 gpio-controller; 415 gpio-controller;
397 #gpio-cells = <1>; 416 #gpio-cells = <1>;
398 interrupt-controller; 417 interrupt-controller;
@@ -405,8 +424,8 @@
405 serial2 { 424 serial2 {
406 pinctrl_serial2: serial2-0 { 425 pinctrl_serial2: serial2-0 {
407 st,pins { 426 st,pins {
408 tx = <&PIO17 4 ALT2 OUT>; 427 tx = <&pio17 4 ALT2 OUT>;
409 rx = <&PIO17 5 ALT2 IN>; 428 rx = <&pio17 5 ALT2 IN>;
410 }; 429 };
411 }; 430 };
412 }; 431 };
@@ -414,28 +433,28 @@
414 gmac0 { 433 gmac0 {
415 pinctrl_mii0: mii0 { 434 pinctrl_mii0: mii0 {
416 st,pins { 435 st,pins {
417 mdint = <&PIO13 6 ALT2 IN BYPASS 0>; 436 mdint = <&pio13 6 ALT2 IN BYPASS 0>;
418 txen = <&PIO13 7 ALT2 OUT SE_NICLK_IO 0 CLK_A>; 437 txen = <&pio13 7 ALT2 OUT SE_NICLK_IO 0 CLK_A>;
419 txd0 = <&PIO14 0 ALT2 OUT SE_NICLK_IO 0 CLK_A>; 438 txd0 = <&pio14 0 ALT2 OUT SE_NICLK_IO 0 CLK_A>;
420 txd1 = <&PIO14 1 ALT2 OUT SE_NICLK_IO 0 CLK_A>; 439 txd1 = <&pio14 1 ALT2 OUT SE_NICLK_IO 0 CLK_A>;
421 txd2 = <&PIO14 2 ALT2 OUT SE_NICLK_IO 0 CLK_B>; 440 txd2 = <&pio14 2 ALT2 OUT SE_NICLK_IO 0 CLK_B>;
422 txd3 = <&PIO14 3 ALT2 OUT SE_NICLK_IO 0 CLK_B>; 441 txd3 = <&pio14 3 ALT2 OUT SE_NICLK_IO 0 CLK_B>;
423 442
424 txclk = <&PIO15 0 ALT2 IN NICLK 0 CLK_A>; 443 txclk = <&pio15 0 ALT2 IN NICLK 0 CLK_A>;
425 txer = <&PIO15 1 ALT2 OUT SE_NICLK_IO 0 CLK_A>; 444 txer = <&pio15 1 ALT2 OUT SE_NICLK_IO 0 CLK_A>;
426 crs = <&PIO15 2 ALT2 IN BYPASS 1000>; 445 crs = <&pio15 2 ALT2 IN BYPASS 1000>;
427 col = <&PIO15 3 ALT2 IN BYPASS 1000>; 446 col = <&pio15 3 ALT2 IN BYPASS 1000>;
428 mdio= <&PIO15 4 ALT2 OUT BYPASS 1500>; 447 mdio= <&pio15 4 ALT2 OUT BYPASS 1500>;
429 mdc = <&PIO15 5 ALT2 OUT NICLK 0 CLK_B>; 448 mdc = <&pio15 5 ALT2 OUT NICLK 0 CLK_B>;
430 449
431 rxd0 = <&PIO16 0 ALT2 IN SE_NICLK_IO 0 CLK_A>; 450 rxd0 = <&pio16 0 ALT2 IN SE_NICLK_IO 0 CLK_A>;
432 rxd1 = <&PIO16 1 ALT2 IN SE_NICLK_IO 0 CLK_A>; 451 rxd1 = <&pio16 1 ALT2 IN SE_NICLK_IO 0 CLK_A>;
433 rxd2 = <&PIO16 2 ALT2 IN SE_NICLK_IO 0 CLK_A>; 452 rxd2 = <&pio16 2 ALT2 IN SE_NICLK_IO 0 CLK_A>;
434 rxd3 = <&PIO16 3 ALT2 IN SE_NICLK_IO 0 CLK_A>; 453 rxd3 = <&pio16 3 ALT2 IN SE_NICLK_IO 0 CLK_A>;
435 rxdv = <&PIO15 6 ALT2 IN SE_NICLK_IO 0 CLK_A>; 454 rxdv = <&pio15 6 ALT2 IN SE_NICLK_IO 0 CLK_A>;
436 rx_er = <&PIO15 7 ALT2 IN SE_NICLK_IO 0 CLK_A>; 455 rx_er = <&pio15 7 ALT2 IN SE_NICLK_IO 0 CLK_A>;
437 rxclk = <&PIO17 0 ALT2 IN NICLK 0 CLK_A>; 456 rxclk = <&pio17 0 ALT2 IN NICLK 0 CLK_A>;
438 phyclk = <&PIO13 5 ALT2 OUT NICLK 0 CLK_B>; 457 phyclk = <&pio13 5 ALT2 OUT NICLK 0 CLK_B>;
439 }; 458 };
440 }; 459 };
441 460
@@ -445,25 +464,79 @@
445 }; 464 };
446 pinctrl_rgmii0: rgmii0 { 465 pinctrl_rgmii0: rgmii0 {
447 st,pins { 466 st,pins {
448 phyclk = <&PIO13 5 ALT4 OUT NICLK 0 CLK_B>; 467 phyclk = <&pio13 5 ALT4 OUT NICLK 0 CLK_B>;
449 txen = <&PIO13 7 ALT2 OUT DE_IO 0 CLK_A>; 468 txen = <&pio13 7 ALT2 OUT DE_IO 0 CLK_A>;
450 txd0 = <&PIO14 0 ALT2 OUT DE_IO 500 CLK_A>; 469 txd0 = <&pio14 0 ALT2 OUT DE_IO 500 CLK_A>;
451 txd1 = <&PIO14 1 ALT2 OUT DE_IO 500 CLK_A>; 470 txd1 = <&pio14 1 ALT2 OUT DE_IO 500 CLK_A>;
452 txd2 = <&PIO14 2 ALT2 OUT DE_IO 500 CLK_B>; 471 txd2 = <&pio14 2 ALT2 OUT DE_IO 500 CLK_B>;
453 txd3 = <&PIO14 3 ALT2 OUT DE_IO 500 CLK_B>; 472 txd3 = <&pio14 3 ALT2 OUT DE_IO 500 CLK_B>;
454 txclk = <&PIO15 0 ALT2 IN NICLK 0 CLK_A>; 473 txclk = <&pio15 0 ALT2 IN NICLK 0 CLK_A>;
455 474
456 mdio = <&PIO15 4 ALT2 OUT BYPASS 0>; 475 mdio = <&pio15 4 ALT2 OUT BYPASS 0>;
457 mdc = <&PIO15 5 ALT2 OUT NICLK 0 CLK_B>; 476 mdc = <&pio15 5 ALT2 OUT NICLK 0 CLK_B>;
458 477
459 rxdv = <&PIO15 6 ALT2 IN DE_IO 500 CLK_A>; 478 rxdv = <&pio15 6 ALT2 IN DE_IO 500 CLK_A>;
460 rxd0 =<&PIO16 0 ALT2 IN DE_IO 500 CLK_A>; 479 rxd0 =<&pio16 0 ALT2 IN DE_IO 500 CLK_A>;
461 rxd1 =<&PIO16 1 ALT2 IN DE_IO 500 CLK_A>; 480 rxd1 =<&pio16 1 ALT2 IN DE_IO 500 CLK_A>;
462 rxd2 =<&PIO16 2 ALT2 IN DE_IO 500 CLK_A>; 481 rxd2 =<&pio16 2 ALT2 IN DE_IO 500 CLK_A>;
463 rxd3 =<&PIO16 3 ALT2 IN DE_IO 500 CLK_A>; 482 rxd3 =<&pio16 3 ALT2 IN DE_IO 500 CLK_A>;
464 rxclk =<&PIO17 0 ALT2 IN NICLK 0 CLK_A>; 483 rxclk =<&pio17 0 ALT2 IN NICLK 0 CLK_A>;
465 484
466 clk125=<&PIO17 6 ALT1 IN NICLK 0 CLK_A>; 485 clk125=<&pio17 6 ALT1 IN NICLK 0 CLK_A>;
486 };
487 };
488 };
489
490 mmc0 {
491 pinctrl_mmc0: mmc0 {
492 st,pins {
493 mmcclk = <&pio13 4 ALT4 BIDIR_PU NICLK 0 CLK_B>;
494 data0 = <&pio14 4 ALT4 BIDIR_PU BYPASS 0>;
495 data1 = <&pio14 5 ALT4 BIDIR_PU BYPASS 0>;
496 data2 = <&pio14 6 ALT4 BIDIR_PU BYPASS 0>;
497 data3 = <&pio14 7 ALT4 BIDIR_PU BYPASS 0>;
498 cmd = <&pio15 1 ALT4 BIDIR_PU BYPASS 0>;
499 wp = <&pio15 3 ALT4 IN>;
500 data4 = <&pio16 4 ALT4 BIDIR_PU BYPASS 0>;
501 data5 = <&pio16 5 ALT4 BIDIR_PU BYPASS 0>;
502 data6 = <&pio16 6 ALT4 BIDIR_PU BYPASS 0>;
503 data7 = <&pio16 7 ALT4 BIDIR_PU BYPASS 0>;
504 pwr = <&pio17 1 ALT4 OUT>;
505 cd = <&pio17 2 ALT4 IN>;
506 led = <&pio17 3 ALT4 OUT>;
507 };
508 };
509 };
510 mmc1 {
511 pinctrl_mmc1: mmc1 {
512 st,pins {
513 mmcclk = <&pio15 0 ALT3 BIDIR_PU NICLK 0 CLK_B>;
514 data0 = <&pio13 7 ALT3 BIDIR_PU BYPASS 0>;
515 data1 = <&pio14 1 ALT3 BIDIR_PU BYPASS 0>;
516 data2 = <&pio14 2 ALT3 BIDIR_PU BYPASS 0>;
517 data3 = <&pio14 3 ALT3 BIDIR_PU BYPASS 0>;
518 cmd = <&pio15 4 ALT3 BIDIR_PU BYPASS 0>;
519 data4 = <&pio15 6 ALT3 BIDIR_PU BYPASS 0>;
520 data5 = <&pio15 7 ALT3 BIDIR_PU BYPASS 0>;
521 data6 = <&pio16 0 ALT3 BIDIR_PU BYPASS 0>;
522 data7 = <&pio16 1 ALT3 BIDIR_PU BYPASS 0>;
523 pwr = <&pio16 2 ALT3 OUT>;
524 nreset = <&pio13 6 ALT3 OUT>;
525 };
526 };
527 };
528
529 usb {
530 pinctrl_usb1: usb1 {
531 st,pins {
532 oc-detect = <&pio18 0 ALT1 IN>;
533 pwr-enable = <&pio18 1 ALT1 OUT>;
534 };
535 };
536 pinctrl_usb2: usb2 {
537 st,pins {
538 oc-detect = <&pio18 2 ALT1 IN>;
539 pwr-enable = <&pio18 3 ALT1 OUT>;
467 }; 540 };
468 }; 541 };
469 }; 542 };
@@ -480,7 +553,7 @@
480 interrupt-names = "irqmux"; 553 interrupt-names = "irqmux";
481 ranges = <0 0xfd6b0000 0x3000>; 554 ranges = <0 0xfd6b0000 0x3000>;
482 555
483 PIO100: gpio@fd6b0000 { 556 pio100: gpio@fd6b0000 {
484 gpio-controller; 557 gpio-controller;
485 #gpio-cells = <1>; 558 #gpio-cells = <1>;
486 interrupt-controller; 559 interrupt-controller;
@@ -488,7 +561,7 @@
488 reg = <0 0x100>; 561 reg = <0 0x100>;
489 st,bank-name = "PIO100"; 562 st,bank-name = "PIO100";
490 }; 563 };
491 PIO101: gpio@fd6b1000 { 564 pio101: gpio@fd6b1000 {
492 gpio-controller; 565 gpio-controller;
493 #gpio-cells = <1>; 566 #gpio-cells = <1>;
494 interrupt-controller; 567 interrupt-controller;
@@ -496,7 +569,7 @@
496 reg = <0x1000 0x100>; 569 reg = <0x1000 0x100>;
497 st,bank-name = "PIO101"; 570 st,bank-name = "PIO101";
498 }; 571 };
499 PIO102: gpio@fd6b2000 { 572 pio102: gpio@fd6b2000 {
500 gpio-controller; 573 gpio-controller;
501 #gpio-cells = <1>; 574 #gpio-cells = <1>;
502 interrupt-controller; 575 interrupt-controller;
@@ -517,7 +590,7 @@
517 interrupt-names = "irqmux"; 590 interrupt-names = "irqmux";
518 ranges = <0 0xfd330000 0x5000>; 591 ranges = <0 0xfd330000 0x5000>;
519 592
520 PIO103: gpio@fd330000 { 593 pio103: gpio@fd330000 {
521 gpio-controller; 594 gpio-controller;
522 #gpio-cells = <1>; 595 #gpio-cells = <1>;
523 interrupt-controller; 596 interrupt-controller;
@@ -525,7 +598,7 @@
525 reg = <0 0x100>; 598 reg = <0 0x100>;
526 st,bank-name = "PIO103"; 599 st,bank-name = "PIO103";
527 }; 600 };
528 PIO104: gpio@fd331000 { 601 pio104: gpio@fd331000 {
529 gpio-controller; 602 gpio-controller;
530 #gpio-cells = <1>; 603 #gpio-cells = <1>;
531 interrupt-controller; 604 interrupt-controller;
@@ -533,7 +606,7 @@
533 reg = <0x1000 0x100>; 606 reg = <0x1000 0x100>;
534 st,bank-name = "PIO104"; 607 st,bank-name = "PIO104";
535 }; 608 };
536 PIO105: gpio@fd332000 { 609 pio105: gpio@fd332000 {
537 gpio-controller; 610 gpio-controller;
538 #gpio-cells = <1>; 611 #gpio-cells = <1>;
539 interrupt-controller; 612 interrupt-controller;
@@ -541,7 +614,7 @@
541 reg = <0x2000 0x100>; 614 reg = <0x2000 0x100>;
542 st,bank-name = "PIO105"; 615 st,bank-name = "PIO105";
543 }; 616 };
544 PIO106: gpio@fd333000 { 617 pio106: gpio@fd333000 {
545 gpio-controller; 618 gpio-controller;
546 #gpio-cells = <1>; 619 #gpio-cells = <1>;
547 interrupt-controller; 620 interrupt-controller;
@@ -550,7 +623,7 @@
550 st,bank-name = "PIO106"; 623 st,bank-name = "PIO106";
551 }; 624 };
552 625
553 PIO107: gpio@fd334000 { 626 pio107: gpio@fd334000 {
554 gpio-controller; 627 gpio-controller;
555 #gpio-cells = <1>; 628 #gpio-cells = <1>;
556 interrupt-controller; 629 interrupt-controller;
diff --git a/arch/arm/boot/dts/stih416.dtsi b/arch/arm/boot/dts/stih416.dtsi
index 84758d76d064..fad9073ddeed 100644
--- a/arch/arm/boot/dts/stih416.dtsi
+++ b/arch/arm/boot/dts/stih416.dtsi
@@ -9,6 +9,8 @@
9#include "stih41x.dtsi" 9#include "stih41x.dtsi"
10#include "stih416-clock.dtsi" 10#include "stih416-clock.dtsi"
11#include "stih416-pinctrl.dtsi" 11#include "stih416-pinctrl.dtsi"
12
13#include <dt-bindings/phy/phy-miphy365x.h>
12#include <dt-bindings/interrupt-controller/arm-gic.h> 14#include <dt-bindings/interrupt-controller/arm-gic.h>
13#include <dt-bindings/reset-controller/stih416-resets.h> 15#include <dt-bindings/reset-controller/stih416-resets.h>
14/ { 16/ {
@@ -236,5 +238,212 @@
236 resets = <&powerdown STIH416_KEYSCAN_POWERDOWN>, 238 resets = <&powerdown STIH416_KEYSCAN_POWERDOWN>,
237 <&softreset STIH416_KEYSCAN_SOFTRESET>; 239 <&softreset STIH416_KEYSCAN_SOFTRESET>;
238 }; 240 };
241
242 temp0 {
243 compatible = "st,stih416-sas-thermal";
244 clock-names = "thermal";
245 clocks = <&clockgen_c_vcc 14>;
246
247 status = "okay";
248 };
249
250 temp1@fdfe8000 {
251 compatible = "st,stih416-mpe-thermal";
252 reg = <0xfdfe8000 0x10>;
253 clocks = <&clockgen_e 3>;
254 clock-names = "thermal";
255 interrupts = <GIC_SPI 23 IRQ_TYPE_EDGE_RISING>;
256
257 status = "okay";
258 };
259
260 mmc0: sdhci@fe81e000 {
261 compatible = "st,sdhci";
262 status = "disabled";
263 reg = <0xfe81e000 0x1000>;
264 interrupts = <GIC_SPI 127 IRQ_TYPE_NONE>;
265 interrupt-names = "mmcirq";
266 pinctrl-names = "default";
267 pinctrl-0 = <&pinctrl_mmc0>;
268 clock-names = "mmc";
269 clocks = <&clk_s_a1_ls 1>;
270 };
271
272 mmc1: sdhci@fe81f000 {
273 compatible = "st,sdhci";
274 status = "disabled";
275 reg = <0xfe81f000 0x1000>;
276 interrupts = <GIC_SPI 128 IRQ_TYPE_NONE>;
277 interrupt-names = "mmcirq";
278 pinctrl-names = "default";
279 pinctrl-0 = <&pinctrl_mmc1>;
280 clock-names = "mmc";
281 clocks = <&clk_s_a1_ls 8>;
282 };
283
284 miphy365x_phy: phy@fe382000 {
285 compatible = "st,miphy365x-phy";
286 st,syscfg = <&syscfg_rear>;
287 #address-cells = <1>;
288 #size-cells = <1>;
289 ranges;
290
291 phy_port0: port@fe382000 {
292 #phy-cells = <1>;
293 reg = <0xfe382000 0x100>, <0xfe394000 0x100>, <0x824 0x4>;
294 reg-names = "sata", "pcie", "syscfg";
295 };
296
297 phy_port1: port@fe38a000 {
298 #phy-cells = <1>;
299 reg = <0xfe38a000 0x100>, <0xfe804000 0x100>, <0x828 0x4>;
300 reg-names = "sata", "pcie", "syscfg";
301 };
302 };
303
304 sata0: sata@fe380000 {
305 compatible = "st,sti-ahci";
306 reg = <0xfe380000 0x1000>;
307 interrupts = <GIC_SPI 157 IRQ_TYPE_NONE>;
308 interrupt-names = "hostc";
309 phys = <&phy_port0 MIPHY_TYPE_SATA>;
310 phy-names = "sata-phy";
311 resets = <&powerdown STIH416_SATA0_POWERDOWN>,
312 <&softreset STIH416_SATA0_SOFTRESET>;
313 reset-names = "pwr-dwn", "sw-rst";
314 clock-names = "ahci_clk";
315 clocks = <&clk_s_a0_ls CLK_ICN_REG>;
316
317 status = "disabled";
318 };
319
320 usb2_phy: phy@0 {
321 compatible = "st,stih416-usb-phy";
322 #phy-cells = <0>;
323 st,syscfg = <&syscfg_rear>;
324 clocks = <&clk_sysin>;
325 clock-names = "osc_phy";
326 };
327
328 ehci0: usb@fe1ffe00 {
329 compatible = "st,st-ehci-300x";
330 reg = <0xfe1ffe00 0x100>;
331 interrupts = <GIC_SPI 148 IRQ_TYPE_NONE>;
332 pinctrl-names = "default";
333 pinctrl-0 = <&pinctrl_usb0>;
334 clocks = <&clk_s_a1_ls 0>,
335 <&clockgen_b0 0>;
336 clock-names = "ic", "clk48";
337 phys = <&usb2_phy>;
338 phy-names = "usb";
339 resets = <&powerdown STIH416_USB0_POWERDOWN>,
340 <&softreset STIH416_USB0_SOFTRESET>;
341 reset-names = "power", "softreset";
342 };
343
344 ohci0: usb@fe1ffc00 {
345 compatible = "st,st-ohci-300x";
346 reg = <0xfe1ffc00 0x100>;
347 interrupts = <GIC_SPI 149 IRQ_TYPE_NONE>;
348 clocks = <&clk_s_a1_ls 0>,
349 <&clockgen_b0 0>;
350 clock-names = "ic", "clk48";
351 phys = <&usb2_phy>;
352 phy-names = "usb";
353 status = "okay";
354 resets = <&powerdown STIH416_USB0_POWERDOWN>,
355 <&softreset STIH416_USB0_SOFTRESET>;
356 reset-names = "power", "softreset";
357 };
358
359 ehci1: usb@fe203e00 {
360 compatible = "st,st-ehci-300x";
361 reg = <0xfe203e00 0x100>;
362 interrupts = <GIC_SPI 150 IRQ_TYPE_NONE>;
363 pinctrl-names = "default";
364 pinctrl-0 = <&pinctrl_usb1>;
365 clocks = <&clk_s_a1_ls 0>,
366 <&clockgen_b0 0>;
367 clock-names = "ic", "clk48";
368 phys = <&usb2_phy>;
369 phy-names = "usb";
370 resets = <&powerdown STIH416_USB1_POWERDOWN>,
371 <&softreset STIH416_USB1_SOFTRESET>;
372 reset-names = "power", "softreset";
373 };
374
375 ohci1: usb@fe203c00 {
376 compatible = "st,st-ohci-300x";
377 reg = <0xfe203c00 0x100>;
378 interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>;
379 clocks = <&clk_s_a1_ls 0>,
380 <&clockgen_b0 0>;
381 clock-names = "ic", "clk48";
382 phys = <&usb2_phy>;
383 phy-names = "usb";
384 resets = <&powerdown STIH416_USB1_POWERDOWN>,
385 <&softreset STIH416_USB1_SOFTRESET>;
386 reset-names = "power", "softreset";
387 };
388
389 ehci2: usb@fe303e00 {
390 compatible = "st,st-ehci-300x";
391 reg = <0xfe303e00 0x100>;
392 interrupts = <GIC_SPI 152 IRQ_TYPE_NONE>;
393 pinctrl-names = "default";
394 pinctrl-0 = <&pinctrl_usb2>;
395 clocks = <&clk_s_a1_ls 0>,
396 <&clockgen_b0 0>;
397 clock-names = "ic", "clk48";
398 phys = <&usb2_phy>;
399 phy-names = "usb";
400 resets = <&powerdown STIH416_USB2_POWERDOWN>,
401 <&softreset STIH416_USB2_SOFTRESET>;
402 reset-names = "power", "softreset";
403 };
404
405 ohci2: usb@fe303c00 {
406 compatible = "st,st-ohci-300x";
407 reg = <0xfe303c00 0x100>;
408 interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>;
409 clocks = <&clk_s_a1_ls 0>,
410 <&clockgen_b0 0>;
411 clock-names = "ic", "clk48";
412 phys = <&usb2_phy>;
413 phy-names = "usb";
414 resets = <&powerdown STIH416_USB2_POWERDOWN>,
415 <&softreset STIH416_USB2_SOFTRESET>;
416 reset-names = "power", "softreset";
417 };
418
419 ehci3: usb@fe343e00 {
420 compatible = "st,st-ehci-300x";
421 reg = <0xfe343e00 0x100>;
422 interrupts = <GIC_SPI 154 IRQ_TYPE_NONE>;
423 pinctrl-names = "default";
424 pinctrl-0 = <&pinctrl_usb3>;
425 clocks = <&clk_s_a1_ls 0>,
426 <&clockgen_b0 0>;
427 clock-names = "ic", "clk48";
428 phys = <&usb2_phy>;
429 phy-names = "usb";
430 resets = <&powerdown STIH416_USB3_POWERDOWN>,
431 <&softreset STIH416_USB3_SOFTRESET>;
432 reset-names = "power", "softreset";
433 };
434
435 ohci3: usb@fe343c00 {
436 compatible = "st,st-ohci-300x";
437 reg = <0xfe343c00 0x100>;
438 interrupts = <GIC_SPI 155 IRQ_TYPE_NONE>;
439 clocks = <&clk_s_a1_ls 0>,
440 <&clockgen_b0 0>;
441 clock-names = "ic", "clk48";
442 phys = <&usb2_phy>;
443 phy-names = "usb";
444 resets = <&powerdown STIH416_USB3_POWERDOWN>,
445 <&softreset STIH416_USB3_SOFTRESET>;
446 reset-names = "power", "softreset";
447 };
239 }; 448 };
240}; 449};
diff --git a/arch/arm/boot/dts/stih41x-b2000.dtsi b/arch/arm/boot/dts/stih41x-b2000.dtsi
index b3dd6ca5c2ae..5f91f455f05b 100644
--- a/arch/arm/boot/dts/stih41x-b2000.dtsi
+++ b/arch/arm/boot/dts/stih41x-b2000.dtsi
@@ -35,7 +35,7 @@
35 fp_led { 35 fp_led {
36 #gpio-cells = <1>; 36 #gpio-cells = <1>;
37 label = "Front Panel LED"; 37 label = "Front Panel LED";
38 gpios = <&PIO105 7>; 38 gpios = <&pio105 7>;
39 linux,default-trigger = "heartbeat"; 39 linux,default-trigger = "heartbeat";
40 }; 40 };
41 }; 41 };
@@ -55,7 +55,7 @@
55 phy-mode = "mii"; 55 phy-mode = "mii";
56 pinctrl-0 = <&pinctrl_mii0>; 56 pinctrl-0 = <&pinctrl_mii0>;
57 57
58 snps,reset-gpio = <&PIO106 2>; 58 snps,reset-gpio = <&pio106 2>;
59 snps,reset-active-low; 59 snps,reset-active-low;
60 snps,reset-delays-us = <0 10000 10000>; 60 snps,reset-delays-us = <0 10000 10000>;
61 }; 61 };
@@ -65,7 +65,7 @@
65 phy-mode = "mii"; 65 phy-mode = "mii";
66 st,tx-retime-src = "txclk"; 66 st,tx-retime-src = "txclk";
67 67
68 snps,reset-gpio = <&PIO4 7>; 68 snps,reset-gpio = <&pio4 7>;
69 snps,reset-active-low; 69 snps,reset-active-low;
70 snps,reset-delays-us = <0 10000 10000>; 70 snps,reset-delays-us = <0 10000 10000>;
71 }; 71 };
diff --git a/arch/arm/boot/dts/stih41x-b2020.dtsi b/arch/arm/boot/dts/stih41x-b2020.dtsi
index d8a84295c328..487d7d87dbef 100644
--- a/arch/arm/boot/dts/stih41x-b2020.dtsi
+++ b/arch/arm/boot/dts/stih41x-b2020.dtsi
@@ -32,11 +32,11 @@
32 red { 32 red {
33 #gpio-cells = <1>; 33 #gpio-cells = <1>;
34 label = "Front Panel LED"; 34 label = "Front Panel LED";
35 gpios = <&PIO4 1>; 35 gpios = <&pio4 1>;
36 linux,default-trigger = "heartbeat"; 36 linux,default-trigger = "heartbeat";
37 }; 37 };
38 green { 38 green {
39 gpios = <&PIO4 7>; 39 gpios = <&pio4 7>;
40 default-state = "off"; 40 default-state = "off";
41 }; 41 };
42 }; 42 };
@@ -68,11 +68,15 @@
68 phy-mode = "rgmii-id"; 68 phy-mode = "rgmii-id";
69 max-speed = <1000>; 69 max-speed = <1000>;
70 st,tx-retime-src = "clk_125"; 70 st,tx-retime-src = "clk_125";
71 snps,reset-gpio = <&PIO3 0>; 71 snps,reset-gpio = <&pio3 0>;
72 snps,reset-active-low; 72 snps,reset-active-low;
73 snps,reset-delays-us = <0 10000 10000>; 73 snps,reset-delays-us = <0 10000 10000>;
74 74
75 pinctrl-0 = <&pinctrl_rgmii1>; 75 pinctrl-0 = <&pinctrl_rgmii1>;
76 }; 76 };
77
78 mmc0: sdhci@fe81e000 {
79 bus-width = <8>;
80 };
77 }; 81 };
78}; 82};
diff --git a/arch/arm/boot/dts/stih41x-b2020x.dtsi b/arch/arm/boot/dts/stih41x-b2020x.dtsi
index df01c1211b32..f797a0607382 100644
--- a/arch/arm/boot/dts/stih41x-b2020x.dtsi
+++ b/arch/arm/boot/dts/stih41x-b2020x.dtsi
@@ -8,6 +8,10 @@
8 */ 8 */
9/ { 9/ {
10 soc { 10 soc {
11 mmc0: sdhci@fe81e000 {
12 status = "okay";
13 };
14
11 spifsm: spifsm@fe902000 { 15 spifsm: spifsm@fe902000 {
12 #address-cells = <1>; 16 #address-cells = <1>;
13 #size-cells = <1>; 17 #size-cells = <1>;
diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi b/arch/arm/boot/dts/stihxxx-b2120.dtsi
new file mode 100644
index 000000000000..0074bd49797c
--- /dev/null
+++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2014 STMicroelectronics (R&D) Limited.
3 * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9/ {
10 soc {
11 sbc_serial0: serial@9530000 {
12 status = "okay";
13 };
14
15 leds {
16 compatible = "gpio-leds";
17 red {
18 #gpio-cells = <2>;
19 label = "Front Panel LED";
20 gpios = <&pio4 1 0>;
21 linux,default-trigger = "heartbeat";
22 };
23 green {
24 #gpio-cells = <2>;
25 gpios = <&pio1 3 0>;
26 default-state = "off";
27 };
28 };
29
30 i2c@9842000 {
31 status = "okay";
32 };
33
34 i2c@9843000 {
35 status = "okay";
36 };
37
38 i2c@9844000 {
39 status = "okay";
40 };
41
42 i2c@9845000 {
43 status = "okay";
44 };
45
46 i2c@9540000 {
47 status = "okay";
48 };
49
50 /* SSC11 to HDMI */
51 i2c@9541000 {
52 status = "okay";
53 /* HDMI V1.3a supports Standard mode only */
54 clock-frequency = <100000>;
55 st,i2c-min-scl-pulse-width-us = <0>;
56 st,i2c-min-sda-pulse-width-us = <5>;
57 };
58 };
59};
diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
index 9e99ade35e37..3bcfd81837f0 100644
--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -3,12 +3,48 @@
3 * 3 *
4 * Emilio López <emilio@elopez.com.ar> 4 * Emilio López <emilio@elopez.com.ar>
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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts b/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts
index 1763cc7ec023..f3f2974658e4 100644
--- a/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts
+++ b/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts
@@ -1,12 +1,48 @@
1/* 1/*
2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com> 2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
3 * 3 *
4 * The code contained herein is licensed under the GNU General Public 4 * This file is dual-licensed: you can use it either under the terms
5 * License. You may obtain a copy of the GNU General Public License 5 * of the GPL or the X11 license, at your option. Note that this dual
6 * Version 2 or later at the following locations: 6 * licensing only applies to this file, and not this project as a
7 * whole.
7 * 8 *
8 * http://www.opensource.org/licenses/gpl-license.html 9 * a) This file is free software; you can redistribute it and/or
9 * http://www.gnu.org/copyleft/gpl.html 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 file 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 file; 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.
10 */ 46 */
11 47
12/dts-v1/; 48/dts-v1/;
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 3ce56bfbc0b5..6a310da53f18 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -2,12 +2,48 @@
2 * Copyright 2012 Stefan Roese 2 * Copyright 2012 Stefan Roese
3 * Stefan Roese <sr@denx.de> 3 * Stefan Roese <sr@denx.de>
4 * 4 *
5 * The code contained herein is licensed under the GNU General Public 5 * This file is dual-licensed: you can use it either under the terms
6 * License. You may obtain a copy of the GNU General Public License 6 * of the GPL or the X11 license, at your option. Note that this dual
7 * Version 2 or later at the following locations: 7 * licensing only applies to this file, and not this project as a
8 * whole.
8 * 9 *
9 * http://www.opensource.org/licenses/gpl-license.html 10 * a) This file is free software; you can redistribute it and/or
10 * http://www.gnu.org/copyleft/gpl.html 11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
14 *
15 * This file is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public
21 * License along with this file; if not, write to the Free
22 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
23 * MA 02110-1301 USA
24 *
25 * Or, alternatively,
26 *
27 * b) Permission is hereby granted, free of charge, to any person
28 * obtaining a copy of this software and associated documentation
29 * files (the "Software"), to deal in the Software without
30 * restriction, including without limitation the rights to use,
31 * copy, modify, merge, publish, distribute, sublicense, and/or
32 * sell copies of the Software, and to permit persons to whom the
33 * Software is furnished to do so, subject to the following
34 * conditions:
35 *
36 * The above copyright notice and this permission notice shall be
37 * included in all copies or substantial portions of the Software.
38 *
39 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
41 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
43 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 * OTHER DEALINGS IN THE SOFTWARE.
11 */ 47 */
12 48
13/dts-v1/; 49/dts-v1/;
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index 891ea446abae..efc116287e0f 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts b/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
index 6b0c37812ade..3e25ee4d3248 100644
--- a/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
+++ b/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
@@ -3,12 +3,48 @@
3 * 3 *
4 * David Lanzendörfer <david.lanzendoerfer@o2s.ch> 4 * David Lanzendörfer <david.lanzendoerfer@o2s.ch>
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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
index b9ecce60f2e7..8b3f97470249 100644
--- a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
@@ -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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
index d046d568f5a1..88cf1a531155 100644
--- a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
+++ b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
@@ -1,12 +1,48 @@
1/* 1/*
2 * Copyright 2014 - Hans de Goede <hdegoede@redhat.com> 2 * Copyright 2014 - Hans de Goede <hdegoede@redhat.com>
3 * 3 *
4 * The code contained herein is licensed under the GNU General Public 4 * This file is dual-licensed: you can use it either under the terms
5 * License. You may obtain a copy of the GNU General Public License 5 * of the GPL or the X11 license, at your option. Note that this dual
6 * Version 2 or later at the following locations: 6 * licensing only applies to this file, and not this project as a
7 * whole.
7 * 8 *
8 * http://www.opensource.org/licenses/gpl-license.html 9 * a) This file is free software; you can redistribute it and/or
9 * http://www.gnu.org/copyleft/gpl.html 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 file 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 file; 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.
10 */ 46 */
11 47
12/dts-v1/; 48/dts-v1/;
diff --git a/arch/arm/boot/dts/sun4i-a10-pcduino.dts b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
index 6675bcd7860e..ce5994597407 100644
--- a/arch/arm/boot/dts/sun4i-a10-pcduino.dts
+++ b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
@@ -2,12 +2,48 @@
2 * Copyright 2014 Zoltan HERPAI 2 * Copyright 2014 Zoltan HERPAI
3 * Zoltan HERPAI <wigyori@uid0.hu> 3 * Zoltan HERPAI <wigyori@uid0.hu>
4 * 4 *
5 * The code contained herein is licensed under the GNU General Public 5 * This file is dual-licensed: you can use it either under the terms
6 * License. You may obtain a copy of the GNU General Public License 6 * of the GPL or the X11 license, at your option. Note that this dual
7 * Version 2 or later at the following locations: 7 * licensing only applies to this file, and not this project as a
8 * whole.
8 * 9 *
9 * http://www.opensource.org/licenses/gpl-license.html 10 * a) This file is free software; you can redistribute it and/or
10 * http://www.gnu.org/copyleft/gpl.html 11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
14 *
15 * This file is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public
21 * License along with this file; if not, write to the Free
22 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
23 * MA 02110-1301 USA
24 *
25 * Or, alternatively,
26 *
27 * b) Permission is hereby granted, free of charge, to any person
28 * obtaining a copy of this software and associated documentation
29 * files (the "Software"), to deal in the Software without
30 * restriction, including without limitation the rights to use,
31 * copy, modify, merge, publish, distribute, sublicense, and/or
32 * sell copies of the Software, and to permit persons to whom the
33 * Software is furnished to do so, subject to the following
34 * conditions:
35 *
36 * The above copyright notice and this permission notice shall be
37 * included in all copies or substantial portions of the Software.
38 *
39 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
41 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
43 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 * OTHER DEALINGS IN THE SOFTWARE.
11 */ 47 */
12 48
13/dts-v1/; 49/dts-v1/;
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 380f914b226d..e3ab942fd148 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -27,6 +27,20 @@
27 serial7 = &uart7; 27 serial7 = &uart7;
28 }; 28 };
29 29
30 chosen {
31 #address-cells = <1>;
32 #size-cells = <1>;
33 ranges;
34
35 framebuffer@0 {
36 compatible = "allwinner,simple-framebuffer", "simple-framebuffer";
37 allwinner,pipeline = "de_be0-lcd0-hdmi";
38 clocks = <&pll5 1>, <&ahb_gates 36>, <&ahb_gates 43>,
39 <&ahb_gates 44>;
40 status = "disabled";
41 };
42 };
43
30 cpus { 44 cpus {
31 #address-cells = <1>; 45 #address-cells = <1>;
32 #size-cells = <0>; 46 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
index ea9519da5764..fe3c559ca6a8 100644
--- a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
@@ -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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun5i-a10s-r7-tv-dongle.dts b/arch/arm/boot/dts/sun5i-a10s-r7-tv-dongle.dts
index 43a93762d4f2..1fa2916eafc2 100644
--- a/arch/arm/boot/dts/sun5i-a10s-r7-tv-dongle.dts
+++ b/arch/arm/boot/dts/sun5i-a10s-r7-tv-dongle.dts
@@ -1,12 +1,48 @@
1/* 1/*
2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com> 2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
3 * 3 *
4 * The code contained herein is licensed under the GNU General Public 4 * This file is dual-licensed: you can use it either under the terms
5 * License. You may obtain a copy of the GNU General Public License 5 * of the GPL or the X11 license, at your option. Note that this dual
6 * Version 2 or later at the following locations: 6 * licensing only applies to this file, and not this project as a
7 * whole.
7 * 8 *
8 * http://www.opensource.org/licenses/gpl-license.html 9 * a) This file is free software; you can redistribute it and/or
9 * http://www.gnu.org/copyleft/gpl.html 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 file 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 file; 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.
10 */ 46 */
11 47
12/dts-v1/; 48/dts-v1/;
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index 531272c0e526..81ad4b94e812 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -24,6 +24,20 @@
24 serial3 = &uart3; 24 serial3 = &uart3;
25 }; 25 };
26 26
27 chosen {
28 #address-cells = <1>;
29 #size-cells = <1>;
30 ranges;
31
32 framebuffer@0 {
33 compatible = "allwinner,simple-framebuffer", "simple-framebuffer";
34 allwinner,pipeline = "de_be0-lcd0-hdmi";
35 clocks = <&pll5 1>, <&ahb_gates 36>, <&ahb_gates 43>,
36 <&ahb_gates 44>;
37 status = "disabled";
38 };
39 };
40
27 cpus { 41 cpus {
28 cpu@0 { 42 cpu@0 {
29 compatible = "arm,cortex-a8"; 43 compatible = "arm,cortex-a8";
diff --git a/arch/arm/boot/dts/sun5i-a13-hsg-h702.dts b/arch/arm/boot/dts/sun5i-a13-hsg-h702.dts
index 8b3cd0907b32..eeed1f236ee8 100644
--- a/arch/arm/boot/dts/sun5i-a13-hsg-h702.dts
+++ b/arch/arm/boot/dts/sun5i-a13-hsg-h702.dts
@@ -6,18 +6,18 @@
6 * licensing only applies to this file, and not this project as a 6 * licensing only applies to this file, and not this project as a
7 * whole. 7 * whole.
8 * 8 *
9 * a) This library is free software; you can redistribute it and/or 9 * a) This file is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as 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 11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version. 12 * License, or (at your option) any later version.
13 * 13 *
14 * This library is distributed in the hope that it will be useful, 14 * This file is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU General Public 19 * You should have received a copy of the GNU General Public
20 * License along with this library; if not, write to the Free 20 * License along with this file; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 21 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 * MA 02110-1301 USA 22 * MA 02110-1301 USA
23 * 23 *
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts
index fa44b026483b..916ee8bb826f 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts
@@ -1,15 +1,49 @@
1/* 1/*
2 * Copyright 2012 Maxime Ripard 2 * Copyright 2012 Maxime Ripard <maxime.ripard@free-electrons.com>
3 * Copyright 2013 Hans de Goede <hdegoede@redhat.com> 3 * Copyright 2013 Hans de Goede <hdegoede@redhat.com>
4 * 4 *
5 * Maxime Ripard <maxime.ripard@free-electrons.com> 5 * This file is dual-licensed: you can use it either under the terms
6 * of the GPL or the X11 license, at your option. Note that this dual
7 * licensing only applies to this file, and not this project as a
8 * whole.
6 * 9 *
7 * The code contained herein is licensed under the GNU General Public 10 * a) This file is free software; you can redistribute it and/or
8 * License. You may obtain a copy of the GNU General Public License 11 * modify it under the terms of the GNU General Public License as
9 * Version 2 or later at the following locations: 12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
10 * 14 *
11 * http://www.opensource.org/licenses/gpl-license.html 15 * This file is distributed in the hope that it will be useful,
12 * http://www.gnu.org/copyleft/gpl.html 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public
21 * License along with this file; if not, write to the Free
22 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
23 * MA 02110-1301 USA
24 *
25 * Or, alternatively,
26 *
27 * b) Permission is hereby granted, free of charge, to any person
28 * obtaining a copy of this software and associated documentation
29 * files (the "Software"), to deal in the Software without
30 * restriction, including without limitation the rights to use,
31 * copy, modify, merge, publish, distribute, sublicense, and/or
32 * sell copies of the Software, and to permit persons to whom the
33 * Software is furnished to do so, subject to the following
34 * conditions:
35 *
36 * The above copyright notice and this permission notice shall be
37 * included in all copies or substantial portions of the Software.
38 *
39 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
41 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
43 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 * OTHER DEALINGS IN THE SOFTWARE.
13 */ 47 */
14 48
15/dts-v1/; 49/dts-v1/;
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index 429994e1943e..e31d291d14cb 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts b/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts
index 2bbf8867362b..c74a63a39531 100644
--- a/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts
+++ b/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts
@@ -3,12 +3,48 @@
3 * 3 *
4 * Boris Brezillon <boris.brezillon@free-electrons.com> 4 * Boris Brezillon <boris.brezillon@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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun6i-a31-colombus.dts b/arch/arm/boot/dts/sun6i-a31-colombus.dts
index 546cf6eff5c7..c36b4dc89c13 100644
--- a/arch/arm/boot/dts/sun6i-a31-colombus.dts
+++ b/arch/arm/boot/dts/sun6i-a31-colombus.dts
@@ -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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
index f142065b3c1f..6e924d9d2912 100644
--- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
+++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
@@ -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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun6i-a31-m9.dts b/arch/arm/boot/dts/sun6i-a31-m9.dts
index bc6115da5ae1..3ab544f3af4a 100644
--- a/arch/arm/boot/dts/sun6i-a31-m9.dts
+++ b/arch/arm/boot/dts/sun6i-a31-m9.dts
@@ -1,12 +1,48 @@
1/* 1/*
2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com> 2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
3 * 3 *
4 * The code contained herein is licensed under the GNU General Public 4 * This file is dual-licensed: you can use it either under the terms
5 * License. You may obtain a copy of the GNU General Public License 5 * of the GPL or the X11 license, at your option. Note that this dual
6 * Version 2 or later at the following locations: 6 * licensing only applies to this file, and not this project as a
7 * whole.
7 * 8 *
8 * http://www.opensource.org/licenses/gpl-license.html 9 * a) This file is free software; you can redistribute it and/or
9 * http://www.gnu.org/copyleft/gpl.html 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 file 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 file; 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.
10 */ 46 */
11 47
12/dts-v1/; 48/dts-v1/;
@@ -32,13 +68,40 @@
32 status = "okay"; 68 status = "okay";
33 }; 69 };
34 70
71 usbphy: phy@01c19400 {
72 usb1_vbus-supply = <&reg_usb1_vbus>;
73 status = "okay";
74 };
75
76 ehci0: usb@01c1a000 {
77 status = "okay";
78 };
79
80 ehci1: usb@01c1b000 {
81 status = "okay";
82 };
83
35 pio: pinctrl@01c20800 { 84 pio: pinctrl@01c20800 {
85 led_pins_m9: led_pins@0 {
86 allwinner,pins = "PH13";
87 allwinner,function = "gpio_out";
88 allwinner,drive = <0>;
89 allwinner,pull = <0>;
90 };
91
36 mmc0_cd_pin_m9: mmc0_cd_pin@0 { 92 mmc0_cd_pin_m9: mmc0_cd_pin@0 {
37 allwinner,pins = "PH22"; 93 allwinner,pins = "PH22";
38 allwinner,function = "gpio_in"; 94 allwinner,function = "gpio_in";
39 allwinner,drive = <0>; 95 allwinner,drive = <0>;
40 allwinner,pull = <1>; 96 allwinner,pull = <1>;
41 }; 97 };
98
99 usb1_vbus_pin_m9: usb1_vbus_pin@0 {
100 allwinner,pins = "PC27";
101 allwinner,function = "gpio_out";
102 allwinner,drive = <0>;
103 allwinner,pull = <0>;
104 };
42 }; 105 };
43 106
44 uart0: serial@01c28000 { 107 uart0: serial@01c28000 {
@@ -46,5 +109,35 @@
46 pinctrl-0 = <&uart0_pins_a>; 109 pinctrl-0 = <&uart0_pins_a>;
47 status = "okay"; 110 status = "okay";
48 }; 111 };
112
113 gmac: ethernet@01c30000 {
114 pinctrl-names = "default";
115 pinctrl-0 = <&gmac_pins_mii_a>;
116 phy = <&phy1>;
117 phy-mode = "mii";
118 status = "okay";
119
120 phy1: ethernet-phy@1 {
121 reg = <1>;
122 };
123 };
124 };
125
126 leds {
127 compatible = "gpio-leds";
128 pinctrl-names = "default";
129 pinctrl-0 = <&led_pins_m9>;
130
131 blue {
132 label = "m9:blue:usr";
133 gpios = <&pio 7 13 0>;
134 };
135 };
136
137 reg_usb1_vbus: usb1-vbus {
138 pinctrl-names = "default";
139 pinctrl-0 = <&usb1_vbus_pin_m9>;
140 gpio = <&pio 2 27 0>;
141 status = "okay";
49 }; 142 };
50}; 143};
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 2e652e2339e9..a400172a8a52 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -8,18 +8,18 @@
8 * licensing only applies to this file, and not this project as a 8 * licensing only applies to this file, and not this project as a
9 * whole. 9 * whole.
10 * 10 *
11 * a) This library is free software; you can redistribute it and/or 11 * a) This file is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as 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 13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version. 14 * License, or (at your option) any later version.
15 * 15 *
16 * This library is distributed in the hope that it will be useful, 16 * This file is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details. 19 * GNU General Public License for more details.
20 * 20 *
21 * You should have received a copy of the GNU General Public 21 * You should have received a copy of the GNU General Public
22 * License along with this library; if not, write to the Free 22 * License along with this file; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 * MA 02110-1301 USA 24 * MA 02110-1301 USA
25 * 25 *
@@ -62,6 +62,18 @@
62 ethernet0 = &gmac; 62 ethernet0 = &gmac;
63 }; 63 };
64 64
65 chosen {
66 #address-cells = <1>;
67 #size-cells = <1>;
68 ranges;
69
70 framebuffer@0 {
71 compatible = "allwinner,simple-framebuffer", "simple-framebuffer";
72 allwinner,pipeline = "de_be0-lcd0-hdmi";
73 clocks = <&pll6 0>;
74 status = "disabled";
75 };
76 };
65 77
66 cpus { 78 cpus {
67 enable-method = "allwinner,sun6i-a31"; 79 enable-method = "allwinner,sun6i-a31";
@@ -132,11 +144,11 @@
132 }; 144 };
133 145
134 pll6: clk@01c20028 { 146 pll6: clk@01c20028 {
135 #clock-cells = <0>; 147 #clock-cells = <1>;
136 compatible = "allwinner,sun6i-a31-pll6-clk"; 148 compatible = "allwinner,sun6i-a31-pll6-clk";
137 reg = <0x01c20028 0x4>; 149 reg = <0x01c20028 0x4>;
138 clocks = <&osc24M>; 150 clocks = <&osc24M>;
139 clock-output-names = "pll6"; 151 clock-output-names = "pll6", "pll6x2";
140 }; 152 };
141 153
142 cpu: cpu@01c20050 { 154 cpu: cpu@01c20050 {
@@ -166,7 +178,7 @@
166 #clock-cells = <0>; 178 #clock-cells = <0>;
167 compatible = "allwinner,sun6i-a31-ahb1-mux-clk"; 179 compatible = "allwinner,sun6i-a31-ahb1-mux-clk";
168 reg = <0x01c20054 0x4>; 180 reg = <0x01c20054 0x4>;
169 clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6>; 181 clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>;
170 clock-output-names = "ahb1_mux"; 182 clock-output-names = "ahb1_mux";
171 }; 183 };
172 184
@@ -221,7 +233,7 @@
221 #clock-cells = <0>; 233 #clock-cells = <0>;
222 compatible = "allwinner,sun4i-a10-apb1-mux-clk"; 234 compatible = "allwinner,sun4i-a10-apb1-mux-clk";
223 reg = <0x01c20058 0x4>; 235 reg = <0x01c20058 0x4>;
224 clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>; 236 clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>;
225 clock-output-names = "apb2_mux"; 237 clock-output-names = "apb2_mux";
226 }; 238 };
227 239
@@ -248,7 +260,7 @@
248 #clock-cells = <0>; 260 #clock-cells = <0>;
249 compatible = "allwinner,sun4i-a10-mod0-clk"; 261 compatible = "allwinner,sun4i-a10-mod0-clk";
250 reg = <0x01c20088 0x4>; 262 reg = <0x01c20088 0x4>;
251 clocks = <&osc24M>, <&pll6>; 263 clocks = <&osc24M>, <&pll6 0>;
252 clock-output-names = "mmc0"; 264 clock-output-names = "mmc0";
253 }; 265 };
254 266
@@ -256,7 +268,7 @@
256 #clock-cells = <0>; 268 #clock-cells = <0>;
257 compatible = "allwinner,sun4i-a10-mod0-clk"; 269 compatible = "allwinner,sun4i-a10-mod0-clk";
258 reg = <0x01c2008c 0x4>; 270 reg = <0x01c2008c 0x4>;
259 clocks = <&osc24M>, <&pll6>; 271 clocks = <&osc24M>, <&pll6 0>;
260 clock-output-names = "mmc1"; 272 clock-output-names = "mmc1";
261 }; 273 };
262 274
@@ -264,7 +276,7 @@
264 #clock-cells = <0>; 276 #clock-cells = <0>;
265 compatible = "allwinner,sun4i-a10-mod0-clk"; 277 compatible = "allwinner,sun4i-a10-mod0-clk";
266 reg = <0x01c20090 0x4>; 278 reg = <0x01c20090 0x4>;
267 clocks = <&osc24M>, <&pll6>; 279 clocks = <&osc24M>, <&pll6 0>;
268 clock-output-names = "mmc2"; 280 clock-output-names = "mmc2";
269 }; 281 };
270 282
@@ -272,7 +284,7 @@
272 #clock-cells = <0>; 284 #clock-cells = <0>;
273 compatible = "allwinner,sun4i-a10-mod0-clk"; 285 compatible = "allwinner,sun4i-a10-mod0-clk";
274 reg = <0x01c20094 0x4>; 286 reg = <0x01c20094 0x4>;
275 clocks = <&osc24M>, <&pll6>; 287 clocks = <&osc24M>, <&pll6 0>;
276 clock-output-names = "mmc3"; 288 clock-output-names = "mmc3";
277 }; 289 };
278 290
@@ -280,7 +292,7 @@
280 #clock-cells = <0>; 292 #clock-cells = <0>;
281 compatible = "allwinner,sun4i-a10-mod0-clk"; 293 compatible = "allwinner,sun4i-a10-mod0-clk";
282 reg = <0x01c200a0 0x4>; 294 reg = <0x01c200a0 0x4>;
283 clocks = <&osc24M>, <&pll6>; 295 clocks = <&osc24M>, <&pll6 0>;
284 clock-output-names = "spi0"; 296 clock-output-names = "spi0";
285 }; 297 };
286 298
@@ -288,7 +300,7 @@
288 #clock-cells = <0>; 300 #clock-cells = <0>;
289 compatible = "allwinner,sun4i-a10-mod0-clk"; 301 compatible = "allwinner,sun4i-a10-mod0-clk";
290 reg = <0x01c200a4 0x4>; 302 reg = <0x01c200a4 0x4>;
291 clocks = <&osc24M>, <&pll6>; 303 clocks = <&osc24M>, <&pll6 0>;
292 clock-output-names = "spi1"; 304 clock-output-names = "spi1";
293 }; 305 };
294 306
@@ -296,7 +308,7 @@
296 #clock-cells = <0>; 308 #clock-cells = <0>;
297 compatible = "allwinner,sun4i-a10-mod0-clk"; 309 compatible = "allwinner,sun4i-a10-mod0-clk";
298 reg = <0x01c200a8 0x4>; 310 reg = <0x01c200a8 0x4>;
299 clocks = <&osc24M>, <&pll6>; 311 clocks = <&osc24M>, <&pll6 0>;
300 clock-output-names = "spi2"; 312 clock-output-names = "spi2";
301 }; 313 };
302 314
@@ -304,7 +316,7 @@
304 #clock-cells = <0>; 316 #clock-cells = <0>;
305 compatible = "allwinner,sun4i-a10-mod0-clk"; 317 compatible = "allwinner,sun4i-a10-mod0-clk";
306 reg = <0x01c200ac 0x4>; 318 reg = <0x01c200ac 0x4>;
307 clocks = <&osc24M>, <&pll6>; 319 clocks = <&osc24M>, <&pll6 0>;
308 clock-output-names = "spi3"; 320 clock-output-names = "spi3";
309 }; 321 };
310 322
@@ -364,7 +376,7 @@
364 376
365 /* DMA controller requires AHB1 clocked from PLL6 */ 377 /* DMA controller requires AHB1 clocked from PLL6 */
366 assigned-clocks = <&ahb1_mux>; 378 assigned-clocks = <&ahb1_mux>;
367 assigned-clock-parents = <&pll6>; 379 assigned-clock-parents = <&pll6 0>;
368 }; 380 };
369 381
370 mmc0: mmc@01c0f000 { 382 mmc0: mmc@01c0f000 {
@@ -844,7 +856,7 @@
844 ar100: ar100_clk { 856 ar100: ar100_clk {
845 compatible = "allwinner,sun6i-a31-ar100-clk"; 857 compatible = "allwinner,sun6i-a31-ar100-clk";
846 #clock-cells = <0>; 858 #clock-cells = <0>;
847 clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>; 859 clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>;
848 clock-output-names = "ar100"; 860 clock-output-names = "ar100";
849 }; 861 };
850 862
diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi.dts b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
new file mode 100644
index 000000000000..1cf1214cc068
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
@@ -0,0 +1,214 @@
1/*
2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
3 *
4 * Hans de Goede <hdegoede@redhat.com>
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 file 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 file 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 file; 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/include/ "sun7i-a20.dtsi"
52/include/ "sunxi-common-regulators.dtsi"
53
54/ {
55 model = "LeMaker Banana Pi";
56 compatible = "lemaker,bananapi", "allwinner,sun7i-a20";
57
58 soc@01c00000 {
59 spi0: spi@01c05000 {
60 pinctrl-names = "default";
61 pinctrl-0 = <&spi0_pins_a>;
62 status = "okay";
63 };
64
65 mmc0: mmc@01c0f000 {
66 pinctrl-names = "default";
67 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bananapi>;
68 vmmc-supply = <&reg_vcc3v3>;
69 bus-width = <4>;
70 cd-gpios = <&pio 7 10 0>; /* PH10 */
71 cd-inverted;
72 status = "okay";
73 };
74
75 usbphy: phy@01c13400 {
76 usb1_vbus-supply = <&reg_usb1_vbus>;
77 usb2_vbus-supply = <&reg_usb2_vbus>;
78 status = "okay";
79 };
80
81 ehci0: usb@01c14000 {
82 status = "okay";
83 };
84
85 ohci0: usb@01c14400 {
86 status = "okay";
87 };
88
89 ahci: sata@01c18000 {
90 status = "okay";
91 };
92
93 ehci1: usb@01c1c000 {
94 status = "okay";
95 };
96
97 ohci1: usb@01c1c400 {
98 status = "okay";
99 };
100
101 pinctrl@01c20800 {
102 mmc0_cd_pin_bananapi: mmc0_cd_pin@0 {
103 allwinner,pins = "PH10";
104 allwinner,function = "gpio_in";
105 allwinner,drive = <0>;
106 allwinner,pull = <1>;
107 };
108
109 gmac_power_pin_bananapi: gmac_power_pin@0 {
110 allwinner,pins = "PH23";
111 allwinner,function = "gpio_out";
112 allwinner,drive = <0>;
113 allwinner,pull = <0>;
114 };
115
116 led_pins_bananapi: led_pins@0 {
117 allwinner,pins = "PH24";
118 allwinner,function = "gpio_out";
119 allwinner,drive = <0>;
120 allwinner,pull = <0>;
121 };
122 };
123
124 ir0: ir@01c21800 {
125 pinctrl-names = "default";
126 pinctrl-0 = <&ir0_pins_a>;
127 status = "okay";
128 };
129
130 uart0: serial@01c28000 {
131 pinctrl-names = "default";
132 pinctrl-0 = <&uart0_pins_a>;
133 status = "okay";
134 };
135
136 uart3: serial@01c28c00 {
137 pinctrl-names = "default";
138 pinctrl-0 = <&uart3_pins_b>;
139 status = "okay";
140 };
141
142 uart7: serial@01c29c00 {
143 pinctrl-names = "default";
144 pinctrl-0 = <&uart7_pins_a>;
145 status = "okay";
146 };
147
148 i2c0: i2c@01c2ac00 {
149 pinctrl-names = "default";
150 pinctrl-0 = <&i2c0_pins_a>;
151 status = "okay";
152
153 axp209: pmic@34 {
154 compatible = "x-powers,axp209";
155 reg = <0x34>;
156 interrupt-parent = <&nmi_intc>;
157 interrupts = <0 8>;
158
159 interrupt-controller;
160 #interrupt-cells = <1>;
161 };
162 };
163
164 i2c2: i2c@01c2b400 {
165 pinctrl-names = "default";
166 pinctrl-0 = <&i2c2_pins_a>;
167 status = "okay";
168 };
169
170 gmac: ethernet@01c50000 {
171 pinctrl-names = "default";
172 pinctrl-0 = <&gmac_pins_rgmii_a>;
173 phy = <&phy1>;
174 phy-mode = "rgmii";
175 phy-supply = <&reg_gmac_3v3>;
176 status = "okay";
177
178 phy1: ethernet-phy@1 {
179 reg = <1>;
180 };
181 };
182 };
183
184 leds {
185 compatible = "gpio-leds";
186 pinctrl-names = "default";
187 pinctrl-0 = <&led_pins_bananapi>;
188
189 green {
190 label = "bananapi:green:usr";
191 gpios = <&pio 7 24 0>;
192 };
193 };
194
195 reg_usb1_vbus: usb1-vbus {
196 status = "okay";
197 };
198
199 reg_usb2_vbus: usb2-vbus {
200 status = "okay";
201 };
202
203 reg_gmac_3v3: gmac-3v3 {
204 compatible = "regulator-fixed";
205 pinctrl-names = "default";
206 pinctrl-0 = <&gmac_power_pin_bananapi>;
207 regulator-name = "gmac-3v3";
208 regulator-min-microvolt = <3300000>;
209 regulator-max-microvolt = <3300000>;
210 startup-delay-us = <100000>;
211 enable-active-high;
212 gpio = <&pio 7 23 0>;
213 };
214};
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
index a6c1a3c717bc..a281d259b9b8 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -40,6 +40,7 @@
40 }; 40 };
41 41
42 usbphy: phy@01c13400 { 42 usbphy: phy@01c13400 {
43 usb0_vbus-supply = <&reg_usb0_vbus>;
43 usb1_vbus-supply = <&reg_usb1_vbus>; 44 usb1_vbus-supply = <&reg_usb1_vbus>;
44 usb2_vbus-supply = <&reg_usb2_vbus>; 45 usb2_vbus-supply = <&reg_usb2_vbus>;
45 status = "okay"; 46 status = "okay";
@@ -92,6 +93,13 @@
92 allwinner,drive = <0>; 93 allwinner,drive = <0>;
93 allwinner,pull = <0>; 94 allwinner,pull = <0>;
94 }; 95 };
96
97 usb0_vbus_pin_a: usb0_vbus_pin@0 {
98 allwinner,pins = "PH17";
99 allwinner,function = "gpio_out";
100 allwinner,drive = <0>;
101 allwinner,pull = <0>;
102 };
95 }; 103 };
96 104
97 pwm: pwm@01c20e00 { 105 pwm: pwm@01c20e00 {
@@ -185,6 +193,12 @@
185 status = "okay"; 193 status = "okay";
186 }; 194 };
187 195
196 reg_usb0_vbus: usb0-vbus {
197 pinctrl-0 = <&usb0_vbus_pin_a>;
198 gpio = <&pio 7 17 0>;
199 status = "okay";
200 };
201
188 reg_usb1_vbus: usb1-vbus { 202 reg_usb1_vbus: usb1-vbus {
189 status = "okay"; 203 status = "okay";
190 }; 204 };
diff --git a/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts b/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
index 6a67712d417a..f38bb1a6656c 100644
--- a/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
+++ b/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
@@ -1,12 +1,48 @@
1/* 1/*
2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com> 2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
3 * 3 *
4 * The code contained herein is licensed under the GNU General Public 4 * This file is dual-licensed: you can use it either under the terms
5 * License. You may obtain a copy of the GNU General Public License 5 * of the GPL or the X11 license, at your option. Note that this dual
6 * Version 2 or later at the following locations: 6 * licensing only applies to this file, and not this project as a
7 * whole.
7 * 8 *
8 * http://www.opensource.org/licenses/gpl-license.html 9 * a) This file is free software; you can redistribute it and/or
9 * http://www.gnu.org/copyleft/gpl.html 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 file 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 file; 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.
10 */ 46 */
11 47
12/dts-v1/; 48/dts-v1/;
diff --git a/arch/arm/boot/dts/sun7i-a20-m3.dts b/arch/arm/boot/dts/sun7i-a20-m3.dts
new file mode 100644
index 000000000000..b8e568c55271
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-m3.dts
@@ -0,0 +1,168 @@
1/*
2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
3 *
4 * Hans de Goede <hdegoede@redhat.com>
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 file 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 file 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 file; 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/include/ "sun7i-a20.dtsi"
52/include/ "sunxi-common-regulators.dtsi"
53
54/ {
55 model = "Mele M3";
56 compatible = "mele,m3", "allwinner,sun7i-a20";
57
58 soc@01c00000 {
59 mmc0: mmc@01c0f000 {
60 pinctrl-names = "default";
61 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
62 vmmc-supply = <&reg_vcc3v3>;
63 bus-width = <4>;
64 cd-gpios = <&pio 7 1 0>; /* PH1 */
65 cd-inverted;
66 status = "okay";
67 };
68
69 mmc2: mmc@01c11000 {
70 pinctrl-names = "default";
71 pinctrl-0 = <&mmc2_pins_a>;
72 vmmc-supply = <&reg_vcc3v3>;
73 bus-width = <4>;
74 non-removable;
75 status = "okay";
76 };
77
78 usbphy: phy@01c13400 {
79 usb1_vbus-supply = <&reg_usb1_vbus>;
80 usb2_vbus-supply = <&reg_usb2_vbus>;
81 status = "okay";
82 };
83
84 ehci0: usb@01c14000 {
85 status = "okay";
86 };
87
88 ohci0: usb@01c14400 {
89 status = "okay";
90 };
91
92 ehci1: usb@01c1c000 {
93 status = "okay";
94 };
95
96 ohci1: usb@01c1c400 {
97 status = "okay";
98 };
99
100 pinctrl@01c20800 {
101 led_pins_m3: led_pins@0 {
102 allwinner,pins = "PH20";
103 allwinner,function = "gpio_out";
104 allwinner,drive = <0>;
105 allwinner,pull = <0>;
106 };
107 };
108
109 ir0: ir@01c21800 {
110 pinctrl-names = "default";
111 pinctrl-0 = <&ir0_pins_a>;
112 status = "okay";
113 };
114
115 uart0: serial@01c28000 {
116 pinctrl-names = "default";
117 pinctrl-0 = <&uart0_pins_a>;
118 status = "okay";
119 };
120
121 i2c0: i2c@01c2ac00 {
122 pinctrl-names = "default";
123 pinctrl-0 = <&i2c0_pins_a>;
124 status = "okay";
125
126 axp209: pmic@34 {
127 compatible = "x-powers,axp209";
128 reg = <0x34>;
129 interrupt-parent = <&nmi_intc>;
130 interrupts = <0 8>;
131
132 interrupt-controller;
133 #interrupt-cells = <1>;
134 };
135 };
136
137 gmac: ethernet@01c50000 {
138 pinctrl-names = "default";
139 pinctrl-0 = <&gmac_pins_mii_a>;
140 phy = <&phy1>;
141 phy-mode = "mii";
142 status = "okay";
143
144 phy1: ethernet-phy@1 {
145 reg = <1>;
146 };
147 };
148 };
149
150 leds {
151 compatible = "gpio-leds";
152 pinctrl-names = "default";
153 pinctrl-0 = <&led_pins_m3>;
154
155 blue {
156 label = "m3:blue:usr";
157 gpios = <&pio 7 20 0>;
158 };
159 };
160
161 reg_usb1_vbus: usb1-vbus {
162 status = "okay";
163 };
164
165 reg_usb2_vbus: usb2-vbus {
166 status = "okay";
167 };
168};
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts
index 1eb8175959a6..3f3ff9693992 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts
@@ -4,12 +4,48 @@
4 * Copyright 2014 - Hans de Goede <hdegoede@redhat.com> 4 * Copyright 2014 - Hans de Goede <hdegoede@redhat.com>
5 * Copyright (c) 2014 FUKAUMI Naoki <naobsd@gmail.com> 5 * Copyright (c) 2014 FUKAUMI Naoki <naobsd@gmail.com>
6 * 6 *
7 * The code contained herein is licensed under the GNU General Public 7 * This file is dual-licensed: you can use it either under the terms
8 * License. You may obtain a copy of the GNU General Public License 8 * of the GPL or the X11 license, at your option. Note that this dual
9 * Version 2 or later at the following locations: 9 * licensing only applies to this file, and not this project as a
10 * whole.
10 * 11 *
11 * http://www.opensource.org/licenses/gpl-license.html 12 * a) This file is free software; you can redistribute it and/or
12 * http://www.gnu.org/copyleft/gpl.html 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 file 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 * You should have received a copy of the GNU General Public
23 * License along with this file; if not, write to the Free
24 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
25 * MA 02110-1301 USA
26 *
27 * Or, alternatively,
28 *
29 * b) Permission is hereby granted, free of charge, to any person
30 * obtaining a copy of this software and associated documentation
31 * files (the "Software"), to deal in the Software without
32 * restriction, including without limitation the rights to use,
33 * copy, modify, merge, publish, distribute, sublicense, and/or
34 * sell copies of the Software, and to permit persons to whom the
35 * Software is furnished to do so, subject to the following
36 * conditions:
37 *
38 * The above copyright notice and this permission notice shall be
39 * included in all copies or substantial portions of the Software.
40 *
41 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
42 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
43 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
44 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
45 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
46 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
47 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
48 * OTHER DEALINGS IN THE SOFTWARE.
13 */ 49 */
14 50
15/dts-v1/; 51/dts-v1/;
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
new file mode 100644
index 000000000000..ed364d5e755e
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
@@ -0,0 +1,228 @@
1/*
2 * Copyright 2014 - Iain Paton <ipaton0@gmail.com>
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 file 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 file 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 file; 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/ "sun7i-a20.dtsi"
50/include/ "sunxi-common-regulators.dtsi"
51
52/ {
53 model = "Olimex A20-OLinuXino-LIME2";
54 compatible = "olimex,a20-olinuxino-lime2", "allwinner,sun7i-a20";
55
56 soc@01c00000 {
57 mmc0: mmc@01c0f000 {
58 pinctrl-names = "default";
59 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
60 vmmc-supply = <&reg_vcc3v3>;
61 bus-width = <4>;
62 cd-gpios = <&pio 7 1 0>; /* PH1 */
63 cd-inverted;
64 status = "okay";
65 };
66
67 usbphy: phy@01c13400 {
68 usb1_vbus-supply = <&reg_usb1_vbus>;
69 usb2_vbus-supply = <&reg_usb2_vbus>;
70 status = "okay";
71 };
72
73 ehci0: usb@01c14000 {
74 status = "okay";
75 };
76
77 ohci0: usb@01c14400 {
78 status = "okay";
79 };
80
81 ahci: sata@01c18000 {
82 target-supply = <&reg_ahci_5v>;
83 status = "okay";
84 };
85
86 ehci1: usb@01c1c000 {
87 status = "okay";
88 };
89
90 ohci1: usb@01c1c400 {
91 status = "okay";
92 };
93
94 pinctrl@01c20800 {
95 ahci_pwr_pin_olinuxinolime: ahci_pwr_pin@1 {
96 allwinner,pins = "PC3";
97 allwinner,function = "gpio_out";
98 allwinner,drive = <0>;
99 allwinner,pull = <0>;
100 };
101
102 led_pins_olinuxinolime: led_pins@0 {
103 allwinner,pins = "PH2";
104 allwinner,function = "gpio_out";
105 allwinner,drive = <1>;
106 allwinner,pull = <0>;
107 };
108 };
109
110 uart0: serial@01c28000 {
111 pinctrl-names = "default";
112 pinctrl-0 = <&uart0_pins_a>;
113 status = "okay";
114 };
115
116 i2c0: i2c@01c2ac00 {
117 pinctrl-names = "default";
118 pinctrl-0 = <&i2c0_pins_a>;
119 status = "okay";
120
121 axp209: pmic@34 {
122 compatible = "x-powers,axp209";
123 reg = <0x34>;
124 interrupt-parent = <&nmi_intc>;
125 interrupts = <0 8>;
126
127 interrupt-controller;
128 #interrupt-cells = <1>;
129
130 acin-supply = <&reg_axp_ipsout>;
131 vin2-supply = <&reg_axp_ipsout>;
132 vin3-supply = <&reg_axp_ipsout>;
133 ldo24in-supply = <&reg_axp_ipsout>;
134 ldo3in-supply = <&reg_axp_ipsout>;
135
136 regulators {
137 vdd_rtc: ldo1 {
138 regulator-min-microvolt = <1300000>;
139 regulator-max-microvolt = <1300000>;
140 regulator-always-on;
141 };
142
143 avcc: ldo2 {
144 regulator-min-microvolt = <1800000>;
145 regulator-max-microvolt = <3300000>;
146 regulator-always-on;
147 };
148
149 vcc_csi0: ldo3 {
150 regulator-min-microvolt = <700000>;
151 regulator-max-microvolt = <3500000>;
152 regulator-always-on;
153 };
154
155 vcc_csi1: ldo4 {
156 regulator-min-microvolt = <1250000>;
157 regulator-max-microvolt = <3300000>;
158 regulator-always-on;
159 };
160
161 vdd_cpu: dcdc2 {
162 regulator-min-microvolt = <700000>;
163 regulator-max-microvolt = <2275000>;
164 regulator-always-on;
165 };
166
167 vdd_int: dcdc3 {
168 regulator-min-microvolt = <700000>;
169 regulator-max-microvolt = <3500000>;
170 regulator-always-on;
171 };
172 };
173 };
174 };
175
176 i2c1: i2c@01c2b000 {
177 pinctrl-names = "default";
178 pinctrl-0 = <&i2c1_pins_a>;
179 status = "okay";
180 };
181
182 gmac: ethernet@01c50000 {
183 pinctrl-names = "default";
184 pinctrl-0 = <&gmac_pins_rgmii_a>;
185 phy = <&phy1>;
186 phy-mode = "rgmii";
187 status = "okay";
188
189 phy1: ethernet-phy@1 {
190 reg = <1>;
191 };
192 };
193 };
194
195 leds {
196 compatible = "gpio-leds";
197 pinctrl-names = "default";
198 pinctrl-0 = <&led_pins_olinuxinolime>;
199
200 green {
201 label = "a20-olinuxino-lime2:green:usr";
202 gpios = <&pio 7 2 0>;
203 default-state = "on";
204 };
205 };
206
207 reg_ahci_5v: ahci-5v {
208 pinctrl-0 = <&ahci_pwr_pin_olinuxinolime>;
209 gpio = <&pio 2 3 0>;
210 status = "okay";
211 };
212
213 reg_usb1_vbus: usb1-vbus {
214 status = "okay";
215 };
216
217 reg_usb2_vbus: usb2-vbus {
218 status = "okay";
219 };
220
221 reg_axp_ipsout: axp_ipsout {
222 compatible = "regulator-fixed";
223 regulator-name = "axp-ipsout";
224 regulator-min-microvolt = <5000000>;
225 regulator-max-microvolt = <5000000>;
226 regulator-always-on;
227 };
228};
diff --git a/arch/arm/boot/dts/sun7i-a20-pcduino3.dts b/arch/arm/boot/dts/sun7i-a20-pcduino3.dts
index 046dfc0d45d8..8dca49b2477b 100644
--- a/arch/arm/boot/dts/sun7i-a20-pcduino3.dts
+++ b/arch/arm/boot/dts/sun7i-a20-pcduino3.dts
@@ -2,12 +2,48 @@
2 * Copyright 2014 Zoltan HERPAI 2 * Copyright 2014 Zoltan HERPAI
3 * Zoltan HERPAI <wigyori@uid0.hu> 3 * Zoltan HERPAI <wigyori@uid0.hu>
4 * 4 *
5 * The code contained herein is licensed under the GNU General Public 5 * This file is dual-licensed: you can use it either under the terms
6 * License. You may obtain a copy of the GNU General Public License 6 * of the GPL or the X11 license, at your option. Note that this dual
7 * Version 2 or later at the following locations: 7 * licensing only applies to this file, and not this project as a
8 * whole.
8 * 9 *
9 * http://www.opensource.org/licenses/gpl-license.html 10 * a) This file is free software; you can redistribute it and/or
10 * http://www.gnu.org/copyleft/gpl.html 11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
14 *
15 * This file is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public
21 * License along with this file; if not, write to the Free
22 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
23 * MA 02110-1301 USA
24 *
25 * Or, alternatively,
26 *
27 * b) Permission is hereby granted, free of charge, to any person
28 * obtaining a copy of this software and associated documentation
29 * files (the "Software"), to deal in the Software without
30 * restriction, including without limitation the rights to use,
31 * copy, modify, merge, publish, distribute, sublicense, and/or
32 * sell copies of the Software, and to permit persons to whom the
33 * Software is furnished to do so, subject to the following
34 * conditions:
35 *
36 * The above copyright notice and this permission notice shall be
37 * included in all copies or substantial portions of the Software.
38 *
39 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
41 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
43 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 * OTHER DEALINGS IN THE SOFTWARE.
11 */ 47 */
12 48
13/dts-v1/; 49/dts-v1/;
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 82097c905c48..82a524ce28ad 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -8,18 +8,18 @@
8 * licensing only applies to this file, and not this project as a 8 * licensing only applies to this file, and not this project as a
9 * whole. 9 * whole.
10 * 10 *
11 * a) This library is free software; you can redistribute it and/or 11 * a) This file is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as 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 13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version. 14 * License, or (at your option) any later version.
15 * 15 *
16 * This library is distributed in the hope that it will be useful, 16 * This file is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details. 19 * GNU General Public License for more details.
20 * 20 *
21 * You should have received a copy of the GNU General Public 21 * You should have received a copy of the GNU General Public
22 * License along with this library; if not, write to the Free 22 * License along with this file; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 * MA 02110-1301 USA 24 * MA 02110-1301 USA
25 * 25 *
@@ -64,6 +64,20 @@
64 serial7 = &uart7; 64 serial7 = &uart7;
65 }; 65 };
66 66
67 chosen {
68 #address-cells = <1>;
69 #size-cells = <1>;
70 ranges;
71
72 framebuffer@0 {
73 compatible = "allwinner,simple-framebuffer", "simple-framebuffer";
74 allwinner,pipeline = "de_be0-lcd0-hdmi";
75 clocks = <&pll5 1>, <&ahb_gates 36>, <&ahb_gates 43>,
76 <&ahb_gates 44>;
77 status = "disabled";
78 };
79 };
80
67 cpus { 81 cpus {
68 #address-cells = <1>; 82 #address-cells = <1>;
69 #size-cells = <0>; 83 #size-cells = <0>;
@@ -552,8 +566,8 @@
552 reg-names = "phy_ctrl", "pmu1", "pmu2"; 566 reg-names = "phy_ctrl", "pmu1", "pmu2";
553 clocks = <&usb_clk 8>; 567 clocks = <&usb_clk 8>;
554 clock-names = "usb_phy"; 568 clock-names = "usb_phy";
555 resets = <&usb_clk 1>, <&usb_clk 2>; 569 resets = <&usb_clk 0>, <&usb_clk 1>, <&usb_clk 2>;
556 reset-names = "usb1_reset", "usb2_reset"; 570 reset-names = "usb0_reset", "usb1_reset", "usb2_reset";
557 status = "disabled"; 571 status = "disabled";
558 }; 572 };
559 573
@@ -677,6 +691,13 @@
677 allwinner,pull = <0>; 691 allwinner,pull = <0>;
678 }; 692 };
679 693
694 uart3_pins_b: uart3@1 {
695 allwinner,pins = "PH0", "PH1";
696 allwinner,function = "uart3";
697 allwinner,drive = <0>;
698 allwinner,pull = <0>;
699 };
700
680 uart4_pins_a: uart4@0 { 701 uart4_pins_a: uart4@0 {
681 allwinner,pins = "PG10", "PG11"; 702 allwinner,pins = "PG10", "PG11";
682 allwinner,function = "uart4"; 703 allwinner,function = "uart4";
@@ -784,6 +805,13 @@
784 allwinner,pull = <0>; 805 allwinner,pull = <0>;
785 }; 806 };
786 807
808 spi0_pins_a: spi0@0 {
809 allwinner,pins = "PI10", "PI11", "PI12", "PI13", "PI14";
810 allwinner,function = "spi0";
811 allwinner,drive = <0>;
812 allwinner,pull = <0>;
813 };
814
787 spi1_pins_a: spi1@0 { 815 spi1_pins_a: spi1@0 {
788 allwinner,pins = "PI16", "PI17", "PI18", "PI19"; 816 allwinner,pins = "PI16", "PI17", "PI18", "PI19";
789 allwinner,function = "spi1"; 817 allwinner,function = "spi1";
@@ -819,6 +847,13 @@
819 allwinner,pull = <1>; 847 allwinner,pull = <1>;
820 }; 848 };
821 849
850 mmc2_pins_a: mmc2@0 {
851 allwinner,pins = "PC6","PC7","PC8","PC9","PC10","PC11";
852 allwinner,function = "mmc2";
853 allwinner,drive = <2>;
854 allwinner,pull = <1>;
855 };
856
822 mmc3_pins_a: mmc3@0 { 857 mmc3_pins_a: mmc3@0 {
823 allwinner,pins = "PI4","PI5","PI6","PI7","PI8","PI9"; 858 allwinner,pins = "PI4","PI5","PI6","PI7","PI8","PI9";
824 allwinner,function = "mmc3"; 859 allwinner,function = "mmc3";
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 e9b8cca8dcc1..7f2117ce6985 100644
--- a/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts
+++ b/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts
@@ -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 file 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 file 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 file; 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/dts-v1/; 50/dts-v1/;
diff --git a/arch/arm/boot/dts/sun8i-a23.dtsi b/arch/arm/boot/dts/sun8i-a23.dtsi
index 6146ef15efbe..6086adbf9d74 100644
--- a/arch/arm/boot/dts/sun8i-a23.dtsi
+++ b/arch/arm/boot/dts/sun8i-a23.dtsi
@@ -8,18 +8,18 @@
8 * licensing only applies to this file, and not this project as a 8 * licensing only applies to this file, and not this project as a
9 * whole. 9 * whole.
10 * 10 *
11 * a) This library is free software; you can redistribute it and/or 11 * a) This file is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as 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 13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version. 14 * License, or (at your option) any later version.
15 * 15 *
16 * This library is distributed in the hope that it will be useful, 16 * This file is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details. 19 * GNU General Public License for more details.
20 * 20 *
21 * You should have received a copy of the GNU General Public 21 * You should have received a copy of the GNU General Public
22 * License along with this library; if not, write to the Free 22 * License along with this file; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 23 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 * MA 02110-1301 USA 24 * MA 02110-1301 USA
25 * 25 *
diff --git a/arch/arm/boot/dts/sun9i-a80-optimus.dts b/arch/arm/boot/dts/sun9i-a80-optimus.dts
new file mode 100644
index 000000000000..506948f582ee
--- /dev/null
+++ b/arch/arm/boot/dts/sun9i-a80-optimus.dts
@@ -0,0 +1,119 @@
1/*
2 * Copyright 2014 Chen-Yu Tsai
3 *
4 * Chen-Yu Tsai <wens@csie.org>
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 file 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 file 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 file; 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/include/ "sun9i-a80.dtsi"
52
53/ {
54 model = "Merrii A80 Optimus Board";
55 compatible = "merrii,a80-optimus", "allwinner,sun9i-a80";
56
57 chosen {
58 bootargs = "earlyprintk console=ttyS0,115200";
59 };
60
61 soc {
62 pio: pinctrl@06000800 {
63 i2c3_pins_a: i2c3@0 {
64 /* Enable internal pull-up */
65 allwinner,pull = <1>;
66 };
67
68 led_pins_optimus: led-pins@0 {
69 allwinner,pins = "PH0", "PH1";
70 allwinner,function = "gpio_out";
71 allwinner,drive = <0>;
72 allwinner,pull = <0>;
73 };
74
75 uart4_pins_a: uart4@0 {
76 /* Enable internal pull-up */
77 allwinner,pull = <1>;
78 };
79 };
80
81 uart0: serial@07000000 {
82 pinctrl-names = "default";
83 pinctrl-0 = <&uart0_pins_a>;
84 status = "okay";
85 };
86
87 uart4: serial@07001000 {
88 pinctrl-names = "default";
89 pinctrl-0 = <&uart4_pins_a>;
90 status = "okay";
91 };
92
93 i2c3: i2c@07003400 {
94 pinctrl-names = "default";
95 pinctrl-0 = <&i2c3_pins_a>;
96 status = "okay";
97 };
98 };
99
100 leds {
101 compatible = "gpio-leds";
102 pinctrl-names = "default";
103 pinctrl-0 = <&led_pins_optimus>;
104
105 /* The LED names match those found on the board */
106
107 led2 {
108 label = "optimus:led2:usr";
109 gpios = <&pio 7 1 0>;
110 };
111
112 /* led3 is on PM15, in R_PIO */
113
114 led4 {
115 label = "optimus:led4:usr";
116 gpios = <&pio 7 0 0>;
117 };
118 };
119};
diff --git a/arch/arm/boot/dts/sun9i-a80.dtsi b/arch/arm/boot/dts/sun9i-a80.dtsi
new file mode 100644
index 000000000000..494714f67b57
--- /dev/null
+++ b/arch/arm/boot/dts/sun9i-a80.dtsi
@@ -0,0 +1,514 @@
1/*
2 * Copyright 2014 Chen-Yu Tsai
3 *
4 * Chen-Yu Tsai <wens@csie.org>
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 file 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 file 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 file; 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/include/ "skeleton64.dtsi"
51
52/ {
53 interrupt-parent = <&gic>;
54
55 aliases {
56 serial0 = &uart0;
57 serial1 = &uart1;
58 serial2 = &uart2;
59 serial3 = &uart3;
60 serial4 = &uart4;
61 serial5 = &uart5;
62 serial6 = &r_uart;
63 };
64
65 cpus {
66 #address-cells = <1>;
67 #size-cells = <0>;
68
69 cpu0: cpu@0 {
70 compatible = "arm,cortex-a7";
71 device_type = "cpu";
72 reg = <0x0>;
73 };
74
75 cpu1: cpu@1 {
76 compatible = "arm,cortex-a7";
77 device_type = "cpu";
78 reg = <0x1>;
79 };
80
81 cpu2: cpu@2 {
82 compatible = "arm,cortex-a7";
83 device_type = "cpu";
84 reg = <0x2>;
85 };
86
87 cpu3: cpu@3 {
88 compatible = "arm,cortex-a7";
89 device_type = "cpu";
90 reg = <0x3>;
91 };
92
93 cpu4: cpu@100 {
94 compatible = "arm,cortex-a15";
95 device_type = "cpu";
96 reg = <0x100>;
97 };
98
99 cpu5: cpu@101 {
100 compatible = "arm,cortex-a15";
101 device_type = "cpu";
102 reg = <0x101>;
103 };
104
105 cpu6: cpu@102 {
106 compatible = "arm,cortex-a15";
107 device_type = "cpu";
108 reg = <0x102>;
109 };
110
111 cpu7: cpu@103 {
112 compatible = "arm,cortex-a15";
113 device_type = "cpu";
114 reg = <0x103>;
115 };
116 };
117
118 memory {
119 /* 8GB max. with LPAE */
120 reg = <0 0x20000000 0x02 0>;
121 };
122
123 clocks {
124 #address-cells = <1>;
125 #size-cells = <1>;
126 /*
127 * map 64 bit address range down to 32 bits,
128 * as the peripherals are all under 512MB.
129 */
130 ranges = <0 0 0 0x20000000>;
131
132 osc24M: osc24M_clk {
133 #clock-cells = <0>;
134 compatible = "fixed-clock";
135 clock-frequency = <24000000>;
136 clock-output-names = "osc24M";
137 };
138
139 osc32k: osc32k_clk {
140 #clock-cells = <0>;
141 compatible = "fixed-clock";
142 clock-frequency = <32768>;
143 clock-output-names = "osc32k";
144 };
145
146 pll4: clk@0600000c {
147 #clock-cells = <0>;
148 compatible = "allwinner,sun9i-a80-pll4-clk";
149 reg = <0x0600000c 0x4>;
150 clocks = <&osc24M>;
151 clock-output-names = "pll4";
152 };
153
154 pll12: clk@0600002c {
155 #clock-cells = <0>;
156 compatible = "allwinner,sun9i-a80-pll4-clk";
157 reg = <0x0600002c 0x4>;
158 clocks = <&osc24M>;
159 clock-output-names = "pll12";
160 };
161
162 gt_clk: clk@0600005c {
163 #clock-cells = <0>;
164 compatible = "allwinner,sun9i-a80-gt-clk";
165 reg = <0x0600005c 0x4>;
166 clocks = <&osc24M>, <&pll4>, <&pll12>, <&pll12>;
167 clock-output-names = "gt";
168 };
169
170 ahb0: clk@06000060 {
171 #clock-cells = <0>;
172 compatible = "allwinner,sun9i-a80-ahb-clk";
173 reg = <0x06000060 0x4>;
174 clocks = <&gt_clk>, <&pll4>, <&pll12>, <&pll12>;
175 clock-output-names = "ahb0";
176 };
177
178 ahb1: clk@06000064 {
179 #clock-cells = <0>;
180 compatible = "allwinner,sun9i-a80-ahb-clk";
181 reg = <0x06000064 0x4>;
182 clocks = <&gt_clk>, <&pll4>, <&pll12>, <&pll12>;
183 clock-output-names = "ahb1";
184 };
185
186 ahb2: clk@06000068 {
187 #clock-cells = <0>;
188 compatible = "allwinner,sun9i-a80-ahb-clk";
189 reg = <0x06000068 0x4>;
190 clocks = <&gt_clk>, <&pll4>, <&pll12>, <&pll12>;
191 clock-output-names = "ahb2";
192 };
193
194 apb0: clk@06000070 {
195 #clock-cells = <0>;
196 compatible = "allwinner,sun9i-a80-apb0-clk";
197 reg = <0x06000070 0x4>;
198 clocks = <&osc24M>, <&pll4>;
199 clock-output-names = "apb0";
200 };
201
202 apb1: clk@06000074 {
203 #clock-cells = <0>;
204 compatible = "allwinner,sun9i-a80-apb1-clk";
205 reg = <0x06000074 0x4>;
206 clocks = <&osc24M>, <&pll4>;
207 clock-output-names = "apb1";
208 };
209
210 cci400_clk: clk@06000078 {
211 #clock-cells = <0>;
212 compatible = "allwinner,sun9i-a80-gt-clk";
213 reg = <0x06000078 0x4>;
214 clocks = <&osc24M>, <&pll4>, <&pll12>, <&pll12>;
215 clock-output-names = "cci400";
216 };
217
218 ahb0_gates: clk@06000580 {
219 #clock-cells = <1>;
220 compatible = "allwinner,sun9i-a80-ahb0-gates-clk";
221 reg = <0x06000580 0x4>;
222 clocks = <&ahb0>;
223 clock-output-names = "ahb0_fd", "ahb0_ve", "ahb0_gpu",
224 "ahb0_ss", "ahb0_sd", "ahb0_nand1",
225 "ahb0_nand0", "ahb0_sdram",
226 "ahb0_mipi_hsi", "ahb0_sata", "ahb0_ts",
227 "ahb0_spi0","ahb0_spi1", "ahb0_spi2",
228 "ahb0_spi3";
229 };
230
231 ahb1_gates: clk@06000584 {
232 #clock-cells = <1>;
233 compatible = "allwinner,sun9i-a80-ahb1-gates-clk";
234 reg = <0x06000584 0x4>;
235 clocks = <&ahb1>;
236 clock-output-names = "ahb1_usbotg", "ahb1_usbhci",
237 "ahb1_gmac", "ahb1_msgbox",
238 "ahb1_spinlock", "ahb1_hstimer",
239 "ahb1_dma";
240 };
241
242 ahb2_gates: clk@06000588 {
243 #clock-cells = <1>;
244 compatible = "allwinner,sun9i-a80-ahb2-gates-clk";
245 reg = <0x06000588 0x4>;
246 clocks = <&ahb2>;
247 clock-output-names = "ahb2_lcd0", "ahb2_lcd1",
248 "ahb2_edp", "ahb2_csi", "ahb2_hdmi",
249 "ahb2_de", "ahb2_mp", "ahb2_mipi_dsi";
250 };
251
252 apb0_gates: clk@06000590 {
253 #clock-cells = <1>;
254 compatible = "allwinner,sun9i-a80-apb0-gates-clk";
255 reg = <0x06000590 0x4>;
256 clocks = <&apb0>;
257 clock-output-names = "apb0_spdif", "apb0_pio",
258 "apb0_ac97", "apb0_i2s0", "apb0_i2s1",
259 "apb0_lradc", "apb0_gpadc", "apb0_twd",
260 "apb0_cirtx";
261 };
262
263 apb1_gates: clk@06000594 {
264 #clock-cells = <1>;
265 compatible = "allwinner,sun9i-a80-apb1-gates-clk";
266 reg = <0x06000594 0x4>;
267 clocks = <&apb1>;
268 clock-output-names = "apb1_i2c0", "apb1_i2c1",
269 "apb1_i2c2", "apb1_i2c3", "apb1_i2c4",
270 "apb1_uart0", "apb1_uart1",
271 "apb1_uart2", "apb1_uart3",
272 "apb1_uart4", "apb1_uart5";
273 };
274 };
275
276 soc {
277 compatible = "simple-bus";
278 #address-cells = <1>;
279 #size-cells = <1>;
280 /*
281 * map 64 bit address range down to 32 bits,
282 * as the peripherals are all under 512MB.
283 */
284 ranges = <0 0 0 0x20000000>;
285
286 gic: interrupt-controller@01c41000 {
287 compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
288 reg = <0x01c41000 0x1000>,
289 <0x01c42000 0x1000>,
290 <0x01c44000 0x2000>,
291 <0x01c46000 0x2000>;
292 interrupt-controller;
293 #interrupt-cells = <3>;
294 interrupts = <1 9 0xf04>;
295 };
296
297 ahb0_resets: reset@060005a0 {
298 #reset-cells = <1>;
299 compatible = "allwinner,sun6i-a31-clock-reset";
300 reg = <0x060005a0 0x4>;
301 };
302
303 ahb1_resets: reset@060005a4 {
304 #reset-cells = <1>;
305 compatible = "allwinner,sun6i-a31-clock-reset";
306 reg = <0x060005a4 0x4>;
307 };
308
309 ahb2_resets: reset@060005a8 {
310 #reset-cells = <1>;
311 compatible = "allwinner,sun6i-a31-clock-reset";
312 reg = <0x060005a8 0x4>;
313 };
314
315 apb0_resets: reset@060005b0 {
316 #reset-cells = <1>;
317 compatible = "allwinner,sun6i-a31-clock-reset";
318 reg = <0x060005b0 0x4>;
319 };
320
321 apb1_resets: reset@060005b4 {
322 #reset-cells = <1>;
323 compatible = "allwinner,sun6i-a31-clock-reset";
324 reg = <0x060005b4 0x4>;
325 };
326
327 timer@06000c00 {
328 compatible = "allwinner,sun4i-a10-timer";
329 reg = <0x06000c00 0xa0>;
330 interrupts = <0 18 4>,
331 <0 19 4>,
332 <0 20 4>,
333 <0 21 4>,
334 <0 22 4>,
335 <0 23 4>;
336
337 clocks = <&osc24M>;
338 };
339
340 pio: pinctrl@06000800 {
341 compatible = "allwinner,sun9i-a80-pinctrl";
342 reg = <0x06000800 0x400>;
343 interrupts = <0 11 4>,
344 <0 15 4>,
345 <0 16 4>,
346 <0 17 4>,
347 <0 120 4>;
348 clocks = <&apb0_gates 5>;
349 gpio-controller;
350 interrupt-controller;
351 #interrupt-cells = <2>;
352 #size-cells = <0>;
353 #gpio-cells = <3>;
354
355 i2c3_pins_a: i2c3@0 {
356 allwinner,pins = "PG10", "PG11";
357 allwinner,function = "i2c3";
358 allwinner,drive = <0>;
359 allwinner,pull = <0>;
360 };
361
362 uart0_pins_a: uart0@0 {
363 allwinner,pins = "PH12", "PH13";
364 allwinner,function = "uart0";
365 allwinner,drive = <0>;
366 allwinner,pull = <0>;
367 };
368
369 uart4_pins_a: uart4@0 {
370 allwinner,pins = "PG12", "PG13", "PG14", "PG15";
371 allwinner,function = "uart4";
372 allwinner,drive = <0>;
373 allwinner,pull = <0>;
374 };
375 };
376
377 uart0: serial@07000000 {
378 compatible = "snps,dw-apb-uart";
379 reg = <0x07000000 0x400>;
380 interrupts = <0 0 4>;
381 reg-shift = <2>;
382 reg-io-width = <4>;
383 clocks = <&apb1_gates 16>;
384 resets = <&apb1_resets 16>;
385 status = "disabled";
386 };
387
388 uart1: serial@07000400 {
389 compatible = "snps,dw-apb-uart";
390 reg = <0x07000400 0x400>;
391 interrupts = <0 1 4>;
392 reg-shift = <2>;
393 reg-io-width = <4>;
394 clocks = <&apb1_gates 17>;
395 resets = <&apb1_resets 17>;
396 status = "disabled";
397 };
398
399 uart2: serial@07000800 {
400 compatible = "snps,dw-apb-uart";
401 reg = <0x07000800 0x400>;
402 interrupts = <0 2 4>;
403 reg-shift = <2>;
404 reg-io-width = <4>;
405 clocks = <&apb1_gates 18>;
406 resets = <&apb1_resets 18>;
407 status = "disabled";
408 };
409
410 uart3: serial@07000c00 {
411 compatible = "snps,dw-apb-uart";
412 reg = <0x07000c00 0x400>;
413 interrupts = <0 3 4>;
414 reg-shift = <2>;
415 reg-io-width = <4>;
416 clocks = <&apb1_gates 19>;
417 resets = <&apb1_resets 19>;
418 status = "disabled";
419 };
420
421 uart4: serial@07001000 {
422 compatible = "snps,dw-apb-uart";
423 reg = <0x07001000 0x400>;
424 interrupts = <0 4 4>;
425 reg-shift = <2>;
426 reg-io-width = <4>;
427 clocks = <&apb1_gates 20>;
428 resets = <&apb1_resets 20>;
429 status = "disabled";
430 };
431
432 uart5: serial@07001400 {
433 compatible = "snps,dw-apb-uart";
434 reg = <0x07001400 0x400>;
435 interrupts = <0 5 4>;
436 reg-shift = <2>;
437 reg-io-width = <4>;
438 clocks = <&apb1_gates 21>;
439 resets = <&apb1_resets 21>;
440 status = "disabled";
441 };
442
443 i2c0: i2c@07002800 {
444 compatible = "allwinner,sun6i-a31-i2c";
445 reg = <0x07002800 0x400>;
446 interrupts = <0 6 4>;
447 clocks = <&apb1_gates 0>;
448 resets = <&apb1_resets 0>;
449 status = "disabled";
450 #address-cells = <1>;
451 #size-cells = <0>;
452 };
453
454 i2c1: i2c@07002c00 {
455 compatible = "allwinner,sun6i-a31-i2c";
456 reg = <0x07002c00 0x400>;
457 interrupts = <0 7 4>;
458 clocks = <&apb1_gates 1>;
459 resets = <&apb1_resets 1>;
460 status = "disabled";
461 #address-cells = <1>;
462 #size-cells = <0>;
463 };
464
465 i2c2: i2c@07003000 {
466 compatible = "allwinner,sun6i-a31-i2c";
467 reg = <0x07003000 0x400>;
468 interrupts = <0 8 4>;
469 clocks = <&apb1_gates 2>;
470 resets = <&apb1_resets 2>;
471 status = "disabled";
472 #address-cells = <1>;
473 #size-cells = <0>;
474 };
475
476 i2c3: i2c@07003400 {
477 compatible = "allwinner,sun6i-a31-i2c";
478 reg = <0x07003400 0x400>;
479 interrupts = <0 9 4>;
480 clocks = <&apb1_gates 3>;
481 resets = <&apb1_resets 3>;
482 status = "disabled";
483 #address-cells = <1>;
484 #size-cells = <0>;
485 };
486
487 i2c4: i2c@07003800 {
488 compatible = "allwinner,sun6i-a31-i2c";
489 reg = <0x07003800 0x400>;
490 interrupts = <0 10 4>;
491 clocks = <&apb1_gates 4>;
492 resets = <&apb1_resets 4>;
493 status = "disabled";
494 #address-cells = <1>;
495 #size-cells = <0>;
496 };
497
498 r_wdt: watchdog@08001000 {
499 compatible = "allwinner,sun6i-a31-wdt";
500 reg = <0x08001000 0x20>;
501 interrupts = <0 36 4>;
502 };
503
504 r_uart: serial@08002800 {
505 compatible = "snps,dw-apb-uart";
506 reg = <0x08002800 0x400>;
507 interrupts = <0 38 4>;
508 reg-shift = <2>;
509 reg-io-width = <4>;
510 clocks = <&osc24M>;
511 status = "disabled";
512 };
513 };
514};
diff --git a/arch/arm/boot/dts/sunxi-common-regulators.dtsi b/arch/arm/boot/dts/sunxi-common-regulators.dtsi
index c9c5b10e03eb..d8876634f965 100644
--- a/arch/arm/boot/dts/sunxi-common-regulators.dtsi
+++ b/arch/arm/boot/dts/sunxi-common-regulators.dtsi
@@ -3,12 +3,48 @@
3 * 3 *
4 * Copyright 2014 - Hans de Goede <hdegoede@redhat.com> 4 * Copyright 2014 - Hans de Goede <hdegoede@redhat.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 file 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 file 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 file; 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/ { 50/ {
@@ -21,6 +57,13 @@
21 allwinner,pull = <0>; 57 allwinner,pull = <0>;
22 }; 58 };
23 59
60 usb0_vbus_pin_a: usb0_vbus_pin@0 {
61 allwinner,pins = "PB9";
62 allwinner,function = "gpio_out";
63 allwinner,drive = <0>;
64 allwinner,pull = <0>;
65 };
66
24 usb1_vbus_pin_a: usb1_vbus_pin@0 { 67 usb1_vbus_pin_a: usb1_vbus_pin@0 {
25 allwinner,pins = "PH6"; 68 allwinner,pins = "PH6";
26 allwinner,function = "gpio_out"; 69 allwinner,function = "gpio_out";
@@ -44,11 +87,24 @@
44 regulator-name = "ahci-5v"; 87 regulator-name = "ahci-5v";
45 regulator-min-microvolt = <5000000>; 88 regulator-min-microvolt = <5000000>;
46 regulator-max-microvolt = <5000000>; 89 regulator-max-microvolt = <5000000>;
90 regulator-boot-on;
47 enable-active-high; 91 enable-active-high;
48 gpio = <&pio 1 8 0>; 92 gpio = <&pio 1 8 0>;
49 status = "disabled"; 93 status = "disabled";
50 }; 94 };
51 95
96 reg_usb0_vbus: usb0-vbus {
97 compatible = "regulator-fixed";
98 pinctrl-names = "default";
99 pinctrl-0 = <&usb0_vbus_pin_a>;
100 regulator-name = "usb0-vbus";
101 regulator-min-microvolt = <5000000>;
102 regulator-max-microvolt = <5000000>;
103 enable-active-high;
104 gpio = <&pio 1 9 0>;
105 status = "disabled";
106 };
107
52 reg_usb1_vbus: usb1-vbus { 108 reg_usb1_vbus: usb1-vbus {
53 compatible = "regulator-fixed"; 109 compatible = "regulator-fixed";
54 pinctrl-names = "default"; 110 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index a1b682ea01bd..cbf5a1ae0ca7 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -189,7 +189,7 @@
189 189
190 /* ALS and Proximity sensor */ 190 /* ALS and Proximity sensor */
191 isl29028@44 { 191 isl29028@44 {
192 compatible = "isil,isl29028"; 192 compatible = "isl,isl29028";
193 reg = <0x44>; 193 reg = <0x44>;
194 interrupt-parent = <&gpio>; 194 interrupt-parent = <&gpio>;
195 interrupts = <TEGRA_GPIO(L, 0) IRQ_TYPE_LEVEL_HIGH>; 195 interrupts = <TEGRA_GPIO(L, 0) IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
new file mode 100644
index 000000000000..56a452bc326c
--- /dev/null
+++ b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
@@ -0,0 +1,96 @@
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/ {
11 chosen {
12 bootargs = "console=ttyLP0,115200";
13 };
14
15 regulators {
16 compatible = "simple-bus";
17 #address-cells = <1>;
18 #size-cells = <0>;
19
20 sys_5v0_reg: regulator@0 {
21 compatible = "regulator-fixed";
22 reg = <0>;
23 regulator-name = "5v0";
24 regulator-min-microvolt = <5000000>;
25 regulator-max-microvolt = <5000000>;
26 regulator-always-on;
27 };
28
29 /* USBH_PEN */
30 usbh_vbus_reg: regulator@1 {
31 compatible = "regulator-fixed";
32 pinctrl-names = "default";
33 pinctrl-0 = <&pinctrl_usbh1_reg>;
34 reg = <1>;
35 regulator-name = "usbh_vbus";
36 regulator-min-microvolt = <5000000>;
37 regulator-max-microvolt = <5000000>;
38 gpio = <&gpio3 19 GPIO_ACTIVE_LOW>;
39 vin-supply = <&sys_5v0_reg>;
40 };
41 };
42};
43
44&bl {
45 brightness-levels = <0 4 8 16 32 64 128 255>;
46 default-brightness-level = <6>;
47 status = "okay";
48};
49
50&esdhc1 {
51 pinctrl-names = "default";
52 pinctrl-0 = <&pinctrl_esdhc1>;
53 bus-width = <4>;
54 status = "okay";
55};
56
57&fec1 {
58 phy-mode = "rmii";
59 pinctrl-names = "default";
60 pinctrl-0 = <&pinctrl_fec1>;
61 status = "okay";
62};
63
64&i2c0 {
65 status = "okay";
66
67 /* M41T0M6 real time clock on carrier board */
68 rtc: m41t0m6@68 {
69 compatible = "st,m41t00";
70 reg = <0x68>;
71 };
72};
73
74&pwm0 {
75 status = "okay";
76};
77
78&pwm1 {
79 status = "okay";
80};
81
82&uart0 {
83 status = "okay";
84};
85
86&uart1 {
87 status = "okay";
88};
89
90&uart2 {
91 status = "okay";
92};
93
94&usbh1 {
95 vbus-supply = <&usbh_vbus_reg>;
96};
diff --git a/arch/arm/boot/dts/vf-colibri.dtsi b/arch/arm/boot/dts/vf-colibri.dtsi
new file mode 100644
index 000000000000..82f5728be5c9
--- /dev/null
+++ b/arch/arm/boot/dts/vf-colibri.dtsi
@@ -0,0 +1,186 @@
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/ {
11 bl: backlight {
12 compatible = "pwm-backlight";
13 pwms = <&pwm0 0 5000000 0>;
14 status = "disabled";
15 };
16};
17
18&adc0 {
19 status = "okay";
20};
21
22&adc1 {
23 status = "okay";
24};
25
26&edma0 {
27 status = "okay";
28};
29
30&esdhc1 {
31 pinctrl-names = "default";
32 pinctrl-0 = <&pinctrl_esdhc1>;
33 bus-width = <4>;
34 cd-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
35};
36
37&fec1 {
38 phy-mode = "rmii";
39 pinctrl-names = "default";
40 pinctrl-0 = <&pinctrl_fec1>;
41};
42
43&i2c0 {
44 clock-frequency = <400000>;
45 pinctrl-names = "default";
46 pinctrl-0 = <&pinctrl_i2c0>;
47};
48
49&pwm0 {
50 pinctrl-names = "default";
51 pinctrl-0 = <&pinctrl_pwm0>;
52};
53
54&pwm1 {
55 pinctrl-names = "default";
56 pinctrl-0 = <&pinctrl_pwm1>;
57};
58
59&uart0 {
60 pinctrl-names = "default";
61 pinctrl-0 = <&pinctrl_uart0>;
62};
63
64&uart1 {
65 pinctrl-names = "default";
66 pinctrl-0 = <&pinctrl_uart1>;
67};
68
69&uart2 {
70 pinctrl-names = "default";
71 pinctrl-0 = <&pinctrl_uart2>;
72};
73
74&usbdev0 {
75 disable-over-current;
76 status = "okay";
77};
78
79&usbh1 {
80 disable-over-current;
81 status = "okay";
82};
83
84&usbmisc0 {
85 status = "okay";
86};
87
88&usbmisc1 {
89 status = "okay";
90};
91
92&usbphy0 {
93 status = "okay";
94};
95
96&usbphy1 {
97 status = "okay";
98};
99
100&iomuxc {
101 vf610-colibri {
102 pinctrl_gpio_ext: gpio_ext {
103 fsl,pins = <
104 VF610_PAD_PTD10__GPIO_89 0x22ed /* EXT_IO_0 */
105 VF610_PAD_PTD9__GPIO_88 0x22ed /* EXT_IO_1 */
106 VF610_PAD_PTD26__GPIO_68 0x22ed /* EXT_IO_2 */
107 >;
108 };
109
110 pinctrl_esdhc1: esdhc1grp {
111 fsl,pins = <
112 VF610_PAD_PTA24__ESDHC1_CLK 0x31ef
113 VF610_PAD_PTA25__ESDHC1_CMD 0x31ef
114 VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef
115 VF610_PAD_PTA27__ESDHC1_DAT1 0x31ef
116 VF610_PAD_PTA28__ESDHC1_DATA2 0x31ef
117 VF610_PAD_PTA29__ESDHC1_DAT3 0x31ef
118 VF610_PAD_PTB20__GPIO_42 0x219d
119 >;
120 };
121
122 pinctrl_fec1: fec1grp {
123 fsl,pins = <
124 VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2
125 VF610_PAD_PTC10__ENET_RMII1_MDIO 0x30d3
126 VF610_PAD_PTC11__ENET_RMII1_CRS 0x30d1
127 VF610_PAD_PTC12__ENET_RMII_RXD1 0x30d1
128 VF610_PAD_PTC13__ENET_RMII1_RXD0 0x30d1
129 VF610_PAD_PTC14__ENET_RMII1_RXER 0x30d1
130 VF610_PAD_PTC15__ENET_RMII1_TXD1 0x30d2
131 VF610_PAD_PTC16__ENET_RMII1_TXD0 0x30d2
132 VF610_PAD_PTC17__ENET_RMII1_TXEN 0x30d2
133 >;
134 };
135
136 pinctrl_i2c0: i2c0grp {
137 fsl,pins = <
138 VF610_PAD_PTB14__I2C0_SCL 0x37ff
139 VF610_PAD_PTB15__I2C0_SDA 0x37ff
140 >;
141 };
142
143 pinctrl_pwm0: pwm0grp {
144 fsl,pins = <
145 VF610_PAD_PTB0__FTM0_CH0 0x1182
146 VF610_PAD_PTB1__FTM0_CH1 0x1182
147 >;
148 };
149
150 pinctrl_pwm1: pwm1grp {
151 fsl,pins = <
152 VF610_PAD_PTB8__FTM1_CH0 0x1182
153 VF610_PAD_PTB9__FTM1_CH1 0x1182
154 >;
155 };
156
157 pinctrl_uart0: uart0grp {
158 fsl,pins = <
159 VF610_PAD_PTB10__UART0_TX 0x21a2
160 VF610_PAD_PTB11__UART0_RX 0x21a1
161 >;
162 };
163
164 pinctrl_uart1: uart1grp {
165 fsl,pins = <
166 VF610_PAD_PTB4__UART1_TX 0x21a2
167 VF610_PAD_PTB5__UART1_RX 0x21a1
168 >;
169 };
170
171 pinctrl_uart2: uart2grp {
172 fsl,pins = <
173 VF610_PAD_PTD0__UART2_TX 0x21a2
174 VF610_PAD_PTD1__UART2_RX 0x21a1
175 VF610_PAD_PTD2__UART2_RTS 0x21a2
176 VF610_PAD_PTD3__UART2_CTS 0x21a1
177 >;
178 };
179
180 pinctrl_usbh1_reg: gpio_usb_vbus {
181 fsl,pins = <
182 VF610_PAD_PTD4__GPIO_83 0x22ed
183 >;
184 };
185 };
186};
diff --git a/arch/arm/boot/dts/vf500-colibri-eval-v3.dts b/arch/arm/boot/dts/vf500-colibri-eval-v3.dts
new file mode 100644
index 000000000000..7fc782c4fc52
--- /dev/null
+++ b/arch/arm/boot/dts/vf500-colibri-eval-v3.dts
@@ -0,0 +1,17 @@
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 "vf500-colibri.dtsi"
12#include "vf-colibri-eval-v3.dtsi"
13
14/ {
15 model = "Toradex Colibri VF50 on Colibri Evaluation Board";
16 compatible = "toradex,vf500-colibri_vf50-on-eval", "toradex,vf500-colibri_vf50", "fsl,vf500";
17};
diff --git a/arch/arm/boot/dts/vf500-colibri.dtsi b/arch/arm/boot/dts/vf500-colibri.dtsi
new file mode 100644
index 000000000000..cee34a32f25b
--- /dev/null
+++ b/arch/arm/boot/dts/vf500-colibri.dtsi
@@ -0,0 +1,20 @@
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#include "vf500.dtsi"
11#include "vf-colibri.dtsi"
12
13/ {
14 model = "Toradex Colibri VF50 COM";
15 compatible = "toradex,vf610-colibri_vf50", "fsl,vf500";
16
17 memory {
18 reg = <0x80000000 0x8000000>;
19 };
20};
diff --git a/arch/arm/boot/dts/vf500.dtsi b/arch/arm/boot/dts/vf500.dtsi
new file mode 100644
index 000000000000..de6700542714
--- /dev/null
+++ b/arch/arm/boot/dts/vf500.dtsi
@@ -0,0 +1,171 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License 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 "skeleton.dtsi"
11#include "vfxxx.dtsi"
12#include <dt-bindings/interrupt-controller/arm-gic.h>
13
14/ {
15 cpus {
16 #address-cells = <1>;
17 #size-cells = <0>;
18
19 a5_cpu: cpu@0 {
20 compatible = "arm,cortex-a5";
21 device_type = "cpu";
22 reg = <0x0>;
23 };
24 };
25
26 soc {
27 interrupt-parent = <&intc>;
28
29 aips-bus@40000000 {
30
31 intc: interrupt-controller@40002000 {
32 compatible = "arm,cortex-a9-gic";
33 #interrupt-cells = <3>;
34 interrupt-controller;
35 reg = <0x40003000 0x1000>,
36 <0x40002100 0x100>;
37 };
38
39 global_timer: timer@40002200 {
40 compatible = "arm,cortex-a9-global-timer";
41 reg = <0x40002200 0x20>;
42 interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
43 clocks = <&clks VF610_CLK_PLATFORM_BUS>;
44 };
45 };
46 };
47};
48
49&adc0 {
50 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
51};
52
53&adc1 {
54 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
55};
56
57&can0 {
58 interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
59};
60
61&can1 {
62 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
63};
64
65&dspi0 {
66 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
67};
68
69&edma0 {
70 interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
71 <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
72 interrupt-names = "edma-tx", "edma-err";
73};
74
75&edma1 {
76 interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
77 <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
78 interrupt-names = "edma-tx", "edma-err";
79};
80
81&esdhc1 {
82 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
83};
84
85&fec0 {
86 interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
87};
88
89&fec1 {
90 interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
91};
92
93&ftm {
94 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
95};
96
97&gpio1 {
98 interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
99};
100
101&gpio2 {
102 interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
103};
104
105&gpio3 {
106 interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
107};
108
109&gpio4 {
110 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
111};
112
113&gpio5 {
114 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
115};
116
117&i2c0 {
118 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
119};
120
121&pit {
122 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
123};
124
125&qspi0 {
126 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
127};
128
129&sai2 {
130 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
131};
132
133&uart0 {
134 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
135};
136
137&uart1 {
138 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
139};
140
141&uart2 {
142 interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
143};
144
145&uart3 {
146 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
147};
148
149&uart4 {
150 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
151};
152
153&uart5 {
154 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
155};
156
157&usbdev0 {
158 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
159};
160
161&usbh1 {
162 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
163};
164
165&usbphy0 {
166 interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
167};
168
169&usbphy1 {
170 interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
171};
diff --git a/arch/arm/boot/dts/vf610-colibri-eval-v3.dts b/arch/arm/boot/dts/vf610-colibri-eval-v3.dts
index 7fb306679341..10ebe99e2751 100644
--- a/arch/arm/boot/dts/vf610-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/vf610-colibri-eval-v3.dts
@@ -9,38 +9,9 @@
9 9
10/dts-v1/; 10/dts-v1/;
11#include "vf610-colibri.dtsi" 11#include "vf610-colibri.dtsi"
12#include "vf-colibri-eval-v3.dtsi"
12 13
13/ { 14/ {
14 model = "Toradex Colibri VF61 on Colibri Evaluation Board"; 15 model = "Toradex Colibri VF61 on Colibri Evaluation Board";
15 compatible = "toradex,vf610-colibri_vf61-on-eval", "toradex,vf610-colibri_vf61", "fsl,vf610"; 16 compatible = "toradex,vf610-colibri_vf61-on-eval", "toradex,vf610-colibri_vf61", "fsl,vf610";
16 17}; \ No newline at end of file
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.dtsi b/arch/arm/boot/dts/vf610-colibri.dtsi
index 0cd83434b073..19fe045b8334 100644
--- a/arch/arm/boot/dts/vf610-colibri.dtsi
+++ b/arch/arm/boot/dts/vf610-colibri.dtsi
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include "vf610.dtsi" 10#include "vf610.dtsi"
11#include "vf-colibri.dtsi"
11 12
12/ { 13/ {
13 model = "Toradex Colibri VF61 COM"; 14 model = "Toradex Colibri VF61 COM";
@@ -16,108 +17,9 @@
16 memory { 17 memory {
17 reg = <0x80000000 0x10000000>; 18 reg = <0x80000000 0x10000000>;
18 }; 19 };
19
20 clocks {
21 enet_ext {
22 compatible = "fixed-clock";
23 #clock-cells = <0>;
24 clock-frequency = <50000000>;
25 };
26 };
27
28};
29
30&esdhc1 {
31 pinctrl-names = "default";
32 pinctrl-0 = <&pinctrl_esdhc1>;
33 bus-width = <4>;
34};
35
36&fec1 {
37 phy-mode = "rmii";
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_fec1>;
40}; 20};
41 21
42&L2 { 22&L2 {
43 arm,data-latency = <2 1 2>; 23 arm,data-latency = <2 1 2>;
44 arm,tag-latency = <3 2 3>; 24 arm,tag-latency = <3 2 3>;
45}; 25};
46
47&uart0 {
48 pinctrl-names = "default";
49 pinctrl-0 = <&pinctrl_uart0>;
50};
51
52&uart1 {
53 pinctrl-names = "default";
54 pinctrl-0 = <&pinctrl_uart1>;
55};
56
57&uart2 {
58 pinctrl-names = "default";
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";
70};
71
72&iomuxc {
73 vf610-colibri {
74 pinctrl_esdhc1: esdhc1grp {
75 fsl,pins = <
76 VF610_PAD_PTA24__ESDHC1_CLK 0x31ef
77 VF610_PAD_PTA25__ESDHC1_CMD 0x31ef
78 VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef
79 VF610_PAD_PTA27__ESDHC1_DAT1 0x31ef
80 VF610_PAD_PTA28__ESDHC1_DATA2 0x31ef
81 VF610_PAD_PTA29__ESDHC1_DAT3 0x31ef
82 VF610_PAD_PTB20__GPIO_42 0x219d
83 >;
84 };
85
86 pinctrl_fec1: fec1grp {
87 fsl,pins = <
88 VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2
89 VF610_PAD_PTC10__ENET_RMII1_MDIO 0x30d3
90 VF610_PAD_PTC11__ENET_RMII1_CRS 0x30d1
91 VF610_PAD_PTC12__ENET_RMII_RXD1 0x30d1
92 VF610_PAD_PTC13__ENET_RMII1_RXD0 0x30d1
93 VF610_PAD_PTC14__ENET_RMII1_RXER 0x30d1
94 VF610_PAD_PTC15__ENET_RMII1_TXD1 0x30d2
95 VF610_PAD_PTC16__ENET_RMII1_TXD0 0x30d2
96 VF610_PAD_PTC17__ENET_RMII1_TXEN 0x30d2
97 >;
98 };
99
100 pinctrl_uart0: uart0grp {
101 fsl,pins = <
102 VF610_PAD_PTB10__UART0_TX 0x21a2
103 VF610_PAD_PTB11__UART0_RX 0x21a1
104 >;
105 };
106
107 pinctrl_uart1: uart1grp {
108 fsl,pins = <
109 VF610_PAD_PTB4__UART1_TX 0x21a2
110 VF610_PAD_PTB5__UART1_RX 0x21a1
111 >;
112 };
113
114 pinctrl_uart2: uart2grp {
115 fsl,pins = <
116 VF610_PAD_PTD0__UART2_TX 0x21a2
117 VF610_PAD_PTD1__UART2_RX 0x21a1
118 VF610_PAD_PTD2__UART2_RTS 0x21a2
119 VF610_PAD_PTD3__UART2_CTS 0x21a1
120 >;
121 };
122 };
123};
diff --git a/arch/arm/boot/dts/vf610-cosmic.dts b/arch/arm/boot/dts/vf610-cosmic.dts
index de1b453c2932..fd8758b639f5 100644
--- a/arch/arm/boot/dts/vf610-cosmic.dts
+++ b/arch/arm/boot/dts/vf610-cosmic.dts
@@ -23,14 +23,16 @@
23 reg = <0x80000000 0x10000000>; 23 reg = <0x80000000 0x10000000>;
24 }; 24 };
25 25
26 clocks { 26 enet_ext: enet_ext {
27 enet_ext { 27 compatible = "fixed-clock";
28 compatible = "fixed-clock"; 28 #clock-cells = <0>;
29 #clock-cells = <0>; 29 clock-frequency = <50000000>;
30 clock-frequency = <50000000>;
31 };
32 }; 30 };
31};
33 32
33&clks {
34 clocks = <&sxosc>, <&fxosc>, <&enet_ext>;
35 clock-names = "sxosc", "fxosc", "enet_ext";
34}; 36};
35 37
36&esdhc1 { 38&esdhc1 {
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index 189b6975fe7d..a0f762159cb2 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -22,18 +22,16 @@
22 reg = <0x80000000 0x8000000>; 22 reg = <0x80000000 0x8000000>;
23 }; 23 };
24 24
25 clocks { 25 audio_ext: mclk_osc {
26 audio_ext { 26 compatible = "fixed-clock";
27 compatible = "fixed-clock"; 27 #clock-cells = <0>;
28 #clock-cells = <0>; 28 clock-frequency = <24576000>;
29 clock-frequency = <24576000>; 29 };
30 };
31 30
32 enet_ext { 31 enet_ext: eth_osc {
33 compatible = "fixed-clock"; 32 compatible = "fixed-clock";
34 #clock-cells = <0>; 33 #clock-cells = <0>;
35 clock-frequency = <50000000>; 34 clock-frequency = <50000000>;
36 };
37 }; 35 };
38 36
39 regulators { 37 regulators {
@@ -95,6 +93,11 @@
95 status = "okay"; 93 status = "okay";
96}; 94};
97 95
96&clks {
97 clocks = <&sxosc>, <&fxosc>, <&enet_ext>, <&audio_ext>;
98 clock-names = "sxosc", "fxosc", "enet_ext", "audio_ext";
99};
100
98&dspi0 { 101&dspi0 {
99 bus-num = <0>; 102 bus-num = <0>;
100 pinctrl-names = "default"; 103 pinctrl-names = "default";
@@ -112,10 +115,15 @@
112 }; 115 };
113}; 116};
114 117
118&edma0 {
119 status = "okay";
120};
121
115&esdhc1 { 122&esdhc1 {
116 pinctrl-names = "default"; 123 pinctrl-names = "default";
117 pinctrl-0 = <&pinctrl_esdhc1>; 124 pinctrl-0 = <&pinctrl_esdhc1>;
118 bus-width = <4>; 125 bus-width = <4>;
126 cd-gpios = <&gpio5 6 GPIO_ACTIVE_LOW>;
119 status = "okay"; 127 status = "okay";
120}; 128};
121 129
@@ -285,3 +293,19 @@
285 disable-over-current; 293 disable-over-current;
286 status = "okay"; 294 status = "okay";
287}; 295};
296
297&usbmisc0 {
298 status = "okay";
299};
300
301&usbmisc1 {
302 status = "okay";
303};
304
305&usbphy0 {
306 status = "okay";
307};
308
309&usbphy1 {
310 status = "okay";
311};
diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index 4d2ec32de96f..5f8eb1bd782b 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -7,481 +7,19 @@
7 * (at your option) any later version. 7 * (at your option) any later version.
8 */ 8 */
9 9
10#include "skeleton.dtsi" 10#include "vf500.dtsi"
11#include "vf610-pinfunc.h"
12#include <dt-bindings/clock/vf610-clock.h>
13#include <dt-bindings/interrupt-controller/irq.h>
14 11
15/ { 12&a5_cpu {
16 aliases { 13 next-level-cache = <&L2>;
17 can0 = &can0; 14};
18 can1 = &can1;
19 serial0 = &uart0;
20 serial1 = &uart1;
21 serial2 = &uart2;
22 serial3 = &uart3;
23 serial4 = &uart4;
24 serial5 = &uart5;
25 gpio0 = &gpio1;
26 gpio1 = &gpio2;
27 gpio2 = &gpio3;
28 gpio3 = &gpio4;
29 gpio4 = &gpio5;
30 usbphy0 = &usbphy0;
31 usbphy1 = &usbphy1;
32 };
33
34 cpus {
35 #address-cells = <1>;
36 #size-cells = <0>;
37
38 cpu@0 {
39 compatible = "arm,cortex-a5";
40 device_type = "cpu";
41 reg = <0x0>;
42 next-level-cache = <&L2>;
43 };
44 };
45
46 clocks {
47 #address-cells = <1>;
48 #size-cells = <0>;
49
50 sxosc {
51 compatible = "fixed-clock";
52 #clock-cells = <0>;
53 clock-frequency = <32768>;
54 };
55
56 fxosc {
57 compatible = "fixed-clock";
58 #clock-cells = <0>;
59 clock-frequency = <24000000>;
60 };
61 };
62
63 soc {
64 #address-cells = <1>;
65 #size-cells = <1>;
66 compatible = "simple-bus";
67 interrupt-parent = <&intc>;
68 ranges;
69
70 aips0: aips-bus@40000000 {
71 compatible = "fsl,aips-bus", "simple-bus";
72 #address-cells = <1>;
73 #size-cells = <1>;
74 interrupt-parent = <&intc>;
75 reg = <0x40000000 0x70000>;
76 ranges;
77
78 intc: interrupt-controller@40002000 {
79 compatible = "arm,cortex-a9-gic";
80 #interrupt-cells = <3>;
81 interrupt-controller;
82 reg = <0x40003000 0x1000>,
83 <0x40002100 0x100>;
84 };
85
86 L2: l2-cache@40006000 {
87 compatible = "arm,pl310-cache";
88 reg = <0x40006000 0x1000>;
89 cache-unified;
90 cache-level = <2>;
91 arm,data-latency = <1 1 1>;
92 arm,tag-latency = <2 2 2>;
93 };
94
95 edma0: dma-controller@40018000 {
96 #dma-cells = <2>;
97 compatible = "fsl,vf610-edma";
98 reg = <0x40018000 0x2000>,
99 <0x40024000 0x1000>,
100 <0x40025000 0x1000>;
101 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>,
102 <0 9 IRQ_TYPE_LEVEL_HIGH>;
103 interrupt-names = "edma-tx", "edma-err";
104 dma-channels = <32>;
105 clock-names = "dmamux0", "dmamux1";
106 clocks = <&clks VF610_CLK_DMAMUX0>,
107 <&clks VF610_CLK_DMAMUX1>;
108 };
109
110 can0: flexcan@40020000 {
111 compatible = "fsl,vf610-flexcan";
112 reg = <0x40020000 0x4000>;
113 interrupts = <0 58 IRQ_TYPE_LEVEL_HIGH>;
114 clocks = <&clks VF610_CLK_FLEXCAN0>,
115 <&clks VF610_CLK_FLEXCAN0>;
116 clock-names = "ipg", "per";
117 status = "disabled";
118 };
119
120 uart0: serial@40027000 {
121 compatible = "fsl,vf610-lpuart";
122 reg = <0x40027000 0x1000>;
123 interrupts = <0 61 IRQ_TYPE_LEVEL_HIGH>;
124 clocks = <&clks VF610_CLK_UART0>;
125 clock-names = "ipg";
126 dmas = <&edma0 0 2>,
127 <&edma0 0 3>;
128 dma-names = "rx","tx";
129 status = "disabled";
130 };
131
132 uart1: serial@40028000 {
133 compatible = "fsl,vf610-lpuart";
134 reg = <0x40028000 0x1000>;
135 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
136 clocks = <&clks VF610_CLK_UART1>;
137 clock-names = "ipg";
138 dmas = <&edma0 0 4>,
139 <&edma0 0 5>;
140 dma-names = "rx","tx";
141 status = "disabled";
142 };
143
144 uart2: serial@40029000 {
145 compatible = "fsl,vf610-lpuart";
146 reg = <0x40029000 0x1000>;
147 interrupts = <0 63 IRQ_TYPE_LEVEL_HIGH>;
148 clocks = <&clks VF610_CLK_UART2>;
149 clock-names = "ipg";
150 dmas = <&edma0 0 6>,
151 <&edma0 0 7>;
152 dma-names = "rx","tx";
153 status = "disabled";
154 };
155
156 uart3: serial@4002a000 {
157 compatible = "fsl,vf610-lpuart";
158 reg = <0x4002a000 0x1000>;
159 interrupts = <0 64 IRQ_TYPE_LEVEL_HIGH>;
160 clocks = <&clks VF610_CLK_UART3>;
161 clock-names = "ipg";
162 dmas = <&edma0 0 8>,
163 <&edma0 0 9>;
164 dma-names = "rx","tx";
165 status = "disabled";
166 };
167
168 dspi0: dspi0@4002c000 {
169 #address-cells = <1>;
170 #size-cells = <0>;
171 compatible = "fsl,vf610-dspi";
172 reg = <0x4002c000 0x1000>;
173 interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>;
174 clocks = <&clks VF610_CLK_DSPI0>;
175 clock-names = "dspi";
176 spi-num-chipselects = <5>;
177 status = "disabled";
178 };
179
180 sai2: sai@40031000 {
181 compatible = "fsl,vf610-sai";
182 reg = <0x40031000 0x1000>;
183 interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
184 clocks = <&clks VF610_CLK_SAI2>;
185 clock-names = "sai";
186 dma-names = "tx", "rx";
187 dmas = <&edma0 0 21>,
188 <&edma0 0 20>;
189 status = "disabled";
190 };
191
192 pit: pit@40037000 {
193 compatible = "fsl,vf610-pit";
194 reg = <0x40037000 0x1000>;
195 interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>;
196 clocks = <&clks VF610_CLK_PIT>;
197 clock-names = "pit";
198 };
199
200 pwm0: pwm@40038000 {
201 compatible = "fsl,vf610-ftm-pwm";
202 #pwm-cells = <3>;
203 reg = <0x40038000 0x1000>;
204 clock-names = "ftm_sys", "ftm_ext",
205 "ftm_fix", "ftm_cnt_clk_en";
206 clocks = <&clks VF610_CLK_FTM0>,
207 <&clks VF610_CLK_FTM0_EXT_SEL>,
208 <&clks VF610_CLK_FTM0_FIX_SEL>,
209 <&clks VF610_CLK_FTM0_EXT_FIX_EN>;
210 status = "disabled";
211 };
212
213 adc0: adc@4003b000 {
214 compatible = "fsl,vf610-adc";
215 reg = <0x4003b000 0x1000>;
216 interrupts = <0 53 0x04>;
217 clocks = <&clks VF610_CLK_ADC0>;
218 clock-names = "adc";
219 status = "disabled";
220 };
221
222 wdog@4003e000 {
223 compatible = "fsl,vf610-wdt", "fsl,imx21-wdt";
224 reg = <0x4003e000 0x1000>;
225 clocks = <&clks VF610_CLK_WDT>;
226 clock-names = "wdog";
227 };
228
229 qspi0: quadspi@40044000 {
230 #address-cells = <1>;
231 #size-cells = <0>;
232 compatible = "fsl,vf610-qspi";
233 reg = <0x40044000 0x1000>;
234 interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>;
235 clocks = <&clks VF610_CLK_QSPI0_EN>,
236 <&clks VF610_CLK_QSPI0>;
237 clock-names = "qspi_en", "qspi";
238 status = "disabled";
239 };
240
241 iomuxc: iomuxc@40048000 {
242 compatible = "fsl,vf610-iomuxc";
243 reg = <0x40048000 0x1000>;
244 #gpio-range-cells = <3>;
245 };
246
247 gpio1: gpio@40049000 {
248 compatible = "fsl,vf610-gpio";
249 reg = <0x40049000 0x1000 0x400ff000 0x40>;
250 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
251 gpio-controller;
252 #gpio-cells = <2>;
253 interrupt-controller;
254 #interrupt-cells = <2>;
255 gpio-ranges = <&iomuxc 0 0 32>;
256 };
257
258 gpio2: gpio@4004a000 {
259 compatible = "fsl,vf610-gpio";
260 reg = <0x4004a000 0x1000 0x400ff040 0x40>;
261 interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
262 gpio-controller;
263 #gpio-cells = <2>;
264 interrupt-controller;
265 #interrupt-cells = <2>;
266 gpio-ranges = <&iomuxc 0 32 32>;
267 };
268
269 gpio3: gpio@4004b000 {
270 compatible = "fsl,vf610-gpio";
271 reg = <0x4004b000 0x1000 0x400ff080 0x40>;
272 interrupts = <0 109 IRQ_TYPE_LEVEL_HIGH>;
273 gpio-controller;
274 #gpio-cells = <2>;
275 interrupt-controller;
276 #interrupt-cells = <2>;
277 gpio-ranges = <&iomuxc 0 64 32>;
278 };
279
280 gpio4: gpio@4004c000 {
281 compatible = "fsl,vf610-gpio";
282 reg = <0x4004c000 0x1000 0x400ff0c0 0x40>;
283 interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
284 gpio-controller;
285 #gpio-cells = <2>;
286 interrupt-controller;
287 #interrupt-cells = <2>;
288 gpio-ranges = <&iomuxc 0 96 32>;
289 };
290
291 gpio5: gpio@4004d000 {
292 compatible = "fsl,vf610-gpio";
293 reg = <0x4004d000 0x1000 0x400ff100 0x40>;
294 interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>;
295 gpio-controller;
296 #gpio-cells = <2>;
297 interrupt-controller;
298 #interrupt-cells = <2>;
299 gpio-ranges = <&iomuxc 0 128 7>;
300 };
301
302 anatop: anatop@40050000 {
303 compatible = "fsl,vf610-anatop", "syscon";
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>;
321 };
322
323 i2c0: i2c@40066000 {
324 #address-cells = <1>;
325 #size-cells = <0>;
326 compatible = "fsl,vf610-i2c";
327 reg = <0x40066000 0x1000>;
328 interrupts =<0 71 IRQ_TYPE_LEVEL_HIGH>;
329 clocks = <&clks VF610_CLK_I2C0>;
330 clock-names = "ipg";
331 dmas = <&edma0 0 50>,
332 <&edma0 0 51>;
333 dma-names = "rx","tx";
334 status = "disabled";
335 };
336
337 clks: ccm@4006b000 {
338 compatible = "fsl,vf610-ccm";
339 reg = <0x4006b000 0x1000>;
340 #clock-cells = <1>;
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 };
360 };
361
362 aips1: aips-bus@40080000 {
363 compatible = "fsl,aips-bus", "simple-bus";
364 #address-cells = <1>;
365 #size-cells = <1>;
366 reg = <0x40080000 0x80000>;
367 ranges;
368
369 edma1: dma-controller@40098000 {
370 #dma-cells = <2>;
371 compatible = "fsl,vf610-edma";
372 reg = <0x40098000 0x2000>,
373 <0x400a1000 0x1000>,
374 <0x400a2000 0x1000>;
375 interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>,
376 <0 11 IRQ_TYPE_LEVEL_HIGH>;
377 interrupt-names = "edma-tx", "edma-err";
378 dma-channels = <32>;
379 clock-names = "dmamux0", "dmamux1";
380 clocks = <&clks VF610_CLK_DMAMUX2>,
381 <&clks VF610_CLK_DMAMUX3>;
382 };
383
384 uart4: serial@400a9000 {
385 compatible = "fsl,vf610-lpuart";
386 reg = <0x400a9000 0x1000>;
387 interrupts = <0 65 IRQ_TYPE_LEVEL_HIGH>;
388 clocks = <&clks VF610_CLK_UART4>;
389 clock-names = "ipg";
390 status = "disabled";
391 };
392
393 uart5: serial@400aa000 {
394 compatible = "fsl,vf610-lpuart";
395 reg = <0x400aa000 0x1000>;
396 interrupts = <0 66 IRQ_TYPE_LEVEL_HIGH>;
397 clocks = <&clks VF610_CLK_UART5>;
398 clock-names = "ipg";
399 status = "disabled";
400 };
401
402 adc1: adc@400bb000 {
403 compatible = "fsl,vf610-adc";
404 reg = <0x400bb000 0x1000>;
405 interrupts = <0 54 0x04>;
406 clocks = <&clks VF610_CLK_ADC1>;
407 clock-names = "adc";
408 status = "disabled";
409 };
410
411 esdhc1: esdhc@400b2000 {
412 compatible = "fsl,imx53-esdhc";
413 reg = <0x400b2000 0x1000>;
414 interrupts = <0 28 0x04>;
415 clocks = <&clks VF610_CLK_IPG_BUS>,
416 <&clks VF610_CLK_PLATFORM_BUS>,
417 <&clks VF610_CLK_ESDHC1>;
418 clock-names = "ipg", "ahb", "per";
419 status = "disabled";
420 };
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
440 ftm: ftm@400b8000 {
441 compatible = "fsl,ftm-timer";
442 reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
443 interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>;
444 clock-names = "ftm-evt", "ftm-src",
445 "ftm-evt-counter-en", "ftm-src-counter-en";
446 clocks = <&clks VF610_CLK_FTM2>,
447 <&clks VF610_CLK_FTM3>,
448 <&clks VF610_CLK_FTM2_EXT_FIX_EN>,
449 <&clks VF610_CLK_FTM3_EXT_FIX_EN>;
450 status = "disabled";
451 };
452
453 fec0: ethernet@400d0000 {
454 compatible = "fsl,mvf600-fec";
455 reg = <0x400d0000 0x1000>;
456 interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
457 clocks = <&clks VF610_CLK_ENET0>,
458 <&clks VF610_CLK_ENET0>,
459 <&clks VF610_CLK_ENET>;
460 clock-names = "ipg", "ahb", "ptp";
461 status = "disabled";
462 };
463
464 fec1: ethernet@400d1000 {
465 compatible = "fsl,mvf600-fec";
466 reg = <0x400d1000 0x1000>;
467 interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
468 clocks = <&clks VF610_CLK_ENET1>,
469 <&clks VF610_CLK_ENET1>,
470 <&clks VF610_CLK_ENET>;
471 clock-names = "ipg", "ahb", "ptp";
472 status = "disabled";
473 };
474
475 can1: flexcan@400d4000 {
476 compatible = "fsl,vf610-flexcan";
477 reg = <0x400d4000 0x4000>;
478 interrupts = <0 59 IRQ_TYPE_LEVEL_HIGH>;
479 clocks = <&clks VF610_CLK_FLEXCAN1>,
480 <&clks VF610_CLK_FLEXCAN1>;
481 clock-names = "ipg", "per";
482 status = "disabled";
483 };
484 15
485 }; 16&aips0 {
17 L2: l2-cache@40006000 {
18 compatible = "arm,pl310-cache";
19 reg = <0x40006000 0x1000>;
20 cache-unified;
21 cache-level = <2>;
22 arm,data-latency = <1 1 1>;
23 arm,tag-latency = <2 2 2>;
486 }; 24 };
487}; 25};
diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
new file mode 100644
index 000000000000..505969ae8093
--- /dev/null
+++ b/arch/arm/boot/dts/vfxxx.dtsi
@@ -0,0 +1,437 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License 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 "vf610-pinfunc.h"
11#include <dt-bindings/clock/vf610-clock.h>
12#include <dt-bindings/interrupt-controller/irq.h>
13#include <dt-bindings/gpio/gpio.h>
14
15/ {
16 aliases {
17 can0 = &can0;
18 can1 = &can1;
19 serial0 = &uart0;
20 serial1 = &uart1;
21 serial2 = &uart2;
22 serial3 = &uart3;
23 serial4 = &uart4;
24 serial5 = &uart5;
25 gpio0 = &gpio1;
26 gpio1 = &gpio2;
27 gpio2 = &gpio3;
28 gpio3 = &gpio4;
29 gpio4 = &gpio5;
30 usbphy0 = &usbphy0;
31 usbphy1 = &usbphy1;
32 };
33
34 fxosc: fxosc {
35 compatible = "fixed-clock";
36 #clock-cells = <0>;
37 clock-frequency = <24000000>;
38 };
39
40 sxosc: sxosc {
41 compatible = "fixed-clock";
42 #clock-cells = <0>;
43 clock-frequency = <32768>;
44 };
45
46 soc {
47 #address-cells = <1>;
48 #size-cells = <1>;
49 compatible = "simple-bus";
50 ranges;
51
52 aips0: aips-bus@40000000 {
53 compatible = "fsl,aips-bus", "simple-bus";
54 #address-cells = <1>;
55 #size-cells = <1>;
56 ranges;
57
58 edma0: dma-controller@40018000 {
59 #dma-cells = <2>;
60 compatible = "fsl,vf610-edma";
61 reg = <0x40018000 0x2000>,
62 <0x40024000 0x1000>,
63 <0x40025000 0x1000>;
64 dma-channels = <32>;
65 clock-names = "dmamux0", "dmamux1";
66 clocks = <&clks VF610_CLK_DMAMUX0>,
67 <&clks VF610_CLK_DMAMUX1>;
68 status = "disabled";
69 };
70
71 can0: flexcan@40020000 {
72 compatible = "fsl,vf610-flexcan";
73 reg = <0x40020000 0x4000>;
74 clocks = <&clks VF610_CLK_FLEXCAN0>,
75 <&clks VF610_CLK_FLEXCAN0>;
76 clock-names = "ipg", "per";
77 status = "disabled";
78 };
79
80 uart0: serial@40027000 {
81 compatible = "fsl,vf610-lpuart";
82 reg = <0x40027000 0x1000>;
83 clocks = <&clks VF610_CLK_UART0>;
84 clock-names = "ipg";
85 dmas = <&edma0 0 2>,
86 <&edma0 0 3>;
87 dma-names = "rx","tx";
88 status = "disabled";
89 };
90
91 uart1: serial@40028000 {
92 compatible = "fsl,vf610-lpuart";
93 reg = <0x40028000 0x1000>;
94 clocks = <&clks VF610_CLK_UART1>;
95 clock-names = "ipg";
96 dmas = <&edma0 0 4>,
97 <&edma0 0 5>;
98 dma-names = "rx","tx";
99 status = "disabled";
100 };
101
102 uart2: serial@40029000 {
103 compatible = "fsl,vf610-lpuart";
104 reg = <0x40029000 0x1000>;
105 clocks = <&clks VF610_CLK_UART2>;
106 clock-names = "ipg";
107 dmas = <&edma0 0 6>,
108 <&edma0 0 7>;
109 dma-names = "rx","tx";
110 status = "disabled";
111 };
112
113 uart3: serial@4002a000 {
114 compatible = "fsl,vf610-lpuart";
115 reg = <0x4002a000 0x1000>;
116 clocks = <&clks VF610_CLK_UART3>;
117 clock-names = "ipg";
118 dmas = <&edma0 0 8>,
119 <&edma0 0 9>;
120 dma-names = "rx","tx";
121 status = "disabled";
122 };
123
124 dspi0: dspi0@4002c000 {
125 #address-cells = <1>;
126 #size-cells = <0>;
127 compatible = "fsl,vf610-dspi";
128 reg = <0x4002c000 0x1000>;
129 clocks = <&clks VF610_CLK_DSPI0>;
130 clock-names = "dspi";
131 spi-num-chipselects = <5>;
132 status = "disabled";
133 };
134
135 sai2: sai@40031000 {
136 compatible = "fsl,vf610-sai";
137 reg = <0x40031000 0x1000>;
138 clocks = <&clks VF610_CLK_SAI2>;
139 clock-names = "sai";
140 dma-names = "tx", "rx";
141 dmas = <&edma0 0 21>,
142 <&edma0 0 20>;
143 status = "disabled";
144 };
145
146 pit: pit@40037000 {
147 compatible = "fsl,vf610-pit";
148 reg = <0x40037000 0x1000>;
149 clocks = <&clks VF610_CLK_PIT>;
150 clock-names = "pit";
151 };
152
153 pwm0: pwm@40038000 {
154 compatible = "fsl,vf610-ftm-pwm";
155 #pwm-cells = <3>;
156 reg = <0x40038000 0x1000>;
157 clock-names = "ftm_sys", "ftm_ext",
158 "ftm_fix", "ftm_cnt_clk_en";
159 clocks = <&clks VF610_CLK_FTM0>,
160 <&clks VF610_CLK_FTM0_EXT_SEL>,
161 <&clks VF610_CLK_FTM0_FIX_SEL>,
162 <&clks VF610_CLK_FTM0_EXT_FIX_EN>;
163 status = "disabled";
164 };
165
166 pwm1: pwm@40039000 {
167 compatible = "fsl,vf610-ftm-pwm";
168 #pwm-cells = <3>;
169 reg = <0x40039000 0x1000>;
170 clock-names = "ftm_sys", "ftm_ext",
171 "ftm_fix", "ftm_cnt_clk_en";
172 clocks = <&clks VF610_CLK_FTM1>,
173 <&clks VF610_CLK_FTM1_EXT_SEL>,
174 <&clks VF610_CLK_FTM1_FIX_SEL>,
175 <&clks VF610_CLK_FTM1_EXT_FIX_EN>;
176 status = "disabled";
177 };
178
179 adc0: adc@4003b000 {
180 compatible = "fsl,vf610-adc";
181 reg = <0x4003b000 0x1000>;
182 clocks = <&clks VF610_CLK_ADC0>;
183 clock-names = "adc";
184 status = "disabled";
185 };
186
187 wdog@4003e000 {
188 compatible = "fsl,vf610-wdt", "fsl,imx21-wdt";
189 reg = <0x4003e000 0x1000>;
190 clocks = <&clks VF610_CLK_WDT>;
191 clock-names = "wdog";
192 status = "disabled";
193 };
194
195 qspi0: quadspi@40044000 {
196 #address-cells = <1>;
197 #size-cells = <0>;
198 compatible = "fsl,vf610-qspi";
199 reg = <0x40044000 0x1000>;
200 clocks = <&clks VF610_CLK_QSPI0_EN>,
201 <&clks VF610_CLK_QSPI0>;
202 clock-names = "qspi_en", "qspi";
203 status = "disabled";
204 };
205
206 iomuxc: iomuxc@40048000 {
207 compatible = "fsl,vf610-iomuxc";
208 reg = <0x40048000 0x1000>;
209 #gpio-range-cells = <3>;
210 };
211
212 gpio1: gpio@40049000 {
213 compatible = "fsl,vf610-gpio";
214 reg = <0x40049000 0x1000 0x400ff000 0x40>;
215 gpio-controller;
216 #gpio-cells = <2>;
217 interrupt-controller;
218 #interrupt-cells = <2>;
219 gpio-ranges = <&iomuxc 0 0 32>;
220 };
221
222 gpio2: gpio@4004a000 {
223 compatible = "fsl,vf610-gpio";
224 reg = <0x4004a000 0x1000 0x400ff040 0x40>;
225 gpio-controller;
226 #gpio-cells = <2>;
227 interrupt-controller;
228 #interrupt-cells = <2>;
229 gpio-ranges = <&iomuxc 0 32 32>;
230 };
231
232 gpio3: gpio@4004b000 {
233 compatible = "fsl,vf610-gpio";
234 reg = <0x4004b000 0x1000 0x400ff080 0x40>;
235 gpio-controller;
236 #gpio-cells = <2>;
237 interrupt-controller;
238 #interrupt-cells = <2>;
239 gpio-ranges = <&iomuxc 0 64 32>;
240 };
241
242 gpio4: gpio@4004c000 {
243 compatible = "fsl,vf610-gpio";
244 reg = <0x4004c000 0x1000 0x400ff0c0 0x40>;
245 gpio-controller;
246 #gpio-cells = <2>;
247 interrupt-controller;
248 #interrupt-cells = <2>;
249 gpio-ranges = <&iomuxc 0 96 32>;
250 };
251
252 gpio5: gpio@4004d000 {
253 compatible = "fsl,vf610-gpio";
254 reg = <0x4004d000 0x1000 0x400ff100 0x40>;
255 gpio-controller;
256 #gpio-cells = <2>;
257 interrupt-controller;
258 #interrupt-cells = <2>;
259 gpio-ranges = <&iomuxc 0 128 7>;
260 };
261
262 anatop: anatop@40050000 {
263 compatible = "fsl,vf610-anatop", "syscon";
264 reg = <0x40050000 0x400>;
265 };
266
267 usbphy0: usbphy@40050800 {
268 compatible = "fsl,vf610-usbphy";
269 reg = <0x40050800 0x400>;
270 clocks = <&clks VF610_CLK_USBPHY0>;
271 fsl,anatop = <&anatop>;
272 status = "disabled";
273 };
274
275 usbphy1: usbphy@40050c00 {
276 compatible = "fsl,vf610-usbphy";
277 reg = <0x40050c00 0x400>;
278 clocks = <&clks VF610_CLK_USBPHY1>;
279 fsl,anatop = <&anatop>;
280 status = "disabled";
281 };
282
283 i2c0: i2c@40066000 {
284 #address-cells = <1>;
285 #size-cells = <0>;
286 compatible = "fsl,vf610-i2c";
287 reg = <0x40066000 0x1000>;
288 clocks = <&clks VF610_CLK_I2C0>;
289 clock-names = "ipg";
290 dmas = <&edma0 0 50>,
291 <&edma0 0 51>;
292 dma-names = "rx","tx";
293 status = "disabled";
294 };
295
296 clks: ccm@4006b000 {
297 compatible = "fsl,vf610-ccm";
298 reg = <0x4006b000 0x1000>;
299 clocks = <&sxosc>, <&fxosc>;
300 clock-names = "sxosc", "fxosc";
301 #clock-cells = <1>;
302 };
303
304 usbdev0: usb@40034000 {
305 compatible = "fsl,vf610-usb", "fsl,imx27-usb";
306 reg = <0x40034000 0x800>;
307 clocks = <&clks VF610_CLK_USBC0>;
308 fsl,usbphy = <&usbphy0>;
309 fsl,usbmisc = <&usbmisc0 0>;
310 dr_mode = "peripheral";
311 status = "disabled";
312 };
313
314 usbmisc0: usb@40034800 {
315 #index-cells = <1>;
316 compatible = "fsl,vf610-usbmisc";
317 reg = <0x40034800 0x200>;
318 clocks = <&clks VF610_CLK_USBC0>;
319 status = "disabled";
320 };
321 };
322
323 aips1: aips-bus@40080000 {
324 compatible = "fsl,aips-bus", "simple-bus";
325 #address-cells = <1>;
326 #size-cells = <1>;
327 ranges;
328
329 edma1: dma-controller@40098000 {
330 #dma-cells = <2>;
331 compatible = "fsl,vf610-edma";
332 reg = <0x40098000 0x2000>,
333 <0x400a1000 0x1000>,
334 <0x400a2000 0x1000>;
335 dma-channels = <32>;
336 clock-names = "dmamux0", "dmamux1";
337 clocks = <&clks VF610_CLK_DMAMUX2>,
338 <&clks VF610_CLK_DMAMUX3>;
339 status = "disabled";
340 };
341
342 uart4: serial@400a9000 {
343 compatible = "fsl,vf610-lpuart";
344 reg = <0x400a9000 0x1000>;
345 clocks = <&clks VF610_CLK_UART4>;
346 clock-names = "ipg";
347 status = "disabled";
348 };
349
350 uart5: serial@400aa000 {
351 compatible = "fsl,vf610-lpuart";
352 reg = <0x400aa000 0x1000>;
353 clocks = <&clks VF610_CLK_UART5>;
354 clock-names = "ipg";
355 status = "disabled";
356 };
357
358 adc1: adc@400bb000 {
359 compatible = "fsl,vf610-adc";
360 reg = <0x400bb000 0x1000>;
361 clocks = <&clks VF610_CLK_ADC1>;
362 clock-names = "adc";
363 status = "disabled";
364 };
365
366 esdhc1: esdhc@400b2000 {
367 compatible = "fsl,imx53-esdhc";
368 reg = <0x400b2000 0x1000>;
369 clocks = <&clks VF610_CLK_IPG_BUS>,
370 <&clks VF610_CLK_PLATFORM_BUS>,
371 <&clks VF610_CLK_ESDHC1>;
372 clock-names = "ipg", "ahb", "per";
373 status = "disabled";
374 };
375
376 usbh1: usb@400b4000 {
377 compatible = "fsl,vf610-usb", "fsl,imx27-usb";
378 reg = <0x400b4000 0x800>;
379 clocks = <&clks VF610_CLK_USBC1>;
380 fsl,usbphy = <&usbphy1>;
381 fsl,usbmisc = <&usbmisc1 0>;
382 dr_mode = "host";
383 status = "disabled";
384 };
385
386 usbmisc1: usb@400b4800 {
387 #index-cells = <1>;
388 compatible = "fsl,vf610-usbmisc";
389 reg = <0x400b4800 0x200>;
390 clocks = <&clks VF610_CLK_USBC1>;
391 status = "disabled";
392 };
393
394 ftm: ftm@400b8000 {
395 compatible = "fsl,ftm-timer";
396 reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
397 clock-names = "ftm-evt", "ftm-src",
398 "ftm-evt-counter-en", "ftm-src-counter-en";
399 clocks = <&clks VF610_CLK_FTM2>,
400 <&clks VF610_CLK_FTM3>,
401 <&clks VF610_CLK_FTM2_EXT_FIX_EN>,
402 <&clks VF610_CLK_FTM3_EXT_FIX_EN>;
403 status = "disabled";
404 };
405
406 fec0: ethernet@400d0000 {
407 compatible = "fsl,mvf600-fec";
408 reg = <0x400d0000 0x1000>;
409 clocks = <&clks VF610_CLK_ENET0>,
410 <&clks VF610_CLK_ENET0>,
411 <&clks VF610_CLK_ENET>;
412 clock-names = "ipg", "ahb", "ptp";
413 status = "disabled";
414 };
415
416 fec1: ethernet@400d1000 {
417 compatible = "fsl,mvf600-fec";
418 reg = <0x400d1000 0x1000>;
419 clocks = <&clks VF610_CLK_ENET1>,
420 <&clks VF610_CLK_ENET1>,
421 <&clks VF610_CLK_ENET>;
422 clock-names = "ipg", "ahb", "ptp";
423 status = "disabled";
424 };
425
426 can1: flexcan@400d4000 {
427 compatible = "fsl,vf610-flexcan";
428 reg = <0x400d4000 0x4000>;
429 clocks = <&clks VF610_CLK_FLEXCAN1>,
430 <&clks VF610_CLK_FLEXCAN1>;
431 clock-names = "ipg", "per";
432 status = "disabled";
433 };
434
435 };
436 };
437};
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index ce2ef5bec4f2..ee3e5d675b05 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -243,7 +243,6 @@
243 clkc: clkc@100 { 243 clkc: clkc@100 {
244 #clock-cells = <1>; 244 #clock-cells = <1>;
245 compatible = "xlnx,ps7-clkc"; 245 compatible = "xlnx,ps7-clkc";
246 ps-clk-frequency = <33333333>;
247 fclk-enable = <0>; 246 fclk-enable = <0>;
248 clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x", 247 clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x",
249 "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x", 248 "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x",
diff --git a/arch/arm/boot/dts/zynq-parallella.dts b/arch/arm/boot/dts/zynq-parallella.dts
index 0429bbd89fba..ab1dc0a56cdd 100644
--- a/arch/arm/boot/dts/zynq-parallella.dts
+++ b/arch/arm/boot/dts/zynq-parallella.dts
@@ -36,6 +36,7 @@
36 36
37&clkc { 37&clkc {
38 fclk-enable = <0xf>; 38 fclk-enable = <0xf>;
39 ps-clk-frequency = <33333333>;
39}; 40};
40 41
41&gem0 { 42&gem0 {
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index 94e2cda6f9b6..280f02dd4ddc 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -42,6 +42,10 @@
42 status = "okay"; 42 status = "okay";
43}; 43};
44 44
45&clkc {
46 ps-clk-frequency = <33333333>;
47};
48
45&gem0 { 49&gem0 {
46 status = "okay"; 50 status = "okay";
47 phy-mode = "rgmii-id"; 51 phy-mode = "rgmii-id";
diff --git a/arch/arm/boot/dts/zynq-zc706.dts b/arch/arm/boot/dts/zynq-zc706.dts
index a8bbdfbc7093..34f7812d2ee8 100644
--- a/arch/arm/boot/dts/zynq-zc706.dts
+++ b/arch/arm/boot/dts/zynq-zc706.dts
@@ -29,6 +29,10 @@
29 29
30}; 30};
31 31
32&clkc {
33 ps-clk-frequency = <33333333>;
34};
35
32&gem0 { 36&gem0 {
33 status = "okay"; 37 status = "okay";
34 phy-mode = "rgmii-id"; 38 phy-mode = "rgmii-id";
diff --git a/arch/arm/boot/dts/zynq-zed.dts b/arch/arm/boot/dts/zynq-zed.dts
index 697779a353ed..1c7cc990b47a 100644
--- a/arch/arm/boot/dts/zynq-zed.dts
+++ b/arch/arm/boot/dts/zynq-zed.dts
@@ -29,6 +29,10 @@
29 29
30}; 30};
31 31
32&clkc {
33 ps-clk-frequency = <33333333>;
34};
35
32&gem0 { 36&gem0 {
33 status = "okay"; 37 status = "okay";
34 phy-mode = "rgmii-id"; 38 phy-mode = "rgmii-id";
diff --git a/arch/arm/boot/dts/zynq-zybo.dts b/arch/arm/boot/dts/zynq-zybo.dts
new file mode 100644
index 000000000000..a9a12ce5023b
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-zybo.dts
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2011 - 2014 Xilinx
3 * Copyright (C) 2012 National Instruments Corp.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14/dts-v1/;
15/include/ "zynq-7000.dtsi"
16
17/ {
18 model = "Zynq ZYBO Development Board";
19 compatible = "digilent,zynq-zybo", "xlnx,zynq-7000";
20
21 memory {
22 device_type = "memory";
23 reg = <0x0 0x20000000>;
24 };
25
26 chosen {
27 bootargs = "console=ttyPS0,115200 earlyprintk";
28 };
29
30};
31
32&clkc {
33 ps-clk-frequency = <50000000>;
34};
35
36&gem0 {
37 status = "okay";
38 phy-mode = "rgmii-id";
39 phy-handle = <&ethernet_phy>;
40
41 ethernet_phy: ethernet-phy@0 {
42 reg = <0>;
43 };
44};
45
46&sdhci0 {
47 status = "okay";
48};
49
50&uart1 {
51 status = "okay";
52};
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 72041f002b7e..5662a872689b 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -245,6 +245,8 @@ struct edma {
245 /* list of channels with no even trigger; terminated by "-1" */ 245 /* list of channels with no even trigger; terminated by "-1" */
246 const s8 *noevent; 246 const s8 *noevent;
247 247
248 struct edma_soc_info *info;
249
248 /* The edma_inuse bit for each PaRAM slot is clear unless the 250 /* The edma_inuse bit for each PaRAM slot is clear unless the
249 * channel is in use ... by ARM or DSP, for QDMA, or whatever. 251 * channel is in use ... by ARM or DSP, for QDMA, or whatever.
250 */ 252 */
@@ -296,7 +298,7 @@ static void map_dmach_queue(unsigned ctlr, unsigned ch_no,
296 ~(0x7 << bit), queue_no << bit); 298 ~(0x7 << bit), queue_no << bit);
297} 299}
298 300
299static void __init assign_priority_to_queue(unsigned ctlr, int queue_no, 301static void assign_priority_to_queue(unsigned ctlr, int queue_no,
300 int priority) 302 int priority)
301{ 303{
302 int bit = queue_no * 4; 304 int bit = queue_no * 4;
@@ -315,7 +317,7 @@ static void __init assign_priority_to_queue(unsigned ctlr, int queue_no,
315 * included in that particular EDMA variant (Eg : dm646x) 317 * included in that particular EDMA variant (Eg : dm646x)
316 * 318 *
317 */ 319 */
318static void __init map_dmach_param(unsigned ctlr) 320static void map_dmach_param(unsigned ctlr)
319{ 321{
320 int i; 322 int i;
321 for (i = 0; i < EDMA_MAX_DMACH; i++) 323 for (i = 0; i < EDMA_MAX_DMACH; i++)
@@ -1798,6 +1800,7 @@ static int edma_probe(struct platform_device *pdev)
1798 edma_write_array2(j, EDMA_DRAE, i, 1, 0x0); 1800 edma_write_array2(j, EDMA_DRAE, i, 1, 0x0);
1799 edma_write_array(j, EDMA_QRAE, i, 0x0); 1801 edma_write_array(j, EDMA_QRAE, i, 0x0);
1800 } 1802 }
1803 edma_cc[j]->info = info[j];
1801 arch_num_cc++; 1804 arch_num_cc++;
1802 1805
1803 edma_dev_info.id = j; 1806 edma_dev_info.id = j;
@@ -1807,9 +1810,56 @@ static int edma_probe(struct platform_device *pdev)
1807 return 0; 1810 return 0;
1808} 1811}
1809 1812
1813#ifdef CONFIG_PM_SLEEP
1814static int edma_pm_resume(struct device *dev)
1815{
1816 int i, j;
1817
1818 for (j = 0; j < arch_num_cc; j++) {
1819 struct edma *cc = edma_cc[j];
1820
1821 s8 (*queue_priority_mapping)[2];
1822
1823 queue_priority_mapping = cc->info->queue_priority_mapping;
1824
1825 /* Event queue priority mapping */
1826 for (i = 0; queue_priority_mapping[i][0] != -1; i++)
1827 assign_priority_to_queue(j,
1828 queue_priority_mapping[i][0],
1829 queue_priority_mapping[i][1]);
1830
1831 /*
1832 * Map the channel to param entry if channel mapping logic
1833 * exist
1834 */
1835 if (edma_read(j, EDMA_CCCFG) & CHMAP_EXIST)
1836 map_dmach_param(j);
1837
1838 for (i = 0; i < cc->num_channels; i++) {
1839 if (test_bit(i, cc->edma_inuse)) {
1840 /* ensure access through shadow region 0 */
1841 edma_or_array2(j, EDMA_DRAE, 0, i >> 5,
1842 BIT(i & 0x1f));
1843
1844 setup_dma_interrupt(i,
1845 cc->intr_data[i].callback,
1846 cc->intr_data[i].data);
1847 }
1848 }
1849 }
1850
1851 return 0;
1852}
1853#endif
1854
1855static const struct dev_pm_ops edma_pm_ops = {
1856 SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, edma_pm_resume)
1857};
1858
1810static struct platform_driver edma_driver = { 1859static struct platform_driver edma_driver = {
1811 .driver = { 1860 .driver = {
1812 .name = "edma", 1861 .name = "edma",
1862 .pm = &edma_pm_ops,
1813 .of_match_table = edma_of_ids, 1863 .of_match_table = edma_of_ids,
1814 }, 1864 },
1815 .probe = edma_probe, 1865 .probe = edma_probe,
diff --git a/arch/arm/configs/ape6evm_defconfig b/arch/arm/configs/ape6evm_defconfig
index b54b28fc5a70..db81d8ce4c03 100644
--- a/arch/arm/configs/ape6evm_defconfig
+++ b/arch/arm/configs/ape6evm_defconfig
@@ -33,6 +33,7 @@ CONFIG_ARM_APPENDED_DTB=y
33CONFIG_VFP=y 33CONFIG_VFP=y
34CONFIG_NEON=y 34CONFIG_NEON=y
35CONFIG_BINFMT_MISC=y 35CONFIG_BINFMT_MISC=y
36CONFIG_PM_RUNTIME=y
36CONFIG_NET=y 37CONFIG_NET=y
37CONFIG_PACKET=y 38CONFIG_PACKET=y
38CONFIG_UNIX=y 39CONFIG_UNIX=y
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 3b515c179487..a67375f24b21 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -80,6 +80,7 @@ CONFIG_BLK_DEV_SD=y
80CONFIG_NETDEVICES=y 80CONFIG_NETDEVICES=y
81CONFIG_MACB=y 81CONFIG_MACB=y
82# CONFIG_NET_VENDOR_BROADCOM is not set 82# CONFIG_NET_VENDOR_BROADCOM is not set
83CONFIG_DM9000=y
83# CONFIG_NET_VENDOR_FARADAY is not set 84# CONFIG_NET_VENDOR_FARADAY is not set
84# CONFIG_NET_VENDOR_INTEL is not set 85# CONFIG_NET_VENDOR_INTEL is not set
85# CONFIG_NET_VENDOR_MARVELL is not set 86# CONFIG_NET_VENDOR_MARVELL is not set
@@ -113,6 +114,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=272
113CONFIG_INPUT_JOYDEV=y 114CONFIG_INPUT_JOYDEV=y
114CONFIG_INPUT_EVDEV=y 115CONFIG_INPUT_EVDEV=y
115# CONFIG_KEYBOARD_ATKBD is not set 116# CONFIG_KEYBOARD_ATKBD is not set
117CONFIG_KEYBOARD_QT1070=y
116CONFIG_KEYBOARD_GPIO=y 118CONFIG_KEYBOARD_GPIO=y
117# CONFIG_INPUT_MOUSE is not set 119# CONFIG_INPUT_MOUSE is not set
118CONFIG_INPUT_TOUCHSCREEN=y 120CONFIG_INPUT_TOUCHSCREEN=y
@@ -186,6 +188,7 @@ CONFIG_IIO=y
186CONFIG_AT91_ADC=y 188CONFIG_AT91_ADC=y
187CONFIG_PWM=y 189CONFIG_PWM=y
188CONFIG_PWM_ATMEL=y 190CONFIG_PWM_ATMEL=y
191CONFIG_PWM_ATMEL_TCB=y
189CONFIG_EXT4_FS=y 192CONFIG_EXT4_FS=y
190CONFIG_FANOTIFY=y 193CONFIG_FANOTIFY=y
191CONFIG_VFAT_FS=y 194CONFIG_VFAT_FS=y
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
deleted file mode 100644
index bf057719dab0..000000000000
--- a/arch/arm/configs/at91rm9200_defconfig
+++ /dev/null
@@ -1,161 +0,0 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_NO_HZ=y
5CONFIG_HIGH_RES_TIMERS=y
6CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=14
9CONFIG_USER_NS=y
10CONFIG_BLK_DEV_INITRD=y
11CONFIG_MODULES=y
12CONFIG_MODULE_FORCE_LOAD=y
13CONFIG_MODULE_UNLOAD=y
14CONFIG_MODVERSIONS=y
15CONFIG_MODULE_SRCVERSION_ALL=y
16# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_CFQ is not set
18CONFIG_ARCH_AT91=y
19CONFIG_ARCH_AT91RM9200=y
20CONFIG_MACH_ONEARM=y
21CONFIG_MACH_AT91RM9200EK=y
22CONFIG_MACH_CSB337=y
23CONFIG_MACH_CSB637=y
24CONFIG_MACH_CARMEVA=y
25CONFIG_MACH_ATEB9200=y
26CONFIG_MACH_KB9200=y
27CONFIG_MACH_PICOTUX2XX=y
28CONFIG_MACH_KAFA=y
29CONFIG_MACH_ECBAT91=y
30CONFIG_MACH_YL9200=y
31CONFIG_MACH_CPUAT91=y
32CONFIG_MACH_ECO920=y
33CONFIG_MTD_AT91_DATAFLASH_CARD=y
34CONFIG_AT91_TIMER_HZ=100
35# CONFIG_ARM_THUMB is not set
36CONFIG_PCCARD=y
37CONFIG_AT91_CF=y
38CONFIG_AEABI=y
39# CONFIG_COMPACTION is not set
40CONFIG_ZBOOT_ROM_TEXT=0x10000000
41CONFIG_ZBOOT_ROM_BSS=0x20040000
42CONFIG_KEXEC=y
43CONFIG_AUTO_ZRELADDR=y
44CONFIG_FPE_NWFPE=y
45CONFIG_BINFMT_MISC=y
46CONFIG_NET=y
47CONFIG_PACKET=y
48CONFIG_UNIX=y
49CONFIG_INET=y
50CONFIG_IP_MULTICAST=y
51CONFIG_IP_PNP=y
52CONFIG_IP_PNP_DHCP=y
53CONFIG_IP_PNP_BOOTP=y
54# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
55# CONFIG_INET_XFRM_MODE_TUNNEL is not set
56# CONFIG_INET_XFRM_MODE_BEET is not set
57# CONFIG_INET_DIAG is not set
58CONFIG_IPV6=y
59CONFIG_IPV6_PRIVACY=y
60CONFIG_IPV6_ROUTER_PREF=y
61CONFIG_IPV6_ROUTE_INFO=y
62CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
63CONFIG_DEVTMPFS=y
64CONFIG_DEVTMPFS_MOUNT=y
65# CONFIG_STANDALONE is not set
66# CONFIG_PREVENT_FIRMWARE_BUILD is not set
67CONFIG_MTD=y
68CONFIG_MTD_CMDLINE_PARTS=y
69CONFIG_MTD_CHAR=y
70CONFIG_MTD_BLOCK=y
71CONFIG_MTD_CFI=y
72CONFIG_MTD_JEDECPROBE=y
73CONFIG_MTD_CFI_INTELEXT=y
74CONFIG_MTD_CFI_AMDSTD=y
75CONFIG_MTD_COMPLEX_MAPPINGS=y
76CONFIG_MTD_PHYSMAP=y
77CONFIG_MTD_PLATRAM=y
78CONFIG_MTD_DATAFLASH=y
79CONFIG_MTD_NAND=y
80CONFIG_MTD_NAND_ATMEL=y
81CONFIG_MTD_NAND_PLATFORM=y
82CONFIG_MTD_UBI=y
83CONFIG_MTD_UBI_GLUEBI=y
84CONFIG_BLK_DEV_LOOP=y
85CONFIG_BLK_DEV_RAM=y
86CONFIG_BLK_DEV_RAM_SIZE=8192
87CONFIG_NETDEVICES=y
88CONFIG_MII=y
89CONFIG_ARM_AT91_ETHER=y
90CONFIG_DAVICOM_PHY=y
91CONFIG_SMSC_PHY=y
92CONFIG_MICREL_PHY=y
93# CONFIG_WLAN is not set
94# CONFIG_INPUT_MOUSEDEV is not set
95CONFIG_INPUT_EVDEV=y
96CONFIG_KEYBOARD_GPIO=y
97# CONFIG_INPUT_MOUSE is not set
98CONFIG_INPUT_TOUCHSCREEN=y
99# CONFIG_LEGACY_PTYS is not set
100CONFIG_SERIAL_ATMEL=y
101CONFIG_SERIAL_ATMEL_CONSOLE=y
102CONFIG_HW_RANDOM=y
103CONFIG_I2C=y
104CONFIG_I2C_CHARDEV=y
105CONFIG_I2C_GPIO=y
106CONFIG_SPI=y
107CONFIG_SPI_ATMEL=y
108CONFIG_GPIO_SYSFS=y
109# CONFIG_HWMON is not set
110CONFIG_WATCHDOG=y
111CONFIG_WATCHDOG_NOWAYOUT=y
112CONFIG_AT91RM9200_WATCHDOG=y
113CONFIG_FB=y
114CONFIG_FB_MODE_HELPERS=y
115CONFIG_FB_TILEBLITTING=y
116CONFIG_FB_S1D13XXX=y
117CONFIG_BACKLIGHT_LCD_SUPPORT=y
118CONFIG_LCD_CLASS_DEVICE=y
119CONFIG_BACKLIGHT_CLASS_DEVICE=y
120# CONFIG_BACKLIGHT_GENERIC is not set
121CONFIG_FRAMEBUFFER_CONSOLE=y
122CONFIG_FONTS=y
123CONFIG_LOGO=y
124CONFIG_USB=y
125CONFIG_USB_OHCI_HCD=y
126CONFIG_USB_GADGET=y
127CONFIG_USB_AT91=y
128CONFIG_USB_G_SERIAL=y
129CONFIG_MMC=y
130CONFIG_MMC_ATMELMCI=y
131CONFIG_NEW_LEDS=y
132CONFIG_LEDS_CLASS=y
133CONFIG_LEDS_GPIO=y
134CONFIG_LEDS_TRIGGERS=y
135CONFIG_LEDS_TRIGGER_TIMER=y
136CONFIG_LEDS_TRIGGER_HEARTBEAT=y
137CONFIG_LEDS_TRIGGER_GPIO=y
138CONFIG_RTC_CLASS=y
139CONFIG_RTC_DRV_AT91RM9200=y
140CONFIG_EXT4_FS=y
141CONFIG_AUTOFS4_FS=y
142CONFIG_VFAT_FS=y
143CONFIG_TMPFS=y
144CONFIG_UBIFS_FS=y
145CONFIG_UBIFS_FS_ADVANCED_COMPR=y
146CONFIG_NFS_FS=y
147CONFIG_ROOT_NFS=y
148CONFIG_NLS_CODEPAGE_437=y
149CONFIG_NLS_CODEPAGE_850=y
150CONFIG_NLS_ISO8859_1=y
151CONFIG_NLS_UTF8=y
152CONFIG_MAGIC_SYSRQ=y
153CONFIG_DEBUG_FS=y
154CONFIG_DEBUG_KERNEL=y
155# CONFIG_FTRACE is not set
156CONFIG_DEBUG_USER=y
157CONFIG_DEBUG_LL=y
158CONFIG_EARLY_PRINTK=y
159CONFIG_CRYPTO_PCBC=y
160CONFIG_CRYPTO_SHA1=y
161CONFIG_XZ_DEC_ARMTHUMB=y
diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig
deleted file mode 100644
index 3ada05d639ad..000000000000
--- a/arch/arm/configs/at91sam9260_9g20_defconfig
+++ /dev/null
@@ -1,145 +0,0 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11# CONFIG_IOSCHED_DEADLINE is not set
12# CONFIG_IOSCHED_CFQ is not set
13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9260=y
15CONFIG_MACH_AT91SAM9260EK=y
16CONFIG_MACH_CAM60=y
17CONFIG_MACH_SAM9_L9260=y
18CONFIG_MACH_AFEB9260=y
19CONFIG_MACH_CPU9260=y
20CONFIG_MACH_FLEXIBITY=y
21CONFIG_MACH_AT91SAM9G20EK=y
22CONFIG_MACH_AT91SAM9G20EK_2MMC=y
23CONFIG_MACH_CPU9G20=y
24CONFIG_MACH_ACMENETUSFOXG20=y
25CONFIG_MACH_PORTUXG20=y
26CONFIG_MACH_STAMP9G20=y
27CONFIG_MACH_PCONTROL_G20=y
28CONFIG_MACH_GSIA18S=y
29CONFIG_MACH_SNAPPER_9260=y
30CONFIG_MACH_AT91SAM9_DT=y
31CONFIG_AT91_SLOW_CLOCK=y
32# CONFIG_ARM_THUMB is not set
33CONFIG_AEABI=y
34CONFIG_ZBOOT_ROM_TEXT=0x0
35CONFIG_ZBOOT_ROM_BSS=0x0
36CONFIG_ARM_APPENDED_DTB=y
37CONFIG_ARM_ATAG_DTB_COMPAT=y
38CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
39CONFIG_AUTO_ZRELADDR=y
40CONFIG_NET=y
41CONFIG_PACKET=y
42CONFIG_UNIX=y
43CONFIG_INET=y
44CONFIG_IP_PNP=y
45CONFIG_IP_PNP_DHCP=y
46CONFIG_IP_PNP_BOOTP=y
47# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
48# CONFIG_INET_XFRM_MODE_TUNNEL is not set
49# CONFIG_INET_XFRM_MODE_BEET is not set
50# CONFIG_INET_LRO is not set
51# CONFIG_IPV6 is not set
52CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
53CONFIG_DEVTMPFS=y
54CONFIG_DEVTMPFS_MOUNT=y
55CONFIG_MTD=y
56CONFIG_MTD_CMDLINE_PARTS=y
57CONFIG_MTD_BLOCK=y
58CONFIG_MTD_DATAFLASH=y
59CONFIG_MTD_NAND=y
60CONFIG_MTD_NAND_ATMEL=y
61CONFIG_MTD_UBI=y
62CONFIG_BLK_DEV_LOOP=y
63CONFIG_BLK_DEV_RAM=y
64CONFIG_BLK_DEV_RAM_SIZE=8192
65CONFIG_EEPROM_AT25=y
66CONFIG_SCSI=y
67CONFIG_BLK_DEV_SD=y
68# CONFIG_SCSI_LOWLEVEL is not set
69CONFIG_NETDEVICES=y
70CONFIG_MACB=y
71# CONFIG_NET_VENDOR_BROADCOM is not set
72# CONFIG_NET_VENDOR_FARADAY is not set
73# CONFIG_NET_VENDOR_INTEL is not set
74# CONFIG_NET_VENDOR_MARVELL is not set
75# CONFIG_NET_VENDOR_MICREL is not set
76# CONFIG_NET_VENDOR_MICROCHIP is not set
77# CONFIG_NET_VENDOR_NATSEMI is not set
78# CONFIG_NET_VENDOR_SEEQ is not set
79# CONFIG_NET_VENDOR_SMSC is not set
80# CONFIG_NET_VENDOR_STMICRO is not set
81CONFIG_SMSC_PHY=y
82# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
83CONFIG_KEYBOARD_GPIO=y
84# CONFIG_INPUT_MOUSE is not set
85CONFIG_SERIAL_ATMEL=y
86CONFIG_SERIAL_ATMEL_CONSOLE=y
87CONFIG_HW_RANDOM=y
88CONFIG_I2C=y
89CONFIG_I2C_CHARDEV=y
90CONFIG_I2C_GPIO=y
91CONFIG_SPI=y
92CONFIG_SPI_ATMEL=y
93CONFIG_SPI_SPIDEV=y
94CONFIG_GPIO_SYSFS=y
95CONFIG_POWER_SUPPLY=y
96CONFIG_POWER_RESET=y
97# CONFIG_HWMON is not set
98CONFIG_WATCHDOG=y
99CONFIG_WATCHDOG_NOWAYOUT=y
100CONFIG_AT91SAM9X_WATCHDOG=y
101CONFIG_SOUND=y
102CONFIG_SND=y
103CONFIG_SND_SEQUENCER=y
104CONFIG_SND_MIXER_OSS=y
105CONFIG_SND_PCM_OSS=y
106CONFIG_SND_SEQUENCER_OSS=y
107# CONFIG_SND_VERBOSE_PROCFS is not set
108CONFIG_USB=y
109CONFIG_USB_MON=y
110CONFIG_USB_OHCI_HCD=y
111CONFIG_USB_STORAGE=y
112CONFIG_USB_GADGET=y
113CONFIG_USB_AT91=y
114CONFIG_USB_G_SERIAL=y
115CONFIG_MMC=y
116CONFIG_MMC_ATMELMCI=y
117CONFIG_MMC_SPI=y
118CONFIG_NEW_LEDS=y
119CONFIG_LEDS_CLASS=y
120CONFIG_LEDS_GPIO=y
121CONFIG_LEDS_TRIGGERS=y
122CONFIG_LEDS_TRIGGER_TIMER=y
123CONFIG_LEDS_TRIGGER_HEARTBEAT=y
124CONFIG_RTC_CLASS=y
125CONFIG_RTC_DRV_RV3029C2=y
126CONFIG_RTC_DRV_AT91SAM9=y
127CONFIG_IIO=y
128CONFIG_AT91_ADC=y
129CONFIG_EXT4_FS=y
130CONFIG_VFAT_FS=y
131CONFIG_TMPFS=y
132CONFIG_UBIFS_FS=y
133CONFIG_UBIFS_FS_ADVANCED_COMPR=y
134CONFIG_NFS_FS=y
135CONFIG_ROOT_NFS=y
136CONFIG_NLS_CODEPAGE_437=y
137CONFIG_NLS_CODEPAGE_850=y
138CONFIG_NLS_ISO8859_1=y
139CONFIG_NLS_ISO8859_15=y
140CONFIG_NLS_UTF8=y
141CONFIG_DEBUG_INFO=y
142# CONFIG_ENABLE_WARN_DEPRECATED is not set
143# CONFIG_FTRACE is not set
144CONFIG_DEBUG_LL=y
145CONFIG_EARLY_PRINTK=y
diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig
deleted file mode 100644
index 0c505d801e25..000000000000
--- a/arch/arm/configs/at91sam9261_9g10_defconfig
+++ /dev/null
@@ -1,147 +0,0 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_KERNEL_LZMA=y
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_NAMESPACES=y
9CONFIG_EMBEDDED=y
10CONFIG_SLAB=y
11CONFIG_MODULES=y
12CONFIG_MODULE_UNLOAD=y
13# CONFIG_BLK_DEV_BSG is not set
14# CONFIG_IOSCHED_DEADLINE is not set
15# CONFIG_IOSCHED_CFQ is not set
16CONFIG_ARCH_AT91=y
17CONFIG_ARCH_AT91SAM9261=y
18CONFIG_MACH_AT91SAM9261EK=y
19CONFIG_MACH_AT91SAM9G10EK=y
20# CONFIG_ARM_THUMB is not set
21CONFIG_AEABI=y
22CONFIG_ZBOOT_ROM_TEXT=0x0
23CONFIG_ZBOOT_ROM_BSS=0x0
24CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
25CONFIG_AUTO_ZRELADDR=y
26CONFIG_VFP=y
27# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
28CONFIG_NET=y
29CONFIG_PACKET=y
30CONFIG_UNIX=y
31CONFIG_INET=y
32CONFIG_IP_MULTICAST=y
33CONFIG_IP_PNP=y
34CONFIG_IP_PNP_DHCP=y
35CONFIG_IP_PNP_BOOTP=y
36# CONFIG_INET_LRO is not set
37# CONFIG_IPV6 is not set
38CONFIG_CFG80211=y
39CONFIG_MAC80211=y
40CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
41CONFIG_DEVTMPFS=y
42CONFIG_DEVTMPFS_MOUNT=y
43CONFIG_MTD=y
44CONFIG_MTD_CMDLINE_PARTS=y
45CONFIG_MTD_BLOCK=y
46CONFIG_MTD_NAND=y
47CONFIG_MTD_NAND_ATMEL=y
48CONFIG_MTD_UBI=y
49CONFIG_MTD_UBI_GLUEBI=y
50CONFIG_BLK_DEV_RAM=y
51CONFIG_BLK_DEV_RAM_SIZE=8192
52CONFIG_ATMEL_TCLIB=y
53CONFIG_ATMEL_SSC=y
54CONFIG_SCSI=y
55CONFIG_BLK_DEV_SD=y
56CONFIG_NETDEVICES=y
57CONFIG_DM9000=y
58CONFIG_USB_ZD1201=m
59CONFIG_RTL8187=m
60CONFIG_LIBERTAS=m
61CONFIG_LIBERTAS_USB=m
62CONFIG_LIBERTAS_SDIO=m
63CONFIG_LIBERTAS_SPI=m
64CONFIG_RT2X00=m
65CONFIG_RT2500USB=m
66CONFIG_RT73USB=m
67CONFIG_ZD1211RW=m
68CONFIG_INPUT_POLLDEV=m
69# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
70CONFIG_INPUT_MOUSEDEV_SCREEN_X=240
71CONFIG_INPUT_MOUSEDEV_SCREEN_Y=320
72CONFIG_INPUT_EVDEV=y
73# CONFIG_KEYBOARD_ATKBD is not set
74CONFIG_KEYBOARD_GPIO=y
75# CONFIG_INPUT_MOUSE is not set
76CONFIG_INPUT_TOUCHSCREEN=y
77CONFIG_TOUCHSCREEN_ADS7846=y
78CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
79CONFIG_SERIAL_ATMEL=y
80CONFIG_SERIAL_ATMEL_CONSOLE=y
81CONFIG_HW_RANDOM=y
82CONFIG_I2C=y
83CONFIG_I2C_CHARDEV=y
84CONFIG_I2C_GPIO=y
85CONFIG_SPI=y
86CONFIG_SPI_ATMEL=y
87CONFIG_POWER_SUPPLY=y
88CONFIG_POWER_RESET=y
89# CONFIG_HWMON is not set
90CONFIG_WATCHDOG=y
91CONFIG_WATCHDOG_NOWAYOUT=y
92CONFIG_AT91SAM9X_WATCHDOG=y
93CONFIG_FB=y
94CONFIG_FB_ATMEL=y
95CONFIG_BACKLIGHT_LCD_SUPPORT=y
96# CONFIG_LCD_CLASS_DEVICE is not set
97CONFIG_BACKLIGHT_CLASS_DEVICE=y
98CONFIG_BACKLIGHT_ATMEL_LCDC=y
99# CONFIG_BACKLIGHT_GENERIC is not set
100CONFIG_FRAMEBUFFER_CONSOLE=y
101CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
102CONFIG_LOGO=y
103CONFIG_SOUND=y
104CONFIG_SND=y
105CONFIG_SND_SEQUENCER=y
106CONFIG_SND_MIXER_OSS=y
107CONFIG_SND_PCM_OSS=y
108# CONFIG_SND_SUPPORT_OLD_API is not set
109# CONFIG_SND_VERBOSE_PROCFS is not set
110# CONFIG_SND_DRIVERS is not set
111# CONFIG_SND_ARM is not set
112CONFIG_SND_AT73C213=y
113CONFIG_SND_USB_AUDIO=m
114# CONFIG_USB_HID is not set
115CONFIG_USB=y
116CONFIG_USB_OHCI_HCD=y
117CONFIG_USB_STORAGE=y
118CONFIG_USB_GADGET=y
119CONFIG_USB_AT91=y
120CONFIG_USB_G_SERIAL=y
121CONFIG_MMC=y
122CONFIG_MMC_ATMELMCI=m
123CONFIG_NEW_LEDS=y
124CONFIG_LEDS_CLASS=y
125CONFIG_LEDS_GPIO=y
126CONFIG_LEDS_TRIGGERS=y
127CONFIG_LEDS_TRIGGER_TIMER=y
128CONFIG_LEDS_TRIGGER_HEARTBEAT=y
129CONFIG_LEDS_TRIGGER_GPIO=y
130CONFIG_RTC_CLASS=y
131CONFIG_RTC_DRV_AT91SAM9=y
132CONFIG_MSDOS_FS=y
133CONFIG_VFAT_FS=y
134CONFIG_TMPFS=y
135CONFIG_UBIFS_FS=y
136CONFIG_UBIFS_FS_ADVANCED_COMPR=y
137CONFIG_SQUASHFS=y
138CONFIG_SQUASHFS_LZO=y
139CONFIG_SQUASHFS_XZ=y
140CONFIG_NFS_FS=y
141CONFIG_ROOT_NFS=y
142CONFIG_NLS_CODEPAGE_437=y
143CONFIG_NLS_CODEPAGE_850=y
144CONFIG_NLS_ISO8859_1=y
145CONFIG_NLS_ISO8859_15=y
146CONFIG_NLS_UTF8=y
147CONFIG_CRC_CCITT=m
diff --git a/arch/arm/configs/at91sam9263_defconfig b/arch/arm/configs/at91sam9263_defconfig
deleted file mode 100644
index 8b671c977b81..000000000000
--- a/arch/arm/configs/at91sam9263_defconfig
+++ /dev/null
@@ -1,151 +0,0 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_NAMESPACES=y
8CONFIG_EMBEDDED=y
9CONFIG_SLAB=y
10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y
12# CONFIG_BLK_DEV_BSG is not set
13# CONFIG_IOSCHED_DEADLINE is not set
14# CONFIG_IOSCHED_CFQ is not set
15CONFIG_ARCH_AT91=y
16CONFIG_ARCH_AT91SAM9263=y
17CONFIG_MACH_AT91SAM9263EK=y
18CONFIG_MTD_AT91_DATAFLASH_CARD=y
19# CONFIG_ARM_THUMB is not set
20CONFIG_AEABI=y
21CONFIG_ZBOOT_ROM_TEXT=0x0
22CONFIG_ZBOOT_ROM_BSS=0x0
23CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
24CONFIG_AUTO_ZRELADDR=y
25CONFIG_NET=y
26CONFIG_PACKET=y
27CONFIG_UNIX=y
28CONFIG_NET_KEY=y
29CONFIG_INET=y
30CONFIG_IP_MULTICAST=y
31CONFIG_IP_ADVANCED_ROUTER=y
32CONFIG_IP_ROUTE_VERBOSE=y
33CONFIG_IP_PNP=y
34CONFIG_IP_PNP_DHCP=y
35CONFIG_IP_PNP_BOOTP=y
36CONFIG_IP_PNP_RARP=y
37CONFIG_NET_IPIP=y
38CONFIG_IP_MROUTE=y
39CONFIG_IP_PIMSM_V1=y
40CONFIG_IP_PIMSM_V2=y
41# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
42# CONFIG_INET_XFRM_MODE_TUNNEL is not set
43# CONFIG_INET_XFRM_MODE_BEET is not set
44# CONFIG_INET_LRO is not set
45# CONFIG_INET_DIAG is not set
46CONFIG_IPV6=y
47# CONFIG_WIRELESS is not set
48CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
49CONFIG_DEVTMPFS=y
50CONFIG_DEVTMPFS_MOUNT=y
51CONFIG_MTD=y
52CONFIG_MTD_CMDLINE_PARTS=y
53CONFIG_MTD_BLOCK=y
54CONFIG_NFTL=y
55CONFIG_NFTL_RW=y
56CONFIG_MTD_DATAFLASH=y
57CONFIG_MTD_BLOCK2MTD=y
58CONFIG_MTD_NAND=y
59CONFIG_MTD_NAND_ATMEL=y
60CONFIG_MTD_UBI=y
61CONFIG_MTD_UBI_GLUEBI=y
62CONFIG_BLK_DEV_LOOP=y
63CONFIG_BLK_DEV_RAM=y
64CONFIG_BLK_DEV_RAM_SIZE=8192
65CONFIG_ATMEL_TCLIB=y
66CONFIG_SCSI=y
67CONFIG_BLK_DEV_SD=y
68CONFIG_NETDEVICES=y
69CONFIG_MACB=y
70CONFIG_SMSC_PHY=y
71# CONFIG_WLAN is not set
72CONFIG_INPUT_POLLDEV=m
73# CONFIG_INPUT_MOUSEDEV is not set
74CONFIG_INPUT_EVDEV=y
75# CONFIG_KEYBOARD_ATKBD is not set
76CONFIG_KEYBOARD_GPIO=y
77# CONFIG_INPUT_MOUSE is not set
78CONFIG_INPUT_TOUCHSCREEN=y
79CONFIG_TOUCHSCREEN_ADS7846=y
80# CONFIG_LEGACY_PTYS is not set
81CONFIG_SERIAL_ATMEL=y
82CONFIG_SERIAL_ATMEL_CONSOLE=y
83CONFIG_HW_RANDOM=y
84CONFIG_I2C=y
85CONFIG_I2C_CHARDEV=y
86CONFIG_I2C_GPIO=y
87CONFIG_SPI=y
88CONFIG_SPI_ATMEL=y
89CONFIG_GPIO_SYSFS=y
90CONFIG_POWER_SUPPLY=y
91CONFIG_POWER_RESET=y
92# CONFIG_HWMON is not set
93CONFIG_WATCHDOG=y
94CONFIG_WATCHDOG_NOWAYOUT=y
95CONFIG_AT91SAM9X_WATCHDOG=y
96CONFIG_FB=y
97CONFIG_FB_ATMEL=y
98CONFIG_BACKLIGHT_LCD_SUPPORT=y
99CONFIG_LCD_CLASS_DEVICE=y
100CONFIG_BACKLIGHT_CLASS_DEVICE=y
101CONFIG_FRAMEBUFFER_CONSOLE=y
102CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
103CONFIG_LOGO=y
104CONFIG_SOUND=y
105CONFIG_SND=y
106CONFIG_SND_SEQUENCER=y
107CONFIG_SND_MIXER_OSS=y
108CONFIG_SND_PCM_OSS=y
109# CONFIG_SND_SUPPORT_OLD_API is not set
110# CONFIG_SND_VERBOSE_PROCFS is not set
111# CONFIG_SND_DRIVERS is not set
112# CONFIG_SND_ARM is not set
113CONFIG_SND_ATMEL_AC97C=y
114# CONFIG_SND_SPI is not set
115CONFIG_SND_USB_AUDIO=m
116CONFIG_USB=y
117CONFIG_USB_MON=y
118CONFIG_USB_OHCI_HCD=y
119CONFIG_USB_STORAGE=y
120CONFIG_USB_GADGET=y
121CONFIG_USB_ATMEL_USBA=y
122CONFIG_USB_G_SERIAL=y
123CONFIG_MMC=y
124CONFIG_SDIO_UART=m
125CONFIG_MMC_ATMELMCI=m
126CONFIG_NEW_LEDS=y
127CONFIG_LEDS_CLASS=y
128CONFIG_LEDS_GPIO=y
129CONFIG_LEDS_PWM=y
130CONFIG_LEDS_TRIGGERS=y
131CONFIG_LEDS_TRIGGER_HEARTBEAT=y
132CONFIG_RTC_CLASS=y
133CONFIG_RTC_DRV_AT91SAM9=y
134CONFIG_PWM=y
135CONFIG_PWM_ATMEL=y
136CONFIG_EXT4_FS=y
137CONFIG_VFAT_FS=y
138CONFIG_TMPFS=y
139CONFIG_UBIFS_FS=y
140CONFIG_UBIFS_FS_ADVANCED_COMPR=y
141CONFIG_NFS_FS=y
142CONFIG_NFS_V3_ACL=y
143CONFIG_NFS_V4=y
144CONFIG_ROOT_NFS=y
145CONFIG_NLS_CODEPAGE_437=y
146CONFIG_NLS_CODEPAGE_850=y
147CONFIG_NLS_ISO8859_1=y
148CONFIG_NLS_UTF8=y
149CONFIG_DEBUG_USER=y
150CONFIG_XZ_DEC=y
151CONFIG_FONTS=y
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
deleted file mode 100644
index f66d1a1b64bf..000000000000
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ /dev/null
@@ -1,175 +0,0 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED=y
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y
8CONFIG_CC_OPTIMIZE_FOR_SIZE=y
9CONFIG_EMBEDDED=y
10CONFIG_SLAB=y
11CONFIG_MODULES=y
12CONFIG_MODULE_UNLOAD=y
13# CONFIG_LBDAF is not set
14# CONFIG_BLK_DEV_BSG is not set
15# CONFIG_IOSCHED_DEADLINE is not set
16# CONFIG_IOSCHED_CFQ is not set
17CONFIG_ARCH_AT91=y
18CONFIG_ARCH_AT91SAM9G45=y
19CONFIG_MACH_AT91SAM9M10G45EK=y
20CONFIG_MACH_AT91SAM9_DT=y
21CONFIG_AT91_SLOW_CLOCK=y
22CONFIG_AEABI=y
23CONFIG_UACCESS_WITH_MEMCPY=y
24CONFIG_ZBOOT_ROM_TEXT=0x0
25CONFIG_ZBOOT_ROM_BSS=0x0
26CONFIG_CMDLINE="mem=128M console=ttyS0,115200 initrd=0x71100000,25165824 root=/dev/ram0 rw"
27CONFIG_AUTO_ZRELADDR=y
28# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
29CONFIG_NET=y
30CONFIG_PACKET=y
31CONFIG_UNIX=y
32CONFIG_INET=y
33CONFIG_IP_MULTICAST=y
34CONFIG_IP_PNP=y
35CONFIG_IP_PNP_DHCP=y
36CONFIG_IP_PNP_BOOTP=y
37# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
38# CONFIG_INET_XFRM_MODE_TUNNEL is not set
39# CONFIG_INET_XFRM_MODE_BEET is not set
40# CONFIG_INET_DIAG is not set
41CONFIG_IPV6=y
42# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
43# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
44# CONFIG_INET6_XFRM_MODE_BEET is not set
45CONFIG_IPV6_SIT_6RD=y
46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
47CONFIG_DEVTMPFS=y
48CONFIG_DEVTMPFS_MOUNT=y
49# CONFIG_STANDALONE is not set
50# CONFIG_PREVENT_FIRMWARE_BUILD is not set
51CONFIG_MTD=y
52CONFIG_MTD_CMDLINE_PARTS=y
53CONFIG_MTD_BLOCK=y
54CONFIG_MTD_DATAFLASH=y
55CONFIG_MTD_NAND=y
56CONFIG_MTD_NAND_ATMEL=y
57CONFIG_MTD_UBI=y
58CONFIG_MTD_UBI_GLUEBI=y
59CONFIG_BLK_DEV_LOOP=y
60CONFIG_BLK_DEV_RAM=y
61CONFIG_BLK_DEV_RAM_COUNT=4
62CONFIG_BLK_DEV_RAM_SIZE=8192
63CONFIG_ATMEL_TCLIB=y
64CONFIG_ATMEL_SSC=y
65CONFIG_SCSI=y
66CONFIG_BLK_DEV_SD=y
67# CONFIG_SCSI_LOWLEVEL is not set
68CONFIG_NETDEVICES=y
69CONFIG_MACB=y
70CONFIG_DAVICOM_PHY=y
71# CONFIG_INPUT_MOUSEDEV is not set
72CONFIG_INPUT_JOYDEV=y
73CONFIG_INPUT_EVDEV=y
74# CONFIG_KEYBOARD_ATKBD is not set
75CONFIG_KEYBOARD_QT1070=y
76CONFIG_KEYBOARD_QT2160=y
77CONFIG_KEYBOARD_GPIO=y
78# CONFIG_INPUT_MOUSE is not set
79CONFIG_INPUT_TOUCHSCREEN=y
80CONFIG_TOUCHSCREEN_ATMEL_MXT=m
81# CONFIG_SERIO is not set
82# CONFIG_LEGACY_PTYS is not set
83CONFIG_SERIAL_ATMEL=y
84CONFIG_SERIAL_ATMEL_CONSOLE=y
85CONFIG_HW_RANDOM=y
86CONFIG_I2C=y
87CONFIG_I2C_CHARDEV=y
88CONFIG_I2C_GPIO=y
89CONFIG_SPI=y
90CONFIG_SPI_ATMEL=y
91CONFIG_POWER_SUPPLY=y
92CONFIG_POWER_RESET=y
93# CONFIG_HWMON is not set
94CONFIG_WATCHDOG=y
95CONFIG_WATCHDOG_NOWAYOUT=y
96CONFIG_AT91SAM9X_WATCHDOG=y
97CONFIG_FB=y
98CONFIG_FB_ATMEL=y
99CONFIG_BACKLIGHT_LCD_SUPPORT=y
100CONFIG_LCD_CLASS_DEVICE=y
101CONFIG_BACKLIGHT_CLASS_DEVICE=y
102CONFIG_BACKLIGHT_ATMEL_LCDC=y
103# CONFIG_BACKLIGHT_GENERIC is not set
104CONFIG_BACKLIGHT_PWM=y
105CONFIG_FRAMEBUFFER_CONSOLE=y
106CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
107CONFIG_LOGO=y
108CONFIG_SOUND=y
109CONFIG_SND=y
110CONFIG_SND_SEQUENCER=y
111CONFIG_SND_MIXER_OSS=y
112CONFIG_SND_PCM_OSS=y
113# CONFIG_SND_SUPPORT_OLD_API is not set
114# CONFIG_SND_VERBOSE_PROCFS is not set
115# CONFIG_SND_DRIVERS is not set
116# CONFIG_SND_ARM is not set
117CONFIG_SND_ATMEL_AC97C=y
118# CONFIG_SND_SPI is not set
119# CONFIG_SND_USB is not set
120# CONFIG_USB_HID is not set
121CONFIG_USB=y
122CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
123CONFIG_USB_EHCI_HCD=y
124CONFIG_USB_OHCI_HCD=y
125CONFIG_USB_ACM=y
126CONFIG_USB_STORAGE=y
127CONFIG_USB_GADGET=y
128CONFIG_USB_ATMEL_USBA=y
129CONFIG_USB_G_MULTI=y
130CONFIG_USB_G_MULTI_CDC=y
131CONFIG_MMC=y
132# CONFIG_MMC_BLOCK_BOUNCE is not set
133CONFIG_MMC_ATMELMCI=y
134CONFIG_NEW_LEDS=y
135CONFIG_LEDS_CLASS=y
136CONFIG_LEDS_GPIO=y
137CONFIG_LEDS_PWM=y
138CONFIG_LEDS_TRIGGERS=y
139CONFIG_LEDS_TRIGGER_TIMER=y
140CONFIG_LEDS_TRIGGER_HEARTBEAT=y
141CONFIG_LEDS_TRIGGER_GPIO=y
142CONFIG_RTC_CLASS=y
143CONFIG_RTC_DRV_AT91RM9200=y
144CONFIG_DMADEVICES=y
145CONFIG_AT_HDMAC=y
146CONFIG_DMATEST=m
147# CONFIG_IOMMU_SUPPORT is not set
148CONFIG_IIO=y
149CONFIG_AT91_ADC=y
150CONFIG_PWM=y
151CONFIG_PWM_ATMEL=y
152CONFIG_EXT4_FS=y
153CONFIG_FANOTIFY=y
154CONFIG_VFAT_FS=y
155CONFIG_TMPFS=y
156CONFIG_UBIFS_FS=y
157CONFIG_UBIFS_FS_ADVANCED_COMPR=y
158CONFIG_NFS_FS=y
159CONFIG_ROOT_NFS=y
160CONFIG_NLS_CODEPAGE_437=y
161CONFIG_NLS_CODEPAGE_850=y
162CONFIG_NLS_ISO8859_1=y
163CONFIG_STRIP_ASM_SYMS=y
164CONFIG_DEBUG_MEMORY_INIT=y
165# CONFIG_SCHED_DEBUG is not set
166# CONFIG_FTRACE is not set
167CONFIG_DEBUG_USER=y
168CONFIG_DEBUG_LL=y
169CONFIG_EARLY_PRINTK=y
170CONFIG_CRYPTO_ECB=y
171# CONFIG_CRYPTO_ANSI_CPRNG is not set
172CONFIG_CRYPTO_USER_API_HASH=m
173CONFIG_CRYPTO_USER_API_SKCIPHER=m
174# CONFIG_CRYPTO_HW is not set
175CONFIG_FONTS=y
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
deleted file mode 100644
index 4c26d344ae88..000000000000
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ /dev/null
@@ -1,92 +0,0 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11# CONFIG_IOSCHED_DEADLINE is not set
12# CONFIG_IOSCHED_CFQ is not set
13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9RL=y
15CONFIG_MACH_AT91SAM9RLEK=y
16# CONFIG_ARM_THUMB is not set
17CONFIG_AEABI=y
18CONFIG_ZBOOT_ROM_TEXT=0x0
19CONFIG_ZBOOT_ROM_BSS=0x0
20CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,17105363 root=/dev/ram0 rw"
21CONFIG_AUTO_ZRELADDR=y
22CONFIG_NET=y
23CONFIG_UNIX=y
24CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
25CONFIG_DEVTMPFS=y
26CONFIG_DEVTMPFS_MOUNT=y
27CONFIG_MTD=y
28CONFIG_MTD_CMDLINE_PARTS=y
29CONFIG_MTD_BLOCK=y
30CONFIG_MTD_DATAFLASH=y
31CONFIG_MTD_NAND=y
32CONFIG_MTD_NAND_ATMEL=y
33CONFIG_MTD_UBI=y
34CONFIG_BLK_DEV_LOOP=y
35CONFIG_BLK_DEV_RAM=y
36CONFIG_BLK_DEV_RAM_COUNT=4
37CONFIG_BLK_DEV_RAM_SIZE=24576
38CONFIG_SCSI=y
39CONFIG_BLK_DEV_SD=y
40# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
41CONFIG_INPUT_MOUSEDEV_SCREEN_X=320
42CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240
43CONFIG_INPUT_EVDEV=y
44# CONFIG_INPUT_KEYBOARD is not set
45# CONFIG_INPUT_MOUSE is not set
46CONFIG_INPUT_TOUCHSCREEN=y
47# CONFIG_SERIO is not set
48CONFIG_SERIAL_ATMEL=y
49CONFIG_SERIAL_ATMEL_CONSOLE=y
50# CONFIG_HW_RANDOM is not set
51CONFIG_I2C=y
52CONFIG_I2C_CHARDEV=y
53CONFIG_I2C_GPIO=y
54CONFIG_SPI=y
55CONFIG_SPI_ATMEL=y
56CONFIG_POWER_SUPPLY=y
57CONFIG_POWER_RESET=y
58# CONFIG_HWMON is not set
59CONFIG_WATCHDOG=y
60CONFIG_WATCHDOG_NOWAYOUT=y
61CONFIG_AT91SAM9X_WATCHDOG=y
62CONFIG_FB=y
63CONFIG_FB_ATMEL=y
64CONFIG_USB_GADGET=y
65CONFIG_USB_ATMEL_USBA=y
66CONFIG_MMC=y
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
74CONFIG_RTC_CLASS=y
75CONFIG_RTC_DRV_AT91SAM9=y
76CONFIG_IIO=y
77CONFIG_AT91_ADC=y
78CONFIG_PWM=y
79CONFIG_PWM_ATMEL=y
80CONFIG_EXT4_FS=y
81CONFIG_VFAT_FS=y
82CONFIG_TMPFS=y
83CONFIG_UBIFS_FS=y
84CONFIG_CRAMFS=y
85CONFIG_NLS_CODEPAGE_437=y
86CONFIG_NLS_CODEPAGE_850=y
87CONFIG_NLS_ISO8859_1=y
88CONFIG_NLS_ISO8859_15=y
89CONFIG_NLS_UTF8=y
90CONFIG_DEBUG_INFO=y
91CONFIG_DEBUG_USER=y
92CONFIG_DEBUG_LL=y
diff --git a/arch/arm/configs/at91x40_defconfig b/arch/arm/configs/at91x40_defconfig
deleted file mode 100644
index c55e9212fcbb..000000000000
--- a/arch/arm/configs/at91x40_defconfig
+++ /dev/null
@@ -1,48 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14
3CONFIG_EMBEDDED=y
4# CONFIG_HOTPLUG is not set
5# CONFIG_ELF_CORE is not set
6# CONFIG_FUTEX is not set
7# CONFIG_TIMERFD is not set
8# CONFIG_VM_EVENT_COUNTERS is not set
9# CONFIG_COMPAT_BRK is not set
10CONFIG_SLAB=y
11# CONFIG_LBDAF is not set
12# CONFIG_BLK_DEV_BSG is not set
13# CONFIG_IOSCHED_DEADLINE is not set
14# CONFIG_IOSCHED_CFQ is not set
15# CONFIG_MMU is not set
16CONFIG_ARCH_AT91=y
17CONFIG_ARCH_AT91X40=y
18CONFIG_MACH_AT91EB01=y
19CONFIG_AT91_EARLY_USART0=y
20CONFIG_CPU_ARM7TDMI=y
21CONFIG_SET_MEM_PARAM=y
22CONFIG_DRAM_BASE=0x01000000
23CONFIG_DRAM_SIZE=0x00400000
24CONFIG_FLASH_MEM_BASE=0x01400000
25CONFIG_PROCESSOR_ID=0x14000040
26CONFIG_ZBOOT_ROM_TEXT=0x0
27CONFIG_ZBOOT_ROM_BSS=0x0
28CONFIG_BINFMT_FLAT=y
29# CONFIG_SUSPEND is not set
30# CONFIG_FW_LOADER is not set
31CONFIG_MTD=y
32CONFIG_MTD_PARTITIONS=y
33CONFIG_MTD_CHAR=y
34CONFIG_MTD_BLOCK=y
35CONFIG_MTD_RAM=y
36CONFIG_MTD_ROM=y
37CONFIG_BLK_DEV_RAM=y
38# CONFIG_INPUT is not set
39# CONFIG_SERIO is not set
40# CONFIG_VT is not set
41# CONFIG_DEVKMEM is not set
42# CONFIG_HW_RANDOM is not set
43# CONFIG_HWMON is not set
44# CONFIG_USB_SUPPORT is not set
45CONFIG_EXT2_FS=y
46# CONFIG_DNOTIFY is not set
47CONFIG_ROMFS_FS=y
48# CONFIG_ENABLE_MUST_CHECK is not set
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index bc614f44b33d..83a87e48901c 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_defconfig
@@ -25,7 +25,8 @@ CONFIG_MODULE_UNLOAD=y
25# CONFIG_BLK_DEV_BSG is not set 25# CONFIG_BLK_DEV_BSG is not set
26CONFIG_PARTITION_ADVANCED=y 26CONFIG_PARTITION_ADVANCED=y
27CONFIG_ARCH_BCM=y 27CONFIG_ARCH_BCM=y
28CONFIG_ARCH_BCM_MOBILE=y 28CONFIG_ARCH_BCM_21664=y
29CONFIG_ARCH_BCM_281XX=y
29CONFIG_ARM_THUMBEE=y 30CONFIG_ARM_THUMBEE=y
30CONFIG_SMP=y 31CONFIG_SMP=y
31CONFIG_PREEMPT=y 32CONFIG_PREEMPT=y
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index e21ef830a483..c41990729024 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -134,6 +134,7 @@ CONFIG_USB_STORAGE=y
134CONFIG_USB_DWC3=y 134CONFIG_USB_DWC3=y
135CONFIG_USB_HSIC_USB3503=y 135CONFIG_USB_HSIC_USB3503=y
136CONFIG_MMC=y 136CONFIG_MMC=y
137CONFIG_MMC_BLOCK_MINORS=16
137CONFIG_MMC_SDHCI=y 138CONFIG_MMC_SDHCI=y
138CONFIG_MMC_SDHCI_S3C=y 139CONFIG_MMC_SDHCI_S3C=y
139CONFIG_MMC_SDHCI_S3C_DMA=y 140CONFIG_MMC_SDHCI_S3C_DMA=y
diff --git a/arch/arm/configs/hisi_defconfig b/arch/arm/configs/hisi_defconfig
index 1772505caeba..1fe3621faf65 100644
--- a/arch/arm/configs/hisi_defconfig
+++ b/arch/arm/configs/hisi_defconfig
@@ -5,6 +5,8 @@ CONFIG_BLK_DEV_INITRD=y
5CONFIG_RD_LZMA=y 5CONFIG_RD_LZMA=y
6CONFIG_ARCH_HISI=y 6CONFIG_ARCH_HISI=y
7CONFIG_ARCH_HI3xxx=y 7CONFIG_ARCH_HI3xxx=y
8CONFIG_PARTITION_ADVANCED=y
9CONFIG_CMDLINE_PARTITION=y
8CONFIG_ARCH_HIX5HD2=y 10CONFIG_ARCH_HIX5HD2=y
9CONFIG_ARCH_HIP04=y 11CONFIG_ARCH_HIP04=y
10CONFIG_SMP=y 12CONFIG_SMP=y
@@ -14,8 +16,11 @@ CONFIG_AEABI=y
14CONFIG_HIGHMEM=y 16CONFIG_HIGHMEM=y
15CONFIG_ARM_APPENDED_DTB=y 17CONFIG_ARM_APPENDED_DTB=y
16CONFIG_ARM_ATAG_DTB_COMPAT=y 18CONFIG_ARM_ATAG_DTB_COMPAT=y
19CONFIG_NEON=y
17CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y 20CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
21CONFIG_PM_RUNTIME=y
18CONFIG_NET=y 22CONFIG_NET=y
23CONFIG_PACKET=y
19CONFIG_UNIX=y 24CONFIG_UNIX=y
20CONFIG_INET=y 25CONFIG_INET=y
21CONFIG_IP_PNP=y 26CONFIG_IP_PNP=y
@@ -26,6 +31,7 @@ CONFIG_BLK_DEV_SD=y
26CONFIG_ATA=y 31CONFIG_ATA=y
27CONFIG_SATA_AHCI_PLATFORM=y 32CONFIG_SATA_AHCI_PLATFORM=y
28CONFIG_NETDEVICES=y 33CONFIG_NETDEVICES=y
34CONFIG_HIX5HD2_GMAC=y
29CONFIG_SERIAL_8250=y 35CONFIG_SERIAL_8250=y
30CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y 36CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
31CONFIG_SERIAL_8250_CONSOLE=y 37CONFIG_SERIAL_8250_CONSOLE=y
@@ -39,8 +45,13 @@ CONFIG_I2C_DESIGNWARE_PLATFORM=y
39CONFIG_SPI=y 45CONFIG_SPI=y
40CONFIG_SPI_PL022=y 46CONFIG_SPI_PL022=y
41CONFIG_PINCTRL_SINGLE=y 47CONFIG_PINCTRL_SINGLE=y
48CONFIG_DEBUG_GPIO=y
49CONFIG_GPIO_SYSFS=y
50CONFIG_GPIOLIB=y
42CONFIG_GPIO_GENERIC_PLATFORM=y 51CONFIG_GPIO_GENERIC_PLATFORM=y
43CONFIG_REGULATOR_GPIO=y 52CONFIG_REGULATOR_GPIO=y
53CONFIG_MFD_SYSCON=y
54CONFIG_POWER_RESET_SYSCON=y
44CONFIG_DRM=y 55CONFIG_DRM=y
45CONFIG_FB_SIMPLE=y 56CONFIG_FB_SIMPLE=y
46CONFIG_USB=y 57CONFIG_USB=y
@@ -48,15 +59,21 @@ CONFIG_USB_XHCI_HCD=y
48CONFIG_USB_EHCI_HCD=y 59CONFIG_USB_EHCI_HCD=y
49CONFIG_USB_EHCI_MXC=y 60CONFIG_USB_EHCI_MXC=y
50CONFIG_USB_EHCI_HCD_PLATFORM=y 61CONFIG_USB_EHCI_HCD_PLATFORM=y
62CONFIG_USB_OHCI_HCD=y
63CONFIG_USB_OHCI_HCD_PLATFORM=y
51CONFIG_USB_STORAGE=y 64CONFIG_USB_STORAGE=y
52CONFIG_NOP_USB_XCEIV=y 65CONFIG_NOP_USB_XCEIV=y
53CONFIG_MMC=y 66CONFIG_MMC=y
54CONFIG_RTC_CLASS=y 67CONFIG_RTC_CLASS=y
68CONFIG_MMC_DW=y
69CONFIG_MMC_DW_IDMAC=y
70CONFIG_MMC_DW_PLTFM=y
55CONFIG_RTC_DRV_PL031=y 71CONFIG_RTC_DRV_PL031=y
56CONFIG_DMADEVICES=y 72CONFIG_DMADEVICES=y
57CONFIG_DW_DMAC=y 73CONFIG_DW_DMAC=y
58CONFIG_PL330_DMA=y 74CONFIG_PL330_DMA=y
59CONFIG_PWM=y 75CONFIG_PWM=y
76CONFIG_PHY_HIX5HD2_SATA=y
60CONFIG_EXT4_FS=y 77CONFIG_EXT4_FS=y
61CONFIG_TMPFS=y 78CONFIG_TMPFS=y
62CONFIG_NFS_FS=y 79CONFIG_NFS_FS=y
@@ -65,6 +82,8 @@ CONFIG_NFS_V4=y
65CONFIG_ROOT_NFS=y 82CONFIG_ROOT_NFS=y
66CONFIG_PRINTK_TIME=y 83CONFIG_PRINTK_TIME=y
67CONFIG_DEBUG_FS=y 84CONFIG_DEBUG_FS=y
85CONFIG_NLS_CODEPAGE_437=y
86CONFIG_NLS_ISO8859_1=y
68CONFIG_DEBUG_KERNEL=y 87CONFIG_DEBUG_KERNEL=y
69CONFIG_LOCKUP_DETECTOR=y 88CONFIG_LOCKUP_DETECTOR=y
70CONFIG_VFP=y 89CONFIG_VFP=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 6790f1b3f3a1..f707cd2691cf 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -163,7 +163,13 @@ CONFIG_SPI_IMX=y
163CONFIG_GPIO_SYSFS=y 163CONFIG_GPIO_SYSFS=y
164CONFIG_GPIO_MC9S08DZ60=y 164CONFIG_GPIO_MC9S08DZ60=y
165CONFIG_GPIO_STMPE=y 165CONFIG_GPIO_STMPE=y
166# CONFIG_HWMON is not set 166CONFIG_SENSORS_GPIO_FAN=y
167CONFIG_THERMAL=y
168CONFIG_CPU_THERMAL=y
169CONFIG_IMX_THERMAL=y
170CONFIG_POWER_SUPPLY=y
171CONFIG_POWER_RESET=y
172CONFIG_POWER_RESET_IMX=y
167CONFIG_WATCHDOG=y 173CONFIG_WATCHDOG=y
168CONFIG_IMX2_WDT=y 174CONFIG_IMX2_WDT=y
169CONFIG_MFD_DA9052_I2C=y 175CONFIG_MFD_DA9052_I2C=y
@@ -211,6 +217,7 @@ CONFIG_SND_SOC_IMX_WM8962=y
211CONFIG_SND_SOC_IMX_SGTL5000=y 217CONFIG_SND_SOC_IMX_SGTL5000=y
212CONFIG_SND_SOC_IMX_SPDIF=y 218CONFIG_SND_SOC_IMX_SPDIF=y
213CONFIG_SND_SOC_IMX_MC13783=y 219CONFIG_SND_SOC_IMX_MC13783=y
220CONFIG_SND_SOC_TLV320AIC3X=y
214CONFIG_SND_SIMPLE_CARD=y 221CONFIG_SND_SIMPLE_CARD=y
215CONFIG_USB=y 222CONFIG_USB=y
216CONFIG_USB_EHCI_HCD=y 223CONFIG_USB_EHCI_HCD=y
@@ -239,6 +246,7 @@ CONFIG_LEDS_TRIGGER_BACKLIGHT=y
239CONFIG_LEDS_TRIGGER_GPIO=y 246CONFIG_LEDS_TRIGGER_GPIO=y
240CONFIG_RTC_CLASS=y 247CONFIG_RTC_CLASS=y
241CONFIG_RTC_INTF_DEV_UIE_EMUL=y 248CONFIG_RTC_INTF_DEV_UIE_EMUL=y
249CONFIG_RTC_DRV_DS1307=y
242CONFIG_RTC_DRV_ISL1208=y 250CONFIG_RTC_DRV_ISL1208=y
243CONFIG_RTC_DRV_PCF8563=y 251CONFIG_RTC_DRV_PCF8563=y
244CONFIG_RTC_DRV_MC13XXX=y 252CONFIG_RTC_DRV_MC13XXX=y
diff --git a/arch/arm/configs/integrator_defconfig b/arch/arm/configs/integrator_defconfig
index c1f5adc5493e..71f14675d009 100644
--- a/arch/arm/configs/integrator_defconfig
+++ b/arch/arm/configs/integrator_defconfig
@@ -8,6 +8,9 @@ CONFIG_BLK_DEV_INITRD=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
10CONFIG_PARTITION_ADVANCED=y 10CONFIG_PARTITION_ADVANCED=y
11CONFIG_ARCH_MULTI_V4T=y
12CONFIG_ARCH_MULTI_V5=y
13# CONFIG_ARCH_MULTI_V7 is not set
11CONFIG_ARCH_INTEGRATOR=y 14CONFIG_ARCH_INTEGRATOR=y
12CONFIG_ARCH_INTEGRATOR_AP=y 15CONFIG_ARCH_INTEGRATOR_AP=y
13CONFIG_ARCH_INTEGRATOR_CP=y 16CONFIG_ARCH_INTEGRATOR_CP=y
diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig
index 932ae40fb128..20a3ff99fae2 100644
--- a/arch/arm/configs/keystone_defconfig
+++ b/arch/arm/configs/keystone_defconfig
@@ -20,6 +20,9 @@ CONFIG_MODULE_FORCE_UNLOAD=y
20CONFIG_MODVERSIONS=y 20CONFIG_MODVERSIONS=y
21CONFIG_ARCH_KEYSTONE=y 21CONFIG_ARCH_KEYSTONE=y
22CONFIG_ARM_LPAE=y 22CONFIG_ARM_LPAE=y
23CONFIG_PCI=y
24CONFIG_PCI_MSI=y
25CONFIG_PCI_KEYSTONE=y
23CONFIG_SMP=y 26CONFIG_SMP=y
24CONFIG_PREEMPT=y 27CONFIG_PREEMPT=y
25CONFIG_AEABI=y 28CONFIG_AEABI=y
@@ -194,3 +197,7 @@ CONFIG_LEDS_TRIGGER_ONESHOT=y
194CONFIG_LEDS_TRIGGER_HEARTBEAT=y 197CONFIG_LEDS_TRIGGER_HEARTBEAT=y
195CONFIG_LEDS_TRIGGER_BACKLIGHT=y 198CONFIG_LEDS_TRIGGER_BACKLIGHT=y
196CONFIG_LEDS_TRIGGER_GPIO=y 199CONFIG_LEDS_TRIGGER_GPIO=y
200CONFIG_KEYSTONE_IRQ=y
201CONFIG_GPIO_SYSCON=y
202CONFIG_TI_DAVINCI_MDIO=y
203CONFIG_MARVELL_PHY=y
diff --git a/arch/arm/configs/koelsch_defconfig b/arch/arm/configs/koelsch_defconfig
deleted file mode 100644
index b33d19b7f134..000000000000
--- a/arch/arm/configs/koelsch_defconfig
+++ /dev/null
@@ -1,113 +0,0 @@
1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_CC_OPTIMIZE_FOR_SIZE=y
7CONFIG_SYSCTL_SYSCALL=y
8CONFIG_EMBEDDED=y
9CONFIG_PERF_EVENTS=y
10CONFIG_SLAB=y
11CONFIG_ARCH_SHMOBILE_LEGACY=y
12CONFIG_ARCH_R8A7791=y
13CONFIG_MACH_KOELSCH=y
14# CONFIG_SWP_EMULATE is not set
15CONFIG_CPU_BPREDICT_DISABLE=y
16CONFIG_PL310_ERRATA_588369=y
17CONFIG_ARM_ERRATA_754322=y
18CONFIG_PCI=y
19CONFIG_PCI_RCAR_GEN2=y
20CONFIG_PCI_RCAR_GEN2_PCIE=y
21CONFIG_SMP=y
22CONFIG_SCHED_MC=y
23CONFIG_NR_CPUS=8
24CONFIG_AEABI=y
25CONFIG_ZBOOT_ROM_TEXT=0x0
26CONFIG_ZBOOT_ROM_BSS=0x0
27CONFIG_ARM_APPENDED_DTB=y
28CONFIG_KEXEC=y
29CONFIG_AUTO_ZRELADDR=y
30CONFIG_VFP=y
31CONFIG_NEON=y
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33CONFIG_PM_RUNTIME=y
34CONFIG_NET=y
35CONFIG_PACKET=y
36CONFIG_UNIX=y
37CONFIG_INET=y
38CONFIG_IP_PNP=y
39CONFIG_IP_PNP_DHCP=y
40CONFIG_DEVTMPFS=y
41CONFIG_DEVTMPFS_MOUNT=y
42CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
43CONFIG_BLK_DEV_SD=y
44CONFIG_ATA=y
45CONFIG_SATA_RCAR=y
46CONFIG_MTD=y
47CONFIG_MTD_M25P80=y
48CONFIG_MTD_SPI_NOR=y
49CONFIG_EEPROM_AT24=y
50CONFIG_NETDEVICES=y
51# CONFIG_NET_VENDOR_ARC is not set
52# CONFIG_NET_CADENCE is not set
53# CONFIG_NET_VENDOR_BROADCOM is not set
54# CONFIG_NET_VENDOR_CIRRUS is not set
55# CONFIG_NET_VENDOR_FARADAY is not set
56# CONFIG_NET_VENDOR_INTEL is not set
57# CONFIG_NET_VENDOR_MARVELL is not set
58# CONFIG_NET_VENDOR_MICREL is not set
59# CONFIG_NET_VENDOR_NATSEMI is not set
60CONFIG_SH_ETH=y
61# CONFIG_NET_VENDOR_SEEQ is not set
62# CONFIG_NET_VENDOR_SMSC is not set
63# CONFIG_NET_VENDOR_STMICRO is not set
64# CONFIG_NET_VENDOR_VIA is not set
65# CONFIG_NET_VENDOR_WIZNET is not set
66# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
67CONFIG_KEYBOARD_GPIO=y
68# CONFIG_INPUT_MOUSE is not set
69# CONFIG_LEGACY_PTYS is not set
70CONFIG_SERIAL_SH_SCI=y
71CONFIG_SERIAL_SH_SCI_NR_UARTS=20
72CONFIG_SERIAL_SH_SCI_CONSOLE=y
73CONFIG_I2C=y
74CONFIG_I2C_MUX=y
75CONFIG_I2C_SH_MOBILE=y
76CONFIG_I2C_RCAR=y
77CONFIG_SPI=y
78CONFIG_SPI_RSPI=y
79CONFIG_SPI_SH_MSIOF=y
80CONFIG_GPIOLIB=y
81CONFIG_GPIO_RCAR=y
82# CONFIG_HWMON is not set
83CONFIG_THERMAL=y
84CONFIG_RCAR_THERMAL=y
85CONFIG_REGULATOR=y
86CONFIG_REGULATOR_FIXED_VOLTAGE=y
87CONFIG_REGULATOR_DA9210=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
97# CONFIG_HID is not set
98# CONFIG_USB_SUPPORT is not set
99CONFIG_MMC=y
100CONFIG_MMC_SDHI=y
101CONFIG_NEW_LEDS=y
102CONFIG_LEDS_CLASS=y
103CONFIG_LEDS_GPIO=y
104# CONFIG_IOMMU_SUPPORT is not set
105# CONFIG_DNOTIFY is not set
106CONFIG_TMPFS=y
107CONFIG_CONFIGFS_FS=y
108# CONFIG_MISC_FILESYSTEMS is not set
109CONFIG_NFS_FS=y
110CONFIG_ROOT_NFS=y
111# CONFIG_ENABLE_WARN_DEPRECATED is not set
112# CONFIG_ENABLE_MUST_CHECK is not set
113# CONFIG_ARM_UNWIND is not set
diff --git a/arch/arm/configs/multi_v5_defconfig b/arch/arm/configs/multi_v5_defconfig
index 018bef9fa7e8..9d56781a8f80 100644
--- a/arch/arm/configs/multi_v5_defconfig
+++ b/arch/arm/configs/multi_v5_defconfig
@@ -67,9 +67,11 @@ CONFIG_SATA_AHCI=y
67CONFIG_SATA_MV=y 67CONFIG_SATA_MV=y
68CONFIG_NETDEVICES=y 68CONFIG_NETDEVICES=y
69CONFIG_NET_DSA_MV88E6123_61_65=y 69CONFIG_NET_DSA_MV88E6123_61_65=y
70CONFIG_NET_DSA_MV88E6171=y
70CONFIG_MV643XX_ETH=y 71CONFIG_MV643XX_ETH=y
71CONFIG_R8169=y 72CONFIG_R8169=y
72CONFIG_MARVELL_PHY=y 73CONFIG_MARVELL_PHY=y
74CONFIG_MWL8K=m
73CONFIG_LIBERTAS=y 75CONFIG_LIBERTAS=y
74CONFIG_LIBERTAS_SDIO=y 76CONFIG_LIBERTAS_SDIO=y
75CONFIG_INPUT_EVDEV=y 77CONFIG_INPUT_EVDEV=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 9d7a32f93fcf..d7896580f3bb 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -3,12 +3,14 @@ CONFIG_FHANDLE=y
3CONFIG_IRQ_DOMAIN_DEBUG=y 3CONFIG_IRQ_DOMAIN_DEBUG=y
4CONFIG_NO_HZ=y 4CONFIG_NO_HZ=y
5CONFIG_HIGH_RES_TIMERS=y 5CONFIG_HIGH_RES_TIMERS=y
6CONFIG_CGROUPS=y
6CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
7CONFIG_EMBEDDED=y 8CONFIG_EMBEDDED=y
8CONFIG_PERF_EVENTS=y 9CONFIG_PERF_EVENTS=y
9CONFIG_MODULES=y 10CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
11CONFIG_PARTITION_ADVANCED=y 12CONFIG_PARTITION_ADVANCED=y
13CONFIG_CMDLINE_PARTITION=y
12CONFIG_ARCH_VIRT=y 14CONFIG_ARCH_VIRT=y
13CONFIG_ARCH_MVEBU=y 15CONFIG_ARCH_MVEBU=y
14CONFIG_MACH_ARMADA_370=y 16CONFIG_MACH_ARMADA_370=y
@@ -17,7 +19,9 @@ CONFIG_MACH_ARMADA_38X=y
17CONFIG_MACH_ARMADA_XP=y 19CONFIG_MACH_ARMADA_XP=y
18CONFIG_MACH_DOVE=y 20CONFIG_MACH_DOVE=y
19CONFIG_ARCH_BCM=y 21CONFIG_ARCH_BCM=y
20CONFIG_ARCH_BCM_MOBILE=y 22CONFIG_ARCH_BCM_CYGNUS=y
23CONFIG_ARCH_BCM_21664=y
24CONFIG_ARCH_BCM_281XX=y
21CONFIG_ARCH_BCM_5301X=y 25CONFIG_ARCH_BCM_5301X=y
22CONFIG_ARCH_BRCMSTB=y 26CONFIG_ARCH_BRCMSTB=y
23CONFIG_ARCH_BERLIN=y 27CONFIG_ARCH_BERLIN=y
@@ -124,8 +128,12 @@ CONFIG_DMA_CMA=y
124CONFIG_CMA_SIZE_MBYTES=64 128CONFIG_CMA_SIZE_MBYTES=64
125CONFIG_OMAP_OCP2SCP=y 129CONFIG_OMAP_OCP2SCP=y
126CONFIG_MTD=y 130CONFIG_MTD=y
131CONFIG_MTD_CMDLINE_PARTS=y
132CONFIG_MTD_BLOCK=y
127CONFIG_MTD_M25P80=y 133CONFIG_MTD_M25P80=y
134CONFIG_MTD_NAND=y
128CONFIG_MTD_SPI_NOR=y 135CONFIG_MTD_SPI_NOR=y
136CONFIG_MTD_UBI=y
129CONFIG_BLK_DEV_LOOP=y 137CONFIG_BLK_DEV_LOOP=y
130CONFIG_AD525X_DPOT=y 138CONFIG_AD525X_DPOT=y
131CONFIG_AD525X_DPOT_I2C=y 139CONFIG_AD525X_DPOT_I2C=y
@@ -146,6 +154,7 @@ CONFIG_AHCI_TEGRA=y
146CONFIG_SATA_HIGHBANK=y 154CONFIG_SATA_HIGHBANK=y
147CONFIG_SATA_MV=y 155CONFIG_SATA_MV=y
148CONFIG_NETDEVICES=y 156CONFIG_NETDEVICES=y
157CONFIG_HIX5HD2_GMAC=y
149CONFIG_SUN4I_EMAC=y 158CONFIG_SUN4I_EMAC=y
150CONFIG_MACB=y 159CONFIG_MACB=y
151CONFIG_NET_CALXEDA_XGMAC=y 160CONFIG_NET_CALXEDA_XGMAC=y
@@ -160,6 +169,7 @@ CONFIG_TI_CPSW=y
160CONFIG_XILINX_EMACLITE=y 169CONFIG_XILINX_EMACLITE=y
161CONFIG_AT803X_PHY=y 170CONFIG_AT803X_PHY=y
162CONFIG_MARVELL_PHY=y 171CONFIG_MARVELL_PHY=y
172CONFIG_BROADCOM_PHY=y
163CONFIG_ICPLUS_PHY=y 173CONFIG_ICPLUS_PHY=y
164CONFIG_USB_PEGASUS=y 174CONFIG_USB_PEGASUS=y
165CONFIG_USB_USBNET=y 175CONFIG_USB_USBNET=y
@@ -234,6 +244,7 @@ CONFIG_SPI_TEGRA114=y
234CONFIG_SPI_TEGRA20_SFLASH=y 244CONFIG_SPI_TEGRA20_SFLASH=y
235CONFIG_SPI_TEGRA20_SLINK=y 245CONFIG_SPI_TEGRA20_SLINK=y
236CONFIG_SPI_XILINX=y 246CONFIG_SPI_XILINX=y
247CONFIG_SPI_SPIDEV=y
237CONFIG_PINCTRL_AS3722=y 248CONFIG_PINCTRL_AS3722=y
238CONFIG_PINCTRL_PALMAS=y 249CONFIG_PINCTRL_PALMAS=y
239CONFIG_PINCTRL_APQ8084=y 250CONFIG_PINCTRL_APQ8084=y
@@ -261,6 +272,7 @@ CONFIG_ST_THERMAL_SYSCFG=y
261CONFIG_ST_THERMAL_MEMMAP=y 272CONFIG_ST_THERMAL_MEMMAP=y
262CONFIG_WATCHDOG=y 273CONFIG_WATCHDOG=y
263CONFIG_XILINX_WATCHDOG=y 274CONFIG_XILINX_WATCHDOG=y
275CONFIG_ARM_SP805_WATCHDOG=y
264CONFIG_ORION_WATCHDOG=y 276CONFIG_ORION_WATCHDOG=y
265CONFIG_SUNXI_WATCHDOG=y 277CONFIG_SUNXI_WATCHDOG=y
266CONFIG_MESON_WATCHDOG=y 278CONFIG_MESON_WATCHDOG=y
@@ -268,6 +280,7 @@ CONFIG_MFD_AS3722=y
268CONFIG_MFD_BCM590XX=y 280CONFIG_MFD_BCM590XX=y
269CONFIG_MFD_CROS_EC=y 281CONFIG_MFD_CROS_EC=y
270CONFIG_MFD_CROS_EC_SPI=y 282CONFIG_MFD_CROS_EC_SPI=y
283CONFIG_MFD_MAX77686=y
271CONFIG_MFD_MAX8907=y 284CONFIG_MFD_MAX8907=y
272CONFIG_MFD_SEC_CORE=y 285CONFIG_MFD_SEC_CORE=y
273CONFIG_MFD_STMPE=y 286CONFIG_MFD_STMPE=y
@@ -279,7 +292,10 @@ CONFIG_REGULATOR_AB8500=y
279CONFIG_REGULATOR_AS3722=y 292CONFIG_REGULATOR_AS3722=y
280CONFIG_REGULATOR_BCM590XX=y 293CONFIG_REGULATOR_BCM590XX=y
281CONFIG_REGULATOR_GPIO=y 294CONFIG_REGULATOR_GPIO=y
295CONFIG_MFD_SYSCON=y
296CONFIG_POWER_RESET_SYSCON=y
282CONFIG_REGULATOR_MAX8907=y 297CONFIG_REGULATOR_MAX8907=y
298CONFIG_REGULATOR_MAX77686=y
283CONFIG_REGULATOR_PALMAS=y 299CONFIG_REGULATOR_PALMAS=y
284CONFIG_REGULATOR_S2MPS11=y 300CONFIG_REGULATOR_S2MPS11=y
285CONFIG_REGULATOR_S5M8767=y 301CONFIG_REGULATOR_S5M8767=y
@@ -308,6 +324,8 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
308CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 324CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
309CONFIG_SOUND=y 325CONFIG_SOUND=y
310CONFIG_SND=y 326CONFIG_SND=y
327CONFIG_SND_DYNAMIC_MINORS=y
328CONFIG_SND_USB_AUDIO=y
311CONFIG_SND_SOC=y 329CONFIG_SND_SOC=y
312CONFIG_SND_SOC_TEGRA=y 330CONFIG_SND_SOC_TEGRA=y
313CONFIG_SND_SOC_TEGRA_RT5640=y 331CONFIG_SND_SOC_TEGRA_RT5640=y
@@ -321,9 +339,11 @@ CONFIG_USB_XHCI_HCD=y
321CONFIG_USB_XHCI_MVEBU=y 339CONFIG_USB_XHCI_MVEBU=y
322CONFIG_USB_EHCI_HCD=y 340CONFIG_USB_EHCI_HCD=y
323CONFIG_USB_EHCI_TEGRA=y 341CONFIG_USB_EHCI_TEGRA=y
342CONFIG_USB_EHCI_HCD_STI=y
324CONFIG_USB_EHCI_HCD_PLATFORM=y 343CONFIG_USB_EHCI_HCD_PLATFORM=y
325CONFIG_USB_ISP1760_HCD=y 344CONFIG_USB_ISP1760_HCD=y
326CONFIG_USB_OHCI_HCD=y 345CONFIG_USB_OHCI_HCD=y
346CONFIG_USB_OHCI_HCD_STI=y
327CONFIG_USB_OHCI_HCD_PLATFORM=y 347CONFIG_USB_OHCI_HCD_PLATFORM=y
328CONFIG_USB_STORAGE=y 348CONFIG_USB_STORAGE=y
329CONFIG_USB_CHIPIDEA=y 349CONFIG_USB_CHIPIDEA=y
@@ -355,6 +375,8 @@ CONFIG_MMC_OMAP_HS=y
355CONFIG_MMC_MVSDIO=y 375CONFIG_MMC_MVSDIO=y
356CONFIG_MMC_SUNXI=y 376CONFIG_MMC_SUNXI=y
357CONFIG_MMC_DW=y 377CONFIG_MMC_DW=y
378CONFIG_MMC_DW_IDMAC=y
379CONFIG_MMC_DW_PLTFM=y
358CONFIG_MMC_DW_EXYNOS=y 380CONFIG_MMC_DW_EXYNOS=y
359CONFIG_MMC_DW_ROCKCHIP=y 381CONFIG_MMC_DW_ROCKCHIP=y
360CONFIG_NEW_LEDS=y 382CONFIG_NEW_LEDS=y
@@ -379,6 +401,7 @@ CONFIG_RTC_CLASS=y
379CONFIG_RTC_DRV_AS3722=y 401CONFIG_RTC_DRV_AS3722=y
380CONFIG_RTC_DRV_DS1307=y 402CONFIG_RTC_DRV_DS1307=y
381CONFIG_RTC_DRV_MAX8907=y 403CONFIG_RTC_DRV_MAX8907=y
404CONFIG_RTC_DRV_MAX77686=y
382CONFIG_RTC_DRV_PALMAS=y 405CONFIG_RTC_DRV_PALMAS=y
383CONFIG_RTC_DRV_TWL4030=y 406CONFIG_RTC_DRV_TWL4030=y
384CONFIG_RTC_DRV_TPS6586X=y 407CONFIG_RTC_DRV_TPS6586X=y
@@ -413,6 +436,7 @@ CONFIG_NVEC_POWER=y
413CONFIG_NVEC_PAZ00=y 436CONFIG_NVEC_PAZ00=y
414CONFIG_QCOM_GSBI=y 437CONFIG_QCOM_GSBI=y
415CONFIG_COMMON_CLK_QCOM=y 438CONFIG_COMMON_CLK_QCOM=y
439CONFIG_COMMON_CLK_MAX77686=y
416CONFIG_APQ_MMCC_8084=y 440CONFIG_APQ_MMCC_8084=y
417CONFIG_MSM_GCC_8660=y 441CONFIG_MSM_GCC_8660=y
418CONFIG_MSM_MMCC_8960=y 442CONFIG_MSM_MMCC_8960=y
@@ -426,12 +450,19 @@ CONFIG_AK8975=y
426CONFIG_PWM=y 450CONFIG_PWM=y
427CONFIG_PWM_TEGRA=y 451CONFIG_PWM_TEGRA=y
428CONFIG_PWM_VT8500=y 452CONFIG_PWM_VT8500=y
453CONFIG_PHY_HIX5HD2_SATA=y
429CONFIG_OMAP_USB2=y 454CONFIG_OMAP_USB2=y
430CONFIG_TI_PIPE3=y 455CONFIG_TI_PIPE3=y
431CONFIG_PHY_MIPHY365X=y 456CONFIG_PHY_MIPHY365X=y
457CONFIG_PHY_STIH41X_USB=y
432CONFIG_PHY_SUN4I_USB=y 458CONFIG_PHY_SUN4I_USB=y
433CONFIG_EXT4_FS=y 459CONFIG_EXT4_FS=y
460CONFIG_AUTOFS4_FS=y
461CONFIG_MSDOS_FS=y
434CONFIG_VFAT_FS=y 462CONFIG_VFAT_FS=y
463CONFIG_NTFS_FS=y
464CONFIG_TMPFS_POSIX_ACL=y
465CONFIG_UBIFS_FS=y
435CONFIG_TMPFS=y 466CONFIG_TMPFS=y
436CONFIG_SQUASHFS=y 467CONFIG_SQUASHFS=y
437CONFIG_SQUASHFS_LZO=y 468CONFIG_SQUASHFS_LZO=y
@@ -440,6 +471,9 @@ CONFIG_NFS_FS=y
440CONFIG_NFS_V3_ACL=y 471CONFIG_NFS_V3_ACL=y
441CONFIG_NFS_V4=y 472CONFIG_NFS_V4=y
442CONFIG_ROOT_NFS=y 473CONFIG_ROOT_NFS=y
474CONFIG_NLS_CODEPAGE_437=y
475CONFIG_NLS_ISO8859_1=y
476CONFIG_NLS_UTF8=y
443CONFIG_PRINTK_TIME=y 477CONFIG_PRINTK_TIME=y
444CONFIG_DEBUG_FS=y 478CONFIG_DEBUG_FS=y
445CONFIG_MAGIC_SYSRQ=y 479CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/arm/configs/mvebu_v5_defconfig b/arch/arm/configs/mvebu_v5_defconfig
index 22058e18dfaa..824de499237b 100644
--- a/arch/arm/configs/mvebu_v5_defconfig
+++ b/arch/arm/configs/mvebu_v5_defconfig
@@ -67,9 +67,11 @@ CONFIG_SATA_AHCI=y
67CONFIG_SATA_MV=y 67CONFIG_SATA_MV=y
68CONFIG_NETDEVICES=y 68CONFIG_NETDEVICES=y
69CONFIG_NET_DSA_MV88E6123_61_65=y 69CONFIG_NET_DSA_MV88E6123_61_65=y
70CONFIG_NET_DSA_MV88E6171=y
70CONFIG_MV643XX_ETH=y 71CONFIG_MV643XX_ETH=y
71CONFIG_R8169=y 72CONFIG_R8169=y
72CONFIG_MARVELL_PHY=y 73CONFIG_MARVELL_PHY=y
74CONFIG_MWL8K=m
73CONFIG_LIBERTAS=y 75CONFIG_LIBERTAS=y
74CONFIG_LIBERTAS_SDIO=y 76CONFIG_LIBERTAS_SDIO=y
75CONFIG_INPUT_EVDEV=y 77CONFIG_INPUT_EVDEV=y
diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig
index ed0a0d1be0f3..627accea72fb 100644
--- a/arch/arm/configs/mvebu_v7_defconfig
+++ b/arch/arm/configs/mvebu_v7_defconfig
@@ -45,6 +45,7 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
45CONFIG_DEVTMPFS=y 45CONFIG_DEVTMPFS=y
46CONFIG_DEVTMPFS_MOUNT=y 46CONFIG_DEVTMPFS_MOUNT=y
47CONFIG_MTD=y 47CONFIG_MTD=y
48CONFIG_MTD_BLOCK=y
48CONFIG_MTD_CFI=y 49CONFIG_MTD_CFI=y
49CONFIG_MTD_CFI_INTELEXT=y 50CONFIG_MTD_CFI_INTELEXT=y
50CONFIG_MTD_CFI_AMDSTD=y 51CONFIG_MTD_CFI_AMDSTD=y
@@ -59,10 +60,12 @@ CONFIG_ATA=y
59CONFIG_AHCI_MVEBU=y 60CONFIG_AHCI_MVEBU=y
60CONFIG_SATA_MV=y 61CONFIG_SATA_MV=y
61CONFIG_NETDEVICES=y 62CONFIG_NETDEVICES=y
63CONFIG_NET_DSA_MV88E6171=y
62CONFIG_MV643XX_ETH=y 64CONFIG_MV643XX_ETH=y
63CONFIG_MVNETA=y 65CONFIG_MVNETA=y
64CONFIG_MVPP2=y 66CONFIG_MVPP2=y
65CONFIG_MARVELL_PHY=y 67CONFIG_MARVELL_PHY=y
68CONFIG_FIXED_PHY=y
66CONFIG_MWIFIEX=y 69CONFIG_MWIFIEX=y
67CONFIG_MWIFIEX_SDIO=y 70CONFIG_MWIFIEX_SDIO=y
68CONFIG_INPUT_EVDEV=y 71CONFIG_INPUT_EVDEV=y
@@ -72,6 +75,7 @@ CONFIG_SERIAL_8250_CONSOLE=y
72CONFIG_SERIAL_8250_DW=y 75CONFIG_SERIAL_8250_DW=y
73CONFIG_SERIAL_OF_PLATFORM=y 76CONFIG_SERIAL_OF_PLATFORM=y
74CONFIG_I2C=y 77CONFIG_I2C=y
78CONFIG_I2C_CHARDEV=y
75CONFIG_I2C_MV64XXX=y 79CONFIG_I2C_MV64XXX=y
76CONFIG_SPI=y 80CONFIG_SPI=y
77CONFIG_SPI_ORION=y 81CONFIG_SPI_ORION=y
@@ -85,7 +89,9 @@ CONFIG_SOUND=y
85CONFIG_SND=y 89CONFIG_SND=y
86CONFIG_SND_SOC=y 90CONFIG_SND_SOC=y
87CONFIG_SND_KIRKWOOD_SOC=y 91CONFIG_SND_KIRKWOOD_SOC=y
88CONFIG_SND_KIRKWOOD_SOC_ARMADA370_DB=y 92CONFIG_SND_SOC_CS42L51_I2C=y
93CONFIG_SND_SOC_SPDIF=y
94CONFIG_SND_SIMPLE_CARD=y
89CONFIG_USB=y 95CONFIG_USB=y
90CONFIG_USB_XHCI_HCD=y 96CONFIG_USB_XHCI_HCD=y
91CONFIG_USB_XHCI_MVEBU=y 97CONFIG_USB_XHCI_MVEBU=y
@@ -96,6 +102,7 @@ CONFIG_MMC=y
96CONFIG_MMC_SDHCI=y 102CONFIG_MMC_SDHCI=y
97CONFIG_MMC_SDHCI_PLTFM=y 103CONFIG_MMC_SDHCI_PLTFM=y
98CONFIG_MMC_SDHCI_DOVE=y 104CONFIG_MMC_SDHCI_DOVE=y
105CONFIG_MMC_SDHCI_PXAV3=y
99CONFIG_MMC_MVSDIO=y 106CONFIG_MMC_MVSDIO=y
100CONFIG_LEDS_GPIO=y 107CONFIG_LEDS_GPIO=y
101CONFIG_LEDS_CLASS=y 108CONFIG_LEDS_CLASS=y
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index 263ae3869e32..7d2ad30d9e70 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -20,7 +20,6 @@ CONFIG_PREEMPT=y
20CONFIG_AEABI=y 20CONFIG_AEABI=y
21CONFIG_ZBOOT_ROM_TEXT=0x0 21CONFIG_ZBOOT_ROM_TEXT=0x0
22CONFIG_ZBOOT_ROM_BSS=0x0 22CONFIG_ZBOOT_ROM_BSS=0x0
23CONFIG_FPE_NWFPE=y
24CONFIG_NET=y 23CONFIG_NET=y
25CONFIG_PACKET=y 24CONFIG_PACKET=y
26CONFIG_UNIX=y 25CONFIG_UNIX=y
@@ -57,14 +56,12 @@ CONFIG_MTD_NAND_FSMC=y
57CONFIG_MTD_ONENAND=y 56CONFIG_MTD_ONENAND=y
58CONFIG_MTD_ONENAND_VERIFY_WRITE=y 57CONFIG_MTD_ONENAND_VERIFY_WRITE=y
59CONFIG_MTD_ONENAND_GENERIC=y 58CONFIG_MTD_ONENAND_GENERIC=y
60CONFIG_PROC_DEVICETREE=y
61CONFIG_BLK_DEV_LOOP=y 59CONFIG_BLK_DEV_LOOP=y
62CONFIG_BLK_DEV_CRYPTOLOOP=y 60CONFIG_BLK_DEV_CRYPTOLOOP=y
63CONFIG_BLK_DEV_RAM=y 61CONFIG_BLK_DEV_RAM=y
64CONFIG_SCSI=y 62CONFIG_SCSI=y
65CONFIG_BLK_DEV_SD=y 63CONFIG_BLK_DEV_SD=y
66CONFIG_CHR_DEV_SG=y 64CONFIG_CHR_DEV_SG=y
67CONFIG_SCSI_MULTI_LUN=y
68CONFIG_SCSI_CONSTANTS=y 65CONFIG_SCSI_CONSTANTS=y
69CONFIG_SCSI_LOGGING=y 66CONFIG_SCSI_LOGGING=y
70CONFIG_SCSI_SCAN_ASYNC=y 67CONFIG_SCSI_SCAN_ASYNC=y
@@ -83,21 +80,21 @@ CONFIG_PPP_SYNC_TTY=m
83CONFIG_INPUT_EVDEV=y 80CONFIG_INPUT_EVDEV=y
84# CONFIG_KEYBOARD_ATKBD is not set 81# CONFIG_KEYBOARD_ATKBD is not set
85CONFIG_KEYBOARD_GPIO=y 82CONFIG_KEYBOARD_GPIO=y
83CONFIG_KEYBOARD_STMPE=y
86# CONFIG_MOUSE_PS2 is not set 84# CONFIG_MOUSE_PS2 is not set
87# CONFIG_SERIO is not set 85# CONFIG_SERIO is not set
88# CONFIG_LEGACY_PTYS is not set 86# CONFIG_LEGACY_PTYS is not set
89CONFIG_SERIAL_AMBA_PL011=y 87CONFIG_SERIAL_AMBA_PL011=y
90CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 88CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
91CONFIG_HW_RANDOM=y 89CONFIG_HW_RANDOM=y
92CONFIG_HW_RANDOM_NOMADIK=y
93CONFIG_I2C_CHARDEV=y 90CONFIG_I2C_CHARDEV=y
94CONFIG_I2C_GPIO=y 91CONFIG_I2C_GPIO=y
95CONFIG_I2C_NOMADIK=y
96CONFIG_DEBUG_GPIO=y 92CONFIG_DEBUG_GPIO=y
93CONFIG_GPIO_STMPE=y
97# CONFIG_HWMON is not set 94# CONFIG_HWMON is not set
95CONFIG_MFD_STMPE=y
98CONFIG_REGULATOR=y 96CONFIG_REGULATOR=y
99CONFIG_MMC=y 97CONFIG_MMC=y
100CONFIG_MMC_UNSAFE_RESUME=y
101# CONFIG_MMC_BLOCK_BOUNCE is not set 98# CONFIG_MMC_BLOCK_BOUNCE is not set
102CONFIG_MMC_ARMMMCI=y 99CONFIG_MMC_ARMMMCI=y
103CONFIG_NEW_LEDS=y 100CONFIG_NEW_LEDS=y
@@ -125,12 +122,12 @@ CONFIG_NLS_CODEPAGE_437=y
125CONFIG_NLS_ASCII=y 122CONFIG_NLS_ASCII=y
126CONFIG_NLS_ISO8859_1=y 123CONFIG_NLS_ISO8859_1=y
127CONFIG_NLS_ISO8859_15=y 124CONFIG_NLS_ISO8859_15=y
125CONFIG_DEBUG_INFO=y
128# CONFIG_ENABLE_MUST_CHECK is not set 126# CONFIG_ENABLE_MUST_CHECK is not set
129CONFIG_DEBUG_FS=y 127CONFIG_DEBUG_FS=y
130# CONFIG_SCHED_DEBUG is not set 128# CONFIG_SCHED_DEBUG is not set
131# CONFIG_DEBUG_PREEMPT is not set 129# CONFIG_DEBUG_PREEMPT is not set
132# CONFIG_DEBUG_BUGVERBOSE is not set 130# CONFIG_DEBUG_BUGVERBOSE is not set
133CONFIG_DEBUG_INFO=y
134CONFIG_CRYPTO_MD5=y 131CONFIG_CRYPTO_MD5=y
135CONFIG_CRYPTO_SHA1=y 132CONFIG_CRYPTO_SHA1=y
136CONFIG_CRYPTO_DES=y 133CONFIG_CRYPTO_DES=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index b3f86670d2eb..3e09286f7ff1 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -129,11 +129,27 @@ CONFIG_BLK_DEV_SD=y
129CONFIG_SCSI_SCAN_ASYNC=y 129CONFIG_SCSI_SCAN_ASYNC=y
130CONFIG_MD=y 130CONFIG_MD=y
131CONFIG_NETDEVICES=y 131CONFIG_NETDEVICES=y
132# CONFIG_NET_VENDOR_ARC is not set
133# CONFIG_NET_CADENCE is not set
134# CONFIG_NET_VENDOR_BROADCOM is not set
135# CONFIG_NET_VENDOR_CIRRUS is not set
136# CONFIG_NET_VENDOR_FARADAY is not set
137# CONFIG_NET_VENDOR_HISILICON is not set
138# CONFIG_NET_VENDOR_INTEL is not set
139# CONFIG_NET_VENDOR_MARVELL is not set
132CONFIG_KS8851=y 140CONFIG_KS8851=y
133CONFIG_KS8851_MLL=y 141CONFIG_KS8851_MLL=y
142# CONFIG_NET_VENDOR_MICROCHIP is not set
143# CONFIG_NET_VENDOR_NATSEMI is not set
144# CONFIG_NET_VENDOR_QUALCOMM is not set
145# CONFIG_NET_VENDOR_SAMSUNG is not set
146# CONFIG_NET_VENDOR_SEEQ is not set
134CONFIG_SMC91X=y 147CONFIG_SMC91X=y
135CONFIG_SMSC911X=y 148CONFIG_SMSC911X=y
149# CONFIG_NET_VENDOR_STMICRO is not set
136CONFIG_TI_CPSW=y 150CONFIG_TI_CPSW=y
151# CONFIG_NET_VENDOR_VIA is not set
152# CONFIG_NET_VENDOR_WIZNET is not set
137CONFIG_AT803X_PHY=y 153CONFIG_AT803X_PHY=y
138CONFIG_SMSC_PHY=y 154CONFIG_SMSC_PHY=y
139CONFIG_USB_USBNET=y 155CONFIG_USB_USBNET=y
@@ -161,6 +177,7 @@ CONFIG_KEYBOARD_MATRIX=m
161CONFIG_KEYBOARD_TWL4030=y 177CONFIG_KEYBOARD_TWL4030=y
162CONFIG_INPUT_TOUCHSCREEN=y 178CONFIG_INPUT_TOUCHSCREEN=y
163CONFIG_TOUCHSCREEN_ADS7846=m 179CONFIG_TOUCHSCREEN_ADS7846=m
180CONFIG_TOUCHSCREEN_EDT_FT5X06=m
164CONFIG_TOUCHSCREEN_TSC2005=m 181CONFIG_TOUCHSCREEN_TSC2005=m
165CONFIG_TOUCHSCREEN_TSC2007=m 182CONFIG_TOUCHSCREEN_TSC2007=m
166CONFIG_INPUT_MISC=y 183CONFIG_INPUT_MISC=y
@@ -264,6 +281,8 @@ CONFIG_SND_VERBOSE_PRINTK=y
264CONFIG_SND_DEBUG=y 281CONFIG_SND_DEBUG=y
265CONFIG_SND_USB_AUDIO=m 282CONFIG_SND_USB_AUDIO=m
266CONFIG_SND_SOC=m 283CONFIG_SND_SOC=m
284CONFIG_SND_EDMA_SOC=m
285CONFIG_SND_AM33XX_SOC_EVM=m
267CONFIG_SND_OMAP_SOC=m 286CONFIG_SND_OMAP_SOC=m
268CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m 287CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m
269CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m 288CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m
@@ -271,6 +290,7 @@ CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
271CONFIG_USB=y 290CONFIG_USB=y
272CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 291CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
273CONFIG_USB_MON=y 292CONFIG_USB_MON=y
293CONFIG_USB_XHCI_HCD=m
274CONFIG_USB_WDM=y 294CONFIG_USB_WDM=y
275CONFIG_USB_STORAGE=y 295CONFIG_USB_STORAGE=y
276CONFIG_USB_DWC3=m 296CONFIG_USB_DWC3=m
@@ -306,6 +326,8 @@ CONFIG_DMA_OMAP=y
306CONFIG_EXTCON=y 326CONFIG_EXTCON=y
307CONFIG_EXTCON_PALMAS=y 327CONFIG_EXTCON_PALMAS=y
308CONFIG_PWM=y 328CONFIG_PWM=y
329CONFIG_PWM_TIECAP=y
330CONFIG_PWM_TIEHRPWM=y
309CONFIG_PWM_TWL=y 331CONFIG_PWM_TWL=y
310CONFIG_PWM_TWL_LED=y 332CONFIG_PWM_TWL_LED=y
311CONFIG_OMAP_USB2=y 333CONFIG_OMAP_USB2=y
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index c9089c927daf..b58fb32770a0 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -12,7 +12,7 @@ CONFIG_MODULES=y
12CONFIG_MODULE_FORCE_LOAD=y 12CONFIG_MODULE_FORCE_LOAD=y
13CONFIG_MODULE_UNLOAD=y 13CONFIG_MODULE_UNLOAD=y
14CONFIG_MODULE_FORCE_UNLOAD=y 14CONFIG_MODULE_FORCE_UNLOAD=y
15# CONFIG_LBDAF is not set 15CONFIG_LBDAF=y
16# CONFIG_BLK_DEV_BSG is not set 16# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_DEADLINE is not set 17# CONFIG_IOSCHED_DEADLINE is not set
18# CONFIG_IOSCHED_CFQ is not set 18# CONFIG_IOSCHED_CFQ is not set
@@ -20,7 +20,6 @@ CONFIG_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_SOC_SAMA5D4=y
23CONFIG_MACH_SAMA5_DT=y
24CONFIG_AEABI=y 23CONFIG_AEABI=y
25CONFIG_UACCESS_WITH_MEMCPY=y 24CONFIG_UACCESS_WITH_MEMCPY=y
26CONFIG_ZBOOT_ROM_TEXT=0x0 25CONFIG_ZBOOT_ROM_TEXT=0x0
@@ -30,6 +29,8 @@ CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 r
30CONFIG_KEXEC=y 29CONFIG_KEXEC=y
31CONFIG_AUTO_ZRELADDR=y 30CONFIG_AUTO_ZRELADDR=y
32CONFIG_VFP=y 31CONFIG_VFP=y
32CONFIG_NEON=y
33CONFIG_KERNEL_MODE_NEON=y
33# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 34# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
34CONFIG_PM_RUNTIME=y 35CONFIG_PM_RUNTIME=y
35CONFIG_PM_DEBUG=y 36CONFIG_PM_DEBUG=y
@@ -176,11 +177,13 @@ CONFIG_LEDS_TRIGGER_GPIO=y
176CONFIG_RTC_CLASS=y 177CONFIG_RTC_CLASS=y
177CONFIG_RTC_DRV_AT91RM9200=y 178CONFIG_RTC_DRV_AT91RM9200=y
178CONFIG_DMADEVICES=y 179CONFIG_DMADEVICES=y
180CONFIG_AT_XDMAC=y
179# CONFIG_IOMMU_SUPPORT is not set 181# CONFIG_IOMMU_SUPPORT is not set
180CONFIG_IIO=y 182CONFIG_IIO=y
181CONFIG_AT91_ADC=y 183CONFIG_AT91_ADC=y
182CONFIG_PWM=y 184CONFIG_PWM=y
183CONFIG_PWM_ATMEL=y 185CONFIG_PWM_ATMEL=y
186CONFIG_PWM_ATMEL_TCB=y
184CONFIG_EXT4_FS=y 187CONFIG_EXT4_FS=y
185CONFIG_FANOTIFY=y 188CONFIG_FANOTIFY=y
186CONFIG_VFAT_FS=y 189CONFIG_VFAT_FS=y
diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
index d7346ad51043..63fb5316ff02 100644
--- a/arch/arm/configs/shmobile_defconfig
+++ b/arch/arm/configs/shmobile_defconfig
@@ -17,7 +17,6 @@ CONFIG_ARCH_R8A7779=y
17CONFIG_ARCH_R8A7790=y 17CONFIG_ARCH_R8A7790=y
18CONFIG_ARCH_R8A7791=y 18CONFIG_ARCH_R8A7791=y
19CONFIG_ARCH_R8A7794=y 19CONFIG_ARCH_R8A7794=y
20CONFIG_MACH_KOELSCH=y
21CONFIG_MACH_LAGER=y 20CONFIG_MACH_LAGER=y
22CONFIG_MACH_MARZEN=y 21CONFIG_MACH_MARZEN=y
23# CONFIG_SWP_EMULATE is not set 22# CONFIG_SWP_EMULATE is not set
@@ -126,6 +125,7 @@ CONFIG_SND=y
126CONFIG_SND_SOC=y 125CONFIG_SND_SOC=y
127CONFIG_SND_SOC_SH4_FSI=y 126CONFIG_SND_SOC_SH4_FSI=y
128CONFIG_SND_SOC_RCAR=y 127CONFIG_SND_SOC_RCAR=y
128CONFIG_SND_SOC_AK4642=y
129CONFIG_SND_SOC_WM8978=y 129CONFIG_SND_SOC_WM8978=y
130CONFIG_USB=y 130CONFIG_USB=y
131CONFIG_USB_EHCI_HCD=y 131CONFIG_USB_EHCI_HCD=y
@@ -146,6 +146,8 @@ CONFIG_RTC_CLASS=y
146CONFIG_RTC_DRV_S35390A=y 146CONFIG_RTC_DRV_S35390A=y
147CONFIG_DMADEVICES=y 147CONFIG_DMADEVICES=y
148CONFIG_SH_DMAE=y 148CONFIG_SH_DMAE=y
149CONFIG_RCAR_AUDMAC_PP=y
150CONFIG_RCAR_DMAC=y
149# CONFIG_IOMMU_SUPPORT is not set 151# CONFIG_IOMMU_SUPPORT is not set
150CONFIG_PWM=y 152CONFIG_PWM=y
151CONFIG_PWM_RENESAS_TPU=y 153CONFIG_PWM_RENESAS_TPU=y
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index 888fc1521322..40750f93aa83 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -97,10 +97,8 @@ CONFIG_ICS932S401=y
97CONFIG_APDS9802ALS=y 97CONFIG_APDS9802ALS=y
98CONFIG_ISL29003=y 98CONFIG_ISL29003=y
99CONFIG_EEPROM_AT24=y 99CONFIG_EEPROM_AT24=y
100CONFIG_SCSI=y
101CONFIG_BLK_DEV_SD=y 100CONFIG_BLK_DEV_SD=y
102CONFIG_BLK_DEV_SR=y 101CONFIG_BLK_DEV_SR=y
103CONFIG_SCSI_MULTI_LUN=y
104# CONFIG_SCSI_LOWLEVEL is not set 102# CONFIG_SCSI_LOWLEVEL is not set
105CONFIG_ATA=y 103CONFIG_ATA=y
106CONFIG_SATA_AHCI=y 104CONFIG_SATA_AHCI=y
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 92793ba69c40..d4ebf5679f1f 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -78,6 +78,15 @@ static inline u32 arch_timer_get_cntfrq(void)
78 return val; 78 return val;
79} 79}
80 80
81static inline u64 arch_counter_get_cntpct(void)
82{
83 u64 cval;
84
85 isb();
86 asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
87 return cval;
88}
89
81static inline u64 arch_counter_get_cntvct(void) 90static inline u64 arch_counter_get_cntvct(void)
82{ 91{
83 u64 cval; 92 u64 cval;
diff --git a/arch/arm/include/asm/cpuidle.h b/arch/arm/include/asm/cpuidle.h
index 2fca60ab513a..af319ac4960c 100644
--- a/arch/arm/include/asm/cpuidle.h
+++ b/arch/arm/include/asm/cpuidle.h
@@ -15,7 +15,6 @@ static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
15 .exit_latency = 1,\ 15 .exit_latency = 1,\
16 .target_residency = 1,\ 16 .target_residency = 1,\
17 .power_usage = p,\ 17 .power_usage = p,\
18 .flags = CPUIDLE_FLAG_TIME_VALID,\
19 .name = "WFI",\ 18 .name = "WFI",\
20 .desc = "ARM WFI",\ 19 .desc = "ARM WFI",\
21} 20}
diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h
index 2c9f10df7568..89aefe10d66b 100644
--- a/arch/arm/include/asm/firmware.h
+++ b/arch/arm/include/asm/firmware.h
@@ -28,7 +28,7 @@ struct firmware_ops {
28 /* 28 /*
29 * Enters CPU idle mode 29 * Enters CPU idle mode
30 */ 30 */
31 int (*do_idle)(void); 31 int (*do_idle)(unsigned long mode);
32 /* 32 /*
33 * Sets boot address of specified physical CPU 33 * Sets boot address of specified physical CPU
34 */ 34 */
@@ -41,6 +41,14 @@ struct firmware_ops {
41 * Initializes L2 cache 41 * Initializes L2 cache
42 */ 42 */
43 int (*l2x0_init)(void); 43 int (*l2x0_init)(void);
44 /*
45 * Enter system-wide suspend.
46 */
47 int (*suspend)(void);
48 /*
49 * Restore state of privileged hardware after system-wide suspend.
50 */
51 int (*resume)(void);
44}; 52};
45 53
46/* Global pointer for current firmware_ops structure, can't be NULL. */ 54/* Global pointer for current firmware_ops structure, can't be NULL. */
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 180567408ee8..db58deb00aa7 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -47,13 +47,13 @@ extern void atomic_io_modify_relaxed(void __iomem *reg, u32 mask, u32 set);
47 * Generic IO read/write. These perform native-endian accesses. Note 47 * Generic IO read/write. These perform native-endian accesses. Note
48 * that some architectures will want to re-define __raw_{read,write}w. 48 * that some architectures will want to re-define __raw_{read,write}w.
49 */ 49 */
50extern void __raw_writesb(void __iomem *addr, const void *data, int bytelen); 50void __raw_writesb(volatile void __iomem *addr, const void *data, int bytelen);
51extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen); 51void __raw_writesw(volatile void __iomem *addr, const void *data, int wordlen);
52extern void __raw_writesl(void __iomem *addr, const void *data, int longlen); 52void __raw_writesl(volatile void __iomem *addr, const void *data, int longlen);
53 53
54extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen); 54void __raw_readsb(const volatile void __iomem *addr, void *data, int bytelen);
55extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); 55void __raw_readsw(const volatile void __iomem *addr, void *data, int wordlen);
56extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); 56void __raw_readsl(const volatile void __iomem *addr, void *data, int longlen);
57 57
58#if __LINUX_ARM_ARCH__ < 6 58#if __LINUX_ARM_ARCH__ < 6
59/* 59/*
@@ -69,6 +69,7 @@ extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
69 * writeback addressing modes as these incur a significant performance 69 * writeback addressing modes as these incur a significant performance
70 * overhead (the address generation must be emulated in software). 70 * overhead (the address generation must be emulated in software).
71 */ 71 */
72#define __raw_writew __raw_writew
72static inline void __raw_writew(u16 val, volatile void __iomem *addr) 73static inline void __raw_writew(u16 val, volatile void __iomem *addr)
73{ 74{
74 asm volatile("strh %1, %0" 75 asm volatile("strh %1, %0"
@@ -76,6 +77,7 @@ static inline void __raw_writew(u16 val, volatile void __iomem *addr)
76 : "r" (val)); 77 : "r" (val));
77} 78}
78 79
80#define __raw_readw __raw_readw
79static inline u16 __raw_readw(const volatile void __iomem *addr) 81static inline u16 __raw_readw(const volatile void __iomem *addr)
80{ 82{
81 u16 val; 83 u16 val;
@@ -86,6 +88,7 @@ static inline u16 __raw_readw(const volatile void __iomem *addr)
86} 88}
87#endif 89#endif
88 90
91#define __raw_writeb __raw_writeb
89static inline void __raw_writeb(u8 val, volatile void __iomem *addr) 92static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
90{ 93{
91 asm volatile("strb %1, %0" 94 asm volatile("strb %1, %0"
@@ -93,6 +96,7 @@ static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
93 : "r" (val)); 96 : "r" (val));
94} 97}
95 98
99#define __raw_writel __raw_writel
96static inline void __raw_writel(u32 val, volatile void __iomem *addr) 100static inline void __raw_writel(u32 val, volatile void __iomem *addr)
97{ 101{
98 asm volatile("str %1, %0" 102 asm volatile("str %1, %0"
@@ -100,6 +104,7 @@ static inline void __raw_writel(u32 val, volatile void __iomem *addr)
100 : "r" (val)); 104 : "r" (val));
101} 105}
102 106
107#define __raw_readb __raw_readb
103static inline u8 __raw_readb(const volatile void __iomem *addr) 108static inline u8 __raw_readb(const volatile void __iomem *addr)
104{ 109{
105 u8 val; 110 u8 val;
@@ -109,6 +114,7 @@ static inline u8 __raw_readb(const volatile void __iomem *addr)
109 return val; 114 return val;
110} 115}
111 116
117#define __raw_readl __raw_readl
112static inline u32 __raw_readl(const volatile void __iomem *addr) 118static inline u32 __raw_readl(const volatile void __iomem *addr)
113{ 119{
114 u32 val; 120 u32 val;
@@ -267,20 +273,6 @@ extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);
267#define insl(p,d,l) __raw_readsl(__io(p),d,l) 273#define insl(p,d,l) __raw_readsl(__io(p),d,l)
268#endif 274#endif
269 275
270#define outb_p(val,port) outb((val),(port))
271#define outw_p(val,port) outw((val),(port))
272#define outl_p(val,port) outl((val),(port))
273#define inb_p(port) inb((port))
274#define inw_p(port) inw((port))
275#define inl_p(port) inl((port))
276
277#define outsb_p(port,from,len) outsb(port,from,len)
278#define outsw_p(port,from,len) outsw(port,from,len)
279#define outsl_p(port,from,len) outsl(port,from,len)
280#define insb_p(port,to,len) insb(port,to,len)
281#define insw_p(port,to,len) insw(port,to,len)
282#define insl_p(port,to,len) insl(port,to,len)
283
284/* 276/*
285 * String version of IO memory access ops: 277 * String version of IO memory access ops:
286 */ 278 */
@@ -347,40 +339,42 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
347#define iounmap __arm_iounmap 339#define iounmap __arm_iounmap
348 340
349/* 341/*
350 * io{read,write}{8,16,32} macros 342 * io{read,write}{16,32}be() macros
351 */ 343 */
352#ifndef ioread8 344#define ioread16be(p) ({ __u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
353#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __iormb(); __v; }) 345#define ioread32be(p) ({ __u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
354#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; })
355#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; })
356
357#define ioread16be(p) ({ unsigned int __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
358#define ioread32be(p) ({ unsigned int __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
359
360#define iowrite8(v,p) ({ __iowmb(); __raw_writeb(v, p); })
361#define iowrite16(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_le16(v), p); })
362#define iowrite32(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_le32(v), p); })
363 346
364#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); }) 347#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); })
365#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); }) 348#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); })
366
367#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
368#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
369#define ioread32_rep(p,d,c) __raw_readsl(p,d,c)
370
371#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c)
372#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c)
373#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c)
374 349
350#ifndef ioport_map
351#define ioport_map ioport_map
375extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 352extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
353#endif
354#ifndef ioport_unmap
355#define ioport_unmap ioport_unmap
376extern void ioport_unmap(void __iomem *addr); 356extern void ioport_unmap(void __iomem *addr);
377#endif 357#endif
378 358
379struct pci_dev; 359struct pci_dev;
380 360
361#define pci_iounmap pci_iounmap
381extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); 362extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
382 363
383/* 364/*
365 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
366 * access
367 */
368#define xlate_dev_mem_ptr(p) __va(p)
369
370/*
371 * Convert a virtual cached pointer to an uncached pointer
372 */
373#define xlate_dev_kmem_ptr(p) p
374
375#include <asm-generic/io.h>
376
377/*
384 * can the hardware map this into one segment or not, given no other 378 * can the hardware map this into one segment or not, given no other
385 * constraints. 379 * constraints.
386 */ 380 */
@@ -402,17 +396,6 @@ extern int devmem_is_allowed(unsigned long pfn);
402#endif 396#endif
403 397
404/* 398/*
405 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
406 * access
407 */
408#define xlate_dev_mem_ptr(p) __va(p)
409
410/*
411 * Convert a virtual cached pointer to an uncached pointer
412 */
413#define xlate_dev_kmem_ptr(p) p
414
415/*
416 * Register ISA memory and port locations for glibc iopl/inb/outb 399 * Register ISA memory and port locations for glibc iopl/inb/outb
417 * emulation. 400 * emulation.
418 */ 401 */
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 7fc42784becb..8292b5f81e23 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -22,6 +22,9 @@ struct hw_pci {
22#ifdef CONFIG_PCI_DOMAINS 22#ifdef CONFIG_PCI_DOMAINS
23 int domain; 23 int domain;
24#endif 24#endif
25#ifdef CONFIG_PCI_MSI
26 struct msi_controller *msi_ctrl;
27#endif
25 struct pci_ops *ops; 28 struct pci_ops *ops;
26 int nr_controllers; 29 int nr_controllers;
27 void **private_data; 30 void **private_data;
@@ -36,8 +39,6 @@ struct hw_pci {
36 resource_size_t start, 39 resource_size_t start,
37 resource_size_t size, 40 resource_size_t size,
38 resource_size_t align); 41 resource_size_t align);
39 void (*add_bus)(struct pci_bus *bus);
40 void (*remove_bus)(struct pci_bus *bus);
41}; 42};
42 43
43/* 44/*
@@ -47,6 +48,9 @@ struct pci_sys_data {
47#ifdef CONFIG_PCI_DOMAINS 48#ifdef CONFIG_PCI_DOMAINS
48 int domain; 49 int domain;
49#endif 50#endif
51#ifdef CONFIG_PCI_MSI
52 struct msi_controller *msi_ctrl;
53#endif
50 struct list_head node; 54 struct list_head node;
51 int busnr; /* primary bus number */ 55 int busnr; /* primary bus number */
52 u64 mem_offset; /* bus->cpu memory mapping offset */ 56 u64 mem_offset; /* bus->cpu memory mapping offset */
@@ -65,8 +69,6 @@ struct pci_sys_data {
65 resource_size_t start, 69 resource_size_t start,
66 resource_size_t size, 70 resource_size_t size,
67 resource_size_t align); 71 resource_size_t align);
68 void (*add_bus)(struct pci_bus *bus);
69 void (*remove_bus)(struct pci_bus *bus);
70 void *private_data; /* platform controller private data */ 72 void *private_data; /* platform controller private data */
71}; 73};
72 74
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index e731018869a7..184def0e1652 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -274,11 +274,13 @@ static inline unsigned long __phys_to_virt(phys_addr_t x)
274 * translation for translating DMA addresses. Use the driver 274 * translation for translating DMA addresses. Use the driver
275 * DMA support - see dma-mapping.h. 275 * DMA support - see dma-mapping.h.
276 */ 276 */
277#define virt_to_phys virt_to_phys
277static inline phys_addr_t virt_to_phys(const volatile void *x) 278static inline phys_addr_t virt_to_phys(const volatile void *x)
278{ 279{
279 return __virt_to_phys((unsigned long)(x)); 280 return __virt_to_phys((unsigned long)(x));
280} 281}
281 282
283#define phys_to_virt phys_to_virt
282static inline void *phys_to_virt(phys_addr_t x) 284static inline void *phys_to_virt(phys_addr_t x)
283{ 285{
284 return (void *)__phys_to_virt(x); 286 return (void *)__phys_to_virt(x);
@@ -322,11 +324,13 @@ static inline phys_addr_t __virt_to_idmap(unsigned long x)
322#endif 324#endif
323 325
324#ifdef CONFIG_VIRT_TO_BUS 326#ifdef CONFIG_VIRT_TO_BUS
327#define virt_to_bus virt_to_bus
325static inline __deprecated unsigned long virt_to_bus(void *x) 328static inline __deprecated unsigned long virt_to_bus(void *x)
326{ 329{
327 return __virt_to_bus((unsigned long)x); 330 return __virt_to_bus((unsigned long)x);
328} 331}
329 332
333#define bus_to_virt bus_to_virt
330static inline __deprecated void *bus_to_virt(unsigned long x) 334static inline __deprecated void *bus_to_virt(unsigned long x)
331{ 335{
332 return (void *)__bus_to_virt(x); 336 return (void *)__bus_to_virt(x);
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h
index c3a83691af8e..d9cf138fd7d4 100644
--- a/arch/arm/include/asm/perf_event.h
+++ b/arch/arm/include/asm/perf_event.h
@@ -12,7 +12,7 @@
12#ifndef __ARM_PERF_EVENT_H__ 12#ifndef __ARM_PERF_EVENT_H__
13#define __ARM_PERF_EVENT_H__ 13#define __ARM_PERF_EVENT_H__
14 14
15#ifdef CONFIG_HW_PERF_EVENTS 15#ifdef CONFIG_PERF_EVENTS
16struct pt_regs; 16struct pt_regs;
17extern unsigned long perf_instruction_pointer(struct pt_regs *regs); 17extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
18extern unsigned long perf_misc_flags(struct pt_regs *regs); 18extern unsigned long perf_misc_flags(struct pt_regs *regs);
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
index 0b648c541293..b1596bd59129 100644
--- a/arch/arm/include/asm/pmu.h
+++ b/arch/arm/include/asm/pmu.h
@@ -15,6 +15,8 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/perf_event.h> 16#include <linux/perf_event.h>
17 17
18#include <asm/cputype.h>
19
18/* 20/*
19 * struct arm_pmu_platdata - ARM PMU platform data 21 * struct arm_pmu_platdata - ARM PMU platform data
20 * 22 *
@@ -66,19 +68,25 @@ struct pmu_hw_events {
66 /* 68 /*
67 * The events that are active on the PMU for the given index. 69 * The events that are active on the PMU for the given index.
68 */ 70 */
69 struct perf_event **events; 71 struct perf_event *events[ARMPMU_MAX_HWEVENTS];
70 72
71 /* 73 /*
72 * A 1 bit for an index indicates that the counter is being used for 74 * A 1 bit for an index indicates that the counter is being used for
73 * an event. A 0 means that the counter can be used. 75 * an event. A 0 means that the counter can be used.
74 */ 76 */
75 unsigned long *used_mask; 77 DECLARE_BITMAP(used_mask, ARMPMU_MAX_HWEVENTS);
76 78
77 /* 79 /*
78 * Hardware lock to serialize accesses to PMU registers. Needed for the 80 * Hardware lock to serialize accesses to PMU registers. Needed for the
79 * read/modify/write sequences. 81 * read/modify/write sequences.
80 */ 82 */
81 raw_spinlock_t pmu_lock; 83 raw_spinlock_t pmu_lock;
84
85 /*
86 * When using percpu IRQs, we need a percpu dev_id. Place it here as we
87 * already have to allocate this struct per cpu.
88 */
89 struct arm_pmu *percpu_pmu;
82}; 90};
83 91
84struct arm_pmu { 92struct arm_pmu {
@@ -107,7 +115,8 @@ struct arm_pmu {
107 struct mutex reserve_mutex; 115 struct mutex reserve_mutex;
108 u64 max_period; 116 u64 max_period;
109 struct platform_device *plat_device; 117 struct platform_device *plat_device;
110 struct pmu_hw_events *(*get_hw_events)(void); 118 struct pmu_hw_events __percpu *hw_events;
119 struct notifier_block hotplug_nb;
111}; 120};
112 121
113#define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu)) 122#define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu))
@@ -127,6 +136,27 @@ int armpmu_map_event(struct perf_event *event,
127 [PERF_COUNT_HW_CACHE_RESULT_MAX], 136 [PERF_COUNT_HW_CACHE_RESULT_MAX],
128 u32 raw_event_mask); 137 u32 raw_event_mask);
129 138
139struct pmu_probe_info {
140 unsigned int cpuid;
141 unsigned int mask;
142 int (*init)(struct arm_pmu *);
143};
144
145#define PMU_PROBE(_cpuid, _mask, _fn) \
146{ \
147 .cpuid = (_cpuid), \
148 .mask = (_mask), \
149 .init = (_fn), \
150}
151
152#define ARM_PMU_PROBE(_cpuid, _fn) \
153 PMU_PROBE(_cpuid, ARM_CPU_PART_MASK, _fn)
154
155#define ARM_PMU_XSCALE_MASK ((0xff << 24) | ARM_CPU_XSCALE_ARCH_MASK)
156
157#define XSCALE_PMU_PROBE(_version, _fn) \
158 PMU_PROBE(ARM_CPU_IMP_INTEL << 24 | _version, ARM_PMU_XSCALE_MASK, _fn)
159
130#endif /* CONFIG_HW_PERF_EVENTS */ 160#endif /* CONFIG_HW_PERF_EVENTS */
131 161
132#endif /* __ARM_PMU_H__ */ 162#endif /* __ARM_PMU_H__ */
diff --git a/arch/arm/include/debug/asm9260.S b/arch/arm/include/debug/asm9260.S
new file mode 100644
index 000000000000..292f85b49fca
--- /dev/null
+++ b/arch/arm/include/debug/asm9260.S
@@ -0,0 +1,29 @@
1/* Debugging macro include header
2 *
3 * Copyright (C) 1994-1999 Russell King
4 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
5 * Modified for ASM9260 by Oleksij Remepl <linux@rempel-privat.de>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13 .macro addruart, rp, rv, tmp
14 ldr \rp, = CONFIG_DEBUG_UART_PHYS
15 ldr \rv, = CONFIG_DEBUG_UART_VIRT
16 .endm
17
18 .macro waituart,rd,rx
19 .endm
20
21 .macro senduart,rd,rx
22 str \rd, [\rx, #0x50] @ TXDATA
23 .endm
24
25 .macro busyuart,rd,rx
261002: ldr \rd, [\rx, #0x60] @ STAT
27 tst \rd, #1 << 27 @ TXEMPTY
28 beq 1002b @ wait until transmit done
29 .endm
diff --git a/arch/arm/include/debug/renesas-scif.S b/arch/arm/include/debug/renesas-scif.S
new file mode 100644
index 000000000000..97820a8df51a
--- /dev/null
+++ b/arch/arm/include/debug/renesas-scif.S
@@ -0,0 +1,52 @@
1/*
2 * Renesas SCIF(A) debugging macro include header
3 *
4 * Based on r8a7790.S
5 *
6 * Copyright (C) 2012-2013 Renesas Electronics Corporation
7 * Copyright (C) 1994-1999 Russell King
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#define SCIF_PHYS CONFIG_DEBUG_UART_PHYS
15#define SCIF_VIRT ((SCIF_PHYS & 0x00ffffff) | 0xfd000000)
16
17#if CONFIG_DEBUG_UART_PHYS < 0xe6e00000
18/* SCIFA */
19#define FTDR 0x20
20#define FSR 0x14
21#else
22/* SCIF */
23#define FTDR 0x0c
24#define FSR 0x10
25#endif
26
27#define TDFE (1 << 5)
28#define TEND (1 << 6)
29
30 .macro addruart, rp, rv, tmp
31 ldr \rp, =SCIF_PHYS
32 ldr \rv, =SCIF_VIRT
33 .endm
34
35 .macro waituart, rd, rx
361001: ldrh \rd, [\rx, #FSR]
37 tst \rd, #TDFE
38 beq 1001b
39 .endm
40
41 .macro senduart, rd, rx
42 strb \rd, [\rx, #FTDR]
43 ldrh \rd, [\rx, #FSR]
44 bic \rd, \rd, #TEND
45 strh \rd, [\rx, #FSR]
46 .endm
47
48 .macro busyuart, rd, rx
491001: ldrh \rd, [\rx, #FSR]
50 tst \rd, #TEND
51 beq 1001b
52 .endm
diff --git a/arch/arm/mach-sa1100/include/mach/debug-macro.S b/arch/arm/include/debug/sa1100.S
index 530772d937ad..a0ae4f4cd924 100644
--- a/arch/arm/mach-sa1100/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/sa1100.S
@@ -1,4 +1,4 @@
1/* arch/arm/mach-sa1100/include/mach/debug-macro.S 1/* arch/arm/include/debug/sa1100.S
2 * 2 *
3 * Debugging macro include header 3 * Debugging macro include header
4 * 4 *
@@ -10,7 +10,13 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11 *
12*/ 12*/
13#include <mach/hardware.h> 13
14#define UTCR3 0x0c
15#define UTDR 0x14
16#define UTSR1 0x20
17#define UTCR3_TXE 0x00000002 /* Transmit Enable */
18#define UTSR1_TBY 0x00000001 /* Transmitter BusY (read) */
19#define UTSR1_TNF 0x00000004 /* Transmit FIFO Not Full (read) */
14 20
15 .macro addruart, rp, rv, tmp 21 .macro addruart, rp, rv, tmp
16 mrc p15, 0, \rp, c1, c0 22 mrc p15, 0, \rp, c1, c0
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 38ddd9f83d0e..8dcbed5016ac 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -82,7 +82,7 @@ obj-$(CONFIG_CPU_MOHAWK) += xscale-cp0.o
82obj-$(CONFIG_CPU_PJ4) += pj4-cp0.o 82obj-$(CONFIG_CPU_PJ4) += pj4-cp0.o
83obj-$(CONFIG_CPU_PJ4B) += pj4-cp0.o 83obj-$(CONFIG_CPU_PJ4B) += pj4-cp0.o
84obj-$(CONFIG_IWMMXT) += iwmmxt.o 84obj-$(CONFIG_IWMMXT) += iwmmxt.o
85obj-$(CONFIG_PERF_EVENTS) += perf_regs.o 85obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o
86obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o 86obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o
87AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 87AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
88obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o 88obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 17a26c17f7f5..daaff73bc776 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -18,6 +18,15 @@
18 18
19static int debug_pci; 19static int debug_pci;
20 20
21#ifdef CONFIG_PCI_MSI
22struct msi_controller *pcibios_msi_controller(struct pci_dev *dev)
23{
24 struct pci_sys_data *sysdata = dev->bus->sysdata;
25
26 return sysdata->msi_ctrl;
27}
28#endif
29
21/* 30/*
22 * We can't use pci_get_device() here since we are 31 * We can't use pci_get_device() here since we are
23 * called from interrupt context. 32 * called from interrupt context.
@@ -360,20 +369,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
360} 369}
361EXPORT_SYMBOL(pcibios_fixup_bus); 370EXPORT_SYMBOL(pcibios_fixup_bus);
362 371
363void pcibios_add_bus(struct pci_bus *bus)
364{
365 struct pci_sys_data *sys = bus->sysdata;
366 if (sys->add_bus)
367 sys->add_bus(bus);
368}
369
370void pcibios_remove_bus(struct pci_bus *bus)
371{
372 struct pci_sys_data *sys = bus->sysdata;
373 if (sys->remove_bus)
374 sys->remove_bus(bus);
375}
376
377/* 372/*
378 * Swizzle the device pin each time we cross a bridge. If a platform does 373 * Swizzle the device pin each time we cross a bridge. If a platform does
379 * not provide a swizzle function, we perform the standard PCI swizzling. 374 * not provide a swizzle function, we perform the standard PCI swizzling.
@@ -471,12 +466,13 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
471#ifdef CONFIG_PCI_DOMAINS 466#ifdef CONFIG_PCI_DOMAINS
472 sys->domain = hw->domain; 467 sys->domain = hw->domain;
473#endif 468#endif
469#ifdef CONFIG_PCI_MSI
470 sys->msi_ctrl = hw->msi_ctrl;
471#endif
474 sys->busnr = busnr; 472 sys->busnr = busnr;
475 sys->swizzle = hw->swizzle; 473 sys->swizzle = hw->swizzle;
476 sys->map_irq = hw->map_irq; 474 sys->map_irq = hw->map_irq;
477 sys->align_resource = hw->align_resource; 475 sys->align_resource = hw->align_resource;
478 sys->add_bus = hw->add_bus;
479 sys->remove_bus = hw->remove_bus;
480 INIT_LIST_HEAD(&sys->resources); 476 INIT_LIST_HEAD(&sys->resources);
481 477
482 if (hw->private_data) 478 if (hw->private_data)
diff --git a/arch/arm/kernel/perf_callchain.c b/arch/arm/kernel/perf_callchain.c
new file mode 100644
index 000000000000..4e02ae5950ff
--- /dev/null
+++ b/arch/arm/kernel/perf_callchain.c
@@ -0,0 +1,136 @@
1/*
2 * ARM callchain support
3 *
4 * Copyright (C) 2009 picoChip Designs, Ltd., Jamie Iles
5 * Copyright (C) 2010 ARM Ltd., Will Deacon <will.deacon@arm.com>
6 *
7 * This code is based on the ARM OProfile backtrace code.
8 */
9#include <linux/perf_event.h>
10#include <linux/uaccess.h>
11
12#include <asm/stacktrace.h>
13
14/*
15 * The registers we're interested in are at the end of the variable
16 * length saved register structure. The fp points at the end of this
17 * structure so the address of this struct is:
18 * (struct frame_tail *)(xxx->fp)-1
19 *
20 * This code has been adapted from the ARM OProfile support.
21 */
22struct frame_tail {
23 struct frame_tail __user *fp;
24 unsigned long sp;
25 unsigned long lr;
26} __attribute__((packed));
27
28/*
29 * Get the return address for a single stackframe and return a pointer to the
30 * next frame tail.
31 */
32static struct frame_tail __user *
33user_backtrace(struct frame_tail __user *tail,
34 struct perf_callchain_entry *entry)
35{
36 struct frame_tail buftail;
37 unsigned long err;
38
39 if (!access_ok(VERIFY_READ, tail, sizeof(buftail)))
40 return NULL;
41
42 pagefault_disable();
43 err = __copy_from_user_inatomic(&buftail, tail, sizeof(buftail));
44 pagefault_enable();
45
46 if (err)
47 return NULL;
48
49 perf_callchain_store(entry, buftail.lr);
50
51 /*
52 * Frame pointers should strictly progress back up the stack
53 * (towards higher addresses).
54 */
55 if (tail + 1 >= buftail.fp)
56 return NULL;
57
58 return buftail.fp - 1;
59}
60
61void
62perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
63{
64 struct frame_tail __user *tail;
65
66 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
67 /* We don't support guest os callchain now */
68 return;
69 }
70
71 perf_callchain_store(entry, regs->ARM_pc);
72
73 if (!current->mm)
74 return;
75
76 tail = (struct frame_tail __user *)regs->ARM_fp - 1;
77
78 while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
79 tail && !((unsigned long)tail & 0x3))
80 tail = user_backtrace(tail, entry);
81}
82
83/*
84 * Gets called by walk_stackframe() for every stackframe. This will be called
85 * whist unwinding the stackframe and is like a subroutine return so we use
86 * the PC.
87 */
88static int
89callchain_trace(struct stackframe *fr,
90 void *data)
91{
92 struct perf_callchain_entry *entry = data;
93 perf_callchain_store(entry, fr->pc);
94 return 0;
95}
96
97void
98perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
99{
100 struct stackframe fr;
101
102 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
103 /* We don't support guest os callchain now */
104 return;
105 }
106
107 arm_get_current_stackframe(regs, &fr);
108 walk_stackframe(&fr, callchain_trace, entry);
109}
110
111unsigned long perf_instruction_pointer(struct pt_regs *regs)
112{
113 if (perf_guest_cbs && perf_guest_cbs->is_in_guest())
114 return perf_guest_cbs->get_guest_ip();
115
116 return instruction_pointer(regs);
117}
118
119unsigned long perf_misc_flags(struct pt_regs *regs)
120{
121 int misc = 0;
122
123 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
124 if (perf_guest_cbs->is_user_mode())
125 misc |= PERF_RECORD_MISC_GUEST_USER;
126 else
127 misc |= PERF_RECORD_MISC_GUEST_KERNEL;
128 } else {
129 if (user_mode(regs))
130 misc |= PERF_RECORD_MISC_USER;
131 else
132 misc |= PERF_RECORD_MISC_KERNEL;
133 }
134
135 return misc;
136}
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 266cba46db3e..e34934f63a49 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -7,21 +7,18 @@
7 * Copyright (C) 2010 ARM Ltd., Will Deacon <will.deacon@arm.com> 7 * Copyright (C) 2010 ARM Ltd., Will Deacon <will.deacon@arm.com>
8 * 8 *
9 * This code is based on the sparc64 perf event code, which is in turn based 9 * This code is based on the sparc64 perf event code, which is in turn based
10 * on the x86 code. Callchain code is based on the ARM OProfile backtrace 10 * on the x86 code.
11 * code.
12 */ 11 */
13#define pr_fmt(fmt) "hw perfevents: " fmt 12#define pr_fmt(fmt) "hw perfevents: " fmt
14 13
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/platform_device.h> 15#include <linux/platform_device.h>
17#include <linux/pm_runtime.h> 16#include <linux/pm_runtime.h>
18#include <linux/uaccess.h>
19#include <linux/irq.h> 17#include <linux/irq.h>
20#include <linux/irqdesc.h> 18#include <linux/irqdesc.h>
21 19
22#include <asm/irq_regs.h> 20#include <asm/irq_regs.h>
23#include <asm/pmu.h> 21#include <asm/pmu.h>
24#include <asm/stacktrace.h>
25 22
26static int 23static int
27armpmu_map_cache_event(const unsigned (*cache_map) 24armpmu_map_cache_event(const unsigned (*cache_map)
@@ -80,8 +77,12 @@ armpmu_map_event(struct perf_event *event,
80 u32 raw_event_mask) 77 u32 raw_event_mask)
81{ 78{
82 u64 config = event->attr.config; 79 u64 config = event->attr.config;
80 int type = event->attr.type;
83 81
84 switch (event->attr.type) { 82 if (type == event->pmu->type)
83 return armpmu_map_raw_event(raw_event_mask, config);
84
85 switch (type) {
85 case PERF_TYPE_HARDWARE: 86 case PERF_TYPE_HARDWARE:
86 return armpmu_map_hw_event(event_map, config); 87 return armpmu_map_hw_event(event_map, config);
87 case PERF_TYPE_HW_CACHE: 88 case PERF_TYPE_HW_CACHE:
@@ -200,7 +201,7 @@ static void
200armpmu_del(struct perf_event *event, int flags) 201armpmu_del(struct perf_event *event, int flags)
201{ 202{
202 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 203 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
203 struct pmu_hw_events *hw_events = armpmu->get_hw_events(); 204 struct pmu_hw_events *hw_events = this_cpu_ptr(armpmu->hw_events);
204 struct hw_perf_event *hwc = &event->hw; 205 struct hw_perf_event *hwc = &event->hw;
205 int idx = hwc->idx; 206 int idx = hwc->idx;
206 207
@@ -217,7 +218,7 @@ static int
217armpmu_add(struct perf_event *event, int flags) 218armpmu_add(struct perf_event *event, int flags)
218{ 219{
219 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 220 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
220 struct pmu_hw_events *hw_events = armpmu->get_hw_events(); 221 struct pmu_hw_events *hw_events = this_cpu_ptr(armpmu->hw_events);
221 struct hw_perf_event *hwc = &event->hw; 222 struct hw_perf_event *hwc = &event->hw;
222 int idx; 223 int idx;
223 int err = 0; 224 int err = 0;
@@ -274,14 +275,12 @@ validate_group(struct perf_event *event)
274{ 275{
275 struct perf_event *sibling, *leader = event->group_leader; 276 struct perf_event *sibling, *leader = event->group_leader;
276 struct pmu_hw_events fake_pmu; 277 struct pmu_hw_events fake_pmu;
277 DECLARE_BITMAP(fake_used_mask, ARMPMU_MAX_HWEVENTS);
278 278
279 /* 279 /*
280 * Initialise the fake PMU. We only need to populate the 280 * Initialise the fake PMU. We only need to populate the
281 * used_mask for the purposes of validation. 281 * used_mask for the purposes of validation.
282 */ 282 */
283 memset(fake_used_mask, 0, sizeof(fake_used_mask)); 283 memset(&fake_pmu.used_mask, 0, sizeof(fake_pmu.used_mask));
284 fake_pmu.used_mask = fake_used_mask;
285 284
286 if (!validate_event(&fake_pmu, leader)) 285 if (!validate_event(&fake_pmu, leader))
287 return -EINVAL; 286 return -EINVAL;
@@ -305,17 +304,21 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void *dev)
305 int ret; 304 int ret;
306 u64 start_clock, finish_clock; 305 u64 start_clock, finish_clock;
307 306
308 if (irq_is_percpu(irq)) 307 /*
309 dev = *(void **)dev; 308 * we request the IRQ with a (possibly percpu) struct arm_pmu**, but
310 armpmu = dev; 309 * the handlers expect a struct arm_pmu*. The percpu_irq framework will
310 * do any necessary shifting, we just need to perform the first
311 * dereference.
312 */
313 armpmu = *(void **)dev;
311 plat_device = armpmu->plat_device; 314 plat_device = armpmu->plat_device;
312 plat = dev_get_platdata(&plat_device->dev); 315 plat = dev_get_platdata(&plat_device->dev);
313 316
314 start_clock = sched_clock(); 317 start_clock = sched_clock();
315 if (plat && plat->handle_irq) 318 if (plat && plat->handle_irq)
316 ret = plat->handle_irq(irq, dev, armpmu->handle_irq); 319 ret = plat->handle_irq(irq, armpmu, armpmu->handle_irq);
317 else 320 else
318 ret = armpmu->handle_irq(irq, dev); 321 ret = armpmu->handle_irq(irq, armpmu);
319 finish_clock = sched_clock(); 322 finish_clock = sched_clock();
320 323
321 perf_sample_event_took(finish_clock - start_clock); 324 perf_sample_event_took(finish_clock - start_clock);
@@ -468,7 +471,7 @@ static int armpmu_event_init(struct perf_event *event)
468static void armpmu_enable(struct pmu *pmu) 471static void armpmu_enable(struct pmu *pmu)
469{ 472{
470 struct arm_pmu *armpmu = to_arm_pmu(pmu); 473 struct arm_pmu *armpmu = to_arm_pmu(pmu);
471 struct pmu_hw_events *hw_events = armpmu->get_hw_events(); 474 struct pmu_hw_events *hw_events = this_cpu_ptr(armpmu->hw_events);
472 int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events); 475 int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events);
473 476
474 if (enabled) 477 if (enabled)
@@ -533,130 +536,3 @@ int armpmu_register(struct arm_pmu *armpmu, int type)
533 return perf_pmu_register(&armpmu->pmu, armpmu->name, type); 536 return perf_pmu_register(&armpmu->pmu, armpmu->name, type);
534} 537}
535 538
536/*
537 * Callchain handling code.
538 */
539
540/*
541 * The registers we're interested in are at the end of the variable
542 * length saved register structure. The fp points at the end of this
543 * structure so the address of this struct is:
544 * (struct frame_tail *)(xxx->fp)-1
545 *
546 * This code has been adapted from the ARM OProfile support.
547 */
548struct frame_tail {
549 struct frame_tail __user *fp;
550 unsigned long sp;
551 unsigned long lr;
552} __attribute__((packed));
553
554/*
555 * Get the return address for a single stackframe and return a pointer to the
556 * next frame tail.
557 */
558static struct frame_tail __user *
559user_backtrace(struct frame_tail __user *tail,
560 struct perf_callchain_entry *entry)
561{
562 struct frame_tail buftail;
563 unsigned long err;
564
565 if (!access_ok(VERIFY_READ, tail, sizeof(buftail)))
566 return NULL;
567
568 pagefault_disable();
569 err = __copy_from_user_inatomic(&buftail, tail, sizeof(buftail));
570 pagefault_enable();
571
572 if (err)
573 return NULL;
574
575 perf_callchain_store(entry, buftail.lr);
576
577 /*
578 * Frame pointers should strictly progress back up the stack
579 * (towards higher addresses).
580 */
581 if (tail + 1 >= buftail.fp)
582 return NULL;
583
584 return buftail.fp - 1;
585}
586
587void
588perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
589{
590 struct frame_tail __user *tail;
591
592 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
593 /* We don't support guest os callchain now */
594 return;
595 }
596
597 perf_callchain_store(entry, regs->ARM_pc);
598
599 if (!current->mm)
600 return;
601
602 tail = (struct frame_tail __user *)regs->ARM_fp - 1;
603
604 while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
605 tail && !((unsigned long)tail & 0x3))
606 tail = user_backtrace(tail, entry);
607}
608
609/*
610 * Gets called by walk_stackframe() for every stackframe. This will be called
611 * whist unwinding the stackframe and is like a subroutine return so we use
612 * the PC.
613 */
614static int
615callchain_trace(struct stackframe *fr,
616 void *data)
617{
618 struct perf_callchain_entry *entry = data;
619 perf_callchain_store(entry, fr->pc);
620 return 0;
621}
622
623void
624perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
625{
626 struct stackframe fr;
627
628 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
629 /* We don't support guest os callchain now */
630 return;
631 }
632
633 arm_get_current_stackframe(regs, &fr);
634 walk_stackframe(&fr, callchain_trace, entry);
635}
636
637unsigned long perf_instruction_pointer(struct pt_regs *regs)
638{
639 if (perf_guest_cbs && perf_guest_cbs->is_in_guest())
640 return perf_guest_cbs->get_guest_ip();
641
642 return instruction_pointer(regs);
643}
644
645unsigned long perf_misc_flags(struct pt_regs *regs)
646{
647 int misc = 0;
648
649 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
650 if (perf_guest_cbs->is_user_mode())
651 misc |= PERF_RECORD_MISC_GUEST_USER;
652 else
653 misc |= PERF_RECORD_MISC_GUEST_KERNEL;
654 } else {
655 if (user_mode(regs))
656 misc |= PERF_RECORD_MISC_USER;
657 else
658 misc |= PERF_RECORD_MISC_KERNEL;
659 }
660
661 return misc;
662}
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index eb2c4d55666b..dd9acc95ebc0 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -35,11 +35,6 @@
35/* Set at runtime when we know what CPU type we are. */ 35/* Set at runtime when we know what CPU type we are. */
36static struct arm_pmu *cpu_pmu; 36static struct arm_pmu *cpu_pmu;
37 37
38static DEFINE_PER_CPU(struct arm_pmu *, percpu_pmu);
39static DEFINE_PER_CPU(struct perf_event * [ARMPMU_MAX_HWEVENTS], hw_events);
40static DEFINE_PER_CPU(unsigned long [BITS_TO_LONGS(ARMPMU_MAX_HWEVENTS)], used_mask);
41static DEFINE_PER_CPU(struct pmu_hw_events, cpu_hw_events);
42
43/* 38/*
44 * Despite the names, these two functions are CPU-specific and are used 39 * Despite the names, these two functions are CPU-specific and are used
45 * by the OProfile/perf code. 40 * by the OProfile/perf code.
@@ -69,11 +64,6 @@ EXPORT_SYMBOL_GPL(perf_num_counters);
69#include "perf_event_v6.c" 64#include "perf_event_v6.c"
70#include "perf_event_v7.c" 65#include "perf_event_v7.c"
71 66
72static struct pmu_hw_events *cpu_pmu_get_cpu_events(void)
73{
74 return this_cpu_ptr(&cpu_hw_events);
75}
76
77static void cpu_pmu_enable_percpu_irq(void *data) 67static void cpu_pmu_enable_percpu_irq(void *data)
78{ 68{
79 int irq = *(int *)data; 69 int irq = *(int *)data;
@@ -92,20 +82,21 @@ static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
92{ 82{
93 int i, irq, irqs; 83 int i, irq, irqs;
94 struct platform_device *pmu_device = cpu_pmu->plat_device; 84 struct platform_device *pmu_device = cpu_pmu->plat_device;
85 struct pmu_hw_events __percpu *hw_events = cpu_pmu->hw_events;
95 86
96 irqs = min(pmu_device->num_resources, num_possible_cpus()); 87 irqs = min(pmu_device->num_resources, num_possible_cpus());
97 88
98 irq = platform_get_irq(pmu_device, 0); 89 irq = platform_get_irq(pmu_device, 0);
99 if (irq >= 0 && irq_is_percpu(irq)) { 90 if (irq >= 0 && irq_is_percpu(irq)) {
100 on_each_cpu(cpu_pmu_disable_percpu_irq, &irq, 1); 91 on_each_cpu(cpu_pmu_disable_percpu_irq, &irq, 1);
101 free_percpu_irq(irq, &percpu_pmu); 92 free_percpu_irq(irq, &hw_events->percpu_pmu);
102 } else { 93 } else {
103 for (i = 0; i < irqs; ++i) { 94 for (i = 0; i < irqs; ++i) {
104 if (!cpumask_test_and_clear_cpu(i, &cpu_pmu->active_irqs)) 95 if (!cpumask_test_and_clear_cpu(i, &cpu_pmu->active_irqs))
105 continue; 96 continue;
106 irq = platform_get_irq(pmu_device, i); 97 irq = platform_get_irq(pmu_device, i);
107 if (irq >= 0) 98 if (irq >= 0)
108 free_irq(irq, cpu_pmu); 99 free_irq(irq, per_cpu_ptr(&hw_events->percpu_pmu, i));
109 } 100 }
110 } 101 }
111} 102}
@@ -114,19 +105,21 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
114{ 105{
115 int i, err, irq, irqs; 106 int i, err, irq, irqs;
116 struct platform_device *pmu_device = cpu_pmu->plat_device; 107 struct platform_device *pmu_device = cpu_pmu->plat_device;
108 struct pmu_hw_events __percpu *hw_events = cpu_pmu->hw_events;
117 109
118 if (!pmu_device) 110 if (!pmu_device)
119 return -ENODEV; 111 return -ENODEV;
120 112
121 irqs = min(pmu_device->num_resources, num_possible_cpus()); 113 irqs = min(pmu_device->num_resources, num_possible_cpus());
122 if (irqs < 1) { 114 if (irqs < 1) {
123 printk_once("perf/ARM: No irqs for PMU defined, sampling events not supported\n"); 115 pr_warn_once("perf/ARM: No irqs for PMU defined, sampling events not supported\n");
124 return 0; 116 return 0;
125 } 117 }
126 118
127 irq = platform_get_irq(pmu_device, 0); 119 irq = platform_get_irq(pmu_device, 0);
128 if (irq >= 0 && irq_is_percpu(irq)) { 120 if (irq >= 0 && irq_is_percpu(irq)) {
129 err = request_percpu_irq(irq, handler, "arm-pmu", &percpu_pmu); 121 err = request_percpu_irq(irq, handler, "arm-pmu",
122 &hw_events->percpu_pmu);
130 if (err) { 123 if (err) {
131 pr_err("unable to request IRQ%d for ARM PMU counters\n", 124 pr_err("unable to request IRQ%d for ARM PMU counters\n",
132 irq); 125 irq);
@@ -153,7 +146,7 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
153 146
154 err = request_irq(irq, handler, 147 err = request_irq(irq, handler,
155 IRQF_NOBALANCING | IRQF_NO_THREAD, "arm-pmu", 148 IRQF_NOBALANCING | IRQF_NO_THREAD, "arm-pmu",
156 cpu_pmu); 149 per_cpu_ptr(&hw_events->percpu_pmu, i));
157 if (err) { 150 if (err) {
158 pr_err("unable to request IRQ%d for ARM PMU counters\n", 151 pr_err("unable to request IRQ%d for ARM PMU counters\n",
159 irq); 152 irq);
@@ -167,18 +160,50 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
167 return 0; 160 return 0;
168} 161}
169 162
170static void cpu_pmu_init(struct arm_pmu *cpu_pmu) 163/*
164 * PMU hardware loses all context when a CPU goes offline.
165 * When a CPU is hotplugged back in, since some hardware registers are
166 * UNKNOWN at reset, the PMU must be explicitly reset to avoid reading
167 * junk values out of them.
168 */
169static int cpu_pmu_notify(struct notifier_block *b, unsigned long action,
170 void *hcpu)
171{
172 struct arm_pmu *pmu = container_of(b, struct arm_pmu, hotplug_nb);
173
174 if ((action & ~CPU_TASKS_FROZEN) != CPU_STARTING)
175 return NOTIFY_DONE;
176
177 if (pmu->reset)
178 pmu->reset(pmu);
179 else
180 return NOTIFY_DONE;
181
182 return NOTIFY_OK;
183}
184
185static int cpu_pmu_init(struct arm_pmu *cpu_pmu)
171{ 186{
187 int err;
172 int cpu; 188 int cpu;
189 struct pmu_hw_events __percpu *cpu_hw_events;
190
191 cpu_hw_events = alloc_percpu(struct pmu_hw_events);
192 if (!cpu_hw_events)
193 return -ENOMEM;
194
195 cpu_pmu->hotplug_nb.notifier_call = cpu_pmu_notify;
196 err = register_cpu_notifier(&cpu_pmu->hotplug_nb);
197 if (err)
198 goto out_hw_events;
199
173 for_each_possible_cpu(cpu) { 200 for_each_possible_cpu(cpu) {
174 struct pmu_hw_events *events = &per_cpu(cpu_hw_events, cpu); 201 struct pmu_hw_events *events = per_cpu_ptr(cpu_hw_events, cpu);
175 events->events = per_cpu(hw_events, cpu);
176 events->used_mask = per_cpu(used_mask, cpu);
177 raw_spin_lock_init(&events->pmu_lock); 202 raw_spin_lock_init(&events->pmu_lock);
178 per_cpu(percpu_pmu, cpu) = cpu_pmu; 203 events->percpu_pmu = cpu_pmu;
179 } 204 }
180 205
181 cpu_pmu->get_hw_events = cpu_pmu_get_cpu_events; 206 cpu_pmu->hw_events = cpu_hw_events;
182 cpu_pmu->request_irq = cpu_pmu_request_irq; 207 cpu_pmu->request_irq = cpu_pmu_request_irq;
183 cpu_pmu->free_irq = cpu_pmu_free_irq; 208 cpu_pmu->free_irq = cpu_pmu_free_irq;
184 209
@@ -189,31 +214,19 @@ static void cpu_pmu_init(struct arm_pmu *cpu_pmu)
189 /* If no interrupts available, set the corresponding capability flag */ 214 /* If no interrupts available, set the corresponding capability flag */
190 if (!platform_get_irq(cpu_pmu->plat_device, 0)) 215 if (!platform_get_irq(cpu_pmu->plat_device, 0))
191 cpu_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; 216 cpu_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
192}
193
194/*
195 * PMU hardware loses all context when a CPU goes offline.
196 * When a CPU is hotplugged back in, since some hardware registers are
197 * UNKNOWN at reset, the PMU must be explicitly reset to avoid reading
198 * junk values out of them.
199 */
200static int cpu_pmu_notify(struct notifier_block *b, unsigned long action,
201 void *hcpu)
202{
203 if ((action & ~CPU_TASKS_FROZEN) != CPU_STARTING)
204 return NOTIFY_DONE;
205 217
206 if (cpu_pmu && cpu_pmu->reset) 218 return 0;
207 cpu_pmu->reset(cpu_pmu);
208 else
209 return NOTIFY_DONE;
210 219
211 return NOTIFY_OK; 220out_hw_events:
221 free_percpu(cpu_hw_events);
222 return err;
212} 223}
213 224
214static struct notifier_block cpu_pmu_hotplug_notifier = { 225static void cpu_pmu_destroy(struct arm_pmu *cpu_pmu)
215 .notifier_call = cpu_pmu_notify, 226{
216}; 227 unregister_cpu_notifier(&cpu_pmu->hotplug_nb);
228 free_percpu(cpu_pmu->hw_events);
229}
217 230
218/* 231/*
219 * PMU platform driver and devicetree bindings. 232 * PMU platform driver and devicetree bindings.
@@ -241,48 +254,34 @@ static struct platform_device_id cpu_pmu_plat_device_ids[] = {
241 {}, 254 {},
242}; 255};
243 256
257static const struct pmu_probe_info pmu_probe_table[] = {
258 ARM_PMU_PROBE(ARM_CPU_PART_ARM1136, armv6_1136_pmu_init),
259 ARM_PMU_PROBE(ARM_CPU_PART_ARM1156, armv6_1156_pmu_init),
260 ARM_PMU_PROBE(ARM_CPU_PART_ARM1176, armv6_1176_pmu_init),
261 ARM_PMU_PROBE(ARM_CPU_PART_ARM11MPCORE, armv6mpcore_pmu_init),
262 ARM_PMU_PROBE(ARM_CPU_PART_CORTEX_A8, armv7_a8_pmu_init),
263 ARM_PMU_PROBE(ARM_CPU_PART_CORTEX_A9, armv7_a9_pmu_init),
264 XSCALE_PMU_PROBE(ARM_CPU_XSCALE_ARCH_V1, xscale1pmu_init),
265 XSCALE_PMU_PROBE(ARM_CPU_XSCALE_ARCH_V2, xscale2pmu_init),
266 { /* sentinel value */ }
267};
268
244/* 269/*
245 * CPU PMU identification and probing. 270 * CPU PMU identification and probing.
246 */ 271 */
247static int probe_current_pmu(struct arm_pmu *pmu) 272static int probe_current_pmu(struct arm_pmu *pmu)
248{ 273{
249 int cpu = get_cpu(); 274 int cpu = get_cpu();
275 unsigned int cpuid = read_cpuid_id();
250 int ret = -ENODEV; 276 int ret = -ENODEV;
277 const struct pmu_probe_info *info;
251 278
252 pr_info("probing PMU on CPU %d\n", cpu); 279 pr_info("probing PMU on CPU %d\n", cpu);
253 280
254 switch (read_cpuid_part()) { 281 for (info = pmu_probe_table; info->init != NULL; info++) {
255 /* ARM Ltd CPUs. */ 282 if ((cpuid & info->mask) != info->cpuid)
256 case ARM_CPU_PART_ARM1136: 283 continue;
257 ret = armv6_1136_pmu_init(pmu); 284 ret = info->init(pmu);
258 break;
259 case ARM_CPU_PART_ARM1156:
260 ret = armv6_1156_pmu_init(pmu);
261 break;
262 case ARM_CPU_PART_ARM1176:
263 ret = armv6_1176_pmu_init(pmu);
264 break;
265 case ARM_CPU_PART_ARM11MPCORE:
266 ret = armv6mpcore_pmu_init(pmu);
267 break;
268 case ARM_CPU_PART_CORTEX_A8:
269 ret = armv7_a8_pmu_init(pmu);
270 break;
271 case ARM_CPU_PART_CORTEX_A9:
272 ret = armv7_a9_pmu_init(pmu);
273 break;
274
275 default:
276 if (read_cpuid_implementor() == ARM_CPU_IMP_INTEL) {
277 switch (xscale_cpu_arch_version()) {
278 case ARM_CPU_XSCALE_ARCH_V1:
279 ret = xscale1pmu_init(pmu);
280 break;
281 case ARM_CPU_XSCALE_ARCH_V2:
282 ret = xscale2pmu_init(pmu);
283 break;
284 }
285 }
286 break; 285 break;
287 } 286 }
288 287
@@ -299,13 +298,13 @@ static int cpu_pmu_device_probe(struct platform_device *pdev)
299 int ret = -ENODEV; 298 int ret = -ENODEV;
300 299
301 if (cpu_pmu) { 300 if (cpu_pmu) {
302 pr_info("attempt to register multiple PMU devices!"); 301 pr_info("attempt to register multiple PMU devices!\n");
303 return -ENOSPC; 302 return -ENOSPC;
304 } 303 }
305 304
306 pmu = kzalloc(sizeof(struct arm_pmu), GFP_KERNEL); 305 pmu = kzalloc(sizeof(struct arm_pmu), GFP_KERNEL);
307 if (!pmu) { 306 if (!pmu) {
308 pr_info("failed to allocate PMU device!"); 307 pr_info("failed to allocate PMU device!\n");
309 return -ENOMEM; 308 return -ENOMEM;
310 } 309 }
311 310
@@ -320,18 +319,24 @@ static int cpu_pmu_device_probe(struct platform_device *pdev)
320 } 319 }
321 320
322 if (ret) { 321 if (ret) {
323 pr_info("failed to probe PMU!"); 322 pr_info("failed to probe PMU!\n");
324 goto out_free; 323 goto out_free;
325 } 324 }
326 325
327 cpu_pmu_init(cpu_pmu); 326 ret = cpu_pmu_init(cpu_pmu);
328 ret = armpmu_register(cpu_pmu, PERF_TYPE_RAW); 327 if (ret)
328 goto out_free;
329 329
330 if (!ret) 330 ret = armpmu_register(cpu_pmu, -1);
331 return 0; 331 if (ret)
332 goto out_destroy;
332 333
334 return 0;
335
336out_destroy:
337 cpu_pmu_destroy(cpu_pmu);
333out_free: 338out_free:
334 pr_info("failed to register PMU devices!"); 339 pr_info("failed to register PMU devices!\n");
335 kfree(pmu); 340 kfree(pmu);
336 return ret; 341 return ret;
337} 342}
@@ -348,16 +353,6 @@ static struct platform_driver cpu_pmu_driver = {
348 353
349static int __init register_pmu_driver(void) 354static int __init register_pmu_driver(void)
350{ 355{
351 int err; 356 return platform_driver_register(&cpu_pmu_driver);
352
353 err = register_cpu_notifier(&cpu_pmu_hotplug_notifier);
354 if (err)
355 return err;
356
357 err = platform_driver_register(&cpu_pmu_driver);
358 if (err)
359 unregister_cpu_notifier(&cpu_pmu_hotplug_notifier);
360
361 return err;
362} 357}
363device_initcall(register_pmu_driver); 358device_initcall(register_pmu_driver);
diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c
index abfeb04f3213..f2ffd5c542ed 100644
--- a/arch/arm/kernel/perf_event_v6.c
+++ b/arch/arm/kernel/perf_event_v6.c
@@ -262,7 +262,7 @@ static void armv6pmu_enable_event(struct perf_event *event)
262 unsigned long val, mask, evt, flags; 262 unsigned long val, mask, evt, flags;
263 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 263 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
264 struct hw_perf_event *hwc = &event->hw; 264 struct hw_perf_event *hwc = &event->hw;
265 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 265 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
266 int idx = hwc->idx; 266 int idx = hwc->idx;
267 267
268 if (ARMV6_CYCLE_COUNTER == idx) { 268 if (ARMV6_CYCLE_COUNTER == idx) {
@@ -300,7 +300,7 @@ armv6pmu_handle_irq(int irq_num,
300 unsigned long pmcr = armv6_pmcr_read(); 300 unsigned long pmcr = armv6_pmcr_read();
301 struct perf_sample_data data; 301 struct perf_sample_data data;
302 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; 302 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
303 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events(); 303 struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events);
304 struct pt_regs *regs; 304 struct pt_regs *regs;
305 int idx; 305 int idx;
306 306
@@ -356,7 +356,7 @@ armv6pmu_handle_irq(int irq_num,
356static void armv6pmu_start(struct arm_pmu *cpu_pmu) 356static void armv6pmu_start(struct arm_pmu *cpu_pmu)
357{ 357{
358 unsigned long flags, val; 358 unsigned long flags, val;
359 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 359 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
360 360
361 raw_spin_lock_irqsave(&events->pmu_lock, flags); 361 raw_spin_lock_irqsave(&events->pmu_lock, flags);
362 val = armv6_pmcr_read(); 362 val = armv6_pmcr_read();
@@ -368,7 +368,7 @@ static void armv6pmu_start(struct arm_pmu *cpu_pmu)
368static void armv6pmu_stop(struct arm_pmu *cpu_pmu) 368static void armv6pmu_stop(struct arm_pmu *cpu_pmu)
369{ 369{
370 unsigned long flags, val; 370 unsigned long flags, val;
371 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 371 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
372 372
373 raw_spin_lock_irqsave(&events->pmu_lock, flags); 373 raw_spin_lock_irqsave(&events->pmu_lock, flags);
374 val = armv6_pmcr_read(); 374 val = armv6_pmcr_read();
@@ -409,7 +409,7 @@ static void armv6pmu_disable_event(struct perf_event *event)
409 unsigned long val, mask, evt, flags; 409 unsigned long val, mask, evt, flags;
410 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 410 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
411 struct hw_perf_event *hwc = &event->hw; 411 struct hw_perf_event *hwc = &event->hw;
412 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 412 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
413 int idx = hwc->idx; 413 int idx = hwc->idx;
414 414
415 if (ARMV6_CYCLE_COUNTER == idx) { 415 if (ARMV6_CYCLE_COUNTER == idx) {
@@ -444,7 +444,7 @@ static void armv6mpcore_pmu_disable_event(struct perf_event *event)
444 unsigned long val, mask, flags, evt = 0; 444 unsigned long val, mask, flags, evt = 0;
445 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 445 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
446 struct hw_perf_event *hwc = &event->hw; 446 struct hw_perf_event *hwc = &event->hw;
447 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 447 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
448 int idx = hwc->idx; 448 int idx = hwc->idx;
449 449
450 if (ARMV6_CYCLE_COUNTER == idx) { 450 if (ARMV6_CYCLE_COUNTER == idx) {
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 116758b77f93..8993770c47de 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -564,13 +564,11 @@ static inline int armv7_pmnc_counter_has_overflowed(u32 pmnc, int idx)
564 return pmnc & BIT(ARMV7_IDX_TO_COUNTER(idx)); 564 return pmnc & BIT(ARMV7_IDX_TO_COUNTER(idx));
565} 565}
566 566
567static inline int armv7_pmnc_select_counter(int idx) 567static inline void armv7_pmnc_select_counter(int idx)
568{ 568{
569 u32 counter = ARMV7_IDX_TO_COUNTER(idx); 569 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
570 asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter)); 570 asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter));
571 isb(); 571 isb();
572
573 return idx;
574} 572}
575 573
576static inline u32 armv7pmu_read_counter(struct perf_event *event) 574static inline u32 armv7pmu_read_counter(struct perf_event *event)
@@ -580,13 +578,15 @@ static inline u32 armv7pmu_read_counter(struct perf_event *event)
580 int idx = hwc->idx; 578 int idx = hwc->idx;
581 u32 value = 0; 579 u32 value = 0;
582 580
583 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) 581 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
584 pr_err("CPU%u reading wrong counter %d\n", 582 pr_err("CPU%u reading wrong counter %d\n",
585 smp_processor_id(), idx); 583 smp_processor_id(), idx);
586 else if (idx == ARMV7_IDX_CYCLE_COUNTER) 584 } else if (idx == ARMV7_IDX_CYCLE_COUNTER) {
587 asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (value)); 585 asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (value));
588 else if (armv7_pmnc_select_counter(idx) == idx) 586 } else {
587 armv7_pmnc_select_counter(idx);
589 asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (value)); 588 asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (value));
589 }
590 590
591 return value; 591 return value;
592} 592}
@@ -597,45 +597,43 @@ static inline void armv7pmu_write_counter(struct perf_event *event, u32 value)
597 struct hw_perf_event *hwc = &event->hw; 597 struct hw_perf_event *hwc = &event->hw;
598 int idx = hwc->idx; 598 int idx = hwc->idx;
599 599
600 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) 600 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
601 pr_err("CPU%u writing wrong counter %d\n", 601 pr_err("CPU%u writing wrong counter %d\n",
602 smp_processor_id(), idx); 602 smp_processor_id(), idx);
603 else if (idx == ARMV7_IDX_CYCLE_COUNTER) 603 } else if (idx == ARMV7_IDX_CYCLE_COUNTER) {
604 asm volatile("mcr p15, 0, %0, c9, c13, 0" : : "r" (value)); 604 asm volatile("mcr p15, 0, %0, c9, c13, 0" : : "r" (value));
605 else if (armv7_pmnc_select_counter(idx) == idx) 605 } else {
606 armv7_pmnc_select_counter(idx);
606 asm volatile("mcr p15, 0, %0, c9, c13, 2" : : "r" (value)); 607 asm volatile("mcr p15, 0, %0, c9, c13, 2" : : "r" (value));
608 }
607} 609}
608 610
609static inline void armv7_pmnc_write_evtsel(int idx, u32 val) 611static inline void armv7_pmnc_write_evtsel(int idx, u32 val)
610{ 612{
611 if (armv7_pmnc_select_counter(idx) == idx) { 613 armv7_pmnc_select_counter(idx);
612 val &= ARMV7_EVTYPE_MASK; 614 val &= ARMV7_EVTYPE_MASK;
613 asm volatile("mcr p15, 0, %0, c9, c13, 1" : : "r" (val)); 615 asm volatile("mcr p15, 0, %0, c9, c13, 1" : : "r" (val));
614 }
615} 616}
616 617
617static inline int armv7_pmnc_enable_counter(int idx) 618static inline void armv7_pmnc_enable_counter(int idx)
618{ 619{
619 u32 counter = ARMV7_IDX_TO_COUNTER(idx); 620 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
620 asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (BIT(counter))); 621 asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (BIT(counter)));
621 return idx;
622} 622}
623 623
624static inline int armv7_pmnc_disable_counter(int idx) 624static inline void armv7_pmnc_disable_counter(int idx)
625{ 625{
626 u32 counter = ARMV7_IDX_TO_COUNTER(idx); 626 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
627 asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (BIT(counter))); 627 asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (BIT(counter)));
628 return idx;
629} 628}
630 629
631static inline int armv7_pmnc_enable_intens(int idx) 630static inline void armv7_pmnc_enable_intens(int idx)
632{ 631{
633 u32 counter = ARMV7_IDX_TO_COUNTER(idx); 632 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
634 asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (BIT(counter))); 633 asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (BIT(counter)));
635 return idx;
636} 634}
637 635
638static inline int armv7_pmnc_disable_intens(int idx) 636static inline void armv7_pmnc_disable_intens(int idx)
639{ 637{
640 u32 counter = ARMV7_IDX_TO_COUNTER(idx); 638 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
641 asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (BIT(counter))); 639 asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (BIT(counter)));
@@ -643,8 +641,6 @@ static inline int armv7_pmnc_disable_intens(int idx)
643 /* Clear the overflow flag in case an interrupt is pending. */ 641 /* Clear the overflow flag in case an interrupt is pending. */
644 asm volatile("mcr p15, 0, %0, c9, c12, 3" : : "r" (BIT(counter))); 642 asm volatile("mcr p15, 0, %0, c9, c12, 3" : : "r" (BIT(counter)));
645 isb(); 643 isb();
646
647 return idx;
648} 644}
649 645
650static inline u32 armv7_pmnc_getreset_flags(void) 646static inline u32 armv7_pmnc_getreset_flags(void)
@@ -667,34 +663,34 @@ static void armv7_pmnc_dump_regs(struct arm_pmu *cpu_pmu)
667 u32 val; 663 u32 val;
668 unsigned int cnt; 664 unsigned int cnt;
669 665
670 printk(KERN_INFO "PMNC registers dump:\n"); 666 pr_info("PMNC registers dump:\n");
671 667
672 asm volatile("mrc p15, 0, %0, c9, c12, 0" : "=r" (val)); 668 asm volatile("mrc p15, 0, %0, c9, c12, 0" : "=r" (val));
673 printk(KERN_INFO "PMNC =0x%08x\n", val); 669 pr_info("PMNC =0x%08x\n", val);
674 670
675 asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r" (val)); 671 asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r" (val));
676 printk(KERN_INFO "CNTENS=0x%08x\n", val); 672 pr_info("CNTENS=0x%08x\n", val);
677 673
678 asm volatile("mrc p15, 0, %0, c9, c14, 1" : "=r" (val)); 674 asm volatile("mrc p15, 0, %0, c9, c14, 1" : "=r" (val));
679 printk(KERN_INFO "INTENS=0x%08x\n", val); 675 pr_info("INTENS=0x%08x\n", val);
680 676
681 asm volatile("mrc p15, 0, %0, c9, c12, 3" : "=r" (val)); 677 asm volatile("mrc p15, 0, %0, c9, c12, 3" : "=r" (val));
682 printk(KERN_INFO "FLAGS =0x%08x\n", val); 678 pr_info("FLAGS =0x%08x\n", val);
683 679
684 asm volatile("mrc p15, 0, %0, c9, c12, 5" : "=r" (val)); 680 asm volatile("mrc p15, 0, %0, c9, c12, 5" : "=r" (val));
685 printk(KERN_INFO "SELECT=0x%08x\n", val); 681 pr_info("SELECT=0x%08x\n", val);
686 682
687 asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (val)); 683 asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (val));
688 printk(KERN_INFO "CCNT =0x%08x\n", val); 684 pr_info("CCNT =0x%08x\n", val);
689 685
690 for (cnt = ARMV7_IDX_COUNTER0; 686 for (cnt = ARMV7_IDX_COUNTER0;
691 cnt <= ARMV7_IDX_COUNTER_LAST(cpu_pmu); cnt++) { 687 cnt <= ARMV7_IDX_COUNTER_LAST(cpu_pmu); cnt++) {
692 armv7_pmnc_select_counter(cnt); 688 armv7_pmnc_select_counter(cnt);
693 asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (val)); 689 asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (val));
694 printk(KERN_INFO "CNT[%d] count =0x%08x\n", 690 pr_info("CNT[%d] count =0x%08x\n",
695 ARMV7_IDX_TO_COUNTER(cnt), val); 691 ARMV7_IDX_TO_COUNTER(cnt), val);
696 asm volatile("mrc p15, 0, %0, c9, c13, 1" : "=r" (val)); 692 asm volatile("mrc p15, 0, %0, c9, c13, 1" : "=r" (val));
697 printk(KERN_INFO "CNT[%d] evtsel=0x%08x\n", 693 pr_info("CNT[%d] evtsel=0x%08x\n",
698 ARMV7_IDX_TO_COUNTER(cnt), val); 694 ARMV7_IDX_TO_COUNTER(cnt), val);
699 } 695 }
700} 696}
@@ -705,7 +701,7 @@ static void armv7pmu_enable_event(struct perf_event *event)
705 unsigned long flags; 701 unsigned long flags;
706 struct hw_perf_event *hwc = &event->hw; 702 struct hw_perf_event *hwc = &event->hw;
707 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 703 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
708 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 704 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
709 int idx = hwc->idx; 705 int idx = hwc->idx;
710 706
711 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) { 707 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
@@ -751,7 +747,7 @@ static void armv7pmu_disable_event(struct perf_event *event)
751 unsigned long flags; 747 unsigned long flags;
752 struct hw_perf_event *hwc = &event->hw; 748 struct hw_perf_event *hwc = &event->hw;
753 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 749 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
754 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 750 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
755 int idx = hwc->idx; 751 int idx = hwc->idx;
756 752
757 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) { 753 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
@@ -783,7 +779,7 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
783 u32 pmnc; 779 u32 pmnc;
784 struct perf_sample_data data; 780 struct perf_sample_data data;
785 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; 781 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
786 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events(); 782 struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events);
787 struct pt_regs *regs; 783 struct pt_regs *regs;
788 int idx; 784 int idx;
789 785
@@ -843,7 +839,7 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
843static void armv7pmu_start(struct arm_pmu *cpu_pmu) 839static void armv7pmu_start(struct arm_pmu *cpu_pmu)
844{ 840{
845 unsigned long flags; 841 unsigned long flags;
846 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 842 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
847 843
848 raw_spin_lock_irqsave(&events->pmu_lock, flags); 844 raw_spin_lock_irqsave(&events->pmu_lock, flags);
849 /* Enable all counters */ 845 /* Enable all counters */
@@ -854,7 +850,7 @@ static void armv7pmu_start(struct arm_pmu *cpu_pmu)
854static void armv7pmu_stop(struct arm_pmu *cpu_pmu) 850static void armv7pmu_stop(struct arm_pmu *cpu_pmu)
855{ 851{
856 unsigned long flags; 852 unsigned long flags;
857 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 853 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
858 854
859 raw_spin_lock_irqsave(&events->pmu_lock, flags); 855 raw_spin_lock_irqsave(&events->pmu_lock, flags);
860 /* Disable all counters */ 856 /* Disable all counters */
@@ -1287,7 +1283,7 @@ static void krait_pmu_disable_event(struct perf_event *event)
1287 struct hw_perf_event *hwc = &event->hw; 1283 struct hw_perf_event *hwc = &event->hw;
1288 int idx = hwc->idx; 1284 int idx = hwc->idx;
1289 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 1285 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
1290 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1286 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
1291 1287
1292 /* Disable counter and interrupt */ 1288 /* Disable counter and interrupt */
1293 raw_spin_lock_irqsave(&events->pmu_lock, flags); 1289 raw_spin_lock_irqsave(&events->pmu_lock, flags);
@@ -1313,7 +1309,7 @@ static void krait_pmu_enable_event(struct perf_event *event)
1313 struct hw_perf_event *hwc = &event->hw; 1309 struct hw_perf_event *hwc = &event->hw;
1314 int idx = hwc->idx; 1310 int idx = hwc->idx;
1315 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 1311 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
1316 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1312 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
1317 1313
1318 /* 1314 /*
1319 * Enable counter and interrupt, and set the counter to count 1315 * Enable counter and interrupt, and set the counter to count
diff --git a/arch/arm/kernel/perf_event_xscale.c b/arch/arm/kernel/perf_event_xscale.c
index 08da0af550b7..8af9f1f82c68 100644
--- a/arch/arm/kernel/perf_event_xscale.c
+++ b/arch/arm/kernel/perf_event_xscale.c
@@ -138,7 +138,7 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
138 unsigned long pmnc; 138 unsigned long pmnc;
139 struct perf_sample_data data; 139 struct perf_sample_data data;
140 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; 140 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
141 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events(); 141 struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events);
142 struct pt_regs *regs; 142 struct pt_regs *regs;
143 int idx; 143 int idx;
144 144
@@ -198,7 +198,7 @@ static void xscale1pmu_enable_event(struct perf_event *event)
198 unsigned long val, mask, evt, flags; 198 unsigned long val, mask, evt, flags;
199 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 199 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
200 struct hw_perf_event *hwc = &event->hw; 200 struct hw_perf_event *hwc = &event->hw;
201 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 201 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
202 int idx = hwc->idx; 202 int idx = hwc->idx;
203 203
204 switch (idx) { 204 switch (idx) {
@@ -234,7 +234,7 @@ static void xscale1pmu_disable_event(struct perf_event *event)
234 unsigned long val, mask, evt, flags; 234 unsigned long val, mask, evt, flags;
235 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 235 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
236 struct hw_perf_event *hwc = &event->hw; 236 struct hw_perf_event *hwc = &event->hw;
237 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 237 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
238 int idx = hwc->idx; 238 int idx = hwc->idx;
239 239
240 switch (idx) { 240 switch (idx) {
@@ -287,7 +287,7 @@ xscale1pmu_get_event_idx(struct pmu_hw_events *cpuc,
287static void xscale1pmu_start(struct arm_pmu *cpu_pmu) 287static void xscale1pmu_start(struct arm_pmu *cpu_pmu)
288{ 288{
289 unsigned long flags, val; 289 unsigned long flags, val;
290 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 290 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
291 291
292 raw_spin_lock_irqsave(&events->pmu_lock, flags); 292 raw_spin_lock_irqsave(&events->pmu_lock, flags);
293 val = xscale1pmu_read_pmnc(); 293 val = xscale1pmu_read_pmnc();
@@ -299,7 +299,7 @@ static void xscale1pmu_start(struct arm_pmu *cpu_pmu)
299static void xscale1pmu_stop(struct arm_pmu *cpu_pmu) 299static void xscale1pmu_stop(struct arm_pmu *cpu_pmu)
300{ 300{
301 unsigned long flags, val; 301 unsigned long flags, val;
302 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 302 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
303 303
304 raw_spin_lock_irqsave(&events->pmu_lock, flags); 304 raw_spin_lock_irqsave(&events->pmu_lock, flags);
305 val = xscale1pmu_read_pmnc(); 305 val = xscale1pmu_read_pmnc();
@@ -485,7 +485,7 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
485 unsigned long pmnc, of_flags; 485 unsigned long pmnc, of_flags;
486 struct perf_sample_data data; 486 struct perf_sample_data data;
487 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev; 487 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
488 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events(); 488 struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events);
489 struct pt_regs *regs; 489 struct pt_regs *regs;
490 int idx; 490 int idx;
491 491
@@ -539,7 +539,7 @@ static void xscale2pmu_enable_event(struct perf_event *event)
539 unsigned long flags, ien, evtsel; 539 unsigned long flags, ien, evtsel;
540 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 540 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
541 struct hw_perf_event *hwc = &event->hw; 541 struct hw_perf_event *hwc = &event->hw;
542 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 542 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
543 int idx = hwc->idx; 543 int idx = hwc->idx;
544 544
545 ien = xscale2pmu_read_int_enable(); 545 ien = xscale2pmu_read_int_enable();
@@ -585,7 +585,7 @@ static void xscale2pmu_disable_event(struct perf_event *event)
585 unsigned long flags, ien, evtsel, of_flags; 585 unsigned long flags, ien, evtsel, of_flags;
586 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); 586 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
587 struct hw_perf_event *hwc = &event->hw; 587 struct hw_perf_event *hwc = &event->hw;
588 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 588 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
589 int idx = hwc->idx; 589 int idx = hwc->idx;
590 590
591 ien = xscale2pmu_read_int_enable(); 591 ien = xscale2pmu_read_int_enable();
@@ -651,7 +651,7 @@ out:
651static void xscale2pmu_start(struct arm_pmu *cpu_pmu) 651static void xscale2pmu_start(struct arm_pmu *cpu_pmu)
652{ 652{
653 unsigned long flags, val; 653 unsigned long flags, val;
654 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 654 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
655 655
656 raw_spin_lock_irqsave(&events->pmu_lock, flags); 656 raw_spin_lock_irqsave(&events->pmu_lock, flags);
657 val = xscale2pmu_read_pmnc() & ~XSCALE_PMU_CNT64; 657 val = xscale2pmu_read_pmnc() & ~XSCALE_PMU_CNT64;
@@ -663,7 +663,7 @@ static void xscale2pmu_start(struct arm_pmu *cpu_pmu)
663static void xscale2pmu_stop(struct arm_pmu *cpu_pmu) 663static void xscale2pmu_stop(struct arm_pmu *cpu_pmu)
664{ 664{
665 unsigned long flags, val; 665 unsigned long flags, val;
666 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 666 struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
667 667
668 raw_spin_lock_irqsave(&events->pmu_lock, flags); 668 raw_spin_lock_irqsave(&events->pmu_lock, flags);
669 val = xscale2pmu_read_pmnc(); 669 val = xscale2pmu_read_pmnc();
diff --git a/arch/arm/mach-asm9260/Kconfig b/arch/arm/mach-asm9260/Kconfig
new file mode 100644
index 000000000000..8423be76080e
--- /dev/null
+++ b/arch/arm/mach-asm9260/Kconfig
@@ -0,0 +1,6 @@
1config MACH_ASM9260
2 bool "Alphascale ASM9260"
3 depends on ARCH_MULTI_V5
4 select CPU_ARM926T
5 help
6 Support for Alphascale ASM9260 based platform.
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 0e6d548b70d9..2395c68b3e32 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -15,27 +15,10 @@ config HAVE_AT91_DBGU1
15config HAVE_AT91_DBGU2 15config HAVE_AT91_DBGU2
16 bool 16 bool
17 17
18config AT91_USE_OLD_CLK
19 bool
20
21config AT91_PMC_UNIT
22 bool
23 default !ARCH_AT91X40
24
25config COMMON_CLK_AT91 18config COMMON_CLK_AT91
26 bool 19 bool
27 default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK
28 select COMMON_CLK 20 select COMMON_CLK
29 21
30config OLD_CLK_AT91
31 bool
32 default AT91_PMC_UNIT && AT91_USE_OLD_CLK
33
34config OLD_IRQ_AT91
35 bool
36 select MULTI_IRQ_HANDLER
37 select SPARSE_IRQ
38
39config HAVE_AT91_SMD 22config HAVE_AT91_SMD
40 bool 23 bool
41 24
@@ -44,20 +27,22 @@ config HAVE_AT91_H32MX
44 27
45config SOC_AT91SAM9 28config SOC_AT91SAM9
46 bool 29 bool
47 select ATMEL_AIC_IRQ if !OLD_IRQ_AT91 30 select ATMEL_AIC_IRQ
31 select COMMON_CLK_AT91
48 select CPU_ARM926T 32 select CPU_ARM926T
49 select GENERIC_CLOCKEVENTS 33 select GENERIC_CLOCKEVENTS
50 select MEMORY if USE_OF 34 select MEMORY
51 select ATMEL_SDRAMC if USE_OF 35 select ATMEL_SDRAMC
52 36
53config SOC_SAMA5 37config SOC_SAMA5
54 bool 38 bool
55 select ATMEL_AIC5_IRQ 39 select ATMEL_AIC5_IRQ
40 select COMMON_CLK_AT91
56 select CPU_V7 41 select CPU_V7
57 select GENERIC_CLOCKEVENTS 42 select GENERIC_CLOCKEVENTS
58 select USE_OF
59 select MEMORY 43 select MEMORY
60 select ATMEL_SDRAMC 44 select ATMEL_SDRAMC
45 select PHYLIB if NETDEVICES
61 46
62menu "Atmel AT91 System-on-Chip" 47menu "Atmel AT91 System-on-Chip"
63 48
@@ -65,16 +50,6 @@ choice
65 50
66 prompt "Core type" 51 prompt "Core type"
67 52
68config ARCH_AT91X40
69 bool "ARM7 AT91X40"
70 depends on !MMU
71 select CPU_ARM7TDMI
72 select ARCH_USES_GETTIMEOFFSET
73 select OLD_IRQ_AT91
74
75 help
76 Select this if you are using one of Atmel's AT91X40 SoC.
77
78config SOC_SAM_V4_V5 53config SOC_SAM_V4_V5
79 bool "ARM9 AT91SAM9/AT91RM9200" 54 bool "ARM9 AT91SAM9/AT91RM9200"
80 help 55 help
@@ -122,7 +97,8 @@ endif
122if SOC_SAM_V4_V5 97if SOC_SAM_V4_V5
123config SOC_AT91RM9200 98config SOC_AT91RM9200
124 bool "AT91RM9200" 99 bool "AT91RM9200"
125 select ATMEL_AIC_IRQ if !OLD_IRQ_AT91 100 select ATMEL_AIC_IRQ
101 select COMMON_CLK_AT91
126 select CPU_ARM920T 102 select CPU_ARM920T
127 select GENERIC_CLOCKEVENTS 103 select GENERIC_CLOCKEVENTS
128 select HAVE_AT91_DBGU0 104 select HAVE_AT91_DBGU0
@@ -198,37 +174,11 @@ config SOC_AT91SAM9N12
198# ---------------------------------------------------------- 174# ----------------------------------------------------------
199endif # SOC_SAM_V4_V5 175endif # SOC_SAM_V4_V5
200 176
201
202if SOC_SAM_V4_V5 || ARCH_AT91X40
203source arch/arm/mach-at91/Kconfig.non_dt
204endif
205
206comment "Generic Board Type"
207
208config MACH_AT91RM9200_DT 177config MACH_AT91RM9200_DT
209 bool "Atmel AT91RM9200 Evaluation Kits with device-tree support" 178 def_bool SOC_AT91RM9200
210 depends on SOC_AT91RM9200
211 select USE_OF
212 help
213 Select this if you want to experiment device-tree with
214 an Atmel RM9200 Evaluation Kit.
215 179
216config MACH_AT91SAM9_DT 180config MACH_AT91SAM9_DT
217 bool "Atmel AT91SAM Evaluation Kits with device-tree support" 181 def_bool SOC_AT91SAM9
218 depends on SOC_AT91SAM9
219 select USE_OF
220 help
221 Select this if you want to experiment device-tree with
222 an Atmel Evaluation Kit.
223
224config MACH_SAMA5_DT
225 bool "Atmel SAMA5 Evaluation Kits with device-tree support"
226 depends on SOC_SAMA5
227 select USE_OF
228 select PHYLIB if NETDEVICES
229 help
230 Select this if you want to experiment device-tree with
231 an Atmel Evaluation Kit.
232 182
233# ---------------------------------------------------------- 183# ----------------------------------------------------------
234 184
@@ -251,7 +201,7 @@ config AT91_TIMER_HZ
251 int "Kernel HZ (jiffies per second)" 201 int "Kernel HZ (jiffies per second)"
252 range 32 1024 202 range 32 1024
253 depends on ARCH_AT91 203 depends on ARCH_AT91
254 default "128" if ARCH_AT91RM9200 204 default "128" if SOC_AT91RM9200
255 default "100" 205 default "100"
256 help 206 help
257 On AT91rm9200 chips where you're using a system clock derived 207 On AT91rm9200 chips where you're using a system clock derived
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt
deleted file mode 100644
index d8e88219edb4..000000000000
--- a/arch/arm/mach-at91/Kconfig.non_dt
+++ /dev/null
@@ -1,344 +0,0 @@
1menu "Atmel Non-DT world"
2
3config HAVE_AT91_DATAFLASH_CARD
4 bool
5
6choice
7 prompt "Atmel AT91 Processor Devices for non DT boards"
8 depends on !ARCH_AT91X40
9
10config ARCH_AT91_NONE
11 bool "None"
12
13config ARCH_AT91RM9200
14 bool "AT91RM9200"
15 select SOC_AT91RM9200
16 select AT91_USE_OLD_CLK
17 select OLD_IRQ_AT91
18
19config ARCH_AT91SAM9260
20 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20"
21 select SOC_AT91SAM9260
22 select AT91_USE_OLD_CLK
23 select OLD_IRQ_AT91
24
25config ARCH_AT91SAM9261
26 bool "AT91SAM9261 or AT91SAM9G10"
27 select SOC_AT91SAM9261
28 select AT91_USE_OLD_CLK
29 select OLD_IRQ_AT91
30
31config ARCH_AT91SAM9263
32 bool "AT91SAM9263"
33 select SOC_AT91SAM9263
34 select AT91_USE_OLD_CLK
35 select OLD_IRQ_AT91
36
37config ARCH_AT91SAM9RL
38 bool "AT91SAM9RL"
39 select SOC_AT91SAM9RL
40 select AT91_USE_OLD_CLK
41 select OLD_IRQ_AT91
42
43config ARCH_AT91SAM9G45
44 bool "AT91SAM9G45"
45 select SOC_AT91SAM9G45
46 select AT91_USE_OLD_CLK
47 select OLD_IRQ_AT91
48
49endchoice
50
51config ARCH_AT91SAM9G20
52 bool
53 select ARCH_AT91SAM9260
54
55config ARCH_AT91SAM9G10
56 bool
57 select ARCH_AT91SAM9261
58
59# ----------------------------------------------------------
60
61if ARCH_AT91RM9200
62
63comment "AT91RM9200 Board Type"
64
65config MACH_ONEARM
66 bool "Ajeco 1ARM Single Board Computer"
67 help
68 Select this if you are using Ajeco's 1ARM Single Board Computer.
69 <http://www.ajeco.fi/>
70
71config MACH_AT91RM9200EK
72 bool "Atmel AT91RM9200-EK Evaluation Kit"
73 select HAVE_AT91_DATAFLASH_CARD
74 help
75 Select this if you are using Atmel's AT91RM9200-EK Evaluation Kit.
76 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3507>
77
78config MACH_CSB337
79 bool "Cogent CSB337"
80 help
81 Select this if you are using Cogent's CSB337 board.
82 <http://www.cogcomp.com/csb_csb337.htm>
83
84config MACH_CSB637
85 bool "Cogent CSB637"
86 help
87 Select this if you are using Cogent's CSB637 board.
88 <http://www.cogcomp.com/csb_csb637.htm>
89
90config MACH_CARMEVA
91 bool "Conitec ARM&EVA"
92 help
93 Select this if you are using Conitec's AT91RM9200-MCU-Module.
94 <http://www.conitec.net/english/linuxboard.php>
95
96config MACH_ATEB9200
97 bool "Embest ATEB9200"
98 help
99 Select this if you are using Embest's ATEB9200 board.
100 <http://www.embedinfo.com/english/product/ATEB9200.asp>
101
102config MACH_KB9200
103 bool "KwikByte KB920x"
104 help
105 Select this if you are using KwikByte's KB920x board.
106 <http://www.kwikbyte.com/KB9202.html>
107
108config MACH_PICOTUX2XX
109 bool "picotux 200"
110 help
111 Select this if you are using a picotux 200.
112 <http://www.picotux.com/>
113
114config MACH_KAFA
115 bool "Sperry-Sun KAFA board"
116 help
117 Select this if you are using Sperry-Sun's KAFA board.
118
119config MACH_ECBAT91
120 bool "emQbit ECB_AT91 SBC"
121 select HAVE_AT91_DATAFLASH_CARD
122 help
123 Select this if you are using emQbit's ECB_AT91 board.
124 <http://wiki.emqbit.com/free-ecb-at91>
125
126config MACH_YL9200
127 bool "ucDragon YL-9200"
128 help
129 Select this if you are using the ucDragon YL-9200 board.
130
131config MACH_CPUAT91
132 bool "Eukrea CPUAT91"
133 help
134 Select this if you are using the Eukrea Electromatique's
135 CPUAT91 board <http://www.eukrea.com/>.
136
137config MACH_ECO920
138 bool "eco920"
139 help
140 Select this if you are using the eco920 board
141endif
142
143# ----------------------------------------------------------
144
145if ARCH_AT91SAM9260
146
147comment "AT91SAM9260 Variants"
148
149comment "AT91SAM9260 / AT91SAM9XE Board Type"
150
151config MACH_AT91SAM9260EK
152 bool "Atmel AT91SAM9260-EK / AT91SAM9XE Evaluation Kit"
153 select HAVE_AT91_DATAFLASH_CARD
154 help
155 Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit
156 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933>
157
158config MACH_CAM60
159 bool "KwikByte KB9260 (CAM60) board"
160 help
161 Select this if you are using KwikByte's KB9260 (CAM60) board based on the Atmel AT91SAM9260.
162 <http://www.kwikbyte.com/KB9260.html>
163
164config MACH_SAM9_L9260
165 bool "Olimex SAM9-L9260 board"
166 select HAVE_AT91_DATAFLASH_CARD
167 help
168 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260.
169 <http://www.olimex.com/dev/sam9-L9260.html>
170
171config MACH_AFEB9260
172 bool "Custom afeb9260 board v1"
173 help
174 Select this if you are using custom afeb9260 board based on
175 open hardware design. Select this for revision 1 of the board.
176 <svn://194.85.238.22/home/users/george/svn/arm9eb>
177 <http://groups.google.com/group/arm9fpga-evolution-board>
178
179config MACH_CPU9260
180 bool "Eukrea CPU9260 board"
181 help
182 Select this if you are using a Eukrea Electromatique's
183 CPU9260 Board <http://www.eukrea.com/>
184
185config MACH_FLEXIBITY
186 bool "Flexibity Connect board"
187 help
188 Select this if you are using Flexibity Connect board
189 <http://www.flexibity.com>
190
191comment "AT91SAM9G20 Board Type"
192
193config MACH_AT91SAM9G20EK
194 bool "Atmel AT91SAM9G20-EK Evaluation Kit"
195 select HAVE_AT91_DATAFLASH_CARD
196 help
197 Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit
198 that embeds only one SD/MMC slot.
199
200config MACH_AT91SAM9G20EK_2MMC
201 depends on MACH_AT91SAM9G20EK
202 bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots"
203 help
204 Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit
205 with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and
206 onwards.
207 <http://www.atmel.com/tools/SAM9G20-EK.aspx>
208
209config MACH_CPU9G20
210 bool "Eukrea CPU9G20 board"
211 help
212 Select this if you are using a Eukrea Electromatique's
213 CPU9G20 Board <http://www.eukrea.com/>
214
215config MACH_PORTUXG20
216 bool "taskit PortuxG20"
217 help
218 Select this if you are using taskit's PortuxG20.
219 <http://www.taskit.de/en/>
220
221config MACH_STAMP9G20
222 bool "taskit Stamp9G20 CPU module"
223 help
224 Select this if you are using taskit's Stamp9G20 CPU module on its
225 evaluation board.
226 <http://www.taskit.de/en/>
227
228config MACH_PCONTROL_G20
229 bool "PControl G20 CPU module"
230 help
231 Select this if you are using taskit's Stamp9G20 CPU module on this
232 carrier board, being the decentralized unit of a building automation
233 system; featuring nvram, eth-switch, iso-rs485, display, io
234
235config MACH_GSIA18S
236 bool "GS_IA18_S board"
237 help
238 This enables support for the GS_IA18_S board
239 produced by GeoSIG Ltd company. This is an internet accelerograph.
240 <http://www.geosig.com>
241
242config MACH_SNAPPER_9260
243 bool "Bluewater Systems Snapper 9260/9G20 module"
244 help
245 Select this if you are using the Bluewater Systems Snapper 9260 or
246 Snapper 9G20 modules.
247 <http://www.bluewatersys.com/>
248endif
249
250# ----------------------------------------------------------
251
252if ARCH_AT91SAM9261
253
254comment "AT91SAM9261 Board Type"
255
256config MACH_AT91SAM9261EK
257 bool "Atmel AT91SAM9261-EK Evaluation Kit"
258 select HAVE_AT91_DATAFLASH_CARD
259 help
260 Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
261 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
262
263comment "AT91SAM9G10 Board Type"
264
265config MACH_AT91SAM9G10EK
266 bool "Atmel AT91SAM9G10-EK Evaluation Kit"
267 select HAVE_AT91_DATAFLASH_CARD
268 help
269 Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
270 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
271
272endif
273
274# ----------------------------------------------------------
275
276if ARCH_AT91SAM9263
277
278comment "AT91SAM9263 Board Type"
279
280config MACH_AT91SAM9263EK
281 bool "Atmel AT91SAM9263-EK Evaluation Kit"
282 select HAVE_AT91_DATAFLASH_CARD
283 help
284 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
285 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
286
287endif
288
289# ----------------------------------------------------------
290
291if ARCH_AT91SAM9RL
292
293comment "AT91SAM9RL Board Type"
294
295config MACH_AT91SAM9RLEK
296 bool "Atmel AT91SAM9RL-EK Evaluation Kit"
297 help
298 Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
299
300endif
301
302# ----------------------------------------------------------
303
304if ARCH_AT91SAM9G45
305
306comment "AT91SAM9G45 Board Type"
307
308config MACH_AT91SAM9M10G45EK
309 bool "Atmel AT91SAM9M10G45-EK Evaluation Kits"
310 help
311 Select this if you are using Atmel's AT91SAM9M10G45-EK Evaluation Kit.
312 Those boards can be populated with any SoC of AT91SAM9G45 or AT91SAM9M10
313 families: AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
314 <http://www.atmel.com/tools/SAM9M10-G45-EK.aspx>
315
316endif
317
318# ----------------------------------------------------------
319
320if ARCH_AT91X40
321
322comment "AT91X40 Board Type"
323
324config MACH_AT91EB01
325 bool "Atmel AT91EB01 Evaluation Kit"
326 help
327 Select this if you are using Atmel's AT91EB01 Evaluation Kit.
328 It is also a popular target for simulators such as GDB's
329 ARM simulator (commonly known as the ARMulator) and the
330 Skyeye simulator.
331
332endif
333
334# ----------------------------------------------------------
335
336comment "AT91 Board Options"
337
338config MTD_AT91_DATAFLASH_CARD
339 bool "Enable DataFlash Card support"
340 depends on HAVE_AT91_DATAFLASH_CARD
341 help
342 Enable support for the DataFlash card.
343
344endmenu
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 1b9ae0257a6e..7b6424d40764 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -2,10 +2,8 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := gpio.o setup.o sysirq_mask.o 5obj-y := setup.o sysirq_mask.o
6 6
7obj-$(CONFIG_OLD_IRQ_AT91) += irq.o
8obj-$(CONFIG_OLD_CLK_AT91) += clock.o
9obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o 7obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o
10 8
11# CPU-specific support 9# CPU-specific support
@@ -20,73 +18,12 @@ obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o
20obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o 18obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
21obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o 19obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
22 20
23obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o
24obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o
25obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261_devices.o
26obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263_devices.o
27obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl_devices.o
28obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45_devices.o
29obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
30
31# AT91RM9200 board-specific support
32obj-$(CONFIG_MACH_ONEARM) += board-1arm.o
33obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o
34obj-$(CONFIG_MACH_CSB337) += board-csb337.o
35obj-$(CONFIG_MACH_CSB637) += board-csb637.o
36obj-$(CONFIG_MACH_CARMEVA) += board-carmeva.o
37obj-$(CONFIG_MACH_KB9200) += board-kb9202.o
38obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
39obj-$(CONFIG_MACH_KAFA) += board-kafa.o
40obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o
41obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o
42obj-$(CONFIG_MACH_YL9200) += board-yl-9200.o
43obj-$(CONFIG_MACH_CPUAT91) += board-cpuat91.o
44obj-$(CONFIG_MACH_ECO920) += board-eco920.o
45
46# AT91SAM9260 board-specific support
47obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
48obj-$(CONFIG_MACH_CAM60) += board-cam60.o
49obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
50obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o
51obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o
52obj-$(CONFIG_MACH_FLEXIBITY) += board-flexibity.o
53
54# AT91SAM9261 board-specific support
55obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o
56obj-$(CONFIG_MACH_AT91SAM9G10EK) += board-sam9261ek.o
57
58# AT91SAM9263 board-specific support
59obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
60
61# AT91SAM9RL board-specific support
62obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
63
64# AT91SAM9G20 board-specific support
65obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
66obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o
67obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
68obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
69obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o
70obj-$(CONFIG_MACH_GSIA18S) += board-gsia18s.o board-stamp9g20.o
71
72# AT91SAM9260/AT91SAM9G20 board-specific support
73obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
74
75# AT91SAM9G45 board-specific support
76obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o
77
78# AT91SAM board with device-tree 21# AT91SAM board with device-tree
79obj-$(CONFIG_MACH_AT91RM9200_DT) += board-dt-rm9200.o 22obj-$(CONFIG_MACH_AT91RM9200_DT) += board-dt-rm9200.o
80obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o 23obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o
81 24
82# SAMA5 board with device-tree 25# SAMA5 board with device-tree
83obj-$(CONFIG_MACH_SAMA5_DT) += board-dt-sama5.o 26obj-$(CONFIG_SOC_SAMA5) += board-dt-sama5.o
84
85# AT91X40 board-specific support
86obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
87
88# Drivers
89obj-y += leds.o
90 27
91# Power Management 28# Power Management
92obj-$(CONFIG_PM) += pm.o 29obj-$(CONFIG_PM) += pm.o
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot
index 5309f9b6aabc..29ed0fa374ca 100644
--- a/arch/arm/mach-at91/Makefile.boot
+++ b/arch/arm/mach-at91/Makefile.boot
@@ -3,12 +3,6 @@
3# PARAMS_PHYS must be within 4MB of ZRELADDR 3# PARAMS_PHYS must be within 4MB of ZRELADDR
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6ifeq ($(CONFIG_ARCH_AT91SAM9G45),y)
7 zreladdr-y += 0x70008000
8params_phys-y := 0x70000100
9initrd_phys-y := 0x70410000
10else
11 zreladdr-y += 0x20008000 6 zreladdr-y += 0x20008000
12params_phys-y := 0x20000100 7params_phys-y := 0x20000100
13initrd_phys-y := 0x20410000 8initrd_phys-y := 0x20410000
14endif
diff --git a/arch/arm/mach-at91/at91_aic.h b/arch/arm/mach-at91/at91_aic.h
deleted file mode 100644
index eaea66197fa1..000000000000
--- a/arch/arm/mach-at91/at91_aic.h
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_aic.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Advanced Interrupt Controller (AIC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
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_AIC_H
17#define AT91_AIC_H
18
19#ifndef __ASSEMBLY__
20extern void __iomem *at91_aic_base;
21
22#define at91_aic_read(field) \
23 __raw_readl(at91_aic_base + field)
24
25#define at91_aic_write(field, value) \
26 __raw_writel(value, at91_aic_base + field)
27#else
28.extern at91_aic_base
29#endif
30
31/* Number of irq lines managed by AIC */
32#define NR_AIC_IRQS 32
33#define NR_AIC5_IRQS 128
34
35#define AT91_AIC5_SSR 0x0 /* Source Select Register [AIC5] */
36#define AT91_AIC5_INTSEL_MSK (0x7f << 0) /* Interrupt Line Selection Mask */
37
38#define AT91_AIC_IRQ_MIN_PRIORITY 0
39#define AT91_AIC_IRQ_MAX_PRIORITY 7
40
41#define AT91_AIC_SMR(n) ((n) * 4) /* Source Mode Registers 0-31 */
42#define AT91_AIC5_SMR 0x4 /* Source Mode Register [AIC5] */
43#define AT91_AIC_PRIOR (7 << 0) /* Priority Level */
44#define AT91_AIC_SRCTYPE (3 << 5) /* Interrupt Source Type */
45#define AT91_AIC_SRCTYPE_LOW (0 << 5)
46#define AT91_AIC_SRCTYPE_FALLING (1 << 5)
47#define AT91_AIC_SRCTYPE_HIGH (2 << 5)
48#define AT91_AIC_SRCTYPE_RISING (3 << 5)
49
50#define AT91_AIC_SVR(n) (0x80 + ((n) * 4)) /* Source Vector Registers 0-31 */
51#define AT91_AIC5_SVR 0x8 /* Source Vector Register [AIC5] */
52#define AT91_AIC_IVR 0x100 /* Interrupt Vector Register */
53#define AT91_AIC5_IVR 0x10 /* Interrupt Vector Register [AIC5] */
54#define AT91_AIC_FVR 0x104 /* Fast Interrupt Vector Register */
55#define AT91_AIC5_FVR 0x14 /* Fast Interrupt Vector Register [AIC5] */
56#define AT91_AIC_ISR 0x108 /* Interrupt Status Register */
57#define AT91_AIC5_ISR 0x18 /* Interrupt Status Register [AIC5] */
58#define AT91_AIC_IRQID (0x1f << 0) /* Current Interrupt Identifier */
59
60#define AT91_AIC_IPR 0x10c /* Interrupt Pending Register */
61#define AT91_AIC5_IPR0 0x20 /* Interrupt Pending Register 0 [AIC5] */
62#define AT91_AIC5_IPR1 0x24 /* Interrupt Pending Register 1 [AIC5] */
63#define AT91_AIC5_IPR2 0x28 /* Interrupt Pending Register 2 [AIC5] */
64#define AT91_AIC5_IPR3 0x2c /* Interrupt Pending Register 3 [AIC5] */
65#define AT91_AIC_IMR 0x110 /* Interrupt Mask Register */
66#define AT91_AIC5_IMR 0x30 /* Interrupt Mask Register [AIC5] */
67#define AT91_AIC_CISR 0x114 /* Core Interrupt Status Register */
68#define AT91_AIC5_CISR 0x34 /* Core Interrupt Status Register [AIC5] */
69#define AT91_AIC_NFIQ (1 << 0) /* nFIQ Status */
70#define AT91_AIC_NIRQ (1 << 1) /* nIRQ Status */
71
72#define AT91_AIC_IECR 0x120 /* Interrupt Enable Command Register */
73#define AT91_AIC5_IECR 0x40 /* Interrupt Enable Command Register [AIC5] */
74#define AT91_AIC_IDCR 0x124 /* Interrupt Disable Command Register */
75#define AT91_AIC5_IDCR 0x44 /* Interrupt Disable Command Register [AIC5] */
76#define AT91_AIC_ICCR 0x128 /* Interrupt Clear Command Register */
77#define AT91_AIC5_ICCR 0x48 /* Interrupt Clear Command Register [AIC5] */
78#define AT91_AIC_ISCR 0x12c /* Interrupt Set Command Register */
79#define AT91_AIC5_ISCR 0x4c /* Interrupt Set Command Register [AIC5] */
80#define AT91_AIC_EOICR 0x130 /* End of Interrupt Command Register */
81#define AT91_AIC5_EOICR 0x38 /* End of Interrupt Command Register [AIC5] */
82#define AT91_AIC_SPU 0x134 /* Spurious Interrupt Vector Register */
83#define AT91_AIC5_SPU 0x3c /* Spurious Interrupt Vector Register [AIC5] */
84#define AT91_AIC_DCR 0x138 /* Debug Control Register */
85#define AT91_AIC5_DCR 0x6c /* Debug Control Register [AIC5] */
86#define AT91_AIC_DCR_PROT (1 << 0) /* Protection Mode */
87#define AT91_AIC_DCR_GMSK (1 << 1) /* General Mask */
88
89#define AT91_AIC_FFER 0x140 /* Fast Forcing Enable Register [SAM9 only] */
90#define AT91_AIC5_FFER 0x50 /* Fast Forcing Enable Register [AIC5] */
91#define AT91_AIC_FFDR 0x144 /* Fast Forcing Disable Register [SAM9 only] */
92#define AT91_AIC5_FFDR 0x54 /* Fast Forcing Disable Register [AIC5] */
93#define AT91_AIC_FFSR 0x148 /* Fast Forcing Status Register [SAM9 only] */
94#define AT91_AIC5_FFSR 0x58 /* Fast Forcing Status Register [AIC5] */
95
96void at91_aic_handle_irq(struct pt_regs *regs);
97void at91_aic5_handle_irq(struct pt_regs *regs);
98
99#endif
diff --git a/arch/arm/mach-at91/at91_tc.h b/arch/arm/mach-at91/at91_tc.h
deleted file mode 100644
index 46a317fd7164..000000000000
--- a/arch/arm/mach-at91/at91_tc.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_tc.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Timer/Counter Unit (TC) registers.
7 * Based on AT91RM9200 datasheet revision E.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef AT91_TC_H
16#define AT91_TC_H
17
18#define AT91_TC_BCR 0xc0 /* TC Block Control Register */
19#define AT91_TC_SYNC (1 << 0) /* Synchro Command */
20
21#define AT91_TC_BMR 0xc4 /* TC Block Mode Register */
22#define AT91_TC_TC0XC0S (3 << 0) /* External Clock Signal 0 Selection */
23#define AT91_TC_TC0XC0S_TCLK0 (0 << 0)
24#define AT91_TC_TC0XC0S_NONE (1 << 0)
25#define AT91_TC_TC0XC0S_TIOA1 (2 << 0)
26#define AT91_TC_TC0XC0S_TIOA2 (3 << 0)
27#define AT91_TC_TC1XC1S (3 << 2) /* External Clock Signal 1 Selection */
28#define AT91_TC_TC1XC1S_TCLK1 (0 << 2)
29#define AT91_TC_TC1XC1S_NONE (1 << 2)
30#define AT91_TC_TC1XC1S_TIOA0 (2 << 2)
31#define AT91_TC_TC1XC1S_TIOA2 (3 << 2)
32#define AT91_TC_TC2XC2S (3 << 4) /* External Clock Signal 2 Selection */
33#define AT91_TC_TC2XC2S_TCLK2 (0 << 4)
34#define AT91_TC_TC2XC2S_NONE (1 << 4)
35#define AT91_TC_TC2XC2S_TIOA0 (2 << 4)
36#define AT91_TC_TC2XC2S_TIOA1 (3 << 4)
37
38
39#define AT91_TC_CCR 0x00 /* Channel Control Register */
40#define AT91_TC_CLKEN (1 << 0) /* Counter Clock Enable Command */
41#define AT91_TC_CLKDIS (1 << 1) /* Counter CLock Disable Command */
42#define AT91_TC_SWTRG (1 << 2) /* Software Trigger Command */
43
44#define AT91_TC_CMR 0x04 /* Channel Mode Register */
45#define AT91_TC_TCCLKS (7 << 0) /* Capture/Waveform Mode: Clock Selection */
46#define AT91_TC_TIMER_CLOCK1 (0 << 0)
47#define AT91_TC_TIMER_CLOCK2 (1 << 0)
48#define AT91_TC_TIMER_CLOCK3 (2 << 0)
49#define AT91_TC_TIMER_CLOCK4 (3 << 0)
50#define AT91_TC_TIMER_CLOCK5 (4 << 0)
51#define AT91_TC_XC0 (5 << 0)
52#define AT91_TC_XC1 (6 << 0)
53#define AT91_TC_XC2 (7 << 0)
54#define AT91_TC_CLKI (1 << 3) /* Capture/Waveform Mode: Clock Invert */
55#define AT91_TC_BURST (3 << 4) /* Capture/Waveform Mode: Burst Signal Selection */
56#define AT91_TC_LDBSTOP (1 << 6) /* Capture Mode: Counter Clock Stopped with TB Loading */
57#define AT91_TC_LDBDIS (1 << 7) /* Capture Mode: Counter Clock Disable with RB Loading */
58#define AT91_TC_ETRGEDG (3 << 8) /* Capture Mode: External Trigger Edge Selection */
59#define AT91_TC_ABETRG (1 << 10) /* Capture Mode: TIOA or TIOB External Trigger Selection */
60#define AT91_TC_CPCTRG (1 << 14) /* Capture Mode: RC Compare Trigger Enable */
61#define AT91_TC_WAVE (1 << 15) /* Capture/Waveform mode */
62#define AT91_TC_LDRA (3 << 16) /* Capture Mode: RA Loading Selection */
63#define AT91_TC_LDRB (3 << 18) /* Capture Mode: RB Loading Selection */
64
65#define AT91_TC_CPCSTOP (1 << 6) /* Waveform Mode: Counter Clock Stopped with RC Compare */
66#define AT91_TC_CPCDIS (1 << 7) /* Waveform Mode: Counter Clock Disable with RC Compare */
67#define AT91_TC_EEVTEDG (3 << 8) /* Waveform Mode: External Event Edge Selection */
68#define AT91_TC_EEVTEDG_NONE (0 << 8)
69#define AT91_TC_EEVTEDG_RISING (1 << 8)
70#define AT91_TC_EEVTEDG_FALLING (2 << 8)
71#define AT91_TC_EEVTEDG_BOTH (3 << 8)
72#define AT91_TC_EEVT (3 << 10) /* Waveform Mode: External Event Selection */
73#define AT91_TC_EEVT_TIOB (0 << 10)
74#define AT91_TC_EEVT_XC0 (1 << 10)
75#define AT91_TC_EEVT_XC1 (2 << 10)
76#define AT91_TC_EEVT_XC2 (3 << 10)
77#define AT91_TC_ENETRG (1 << 12) /* Waveform Mode: External Event Trigger Enable */
78#define AT91_TC_WAVESEL (3 << 13) /* Waveform Mode: Waveform Selection */
79#define AT91_TC_WAVESEL_UP (0 << 13)
80#define AT91_TC_WAVESEL_UP_AUTO (2 << 13)
81#define AT91_TC_WAVESEL_UPDOWN (1 << 13)
82#define AT91_TC_WAVESEL_UPDOWN_AUTO (3 << 13)
83#define AT91_TC_ACPA (3 << 16) /* Waveform Mode: RA Compare Effect on TIOA */
84#define AT91_TC_ACPA_NONE (0 << 16)
85#define AT91_TC_ACPA_SET (1 << 16)
86#define AT91_TC_ACPA_CLEAR (2 << 16)
87#define AT91_TC_ACPA_TOGGLE (3 << 16)
88#define AT91_TC_ACPC (3 << 18) /* Waveform Mode: RC Compre Effect on TIOA */
89#define AT91_TC_ACPC_NONE (0 << 18)
90#define AT91_TC_ACPC_SET (1 << 18)
91#define AT91_TC_ACPC_CLEAR (2 << 18)
92#define AT91_TC_ACPC_TOGGLE (3 << 18)
93#define AT91_TC_AEEVT (3 << 20) /* Waveform Mode: External Event Effect on TIOA */
94#define AT91_TC_AEEVT_NONE (0 << 20)
95#define AT91_TC_AEEVT_SET (1 << 20)
96#define AT91_TC_AEEVT_CLEAR (2 << 20)
97#define AT91_TC_AEEVT_TOGGLE (3 << 20)
98#define AT91_TC_ASWTRG (3 << 22) /* Waveform Mode: Software Trigger Effect on TIOA */
99#define AT91_TC_ASWTRG_NONE (0 << 22)
100#define AT91_TC_ASWTRG_SET (1 << 22)
101#define AT91_TC_ASWTRG_CLEAR (2 << 22)
102#define AT91_TC_ASWTRG_TOGGLE (3 << 22)
103#define AT91_TC_BCPB (3 << 24) /* Waveform Mode: RB Compare Effect on TIOB */
104#define AT91_TC_BCPB_NONE (0 << 24)
105#define AT91_TC_BCPB_SET (1 << 24)
106#define AT91_TC_BCPB_CLEAR (2 << 24)
107#define AT91_TC_BCPB_TOGGLE (3 << 24)
108#define AT91_TC_BCPC (3 << 26) /* Waveform Mode: RC Compare Effect on TIOB */
109#define AT91_TC_BCPC_NONE (0 << 26)
110#define AT91_TC_BCPC_SET (1 << 26)
111#define AT91_TC_BCPC_CLEAR (2 << 26)
112#define AT91_TC_BCPC_TOGGLE (3 << 26)
113#define AT91_TC_BEEVT (3 << 28) /* Waveform Mode: External Event Effect on TIOB */
114#define AT91_TC_BEEVT_NONE (0 << 28)
115#define AT91_TC_BEEVT_SET (1 << 28)
116#define AT91_TC_BEEVT_CLEAR (2 << 28)
117#define AT91_TC_BEEVT_TOGGLE (3 << 28)
118#define AT91_TC_BSWTRG (3 << 30) /* Waveform Mode: Software Trigger Effect on TIOB */
119#define AT91_TC_BSWTRG_NONE (0 << 30)
120#define AT91_TC_BSWTRG_SET (1 << 30)
121#define AT91_TC_BSWTRG_CLEAR (2 << 30)
122#define AT91_TC_BSWTRG_TOGGLE (3 << 30)
123
124#define AT91_TC_CV 0x10 /* Counter Value */
125#define AT91_TC_RA 0x14 /* Register A */
126#define AT91_TC_RB 0x18 /* Register B */
127#define AT91_TC_RC 0x1c /* Register C */
128
129#define AT91_TC_SR 0x20 /* Status Register */
130#define AT91_TC_COVFS (1 << 0) /* Counter Overflow Status */
131#define AT91_TC_LOVRS (1 << 1) /* Load Overrun Status */
132#define AT91_TC_CPAS (1 << 2) /* RA Compare Status */
133#define AT91_TC_CPBS (1 << 3) /* RB Compare Status */
134#define AT91_TC_CPCS (1 << 4) /* RC Compare Status */
135#define AT91_TC_LDRAS (1 << 5) /* RA Loading Status */
136#define AT91_TC_LDRBS (1 << 6) /* RB Loading Status */
137#define AT91_TC_ETRGS (1 << 7) /* External Trigger Status */
138#define AT91_TC_CLKSTA (1 << 16) /* Clock Enabling Status */
139#define AT91_TC_MTIOA (1 << 17) /* TIOA Mirror */
140#define AT91_TC_MTIOB (1 << 18) /* TIOB Mirror */
141
142#define AT91_TC_IER 0x24 /* Interrupt Enable Register */
143#define AT91_TC_IDR 0x28 /* Interrupt Disable Register */
144#define AT91_TC_IMR 0x2c /* Interrupt Mask Register */
145
146#endif
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 038702ee8bc6..b52916947535 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -11,296 +11,15 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/reboot.h>
15#include <linux/clk/at91_pmc.h> 14#include <linux/clk/at91_pmc.h>
16 15
17#include <asm/irq.h>
18#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 16#include <asm/mach/map.h>
20#include <asm/system_misc.h> 17#include <asm/system_misc.h>
21#include <mach/at91rm9200.h>
22#include <mach/at91_st.h> 18#include <mach/at91_st.h>
23#include <mach/cpu.h>
24#include <mach/hardware.h> 19#include <mach/hardware.h>
25 20
26#include "at91_aic.h"
27#include "soc.h" 21#include "soc.h"
28#include "generic.h" 22#include "generic.h"
29#include "sam9_smc.h"
30#include "pm.h"
31
32#if defined(CONFIG_OLD_CLK_AT91)
33#include "clock.h"
34/* --------------------------------------------------------------------
35 * Clocks
36 * -------------------------------------------------------------------- */
37
38/*
39 * The peripheral clocks.
40 */
41static struct clk udc_clk = {
42 .name = "udc_clk",
43 .pmc_mask = 1 << AT91RM9200_ID_UDP,
44 .type = CLK_TYPE_PERIPHERAL,
45};
46static struct clk ohci_clk = {
47 .name = "ohci_clk",
48 .pmc_mask = 1 << AT91RM9200_ID_UHP,
49 .type = CLK_TYPE_PERIPHERAL,
50};
51static struct clk ether_clk = {
52 .name = "ether_clk",
53 .pmc_mask = 1 << AT91RM9200_ID_EMAC,
54 .type = CLK_TYPE_PERIPHERAL,
55};
56static struct clk mmc_clk = {
57 .name = "mci_clk",
58 .pmc_mask = 1 << AT91RM9200_ID_MCI,
59 .type = CLK_TYPE_PERIPHERAL,
60};
61static struct clk twi_clk = {
62 .name = "twi_clk",
63 .pmc_mask = 1 << AT91RM9200_ID_TWI,
64 .type = CLK_TYPE_PERIPHERAL,
65};
66static struct clk usart0_clk = {
67 .name = "usart0_clk",
68 .pmc_mask = 1 << AT91RM9200_ID_US0,
69 .type = CLK_TYPE_PERIPHERAL,
70};
71static struct clk usart1_clk = {
72 .name = "usart1_clk",
73 .pmc_mask = 1 << AT91RM9200_ID_US1,
74 .type = CLK_TYPE_PERIPHERAL,
75};
76static struct clk usart2_clk = {
77 .name = "usart2_clk",
78 .pmc_mask = 1 << AT91RM9200_ID_US2,
79 .type = CLK_TYPE_PERIPHERAL,
80};
81static struct clk usart3_clk = {
82 .name = "usart3_clk",
83 .pmc_mask = 1 << AT91RM9200_ID_US3,
84 .type = CLK_TYPE_PERIPHERAL,
85};
86static struct clk spi_clk = {
87 .name = "spi_clk",
88 .pmc_mask = 1 << AT91RM9200_ID_SPI,
89 .type = CLK_TYPE_PERIPHERAL,
90};
91static struct clk pioA_clk = {
92 .name = "pioA_clk",
93 .pmc_mask = 1 << AT91RM9200_ID_PIOA,
94 .type = CLK_TYPE_PERIPHERAL,
95};
96static struct clk pioB_clk = {
97 .name = "pioB_clk",
98 .pmc_mask = 1 << AT91RM9200_ID_PIOB,
99 .type = CLK_TYPE_PERIPHERAL,
100};
101static struct clk pioC_clk = {
102 .name = "pioC_clk",
103 .pmc_mask = 1 << AT91RM9200_ID_PIOC,
104 .type = CLK_TYPE_PERIPHERAL,
105};
106static struct clk pioD_clk = {
107 .name = "pioD_clk",
108 .pmc_mask = 1 << AT91RM9200_ID_PIOD,
109 .type = CLK_TYPE_PERIPHERAL,
110};
111static struct clk ssc0_clk = {
112 .name = "ssc0_clk",
113 .pmc_mask = 1 << AT91RM9200_ID_SSC0,
114 .type = CLK_TYPE_PERIPHERAL,
115};
116static struct clk ssc1_clk = {
117 .name = "ssc1_clk",
118 .pmc_mask = 1 << AT91RM9200_ID_SSC1,
119 .type = CLK_TYPE_PERIPHERAL,
120};
121static struct clk ssc2_clk = {
122 .name = "ssc2_clk",
123 .pmc_mask = 1 << AT91RM9200_ID_SSC2,
124 .type = CLK_TYPE_PERIPHERAL,
125};
126static struct clk tc0_clk = {
127 .name = "tc0_clk",
128 .pmc_mask = 1 << AT91RM9200_ID_TC0,
129 .type = CLK_TYPE_PERIPHERAL,
130};
131static struct clk tc1_clk = {
132 .name = "tc1_clk",
133 .pmc_mask = 1 << AT91RM9200_ID_TC1,
134 .type = CLK_TYPE_PERIPHERAL,
135};
136static struct clk tc2_clk = {
137 .name = "tc2_clk",
138 .pmc_mask = 1 << AT91RM9200_ID_TC2,
139 .type = CLK_TYPE_PERIPHERAL,
140};
141static struct clk tc3_clk = {
142 .name = "tc3_clk",
143 .pmc_mask = 1 << AT91RM9200_ID_TC3,
144 .type = CLK_TYPE_PERIPHERAL,
145};
146static struct clk tc4_clk = {
147 .name = "tc4_clk",
148 .pmc_mask = 1 << AT91RM9200_ID_TC4,
149 .type = CLK_TYPE_PERIPHERAL,
150};
151static struct clk tc5_clk = {
152 .name = "tc5_clk",
153 .pmc_mask = 1 << AT91RM9200_ID_TC5,
154 .type = CLK_TYPE_PERIPHERAL,
155};
156
157static struct clk *periph_clocks[] __initdata = {
158 &pioA_clk,
159 &pioB_clk,
160 &pioC_clk,
161 &pioD_clk,
162 &usart0_clk,
163 &usart1_clk,
164 &usart2_clk,
165 &usart3_clk,
166 &mmc_clk,
167 &udc_clk,
168 &twi_clk,
169 &spi_clk,
170 &ssc0_clk,
171 &ssc1_clk,
172 &ssc2_clk,
173 &tc0_clk,
174 &tc1_clk,
175 &tc2_clk,
176 &tc3_clk,
177 &tc4_clk,
178 &tc5_clk,
179 &ohci_clk,
180 &ether_clk,
181 // irq0 .. irq6
182};
183
184static struct clk_lookup periph_clocks_lookups[] = {
185 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
186 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
187 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
188 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk),
189 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
190 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
191 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
192 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
193 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.2", &ssc2_clk),
194 CLKDEV_CON_DEV_ID("pclk", "fffd0000.ssc", &ssc0_clk),
195 CLKDEV_CON_DEV_ID("pclk", "fffd4000.ssc", &ssc1_clk),
196 CLKDEV_CON_DEV_ID("pclk", "fffd8000.ssc", &ssc2_clk),
197 CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200.0", &twi_clk),
198 /* fake hclk clock */
199 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
200 CLKDEV_CON_ID("pioA", &pioA_clk),
201 CLKDEV_CON_ID("pioB", &pioB_clk),
202 CLKDEV_CON_ID("pioC", &pioC_clk),
203 CLKDEV_CON_ID("pioD", &pioD_clk),
204 /* usart lookup table for DT entries */
205 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
206 CLKDEV_CON_DEV_ID("usart", "fffc0000.serial", &usart0_clk),
207 CLKDEV_CON_DEV_ID("usart", "fffc4000.serial", &usart1_clk),
208 CLKDEV_CON_DEV_ID("usart", "fffc8000.serial", &usart2_clk),
209 CLKDEV_CON_DEV_ID("usart", "fffcc000.serial", &usart3_clk),
210 /* tc lookup table for DT entries */
211 CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
212 CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
213 CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
214 CLKDEV_CON_DEV_ID("t0_clk", "fffa4000.timer", &tc3_clk),
215 CLKDEV_CON_DEV_ID("t1_clk", "fffa4000.timer", &tc4_clk),
216 CLKDEV_CON_DEV_ID("t2_clk", "fffa4000.timer", &tc5_clk),
217 CLKDEV_CON_DEV_ID("mci_clk", "fffb4000.mmc", &mmc_clk),
218 CLKDEV_CON_DEV_ID("emac_clk", "fffbc000.ethernet", &ether_clk),
219 CLKDEV_CON_DEV_ID(NULL, "fffb8000.i2c", &twi_clk),
220 CLKDEV_CON_DEV_ID("hclk", "300000.ohci", &ohci_clk),
221 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
222 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
223 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
224 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioD_clk),
225};
226
227static struct clk_lookup usart_clocks_lookups[] = {
228 CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck),
229 CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk),
230 CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk),
231 CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk),
232 CLKDEV_CON_DEV_ID("usart", "atmel_usart.4", &usart3_clk),
233};
234
235/*
236 * The four programmable clocks.
237 * You must configure pin multiplexing to bring these signals out.
238 */
239static struct clk pck0 = {
240 .name = "pck0",
241 .pmc_mask = AT91_PMC_PCK0,
242 .type = CLK_TYPE_PROGRAMMABLE,
243 .id = 0,
244};
245static struct clk pck1 = {
246 .name = "pck1",
247 .pmc_mask = AT91_PMC_PCK1,
248 .type = CLK_TYPE_PROGRAMMABLE,
249 .id = 1,
250};
251static struct clk pck2 = {
252 .name = "pck2",
253 .pmc_mask = AT91_PMC_PCK2,
254 .type = CLK_TYPE_PROGRAMMABLE,
255 .id = 2,
256};
257static struct clk pck3 = {
258 .name = "pck3",
259 .pmc_mask = AT91_PMC_PCK3,
260 .type = CLK_TYPE_PROGRAMMABLE,
261 .id = 3,
262};
263
264static void __init at91rm9200_register_clocks(void)
265{
266 int i;
267
268 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
269 clk_register(periph_clocks[i]);
270
271 clkdev_add_table(periph_clocks_lookups,
272 ARRAY_SIZE(periph_clocks_lookups));
273 clkdev_add_table(usart_clocks_lookups,
274 ARRAY_SIZE(usart_clocks_lookups));
275
276 clk_register(&pck0);
277 clk_register(&pck1);
278 clk_register(&pck2);
279 clk_register(&pck3);
280}
281#else
282#define at91rm9200_register_clocks NULL
283#endif
284
285/* --------------------------------------------------------------------
286 * GPIO
287 * -------------------------------------------------------------------- */
288
289static struct at91_gpio_bank at91rm9200_gpio[] __initdata = {
290 {
291 .id = AT91RM9200_ID_PIOA,
292 .regbase = AT91RM9200_BASE_PIOA,
293 }, {
294 .id = AT91RM9200_ID_PIOB,
295 .regbase = AT91RM9200_BASE_PIOB,
296 }, {
297 .id = AT91RM9200_ID_PIOC,
298 .regbase = AT91RM9200_BASE_PIOC,
299 }, {
300 .id = AT91RM9200_ID_PIOD,
301 .regbase = AT91RM9200_BASE_PIOD,
302 }
303};
304 23
305static void at91rm9200_idle(void) 24static void at91rm9200_idle(void)
306{ 25{
@@ -329,74 +48,14 @@ static void __init at91rm9200_map_io(void)
329 at91_init_sram(0, AT91RM9200_SRAM_BASE, AT91RM9200_SRAM_SIZE); 48 at91_init_sram(0, AT91RM9200_SRAM_BASE, AT91RM9200_SRAM_SIZE);
330} 49}
331 50
332static void __init at91rm9200_ioremap_registers(void)
333{
334 at91rm9200_ioremap_st(AT91RM9200_BASE_ST);
335 at91_ioremap_ramc(0, AT91RM9200_BASE_MC, 256);
336 at91_pm_set_standby(at91rm9200_standby);
337}
338
339static void __init at91rm9200_initialize(void) 51static void __init at91rm9200_initialize(void)
340{ 52{
341 arm_pm_idle = at91rm9200_idle; 53 arm_pm_idle = at91rm9200_idle;
342 arm_pm_restart = at91rm9200_restart; 54 arm_pm_restart = at91rm9200_restart;
343
344 /* Initialize GPIO subsystem */
345 at91_gpio_init(at91rm9200_gpio,
346 cpu_is_at91rm9200_bga() ? AT91RM9200_BGA : AT91RM9200_PQFP);
347} 55}
348 56
349 57
350/* --------------------------------------------------------------------
351 * Interrupt initialization
352 * -------------------------------------------------------------------- */
353
354/*
355 * The default interrupt priority levels (0 = lowest, 7 = highest).
356 */
357static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
358 7, /* Advanced Interrupt Controller (FIQ) */
359 7, /* System Peripherals */
360 1, /* Parallel IO Controller A */
361 1, /* Parallel IO Controller B */
362 1, /* Parallel IO Controller C */
363 1, /* Parallel IO Controller D */
364 5, /* USART 0 */
365 5, /* USART 1 */
366 5, /* USART 2 */
367 5, /* USART 3 */
368 0, /* Multimedia Card Interface */
369 2, /* USB Device Port */
370 6, /* Two-Wire Interface */
371 5, /* Serial Peripheral Interface */
372 4, /* Serial Synchronous Controller 0 */
373 4, /* Serial Synchronous Controller 1 */
374 4, /* Serial Synchronous Controller 2 */
375 0, /* Timer Counter 0 */
376 0, /* Timer Counter 1 */
377 0, /* Timer Counter 2 */
378 0, /* Timer Counter 3 */
379 0, /* Timer Counter 4 */
380 0, /* Timer Counter 5 */
381 2, /* USB Host port */
382 3, /* Ethernet MAC */
383 0, /* Advanced Interrupt Controller (IRQ0) */
384 0, /* Advanced Interrupt Controller (IRQ1) */
385 0, /* Advanced Interrupt Controller (IRQ2) */
386 0, /* Advanced Interrupt Controller (IRQ3) */
387 0, /* Advanced Interrupt Controller (IRQ4) */
388 0, /* Advanced Interrupt Controller (IRQ5) */
389 0 /* Advanced Interrupt Controller (IRQ6) */
390};
391
392AT91_SOC_START(at91rm9200) 58AT91_SOC_START(at91rm9200)
393 .map_io = at91rm9200_map_io, 59 .map_io = at91rm9200_map_io,
394 .default_irq_priority = at91rm9200_default_irq_priority,
395 .extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
396 | (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
397 | (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
398 | (1 << AT91RM9200_ID_IRQ6),
399 .ioremap_registers = at91rm9200_ioremap_registers,
400 .register_clocks = at91rm9200_register_clocks,
401 .init = at91rm9200_initialize, 60 .init = at91rm9200_initialize,
402AT91_SOC_END 61AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
deleted file mode 100644
index 74f1eaf97801..000000000000
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ /dev/null
@@ -1,1212 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91rm9200_devices.c
3 *
4 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
5 * Copyright (C) 2005 David Brownell
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 */
13#include <asm/mach/arch.h>
14#include <asm/mach/map.h>
15
16#include <linux/dma-mapping.h>
17#include <linux/gpio.h>
18#include <linux/gpio/machine.h>
19#include <linux/platform_device.h>
20#include <linux/i2c-gpio.h>
21
22#include <mach/at91rm9200.h>
23#include <mach/at91rm9200_mc.h>
24#include <mach/at91_ramc.h>
25#include <mach/hardware.h>
26
27#include "board.h"
28#include "generic.h"
29#include "gpio.h"
30
31
32/* --------------------------------------------------------------------
33 * USB Host
34 * -------------------------------------------------------------------- */
35
36#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
37static u64 ohci_dmamask = DMA_BIT_MASK(32);
38static struct at91_usbh_data usbh_data;
39
40static struct resource usbh_resources[] = {
41 [0] = {
42 .start = AT91RM9200_UHP_BASE,
43 .end = AT91RM9200_UHP_BASE + SZ_1M - 1,
44 .flags = IORESOURCE_MEM,
45 },
46 [1] = {
47 .start = NR_IRQS_LEGACY + AT91RM9200_ID_UHP,
48 .end = NR_IRQS_LEGACY + AT91RM9200_ID_UHP,
49 .flags = IORESOURCE_IRQ,
50 },
51};
52
53static struct platform_device at91rm9200_usbh_device = {
54 .name = "at91_ohci",
55 .id = -1,
56 .dev = {
57 .dma_mask = &ohci_dmamask,
58 .coherent_dma_mask = DMA_BIT_MASK(32),
59 .platform_data = &usbh_data,
60 },
61 .resource = usbh_resources,
62 .num_resources = ARRAY_SIZE(usbh_resources),
63};
64
65void __init at91_add_device_usbh(struct at91_usbh_data *data)
66{
67 int i;
68
69 if (!data)
70 return;
71
72 /* Enable overcurrent notification */
73 for (i = 0; i < data->ports; i++) {
74 if (gpio_is_valid(data->overcurrent_pin[i]))
75 at91_set_gpio_input(data->overcurrent_pin[i], 1);
76 }
77
78 usbh_data = *data;
79 platform_device_register(&at91rm9200_usbh_device);
80}
81#else
82void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
83#endif
84
85
86/* --------------------------------------------------------------------
87 * USB Device (Gadget)
88 * -------------------------------------------------------------------- */
89
90#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
91static struct at91_udc_data udc_data;
92
93static struct resource udc_resources[] = {
94 [0] = {
95 .start = AT91RM9200_BASE_UDP,
96 .end = AT91RM9200_BASE_UDP + SZ_16K - 1,
97 .flags = IORESOURCE_MEM,
98 },
99 [1] = {
100 .start = NR_IRQS_LEGACY + AT91RM9200_ID_UDP,
101 .end = NR_IRQS_LEGACY + AT91RM9200_ID_UDP,
102 .flags = IORESOURCE_IRQ,
103 },
104};
105
106static struct platform_device at91rm9200_udc_device = {
107 .name = "at91_udc",
108 .id = -1,
109 .dev = {
110 .platform_data = &udc_data,
111 },
112 .resource = udc_resources,
113 .num_resources = ARRAY_SIZE(udc_resources),
114};
115
116void __init at91_add_device_udc(struct at91_udc_data *data)
117{
118 if (!data)
119 return;
120
121 if (gpio_is_valid(data->vbus_pin)) {
122 at91_set_gpio_input(data->vbus_pin, 0);
123 at91_set_deglitch(data->vbus_pin, 1);
124 }
125 if (gpio_is_valid(data->pullup_pin))
126 at91_set_gpio_output(data->pullup_pin, 0);
127
128 udc_data = *data;
129 platform_device_register(&at91rm9200_udc_device);
130}
131#else
132void __init at91_add_device_udc(struct at91_udc_data *data) {}
133#endif
134
135
136/* --------------------------------------------------------------------
137 * Ethernet
138 * -------------------------------------------------------------------- */
139
140#if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
141static u64 eth_dmamask = DMA_BIT_MASK(32);
142static struct macb_platform_data eth_data;
143
144static struct resource eth_resources[] = {
145 [0] = {
146 .start = AT91RM9200_BASE_EMAC,
147 .end = AT91RM9200_BASE_EMAC + SZ_16K - 1,
148 .flags = IORESOURCE_MEM,
149 },
150 [1] = {
151 .start = NR_IRQS_LEGACY + AT91RM9200_ID_EMAC,
152 .end = NR_IRQS_LEGACY + AT91RM9200_ID_EMAC,
153 .flags = IORESOURCE_IRQ,
154 },
155};
156
157static struct platform_device at91rm9200_eth_device = {
158 .name = "at91_ether",
159 .id = -1,
160 .dev = {
161 .dma_mask = &eth_dmamask,
162 .coherent_dma_mask = DMA_BIT_MASK(32),
163 .platform_data = &eth_data,
164 },
165 .resource = eth_resources,
166 .num_resources = ARRAY_SIZE(eth_resources),
167};
168
169void __init at91_add_device_eth(struct macb_platform_data *data)
170{
171 if (!data)
172 return;
173
174 if (gpio_is_valid(data->phy_irq_pin)) {
175 at91_set_gpio_input(data->phy_irq_pin, 0);
176 at91_set_deglitch(data->phy_irq_pin, 1);
177 }
178
179 /* Pins used for MII and RMII */
180 at91_set_A_periph(AT91_PIN_PA16, 0); /* EMDIO */
181 at91_set_A_periph(AT91_PIN_PA15, 0); /* EMDC */
182 at91_set_A_periph(AT91_PIN_PA14, 0); /* ERXER */
183 at91_set_A_periph(AT91_PIN_PA13, 0); /* ERX1 */
184 at91_set_A_periph(AT91_PIN_PA12, 0); /* ERX0 */
185 at91_set_A_periph(AT91_PIN_PA11, 0); /* ECRS_ECRSDV */
186 at91_set_A_periph(AT91_PIN_PA10, 0); /* ETX1 */
187 at91_set_A_periph(AT91_PIN_PA9, 0); /* ETX0 */
188 at91_set_A_periph(AT91_PIN_PA8, 0); /* ETXEN */
189 at91_set_A_periph(AT91_PIN_PA7, 0); /* ETXCK_EREFCK */
190
191 if (!data->is_rmii) {
192 at91_set_B_periph(AT91_PIN_PB19, 0); /* ERXCK */
193 at91_set_B_periph(AT91_PIN_PB18, 0); /* ECOL */
194 at91_set_B_periph(AT91_PIN_PB17, 0); /* ERXDV */
195 at91_set_B_periph(AT91_PIN_PB16, 0); /* ERX3 */
196 at91_set_B_periph(AT91_PIN_PB15, 0); /* ERX2 */
197 at91_set_B_periph(AT91_PIN_PB14, 0); /* ETXER */
198 at91_set_B_periph(AT91_PIN_PB13, 0); /* ETX3 */
199 at91_set_B_periph(AT91_PIN_PB12, 0); /* ETX2 */
200 }
201
202 eth_data = *data;
203 platform_device_register(&at91rm9200_eth_device);
204}
205#else
206void __init at91_add_device_eth(struct macb_platform_data *data) {}
207#endif
208
209
210/* --------------------------------------------------------------------
211 * Compact Flash / PCMCIA
212 * -------------------------------------------------------------------- */
213
214#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
215static struct at91_cf_data cf_data;
216
217#define CF_BASE AT91_CHIPSELECT_4
218
219static struct resource cf_resources[] = {
220 [0] = {
221 .start = CF_BASE,
222 /* ties up CS4, CS5 and CS6 */
223 .end = CF_BASE + (0x30000000 - 1),
224 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
225 },
226};
227
228static struct platform_device at91rm9200_cf_device = {
229 .name = "at91_cf",
230 .id = -1,
231 .dev = {
232 .platform_data = &cf_data,
233 },
234 .resource = cf_resources,
235 .num_resources = ARRAY_SIZE(cf_resources),
236};
237
238void __init at91_add_device_cf(struct at91_cf_data *data)
239{
240 unsigned int csa;
241
242 if (!data)
243 return;
244
245 data->chipselect = 4; /* can only use EBI ChipSelect 4 */
246
247 /* CF takes over CS4, CS5, CS6 */
248 csa = at91_ramc_read(0, AT91_EBI_CSA);
249 at91_ramc_write(0, AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);
250
251 /*
252 * Static memory controller timing adjustments.
253 * REVISIT: these timings are in terms of MCK cycles, so
254 * when MCK changes (cpufreq etc) so must these values...
255 */
256 at91_ramc_write(0, AT91_SMC_CSR(4),
257 AT91_SMC_ACSS_STD
258 | AT91_SMC_DBW_16
259 | AT91_SMC_BAT
260 | AT91_SMC_WSEN
261 | AT91_SMC_NWS_(32) /* wait states */
262 | AT91_SMC_RWSETUP_(6) /* setup time */
263 | AT91_SMC_RWHOLD_(4) /* hold time */
264 );
265
266 /* input/irq */
267 if (gpio_is_valid(data->irq_pin)) {
268 at91_set_gpio_input(data->irq_pin, 1);
269 at91_set_deglitch(data->irq_pin, 1);
270 }
271 at91_set_gpio_input(data->det_pin, 1);
272 at91_set_deglitch(data->det_pin, 1);
273
274 /* outputs, initially off */
275 if (gpio_is_valid(data->vcc_pin))
276 at91_set_gpio_output(data->vcc_pin, 0);
277 at91_set_gpio_output(data->rst_pin, 0);
278
279 /* force poweron defaults for these pins ... */
280 at91_set_A_periph(AT91_PIN_PC9, 0); /* A25/CFRNW */
281 at91_set_A_periph(AT91_PIN_PC10, 0); /* NCS4/CFCS */
282 at91_set_A_periph(AT91_PIN_PC11, 0); /* NCS5/CFCE1 */
283 at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */
284
285 /* nWAIT is _not_ a default setting */
286 at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */
287
288 cf_data = *data;
289 platform_device_register(&at91rm9200_cf_device);
290}
291#else
292void __init at91_add_device_cf(struct at91_cf_data *data) {}
293#endif
294
295
296/* --------------------------------------------------------------------
297 * MMC / SD
298 * -------------------------------------------------------------------- */
299
300#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
301static u64 mmc_dmamask = DMA_BIT_MASK(32);
302static struct mci_platform_data mmc_data;
303
304static struct resource mmc_resources[] = {
305 [0] = {
306 .start = AT91RM9200_BASE_MCI,
307 .end = AT91RM9200_BASE_MCI + SZ_16K - 1,
308 .flags = IORESOURCE_MEM,
309 },
310 [1] = {
311 .start = NR_IRQS_LEGACY + AT91RM9200_ID_MCI,
312 .end = NR_IRQS_LEGACY + AT91RM9200_ID_MCI,
313 .flags = IORESOURCE_IRQ,
314 },
315};
316
317static struct platform_device at91rm9200_mmc_device = {
318 .name = "atmel_mci",
319 .id = -1,
320 .dev = {
321 .dma_mask = &mmc_dmamask,
322 .coherent_dma_mask = DMA_BIT_MASK(32),
323 .platform_data = &mmc_data,
324 },
325 .resource = mmc_resources,
326 .num_resources = ARRAY_SIZE(mmc_resources),
327};
328
329void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
330{
331 unsigned int i;
332 unsigned int slot_count = 0;
333
334 if (!data)
335 return;
336
337 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
338
339 if (!data->slot[i].bus_width)
340 continue;
341
342 /* input/irq */
343 if (gpio_is_valid(data->slot[i].detect_pin)) {
344 at91_set_gpio_input(data->slot[i].detect_pin, 1);
345 at91_set_deglitch(data->slot[i].detect_pin, 1);
346 }
347 if (gpio_is_valid(data->slot[i].wp_pin))
348 at91_set_gpio_input(data->slot[i].wp_pin, 1);
349
350 switch (i) {
351 case 0: /* slot A */
352 /* CMD */
353 at91_set_A_periph(AT91_PIN_PA28, 1);
354 /* DAT0, maybe DAT1..DAT3 */
355 at91_set_A_periph(AT91_PIN_PA29, 1);
356 if (data->slot[i].bus_width == 4) {
357 at91_set_B_periph(AT91_PIN_PB3, 1);
358 at91_set_B_periph(AT91_PIN_PB4, 1);
359 at91_set_B_periph(AT91_PIN_PB5, 1);
360 }
361 slot_count++;
362 break;
363 case 1: /* slot B */
364 /* CMD */
365 at91_set_B_periph(AT91_PIN_PA8, 1);
366 /* DAT0, maybe DAT1..DAT3 */
367 at91_set_B_periph(AT91_PIN_PA9, 1);
368 if (data->slot[i].bus_width == 4) {
369 at91_set_B_periph(AT91_PIN_PA10, 1);
370 at91_set_B_periph(AT91_PIN_PA11, 1);
371 at91_set_B_periph(AT91_PIN_PA12, 1);
372 }
373 slot_count++;
374 break;
375 default:
376 printk(KERN_ERR
377 "AT91: SD/MMC slot %d not available\n", i);
378 break;
379 }
380 if (slot_count) {
381 /* CLK */
382 at91_set_A_periph(AT91_PIN_PA27, 0);
383
384 mmc_data = *data;
385 platform_device_register(&at91rm9200_mmc_device);
386 }
387 }
388
389}
390#else
391void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
392#endif
393
394
395/* --------------------------------------------------------------------
396 * NAND / SmartMedia
397 * -------------------------------------------------------------------- */
398
399#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
400static struct atmel_nand_data nand_data;
401
402#define NAND_BASE AT91_CHIPSELECT_3
403
404static struct resource nand_resources[] = {
405 {
406 .start = NAND_BASE,
407 .end = NAND_BASE + SZ_256M - 1,
408 .flags = IORESOURCE_MEM,
409 }
410};
411
412static struct platform_device at91rm9200_nand_device = {
413 .name = "atmel_nand",
414 .id = -1,
415 .dev = {
416 .platform_data = &nand_data,
417 },
418 .resource = nand_resources,
419 .num_resources = ARRAY_SIZE(nand_resources),
420};
421
422void __init at91_add_device_nand(struct atmel_nand_data *data)
423{
424 unsigned int csa;
425
426 if (!data)
427 return;
428
429 /* enable the address range of CS3 */
430 csa = at91_ramc_read(0, AT91_EBI_CSA);
431 at91_ramc_write(0, AT91_EBI_CSA, csa | AT91_EBI_CS3A_SMC_SMARTMEDIA);
432
433 /* set the bus interface characteristics */
434 at91_ramc_write(0, AT91_SMC_CSR(3), AT91_SMC_ACSS_STD | AT91_SMC_DBW_8 | AT91_SMC_WSEN
435 | AT91_SMC_NWS_(5)
436 | AT91_SMC_TDF_(1)
437 | AT91_SMC_RWSETUP_(0) /* tDS Data Set up Time 30 - ns */
438 | AT91_SMC_RWHOLD_(1) /* tDH Data Hold Time 20 - ns */
439 );
440
441 /* enable pin */
442 if (gpio_is_valid(data->enable_pin))
443 at91_set_gpio_output(data->enable_pin, 1);
444
445 /* ready/busy pin */
446 if (gpio_is_valid(data->rdy_pin))
447 at91_set_gpio_input(data->rdy_pin, 1);
448
449 /* card detect pin */
450 if (gpio_is_valid(data->det_pin))
451 at91_set_gpio_input(data->det_pin, 1);
452
453 at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */
454 at91_set_A_periph(AT91_PIN_PC3, 0); /* SMWE */
455
456 nand_data = *data;
457 platform_device_register(&at91rm9200_nand_device);
458}
459#else
460void __init at91_add_device_nand(struct atmel_nand_data *data) {}
461#endif
462
463
464/* --------------------------------------------------------------------
465 * TWI (i2c)
466 * -------------------------------------------------------------------- */
467
468/*
469 * Prefer the GPIO code since the TWI controller isn't robust
470 * (gets overruns and underruns under load) and can only issue
471 * repeated STARTs in one scenario (the driver doesn't yet handle them).
472 */
473#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
474
475static struct i2c_gpio_platform_data pdata = {
476 .sda_pin = AT91_PIN_PA25,
477 .sda_is_open_drain = 1,
478 .scl_pin = AT91_PIN_PA26,
479 .scl_is_open_drain = 1,
480 .udelay = 2, /* ~100 kHz */
481};
482
483static struct platform_device at91rm9200_twi_device = {
484 .name = "i2c-gpio",
485 .id = 0,
486 .dev.platform_data = &pdata,
487};
488
489void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
490{
491 at91_set_GPIO_periph(AT91_PIN_PA25, 1); /* TWD (SDA) */
492 at91_set_multi_drive(AT91_PIN_PA25, 1);
493
494 at91_set_GPIO_periph(AT91_PIN_PA26, 1); /* TWCK (SCL) */
495 at91_set_multi_drive(AT91_PIN_PA26, 1);
496
497 i2c_register_board_info(0, devices, nr_devices);
498 platform_device_register(&at91rm9200_twi_device);
499}
500
501#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
502
503static struct resource twi_resources[] = {
504 [0] = {
505 .start = AT91RM9200_BASE_TWI,
506 .end = AT91RM9200_BASE_TWI + SZ_16K - 1,
507 .flags = IORESOURCE_MEM,
508 },
509 [1] = {
510 .start = NR_IRQS_LEGACY + AT91RM9200_ID_TWI,
511 .end = NR_IRQS_LEGACY + AT91RM9200_ID_TWI,
512 .flags = IORESOURCE_IRQ,
513 },
514};
515
516static struct platform_device at91rm9200_twi_device = {
517 .name = "i2c-at91rm9200",
518 .id = 0,
519 .resource = twi_resources,
520 .num_resources = ARRAY_SIZE(twi_resources),
521};
522
523void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
524{
525 /* pins used for TWI interface */
526 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */
527 at91_set_multi_drive(AT91_PIN_PA25, 1);
528
529 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */
530 at91_set_multi_drive(AT91_PIN_PA26, 1);
531
532 i2c_register_board_info(0, devices, nr_devices);
533 platform_device_register(&at91rm9200_twi_device);
534}
535#else
536void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
537#endif
538
539
540/* --------------------------------------------------------------------
541 * SPI
542 * -------------------------------------------------------------------- */
543
544#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
545static u64 spi_dmamask = DMA_BIT_MASK(32);
546
547static struct resource spi_resources[] = {
548 [0] = {
549 .start = AT91RM9200_BASE_SPI,
550 .end = AT91RM9200_BASE_SPI + SZ_16K - 1,
551 .flags = IORESOURCE_MEM,
552 },
553 [1] = {
554 .start = NR_IRQS_LEGACY + AT91RM9200_ID_SPI,
555 .end = NR_IRQS_LEGACY + AT91RM9200_ID_SPI,
556 .flags = IORESOURCE_IRQ,
557 },
558};
559
560static struct platform_device at91rm9200_spi_device = {
561 .name = "atmel_spi",
562 .id = 0,
563 .dev = {
564 .dma_mask = &spi_dmamask,
565 .coherent_dma_mask = DMA_BIT_MASK(32),
566 },
567 .resource = spi_resources,
568 .num_resources = ARRAY_SIZE(spi_resources),
569};
570
571static const unsigned spi_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PA4, AT91_PIN_PA5, AT91_PIN_PA6 };
572
573void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
574{
575 int i;
576 unsigned long cs_pin;
577
578 at91_set_A_periph(AT91_PIN_PA0, 0); /* MISO */
579 at91_set_A_periph(AT91_PIN_PA1, 0); /* MOSI */
580 at91_set_A_periph(AT91_PIN_PA2, 0); /* SPCK */
581
582 /* Enable SPI chip-selects */
583 for (i = 0; i < nr_devices; i++) {
584 if (devices[i].controller_data)
585 cs_pin = (unsigned long) devices[i].controller_data;
586 else
587 cs_pin = spi_standard_cs[devices[i].chip_select];
588
589 if (devices[i].chip_select == 0) /* for CS0 errata */
590 at91_set_A_periph(cs_pin, 0);
591 else
592 at91_set_gpio_output(cs_pin, 1);
593
594
595 /* pass chip-select pin to driver */
596 devices[i].controller_data = (void *) cs_pin;
597 }
598
599 spi_register_board_info(devices, nr_devices);
600 platform_device_register(&at91rm9200_spi_device);
601}
602#else
603void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
604#endif
605
606
607/* --------------------------------------------------------------------
608 * Timer/Counter blocks
609 * -------------------------------------------------------------------- */
610
611#ifdef CONFIG_ATMEL_TCLIB
612
613static struct resource tcb0_resources[] = {
614 [0] = {
615 .start = AT91RM9200_BASE_TCB0,
616 .end = AT91RM9200_BASE_TCB0 + SZ_16K - 1,
617 .flags = IORESOURCE_MEM,
618 },
619 [1] = {
620 .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC0,
621 .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC0,
622 .flags = IORESOURCE_IRQ,
623 },
624 [2] = {
625 .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC1,
626 .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC1,
627 .flags = IORESOURCE_IRQ,
628 },
629 [3] = {
630 .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC2,
631 .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC2,
632 .flags = IORESOURCE_IRQ,
633 },
634};
635
636static struct platform_device at91rm9200_tcb0_device = {
637 .name = "atmel_tcb",
638 .id = 0,
639 .resource = tcb0_resources,
640 .num_resources = ARRAY_SIZE(tcb0_resources),
641};
642
643static struct resource tcb1_resources[] = {
644 [0] = {
645 .start = AT91RM9200_BASE_TCB1,
646 .end = AT91RM9200_BASE_TCB1 + SZ_16K - 1,
647 .flags = IORESOURCE_MEM,
648 },
649 [1] = {
650 .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC3,
651 .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC3,
652 .flags = IORESOURCE_IRQ,
653 },
654 [2] = {
655 .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC4,
656 .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC4,
657 .flags = IORESOURCE_IRQ,
658 },
659 [3] = {
660 .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC5,
661 .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC5,
662 .flags = IORESOURCE_IRQ,
663 },
664};
665
666static struct platform_device at91rm9200_tcb1_device = {
667 .name = "atmel_tcb",
668 .id = 1,
669 .resource = tcb1_resources,
670 .num_resources = ARRAY_SIZE(tcb1_resources),
671};
672
673static void __init at91_add_device_tc(void)
674{
675 platform_device_register(&at91rm9200_tcb0_device);
676 platform_device_register(&at91rm9200_tcb1_device);
677}
678#else
679static void __init at91_add_device_tc(void) { }
680#endif
681
682
683/* --------------------------------------------------------------------
684 * RTC
685 * -------------------------------------------------------------------- */
686
687#if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
688static struct resource rtc_resources[] = {
689 [0] = {
690 .start = AT91RM9200_BASE_RTC,
691 .end = AT91RM9200_BASE_RTC + SZ_256 - 1,
692 .flags = IORESOURCE_MEM,
693 },
694 [1] = {
695 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
696 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
697 .flags = IORESOURCE_IRQ,
698 },
699};
700
701static struct platform_device at91rm9200_rtc_device = {
702 .name = "at91_rtc",
703 .id = -1,
704 .resource = rtc_resources,
705 .num_resources = ARRAY_SIZE(rtc_resources),
706};
707
708static void __init at91_add_device_rtc(void)
709{
710 platform_device_register(&at91rm9200_rtc_device);
711}
712#else
713static void __init at91_add_device_rtc(void) {}
714#endif
715
716
717/* --------------------------------------------------------------------
718 * Watchdog
719 * -------------------------------------------------------------------- */
720
721#if defined(CONFIG_AT91RM9200_WATCHDOG) || defined(CONFIG_AT91RM9200_WATCHDOG_MODULE)
722static struct platform_device at91rm9200_wdt_device = {
723 .name = "at91_wdt",
724 .id = -1,
725 .num_resources = 0,
726};
727
728static void __init at91_add_device_watchdog(void)
729{
730 platform_device_register(&at91rm9200_wdt_device);
731}
732#else
733static void __init at91_add_device_watchdog(void) {}
734#endif
735
736
737/* --------------------------------------------------------------------
738 * SSC -- Synchronous Serial Controller
739 * -------------------------------------------------------------------- */
740
741#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
742static u64 ssc0_dmamask = DMA_BIT_MASK(32);
743
744static struct resource ssc0_resources[] = {
745 [0] = {
746 .start = AT91RM9200_BASE_SSC0,
747 .end = AT91RM9200_BASE_SSC0 + SZ_16K - 1,
748 .flags = IORESOURCE_MEM,
749 },
750 [1] = {
751 .start = NR_IRQS_LEGACY + AT91RM9200_ID_SSC0,
752 .end = NR_IRQS_LEGACY + AT91RM9200_ID_SSC0,
753 .flags = IORESOURCE_IRQ,
754 },
755};
756
757static struct platform_device at91rm9200_ssc0_device = {
758 .name = "at91rm9200_ssc",
759 .id = 0,
760 .dev = {
761 .dma_mask = &ssc0_dmamask,
762 .coherent_dma_mask = DMA_BIT_MASK(32),
763 },
764 .resource = ssc0_resources,
765 .num_resources = ARRAY_SIZE(ssc0_resources),
766};
767
768static inline void configure_ssc0_pins(unsigned pins)
769{
770 if (pins & ATMEL_SSC_TF)
771 at91_set_A_periph(AT91_PIN_PB0, 1);
772 if (pins & ATMEL_SSC_TK)
773 at91_set_A_periph(AT91_PIN_PB1, 1);
774 if (pins & ATMEL_SSC_TD)
775 at91_set_A_periph(AT91_PIN_PB2, 1);
776 if (pins & ATMEL_SSC_RD)
777 at91_set_A_periph(AT91_PIN_PB3, 1);
778 if (pins & ATMEL_SSC_RK)
779 at91_set_A_periph(AT91_PIN_PB4, 1);
780 if (pins & ATMEL_SSC_RF)
781 at91_set_A_periph(AT91_PIN_PB5, 1);
782}
783
784static u64 ssc1_dmamask = DMA_BIT_MASK(32);
785
786static struct resource ssc1_resources[] = {
787 [0] = {
788 .start = AT91RM9200_BASE_SSC1,
789 .end = AT91RM9200_BASE_SSC1 + SZ_16K - 1,
790 .flags = IORESOURCE_MEM,
791 },
792 [1] = {
793 .start = NR_IRQS_LEGACY + AT91RM9200_ID_SSC1,
794 .end = NR_IRQS_LEGACY + AT91RM9200_ID_SSC1,
795 .flags = IORESOURCE_IRQ,
796 },
797};
798
799static struct platform_device at91rm9200_ssc1_device = {
800 .name = "at91rm9200_ssc",
801 .id = 1,
802 .dev = {
803 .dma_mask = &ssc1_dmamask,
804 .coherent_dma_mask = DMA_BIT_MASK(32),
805 },
806 .resource = ssc1_resources,
807 .num_resources = ARRAY_SIZE(ssc1_resources),
808};
809
810static inline void configure_ssc1_pins(unsigned pins)
811{
812 if (pins & ATMEL_SSC_TF)
813 at91_set_A_periph(AT91_PIN_PB6, 1);
814 if (pins & ATMEL_SSC_TK)
815 at91_set_A_periph(AT91_PIN_PB7, 1);
816 if (pins & ATMEL_SSC_TD)
817 at91_set_A_periph(AT91_PIN_PB8, 1);
818 if (pins & ATMEL_SSC_RD)
819 at91_set_A_periph(AT91_PIN_PB9, 1);
820 if (pins & ATMEL_SSC_RK)
821 at91_set_A_periph(AT91_PIN_PB10, 1);
822 if (pins & ATMEL_SSC_RF)
823 at91_set_A_periph(AT91_PIN_PB11, 1);
824}
825
826static u64 ssc2_dmamask = DMA_BIT_MASK(32);
827
828static struct resource ssc2_resources[] = {
829 [0] = {
830 .start = AT91RM9200_BASE_SSC2,
831 .end = AT91RM9200_BASE_SSC2 + SZ_16K - 1,
832 .flags = IORESOURCE_MEM,
833 },
834 [1] = {
835 .start = NR_IRQS_LEGACY + AT91RM9200_ID_SSC2,
836 .end = NR_IRQS_LEGACY + AT91RM9200_ID_SSC2,
837 .flags = IORESOURCE_IRQ,
838 },
839};
840
841static struct platform_device at91rm9200_ssc2_device = {
842 .name = "at91rm9200_ssc",
843 .id = 2,
844 .dev = {
845 .dma_mask = &ssc2_dmamask,
846 .coherent_dma_mask = DMA_BIT_MASK(32),
847 },
848 .resource = ssc2_resources,
849 .num_resources = ARRAY_SIZE(ssc2_resources),
850};
851
852static inline void configure_ssc2_pins(unsigned pins)
853{
854 if (pins & ATMEL_SSC_TF)
855 at91_set_A_periph(AT91_PIN_PB12, 1);
856 if (pins & ATMEL_SSC_TK)
857 at91_set_A_periph(AT91_PIN_PB13, 1);
858 if (pins & ATMEL_SSC_TD)
859 at91_set_A_periph(AT91_PIN_PB14, 1);
860 if (pins & ATMEL_SSC_RD)
861 at91_set_A_periph(AT91_PIN_PB15, 1);
862 if (pins & ATMEL_SSC_RK)
863 at91_set_A_periph(AT91_PIN_PB16, 1);
864 if (pins & ATMEL_SSC_RF)
865 at91_set_A_periph(AT91_PIN_PB17, 1);
866}
867
868/*
869 * SSC controllers are accessed through library code, instead of any
870 * kind of all-singing/all-dancing driver. For example one could be
871 * used by a particular I2S audio codec's driver, while another one
872 * on the same system might be used by a custom data capture driver.
873 */
874void __init at91_add_device_ssc(unsigned id, unsigned pins)
875{
876 struct platform_device *pdev;
877
878 /*
879 * NOTE: caller is responsible for passing information matching
880 * "pins" to whatever will be using each particular controller.
881 */
882 switch (id) {
883 case AT91RM9200_ID_SSC0:
884 pdev = &at91rm9200_ssc0_device;
885 configure_ssc0_pins(pins);
886 break;
887 case AT91RM9200_ID_SSC1:
888 pdev = &at91rm9200_ssc1_device;
889 configure_ssc1_pins(pins);
890 break;
891 case AT91RM9200_ID_SSC2:
892 pdev = &at91rm9200_ssc2_device;
893 configure_ssc2_pins(pins);
894 break;
895 default:
896 return;
897 }
898
899 platform_device_register(pdev);
900}
901
902#else
903void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
904#endif
905
906
907/* --------------------------------------------------------------------
908 * UART
909 * -------------------------------------------------------------------- */
910
911#if defined(CONFIG_SERIAL_ATMEL)
912static struct resource dbgu_resources[] = {
913 [0] = {
914 .start = AT91RM9200_BASE_DBGU,
915 .end = AT91RM9200_BASE_DBGU + SZ_512 - 1,
916 .flags = IORESOURCE_MEM,
917 },
918 [1] = {
919 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
920 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
921 .flags = IORESOURCE_IRQ,
922 },
923};
924
925static struct atmel_uart_data dbgu_data = {
926 .use_dma_tx = 0,
927 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
928};
929
930static u64 dbgu_dmamask = DMA_BIT_MASK(32);
931
932static struct platform_device at91rm9200_dbgu_device = {
933 .name = "atmel_usart",
934 .id = 0,
935 .dev = {
936 .dma_mask = &dbgu_dmamask,
937 .coherent_dma_mask = DMA_BIT_MASK(32),
938 .platform_data = &dbgu_data,
939 },
940 .resource = dbgu_resources,
941 .num_resources = ARRAY_SIZE(dbgu_resources),
942};
943
944static inline void configure_dbgu_pins(void)
945{
946 at91_set_A_periph(AT91_PIN_PA30, 0); /* DRXD */
947 at91_set_A_periph(AT91_PIN_PA31, 1); /* DTXD */
948}
949
950static struct resource uart0_resources[] = {
951 [0] = {
952 .start = AT91RM9200_BASE_US0,
953 .end = AT91RM9200_BASE_US0 + SZ_16K - 1,
954 .flags = IORESOURCE_MEM,
955 },
956 [1] = {
957 .start = NR_IRQS_LEGACY + AT91RM9200_ID_US0,
958 .end = NR_IRQS_LEGACY + AT91RM9200_ID_US0,
959 .flags = IORESOURCE_IRQ,
960 },
961};
962
963static struct atmel_uart_data uart0_data = {
964 .use_dma_tx = 1,
965 .use_dma_rx = 1,
966};
967
968static struct gpiod_lookup_table uart0_gpios_table = {
969 .dev_id = "atmel_usart",
970 .table = {
971 GPIO_LOOKUP("pioA", 21, "rts", GPIO_ACTIVE_LOW),
972 { },
973 },
974};
975
976static u64 uart0_dmamask = DMA_BIT_MASK(32);
977
978static struct platform_device at91rm9200_uart0_device = {
979 .name = "atmel_usart",
980 .id = 1,
981 .dev = {
982 .dma_mask = &uart0_dmamask,
983 .coherent_dma_mask = DMA_BIT_MASK(32),
984 .platform_data = &uart0_data,
985 },
986 .resource = uart0_resources,
987 .num_resources = ARRAY_SIZE(uart0_resources),
988};
989
990static inline void configure_usart0_pins(unsigned pins)
991{
992 at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */
993 at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */
994
995 if (pins & ATMEL_UART_CTS)
996 at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */
997
998 if (pins & ATMEL_UART_RTS) {
999 /*
1000 * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21.
1001 * We need to drive the pin manually. The serial driver will driver
1002 * this to high when initializing.
1003 */
1004 gpiod_add_lookup_table(&uart0_gpios_table);
1005 }
1006}
1007
1008static struct resource uart1_resources[] = {
1009 [0] = {
1010 .start = AT91RM9200_BASE_US1,
1011 .end = AT91RM9200_BASE_US1 + SZ_16K - 1,
1012 .flags = IORESOURCE_MEM,
1013 },
1014 [1] = {
1015 .start = NR_IRQS_LEGACY + AT91RM9200_ID_US1,
1016 .end = NR_IRQS_LEGACY + AT91RM9200_ID_US1,
1017 .flags = IORESOURCE_IRQ,
1018 },
1019};
1020
1021static struct atmel_uart_data uart1_data = {
1022 .use_dma_tx = 1,
1023 .use_dma_rx = 1,
1024};
1025
1026static u64 uart1_dmamask = DMA_BIT_MASK(32);
1027
1028static struct platform_device at91rm9200_uart1_device = {
1029 .name = "atmel_usart",
1030 .id = 2,
1031 .dev = {
1032 .dma_mask = &uart1_dmamask,
1033 .coherent_dma_mask = DMA_BIT_MASK(32),
1034 .platform_data = &uart1_data,
1035 },
1036 .resource = uart1_resources,
1037 .num_resources = ARRAY_SIZE(uart1_resources),
1038};
1039
1040static inline void configure_usart1_pins(unsigned pins)
1041{
1042 at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */
1043 at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */
1044
1045 if (pins & ATMEL_UART_RI)
1046 at91_set_A_periph(AT91_PIN_PB18, 0); /* RI1 */
1047 if (pins & ATMEL_UART_DTR)
1048 at91_set_A_periph(AT91_PIN_PB19, 0); /* DTR1 */
1049 if (pins & ATMEL_UART_DCD)
1050 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD1 */
1051 if (pins & ATMEL_UART_CTS)
1052 at91_set_A_periph(AT91_PIN_PB24, 0); /* CTS1 */
1053 if (pins & ATMEL_UART_DSR)
1054 at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */
1055 if (pins & ATMEL_UART_RTS)
1056 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */
1057}
1058
1059static struct resource uart2_resources[] = {
1060 [0] = {
1061 .start = AT91RM9200_BASE_US2,
1062 .end = AT91RM9200_BASE_US2 + SZ_16K - 1,
1063 .flags = IORESOURCE_MEM,
1064 },
1065 [1] = {
1066 .start = NR_IRQS_LEGACY + AT91RM9200_ID_US2,
1067 .end = NR_IRQS_LEGACY + AT91RM9200_ID_US2,
1068 .flags = IORESOURCE_IRQ,
1069 },
1070};
1071
1072static struct atmel_uart_data uart2_data = {
1073 .use_dma_tx = 1,
1074 .use_dma_rx = 1,
1075};
1076
1077static u64 uart2_dmamask = DMA_BIT_MASK(32);
1078
1079static struct platform_device at91rm9200_uart2_device = {
1080 .name = "atmel_usart",
1081 .id = 3,
1082 .dev = {
1083 .dma_mask = &uart2_dmamask,
1084 .coherent_dma_mask = DMA_BIT_MASK(32),
1085 .platform_data = &uart2_data,
1086 },
1087 .resource = uart2_resources,
1088 .num_resources = ARRAY_SIZE(uart2_resources),
1089};
1090
1091static inline void configure_usart2_pins(unsigned pins)
1092{
1093 at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */
1094 at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */
1095
1096 if (pins & ATMEL_UART_CTS)
1097 at91_set_B_periph(AT91_PIN_PA30, 0); /* CTS2 */
1098 if (pins & ATMEL_UART_RTS)
1099 at91_set_B_periph(AT91_PIN_PA31, 0); /* RTS2 */
1100}
1101
1102static struct resource uart3_resources[] = {
1103 [0] = {
1104 .start = AT91RM9200_BASE_US3,
1105 .end = AT91RM9200_BASE_US3 + SZ_16K - 1,
1106 .flags = IORESOURCE_MEM,
1107 },
1108 [1] = {
1109 .start = NR_IRQS_LEGACY + AT91RM9200_ID_US3,
1110 .end = NR_IRQS_LEGACY + AT91RM9200_ID_US3,
1111 .flags = IORESOURCE_IRQ,
1112 },
1113};
1114
1115static struct atmel_uart_data uart3_data = {
1116 .use_dma_tx = 1,
1117 .use_dma_rx = 1,
1118};
1119
1120static u64 uart3_dmamask = DMA_BIT_MASK(32);
1121
1122static struct platform_device at91rm9200_uart3_device = {
1123 .name = "atmel_usart",
1124 .id = 4,
1125 .dev = {
1126 .dma_mask = &uart3_dmamask,
1127 .coherent_dma_mask = DMA_BIT_MASK(32),
1128 .platform_data = &uart3_data,
1129 },
1130 .resource = uart3_resources,
1131 .num_resources = ARRAY_SIZE(uart3_resources),
1132};
1133
1134static inline void configure_usart3_pins(unsigned pins)
1135{
1136 at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */
1137 at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */
1138
1139 if (pins & ATMEL_UART_CTS)
1140 at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS3 */
1141 if (pins & ATMEL_UART_RTS)
1142 at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */
1143}
1144
1145static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1146
1147void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1148{
1149 struct platform_device *pdev;
1150 struct atmel_uart_data *pdata;
1151
1152 switch (id) {
1153 case 0: /* DBGU */
1154 pdev = &at91rm9200_dbgu_device;
1155 configure_dbgu_pins();
1156 break;
1157 case AT91RM9200_ID_US0:
1158 pdev = &at91rm9200_uart0_device;
1159 configure_usart0_pins(pins);
1160 break;
1161 case AT91RM9200_ID_US1:
1162 pdev = &at91rm9200_uart1_device;
1163 configure_usart1_pins(pins);
1164 break;
1165 case AT91RM9200_ID_US2:
1166 pdev = &at91rm9200_uart2_device;
1167 configure_usart2_pins(pins);
1168 break;
1169 case AT91RM9200_ID_US3:
1170 pdev = &at91rm9200_uart3_device;
1171 configure_usart3_pins(pins);
1172 break;
1173 default:
1174 return;
1175 }
1176 pdata = pdev->dev.platform_data;
1177 pdata->num = portnr; /* update to mapped ID */
1178
1179 if (portnr < ATMEL_MAX_UART)
1180 at91_uarts[portnr] = pdev;
1181}
1182
1183void __init at91_add_device_serial(void)
1184{
1185 int i;
1186
1187 for (i = 0; i < ATMEL_MAX_UART; i++) {
1188 if (at91_uarts[i])
1189 platform_device_register(at91_uarts[i]);
1190 }
1191}
1192#else
1193void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1194void __init at91_add_device_serial(void) {}
1195#endif
1196
1197
1198/* -------------------------------------------------------------------- */
1199
1200/*
1201 * These devices are always present and don't need any board-specific
1202 * setup.
1203 */
1204static int __init at91_add_standard_devices(void)
1205{
1206 at91_add_device_rtc();
1207 at91_add_device_watchdog();
1208 at91_add_device_tc();
1209 return 0;
1210}
1211
1212arch_initcall(at91_add_standard_devices);
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index 7fd13aef9827..51761f8927b7 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -183,7 +183,6 @@ static struct clock_event_device clkevt = {
183void __iomem *at91_st_base; 183void __iomem *at91_st_base;
184EXPORT_SYMBOL_GPL(at91_st_base); 184EXPORT_SYMBOL_GPL(at91_st_base);
185 185
186#ifdef CONFIG_OF
187static struct of_device_id at91rm9200_st_timer_ids[] = { 186static struct of_device_id at91rm9200_st_timer_ids[] = {
188 { .compatible = "atmel,at91rm9200-st" }, 187 { .compatible = "atmel,at91rm9200-st" },
189 { /* sentinel */ } 188 { /* sentinel */ }
@@ -219,28 +218,6 @@ node_err:
219err: 218err:
220 return -EINVAL; 219 return -EINVAL;
221} 220}
222#else
223static int __init of_at91rm9200_st_init(void)
224{
225 return -EINVAL;
226}
227#endif
228
229void __init at91rm9200_ioremap_st(u32 addr)
230{
231#ifdef CONFIG_OF
232 struct device_node *np;
233
234 np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
235 if (np) {
236 of_node_put(np);
237 return;
238 }
239#endif
240 at91_st_base = ioremap(addr, 256);
241 if (!at91_st_base)
242 panic("Impossible to ioremap ST\n");
243}
244 221
245/* 222/*
246 * ST (system timer) module supports both clockevents and clocksource. 223 * ST (system timer) module supports both clockevents and clocksource.
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index aab1f969a7c3..78137c24d90b 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -10,305 +10,13 @@
10 * 10 *
11 */ 11 */
12 12
13#include <linux/module.h>
14#include <linux/platform_device.h>
15#include <linux/clk/at91_pmc.h>
16
17#include <asm/proc-fns.h>
18#include <asm/irq.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <asm/system_misc.h> 13#include <asm/system_misc.h>
22#include <mach/cpu.h> 14#include <mach/cpu.h>
23#include <mach/at91_dbgu.h> 15#include <mach/at91_dbgu.h>
24#include <mach/at91sam9260.h>
25#include <mach/hardware.h> 16#include <mach/hardware.h>
26 17
27#include "at91_aic.h"
28#include "soc.h" 18#include "soc.h"
29#include "generic.h" 19#include "generic.h"
30#include "sam9_smc.h"
31#include "pm.h"
32
33#if defined(CONFIG_OLD_CLK_AT91)
34#include "clock.h"
35/* --------------------------------------------------------------------
36 * Clocks
37 * -------------------------------------------------------------------- */
38
39/*
40 * The peripheral clocks.
41 */
42static struct clk pioA_clk = {
43 .name = "pioA_clk",
44 .pmc_mask = 1 << AT91SAM9260_ID_PIOA,
45 .type = CLK_TYPE_PERIPHERAL,
46};
47static struct clk pioB_clk = {
48 .name = "pioB_clk",
49 .pmc_mask = 1 << AT91SAM9260_ID_PIOB,
50 .type = CLK_TYPE_PERIPHERAL,
51};
52static struct clk pioC_clk = {
53 .name = "pioC_clk",
54 .pmc_mask = 1 << AT91SAM9260_ID_PIOC,
55 .type = CLK_TYPE_PERIPHERAL,
56};
57static struct clk adc_clk = {
58 .name = "adc_clk",
59 .pmc_mask = 1 << AT91SAM9260_ID_ADC,
60 .type = CLK_TYPE_PERIPHERAL,
61};
62
63static struct clk adc_op_clk = {
64 .name = "adc_op_clk",
65 .type = CLK_TYPE_PERIPHERAL,
66 .rate_hz = 5000000,
67};
68
69static struct clk usart0_clk = {
70 .name = "usart0_clk",
71 .pmc_mask = 1 << AT91SAM9260_ID_US0,
72 .type = CLK_TYPE_PERIPHERAL,
73};
74static struct clk usart1_clk = {
75 .name = "usart1_clk",
76 .pmc_mask = 1 << AT91SAM9260_ID_US1,
77 .type = CLK_TYPE_PERIPHERAL,
78};
79static struct clk usart2_clk = {
80 .name = "usart2_clk",
81 .pmc_mask = 1 << AT91SAM9260_ID_US2,
82 .type = CLK_TYPE_PERIPHERAL,
83};
84static struct clk mmc_clk = {
85 .name = "mci_clk",
86 .pmc_mask = 1 << AT91SAM9260_ID_MCI,
87 .type = CLK_TYPE_PERIPHERAL,
88};
89static struct clk udc_clk = {
90 .name = "udc_clk",
91 .pmc_mask = 1 << AT91SAM9260_ID_UDP,
92 .type = CLK_TYPE_PERIPHERAL,
93};
94static struct clk twi_clk = {
95 .name = "twi_clk",
96 .pmc_mask = 1 << AT91SAM9260_ID_TWI,
97 .type = CLK_TYPE_PERIPHERAL,
98};
99static struct clk spi0_clk = {
100 .name = "spi0_clk",
101 .pmc_mask = 1 << AT91SAM9260_ID_SPI0,
102 .type = CLK_TYPE_PERIPHERAL,
103};
104static struct clk spi1_clk = {
105 .name = "spi1_clk",
106 .pmc_mask = 1 << AT91SAM9260_ID_SPI1,
107 .type = CLK_TYPE_PERIPHERAL,
108};
109static struct clk ssc_clk = {
110 .name = "ssc_clk",
111 .pmc_mask = 1 << AT91SAM9260_ID_SSC,
112 .type = CLK_TYPE_PERIPHERAL,
113};
114static struct clk tc0_clk = {
115 .name = "tc0_clk",
116 .pmc_mask = 1 << AT91SAM9260_ID_TC0,
117 .type = CLK_TYPE_PERIPHERAL,
118};
119static struct clk tc1_clk = {
120 .name = "tc1_clk",
121 .pmc_mask = 1 << AT91SAM9260_ID_TC1,
122 .type = CLK_TYPE_PERIPHERAL,
123};
124static struct clk tc2_clk = {
125 .name = "tc2_clk",
126 .pmc_mask = 1 << AT91SAM9260_ID_TC2,
127 .type = CLK_TYPE_PERIPHERAL,
128};
129static struct clk ohci_clk = {
130 .name = "ohci_clk",
131 .pmc_mask = 1 << AT91SAM9260_ID_UHP,
132 .type = CLK_TYPE_PERIPHERAL,
133};
134static struct clk macb_clk = {
135 .name = "pclk",
136 .pmc_mask = 1 << AT91SAM9260_ID_EMAC,
137 .type = CLK_TYPE_PERIPHERAL,
138};
139static struct clk isi_clk = {
140 .name = "isi_clk",
141 .pmc_mask = 1 << AT91SAM9260_ID_ISI,
142 .type = CLK_TYPE_PERIPHERAL,
143};
144static struct clk usart3_clk = {
145 .name = "usart3_clk",
146 .pmc_mask = 1 << AT91SAM9260_ID_US3,
147 .type = CLK_TYPE_PERIPHERAL,
148};
149static struct clk usart4_clk = {
150 .name = "usart4_clk",
151 .pmc_mask = 1 << AT91SAM9260_ID_US4,
152 .type = CLK_TYPE_PERIPHERAL,
153};
154static struct clk usart5_clk = {
155 .name = "usart5_clk",
156 .pmc_mask = 1 << AT91SAM9260_ID_US5,
157 .type = CLK_TYPE_PERIPHERAL,
158};
159static struct clk tc3_clk = {
160 .name = "tc3_clk",
161 .pmc_mask = 1 << AT91SAM9260_ID_TC3,
162 .type = CLK_TYPE_PERIPHERAL,
163};
164static struct clk tc4_clk = {
165 .name = "tc4_clk",
166 .pmc_mask = 1 << AT91SAM9260_ID_TC4,
167 .type = CLK_TYPE_PERIPHERAL,
168};
169static struct clk tc5_clk = {
170 .name = "tc5_clk",
171 .pmc_mask = 1 << AT91SAM9260_ID_TC5,
172 .type = CLK_TYPE_PERIPHERAL,
173};
174
175static struct clk *periph_clocks[] __initdata = {
176 &pioA_clk,
177 &pioB_clk,
178 &pioC_clk,
179 &adc_clk,
180 &adc_op_clk,
181 &usart0_clk,
182 &usart1_clk,
183 &usart2_clk,
184 &mmc_clk,
185 &udc_clk,
186 &twi_clk,
187 &spi0_clk,
188 &spi1_clk,
189 &ssc_clk,
190 &tc0_clk,
191 &tc1_clk,
192 &tc2_clk,
193 &ohci_clk,
194 &macb_clk,
195 &isi_clk,
196 &usart3_clk,
197 &usart4_clk,
198 &usart5_clk,
199 &tc3_clk,
200 &tc4_clk,
201 &tc5_clk,
202 // irq0 .. irq2
203};
204
205static struct clk_lookup periph_clocks_lookups[] = {
206 /* One additional fake clock for macb_hclk */
207 CLKDEV_CON_ID("hclk", &macb_clk),
208 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
209 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
210 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
211 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
212 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
213 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk),
214 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
215 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
216 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc_clk),
217 CLKDEV_CON_DEV_ID("pclk", "fffbc000.ssc", &ssc_clk),
218 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk),
219 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi_clk),
220 /* more usart lookup table for DT entries */
221 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
222 CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
223 CLKDEV_CON_DEV_ID("usart", "fffb4000.serial", &usart1_clk),
224 CLKDEV_CON_DEV_ID("usart", "fffb8000.serial", &usart2_clk),
225 CLKDEV_CON_DEV_ID("usart", "fffd0000.serial", &usart3_clk),
226 CLKDEV_CON_DEV_ID("usart", "fffd4000.serial", &usart4_clk),
227 CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk),
228 CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi_clk),
229 /* more tc lookup table for DT entries */
230 CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
231 CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
232 CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
233 CLKDEV_CON_DEV_ID("t0_clk", "fffdc000.timer", &tc3_clk),
234 CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk),
235 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk),
236 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk),
237 CLKDEV_CON_DEV_ID("mci_clk", "fffa8000.mmc", &mmc_clk),
238 CLKDEV_CON_DEV_ID("spi_clk", "fffc8000.spi", &spi0_clk),
239 CLKDEV_CON_DEV_ID("spi_clk", "fffcc000.spi", &spi1_clk),
240 /* fake hclk clock */
241 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
242 CLKDEV_CON_ID("pioA", &pioA_clk),
243 CLKDEV_CON_ID("pioB", &pioB_clk),
244 CLKDEV_CON_ID("pioC", &pioC_clk),
245 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
246 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
247 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
248};
249
250static struct clk_lookup usart_clocks_lookups[] = {
251 CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck),
252 CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk),
253 CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk),
254 CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk),
255 CLKDEV_CON_DEV_ID("usart", "atmel_usart.4", &usart3_clk),
256 CLKDEV_CON_DEV_ID("usart", "atmel_usart.5", &usart4_clk),
257 CLKDEV_CON_DEV_ID("usart", "atmel_usart.6", &usart5_clk),
258};
259
260/*
261 * The two programmable clocks.
262 * You must configure pin multiplexing to bring these signals out.
263 */
264static struct clk pck0 = {
265 .name = "pck0",
266 .pmc_mask = AT91_PMC_PCK0,
267 .type = CLK_TYPE_PROGRAMMABLE,
268 .id = 0,
269};
270static struct clk pck1 = {
271 .name = "pck1",
272 .pmc_mask = AT91_PMC_PCK1,
273 .type = CLK_TYPE_PROGRAMMABLE,
274 .id = 1,
275};
276
277static void __init at91sam9260_register_clocks(void)
278{
279 int i;
280
281 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
282 clk_register(periph_clocks[i]);
283
284 clkdev_add_table(periph_clocks_lookups,
285 ARRAY_SIZE(periph_clocks_lookups));
286 clkdev_add_table(usart_clocks_lookups,
287 ARRAY_SIZE(usart_clocks_lookups));
288
289 clk_register(&pck0);
290 clk_register(&pck1);
291}
292#else
293#define at91sam9260_register_clocks NULL
294#endif
295
296/* --------------------------------------------------------------------
297 * GPIO
298 * -------------------------------------------------------------------- */
299
300static struct at91_gpio_bank at91sam9260_gpio[] __initdata = {
301 {
302 .id = AT91SAM9260_ID_PIOA,
303 .regbase = AT91SAM9260_BASE_PIOA,
304 }, {
305 .id = AT91SAM9260_ID_PIOB,
306 .regbase = AT91SAM9260_BASE_PIOB,
307 }, {
308 .id = AT91SAM9260_ID_PIOC,
309 .regbase = AT91SAM9260_BASE_PIOC,
310 }
311};
312 20
313/* -------------------------------------------------------------------- 21/* --------------------------------------------------------------------
314 * AT91SAM9260 processor initialization 22 * AT91SAM9260 processor initialization
@@ -340,119 +48,14 @@ static void __init at91sam9260_map_io(void)
340 at91_init_sram(0, AT91SAM9260_SRAM_BASE, AT91SAM9260_SRAM_SIZE); 48 at91_init_sram(0, AT91SAM9260_SRAM_BASE, AT91SAM9260_SRAM_SIZE);
341} 49}
342 50
343static void __init at91sam9260_ioremap_registers(void)
344{
345 at91_ioremap_ramc(0, AT91SAM9260_BASE_SDRAMC, 512);
346 at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT);
347 at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC);
348 at91_ioremap_matrix(AT91SAM9260_BASE_MATRIX);
349 at91_pm_set_standby(at91sam9_sdram_standby);
350}
351
352static void __init at91sam9260_initialize(void) 51static void __init at91sam9260_initialize(void)
353{ 52{
354 arm_pm_idle = at91sam9_idle; 53 arm_pm_idle = at91sam9_idle;
355 54
356 at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT); 55 at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT);
357
358 /* Register GPIO subsystem */
359 at91_gpio_init(at91sam9260_gpio, 3);
360}
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
401/* --------------------------------------------------------------------
402 * Interrupt initialization
403 * -------------------------------------------------------------------- */
404
405/*
406 * The default interrupt priority levels (0 = lowest, 7 = highest).
407 */
408static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
409 7, /* Advanced Interrupt Controller */
410 7, /* System Peripherals */
411 1, /* Parallel IO Controller A */
412 1, /* Parallel IO Controller B */
413 1, /* Parallel IO Controller C */
414 0, /* Analog-to-Digital Converter */
415 5, /* USART 0 */
416 5, /* USART 1 */
417 5, /* USART 2 */
418 0, /* Multimedia Card Interface */
419 2, /* USB Device Port */
420 6, /* Two-Wire Interface */
421 5, /* Serial Peripheral Interface 0 */
422 5, /* Serial Peripheral Interface 1 */
423 5, /* Serial Synchronous Controller */
424 0,
425 0,
426 0, /* Timer Counter 0 */
427 0, /* Timer Counter 1 */
428 0, /* Timer Counter 2 */
429 2, /* USB Host port */
430 3, /* Ethernet */
431 0, /* Image Sensor Interface */
432 5, /* USART 3 */
433 5, /* USART 4 */
434 5, /* USART 5 */
435 0, /* Timer Counter 3 */
436 0, /* Timer Counter 4 */
437 0, /* Timer Counter 5 */
438 0, /* Advanced Interrupt Controller */
439 0, /* Advanced Interrupt Controller */
440 0, /* Advanced Interrupt Controller */
441};
442
443static void __init at91sam9260_init_time(void)
444{
445 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
446} 56}
447 57
448AT91_SOC_START(at91sam9260) 58AT91_SOC_START(at91sam9260)
449 .map_io = at91sam9260_map_io, 59 .map_io = at91sam9260_map_io,
450 .default_irq_priority = at91sam9260_default_irq_priority,
451 .extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
452 | (1 << AT91SAM9260_ID_IRQ2),
453 .ioremap_registers = at91sam9260_ioremap_registers,
454 .register_clocks = at91sam9260_register_clocks,
455 .register_devices = at91sam9260_register_devices,
456 .init = at91sam9260_initialize, 60 .init = at91sam9260_initialize,
457 .init_time = at91sam9260_init_time,
458AT91_SOC_END 61AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
deleted file mode 100644
index ef88e0fe4e80..000000000000
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ /dev/null
@@ -1,1364 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91sam9260_devices.c
3 *
4 * Copyright (C) 2006 Atmel
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12#include <asm/mach/arch.h>
13#include <asm/mach/map.h>
14
15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
17#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h>
19
20#include <linux/platform_data/at91_adc.h>
21
22#include <mach/cpu.h>
23#include <mach/at91sam9260.h>
24#include <mach/at91sam9260_matrix.h>
25#include <mach/at91_matrix.h>
26#include <mach/at91sam9_smc.h>
27#include <mach/hardware.h>
28
29#include "board.h"
30#include "generic.h"
31#include "gpio.h"
32
33/* --------------------------------------------------------------------
34 * USB Host
35 * -------------------------------------------------------------------- */
36
37#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
38static u64 ohci_dmamask = DMA_BIT_MASK(32);
39static struct at91_usbh_data usbh_data;
40
41static struct resource usbh_resources[] = {
42 [0] = {
43 .start = AT91SAM9260_UHP_BASE,
44 .end = AT91SAM9260_UHP_BASE + SZ_1M - 1,
45 .flags = IORESOURCE_MEM,
46 },
47 [1] = {
48 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_UHP,
49 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_UHP,
50 .flags = IORESOURCE_IRQ,
51 },
52};
53
54static struct platform_device at91_usbh_device = {
55 .name = "at91_ohci",
56 .id = -1,
57 .dev = {
58 .dma_mask = &ohci_dmamask,
59 .coherent_dma_mask = DMA_BIT_MASK(32),
60 .platform_data = &usbh_data,
61 },
62 .resource = usbh_resources,
63 .num_resources = ARRAY_SIZE(usbh_resources),
64};
65
66void __init at91_add_device_usbh(struct at91_usbh_data *data)
67{
68 int i;
69
70 if (!data)
71 return;
72
73 /* Enable overcurrent notification */
74 for (i = 0; i < data->ports; i++) {
75 if (gpio_is_valid(data->overcurrent_pin[i]))
76 at91_set_gpio_input(data->overcurrent_pin[i], 1);
77 }
78
79 usbh_data = *data;
80 platform_device_register(&at91_usbh_device);
81}
82#else
83void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
84#endif
85
86
87/* --------------------------------------------------------------------
88 * USB Device (Gadget)
89 * -------------------------------------------------------------------- */
90
91#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
92static struct at91_udc_data udc_data;
93
94static struct resource udc_resources[] = {
95 [0] = {
96 .start = AT91SAM9260_BASE_UDP,
97 .end = AT91SAM9260_BASE_UDP + SZ_16K - 1,
98 .flags = IORESOURCE_MEM,
99 },
100 [1] = {
101 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_UDP,
102 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_UDP,
103 .flags = IORESOURCE_IRQ,
104 },
105};
106
107static struct platform_device at91_udc_device = {
108 .name = "at91_udc",
109 .id = -1,
110 .dev = {
111 .platform_data = &udc_data,
112 },
113 .resource = udc_resources,
114 .num_resources = ARRAY_SIZE(udc_resources),
115};
116
117void __init at91_add_device_udc(struct at91_udc_data *data)
118{
119 if (!data)
120 return;
121
122 if (gpio_is_valid(data->vbus_pin)) {
123 at91_set_gpio_input(data->vbus_pin, 0);
124 at91_set_deglitch(data->vbus_pin, 1);
125 }
126
127 /* Pullup pin is handled internally by USB device peripheral */
128
129 udc_data = *data;
130 platform_device_register(&at91_udc_device);
131}
132#else
133void __init at91_add_device_udc(struct at91_udc_data *data) {}
134#endif
135
136
137/* --------------------------------------------------------------------
138 * Ethernet
139 * -------------------------------------------------------------------- */
140
141#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
142static u64 eth_dmamask = DMA_BIT_MASK(32);
143static struct macb_platform_data eth_data;
144
145static struct resource eth_resources[] = {
146 [0] = {
147 .start = AT91SAM9260_BASE_EMAC,
148 .end = AT91SAM9260_BASE_EMAC + SZ_16K - 1,
149 .flags = IORESOURCE_MEM,
150 },
151 [1] = {
152 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_EMAC,
153 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_EMAC,
154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158static struct platform_device at91sam9260_eth_device = {
159 .name = "macb",
160 .id = -1,
161 .dev = {
162 .dma_mask = &eth_dmamask,
163 .coherent_dma_mask = DMA_BIT_MASK(32),
164 .platform_data = &eth_data,
165 },
166 .resource = eth_resources,
167 .num_resources = ARRAY_SIZE(eth_resources),
168};
169
170void __init at91_add_device_eth(struct macb_platform_data *data)
171{
172 if (!data)
173 return;
174
175 if (gpio_is_valid(data->phy_irq_pin)) {
176 at91_set_gpio_input(data->phy_irq_pin, 0);
177 at91_set_deglitch(data->phy_irq_pin, 1);
178 }
179
180 /* Pins used for MII and RMII */
181 at91_set_A_periph(AT91_PIN_PA19, 0); /* ETXCK_EREFCK */
182 at91_set_A_periph(AT91_PIN_PA17, 0); /* ERXDV */
183 at91_set_A_periph(AT91_PIN_PA14, 0); /* ERX0 */
184 at91_set_A_periph(AT91_PIN_PA15, 0); /* ERX1 */
185 at91_set_A_periph(AT91_PIN_PA18, 0); /* ERXER */
186 at91_set_A_periph(AT91_PIN_PA16, 0); /* ETXEN */
187 at91_set_A_periph(AT91_PIN_PA12, 0); /* ETX0 */
188 at91_set_A_periph(AT91_PIN_PA13, 0); /* ETX1 */
189 at91_set_A_periph(AT91_PIN_PA21, 0); /* EMDIO */
190 at91_set_A_periph(AT91_PIN_PA20, 0); /* EMDC */
191
192 if (!data->is_rmii) {
193 at91_set_B_periph(AT91_PIN_PA28, 0); /* ECRS */
194 at91_set_B_periph(AT91_PIN_PA29, 0); /* ECOL */
195 at91_set_B_periph(AT91_PIN_PA25, 0); /* ERX2 */
196 at91_set_B_periph(AT91_PIN_PA26, 0); /* ERX3 */
197 at91_set_B_periph(AT91_PIN_PA27, 0); /* ERXCK */
198 at91_set_B_periph(AT91_PIN_PA23, 0); /* ETX2 */
199 at91_set_B_periph(AT91_PIN_PA24, 0); /* ETX3 */
200 at91_set_B_periph(AT91_PIN_PA22, 0); /* ETXER */
201 }
202
203 eth_data = *data;
204 platform_device_register(&at91sam9260_eth_device);
205}
206#else
207void __init at91_add_device_eth(struct macb_platform_data *data) {}
208#endif
209
210
211/* --------------------------------------------------------------------
212 * MMC / SD Slot for Atmel MCI Driver
213 * -------------------------------------------------------------------- */
214
215#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
216static u64 mmc_dmamask = DMA_BIT_MASK(32);
217static struct mci_platform_data mmc_data;
218
219static struct resource mmc_resources[] = {
220 [0] = {
221 .start = AT91SAM9260_BASE_MCI,
222 .end = AT91SAM9260_BASE_MCI + SZ_16K - 1,
223 .flags = IORESOURCE_MEM,
224 },
225 [1] = {
226 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI,
227 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct platform_device at91sam9260_mmc_device = {
233 .name = "atmel_mci",
234 .id = -1,
235 .dev = {
236 .dma_mask = &mmc_dmamask,
237 .coherent_dma_mask = DMA_BIT_MASK(32),
238 .platform_data = &mmc_data,
239 },
240 .resource = mmc_resources,
241 .num_resources = ARRAY_SIZE(mmc_resources),
242};
243
244void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
245{
246 unsigned int i;
247 unsigned int slot_count = 0;
248
249 if (!data)
250 return;
251
252 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
253 if (data->slot[i].bus_width) {
254 /* input/irq */
255 if (gpio_is_valid(data->slot[i].detect_pin)) {
256 at91_set_gpio_input(data->slot[i].detect_pin, 1);
257 at91_set_deglitch(data->slot[i].detect_pin, 1);
258 }
259 if (gpio_is_valid(data->slot[i].wp_pin))
260 at91_set_gpio_input(data->slot[i].wp_pin, 1);
261
262 switch (i) {
263 case 0:
264 /* CMD */
265 at91_set_A_periph(AT91_PIN_PA7, 1);
266 /* DAT0, maybe DAT1..DAT3 */
267 at91_set_A_periph(AT91_PIN_PA6, 1);
268 if (data->slot[i].bus_width == 4) {
269 at91_set_A_periph(AT91_PIN_PA9, 1);
270 at91_set_A_periph(AT91_PIN_PA10, 1);
271 at91_set_A_periph(AT91_PIN_PA11, 1);
272 }
273 slot_count++;
274 break;
275 case 1:
276 /* CMD */
277 at91_set_B_periph(AT91_PIN_PA1, 1);
278 /* DAT0, maybe DAT1..DAT3 */
279 at91_set_B_periph(AT91_PIN_PA0, 1);
280 if (data->slot[i].bus_width == 4) {
281 at91_set_B_periph(AT91_PIN_PA5, 1);
282 at91_set_B_periph(AT91_PIN_PA4, 1);
283 at91_set_B_periph(AT91_PIN_PA3, 1);
284 }
285 slot_count++;
286 break;
287 default:
288 printk(KERN_ERR
289 "AT91: SD/MMC slot %d not available\n", i);
290 break;
291 }
292 }
293 }
294
295 if (slot_count) {
296 /* CLK */
297 at91_set_A_periph(AT91_PIN_PA8, 0);
298
299 mmc_data = *data;
300 platform_device_register(&at91sam9260_mmc_device);
301 }
302}
303#else
304void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
305#endif
306
307
308/* --------------------------------------------------------------------
309 * NAND / SmartMedia
310 * -------------------------------------------------------------------- */
311
312#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
313static struct atmel_nand_data nand_data;
314
315#define NAND_BASE AT91_CHIPSELECT_3
316
317static struct resource nand_resources[] = {
318 [0] = {
319 .start = NAND_BASE,
320 .end = NAND_BASE + SZ_256M - 1,
321 .flags = IORESOURCE_MEM,
322 },
323 [1] = {
324 .start = AT91SAM9260_BASE_ECC,
325 .end = AT91SAM9260_BASE_ECC + SZ_512 - 1,
326 .flags = IORESOURCE_MEM,
327 }
328};
329
330static struct platform_device at91sam9260_nand_device = {
331 .name = "atmel_nand",
332 .id = -1,
333 .dev = {
334 .platform_data = &nand_data,
335 },
336 .resource = nand_resources,
337 .num_resources = ARRAY_SIZE(nand_resources),
338};
339
340void __init at91_add_device_nand(struct atmel_nand_data *data)
341{
342 unsigned long csa;
343
344 if (!data)
345 return;
346
347 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
348 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
349
350 /* enable pin */
351 if (gpio_is_valid(data->enable_pin))
352 at91_set_gpio_output(data->enable_pin, 1);
353
354 /* ready/busy pin */
355 if (gpio_is_valid(data->rdy_pin))
356 at91_set_gpio_input(data->rdy_pin, 1);
357
358 /* card detect pin */
359 if (gpio_is_valid(data->det_pin))
360 at91_set_gpio_input(data->det_pin, 1);
361
362 nand_data = *data;
363 platform_device_register(&at91sam9260_nand_device);
364}
365#else
366void __init at91_add_device_nand(struct atmel_nand_data *data) {}
367#endif
368
369
370/* --------------------------------------------------------------------
371 * TWI (i2c)
372 * -------------------------------------------------------------------- */
373
374/*
375 * Prefer the GPIO code since the TWI controller isn't robust
376 * (gets overruns and underruns under load) and can only issue
377 * repeated STARTs in one scenario (the driver doesn't yet handle them).
378 */
379
380#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
381
382static struct i2c_gpio_platform_data pdata = {
383 .sda_pin = AT91_PIN_PA23,
384 .sda_is_open_drain = 1,
385 .scl_pin = AT91_PIN_PA24,
386 .scl_is_open_drain = 1,
387 .udelay = 2, /* ~100 kHz */
388};
389
390static struct platform_device at91sam9260_twi_device = {
391 .name = "i2c-gpio",
392 .id = 0,
393 .dev.platform_data = &pdata,
394};
395
396void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
397{
398 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
399 at91_set_multi_drive(AT91_PIN_PA23, 1);
400
401 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
402 at91_set_multi_drive(AT91_PIN_PA24, 1);
403
404 i2c_register_board_info(0, devices, nr_devices);
405 platform_device_register(&at91sam9260_twi_device);
406}
407
408#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
409
410static struct resource twi_resources[] = {
411 [0] = {
412 .start = AT91SAM9260_BASE_TWI,
413 .end = AT91SAM9260_BASE_TWI + SZ_16K - 1,
414 .flags = IORESOURCE_MEM,
415 },
416 [1] = {
417 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TWI,
418 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TWI,
419 .flags = IORESOURCE_IRQ,
420 },
421};
422
423static struct platform_device at91sam9260_twi_device = {
424 .id = 0,
425 .resource = twi_resources,
426 .num_resources = ARRAY_SIZE(twi_resources),
427};
428
429void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
430{
431 /* IP version is not the same on 9260 and g20 */
432 if (cpu_is_at91sam9g20()) {
433 at91sam9260_twi_device.name = "i2c-at91sam9g20";
434 } else {
435 at91sam9260_twi_device.name = "i2c-at91sam9260";
436 }
437
438 /* pins used for TWI interface */
439 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
440 at91_set_multi_drive(AT91_PIN_PA23, 1);
441
442 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
443 at91_set_multi_drive(AT91_PIN_PA24, 1);
444
445 i2c_register_board_info(0, devices, nr_devices);
446 platform_device_register(&at91sam9260_twi_device);
447}
448#else
449void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
450#endif
451
452
453/* --------------------------------------------------------------------
454 * SPI
455 * -------------------------------------------------------------------- */
456
457#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
458static u64 spi_dmamask = DMA_BIT_MASK(32);
459
460static struct resource spi0_resources[] = {
461 [0] = {
462 .start = AT91SAM9260_BASE_SPI0,
463 .end = AT91SAM9260_BASE_SPI0 + SZ_16K - 1,
464 .flags = IORESOURCE_MEM,
465 },
466 [1] = {
467 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_SPI0,
468 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_SPI0,
469 .flags = IORESOURCE_IRQ,
470 },
471};
472
473static struct platform_device at91sam9260_spi0_device = {
474 .name = "atmel_spi",
475 .id = 0,
476 .dev = {
477 .dma_mask = &spi_dmamask,
478 .coherent_dma_mask = DMA_BIT_MASK(32),
479 },
480 .resource = spi0_resources,
481 .num_resources = ARRAY_SIZE(spi0_resources),
482};
483
484static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PC11, AT91_PIN_PC16, AT91_PIN_PC17 };
485
486static struct resource spi1_resources[] = {
487 [0] = {
488 .start = AT91SAM9260_BASE_SPI1,
489 .end = AT91SAM9260_BASE_SPI1 + SZ_16K - 1,
490 .flags = IORESOURCE_MEM,
491 },
492 [1] = {
493 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_SPI1,
494 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_SPI1,
495 .flags = IORESOURCE_IRQ,
496 },
497};
498
499static struct platform_device at91sam9260_spi1_device = {
500 .name = "atmel_spi",
501 .id = 1,
502 .dev = {
503 .dma_mask = &spi_dmamask,
504 .coherent_dma_mask = DMA_BIT_MASK(32),
505 },
506 .resource = spi1_resources,
507 .num_resources = ARRAY_SIZE(spi1_resources),
508};
509
510static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB3, AT91_PIN_PC5, AT91_PIN_PC4, AT91_PIN_PC3 };
511
512void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
513{
514 int i;
515 unsigned long cs_pin;
516 short enable_spi0 = 0;
517 short enable_spi1 = 0;
518
519 /* Choose SPI chip-selects */
520 for (i = 0; i < nr_devices; i++) {
521 if (devices[i].controller_data)
522 cs_pin = (unsigned long) devices[i].controller_data;
523 else if (devices[i].bus_num == 0)
524 cs_pin = spi0_standard_cs[devices[i].chip_select];
525 else
526 cs_pin = spi1_standard_cs[devices[i].chip_select];
527
528 if (!gpio_is_valid(cs_pin))
529 continue;
530
531 if (devices[i].bus_num == 0)
532 enable_spi0 = 1;
533 else
534 enable_spi1 = 1;
535
536 /* enable chip-select pin */
537 at91_set_gpio_output(cs_pin, 1);
538
539 /* pass chip-select pin to driver */
540 devices[i].controller_data = (void *) cs_pin;
541 }
542
543 spi_register_board_info(devices, nr_devices);
544
545 /* Configure SPI bus(es) */
546 if (enable_spi0) {
547 at91_set_A_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
548 at91_set_A_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
549 at91_set_A_periph(AT91_PIN_PA2, 0); /* SPI1_SPCK */
550
551 platform_device_register(&at91sam9260_spi0_device);
552 }
553 if (enable_spi1) {
554 at91_set_A_periph(AT91_PIN_PB0, 0); /* SPI1_MISO */
555 at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI1_MOSI */
556 at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI1_SPCK */
557
558 platform_device_register(&at91sam9260_spi1_device);
559 }
560}
561#else
562void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
563#endif
564
565
566/* --------------------------------------------------------------------
567 * Timer/Counter blocks
568 * -------------------------------------------------------------------- */
569
570#ifdef CONFIG_ATMEL_TCLIB
571
572static struct resource tcb0_resources[] = {
573 [0] = {
574 .start = AT91SAM9260_BASE_TCB0,
575 .end = AT91SAM9260_BASE_TCB0 + SZ_256 - 1,
576 .flags = IORESOURCE_MEM,
577 },
578 [1] = {
579 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC0,
580 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC0,
581 .flags = IORESOURCE_IRQ,
582 },
583 [2] = {
584 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC1,
585 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC1,
586 .flags = IORESOURCE_IRQ,
587 },
588 [3] = {
589 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC2,
590 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC2,
591 .flags = IORESOURCE_IRQ,
592 },
593};
594
595static struct platform_device at91sam9260_tcb0_device = {
596 .name = "atmel_tcb",
597 .id = 0,
598 .resource = tcb0_resources,
599 .num_resources = ARRAY_SIZE(tcb0_resources),
600};
601
602static struct resource tcb1_resources[] = {
603 [0] = {
604 .start = AT91SAM9260_BASE_TCB1,
605 .end = AT91SAM9260_BASE_TCB1 + SZ_256 - 1,
606 .flags = IORESOURCE_MEM,
607 },
608 [1] = {
609 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC3,
610 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC3,
611 .flags = IORESOURCE_IRQ,
612 },
613 [2] = {
614 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC4,
615 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC4,
616 .flags = IORESOURCE_IRQ,
617 },
618 [3] = {
619 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC5,
620 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC5,
621 .flags = IORESOURCE_IRQ,
622 },
623};
624
625static struct platform_device at91sam9260_tcb1_device = {
626 .name = "atmel_tcb",
627 .id = 1,
628 .resource = tcb1_resources,
629 .num_resources = ARRAY_SIZE(tcb1_resources),
630};
631
632static void __init at91_add_device_tc(void)
633{
634 platform_device_register(&at91sam9260_tcb0_device);
635 platform_device_register(&at91sam9260_tcb1_device);
636}
637#else
638static void __init at91_add_device_tc(void) { }
639#endif
640
641
642/* --------------------------------------------------------------------
643 * RTT
644 * -------------------------------------------------------------------- */
645
646static struct resource rtt_resources[] = {
647 {
648 .start = AT91SAM9260_BASE_RTT,
649 .end = AT91SAM9260_BASE_RTT + SZ_16 - 1,
650 .flags = IORESOURCE_MEM,
651 }, {
652 .flags = IORESOURCE_MEM,
653 }, {
654 .flags = IORESOURCE_IRQ,
655 },
656};
657
658static struct platform_device at91sam9260_rtt_device = {
659 .name = "at91_rtt",
660 .id = 0,
661 .resource = rtt_resources,
662};
663
664
665#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
666static void __init at91_add_device_rtt_rtc(void)
667{
668 at91sam9260_rtt_device.name = "rtc-at91sam9";
669 /*
670 * The second resource is needed:
671 * GPBR will serve as the storage for RTC time offset
672 */
673 at91sam9260_rtt_device.num_resources = 3;
674 rtt_resources[1].start = AT91SAM9260_BASE_GPBR +
675 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
676 rtt_resources[1].end = rtt_resources[1].start + 3;
677 rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
678 rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
679}
680#else
681static void __init at91_add_device_rtt_rtc(void)
682{
683 /* Only one resource is needed: RTT not used as RTC */
684 at91sam9260_rtt_device.num_resources = 1;
685}
686#endif
687
688static void __init at91_add_device_rtt(void)
689{
690 at91_add_device_rtt_rtc();
691 platform_device_register(&at91sam9260_rtt_device);
692}
693
694
695/* --------------------------------------------------------------------
696 * Watchdog
697 * -------------------------------------------------------------------- */
698
699#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
700static struct resource wdt_resources[] = {
701 {
702 .start = AT91SAM9260_BASE_WDT,
703 .end = AT91SAM9260_BASE_WDT + SZ_16 - 1,
704 .flags = IORESOURCE_MEM,
705 }
706};
707
708static struct platform_device at91sam9260_wdt_device = {
709 .name = "at91_wdt",
710 .id = -1,
711 .resource = wdt_resources,
712 .num_resources = ARRAY_SIZE(wdt_resources),
713};
714
715static void __init at91_add_device_watchdog(void)
716{
717 platform_device_register(&at91sam9260_wdt_device);
718}
719#else
720static void __init at91_add_device_watchdog(void) {}
721#endif
722
723
724/* --------------------------------------------------------------------
725 * SSC -- Synchronous Serial Controller
726 * -------------------------------------------------------------------- */
727
728#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
729static u64 ssc_dmamask = DMA_BIT_MASK(32);
730
731static struct resource ssc_resources[] = {
732 [0] = {
733 .start = AT91SAM9260_BASE_SSC,
734 .end = AT91SAM9260_BASE_SSC + SZ_16K - 1,
735 .flags = IORESOURCE_MEM,
736 },
737 [1] = {
738 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_SSC,
739 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_SSC,
740 .flags = IORESOURCE_IRQ,
741 },
742};
743
744static struct platform_device at91sam9260_ssc_device = {
745 .name = "at91rm9200_ssc",
746 .id = 0,
747 .dev = {
748 .dma_mask = &ssc_dmamask,
749 .coherent_dma_mask = DMA_BIT_MASK(32),
750 },
751 .resource = ssc_resources,
752 .num_resources = ARRAY_SIZE(ssc_resources),
753};
754
755static inline void configure_ssc_pins(unsigned pins)
756{
757 if (pins & ATMEL_SSC_TF)
758 at91_set_A_periph(AT91_PIN_PB17, 1);
759 if (pins & ATMEL_SSC_TK)
760 at91_set_A_periph(AT91_PIN_PB16, 1);
761 if (pins & ATMEL_SSC_TD)
762 at91_set_A_periph(AT91_PIN_PB18, 1);
763 if (pins & ATMEL_SSC_RD)
764 at91_set_A_periph(AT91_PIN_PB19, 1);
765 if (pins & ATMEL_SSC_RK)
766 at91_set_A_periph(AT91_PIN_PB20, 1);
767 if (pins & ATMEL_SSC_RF)
768 at91_set_A_periph(AT91_PIN_PB21, 1);
769}
770
771/*
772 * SSC controllers are accessed through library code, instead of any
773 * kind of all-singing/all-dancing driver. For example one could be
774 * used by a particular I2S audio codec's driver, while another one
775 * on the same system might be used by a custom data capture driver.
776 */
777void __init at91_add_device_ssc(unsigned id, unsigned pins)
778{
779 struct platform_device *pdev;
780
781 /*
782 * NOTE: caller is responsible for passing information matching
783 * "pins" to whatever will be using each particular controller.
784 */
785 switch (id) {
786 case AT91SAM9260_ID_SSC:
787 pdev = &at91sam9260_ssc_device;
788 configure_ssc_pins(pins);
789 break;
790 default:
791 return;
792 }
793
794 platform_device_register(pdev);
795}
796
797#else
798void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
799#endif
800
801
802/* --------------------------------------------------------------------
803 * UART
804 * -------------------------------------------------------------------- */
805#if defined(CONFIG_SERIAL_ATMEL)
806static struct resource dbgu_resources[] = {
807 [0] = {
808 .start = AT91SAM9260_BASE_DBGU,
809 .end = AT91SAM9260_BASE_DBGU + SZ_512 - 1,
810 .flags = IORESOURCE_MEM,
811 },
812 [1] = {
813 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
814 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
815 .flags = IORESOURCE_IRQ,
816 },
817};
818
819static struct atmel_uart_data dbgu_data = {
820 .use_dma_tx = 0,
821 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
822};
823
824static u64 dbgu_dmamask = DMA_BIT_MASK(32);
825
826static struct platform_device at91sam9260_dbgu_device = {
827 .name = "atmel_usart",
828 .id = 0,
829 .dev = {
830 .dma_mask = &dbgu_dmamask,
831 .coherent_dma_mask = DMA_BIT_MASK(32),
832 .platform_data = &dbgu_data,
833 },
834 .resource = dbgu_resources,
835 .num_resources = ARRAY_SIZE(dbgu_resources),
836};
837
838static inline void configure_dbgu_pins(void)
839{
840 at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */
841 at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */
842}
843
844static struct resource uart0_resources[] = {
845 [0] = {
846 .start = AT91SAM9260_BASE_US0,
847 .end = AT91SAM9260_BASE_US0 + SZ_16K - 1,
848 .flags = IORESOURCE_MEM,
849 },
850 [1] = {
851 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US0,
852 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US0,
853 .flags = IORESOURCE_IRQ,
854 },
855};
856
857static struct atmel_uart_data uart0_data = {
858 .use_dma_tx = 1,
859 .use_dma_rx = 1,
860};
861
862static u64 uart0_dmamask = DMA_BIT_MASK(32);
863
864static struct platform_device at91sam9260_uart0_device = {
865 .name = "atmel_usart",
866 .id = 1,
867 .dev = {
868 .dma_mask = &uart0_dmamask,
869 .coherent_dma_mask = DMA_BIT_MASK(32),
870 .platform_data = &uart0_data,
871 },
872 .resource = uart0_resources,
873 .num_resources = ARRAY_SIZE(uart0_resources),
874};
875
876static inline void configure_usart0_pins(unsigned pins)
877{
878 at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
879 at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
880
881 if (pins & ATMEL_UART_RTS)
882 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */
883 if (pins & ATMEL_UART_CTS)
884 at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */
885 if (pins & ATMEL_UART_DTR)
886 at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */
887 if (pins & ATMEL_UART_DSR)
888 at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */
889 if (pins & ATMEL_UART_DCD)
890 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */
891 if (pins & ATMEL_UART_RI)
892 at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */
893}
894
895static struct resource uart1_resources[] = {
896 [0] = {
897 .start = AT91SAM9260_BASE_US1,
898 .end = AT91SAM9260_BASE_US1 + SZ_16K - 1,
899 .flags = IORESOURCE_MEM,
900 },
901 [1] = {
902 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US1,
903 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US1,
904 .flags = IORESOURCE_IRQ,
905 },
906};
907
908static struct atmel_uart_data uart1_data = {
909 .use_dma_tx = 1,
910 .use_dma_rx = 1,
911};
912
913static u64 uart1_dmamask = DMA_BIT_MASK(32);
914
915static struct platform_device at91sam9260_uart1_device = {
916 .name = "atmel_usart",
917 .id = 2,
918 .dev = {
919 .dma_mask = &uart1_dmamask,
920 .coherent_dma_mask = DMA_BIT_MASK(32),
921 .platform_data = &uart1_data,
922 },
923 .resource = uart1_resources,
924 .num_resources = ARRAY_SIZE(uart1_resources),
925};
926
927static inline void configure_usart1_pins(unsigned pins)
928{
929 at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
930 at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
931
932 if (pins & ATMEL_UART_RTS)
933 at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */
934 if (pins & ATMEL_UART_CTS)
935 at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */
936}
937
938static struct resource uart2_resources[] = {
939 [0] = {
940 .start = AT91SAM9260_BASE_US2,
941 .end = AT91SAM9260_BASE_US2 + SZ_16K - 1,
942 .flags = IORESOURCE_MEM,
943 },
944 [1] = {
945 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US2,
946 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US2,
947 .flags = IORESOURCE_IRQ,
948 },
949};
950
951static struct atmel_uart_data uart2_data = {
952 .use_dma_tx = 1,
953 .use_dma_rx = 1,
954};
955
956static u64 uart2_dmamask = DMA_BIT_MASK(32);
957
958static struct platform_device at91sam9260_uart2_device = {
959 .name = "atmel_usart",
960 .id = 3,
961 .dev = {
962 .dma_mask = &uart2_dmamask,
963 .coherent_dma_mask = DMA_BIT_MASK(32),
964 .platform_data = &uart2_data,
965 },
966 .resource = uart2_resources,
967 .num_resources = ARRAY_SIZE(uart2_resources),
968};
969
970static inline void configure_usart2_pins(unsigned pins)
971{
972 at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
973 at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
974
975 if (pins & ATMEL_UART_RTS)
976 at91_set_A_periph(AT91_PIN_PA4, 0); /* RTS2 */
977 if (pins & ATMEL_UART_CTS)
978 at91_set_A_periph(AT91_PIN_PA5, 0); /* CTS2 */
979}
980
981static struct resource uart3_resources[] = {
982 [0] = {
983 .start = AT91SAM9260_BASE_US3,
984 .end = AT91SAM9260_BASE_US3 + SZ_16K - 1,
985 .flags = IORESOURCE_MEM,
986 },
987 [1] = {
988 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US3,
989 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US3,
990 .flags = IORESOURCE_IRQ,
991 },
992};
993
994static struct atmel_uart_data uart3_data = {
995 .use_dma_tx = 1,
996 .use_dma_rx = 1,
997};
998
999static u64 uart3_dmamask = DMA_BIT_MASK(32);
1000
1001static struct platform_device at91sam9260_uart3_device = {
1002 .name = "atmel_usart",
1003 .id = 4,
1004 .dev = {
1005 .dma_mask = &uart3_dmamask,
1006 .coherent_dma_mask = DMA_BIT_MASK(32),
1007 .platform_data = &uart3_data,
1008 },
1009 .resource = uart3_resources,
1010 .num_resources = ARRAY_SIZE(uart3_resources),
1011};
1012
1013static inline void configure_usart3_pins(unsigned pins)
1014{
1015 at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */
1016 at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */
1017
1018 if (pins & ATMEL_UART_RTS)
1019 at91_set_B_periph(AT91_PIN_PC8, 0); /* RTS3 */
1020 if (pins & ATMEL_UART_CTS)
1021 at91_set_B_periph(AT91_PIN_PC10, 0); /* CTS3 */
1022}
1023
1024static struct resource uart4_resources[] = {
1025 [0] = {
1026 .start = AT91SAM9260_BASE_US4,
1027 .end = AT91SAM9260_BASE_US4 + SZ_16K - 1,
1028 .flags = IORESOURCE_MEM,
1029 },
1030 [1] = {
1031 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US4,
1032 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US4,
1033 .flags = IORESOURCE_IRQ,
1034 },
1035};
1036
1037static struct atmel_uart_data uart4_data = {
1038 .use_dma_tx = 1,
1039 .use_dma_rx = 1,
1040};
1041
1042static u64 uart4_dmamask = DMA_BIT_MASK(32);
1043
1044static struct platform_device at91sam9260_uart4_device = {
1045 .name = "atmel_usart",
1046 .id = 5,
1047 .dev = {
1048 .dma_mask = &uart4_dmamask,
1049 .coherent_dma_mask = DMA_BIT_MASK(32),
1050 .platform_data = &uart4_data,
1051 },
1052 .resource = uart4_resources,
1053 .num_resources = ARRAY_SIZE(uart4_resources),
1054};
1055
1056static inline void configure_usart4_pins(void)
1057{
1058 at91_set_B_periph(AT91_PIN_PA31, 1); /* TXD4 */
1059 at91_set_B_periph(AT91_PIN_PA30, 0); /* RXD4 */
1060}
1061
1062static struct resource uart5_resources[] = {
1063 [0] = {
1064 .start = AT91SAM9260_BASE_US5,
1065 .end = AT91SAM9260_BASE_US5 + SZ_16K - 1,
1066 .flags = IORESOURCE_MEM,
1067 },
1068 [1] = {
1069 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US5,
1070 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US5,
1071 .flags = IORESOURCE_IRQ,
1072 },
1073};
1074
1075static struct atmel_uart_data uart5_data = {
1076 .use_dma_tx = 1,
1077 .use_dma_rx = 1,
1078};
1079
1080static u64 uart5_dmamask = DMA_BIT_MASK(32);
1081
1082static struct platform_device at91sam9260_uart5_device = {
1083 .name = "atmel_usart",
1084 .id = 6,
1085 .dev = {
1086 .dma_mask = &uart5_dmamask,
1087 .coherent_dma_mask = DMA_BIT_MASK(32),
1088 .platform_data = &uart5_data,
1089 },
1090 .resource = uart5_resources,
1091 .num_resources = ARRAY_SIZE(uart5_resources),
1092};
1093
1094static inline void configure_usart5_pins(void)
1095{
1096 at91_set_A_periph(AT91_PIN_PB12, 1); /* TXD5 */
1097 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */
1098}
1099
1100static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1101
1102void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1103{
1104 struct platform_device *pdev;
1105 struct atmel_uart_data *pdata;
1106
1107 switch (id) {
1108 case 0: /* DBGU */
1109 pdev = &at91sam9260_dbgu_device;
1110 configure_dbgu_pins();
1111 break;
1112 case AT91SAM9260_ID_US0:
1113 pdev = &at91sam9260_uart0_device;
1114 configure_usart0_pins(pins);
1115 break;
1116 case AT91SAM9260_ID_US1:
1117 pdev = &at91sam9260_uart1_device;
1118 configure_usart1_pins(pins);
1119 break;
1120 case AT91SAM9260_ID_US2:
1121 pdev = &at91sam9260_uart2_device;
1122 configure_usart2_pins(pins);
1123 break;
1124 case AT91SAM9260_ID_US3:
1125 pdev = &at91sam9260_uart3_device;
1126 configure_usart3_pins(pins);
1127 break;
1128 case AT91SAM9260_ID_US4:
1129 pdev = &at91sam9260_uart4_device;
1130 configure_usart4_pins();
1131 break;
1132 case AT91SAM9260_ID_US5:
1133 pdev = &at91sam9260_uart5_device;
1134 configure_usart5_pins();
1135 break;
1136 default:
1137 return;
1138 }
1139 pdata = pdev->dev.platform_data;
1140 pdata->num = portnr; /* update to mapped ID */
1141
1142 if (portnr < ATMEL_MAX_UART)
1143 at91_uarts[portnr] = pdev;
1144}
1145
1146void __init at91_add_device_serial(void)
1147{
1148 int i;
1149
1150 for (i = 0; i < ATMEL_MAX_UART; i++) {
1151 if (at91_uarts[i])
1152 platform_device_register(at91_uarts[i]);
1153 }
1154}
1155#else
1156void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1157void __init at91_add_device_serial(void) {}
1158#endif
1159
1160/* --------------------------------------------------------------------
1161 * CF/IDE
1162 * -------------------------------------------------------------------- */
1163
1164#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \
1165 defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
1166
1167static struct at91_cf_data cf0_data;
1168
1169static struct resource cf0_resources[] = {
1170 [0] = {
1171 .start = AT91_CHIPSELECT_4,
1172 .end = AT91_CHIPSELECT_4 + SZ_256M - 1,
1173 .flags = IORESOURCE_MEM,
1174 }
1175};
1176
1177static struct platform_device cf0_device = {
1178 .id = 0,
1179 .dev = {
1180 .platform_data = &cf0_data,
1181 },
1182 .resource = cf0_resources,
1183 .num_resources = ARRAY_SIZE(cf0_resources),
1184};
1185
1186static struct at91_cf_data cf1_data;
1187
1188static struct resource cf1_resources[] = {
1189 [0] = {
1190 .start = AT91_CHIPSELECT_5,
1191 .end = AT91_CHIPSELECT_5 + SZ_256M - 1,
1192 .flags = IORESOURCE_MEM,
1193 }
1194};
1195
1196static struct platform_device cf1_device = {
1197 .id = 1,
1198 .dev = {
1199 .platform_data = &cf1_data,
1200 },
1201 .resource = cf1_resources,
1202 .num_resources = ARRAY_SIZE(cf1_resources),
1203};
1204
1205void __init at91_add_device_cf(struct at91_cf_data *data)
1206{
1207 struct platform_device *pdev;
1208 unsigned long csa;
1209
1210 if (!data)
1211 return;
1212
1213 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
1214
1215 switch (data->chipselect) {
1216 case 4:
1217 at91_set_multi_drive(AT91_PIN_PC8, 0);
1218 at91_set_A_periph(AT91_PIN_PC8, 0);
1219 csa |= AT91_MATRIX_CS4A_SMC_CF1;
1220 cf0_data = *data;
1221 pdev = &cf0_device;
1222 break;
1223 case 5:
1224 at91_set_multi_drive(AT91_PIN_PC9, 0);
1225 at91_set_A_periph(AT91_PIN_PC9, 0);
1226 csa |= AT91_MATRIX_CS5A_SMC_CF2;
1227 cf1_data = *data;
1228 pdev = &cf1_device;
1229 break;
1230 default:
1231 printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
1232 data->chipselect);
1233 return;
1234 }
1235
1236 at91_matrix_write(AT91_MATRIX_EBICSA, csa);
1237
1238 if (gpio_is_valid(data->rst_pin)) {
1239 at91_set_multi_drive(data->rst_pin, 0);
1240 at91_set_gpio_output(data->rst_pin, 1);
1241 }
1242
1243 if (gpio_is_valid(data->irq_pin)) {
1244 at91_set_gpio_input(data->irq_pin, 0);
1245 at91_set_deglitch(data->irq_pin, 1);
1246 }
1247
1248 if (gpio_is_valid(data->det_pin)) {
1249 at91_set_gpio_input(data->det_pin, 0);
1250 at91_set_deglitch(data->det_pin, 1);
1251 }
1252
1253 at91_set_B_periph(AT91_PIN_PC6, 0); /* CFCE1 */
1254 at91_set_B_periph(AT91_PIN_PC7, 0); /* CFCE2 */
1255 at91_set_A_periph(AT91_PIN_PC10, 0); /* CFRNW */
1256 at91_set_A_periph(AT91_PIN_PC15, 1); /* NWAIT */
1257
1258 if (IS_ENABLED(CONFIG_PATA_AT91) && (data->flags & AT91_CF_TRUE_IDE))
1259 pdev->name = "pata_at91";
1260 else
1261 pdev->name = "at91_cf";
1262
1263 platform_device_register(pdev);
1264}
1265
1266#else
1267void __init at91_add_device_cf(struct at91_cf_data * data) {}
1268#endif
1269
1270/* --------------------------------------------------------------------
1271 * ADCs
1272 * -------------------------------------------------------------------- */
1273
1274#if IS_ENABLED(CONFIG_AT91_ADC)
1275static struct at91_adc_data adc_data;
1276
1277static struct resource adc_resources[] = {
1278 [0] = {
1279 .start = AT91SAM9260_BASE_ADC,
1280 .end = AT91SAM9260_BASE_ADC + SZ_16K - 1,
1281 .flags = IORESOURCE_MEM,
1282 },
1283 [1] = {
1284 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_ADC,
1285 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_ADC,
1286 .flags = IORESOURCE_IRQ,
1287 },
1288};
1289
1290static struct platform_device at91_adc_device = {
1291 .name = "at91sam9260-adc",
1292 .id = -1,
1293 .dev = {
1294 .platform_data = &adc_data,
1295 },
1296 .resource = adc_resources,
1297 .num_resources = ARRAY_SIZE(adc_resources),
1298};
1299
1300static struct at91_adc_trigger at91_adc_triggers[] = {
1301 [0] = {
1302 .name = "timer-counter-0",
1303 .value = 0x1,
1304 },
1305 [1] = {
1306 .name = "timer-counter-1",
1307 .value = 0x3,
1308 },
1309 [2] = {
1310 .name = "timer-counter-2",
1311 .value = 0x5,
1312 },
1313 [3] = {
1314 .name = "external",
1315 .value = 0xd,
1316 .is_external = true,
1317 },
1318};
1319
1320void __init at91_add_device_adc(struct at91_adc_data *data)
1321{
1322 if (!data)
1323 return;
1324
1325 if (test_bit(0, &data->channels_used))
1326 at91_set_A_periph(AT91_PIN_PC0, 0);
1327 if (test_bit(1, &data->channels_used))
1328 at91_set_A_periph(AT91_PIN_PC1, 0);
1329 if (test_bit(2, &data->channels_used))
1330 at91_set_A_periph(AT91_PIN_PC2, 0);
1331 if (test_bit(3, &data->channels_used))
1332 at91_set_A_periph(AT91_PIN_PC3, 0);
1333
1334 if (data->use_external_triggers)
1335 at91_set_A_periph(AT91_PIN_PA22, 0);
1336
1337 data->startup_time = 10;
1338 data->trigger_number = 4;
1339 data->trigger_list = at91_adc_triggers;
1340
1341 adc_data = *data;
1342 platform_device_register(&at91_adc_device);
1343}
1344#else
1345void __init at91_add_device_adc(struct at91_adc_data *data) {}
1346#endif
1347
1348/* -------------------------------------------------------------------- */
1349/*
1350 * These devices are always present and don't need any board-specific
1351 * setup.
1352 */
1353static int __init at91_add_standard_devices(void)
1354{
1355 if (of_have_populated_dt())
1356 return 0;
1357
1358 at91_add_device_rtt();
1359 at91_add_device_watchdog();
1360 at91_add_device_tc();
1361 return 0;
1362}
1363
1364arch_initcall(at91_add_standard_devices);
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index a8bd35963332..d29953ecb0c4 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -10,282 +10,12 @@
10 * 10 *
11 */ 11 */
12 12
13#include <linux/module.h>
14#include <linux/platform_device.h>
15#include <linux/clk/at91_pmc.h>
16
17#include <asm/proc-fns.h>
18#include <asm/irq.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <asm/system_misc.h> 13#include <asm/system_misc.h>
22#include <mach/cpu.h> 14#include <mach/cpu.h>
23#include <mach/at91sam9261.h>
24#include <mach/hardware.h> 15#include <mach/hardware.h>
25 16
26#include "at91_aic.h"
27#include "soc.h" 17#include "soc.h"
28#include "generic.h" 18#include "generic.h"
29#include "sam9_smc.h"
30#include "pm.h"
31
32#if defined(CONFIG_OLD_CLK_AT91)
33#include "clock.h"
34
35/* --------------------------------------------------------------------
36 * Clocks
37 * -------------------------------------------------------------------- */
38
39/*
40 * The peripheral clocks.
41 */
42static struct clk pioA_clk = {
43 .name = "pioA_clk",
44 .pmc_mask = 1 << AT91SAM9261_ID_PIOA,
45 .type = CLK_TYPE_PERIPHERAL,
46};
47static struct clk pioB_clk = {
48 .name = "pioB_clk",
49 .pmc_mask = 1 << AT91SAM9261_ID_PIOB,
50 .type = CLK_TYPE_PERIPHERAL,
51};
52static struct clk pioC_clk = {
53 .name = "pioC_clk",
54 .pmc_mask = 1 << AT91SAM9261_ID_PIOC,
55 .type = CLK_TYPE_PERIPHERAL,
56};
57static struct clk usart0_clk = {
58 .name = "usart0_clk",
59 .pmc_mask = 1 << AT91SAM9261_ID_US0,
60 .type = CLK_TYPE_PERIPHERAL,
61};
62static struct clk usart1_clk = {
63 .name = "usart1_clk",
64 .pmc_mask = 1 << AT91SAM9261_ID_US1,
65 .type = CLK_TYPE_PERIPHERAL,
66};
67static struct clk usart2_clk = {
68 .name = "usart2_clk",
69 .pmc_mask = 1 << AT91SAM9261_ID_US2,
70 .type = CLK_TYPE_PERIPHERAL,
71};
72static struct clk mmc_clk = {
73 .name = "mci_clk",
74 .pmc_mask = 1 << AT91SAM9261_ID_MCI,
75 .type = CLK_TYPE_PERIPHERAL,
76};
77static struct clk udc_clk = {
78 .name = "udc_clk",
79 .pmc_mask = 1 << AT91SAM9261_ID_UDP,
80 .type = CLK_TYPE_PERIPHERAL,
81};
82static struct clk twi_clk = {
83 .name = "twi_clk",
84 .pmc_mask = 1 << AT91SAM9261_ID_TWI,
85 .type = CLK_TYPE_PERIPHERAL,
86};
87static struct clk spi0_clk = {
88 .name = "spi0_clk",
89 .pmc_mask = 1 << AT91SAM9261_ID_SPI0,
90 .type = CLK_TYPE_PERIPHERAL,
91};
92static struct clk spi1_clk = {
93 .name = "spi1_clk",
94 .pmc_mask = 1 << AT91SAM9261_ID_SPI1,
95 .type = CLK_TYPE_PERIPHERAL,
96};
97static struct clk ssc0_clk = {
98 .name = "ssc0_clk",
99 .pmc_mask = 1 << AT91SAM9261_ID_SSC0,
100 .type = CLK_TYPE_PERIPHERAL,
101};
102static struct clk ssc1_clk = {
103 .name = "ssc1_clk",
104 .pmc_mask = 1 << AT91SAM9261_ID_SSC1,
105 .type = CLK_TYPE_PERIPHERAL,
106};
107static struct clk ssc2_clk = {
108 .name = "ssc2_clk",
109 .pmc_mask = 1 << AT91SAM9261_ID_SSC2,
110 .type = CLK_TYPE_PERIPHERAL,
111};
112static struct clk tc0_clk = {
113 .name = "tc0_clk",
114 .pmc_mask = 1 << AT91SAM9261_ID_TC0,
115 .type = CLK_TYPE_PERIPHERAL,
116};
117static struct clk tc1_clk = {
118 .name = "tc1_clk",
119 .pmc_mask = 1 << AT91SAM9261_ID_TC1,
120 .type = CLK_TYPE_PERIPHERAL,
121};
122static struct clk tc2_clk = {
123 .name = "tc2_clk",
124 .pmc_mask = 1 << AT91SAM9261_ID_TC2,
125 .type = CLK_TYPE_PERIPHERAL,
126};
127static struct clk ohci_clk = {
128 .name = "ohci_clk",
129 .pmc_mask = 1 << AT91SAM9261_ID_UHP,
130 .type = CLK_TYPE_PERIPHERAL,
131};
132static struct clk lcdc_clk = {
133 .name = "lcdc_clk",
134 .pmc_mask = 1 << AT91SAM9261_ID_LCDC,
135 .type = CLK_TYPE_PERIPHERAL,
136};
137
138/* HClocks */
139static struct clk hck0 = {
140 .name = "hck0",
141 .pmc_mask = AT91_PMC_HCK0,
142 .type = CLK_TYPE_SYSTEM,
143 .id = 0,
144};
145static struct clk hck1 = {
146 .name = "hck1",
147 .pmc_mask = AT91_PMC_HCK1,
148 .type = CLK_TYPE_SYSTEM,
149 .id = 1,
150};
151
152static struct clk *periph_clocks[] __initdata = {
153 &pioA_clk,
154 &pioB_clk,
155 &pioC_clk,
156 &usart0_clk,
157 &usart1_clk,
158 &usart2_clk,
159 &mmc_clk,
160 &udc_clk,
161 &twi_clk,
162 &spi0_clk,
163 &spi1_clk,
164 &ssc0_clk,
165 &ssc1_clk,
166 &ssc2_clk,
167 &tc0_clk,
168 &tc1_clk,
169 &tc2_clk,
170 &ohci_clk,
171 &lcdc_clk,
172 // irq0 .. irq2
173};
174
175static struct clk_lookup periph_clocks_lookups[] = {
176 CLKDEV_CON_DEV_ID("hclk", "at91sam9261-lcdfb.0", &hck1),
177 CLKDEV_CON_DEV_ID("hclk", "at91sam9g10-lcdfb.0", &hck1),
178 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
179 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
180 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
181 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
182 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
183 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
184 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
185 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.2", &ssc2_clk),
186 CLKDEV_CON_DEV_ID("pclk", "fffbc000.ssc", &ssc0_clk),
187 CLKDEV_CON_DEV_ID("pclk", "fffc0000.ssc", &ssc1_clk),
188 CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc2_clk),
189 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
190 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9261.0", &twi_clk),
191 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.0", &twi_clk),
192 CLKDEV_CON_ID("pioA", &pioA_clk),
193 CLKDEV_CON_ID("pioB", &pioB_clk),
194 CLKDEV_CON_ID("pioC", &pioC_clk),
195 /* more lookup table for DT entries */
196 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
197 CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
198 CLKDEV_CON_DEV_ID("usart", "ffffb400.serial", &usart1_clk),
199 CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk),
200 CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
201 CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
202 CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
203 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &hck0),
204 CLKDEV_CON_DEV_ID("hclk", "600000.fb", &hck1),
205 CLKDEV_CON_DEV_ID("spi_clk", "fffc8000.spi", &spi0_clk),
206 CLKDEV_CON_DEV_ID("spi_clk", "fffcc000.spi", &spi1_clk),
207 CLKDEV_CON_DEV_ID("mci_clk", "fffa8000.mmc", &mmc_clk),
208 CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi_clk),
209 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
210 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
211 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
212};
213
214static struct clk_lookup usart_clocks_lookups[] = {
215 CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck),
216 CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk),
217 CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk),
218 CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk),
219};
220
221/*
222 * The four programmable clocks.
223 * You must configure pin multiplexing to bring these signals out.
224 */
225static struct clk pck0 = {
226 .name = "pck0",
227 .pmc_mask = AT91_PMC_PCK0,
228 .type = CLK_TYPE_PROGRAMMABLE,
229 .id = 0,
230};
231static struct clk pck1 = {
232 .name = "pck1",
233 .pmc_mask = AT91_PMC_PCK1,
234 .type = CLK_TYPE_PROGRAMMABLE,
235 .id = 1,
236};
237static struct clk pck2 = {
238 .name = "pck2",
239 .pmc_mask = AT91_PMC_PCK2,
240 .type = CLK_TYPE_PROGRAMMABLE,
241 .id = 2,
242};
243static struct clk pck3 = {
244 .name = "pck3",
245 .pmc_mask = AT91_PMC_PCK3,
246 .type = CLK_TYPE_PROGRAMMABLE,
247 .id = 3,
248};
249
250static void __init at91sam9261_register_clocks(void)
251{
252 int i;
253
254 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
255 clk_register(periph_clocks[i]);
256
257 clkdev_add_table(periph_clocks_lookups,
258 ARRAY_SIZE(periph_clocks_lookups));
259 clkdev_add_table(usart_clocks_lookups,
260 ARRAY_SIZE(usart_clocks_lookups));
261
262 clk_register(&pck0);
263 clk_register(&pck1);
264 clk_register(&pck2);
265 clk_register(&pck3);
266
267 clk_register(&hck0);
268 clk_register(&hck1);
269}
270#else
271#define at91sam9261_register_clocks NULL
272#endif
273/* --------------------------------------------------------------------
274 * GPIO
275 * -------------------------------------------------------------------- */
276
277static struct at91_gpio_bank at91sam9261_gpio[] __initdata = {
278 {
279 .id = AT91SAM9261_ID_PIOA,
280 .regbase = AT91SAM9261_BASE_PIOA,
281 }, {
282 .id = AT91SAM9261_ID_PIOB,
283 .regbase = AT91SAM9261_BASE_PIOB,
284 }, {
285 .id = AT91SAM9261_ID_PIOC,
286 .regbase = AT91SAM9261_BASE_PIOC,
287 }
288};
289 19
290/* -------------------------------------------------------------------- 20/* --------------------------------------------------------------------
291 * AT91SAM9261 processor initialization 21 * AT91SAM9261 processor initialization
@@ -299,119 +29,14 @@ static void __init at91sam9261_map_io(void)
299 at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE); 29 at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE);
300} 30}
301 31
302static void __init at91sam9261_ioremap_registers(void)
303{
304 at91_ioremap_ramc(0, AT91SAM9261_BASE_SDRAMC, 512);
305 at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT);
306 at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC);
307 at91_ioremap_matrix(AT91SAM9261_BASE_MATRIX);
308 at91_pm_set_standby(at91sam9_sdram_standby);
309}
310
311static void __init at91sam9261_initialize(void) 32static void __init at91sam9261_initialize(void)
312{ 33{
313 arm_pm_idle = at91sam9_idle; 34 arm_pm_idle = at91sam9_idle;
314 35
315 at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT); 36 at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT);
316
317 /* Register GPIO subsystem */
318 at91_gpio_init(at91sam9261_gpio, 3);
319}
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
360/* --------------------------------------------------------------------
361 * Interrupt initialization
362 * -------------------------------------------------------------------- */
363
364/*
365 * The default interrupt priority levels (0 = lowest, 7 = highest).
366 */
367static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
368 7, /* Advanced Interrupt Controller */
369 7, /* System Peripherals */
370 1, /* Parallel IO Controller A */
371 1, /* Parallel IO Controller B */
372 1, /* Parallel IO Controller C */
373 0,
374 5, /* USART 0 */
375 5, /* USART 1 */
376 5, /* USART 2 */
377 0, /* Multimedia Card Interface */
378 2, /* USB Device Port */
379 6, /* Two-Wire Interface */
380 5, /* Serial Peripheral Interface 0 */
381 5, /* Serial Peripheral Interface 1 */
382 4, /* Serial Synchronous Controller 0 */
383 4, /* Serial Synchronous Controller 1 */
384 4, /* Serial Synchronous Controller 2 */
385 0, /* Timer Counter 0 */
386 0, /* Timer Counter 1 */
387 0, /* Timer Counter 2 */
388 2, /* USB Host port */
389 3, /* LCD Controller */
390 0,
391 0,
392 0,
393 0,
394 0,
395 0,
396 0,
397 0, /* Advanced Interrupt Controller */
398 0, /* Advanced Interrupt Controller */
399 0, /* Advanced Interrupt Controller */
400};
401
402static void __init at91sam9261_init_time(void)
403{
404 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
405} 37}
406 38
407AT91_SOC_START(at91sam9261) 39AT91_SOC_START(at91sam9261)
408 .map_io = at91sam9261_map_io, 40 .map_io = at91sam9261_map_io,
409 .default_irq_priority = at91sam9261_default_irq_priority,
410 .extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
411 | (1 << AT91SAM9261_ID_IRQ2),
412 .ioremap_registers = at91sam9261_ioremap_registers,
413 .register_clocks = at91sam9261_register_clocks,
414 .register_devices = at91sam9261_register_devices,
415 .init = at91sam9261_initialize, 41 .init = at91sam9261_initialize,
416 .init_time = at91sam9261_init_time,
417AT91_SOC_END 42AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
deleted file mode 100644
index 29baacb5c359..000000000000
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ /dev/null
@@ -1,1098 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91sam9261_devices.c
3 *
4 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
5 * Copyright (C) 2005 David Brownell
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 */
13#include <asm/mach/arch.h>
14#include <asm/mach/map.h>
15
16#include <linux/dma-mapping.h>
17#include <linux/gpio.h>
18#include <linux/platform_device.h>
19#include <linux/i2c-gpio.h>
20
21#include <linux/fb.h>
22#include <video/atmel_lcdc.h>
23
24#include <mach/at91sam9261.h>
25#include <mach/at91sam9261_matrix.h>
26#include <mach/at91_matrix.h>
27#include <mach/at91sam9_smc.h>
28#include <mach/hardware.h>
29
30#include "board.h"
31#include "generic.h"
32#include "gpio.h"
33
34/* --------------------------------------------------------------------
35 * USB Host
36 * -------------------------------------------------------------------- */
37
38#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
39static u64 ohci_dmamask = DMA_BIT_MASK(32);
40static struct at91_usbh_data usbh_data;
41
42static struct resource usbh_resources[] = {
43 [0] = {
44 .start = AT91SAM9261_UHP_BASE,
45 .end = AT91SAM9261_UHP_BASE + SZ_1M - 1,
46 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
49 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_UHP,
50 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_UHP,
51 .flags = IORESOURCE_IRQ,
52 },
53};
54
55static struct platform_device at91sam9261_usbh_device = {
56 .name = "at91_ohci",
57 .id = -1,
58 .dev = {
59 .dma_mask = &ohci_dmamask,
60 .coherent_dma_mask = DMA_BIT_MASK(32),
61 .platform_data = &usbh_data,
62 },
63 .resource = usbh_resources,
64 .num_resources = ARRAY_SIZE(usbh_resources),
65};
66
67void __init at91_add_device_usbh(struct at91_usbh_data *data)
68{
69 int i;
70
71 if (!data)
72 return;
73
74 /* Enable overcurrent notification */
75 for (i = 0; i < data->ports; i++) {
76 if (gpio_is_valid(data->overcurrent_pin[i]))
77 at91_set_gpio_input(data->overcurrent_pin[i], 1);
78 }
79
80 usbh_data = *data;
81 platform_device_register(&at91sam9261_usbh_device);
82}
83#else
84void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
85#endif
86
87
88/* --------------------------------------------------------------------
89 * USB Device (Gadget)
90 * -------------------------------------------------------------------- */
91
92#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
93static struct at91_udc_data udc_data;
94
95static struct resource udc_resources[] = {
96 [0] = {
97 .start = AT91SAM9261_BASE_UDP,
98 .end = AT91SAM9261_BASE_UDP + SZ_16K - 1,
99 .flags = IORESOURCE_MEM,
100 },
101 [1] = {
102 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_UDP,
103 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_UDP,
104 .flags = IORESOURCE_IRQ,
105 },
106};
107
108static struct platform_device at91sam9261_udc_device = {
109 .name = "at91_udc",
110 .id = -1,
111 .dev = {
112 .platform_data = &udc_data,
113 },
114 .resource = udc_resources,
115 .num_resources = ARRAY_SIZE(udc_resources),
116};
117
118void __init at91_add_device_udc(struct at91_udc_data *data)
119{
120 if (!data)
121 return;
122
123 if (gpio_is_valid(data->vbus_pin)) {
124 at91_set_gpio_input(data->vbus_pin, 0);
125 at91_set_deglitch(data->vbus_pin, 1);
126 }
127
128 /* Pullup pin is handled internally by USB device peripheral */
129
130 udc_data = *data;
131 platform_device_register(&at91sam9261_udc_device);
132}
133#else
134void __init at91_add_device_udc(struct at91_udc_data *data) {}
135#endif
136
137/* --------------------------------------------------------------------
138 * MMC / SD
139 * -------------------------------------------------------------------- */
140
141#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
142static u64 mmc_dmamask = DMA_BIT_MASK(32);
143static struct mci_platform_data mmc_data;
144
145static struct resource mmc_resources[] = {
146 [0] = {
147 .start = AT91SAM9261_BASE_MCI,
148 .end = AT91SAM9261_BASE_MCI + SZ_16K - 1,
149 .flags = IORESOURCE_MEM,
150 },
151 [1] = {
152 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_MCI,
153 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_MCI,
154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158static struct platform_device at91sam9261_mmc_device = {
159 .name = "atmel_mci",
160 .id = -1,
161 .dev = {
162 .dma_mask = &mmc_dmamask,
163 .coherent_dma_mask = DMA_BIT_MASK(32),
164 .platform_data = &mmc_data,
165 },
166 .resource = mmc_resources,
167 .num_resources = ARRAY_SIZE(mmc_resources),
168};
169
170void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
171{
172 if (!data)
173 return;
174
175 if (data->slot[0].bus_width) {
176 /* input/irq */
177 if (gpio_is_valid(data->slot[0].detect_pin)) {
178 at91_set_gpio_input(data->slot[0].detect_pin, 1);
179 at91_set_deglitch(data->slot[0].detect_pin, 1);
180 }
181 if (gpio_is_valid(data->slot[0].wp_pin))
182 at91_set_gpio_input(data->slot[0].wp_pin, 1);
183
184 /* CLK */
185 at91_set_B_periph(AT91_PIN_PA2, 0);
186
187 /* CMD */
188 at91_set_B_periph(AT91_PIN_PA1, 1);
189
190 /* DAT0, maybe DAT1..DAT3 */
191 at91_set_B_periph(AT91_PIN_PA0, 1);
192 if (data->slot[0].bus_width == 4) {
193 at91_set_B_periph(AT91_PIN_PA4, 1);
194 at91_set_B_periph(AT91_PIN_PA5, 1);
195 at91_set_B_periph(AT91_PIN_PA6, 1);
196 }
197
198 mmc_data = *data;
199 platform_device_register(&at91sam9261_mmc_device);
200 }
201}
202#else
203void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
204#endif
205
206
207/* --------------------------------------------------------------------
208 * NAND / SmartMedia
209 * -------------------------------------------------------------------- */
210
211#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
212static struct atmel_nand_data nand_data;
213
214#define NAND_BASE AT91_CHIPSELECT_3
215
216static struct resource nand_resources[] = {
217 {
218 .start = NAND_BASE,
219 .end = NAND_BASE + SZ_256M - 1,
220 .flags = IORESOURCE_MEM,
221 }
222};
223
224static struct platform_device atmel_nand_device = {
225 .name = "atmel_nand",
226 .id = -1,
227 .dev = {
228 .platform_data = &nand_data,
229 },
230 .resource = nand_resources,
231 .num_resources = ARRAY_SIZE(nand_resources),
232};
233
234void __init at91_add_device_nand(struct atmel_nand_data *data)
235{
236 unsigned long csa;
237
238 if (!data)
239 return;
240
241 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
242 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
243
244 /* enable pin */
245 if (gpio_is_valid(data->enable_pin))
246 at91_set_gpio_output(data->enable_pin, 1);
247
248 /* ready/busy pin */
249 if (gpio_is_valid(data->rdy_pin))
250 at91_set_gpio_input(data->rdy_pin, 1);
251
252 /* card detect pin */
253 if (gpio_is_valid(data->det_pin))
254 at91_set_gpio_input(data->det_pin, 1);
255
256 at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */
257 at91_set_A_periph(AT91_PIN_PC1, 0); /* NANDWE */
258
259 nand_data = *data;
260 platform_device_register(&atmel_nand_device);
261}
262
263#else
264void __init at91_add_device_nand(struct atmel_nand_data *data) {}
265#endif
266
267
268/* --------------------------------------------------------------------
269 * TWI (i2c)
270 * -------------------------------------------------------------------- */
271
272/*
273 * Prefer the GPIO code since the TWI controller isn't robust
274 * (gets overruns and underruns under load) and can only issue
275 * repeated STARTs in one scenario (the driver doesn't yet handle them).
276 */
277#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
278
279static struct i2c_gpio_platform_data pdata = {
280 .sda_pin = AT91_PIN_PA7,
281 .sda_is_open_drain = 1,
282 .scl_pin = AT91_PIN_PA8,
283 .scl_is_open_drain = 1,
284 .udelay = 2, /* ~100 kHz */
285};
286
287static struct platform_device at91sam9261_twi_device = {
288 .name = "i2c-gpio",
289 .id = 0,
290 .dev.platform_data = &pdata,
291};
292
293void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
294{
295 at91_set_GPIO_periph(AT91_PIN_PA7, 1); /* TWD (SDA) */
296 at91_set_multi_drive(AT91_PIN_PA7, 1);
297
298 at91_set_GPIO_periph(AT91_PIN_PA8, 1); /* TWCK (SCL) */
299 at91_set_multi_drive(AT91_PIN_PA8, 1);
300
301 i2c_register_board_info(0, devices, nr_devices);
302 platform_device_register(&at91sam9261_twi_device);
303}
304
305#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
306
307static struct resource twi_resources[] = {
308 [0] = {
309 .start = AT91SAM9261_BASE_TWI,
310 .end = AT91SAM9261_BASE_TWI + SZ_16K - 1,
311 .flags = IORESOURCE_MEM,
312 },
313 [1] = {
314 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_TWI,
315 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_TWI,
316 .flags = IORESOURCE_IRQ,
317 },
318};
319
320static struct platform_device at91sam9261_twi_device = {
321 .id = 0,
322 .resource = twi_resources,
323 .num_resources = ARRAY_SIZE(twi_resources),
324};
325
326void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
327{
328 /* IP version is not the same on 9261 and g10 */
329 if (cpu_is_at91sam9g10()) {
330 at91sam9261_twi_device.name = "i2c-at91sam9g10";
331 /* I2C PIO must not be configured as open-drain on this chip */
332 } else {
333 at91sam9261_twi_device.name = "i2c-at91sam9261";
334 at91_set_multi_drive(AT91_PIN_PA7, 1);
335 at91_set_multi_drive(AT91_PIN_PA8, 1);
336 }
337
338 /* pins used for TWI interface */
339 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */
340 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */
341
342 i2c_register_board_info(0, devices, nr_devices);
343 platform_device_register(&at91sam9261_twi_device);
344}
345#else
346void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
347#endif
348
349
350/* --------------------------------------------------------------------
351 * SPI
352 * -------------------------------------------------------------------- */
353
354#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
355static u64 spi_dmamask = DMA_BIT_MASK(32);
356
357static struct resource spi0_resources[] = {
358 [0] = {
359 .start = AT91SAM9261_BASE_SPI0,
360 .end = AT91SAM9261_BASE_SPI0 + SZ_16K - 1,
361 .flags = IORESOURCE_MEM,
362 },
363 [1] = {
364 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI0,
365 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI0,
366 .flags = IORESOURCE_IRQ,
367 },
368};
369
370static struct platform_device at91sam9261_spi0_device = {
371 .name = "atmel_spi",
372 .id = 0,
373 .dev = {
374 .dma_mask = &spi_dmamask,
375 .coherent_dma_mask = DMA_BIT_MASK(32),
376 },
377 .resource = spi0_resources,
378 .num_resources = ARRAY_SIZE(spi0_resources),
379};
380
381static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PA4, AT91_PIN_PA5, AT91_PIN_PA6 };
382
383static struct resource spi1_resources[] = {
384 [0] = {
385 .start = AT91SAM9261_BASE_SPI1,
386 .end = AT91SAM9261_BASE_SPI1 + SZ_16K - 1,
387 .flags = IORESOURCE_MEM,
388 },
389 [1] = {
390 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI1,
391 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI1,
392 .flags = IORESOURCE_IRQ,
393 },
394};
395
396static struct platform_device at91sam9261_spi1_device = {
397 .name = "atmel_spi",
398 .id = 1,
399 .dev = {
400 .dma_mask = &spi_dmamask,
401 .coherent_dma_mask = DMA_BIT_MASK(32),
402 },
403 .resource = spi1_resources,
404 .num_resources = ARRAY_SIZE(spi1_resources),
405};
406
407static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB28, AT91_PIN_PA24, AT91_PIN_PA25, AT91_PIN_PA26 };
408
409void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
410{
411 int i;
412 unsigned long cs_pin;
413 short enable_spi0 = 0;
414 short enable_spi1 = 0;
415
416 /* Choose SPI chip-selects */
417 for (i = 0; i < nr_devices; i++) {
418 if (devices[i].controller_data)
419 cs_pin = (unsigned long) devices[i].controller_data;
420 else if (devices[i].bus_num == 0)
421 cs_pin = spi0_standard_cs[devices[i].chip_select];
422 else
423 cs_pin = spi1_standard_cs[devices[i].chip_select];
424
425 if (!gpio_is_valid(cs_pin))
426 continue;
427
428 if (devices[i].bus_num == 0)
429 enable_spi0 = 1;
430 else
431 enable_spi1 = 1;
432
433 /* enable chip-select pin */
434 at91_set_gpio_output(cs_pin, 1);
435
436 /* pass chip-select pin to driver */
437 devices[i].controller_data = (void *) cs_pin;
438 }
439
440 spi_register_board_info(devices, nr_devices);
441
442 /* Configure SPI bus(es) */
443 if (enable_spi0) {
444 at91_set_A_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
445 at91_set_A_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
446 at91_set_A_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
447
448 platform_device_register(&at91sam9261_spi0_device);
449 }
450 if (enable_spi1) {
451 at91_set_A_periph(AT91_PIN_PB30, 0); /* SPI1_MISO */
452 at91_set_A_periph(AT91_PIN_PB31, 0); /* SPI1_MOSI */
453 at91_set_A_periph(AT91_PIN_PB29, 0); /* SPI1_SPCK */
454
455 platform_device_register(&at91sam9261_spi1_device);
456 }
457}
458#else
459void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
460#endif
461
462
463/* --------------------------------------------------------------------
464 * LCD Controller
465 * -------------------------------------------------------------------- */
466
467#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
468static u64 lcdc_dmamask = DMA_BIT_MASK(32);
469static struct atmel_lcdfb_pdata lcdc_data;
470
471static struct resource lcdc_resources[] = {
472 [0] = {
473 .start = AT91SAM9261_LCDC_BASE,
474 .end = AT91SAM9261_LCDC_BASE + SZ_4K - 1,
475 .flags = IORESOURCE_MEM,
476 },
477 [1] = {
478 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_LCDC,
479 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_LCDC,
480 .flags = IORESOURCE_IRQ,
481 },
482#if defined(CONFIG_FB_INTSRAM)
483 [2] = {
484 .start = AT91SAM9261_SRAM_BASE,
485 .end = AT91SAM9261_SRAM_BASE + AT91SAM9261_SRAM_SIZE - 1,
486 .flags = IORESOURCE_MEM,
487 },
488#endif
489};
490
491static struct platform_device at91_lcdc_device = {
492 .id = 0,
493 .dev = {
494 .dma_mask = &lcdc_dmamask,
495 .coherent_dma_mask = DMA_BIT_MASK(32),
496 .platform_data = &lcdc_data,
497 },
498 .resource = lcdc_resources,
499 .num_resources = ARRAY_SIZE(lcdc_resources),
500};
501
502void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
503{
504 if (!data) {
505 return;
506 }
507
508 if (cpu_is_at91sam9g10())
509 at91_lcdc_device.name = "at91sam9g10-lcdfb";
510 else
511 at91_lcdc_device.name = "at91sam9261-lcdfb";
512
513#if defined(CONFIG_FB_ATMEL_STN)
514 at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */
515 at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */
516 at91_set_A_periph(AT91_PIN_PB2, 0); /* LCDDOTCK */
517 at91_set_A_periph(AT91_PIN_PB3, 0); /* LCDDEN */
518 at91_set_A_periph(AT91_PIN_PB4, 0); /* LCDCC */
519 at91_set_A_periph(AT91_PIN_PB5, 0); /* LCDD0 */
520 at91_set_A_periph(AT91_PIN_PB6, 0); /* LCDD1 */
521 at91_set_A_periph(AT91_PIN_PB7, 0); /* LCDD2 */
522 at91_set_A_periph(AT91_PIN_PB8, 0); /* LCDD3 */
523#else
524 at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */
525 at91_set_A_periph(AT91_PIN_PB2, 0); /* LCDDOTCK */
526 at91_set_A_periph(AT91_PIN_PB3, 0); /* LCDDEN */
527 at91_set_A_periph(AT91_PIN_PB4, 0); /* LCDCC */
528 at91_set_A_periph(AT91_PIN_PB7, 0); /* LCDD2 */
529 at91_set_A_periph(AT91_PIN_PB8, 0); /* LCDD3 */
530 at91_set_A_periph(AT91_PIN_PB9, 0); /* LCDD4 */
531 at91_set_A_periph(AT91_PIN_PB10, 0); /* LCDD5 */
532 at91_set_A_periph(AT91_PIN_PB11, 0); /* LCDD6 */
533 at91_set_A_periph(AT91_PIN_PB12, 0); /* LCDD7 */
534 at91_set_A_periph(AT91_PIN_PB15, 0); /* LCDD10 */
535 at91_set_A_periph(AT91_PIN_PB16, 0); /* LCDD11 */
536 at91_set_A_periph(AT91_PIN_PB17, 0); /* LCDD12 */
537 at91_set_A_periph(AT91_PIN_PB18, 0); /* LCDD13 */
538 at91_set_A_periph(AT91_PIN_PB19, 0); /* LCDD14 */
539 at91_set_A_periph(AT91_PIN_PB20, 0); /* LCDD15 */
540 at91_set_B_periph(AT91_PIN_PB23, 0); /* LCDD18 */
541 at91_set_B_periph(AT91_PIN_PB24, 0); /* LCDD19 */
542 at91_set_B_periph(AT91_PIN_PB25, 0); /* LCDD20 */
543 at91_set_B_periph(AT91_PIN_PB26, 0); /* LCDD21 */
544 at91_set_B_periph(AT91_PIN_PB27, 0); /* LCDD22 */
545 at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */
546#endif
547
548 if (ARRAY_SIZE(lcdc_resources) > 2) {
549 void __iomem *fb;
550 struct resource *fb_res = &lcdc_resources[2];
551 size_t fb_len = resource_size(fb_res);
552
553 fb = ioremap(fb_res->start, fb_len);
554 if (fb) {
555 memset(fb, 0, fb_len);
556 iounmap(fb);
557 }
558 }
559 lcdc_data = *data;
560 platform_device_register(&at91_lcdc_device);
561}
562#else
563void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
564#endif
565
566
567/* --------------------------------------------------------------------
568 * Timer/Counter block
569 * -------------------------------------------------------------------- */
570
571#ifdef CONFIG_ATMEL_TCLIB
572
573static struct resource tcb_resources[] = {
574 [0] = {
575 .start = AT91SAM9261_BASE_TCB0,
576 .end = AT91SAM9261_BASE_TCB0 + SZ_16K - 1,
577 .flags = IORESOURCE_MEM,
578 },
579 [1] = {
580 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_TC0,
581 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_TC0,
582 .flags = IORESOURCE_IRQ,
583 },
584 [2] = {
585 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_TC1,
586 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_TC1,
587 .flags = IORESOURCE_IRQ,
588 },
589 [3] = {
590 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_TC2,
591 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_TC2,
592 .flags = IORESOURCE_IRQ,
593 },
594};
595
596static struct platform_device at91sam9261_tcb_device = {
597 .name = "atmel_tcb",
598 .id = 0,
599 .resource = tcb_resources,
600 .num_resources = ARRAY_SIZE(tcb_resources),
601};
602
603static void __init at91_add_device_tc(void)
604{
605 platform_device_register(&at91sam9261_tcb_device);
606}
607#else
608static void __init at91_add_device_tc(void) { }
609#endif
610
611
612/* --------------------------------------------------------------------
613 * RTT
614 * -------------------------------------------------------------------- */
615
616static struct resource rtt_resources[] = {
617 {
618 .start = AT91SAM9261_BASE_RTT,
619 .end = AT91SAM9261_BASE_RTT + SZ_16 - 1,
620 .flags = IORESOURCE_MEM,
621 }, {
622 .flags = IORESOURCE_MEM,
623 }, {
624 .flags = IORESOURCE_IRQ,
625 }
626};
627
628static struct platform_device at91sam9261_rtt_device = {
629 .name = "at91_rtt",
630 .id = 0,
631 .resource = rtt_resources,
632};
633
634#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
635static void __init at91_add_device_rtt_rtc(void)
636{
637 at91sam9261_rtt_device.name = "rtc-at91sam9";
638 /*
639 * The second resource is needed:
640 * GPBR will serve as the storage for RTC time offset
641 */
642 at91sam9261_rtt_device.num_resources = 3;
643 rtt_resources[1].start = AT91SAM9261_BASE_GPBR +
644 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
645 rtt_resources[1].end = rtt_resources[1].start + 3;
646 rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
647 rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
648}
649#else
650static void __init at91_add_device_rtt_rtc(void)
651{
652 /* Only one resource is needed: RTT not used as RTC */
653 at91sam9261_rtt_device.num_resources = 1;
654}
655#endif
656
657static void __init at91_add_device_rtt(void)
658{
659 at91_add_device_rtt_rtc();
660 platform_device_register(&at91sam9261_rtt_device);
661}
662
663
664/* --------------------------------------------------------------------
665 * Watchdog
666 * -------------------------------------------------------------------- */
667
668#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
669static struct resource wdt_resources[] = {
670 {
671 .start = AT91SAM9261_BASE_WDT,
672 .end = AT91SAM9261_BASE_WDT + SZ_16 - 1,
673 .flags = IORESOURCE_MEM,
674 }
675};
676
677static struct platform_device at91sam9261_wdt_device = {
678 .name = "at91_wdt",
679 .id = -1,
680 .resource = wdt_resources,
681 .num_resources = ARRAY_SIZE(wdt_resources),
682};
683
684static void __init at91_add_device_watchdog(void)
685{
686 platform_device_register(&at91sam9261_wdt_device);
687}
688#else
689static void __init at91_add_device_watchdog(void) {}
690#endif
691
692
693/* --------------------------------------------------------------------
694 * SSC -- Synchronous Serial Controller
695 * -------------------------------------------------------------------- */
696
697#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
698static u64 ssc0_dmamask = DMA_BIT_MASK(32);
699
700static struct resource ssc0_resources[] = {
701 [0] = {
702 .start = AT91SAM9261_BASE_SSC0,
703 .end = AT91SAM9261_BASE_SSC0 + SZ_16K - 1,
704 .flags = IORESOURCE_MEM,
705 },
706 [1] = {
707 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC0,
708 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC0,
709 .flags = IORESOURCE_IRQ,
710 },
711};
712
713static struct platform_device at91sam9261_ssc0_device = {
714 .name = "at91rm9200_ssc",
715 .id = 0,
716 .dev = {
717 .dma_mask = &ssc0_dmamask,
718 .coherent_dma_mask = DMA_BIT_MASK(32),
719 },
720 .resource = ssc0_resources,
721 .num_resources = ARRAY_SIZE(ssc0_resources),
722};
723
724static inline void configure_ssc0_pins(unsigned pins)
725{
726 if (pins & ATMEL_SSC_TF)
727 at91_set_A_periph(AT91_PIN_PB21, 1);
728 if (pins & ATMEL_SSC_TK)
729 at91_set_A_periph(AT91_PIN_PB22, 1);
730 if (pins & ATMEL_SSC_TD)
731 at91_set_A_periph(AT91_PIN_PB23, 1);
732 if (pins & ATMEL_SSC_RD)
733 at91_set_A_periph(AT91_PIN_PB24, 1);
734 if (pins & ATMEL_SSC_RK)
735 at91_set_A_periph(AT91_PIN_PB25, 1);
736 if (pins & ATMEL_SSC_RF)
737 at91_set_A_periph(AT91_PIN_PB26, 1);
738}
739
740static u64 ssc1_dmamask = DMA_BIT_MASK(32);
741
742static struct resource ssc1_resources[] = {
743 [0] = {
744 .start = AT91SAM9261_BASE_SSC1,
745 .end = AT91SAM9261_BASE_SSC1 + SZ_16K - 1,
746 .flags = IORESOURCE_MEM,
747 },
748 [1] = {
749 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC1,
750 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC1,
751 .flags = IORESOURCE_IRQ,
752 },
753};
754
755static struct platform_device at91sam9261_ssc1_device = {
756 .name = "at91rm9200_ssc",
757 .id = 1,
758 .dev = {
759 .dma_mask = &ssc1_dmamask,
760 .coherent_dma_mask = DMA_BIT_MASK(32),
761 },
762 .resource = ssc1_resources,
763 .num_resources = ARRAY_SIZE(ssc1_resources),
764};
765
766static inline void configure_ssc1_pins(unsigned pins)
767{
768 if (pins & ATMEL_SSC_TF)
769 at91_set_B_periph(AT91_PIN_PA17, 1);
770 if (pins & ATMEL_SSC_TK)
771 at91_set_B_periph(AT91_PIN_PA18, 1);
772 if (pins & ATMEL_SSC_TD)
773 at91_set_B_periph(AT91_PIN_PA19, 1);
774 if (pins & ATMEL_SSC_RD)
775 at91_set_B_periph(AT91_PIN_PA20, 1);
776 if (pins & ATMEL_SSC_RK)
777 at91_set_B_periph(AT91_PIN_PA21, 1);
778 if (pins & ATMEL_SSC_RF)
779 at91_set_B_periph(AT91_PIN_PA22, 1);
780}
781
782static u64 ssc2_dmamask = DMA_BIT_MASK(32);
783
784static struct resource ssc2_resources[] = {
785 [0] = {
786 .start = AT91SAM9261_BASE_SSC2,
787 .end = AT91SAM9261_BASE_SSC2 + SZ_16K - 1,
788 .flags = IORESOURCE_MEM,
789 },
790 [1] = {
791 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC2,
792 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC2,
793 .flags = IORESOURCE_IRQ,
794 },
795};
796
797static struct platform_device at91sam9261_ssc2_device = {
798 .name = "at91rm9200_ssc",
799 .id = 2,
800 .dev = {
801 .dma_mask = &ssc2_dmamask,
802 .coherent_dma_mask = DMA_BIT_MASK(32),
803 },
804 .resource = ssc2_resources,
805 .num_resources = ARRAY_SIZE(ssc2_resources),
806};
807
808static inline void configure_ssc2_pins(unsigned pins)
809{
810 if (pins & ATMEL_SSC_TF)
811 at91_set_B_periph(AT91_PIN_PC25, 1);
812 if (pins & ATMEL_SSC_TK)
813 at91_set_B_periph(AT91_PIN_PC26, 1);
814 if (pins & ATMEL_SSC_TD)
815 at91_set_B_periph(AT91_PIN_PC27, 1);
816 if (pins & ATMEL_SSC_RD)
817 at91_set_B_periph(AT91_PIN_PC28, 1);
818 if (pins & ATMEL_SSC_RK)
819 at91_set_B_periph(AT91_PIN_PC29, 1);
820 if (pins & ATMEL_SSC_RF)
821 at91_set_B_periph(AT91_PIN_PC30, 1);
822}
823
824/*
825 * SSC controllers are accessed through library code, instead of any
826 * kind of all-singing/all-dancing driver. For example one could be
827 * used by a particular I2S audio codec's driver, while another one
828 * on the same system might be used by a custom data capture driver.
829 */
830void __init at91_add_device_ssc(unsigned id, unsigned pins)
831{
832 struct platform_device *pdev;
833
834 /*
835 * NOTE: caller is responsible for passing information matching
836 * "pins" to whatever will be using each particular controller.
837 */
838 switch (id) {
839 case AT91SAM9261_ID_SSC0:
840 pdev = &at91sam9261_ssc0_device;
841 configure_ssc0_pins(pins);
842 break;
843 case AT91SAM9261_ID_SSC1:
844 pdev = &at91sam9261_ssc1_device;
845 configure_ssc1_pins(pins);
846 break;
847 case AT91SAM9261_ID_SSC2:
848 pdev = &at91sam9261_ssc2_device;
849 configure_ssc2_pins(pins);
850 break;
851 default:
852 return;
853 }
854
855 platform_device_register(pdev);
856}
857
858#else
859void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
860#endif
861
862
863/* --------------------------------------------------------------------
864 * UART
865 * -------------------------------------------------------------------- */
866
867#if defined(CONFIG_SERIAL_ATMEL)
868static struct resource dbgu_resources[] = {
869 [0] = {
870 .start = AT91SAM9261_BASE_DBGU,
871 .end = AT91SAM9261_BASE_DBGU + SZ_512 - 1,
872 .flags = IORESOURCE_MEM,
873 },
874 [1] = {
875 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
876 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
877 .flags = IORESOURCE_IRQ,
878 },
879};
880
881static struct atmel_uart_data dbgu_data = {
882 .use_dma_tx = 0,
883 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
884};
885
886static u64 dbgu_dmamask = DMA_BIT_MASK(32);
887
888static struct platform_device at91sam9261_dbgu_device = {
889 .name = "atmel_usart",
890 .id = 0,
891 .dev = {
892 .dma_mask = &dbgu_dmamask,
893 .coherent_dma_mask = DMA_BIT_MASK(32),
894 .platform_data = &dbgu_data,
895 },
896 .resource = dbgu_resources,
897 .num_resources = ARRAY_SIZE(dbgu_resources),
898};
899
900static inline void configure_dbgu_pins(void)
901{
902 at91_set_A_periph(AT91_PIN_PA9, 0); /* DRXD */
903 at91_set_A_periph(AT91_PIN_PA10, 1); /* DTXD */
904}
905
906static struct resource uart0_resources[] = {
907 [0] = {
908 .start = AT91SAM9261_BASE_US0,
909 .end = AT91SAM9261_BASE_US0 + SZ_16K - 1,
910 .flags = IORESOURCE_MEM,
911 },
912 [1] = {
913 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_US0,
914 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_US0,
915 .flags = IORESOURCE_IRQ,
916 },
917};
918
919static struct atmel_uart_data uart0_data = {
920 .use_dma_tx = 1,
921 .use_dma_rx = 1,
922};
923
924static u64 uart0_dmamask = DMA_BIT_MASK(32);
925
926static struct platform_device at91sam9261_uart0_device = {
927 .name = "atmel_usart",
928 .id = 1,
929 .dev = {
930 .dma_mask = &uart0_dmamask,
931 .coherent_dma_mask = DMA_BIT_MASK(32),
932 .platform_data = &uart0_data,
933 },
934 .resource = uart0_resources,
935 .num_resources = ARRAY_SIZE(uart0_resources),
936};
937
938static inline void configure_usart0_pins(unsigned pins)
939{
940 at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */
941 at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */
942
943 if (pins & ATMEL_UART_RTS)
944 at91_set_A_periph(AT91_PIN_PC10, 0); /* RTS0 */
945 if (pins & ATMEL_UART_CTS)
946 at91_set_A_periph(AT91_PIN_PC11, 0); /* CTS0 */
947}
948
949static struct resource uart1_resources[] = {
950 [0] = {
951 .start = AT91SAM9261_BASE_US1,
952 .end = AT91SAM9261_BASE_US1 + SZ_16K - 1,
953 .flags = IORESOURCE_MEM,
954 },
955 [1] = {
956 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_US1,
957 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_US1,
958 .flags = IORESOURCE_IRQ,
959 },
960};
961
962static struct atmel_uart_data uart1_data = {
963 .use_dma_tx = 1,
964 .use_dma_rx = 1,
965};
966
967static u64 uart1_dmamask = DMA_BIT_MASK(32);
968
969static struct platform_device at91sam9261_uart1_device = {
970 .name = "atmel_usart",
971 .id = 2,
972 .dev = {
973 .dma_mask = &uart1_dmamask,
974 .coherent_dma_mask = DMA_BIT_MASK(32),
975 .platform_data = &uart1_data,
976 },
977 .resource = uart1_resources,
978 .num_resources = ARRAY_SIZE(uart1_resources),
979};
980
981static inline void configure_usart1_pins(unsigned pins)
982{
983 at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */
984 at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */
985
986 if (pins & ATMEL_UART_RTS)
987 at91_set_B_periph(AT91_PIN_PA12, 0); /* RTS1 */
988 if (pins & ATMEL_UART_CTS)
989 at91_set_B_periph(AT91_PIN_PA13, 0); /* CTS1 */
990}
991
992static struct resource uart2_resources[] = {
993 [0] = {
994 .start = AT91SAM9261_BASE_US2,
995 .end = AT91SAM9261_BASE_US2 + SZ_16K - 1,
996 .flags = IORESOURCE_MEM,
997 },
998 [1] = {
999 .start = NR_IRQS_LEGACY + AT91SAM9261_ID_US2,
1000 .end = NR_IRQS_LEGACY + AT91SAM9261_ID_US2,
1001 .flags = IORESOURCE_IRQ,
1002 },
1003};
1004
1005static struct atmel_uart_data uart2_data = {
1006 .use_dma_tx = 1,
1007 .use_dma_rx = 1,
1008};
1009
1010static u64 uart2_dmamask = DMA_BIT_MASK(32);
1011
1012static struct platform_device at91sam9261_uart2_device = {
1013 .name = "atmel_usart",
1014 .id = 3,
1015 .dev = {
1016 .dma_mask = &uart2_dmamask,
1017 .coherent_dma_mask = DMA_BIT_MASK(32),
1018 .platform_data = &uart2_data,
1019 },
1020 .resource = uart2_resources,
1021 .num_resources = ARRAY_SIZE(uart2_resources),
1022};
1023
1024static inline void configure_usart2_pins(unsigned pins)
1025{
1026 at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */
1027 at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */
1028
1029 if (pins & ATMEL_UART_RTS)
1030 at91_set_B_periph(AT91_PIN_PA15, 0); /* RTS2*/
1031 if (pins & ATMEL_UART_CTS)
1032 at91_set_B_periph(AT91_PIN_PA16, 0); /* CTS2 */
1033}
1034
1035static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1036
1037void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1038{
1039 struct platform_device *pdev;
1040 struct atmel_uart_data *pdata;
1041
1042 switch (id) {
1043 case 0: /* DBGU */
1044 pdev = &at91sam9261_dbgu_device;
1045 configure_dbgu_pins();
1046 break;
1047 case AT91SAM9261_ID_US0:
1048 pdev = &at91sam9261_uart0_device;
1049 configure_usart0_pins(pins);
1050 break;
1051 case AT91SAM9261_ID_US1:
1052 pdev = &at91sam9261_uart1_device;
1053 configure_usart1_pins(pins);
1054 break;
1055 case AT91SAM9261_ID_US2:
1056 pdev = &at91sam9261_uart2_device;
1057 configure_usart2_pins(pins);
1058 break;
1059 default:
1060 return;
1061 }
1062 pdata = pdev->dev.platform_data;
1063 pdata->num = portnr; /* update to mapped ID */
1064
1065 if (portnr < ATMEL_MAX_UART)
1066 at91_uarts[portnr] = pdev;
1067}
1068
1069void __init at91_add_device_serial(void)
1070{
1071 int i;
1072
1073 for (i = 0; i < ATMEL_MAX_UART; i++) {
1074 if (at91_uarts[i])
1075 platform_device_register(at91_uarts[i]);
1076 }
1077}
1078#else
1079void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1080void __init at91_add_device_serial(void) {}
1081#endif
1082
1083
1084/* -------------------------------------------------------------------- */
1085
1086/*
1087 * These devices are always present and don't need any board-specific
1088 * setup.
1089 */
1090static int __init at91_add_standard_devices(void)
1091{
1092 at91_add_device_rtt();
1093 at91_add_device_watchdog();
1094 at91_add_device_tc();
1095 return 0;
1096}
1097
1098arch_initcall(at91_add_standard_devices);
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index fbff228cc63e..e7ad14864083 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -10,304 +10,11 @@
10 * 10 *
11 */ 11 */
12 12
13#include <linux/module.h>
14#include <linux/platform_device.h>
15#include <linux/clk/at91_pmc.h>
16
17#include <asm/proc-fns.h>
18#include <asm/irq.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <asm/system_misc.h> 13#include <asm/system_misc.h>
22#include <mach/at91sam9263.h>
23#include <mach/hardware.h> 14#include <mach/hardware.h>
24 15
25#include "at91_aic.h"
26#include "soc.h" 16#include "soc.h"
27#include "generic.h" 17#include "generic.h"
28#include "sam9_smc.h"
29#include "pm.h"
30
31#if defined(CONFIG_OLD_CLK_AT91)
32#include "clock.h"
33/* --------------------------------------------------------------------
34 * Clocks
35 * -------------------------------------------------------------------- */
36
37/*
38 * The peripheral clocks.
39 */
40static struct clk pioA_clk = {
41 .name = "pioA_clk",
42 .pmc_mask = 1 << AT91SAM9263_ID_PIOA,
43 .type = CLK_TYPE_PERIPHERAL,
44};
45static struct clk pioB_clk = {
46 .name = "pioB_clk",
47 .pmc_mask = 1 << AT91SAM9263_ID_PIOB,
48 .type = CLK_TYPE_PERIPHERAL,
49};
50static struct clk pioCDE_clk = {
51 .name = "pioCDE_clk",
52 .pmc_mask = 1 << AT91SAM9263_ID_PIOCDE,
53 .type = CLK_TYPE_PERIPHERAL,
54};
55static struct clk usart0_clk = {
56 .name = "usart0_clk",
57 .pmc_mask = 1 << AT91SAM9263_ID_US0,
58 .type = CLK_TYPE_PERIPHERAL,
59};
60static struct clk usart1_clk = {
61 .name = "usart1_clk",
62 .pmc_mask = 1 << AT91SAM9263_ID_US1,
63 .type = CLK_TYPE_PERIPHERAL,
64};
65static struct clk usart2_clk = {
66 .name = "usart2_clk",
67 .pmc_mask = 1 << AT91SAM9263_ID_US2,
68 .type = CLK_TYPE_PERIPHERAL,
69};
70static struct clk mmc0_clk = {
71 .name = "mci0_clk",
72 .pmc_mask = 1 << AT91SAM9263_ID_MCI0,
73 .type = CLK_TYPE_PERIPHERAL,
74};
75static struct clk mmc1_clk = {
76 .name = "mci1_clk",
77 .pmc_mask = 1 << AT91SAM9263_ID_MCI1,
78 .type = CLK_TYPE_PERIPHERAL,
79};
80static struct clk can_clk = {
81 .name = "can_clk",
82 .pmc_mask = 1 << AT91SAM9263_ID_CAN,
83 .type = CLK_TYPE_PERIPHERAL,
84};
85static struct clk twi_clk = {
86 .name = "twi_clk",
87 .pmc_mask = 1 << AT91SAM9263_ID_TWI,
88 .type = CLK_TYPE_PERIPHERAL,
89};
90static struct clk spi0_clk = {
91 .name = "spi0_clk",
92 .pmc_mask = 1 << AT91SAM9263_ID_SPI0,
93 .type = CLK_TYPE_PERIPHERAL,
94};
95static struct clk spi1_clk = {
96 .name = "spi1_clk",
97 .pmc_mask = 1 << AT91SAM9263_ID_SPI1,
98 .type = CLK_TYPE_PERIPHERAL,
99};
100static struct clk ssc0_clk = {
101 .name = "ssc0_clk",
102 .pmc_mask = 1 << AT91SAM9263_ID_SSC0,
103 .type = CLK_TYPE_PERIPHERAL,
104};
105static struct clk ssc1_clk = {
106 .name = "ssc1_clk",
107 .pmc_mask = 1 << AT91SAM9263_ID_SSC1,
108 .type = CLK_TYPE_PERIPHERAL,
109};
110static struct clk ac97_clk = {
111 .name = "ac97_clk",
112 .pmc_mask = 1 << AT91SAM9263_ID_AC97C,
113 .type = CLK_TYPE_PERIPHERAL,
114};
115static struct clk tcb_clk = {
116 .name = "tcb_clk",
117 .pmc_mask = 1 << AT91SAM9263_ID_TCB,
118 .type = CLK_TYPE_PERIPHERAL,
119};
120static struct clk pwm_clk = {
121 .name = "pwm_clk",
122 .pmc_mask = 1 << AT91SAM9263_ID_PWMC,
123 .type = CLK_TYPE_PERIPHERAL,
124};
125static struct clk macb_clk = {
126 .name = "pclk",
127 .pmc_mask = 1 << AT91SAM9263_ID_EMAC,
128 .type = CLK_TYPE_PERIPHERAL,
129};
130static struct clk dma_clk = {
131 .name = "dma_clk",
132 .pmc_mask = 1 << AT91SAM9263_ID_DMA,
133 .type = CLK_TYPE_PERIPHERAL,
134};
135static struct clk twodge_clk = {
136 .name = "2dge_clk",
137 .pmc_mask = 1 << AT91SAM9263_ID_2DGE,
138 .type = CLK_TYPE_PERIPHERAL,
139};
140static struct clk udc_clk = {
141 .name = "udc_clk",
142 .pmc_mask = 1 << AT91SAM9263_ID_UDP,
143 .type = CLK_TYPE_PERIPHERAL,
144};
145static struct clk isi_clk = {
146 .name = "isi_clk",
147 .pmc_mask = 1 << AT91SAM9263_ID_ISI,
148 .type = CLK_TYPE_PERIPHERAL,
149};
150static struct clk lcdc_clk = {
151 .name = "lcdc_clk",
152 .pmc_mask = 1 << AT91SAM9263_ID_LCDC,
153 .type = CLK_TYPE_PERIPHERAL,
154};
155static struct clk ohci_clk = {
156 .name = "ohci_clk",
157 .pmc_mask = 1 << AT91SAM9263_ID_UHP,
158 .type = CLK_TYPE_PERIPHERAL,
159};
160
161static struct clk *periph_clocks[] __initdata = {
162 &pioA_clk,
163 &pioB_clk,
164 &pioCDE_clk,
165 &usart0_clk,
166 &usart1_clk,
167 &usart2_clk,
168 &mmc0_clk,
169 &mmc1_clk,
170 &can_clk,
171 &twi_clk,
172 &spi0_clk,
173 &spi1_clk,
174 &ssc0_clk,
175 &ssc1_clk,
176 &ac97_clk,
177 &tcb_clk,
178 &pwm_clk,
179 &macb_clk,
180 &twodge_clk,
181 &udc_clk,
182 &isi_clk,
183 &lcdc_clk,
184 &dma_clk,
185 &ohci_clk,
186 // irq0 .. irq1
187};
188
189static struct clk_lookup periph_clocks_lookups[] = {
190 /* One additional fake clock for macb_hclk */
191 CLKDEV_CON_ID("hclk", &macb_clk),
192 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
193 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
194 CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk),
195 CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk),
196 CLKDEV_CON_DEV_ID("hclk", "at91sam9263-lcdfb.0", &lcdc_clk),
197 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
198 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
199 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
200 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
201 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
202 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk),
203 CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
204 /* fake hclk clock */
205 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
206 CLKDEV_CON_ID("pioA", &pioA_clk),
207 CLKDEV_CON_ID("pioB", &pioB_clk),
208 CLKDEV_CON_ID("pioC", &pioCDE_clk),
209 CLKDEV_CON_ID("pioD", &pioCDE_clk),
210 CLKDEV_CON_ID("pioE", &pioCDE_clk),
211 /* more usart lookup table for DT entries */
212 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
213 CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk),
214 CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk),
215 CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk),
216 /* more tc lookup table for DT entries */
217 CLKDEV_CON_DEV_ID("t0_clk", "fff7c000.timer", &tcb_clk),
218 CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk),
219 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
220 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
221 CLKDEV_CON_DEV_ID("mci_clk", "fff80000.mmc", &mmc0_clk),
222 CLKDEV_CON_DEV_ID("mci_clk", "fff84000.mmc", &mmc1_clk),
223 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk),
224 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
225 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
226 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioCDE_clk),
227 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCDE_clk),
228 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCDE_clk),
229 CLKDEV_CON_DEV_ID(NULL, "fffb8000.pwm", &pwm_clk),
230};
231
232static struct clk_lookup usart_clocks_lookups[] = {
233 CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck),
234 CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk),
235 CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk),
236 CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk),
237};
238
239/*
240 * The four programmable clocks.
241 * You must configure pin multiplexing to bring these signals out.
242 */
243static struct clk pck0 = {
244 .name = "pck0",
245 .pmc_mask = AT91_PMC_PCK0,
246 .type = CLK_TYPE_PROGRAMMABLE,
247 .id = 0,
248};
249static struct clk pck1 = {
250 .name = "pck1",
251 .pmc_mask = AT91_PMC_PCK1,
252 .type = CLK_TYPE_PROGRAMMABLE,
253 .id = 1,
254};
255static struct clk pck2 = {
256 .name = "pck2",
257 .pmc_mask = AT91_PMC_PCK2,
258 .type = CLK_TYPE_PROGRAMMABLE,
259 .id = 2,
260};
261static struct clk pck3 = {
262 .name = "pck3",
263 .pmc_mask = AT91_PMC_PCK3,
264 .type = CLK_TYPE_PROGRAMMABLE,
265 .id = 3,
266};
267
268static void __init at91sam9263_register_clocks(void)
269{
270 int i;
271
272 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
273 clk_register(periph_clocks[i]);
274
275 clkdev_add_table(periph_clocks_lookups,
276 ARRAY_SIZE(periph_clocks_lookups));
277 clkdev_add_table(usart_clocks_lookups,
278 ARRAY_SIZE(usart_clocks_lookups));
279
280 clk_register(&pck0);
281 clk_register(&pck1);
282 clk_register(&pck2);
283 clk_register(&pck3);
284}
285#else
286#define at91sam9263_register_clocks NULL
287#endif
288
289/* --------------------------------------------------------------------
290 * GPIO
291 * -------------------------------------------------------------------- */
292
293static struct at91_gpio_bank at91sam9263_gpio[] __initdata = {
294 {
295 .id = AT91SAM9263_ID_PIOA,
296 .regbase = AT91SAM9263_BASE_PIOA,
297 }, {
298 .id = AT91SAM9263_ID_PIOB,
299 .regbase = AT91SAM9263_BASE_PIOB,
300 }, {
301 .id = AT91SAM9263_ID_PIOCDE,
302 .regbase = AT91SAM9263_BASE_PIOC,
303 }, {
304 .id = AT91SAM9263_ID_PIOCDE,
305 .regbase = AT91SAM9263_BASE_PIOD,
306 }, {
307 .id = AT91SAM9263_ID_PIOCDE,
308 .regbase = AT91SAM9263_BASE_PIOE,
309 }
310};
311 18
312/* -------------------------------------------------------------------- 19/* --------------------------------------------------------------------
313 * AT91SAM9263 processor initialization 20 * AT91SAM9263 processor initialization
@@ -319,121 +26,15 @@ static void __init at91sam9263_map_io(void)
319 at91_init_sram(1, AT91SAM9263_SRAM1_BASE, AT91SAM9263_SRAM1_SIZE); 26 at91_init_sram(1, AT91SAM9263_SRAM1_BASE, AT91SAM9263_SRAM1_SIZE);
320} 27}
321 28
322static void __init at91sam9263_ioremap_registers(void)
323{
324 at91_ioremap_ramc(0, AT91SAM9263_BASE_SDRAMC0, 512);
325 at91_ioremap_ramc(1, AT91SAM9263_BASE_SDRAMC1, 512);
326 at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT);
327 at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0);
328 at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1);
329 at91_ioremap_matrix(AT91SAM9263_BASE_MATRIX);
330 at91_pm_set_standby(at91sam9_sdram_standby);
331}
332
333static void __init at91sam9263_initialize(void) 29static void __init at91sam9263_initialize(void)
334{ 30{
335 arm_pm_idle = at91sam9_idle; 31 arm_pm_idle = at91sam9_idle;
336 32
337 at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0); 33 at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0);
338 at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1); 34 at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1);
339
340 /* Register GPIO subsystem */
341 at91_gpio_init(at91sam9263_gpio, 5);
342}
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
383/* --------------------------------------------------------------------
384 * Interrupt initialization
385 * -------------------------------------------------------------------- */
386
387/*
388 * The default interrupt priority levels (0 = lowest, 7 = highest).
389 */
390static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
391 7, /* Advanced Interrupt Controller (FIQ) */
392 7, /* System Peripherals */
393 1, /* Parallel IO Controller A */
394 1, /* Parallel IO Controller B */
395 1, /* Parallel IO Controller C, D and E */
396 0,
397 0,
398 5, /* USART 0 */
399 5, /* USART 1 */
400 5, /* USART 2 */
401 0, /* Multimedia Card Interface 0 */
402 0, /* Multimedia Card Interface 1 */
403 3, /* CAN */
404 6, /* Two-Wire Interface */
405 5, /* Serial Peripheral Interface 0 */
406 5, /* Serial Peripheral Interface 1 */
407 4, /* Serial Synchronous Controller 0 */
408 4, /* Serial Synchronous Controller 1 */
409 5, /* AC97 Controller */
410 0, /* Timer Counter 0, 1 and 2 */
411 0, /* Pulse Width Modulation Controller */
412 3, /* Ethernet */
413 0,
414 0, /* 2D Graphic Engine */
415 2, /* USB Device Port */
416 0, /* Image Sensor Interface */
417 3, /* LDC Controller */
418 0, /* DMA Controller */
419 0,
420 2, /* USB Host port */
421 0, /* Advanced Interrupt Controller (IRQ0) */
422 0, /* Advanced Interrupt Controller (IRQ1) */
423};
424
425static void __init at91sam9263_init_time(void)
426{
427 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
428} 35}
429 36
430AT91_SOC_START(at91sam9263) 37AT91_SOC_START(at91sam9263)
431 .map_io = at91sam9263_map_io, 38 .map_io = at91sam9263_map_io,
432 .default_irq_priority = at91sam9263_default_irq_priority,
433 .extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1),
434 .ioremap_registers = at91sam9263_ioremap_registers,
435 .register_clocks = at91sam9263_register_clocks,
436 .register_devices = at91sam9263_register_devices,
437 .init = at91sam9263_initialize, 39 .init = at91sam9263_initialize,
438 .init_time = at91sam9263_init_time,
439AT91_SOC_END 40AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
deleted file mode 100644
index cef0e2f57068..000000000000
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ /dev/null
@@ -1,1538 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91sam9263_devices.c
3 *
4 * Copyright (C) 2007 Atmel 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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12#include <asm/mach/arch.h>
13#include <asm/mach/map.h>
14
15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
17#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h>
19
20#include <linux/fb.h>
21#include <video/atmel_lcdc.h>
22
23#include <mach/at91sam9263.h>
24#include <mach/at91sam9263_matrix.h>
25#include <mach/at91_matrix.h>
26#include <mach/at91sam9_smc.h>
27#include <mach/hardware.h>
28
29#include "board.h"
30#include "generic.h"
31#include "gpio.h"
32
33
34/* --------------------------------------------------------------------
35 * USB Host
36 * -------------------------------------------------------------------- */
37
38#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
39static u64 ohci_dmamask = DMA_BIT_MASK(32);
40static struct at91_usbh_data usbh_data;
41
42static struct resource usbh_resources[] = {
43 [0] = {
44 .start = AT91SAM9263_UHP_BASE,
45 .end = AT91SAM9263_UHP_BASE + SZ_1M - 1,
46 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
49 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_UHP,
50 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_UHP,
51 .flags = IORESOURCE_IRQ,
52 },
53};
54
55static struct platform_device at91_usbh_device = {
56 .name = "at91_ohci",
57 .id = -1,
58 .dev = {
59 .dma_mask = &ohci_dmamask,
60 .coherent_dma_mask = DMA_BIT_MASK(32),
61 .platform_data = &usbh_data,
62 },
63 .resource = usbh_resources,
64 .num_resources = ARRAY_SIZE(usbh_resources),
65};
66
67void __init at91_add_device_usbh(struct at91_usbh_data *data)
68{
69 int i;
70
71 if (!data)
72 return;
73
74 /* Enable VBus control for UHP ports */
75 for (i = 0; i < data->ports; i++) {
76 if (gpio_is_valid(data->vbus_pin[i]))
77 at91_set_gpio_output(data->vbus_pin[i],
78 data->vbus_pin_active_low[i]);
79 }
80
81 /* Enable overcurrent notification */
82 for (i = 0; i < data->ports; i++) {
83 if (gpio_is_valid(data->overcurrent_pin[i]))
84 at91_set_gpio_input(data->overcurrent_pin[i], 1);
85 }
86
87 usbh_data = *data;
88 platform_device_register(&at91_usbh_device);
89}
90#else
91void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
92#endif
93
94
95/* --------------------------------------------------------------------
96 * USB Device (Gadget)
97 * -------------------------------------------------------------------- */
98
99#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
100static struct at91_udc_data udc_data;
101
102static struct resource udc_resources[] = {
103 [0] = {
104 .start = AT91SAM9263_BASE_UDP,
105 .end = AT91SAM9263_BASE_UDP + SZ_16K - 1,
106 .flags = IORESOURCE_MEM,
107 },
108 [1] = {
109 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_UDP,
110 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_UDP,
111 .flags = IORESOURCE_IRQ,
112 },
113};
114
115static struct platform_device at91_udc_device = {
116 .name = "at91_udc",
117 .id = -1,
118 .dev = {
119 .platform_data = &udc_data,
120 },
121 .resource = udc_resources,
122 .num_resources = ARRAY_SIZE(udc_resources),
123};
124
125void __init at91_add_device_udc(struct at91_udc_data *data)
126{
127 if (!data)
128 return;
129
130 if (gpio_is_valid(data->vbus_pin)) {
131 at91_set_gpio_input(data->vbus_pin, 0);
132 at91_set_deglitch(data->vbus_pin, 1);
133 }
134
135 /* Pullup pin is handled internally by USB device peripheral */
136
137 udc_data = *data;
138 platform_device_register(&at91_udc_device);
139}
140#else
141void __init at91_add_device_udc(struct at91_udc_data *data) {}
142#endif
143
144
145/* --------------------------------------------------------------------
146 * Ethernet
147 * -------------------------------------------------------------------- */
148
149#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
150static u64 eth_dmamask = DMA_BIT_MASK(32);
151static struct macb_platform_data eth_data;
152
153static struct resource eth_resources[] = {
154 [0] = {
155 .start = AT91SAM9263_BASE_EMAC,
156 .end = AT91SAM9263_BASE_EMAC + SZ_16K - 1,
157 .flags = IORESOURCE_MEM,
158 },
159 [1] = {
160 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_EMAC,
161 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_EMAC,
162 .flags = IORESOURCE_IRQ,
163 },
164};
165
166static struct platform_device at91sam9263_eth_device = {
167 .name = "macb",
168 .id = -1,
169 .dev = {
170 .dma_mask = &eth_dmamask,
171 .coherent_dma_mask = DMA_BIT_MASK(32),
172 .platform_data = &eth_data,
173 },
174 .resource = eth_resources,
175 .num_resources = ARRAY_SIZE(eth_resources),
176};
177
178void __init at91_add_device_eth(struct macb_platform_data *data)
179{
180 if (!data)
181 return;
182
183 if (gpio_is_valid(data->phy_irq_pin)) {
184 at91_set_gpio_input(data->phy_irq_pin, 0);
185 at91_set_deglitch(data->phy_irq_pin, 1);
186 }
187
188 /* Pins used for MII and RMII */
189 at91_set_A_periph(AT91_PIN_PE21, 0); /* ETXCK_EREFCK */
190 at91_set_B_periph(AT91_PIN_PC25, 0); /* ERXDV */
191 at91_set_A_periph(AT91_PIN_PE25, 0); /* ERX0 */
192 at91_set_A_periph(AT91_PIN_PE26, 0); /* ERX1 */
193 at91_set_A_periph(AT91_PIN_PE27, 0); /* ERXER */
194 at91_set_A_periph(AT91_PIN_PE28, 0); /* ETXEN */
195 at91_set_A_periph(AT91_PIN_PE23, 0); /* ETX0 */
196 at91_set_A_periph(AT91_PIN_PE24, 0); /* ETX1 */
197 at91_set_A_periph(AT91_PIN_PE30, 0); /* EMDIO */
198 at91_set_A_periph(AT91_PIN_PE29, 0); /* EMDC */
199
200 if (!data->is_rmii) {
201 at91_set_A_periph(AT91_PIN_PE22, 0); /* ECRS */
202 at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */
203 at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */
204 at91_set_B_periph(AT91_PIN_PC23, 0); /* ERX3 */
205 at91_set_B_periph(AT91_PIN_PC27, 0); /* ERXCK */
206 at91_set_B_periph(AT91_PIN_PC20, 0); /* ETX2 */
207 at91_set_B_periph(AT91_PIN_PC21, 0); /* ETX3 */
208 at91_set_B_periph(AT91_PIN_PC24, 0); /* ETXER */
209 }
210
211 eth_data = *data;
212 platform_device_register(&at91sam9263_eth_device);
213}
214#else
215void __init at91_add_device_eth(struct macb_platform_data *data) {}
216#endif
217
218
219/* --------------------------------------------------------------------
220 * MMC / SD
221 * -------------------------------------------------------------------- */
222
223#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
224static u64 mmc_dmamask = DMA_BIT_MASK(32);
225static struct mci_platform_data mmc0_data, mmc1_data;
226
227static struct resource mmc0_resources[] = {
228 [0] = {
229 .start = AT91SAM9263_BASE_MCI0,
230 .end = AT91SAM9263_BASE_MCI0 + SZ_16K - 1,
231 .flags = IORESOURCE_MEM,
232 },
233 [1] = {
234 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_MCI0,
235 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_MCI0,
236 .flags = IORESOURCE_IRQ,
237 },
238};
239
240static struct platform_device at91sam9263_mmc0_device = {
241 .name = "atmel_mci",
242 .id = 0,
243 .dev = {
244 .dma_mask = &mmc_dmamask,
245 .coherent_dma_mask = DMA_BIT_MASK(32),
246 .platform_data = &mmc0_data,
247 },
248 .resource = mmc0_resources,
249 .num_resources = ARRAY_SIZE(mmc0_resources),
250};
251
252static struct resource mmc1_resources[] = {
253 [0] = {
254 .start = AT91SAM9263_BASE_MCI1,
255 .end = AT91SAM9263_BASE_MCI1 + SZ_16K - 1,
256 .flags = IORESOURCE_MEM,
257 },
258 [1] = {
259 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_MCI1,
260 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_MCI1,
261 .flags = IORESOURCE_IRQ,
262 },
263};
264
265static struct platform_device at91sam9263_mmc1_device = {
266 .name = "atmel_mci",
267 .id = 1,
268 .dev = {
269 .dma_mask = &mmc_dmamask,
270 .coherent_dma_mask = DMA_BIT_MASK(32),
271 .platform_data = &mmc1_data,
272 },
273 .resource = mmc1_resources,
274 .num_resources = ARRAY_SIZE(mmc1_resources),
275};
276
277void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
278{
279 unsigned int i;
280 unsigned int slot_count = 0;
281
282 if (!data)
283 return;
284
285 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
286
287 if (!data->slot[i].bus_width)
288 continue;
289
290 /* input/irq */
291 if (gpio_is_valid(data->slot[i].detect_pin)) {
292 at91_set_gpio_input(data->slot[i].detect_pin,
293 1);
294 at91_set_deglitch(data->slot[i].detect_pin,
295 1);
296 }
297 if (gpio_is_valid(data->slot[i].wp_pin))
298 at91_set_gpio_input(data->slot[i].wp_pin, 1);
299
300 if (mmc_id == 0) { /* MCI0 */
301 switch (i) {
302 case 0: /* slot A */
303 /* CMD */
304 at91_set_A_periph(AT91_PIN_PA1, 1);
305 /* DAT0, maybe DAT1..DAT3 */
306 at91_set_A_periph(AT91_PIN_PA0, 1);
307 if (data->slot[i].bus_width == 4) {
308 at91_set_A_periph(AT91_PIN_PA3, 1);
309 at91_set_A_periph(AT91_PIN_PA4, 1);
310 at91_set_A_periph(AT91_PIN_PA5, 1);
311 }
312 slot_count++;
313 break;
314 case 1: /* slot B */
315 /* CMD */
316 at91_set_A_periph(AT91_PIN_PA16, 1);
317 /* DAT0, maybe DAT1..DAT3 */
318 at91_set_A_periph(AT91_PIN_PA17, 1);
319 if (data->slot[i].bus_width == 4) {
320 at91_set_A_periph(AT91_PIN_PA18, 1);
321 at91_set_A_periph(AT91_PIN_PA19, 1);
322 at91_set_A_periph(AT91_PIN_PA20, 1);
323 }
324 slot_count++;
325 break;
326 default:
327 printk(KERN_ERR
328 "AT91: SD/MMC slot %d not available\n", i);
329 break;
330 }
331 if (slot_count) {
332 /* CLK */
333 at91_set_A_periph(AT91_PIN_PA12, 0);
334
335 mmc0_data = *data;
336 platform_device_register(&at91sam9263_mmc0_device);
337 }
338 } else if (mmc_id == 1) { /* MCI1 */
339 switch (i) {
340 case 0: /* slot A */
341 /* CMD */
342 at91_set_A_periph(AT91_PIN_PA7, 1);
343 /* DAT0, maybe DAT1..DAT3 */
344 at91_set_A_periph(AT91_PIN_PA8, 1);
345 if (data->slot[i].bus_width == 4) {
346 at91_set_A_periph(AT91_PIN_PA9, 1);
347 at91_set_A_periph(AT91_PIN_PA10, 1);
348 at91_set_A_periph(AT91_PIN_PA11, 1);
349 }
350 slot_count++;
351 break;
352 case 1: /* slot B */
353 /* CMD */
354 at91_set_A_periph(AT91_PIN_PA21, 1);
355 /* DAT0, maybe DAT1..DAT3 */
356 at91_set_A_periph(AT91_PIN_PA22, 1);
357 if (data->slot[i].bus_width == 4) {
358 at91_set_A_periph(AT91_PIN_PA23, 1);
359 at91_set_A_periph(AT91_PIN_PA24, 1);
360 at91_set_A_periph(AT91_PIN_PA25, 1);
361 }
362 slot_count++;
363 break;
364 default:
365 printk(KERN_ERR
366 "AT91: SD/MMC slot %d not available\n", i);
367 break;
368 }
369 if (slot_count) {
370 /* CLK */
371 at91_set_A_periph(AT91_PIN_PA6, 0);
372
373 mmc1_data = *data;
374 platform_device_register(&at91sam9263_mmc1_device);
375 }
376 }
377 }
378}
379#else
380void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
381#endif
382
383/* --------------------------------------------------------------------
384 * Compact Flash (PCMCIA or IDE)
385 * -------------------------------------------------------------------- */
386
387#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \
388 defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
389
390static struct at91_cf_data cf0_data;
391
392static struct resource cf0_resources[] = {
393 [0] = {
394 .start = AT91_CHIPSELECT_4,
395 .end = AT91_CHIPSELECT_4 + SZ_256M - 1,
396 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
397 }
398};
399
400static struct platform_device cf0_device = {
401 .id = 0,
402 .dev = {
403 .platform_data = &cf0_data,
404 },
405 .resource = cf0_resources,
406 .num_resources = ARRAY_SIZE(cf0_resources),
407};
408
409static struct at91_cf_data cf1_data;
410
411static struct resource cf1_resources[] = {
412 [0] = {
413 .start = AT91_CHIPSELECT_5,
414 .end = AT91_CHIPSELECT_5 + SZ_256M - 1,
415 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
416 }
417};
418
419static struct platform_device cf1_device = {
420 .id = 1,
421 .dev = {
422 .platform_data = &cf1_data,
423 },
424 .resource = cf1_resources,
425 .num_resources = ARRAY_SIZE(cf1_resources),
426};
427
428void __init at91_add_device_cf(struct at91_cf_data *data)
429{
430 unsigned long ebi0_csa;
431 struct platform_device *pdev;
432
433 if (!data)
434 return;
435
436 /*
437 * assign CS4 or CS5 to SMC with Compact Flash logic support,
438 * we assume SMC timings are configured by board code,
439 * except True IDE where timings are controlled by driver
440 */
441 ebi0_csa = at91_matrix_read(AT91_MATRIX_EBI0CSA);
442 switch (data->chipselect) {
443 case 4:
444 at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */
445 ebi0_csa |= AT91_MATRIX_EBI0_CS4A_SMC_CF1;
446 cf0_data = *data;
447 pdev = &cf0_device;
448 break;
449 case 5:
450 at91_set_A_periph(AT91_PIN_PD7, 0); /* EBI0_NCS5/CFCS1 */
451 ebi0_csa |= AT91_MATRIX_EBI0_CS5A_SMC_CF2;
452 cf1_data = *data;
453 pdev = &cf1_device;
454 break;
455 default:
456 printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
457 data->chipselect);
458 return;
459 }
460 at91_matrix_write(AT91_MATRIX_EBI0CSA, ebi0_csa);
461
462 if (gpio_is_valid(data->det_pin)) {
463 at91_set_gpio_input(data->det_pin, 1);
464 at91_set_deglitch(data->det_pin, 1);
465 }
466
467 if (gpio_is_valid(data->irq_pin)) {
468 at91_set_gpio_input(data->irq_pin, 1);
469 at91_set_deglitch(data->irq_pin, 1);
470 }
471
472 if (gpio_is_valid(data->vcc_pin))
473 /* initially off */
474 at91_set_gpio_output(data->vcc_pin, 0);
475
476 /* enable EBI controlled pins */
477 at91_set_A_periph(AT91_PIN_PD5, 1); /* NWAIT */
478 at91_set_A_periph(AT91_PIN_PD8, 0); /* CFCE1 */
479 at91_set_A_periph(AT91_PIN_PD9, 0); /* CFCE2 */
480 at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */
481
482 pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "pata_at91" : "at91_cf";
483 platform_device_register(pdev);
484}
485#else
486void __init at91_add_device_cf(struct at91_cf_data *data) {}
487#endif
488
489/* --------------------------------------------------------------------
490 * NAND / SmartMedia
491 * -------------------------------------------------------------------- */
492
493#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
494static struct atmel_nand_data nand_data;
495
496#define NAND_BASE AT91_CHIPSELECT_3
497
498static struct resource nand_resources[] = {
499 [0] = {
500 .start = NAND_BASE,
501 .end = NAND_BASE + SZ_256M - 1,
502 .flags = IORESOURCE_MEM,
503 },
504 [1] = {
505 .start = AT91SAM9263_BASE_ECC0,
506 .end = AT91SAM9263_BASE_ECC0 + SZ_512 - 1,
507 .flags = IORESOURCE_MEM,
508 }
509};
510
511static struct platform_device at91sam9263_nand_device = {
512 .name = "atmel_nand",
513 .id = -1,
514 .dev = {
515 .platform_data = &nand_data,
516 },
517 .resource = nand_resources,
518 .num_resources = ARRAY_SIZE(nand_resources),
519};
520
521void __init at91_add_device_nand(struct atmel_nand_data *data)
522{
523 unsigned long csa;
524
525 if (!data)
526 return;
527
528 csa = at91_matrix_read(AT91_MATRIX_EBI0CSA);
529 at91_matrix_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
530
531 /* enable pin */
532 if (gpio_is_valid(data->enable_pin))
533 at91_set_gpio_output(data->enable_pin, 1);
534
535 /* ready/busy pin */
536 if (gpio_is_valid(data->rdy_pin))
537 at91_set_gpio_input(data->rdy_pin, 1);
538
539 /* card detect pin */
540 if (gpio_is_valid(data->det_pin))
541 at91_set_gpio_input(data->det_pin, 1);
542
543 nand_data = *data;
544 platform_device_register(&at91sam9263_nand_device);
545}
546#else
547void __init at91_add_device_nand(struct atmel_nand_data *data) {}
548#endif
549
550
551/* --------------------------------------------------------------------
552 * TWI (i2c)
553 * -------------------------------------------------------------------- */
554
555/*
556 * Prefer the GPIO code since the TWI controller isn't robust
557 * (gets overruns and underruns under load) and can only issue
558 * repeated STARTs in one scenario (the driver doesn't yet handle them).
559 */
560#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
561
562static struct i2c_gpio_platform_data pdata = {
563 .sda_pin = AT91_PIN_PB4,
564 .sda_is_open_drain = 1,
565 .scl_pin = AT91_PIN_PB5,
566 .scl_is_open_drain = 1,
567 .udelay = 2, /* ~100 kHz */
568};
569
570static struct platform_device at91sam9263_twi_device = {
571 .name = "i2c-gpio",
572 .id = 0,
573 .dev.platform_data = &pdata,
574};
575
576void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
577{
578 at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */
579 at91_set_multi_drive(AT91_PIN_PB4, 1);
580
581 at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */
582 at91_set_multi_drive(AT91_PIN_PB5, 1);
583
584 i2c_register_board_info(0, devices, nr_devices);
585 platform_device_register(&at91sam9263_twi_device);
586}
587
588#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
589
590static struct resource twi_resources[] = {
591 [0] = {
592 .start = AT91SAM9263_BASE_TWI,
593 .end = AT91SAM9263_BASE_TWI + SZ_16K - 1,
594 .flags = IORESOURCE_MEM,
595 },
596 [1] = {
597 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_TWI,
598 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_TWI,
599 .flags = IORESOURCE_IRQ,
600 },
601};
602
603static struct platform_device at91sam9263_twi_device = {
604 .name = "i2c-at91sam9260",
605 .id = 0,
606 .resource = twi_resources,
607 .num_resources = ARRAY_SIZE(twi_resources),
608};
609
610void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
611{
612 /* pins used for TWI interface */
613 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */
614 at91_set_multi_drive(AT91_PIN_PB4, 1);
615
616 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */
617 at91_set_multi_drive(AT91_PIN_PB5, 1);
618
619 i2c_register_board_info(0, devices, nr_devices);
620 platform_device_register(&at91sam9263_twi_device);
621}
622#else
623void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
624#endif
625
626
627/* --------------------------------------------------------------------
628 * SPI
629 * -------------------------------------------------------------------- */
630
631#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
632static u64 spi_dmamask = DMA_BIT_MASK(32);
633
634static struct resource spi0_resources[] = {
635 [0] = {
636 .start = AT91SAM9263_BASE_SPI0,
637 .end = AT91SAM9263_BASE_SPI0 + SZ_16K - 1,
638 .flags = IORESOURCE_MEM,
639 },
640 [1] = {
641 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_SPI0,
642 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_SPI0,
643 .flags = IORESOURCE_IRQ,
644 },
645};
646
647static struct platform_device at91sam9263_spi0_device = {
648 .name = "atmel_spi",
649 .id = 0,
650 .dev = {
651 .dma_mask = &spi_dmamask,
652 .coherent_dma_mask = DMA_BIT_MASK(32),
653 },
654 .resource = spi0_resources,
655 .num_resources = ARRAY_SIZE(spi0_resources),
656};
657
658static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA5, AT91_PIN_PA3, AT91_PIN_PA4, AT91_PIN_PB11 };
659
660static struct resource spi1_resources[] = {
661 [0] = {
662 .start = AT91SAM9263_BASE_SPI1,
663 .end = AT91SAM9263_BASE_SPI1 + SZ_16K - 1,
664 .flags = IORESOURCE_MEM,
665 },
666 [1] = {
667 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_SPI1,
668 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_SPI1,
669 .flags = IORESOURCE_IRQ,
670 },
671};
672
673static struct platform_device at91sam9263_spi1_device = {
674 .name = "atmel_spi",
675 .id = 1,
676 .dev = {
677 .dma_mask = &spi_dmamask,
678 .coherent_dma_mask = DMA_BIT_MASK(32),
679 },
680 .resource = spi1_resources,
681 .num_resources = ARRAY_SIZE(spi1_resources),
682};
683
684static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB15, AT91_PIN_PB16, AT91_PIN_PB17, AT91_PIN_PB18 };
685
686void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
687{
688 int i;
689 unsigned long cs_pin;
690 short enable_spi0 = 0;
691 short enable_spi1 = 0;
692
693 /* Choose SPI chip-selects */
694 for (i = 0; i < nr_devices; i++) {
695 if (devices[i].controller_data)
696 cs_pin = (unsigned long) devices[i].controller_data;
697 else if (devices[i].bus_num == 0)
698 cs_pin = spi0_standard_cs[devices[i].chip_select];
699 else
700 cs_pin = spi1_standard_cs[devices[i].chip_select];
701
702 if (!gpio_is_valid(cs_pin))
703 continue;
704
705 if (devices[i].bus_num == 0)
706 enable_spi0 = 1;
707 else
708 enable_spi1 = 1;
709
710 /* enable chip-select pin */
711 at91_set_gpio_output(cs_pin, 1);
712
713 /* pass chip-select pin to driver */
714 devices[i].controller_data = (void *) cs_pin;
715 }
716
717 spi_register_board_info(devices, nr_devices);
718
719 /* Configure SPI bus(es) */
720 if (enable_spi0) {
721 at91_set_B_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
722 at91_set_B_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
723 at91_set_B_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
724
725 platform_device_register(&at91sam9263_spi0_device);
726 }
727 if (enable_spi1) {
728 at91_set_A_periph(AT91_PIN_PB12, 0); /* SPI1_MISO */
729 at91_set_A_periph(AT91_PIN_PB13, 0); /* SPI1_MOSI */
730 at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_SPCK */
731
732 platform_device_register(&at91sam9263_spi1_device);
733 }
734}
735#else
736void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
737#endif
738
739
740/* --------------------------------------------------------------------
741 * AC97
742 * -------------------------------------------------------------------- */
743
744#if defined(CONFIG_SND_ATMEL_AC97C) || defined(CONFIG_SND_ATMEL_AC97C_MODULE)
745static u64 ac97_dmamask = DMA_BIT_MASK(32);
746static struct ac97c_platform_data ac97_data;
747
748static struct resource ac97_resources[] = {
749 [0] = {
750 .start = AT91SAM9263_BASE_AC97C,
751 .end = AT91SAM9263_BASE_AC97C + SZ_16K - 1,
752 .flags = IORESOURCE_MEM,
753 },
754 [1] = {
755 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_AC97C,
756 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_AC97C,
757 .flags = IORESOURCE_IRQ,
758 },
759};
760
761static struct platform_device at91sam9263_ac97_device = {
762 .name = "atmel_ac97c",
763 .id = 0,
764 .dev = {
765 .dma_mask = &ac97_dmamask,
766 .coherent_dma_mask = DMA_BIT_MASK(32),
767 .platform_data = &ac97_data,
768 },
769 .resource = ac97_resources,
770 .num_resources = ARRAY_SIZE(ac97_resources),
771};
772
773void __init at91_add_device_ac97(struct ac97c_platform_data *data)
774{
775 if (!data)
776 return;
777
778 at91_set_A_periph(AT91_PIN_PB0, 0); /* AC97FS */
779 at91_set_A_periph(AT91_PIN_PB1, 0); /* AC97CK */
780 at91_set_A_periph(AT91_PIN_PB2, 0); /* AC97TX */
781 at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */
782
783 /* reset */
784 if (gpio_is_valid(data->reset_pin))
785 at91_set_gpio_output(data->reset_pin, 0);
786
787 ac97_data = *data;
788 platform_device_register(&at91sam9263_ac97_device);
789}
790#else
791void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
792#endif
793
794/* --------------------------------------------------------------------
795 * CAN Controller
796 * -------------------------------------------------------------------- */
797
798#if defined(CONFIG_CAN_AT91) || defined(CONFIG_CAN_AT91_MODULE)
799static struct resource can_resources[] = {
800 [0] = {
801 .start = AT91SAM9263_BASE_CAN,
802 .end = AT91SAM9263_BASE_CAN + SZ_16K - 1,
803 .flags = IORESOURCE_MEM,
804 },
805 [1] = {
806 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_CAN,
807 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_CAN,
808 .flags = IORESOURCE_IRQ,
809 },
810};
811
812static struct platform_device at91sam9263_can_device = {
813 .name = "at91_can",
814 .id = -1,
815 .resource = can_resources,
816 .num_resources = ARRAY_SIZE(can_resources),
817};
818
819void __init at91_add_device_can(struct at91_can_data *data)
820{
821 at91_set_A_periph(AT91_PIN_PA13, 0); /* CANTX */
822 at91_set_A_periph(AT91_PIN_PA14, 0); /* CANRX */
823 at91sam9263_can_device.dev.platform_data = data;
824
825 platform_device_register(&at91sam9263_can_device);
826}
827#else
828void __init at91_add_device_can(struct at91_can_data *data) {}
829#endif
830
831/* --------------------------------------------------------------------
832 * LCD Controller
833 * -------------------------------------------------------------------- */
834
835#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
836static u64 lcdc_dmamask = DMA_BIT_MASK(32);
837static struct atmel_lcdfb_pdata lcdc_data;
838
839static struct resource lcdc_resources[] = {
840 [0] = {
841 .start = AT91SAM9263_LCDC_BASE,
842 .end = AT91SAM9263_LCDC_BASE + SZ_4K - 1,
843 .flags = IORESOURCE_MEM,
844 },
845 [1] = {
846 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_LCDC,
847 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_LCDC,
848 .flags = IORESOURCE_IRQ,
849 },
850};
851
852static struct platform_device at91_lcdc_device = {
853 .name = "at91sam9263-lcdfb",
854 .id = 0,
855 .dev = {
856 .dma_mask = &lcdc_dmamask,
857 .coherent_dma_mask = DMA_BIT_MASK(32),
858 .platform_data = &lcdc_data,
859 },
860 .resource = lcdc_resources,
861 .num_resources = ARRAY_SIZE(lcdc_resources),
862};
863
864void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
865{
866 if (!data)
867 return;
868
869 at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
870 at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
871 at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
872 at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */
873 at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDD2 */
874 at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDD3 */
875 at91_set_A_periph(AT91_PIN_PC8, 0); /* LCDD4 */
876 at91_set_A_periph(AT91_PIN_PC9, 0); /* LCDD5 */
877 at91_set_A_periph(AT91_PIN_PC10, 0); /* LCDD6 */
878 at91_set_A_periph(AT91_PIN_PC11, 0); /* LCDD7 */
879 at91_set_A_periph(AT91_PIN_PC14, 0); /* LCDD10 */
880 at91_set_A_periph(AT91_PIN_PC15, 0); /* LCDD11 */
881 at91_set_A_periph(AT91_PIN_PC16, 0); /* LCDD12 */
882 at91_set_B_periph(AT91_PIN_PC12, 0); /* LCDD13 */
883 at91_set_A_periph(AT91_PIN_PC18, 0); /* LCDD14 */
884 at91_set_A_periph(AT91_PIN_PC19, 0); /* LCDD15 */
885 at91_set_A_periph(AT91_PIN_PC22, 0); /* LCDD18 */
886 at91_set_A_periph(AT91_PIN_PC23, 0); /* LCDD19 */
887 at91_set_A_periph(AT91_PIN_PC24, 0); /* LCDD20 */
888 at91_set_B_periph(AT91_PIN_PC17, 0); /* LCDD21 */
889 at91_set_A_periph(AT91_PIN_PC26, 0); /* LCDD22 */
890 at91_set_A_periph(AT91_PIN_PC27, 0); /* LCDD23 */
891
892 lcdc_data = *data;
893 platform_device_register(&at91_lcdc_device);
894}
895#else
896void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
897#endif
898
899
900/* --------------------------------------------------------------------
901 * Image Sensor Interface
902 * -------------------------------------------------------------------- */
903
904#if defined(CONFIG_VIDEO_AT91_ISI) || defined(CONFIG_VIDEO_AT91_ISI_MODULE)
905
906struct resource isi_resources[] = {
907 [0] = {
908 .start = AT91SAM9263_BASE_ISI,
909 .end = AT91SAM9263_BASE_ISI + SZ_16K - 1,
910 .flags = IORESOURCE_MEM,
911 },
912 [1] = {
913 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_ISI,
914 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_ISI,
915 .flags = IORESOURCE_IRQ,
916 },
917};
918
919static struct platform_device at91sam9263_isi_device = {
920 .name = "at91_isi",
921 .id = -1,
922 .resource = isi_resources,
923 .num_resources = ARRAY_SIZE(isi_resources),
924};
925
926void __init at91_add_device_isi(struct isi_platform_data *data,
927 bool use_pck_as_mck)
928{
929 at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */
930 at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */
931 at91_set_A_periph(AT91_PIN_PE2, 0); /* ISI_D2 */
932 at91_set_A_periph(AT91_PIN_PE3, 0); /* ISI_D3 */
933 at91_set_A_periph(AT91_PIN_PE4, 0); /* ISI_D4 */
934 at91_set_A_periph(AT91_PIN_PE5, 0); /* ISI_D5 */
935 at91_set_A_periph(AT91_PIN_PE6, 0); /* ISI_D6 */
936 at91_set_A_periph(AT91_PIN_PE7, 0); /* ISI_D7 */
937 at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */
938 at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */
939 at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */
940 at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */
941 at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */
942 at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */
943 at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */
944
945 if (use_pck_as_mck) {
946 at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */
947
948 /* TODO: register the PCK for ISI_MCK and set its parent */
949 }
950}
951#else
952void __init at91_add_device_isi(struct isi_platform_data *data,
953 bool use_pck_as_mck) {}
954#endif
955
956
957/* --------------------------------------------------------------------
958 * Timer/Counter block
959 * -------------------------------------------------------------------- */
960
961#ifdef CONFIG_ATMEL_TCLIB
962
963static struct resource tcb_resources[] = {
964 [0] = {
965 .start = AT91SAM9263_BASE_TCB0,
966 .end = AT91SAM9263_BASE_TCB0 + SZ_16K - 1,
967 .flags = IORESOURCE_MEM,
968 },
969 [1] = {
970 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_TCB,
971 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_TCB,
972 .flags = IORESOURCE_IRQ,
973 },
974};
975
976static struct platform_device at91sam9263_tcb_device = {
977 .name = "atmel_tcb",
978 .id = 0,
979 .resource = tcb_resources,
980 .num_resources = ARRAY_SIZE(tcb_resources),
981};
982
983#if defined(CONFIG_OF)
984static struct of_device_id tcb_ids[] = {
985 { .compatible = "atmel,at91rm9200-tcb" },
986 { /*sentinel*/ }
987};
988#endif
989
990static void __init at91_add_device_tc(void)
991{
992#if defined(CONFIG_OF)
993 struct device_node *np;
994
995 np = of_find_matching_node(NULL, tcb_ids);
996 if (np) {
997 of_node_put(np);
998 return;
999 }
1000#endif
1001
1002 platform_device_register(&at91sam9263_tcb_device);
1003}
1004#else
1005static void __init at91_add_device_tc(void) { }
1006#endif
1007
1008
1009/* --------------------------------------------------------------------
1010 * RTT
1011 * -------------------------------------------------------------------- */
1012
1013static struct resource rtt0_resources[] = {
1014 {
1015 .start = AT91SAM9263_BASE_RTT0,
1016 .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1,
1017 .flags = IORESOURCE_MEM,
1018 }, {
1019 .flags = IORESOURCE_MEM,
1020 }, {
1021 .flags = IORESOURCE_IRQ,
1022 }
1023};
1024
1025static struct platform_device at91sam9263_rtt0_device = {
1026 .name = "at91_rtt",
1027 .id = 0,
1028 .resource = rtt0_resources,
1029};
1030
1031static struct resource rtt1_resources[] = {
1032 {
1033 .start = AT91SAM9263_BASE_RTT1,
1034 .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1,
1035 .flags = IORESOURCE_MEM,
1036 }, {
1037 .flags = IORESOURCE_MEM,
1038 }, {
1039 .flags = IORESOURCE_IRQ,
1040 }
1041};
1042
1043static struct platform_device at91sam9263_rtt1_device = {
1044 .name = "at91_rtt",
1045 .id = 1,
1046 .resource = rtt1_resources,
1047};
1048
1049#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
1050static void __init at91_add_device_rtt_rtc(void)
1051{
1052 struct platform_device *pdev;
1053 struct resource *r;
1054
1055 switch (CONFIG_RTC_DRV_AT91SAM9_RTT) {
1056 case 0:
1057 /*
1058 * The second resource is needed only for the chosen RTT:
1059 * GPBR will serve as the storage for RTC time offset
1060 */
1061 at91sam9263_rtt0_device.num_resources = 3;
1062 at91sam9263_rtt1_device.num_resources = 1;
1063 pdev = &at91sam9263_rtt0_device;
1064 r = rtt0_resources;
1065 break;
1066 case 1:
1067 at91sam9263_rtt0_device.num_resources = 1;
1068 at91sam9263_rtt1_device.num_resources = 3;
1069 pdev = &at91sam9263_rtt1_device;
1070 r = rtt1_resources;
1071 break;
1072 default:
1073 pr_err("at91sam9263: only supports 2 RTT (%d)\n",
1074 CONFIG_RTC_DRV_AT91SAM9_RTT);
1075 return;
1076 }
1077
1078 pdev->name = "rtc-at91sam9";
1079 r[1].start = AT91SAM9263_BASE_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
1080 r[1].end = r[1].start + 3;
1081 r[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
1082 r[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
1083}
1084#else
1085static void __init at91_add_device_rtt_rtc(void)
1086{
1087 /* Only one resource is needed: RTT not used as RTC */
1088 at91sam9263_rtt0_device.num_resources = 1;
1089 at91sam9263_rtt1_device.num_resources = 1;
1090}
1091#endif
1092
1093static void __init at91_add_device_rtt(void)
1094{
1095 at91_add_device_rtt_rtc();
1096 platform_device_register(&at91sam9263_rtt0_device);
1097 platform_device_register(&at91sam9263_rtt1_device);
1098}
1099
1100
1101/* --------------------------------------------------------------------
1102 * Watchdog
1103 * -------------------------------------------------------------------- */
1104
1105#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
1106static struct resource wdt_resources[] = {
1107 {
1108 .start = AT91SAM9263_BASE_WDT,
1109 .end = AT91SAM9263_BASE_WDT + SZ_16 - 1,
1110 .flags = IORESOURCE_MEM,
1111 }
1112};
1113
1114static struct platform_device at91sam9263_wdt_device = {
1115 .name = "at91_wdt",
1116 .id = -1,
1117 .resource = wdt_resources,
1118 .num_resources = ARRAY_SIZE(wdt_resources),
1119};
1120
1121static void __init at91_add_device_watchdog(void)
1122{
1123 platform_device_register(&at91sam9263_wdt_device);
1124}
1125#else
1126static void __init at91_add_device_watchdog(void) {}
1127#endif
1128
1129
1130/* --------------------------------------------------------------------
1131 * PWM
1132 * --------------------------------------------------------------------*/
1133
1134#if IS_ENABLED(CONFIG_PWM_ATMEL)
1135static struct resource pwm_resources[] = {
1136 [0] = {
1137 .start = AT91SAM9263_BASE_PWMC,
1138 .end = AT91SAM9263_BASE_PWMC + SZ_16K - 1,
1139 .flags = IORESOURCE_MEM,
1140 },
1141 [1] = {
1142 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_PWMC,
1143 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_PWMC,
1144 .flags = IORESOURCE_IRQ,
1145 },
1146};
1147
1148static struct platform_device at91sam9263_pwm0_device = {
1149 .name = "at91sam9rl-pwm",
1150 .id = -1,
1151 .resource = pwm_resources,
1152 .num_resources = ARRAY_SIZE(pwm_resources),
1153};
1154
1155void __init at91_add_device_pwm(u32 mask)
1156{
1157 if (mask & (1 << AT91_PWM0))
1158 at91_set_B_periph(AT91_PIN_PB7, 1); /* enable PWM0 */
1159
1160 if (mask & (1 << AT91_PWM1))
1161 at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM1 */
1162
1163 if (mask & (1 << AT91_PWM2))
1164 at91_set_B_periph(AT91_PIN_PC29, 1); /* enable PWM2 */
1165
1166 if (mask & (1 << AT91_PWM3))
1167 at91_set_B_periph(AT91_PIN_PB29, 1); /* enable PWM3 */
1168
1169 platform_device_register(&at91sam9263_pwm0_device);
1170}
1171#else
1172void __init at91_add_device_pwm(u32 mask) {}
1173#endif
1174
1175
1176/* --------------------------------------------------------------------
1177 * SSC -- Synchronous Serial Controller
1178 * -------------------------------------------------------------------- */
1179
1180#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
1181static u64 ssc0_dmamask = DMA_BIT_MASK(32);
1182
1183static struct resource ssc0_resources[] = {
1184 [0] = {
1185 .start = AT91SAM9263_BASE_SSC0,
1186 .end = AT91SAM9263_BASE_SSC0 + SZ_16K - 1,
1187 .flags = IORESOURCE_MEM,
1188 },
1189 [1] = {
1190 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_SSC0,
1191 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_SSC0,
1192 .flags = IORESOURCE_IRQ,
1193 },
1194};
1195
1196static struct platform_device at91sam9263_ssc0_device = {
1197 .name = "at91rm9200_ssc",
1198 .id = 0,
1199 .dev = {
1200 .dma_mask = &ssc0_dmamask,
1201 .coherent_dma_mask = DMA_BIT_MASK(32),
1202 },
1203 .resource = ssc0_resources,
1204 .num_resources = ARRAY_SIZE(ssc0_resources),
1205};
1206
1207static inline void configure_ssc0_pins(unsigned pins)
1208{
1209 if (pins & ATMEL_SSC_TF)
1210 at91_set_B_periph(AT91_PIN_PB0, 1);
1211 if (pins & ATMEL_SSC_TK)
1212 at91_set_B_periph(AT91_PIN_PB1, 1);
1213 if (pins & ATMEL_SSC_TD)
1214 at91_set_B_periph(AT91_PIN_PB2, 1);
1215 if (pins & ATMEL_SSC_RD)
1216 at91_set_B_periph(AT91_PIN_PB3, 1);
1217 if (pins & ATMEL_SSC_RK)
1218 at91_set_B_periph(AT91_PIN_PB4, 1);
1219 if (pins & ATMEL_SSC_RF)
1220 at91_set_B_periph(AT91_PIN_PB5, 1);
1221}
1222
1223static u64 ssc1_dmamask = DMA_BIT_MASK(32);
1224
1225static struct resource ssc1_resources[] = {
1226 [0] = {
1227 .start = AT91SAM9263_BASE_SSC1,
1228 .end = AT91SAM9263_BASE_SSC1 + SZ_16K - 1,
1229 .flags = IORESOURCE_MEM,
1230 },
1231 [1] = {
1232 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_SSC1,
1233 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_SSC1,
1234 .flags = IORESOURCE_IRQ,
1235 },
1236};
1237
1238static struct platform_device at91sam9263_ssc1_device = {
1239 .name = "at91rm9200_ssc",
1240 .id = 1,
1241 .dev = {
1242 .dma_mask = &ssc1_dmamask,
1243 .coherent_dma_mask = DMA_BIT_MASK(32),
1244 },
1245 .resource = ssc1_resources,
1246 .num_resources = ARRAY_SIZE(ssc1_resources),
1247};
1248
1249static inline void configure_ssc1_pins(unsigned pins)
1250{
1251 if (pins & ATMEL_SSC_TF)
1252 at91_set_A_periph(AT91_PIN_PB6, 1);
1253 if (pins & ATMEL_SSC_TK)
1254 at91_set_A_periph(AT91_PIN_PB7, 1);
1255 if (pins & ATMEL_SSC_TD)
1256 at91_set_A_periph(AT91_PIN_PB8, 1);
1257 if (pins & ATMEL_SSC_RD)
1258 at91_set_A_periph(AT91_PIN_PB9, 1);
1259 if (pins & ATMEL_SSC_RK)
1260 at91_set_A_periph(AT91_PIN_PB10, 1);
1261 if (pins & ATMEL_SSC_RF)
1262 at91_set_A_periph(AT91_PIN_PB11, 1);
1263}
1264
1265/*
1266 * SSC controllers are accessed through library code, instead of any
1267 * kind of all-singing/all-dancing driver. For example one could be
1268 * used by a particular I2S audio codec's driver, while another one
1269 * on the same system might be used by a custom data capture driver.
1270 */
1271void __init at91_add_device_ssc(unsigned id, unsigned pins)
1272{
1273 struct platform_device *pdev;
1274
1275 /*
1276 * NOTE: caller is responsible for passing information matching
1277 * "pins" to whatever will be using each particular controller.
1278 */
1279 switch (id) {
1280 case AT91SAM9263_ID_SSC0:
1281 pdev = &at91sam9263_ssc0_device;
1282 configure_ssc0_pins(pins);
1283 break;
1284 case AT91SAM9263_ID_SSC1:
1285 pdev = &at91sam9263_ssc1_device;
1286 configure_ssc1_pins(pins);
1287 break;
1288 default:
1289 return;
1290 }
1291
1292 platform_device_register(pdev);
1293}
1294
1295#else
1296void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
1297#endif
1298
1299
1300/* --------------------------------------------------------------------
1301 * UART
1302 * -------------------------------------------------------------------- */
1303
1304#if defined(CONFIG_SERIAL_ATMEL)
1305
1306static struct resource dbgu_resources[] = {
1307 [0] = {
1308 .start = AT91SAM9263_BASE_DBGU,
1309 .end = AT91SAM9263_BASE_DBGU + SZ_512 - 1,
1310 .flags = IORESOURCE_MEM,
1311 },
1312 [1] = {
1313 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
1314 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
1315 .flags = IORESOURCE_IRQ,
1316 },
1317};
1318
1319static struct atmel_uart_data dbgu_data = {
1320 .use_dma_tx = 0,
1321 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
1322};
1323
1324static u64 dbgu_dmamask = DMA_BIT_MASK(32);
1325
1326static struct platform_device at91sam9263_dbgu_device = {
1327 .name = "atmel_usart",
1328 .id = 0,
1329 .dev = {
1330 .dma_mask = &dbgu_dmamask,
1331 .coherent_dma_mask = DMA_BIT_MASK(32),
1332 .platform_data = &dbgu_data,
1333 },
1334 .resource = dbgu_resources,
1335 .num_resources = ARRAY_SIZE(dbgu_resources),
1336};
1337
1338static inline void configure_dbgu_pins(void)
1339{
1340 at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */
1341 at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */
1342}
1343
1344static struct resource uart0_resources[] = {
1345 [0] = {
1346 .start = AT91SAM9263_BASE_US0,
1347 .end = AT91SAM9263_BASE_US0 + SZ_16K - 1,
1348 .flags = IORESOURCE_MEM,
1349 },
1350 [1] = {
1351 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_US0,
1352 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_US0,
1353 .flags = IORESOURCE_IRQ,
1354 },
1355};
1356
1357static struct atmel_uart_data uart0_data = {
1358 .use_dma_tx = 1,
1359 .use_dma_rx = 1,
1360};
1361
1362static u64 uart0_dmamask = DMA_BIT_MASK(32);
1363
1364static struct platform_device at91sam9263_uart0_device = {
1365 .name = "atmel_usart",
1366 .id = 1,
1367 .dev = {
1368 .dma_mask = &uart0_dmamask,
1369 .coherent_dma_mask = DMA_BIT_MASK(32),
1370 .platform_data = &uart0_data,
1371 },
1372 .resource = uart0_resources,
1373 .num_resources = ARRAY_SIZE(uart0_resources),
1374};
1375
1376static inline void configure_usart0_pins(unsigned pins)
1377{
1378 at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */
1379 at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */
1380
1381 if (pins & ATMEL_UART_RTS)
1382 at91_set_A_periph(AT91_PIN_PA28, 0); /* RTS0 */
1383 if (pins & ATMEL_UART_CTS)
1384 at91_set_A_periph(AT91_PIN_PA29, 0); /* CTS0 */
1385}
1386
1387static struct resource uart1_resources[] = {
1388 [0] = {
1389 .start = AT91SAM9263_BASE_US1,
1390 .end = AT91SAM9263_BASE_US1 + SZ_16K - 1,
1391 .flags = IORESOURCE_MEM,
1392 },
1393 [1] = {
1394 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_US1,
1395 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_US1,
1396 .flags = IORESOURCE_IRQ,
1397 },
1398};
1399
1400static struct atmel_uart_data uart1_data = {
1401 .use_dma_tx = 1,
1402 .use_dma_rx = 1,
1403};
1404
1405static u64 uart1_dmamask = DMA_BIT_MASK(32);
1406
1407static struct platform_device at91sam9263_uart1_device = {
1408 .name = "atmel_usart",
1409 .id = 2,
1410 .dev = {
1411 .dma_mask = &uart1_dmamask,
1412 .coherent_dma_mask = DMA_BIT_MASK(32),
1413 .platform_data = &uart1_data,
1414 },
1415 .resource = uart1_resources,
1416 .num_resources = ARRAY_SIZE(uart1_resources),
1417};
1418
1419static inline void configure_usart1_pins(unsigned pins)
1420{
1421 at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
1422 at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
1423
1424 if (pins & ATMEL_UART_RTS)
1425 at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */
1426 if (pins & ATMEL_UART_CTS)
1427 at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */
1428}
1429
1430static struct resource uart2_resources[] = {
1431 [0] = {
1432 .start = AT91SAM9263_BASE_US2,
1433 .end = AT91SAM9263_BASE_US2 + SZ_16K - 1,
1434 .flags = IORESOURCE_MEM,
1435 },
1436 [1] = {
1437 .start = NR_IRQS_LEGACY + AT91SAM9263_ID_US2,
1438 .end = NR_IRQS_LEGACY + AT91SAM9263_ID_US2,
1439 .flags = IORESOURCE_IRQ,
1440 },
1441};
1442
1443static struct atmel_uart_data uart2_data = {
1444 .use_dma_tx = 1,
1445 .use_dma_rx = 1,
1446};
1447
1448static u64 uart2_dmamask = DMA_BIT_MASK(32);
1449
1450static struct platform_device at91sam9263_uart2_device = {
1451 .name = "atmel_usart",
1452 .id = 3,
1453 .dev = {
1454 .dma_mask = &uart2_dmamask,
1455 .coherent_dma_mask = DMA_BIT_MASK(32),
1456 .platform_data = &uart2_data,
1457 },
1458 .resource = uart2_resources,
1459 .num_resources = ARRAY_SIZE(uart2_resources),
1460};
1461
1462static inline void configure_usart2_pins(unsigned pins)
1463{
1464 at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
1465 at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
1466
1467 if (pins & ATMEL_UART_RTS)
1468 at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */
1469 if (pins & ATMEL_UART_CTS)
1470 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
1471}
1472
1473static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1474
1475void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1476{
1477 struct platform_device *pdev;
1478 struct atmel_uart_data *pdata;
1479
1480 switch (id) {
1481 case 0: /* DBGU */
1482 pdev = &at91sam9263_dbgu_device;
1483 configure_dbgu_pins();
1484 break;
1485 case AT91SAM9263_ID_US0:
1486 pdev = &at91sam9263_uart0_device;
1487 configure_usart0_pins(pins);
1488 break;
1489 case AT91SAM9263_ID_US1:
1490 pdev = &at91sam9263_uart1_device;
1491 configure_usart1_pins(pins);
1492 break;
1493 case AT91SAM9263_ID_US2:
1494 pdev = &at91sam9263_uart2_device;
1495 configure_usart2_pins(pins);
1496 break;
1497 default:
1498 return;
1499 }
1500 pdata = pdev->dev.platform_data;
1501 pdata->num = portnr; /* update to mapped ID */
1502
1503 if (portnr < ATMEL_MAX_UART)
1504 at91_uarts[portnr] = pdev;
1505}
1506
1507void __init at91_add_device_serial(void)
1508{
1509 int i;
1510
1511 for (i = 0; i < ATMEL_MAX_UART; i++) {
1512 if (at91_uarts[i])
1513 platform_device_register(at91_uarts[i]);
1514 }
1515}
1516#else
1517void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1518void __init at91_add_device_serial(void) {}
1519#endif
1520
1521
1522/* -------------------------------------------------------------------- */
1523/*
1524 * These devices are always present and don't need any board-specific
1525 * setup.
1526 */
1527static int __init at91_add_standard_devices(void)
1528{
1529 if (of_have_populated_dt())
1530 return 0;
1531
1532 at91_add_device_rtt();
1533 at91_add_device_watchdog();
1534 at91_add_device_tc();
1535 return 0;
1536}
1537
1538arch_initcall(at91_add_standard_devices);
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 405427ec05f8..b6117bea9a6f 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -10,356 +10,12 @@
10 * 10 *
11 */ 11 */
12 12
13#include <linux/module.h>
14#include <linux/dma-mapping.h>
15#include <linux/clk/at91_pmc.h>
16#include <linux/platform_device.h>
17
18#include <asm/irq.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <asm/system_misc.h> 13#include <asm/system_misc.h>
22#include <mach/at91sam9g45.h> 14#include <asm/irq.h>
23#include <mach/cpu.h>
24#include <mach/hardware.h> 15#include <mach/hardware.h>
25 16
26#include "at91_aic.h"
27#include "soc.h" 17#include "soc.h"
28#include "generic.h" 18#include "generic.h"
29#include "sam9_smc.h"
30#include "pm.h"
31
32#if defined(CONFIG_OLD_CLK_AT91)
33#include "clock.h"
34/* --------------------------------------------------------------------
35 * Clocks
36 * -------------------------------------------------------------------- */
37
38/*
39 * The peripheral clocks.
40 */
41static struct clk pioA_clk = {
42 .name = "pioA_clk",
43 .pmc_mask = 1 << AT91SAM9G45_ID_PIOA,
44 .type = CLK_TYPE_PERIPHERAL,
45};
46static struct clk pioB_clk = {
47 .name = "pioB_clk",
48 .pmc_mask = 1 << AT91SAM9G45_ID_PIOB,
49 .type = CLK_TYPE_PERIPHERAL,
50};
51static struct clk pioC_clk = {
52 .name = "pioC_clk",
53 .pmc_mask = 1 << AT91SAM9G45_ID_PIOC,
54 .type = CLK_TYPE_PERIPHERAL,
55};
56static struct clk pioDE_clk = {
57 .name = "pioDE_clk",
58 .pmc_mask = 1 << AT91SAM9G45_ID_PIODE,
59 .type = CLK_TYPE_PERIPHERAL,
60};
61static struct clk trng_clk = {
62 .name = "trng_clk",
63 .pmc_mask = 1 << AT91SAM9G45_ID_TRNG,
64 .type = CLK_TYPE_PERIPHERAL,
65};
66static struct clk usart0_clk = {
67 .name = "usart0_clk",
68 .pmc_mask = 1 << AT91SAM9G45_ID_US0,
69 .type = CLK_TYPE_PERIPHERAL,
70};
71static struct clk usart1_clk = {
72 .name = "usart1_clk",
73 .pmc_mask = 1 << AT91SAM9G45_ID_US1,
74 .type = CLK_TYPE_PERIPHERAL,
75};
76static struct clk usart2_clk = {
77 .name = "usart2_clk",
78 .pmc_mask = 1 << AT91SAM9G45_ID_US2,
79 .type = CLK_TYPE_PERIPHERAL,
80};
81static struct clk usart3_clk = {
82 .name = "usart3_clk",
83 .pmc_mask = 1 << AT91SAM9G45_ID_US3,
84 .type = CLK_TYPE_PERIPHERAL,
85};
86static struct clk mmc0_clk = {
87 .name = "mci0_clk",
88 .pmc_mask = 1 << AT91SAM9G45_ID_MCI0,
89 .type = CLK_TYPE_PERIPHERAL,
90};
91static struct clk twi0_clk = {
92 .name = "twi0_clk",
93 .pmc_mask = 1 << AT91SAM9G45_ID_TWI0,
94 .type = CLK_TYPE_PERIPHERAL,
95};
96static struct clk twi1_clk = {
97 .name = "twi1_clk",
98 .pmc_mask = 1 << AT91SAM9G45_ID_TWI1,
99 .type = CLK_TYPE_PERIPHERAL,
100};
101static struct clk spi0_clk = {
102 .name = "spi0_clk",
103 .pmc_mask = 1 << AT91SAM9G45_ID_SPI0,
104 .type = CLK_TYPE_PERIPHERAL,
105};
106static struct clk spi1_clk = {
107 .name = "spi1_clk",
108 .pmc_mask = 1 << AT91SAM9G45_ID_SPI1,
109 .type = CLK_TYPE_PERIPHERAL,
110};
111static struct clk ssc0_clk = {
112 .name = "ssc0_clk",
113 .pmc_mask = 1 << AT91SAM9G45_ID_SSC0,
114 .type = CLK_TYPE_PERIPHERAL,
115};
116static struct clk ssc1_clk = {
117 .name = "ssc1_clk",
118 .pmc_mask = 1 << AT91SAM9G45_ID_SSC1,
119 .type = CLK_TYPE_PERIPHERAL,
120};
121static struct clk tcb0_clk = {
122 .name = "tcb0_clk",
123 .pmc_mask = 1 << AT91SAM9G45_ID_TCB,
124 .type = CLK_TYPE_PERIPHERAL,
125};
126static struct clk pwm_clk = {
127 .name = "pwm_clk",
128 .pmc_mask = 1 << AT91SAM9G45_ID_PWMC,
129 .type = CLK_TYPE_PERIPHERAL,
130};
131static struct clk tsc_clk = {
132 .name = "tsc_clk",
133 .pmc_mask = 1 << AT91SAM9G45_ID_TSC,
134 .type = CLK_TYPE_PERIPHERAL,
135};
136static struct clk dma_clk = {
137 .name = "dma_clk",
138 .pmc_mask = 1 << AT91SAM9G45_ID_DMA,
139 .type = CLK_TYPE_PERIPHERAL,
140};
141static struct clk uhphs_clk = {
142 .name = "uhphs_clk",
143 .pmc_mask = 1 << AT91SAM9G45_ID_UHPHS,
144 .type = CLK_TYPE_PERIPHERAL,
145};
146static struct clk lcdc_clk = {
147 .name = "lcdc_clk",
148 .pmc_mask = 1 << AT91SAM9G45_ID_LCDC,
149 .type = CLK_TYPE_PERIPHERAL,
150};
151static struct clk ac97_clk = {
152 .name = "ac97_clk",
153 .pmc_mask = 1 << AT91SAM9G45_ID_AC97C,
154 .type = CLK_TYPE_PERIPHERAL,
155};
156static struct clk macb_clk = {
157 .name = "pclk",
158 .pmc_mask = 1 << AT91SAM9G45_ID_EMAC,
159 .type = CLK_TYPE_PERIPHERAL,
160};
161static struct clk isi_clk = {
162 .name = "isi_clk",
163 .pmc_mask = 1 << AT91SAM9G45_ID_ISI,
164 .type = CLK_TYPE_PERIPHERAL,
165};
166static struct clk udphs_clk = {
167 .name = "udphs_clk",
168 .pmc_mask = 1 << AT91SAM9G45_ID_UDPHS,
169 .type = CLK_TYPE_PERIPHERAL,
170};
171static struct clk mmc1_clk = {
172 .name = "mci1_clk",
173 .pmc_mask = 1 << AT91SAM9G45_ID_MCI1,
174 .type = CLK_TYPE_PERIPHERAL,
175};
176
177/* Video decoder clock - Only for sam9m10/sam9m11 */
178static struct clk vdec_clk = {
179 .name = "vdec_clk",
180 .pmc_mask = 1 << AT91SAM9G45_ID_VDEC,
181 .type = CLK_TYPE_PERIPHERAL,
182};
183
184static struct clk adc_op_clk = {
185 .name = "adc_op_clk",
186 .type = CLK_TYPE_PERIPHERAL,
187 .rate_hz = 300000,
188};
189
190/* AES/TDES/SHA clock - Only for sam9m11/sam9g56 */
191static struct clk aestdessha_clk = {
192 .name = "aestdessha_clk",
193 .pmc_mask = 1 << AT91SAM9G45_ID_AESTDESSHA,
194 .type = CLK_TYPE_PERIPHERAL,
195};
196
197static struct clk *periph_clocks[] __initdata = {
198 &pioA_clk,
199 &pioB_clk,
200 &pioC_clk,
201 &pioDE_clk,
202 &trng_clk,
203 &usart0_clk,
204 &usart1_clk,
205 &usart2_clk,
206 &usart3_clk,
207 &mmc0_clk,
208 &twi0_clk,
209 &twi1_clk,
210 &spi0_clk,
211 &spi1_clk,
212 &ssc0_clk,
213 &ssc1_clk,
214 &tcb0_clk,
215 &pwm_clk,
216 &tsc_clk,
217 &dma_clk,
218 &uhphs_clk,
219 &lcdc_clk,
220 &ac97_clk,
221 &macb_clk,
222 &isi_clk,
223 &udphs_clk,
224 &mmc1_clk,
225 &adc_op_clk,
226 &aestdessha_clk,
227 // irq0
228};
229
230static struct clk_lookup periph_clocks_lookups[] = {
231 /* One additional fake clock for macb_hclk */
232 CLKDEV_CON_ID("hclk", &macb_clk),
233 /* One additional fake clock for ohci */
234 CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
235 CLKDEV_CON_DEV_ID("hclk", "at91sam9g45-lcdfb.0", &lcdc_clk),
236 CLKDEV_CON_DEV_ID("hclk", "at91sam9g45es-lcdfb.0", &lcdc_clk),
237 CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk),
238 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
239 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
240 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
241 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
242 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
243 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
244 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb0_clk),
245 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
246 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.0", &twi0_clk),
247 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.1", &twi1_clk),
248 CLKDEV_CON_DEV_ID("pclk", "at91sam9g45_ssc.0", &ssc0_clk),
249 CLKDEV_CON_DEV_ID("pclk", "at91sam9g45_ssc.1", &ssc1_clk),
250 CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc0_clk),
251 CLKDEV_CON_DEV_ID("pclk", "fffa0000.ssc", &ssc1_clk),
252 CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
253 CLKDEV_CON_DEV_ID(NULL, "atmel_sha", &aestdessha_clk),
254 CLKDEV_CON_DEV_ID(NULL, "atmel_tdes", &aestdessha_clk),
255 CLKDEV_CON_DEV_ID(NULL, "atmel_aes", &aestdessha_clk),
256 CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
257 /* more usart lookup table for DT entries */
258 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
259 CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk),
260 CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk),
261 CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk),
262 CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk),
263 /* more tc lookup table for DT entries */
264 CLKDEV_CON_DEV_ID("t0_clk", "fff7c000.timer", &tcb0_clk),
265 CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
266 CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk),
267 CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk),
268 CLKDEV_CON_DEV_ID("mci_clk", "fff80000.mmc", &mmc0_clk),
269 CLKDEV_CON_DEV_ID("mci_clk", "fffd0000.mmc", &mmc1_clk),
270 CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk),
271 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
272 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
273 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
274 CLKDEV_CON_DEV_ID("hclk", "600000.gadget", &utmi_clk),
275 CLKDEV_CON_DEV_ID("pclk", "600000.gadget", &udphs_clk),
276 /* fake hclk clock */
277 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
278 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
279 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
280 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk),
281 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioDE_clk),
282 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioDE_clk),
283
284 CLKDEV_CON_ID("pioA", &pioA_clk),
285 CLKDEV_CON_ID("pioB", &pioB_clk),
286 CLKDEV_CON_ID("pioC", &pioC_clk),
287 CLKDEV_CON_ID("pioD", &pioDE_clk),
288 CLKDEV_CON_ID("pioE", &pioDE_clk),
289 /* Fake adc clock */
290 CLKDEV_CON_ID("adc_clk", &tsc_clk),
291 CLKDEV_CON_DEV_ID(NULL, "fffb8000.pwm", &pwm_clk),
292};
293
294static struct clk_lookup usart_clocks_lookups[] = {
295 CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck),
296 CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk),
297 CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk),
298 CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk),
299 CLKDEV_CON_DEV_ID("usart", "atmel_usart.4", &usart3_clk),
300};
301
302/*
303 * The two programmable clocks.
304 * You must configure pin multiplexing to bring these signals out.
305 */
306static struct clk pck0 = {
307 .name = "pck0",
308 .pmc_mask = AT91_PMC_PCK0,
309 .type = CLK_TYPE_PROGRAMMABLE,
310 .id = 0,
311};
312static struct clk pck1 = {
313 .name = "pck1",
314 .pmc_mask = AT91_PMC_PCK1,
315 .type = CLK_TYPE_PROGRAMMABLE,
316 .id = 1,
317};
318
319static void __init at91sam9g45_register_clocks(void)
320{
321 int i;
322
323 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
324 clk_register(periph_clocks[i]);
325
326 clkdev_add_table(periph_clocks_lookups,
327 ARRAY_SIZE(periph_clocks_lookups));
328 clkdev_add_table(usart_clocks_lookups,
329 ARRAY_SIZE(usart_clocks_lookups));
330
331 if (cpu_is_at91sam9m10() || cpu_is_at91sam9m11())
332 clk_register(&vdec_clk);
333
334 clk_register(&pck0);
335 clk_register(&pck1);
336}
337#else
338#define at91sam9g45_register_clocks NULL
339#endif
340
341/* --------------------------------------------------------------------
342 * GPIO
343 * -------------------------------------------------------------------- */
344
345static struct at91_gpio_bank at91sam9g45_gpio[] __initdata = {
346 {
347 .id = AT91SAM9G45_ID_PIOA,
348 .regbase = AT91SAM9G45_BASE_PIOA,
349 }, {
350 .id = AT91SAM9G45_ID_PIOB,
351 .regbase = AT91SAM9G45_BASE_PIOB,
352 }, {
353 .id = AT91SAM9G45_ID_PIOC,
354 .regbase = AT91SAM9G45_BASE_PIOC,
355 }, {
356 .id = AT91SAM9G45_ID_PIODE,
357 .regbase = AT91SAM9G45_BASE_PIOD,
358 }, {
359 .id = AT91SAM9G45_ID_PIODE,
360 .regbase = AT91SAM9G45_BASE_PIOE,
361 }
362};
363 19
364/* -------------------------------------------------------------------- 20/* --------------------------------------------------------------------
365 * AT91SAM9G45 processor initialization 21 * AT91SAM9G45 processor initialization
@@ -370,125 +26,15 @@ static void __init at91sam9g45_map_io(void)
370 at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE); 26 at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE);
371} 27}
372 28
373static void __init at91sam9g45_ioremap_registers(void)
374{
375 at91_ioremap_ramc(0, AT91SAM9G45_BASE_DDRSDRC1, 512);
376 at91_ioremap_ramc(1, AT91SAM9G45_BASE_DDRSDRC0, 512);
377 at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT);
378 at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC);
379 at91_ioremap_matrix(AT91SAM9G45_BASE_MATRIX);
380 at91_pm_set_standby(at91_ddr_standby);
381}
382
383static void __init at91sam9g45_initialize(void) 29static void __init at91sam9g45_initialize(void)
384{ 30{
385 arm_pm_idle = at91sam9_idle; 31 arm_pm_idle = at91sam9_idle;
386 32
387 at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC); 33 at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC);
388 at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT); 34 at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT);
389
390 /* Register GPIO subsystem */
391 at91_gpio_init(at91sam9g45_gpio, 5);
392}
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
438/* --------------------------------------------------------------------
439 * Interrupt initialization
440 * -------------------------------------------------------------------- */
441
442/*
443 * The default interrupt priority levels (0 = lowest, 7 = highest).
444 */
445static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {
446 7, /* Advanced Interrupt Controller (FIQ) */
447 7, /* System Peripherals */
448 1, /* Parallel IO Controller A */
449 1, /* Parallel IO Controller B */
450 1, /* Parallel IO Controller C */
451 1, /* Parallel IO Controller D and E */
452 0,
453 5, /* USART 0 */
454 5, /* USART 1 */
455 5, /* USART 2 */
456 5, /* USART 3 */
457 0, /* Multimedia Card Interface 0 */
458 6, /* Two-Wire Interface 0 */
459 6, /* Two-Wire Interface 1 */
460 5, /* Serial Peripheral Interface 0 */
461 5, /* Serial Peripheral Interface 1 */
462 4, /* Serial Synchronous Controller 0 */
463 4, /* Serial Synchronous Controller 1 */
464 0, /* Timer Counter 0, 1, 2, 3, 4 and 5 */
465 0, /* Pulse Width Modulation Controller */
466 0, /* Touch Screen Controller */
467 0, /* DMA Controller */
468 2, /* USB Host High Speed port */
469 3, /* LDC Controller */
470 5, /* AC97 Controller */
471 3, /* Ethernet */
472 0, /* Image Sensor Interface */
473 2, /* USB Device High speed port */
474 0, /* AESTDESSHA Crypto HW Accelerators */
475 0, /* Multimedia Card Interface 1 */
476 0,
477 0, /* Advanced Interrupt Controller (IRQ0) */
478};
479
480static void __init at91sam9g45_init_time(void)
481{
482 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
483} 35}
484 36
485AT91_SOC_START(at91sam9g45) 37AT91_SOC_START(at91sam9g45)
486 .map_io = at91sam9g45_map_io, 38 .map_io = at91sam9g45_map_io,
487 .default_irq_priority = at91sam9g45_default_irq_priority,
488 .extern_irq = (1 << AT91SAM9G45_ID_IRQ0),
489 .ioremap_registers = at91sam9g45_ioremap_registers,
490 .register_clocks = at91sam9g45_register_clocks,
491 .register_devices = at91sam9g45_register_devices,
492 .init = at91sam9g45_initialize, 39 .init = at91sam9g45_initialize,
493 .init_time = at91sam9g45_init_time,
494AT91_SOC_END 40AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
deleted file mode 100644
index 21ab782cc8e9..000000000000
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ /dev/null
@@ -1,1915 +0,0 @@
1/*
2 * On-Chip devices setup code for the AT91SAM9G45 family
3 *
4 * Copyright (C) 2009 Atmel 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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12#include <asm/mach/arch.h>
13#include <asm/mach/map.h>
14
15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
17#include <linux/clk.h>
18#include <linux/platform_device.h>
19#include <linux/i2c-gpio.h>
20#include <linux/atmel-mci.h>
21#include <linux/platform_data/crypto-atmel.h>
22
23#include <linux/platform_data/at91_adc.h>
24
25#include <linux/fb.h>
26#include <video/atmel_lcdc.h>
27
28#include <mach/at91sam9g45.h>
29#include <mach/at91sam9g45_matrix.h>
30#include <mach/at91_matrix.h>
31#include <mach/at91sam9_smc.h>
32#include <linux/platform_data/dma-atmel.h>
33#include <mach/atmel-mci.h>
34#include <mach/hardware.h>
35
36#include <media/atmel-isi.h>
37
38#include "board.h"
39#include "generic.h"
40#include "clock.h"
41#include "gpio.h"
42
43
44/* --------------------------------------------------------------------
45 * HDMAC - AHB DMA Controller
46 * -------------------------------------------------------------------- */
47
48#if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
49static u64 hdmac_dmamask = DMA_BIT_MASK(32);
50
51static struct resource hdmac_resources[] = {
52 [0] = {
53 .start = AT91SAM9G45_BASE_DMA,
54 .end = AT91SAM9G45_BASE_DMA + SZ_512 - 1,
55 .flags = IORESOURCE_MEM,
56 },
57 [1] = {
58 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_DMA,
59 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_DMA,
60 .flags = IORESOURCE_IRQ,
61 },
62};
63
64static struct platform_device at_hdmac_device = {
65 .name = "at91sam9g45_dma",
66 .id = -1,
67 .dev = {
68 .dma_mask = &hdmac_dmamask,
69 .coherent_dma_mask = DMA_BIT_MASK(32),
70 },
71 .resource = hdmac_resources,
72 .num_resources = ARRAY_SIZE(hdmac_resources),
73};
74
75void __init at91_add_device_hdmac(void)
76{
77 platform_device_register(&at_hdmac_device);
78}
79#else
80void __init at91_add_device_hdmac(void) {}
81#endif
82
83
84/* --------------------------------------------------------------------
85 * USB Host (OHCI)
86 * -------------------------------------------------------------------- */
87
88#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
89static u64 ohci_dmamask = DMA_BIT_MASK(32);
90static struct at91_usbh_data usbh_ohci_data;
91
92static struct resource usbh_ohci_resources[] = {
93 [0] = {
94 .start = AT91SAM9G45_OHCI_BASE,
95 .end = AT91SAM9G45_OHCI_BASE + SZ_1M - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_UHPHS,
100 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_UHPHS,
101 .flags = IORESOURCE_IRQ,
102 },
103};
104
105static struct platform_device at91_usbh_ohci_device = {
106 .name = "at91_ohci",
107 .id = -1,
108 .dev = {
109 .dma_mask = &ohci_dmamask,
110 .coherent_dma_mask = DMA_BIT_MASK(32),
111 .platform_data = &usbh_ohci_data,
112 },
113 .resource = usbh_ohci_resources,
114 .num_resources = ARRAY_SIZE(usbh_ohci_resources),
115};
116
117void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
118{
119 int i;
120
121 if (!data)
122 return;
123
124 /* Enable VBus control for UHP ports */
125 for (i = 0; i < data->ports; i++) {
126 if (gpio_is_valid(data->vbus_pin[i]))
127 at91_set_gpio_output(data->vbus_pin[i],
128 data->vbus_pin_active_low[i]);
129 }
130
131 /* Enable overcurrent notification */
132 for (i = 0; i < data->ports; i++) {
133 if (gpio_is_valid(data->overcurrent_pin[i]))
134 at91_set_gpio_input(data->overcurrent_pin[i], 1);
135 }
136
137 usbh_ohci_data = *data;
138 platform_device_register(&at91_usbh_ohci_device);
139}
140#else
141void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
142#endif
143
144
145/* --------------------------------------------------------------------
146 * USB Host HS (EHCI)
147 * Needs an OHCI host for low and full speed management
148 * -------------------------------------------------------------------- */
149
150#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
151static u64 ehci_dmamask = DMA_BIT_MASK(32);
152static struct at91_usbh_data usbh_ehci_data;
153
154static struct resource usbh_ehci_resources[] = {
155 [0] = {
156 .start = AT91SAM9G45_EHCI_BASE,
157 .end = AT91SAM9G45_EHCI_BASE + SZ_1M - 1,
158 .flags = IORESOURCE_MEM,
159 },
160 [1] = {
161 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_UHPHS,
162 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_UHPHS,
163 .flags = IORESOURCE_IRQ,
164 },
165};
166
167static struct platform_device at91_usbh_ehci_device = {
168 .name = "atmel-ehci",
169 .id = -1,
170 .dev = {
171 .dma_mask = &ehci_dmamask,
172 .coherent_dma_mask = DMA_BIT_MASK(32),
173 .platform_data = &usbh_ehci_data,
174 },
175 .resource = usbh_ehci_resources,
176 .num_resources = ARRAY_SIZE(usbh_ehci_resources),
177};
178
179void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
180{
181 int i;
182
183 if (!data)
184 return;
185
186 /* Enable VBus control for UHP ports */
187 for (i = 0; i < data->ports; i++) {
188 if (gpio_is_valid(data->vbus_pin[i]))
189 at91_set_gpio_output(data->vbus_pin[i],
190 data->vbus_pin_active_low[i]);
191 }
192
193 usbh_ehci_data = *data;
194 platform_device_register(&at91_usbh_ehci_device);
195}
196#else
197void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) {}
198#endif
199
200
201/* --------------------------------------------------------------------
202 * USB HS Device (Gadget)
203 * -------------------------------------------------------------------- */
204
205#if defined(CONFIG_USB_ATMEL_USBA) || defined(CONFIG_USB_ATMEL_USBA_MODULE)
206static struct resource usba_udc_resources[] = {
207 [0] = {
208 .start = AT91SAM9G45_UDPHS_FIFO,
209 .end = AT91SAM9G45_UDPHS_FIFO + SZ_512K - 1,
210 .flags = IORESOURCE_MEM,
211 },
212 [1] = {
213 .start = AT91SAM9G45_BASE_UDPHS,
214 .end = AT91SAM9G45_BASE_UDPHS + SZ_1K - 1,
215 .flags = IORESOURCE_MEM,
216 },
217 [2] = {
218 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_UDPHS,
219 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_UDPHS,
220 .flags = IORESOURCE_IRQ,
221 },
222};
223
224#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
225 [idx] = { \
226 .name = nam, \
227 .index = idx, \
228 .fifo_size = maxpkt, \
229 .nr_banks = maxbk, \
230 .can_dma = dma, \
231 .can_isoc = isoc, \
232 }
233
234static struct usba_ep_data usba_udc_ep[] __initdata = {
235 EP("ep0", 0, 64, 1, 0, 0),
236 EP("ep1", 1, 1024, 2, 1, 1),
237 EP("ep2", 2, 1024, 2, 1, 1),
238 EP("ep3", 3, 1024, 3, 1, 0),
239 EP("ep4", 4, 1024, 3, 1, 0),
240 EP("ep5", 5, 1024, 3, 1, 1),
241 EP("ep6", 6, 1024, 3, 1, 1),
242};
243
244#undef EP
245
246/*
247 * pdata doesn't have room for any endpoints, so we need to
248 * append room for the ones we need right after it.
249 */
250static struct {
251 struct usba_platform_data pdata;
252 struct usba_ep_data ep[7];
253} usba_udc_data;
254
255static struct platform_device at91_usba_udc_device = {
256 .name = "atmel_usba_udc",
257 .id = -1,
258 .dev = {
259 .platform_data = &usba_udc_data.pdata,
260 },
261 .resource = usba_udc_resources,
262 .num_resources = ARRAY_SIZE(usba_udc_resources),
263};
264
265void __init at91_add_device_usba(struct usba_platform_data *data)
266{
267 usba_udc_data.pdata.vbus_pin = -EINVAL;
268 usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
269 memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));
270
271 if (data && gpio_is_valid(data->vbus_pin)) {
272 at91_set_gpio_input(data->vbus_pin, 0);
273 at91_set_deglitch(data->vbus_pin, 1);
274 usba_udc_data.pdata.vbus_pin = data->vbus_pin;
275 }
276
277 /* Pullup pin is handled internally by USB device peripheral */
278
279 platform_device_register(&at91_usba_udc_device);
280}
281#else
282void __init at91_add_device_usba(struct usba_platform_data *data) {}
283#endif
284
285
286/* --------------------------------------------------------------------
287 * Ethernet
288 * -------------------------------------------------------------------- */
289
290#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
291static u64 eth_dmamask = DMA_BIT_MASK(32);
292static struct macb_platform_data eth_data;
293
294static struct resource eth_resources[] = {
295 [0] = {
296 .start = AT91SAM9G45_BASE_EMAC,
297 .end = AT91SAM9G45_BASE_EMAC + SZ_16K - 1,
298 .flags = IORESOURCE_MEM,
299 },
300 [1] = {
301 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_EMAC,
302 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_EMAC,
303 .flags = IORESOURCE_IRQ,
304 },
305};
306
307static struct platform_device at91sam9g45_eth_device = {
308 .name = "macb",
309 .id = -1,
310 .dev = {
311 .dma_mask = &eth_dmamask,
312 .coherent_dma_mask = DMA_BIT_MASK(32),
313 .platform_data = &eth_data,
314 },
315 .resource = eth_resources,
316 .num_resources = ARRAY_SIZE(eth_resources),
317};
318
319void __init at91_add_device_eth(struct macb_platform_data *data)
320{
321 if (!data)
322 return;
323
324 if (gpio_is_valid(data->phy_irq_pin)) {
325 at91_set_gpio_input(data->phy_irq_pin, 0);
326 at91_set_deglitch(data->phy_irq_pin, 1);
327 }
328
329 /* Pins used for MII and RMII */
330 at91_set_A_periph(AT91_PIN_PA17, 0); /* ETXCK_EREFCK */
331 at91_set_A_periph(AT91_PIN_PA15, 0); /* ERXDV */
332 at91_set_A_periph(AT91_PIN_PA12, 0); /* ERX0 */
333 at91_set_A_periph(AT91_PIN_PA13, 0); /* ERX1 */
334 at91_set_A_periph(AT91_PIN_PA16, 0); /* ERXER */
335 at91_set_A_periph(AT91_PIN_PA14, 0); /* ETXEN */
336 at91_set_A_periph(AT91_PIN_PA10, 0); /* ETX0 */
337 at91_set_A_periph(AT91_PIN_PA11, 0); /* ETX1 */
338 at91_set_A_periph(AT91_PIN_PA19, 0); /* EMDIO */
339 at91_set_A_periph(AT91_PIN_PA18, 0); /* EMDC */
340
341 if (!data->is_rmii) {
342 at91_set_B_periph(AT91_PIN_PA29, 0); /* ECRS */
343 at91_set_B_periph(AT91_PIN_PA30, 0); /* ECOL */
344 at91_set_B_periph(AT91_PIN_PA8, 0); /* ERX2 */
345 at91_set_B_periph(AT91_PIN_PA9, 0); /* ERX3 */
346 at91_set_B_periph(AT91_PIN_PA28, 0); /* ERXCK */
347 at91_set_B_periph(AT91_PIN_PA6, 0); /* ETX2 */
348 at91_set_B_periph(AT91_PIN_PA7, 0); /* ETX3 */
349 at91_set_B_periph(AT91_PIN_PA27, 0); /* ETXER */
350 }
351
352 eth_data = *data;
353 platform_device_register(&at91sam9g45_eth_device);
354}
355#else
356void __init at91_add_device_eth(struct macb_platform_data *data) {}
357#endif
358
359
360/* --------------------------------------------------------------------
361 * MMC / SD
362 * -------------------------------------------------------------------- */
363
364#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
365static u64 mmc_dmamask = DMA_BIT_MASK(32);
366static struct mci_platform_data mmc0_data, mmc1_data;
367
368static struct resource mmc0_resources[] = {
369 [0] = {
370 .start = AT91SAM9G45_BASE_MCI0,
371 .end = AT91SAM9G45_BASE_MCI0 + SZ_16K - 1,
372 .flags = IORESOURCE_MEM,
373 },
374 [1] = {
375 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_MCI0,
376 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_MCI0,
377 .flags = IORESOURCE_IRQ,
378 },
379};
380
381static struct platform_device at91sam9g45_mmc0_device = {
382 .name = "atmel_mci",
383 .id = 0,
384 .dev = {
385 .dma_mask = &mmc_dmamask,
386 .coherent_dma_mask = DMA_BIT_MASK(32),
387 .platform_data = &mmc0_data,
388 },
389 .resource = mmc0_resources,
390 .num_resources = ARRAY_SIZE(mmc0_resources),
391};
392
393static struct resource mmc1_resources[] = {
394 [0] = {
395 .start = AT91SAM9G45_BASE_MCI1,
396 .end = AT91SAM9G45_BASE_MCI1 + SZ_16K - 1,
397 .flags = IORESOURCE_MEM,
398 },
399 [1] = {
400 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_MCI1,
401 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_MCI1,
402 .flags = IORESOURCE_IRQ,
403 },
404};
405
406static struct platform_device at91sam9g45_mmc1_device = {
407 .name = "atmel_mci",
408 .id = 1,
409 .dev = {
410 .dma_mask = &mmc_dmamask,
411 .coherent_dma_mask = DMA_BIT_MASK(32),
412 .platform_data = &mmc1_data,
413 },
414 .resource = mmc1_resources,
415 .num_resources = ARRAY_SIZE(mmc1_resources),
416};
417
418/* Consider only one slot : slot 0 */
419void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
420{
421
422 if (!data)
423 return;
424
425 /* Must have at least one usable slot */
426 if (!data->slot[0].bus_width)
427 return;
428
429#if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
430 {
431 struct at_dma_slave *atslave;
432 struct mci_dma_data *alt_atslave;
433
434 alt_atslave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
435 atslave = &alt_atslave->sdata;
436
437 /* DMA slave channel configuration */
438 atslave->dma_dev = &at_hdmac_device.dev;
439 atslave->cfg = ATC_FIFOCFG_HALFFIFO
440 | ATC_SRC_H2SEL_HW | ATC_DST_H2SEL_HW;
441 if (mmc_id == 0) /* MCI0 */
442 atslave->cfg |= ATC_SRC_PER(AT_DMA_ID_MCI0)
443 | ATC_DST_PER(AT_DMA_ID_MCI0);
444
445 else /* MCI1 */
446 atslave->cfg |= ATC_SRC_PER(AT_DMA_ID_MCI1)
447 | ATC_DST_PER(AT_DMA_ID_MCI1);
448
449 data->dma_slave = alt_atslave;
450 }
451#endif
452
453
454 /* input/irq */
455 if (gpio_is_valid(data->slot[0].detect_pin)) {
456 at91_set_gpio_input(data->slot[0].detect_pin, 1);
457 at91_set_deglitch(data->slot[0].detect_pin, 1);
458 }
459 if (gpio_is_valid(data->slot[0].wp_pin))
460 at91_set_gpio_input(data->slot[0].wp_pin, 1);
461
462 if (mmc_id == 0) { /* MCI0 */
463
464 /* CLK */
465 at91_set_A_periph(AT91_PIN_PA0, 0);
466
467 /* CMD */
468 at91_set_A_periph(AT91_PIN_PA1, 1);
469
470 /* DAT0, maybe DAT1..DAT3 and maybe DAT4..DAT7 */
471 at91_set_A_periph(AT91_PIN_PA2, 1);
472 if (data->slot[0].bus_width == 4) {
473 at91_set_A_periph(AT91_PIN_PA3, 1);
474 at91_set_A_periph(AT91_PIN_PA4, 1);
475 at91_set_A_periph(AT91_PIN_PA5, 1);
476 if (data->slot[0].bus_width == 8) {
477 at91_set_A_periph(AT91_PIN_PA6, 1);
478 at91_set_A_periph(AT91_PIN_PA7, 1);
479 at91_set_A_periph(AT91_PIN_PA8, 1);
480 at91_set_A_periph(AT91_PIN_PA9, 1);
481 }
482 }
483
484 mmc0_data = *data;
485 platform_device_register(&at91sam9g45_mmc0_device);
486
487 } else { /* MCI1 */
488
489 /* CLK */
490 at91_set_A_periph(AT91_PIN_PA31, 0);
491
492 /* CMD */
493 at91_set_A_periph(AT91_PIN_PA22, 1);
494
495 /* DAT0, maybe DAT1..DAT3 and maybe DAT4..DAT7 */
496 at91_set_A_periph(AT91_PIN_PA23, 1);
497 if (data->slot[0].bus_width == 4) {
498 at91_set_A_periph(AT91_PIN_PA24, 1);
499 at91_set_A_periph(AT91_PIN_PA25, 1);
500 at91_set_A_periph(AT91_PIN_PA26, 1);
501 if (data->slot[0].bus_width == 8) {
502 at91_set_A_periph(AT91_PIN_PA27, 1);
503 at91_set_A_periph(AT91_PIN_PA28, 1);
504 at91_set_A_periph(AT91_PIN_PA29, 1);
505 at91_set_A_periph(AT91_PIN_PA30, 1);
506 }
507 }
508
509 mmc1_data = *data;
510 platform_device_register(&at91sam9g45_mmc1_device);
511
512 }
513}
514#else
515void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
516#endif
517
518
519/* --------------------------------------------------------------------
520 * NAND / SmartMedia
521 * -------------------------------------------------------------------- */
522
523#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
524static struct atmel_nand_data nand_data;
525
526#define NAND_BASE AT91_CHIPSELECT_3
527
528static struct resource nand_resources[] = {
529 [0] = {
530 .start = NAND_BASE,
531 .end = NAND_BASE + SZ_256M - 1,
532 .flags = IORESOURCE_MEM,
533 },
534 [1] = {
535 .start = AT91SAM9G45_BASE_ECC,
536 .end = AT91SAM9G45_BASE_ECC + SZ_512 - 1,
537 .flags = IORESOURCE_MEM,
538 }
539};
540
541static struct platform_device at91sam9g45_nand_device = {
542 .name = "atmel_nand",
543 .id = -1,
544 .dev = {
545 .platform_data = &nand_data,
546 },
547 .resource = nand_resources,
548 .num_resources = ARRAY_SIZE(nand_resources),
549};
550
551void __init at91_add_device_nand(struct atmel_nand_data *data)
552{
553 unsigned long csa;
554
555 if (!data)
556 return;
557
558 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
559 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
560
561 /* enable pin */
562 if (gpio_is_valid(data->enable_pin))
563 at91_set_gpio_output(data->enable_pin, 1);
564
565 /* ready/busy pin */
566 if (gpio_is_valid(data->rdy_pin))
567 at91_set_gpio_input(data->rdy_pin, 1);
568
569 /* card detect pin */
570 if (gpio_is_valid(data->det_pin))
571 at91_set_gpio_input(data->det_pin, 1);
572
573 nand_data = *data;
574 platform_device_register(&at91sam9g45_nand_device);
575}
576#else
577void __init at91_add_device_nand(struct atmel_nand_data *data) {}
578#endif
579
580
581/* --------------------------------------------------------------------
582 * TWI (i2c)
583 * -------------------------------------------------------------------- */
584
585/*
586 * Prefer the GPIO code since the TWI controller isn't robust
587 * (gets overruns and underruns under load) and can only issue
588 * repeated STARTs in one scenario (the driver doesn't yet handle them).
589 */
590#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
591static struct i2c_gpio_platform_data pdata_i2c0 = {
592 .sda_pin = AT91_PIN_PA20,
593 .sda_is_open_drain = 1,
594 .scl_pin = AT91_PIN_PA21,
595 .scl_is_open_drain = 1,
596 .udelay = 5, /* ~100 kHz */
597};
598
599static struct platform_device at91sam9g45_twi0_device = {
600 .name = "i2c-gpio",
601 .id = 0,
602 .dev.platform_data = &pdata_i2c0,
603};
604
605static struct i2c_gpio_platform_data pdata_i2c1 = {
606 .sda_pin = AT91_PIN_PB10,
607 .sda_is_open_drain = 1,
608 .scl_pin = AT91_PIN_PB11,
609 .scl_is_open_drain = 1,
610 .udelay = 5, /* ~100 kHz */
611};
612
613static struct platform_device at91sam9g45_twi1_device = {
614 .name = "i2c-gpio",
615 .id = 1,
616 .dev.platform_data = &pdata_i2c1,
617};
618
619void __init at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, int nr_devices)
620{
621 i2c_register_board_info(i2c_id, devices, nr_devices);
622
623 if (i2c_id == 0) {
624 at91_set_GPIO_periph(AT91_PIN_PA20, 1); /* TWD (SDA) */
625 at91_set_multi_drive(AT91_PIN_PA20, 1);
626
627 at91_set_GPIO_periph(AT91_PIN_PA21, 1); /* TWCK (SCL) */
628 at91_set_multi_drive(AT91_PIN_PA21, 1);
629
630 platform_device_register(&at91sam9g45_twi0_device);
631 } else {
632 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* TWD (SDA) */
633 at91_set_multi_drive(AT91_PIN_PB10, 1);
634
635 at91_set_GPIO_periph(AT91_PIN_PB11, 1); /* TWCK (SCL) */
636 at91_set_multi_drive(AT91_PIN_PB11, 1);
637
638 platform_device_register(&at91sam9g45_twi1_device);
639 }
640}
641
642#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
643static struct resource twi0_resources[] = {
644 [0] = {
645 .start = AT91SAM9G45_BASE_TWI0,
646 .end = AT91SAM9G45_BASE_TWI0 + SZ_16K - 1,
647 .flags = IORESOURCE_MEM,
648 },
649 [1] = {
650 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TWI0,
651 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TWI0,
652 .flags = IORESOURCE_IRQ,
653 },
654};
655
656static struct platform_device at91sam9g45_twi0_device = {
657 .name = "i2c-at91sam9g10",
658 .id = 0,
659 .resource = twi0_resources,
660 .num_resources = ARRAY_SIZE(twi0_resources),
661};
662
663static struct resource twi1_resources[] = {
664 [0] = {
665 .start = AT91SAM9G45_BASE_TWI1,
666 .end = AT91SAM9G45_BASE_TWI1 + SZ_16K - 1,
667 .flags = IORESOURCE_MEM,
668 },
669 [1] = {
670 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TWI1,
671 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TWI1,
672 .flags = IORESOURCE_IRQ,
673 },
674};
675
676static struct platform_device at91sam9g45_twi1_device = {
677 .name = "i2c-at91sam9g10",
678 .id = 1,
679 .resource = twi1_resources,
680 .num_resources = ARRAY_SIZE(twi1_resources),
681};
682
683void __init at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, int nr_devices)
684{
685 i2c_register_board_info(i2c_id, devices, nr_devices);
686
687 /* pins used for TWI interface */
688 if (i2c_id == 0) {
689 at91_set_A_periph(AT91_PIN_PA20, 0); /* TWD */
690 at91_set_A_periph(AT91_PIN_PA21, 0); /* TWCK */
691
692 platform_device_register(&at91sam9g45_twi0_device);
693 } else {
694 at91_set_A_periph(AT91_PIN_PB10, 0); /* TWD */
695 at91_set_A_periph(AT91_PIN_PB11, 0); /* TWCK */
696
697 platform_device_register(&at91sam9g45_twi1_device);
698 }
699}
700#else
701void __init at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, int nr_devices) {}
702#endif
703
704
705/* --------------------------------------------------------------------
706 * SPI
707 * -------------------------------------------------------------------- */
708
709#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
710static u64 spi_dmamask = DMA_BIT_MASK(32);
711
712static struct resource spi0_resources[] = {
713 [0] = {
714 .start = AT91SAM9G45_BASE_SPI0,
715 .end = AT91SAM9G45_BASE_SPI0 + SZ_16K - 1,
716 .flags = IORESOURCE_MEM,
717 },
718 [1] = {
719 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_SPI0,
720 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_SPI0,
721 .flags = IORESOURCE_IRQ,
722 },
723};
724
725static struct platform_device at91sam9g45_spi0_device = {
726 .name = "atmel_spi",
727 .id = 0,
728 .dev = {
729 .dma_mask = &spi_dmamask,
730 .coherent_dma_mask = DMA_BIT_MASK(32),
731 },
732 .resource = spi0_resources,
733 .num_resources = ARRAY_SIZE(spi0_resources),
734};
735
736static const unsigned spi0_standard_cs[4] = { AT91_PIN_PB3, AT91_PIN_PB18, AT91_PIN_PB19, AT91_PIN_PD27 };
737
738static struct resource spi1_resources[] = {
739 [0] = {
740 .start = AT91SAM9G45_BASE_SPI1,
741 .end = AT91SAM9G45_BASE_SPI1 + SZ_16K - 1,
742 .flags = IORESOURCE_MEM,
743 },
744 [1] = {
745 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_SPI1,
746 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_SPI1,
747 .flags = IORESOURCE_IRQ,
748 },
749};
750
751static struct platform_device at91sam9g45_spi1_device = {
752 .name = "atmel_spi",
753 .id = 1,
754 .dev = {
755 .dma_mask = &spi_dmamask,
756 .coherent_dma_mask = DMA_BIT_MASK(32),
757 },
758 .resource = spi1_resources,
759 .num_resources = ARRAY_SIZE(spi1_resources),
760};
761
762static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB17, AT91_PIN_PD28, AT91_PIN_PD18, AT91_PIN_PD19 };
763
764void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
765{
766 int i;
767 unsigned long cs_pin;
768 short enable_spi0 = 0;
769 short enable_spi1 = 0;
770
771 /* Choose SPI chip-selects */
772 for (i = 0; i < nr_devices; i++) {
773 if (devices[i].controller_data)
774 cs_pin = (unsigned long) devices[i].controller_data;
775 else if (devices[i].bus_num == 0)
776 cs_pin = spi0_standard_cs[devices[i].chip_select];
777 else
778 cs_pin = spi1_standard_cs[devices[i].chip_select];
779
780 if (!gpio_is_valid(cs_pin))
781 continue;
782
783 if (devices[i].bus_num == 0)
784 enable_spi0 = 1;
785 else
786 enable_spi1 = 1;
787
788 /* enable chip-select pin */
789 at91_set_gpio_output(cs_pin, 1);
790
791 /* pass chip-select pin to driver */
792 devices[i].controller_data = (void *) cs_pin;
793 }
794
795 spi_register_board_info(devices, nr_devices);
796
797 /* Configure SPI bus(es) */
798 if (enable_spi0) {
799 at91_set_A_periph(AT91_PIN_PB0, 0); /* SPI0_MISO */
800 at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI0_MOSI */
801 at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI0_SPCK */
802
803 platform_device_register(&at91sam9g45_spi0_device);
804 }
805 if (enable_spi1) {
806 at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_MISO */
807 at91_set_A_periph(AT91_PIN_PB15, 0); /* SPI1_MOSI */
808 at91_set_A_periph(AT91_PIN_PB16, 0); /* SPI1_SPCK */
809
810 platform_device_register(&at91sam9g45_spi1_device);
811 }
812}
813#else
814void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
815#endif
816
817
818/* --------------------------------------------------------------------
819 * AC97
820 * -------------------------------------------------------------------- */
821
822#if defined(CONFIG_SND_ATMEL_AC97C) || defined(CONFIG_SND_ATMEL_AC97C_MODULE)
823static u64 ac97_dmamask = DMA_BIT_MASK(32);
824static struct ac97c_platform_data ac97_data;
825
826static struct resource ac97_resources[] = {
827 [0] = {
828 .start = AT91SAM9G45_BASE_AC97C,
829 .end = AT91SAM9G45_BASE_AC97C + SZ_16K - 1,
830 .flags = IORESOURCE_MEM,
831 },
832 [1] = {
833 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AC97C,
834 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AC97C,
835 .flags = IORESOURCE_IRQ,
836 },
837};
838
839static struct platform_device at91sam9g45_ac97_device = {
840 .name = "atmel_ac97c",
841 .id = 0,
842 .dev = {
843 .dma_mask = &ac97_dmamask,
844 .coherent_dma_mask = DMA_BIT_MASK(32),
845 .platform_data = &ac97_data,
846 },
847 .resource = ac97_resources,
848 .num_resources = ARRAY_SIZE(ac97_resources),
849};
850
851void __init at91_add_device_ac97(struct ac97c_platform_data *data)
852{
853 if (!data)
854 return;
855
856 at91_set_A_periph(AT91_PIN_PD8, 0); /* AC97FS */
857 at91_set_A_periph(AT91_PIN_PD9, 0); /* AC97CK */
858 at91_set_A_periph(AT91_PIN_PD7, 0); /* AC97TX */
859 at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */
860
861 /* reset */
862 if (gpio_is_valid(data->reset_pin))
863 at91_set_gpio_output(data->reset_pin, 0);
864
865 ac97_data = *data;
866 platform_device_register(&at91sam9g45_ac97_device);
867}
868#else
869void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
870#endif
871
872/* --------------------------------------------------------------------
873 * Image Sensor Interface
874 * -------------------------------------------------------------------- */
875#if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE)
876static u64 isi_dmamask = DMA_BIT_MASK(32);
877static struct isi_platform_data isi_data;
878
879struct resource isi_resources[] = {
880 [0] = {
881 .start = AT91SAM9G45_BASE_ISI,
882 .end = AT91SAM9G45_BASE_ISI + SZ_16K - 1,
883 .flags = IORESOURCE_MEM,
884 },
885 [1] = {
886 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_ISI,
887 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_ISI,
888 .flags = IORESOURCE_IRQ,
889 },
890};
891
892static struct platform_device at91sam9g45_isi_device = {
893 .name = "atmel_isi",
894 .id = 0,
895 .dev = {
896 .dma_mask = &isi_dmamask,
897 .coherent_dma_mask = DMA_BIT_MASK(32),
898 .platform_data = &isi_data,
899 },
900 .resource = isi_resources,
901 .num_resources = ARRAY_SIZE(isi_resources),
902};
903
904static struct clk_lookup isi_mck_lookups[] = {
905 CLKDEV_CON_DEV_ID("isi_mck", "atmel_isi.0", NULL),
906};
907
908void __init at91_add_device_isi(struct isi_platform_data *data,
909 bool use_pck_as_mck)
910{
911 struct clk *pck;
912 struct clk *parent;
913
914 if (!data)
915 return;
916 isi_data = *data;
917
918 at91_set_A_periph(AT91_PIN_PB20, 0); /* ISI_D0 */
919 at91_set_A_periph(AT91_PIN_PB21, 0); /* ISI_D1 */
920 at91_set_A_periph(AT91_PIN_PB22, 0); /* ISI_D2 */
921 at91_set_A_periph(AT91_PIN_PB23, 0); /* ISI_D3 */
922 at91_set_A_periph(AT91_PIN_PB24, 0); /* ISI_D4 */
923 at91_set_A_periph(AT91_PIN_PB25, 0); /* ISI_D5 */
924 at91_set_A_periph(AT91_PIN_PB26, 0); /* ISI_D6 */
925 at91_set_A_periph(AT91_PIN_PB27, 0); /* ISI_D7 */
926 at91_set_A_periph(AT91_PIN_PB28, 0); /* ISI_PCK */
927 at91_set_A_periph(AT91_PIN_PB30, 0); /* ISI_HSYNC */
928 at91_set_A_periph(AT91_PIN_PB29, 0); /* ISI_VSYNC */
929 at91_set_B_periph(AT91_PIN_PB8, 0); /* ISI_PD8 */
930 at91_set_B_periph(AT91_PIN_PB9, 0); /* ISI_PD9 */
931 at91_set_B_periph(AT91_PIN_PB10, 0); /* ISI_PD10 */
932 at91_set_B_periph(AT91_PIN_PB11, 0); /* ISI_PD11 */
933
934 platform_device_register(&at91sam9g45_isi_device);
935
936 if (use_pck_as_mck) {
937 at91_set_B_periph(AT91_PIN_PB31, 0); /* ISI_MCK (PCK1) */
938
939 pck = clk_get(NULL, "pck1");
940 parent = clk_get(NULL, "plla");
941
942 BUG_ON(IS_ERR(pck) || IS_ERR(parent));
943
944 if (clk_set_parent(pck, parent)) {
945 pr_err("Failed to set PCK's parent\n");
946 } else {
947 /* Register PCK as ISI_MCK */
948 isi_mck_lookups[0].clk = pck;
949 clkdev_add_table(isi_mck_lookups,
950 ARRAY_SIZE(isi_mck_lookups));
951 }
952
953 clk_put(pck);
954 clk_put(parent);
955 }
956}
957#else
958void __init at91_add_device_isi(struct isi_platform_data *data,
959 bool use_pck_as_mck) {}
960#endif
961
962
963/* --------------------------------------------------------------------
964 * LCD Controller
965 * -------------------------------------------------------------------- */
966
967#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
968static u64 lcdc_dmamask = DMA_BIT_MASK(32);
969static struct atmel_lcdfb_pdata lcdc_data;
970
971static struct resource lcdc_resources[] = {
972 [0] = {
973 .start = AT91SAM9G45_LCDC_BASE,
974 .end = AT91SAM9G45_LCDC_BASE + SZ_4K - 1,
975 .flags = IORESOURCE_MEM,
976 },
977 [1] = {
978 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_LCDC,
979 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_LCDC,
980 .flags = IORESOURCE_IRQ,
981 },
982};
983
984static struct platform_device at91_lcdc_device = {
985 .id = 0,
986 .dev = {
987 .dma_mask = &lcdc_dmamask,
988 .coherent_dma_mask = DMA_BIT_MASK(32),
989 .platform_data = &lcdc_data,
990 },
991 .resource = lcdc_resources,
992 .num_resources = ARRAY_SIZE(lcdc_resources),
993};
994
995void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
996{
997 if (!data)
998 return;
999
1000 if (cpu_is_at91sam9g45es())
1001 at91_lcdc_device.name = "at91sam9g45es-lcdfb";
1002 else
1003 at91_lcdc_device.name = "at91sam9g45-lcdfb";
1004
1005 at91_set_A_periph(AT91_PIN_PE0, 0); /* LCDDPWR */
1006
1007 at91_set_A_periph(AT91_PIN_PE2, 0); /* LCDCC */
1008 at91_set_A_periph(AT91_PIN_PE3, 0); /* LCDVSYNC */
1009 at91_set_A_periph(AT91_PIN_PE4, 0); /* LCDHSYNC */
1010 at91_set_A_periph(AT91_PIN_PE5, 0); /* LCDDOTCK */
1011 at91_set_A_periph(AT91_PIN_PE6, 0); /* LCDDEN */
1012 at91_set_A_periph(AT91_PIN_PE7, 0); /* LCDD0 */
1013 at91_set_A_periph(AT91_PIN_PE8, 0); /* LCDD1 */
1014 at91_set_A_periph(AT91_PIN_PE9, 0); /* LCDD2 */
1015 at91_set_A_periph(AT91_PIN_PE10, 0); /* LCDD3 */
1016 at91_set_A_periph(AT91_PIN_PE11, 0); /* LCDD4 */
1017 at91_set_A_periph(AT91_PIN_PE12, 0); /* LCDD5 */
1018 at91_set_A_periph(AT91_PIN_PE13, 0); /* LCDD6 */
1019 at91_set_A_periph(AT91_PIN_PE14, 0); /* LCDD7 */
1020 at91_set_A_periph(AT91_PIN_PE15, 0); /* LCDD8 */
1021 at91_set_A_periph(AT91_PIN_PE16, 0); /* LCDD9 */
1022 at91_set_A_periph(AT91_PIN_PE17, 0); /* LCDD10 */
1023 at91_set_A_periph(AT91_PIN_PE18, 0); /* LCDD11 */
1024 at91_set_A_periph(AT91_PIN_PE19, 0); /* LCDD12 */
1025 at91_set_A_periph(AT91_PIN_PE20, 0); /* LCDD13 */
1026 at91_set_A_periph(AT91_PIN_PE21, 0); /* LCDD14 */
1027 at91_set_A_periph(AT91_PIN_PE22, 0); /* LCDD15 */
1028 at91_set_A_periph(AT91_PIN_PE23, 0); /* LCDD16 */
1029 at91_set_A_periph(AT91_PIN_PE24, 0); /* LCDD17 */
1030 at91_set_A_periph(AT91_PIN_PE25, 0); /* LCDD18 */
1031 at91_set_A_periph(AT91_PIN_PE26, 0); /* LCDD19 */
1032 at91_set_A_periph(AT91_PIN_PE27, 0); /* LCDD20 */
1033 at91_set_A_periph(AT91_PIN_PE28, 0); /* LCDD21 */
1034 at91_set_A_periph(AT91_PIN_PE29, 0); /* LCDD22 */
1035 at91_set_A_periph(AT91_PIN_PE30, 0); /* LCDD23 */
1036
1037 lcdc_data = *data;
1038 platform_device_register(&at91_lcdc_device);
1039}
1040#else
1041void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
1042#endif
1043
1044
1045/* --------------------------------------------------------------------
1046 * Timer/Counter block
1047 * -------------------------------------------------------------------- */
1048
1049#ifdef CONFIG_ATMEL_TCLIB
1050static struct resource tcb0_resources[] = {
1051 [0] = {
1052 .start = AT91SAM9G45_BASE_TCB0,
1053 .end = AT91SAM9G45_BASE_TCB0 + SZ_256 - 1,
1054 .flags = IORESOURCE_MEM,
1055 },
1056 [1] = {
1057 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TCB,
1058 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TCB,
1059 .flags = IORESOURCE_IRQ,
1060 },
1061};
1062
1063static struct platform_device at91sam9g45_tcb0_device = {
1064 .name = "atmel_tcb",
1065 .id = 0,
1066 .resource = tcb0_resources,
1067 .num_resources = ARRAY_SIZE(tcb0_resources),
1068};
1069
1070/* TCB1 begins with TC3 */
1071static struct resource tcb1_resources[] = {
1072 [0] = {
1073 .start = AT91SAM9G45_BASE_TCB1,
1074 .end = AT91SAM9G45_BASE_TCB1 + SZ_256 - 1,
1075 .flags = IORESOURCE_MEM,
1076 },
1077 [1] = {
1078 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TCB,
1079 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TCB,
1080 .flags = IORESOURCE_IRQ,
1081 },
1082};
1083
1084static struct platform_device at91sam9g45_tcb1_device = {
1085 .name = "atmel_tcb",
1086 .id = 1,
1087 .resource = tcb1_resources,
1088 .num_resources = ARRAY_SIZE(tcb1_resources),
1089};
1090
1091static void __init at91_add_device_tc(void)
1092{
1093 platform_device_register(&at91sam9g45_tcb0_device);
1094 platform_device_register(&at91sam9g45_tcb1_device);
1095}
1096#else
1097static void __init at91_add_device_tc(void) { }
1098#endif
1099
1100
1101/* --------------------------------------------------------------------
1102 * RTC
1103 * -------------------------------------------------------------------- */
1104
1105#if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
1106static struct resource rtc_resources[] = {
1107 [0] = {
1108 .start = AT91SAM9G45_BASE_RTC,
1109 .end = AT91SAM9G45_BASE_RTC + SZ_256 - 1,
1110 .flags = IORESOURCE_MEM,
1111 },
1112 [1] = {
1113 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
1114 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
1115 .flags = IORESOURCE_IRQ,
1116 },
1117};
1118
1119static struct platform_device at91sam9g45_rtc_device = {
1120 .name = "at91_rtc",
1121 .id = -1,
1122 .resource = rtc_resources,
1123 .num_resources = ARRAY_SIZE(rtc_resources),
1124};
1125
1126static void __init at91_add_device_rtc(void)
1127{
1128 platform_device_register(&at91sam9g45_rtc_device);
1129}
1130#else
1131static void __init at91_add_device_rtc(void) {}
1132#endif
1133
1134
1135/* --------------------------------------------------------------------
1136 * ADC and touchscreen
1137 * -------------------------------------------------------------------- */
1138
1139#if IS_ENABLED(CONFIG_AT91_ADC)
1140static struct at91_adc_data adc_data;
1141
1142static struct resource adc_resources[] = {
1143 [0] = {
1144 .start = AT91SAM9G45_BASE_TSC,
1145 .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
1146 .flags = IORESOURCE_MEM,
1147 },
1148 [1] = {
1149 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TSC,
1150 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TSC,
1151 .flags = IORESOURCE_IRQ,
1152 }
1153};
1154
1155static struct platform_device at91_adc_device = {
1156 .name = "at91sam9g45-adc",
1157 .id = -1,
1158 .dev = {
1159 .platform_data = &adc_data,
1160 },
1161 .resource = adc_resources,
1162 .num_resources = ARRAY_SIZE(adc_resources),
1163};
1164
1165static struct at91_adc_trigger at91_adc_triggers[] = {
1166 [0] = {
1167 .name = "external-rising",
1168 .value = 1,
1169 .is_external = true,
1170 },
1171 [1] = {
1172 .name = "external-falling",
1173 .value = 2,
1174 .is_external = true,
1175 },
1176 [2] = {
1177 .name = "external-any",
1178 .value = 3,
1179 .is_external = true,
1180 },
1181 [3] = {
1182 .name = "continuous",
1183 .value = 6,
1184 .is_external = false,
1185 },
1186};
1187
1188void __init at91_add_device_adc(struct at91_adc_data *data)
1189{
1190 if (!data)
1191 return;
1192
1193 if (test_bit(0, &data->channels_used))
1194 at91_set_gpio_input(AT91_PIN_PD20, 0);
1195 if (test_bit(1, &data->channels_used))
1196 at91_set_gpio_input(AT91_PIN_PD21, 0);
1197 if (test_bit(2, &data->channels_used))
1198 at91_set_gpio_input(AT91_PIN_PD22, 0);
1199 if (test_bit(3, &data->channels_used))
1200 at91_set_gpio_input(AT91_PIN_PD23, 0);
1201 if (test_bit(4, &data->channels_used))
1202 at91_set_gpio_input(AT91_PIN_PD24, 0);
1203 if (test_bit(5, &data->channels_used))
1204 at91_set_gpio_input(AT91_PIN_PD25, 0);
1205 if (test_bit(6, &data->channels_used))
1206 at91_set_gpio_input(AT91_PIN_PD26, 0);
1207 if (test_bit(7, &data->channels_used))
1208 at91_set_gpio_input(AT91_PIN_PD27, 0);
1209
1210 if (data->use_external_triggers)
1211 at91_set_A_periph(AT91_PIN_PD28, 0);
1212
1213 data->startup_time = 40;
1214 data->trigger_number = 4;
1215 data->trigger_list = at91_adc_triggers;
1216
1217 adc_data = *data;
1218 platform_device_register(&at91_adc_device);
1219}
1220#else
1221void __init at91_add_device_adc(struct at91_adc_data *data) {}
1222#endif
1223
1224/* --------------------------------------------------------------------
1225 * RTT
1226 * -------------------------------------------------------------------- */
1227
1228static struct resource rtt_resources[] = {
1229 {
1230 .start = AT91SAM9G45_BASE_RTT,
1231 .end = AT91SAM9G45_BASE_RTT + SZ_16 - 1,
1232 .flags = IORESOURCE_MEM,
1233 }, {
1234 .flags = IORESOURCE_MEM,
1235 }, {
1236 .flags = IORESOURCE_IRQ,
1237 }
1238};
1239
1240static struct platform_device at91sam9g45_rtt_device = {
1241 .name = "at91_rtt",
1242 .id = 0,
1243 .resource = rtt_resources,
1244};
1245
1246#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
1247static void __init at91_add_device_rtt_rtc(void)
1248{
1249 at91sam9g45_rtt_device.name = "rtc-at91sam9";
1250 /*
1251 * The second resource is needed:
1252 * GPBR will serve as the storage for RTC time offset
1253 */
1254 at91sam9g45_rtt_device.num_resources = 3;
1255 rtt_resources[1].start = AT91SAM9G45_BASE_GPBR +
1256 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
1257 rtt_resources[1].end = rtt_resources[1].start + 3;
1258 rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
1259 rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
1260}
1261#else
1262static void __init at91_add_device_rtt_rtc(void)
1263{
1264 /* Only one resource is needed: RTT not used as RTC */
1265 at91sam9g45_rtt_device.num_resources = 1;
1266}
1267#endif
1268
1269static void __init at91_add_device_rtt(void)
1270{
1271 at91_add_device_rtt_rtc();
1272 platform_device_register(&at91sam9g45_rtt_device);
1273}
1274
1275
1276/* --------------------------------------------------------------------
1277 * TRNG
1278 * -------------------------------------------------------------------- */
1279
1280#if defined(CONFIG_HW_RANDOM_ATMEL) || defined(CONFIG_HW_RANDOM_ATMEL_MODULE)
1281static struct resource trng_resources[] = {
1282 {
1283 .start = AT91SAM9G45_BASE_TRNG,
1284 .end = AT91SAM9G45_BASE_TRNG + SZ_16K - 1,
1285 .flags = IORESOURCE_MEM,
1286 },
1287};
1288
1289static struct platform_device at91sam9g45_trng_device = {
1290 .name = "atmel-trng",
1291 .id = -1,
1292 .resource = trng_resources,
1293 .num_resources = ARRAY_SIZE(trng_resources),
1294};
1295
1296static void __init at91_add_device_trng(void)
1297{
1298 platform_device_register(&at91sam9g45_trng_device);
1299}
1300#else
1301static void __init at91_add_device_trng(void) {}
1302#endif
1303
1304/* --------------------------------------------------------------------
1305 * Watchdog
1306 * -------------------------------------------------------------------- */
1307
1308#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
1309static struct resource wdt_resources[] = {
1310 {
1311 .start = AT91SAM9G45_BASE_WDT,
1312 .end = AT91SAM9G45_BASE_WDT + SZ_16 - 1,
1313 .flags = IORESOURCE_MEM,
1314 }
1315};
1316
1317static struct platform_device at91sam9g45_wdt_device = {
1318 .name = "at91_wdt",
1319 .id = -1,
1320 .resource = wdt_resources,
1321 .num_resources = ARRAY_SIZE(wdt_resources),
1322};
1323
1324static void __init at91_add_device_watchdog(void)
1325{
1326 platform_device_register(&at91sam9g45_wdt_device);
1327}
1328#else
1329static void __init at91_add_device_watchdog(void) {}
1330#endif
1331
1332
1333/* --------------------------------------------------------------------
1334 * PWM
1335 * --------------------------------------------------------------------*/
1336
1337#if IS_ENABLED(CONFIG_PWM_ATMEL)
1338static struct resource pwm_resources[] = {
1339 [0] = {
1340 .start = AT91SAM9G45_BASE_PWMC,
1341 .end = AT91SAM9G45_BASE_PWMC + SZ_16K - 1,
1342 .flags = IORESOURCE_MEM,
1343 },
1344 [1] = {
1345 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_PWMC,
1346 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_PWMC,
1347 .flags = IORESOURCE_IRQ,
1348 },
1349};
1350
1351static struct platform_device at91sam9g45_pwm0_device = {
1352 .name = "at91sam9rl-pwm",
1353 .id = -1,
1354 .resource = pwm_resources,
1355 .num_resources = ARRAY_SIZE(pwm_resources),
1356};
1357
1358void __init at91_add_device_pwm(u32 mask)
1359{
1360 if (mask & (1 << AT91_PWM0))
1361 at91_set_B_periph(AT91_PIN_PD24, 1); /* enable PWM0 */
1362
1363 if (mask & (1 << AT91_PWM1))
1364 at91_set_B_periph(AT91_PIN_PD31, 1); /* enable PWM1 */
1365
1366 if (mask & (1 << AT91_PWM2))
1367 at91_set_B_periph(AT91_PIN_PD26, 1); /* enable PWM2 */
1368
1369 if (mask & (1 << AT91_PWM3))
1370 at91_set_B_periph(AT91_PIN_PD0, 1); /* enable PWM3 */
1371
1372 platform_device_register(&at91sam9g45_pwm0_device);
1373}
1374#else
1375void __init at91_add_device_pwm(u32 mask) {}
1376#endif
1377
1378
1379/* --------------------------------------------------------------------
1380 * SSC -- Synchronous Serial Controller
1381 * -------------------------------------------------------------------- */
1382
1383#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
1384static u64 ssc0_dmamask = DMA_BIT_MASK(32);
1385
1386static struct resource ssc0_resources[] = {
1387 [0] = {
1388 .start = AT91SAM9G45_BASE_SSC0,
1389 .end = AT91SAM9G45_BASE_SSC0 + SZ_16K - 1,
1390 .flags = IORESOURCE_MEM,
1391 },
1392 [1] = {
1393 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_SSC0,
1394 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_SSC0,
1395 .flags = IORESOURCE_IRQ,
1396 },
1397};
1398
1399static struct platform_device at91sam9g45_ssc0_device = {
1400 .name = "at91sam9g45_ssc",
1401 .id = 0,
1402 .dev = {
1403 .dma_mask = &ssc0_dmamask,
1404 .coherent_dma_mask = DMA_BIT_MASK(32),
1405 },
1406 .resource = ssc0_resources,
1407 .num_resources = ARRAY_SIZE(ssc0_resources),
1408};
1409
1410static inline void configure_ssc0_pins(unsigned pins)
1411{
1412 if (pins & ATMEL_SSC_TF)
1413 at91_set_A_periph(AT91_PIN_PD1, 1);
1414 if (pins & ATMEL_SSC_TK)
1415 at91_set_A_periph(AT91_PIN_PD0, 1);
1416 if (pins & ATMEL_SSC_TD)
1417 at91_set_A_periph(AT91_PIN_PD2, 1);
1418 if (pins & ATMEL_SSC_RD)
1419 at91_set_A_periph(AT91_PIN_PD3, 1);
1420 if (pins & ATMEL_SSC_RK)
1421 at91_set_A_periph(AT91_PIN_PD4, 1);
1422 if (pins & ATMEL_SSC_RF)
1423 at91_set_A_periph(AT91_PIN_PD5, 1);
1424}
1425
1426static u64 ssc1_dmamask = DMA_BIT_MASK(32);
1427
1428static struct resource ssc1_resources[] = {
1429 [0] = {
1430 .start = AT91SAM9G45_BASE_SSC1,
1431 .end = AT91SAM9G45_BASE_SSC1 + SZ_16K - 1,
1432 .flags = IORESOURCE_MEM,
1433 },
1434 [1] = {
1435 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_SSC1,
1436 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_SSC1,
1437 .flags = IORESOURCE_IRQ,
1438 },
1439};
1440
1441static struct platform_device at91sam9g45_ssc1_device = {
1442 .name = "at91sam9g45_ssc",
1443 .id = 1,
1444 .dev = {
1445 .dma_mask = &ssc1_dmamask,
1446 .coherent_dma_mask = DMA_BIT_MASK(32),
1447 },
1448 .resource = ssc1_resources,
1449 .num_resources = ARRAY_SIZE(ssc1_resources),
1450};
1451
1452static inline void configure_ssc1_pins(unsigned pins)
1453{
1454 if (pins & ATMEL_SSC_TF)
1455 at91_set_A_periph(AT91_PIN_PD14, 1);
1456 if (pins & ATMEL_SSC_TK)
1457 at91_set_A_periph(AT91_PIN_PD12, 1);
1458 if (pins & ATMEL_SSC_TD)
1459 at91_set_A_periph(AT91_PIN_PD10, 1);
1460 if (pins & ATMEL_SSC_RD)
1461 at91_set_A_periph(AT91_PIN_PD11, 1);
1462 if (pins & ATMEL_SSC_RK)
1463 at91_set_A_periph(AT91_PIN_PD13, 1);
1464 if (pins & ATMEL_SSC_RF)
1465 at91_set_A_periph(AT91_PIN_PD15, 1);
1466}
1467
1468/*
1469 * SSC controllers are accessed through library code, instead of any
1470 * kind of all-singing/all-dancing driver. For example one could be
1471 * used by a particular I2S audio codec's driver, while another one
1472 * on the same system might be used by a custom data capture driver.
1473 */
1474void __init at91_add_device_ssc(unsigned id, unsigned pins)
1475{
1476 struct platform_device *pdev;
1477
1478 /*
1479 * NOTE: caller is responsible for passing information matching
1480 * "pins" to whatever will be using each particular controller.
1481 */
1482 switch (id) {
1483 case AT91SAM9G45_ID_SSC0:
1484 pdev = &at91sam9g45_ssc0_device;
1485 configure_ssc0_pins(pins);
1486 break;
1487 case AT91SAM9G45_ID_SSC1:
1488 pdev = &at91sam9g45_ssc1_device;
1489 configure_ssc1_pins(pins);
1490 break;
1491 default:
1492 return;
1493 }
1494
1495 platform_device_register(pdev);
1496}
1497
1498#else
1499void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
1500#endif
1501
1502
1503/* --------------------------------------------------------------------
1504 * UART
1505 * -------------------------------------------------------------------- */
1506
1507#if defined(CONFIG_SERIAL_ATMEL)
1508static struct resource dbgu_resources[] = {
1509 [0] = {
1510 .start = AT91SAM9G45_BASE_DBGU,
1511 .end = AT91SAM9G45_BASE_DBGU + SZ_512 - 1,
1512 .flags = IORESOURCE_MEM,
1513 },
1514 [1] = {
1515 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
1516 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
1517 .flags = IORESOURCE_IRQ,
1518 },
1519};
1520
1521static struct atmel_uart_data dbgu_data = {
1522 .use_dma_tx = 0,
1523 .use_dma_rx = 0,
1524};
1525
1526static u64 dbgu_dmamask = DMA_BIT_MASK(32);
1527
1528static struct platform_device at91sam9g45_dbgu_device = {
1529 .name = "atmel_usart",
1530 .id = 0,
1531 .dev = {
1532 .dma_mask = &dbgu_dmamask,
1533 .coherent_dma_mask = DMA_BIT_MASK(32),
1534 .platform_data = &dbgu_data,
1535 },
1536 .resource = dbgu_resources,
1537 .num_resources = ARRAY_SIZE(dbgu_resources),
1538};
1539
1540static inline void configure_dbgu_pins(void)
1541{
1542 at91_set_A_periph(AT91_PIN_PB12, 0); /* DRXD */
1543 at91_set_A_periph(AT91_PIN_PB13, 1); /* DTXD */
1544}
1545
1546static struct resource uart0_resources[] = {
1547 [0] = {
1548 .start = AT91SAM9G45_BASE_US0,
1549 .end = AT91SAM9G45_BASE_US0 + SZ_16K - 1,
1550 .flags = IORESOURCE_MEM,
1551 },
1552 [1] = {
1553 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_US0,
1554 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_US0,
1555 .flags = IORESOURCE_IRQ,
1556 },
1557};
1558
1559static struct atmel_uart_data uart0_data = {
1560 .use_dma_tx = 1,
1561 .use_dma_rx = 1,
1562};
1563
1564static u64 uart0_dmamask = DMA_BIT_MASK(32);
1565
1566static struct platform_device at91sam9g45_uart0_device = {
1567 .name = "atmel_usart",
1568 .id = 1,
1569 .dev = {
1570 .dma_mask = &uart0_dmamask,
1571 .coherent_dma_mask = DMA_BIT_MASK(32),
1572 .platform_data = &uart0_data,
1573 },
1574 .resource = uart0_resources,
1575 .num_resources = ARRAY_SIZE(uart0_resources),
1576};
1577
1578static inline void configure_usart0_pins(unsigned pins)
1579{
1580 at91_set_A_periph(AT91_PIN_PB19, 1); /* TXD0 */
1581 at91_set_A_periph(AT91_PIN_PB18, 0); /* RXD0 */
1582
1583 if (pins & ATMEL_UART_RTS)
1584 at91_set_B_periph(AT91_PIN_PB17, 0); /* RTS0 */
1585 if (pins & ATMEL_UART_CTS)
1586 at91_set_B_periph(AT91_PIN_PB15, 0); /* CTS0 */
1587}
1588
1589static struct resource uart1_resources[] = {
1590 [0] = {
1591 .start = AT91SAM9G45_BASE_US1,
1592 .end = AT91SAM9G45_BASE_US1 + SZ_16K - 1,
1593 .flags = IORESOURCE_MEM,
1594 },
1595 [1] = {
1596 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_US1,
1597 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_US1,
1598 .flags = IORESOURCE_IRQ,
1599 },
1600};
1601
1602static struct atmel_uart_data uart1_data = {
1603 .use_dma_tx = 1,
1604 .use_dma_rx = 1,
1605};
1606
1607static u64 uart1_dmamask = DMA_BIT_MASK(32);
1608
1609static struct platform_device at91sam9g45_uart1_device = {
1610 .name = "atmel_usart",
1611 .id = 2,
1612 .dev = {
1613 .dma_mask = &uart1_dmamask,
1614 .coherent_dma_mask = DMA_BIT_MASK(32),
1615 .platform_data = &uart1_data,
1616 },
1617 .resource = uart1_resources,
1618 .num_resources = ARRAY_SIZE(uart1_resources),
1619};
1620
1621static inline void configure_usart1_pins(unsigned pins)
1622{
1623 at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD1 */
1624 at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD1 */
1625
1626 if (pins & ATMEL_UART_RTS)
1627 at91_set_A_periph(AT91_PIN_PD16, 0); /* RTS1 */
1628 if (pins & ATMEL_UART_CTS)
1629 at91_set_A_periph(AT91_PIN_PD17, 0); /* CTS1 */
1630}
1631
1632static struct resource uart2_resources[] = {
1633 [0] = {
1634 .start = AT91SAM9G45_BASE_US2,
1635 .end = AT91SAM9G45_BASE_US2 + SZ_16K - 1,
1636 .flags = IORESOURCE_MEM,
1637 },
1638 [1] = {
1639 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_US2,
1640 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_US2,
1641 .flags = IORESOURCE_IRQ,
1642 },
1643};
1644
1645static struct atmel_uart_data uart2_data = {
1646 .use_dma_tx = 1,
1647 .use_dma_rx = 1,
1648};
1649
1650static u64 uart2_dmamask = DMA_BIT_MASK(32);
1651
1652static struct platform_device at91sam9g45_uart2_device = {
1653 .name = "atmel_usart",
1654 .id = 3,
1655 .dev = {
1656 .dma_mask = &uart2_dmamask,
1657 .coherent_dma_mask = DMA_BIT_MASK(32),
1658 .platform_data = &uart2_data,
1659 },
1660 .resource = uart2_resources,
1661 .num_resources = ARRAY_SIZE(uart2_resources),
1662};
1663
1664static inline void configure_usart2_pins(unsigned pins)
1665{
1666 at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD2 */
1667 at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD2 */
1668
1669 if (pins & ATMEL_UART_RTS)
1670 at91_set_B_periph(AT91_PIN_PC9, 0); /* RTS2 */
1671 if (pins & ATMEL_UART_CTS)
1672 at91_set_B_periph(AT91_PIN_PC11, 0); /* CTS2 */
1673}
1674
1675static struct resource uart3_resources[] = {
1676 [0] = {
1677 .start = AT91SAM9G45_BASE_US3,
1678 .end = AT91SAM9G45_BASE_US3 + SZ_16K - 1,
1679 .flags = IORESOURCE_MEM,
1680 },
1681 [1] = {
1682 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_US3,
1683 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_US3,
1684 .flags = IORESOURCE_IRQ,
1685 },
1686};
1687
1688static struct atmel_uart_data uart3_data = {
1689 .use_dma_tx = 1,
1690 .use_dma_rx = 1,
1691};
1692
1693static u64 uart3_dmamask = DMA_BIT_MASK(32);
1694
1695static struct platform_device at91sam9g45_uart3_device = {
1696 .name = "atmel_usart",
1697 .id = 4,
1698 .dev = {
1699 .dma_mask = &uart3_dmamask,
1700 .coherent_dma_mask = DMA_BIT_MASK(32),
1701 .platform_data = &uart3_data,
1702 },
1703 .resource = uart3_resources,
1704 .num_resources = ARRAY_SIZE(uart3_resources),
1705};
1706
1707static inline void configure_usart3_pins(unsigned pins)
1708{
1709 at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD3 */
1710 at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD3 */
1711
1712 if (pins & ATMEL_UART_RTS)
1713 at91_set_B_periph(AT91_PIN_PA23, 0); /* RTS3 */
1714 if (pins & ATMEL_UART_CTS)
1715 at91_set_B_periph(AT91_PIN_PA24, 0); /* CTS3 */
1716}
1717
1718static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1719
1720void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1721{
1722 struct platform_device *pdev;
1723 struct atmel_uart_data *pdata;
1724
1725 switch (id) {
1726 case 0: /* DBGU */
1727 pdev = &at91sam9g45_dbgu_device;
1728 configure_dbgu_pins();
1729 break;
1730 case AT91SAM9G45_ID_US0:
1731 pdev = &at91sam9g45_uart0_device;
1732 configure_usart0_pins(pins);
1733 break;
1734 case AT91SAM9G45_ID_US1:
1735 pdev = &at91sam9g45_uart1_device;
1736 configure_usart1_pins(pins);
1737 break;
1738 case AT91SAM9G45_ID_US2:
1739 pdev = &at91sam9g45_uart2_device;
1740 configure_usart2_pins(pins);
1741 break;
1742 case AT91SAM9G45_ID_US3:
1743 pdev = &at91sam9g45_uart3_device;
1744 configure_usart3_pins(pins);
1745 break;
1746 default:
1747 return;
1748 }
1749 pdata = pdev->dev.platform_data;
1750 pdata->num = portnr; /* update to mapped ID */
1751
1752 if (portnr < ATMEL_MAX_UART)
1753 at91_uarts[portnr] = pdev;
1754}
1755
1756void __init at91_add_device_serial(void)
1757{
1758 int i;
1759
1760 for (i = 0; i < ATMEL_MAX_UART; i++) {
1761 if (at91_uarts[i])
1762 platform_device_register(at91_uarts[i]);
1763 }
1764}
1765#else
1766void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1767void __init at91_add_device_serial(void) {}
1768#endif
1769
1770/* --------------------------------------------------------------------
1771 * SHA1/SHA256
1772 * -------------------------------------------------------------------- */
1773
1774#if defined(CONFIG_CRYPTO_DEV_ATMEL_SHA) || defined(CONFIG_CRYPTO_DEV_ATMEL_SHA_MODULE)
1775static struct resource sha_resources[] = {
1776 {
1777 .start = AT91SAM9G45_BASE_SHA,
1778 .end = AT91SAM9G45_BASE_SHA + SZ_16K - 1,
1779 .flags = IORESOURCE_MEM,
1780 },
1781 [1] = {
1782 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1783 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1784 .flags = IORESOURCE_IRQ,
1785 },
1786};
1787
1788static struct platform_device at91sam9g45_sha_device = {
1789 .name = "atmel_sha",
1790 .id = -1,
1791 .resource = sha_resources,
1792 .num_resources = ARRAY_SIZE(sha_resources),
1793};
1794
1795static void __init at91_add_device_sha(void)
1796{
1797 platform_device_register(&at91sam9g45_sha_device);
1798}
1799#else
1800static void __init at91_add_device_sha(void) {}
1801#endif
1802
1803/* --------------------------------------------------------------------
1804 * DES/TDES
1805 * -------------------------------------------------------------------- */
1806
1807#if defined(CONFIG_CRYPTO_DEV_ATMEL_TDES) || defined(CONFIG_CRYPTO_DEV_ATMEL_TDES_MODULE)
1808static struct resource tdes_resources[] = {
1809 [0] = {
1810 .start = AT91SAM9G45_BASE_TDES,
1811 .end = AT91SAM9G45_BASE_TDES + SZ_16K - 1,
1812 .flags = IORESOURCE_MEM,
1813 },
1814 [1] = {
1815 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1816 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1817 .flags = IORESOURCE_IRQ,
1818 },
1819};
1820
1821static struct platform_device at91sam9g45_tdes_device = {
1822 .name = "atmel_tdes",
1823 .id = -1,
1824 .resource = tdes_resources,
1825 .num_resources = ARRAY_SIZE(tdes_resources),
1826};
1827
1828static void __init at91_add_device_tdes(void)
1829{
1830 platform_device_register(&at91sam9g45_tdes_device);
1831}
1832#else
1833static void __init at91_add_device_tdes(void) {}
1834#endif
1835
1836/* --------------------------------------------------------------------
1837 * AES
1838 * -------------------------------------------------------------------- */
1839
1840#if defined(CONFIG_CRYPTO_DEV_ATMEL_AES) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE)
1841static struct crypto_platform_data aes_data;
1842static struct crypto_dma_data alt_atslave;
1843static u64 aes_dmamask = DMA_BIT_MASK(32);
1844
1845static struct resource aes_resources[] = {
1846 [0] = {
1847 .start = AT91SAM9G45_BASE_AES,
1848 .end = AT91SAM9G45_BASE_AES + SZ_16K - 1,
1849 .flags = IORESOURCE_MEM,
1850 },
1851 [1] = {
1852 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1853 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1854 .flags = IORESOURCE_IRQ,
1855 },
1856};
1857
1858static struct platform_device at91sam9g45_aes_device = {
1859 .name = "atmel_aes",
1860 .id = -1,
1861 .dev = {
1862 .dma_mask = &aes_dmamask,
1863 .coherent_dma_mask = DMA_BIT_MASK(32),
1864 .platform_data = &aes_data,
1865 },
1866 .resource = aes_resources,
1867 .num_resources = ARRAY_SIZE(aes_resources),
1868};
1869
1870static void __init at91_add_device_aes(void)
1871{
1872 struct at_dma_slave *atslave;
1873
1874 /* DMA TX slave channel configuration */
1875 atslave = &alt_atslave.txdata;
1876 atslave->dma_dev = &at_hdmac_device.dev;
1877 atslave->cfg = ATC_FIFOCFG_ENOUGHSPACE | ATC_SRC_H2SEL_HW |
1878 ATC_SRC_PER(AT_DMA_ID_AES_RX);
1879
1880 /* DMA RX slave channel configuration */
1881 atslave = &alt_atslave.rxdata;
1882 atslave->dma_dev = &at_hdmac_device.dev;
1883 atslave->cfg = ATC_FIFOCFG_ENOUGHSPACE | ATC_DST_H2SEL_HW |
1884 ATC_DST_PER(AT_DMA_ID_AES_TX);
1885
1886 aes_data.dma_slave = &alt_atslave;
1887 platform_device_register(&at91sam9g45_aes_device);
1888}
1889#else
1890static void __init at91_add_device_aes(void) {}
1891#endif
1892
1893/* -------------------------------------------------------------------- */
1894/*
1895 * These devices are always present and don't need any board-specific
1896 * setup.
1897 */
1898static int __init at91_add_standard_devices(void)
1899{
1900 if (of_have_populated_dt())
1901 return 0;
1902
1903 at91_add_device_hdmac();
1904 at91_add_device_rtc();
1905 at91_add_device_rtt();
1906 at91_add_device_trng();
1907 at91_add_device_watchdog();
1908 at91_add_device_tc();
1909 at91_add_device_sha();
1910 at91_add_device_tdes();
1911 at91_add_device_aes();
1912 return 0;
1913}
1914
1915arch_initcall(at91_add_standard_devices);
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index c8988fe5ff70..dee569b1987e 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -6,219 +6,11 @@
6 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2 or later.
7 */ 7 */
8 8
9#include <linux/module.h> 9#include <asm/system_misc.h>
10#include <linux/dma-mapping.h> 10#include <mach/hardware.h>
11#include <linux/clk/at91_pmc.h>
12 11
13#include <asm/irq.h>
14#include <asm/mach/arch.h>
15#include <asm/mach/map.h>
16#include <mach/at91sam9n12.h>
17#include <mach/cpu.h>
18
19#include "board.h"
20#include "soc.h" 12#include "soc.h"
21#include "generic.h" 13#include "generic.h"
22#include "sam9_smc.h"
23
24#if defined(CONFIG_OLD_CLK_AT91)
25#include "clock.h"
26/* --------------------------------------------------------------------
27 * Clocks
28 * -------------------------------------------------------------------- */
29
30/*
31 * The peripheral clocks.
32 */
33static struct clk pioAB_clk = {
34 .name = "pioAB_clk",
35 .pmc_mask = 1 << AT91SAM9N12_ID_PIOAB,
36 .type = CLK_TYPE_PERIPHERAL,
37};
38static struct clk pioCD_clk = {
39 .name = "pioCD_clk",
40 .pmc_mask = 1 << AT91SAM9N12_ID_PIOCD,
41 .type = CLK_TYPE_PERIPHERAL,
42};
43static struct clk usart0_clk = {
44 .name = "usart0_clk",
45 .pmc_mask = 1 << AT91SAM9N12_ID_USART0,
46 .type = CLK_TYPE_PERIPHERAL,
47};
48static struct clk usart1_clk = {
49 .name = "usart1_clk",
50 .pmc_mask = 1 << AT91SAM9N12_ID_USART1,
51 .type = CLK_TYPE_PERIPHERAL,
52};
53static struct clk usart2_clk = {
54 .name = "usart2_clk",
55 .pmc_mask = 1 << AT91SAM9N12_ID_USART2,
56 .type = CLK_TYPE_PERIPHERAL,
57};
58static struct clk usart3_clk = {
59 .name = "usart3_clk",
60 .pmc_mask = 1 << AT91SAM9N12_ID_USART3,
61 .type = CLK_TYPE_PERIPHERAL,
62};
63static struct clk twi0_clk = {
64 .name = "twi0_clk",
65 .pmc_mask = 1 << AT91SAM9N12_ID_TWI0,
66 .type = CLK_TYPE_PERIPHERAL,
67};
68static struct clk twi1_clk = {
69 .name = "twi1_clk",
70 .pmc_mask = 1 << AT91SAM9N12_ID_TWI1,
71 .type = CLK_TYPE_PERIPHERAL,
72};
73static struct clk mmc_clk = {
74 .name = "mci_clk",
75 .pmc_mask = 1 << AT91SAM9N12_ID_MCI,
76 .type = CLK_TYPE_PERIPHERAL,
77};
78static struct clk spi0_clk = {
79 .name = "spi0_clk",
80 .pmc_mask = 1 << AT91SAM9N12_ID_SPI0,
81 .type = CLK_TYPE_PERIPHERAL,
82};
83static struct clk spi1_clk = {
84 .name = "spi1_clk",
85 .pmc_mask = 1 << AT91SAM9N12_ID_SPI1,
86 .type = CLK_TYPE_PERIPHERAL,
87};
88static struct clk uart0_clk = {
89 .name = "uart0_clk",
90 .pmc_mask = 1 << AT91SAM9N12_ID_UART0,
91 .type = CLK_TYPE_PERIPHERAL,
92};
93static struct clk uart1_clk = {
94 .name = "uart1_clk",
95 .pmc_mask = 1 << AT91SAM9N12_ID_UART1,
96 .type = CLK_TYPE_PERIPHERAL,
97};
98static struct clk tcb_clk = {
99 .name = "tcb_clk",
100 .pmc_mask = 1 << AT91SAM9N12_ID_TCB,
101 .type = CLK_TYPE_PERIPHERAL,
102};
103static struct clk pwm_clk = {
104 .name = "pwm_clk",
105 .pmc_mask = 1 << AT91SAM9N12_ID_PWM,
106 .type = CLK_TYPE_PERIPHERAL,
107};
108static struct clk adc_clk = {
109 .name = "adc_clk",
110 .pmc_mask = 1 << AT91SAM9N12_ID_ADC,
111 .type = CLK_TYPE_PERIPHERAL,
112};
113static struct clk dma_clk = {
114 .name = "dma_clk",
115 .pmc_mask = 1 << AT91SAM9N12_ID_DMA,
116 .type = CLK_TYPE_PERIPHERAL,
117};
118static struct clk uhp_clk = {
119 .name = "uhp",
120 .pmc_mask = 1 << AT91SAM9N12_ID_UHP,
121 .type = CLK_TYPE_PERIPHERAL,
122};
123static struct clk udp_clk = {
124 .name = "udp_clk",
125 .pmc_mask = 1 << AT91SAM9N12_ID_UDP,
126 .type = CLK_TYPE_PERIPHERAL,
127};
128static struct clk lcdc_clk = {
129 .name = "lcdc_clk",
130 .pmc_mask = 1 << AT91SAM9N12_ID_LCDC,
131 .type = CLK_TYPE_PERIPHERAL,
132};
133static struct clk ssc_clk = {
134 .name = "ssc_clk",
135 .pmc_mask = 1 << AT91SAM9N12_ID_SSC,
136 .type = CLK_TYPE_PERIPHERAL,
137};
138
139static struct clk *periph_clocks[] __initdata = {
140 &pioAB_clk,
141 &pioCD_clk,
142 &usart0_clk,
143 &usart1_clk,
144 &usart2_clk,
145 &usart3_clk,
146 &twi0_clk,
147 &twi1_clk,
148 &mmc_clk,
149 &spi0_clk,
150 &spi1_clk,
151 &lcdc_clk,
152 &uart0_clk,
153 &uart1_clk,
154 &tcb_clk,
155 &pwm_clk,
156 &adc_clk,
157 &dma_clk,
158 &uhp_clk,
159 &udp_clk,
160 &ssc_clk,
161};
162
163static struct clk_lookup periph_clocks_lookups[] = {
164 /* lookup table for DT entries */
165 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
166 CLKDEV_CON_DEV_ID("usart", "f801c000.serial", &usart0_clk),
167 CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart1_clk),
168 CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart2_clk),
169 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
170 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
171 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
172 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc_clk),
173 CLKDEV_CON_DEV_ID(NULL, "f0010000.ssc", &ssc_clk),
174 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
175 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
176 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
177 CLKDEV_CON_DEV_ID("spi_clk", "f0000000.spi", &spi0_clk),
178 CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi1_clk),
179 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk),
180 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk),
181 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk),
182 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCD_clk),
183 /* additional fake clock for macb_hclk */
184 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &uhp_clk),
185 CLKDEV_CON_DEV_ID("ohci_clk", "500000.ohci", &uhp_clk),
186 CLKDEV_CON_DEV_ID(NULL, "f8034000.pwm", &pwm_clk),
187};
188
189/*
190 * The two programmable clocks.
191 * You must configure pin multiplexing to bring these signals out.
192 */
193static struct clk pck0 = {
194 .name = "pck0",
195 .pmc_mask = AT91_PMC_PCK0,
196 .type = CLK_TYPE_PROGRAMMABLE,
197 .id = 0,
198};
199static struct clk pck1 = {
200 .name = "pck1",
201 .pmc_mask = AT91_PMC_PCK1,
202 .type = CLK_TYPE_PROGRAMMABLE,
203 .id = 1,
204};
205
206static void __init at91sam9n12_register_clocks(void)
207{
208 int i;
209
210 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
211 clk_register(periph_clocks[i]);
212 clk_register(&pck0);
213 clk_register(&pck1);
214
215 clkdev_add_table(periph_clocks_lookups,
216 ARRAY_SIZE(periph_clocks_lookups));
217
218}
219#else
220#define at91sam9n12_register_clocks NULL
221#endif
222 14
223/* -------------------------------------------------------------------- 15/* --------------------------------------------------------------------
224 * AT91SAM9N12 processor initialization 16 * AT91SAM9N12 processor initialization
@@ -236,6 +28,5 @@ static void __init at91sam9n12_initialize(void)
236 28
237AT91_SOC_START(at91sam9n12) 29AT91_SOC_START(at91sam9n12)
238 .map_io = at91sam9n12_map_io, 30 .map_io = at91sam9n12_map_io,
239 .register_clocks = at91sam9n12_register_clocks,
240 .init = at91sam9n12_initialize, 31 .init = at91sam9n12_initialize,
241AT91_SOC_END 32AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index f553e4ea034b..f25b9aec9c50 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -9,284 +9,14 @@
9 * more details. 9 * more details.
10 */ 10 */
11 11
12#include <linux/module.h>
13#include <linux/platform_device.h>
14#include <linux/clk/at91_pmc.h>
15
16#include <asm/proc-fns.h>
17#include <asm/irq.h>
18#include <asm/mach/arch.h>
19#include <asm/mach/map.h>
20#include <asm/system_misc.h> 12#include <asm/system_misc.h>
13#include <asm/irq.h>
21#include <mach/cpu.h> 14#include <mach/cpu.h>
22#include <mach/at91_dbgu.h> 15#include <mach/at91_dbgu.h>
23#include <mach/at91sam9rl.h>
24#include <mach/hardware.h> 16#include <mach/hardware.h>
25 17
26#include "at91_aic.h"
27#include "soc.h" 18#include "soc.h"
28#include "generic.h" 19#include "generic.h"
29#include "sam9_smc.h"
30#include "pm.h"
31
32/* --------------------------------------------------------------------
33 * Clocks
34 * -------------------------------------------------------------------- */
35#if defined(CONFIG_OLD_CLK_AT91)
36#include "clock.h"
37
38/*
39 * The peripheral clocks.
40 */
41static struct clk pioA_clk = {
42 .name = "pioA_clk",
43 .pmc_mask = 1 << AT91SAM9RL_ID_PIOA,
44 .type = CLK_TYPE_PERIPHERAL,
45};
46static struct clk pioB_clk = {
47 .name = "pioB_clk",
48 .pmc_mask = 1 << AT91SAM9RL_ID_PIOB,
49 .type = CLK_TYPE_PERIPHERAL,
50};
51static struct clk pioC_clk = {
52 .name = "pioC_clk",
53 .pmc_mask = 1 << AT91SAM9RL_ID_PIOC,
54 .type = CLK_TYPE_PERIPHERAL,
55};
56static struct clk pioD_clk = {
57 .name = "pioD_clk",
58 .pmc_mask = 1 << AT91SAM9RL_ID_PIOD,
59 .type = CLK_TYPE_PERIPHERAL,
60};
61static struct clk usart0_clk = {
62 .name = "usart0_clk",
63 .pmc_mask = 1 << AT91SAM9RL_ID_US0,
64 .type = CLK_TYPE_PERIPHERAL,
65};
66static struct clk usart1_clk = {
67 .name = "usart1_clk",
68 .pmc_mask = 1 << AT91SAM9RL_ID_US1,
69 .type = CLK_TYPE_PERIPHERAL,
70};
71static struct clk usart2_clk = {
72 .name = "usart2_clk",
73 .pmc_mask = 1 << AT91SAM9RL_ID_US2,
74 .type = CLK_TYPE_PERIPHERAL,
75};
76static struct clk usart3_clk = {
77 .name = "usart3_clk",
78 .pmc_mask = 1 << AT91SAM9RL_ID_US3,
79 .type = CLK_TYPE_PERIPHERAL,
80};
81static struct clk mmc_clk = {
82 .name = "mci_clk",
83 .pmc_mask = 1 << AT91SAM9RL_ID_MCI,
84 .type = CLK_TYPE_PERIPHERAL,
85};
86static struct clk twi0_clk = {
87 .name = "twi0_clk",
88 .pmc_mask = 1 << AT91SAM9RL_ID_TWI0,
89 .type = CLK_TYPE_PERIPHERAL,
90};
91static struct clk twi1_clk = {
92 .name = "twi1_clk",
93 .pmc_mask = 1 << AT91SAM9RL_ID_TWI1,
94 .type = CLK_TYPE_PERIPHERAL,
95};
96static struct clk spi_clk = {
97 .name = "spi_clk",
98 .pmc_mask = 1 << AT91SAM9RL_ID_SPI,
99 .type = CLK_TYPE_PERIPHERAL,
100};
101static struct clk ssc0_clk = {
102 .name = "ssc0_clk",
103 .pmc_mask = 1 << AT91SAM9RL_ID_SSC0,
104 .type = CLK_TYPE_PERIPHERAL,
105};
106static struct clk ssc1_clk = {
107 .name = "ssc1_clk",
108 .pmc_mask = 1 << AT91SAM9RL_ID_SSC1,
109 .type = CLK_TYPE_PERIPHERAL,
110};
111static struct clk tc0_clk = {
112 .name = "tc0_clk",
113 .pmc_mask = 1 << AT91SAM9RL_ID_TC0,
114 .type = CLK_TYPE_PERIPHERAL,
115};
116static struct clk tc1_clk = {
117 .name = "tc1_clk",
118 .pmc_mask = 1 << AT91SAM9RL_ID_TC1,
119 .type = CLK_TYPE_PERIPHERAL,
120};
121static struct clk tc2_clk = {
122 .name = "tc2_clk",
123 .pmc_mask = 1 << AT91SAM9RL_ID_TC2,
124 .type = CLK_TYPE_PERIPHERAL,
125};
126static struct clk pwm_clk = {
127 .name = "pwm_clk",
128 .pmc_mask = 1 << AT91SAM9RL_ID_PWMC,
129 .type = CLK_TYPE_PERIPHERAL,
130};
131static struct clk tsc_clk = {
132 .name = "tsc_clk",
133 .pmc_mask = 1 << AT91SAM9RL_ID_TSC,
134 .type = CLK_TYPE_PERIPHERAL,
135};
136static struct clk dma_clk = {
137 .name = "dma_clk",
138 .pmc_mask = 1 << AT91SAM9RL_ID_DMA,
139 .type = CLK_TYPE_PERIPHERAL,
140};
141static struct clk udphs_clk = {
142 .name = "udphs_clk",
143 .pmc_mask = 1 << AT91SAM9RL_ID_UDPHS,
144 .type = CLK_TYPE_PERIPHERAL,
145};
146static struct clk lcdc_clk = {
147 .name = "lcdc_clk",
148 .pmc_mask = 1 << AT91SAM9RL_ID_LCDC,
149 .type = CLK_TYPE_PERIPHERAL,
150};
151static struct clk ac97_clk = {
152 .name = "ac97_clk",
153 .pmc_mask = 1 << AT91SAM9RL_ID_AC97C,
154 .type = CLK_TYPE_PERIPHERAL,
155};
156static struct clk adc_op_clk = {
157 .name = "adc_op_clk",
158 .type = CLK_TYPE_PERIPHERAL,
159 .rate_hz = 1000000,
160};
161
162static struct clk *periph_clocks[] __initdata = {
163 &pioA_clk,
164 &pioB_clk,
165 &pioC_clk,
166 &pioD_clk,
167 &usart0_clk,
168 &usart1_clk,
169 &usart2_clk,
170 &usart3_clk,
171 &mmc_clk,
172 &twi0_clk,
173 &twi1_clk,
174 &spi_clk,
175 &ssc0_clk,
176 &ssc1_clk,
177 &tc0_clk,
178 &tc1_clk,
179 &tc2_clk,
180 &pwm_clk,
181 &tsc_clk,
182 &dma_clk,
183 &udphs_clk,
184 &lcdc_clk,
185 &ac97_clk,
186 &adc_op_clk,
187 // irq0
188};
189
190static struct clk_lookup periph_clocks_lookups[] = {
191 CLKDEV_CON_DEV_ID("hclk", "at91sam9rl-lcdfb.0", &lcdc_clk),
192 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
193 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
194 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
195 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
196 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
197 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.0", &ssc0_clk),
198 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
199 CLKDEV_CON_DEV_ID("pclk", "fffc0000.ssc", &ssc0_clk),
200 CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc1_clk),
201 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi0_clk),
202 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.1", &twi1_clk),
203 CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
204 CLKDEV_CON_ID("pioA", &pioA_clk),
205 CLKDEV_CON_ID("pioB", &pioB_clk),
206 CLKDEV_CON_ID("pioC", &pioC_clk),
207 CLKDEV_CON_ID("pioD", &pioD_clk),
208 /* more lookup table for DT entries */
209 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
210 CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk),
211 CLKDEV_CON_DEV_ID("usart", "ffffb400.serial", &usart1_clk),
212 CLKDEV_CON_DEV_ID("usart", "ffffb800.serial", &usart2_clk),
213 CLKDEV_CON_DEV_ID("usart", "ffffbc00.serial", &usart3_clk),
214 CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
215 CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
216 CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
217 CLKDEV_CON_DEV_ID("mci_clk", "fffa4000.mmc", &mmc_clk),
218 CLKDEV_CON_DEV_ID(NULL, "fffa8000.i2c", &twi0_clk),
219 CLKDEV_CON_DEV_ID(NULL, "fffac000.i2c", &twi1_clk),
220 CLKDEV_CON_DEV_ID(NULL, "fffc8000.pwm", &pwm_clk),
221 CLKDEV_CON_DEV_ID(NULL, "ffffc800.pwm", &pwm_clk),
222 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
223 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
224 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
225 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioD_clk),
226 CLKDEV_CON_ID("adc_clk", &tsc_clk),
227};
228
229static struct clk_lookup usart_clocks_lookups[] = {
230 CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck),
231 CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk),
232 CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk),
233 CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk),
234 CLKDEV_CON_DEV_ID("usart", "atmel_usart.4", &usart3_clk),
235};
236
237/*
238 * The two programmable clocks.
239 * You must configure pin multiplexing to bring these signals out.
240 */
241static struct clk pck0 = {
242 .name = "pck0",
243 .pmc_mask = AT91_PMC_PCK0,
244 .type = CLK_TYPE_PROGRAMMABLE,
245 .id = 0,
246};
247static struct clk pck1 = {
248 .name = "pck1",
249 .pmc_mask = AT91_PMC_PCK1,
250 .type = CLK_TYPE_PROGRAMMABLE,
251 .id = 1,
252};
253
254static void __init at91sam9rl_register_clocks(void)
255{
256 int i;
257
258 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
259 clk_register(periph_clocks[i]);
260
261 clkdev_add_table(periph_clocks_lookups,
262 ARRAY_SIZE(periph_clocks_lookups));
263 clkdev_add_table(usart_clocks_lookups,
264 ARRAY_SIZE(usart_clocks_lookups));
265
266 clk_register(&pck0);
267 clk_register(&pck1);
268}
269#endif
270
271/* --------------------------------------------------------------------
272 * GPIO
273 * -------------------------------------------------------------------- */
274
275static struct at91_gpio_bank at91sam9rl_gpio[] __initdata = {
276 {
277 .id = AT91SAM9RL_ID_PIOA,
278 .regbase = AT91SAM9RL_BASE_PIOA,
279 }, {
280 .id = AT91SAM9RL_ID_PIOB,
281 .regbase = AT91SAM9RL_BASE_PIOB,
282 }, {
283 .id = AT91SAM9RL_ID_PIOC,
284 .regbase = AT91SAM9RL_BASE_PIOC,
285 }, {
286 .id = AT91SAM9RL_ID_PIOD,
287 .regbase = AT91SAM9RL_BASE_PIOD,
288 }
289};
290 20
291/* -------------------------------------------------------------------- 21/* --------------------------------------------------------------------
292 * AT91SAM9RL processor initialization 22 * AT91SAM9RL processor initialization
@@ -309,121 +39,15 @@ static void __init at91sam9rl_map_io(void)
309 at91_init_sram(0, AT91SAM9RL_SRAM_BASE, sram_size); 39 at91_init_sram(0, AT91SAM9RL_SRAM_BASE, sram_size);
310} 40}
311 41
312static void __init at91sam9rl_ioremap_registers(void)
313{
314 at91_ioremap_ramc(0, AT91SAM9RL_BASE_SDRAMC, 512);
315 at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT);
316 at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC);
317 at91_ioremap_matrix(AT91SAM9RL_BASE_MATRIX);
318 at91_pm_set_standby(at91sam9_sdram_standby);
319}
320
321static void __init at91sam9rl_initialize(void) 42static void __init at91sam9rl_initialize(void)
322{ 43{
323 arm_pm_idle = at91sam9_idle; 44 arm_pm_idle = at91sam9_idle;
324 45
325 at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC); 46 at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC);
326 at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT); 47 at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT);
327
328 /* Register GPIO subsystem */
329 at91_gpio_init(at91sam9rl_gpio, 4);
330}
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
371/* --------------------------------------------------------------------
372 * Interrupt initialization
373 * -------------------------------------------------------------------- */
374
375/*
376 * The default interrupt priority levels (0 = lowest, 7 = highest).
377 */
378static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
379 7, /* Advanced Interrupt Controller */
380 7, /* System Peripherals */
381 1, /* Parallel IO Controller A */
382 1, /* Parallel IO Controller B */
383 1, /* Parallel IO Controller C */
384 1, /* Parallel IO Controller D */
385 5, /* USART 0 */
386 5, /* USART 1 */
387 5, /* USART 2 */
388 5, /* USART 3 */
389 0, /* Multimedia Card Interface */
390 6, /* Two-Wire Interface 0 */
391 6, /* Two-Wire Interface 1 */
392 5, /* Serial Peripheral Interface */
393 4, /* Serial Synchronous Controller 0 */
394 4, /* Serial Synchronous Controller 1 */
395 0, /* Timer Counter 0 */
396 0, /* Timer Counter 1 */
397 0, /* Timer Counter 2 */
398 0,
399 0, /* Touch Screen Controller */
400 0, /* DMA Controller */
401 2, /* USB Device High speed port */
402 2, /* LCD Controller */
403 6, /* AC97 Controller */
404 0,
405 0,
406 0,
407 0,
408 0,
409 0,
410 0, /* Advanced Interrupt Controller */
411};
412
413static void __init at91sam9rl_init_time(void)
414{
415 at91sam926x_pit_init(NR_IRQS_LEGACY + AT91_ID_SYS);
416} 48}
417 49
418AT91_SOC_START(at91sam9rl) 50AT91_SOC_START(at91sam9rl)
419 .map_io = at91sam9rl_map_io, 51 .map_io = at91sam9rl_map_io,
420 .default_irq_priority = at91sam9rl_default_irq_priority,
421 .extern_irq = (1 << AT91SAM9RL_ID_IRQ0),
422 .ioremap_registers = at91sam9rl_ioremap_registers,
423#if defined(CONFIG_OLD_CLK_AT91)
424 .register_clocks = at91sam9rl_register_clocks,
425#endif
426 .register_devices = at91sam9rl_register_devices,
427 .init = at91sam9rl_initialize, 52 .init = at91sam9rl_initialize,
428 .init_time = at91sam9rl_init_time,
429AT91_SOC_END 53AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
deleted file mode 100644
index 37d1c9ed4562..000000000000
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ /dev/null
@@ -1,1260 +0,0 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file COPYING in the main directory of this archive for
6 * more details.
7 */
8
9#include <asm/mach/arch.h>
10#include <asm/mach/map.h>
11
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14#include <linux/platform_device.h>
15#include <linux/i2c-gpio.h>
16
17#include <linux/fb.h>
18#include <video/atmel_lcdc.h>
19
20#include <mach/at91sam9rl.h>
21#include <mach/at91sam9rl_matrix.h>
22#include <mach/at91_matrix.h>
23#include <mach/at91sam9_smc.h>
24#include <mach/hardware.h>
25#include <linux/platform_data/dma-atmel.h>
26#include <linux/platform_data/at91_adc.h>
27
28#include "board.h"
29#include "generic.h"
30#include "gpio.h"
31
32
33/* --------------------------------------------------------------------
34 * HDMAC - AHB DMA Controller
35 * -------------------------------------------------------------------- */
36
37#if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
38static u64 hdmac_dmamask = DMA_BIT_MASK(32);
39
40static struct resource hdmac_resources[] = {
41 [0] = {
42 .start = AT91SAM9RL_BASE_DMA,
43 .end = AT91SAM9RL_BASE_DMA + SZ_512 - 1,
44 .flags = IORESOURCE_MEM,
45 },
46 [2] = {
47 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_DMA,
48 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_DMA,
49 .flags = IORESOURCE_IRQ,
50 },
51};
52
53static struct platform_device at_hdmac_device = {
54 .name = "at91sam9rl_dma",
55 .id = -1,
56 .dev = {
57 .dma_mask = &hdmac_dmamask,
58 .coherent_dma_mask = DMA_BIT_MASK(32),
59 },
60 .resource = hdmac_resources,
61 .num_resources = ARRAY_SIZE(hdmac_resources),
62};
63
64void __init at91_add_device_hdmac(void)
65{
66 platform_device_register(&at_hdmac_device);
67}
68#else
69void __init at91_add_device_hdmac(void) {}
70#endif
71
72/* --------------------------------------------------------------------
73 * USB HS Device (Gadget)
74 * -------------------------------------------------------------------- */
75
76#if defined(CONFIG_USB_ATMEL_USBA) || defined(CONFIG_USB_ATMEL_USBA_MODULE)
77
78static struct resource usba_udc_resources[] = {
79 [0] = {
80 .start = AT91SAM9RL_UDPHS_FIFO,
81 .end = AT91SAM9RL_UDPHS_FIFO + SZ_512K - 1,
82 .flags = IORESOURCE_MEM,
83 },
84 [1] = {
85 .start = AT91SAM9RL_BASE_UDPHS,
86 .end = AT91SAM9RL_BASE_UDPHS + SZ_1K - 1,
87 .flags = IORESOURCE_MEM,
88 },
89 [2] = {
90 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_UDPHS,
91 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_UDPHS,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
97 [idx] = { \
98 .name = nam, \
99 .index = idx, \
100 .fifo_size = maxpkt, \
101 .nr_banks = maxbk, \
102 .can_dma = dma, \
103 .can_isoc = isoc, \
104 }
105
106static struct usba_ep_data usba_udc_ep[] __initdata = {
107 EP("ep0", 0, 64, 1, 0, 0),
108 EP("ep1", 1, 1024, 2, 1, 1),
109 EP("ep2", 2, 1024, 2, 1, 1),
110 EP("ep3", 3, 1024, 3, 1, 0),
111 EP("ep4", 4, 1024, 3, 1, 0),
112 EP("ep5", 5, 1024, 3, 1, 1),
113 EP("ep6", 6, 1024, 3, 1, 1),
114};
115
116#undef EP
117
118/*
119 * pdata doesn't have room for any endpoints, so we need to
120 * append room for the ones we need right after it.
121 */
122static struct {
123 struct usba_platform_data pdata;
124 struct usba_ep_data ep[7];
125} usba_udc_data;
126
127static struct platform_device at91_usba_udc_device = {
128 .name = "atmel_usba_udc",
129 .id = -1,
130 .dev = {
131 .platform_data = &usba_udc_data.pdata,
132 },
133 .resource = usba_udc_resources,
134 .num_resources = ARRAY_SIZE(usba_udc_resources),
135};
136
137void __init at91_add_device_usba(struct usba_platform_data *data)
138{
139 /*
140 * Invalid pins are 0 on AT91, but the usba driver is shared
141 * with AVR32, which use negative values instead. Once/if
142 * gpio_is_valid() is ported to AT91, revisit this code.
143 */
144 usba_udc_data.pdata.vbus_pin = -EINVAL;
145 usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
146 memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));
147
148 if (data && gpio_is_valid(data->vbus_pin)) {
149 at91_set_gpio_input(data->vbus_pin, 0);
150 at91_set_deglitch(data->vbus_pin, 1);
151 usba_udc_data.pdata.vbus_pin = data->vbus_pin;
152 }
153
154 /* Pullup pin is handled internally by USB device peripheral */
155
156 platform_device_register(&at91_usba_udc_device);
157}
158#else
159void __init at91_add_device_usba(struct usba_platform_data *data) {}
160#endif
161
162
163/* --------------------------------------------------------------------
164 * MMC / SD
165 * -------------------------------------------------------------------- */
166
167#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
168static u64 mmc_dmamask = DMA_BIT_MASK(32);
169static struct mci_platform_data mmc_data;
170
171static struct resource mmc_resources[] = {
172 [0] = {
173 .start = AT91SAM9RL_BASE_MCI,
174 .end = AT91SAM9RL_BASE_MCI + SZ_16K - 1,
175 .flags = IORESOURCE_MEM,
176 },
177 [1] = {
178 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_MCI,
179 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_MCI,
180 .flags = IORESOURCE_IRQ,
181 },
182};
183
184static struct platform_device at91sam9rl_mmc_device = {
185 .name = "atmel_mci",
186 .id = -1,
187 .dev = {
188 .dma_mask = &mmc_dmamask,
189 .coherent_dma_mask = DMA_BIT_MASK(32),
190 .platform_data = &mmc_data,
191 },
192 .resource = mmc_resources,
193 .num_resources = ARRAY_SIZE(mmc_resources),
194};
195
196void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
197{
198 if (!data)
199 return;
200
201 if (data->slot[0].bus_width) {
202 /* input/irq */
203 if (gpio_is_valid(data->slot[0].detect_pin)) {
204 at91_set_gpio_input(data->slot[0].detect_pin, 1);
205 at91_set_deglitch(data->slot[0].detect_pin, 1);
206 }
207 if (gpio_is_valid(data->slot[0].wp_pin))
208 at91_set_gpio_input(data->slot[0].wp_pin, 1);
209
210 /* CLK */
211 at91_set_A_periph(AT91_PIN_PA2, 0);
212
213 /* CMD */
214 at91_set_A_periph(AT91_PIN_PA1, 1);
215
216 /* DAT0, maybe DAT1..DAT3 */
217 at91_set_A_periph(AT91_PIN_PA0, 1);
218 if (data->slot[0].bus_width == 4) {
219 at91_set_A_periph(AT91_PIN_PA3, 1);
220 at91_set_A_periph(AT91_PIN_PA4, 1);
221 at91_set_A_periph(AT91_PIN_PA5, 1);
222 }
223
224 mmc_data = *data;
225 platform_device_register(&at91sam9rl_mmc_device);
226 }
227}
228#else
229void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
230#endif
231
232
233/* --------------------------------------------------------------------
234 * NAND / SmartMedia
235 * -------------------------------------------------------------------- */
236
237#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
238static struct atmel_nand_data nand_data;
239
240#define NAND_BASE AT91_CHIPSELECT_3
241
242static struct resource nand_resources[] = {
243 [0] = {
244 .start = NAND_BASE,
245 .end = NAND_BASE + SZ_256M - 1,
246 .flags = IORESOURCE_MEM,
247 },
248 [1] = {
249 .start = AT91SAM9RL_BASE_ECC,
250 .end = AT91SAM9RL_BASE_ECC + SZ_512 - 1,
251 .flags = IORESOURCE_MEM,
252 }
253};
254
255static struct platform_device atmel_nand_device = {
256 .name = "atmel_nand",
257 .id = -1,
258 .dev = {
259 .platform_data = &nand_data,
260 },
261 .resource = nand_resources,
262 .num_resources = ARRAY_SIZE(nand_resources),
263};
264
265void __init at91_add_device_nand(struct atmel_nand_data *data)
266{
267 unsigned long csa;
268
269 if (!data)
270 return;
271
272 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
273 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
274
275 /* enable pin */
276 if (gpio_is_valid(data->enable_pin))
277 at91_set_gpio_output(data->enable_pin, 1);
278
279 /* ready/busy pin */
280 if (gpio_is_valid(data->rdy_pin))
281 at91_set_gpio_input(data->rdy_pin, 1);
282
283 /* card detect pin */
284 if (gpio_is_valid(data->det_pin))
285 at91_set_gpio_input(data->det_pin, 1);
286
287 at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */
288 at91_set_A_periph(AT91_PIN_PB5, 0); /* NANDWE */
289
290 nand_data = *data;
291 platform_device_register(&atmel_nand_device);
292}
293
294#else
295void __init at91_add_device_nand(struct atmel_nand_data *data) {}
296#endif
297
298
299/* --------------------------------------------------------------------
300 * TWI (i2c)
301 * -------------------------------------------------------------------- */
302
303/*
304 * Prefer the GPIO code since the TWI controller isn't robust
305 * (gets overruns and underruns under load) and can only issue
306 * repeated STARTs in one scenario (the driver doesn't yet handle them).
307 */
308#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
309
310static struct i2c_gpio_platform_data pdata = {
311 .sda_pin = AT91_PIN_PA23,
312 .sda_is_open_drain = 1,
313 .scl_pin = AT91_PIN_PA24,
314 .scl_is_open_drain = 1,
315 .udelay = 2, /* ~100 kHz */
316};
317
318static struct platform_device at91sam9rl_twi_device = {
319 .name = "i2c-gpio",
320 .id = 0,
321 .dev.platform_data = &pdata,
322};
323
324void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
325{
326 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
327 at91_set_multi_drive(AT91_PIN_PA23, 1);
328
329 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
330 at91_set_multi_drive(AT91_PIN_PA24, 1);
331
332 i2c_register_board_info(0, devices, nr_devices);
333 platform_device_register(&at91sam9rl_twi_device);
334}
335
336#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
337
338static struct resource twi_resources[] = {
339 [0] = {
340 .start = AT91SAM9RL_BASE_TWI0,
341 .end = AT91SAM9RL_BASE_TWI0 + SZ_16K - 1,
342 .flags = IORESOURCE_MEM,
343 },
344 [1] = {
345 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TWI0,
346 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TWI0,
347 .flags = IORESOURCE_IRQ,
348 },
349};
350
351static struct platform_device at91sam9rl_twi_device = {
352 .name = "i2c-at91sam9g20",
353 .id = 0,
354 .resource = twi_resources,
355 .num_resources = ARRAY_SIZE(twi_resources),
356};
357
358void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
359{
360 /* pins used for TWI interface */
361 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
362 at91_set_multi_drive(AT91_PIN_PA23, 1);
363
364 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
365 at91_set_multi_drive(AT91_PIN_PA24, 1);
366
367 i2c_register_board_info(0, devices, nr_devices);
368 platform_device_register(&at91sam9rl_twi_device);
369}
370#else
371void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
372#endif
373
374
375/* --------------------------------------------------------------------
376 * SPI
377 * -------------------------------------------------------------------- */
378
379#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
380static u64 spi_dmamask = DMA_BIT_MASK(32);
381
382static struct resource spi_resources[] = {
383 [0] = {
384 .start = AT91SAM9RL_BASE_SPI,
385 .end = AT91SAM9RL_BASE_SPI + SZ_16K - 1,
386 .flags = IORESOURCE_MEM,
387 },
388 [1] = {
389 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_SPI,
390 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_SPI,
391 .flags = IORESOURCE_IRQ,
392 },
393};
394
395static struct platform_device at91sam9rl_spi_device = {
396 .name = "atmel_spi",
397 .id = 0,
398 .dev = {
399 .dma_mask = &spi_dmamask,
400 .coherent_dma_mask = DMA_BIT_MASK(32),
401 },
402 .resource = spi_resources,
403 .num_resources = ARRAY_SIZE(spi_resources),
404};
405
406static const unsigned spi_standard_cs[4] = { AT91_PIN_PA28, AT91_PIN_PB7, AT91_PIN_PD8, AT91_PIN_PD9 };
407
408
409void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
410{
411 int i;
412 unsigned long cs_pin;
413
414 at91_set_A_periph(AT91_PIN_PA25, 0); /* MISO */
415 at91_set_A_periph(AT91_PIN_PA26, 0); /* MOSI */
416 at91_set_A_periph(AT91_PIN_PA27, 0); /* SPCK */
417
418 /* Enable SPI chip-selects */
419 for (i = 0; i < nr_devices; i++) {
420 if (devices[i].controller_data)
421 cs_pin = (unsigned long) devices[i].controller_data;
422 else
423 cs_pin = spi_standard_cs[devices[i].chip_select];
424
425 if (!gpio_is_valid(cs_pin))
426 continue;
427
428 /* enable chip-select pin */
429 at91_set_gpio_output(cs_pin, 1);
430
431 /* pass chip-select pin to driver */
432 devices[i].controller_data = (void *) cs_pin;
433 }
434
435 spi_register_board_info(devices, nr_devices);
436 platform_device_register(&at91sam9rl_spi_device);
437}
438#else
439void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
440#endif
441
442
443/* --------------------------------------------------------------------
444 * AC97
445 * -------------------------------------------------------------------- */
446
447#if defined(CONFIG_SND_ATMEL_AC97C) || defined(CONFIG_SND_ATMEL_AC97C_MODULE)
448static u64 ac97_dmamask = DMA_BIT_MASK(32);
449static struct ac97c_platform_data ac97_data;
450
451static struct resource ac97_resources[] = {
452 [0] = {
453 .start = AT91SAM9RL_BASE_AC97C,
454 .end = AT91SAM9RL_BASE_AC97C + SZ_16K - 1,
455 .flags = IORESOURCE_MEM,
456 },
457 [1] = {
458 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_AC97C,
459 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_AC97C,
460 .flags = IORESOURCE_IRQ,
461 },
462};
463
464static struct platform_device at91sam9rl_ac97_device = {
465 .name = "atmel_ac97c",
466 .id = 0,
467 .dev = {
468 .dma_mask = &ac97_dmamask,
469 .coherent_dma_mask = DMA_BIT_MASK(32),
470 .platform_data = &ac97_data,
471 },
472 .resource = ac97_resources,
473 .num_resources = ARRAY_SIZE(ac97_resources),
474};
475
476void __init at91_add_device_ac97(struct ac97c_platform_data *data)
477{
478 if (!data)
479 return;
480
481 at91_set_A_periph(AT91_PIN_PD1, 0); /* AC97FS */
482 at91_set_A_periph(AT91_PIN_PD2, 0); /* AC97CK */
483 at91_set_A_periph(AT91_PIN_PD3, 0); /* AC97TX */
484 at91_set_A_periph(AT91_PIN_PD4, 0); /* AC97RX */
485
486 /* reset */
487 if (gpio_is_valid(data->reset_pin))
488 at91_set_gpio_output(data->reset_pin, 0);
489
490 ac97_data = *data;
491 platform_device_register(&at91sam9rl_ac97_device);
492}
493#else
494void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
495#endif
496
497
498/* --------------------------------------------------------------------
499 * LCD Controller
500 * -------------------------------------------------------------------- */
501
502#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
503static u64 lcdc_dmamask = DMA_BIT_MASK(32);
504static struct atmel_lcdfb_pdata lcdc_data;
505
506static struct resource lcdc_resources[] = {
507 [0] = {
508 .start = AT91SAM9RL_LCDC_BASE,
509 .end = AT91SAM9RL_LCDC_BASE + SZ_4K - 1,
510 .flags = IORESOURCE_MEM,
511 },
512 [1] = {
513 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_LCDC,
514 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_LCDC,
515 .flags = IORESOURCE_IRQ,
516 },
517};
518
519static struct platform_device at91_lcdc_device = {
520 .name = "at91sam9rl-lcdfb",
521 .id = 0,
522 .dev = {
523 .dma_mask = &lcdc_dmamask,
524 .coherent_dma_mask = DMA_BIT_MASK(32),
525 .platform_data = &lcdc_data,
526 },
527 .resource = lcdc_resources,
528 .num_resources = ARRAY_SIZE(lcdc_resources),
529};
530
531void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
532{
533 if (!data) {
534 return;
535 }
536
537 at91_set_B_periph(AT91_PIN_PC1, 0); /* LCDPWR */
538 at91_set_A_periph(AT91_PIN_PC5, 0); /* LCDHSYNC */
539 at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDDOTCK */
540 at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDDEN */
541 at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDCC */
542 at91_set_B_periph(AT91_PIN_PC9, 0); /* LCDD3 */
543 at91_set_B_periph(AT91_PIN_PC10, 0); /* LCDD4 */
544 at91_set_B_periph(AT91_PIN_PC11, 0); /* LCDD5 */
545 at91_set_B_periph(AT91_PIN_PC12, 0); /* LCDD6 */
546 at91_set_B_periph(AT91_PIN_PC13, 0); /* LCDD7 */
547 at91_set_B_periph(AT91_PIN_PC15, 0); /* LCDD11 */
548 at91_set_B_periph(AT91_PIN_PC16, 0); /* LCDD12 */
549 at91_set_B_periph(AT91_PIN_PC17, 0); /* LCDD13 */
550 at91_set_B_periph(AT91_PIN_PC18, 0); /* LCDD14 */
551 at91_set_B_periph(AT91_PIN_PC19, 0); /* LCDD15 */
552 at91_set_B_periph(AT91_PIN_PC20, 0); /* LCDD18 */
553 at91_set_B_periph(AT91_PIN_PC21, 0); /* LCDD19 */
554 at91_set_B_periph(AT91_PIN_PC22, 0); /* LCDD20 */
555 at91_set_B_periph(AT91_PIN_PC23, 0); /* LCDD21 */
556 at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */
557 at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */
558
559 lcdc_data = *data;
560 platform_device_register(&at91_lcdc_device);
561}
562#else
563void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
564#endif
565
566
567/* --------------------------------------------------------------------
568 * Timer/Counter block
569 * -------------------------------------------------------------------- */
570
571#ifdef CONFIG_ATMEL_TCLIB
572
573static struct resource tcb_resources[] = {
574 [0] = {
575 .start = AT91SAM9RL_BASE_TCB0,
576 .end = AT91SAM9RL_BASE_TCB0 + SZ_16K - 1,
577 .flags = IORESOURCE_MEM,
578 },
579 [1] = {
580 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC0,
581 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC0,
582 .flags = IORESOURCE_IRQ,
583 },
584 [2] = {
585 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC1,
586 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC1,
587 .flags = IORESOURCE_IRQ,
588 },
589 [3] = {
590 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC2,
591 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC2,
592 .flags = IORESOURCE_IRQ,
593 },
594};
595
596static struct platform_device at91sam9rl_tcb_device = {
597 .name = "atmel_tcb",
598 .id = 0,
599 .resource = tcb_resources,
600 .num_resources = ARRAY_SIZE(tcb_resources),
601};
602
603static void __init at91_add_device_tc(void)
604{
605 platform_device_register(&at91sam9rl_tcb_device);
606}
607#else
608static void __init at91_add_device_tc(void) { }
609#endif
610
611
612/* --------------------------------------------------------------------
613 * ADC and Touchscreen
614 * -------------------------------------------------------------------- */
615
616#if IS_ENABLED(CONFIG_AT91_ADC)
617static struct at91_adc_data adc_data;
618
619static struct resource adc_resources[] = {
620 [0] = {
621 .start = AT91SAM9RL_BASE_TSC,
622 .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
623 .flags = IORESOURCE_MEM,
624 },
625 [1] = {
626 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
627 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
628 .flags = IORESOURCE_IRQ,
629 }
630};
631
632static struct platform_device at91_adc_device = {
633 .name = "at91sam9rl-adc",
634 .id = -1,
635 .dev = {
636 .platform_data = &adc_data,
637 },
638 .resource = adc_resources,
639 .num_resources = ARRAY_SIZE(adc_resources),
640};
641
642static struct at91_adc_trigger at91_adc_triggers[] = {
643 [0] = {
644 .name = "external-rising",
645 .value = 1,
646 .is_external = true,
647 },
648 [1] = {
649 .name = "external-falling",
650 .value = 2,
651 .is_external = true,
652 },
653 [2] = {
654 .name = "external-any",
655 .value = 3,
656 .is_external = true,
657 },
658 [3] = {
659 .name = "continuous",
660 .value = 6,
661 .is_external = false,
662 },
663};
664
665void __init at91_add_device_adc(struct at91_adc_data *data)
666{
667 if (!data)
668 return;
669
670 if (test_bit(0, &data->channels_used))
671 at91_set_A_periph(AT91_PIN_PA17, 0);
672 if (test_bit(1, &data->channels_used))
673 at91_set_A_periph(AT91_PIN_PA18, 0);
674 if (test_bit(2, &data->channels_used))
675 at91_set_A_periph(AT91_PIN_PA19, 0);
676 if (test_bit(3, &data->channels_used))
677 at91_set_A_periph(AT91_PIN_PA20, 0);
678 if (test_bit(4, &data->channels_used))
679 at91_set_A_periph(AT91_PIN_PD6, 0);
680 if (test_bit(5, &data->channels_used))
681 at91_set_A_periph(AT91_PIN_PD7, 0);
682
683 if (data->use_external_triggers)
684 at91_set_A_periph(AT91_PIN_PB15, 0);
685
686 data->startup_time = 40;
687 data->trigger_number = 4;
688 data->trigger_list = at91_adc_triggers;
689
690 adc_data = *data;
691 platform_device_register(&at91_adc_device);
692}
693#else
694void __init at91_add_device_adc(struct at91_adc_data *data) {}
695#endif
696
697/* --------------------------------------------------------------------
698 * RTC
699 * -------------------------------------------------------------------- */
700
701#if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
702static struct platform_device at91sam9rl_rtc_device = {
703 .name = "at91_rtc",
704 .id = -1,
705 .num_resources = 0,
706};
707
708static void __init at91_add_device_rtc(void)
709{
710 platform_device_register(&at91sam9rl_rtc_device);
711}
712#else
713static void __init at91_add_device_rtc(void) {}
714#endif
715
716
717/* --------------------------------------------------------------------
718 * RTT
719 * -------------------------------------------------------------------- */
720
721static struct resource rtt_resources[] = {
722 {
723 .start = AT91SAM9RL_BASE_RTT,
724 .end = AT91SAM9RL_BASE_RTT + SZ_16 - 1,
725 .flags = IORESOURCE_MEM,
726 }, {
727 .flags = IORESOURCE_MEM,
728 }, {
729 .flags = IORESOURCE_IRQ,
730 }
731};
732
733static struct platform_device at91sam9rl_rtt_device = {
734 .name = "at91_rtt",
735 .id = 0,
736 .resource = rtt_resources,
737};
738
739#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
740static void __init at91_add_device_rtt_rtc(void)
741{
742 at91sam9rl_rtt_device.name = "rtc-at91sam9";
743 /*
744 * The second resource is needed:
745 * GPBR will serve as the storage for RTC time offset
746 */
747 at91sam9rl_rtt_device.num_resources = 3;
748 rtt_resources[1].start = AT91SAM9RL_BASE_GPBR +
749 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
750 rtt_resources[1].end = rtt_resources[1].start + 3;
751 rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
752 rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
753}
754#else
755static void __init at91_add_device_rtt_rtc(void)
756{
757 /* Only one resource is needed: RTT not used as RTC */
758 at91sam9rl_rtt_device.num_resources = 1;
759}
760#endif
761
762static void __init at91_add_device_rtt(void)
763{
764 at91_add_device_rtt_rtc();
765 platform_device_register(&at91sam9rl_rtt_device);
766}
767
768
769/* --------------------------------------------------------------------
770 * Watchdog
771 * -------------------------------------------------------------------- */
772
773#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
774static struct resource wdt_resources[] = {
775 {
776 .start = AT91SAM9RL_BASE_WDT,
777 .end = AT91SAM9RL_BASE_WDT + SZ_16 - 1,
778 .flags = IORESOURCE_MEM,
779 }
780};
781
782static struct platform_device at91sam9rl_wdt_device = {
783 .name = "at91_wdt",
784 .id = -1,
785 .resource = wdt_resources,
786 .num_resources = ARRAY_SIZE(wdt_resources),
787};
788
789static void __init at91_add_device_watchdog(void)
790{
791 platform_device_register(&at91sam9rl_wdt_device);
792}
793#else
794static void __init at91_add_device_watchdog(void) {}
795#endif
796
797
798/* --------------------------------------------------------------------
799 * PWM
800 * --------------------------------------------------------------------*/
801
802#if IS_ENABLED(CONFIG_PWM_ATMEL)
803static struct resource pwm_resources[] = {
804 [0] = {
805 .start = AT91SAM9RL_BASE_PWMC,
806 .end = AT91SAM9RL_BASE_PWMC + SZ_16K - 1,
807 .flags = IORESOURCE_MEM,
808 },
809 [1] = {
810 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_PWMC,
811 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_PWMC,
812 .flags = IORESOURCE_IRQ,
813 },
814};
815
816static struct platform_device at91sam9rl_pwm0_device = {
817 .name = "at91sam9rl-pwm",
818 .id = -1,
819 .resource = pwm_resources,
820 .num_resources = ARRAY_SIZE(pwm_resources),
821};
822
823void __init at91_add_device_pwm(u32 mask)
824{
825 if (mask & (1 << AT91_PWM0))
826 at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM0 */
827
828 if (mask & (1 << AT91_PWM1))
829 at91_set_B_periph(AT91_PIN_PB9, 1); /* enable PWM1 */
830
831 if (mask & (1 << AT91_PWM2))
832 at91_set_B_periph(AT91_PIN_PD5, 1); /* enable PWM2 */
833
834 if (mask & (1 << AT91_PWM3))
835 at91_set_B_periph(AT91_PIN_PD8, 1); /* enable PWM3 */
836
837 platform_device_register(&at91sam9rl_pwm0_device);
838}
839#else
840void __init at91_add_device_pwm(u32 mask) {}
841#endif
842
843
844/* --------------------------------------------------------------------
845 * SSC -- Synchronous Serial Controller
846 * -------------------------------------------------------------------- */
847
848#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
849static u64 ssc0_dmamask = DMA_BIT_MASK(32);
850
851static struct resource ssc0_resources[] = {
852 [0] = {
853 .start = AT91SAM9RL_BASE_SSC0,
854 .end = AT91SAM9RL_BASE_SSC0 + SZ_16K - 1,
855 .flags = IORESOURCE_MEM,
856 },
857 [1] = {
858 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_SSC0,
859 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_SSC0,
860 .flags = IORESOURCE_IRQ,
861 },
862};
863
864static struct platform_device at91sam9rl_ssc0_device = {
865 .name = "at91rm9200_ssc",
866 .id = 0,
867 .dev = {
868 .dma_mask = &ssc0_dmamask,
869 .coherent_dma_mask = DMA_BIT_MASK(32),
870 },
871 .resource = ssc0_resources,
872 .num_resources = ARRAY_SIZE(ssc0_resources),
873};
874
875static inline void configure_ssc0_pins(unsigned pins)
876{
877 if (pins & ATMEL_SSC_TF)
878 at91_set_A_periph(AT91_PIN_PC0, 1);
879 if (pins & ATMEL_SSC_TK)
880 at91_set_A_periph(AT91_PIN_PC1, 1);
881 if (pins & ATMEL_SSC_TD)
882 at91_set_A_periph(AT91_PIN_PA15, 1);
883 if (pins & ATMEL_SSC_RD)
884 at91_set_A_periph(AT91_PIN_PA16, 1);
885 if (pins & ATMEL_SSC_RK)
886 at91_set_B_periph(AT91_PIN_PA10, 1);
887 if (pins & ATMEL_SSC_RF)
888 at91_set_B_periph(AT91_PIN_PA22, 1);
889}
890
891static u64 ssc1_dmamask = DMA_BIT_MASK(32);
892
893static struct resource ssc1_resources[] = {
894 [0] = {
895 .start = AT91SAM9RL_BASE_SSC1,
896 .end = AT91SAM9RL_BASE_SSC1 + SZ_16K - 1,
897 .flags = IORESOURCE_MEM,
898 },
899 [1] = {
900 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_SSC1,
901 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_SSC1,
902 .flags = IORESOURCE_IRQ,
903 },
904};
905
906static struct platform_device at91sam9rl_ssc1_device = {
907 .name = "at91rm9200_ssc",
908 .id = 1,
909 .dev = {
910 .dma_mask = &ssc1_dmamask,
911 .coherent_dma_mask = DMA_BIT_MASK(32),
912 },
913 .resource = ssc1_resources,
914 .num_resources = ARRAY_SIZE(ssc1_resources),
915};
916
917static inline void configure_ssc1_pins(unsigned pins)
918{
919 if (pins & ATMEL_SSC_TF)
920 at91_set_B_periph(AT91_PIN_PA29, 1);
921 if (pins & ATMEL_SSC_TK)
922 at91_set_B_periph(AT91_PIN_PA30, 1);
923 if (pins & ATMEL_SSC_TD)
924 at91_set_B_periph(AT91_PIN_PA13, 1);
925 if (pins & ATMEL_SSC_RD)
926 at91_set_B_periph(AT91_PIN_PA14, 1);
927 if (pins & ATMEL_SSC_RK)
928 at91_set_B_periph(AT91_PIN_PA9, 1);
929 if (pins & ATMEL_SSC_RF)
930 at91_set_B_periph(AT91_PIN_PA8, 1);
931}
932
933/*
934 * SSC controllers are accessed through library code, instead of any
935 * kind of all-singing/all-dancing driver. For example one could be
936 * used by a particular I2S audio codec's driver, while another one
937 * on the same system might be used by a custom data capture driver.
938 */
939void __init at91_add_device_ssc(unsigned id, unsigned pins)
940{
941 struct platform_device *pdev;
942
943 /*
944 * NOTE: caller is responsible for passing information matching
945 * "pins" to whatever will be using each particular controller.
946 */
947 switch (id) {
948 case AT91SAM9RL_ID_SSC0:
949 pdev = &at91sam9rl_ssc0_device;
950 configure_ssc0_pins(pins);
951 break;
952 case AT91SAM9RL_ID_SSC1:
953 pdev = &at91sam9rl_ssc1_device;
954 configure_ssc1_pins(pins);
955 break;
956 default:
957 return;
958 }
959
960 platform_device_register(pdev);
961}
962
963#else
964void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
965#endif
966
967
968/* --------------------------------------------------------------------
969 * UART
970 * -------------------------------------------------------------------- */
971
972#if defined(CONFIG_SERIAL_ATMEL)
973static struct resource dbgu_resources[] = {
974 [0] = {
975 .start = AT91SAM9RL_BASE_DBGU,
976 .end = AT91SAM9RL_BASE_DBGU + SZ_512 - 1,
977 .flags = IORESOURCE_MEM,
978 },
979 [1] = {
980 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
981 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
982 .flags = IORESOURCE_IRQ,
983 },
984};
985
986static struct atmel_uart_data dbgu_data = {
987 .use_dma_tx = 0,
988 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
989};
990
991static u64 dbgu_dmamask = DMA_BIT_MASK(32);
992
993static struct platform_device at91sam9rl_dbgu_device = {
994 .name = "atmel_usart",
995 .id = 0,
996 .dev = {
997 .dma_mask = &dbgu_dmamask,
998 .coherent_dma_mask = DMA_BIT_MASK(32),
999 .platform_data = &dbgu_data,
1000 },
1001 .resource = dbgu_resources,
1002 .num_resources = ARRAY_SIZE(dbgu_resources),
1003};
1004
1005static inline void configure_dbgu_pins(void)
1006{
1007 at91_set_A_periph(AT91_PIN_PA21, 0); /* DRXD */
1008 at91_set_A_periph(AT91_PIN_PA22, 1); /* DTXD */
1009}
1010
1011static struct resource uart0_resources[] = {
1012 [0] = {
1013 .start = AT91SAM9RL_BASE_US0,
1014 .end = AT91SAM9RL_BASE_US0 + SZ_16K - 1,
1015 .flags = IORESOURCE_MEM,
1016 },
1017 [1] = {
1018 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_US0,
1019 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_US0,
1020 .flags = IORESOURCE_IRQ,
1021 },
1022};
1023
1024static struct atmel_uart_data uart0_data = {
1025 .use_dma_tx = 1,
1026 .use_dma_rx = 1,
1027};
1028
1029static u64 uart0_dmamask = DMA_BIT_MASK(32);
1030
1031static struct platform_device at91sam9rl_uart0_device = {
1032 .name = "atmel_usart",
1033 .id = 1,
1034 .dev = {
1035 .dma_mask = &uart0_dmamask,
1036 .coherent_dma_mask = DMA_BIT_MASK(32),
1037 .platform_data = &uart0_data,
1038 },
1039 .resource = uart0_resources,
1040 .num_resources = ARRAY_SIZE(uart0_resources),
1041};
1042
1043static inline void configure_usart0_pins(unsigned pins)
1044{
1045 at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */
1046 at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */
1047
1048 if (pins & ATMEL_UART_RTS)
1049 at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */
1050 if (pins & ATMEL_UART_CTS)
1051 at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */
1052 if (pins & ATMEL_UART_DSR)
1053 at91_set_A_periph(AT91_PIN_PD14, 0); /* DSR0 */
1054 if (pins & ATMEL_UART_DTR)
1055 at91_set_A_periph(AT91_PIN_PD15, 0); /* DTR0 */
1056 if (pins & ATMEL_UART_DCD)
1057 at91_set_A_periph(AT91_PIN_PD16, 0); /* DCD0 */
1058 if (pins & ATMEL_UART_RI)
1059 at91_set_A_periph(AT91_PIN_PD17, 0); /* RI0 */
1060}
1061
1062static struct resource uart1_resources[] = {
1063 [0] = {
1064 .start = AT91SAM9RL_BASE_US1,
1065 .end = AT91SAM9RL_BASE_US1 + SZ_16K - 1,
1066 .flags = IORESOURCE_MEM,
1067 },
1068 [1] = {
1069 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_US1,
1070 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_US1,
1071 .flags = IORESOURCE_IRQ,
1072 },
1073};
1074
1075static struct atmel_uart_data uart1_data = {
1076 .use_dma_tx = 1,
1077 .use_dma_rx = 1,
1078};
1079
1080static u64 uart1_dmamask = DMA_BIT_MASK(32);
1081
1082static struct platform_device at91sam9rl_uart1_device = {
1083 .name = "atmel_usart",
1084 .id = 2,
1085 .dev = {
1086 .dma_mask = &uart1_dmamask,
1087 .coherent_dma_mask = DMA_BIT_MASK(32),
1088 .platform_data = &uart1_data,
1089 },
1090 .resource = uart1_resources,
1091 .num_resources = ARRAY_SIZE(uart1_resources),
1092};
1093
1094static inline void configure_usart1_pins(unsigned pins)
1095{
1096 at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */
1097 at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */
1098
1099 if (pins & ATMEL_UART_RTS)
1100 at91_set_B_periph(AT91_PIN_PA18, 0); /* RTS1 */
1101 if (pins & ATMEL_UART_CTS)
1102 at91_set_B_periph(AT91_PIN_PA19, 0); /* CTS1 */
1103}
1104
1105static struct resource uart2_resources[] = {
1106 [0] = {
1107 .start = AT91SAM9RL_BASE_US2,
1108 .end = AT91SAM9RL_BASE_US2 + SZ_16K - 1,
1109 .flags = IORESOURCE_MEM,
1110 },
1111 [1] = {
1112 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_US2,
1113 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_US2,
1114 .flags = IORESOURCE_IRQ,
1115 },
1116};
1117
1118static struct atmel_uart_data uart2_data = {
1119 .use_dma_tx = 1,
1120 .use_dma_rx = 1,
1121};
1122
1123static u64 uart2_dmamask = DMA_BIT_MASK(32);
1124
1125static struct platform_device at91sam9rl_uart2_device = {
1126 .name = "atmel_usart",
1127 .id = 3,
1128 .dev = {
1129 .dma_mask = &uart2_dmamask,
1130 .coherent_dma_mask = DMA_BIT_MASK(32),
1131 .platform_data = &uart2_data,
1132 },
1133 .resource = uart2_resources,
1134 .num_resources = ARRAY_SIZE(uart2_resources),
1135};
1136
1137static inline void configure_usart2_pins(unsigned pins)
1138{
1139 at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */
1140 at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */
1141
1142 if (pins & ATMEL_UART_RTS)
1143 at91_set_A_periph(AT91_PIN_PA29, 0); /* RTS2 */
1144 if (pins & ATMEL_UART_CTS)
1145 at91_set_A_periph(AT91_PIN_PA30, 0); /* CTS2 */
1146}
1147
1148static struct resource uart3_resources[] = {
1149 [0] = {
1150 .start = AT91SAM9RL_BASE_US3,
1151 .end = AT91SAM9RL_BASE_US3 + SZ_16K - 1,
1152 .flags = IORESOURCE_MEM,
1153 },
1154 [1] = {
1155 .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_US3,
1156 .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_US3,
1157 .flags = IORESOURCE_IRQ,
1158 },
1159};
1160
1161static struct atmel_uart_data uart3_data = {
1162 .use_dma_tx = 1,
1163 .use_dma_rx = 1,
1164};
1165
1166static u64 uart3_dmamask = DMA_BIT_MASK(32);
1167
1168static struct platform_device at91sam9rl_uart3_device = {
1169 .name = "atmel_usart",
1170 .id = 4,
1171 .dev = {
1172 .dma_mask = &uart3_dmamask,
1173 .coherent_dma_mask = DMA_BIT_MASK(32),
1174 .platform_data = &uart3_data,
1175 },
1176 .resource = uart3_resources,
1177 .num_resources = ARRAY_SIZE(uart3_resources),
1178};
1179
1180static inline void configure_usart3_pins(unsigned pins)
1181{
1182 at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */
1183 at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */
1184
1185 if (pins & ATMEL_UART_RTS)
1186 at91_set_B_periph(AT91_PIN_PD4, 0); /* RTS3 */
1187 if (pins & ATMEL_UART_CTS)
1188 at91_set_B_periph(AT91_PIN_PD3, 0); /* CTS3 */
1189}
1190
1191static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1192
1193void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1194{
1195 struct platform_device *pdev;
1196 struct atmel_uart_data *pdata;
1197
1198 switch (id) {
1199 case 0: /* DBGU */
1200 pdev = &at91sam9rl_dbgu_device;
1201 configure_dbgu_pins();
1202 break;
1203 case AT91SAM9RL_ID_US0:
1204 pdev = &at91sam9rl_uart0_device;
1205 configure_usart0_pins(pins);
1206 break;
1207 case AT91SAM9RL_ID_US1:
1208 pdev = &at91sam9rl_uart1_device;
1209 configure_usart1_pins(pins);
1210 break;
1211 case AT91SAM9RL_ID_US2:
1212 pdev = &at91sam9rl_uart2_device;
1213 configure_usart2_pins(pins);
1214 break;
1215 case AT91SAM9RL_ID_US3:
1216 pdev = &at91sam9rl_uart3_device;
1217 configure_usart3_pins(pins);
1218 break;
1219 default:
1220 return;
1221 }
1222 pdata = pdev->dev.platform_data;
1223 pdata->num = portnr; /* update to mapped ID */
1224
1225 if (portnr < ATMEL_MAX_UART)
1226 at91_uarts[portnr] = pdev;
1227}
1228
1229void __init at91_add_device_serial(void)
1230{
1231 int i;
1232
1233 for (i = 0; i < ATMEL_MAX_UART; i++) {
1234 if (at91_uarts[i])
1235 platform_device_register(at91_uarts[i]);
1236 }
1237}
1238#else
1239void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1240void __init at91_add_device_serial(void) {}
1241#endif
1242
1243
1244/* -------------------------------------------------------------------- */
1245
1246/*
1247 * These devices are always present and don't need any board-specific
1248 * setup.
1249 */
1250static int __init at91_add_standard_devices(void)
1251{
1252 at91_add_device_hdmac();
1253 at91_add_device_rtc();
1254 at91_add_device_rtt();
1255 at91_add_device_watchdog();
1256 at91_add_device_tc();
1257 return 0;
1258}
1259
1260arch_initcall(at91_add_standard_devices);
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 028268ff3722..f0d5a69a7237 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -6,317 +6,11 @@
6 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2 or later.
7 */ 7 */
8 8
9#include <linux/module.h> 9#include <asm/system_misc.h>
10#include <linux/dma-mapping.h> 10#include <mach/hardware.h>
11#include <linux/clk/at91_pmc.h>
12 11
13#include <asm/irq.h>
14#include <asm/mach/arch.h>
15#include <asm/mach/map.h>
16#include <mach/at91sam9x5.h>
17#include <mach/cpu.h>
18
19#include "board.h"
20#include "soc.h" 12#include "soc.h"
21#include "generic.h" 13#include "generic.h"
22#include "sam9_smc.h"
23
24#if defined(CONFIG_OLD_CLK_AT91)
25#include "clock.h"
26/* --------------------------------------------------------------------
27 * Clocks
28 * -------------------------------------------------------------------- */
29
30/*
31 * The peripheral clocks.
32 */
33static struct clk pioAB_clk = {
34 .name = "pioAB_clk",
35 .pmc_mask = 1 << AT91SAM9X5_ID_PIOAB,
36 .type = CLK_TYPE_PERIPHERAL,
37};
38static struct clk pioCD_clk = {
39 .name = "pioCD_clk",
40 .pmc_mask = 1 << AT91SAM9X5_ID_PIOCD,
41 .type = CLK_TYPE_PERIPHERAL,
42};
43static struct clk smd_clk = {
44 .name = "smd_clk",
45 .pmc_mask = 1 << AT91SAM9X5_ID_SMD,
46 .type = CLK_TYPE_PERIPHERAL,
47};
48static struct clk usart0_clk = {
49 .name = "usart0_clk",
50 .pmc_mask = 1 << AT91SAM9X5_ID_USART0,
51 .type = CLK_TYPE_PERIPHERAL,
52};
53static struct clk usart1_clk = {
54 .name = "usart1_clk",
55 .pmc_mask = 1 << AT91SAM9X5_ID_USART1,
56 .type = CLK_TYPE_PERIPHERAL,
57};
58static struct clk usart2_clk = {
59 .name = "usart2_clk",
60 .pmc_mask = 1 << AT91SAM9X5_ID_USART2,
61 .type = CLK_TYPE_PERIPHERAL,
62};
63/* USART3 clock - Only for sam9g25/sam9x25 */
64static struct clk usart3_clk = {
65 .name = "usart3_clk",
66 .pmc_mask = 1 << AT91SAM9X5_ID_USART3,
67 .type = CLK_TYPE_PERIPHERAL,
68};
69static struct clk twi0_clk = {
70 .name = "twi0_clk",
71 .pmc_mask = 1 << AT91SAM9X5_ID_TWI0,
72 .type = CLK_TYPE_PERIPHERAL,
73};
74static struct clk twi1_clk = {
75 .name = "twi1_clk",
76 .pmc_mask = 1 << AT91SAM9X5_ID_TWI1,
77 .type = CLK_TYPE_PERIPHERAL,
78};
79static struct clk twi2_clk = {
80 .name = "twi2_clk",
81 .pmc_mask = 1 << AT91SAM9X5_ID_TWI2,
82 .type = CLK_TYPE_PERIPHERAL,
83};
84static struct clk mmc0_clk = {
85 .name = "mci0_clk",
86 .pmc_mask = 1 << AT91SAM9X5_ID_MCI0,
87 .type = CLK_TYPE_PERIPHERAL,
88};
89static struct clk spi0_clk = {
90 .name = "spi0_clk",
91 .pmc_mask = 1 << AT91SAM9X5_ID_SPI0,
92 .type = CLK_TYPE_PERIPHERAL,
93};
94static struct clk spi1_clk = {
95 .name = "spi1_clk",
96 .pmc_mask = 1 << AT91SAM9X5_ID_SPI1,
97 .type = CLK_TYPE_PERIPHERAL,
98};
99static struct clk uart0_clk = {
100 .name = "uart0_clk",
101 .pmc_mask = 1 << AT91SAM9X5_ID_UART0,
102 .type = CLK_TYPE_PERIPHERAL,
103};
104static struct clk uart1_clk = {
105 .name = "uart1_clk",
106 .pmc_mask = 1 << AT91SAM9X5_ID_UART1,
107 .type = CLK_TYPE_PERIPHERAL,
108};
109static struct clk tcb0_clk = {
110 .name = "tcb0_clk",
111 .pmc_mask = 1 << AT91SAM9X5_ID_TCB,
112 .type = CLK_TYPE_PERIPHERAL,
113};
114static struct clk pwm_clk = {
115 .name = "pwm_clk",
116 .pmc_mask = 1 << AT91SAM9X5_ID_PWM,
117 .type = CLK_TYPE_PERIPHERAL,
118};
119static struct clk adc_clk = {
120 .name = "adc_clk",
121 .pmc_mask = 1 << AT91SAM9X5_ID_ADC,
122 .type = CLK_TYPE_PERIPHERAL,
123};
124static struct clk adc_op_clk = {
125 .name = "adc_op_clk",
126 .type = CLK_TYPE_PERIPHERAL,
127 .rate_hz = 5000000,
128};
129static struct clk dma0_clk = {
130 .name = "dma0_clk",
131 .pmc_mask = 1 << AT91SAM9X5_ID_DMA0,
132 .type = CLK_TYPE_PERIPHERAL,
133};
134static struct clk dma1_clk = {
135 .name = "dma1_clk",
136 .pmc_mask = 1 << AT91SAM9X5_ID_DMA1,
137 .type = CLK_TYPE_PERIPHERAL,
138};
139static struct clk uhphs_clk = {
140 .name = "uhphs",
141 .pmc_mask = 1 << AT91SAM9X5_ID_UHPHS,
142 .type = CLK_TYPE_PERIPHERAL,
143};
144static struct clk udphs_clk = {
145 .name = "udphs_clk",
146 .pmc_mask = 1 << AT91SAM9X5_ID_UDPHS,
147 .type = CLK_TYPE_PERIPHERAL,
148};
149/* emac0 clock - Only for sam9g25/sam9x25/sam9g35/sam9x35 */
150static struct clk macb0_clk = {
151 .name = "pclk",
152 .pmc_mask = 1 << AT91SAM9X5_ID_EMAC0,
153 .type = CLK_TYPE_PERIPHERAL,
154};
155/* lcd clock - Only for sam9g15/sam9g35/sam9x35 */
156static struct clk lcdc_clk = {
157 .name = "lcdc_clk",
158 .pmc_mask = 1 << AT91SAM9X5_ID_LCDC,
159 .type = CLK_TYPE_PERIPHERAL,
160};
161/* isi clock - Only for sam9g25 */
162static struct clk isi_clk = {
163 .name = "isi_clk",
164 .pmc_mask = 1 << AT91SAM9X5_ID_ISI,
165 .type = CLK_TYPE_PERIPHERAL,
166};
167static struct clk mmc1_clk = {
168 .name = "mci1_clk",
169 .pmc_mask = 1 << AT91SAM9X5_ID_MCI1,
170 .type = CLK_TYPE_PERIPHERAL,
171};
172/* emac1 clock - Only for sam9x25 */
173static struct clk macb1_clk = {
174 .name = "pclk",
175 .pmc_mask = 1 << AT91SAM9X5_ID_EMAC1,
176 .type = CLK_TYPE_PERIPHERAL,
177};
178static struct clk ssc_clk = {
179 .name = "ssc_clk",
180 .pmc_mask = 1 << AT91SAM9X5_ID_SSC,
181 .type = CLK_TYPE_PERIPHERAL,
182};
183/* can0 clock - Only for sam9x35 */
184static struct clk can0_clk = {
185 .name = "can0_clk",
186 .pmc_mask = 1 << AT91SAM9X5_ID_CAN0,
187 .type = CLK_TYPE_PERIPHERAL,
188};
189/* can1 clock - Only for sam9x35 */
190static struct clk can1_clk = {
191 .name = "can1_clk",
192 .pmc_mask = 1 << AT91SAM9X5_ID_CAN1,
193 .type = CLK_TYPE_PERIPHERAL,
194};
195
196static struct clk *periph_clocks[] __initdata = {
197 &pioAB_clk,
198 &pioCD_clk,
199 &smd_clk,
200 &usart0_clk,
201 &usart1_clk,
202 &usart2_clk,
203 &twi0_clk,
204 &twi1_clk,
205 &twi2_clk,
206 &mmc0_clk,
207 &spi0_clk,
208 &spi1_clk,
209 &uart0_clk,
210 &uart1_clk,
211 &tcb0_clk,
212 &pwm_clk,
213 &adc_clk,
214 &adc_op_clk,
215 &dma0_clk,
216 &dma1_clk,
217 &uhphs_clk,
218 &udphs_clk,
219 &mmc1_clk,
220 &ssc_clk,
221 // irq0
222};
223
224static struct clk_lookup periph_clocks_lookups[] = {
225 /* lookup table for DT entries */
226 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
227 CLKDEV_CON_DEV_ID("usart", "f801c000.serial", &usart0_clk),
228 CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart1_clk),
229 CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart2_clk),
230 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
231 CLKDEV_CON_DEV_ID("usart", "f8040000.serial", &uart0_clk),
232 CLKDEV_CON_DEV_ID("usart", "f8044000.serial", &uart1_clk),
233 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk),
234 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
235 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc0_clk),
236 CLKDEV_CON_DEV_ID("mci_clk", "f000c000.mmc", &mmc1_clk),
237 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
238 CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
239 CLKDEV_CON_DEV_ID("pclk", "f0010000.ssc", &ssc_clk),
240 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
241 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
242 CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
243 CLKDEV_CON_DEV_ID("spi_clk", "f0000000.spi", &spi0_clk),
244 CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi1_clk),
245 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk),
246 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk),
247 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk),
248 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCD_clk),
249 /* additional fake clock for macb_hclk */
250 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk),
251 CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk),
252 CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk),
253 CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk),
254 CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk),
255 CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk),
256 CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk),
257 CLKDEV_CON_DEV_ID(NULL, "f8034000.pwm", &pwm_clk),
258};
259
260/*
261 * The two programmable clocks.
262 * You must configure pin multiplexing to bring these signals out.
263 */
264static struct clk pck0 = {
265 .name = "pck0",
266 .pmc_mask = AT91_PMC_PCK0,
267 .type = CLK_TYPE_PROGRAMMABLE,
268 .id = 0,
269};
270static struct clk pck1 = {
271 .name = "pck1",
272 .pmc_mask = AT91_PMC_PCK1,
273 .type = CLK_TYPE_PROGRAMMABLE,
274 .id = 1,
275};
276
277static void __init at91sam9x5_register_clocks(void)
278{
279 int i;
280
281 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
282 clk_register(periph_clocks[i]);
283
284 clkdev_add_table(periph_clocks_lookups,
285 ARRAY_SIZE(periph_clocks_lookups));
286
287 if (cpu_is_at91sam9g25()
288 || cpu_is_at91sam9x25())
289 clk_register(&usart3_clk);
290
291 if (cpu_is_at91sam9g25()
292 || cpu_is_at91sam9x25()
293 || cpu_is_at91sam9g35()
294 || cpu_is_at91sam9x35())
295 clk_register(&macb0_clk);
296
297 if (cpu_is_at91sam9g15()
298 || cpu_is_at91sam9g35()
299 || cpu_is_at91sam9x35())
300 clk_register(&lcdc_clk);
301
302 if (cpu_is_at91sam9g25())
303 clk_register(&isi_clk);
304
305 if (cpu_is_at91sam9x25())
306 clk_register(&macb1_clk);
307
308 if (cpu_is_at91sam9x25()
309 || cpu_is_at91sam9x35()) {
310 clk_register(&can0_clk);
311 clk_register(&can1_clk);
312 }
313
314 clk_register(&pck0);
315 clk_register(&pck1);
316}
317#else
318#define at91sam9x5_register_clocks NULL
319#endif
320 14
321/* -------------------------------------------------------------------- 15/* --------------------------------------------------------------------
322 * AT91SAM9x5 processor initialization 16 * AT91SAM9x5 processor initialization
@@ -338,6 +32,5 @@ static void __init at91sam9x5_initialize(void)
338 32
339AT91_SOC_START(at91sam9x5) 33AT91_SOC_START(at91sam9x5)
340 .map_io = at91sam9x5_map_io, 34 .map_io = at91sam9x5_map_io,
341 .register_clocks = at91sam9x5_register_clocks,
342 .init = at91sam9x5_initialize, 35 .init = at91sam9x5_initialize,
343AT91_SOC_END 36AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
deleted file mode 100644
index 7523f1cdfe1d..000000000000
--- a/arch/arm/mach-at91/at91x40.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91x40.c
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com>
5 * Copyright (C) 2005 SAN People
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
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <linux/io.h>
17#include <asm/proc-fns.h>
18#include <asm/system_misc.h>
19#include <asm/mach/arch.h>
20#include <mach/at91x40.h>
21#include <mach/at91_st.h>
22#include <mach/hardware.h>
23
24#include "at91_aic.h"
25#include "generic.h"
26
27/*
28 * Export the clock functions for the AT91X40. Some external code common
29 * to all AT91 family parts relys on this, like the gpio and serial support.
30 */
31int clk_enable(struct clk *clk)
32{
33 return 0;
34}
35
36void clk_disable(struct clk *clk)
37{
38}
39
40unsigned long clk_get_rate(struct clk *clk)
41{
42 return AT91X40_MASTER_CLOCK;
43}
44
45static void at91x40_idle(void)
46{
47 /*
48 * Disable the processor clock. The processor will be automatically
49 * re-enabled by an interrupt or by a reset.
50 */
51 __raw_writel(AT91_PS_CR_CPU, AT91_IO_P2V(AT91_PS_CR));
52 cpu_do_idle();
53}
54
55void __init at91x40_initialize(unsigned long main_clock)
56{
57 arm_pm_idle = at91x40_idle;
58}
59
60/*
61 * The default interrupt priority levels (0 = lowest, 7 = highest).
62 */
63static unsigned int at91x40_default_irq_priority[NR_AIC_IRQS] __initdata = {
64 7, /* Advanced Interrupt Controller (FIQ) */
65 0, /* System Peripherals */
66 0, /* USART 0 */
67 0, /* USART 1 */
68 2, /* Timer Counter 0 */
69 2, /* Timer Counter 1 */
70 2, /* Timer Counter 2 */
71 0, /* Watchdog timer */
72 0, /* Parallel IO Controller A */
73 0, /* Reserved */
74 0, /* Reserved */
75 0, /* Reserved */
76 0, /* Reserved */
77 0, /* Reserved */
78 0, /* Reserved */
79 0, /* Reserved */
80 0, /* External IRQ0 */
81 0, /* External IRQ1 */
82 0, /* External IRQ2 */
83};
84
85void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS])
86{
87 u32 extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
88 | (1 << AT91X40_ID_IRQ2);
89 if (!priority)
90 priority = at91x40_default_irq_priority;
91
92 at91_aic_init(priority, extern_irq);
93}
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
deleted file mode 100644
index 07d0bf2ac2da..000000000000
--- a/arch/arm/mach-at91/at91x40_time.c
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91x40_time.c
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/interrupt.h>
24#include <linux/irq.h>
25#include <linux/time.h>
26#include <linux/io.h>
27#include <mach/hardware.h>
28#include <mach/at91x40.h>
29#include <asm/mach/time.h>
30
31#include "at91_tc.h"
32
33#define at91_tc_read(field) \
34 __raw_readl(AT91_IO_P2V(AT91_TC) + field)
35
36#define at91_tc_write(field, value) \
37 __raw_writel(value, AT91_IO_P2V(AT91_TC) + field)
38
39/*
40 * 3 counter/timer units present.
41 */
42#define AT91_TC_CLK0BASE 0
43#define AT91_TC_CLK1BASE 0x40
44#define AT91_TC_CLK2BASE 0x80
45
46static u32 at91x40_gettimeoffset(void)
47{
48 return (at91_tc_read(AT91_TC_CLK1BASE + AT91_TC_CV) * 1000000 /
49 (AT91X40_MASTER_CLOCK / 128)) * 1000;
50}
51
52static irqreturn_t at91x40_timer_interrupt(int irq, void *dev_id)
53{
54 at91_tc_read(AT91_TC_CLK1BASE + AT91_TC_SR);
55 timer_tick();
56 return IRQ_HANDLED;
57}
58
59static struct irqaction at91x40_timer_irq = {
60 .name = "at91_tick",
61 .flags = IRQF_TIMER,
62 .handler = at91x40_timer_interrupt
63};
64
65void __init at91x40_timer_init(void)
66{
67 unsigned int v;
68
69 arch_gettimeoffset = at91x40_gettimeoffset;
70
71 at91_tc_write(AT91_TC_BCR, 0);
72 v = at91_tc_read(AT91_TC_BMR);
73 v = (v & ~AT91_TC_TC1XC1S) | AT91_TC_TC1XC1S_NONE;
74 at91_tc_write(AT91_TC_BMR, v);
75
76 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_CCR, AT91_TC_CLKDIS);
77 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_CMR, (AT91_TC_TIMER_CLOCK4 | AT91_TC_CPCTRG));
78 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_IDR, 0xffffffff);
79 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_RC, (AT91X40_MASTER_CLOCK / 128) / HZ - 1);
80 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_IER, (1<<4));
81
82 setup_irq(AT91X40_ID_TC1, &at91x40_timer_irq);
83
84 at91_tc_write(AT91_TC_CLK1BASE + AT91_TC_CCR, (AT91_TC_SWTRG | AT91_TC_CLKEN));
85}
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
deleted file mode 100644
index 3f6dbcc34022..000000000000
--- a/arch/arm/mach-at91/board-1arm.c
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-1arm.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/gpio.h>
23#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/platform_device.h>
27
28#include <mach/hardware.h>
29#include <asm/setup.h>
30#include <asm/mach-types.h>
31#include <asm/irq.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/mach/irq.h>
36
37#include <mach/cpu.h>
38
39#include "at91_aic.h"
40#include "board.h"
41#include "generic.h"
42#include "gpio.h"
43
44static void __init onearm_init_early(void)
45{
46 /* Set cpu type: PQFP */
47 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
48
49 /* Initialize processor: 18.432 MHz crystal */
50 at91_initialize(18432000);
51}
52
53static struct macb_platform_data __initdata onearm_eth_data = {
54 .phy_irq_pin = AT91_PIN_PC4,
55 .is_rmii = 1,
56};
57
58static struct at91_usbh_data __initdata onearm_usbh_data = {
59 .ports = 1,
60 .vbus_pin = {-EINVAL, -EINVAL},
61 .overcurrent_pin= {-EINVAL, -EINVAL},
62};
63
64static struct at91_udc_data __initdata onearm_udc_data = {
65 .vbus_pin = AT91_PIN_PC2,
66 .pullup_pin = AT91_PIN_PC3,
67};
68
69static void __init onearm_board_init(void)
70{
71 /* Serial */
72 /* DBGU on ttyS0. (Rx & Tx only) */
73 at91_register_uart(0, 0, 0);
74
75 /* USART0 on ttyS1 (Rx, Tx, CTS, RTS) */
76 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
77
78 /* USART1 on ttyS2 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
79 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
80 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
81 | ATMEL_UART_RI);
82 at91_add_device_serial();
83 /* Ethernet */
84 at91_add_device_eth(&onearm_eth_data);
85 /* USB Host */
86 at91_add_device_usbh(&onearm_usbh_data);
87 /* USB Device */
88 at91_add_device_udc(&onearm_udc_data);
89}
90
91MACHINE_START(ONEARM, "Ajeco 1ARM single board computer")
92 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
93 .init_time = at91rm9200_timer_init,
94 .map_io = at91_map_io,
95 .handle_irq = at91_aic_handle_irq,
96 .init_early = onearm_init_early,
97 .init_irq = at91_init_irq_default,
98 .init_machine = onearm_board_init,
99MACHINE_END
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
deleted file mode 100644
index e76e35ce81e7..000000000000
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-afeb-9260v1.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2008 Sergey Lapin
7 *
8 * A custom board designed as open hardware; PCBs and various information
9 * is available at http://groups.google.com/group/arm9fpga-evolution-board/
10 * Subversion repository: svn://194.85.238.22/home/users/george/svn/arm9eb
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27#include <linux/types.h>
28#include <linux/gpio.h>
29#include <linux/init.h>
30#include <linux/mm.h>
31#include <linux/module.h>
32#include <linux/platform_device.h>
33#include <linux/spi/spi.h>
34#include <linux/clk.h>
35#include <linux/dma-mapping.h>
36
37#include <mach/hardware.h>
38#include <asm/setup.h>
39#include <asm/mach-types.h>
40#include <asm/irq.h>
41
42#include <asm/mach/arch.h>
43#include <asm/mach/map.h>
44#include <asm/mach/irq.h>
45
46#include "at91_aic.h"
47#include "board.h"
48#include "generic.h"
49#include "gpio.h"
50
51
52static void __init afeb9260_init_early(void)
53{
54 /* Initialize processor: 18.432 MHz crystal */
55 at91_initialize(18432000);
56}
57
58/*
59 * USB Host port
60 */
61static struct at91_usbh_data __initdata afeb9260_usbh_data = {
62 .ports = 1,
63 .vbus_pin = {-EINVAL, -EINVAL},
64 .overcurrent_pin= {-EINVAL, -EINVAL},
65};
66
67/*
68 * USB Device port
69 */
70static struct at91_udc_data __initdata afeb9260_udc_data = {
71 .vbus_pin = AT91_PIN_PC5,
72 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
73};
74
75
76
77/*
78 * SPI devices.
79 */
80static struct spi_board_info afeb9260_spi_devices[] = {
81 { /* DataFlash chip */
82 .modalias = "mtd_dataflash",
83 .chip_select = 1,
84 .max_speed_hz = 15 * 1000 * 1000,
85 .bus_num = 0,
86 },
87};
88
89
90/*
91 * MACB Ethernet device
92 */
93static struct macb_platform_data __initdata afeb9260_macb_data = {
94 .phy_irq_pin = AT91_PIN_PA9,
95 .is_rmii = 0,
96};
97
98
99/*
100 * NAND flash
101 */
102static struct mtd_partition __initdata afeb9260_nand_partition[] = {
103 {
104 .name = "bootloader",
105 .offset = 0,
106 .size = (640 * SZ_1K),
107 },
108 {
109 .name = "kernel",
110 .offset = MTDPART_OFS_NXTBLK,
111 .size = SZ_2M,
112 },
113 {
114 .name = "rootfs",
115 .offset = MTDPART_OFS_NXTBLK,
116 .size = MTDPART_SIZ_FULL,
117 },
118};
119
120static struct atmel_nand_data __initdata afeb9260_nand_data = {
121 .ale = 21,
122 .cle = 22,
123 .rdy_pin = AT91_PIN_PC13,
124 .enable_pin = AT91_PIN_PC14,
125 .bus_width_16 = 0,
126 .ecc_mode = NAND_ECC_SOFT,
127 .parts = afeb9260_nand_partition,
128 .num_parts = ARRAY_SIZE(afeb9260_nand_partition),
129 .det_pin = -EINVAL,
130};
131
132
133/*
134 * MCI (SD/MMC)
135 */
136static struct mci_platform_data __initdata afeb9260_mci0_data = {
137 .slot[1] = {
138 .bus_width = 4,
139 .detect_pin = AT91_PIN_PC9,
140 .wp_pin = AT91_PIN_PC4,
141 },
142};
143
144
145
146static struct i2c_board_info __initdata afeb9260_i2c_devices[] = {
147 {
148 I2C_BOARD_INFO("tlv320aic23", 0x1a),
149 }, {
150 I2C_BOARD_INFO("fm3130", 0x68),
151 }, {
152 I2C_BOARD_INFO("24c64", 0x50),
153 },
154};
155
156/*
157 * IDE (CF True IDE mode)
158 */
159static struct at91_cf_data afeb9260_cf_data = {
160 .chipselect = 4,
161 .irq_pin = AT91_PIN_PA6,
162 .det_pin = -EINVAL,
163 .vcc_pin = -EINVAL,
164 .rst_pin = AT91_PIN_PA7,
165 .flags = AT91_CF_TRUE_IDE,
166};
167
168static void __init afeb9260_board_init(void)
169{
170 at91_register_devices();
171
172 /* Serial */
173 /* DBGU on ttyS0. (Rx & Tx only) */
174 at91_register_uart(0, 0, 0);
175
176 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
177 at91_register_uart(AT91SAM9260_ID_US0, 1,
178 ATMEL_UART_CTS | ATMEL_UART_RTS
179 | ATMEL_UART_DTR | ATMEL_UART_DSR
180 | ATMEL_UART_DCD | ATMEL_UART_RI);
181
182 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
183 at91_register_uart(AT91SAM9260_ID_US1, 2,
184 ATMEL_UART_CTS | ATMEL_UART_RTS);
185 at91_add_device_serial();
186 /* USB Host */
187 at91_add_device_usbh(&afeb9260_usbh_data);
188 /* USB Device */
189 at91_add_device_udc(&afeb9260_udc_data);
190 /* SPI */
191 at91_add_device_spi(afeb9260_spi_devices,
192 ARRAY_SIZE(afeb9260_spi_devices));
193 /* NAND */
194 at91_add_device_nand(&afeb9260_nand_data);
195 /* Ethernet */
196 at91_add_device_eth(&afeb9260_macb_data);
197
198 /* Standard function's pin assignments are not
199 * appropriate for us and generic code provide
200 * no API to configure these pins any other way */
201 at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */
202 at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */
203 /* MMC */
204 at91_add_device_mci(0, &afeb9260_mci0_data);
205 /* I2C */
206 at91_add_device_i2c(afeb9260_i2c_devices,
207 ARRAY_SIZE(afeb9260_i2c_devices));
208 /* Audio */
209 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
210 /* IDE */
211 at91_add_device_cf(&afeb9260_cf_data);
212}
213
214MACHINE_START(AFEB9260, "Custom afeb9260 board")
215 /* Maintainer: Sergey Lapin <slapin@ossfans.org> */
216 .init_time = at91_init_time,
217 .map_io = at91_map_io,
218 .handle_irq = at91_aic_handle_irq,
219 .init_early = afeb9260_init_early,
220 .init_irq = at91_init_irq_default,
221 .init_machine = afeb9260_board_init,
222MACHINE_END
223
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
deleted file mode 100644
index ae827dd2d0d2..000000000000
--- a/arch/arm/mach-at91/board-cam60.c
+++ /dev/null
@@ -1,199 +0,0 @@
1/*
2 * KwikByte CAM60 (KB9260)
3 *
4 * based on board-sam9260ek.c
5 * Copyright (C) 2005 SAN People
6 * Copyright (C) 2006 Atmel
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/gpio.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/spi/spi.h>
30#include <linux/spi/flash.h>
31
32#include <mach/hardware.h>
33#include <asm/setup.h>
34#include <asm/mach-types.h>
35#include <asm/irq.h>
36
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39#include <asm/mach/irq.h>
40
41#include <mach/at91sam9_smc.h>
42
43#include "at91_aic.h"
44#include "board.h"
45#include "sam9_smc.h"
46#include "generic.h"
47#include "gpio.h"
48
49
50static void __init cam60_init_early(void)
51{
52 /* Initialize processor: 10 MHz crystal */
53 at91_initialize(10000000);
54}
55
56/*
57 * USB Host
58 */
59static struct at91_usbh_data __initdata cam60_usbh_data = {
60 .ports = 1,
61 .vbus_pin = {-EINVAL, -EINVAL},
62 .overcurrent_pin= {-EINVAL, -EINVAL},
63};
64
65
66/*
67 * SPI devices.
68 */
69#if defined(CONFIG_MTD_DATAFLASH)
70static struct mtd_partition cam60_spi_partitions[] = {
71 {
72 .name = "BOOT1",
73 .offset = 0,
74 .size = 4 * 1056,
75 },
76 {
77 .name = "BOOT2",
78 .offset = MTDPART_OFS_NXTBLK,
79 .size = 256 * 1056,
80 },
81 {
82 .name = "kernel",
83 .offset = MTDPART_OFS_NXTBLK,
84 .size = 2222 * 1056,
85 },
86 {
87 .name = "file system",
88 .offset = MTDPART_OFS_NXTBLK,
89 .size = MTDPART_SIZ_FULL,
90 },
91};
92
93static struct flash_platform_data cam60_spi_flash_platform_data = {
94 .name = "spi_flash",
95 .parts = cam60_spi_partitions,
96 .nr_parts = ARRAY_SIZE(cam60_spi_partitions)
97};
98#endif
99
100static struct spi_board_info cam60_spi_devices[] __initdata = {
101#if defined(CONFIG_MTD_DATAFLASH)
102 { /* DataFlash chip */
103 .modalias = "mtd_dataflash",
104 .chip_select = 0,
105 .max_speed_hz = 15 * 1000 * 1000,
106 .bus_num = 0,
107 .platform_data = &cam60_spi_flash_platform_data
108 },
109#endif
110};
111
112
113/*
114 * MACB Ethernet device
115 */
116static struct macb_platform_data cam60_macb_data __initdata = {
117 .phy_irq_pin = AT91_PIN_PB5,
118 .is_rmii = 0,
119};
120
121
122/*
123 * NAND Flash
124 */
125static struct mtd_partition __initdata cam60_nand_partition[] = {
126 {
127 .name = "nand_fs",
128 .offset = 0,
129 .size = MTDPART_SIZ_FULL,
130 },
131};
132
133static struct atmel_nand_data __initdata cam60_nand_data = {
134 .ale = 21,
135 .cle = 22,
136 .det_pin = -EINVAL,
137 .rdy_pin = AT91_PIN_PA9,
138 .enable_pin = AT91_PIN_PA7,
139 .ecc_mode = NAND_ECC_SOFT,
140 .parts = cam60_nand_partition,
141 .num_parts = ARRAY_SIZE(cam60_nand_partition),
142};
143
144static struct sam9_smc_config __initdata cam60_nand_smc_config = {
145 .ncs_read_setup = 0,
146 .nrd_setup = 1,
147 .ncs_write_setup = 0,
148 .nwe_setup = 1,
149
150 .ncs_read_pulse = 3,
151 .nrd_pulse = 3,
152 .ncs_write_pulse = 3,
153 .nwe_pulse = 3,
154
155 .read_cycle = 5,
156 .write_cycle = 5,
157
158 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
159 .tdf_cycles = 2,
160};
161
162static void __init cam60_add_device_nand(void)
163{
164 /* configure chip-select 3 (NAND) */
165 sam9_smc_configure(0, 3, &cam60_nand_smc_config);
166
167 at91_add_device_nand(&cam60_nand_data);
168}
169
170
171static void __init cam60_board_init(void)
172{
173 at91_register_devices();
174
175 /* Serial */
176 /* DBGU on ttyS0. (Rx & Tx only) */
177 at91_register_uart(0, 0, 0);
178 at91_add_device_serial();
179 /* SPI */
180 at91_add_device_spi(cam60_spi_devices, ARRAY_SIZE(cam60_spi_devices));
181 /* Ethernet */
182 at91_add_device_eth(&cam60_macb_data);
183 /* USB Host */
184 /* enable USB power supply circuit */
185 at91_set_gpio_output(AT91_PIN_PB18, 1);
186 at91_add_device_usbh(&cam60_usbh_data);
187 /* NAND */
188 cam60_add_device_nand();
189}
190
191MACHINE_START(CAM60, "KwikByte CAM60")
192 /* Maintainer: KwikByte */
193 .init_time = at91_init_time,
194 .map_io = at91_map_io,
195 .handle_irq = at91_aic_handle_irq,
196 .init_early = cam60_init_early,
197 .init_irq = at91_init_irq_default,
198 .init_machine = cam60_board_init,
199MACHINE_END
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
deleted file mode 100644
index 47313d3ee037..000000000000
--- a/arch/arm/mach-at91/board-carmeva.c
+++ /dev/null
@@ -1,167 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-carmeva.c
3 *
4 * Copyright (c) 2005 Peer Georgi
5 * Conitec Datasystems
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/gpio.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28
29#include <asm/setup.h>
30#include <asm/mach-types.h>
31#include <asm/irq.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/mach/irq.h>
36
37#include <mach/hardware.h>
38
39#include "at91_aic.h"
40#include "board.h"
41#include "generic.h"
42#include "gpio.h"
43
44
45static void __init carmeva_init_early(void)
46{
47 /* Initialize processor: 20.000 MHz crystal */
48 at91_initialize(20000000);
49}
50
51static struct macb_platform_data __initdata carmeva_eth_data = {
52 .phy_irq_pin = AT91_PIN_PC4,
53 .is_rmii = 1,
54};
55
56static struct at91_usbh_data __initdata carmeva_usbh_data = {
57 .ports = 2,
58 .vbus_pin = {-EINVAL, -EINVAL},
59 .overcurrent_pin= {-EINVAL, -EINVAL},
60};
61
62static struct at91_udc_data __initdata carmeva_udc_data = {
63 .vbus_pin = AT91_PIN_PD12,
64 .pullup_pin = AT91_PIN_PD9,
65};
66
67/* FIXME: user dependent */
68// static struct at91_cf_data __initdata carmeva_cf_data = {
69// .det_pin = AT91_PIN_PB0,
70// .rst_pin = AT91_PIN_PC5,
71 // .irq_pin = -EINVAL,
72 // .vcc_pin = -EINVAL,
73// };
74
75static struct mci_platform_data __initdata carmeva_mci0_data = {
76 .slot[0] = {
77 .bus_width = 4,
78 .detect_pin = AT91_PIN_PB10,
79 .wp_pin = AT91_PIN_PC14,
80 },
81};
82
83static struct spi_board_info carmeva_spi_devices[] = {
84 { /* DataFlash chip */
85 .modalias = "mtd_dataflash",
86 .chip_select = 0,
87 .max_speed_hz = 10 * 1000 * 1000,
88 },
89 { /* User accessible spi - cs1 (250KHz) */
90 .modalias = "spi-cs1",
91 .chip_select = 1,
92 .max_speed_hz = 250 * 1000,
93 },
94 { /* User accessible spi - cs2 (1MHz) */
95 .modalias = "spi-cs2",
96 .chip_select = 2,
97 .max_speed_hz = 1 * 1000 * 1000,
98 },
99 { /* User accessible spi - cs3 (10MHz) */
100 .modalias = "spi-cs3",
101 .chip_select = 3,
102 .max_speed_hz = 10 * 1000 * 1000,
103 },
104};
105
106static struct gpio_led carmeva_leds[] = {
107 { /* "user led 1", LED9 */
108 .name = "led9",
109 .gpio = AT91_PIN_PA21,
110 .active_low = 1,
111 .default_trigger = "heartbeat",
112 },
113 { /* "user led 2", LED10 */
114 .name = "led10",
115 .gpio = AT91_PIN_PA25,
116 .active_low = 1,
117 },
118 { /* "user led 3", LED11 */
119 .name = "led11",
120 .gpio = AT91_PIN_PA26,
121 .active_low = 1,
122 },
123 { /* "user led 4", LED12 */
124 .name = "led12",
125 .gpio = AT91_PIN_PA18,
126 .active_low = 1,
127 }
128};
129
130static void __init carmeva_board_init(void)
131{
132 /* Serial */
133 /* DBGU on ttyS0. (Rx & Tx only) */
134 at91_register_uart(0, 0, 0);
135
136 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
137 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
138 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
139 | ATMEL_UART_RI);
140 at91_add_device_serial();
141 /* Ethernet */
142 at91_add_device_eth(&carmeva_eth_data);
143 /* USB Host */
144 at91_add_device_usbh(&carmeva_usbh_data);
145 /* USB Device */
146 at91_add_device_udc(&carmeva_udc_data);
147 /* I2C */
148 at91_add_device_i2c(NULL, 0);
149 /* SPI */
150 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices));
151 /* Compact Flash */
152// at91_add_device_cf(&carmeva_cf_data);
153 /* MMC */
154 at91_add_device_mci(0, &carmeva_mci0_data);
155 /* LEDs */
156 at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds));
157}
158
159MACHINE_START(CARMEVA, "Carmeva")
160 /* Maintainer: Conitec Datasystems */
161 .init_time = at91rm9200_timer_init,
162 .map_io = at91_map_io,
163 .handle_irq = at91_aic_handle_irq,
164 .init_early = carmeva_init_early,
165 .init_irq = at91_init_irq_default,
166 .init_machine = carmeva_board_init,
167MACHINE_END
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
deleted file mode 100644
index 731c8318f4f5..000000000000
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ /dev/null
@@ -1,386 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-cpu9krea.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2009 Eric Benard - eric@eukrea.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, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/gpio.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/clk.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
32#include <linux/mtd/physmap.h>
33
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <mach/hardware.h>
43#include <mach/at91sam9_smc.h>
44#include <mach/at91sam9260_matrix.h>
45#include <mach/at91_matrix.h>
46
47#include "at91_aic.h"
48#include "board.h"
49#include "sam9_smc.h"
50#include "generic.h"
51#include "gpio.h"
52
53static void __init cpu9krea_init_early(void)
54{
55 /* Initialize processor: 18.432 MHz crystal */
56 at91_initialize(18432000);
57}
58
59/*
60 * USB Host port
61 */
62static struct at91_usbh_data __initdata cpu9krea_usbh_data = {
63 .ports = 2,
64 .vbus_pin = {-EINVAL, -EINVAL},
65 .overcurrent_pin= {-EINVAL, -EINVAL},
66};
67
68/*
69 * USB Device port
70 */
71static struct at91_udc_data __initdata cpu9krea_udc_data = {
72 .vbus_pin = AT91_PIN_PC8,
73 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
74};
75
76/*
77 * MACB Ethernet device
78 */
79static struct macb_platform_data __initdata cpu9krea_macb_data = {
80 .phy_irq_pin = -EINVAL,
81 .is_rmii = 1,
82};
83
84/*
85 * NAND flash
86 */
87static struct atmel_nand_data __initdata cpu9krea_nand_data = {
88 .ale = 21,
89 .cle = 22,
90 .rdy_pin = AT91_PIN_PC13,
91 .enable_pin = AT91_PIN_PC14,
92 .bus_width_16 = 0,
93 .det_pin = -EINVAL,
94 .ecc_mode = NAND_ECC_SOFT,
95};
96
97#ifdef CONFIG_MACH_CPU9260
98static struct sam9_smc_config __initdata cpu9krea_nand_smc_config = {
99 .ncs_read_setup = 0,
100 .nrd_setup = 1,
101 .ncs_write_setup = 0,
102 .nwe_setup = 1,
103
104 .ncs_read_pulse = 3,
105 .nrd_pulse = 3,
106 .ncs_write_pulse = 3,
107 .nwe_pulse = 3,
108
109 .read_cycle = 5,
110 .write_cycle = 5,
111
112 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE
113 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
114 .tdf_cycles = 2,
115};
116#else
117static struct sam9_smc_config __initdata cpu9krea_nand_smc_config = {
118 .ncs_read_setup = 0,
119 .nrd_setup = 2,
120 .ncs_write_setup = 0,
121 .nwe_setup = 2,
122
123 .ncs_read_pulse = 4,
124 .nrd_pulse = 4,
125 .ncs_write_pulse = 4,
126 .nwe_pulse = 4,
127
128 .read_cycle = 7,
129 .write_cycle = 7,
130
131 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE
132 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
133 .tdf_cycles = 3,
134};
135#endif
136
137static void __init cpu9krea_add_device_nand(void)
138{
139 sam9_smc_configure(0, 3, &cpu9krea_nand_smc_config);
140 at91_add_device_nand(&cpu9krea_nand_data);
141}
142
143/*
144 * NOR flash
145 */
146static struct physmap_flash_data cpuat9260_nor_data = {
147 .width = 2,
148};
149
150#define NOR_BASE AT91_CHIPSELECT_0
151#define NOR_SIZE SZ_64M
152
153static struct resource nor_flash_resources[] = {
154 {
155 .start = NOR_BASE,
156 .end = NOR_BASE + NOR_SIZE - 1,
157 .flags = IORESOURCE_MEM,
158 }
159};
160
161static struct platform_device cpu9krea_nor_flash = {
162 .name = "physmap-flash",
163 .id = 0,
164 .dev = {
165 .platform_data = &cpuat9260_nor_data,
166 },
167 .resource = nor_flash_resources,
168 .num_resources = ARRAY_SIZE(nor_flash_resources),
169};
170
171#ifdef CONFIG_MACH_CPU9260
172static struct sam9_smc_config __initdata cpu9krea_nor_smc_config = {
173 .ncs_read_setup = 0,
174 .nrd_setup = 1,
175 .ncs_write_setup = 0,
176 .nwe_setup = 1,
177
178 .ncs_read_pulse = 10,
179 .nrd_pulse = 10,
180 .ncs_write_pulse = 6,
181 .nwe_pulse = 6,
182
183 .read_cycle = 12,
184 .write_cycle = 8,
185
186 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE
187 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE
188 | AT91_SMC_DBW_16,
189 .tdf_cycles = 2,
190};
191#else
192static struct sam9_smc_config __initdata cpu9krea_nor_smc_config = {
193 .ncs_read_setup = 0,
194 .nrd_setup = 1,
195 .ncs_write_setup = 0,
196 .nwe_setup = 1,
197
198 .ncs_read_pulse = 13,
199 .nrd_pulse = 13,
200 .ncs_write_pulse = 8,
201 .nwe_pulse = 8,
202
203 .read_cycle = 15,
204 .write_cycle = 10,
205
206 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE
207 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE
208 | AT91_SMC_DBW_16,
209 .tdf_cycles = 2,
210};
211#endif
212
213static __init void cpu9krea_add_device_nor(void)
214{
215 unsigned long csa;
216
217 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
218 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_VDDIOMSEL_3_3V);
219
220 /* configure chip-select 0 (NOR) */
221 sam9_smc_configure(0, 0, &cpu9krea_nor_smc_config);
222
223 platform_device_register(&cpu9krea_nor_flash);
224}
225
226/*
227 * LEDs
228 */
229static struct gpio_led cpu9krea_leds[] = {
230 { /* LED1 */
231 .name = "LED1",
232 .gpio = AT91_PIN_PC11,
233 .active_low = 1,
234 .default_trigger = "timer",
235 },
236 { /* LED2 */
237 .name = "LED2",
238 .gpio = AT91_PIN_PC12,
239 .active_low = 1,
240 .default_trigger = "heartbeat",
241 },
242 { /* LED3 */
243 .name = "LED3",
244 .gpio = AT91_PIN_PC7,
245 .active_low = 1,
246 .default_trigger = "none",
247 },
248 { /* LED4 */
249 .name = "LED4",
250 .gpio = AT91_PIN_PC9,
251 .active_low = 1,
252 .default_trigger = "none",
253 }
254};
255
256static struct i2c_board_info __initdata cpu9krea_i2c_devices[] = {
257 {
258 I2C_BOARD_INFO("ds1339", 0x68),
259 },
260};
261
262/*
263 * GPIO Buttons
264 */
265#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
266static struct gpio_keys_button cpu9krea_buttons[] = {
267 {
268 .gpio = AT91_PIN_PC3,
269 .code = BTN_0,
270 .desc = "BP1",
271 .active_low = 1,
272 .wakeup = 1,
273 },
274 {
275 .gpio = AT91_PIN_PB20,
276 .code = BTN_1,
277 .desc = "BP2",
278 .active_low = 1,
279 .wakeup = 1,
280 }
281};
282
283static struct gpio_keys_platform_data cpu9krea_button_data = {
284 .buttons = cpu9krea_buttons,
285 .nbuttons = ARRAY_SIZE(cpu9krea_buttons),
286};
287
288static struct platform_device cpu9krea_button_device = {
289 .name = "gpio-keys",
290 .id = -1,
291 .num_resources = 0,
292 .dev = {
293 .platform_data = &cpu9krea_button_data,
294 }
295};
296
297static void __init cpu9krea_add_device_buttons(void)
298{
299 at91_set_gpio_input(AT91_PIN_PC3, 1); /* BP1 */
300 at91_set_deglitch(AT91_PIN_PC3, 1);
301 at91_set_gpio_input(AT91_PIN_PB20, 1); /* BP2 */
302 at91_set_deglitch(AT91_PIN_PB20, 1);
303
304 platform_device_register(&cpu9krea_button_device);
305}
306#else
307static void __init cpu9krea_add_device_buttons(void)
308{
309}
310#endif
311
312/*
313 * MCI (SD/MMC)
314 */
315static struct mci_platform_data __initdata cpu9krea_mci0_data = {
316 .slot[0] = {
317 .bus_width = 4,
318 .detect_pin = AT91_PIN_PA29,
319 .wp_pin = -EINVAL,
320 },
321};
322
323static void __init cpu9krea_board_init(void)
324{
325 at91_register_devices();
326
327 /* NOR */
328 cpu9krea_add_device_nor();
329 /* Serial */
330 /* DGBU on ttyS0. (Rx & Tx only) */
331 at91_register_uart(0, 0, 0);
332
333 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
334 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS |
335 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
336 ATMEL_UART_DCD | ATMEL_UART_RI);
337
338 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
339 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS |
340 ATMEL_UART_RTS);
341
342 /* USART2 on ttyS3. (Rx, Tx, RTS, CTS) */
343 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS |
344 ATMEL_UART_RTS);
345
346 /* USART3 on ttyS4. (Rx, Tx) */
347 at91_register_uart(AT91SAM9260_ID_US3, 4, 0);
348
349 /* USART4 on ttyS5. (Rx, Tx) */
350 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
351
352 /* USART5 on ttyS6. (Rx, Tx) */
353 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
354 at91_add_device_serial();
355 /* USB Host */
356 at91_add_device_usbh(&cpu9krea_usbh_data);
357 /* USB Device */
358 at91_add_device_udc(&cpu9krea_udc_data);
359 /* NAND */
360 cpu9krea_add_device_nand();
361 /* Ethernet */
362 at91_add_device_eth(&cpu9krea_macb_data);
363 /* MMC */
364 at91_add_device_mci(0, &cpu9krea_mci0_data);
365 /* I2C */
366 at91_add_device_i2c(cpu9krea_i2c_devices,
367 ARRAY_SIZE(cpu9krea_i2c_devices));
368 /* LEDs */
369 at91_gpio_leds(cpu9krea_leds, ARRAY_SIZE(cpu9krea_leds));
370 /* Push Buttons */
371 cpu9krea_add_device_buttons();
372}
373
374#ifdef CONFIG_MACH_CPU9260
375MACHINE_START(CPUAT9260, "Eukrea CPU9260")
376#else
377MACHINE_START(CPUAT9G20, "Eukrea CPU9G20")
378#endif
379 /* Maintainer: Eric Benard - EUKREA Electromatique */
380 .init_time = at91_init_time,
381 .map_io = at91_map_io,
382 .handle_irq = at91_aic_handle_irq,
383 .init_early = cpu9krea_init_early,
384 .init_irq = at91_init_irq_default,
385 .init_machine = cpu9krea_board_init,
386MACHINE_END
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
deleted file mode 100644
index c094350c9314..000000000000
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ /dev/null
@@ -1,189 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-cpuat91.c
3 *
4 * Copyright (C) 2009 Eric Benard - eric@eukrea.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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/gpio.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/mtd/physmap.h>
28#include <linux/mtd/plat-ram.h>
29
30#include <mach/hardware.h>
31#include <asm/setup.h>
32#include <asm/mach-types.h>
33#include <asm/irq.h>
34
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/irq.h>
38
39#include <mach/at91rm9200_mc.h>
40#include <mach/at91_ramc.h>
41#include <mach/cpu.h>
42
43#include "at91_aic.h"
44#include "board.h"
45#include "generic.h"
46#include "gpio.h"
47
48
49static struct gpio_led cpuat91_leds[] = {
50 {
51 .name = "led1",
52 .default_trigger = "heartbeat",
53 .active_low = 1,
54 .gpio = AT91_PIN_PC0,
55 },
56};
57
58static void __init cpuat91_init_early(void)
59{
60 /* Set cpu type: PQFP */
61 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
62
63 /* Initialize processor: 18.432 MHz crystal */
64 at91_initialize(18432000);
65}
66
67static struct macb_platform_data __initdata cpuat91_eth_data = {
68 .phy_irq_pin = -EINVAL,
69 .is_rmii = 1,
70};
71
72static struct at91_usbh_data __initdata cpuat91_usbh_data = {
73 .ports = 1,
74 .vbus_pin = {-EINVAL, -EINVAL},
75 .overcurrent_pin= {-EINVAL, -EINVAL},
76};
77
78static struct at91_udc_data __initdata cpuat91_udc_data = {
79 .vbus_pin = AT91_PIN_PC15,
80 .pullup_pin = AT91_PIN_PC14,
81};
82
83static struct mci_platform_data __initdata cpuat91_mci0_data = {
84 .slot[0] = {
85 .bus_width = 4,
86 .detect_pin = AT91_PIN_PC2,
87 .wp_pin = -EINVAL,
88 },
89};
90
91static struct physmap_flash_data cpuat91_flash_data = {
92 .width = 2,
93};
94
95static struct resource cpuat91_flash_resource = {
96 .start = AT91_CHIPSELECT_0,
97 .end = AT91_CHIPSELECT_0 + SZ_16M - 1,
98 .flags = IORESOURCE_MEM,
99};
100
101static struct platform_device cpuat91_norflash = {
102 .name = "physmap-flash",
103 .id = 0,
104 .dev = {
105 .platform_data = &cpuat91_flash_data,
106 },
107 .resource = &cpuat91_flash_resource,
108 .num_resources = 1,
109};
110
111#ifdef CONFIG_MTD_PLATRAM
112struct platdata_mtd_ram at91_sram_pdata = {
113 .mapname = "SRAM",
114 .bankwidth = 2,
115};
116
117static struct resource at91_sram_resource[] = {
118 [0] = {
119 .start = AT91RM9200_SRAM_BASE,
120 .end = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1,
121 .flags = IORESOURCE_MEM,
122 },
123};
124
125static struct platform_device at91_sram = {
126 .name = "mtd-ram",
127 .id = 0,
128 .resource = at91_sram_resource,
129 .num_resources = ARRAY_SIZE(at91_sram_resource),
130 .dev = {
131 .platform_data = &at91_sram_pdata,
132 },
133};
134#endif /* MTD_PLATRAM */
135
136static struct platform_device *platform_devices[] __initdata = {
137 &cpuat91_norflash,
138#ifdef CONFIG_MTD_PLATRAM
139 &at91_sram,
140#endif /* CONFIG_MTD_PLATRAM */
141};
142
143static void __init cpuat91_board_init(void)
144{
145 /* Serial */
146 /* DBGU on ttyS0. (Rx & Tx only) */
147 at91_register_uart(0, 0, 0);
148
149 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
150 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS |
151 ATMEL_UART_RTS);
152
153 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
154 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS |
155 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
156 ATMEL_UART_DCD | ATMEL_UART_RI);
157
158 /* USART2 on ttyS3 (Rx, Tx) */
159 at91_register_uart(AT91RM9200_ID_US2, 3, 0);
160
161 /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */
162 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS |
163 ATMEL_UART_RTS);
164 at91_add_device_serial();
165 /* LEDs. */
166 at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds));
167 /* Ethernet */
168 at91_add_device_eth(&cpuat91_eth_data);
169 /* USB Host */
170 at91_add_device_usbh(&cpuat91_usbh_data);
171 /* USB Device */
172 at91_add_device_udc(&cpuat91_udc_data);
173 /* MMC */
174 at91_add_device_mci(0, &cpuat91_mci0_data);
175 /* I2C */
176 at91_add_device_i2c(NULL, 0);
177 /* Platform devices */
178 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
179}
180
181MACHINE_START(CPUAT91, "Eukrea")
182 /* Maintainer: Eric Benard - EUKREA Electromatique */
183 .init_time = at91rm9200_timer_init,
184 .map_io = at91_map_io,
185 .handle_irq = at91_aic_handle_irq,
186 .init_early = cpuat91_init_early,
187 .init_irq = at91_init_irq_default,
188 .init_machine = cpuat91_board_init,
189MACHINE_END
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
deleted file mode 100644
index 0e35a45cf8d4..000000000000
--- a/arch/arm/mach-at91/board-csb337.c
+++ /dev/null
@@ -1,260 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-csb337.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/gpio.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/mtd/physmap.h>
29#include <linux/input.h>
30#include <linux/gpio_keys.h>
31
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h>
35
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
40#include <mach/hardware.h>
41
42#include "at91_aic.h"
43#include "board.h"
44#include "generic.h"
45#include "gpio.h"
46
47static void __init csb337_init_early(void)
48{
49 /* Initialize processor: 3.6864 MHz crystal */
50 at91_initialize(3686400);
51}
52
53static struct macb_platform_data __initdata csb337_eth_data = {
54 .phy_irq_pin = AT91_PIN_PC2,
55 .is_rmii = 0,
56 /* The CSB337 bootloader stores the MAC the wrong-way around */
57 .rev_eth_addr = 1,
58};
59
60static struct at91_usbh_data __initdata csb337_usbh_data = {
61 .ports = 2,
62 .vbus_pin = {-EINVAL, -EINVAL},
63 .overcurrent_pin= {-EINVAL, -EINVAL},
64};
65
66static struct at91_udc_data __initdata csb337_udc_data = {
67 .pullup_pin = AT91_PIN_PA24,
68 .vbus_pin = -EINVAL,
69};
70
71static struct i2c_board_info __initdata csb337_i2c_devices[] = {
72 {
73 I2C_BOARD_INFO("ds1307", 0x68),
74 },
75};
76
77static struct at91_cf_data __initdata csb337_cf_data = {
78 /*
79 * connector P4 on the CSB 337 mates to
80 * connector P8 on the CSB 300CF
81 */
82
83 /* CSB337 specific */
84 .det_pin = AT91_PIN_PC3,
85
86 /* CSB300CF specific */
87 .irq_pin = AT91_PIN_PA19,
88 .vcc_pin = AT91_PIN_PD0,
89 .rst_pin = AT91_PIN_PD2,
90};
91
92static struct mci_platform_data __initdata csb337_mci0_data = {
93 .slot[0] = {
94 .bus_width = 4,
95 .detect_pin = AT91_PIN_PD5,
96 .wp_pin = AT91_PIN_PD6,
97 },
98};
99
100static struct spi_board_info csb337_spi_devices[] = {
101 { /* CAN controller */
102 .modalias = "sak82c900",
103 .chip_select = 0,
104 .max_speed_hz = 6 * 1000 * 1000,
105 },
106};
107
108#define CSB_FLASH_BASE AT91_CHIPSELECT_0
109#define CSB_FLASH_SIZE SZ_8M
110
111static struct mtd_partition csb_flash_partitions[] = {
112 {
113 .name = "uMON flash",
114 .offset = 0,
115 .size = MTDPART_SIZ_FULL,
116 .mask_flags = MTD_WRITEABLE, /* read only */
117 }
118};
119
120static struct physmap_flash_data csb_flash_data = {
121 .width = 2,
122 .parts = csb_flash_partitions,
123 .nr_parts = ARRAY_SIZE(csb_flash_partitions),
124};
125
126static struct resource csb_flash_resources[] = {
127 {
128 .start = CSB_FLASH_BASE,
129 .end = CSB_FLASH_BASE + CSB_FLASH_SIZE - 1,
130 .flags = IORESOURCE_MEM,
131 }
132};
133
134static struct platform_device csb_flash = {
135 .name = "physmap-flash",
136 .id = 0,
137 .dev = {
138 .platform_data = &csb_flash_data,
139 },
140 .resource = csb_flash_resources,
141 .num_resources = ARRAY_SIZE(csb_flash_resources),
142};
143
144/*
145 * GPIO Buttons (on CSB300)
146 */
147#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
148static struct gpio_keys_button csb300_buttons[] = {
149 {
150 .gpio = AT91_PIN_PB29,
151 .code = BTN_0,
152 .desc = "sw0",
153 .active_low = 1,
154 .wakeup = 1,
155 },
156 {
157 .gpio = AT91_PIN_PB28,
158 .code = BTN_1,
159 .desc = "sw1",
160 .active_low = 1,
161 .wakeup = 1,
162 },
163 {
164 .gpio = AT91_PIN_PA21,
165 .code = BTN_2,
166 .desc = "sw2",
167 .active_low = 1,
168 .wakeup = 1,
169 }
170};
171
172static struct gpio_keys_platform_data csb300_button_data = {
173 .buttons = csb300_buttons,
174 .nbuttons = ARRAY_SIZE(csb300_buttons),
175};
176
177static struct platform_device csb300_button_device = {
178 .name = "gpio-keys",
179 .id = -1,
180 .num_resources = 0,
181 .dev = {
182 .platform_data = &csb300_button_data,
183 }
184};
185
186static void __init csb300_add_device_buttons(void)
187{
188 at91_set_gpio_input(AT91_PIN_PB29, 1); /* sw0 */
189 at91_set_deglitch(AT91_PIN_PB29, 1);
190 at91_set_gpio_input(AT91_PIN_PB28, 1); /* sw1 */
191 at91_set_deglitch(AT91_PIN_PB28, 1);
192 at91_set_gpio_input(AT91_PIN_PA21, 1); /* sw2 */
193 at91_set_deglitch(AT91_PIN_PA21, 1);
194
195 platform_device_register(&csb300_button_device);
196}
197#else
198static void __init csb300_add_device_buttons(void) {}
199#endif
200
201static struct gpio_led csb_leds[] = {
202 { /* "led0", yellow */
203 .name = "led0",
204 .gpio = AT91_PIN_PB2,
205 .active_low = 1,
206 .default_trigger = "heartbeat",
207 },
208 { /* "led1", green */
209 .name = "led1",
210 .gpio = AT91_PIN_PB1,
211 .active_low = 1,
212 .default_trigger = "mmc0",
213 },
214 { /* "led2", yellow */
215 .name = "led2",
216 .gpio = AT91_PIN_PB0,
217 .active_low = 1,
218 .default_trigger = "ide-disk",
219 }
220};
221
222
223static void __init csb337_board_init(void)
224{
225 /* Serial */
226 /* DBGU on ttyS0 */
227 at91_register_uart(0, 0, 0);
228 at91_add_device_serial();
229 /* Ethernet */
230 at91_add_device_eth(&csb337_eth_data);
231 /* USB Host */
232 at91_add_device_usbh(&csb337_usbh_data);
233 /* USB Device */
234 at91_add_device_udc(&csb337_udc_data);
235 /* I2C */
236 at91_add_device_i2c(csb337_i2c_devices, ARRAY_SIZE(csb337_i2c_devices));
237 /* Compact Flash */
238 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */
239 at91_add_device_cf(&csb337_cf_data);
240 /* SPI */
241 at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices));
242 /* MMC */
243 at91_add_device_mci(0, &csb337_mci0_data);
244 /* NOR flash */
245 platform_device_register(&csb_flash);
246 /* LEDs */
247 at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds));
248 /* Switches on CSB300 */
249 csb300_add_device_buttons();
250}
251
252MACHINE_START(CSB337, "Cogent CSB337")
253 /* Maintainer: Bill Gatliff */
254 .init_time = at91rm9200_timer_init,
255 .map_io = at91_map_io,
256 .handle_irq = at91_aic_handle_irq,
257 .init_early = csb337_init_early,
258 .init_irq = at91_init_irq_default,
259 .init_machine = csb337_board_init,
260MACHINE_END
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
deleted file mode 100644
index 18d027f529a8..000000000000
--- a/arch/arm/mach-at91/board-csb637.c
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-csb637.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/gpio.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/platform_device.h>
27#include <linux/mtd/physmap.h>
28
29#include <asm/setup.h>
30#include <asm/mach-types.h>
31#include <asm/irq.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/mach/irq.h>
36
37#include <mach/hardware.h>
38
39#include "at91_aic.h"
40#include "board.h"
41#include "generic.h"
42#include "gpio.h"
43
44
45static void __init csb637_init_early(void)
46{
47 /* Initialize processor: 3.6864 MHz crystal */
48 at91_initialize(3686400);
49}
50
51static struct macb_platform_data __initdata csb637_eth_data = {
52 .phy_irq_pin = AT91_PIN_PC0,
53 .is_rmii = 0,
54};
55
56static struct at91_usbh_data __initdata csb637_usbh_data = {
57 .ports = 2,
58 .vbus_pin = {-EINVAL, -EINVAL},
59 .overcurrent_pin= {-EINVAL, -EINVAL},
60};
61
62static struct at91_udc_data __initdata csb637_udc_data = {
63 .vbus_pin = AT91_PIN_PB28,
64 .pullup_pin = AT91_PIN_PB1,
65};
66
67#define CSB_FLASH_BASE AT91_CHIPSELECT_0
68#define CSB_FLASH_SIZE SZ_16M
69
70static struct mtd_partition csb_flash_partitions[] = {
71 {
72 .name = "uMON flash",
73 .offset = 0,
74 .size = MTDPART_SIZ_FULL,
75 .mask_flags = MTD_WRITEABLE, /* read only */
76 }
77};
78
79static struct physmap_flash_data csb_flash_data = {
80 .width = 2,
81 .parts = csb_flash_partitions,
82 .nr_parts = ARRAY_SIZE(csb_flash_partitions),
83};
84
85static struct resource csb_flash_resources[] = {
86 {
87 .start = CSB_FLASH_BASE,
88 .end = CSB_FLASH_BASE + CSB_FLASH_SIZE - 1,
89 .flags = IORESOURCE_MEM,
90 }
91};
92
93static struct platform_device csb_flash = {
94 .name = "physmap-flash",
95 .id = 0,
96 .dev = {
97 .platform_data = &csb_flash_data,
98 },
99 .resource = csb_flash_resources,
100 .num_resources = ARRAY_SIZE(csb_flash_resources),
101};
102
103static struct gpio_led csb_leds[] = {
104 { /* "d1", red */
105 .name = "d1",
106 .gpio = AT91_PIN_PB2,
107 .active_low = 1,
108 .default_trigger = "heartbeat",
109 },
110};
111
112static void __init csb637_board_init(void)
113{
114 /* LED(s) */
115 at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds));
116 /* Serial */
117 /* DBGU on ttyS0. (Rx & Tx only) */
118 at91_register_uart(0, 0, 0);
119 at91_add_device_serial();
120 /* Ethernet */
121 at91_add_device_eth(&csb637_eth_data);
122 /* USB Host */
123 at91_add_device_usbh(&csb637_usbh_data);
124 /* USB Device */
125 at91_add_device_udc(&csb637_udc_data);
126 /* I2C */
127 at91_add_device_i2c(NULL, 0);
128 /* SPI */
129 at91_add_device_spi(NULL, 0);
130 /* NOR flash */
131 platform_device_register(&csb_flash);
132}
133
134MACHINE_START(CSB637, "Cogent CSB637")
135 /* Maintainer: Bill Gatliff */
136 .init_time = at91rm9200_timer_init,
137 .map_io = at91_map_io,
138 .handle_irq = at91_aic_handle_irq,
139 .init_early = csb637_init_early,
140 .init_irq = at91_init_irq_default,
141 .init_machine = csb637_board_init,
142MACHINE_END
diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c
index 226563f850b8..76dfe8f9af50 100644
--- a/arch/arm/mach-at91/board-dt-rm9200.c
+++ b/arch/arm/mach-at91/board-dt-rm9200.c
@@ -22,14 +22,11 @@
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24 24
25#include "at91_aic.h"
26#include "generic.h" 25#include "generic.h"
27 26
28static void __init at91rm9200_dt_timer_init(void) 27static void __init at91rm9200_dt_timer_init(void)
29{ 28{
30#if defined(CONFIG_COMMON_CLK)
31 of_clk_init(NULL); 29 of_clk_init(NULL);
32#endif
33 at91rm9200_timer_init(); 30 at91rm9200_timer_init();
34} 31}
35 32
diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/board-dt-sam9.c
index d3048ccdc41f..f99246aa9b38 100644
--- a/arch/arm/mach-at91/board-dt-sam9.c
+++ b/arch/arm/mach-at91/board-dt-sam9.c
@@ -21,8 +21,6 @@
21#include <asm/mach/map.h> 21#include <asm/mach/map.h>
22#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
23 23
24#include "at91_aic.h"
25#include "board.h"
26#include "generic.h" 24#include "generic.h"
27 25
28static const char *at91_dt_board_compat[] __initdata = { 26static const char *at91_dt_board_compat[] __initdata = {
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
index 129e2917506b..8fb9ef5333f1 100644
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -24,7 +24,6 @@
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include <asm/mach/irq.h> 25#include <asm/mach/irq.h>
26 26
27#include "at91_aic.h"
28#include "generic.h" 27#include "generic.h"
29 28
30static void __init sama5_dt_device_init(void) 29static void __init sama5_dt_device_init(void)
diff --git a/arch/arm/mach-at91/board-eb01.c b/arch/arm/mach-at91/board-eb01.c
deleted file mode 100644
index becf0a6a289e..000000000000
--- a/arch/arm/mach-at91/board-eb01.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * arch/arm/mach-at91/board-eb01.c
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/platform_device.h>
25#include <linux/irq.h>
26#include <asm/mach-types.h>
27#include <mach/hardware.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30
31#include "at91_aic.h"
32#include "board.h"
33#include "generic.h"
34
35static void __init at91eb01_init_irq(void)
36{
37 at91x40_init_interrupts(NULL);
38}
39
40static void __init at91eb01_init_early(void)
41{
42 at91x40_initialize(40000000);
43}
44
45MACHINE_START(AT91EB01, "Atmel AT91 EB01")
46 /* Maintainer: Greg Ungerer <gerg@snapgear.com> */
47 .init_time = at91x40_timer_init,
48 .handle_irq = at91_aic_handle_irq,
49 .init_early = at91eb01_init_early,
50 .init_irq = at91eb01_init_irq,
51MACHINE_END
52
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
deleted file mode 100644
index aa457a8b22f5..000000000000
--- a/arch/arm/mach-at91/board-eb9200.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-eb9200.c
3 *
4 * Copyright (C) 2005 SAN People, adapted for ATEB9200 from Embest
5 * by Andrew Patrikalakis
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/gpio.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/device.h>
28
29#include <mach/hardware.h>
30#include <asm/setup.h>
31#include <asm/mach-types.h>
32#include <asm/irq.h>
33
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include "at91_aic.h"
39#include "board.h"
40#include "generic.h"
41#include "gpio.h"
42
43
44static void __init eb9200_init_early(void)
45{
46 /* Initialize processor: 18.432 MHz crystal */
47 at91_initialize(18432000);
48}
49
50static struct macb_platform_data __initdata eb9200_eth_data = {
51 .phy_irq_pin = AT91_PIN_PC4,
52 .is_rmii = 1,
53};
54
55static struct at91_usbh_data __initdata eb9200_usbh_data = {
56 .ports = 2,
57 .vbus_pin = {-EINVAL, -EINVAL},
58 .overcurrent_pin= {-EINVAL, -EINVAL},
59};
60
61static struct at91_udc_data __initdata eb9200_udc_data = {
62 .vbus_pin = AT91_PIN_PD4,
63 .pullup_pin = AT91_PIN_PD5,
64};
65
66static struct at91_cf_data __initdata eb9200_cf_data = {
67 .irq_pin = -EINVAL,
68 .det_pin = AT91_PIN_PB0,
69 .vcc_pin = -EINVAL,
70 .rst_pin = AT91_PIN_PC5,
71};
72
73static struct mci_platform_data __initdata eb9200_mci0_data = {
74 .slot[0] = {
75 .bus_width = 4,
76 .detect_pin = -EINVAL,
77 .wp_pin = -EINVAL,
78 },
79};
80
81static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
82 {
83 I2C_BOARD_INFO("24c512", 0x50),
84 },
85};
86
87
88static void __init eb9200_board_init(void)
89{
90 /* Serial */
91 /* DBGU on ttyS0. (Rx & Tx only) */
92 at91_register_uart(0, 0, 0);
93
94 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
95 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
96 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
97 | ATMEL_UART_RI);
98
99 /* USART2 on ttyS2. (Rx, Tx) - IRDA */
100 at91_register_uart(AT91RM9200_ID_US2, 2, 0);
101 at91_add_device_serial();
102 /* Ethernet */
103 at91_add_device_eth(&eb9200_eth_data);
104 /* USB Host */
105 at91_add_device_usbh(&eb9200_usbh_data);
106 /* USB Device */
107 at91_add_device_udc(&eb9200_udc_data);
108 /* I2C */
109 at91_add_device_i2c(eb9200_i2c_devices, ARRAY_SIZE(eb9200_i2c_devices));
110 /* Compact Flash */
111 at91_add_device_cf(&eb9200_cf_data);
112 /* SPI */
113 at91_add_device_spi(NULL, 0);
114 /* MMC */
115 /* only supports 1 or 4 bit interface, not wired through to SPI */
116 at91_add_device_mci(0, &eb9200_mci0_data);
117}
118
119MACHINE_START(ATEB9200, "Embest ATEB9200")
120 .init_time = at91rm9200_timer_init,
121 .map_io = at91_map_io,
122 .handle_irq = at91_aic_handle_irq,
123 .init_early = eb9200_init_early,
124 .init_irq = at91_init_irq_default,
125 .init_machine = eb9200_board_init,
126MACHINE_END
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
deleted file mode 100644
index ede1373ccaba..000000000000
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ /dev/null
@@ -1,191 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/board-ecbat91.c
3 * Copyright (C) 2007 emQbit.com.
4 *
5 * We started from board-dk.c, which is Copyright (C) 2005 SAN People.
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/gpio.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/spi/flash.h>
30
31#include <mach/hardware.h>
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h>
35
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
40#include <mach/cpu.h>
41
42#include "at91_aic.h"
43#include "board.h"
44#include "generic.h"
45#include "gpio.h"
46
47
48static void __init ecb_at91init_early(void)
49{
50 /* Set cpu type: PQFP */
51 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
52
53 /* Initialize processor: 18.432 MHz crystal */
54 at91_initialize(18432000);
55}
56
57static struct macb_platform_data __initdata ecb_at91eth_data = {
58 .phy_irq_pin = AT91_PIN_PC4,
59 .is_rmii = 0,
60};
61
62static struct at91_usbh_data __initdata ecb_at91usbh_data = {
63 .ports = 1,
64 .vbus_pin = {-EINVAL, -EINVAL},
65 .overcurrent_pin= {-EINVAL, -EINVAL},
66};
67
68static struct mci_platform_data __initdata ecbat91_mci0_data = {
69 .slot[0] = {
70 .bus_width = 4,
71 .detect_pin = -EINVAL,
72 .wp_pin = -EINVAL,
73 },
74};
75
76
77#if defined(CONFIG_MTD_DATAFLASH)
78static struct mtd_partition __initdata my_flash0_partitions[] =
79{
80 { /* 0x8400 */
81 .name = "Darrell-loader",
82 .offset = 0,
83 .size = 12 * 1056,
84 },
85 {
86 .name = "U-boot",
87 .offset = MTDPART_OFS_NXTBLK,
88 .size = 110 * 1056,
89 },
90 { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
91 .name = "UBoot-env",
92 .offset = MTDPART_OFS_NXTBLK,
93 .size = 8 * 1056,
94 },
95 { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
96 .name = "Kernel",
97 .offset = MTDPART_OFS_NXTBLK,
98 .size = 1534 * 1056,
99 },
100 { /* 190200 - jffs2 root filesystem */
101 .name = "Filesystem",
102 .offset = MTDPART_OFS_NXTBLK,
103 .size = MTDPART_SIZ_FULL, /* 26 sectors */
104 }
105};
106
107static struct flash_platform_data __initdata my_flash0_platform = {
108 .name = "Removable flash card",
109 .parts = my_flash0_partitions,
110 .nr_parts = ARRAY_SIZE(my_flash0_partitions)
111};
112
113#endif
114
115static struct spi_board_info __initdata ecb_at91spi_devices[] = {
116 { /* DataFlash chip */
117 .modalias = "mtd_dataflash",
118 .chip_select = 0,
119 .max_speed_hz = 10 * 1000 * 1000,
120 .bus_num = 0,
121#if defined(CONFIG_MTD_DATAFLASH)
122 .platform_data = &my_flash0_platform,
123#endif
124 },
125 { /* User accessible spi - cs1 (250KHz) */
126 .modalias = "spi-cs1",
127 .chip_select = 1,
128 .max_speed_hz = 250 * 1000,
129 },
130 { /* User accessible spi - cs2 (1MHz) */
131 .modalias = "spi-cs2",
132 .chip_select = 2,
133 .max_speed_hz = 1 * 1000 * 1000,
134 },
135 { /* User accessible spi - cs3 (10MHz) */
136 .modalias = "spi-cs3",
137 .chip_select = 3,
138 .max_speed_hz = 10 * 1000 * 1000,
139 },
140};
141
142/*
143 * LEDs
144 */
145static struct gpio_led ecb_leds[] = {
146 { /* D1 */
147 .name = "led1",
148 .gpio = AT91_PIN_PC7,
149 .active_low = 1,
150 .default_trigger = "heartbeat",
151 }
152};
153
154static void __init ecb_at91board_init(void)
155{
156 /* Serial */
157 /* DBGU on ttyS0. (Rx & Tx only) */
158 at91_register_uart(0, 0, 0);
159
160 /* USART0 on ttyS1. (Rx & Tx only) */
161 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
162 at91_add_device_serial();
163
164 /* Ethernet */
165 at91_add_device_eth(&ecb_at91eth_data);
166
167 /* USB Host */
168 at91_add_device_usbh(&ecb_at91usbh_data);
169
170 /* I2C */
171 at91_add_device_i2c(NULL, 0);
172
173 /* MMC */
174 at91_add_device_mci(0, &ecbat91_mci0_data);
175
176 /* SPI */
177 at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
178
179 /* LEDs */
180 at91_gpio_leds(ecb_leds, ARRAY_SIZE(ecb_leds));
181}
182
183MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
184 /* Maintainer: emQbit.com */
185 .init_time = at91rm9200_timer_init,
186 .map_io = at91_map_io,
187 .handle_irq = at91_aic_handle_irq,
188 .init_early = ecb_at91init_early,
189 .init_irq = at91_init_irq_default,
190 .init_machine = ecb_at91board_init,
191MACHINE_END
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
deleted file mode 100644
index 4e75321a8f2a..000000000000
--- a/arch/arm/mach-at91/board-eco920.c
+++ /dev/null
@@ -1,160 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/mtd/physmap.h>
20#include <linux/gpio.h>
21
22#include <asm/mach-types.h>
23
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26
27#include <mach/at91rm9200_mc.h>
28#include <mach/at91_ramc.h>
29#include <mach/cpu.h>
30
31#include "at91_aic.h"
32#include "board.h"
33#include "generic.h"
34#include "gpio.h"
35
36
37static void __init eco920_init_early(void)
38{
39 /* Set cpu type: PQFP */
40 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
41
42 at91_initialize(18432000);
43}
44
45static struct macb_platform_data __initdata eco920_eth_data = {
46 .phy_irq_pin = AT91_PIN_PC2,
47 .is_rmii = 1,
48};
49
50static struct at91_usbh_data __initdata eco920_usbh_data = {
51 .ports = 1,
52 .vbus_pin = {-EINVAL, -EINVAL},
53 .overcurrent_pin= {-EINVAL, -EINVAL},
54};
55
56static struct at91_udc_data __initdata eco920_udc_data = {
57 .vbus_pin = AT91_PIN_PB12,
58 .pullup_pin = AT91_PIN_PB13,
59};
60
61static struct mci_platform_data __initdata eco920_mci0_data = {
62 .slot[0] = {
63 .bus_width = 1,
64 .detect_pin = -EINVAL,
65 .wp_pin = -EINVAL,
66 },
67};
68
69static struct physmap_flash_data eco920_flash_data = {
70 .width = 2,
71};
72
73static struct resource eco920_flash_resource = {
74 .start = 0x11000000,
75 .end = 0x11ffffff,
76 .flags = IORESOURCE_MEM,
77};
78
79static struct platform_device eco920_flash = {
80 .name = "physmap-flash",
81 .id = 0,
82 .dev = {
83 .platform_data = &eco920_flash_data,
84 },
85 .resource = &eco920_flash_resource,
86 .num_resources = 1,
87};
88
89static struct spi_board_info eco920_spi_devices[] = {
90 { /* CAN controller */
91 .modalias = "tlv5638",
92 .chip_select = 3,
93 .max_speed_hz = 20 * 1000 * 1000,
94 .mode = SPI_CPHA,
95 },
96};
97
98/*
99 * LEDs
100 */
101static struct gpio_led eco920_leds[] = {
102 { /* D1 */
103 .name = "led1",
104 .gpio = AT91_PIN_PB0,
105 .active_low = 1,
106 .default_trigger = "heartbeat",
107 },
108 { /* D2 */
109 .name = "led2",
110 .gpio = AT91_PIN_PB1,
111 .active_low = 1,
112 .default_trigger = "timer",
113 }
114};
115
116static void __init eco920_board_init(void)
117{
118 /* DBGU on ttyS0. (Rx & Tx only */
119 at91_register_uart(0, 0, 0);
120 at91_add_device_serial();
121 at91_add_device_eth(&eco920_eth_data);
122 at91_add_device_usbh(&eco920_usbh_data);
123 at91_add_device_udc(&eco920_udc_data);
124
125 at91_add_device_mci(0, &eco920_mci0_data);
126 platform_device_register(&eco920_flash);
127
128 at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1)
129 | AT91_SMC_RWSETUP_(1)
130 | AT91_SMC_DBW_8
131 | AT91_SMC_WSEN
132 | AT91_SMC_NWS_(15));
133
134 at91_set_A_periph(AT91_PIN_PC6, 1);
135
136 at91_set_gpio_input(AT91_PIN_PA23, 0);
137 at91_set_deglitch(AT91_PIN_PA23, 1);
138
139/* Initialization of the Static Memory Controller for Chip Select 3 */
140 at91_ramc_write(0, AT91_SMC_CSR(3),
141 AT91_SMC_DBW_16 | /* 16 bit */
142 AT91_SMC_WSEN |
143 AT91_SMC_NWS_(5) | /* wait states */
144 AT91_SMC_TDF_(1) /* float time */
145 );
146
147 at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices));
148 /* LEDs */
149 at91_gpio_leds(eco920_leds, ARRAY_SIZE(eco920_leds));
150}
151
152MACHINE_START(ECO920, "eco920")
153 /* Maintainer: Sascha Hauer */
154 .init_time = at91rm9200_timer_init,
155 .map_io = at91_map_io,
156 .handle_irq = at91_aic_handle_irq,
157 .init_early = eco920_init_early,
158 .init_irq = at91_init_irq_default,
159 .init_machine = eco920_board_init,
160MACHINE_END
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
deleted file mode 100644
index a6aa4a2432f2..000000000000
--- a/arch/arm/mach-at91/board-flexibity.c
+++ /dev/null
@@ -1,171 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-flexibity.c
3 *
4 * Copyright (C) 2010-2011 Flexibity
5 * Copyright (C) 2005 SAN People
6 * Copyright (C) 2006 Atmel
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/init.h>
24#include <linux/platform_device.h>
25#include <linux/spi/spi.h>
26#include <linux/input.h>
27#include <linux/gpio.h>
28
29#include <asm/mach-types.h>
30
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <asm/mach/irq.h>
34
35#include <mach/hardware.h>
36
37#include "at91_aic.h"
38#include "board.h"
39#include "generic.h"
40#include "gpio.h"
41
42static void __init flexibity_init_early(void)
43{
44 /* Initialize processor: 18.432 MHz crystal */
45 at91_initialize(18432000);
46}
47
48/* USB Host port */
49static struct at91_usbh_data __initdata flexibity_usbh_data = {
50 .ports = 2,
51 .vbus_pin = {-EINVAL, -EINVAL},
52 .overcurrent_pin= {-EINVAL, -EINVAL},
53};
54
55/* USB Device port */
56static struct at91_udc_data __initdata flexibity_udc_data = {
57 .vbus_pin = AT91_PIN_PC5,
58 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
59};
60
61/* I2C devices */
62static struct i2c_board_info __initdata flexibity_i2c_devices[] = {
63 {
64 I2C_BOARD_INFO("ds1307", 0x68),
65 },
66};
67
68/* SPI devices */
69static struct spi_board_info flexibity_spi_devices[] = {
70 { /* DataFlash chip */
71 .modalias = "mtd_dataflash",
72 .chip_select = 1,
73 .max_speed_hz = 15 * 1000 * 1000,
74 .bus_num = 0,
75 },
76};
77
78/* MCI (SD/MMC) */
79static struct mci_platform_data __initdata flexibity_mci0_data = {
80 .slot[0] = {
81 .bus_width = 4,
82 .detect_pin = AT91_PIN_PC9,
83 .wp_pin = AT91_PIN_PC4,
84 },
85};
86
87/* LEDs */
88static struct gpio_led flexibity_leds[] = {
89 {
90 .name = "usb1:green",
91 .gpio = AT91_PIN_PA12,
92 .active_low = 1,
93 .default_trigger = "default-on",
94 },
95 {
96 .name = "usb1:red",
97 .gpio = AT91_PIN_PA13,
98 .active_low = 1,
99 .default_trigger = "default-on",
100 },
101 {
102 .name = "usb2:green",
103 .gpio = AT91_PIN_PB26,
104 .active_low = 1,
105 .default_trigger = "default-on",
106 },
107 {
108 .name = "usb2:red",
109 .gpio = AT91_PIN_PB27,
110 .active_low = 1,
111 .default_trigger = "default-on",
112 },
113 {
114 .name = "usb3:green",
115 .gpio = AT91_PIN_PC8,
116 .active_low = 1,
117 .default_trigger = "default-on",
118 },
119 {
120 .name = "usb3:red",
121 .gpio = AT91_PIN_PC6,
122 .active_low = 1,
123 .default_trigger = "default-on",
124 },
125 {
126 .name = "usb4:green",
127 .gpio = AT91_PIN_PB4,
128 .active_low = 1,
129 .default_trigger = "default-on",
130 },
131 {
132 .name = "usb4:red",
133 .gpio = AT91_PIN_PB5,
134 .active_low = 1,
135 .default_trigger = "default-on",
136 }
137};
138
139static void __init flexibity_board_init(void)
140{
141 at91_register_devices();
142
143 /* Serial */
144 /* DBGU on ttyS0. (Rx & Tx only) */
145 at91_register_uart(0, 0, 0);
146 at91_add_device_serial();
147 /* USB Host */
148 at91_add_device_usbh(&flexibity_usbh_data);
149 /* USB Device */
150 at91_add_device_udc(&flexibity_udc_data);
151 /* I2C */
152 at91_add_device_i2c(flexibity_i2c_devices,
153 ARRAY_SIZE(flexibity_i2c_devices));
154 /* SPI */
155 at91_add_device_spi(flexibity_spi_devices,
156 ARRAY_SIZE(flexibity_spi_devices));
157 /* MMC */
158 at91_add_device_mci(0, &flexibity_mci0_data);
159 /* LEDs */
160 at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds));
161}
162
163MACHINE_START(FLEXIBITY, "Flexibity Connect")
164 /* Maintainer: Maxim Osipov */
165 .init_time = at91_init_time,
166 .map_io = at91_map_io,
167 .handle_irq = at91_aic_handle_irq,
168 .init_early = flexibity_init_early,
169 .init_irq = at91_init_irq_default,
170 .init_machine = flexibity_board_init,
171MACHINE_END
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
deleted file mode 100644
index bf5cc55c7db6..000000000000
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ /dev/null
@@ -1,585 +0,0 @@
1/*
2 * Copyright (C) 2010 Christian Glindkamp <christian.glindkamp@taskit.de>
3 * taskit GmbH
4 * 2010 Igor Plyatov <plyatov@gmail.com>
5 * GeoSIG Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 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/platform_device.h>
23#include <linux/gpio.h>
24#include <linux/w1-gpio.h>
25#include <linux/i2c.h>
26#include <linux/i2c/pcf857x.h>
27#include <linux/gpio_keys.h>
28#include <linux/input.h>
29
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32
33#include <mach/at91sam9_smc.h>
34#include <mach/hardware.h>
35
36#include "at91_aic.h"
37#include "board.h"
38#include "sam9_smc.h"
39#include "generic.h"
40#include "gsia18s.h"
41#include "stamp9g20.h"
42#include "gpio.h"
43
44static void __init gsia18s_init_early(void)
45{
46 stamp9g20_init_early();
47}
48
49/*
50 * Two USB Host ports
51 */
52static struct at91_usbh_data __initdata usbh_data = {
53 .ports = 2,
54 .vbus_pin = {-EINVAL, -EINVAL},
55 .overcurrent_pin= {-EINVAL, -EINVAL},
56};
57
58/*
59 * USB Device port
60 */
61static struct at91_udc_data __initdata udc_data = {
62 .vbus_pin = AT91_PIN_PA22,
63 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
64};
65
66/*
67 * MACB Ethernet device
68 */
69static struct macb_platform_data __initdata macb_data = {
70 .phy_irq_pin = AT91_PIN_PA28,
71 .is_rmii = 1,
72};
73
74/*
75 * LEDs and GPOs
76 */
77static struct gpio_led gpio_leds[] = {
78 {
79 .name = "gpo:spi1reset",
80 .gpio = AT91_PIN_PC1,
81 .active_low = 0,
82 .default_trigger = "none",
83 .default_state = LEDS_GPIO_DEFSTATE_OFF,
84 },
85 {
86 .name = "gpo:trig_net_out",
87 .gpio = AT91_PIN_PB20,
88 .active_low = 0,
89 .default_trigger = "none",
90 .default_state = LEDS_GPIO_DEFSTATE_OFF,
91 },
92 {
93 .name = "gpo:trig_net_dir",
94 .gpio = AT91_PIN_PB19,
95 .active_low = 0,
96 .default_trigger = "none",
97 .default_state = LEDS_GPIO_DEFSTATE_OFF,
98 },
99 {
100 .name = "gpo:charge_dis",
101 .gpio = AT91_PIN_PC2,
102 .active_low = 0,
103 .default_trigger = "none",
104 .default_state = LEDS_GPIO_DEFSTATE_OFF,
105 },
106 {
107 .name = "led:event",
108 .gpio = AT91_PIN_PB17,
109 .active_low = 1,
110 .default_trigger = "none",
111 .default_state = LEDS_GPIO_DEFSTATE_OFF,
112 },
113 {
114 .name = "led:lan",
115 .gpio = AT91_PIN_PB18,
116 .active_low = 1,
117 .default_trigger = "none",
118 .default_state = LEDS_GPIO_DEFSTATE_OFF,
119 },
120 {
121 .name = "led:error",
122 .gpio = AT91_PIN_PB16,
123 .active_low = 1,
124 .default_trigger = "none",
125 .default_state = LEDS_GPIO_DEFSTATE_ON,
126 }
127};
128
129static struct gpio_led_platform_data gpio_led_info = {
130 .leds = gpio_leds,
131 .num_leds = ARRAY_SIZE(gpio_leds),
132};
133
134static struct platform_device leds = {
135 .name = "leds-gpio",
136 .id = 0,
137 .dev = {
138 .platform_data = &gpio_led_info,
139 }
140};
141
142static void __init gsia18s_leds_init(void)
143{
144 platform_device_register(&leds);
145}
146
147/* PCF8574 0x20 GPIO - U1 on the GS_IA18-CB_V3 board */
148static struct gpio_led pcf_gpio_leds1[] = {
149 { /* bit 0 */
150 .name = "gpo:hdc_power",
151 .gpio = PCF_GPIO_HDC_POWER,
152 .active_low = 0,
153 .default_trigger = "none",
154 .default_state = LEDS_GPIO_DEFSTATE_OFF,
155 },
156 { /* bit 1 */
157 .name = "gpo:wifi_setup",
158 .gpio = PCF_GPIO_WIFI_SETUP,
159 .active_low = 1,
160 .default_trigger = "none",
161 .default_state = LEDS_GPIO_DEFSTATE_OFF,
162 },
163 { /* bit 2 */
164 .name = "gpo:wifi_enable",
165 .gpio = PCF_GPIO_WIFI_ENABLE,
166 .active_low = 1,
167 .default_trigger = "none",
168 .default_state = LEDS_GPIO_DEFSTATE_OFF,
169 },
170 { /* bit 3 */
171 .name = "gpo:wifi_reset",
172 .gpio = PCF_GPIO_WIFI_RESET,
173 .active_low = 1,
174 .default_trigger = "none",
175 .default_state = LEDS_GPIO_DEFSTATE_ON,
176 },
177 /* bit 4 used as GPI */
178 { /* bit 5 */
179 .name = "gpo:gps_setup",
180 .gpio = PCF_GPIO_GPS_SETUP,
181 .active_low = 1,
182 .default_trigger = "none",
183 .default_state = LEDS_GPIO_DEFSTATE_OFF,
184 },
185 { /* bit 6 */
186 .name = "gpo:gps_standby",
187 .gpio = PCF_GPIO_GPS_STANDBY,
188 .active_low = 0,
189 .default_trigger = "none",
190 .default_state = LEDS_GPIO_DEFSTATE_ON,
191 },
192 { /* bit 7 */
193 .name = "gpo:gps_power",
194 .gpio = PCF_GPIO_GPS_POWER,
195 .active_low = 0,
196 .default_trigger = "none",
197 .default_state = LEDS_GPIO_DEFSTATE_OFF,
198 }
199};
200
201static struct gpio_led_platform_data pcf_gpio_led_info1 = {
202 .leds = pcf_gpio_leds1,
203 .num_leds = ARRAY_SIZE(pcf_gpio_leds1),
204};
205
206static struct platform_device pcf_leds1 = {
207 .name = "leds-gpio", /* GS_IA18-CB_board */
208 .id = 1,
209 .dev = {
210 .platform_data = &pcf_gpio_led_info1,
211 }
212};
213
214/* PCF8574 0x22 GPIO - U1 on the GS_2G_OPT1-A_V0 board (Alarm) */
215static struct gpio_led pcf_gpio_leds2[] = {
216 { /* bit 0 */
217 .name = "gpo:alarm_1",
218 .gpio = PCF_GPIO_ALARM1,
219 .active_low = 1,
220 .default_trigger = "none",
221 .default_state = LEDS_GPIO_DEFSTATE_OFF,
222 },
223 { /* bit 1 */
224 .name = "gpo:alarm_2",
225 .gpio = PCF_GPIO_ALARM2,
226 .active_low = 1,
227 .default_trigger = "none",
228 .default_state = LEDS_GPIO_DEFSTATE_OFF,
229 },
230 { /* bit 2 */
231 .name = "gpo:alarm_3",
232 .gpio = PCF_GPIO_ALARM3,
233 .active_low = 1,
234 .default_trigger = "none",
235 .default_state = LEDS_GPIO_DEFSTATE_OFF,
236 },
237 { /* bit 3 */
238 .name = "gpo:alarm_4",
239 .gpio = PCF_GPIO_ALARM4,
240 .active_low = 1,
241 .default_trigger = "none",
242 .default_state = LEDS_GPIO_DEFSTATE_OFF,
243 },
244 /* bits 4, 5, 6 not used */
245 { /* bit 7 */
246 .name = "gpo:alarm_v_relay_on",
247 .gpio = PCF_GPIO_ALARM_V_RELAY_ON,
248 .active_low = 0,
249 .default_trigger = "none",
250 .default_state = LEDS_GPIO_DEFSTATE_OFF,
251 },
252};
253
254static struct gpio_led_platform_data pcf_gpio_led_info2 = {
255 .leds = pcf_gpio_leds2,
256 .num_leds = ARRAY_SIZE(pcf_gpio_leds2),
257};
258
259static struct platform_device pcf_leds2 = {
260 .name = "leds-gpio",
261 .id = 2,
262 .dev = {
263 .platform_data = &pcf_gpio_led_info2,
264 }
265};
266
267/* PCF8574 0x24 GPIO U1 on the GS_2G-OPT23-A_V0 board (Modem) */
268static struct gpio_led pcf_gpio_leds3[] = {
269 { /* bit 0 */
270 .name = "gpo:modem_power",
271 .gpio = PCF_GPIO_MODEM_POWER,
272 .active_low = 1,
273 .default_trigger = "none",
274 .default_state = LEDS_GPIO_DEFSTATE_OFF,
275 },
276 /* bits 1 and 2 not used */
277 { /* bit 3 */
278 .name = "gpo:modem_reset",
279 .gpio = PCF_GPIO_MODEM_RESET,
280 .active_low = 1,
281 .default_trigger = "none",
282 .default_state = LEDS_GPIO_DEFSTATE_ON,
283 },
284 /* bits 4, 5 and 6 not used */
285 { /* bit 7 */
286 .name = "gpo:trx_reset",
287 .gpio = PCF_GPIO_TRX_RESET,
288 .active_low = 1,
289 .default_trigger = "none",
290 .default_state = LEDS_GPIO_DEFSTATE_ON,
291 }
292};
293
294static struct gpio_led_platform_data pcf_gpio_led_info3 = {
295 .leds = pcf_gpio_leds3,
296 .num_leds = ARRAY_SIZE(pcf_gpio_leds3),
297};
298
299static struct platform_device pcf_leds3 = {
300 .name = "leds-gpio",
301 .id = 3,
302 .dev = {
303 .platform_data = &pcf_gpio_led_info3,
304 }
305};
306
307static void __init gsia18s_pcf_leds_init(void)
308{
309 platform_device_register(&pcf_leds1);
310 platform_device_register(&pcf_leds2);
311 platform_device_register(&pcf_leds3);
312}
313
314/*
315 * SPI busses.
316 */
317static struct spi_board_info gsia18s_spi_devices[] = {
318 { /* User accessible spi0, cs0 used for communication with MSP RTC */
319 .modalias = "spidev",
320 .bus_num = 0,
321 .chip_select = 0,
322 .max_speed_hz = 580000,
323 .mode = SPI_MODE_1,
324 },
325 { /* User accessible spi1, cs0 used for communication with int. DSP */
326 .modalias = "spidev",
327 .bus_num = 1,
328 .chip_select = 0,
329 .max_speed_hz = 5600000,
330 .mode = SPI_MODE_0,
331 },
332 { /* User accessible spi1, cs1 used for communication with ext. DSP */
333 .modalias = "spidev",
334 .bus_num = 1,
335 .chip_select = 1,
336 .max_speed_hz = 5600000,
337 .mode = SPI_MODE_0,
338 },
339 { /* User accessible spi1, cs2 used for communication with ext. DSP */
340 .modalias = "spidev",
341 .bus_num = 1,
342 .chip_select = 2,
343 .max_speed_hz = 5600000,
344 .mode = SPI_MODE_0,
345 },
346 { /* User accessible spi1, cs3 used for communication with ext. DSP */
347 .modalias = "spidev",
348 .bus_num = 1,
349 .chip_select = 3,
350 .max_speed_hz = 5600000,
351 .mode = SPI_MODE_0,
352 }
353};
354
355/*
356 * GPI Buttons
357 */
358static struct gpio_keys_button buttons[] = {
359 {
360 .gpio = GPIO_TRIG_NET_IN,
361 .code = BTN_1,
362 .desc = "TRIG_NET_IN",
363 .type = EV_KEY,
364 .active_low = 0,
365 .wakeup = 1,
366 },
367 { /* SW80 on the GS_IA18_S-MN board*/
368 .gpio = GPIO_CARD_UNMOUNT_0,
369 .code = BTN_2,
370 .desc = "Card umount 0",
371 .type = EV_KEY,
372 .active_low = 1,
373 .wakeup = 1,
374 },
375 { /* SW79 on the GS_IA18_S-MN board*/
376 .gpio = GPIO_CARD_UNMOUNT_1,
377 .code = BTN_3,
378 .desc = "Card umount 1",
379 .type = EV_KEY,
380 .active_low = 1,
381 .wakeup = 1,
382 },
383 { /* SW280 on the GS_IA18-CB board*/
384 .gpio = GPIO_KEY_POWER,
385 .code = KEY_POWER,
386 .desc = "Power Off Button",
387 .type = EV_KEY,
388 .active_low = 0,
389 .wakeup = 1,
390 }
391};
392
393static struct gpio_keys_platform_data button_data = {
394 .buttons = buttons,
395 .nbuttons = ARRAY_SIZE(buttons),
396};
397
398static struct platform_device button_device = {
399 .name = "gpio-keys",
400 .id = -1,
401 .num_resources = 0,
402 .dev = {
403 .platform_data = &button_data,
404 }
405};
406
407static void __init gsia18s_add_device_buttons(void)
408{
409 at91_set_gpio_input(GPIO_TRIG_NET_IN, 1);
410 at91_set_deglitch(GPIO_TRIG_NET_IN, 1);
411 at91_set_gpio_input(GPIO_CARD_UNMOUNT_0, 1);
412 at91_set_deglitch(GPIO_CARD_UNMOUNT_0, 1);
413 at91_set_gpio_input(GPIO_CARD_UNMOUNT_1, 1);
414 at91_set_deglitch(GPIO_CARD_UNMOUNT_1, 1);
415 at91_set_gpio_input(GPIO_KEY_POWER, 0);
416 at91_set_deglitch(GPIO_KEY_POWER, 1);
417
418 platform_device_register(&button_device);
419}
420
421/*
422 * I2C
423 */
424static int pcf8574x_0x20_setup(struct i2c_client *client, int gpio,
425 unsigned int ngpio, void *context)
426{
427 int status;
428
429 status = gpio_request(gpio + PCF_GPIO_ETH_DETECT, "eth_det");
430 if (status < 0) {
431 pr_err("error: can't request GPIO%d\n",
432 gpio + PCF_GPIO_ETH_DETECT);
433 return status;
434 }
435 status = gpio_direction_input(gpio + PCF_GPIO_ETH_DETECT);
436 if (status < 0) {
437 pr_err("error: can't setup GPIO%d as input\n",
438 gpio + PCF_GPIO_ETH_DETECT);
439 return status;
440 }
441 status = gpio_export(gpio + PCF_GPIO_ETH_DETECT, false);
442 if (status < 0) {
443 pr_err("error: can't export GPIO%d\n",
444 gpio + PCF_GPIO_ETH_DETECT);
445 return status;
446 }
447 status = gpio_sysfs_set_active_low(gpio + PCF_GPIO_ETH_DETECT, 1);
448 if (status < 0) {
449 pr_err("error: gpio_sysfs_set active_low(GPIO%d, 1)\n",
450 gpio + PCF_GPIO_ETH_DETECT);
451 return status;
452 }
453
454 return 0;
455}
456
457static int pcf8574x_0x20_teardown(struct i2c_client *client, int gpio,
458 unsigned ngpio, void *context)
459{
460 gpio_free(gpio + PCF_GPIO_ETH_DETECT);
461 return 0;
462}
463
464static struct pcf857x_platform_data pcf20_pdata = {
465 .gpio_base = GS_IA18_S_PCF_GPIO_BASE0,
466 .n_latch = (1 << 4),
467 .setup = pcf8574x_0x20_setup,
468 .teardown = pcf8574x_0x20_teardown,
469};
470
471static struct pcf857x_platform_data pcf22_pdata = {
472 .gpio_base = GS_IA18_S_PCF_GPIO_BASE1,
473};
474
475static struct pcf857x_platform_data pcf24_pdata = {
476 .gpio_base = GS_IA18_S_PCF_GPIO_BASE2,
477};
478
479static struct i2c_board_info __initdata gsia18s_i2c_devices[] = {
480 { /* U1 on the GS_IA18-CB_V3 board */
481 I2C_BOARD_INFO("pcf8574", 0x20),
482 .platform_data = &pcf20_pdata,
483 },
484 { /* U1 on the GS_2G_OPT1-A_V0 board (Alarm) */
485 I2C_BOARD_INFO("pcf8574", 0x22),
486 .platform_data = &pcf22_pdata,
487 },
488 { /* U1 on the GS_2G-OPT23-A_V0 board (Modem) */
489 I2C_BOARD_INFO("pcf8574", 0x24),
490 .platform_data = &pcf24_pdata,
491 },
492 { /* U161 on the GS_IA18_S-MN board */
493 I2C_BOARD_INFO("24c1024", 0x50),
494 },
495 { /* U162 on the GS_IA18_S-MN board */
496 I2C_BOARD_INFO("24c01", 0x53),
497 },
498};
499
500/*
501 * Compact Flash
502 */
503static struct at91_cf_data __initdata gsia18s_cf1_data = {
504 .irq_pin = AT91_PIN_PA27,
505 .det_pin = AT91_PIN_PB30,
506 .vcc_pin = -EINVAL,
507 .rst_pin = AT91_PIN_PB31,
508 .chipselect = 5,
509 .flags = AT91_CF_TRUE_IDE,
510};
511
512/* Power Off by RTC */
513static void gsia18s_power_off(void)
514{
515 pr_notice("Power supply will be switched off automatically now or after 60 seconds without ArmDAS.\n");
516 at91_set_gpio_output(AT91_PIN_PA25, 1);
517 /* Spin to death... */
518 while (1)
519 ;
520}
521
522static int __init gsia18s_power_off_init(void)
523{
524 pm_power_off = gsia18s_power_off;
525 return 0;
526}
527
528/* ---------------------------------------------------------------------------*/
529
530static void __init gsia18s_board_init(void)
531{
532 /*
533 * USART0 on ttyS1 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI).
534 * Used for Internal Analog Modem.
535 */
536 at91_register_uart(AT91SAM9260_ID_US0, 1,
537 ATMEL_UART_CTS | ATMEL_UART_RTS |
538 ATMEL_UART_DTR | ATMEL_UART_DSR |
539 ATMEL_UART_DCD | ATMEL_UART_RI);
540 /*
541 * USART1 on ttyS2 (Rx, Tx, CTS, RTS).
542 * Used for GPS or WiFi or Data stream.
543 */
544 at91_register_uart(AT91SAM9260_ID_US1, 2,
545 ATMEL_UART_CTS | ATMEL_UART_RTS);
546 /*
547 * USART2 on ttyS3 (Rx, Tx, CTS, RTS).
548 * Used for External Modem.
549 */
550 at91_register_uart(AT91SAM9260_ID_US2, 3,
551 ATMEL_UART_CTS | ATMEL_UART_RTS);
552 /*
553 * USART3 on ttyS4 (Rx, Tx, RTS).
554 * Used for RS-485.
555 */
556 at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_RTS);
557
558 /*
559 * USART4 on ttyS5 (Rx, Tx).
560 * Used for TRX433 Radio Module.
561 */
562 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
563 stamp9g20_board_init();
564 at91_add_device_usbh(&usbh_data);
565 at91_add_device_udc(&udc_data);
566 at91_add_device_eth(&macb_data);
567 gsia18s_leds_init();
568 gsia18s_pcf_leds_init();
569 gsia18s_add_device_buttons();
570 at91_add_device_i2c(gsia18s_i2c_devices,
571 ARRAY_SIZE(gsia18s_i2c_devices));
572 at91_add_device_cf(&gsia18s_cf1_data);
573 at91_add_device_spi(gsia18s_spi_devices,
574 ARRAY_SIZE(gsia18s_spi_devices));
575 gsia18s_power_off_init();
576}
577
578MACHINE_START(GSIA18S, "GS_IA18_S")
579 .init_time = at91_init_time,
580 .map_io = at91_map_io,
581 .handle_irq = at91_aic_handle_irq,
582 .init_early = gsia18s_init_early,
583 .init_irq = at91_init_irq_default,
584 .init_machine = gsia18s_board_init,
585MACHINE_END
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
deleted file mode 100644
index 93b1df42f639..000000000000
--- a/arch/arm/mach-at91/board-kafa.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-kafa.c
3 *
4 * Copyright (C) 2006 Sperry-Sun
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/gpio.h>
23#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/platform_device.h>
27
28#include <mach/hardware.h>
29#include <asm/setup.h>
30#include <asm/mach-types.h>
31#include <asm/irq.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/mach/irq.h>
36
37#include <mach/cpu.h>
38
39#include "at91_aic.h"
40#include "board.h"
41#include "generic.h"
42#include "gpio.h"
43
44
45static void __init kafa_init_early(void)
46{
47 /* Set cpu type: PQFP */
48 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
49
50 /* Initialize processor: 18.432 MHz crystal */
51 at91_initialize(18432000);
52}
53
54static struct macb_platform_data __initdata kafa_eth_data = {
55 .phy_irq_pin = AT91_PIN_PC4,
56 .is_rmii = 0,
57};
58
59static struct at91_usbh_data __initdata kafa_usbh_data = {
60 .ports = 1,
61 .vbus_pin = {-EINVAL, -EINVAL},
62 .overcurrent_pin= {-EINVAL, -EINVAL},
63};
64
65static struct at91_udc_data __initdata kafa_udc_data = {
66 .vbus_pin = AT91_PIN_PB6,
67 .pullup_pin = AT91_PIN_PB7,
68};
69
70/*
71 * LEDs
72 */
73static struct gpio_led kafa_leds[] = {
74 { /* D1 */
75 .name = "led1",
76 .gpio = AT91_PIN_PB4,
77 .active_low = 1,
78 .default_trigger = "heartbeat",
79 },
80};
81
82static void __init kafa_board_init(void)
83{
84 /* Serial */
85 /* DBGU on ttyS0. (Rx & Tx only) */
86 at91_register_uart(0, 0, 0);
87
88 /* USART0 on ttyS1 (Rx, Tx, CTS, RTS) */
89 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
90 at91_add_device_serial();
91 /* Ethernet */
92 at91_add_device_eth(&kafa_eth_data);
93 /* USB Host */
94 at91_add_device_usbh(&kafa_usbh_data);
95 /* USB Device */
96 at91_add_device_udc(&kafa_udc_data);
97 /* I2C */
98 at91_add_device_i2c(NULL, 0);
99 /* SPI */
100 at91_add_device_spi(NULL, 0);
101 /* LEDs */
102 at91_gpio_leds(kafa_leds, ARRAY_SIZE(kafa_leds));
103}
104
105MACHINE_START(KAFA, "Sperry-Sun KAFA")
106 /* Maintainer: Sergei Sharonov */
107 .init_time = at91rm9200_timer_init,
108 .map_io = at91_map_io,
109 .handle_irq = at91_aic_handle_irq,
110 .init_early = kafa_init_early,
111 .init_irq = at91_init_irq_default,
112 .init_machine = kafa_board_init,
113MACHINE_END
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
deleted file mode 100644
index d58d36225e08..000000000000
--- a/arch/arm/mach-at91/board-kb9202.c
+++ /dev/null
@@ -1,159 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-kb9202.c
3 *
4 * Copyright (c) 2005 kb_admin
5 * KwikByte, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 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/gpio.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28
29#include <mach/hardware.h>
30#include <asm/setup.h>
31#include <asm/mach-types.h>
32#include <asm/irq.h>
33
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include <mach/cpu.h>
39#include <mach/at91rm9200_mc.h>
40#include <mach/at91_ramc.h>
41
42#include "at91_aic.h"
43#include "board.h"
44#include "generic.h"
45#include "gpio.h"
46
47
48static void __init kb9202_init_early(void)
49{
50 /* Set cpu type: PQFP */
51 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
52
53 /* Initialize processor: 10 MHz crystal */
54 at91_initialize(10000000);
55}
56
57static struct macb_platform_data __initdata kb9202_eth_data = {
58 .phy_irq_pin = AT91_PIN_PB29,
59 .is_rmii = 0,
60};
61
62static struct at91_usbh_data __initdata kb9202_usbh_data = {
63 .ports = 1,
64 .vbus_pin = {-EINVAL, -EINVAL},
65 .overcurrent_pin= {-EINVAL, -EINVAL},
66};
67
68static struct at91_udc_data __initdata kb9202_udc_data = {
69 .vbus_pin = AT91_PIN_PB24,
70 .pullup_pin = AT91_PIN_PB22,
71};
72
73static struct mci_platform_data __initdata kb9202_mci0_data = {
74 .slot[0] = {
75 .bus_width = 4,
76 .detect_pin = AT91_PIN_PB2,
77 .wp_pin = -EINVAL,
78 },
79};
80
81static struct mtd_partition __initdata kb9202_nand_partition[] = {
82 {
83 .name = "nand_fs",
84 .offset = 0,
85 .size = MTDPART_SIZ_FULL,
86 },
87};
88
89static struct atmel_nand_data __initdata kb9202_nand_data = {
90 .ale = 22,
91 .cle = 21,
92 .det_pin = -EINVAL,
93 .rdy_pin = AT91_PIN_PC29,
94 .enable_pin = AT91_PIN_PC28,
95 .ecc_mode = NAND_ECC_SOFT,
96 .parts = kb9202_nand_partition,
97 .num_parts = ARRAY_SIZE(kb9202_nand_partition),
98};
99
100/*
101 * LEDs
102 */
103static struct gpio_led kb9202_leds[] = {
104 { /* D1 */
105 .name = "led1",
106 .gpio = AT91_PIN_PC19,
107 .active_low = 1,
108 .default_trigger = "heartbeat",
109 },
110 { /* D2 */
111 .name = "led2",
112 .gpio = AT91_PIN_PC18,
113 .active_low = 1,
114 .default_trigger = "timer",
115 }
116};
117
118static void __init kb9202_board_init(void)
119{
120 /* Serial */
121 /* DBGU on ttyS0. (Rx & Tx only) */
122 at91_register_uart(0, 0, 0);
123
124 /* USART0 on ttyS1 (Rx & Tx only) */
125 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
126
127 /* USART1 on ttyS2 (Rx & Tx only) - IRDA (optional) */
128 at91_register_uart(AT91RM9200_ID_US1, 2, 0);
129
130 /* USART3 on ttyS3 (Rx, Tx, CTS, RTS) - RS485 (optional) */
131 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
132 at91_add_device_serial();
133 /* Ethernet */
134 at91_add_device_eth(&kb9202_eth_data);
135 /* USB Host */
136 at91_add_device_usbh(&kb9202_usbh_data);
137 /* USB Device */
138 at91_add_device_udc(&kb9202_udc_data);
139 /* MMC */
140 at91_add_device_mci(0, &kb9202_mci0_data);
141 /* I2C */
142 at91_add_device_i2c(NULL, 0);
143 /* SPI */
144 at91_add_device_spi(NULL, 0);
145 /* NAND */
146 at91_add_device_nand(&kb9202_nand_data);
147 /* LEDs */
148 at91_gpio_leds(kb9202_leds, ARRAY_SIZE(kb9202_leds));
149}
150
151MACHINE_START(KB9200, "KB920x")
152 /* Maintainer: KwikByte, Inc. */
153 .init_time = at91rm9200_timer_init,
154 .map_io = at91_map_io,
155 .handle_irq = at91_aic_handle_irq,
156 .init_early = kb9202_init_early,
157 .init_irq = at91_init_irq_default,
158 .init_machine = kb9202_board_init,
159MACHINE_END
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
deleted file mode 100644
index 9c26b94ce448..000000000000
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ /dev/null
@@ -1,228 +0,0 @@
1/*
2 * Copyright (C) 2010 Christian Glindkamp <christian.glindkamp@taskit.de>
3 * taskit GmbH
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19/*
20 * copied and adjusted from board-stamp9g20.c
21 * by Peter Gsellmann <pgsellmann@portner-elektronik.at>
22 */
23
24#include <linux/mm.h>
25#include <linux/platform_device.h>
26#include <linux/gpio.h>
27#include <linux/w1-gpio.h>
28
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31
32#include <mach/at91sam9_smc.h>
33#include <mach/hardware.h>
34
35#include "at91_aic.h"
36#include "board.h"
37#include "sam9_smc.h"
38#include "generic.h"
39#include "stamp9g20.h"
40#include "gpio.h"
41
42
43static void __init pcontrol_g20_init_early(void)
44{
45 stamp9g20_init_early();
46}
47
48static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
49 .ncs_read_setup = 16,
50 .nrd_setup = 18,
51 .ncs_write_setup = 16,
52 .nwe_setup = 18,
53
54 .ncs_read_pulse = 63,
55 .nrd_pulse = 55,
56 .ncs_write_pulse = 63,
57 .nwe_pulse = 55,
58
59 .read_cycle = 127,
60 .write_cycle = 127,
61
62 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE
63 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_SELECT
64 | AT91_SMC_DBW_8 | AT91_SMC_PS_4
65 | AT91_SMC_TDFMODE,
66 .tdf_cycles = 3,
67}, {
68 .ncs_read_setup = 0,
69 .nrd_setup = 0,
70 .ncs_write_setup = 0,
71 .nwe_setup = 1,
72
73 .ncs_read_pulse = 8,
74 .nrd_pulse = 8,
75 .ncs_write_pulse = 5,
76 .nwe_pulse = 4,
77
78 .read_cycle = 8,
79 .write_cycle = 7,
80
81 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE
82 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_SELECT
83 | AT91_SMC_DBW_16 | AT91_SMC_PS_8
84 | AT91_SMC_TDFMODE,
85 .tdf_cycles = 1,
86} };
87
88static void __init add_device_pcontrol(void)
89{
90 /* configure chip-select 4 (IO compatible to 8051 X4 ) */
91 sam9_smc_configure(0, 4, &pcontrol_smc_config[0]);
92 /* configure chip-select 7 (FerroRAM 256KiBx16bit MR2A16A D4 ) */
93 sam9_smc_configure(0, 7, &pcontrol_smc_config[1]);
94}
95
96
97/*
98 * USB Host port
99 */
100static struct at91_usbh_data __initdata usbh_data = {
101 .ports = 2,
102 .vbus_pin = {-EINVAL, -EINVAL},
103 .overcurrent_pin= {-EINVAL, -EINVAL},
104};
105
106
107/*
108 * USB Device port
109 */
110static struct at91_udc_data __initdata pcontrol_g20_udc_data = {
111 .vbus_pin = AT91_PIN_PA22, /* Detect +5V bus voltage */
112 .pullup_pin = AT91_PIN_PA4, /* K-state, active low */
113};
114
115
116/*
117 * MACB Ethernet device
118 */
119static struct macb_platform_data __initdata macb_data = {
120 .phy_irq_pin = AT91_PIN_PA28,
121 .is_rmii = 1,
122};
123
124
125/*
126 * I2C devices: eeprom and phy/switch
127 */
128static struct i2c_board_info __initdata pcontrol_g20_i2c_devices[] = {
129{ /* D7 address width=2, 8KiB */
130 I2C_BOARD_INFO("24c64", 0x50)
131}, { /* D8 address width=1, 1 byte has 32 bits! */
132 I2C_BOARD_INFO("lan9303", 0x0a)
133}, };
134
135
136/*
137 * LEDs
138 */
139static struct gpio_led pcontrol_g20_leds[] = {
140 {
141 .name = "LED1", /* red H5 */
142 .gpio = AT91_PIN_PB18,
143 .active_low = 1,
144 .default_trigger = "none", /* supervisor */
145 }, {
146 .name = "LED2", /* yellow H7 */
147 .gpio = AT91_PIN_PB19,
148 .active_low = 1,
149 .default_trigger = "mmc0", /* SD-card activity */
150 }, {
151 .name = "LED3", /* green H2 */
152 .gpio = AT91_PIN_PB20,
153 .active_low = 1,
154 .default_trigger = "heartbeat", /* blinky */
155 }, {
156 .name = "LED4", /* red H3 */
157 .gpio = AT91_PIN_PC6,
158 .active_low = 1,
159 .default_trigger = "none", /* connection lost */
160 }, {
161 .name = "LED5", /* yellow H6 */
162 .gpio = AT91_PIN_PC7,
163 .active_low = 1,
164 .default_trigger = "none", /* unsent data */
165 }, {
166 .name = "LED6", /* green H1 */
167 .gpio = AT91_PIN_PC9,
168 .active_low = 1,
169 .default_trigger = "none", /* snafu */
170 }
171};
172
173
174/*
175 * SPI devices
176 */
177static struct spi_board_info pcontrol_g20_spi_devices[] = {
178 {
179 .modalias = "spidev", /* HMI port X4 */
180 .chip_select = 1,
181 .max_speed_hz = 50 * 1000 * 1000,
182 .bus_num = 0,
183 }, {
184 .modalias = "spidev", /* piggyback A2 */
185 .chip_select = 0,
186 .max_speed_hz = 50 * 1000 * 1000,
187 .bus_num = 1,
188 },
189};
190
191
192static void __init pcontrol_g20_board_init(void)
193{
194 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) piggyback A2 */
195 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS
196 | ATMEL_UART_RTS);
197
198 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) isolated RS485 X5 */
199 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS
200 | ATMEL_UART_RTS);
201
202 /* USART2 on ttyS3. (Rx, Tx) 9bit-Bus Multidrop-mode X4 */
203 at91_register_uart(AT91SAM9260_ID_US4, 3, 0);
204 stamp9g20_board_init();
205 at91_add_device_usbh(&usbh_data);
206 at91_add_device_eth(&macb_data);
207 at91_add_device_i2c(pcontrol_g20_i2c_devices,
208 ARRAY_SIZE(pcontrol_g20_i2c_devices));
209 add_device_pcontrol();
210 at91_add_device_spi(pcontrol_g20_spi_devices,
211 ARRAY_SIZE(pcontrol_g20_spi_devices));
212 at91_add_device_udc(&pcontrol_g20_udc_data);
213 at91_gpio_leds(pcontrol_g20_leds,
214 ARRAY_SIZE(pcontrol_g20_leds));
215 /* piggyback A2 */
216 at91_set_gpio_output(AT91_PIN_PB31, 1);
217}
218
219
220MACHINE_START(PCONTROL_G20, "PControl G20")
221 /* Maintainer: pgsellmann@portner-elektronik.at */
222 .init_time = at91_init_time,
223 .map_io = at91_map_io,
224 .handle_irq = at91_aic_handle_irq,
225 .init_early = pcontrol_g20_init_early,
226 .init_irq = at91_init_irq_default,
227 .init_machine = pcontrol_g20_board_init,
228MACHINE_END
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
deleted file mode 100644
index 2c0f2d554d84..000000000000
--- a/arch/arm/mach-at91/board-picotux200.c
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-picotux200.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Kleinhenz Elektronik GmbH
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/gpio.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/mtd/physmap.h>
30
31#include <mach/hardware.h>
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h>
35
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
40#include <mach/at91rm9200_mc.h>
41#include <mach/at91_ramc.h>
42
43#include "at91_aic.h"
44#include "board.h"
45#include "generic.h"
46#include "gpio.h"
47
48
49static void __init picotux200_init_early(void)
50{
51 /* Initialize processor: 18.432 MHz crystal */
52 at91_initialize(18432000);
53}
54
55static struct macb_platform_data __initdata picotux200_eth_data = {
56 .phy_irq_pin = AT91_PIN_PC4,
57 .is_rmii = 1,
58};
59
60static struct at91_usbh_data __initdata picotux200_usbh_data = {
61 .ports = 1,
62 .vbus_pin = {-EINVAL, -EINVAL},
63 .overcurrent_pin= {-EINVAL, -EINVAL},
64};
65
66static struct mci_platform_data __initdata picotux200_mci0_data = {
67 .slot[0] = {
68 .bus_width = 4,
69 .detect_pin = AT91_PIN_PB27,
70 .wp_pin = AT91_PIN_PA17,
71 },
72};
73
74#define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0
75#define PICOTUX200_FLASH_SIZE SZ_4M
76
77static struct physmap_flash_data picotux200_flash_data = {
78 .width = 2,
79};
80
81static struct resource picotux200_flash_resource = {
82 .start = PICOTUX200_FLASH_BASE,
83 .end = PICOTUX200_FLASH_BASE + PICOTUX200_FLASH_SIZE - 1,
84 .flags = IORESOURCE_MEM,
85};
86
87static struct platform_device picotux200_flash = {
88 .name = "physmap-flash",
89 .id = 0,
90 .dev = {
91 .platform_data = &picotux200_flash_data,
92 },
93 .resource = &picotux200_flash_resource,
94 .num_resources = 1,
95};
96
97static void __init picotux200_board_init(void)
98{
99 /* Serial */
100 /* DBGU on ttyS0. (Rx & Tx only) */
101 at91_register_uart(0, 0, 0);
102
103 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
104 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
105 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
106 | ATMEL_UART_RI);
107 at91_add_device_serial();
108 /* Ethernet */
109 at91_add_device_eth(&picotux200_eth_data);
110 /* USB Host */
111 at91_add_device_usbh(&picotux200_usbh_data);
112 /* I2C */
113 at91_add_device_i2c(NULL, 0);
114 /* MMC */
115 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
116 at91_add_device_mci(0, &picotux200_mci0_data);
117 /* NOR Flash */
118 platform_device_register(&picotux200_flash);
119}
120
121MACHINE_START(PICOTUX2XX, "picotux 200")
122 /* Maintainer: Kleinhenz Elektronik GmbH */
123 .init_time = at91rm9200_timer_init,
124 .map_io = at91_map_io,
125 .handle_irq = at91_aic_handle_irq,
126 .init_early = picotux200_init_early,
127 .init_irq = at91_init_irq_default,
128 .init_machine = picotux200_board_init,
129MACHINE_END
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
deleted file mode 100644
index 953cea416754..000000000000
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ /dev/null
@@ -1,196 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-rm9200ek.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * Epson S1D framebuffer glue code is:
7 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.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 as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/types.h>
25#include <linux/gpio.h>
26#include <linux/init.h>
27#include <linux/mm.h>
28#include <linux/module.h>
29#include <linux/platform_device.h>
30#include <linux/spi/spi.h>
31#include <linux/mtd/physmap.h>
32
33#include <asm/setup.h>
34#include <asm/mach-types.h>
35#include <asm/irq.h>
36
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39#include <asm/mach/irq.h>
40
41#include <mach/hardware.h>
42#include <mach/at91rm9200_mc.h>
43#include <mach/at91_ramc.h>
44
45#include "at91_aic.h"
46#include "board.h"
47#include "generic.h"
48#include "gpio.h"
49
50
51static void __init ek_init_early(void)
52{
53 /* Initialize processor: 18.432 MHz crystal */
54 at91_initialize(18432000);
55}
56
57static struct macb_platform_data __initdata ek_eth_data = {
58 .phy_irq_pin = AT91_PIN_PC4,
59 .is_rmii = 1,
60};
61
62static struct at91_usbh_data __initdata ek_usbh_data = {
63 .ports = 2,
64 .vbus_pin = {-EINVAL, -EINVAL},
65 .overcurrent_pin= {-EINVAL, -EINVAL},
66};
67
68static struct at91_udc_data __initdata ek_udc_data = {
69 .vbus_pin = AT91_PIN_PD4,
70 .pullup_pin = AT91_PIN_PD5,
71};
72
73#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD
74static struct mci_platform_data __initdata ek_mci0_data = {
75 .slot[0] = {
76 .bus_width = 4,
77 .detect_pin = AT91_PIN_PB27,
78 .wp_pin = AT91_PIN_PA17,
79 }
80};
81#endif
82
83static struct spi_board_info ek_spi_devices[] = {
84 { /* DataFlash chip */
85 .modalias = "mtd_dataflash",
86 .chip_select = 0,
87 .max_speed_hz = 15 * 1000 * 1000,
88 },
89#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
90 { /* DataFlash card */
91 .modalias = "mtd_dataflash",
92 .chip_select = 3,
93 .max_speed_hz = 15 * 1000 * 1000,
94 },
95#endif
96};
97
98static struct i2c_board_info __initdata ek_i2c_devices[] = {
99 {
100 I2C_BOARD_INFO("ics1523", 0x26),
101 },
102 {
103 I2C_BOARD_INFO("dac3550", 0x4d),
104 }
105};
106
107#define EK_FLASH_BASE AT91_CHIPSELECT_0
108#define EK_FLASH_SIZE SZ_8M
109
110static struct physmap_flash_data ek_flash_data = {
111 .width = 2,
112};
113
114static struct resource ek_flash_resource = {
115 .start = EK_FLASH_BASE,
116 .end = EK_FLASH_BASE + EK_FLASH_SIZE - 1,
117 .flags = IORESOURCE_MEM,
118};
119
120static struct platform_device ek_flash = {
121 .name = "physmap-flash",
122 .id = 0,
123 .dev = {
124 .platform_data = &ek_flash_data,
125 },
126 .resource = &ek_flash_resource,
127 .num_resources = 1,
128};
129
130static struct gpio_led ek_leds[] = {
131 { /* "user led 1", DS2 */
132 .name = "green",
133 .gpio = AT91_PIN_PB0,
134 .active_low = 1,
135 .default_trigger = "mmc0",
136 },
137 { /* "user led 2", DS4 */
138 .name = "yellow",
139 .gpio = AT91_PIN_PB1,
140 .active_low = 1,
141 .default_trigger = "heartbeat",
142 },
143 { /* "user led 3", DS6 */
144 .name = "red",
145 .gpio = AT91_PIN_PB2,
146 .active_low = 1,
147 }
148};
149
150static void __init ek_board_init(void)
151{
152 /* Serial */
153 /* DBGU on ttyS0. (Rx & Tx only) */
154 at91_register_uart(0, 0, 0);
155
156 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
157 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
158 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
159 | ATMEL_UART_RI);
160 at91_add_device_serial();
161 /* Ethernet */
162 at91_add_device_eth(&ek_eth_data);
163 /* USB Host */
164 at91_add_device_usbh(&ek_usbh_data);
165 /* USB Device */
166 at91_add_device_udc(&ek_udc_data);
167 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
168 /* I2C */
169 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
170 /* SPI */
171 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
172#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
173 /* DataFlash card */
174 at91_set_gpio_output(AT91_PIN_PB22, 0);
175#else
176 /* MMC */
177 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
178 at91_add_device_mci(0, &ek_mci0_data);
179#endif
180 /* NOR Flash */
181 platform_device_register(&ek_flash);
182 /* LEDs */
183 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
184 /* VGA */
185// ek_add_device_video();
186}
187
188MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK")
189 /* Maintainer: SAN People/Atmel */
190 .init_time = at91rm9200_timer_init,
191 .map_io = at91_map_io,
192 .handle_irq = at91_aic_handle_irq,
193 .init_early = ek_init_early,
194 .init_irq = at91_init_irq_default,
195 .init_machine = ek_board_init,
196MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
deleted file mode 100644
index c2166e3a236c..000000000000
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ /dev/null
@@ -1,230 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-sam9-l9260.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2007 Olimex Ltd
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/gpio.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/spi/spi.h>
30
31#include <mach/hardware.h>
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h>
35
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
40#include <mach/at91sam9_smc.h>
41
42#include "at91_aic.h"
43#include "board.h"
44#include "sam9_smc.h"
45#include "generic.h"
46#include "gpio.h"
47
48
49static void __init ek_init_early(void)
50{
51 /* Initialize processor: 18.432 MHz crystal */
52 at91_initialize(18432000);
53}
54
55/*
56 * USB Host port
57 */
58static struct at91_usbh_data __initdata ek_usbh_data = {
59 .ports = 2,
60 .vbus_pin = {-EINVAL, -EINVAL},
61 .overcurrent_pin= {-EINVAL, -EINVAL},
62};
63
64/*
65 * USB Device port
66 */
67static struct at91_udc_data __initdata ek_udc_data = {
68 .vbus_pin = AT91_PIN_PC5,
69 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
70};
71
72
73/*
74 * SPI devices.
75 */
76static struct spi_board_info ek_spi_devices[] = {
77#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
78 { /* DataFlash chip */
79 .modalias = "mtd_dataflash",
80 .chip_select = 1,
81 .max_speed_hz = 15 * 1000 * 1000,
82 .bus_num = 0,
83 },
84#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
85 { /* DataFlash card */
86 .modalias = "mtd_dataflash",
87 .chip_select = 0,
88 .max_speed_hz = 15 * 1000 * 1000,
89 .bus_num = 0,
90 },
91#endif
92#endif
93};
94
95
96/*
97 * MACB Ethernet device
98 */
99static struct macb_platform_data __initdata ek_macb_data = {
100 .phy_irq_pin = AT91_PIN_PA7,
101 .is_rmii = 0,
102};
103
104
105/*
106 * NAND flash
107 */
108static struct mtd_partition __initdata ek_nand_partition[] = {
109 {
110 .name = "Bootloader Area",
111 .offset = 0,
112 .size = 10 * SZ_1M,
113 },
114 {
115 .name = "User Area",
116 .offset = MTDPART_OFS_NXTBLK,
117 .size = MTDPART_SIZ_FULL,
118 },
119};
120
121static struct atmel_nand_data __initdata ek_nand_data = {
122 .ale = 21,
123 .cle = 22,
124 .det_pin = -EINVAL,
125 .rdy_pin = AT91_PIN_PC13,
126 .enable_pin = AT91_PIN_PC14,
127 .ecc_mode = NAND_ECC_SOFT,
128 .parts = ek_nand_partition,
129 .num_parts = ARRAY_SIZE(ek_nand_partition),
130};
131
132static struct sam9_smc_config __initdata ek_nand_smc_config = {
133 .ncs_read_setup = 0,
134 .nrd_setup = 1,
135 .ncs_write_setup = 0,
136 .nwe_setup = 1,
137
138 .ncs_read_pulse = 3,
139 .nrd_pulse = 3,
140 .ncs_write_pulse = 3,
141 .nwe_pulse = 3,
142
143 .read_cycle = 5,
144 .write_cycle = 5,
145
146 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
147 .tdf_cycles = 2,
148};
149
150static void __init ek_add_device_nand(void)
151{
152 /* configure chip-select 3 (NAND) */
153 sam9_smc_configure(0, 3, &ek_nand_smc_config);
154
155 at91_add_device_nand(&ek_nand_data);
156}
157
158
159/*
160 * MCI (SD/MMC)
161 */
162static struct mci_platform_data __initdata ek_mci0_data = {
163 .slot[1] = {
164 .bus_width = 4,
165 .detect_pin = AT91_PIN_PC8,
166 .wp_pin = AT91_PIN_PC4,
167 },
168};
169
170/*
171 * LEDs
172 */
173static struct gpio_led ek_leds[] = {
174 { /* D1 */
175 .name = "led1",
176 .gpio = AT91_PIN_PA9,
177 .active_low = 1,
178 .default_trigger = "heartbeat",
179 },
180 { /* D2 */
181 .name = "led2",
182 .gpio = AT91_PIN_PA6,
183 .active_low = 1,
184 .default_trigger = "timer",
185 }
186};
187
188static void __init ek_board_init(void)
189{
190 at91_register_devices();
191
192 /* Serial */
193 /* DBGU on ttyS0. (Rx & Tx only) */
194 at91_register_uart(0, 0, 0);
195
196 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
197 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
198 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
199 | ATMEL_UART_RI);
200
201 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
202 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
203 at91_add_device_serial();
204 /* USB Host */
205 at91_add_device_usbh(&ek_usbh_data);
206 /* USB Device */
207 at91_add_device_udc(&ek_udc_data);
208 /* SPI */
209 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
210 /* NAND */
211 ek_add_device_nand();
212 /* Ethernet */
213 at91_add_device_eth(&ek_macb_data);
214 /* MMC */
215 at91_add_device_mci(0, &ek_mci0_data);
216 /* I2C */
217 at91_add_device_i2c(NULL, 0);
218 /* LEDs */
219 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
220}
221
222MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260")
223 /* Maintainer: Olimex */
224 .init_time = at91_init_time,
225 .map_io = at91_map_io,
226 .handle_irq = at91_aic_handle_irq,
227 .init_early = ek_init_early,
228 .init_irq = at91_init_irq_default,
229 .init_machine = ek_board_init,
230MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
deleted file mode 100644
index bf8a946b4cd0..000000000000
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ /dev/null
@@ -1,354 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-sam9260ek.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
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/gpio.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/spi/at73c213.h>
30#include <linux/clk.h>
31#include <linux/platform_data/at24.h>
32#include <linux/gpio_keys.h>
33#include <linux/input.h>
34
35#include <asm/setup.h>
36#include <asm/mach-types.h>
37#include <asm/irq.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/irq.h>
42
43#include <mach/hardware.h>
44#include <mach/at91sam9_smc.h>
45#include <mach/system_rev.h>
46
47#include "at91_aic.h"
48#include "board.h"
49#include "sam9_smc.h"
50#include "generic.h"
51#include "gpio.h"
52
53
54static void __init ek_init_early(void)
55{
56 /* Initialize processor: 18.432 MHz crystal */
57 at91_initialize(18432000);
58}
59
60/*
61 * USB Host port
62 */
63static struct at91_usbh_data __initdata ek_usbh_data = {
64 .ports = 2,
65 .vbus_pin = {-EINVAL, -EINVAL},
66 .overcurrent_pin= {-EINVAL, -EINVAL},
67};
68
69/*
70 * USB Device port
71 */
72static struct at91_udc_data __initdata ek_udc_data = {
73 .vbus_pin = AT91_PIN_PC5,
74 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
75};
76
77
78/*
79 * Audio
80 */
81static struct at73c213_board_info at73c213_data = {
82 .ssc_id = 0,
83 .shortname = "AT91SAM9260-EK external DAC",
84};
85
86#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
87static void __init at73c213_set_clk(struct at73c213_board_info *info)
88{
89 struct clk *pck0;
90 struct clk *plla;
91
92 pck0 = clk_get(NULL, "pck0");
93 plla = clk_get(NULL, "plla");
94
95 /* AT73C213 MCK Clock */
96 at91_set_B_periph(AT91_PIN_PC1, 0); /* PCK0 */
97
98 clk_set_parent(pck0, plla);
99 clk_put(plla);
100
101 info->dac_clk = pck0;
102}
103#else
104static void __init at73c213_set_clk(struct at73c213_board_info *info) {}
105#endif
106
107/*
108 * SPI devices.
109 */
110static struct spi_board_info ek_spi_devices[] = {
111#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
112 { /* DataFlash chip */
113 .modalias = "mtd_dataflash",
114 .chip_select = 1,
115 .max_speed_hz = 15 * 1000 * 1000,
116 .bus_num = 0,
117 },
118#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
119 { /* DataFlash card */
120 .modalias = "mtd_dataflash",
121 .chip_select = 0,
122 .max_speed_hz = 15 * 1000 * 1000,
123 .bus_num = 0,
124 },
125#endif
126#endif
127#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
128 { /* AT73C213 DAC */
129 .modalias = "at73c213",
130 .chip_select = 0,
131 .max_speed_hz = 10 * 1000 * 1000,
132 .bus_num = 1,
133 .mode = SPI_MODE_1,
134 .platform_data = &at73c213_data,
135 },
136#endif
137};
138
139
140/*
141 * MACB Ethernet device
142 */
143static struct macb_platform_data __initdata ek_macb_data = {
144 .phy_irq_pin = AT91_PIN_PA7,
145 .is_rmii = 1,
146};
147
148
149/*
150 * NAND flash
151 */
152static struct mtd_partition __initdata ek_nand_partition[] = {
153 {
154 .name = "Partition 1",
155 .offset = 0,
156 .size = SZ_256K,
157 },
158 {
159 .name = "Partition 2",
160 .offset = MTDPART_OFS_NXTBLK,
161 .size = MTDPART_SIZ_FULL,
162 },
163};
164
165static struct atmel_nand_data __initdata ek_nand_data = {
166 .ale = 21,
167 .cle = 22,
168 .det_pin = -EINVAL,
169 .rdy_pin = AT91_PIN_PC13,
170 .enable_pin = AT91_PIN_PC14,
171 .ecc_mode = NAND_ECC_SOFT,
172 .on_flash_bbt = 1,
173 .parts = ek_nand_partition,
174 .num_parts = ARRAY_SIZE(ek_nand_partition),
175};
176
177static struct sam9_smc_config __initdata ek_nand_smc_config = {
178 .ncs_read_setup = 0,
179 .nrd_setup = 1,
180 .ncs_write_setup = 0,
181 .nwe_setup = 1,
182
183 .ncs_read_pulse = 3,
184 .nrd_pulse = 3,
185 .ncs_write_pulse = 3,
186 .nwe_pulse = 3,
187
188 .read_cycle = 5,
189 .write_cycle = 5,
190
191 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
192 .tdf_cycles = 2,
193};
194
195static void __init ek_add_device_nand(void)
196{
197 ek_nand_data.bus_width_16 = board_have_nand_16bit();
198 /* setup bus-width (8 or 16) */
199 if (ek_nand_data.bus_width_16)
200 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
201 else
202 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
203
204 /* configure chip-select 3 (NAND) */
205 sam9_smc_configure(0, 3, &ek_nand_smc_config);
206
207 at91_add_device_nand(&ek_nand_data);
208}
209
210
211/*
212 * MCI (SD/MMC)
213 */
214static struct mci_platform_data __initdata ek_mci0_data = {
215 .slot[1] = {
216 .bus_width = 4,
217 .detect_pin = -EINVAL,
218 .wp_pin = -EINVAL,
219 },
220};
221
222
223/*
224 * LEDs
225 */
226static struct gpio_led ek_leds[] = {
227 { /* "bottom" led, green, userled1 to be defined */
228 .name = "ds5",
229 .gpio = AT91_PIN_PA6,
230 .active_low = 1,
231 .default_trigger = "none",
232 },
233 { /* "power" led, yellow */
234 .name = "ds1",
235 .gpio = AT91_PIN_PA9,
236 .default_trigger = "heartbeat",
237 }
238};
239
240/*
241 * I2C devices
242 */
243static struct at24_platform_data at24c512 = {
244 .byte_len = SZ_512K / 8,
245 .page_size = 128,
246 .flags = AT24_FLAG_ADDR16,
247};
248
249static struct i2c_board_info __initdata ek_i2c_devices[] = {
250 {
251 I2C_BOARD_INFO("24c512", 0x50),
252 .platform_data = &at24c512,
253 },
254 /* more devices can be added using expansion connectors */
255};
256
257
258/*
259 * GPIO Buttons
260 */
261#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
262static struct gpio_keys_button ek_buttons[] = {
263 {
264 .gpio = AT91_PIN_PA30,
265 .code = BTN_3,
266 .desc = "Button 3",
267 .active_low = 1,
268 .wakeup = 1,
269 },
270 {
271 .gpio = AT91_PIN_PA31,
272 .code = BTN_4,
273 .desc = "Button 4",
274 .active_low = 1,
275 .wakeup = 1,
276 }
277};
278
279static struct gpio_keys_platform_data ek_button_data = {
280 .buttons = ek_buttons,
281 .nbuttons = ARRAY_SIZE(ek_buttons),
282};
283
284static struct platform_device ek_button_device = {
285 .name = "gpio-keys",
286 .id = -1,
287 .num_resources = 0,
288 .dev = {
289 .platform_data = &ek_button_data,
290 }
291};
292
293static void __init ek_add_device_buttons(void)
294{
295 at91_set_gpio_input(AT91_PIN_PA30, 1); /* btn3 */
296 at91_set_deglitch(AT91_PIN_PA30, 1);
297 at91_set_gpio_input(AT91_PIN_PA31, 1); /* btn4 */
298 at91_set_deglitch(AT91_PIN_PA31, 1);
299
300 platform_device_register(&ek_button_device);
301}
302#else
303static void __init ek_add_device_buttons(void) {}
304#endif
305
306
307static void __init ek_board_init(void)
308{
309 at91_register_devices();
310
311 /* Serial */
312 /* DBGU on ttyS0. (Rx & Tx only) */
313 at91_register_uart(0, 0, 0);
314
315 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
316 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
317 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
318 | ATMEL_UART_RI);
319
320 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
321 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
322 at91_add_device_serial();
323 /* USB Host */
324 at91_add_device_usbh(&ek_usbh_data);
325 /* USB Device */
326 at91_add_device_udc(&ek_udc_data);
327 /* SPI */
328 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
329 /* NAND */
330 ek_add_device_nand();
331 /* Ethernet */
332 at91_add_device_eth(&ek_macb_data);
333 /* MMC */
334 at91_add_device_mci(0, &ek_mci0_data);
335 /* I2C */
336 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
337 /* SSC (to AT73C213) */
338 at73c213_set_clk(&at73c213_data);
339 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
340 /* LEDs */
341 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
342 /* Push Buttons */
343 ek_add_device_buttons();
344}
345
346MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
347 /* Maintainer: Atmel */
348 .init_time = at91_init_time,
349 .map_io = at91_map_io,
350 .handle_irq = at91_aic_handle_irq,
351 .init_early = ek_init_early,
352 .init_irq = at91_init_irq_default,
353 .init_machine = ek_board_init,
354MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
deleted file mode 100644
index e85ada820bfb..000000000000
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ /dev/null
@@ -1,623 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-sam9261ek.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
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/gpio.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/spi/ads7846.h>
30#include <linux/spi/at73c213.h>
31#include <linux/clk.h>
32#include <linux/dm9000.h>
33#include <linux/fb.h>
34#include <linux/gpio_keys.h>
35#include <linux/input.h>
36
37#include <video/atmel_lcdc.h>
38
39#include <asm/setup.h>
40#include <asm/mach-types.h>
41#include <asm/irq.h>
42
43#include <asm/mach/arch.h>
44#include <asm/mach/map.h>
45#include <asm/mach/irq.h>
46
47#include <mach/hardware.h>
48#include <mach/at91sam9_smc.h>
49#include <mach/system_rev.h>
50
51#include "at91_aic.h"
52#include "board.h"
53#include "sam9_smc.h"
54#include "generic.h"
55#include "gpio.h"
56
57
58static void __init ek_init_early(void)
59{
60 /* Initialize processor: 18.432 MHz crystal */
61 at91_initialize(18432000);
62}
63
64/*
65 * DM9000 ethernet device
66 */
67#if defined(CONFIG_DM9000)
68static struct resource dm9000_resource[] = {
69 [0] = {
70 .start = AT91_CHIPSELECT_2,
71 .end = AT91_CHIPSELECT_2 + 3,
72 .flags = IORESOURCE_MEM
73 },
74 [1] = {
75 .start = AT91_CHIPSELECT_2 + 0x44,
76 .end = AT91_CHIPSELECT_2 + 0xFF,
77 .flags = IORESOURCE_MEM
78 },
79 [2] = {
80 .flags = IORESOURCE_IRQ
81 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE,
82 }
83};
84
85static struct dm9000_plat_data dm9000_platdata = {
86 .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
87};
88
89static struct platform_device dm9000_device = {
90 .name = "dm9000",
91 .id = 0,
92 .num_resources = ARRAY_SIZE(dm9000_resource),
93 .resource = dm9000_resource,
94 .dev = {
95 .platform_data = &dm9000_platdata,
96 }
97};
98
99/*
100 * SMC timings for the DM9000.
101 * Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
102 */
103static struct sam9_smc_config __initdata dm9000_smc_config = {
104 .ncs_read_setup = 0,
105 .nrd_setup = 2,
106 .ncs_write_setup = 0,
107 .nwe_setup = 2,
108
109 .ncs_read_pulse = 8,
110 .nrd_pulse = 4,
111 .ncs_write_pulse = 8,
112 .nwe_pulse = 4,
113
114 .read_cycle = 16,
115 .write_cycle = 16,
116
117 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16,
118 .tdf_cycles = 1,
119};
120
121static void __init ek_add_device_dm9000(void)
122{
123 struct resource *r = &dm9000_resource[2];
124
125 /* Configure chip-select 2 (DM9000) */
126 sam9_smc_configure(0, 2, &dm9000_smc_config);
127
128 /* Configure Reset signal as output */
129 at91_set_gpio_output(AT91_PIN_PC10, 0);
130
131 /* Configure Interrupt pin as input, no pull-up */
132 at91_set_gpio_input(AT91_PIN_PC11, 0);
133
134 r->start = r->end = gpio_to_irq(AT91_PIN_PC11);
135 platform_device_register(&dm9000_device);
136}
137#else
138static void __init ek_add_device_dm9000(void) {}
139#endif /* CONFIG_DM9000 */
140
141
142/*
143 * USB Host Port
144 */
145static struct at91_usbh_data __initdata ek_usbh_data = {
146 .ports = 2,
147 .vbus_pin = {-EINVAL, -EINVAL},
148 .overcurrent_pin= {-EINVAL, -EINVAL},
149};
150
151
152/*
153 * USB Device Port
154 */
155static struct at91_udc_data __initdata ek_udc_data = {
156 .vbus_pin = AT91_PIN_PB29,
157 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
158};
159
160
161/*
162 * NAND flash
163 */
164static struct mtd_partition __initdata ek_nand_partition[] = {
165 {
166 .name = "Partition 1",
167 .offset = 0,
168 .size = SZ_256K,
169 },
170 {
171 .name = "Partition 2",
172 .offset = MTDPART_OFS_NXTBLK,
173 .size = MTDPART_SIZ_FULL,
174 },
175};
176
177static struct atmel_nand_data __initdata ek_nand_data = {
178 .ale = 22,
179 .cle = 21,
180 .det_pin = -EINVAL,
181 .rdy_pin = AT91_PIN_PC15,
182 .enable_pin = AT91_PIN_PC14,
183 .ecc_mode = NAND_ECC_SOFT,
184 .on_flash_bbt = 1,
185 .parts = ek_nand_partition,
186 .num_parts = ARRAY_SIZE(ek_nand_partition),
187};
188
189static struct sam9_smc_config __initdata ek_nand_smc_config = {
190 .ncs_read_setup = 0,
191 .nrd_setup = 1,
192 .ncs_write_setup = 0,
193 .nwe_setup = 1,
194
195 .ncs_read_pulse = 3,
196 .nrd_pulse = 3,
197 .ncs_write_pulse = 3,
198 .nwe_pulse = 3,
199
200 .read_cycle = 5,
201 .write_cycle = 5,
202
203 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
204 .tdf_cycles = 2,
205};
206
207static void __init ek_add_device_nand(void)
208{
209 ek_nand_data.bus_width_16 = board_have_nand_16bit();
210 /* setup bus-width (8 or 16) */
211 if (ek_nand_data.bus_width_16)
212 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
213 else
214 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
215
216 /* configure chip-select 3 (NAND) */
217 sam9_smc_configure(0, 3, &ek_nand_smc_config);
218
219 at91_add_device_nand(&ek_nand_data);
220}
221
222/*
223 * SPI related devices
224 */
225#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
226
227/*
228 * ADS7846 Touchscreen
229 */
230#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
231
232static int ads7843_pendown_state(void)
233{
234 return !at91_get_gpio_value(AT91_PIN_PC2); /* Touchscreen PENIRQ */
235}
236
237static struct ads7846_platform_data ads_info = {
238 .model = 7843,
239 .x_min = 150,
240 .x_max = 3830,
241 .y_min = 190,
242 .y_max = 3830,
243 .vref_delay_usecs = 100,
244 .x_plate_ohms = 450,
245 .y_plate_ohms = 250,
246 .pressure_max = 15000,
247 .debounce_max = 1,
248 .debounce_rep = 0,
249 .debounce_tol = (~0),
250 .get_pendown_state = ads7843_pendown_state,
251};
252
253static void __init ek_add_device_ts(void)
254{
255 at91_set_B_periph(AT91_PIN_PC2, 1); /* External IRQ0, with pullup */
256 at91_set_gpio_input(AT91_PIN_PA11, 1); /* Touchscreen BUSY signal */
257}
258#else
259static void __init ek_add_device_ts(void) {}
260#endif
261
262/*
263 * Audio
264 */
265static struct at73c213_board_info at73c213_data = {
266 .ssc_id = 1,
267 .shortname = "AT91SAM9261/9G10-EK external DAC",
268};
269
270#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
271static void __init at73c213_set_clk(struct at73c213_board_info *info)
272{
273 struct clk *pck2;
274 struct clk *plla;
275
276 pck2 = clk_get(NULL, "pck2");
277 plla = clk_get(NULL, "plla");
278
279 /* AT73C213 MCK Clock */
280 at91_set_B_periph(AT91_PIN_PB31, 0); /* PCK2 */
281
282 clk_set_parent(pck2, plla);
283 clk_put(plla);
284
285 info->dac_clk = pck2;
286}
287#else
288static void __init at73c213_set_clk(struct at73c213_board_info *info) {}
289#endif
290
291/*
292 * SPI devices
293 */
294static struct spi_board_info ek_spi_devices[] = {
295 { /* DataFlash chip */
296 .modalias = "mtd_dataflash",
297 .chip_select = 0,
298 .max_speed_hz = 15 * 1000 * 1000,
299 .bus_num = 0,
300 },
301#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
302 {
303 .modalias = "ads7846",
304 .chip_select = 2,
305 .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
306 .bus_num = 0,
307 .platform_data = &ads_info,
308 .irq = NR_IRQS_LEGACY + AT91SAM9261_ID_IRQ0,
309 .controller_data = (void *) AT91_PIN_PA28, /* CS pin */
310 },
311#endif
312#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
313 { /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */
314 .modalias = "mtd_dataflash",
315 .chip_select = 3,
316 .max_speed_hz = 15 * 1000 * 1000,
317 .bus_num = 0,
318 },
319#elif defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
320 { /* AT73C213 DAC */
321 .modalias = "at73c213",
322 .chip_select = 3,
323 .max_speed_hz = 10 * 1000 * 1000,
324 .bus_num = 0,
325 .mode = SPI_MODE_1,
326 .platform_data = &at73c213_data,
327 .controller_data = (void*) AT91_PIN_PA29, /* default for CS3 is PA6, but it must be PA29 */
328 },
329#endif
330};
331
332#else /* CONFIG_SPI_ATMEL_* */
333/* spi0 and mmc/sd share the same PIO pins: cannot be used at the same time */
334
335/*
336 * MCI (SD/MMC)
337 * det_pin, wp_pin and vcc_pin are not connected
338 */
339static struct mci_platform_data __initdata mci0_data = {
340 .slot[0] = {
341 .bus_width = 4,
342 .detect_pin = -EINVAL,
343 .wp_pin = -EINVAL,
344 },
345};
346
347#endif /* CONFIG_SPI_ATMEL_* */
348
349
350/*
351 * LCD Controller
352 */
353#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
354
355#if defined(CONFIG_FB_ATMEL_STN)
356
357/* STN */
358static struct fb_videomode at91_stn_modes[] = {
359 {
360 .name = "SP06Q002 @ 75",
361 .refresh = 75,
362 .xres = 320, .yres = 240,
363 .pixclock = KHZ2PICOS(1440),
364
365 .left_margin = 1, .right_margin = 1,
366 .upper_margin = 0, .lower_margin = 0,
367 .hsync_len = 1, .vsync_len = 1,
368
369 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
370 .vmode = FB_VMODE_NONINTERLACED,
371 },
372};
373
374static struct fb_monspecs at91fb_default_stn_monspecs = {
375 .manufacturer = "HIT",
376 .monitor = "SP06Q002",
377
378 .modedb = at91_stn_modes,
379 .modedb_len = ARRAY_SIZE(at91_stn_modes),
380 .hfmin = 15000,
381 .hfmax = 64000,
382 .vfmin = 50,
383 .vfmax = 150,
384};
385
386#define AT91SAM9261_DEFAULT_STN_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
387 | ATMEL_LCDC_DISTYPE_STNMONO \
388 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE \
389 | ATMEL_LCDC_IFWIDTH_4 \
390 | ATMEL_LCDC_SCANMOD_SINGLE)
391
392static void at91_lcdc_stn_power_control(struct atmel_lcdfb_pdata *pdata, int on)
393{
394 /* backlight */
395 if (on) { /* power up */
396 at91_set_gpio_value(AT91_PIN_PC14, 0);
397 at91_set_gpio_value(AT91_PIN_PC15, 0);
398 } else { /* power down */
399 at91_set_gpio_value(AT91_PIN_PC14, 1);
400 at91_set_gpio_value(AT91_PIN_PC15, 1);
401 }
402}
403
404static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
405 .default_bpp = 1,
406 .default_dmacon = ATMEL_LCDC_DMAEN,
407 .default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2,
408 .default_monspecs = &at91fb_default_stn_monspecs,
409 .atmel_lcdfb_power_control = at91_lcdc_stn_power_control,
410 .guard_time = 1,
411};
412
413#else
414
415/* TFT */
416static struct fb_videomode at91_tft_vga_modes[] = {
417 {
418 .name = "TX09D50VM1CCA @ 60",
419 .refresh = 60,
420 .xres = 240, .yres = 320,
421 .pixclock = KHZ2PICOS(4965),
422
423 .left_margin = 1, .right_margin = 33,
424 .upper_margin = 1, .lower_margin = 0,
425 .hsync_len = 5, .vsync_len = 1,
426
427 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
428 .vmode = FB_VMODE_NONINTERLACED,
429 },
430};
431
432static struct fb_monspecs at91fb_default_tft_monspecs = {
433 .manufacturer = "HIT",
434 .monitor = "TX09D50VM1CCA",
435
436 .modedb = at91_tft_vga_modes,
437 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
438 .hfmin = 15000,
439 .hfmax = 64000,
440 .vfmin = 50,
441 .vfmax = 150,
442};
443
444#define AT91SAM9261_DEFAULT_TFT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
445 | ATMEL_LCDC_DISTYPE_TFT \
446 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
447
448static void at91_lcdc_tft_power_control(struct atmel_lcdfb_pdata *pdata, int on)
449{
450 if (on)
451 at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */
452 else
453 at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */
454}
455
456static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
457 .lcdcon_is_backlight = true,
458 .default_bpp = 16,
459 .default_dmacon = ATMEL_LCDC_DMAEN,
460 .default_lcdcon2 = AT91SAM9261_DEFAULT_TFT_LCDCON2,
461 .default_monspecs = &at91fb_default_tft_monspecs,
462 .atmel_lcdfb_power_control = at91_lcdc_tft_power_control,
463 .guard_time = 1,
464};
465#endif
466
467#else
468static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
469#endif
470
471
472/*
473 * GPIO Buttons
474 */
475#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
476static struct gpio_keys_button ek_buttons[] = {
477 {
478 .gpio = AT91_PIN_PA27,
479 .code = BTN_0,
480 .desc = "Button 0",
481 .active_low = 1,
482 .wakeup = 1,
483 },
484 {
485 .gpio = AT91_PIN_PA26,
486 .code = BTN_1,
487 .desc = "Button 1",
488 .active_low = 1,
489 .wakeup = 1,
490 },
491 {
492 .gpio = AT91_PIN_PA25,
493 .code = BTN_2,
494 .desc = "Button 2",
495 .active_low = 1,
496 .wakeup = 1,
497 },
498 {
499 .gpio = AT91_PIN_PA24,
500 .code = BTN_3,
501 .desc = "Button 3",
502 .active_low = 1,
503 .wakeup = 1,
504 }
505};
506
507static struct gpio_keys_platform_data ek_button_data = {
508 .buttons = ek_buttons,
509 .nbuttons = ARRAY_SIZE(ek_buttons),
510};
511
512static struct platform_device ek_button_device = {
513 .name = "gpio-keys",
514 .id = -1,
515 .num_resources = 0,
516 .dev = {
517 .platform_data = &ek_button_data,
518 }
519};
520
521static void __init ek_add_device_buttons(void)
522{
523 at91_set_gpio_input(AT91_PIN_PA27, 1); /* btn0 */
524 at91_set_deglitch(AT91_PIN_PA27, 1);
525 at91_set_gpio_input(AT91_PIN_PA26, 1); /* btn1 */
526 at91_set_deglitch(AT91_PIN_PA26, 1);
527 at91_set_gpio_input(AT91_PIN_PA25, 1); /* btn2 */
528 at91_set_deglitch(AT91_PIN_PA25, 1);
529 at91_set_gpio_input(AT91_PIN_PA24, 1); /* btn3 */
530 at91_set_deglitch(AT91_PIN_PA24, 1);
531
532 platform_device_register(&ek_button_device);
533}
534#else
535static void __init ek_add_device_buttons(void) {}
536#endif
537
538/*
539 * LEDs
540 */
541static struct gpio_led ek_leds[] = {
542 { /* "bottom" led, green, userled1 to be defined */
543 .name = "ds7",
544 .gpio = AT91_PIN_PA14,
545 .active_low = 1,
546 .default_trigger = "none",
547 },
548 { /* "top" led, green, userled2 to be defined */
549 .name = "ds8",
550 .gpio = AT91_PIN_PA13,
551 .active_low = 1,
552 .default_trigger = "none",
553 },
554 { /* "power" led, yellow */
555 .name = "ds1",
556 .gpio = AT91_PIN_PA23,
557 .default_trigger = "heartbeat",
558 }
559};
560
561static void __init ek_board_init(void)
562{
563 at91_register_devices();
564
565 /* Serial */
566 /* DBGU on ttyS0. (Rx & Tx only) */
567 at91_register_uart(0, 0, 0);
568 at91_add_device_serial();
569
570 if (cpu_is_at91sam9g10())
571 ek_lcdc_data.lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB;
572
573 /* USB Host */
574 at91_add_device_usbh(&ek_usbh_data);
575 /* USB Device */
576 at91_add_device_udc(&ek_udc_data);
577 /* I2C */
578 at91_add_device_i2c(NULL, 0);
579 /* NAND */
580 ek_add_device_nand();
581 /* DM9000 ethernet */
582 ek_add_device_dm9000();
583
584 /* spi0 and mmc/sd share the same PIO pins */
585#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
586 /* SPI */
587 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
588 /* Touchscreen */
589 ek_add_device_ts();
590 /* SSC (to AT73C213) */
591 at73c213_set_clk(&at73c213_data);
592 at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX);
593#else
594 /* MMC */
595 at91_add_device_mci(0, &mci0_data);
596#endif
597 /* LCD Controller */
598 at91_add_device_lcdc(&ek_lcdc_data);
599 /* Push Buttons */
600 ek_add_device_buttons();
601 /* LEDs */
602 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
603}
604
605MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
606 /* Maintainer: Atmel */
607 .init_time = at91_init_time,
608 .map_io = at91_map_io,
609 .handle_irq = at91_aic_handle_irq,
610 .init_early = ek_init_early,
611 .init_irq = at91_init_irq_default,
612 .init_machine = ek_board_init,
613MACHINE_END
614
615MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK")
616 /* Maintainer: Atmel */
617 .init_time = at91_init_time,
618 .map_io = at91_map_io,
619 .handle_irq = at91_aic_handle_irq,
620 .init_early = ek_init_early,
621 .init_irq = at91_init_irq_default,
622 .init_machine = ek_board_init,
623MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
deleted file mode 100644
index d76680f2a209..000000000000
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ /dev/null
@@ -1,493 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-sam9263ek.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation.
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/gpio.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/spi/ads7846.h>
30#include <linux/platform_data/at24.h>
31#include <linux/fb.h>
32#include <linux/gpio_keys.h>
33#include <linux/input.h>
34#include <linux/leds.h>
35#include <linux/pwm.h>
36#include <linux/leds_pwm.h>
37
38#include <video/atmel_lcdc.h>
39
40#include <asm/setup.h>
41#include <asm/mach-types.h>
42#include <asm/irq.h>
43
44#include <asm/mach/arch.h>
45#include <asm/mach/map.h>
46#include <asm/mach/irq.h>
47
48#include <mach/hardware.h>
49#include <mach/at91sam9_smc.h>
50#include <mach/system_rev.h>
51
52#include "at91_aic.h"
53#include "board.h"
54#include "sam9_smc.h"
55#include "generic.h"
56#include "gpio.h"
57
58
59static void __init ek_init_early(void)
60{
61 /* Initialize processor: 16.367 MHz crystal */
62 at91_initialize(16367660);
63}
64
65/*
66 * USB Host port
67 */
68static struct at91_usbh_data __initdata ek_usbh_data = {
69 .ports = 2,
70 .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 },
71 .vbus_pin_active_low = {1, 1},
72 .overcurrent_pin= {-EINVAL, -EINVAL},
73};
74
75/*
76 * USB Device port
77 */
78static struct at91_udc_data __initdata ek_udc_data = {
79 .vbus_pin = AT91_PIN_PA25,
80 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
81};
82
83
84/*
85 * ADS7846 Touchscreen
86 */
87#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
88static int ads7843_pendown_state(void)
89{
90 return !at91_get_gpio_value(AT91_PIN_PA15); /* Touchscreen PENIRQ */
91}
92
93static struct ads7846_platform_data ads_info = {
94 .model = 7843,
95 .x_min = 150,
96 .x_max = 3830,
97 .y_min = 190,
98 .y_max = 3830,
99 .vref_delay_usecs = 100,
100 .x_plate_ohms = 450,
101 .y_plate_ohms = 250,
102 .pressure_max = 15000,
103 .debounce_max = 1,
104 .debounce_rep = 0,
105 .debounce_tol = (~0),
106 .get_pendown_state = ads7843_pendown_state,
107};
108
109static void __init ek_add_device_ts(void)
110{
111 at91_set_B_periph(AT91_PIN_PA15, 1); /* External IRQ1, with pullup */
112 at91_set_gpio_input(AT91_PIN_PA31, 1); /* Touchscreen BUSY signal */
113}
114#else
115static void __init ek_add_device_ts(void) {}
116#endif
117
118/*
119 * SPI devices.
120 */
121static struct spi_board_info ek_spi_devices[] = {
122#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
123 { /* DataFlash card */
124 .modalias = "mtd_dataflash",
125 .chip_select = 0,
126 .max_speed_hz = 15 * 1000 * 1000,
127 .bus_num = 0,
128 },
129#endif
130#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
131 {
132 .modalias = "ads7846",
133 .chip_select = 3,
134 .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
135 .bus_num = 0,
136 .platform_data = &ads_info,
137 .irq = NR_IRQS_LEGACY + AT91SAM9263_ID_IRQ1,
138 },
139#endif
140};
141
142
143/*
144 * MCI (SD/MMC)
145 */
146static struct mci_platform_data __initdata mci1_data = {
147 .slot[0] = {
148 .bus_width = 4,
149 .detect_pin = AT91_PIN_PE18,
150 .wp_pin = AT91_PIN_PE19,
151 },
152};
153
154
155/*
156 * MACB Ethernet device
157 */
158static struct macb_platform_data __initdata ek_macb_data = {
159 .phy_irq_pin = AT91_PIN_PE31,
160 .is_rmii = 1,
161};
162
163
164/*
165 * NAND flash
166 */
167static struct mtd_partition __initdata ek_nand_partition[] = {
168 {
169 .name = "Partition 1",
170 .offset = 0,
171 .size = SZ_64M,
172 },
173 {
174 .name = "Partition 2",
175 .offset = MTDPART_OFS_NXTBLK,
176 .size = MTDPART_SIZ_FULL,
177 },
178};
179
180static struct atmel_nand_data __initdata ek_nand_data = {
181 .ale = 21,
182 .cle = 22,
183 .det_pin = -EINVAL,
184 .rdy_pin = AT91_PIN_PA22,
185 .enable_pin = AT91_PIN_PD15,
186 .ecc_mode = NAND_ECC_SOFT,
187 .on_flash_bbt = 1,
188 .parts = ek_nand_partition,
189 .num_parts = ARRAY_SIZE(ek_nand_partition),
190};
191
192static struct sam9_smc_config __initdata ek_nand_smc_config = {
193 .ncs_read_setup = 0,
194 .nrd_setup = 1,
195 .ncs_write_setup = 0,
196 .nwe_setup = 1,
197
198 .ncs_read_pulse = 3,
199 .nrd_pulse = 3,
200 .ncs_write_pulse = 3,
201 .nwe_pulse = 3,
202
203 .read_cycle = 5,
204 .write_cycle = 5,
205
206 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
207 .tdf_cycles = 2,
208};
209
210static void __init ek_add_device_nand(void)
211{
212 ek_nand_data.bus_width_16 = board_have_nand_16bit();
213 /* setup bus-width (8 or 16) */
214 if (ek_nand_data.bus_width_16)
215 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
216 else
217 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
218
219 /* configure chip-select 3 (NAND) */
220 sam9_smc_configure(0, 3, &ek_nand_smc_config);
221
222 at91_add_device_nand(&ek_nand_data);
223}
224
225
226/*
227 * I2C devices
228 */
229static struct at24_platform_data at24c512 = {
230 .byte_len = SZ_512K / 8,
231 .page_size = 128,
232 .flags = AT24_FLAG_ADDR16,
233};
234
235
236static struct i2c_board_info __initdata ek_i2c_devices[] = {
237 {
238 I2C_BOARD_INFO("24c512", 0x50),
239 .platform_data = &at24c512,
240 },
241 /* more devices can be added using expansion connectors */
242};
243
244/*
245 * LCD Controller
246 */
247#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
248static struct fb_videomode at91_tft_vga_modes[] = {
249 {
250 .name = "TX09D50VM1CCA @ 60",
251 .refresh = 60,
252 .xres = 240, .yres = 320,
253 .pixclock = KHZ2PICOS(4965),
254
255 .left_margin = 1, .right_margin = 33,
256 .upper_margin = 1, .lower_margin = 0,
257 .hsync_len = 5, .vsync_len = 1,
258
259 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
260 .vmode = FB_VMODE_NONINTERLACED,
261 },
262};
263
264static struct fb_monspecs at91fb_default_monspecs = {
265 .manufacturer = "HIT",
266 .monitor = "TX09D70VM1CCA",
267
268 .modedb = at91_tft_vga_modes,
269 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
270 .hfmin = 15000,
271 .hfmax = 64000,
272 .vfmin = 50,
273 .vfmax = 150,
274};
275
276#define AT91SAM9263_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
277 | ATMEL_LCDC_DISTYPE_TFT \
278 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
279
280static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
281{
282 at91_set_gpio_value(AT91_PIN_PA30, on);
283}
284
285/* Driver datas */
286static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
287 .lcdcon_is_backlight = true,
288 .default_bpp = 16,
289 .default_dmacon = ATMEL_LCDC_DMAEN,
290 .default_lcdcon2 = AT91SAM9263_DEFAULT_LCDCON2,
291 .default_monspecs = &at91fb_default_monspecs,
292 .atmel_lcdfb_power_control = at91_lcdc_power_control,
293 .guard_time = 1,
294};
295
296#else
297static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
298#endif
299
300
301/*
302 * GPIO Buttons
303 */
304#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
305static struct gpio_keys_button ek_buttons[] = {
306 { /* BP1, "leftclic" */
307 .code = BTN_LEFT,
308 .gpio = AT91_PIN_PC5,
309 .active_low = 1,
310 .desc = "left_click",
311 .wakeup = 1,
312 },
313 { /* BP2, "rightclic" */
314 .code = BTN_RIGHT,
315 .gpio = AT91_PIN_PC4,
316 .active_low = 1,
317 .desc = "right_click",
318 .wakeup = 1,
319 }
320};
321
322static struct gpio_keys_platform_data ek_button_data = {
323 .buttons = ek_buttons,
324 .nbuttons = ARRAY_SIZE(ek_buttons),
325};
326
327static struct platform_device ek_button_device = {
328 .name = "gpio-keys",
329 .id = -1,
330 .num_resources = 0,
331 .dev = {
332 .platform_data = &ek_button_data,
333 }
334};
335
336static void __init ek_add_device_buttons(void)
337{
338 at91_set_GPIO_periph(AT91_PIN_PC5, 1); /* left button */
339 at91_set_deglitch(AT91_PIN_PC5, 1);
340 at91_set_GPIO_periph(AT91_PIN_PC4, 1); /* right button */
341 at91_set_deglitch(AT91_PIN_PC4, 1);
342
343 platform_device_register(&ek_button_device);
344}
345#else
346static void __init ek_add_device_buttons(void) {}
347#endif
348
349
350/*
351 * AC97
352 * reset_pin is not connected: NRST
353 */
354static struct ac97c_platform_data ek_ac97_data = {
355 .reset_pin = -EINVAL,
356};
357
358
359/*
360 * LEDs ... these could all be PWM-driven, for variable brightness
361 */
362static struct gpio_led ek_leds[] = {
363 { /* "right" led, green, userled2 (could be driven by pwm2) */
364 .name = "ds2",
365 .gpio = AT91_PIN_PC29,
366 .active_low = 1,
367 .default_trigger = "nand-disk",
368 },
369 { /* "power" led, yellow (could be driven by pwm0) */
370 .name = "ds3",
371 .gpio = AT91_PIN_PB7,
372 .default_trigger = "heartbeat",
373 },
374#if !IS_ENABLED(CONFIG_LEDS_PWM)
375 {
376 .name = "ds1",
377 .gpio = AT91_PIN_PB8,
378 .active_low = 1,
379 .default_trigger = "none",
380 }
381#endif
382};
383
384/*
385 * PWM Leds
386 */
387static struct pwm_lookup pwm_lookup[] = {
388 PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "ds1",
389 5000, PWM_POLARITY_INVERSED),
390};
391
392#if IS_ENABLED(CONFIG_LEDS_PWM)
393static struct led_pwm pwm_leds[] = {
394 {
395 .name = "ds1",
396 .max_brightness = 255,
397 },
398};
399
400static struct led_pwm_platform_data pwm_data = {
401 .num_leds = ARRAY_SIZE(pwm_leds),
402 .leds = pwm_leds,
403};
404
405static struct platform_device leds_pwm = {
406 .name = "leds_pwm",
407 .id = -1,
408 .dev = {
409 .platform_data = &pwm_data,
410 },
411};
412#endif
413
414
415/*
416 * CAN
417 */
418static void sam9263ek_transceiver_switch(int on)
419{
420 if (on) {
421 at91_set_gpio_output(AT91_PIN_PA18, 1); /* CANRXEN */
422 at91_set_gpio_output(AT91_PIN_PA19, 0); /* CANRS */
423 } else {
424 at91_set_gpio_output(AT91_PIN_PA18, 0); /* CANRXEN */
425 at91_set_gpio_output(AT91_PIN_PA19, 1); /* CANRS */
426 }
427}
428
429static struct at91_can_data ek_can_data = {
430 .transceiver_switch = sam9263ek_transceiver_switch,
431};
432
433static struct platform_device *devices[] __initdata = {
434#if IS_ENABLED(CONFIG_LEDS_PWM)
435 &leds_pwm,
436#endif
437};
438
439static void __init ek_board_init(void)
440{
441 at91_register_devices();
442
443 /* Serial */
444 /* DBGU on ttyS0. (Rx & Tx only) */
445 at91_register_uart(0, 0, 0);
446
447 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
448 at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
449 at91_add_device_serial();
450 /* USB Host */
451 at91_add_device_usbh(&ek_usbh_data);
452 /* USB Device */
453 at91_add_device_udc(&ek_udc_data);
454 /* SPI */
455 at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */
456 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
457 /* Touchscreen */
458 ek_add_device_ts();
459 /* MMC */
460 at91_add_device_mci(1, &mci1_data);
461 /* Ethernet */
462 at91_add_device_eth(&ek_macb_data);
463 /* NAND */
464 ek_add_device_nand();
465 /* I2C */
466 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
467 /* LCD Controller */
468 at91_add_device_lcdc(&ek_lcdc_data);
469 /* Push Buttons */
470 ek_add_device_buttons();
471 /* AC97 */
472 at91_add_device_ac97(&ek_ac97_data);
473 /* LEDs */
474 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
475 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
476#if IS_ENABLED(CONFIG_LEDS_PWM)
477 at91_add_device_pwm(1 << AT91_PWM1);
478#endif
479 /* CAN */
480 at91_add_device_can(&ek_can_data);
481 /* Other platform devices */
482 platform_add_devices(devices, ARRAY_SIZE(devices));
483}
484
485MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
486 /* Maintainer: Atmel */
487 .init_time = at91_init_time,
488 .map_io = at91_map_io,
489 .handle_irq = at91_aic_handle_irq,
490 .init_early = ek_init_early,
491 .init_irq = at91_init_irq_default,
492 .init_machine = ek_board_init,
493MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
deleted file mode 100644
index 49f075213451..000000000000
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ /dev/null
@@ -1,429 +0,0 @@
1/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2008 Atmel
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/types.h>
21#include <linux/gpio.h>
22#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/module.h>
25#include <linux/platform_device.h>
26#include <linux/spi/spi.h>
27#include <linux/spi/at73c213.h>
28#include <linux/gpio_keys.h>
29#include <linux/input.h>
30#include <linux/clk.h>
31#include <linux/regulator/machine.h>
32#include <linux/regulator/fixed.h>
33#include <linux/regulator/consumer.h>
34
35#include <linux/platform_data/at91_adc.h>
36
37#include <mach/hardware.h>
38#include <asm/setup.h>
39#include <asm/mach-types.h>
40#include <asm/irq.h>
41
42#include <asm/mach/arch.h>
43#include <asm/mach/map.h>
44#include <asm/mach/irq.h>
45
46#include <mach/at91sam9_smc.h>
47#include <mach/system_rev.h>
48
49#include "at91_aic.h"
50#include "board.h"
51#include "sam9_smc.h"
52#include "generic.h"
53#include "gpio.h"
54
55/*
56 * board revision encoding
57 * bit 0:
58 * 0 => 1 sd/mmc slot
59 * 1 => 2 sd/mmc slots connectors (board from revision C)
60 */
61#define HAVE_2MMC (1 << 0)
62static int inline ek_have_2mmc(void)
63{
64 return machine_is_at91sam9g20ek_2mmc() || (system_rev & HAVE_2MMC);
65}
66
67
68static void __init ek_init_early(void)
69{
70 /* Initialize processor: 18.432 MHz crystal */
71 at91_initialize(18432000);
72}
73
74/*
75 * USB Host port
76 */
77static struct at91_usbh_data __initdata ek_usbh_data = {
78 .ports = 2,
79 .vbus_pin = {-EINVAL, -EINVAL},
80 .overcurrent_pin= {-EINVAL, -EINVAL},
81};
82
83/*
84 * USB Device port
85 */
86static struct at91_udc_data __initdata ek_udc_data = {
87 .vbus_pin = AT91_PIN_PC5,
88 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
89};
90
91
92/*
93 * SPI devices.
94 */
95static struct spi_board_info ek_spi_devices[] = {
96#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
97 { /* DataFlash chip */
98 .modalias = "mtd_dataflash",
99 .chip_select = 1,
100 .max_speed_hz = 15 * 1000 * 1000,
101 .bus_num = 0,
102 },
103#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
104 { /* DataFlash card */
105 .modalias = "mtd_dataflash",
106 .chip_select = 0,
107 .max_speed_hz = 15 * 1000 * 1000,
108 .bus_num = 0,
109 },
110#endif
111#endif
112};
113
114
115/*
116 * MACB Ethernet device
117 */
118static struct macb_platform_data __initdata ek_macb_data = {
119 .phy_irq_pin = AT91_PIN_PA7,
120 .is_rmii = 1,
121};
122
123static void __init ek_add_device_macb(void)
124{
125 if (ek_have_2mmc())
126 ek_macb_data.phy_irq_pin = AT91_PIN_PB0;
127
128 at91_add_device_eth(&ek_macb_data);
129}
130
131/*
132 * NAND flash
133 */
134static struct mtd_partition __initdata ek_nand_partition[] = {
135 {
136 .name = "Bootstrap",
137 .offset = 0,
138 .size = 4 * SZ_1M,
139 },
140 {
141 .name = "Partition 1",
142 .offset = MTDPART_OFS_NXTBLK,
143 .size = 60 * SZ_1M,
144 },
145 {
146 .name = "Partition 2",
147 .offset = MTDPART_OFS_NXTBLK,
148 .size = MTDPART_SIZ_FULL,
149 },
150};
151
152/* det_pin is not connected */
153static struct atmel_nand_data __initdata ek_nand_data = {
154 .ale = 21,
155 .cle = 22,
156 .rdy_pin = AT91_PIN_PC13,
157 .enable_pin = AT91_PIN_PC14,
158 .det_pin = -EINVAL,
159 .ecc_mode = NAND_ECC_SOFT,
160 .on_flash_bbt = 1,
161 .parts = ek_nand_partition,
162 .num_parts = ARRAY_SIZE(ek_nand_partition),
163};
164
165static struct sam9_smc_config __initdata ek_nand_smc_config = {
166 .ncs_read_setup = 0,
167 .nrd_setup = 2,
168 .ncs_write_setup = 0,
169 .nwe_setup = 2,
170
171 .ncs_read_pulse = 4,
172 .nrd_pulse = 4,
173 .ncs_write_pulse = 4,
174 .nwe_pulse = 4,
175
176 .read_cycle = 7,
177 .write_cycle = 7,
178
179 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
180 .tdf_cycles = 3,
181};
182
183static void __init ek_add_device_nand(void)
184{
185 ek_nand_data.bus_width_16 = board_have_nand_16bit();
186 /* setup bus-width (8 or 16) */
187 if (ek_nand_data.bus_width_16)
188 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
189 else
190 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
191
192 /* configure chip-select 3 (NAND) */
193 sam9_smc_configure(0, 3, &ek_nand_smc_config);
194
195 at91_add_device_nand(&ek_nand_data);
196}
197
198
199/*
200 * MCI (SD/MMC)
201 * wp_pin and vcc_pin are not connected
202 */
203static struct mci_platform_data __initdata ek_mmc_data = {
204 .slot[1] = {
205 .bus_width = 4,
206 .detect_pin = AT91_PIN_PC9,
207 .wp_pin = -EINVAL,
208 },
209
210};
211
212static void __init ek_add_device_mmc(void)
213{
214 if (ek_have_2mmc()) {
215 ek_mmc_data.slot[0].bus_width = 4;
216 ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2;
217 ek_mmc_data.slot[0].wp_pin = -1;
218 }
219 at91_add_device_mci(0, &ek_mmc_data);
220}
221
222/*
223 * LEDs
224 */
225static struct gpio_led ek_leds[] = {
226 { /* "bottom" led, green, userled1 to be defined */
227 .name = "ds5",
228 .gpio = AT91_PIN_PA6,
229 .active_low = 1,
230 .default_trigger = "none",
231 },
232 { /* "power" led, yellow */
233 .name = "ds1",
234 .gpio = AT91_PIN_PA9,
235 .default_trigger = "heartbeat",
236 }
237};
238
239static void __init ek_add_device_gpio_leds(void)
240{
241 if (ek_have_2mmc()) {
242 ek_leds[0].gpio = AT91_PIN_PB8;
243 ek_leds[1].gpio = AT91_PIN_PB9;
244 }
245
246 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
247}
248
249/*
250 * GPIO Buttons
251 */
252#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
253static struct gpio_keys_button ek_buttons[] = {
254 {
255 .gpio = AT91_PIN_PA30,
256 .code = BTN_3,
257 .desc = "Button 3",
258 .active_low = 1,
259 .wakeup = 1,
260 },
261 {
262 .gpio = AT91_PIN_PA31,
263 .code = BTN_4,
264 .desc = "Button 4",
265 .active_low = 1,
266 .wakeup = 1,
267 }
268};
269
270static struct gpio_keys_platform_data ek_button_data = {
271 .buttons = ek_buttons,
272 .nbuttons = ARRAY_SIZE(ek_buttons),
273};
274
275static struct platform_device ek_button_device = {
276 .name = "gpio-keys",
277 .id = -1,
278 .num_resources = 0,
279 .dev = {
280 .platform_data = &ek_button_data,
281 }
282};
283
284static void __init ek_add_device_buttons(void)
285{
286 at91_set_gpio_input(AT91_PIN_PA30, 1); /* btn3 */
287 at91_set_deglitch(AT91_PIN_PA30, 1);
288 at91_set_gpio_input(AT91_PIN_PA31, 1); /* btn4 */
289 at91_set_deglitch(AT91_PIN_PA31, 1);
290
291 platform_device_register(&ek_button_device);
292}
293#else
294static void __init ek_add_device_buttons(void) {}
295#endif
296
297/*
298 * ADCs
299 */
300
301static struct at91_adc_data ek_adc_data = {
302 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3),
303 .use_external_triggers = true,
304 .vref = 3300,
305};
306
307#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
308static struct regulator_consumer_supply ek_audio_consumer_supplies[] = {
309 REGULATOR_SUPPLY("AVDD", "0-001b"),
310 REGULATOR_SUPPLY("HPVDD", "0-001b"),
311 REGULATOR_SUPPLY("DBVDD", "0-001b"),
312 REGULATOR_SUPPLY("DCVDD", "0-001b"),
313};
314
315static struct regulator_init_data ek_avdd_reg_init_data = {
316 .constraints = {
317 .name = "3V3",
318 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
319 },
320 .consumer_supplies = ek_audio_consumer_supplies,
321 .num_consumer_supplies = ARRAY_SIZE(ek_audio_consumer_supplies),
322};
323
324static struct fixed_voltage_config ek_vdd_pdata = {
325 .supply_name = "board-3V3",
326 .microvolts = 3300000,
327 .gpio = -EINVAL,
328 .enabled_at_boot = 0,
329 .init_data = &ek_avdd_reg_init_data,
330};
331static struct platform_device ek_voltage_regulator = {
332 .name = "reg-fixed-voltage",
333 .id = -1,
334 .num_resources = 0,
335 .dev = {
336 .platform_data = &ek_vdd_pdata,
337 },
338};
339static void __init ek_add_regulators(void)
340{
341 platform_device_register(&ek_voltage_regulator);
342}
343#else
344static void __init ek_add_regulators(void) {}
345#endif
346
347
348static struct i2c_board_info __initdata ek_i2c_devices[] = {
349 {
350 I2C_BOARD_INFO("24c512", 0x50)
351 },
352 {
353 I2C_BOARD_INFO("wm8731", 0x1b)
354 },
355};
356
357static struct platform_device sam9g20ek_audio_device = {
358 .name = "at91sam9g20ek-audio",
359 .id = -1,
360};
361
362static void __init ek_add_device_audio(void)
363{
364 platform_device_register(&sam9g20ek_audio_device);
365}
366
367
368static void __init ek_board_init(void)
369{
370 /* Serial */
371 /* DBGU on ttyS0. (Rx & Tx only) */
372 at91_register_uart(0, 0, 0);
373
374 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
375 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
376 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
377 | ATMEL_UART_RI);
378
379 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
380 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
381 at91_add_device_serial();
382 /* USB Host */
383 at91_add_device_usbh(&ek_usbh_data);
384 /* USB Device */
385 at91_add_device_udc(&ek_udc_data);
386 /* SPI */
387 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
388 /* NAND */
389 ek_add_device_nand();
390 /* Ethernet */
391 ek_add_device_macb();
392 /* Regulators */
393 ek_add_regulators();
394 /* MMC */
395 ek_add_device_mmc();
396 /* I2C */
397 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
398 /* LEDs */
399 ek_add_device_gpio_leds();
400 /* Push Buttons */
401 ek_add_device_buttons();
402 /* ADCs */
403 at91_add_device_adc(&ek_adc_data);
404 /* PCK0 provides MCLK to the WM8731 */
405 at91_set_B_periph(AT91_PIN_PC1, 0);
406 /* SSC (for WM8731) */
407 at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
408 ek_add_device_audio();
409}
410
411MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
412 /* Maintainer: Atmel */
413 .init_time = at91_init_time,
414 .map_io = at91_map_io,
415 .handle_irq = at91_aic_handle_irq,
416 .init_early = ek_init_early,
417 .init_irq = at91_init_irq_default,
418 .init_machine = ek_board_init,
419MACHINE_END
420
421MACHINE_START(AT91SAM9G20EK_2MMC, "Atmel AT91SAM9G20-EK 2 MMC Slot Mod")
422 /* Maintainer: Atmel */
423 .init_time = at91_init_time,
424 .map_io = at91_map_io,
425 .handle_irq = at91_aic_handle_irq,
426 .init_early = ek_init_early,
427 .init_irq = at91_init_irq_default,
428 .init_machine = ek_board_init,
429MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
deleted file mode 100644
index a517c7f7af92..000000000000
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ /dev/null
@@ -1,527 +0,0 @@
1/*
2 * Board-specific setup code for the AT91SAM9M10G45 Evaluation Kit family
3 *
4 * Covers: * AT91SAM9G45-EKES board
5 * * AT91SAM9M10G45-EK board
6 *
7 * Copyright (C) 2009 Atmel Corporation.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#include <linux/types.h>
17#include <linux/gpio.h>
18#include <linux/init.h>
19#include <linux/mm.h>
20#include <linux/module.h>
21#include <linux/platform_device.h>
22#include <linux/spi/spi.h>
23#include <linux/fb.h>
24#include <linux/gpio_keys.h>
25#include <linux/input.h>
26#include <linux/leds.h>
27#include <linux/atmel-mci.h>
28#include <linux/delay.h>
29#include <linux/pwm.h>
30#include <linux/leds_pwm.h>
31
32#include <linux/platform_data/at91_adc.h>
33
34#include <mach/hardware.h>
35#include <video/atmel_lcdc.h>
36#include <media/soc_camera.h>
37#include <media/atmel-isi.h>
38
39#include <asm/setup.h>
40#include <asm/mach-types.h>
41#include <asm/irq.h>
42
43#include <asm/mach/arch.h>
44#include <asm/mach/map.h>
45#include <asm/mach/irq.h>
46
47#include <mach/at91sam9_smc.h>
48#include <mach/system_rev.h>
49
50#include "at91_aic.h"
51#include "board.h"
52#include "sam9_smc.h"
53#include "generic.h"
54#include "gpio.h"
55
56
57static void __init ek_init_early(void)
58{
59 /* Initialize processor: 12.000 MHz crystal */
60 at91_initialize(12000000);
61}
62
63/*
64 * USB HS Host port (common to OHCI & EHCI)
65 */
66static struct at91_usbh_data __initdata ek_usbh_hs_data = {
67 .ports = 2,
68 .vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3},
69 .vbus_pin_active_low = {1, 1},
70 .overcurrent_pin= {-EINVAL, -EINVAL},
71};
72
73
74/*
75 * USB HS Device port
76 */
77static struct usba_platform_data __initdata ek_usba_udc_data = {
78 .vbus_pin = AT91_PIN_PB19,
79};
80
81
82/*
83 * SPI devices.
84 */
85static struct spi_board_info ek_spi_devices[] = {
86 { /* DataFlash chip */
87 .modalias = "mtd_dataflash",
88 .chip_select = 0,
89 .max_speed_hz = 15 * 1000 * 1000,
90 .bus_num = 0,
91 },
92};
93
94
95/*
96 * MCI (SD/MMC)
97 */
98static struct mci_platform_data __initdata mci0_data = {
99 .slot[0] = {
100 .bus_width = 4,
101 .detect_pin = AT91_PIN_PD10,
102 .wp_pin = -EINVAL,
103 },
104};
105
106static struct mci_platform_data __initdata mci1_data = {
107 .slot[0] = {
108 .bus_width = 4,
109 .detect_pin = AT91_PIN_PD11,
110 .wp_pin = AT91_PIN_PD29,
111 },
112};
113
114
115/*
116 * MACB Ethernet device
117 */
118static struct macb_platform_data __initdata ek_macb_data = {
119 .phy_irq_pin = AT91_PIN_PD5,
120 .is_rmii = 1,
121};
122
123
124/*
125 * NAND flash
126 */
127static struct mtd_partition __initdata ek_nand_partition[] = {
128 {
129 .name = "Partition 1",
130 .offset = 0,
131 .size = SZ_64M,
132 },
133 {
134 .name = "Partition 2",
135 .offset = MTDPART_OFS_NXTBLK,
136 .size = MTDPART_SIZ_FULL,
137 },
138};
139
140/* det_pin is not connected */
141static struct atmel_nand_data __initdata ek_nand_data = {
142 .ale = 21,
143 .cle = 22,
144 .rdy_pin = AT91_PIN_PC8,
145 .enable_pin = AT91_PIN_PC14,
146 .det_pin = -EINVAL,
147 .ecc_mode = NAND_ECC_SOFT,
148 .on_flash_bbt = 1,
149 .parts = ek_nand_partition,
150 .num_parts = ARRAY_SIZE(ek_nand_partition),
151};
152
153static struct sam9_smc_config __initdata ek_nand_smc_config = {
154 .ncs_read_setup = 0,
155 .nrd_setup = 2,
156 .ncs_write_setup = 0,
157 .nwe_setup = 2,
158
159 .ncs_read_pulse = 4,
160 .nrd_pulse = 4,
161 .ncs_write_pulse = 4,
162 .nwe_pulse = 4,
163
164 .read_cycle = 7,
165 .write_cycle = 7,
166
167 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
168 .tdf_cycles = 3,
169};
170
171static void __init ek_add_device_nand(void)
172{
173 ek_nand_data.bus_width_16 = board_have_nand_16bit();
174 /* setup bus-width (8 or 16) */
175 if (ek_nand_data.bus_width_16)
176 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
177 else
178 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
179
180 /* configure chip-select 3 (NAND) */
181 sam9_smc_configure(0, 3, &ek_nand_smc_config);
182
183 at91_add_device_nand(&ek_nand_data);
184}
185
186
187/*
188 * ISI
189 */
190static struct isi_platform_data __initdata isi_data = {
191 .frate = ISI_CFG1_FRATE_CAPTURE_ALL,
192 /* to use codec and preview path simultaneously */
193 .full_mode = 1,
194 .data_width_flags = ISI_DATAWIDTH_8 | ISI_DATAWIDTH_10,
195 /* ISI_MCK is provided by programmable clock or external clock */
196 .mck_hz = 25000000,
197};
198
199
200/*
201 * soc-camera OV2640
202 */
203#if defined(CONFIG_SOC_CAMERA_OV2640) || \
204 defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
205static unsigned long isi_camera_query_bus_param(struct soc_camera_link *link)
206{
207 /* ISI board for ek using default 8-bits connection */
208 return SOCAM_DATAWIDTH_8;
209}
210
211static int i2c_camera_power(struct device *dev, int on)
212{
213 /* enable or disable the camera */
214 pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE");
215 at91_set_gpio_output(AT91_PIN_PD13, !on);
216
217 if (!on)
218 goto out;
219
220 /* If enabled, give a reset impulse */
221 at91_set_gpio_output(AT91_PIN_PD12, 0);
222 msleep(20);
223 at91_set_gpio_output(AT91_PIN_PD12, 1);
224 msleep(100);
225
226out:
227 return 0;
228}
229
230static struct i2c_board_info i2c_camera = {
231 I2C_BOARD_INFO("ov2640", 0x30),
232};
233
234static struct soc_camera_link iclink_ov2640 = {
235 .bus_id = 0,
236 .board_info = &i2c_camera,
237 .i2c_adapter_id = 0,
238 .power = i2c_camera_power,
239 .query_bus_param = isi_camera_query_bus_param,
240};
241
242static struct platform_device isi_ov2640 = {
243 .name = "soc-camera-pdrv",
244 .id = 0,
245 .dev = {
246 .platform_data = &iclink_ov2640,
247 },
248};
249#endif
250
251
252/*
253 * LCD Controller
254 */
255#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
256static struct fb_videomode at91_tft_vga_modes[] = {
257 {
258 .name = "LG",
259 .refresh = 60,
260 .xres = 480, .yres = 272,
261 .pixclock = KHZ2PICOS(9000),
262
263 .left_margin = 1, .right_margin = 1,
264 .upper_margin = 40, .lower_margin = 1,
265 .hsync_len = 45, .vsync_len = 1,
266
267 .sync = 0,
268 .vmode = FB_VMODE_NONINTERLACED,
269 },
270};
271
272static struct fb_monspecs at91fb_default_monspecs = {
273 .manufacturer = "LG",
274 .monitor = "LB043WQ1",
275
276 .modedb = at91_tft_vga_modes,
277 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
278 .hfmin = 15000,
279 .hfmax = 17640,
280 .vfmin = 57,
281 .vfmax = 67,
282};
283
284#define AT91SAM9G45_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
285 | ATMEL_LCDC_DISTYPE_TFT \
286 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
287
288/* Driver datas */
289static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
290 .lcdcon_is_backlight = true,
291 .default_bpp = 32,
292 .default_dmacon = ATMEL_LCDC_DMAEN,
293 .default_lcdcon2 = AT91SAM9G45_DEFAULT_LCDCON2,
294 .default_monspecs = &at91fb_default_monspecs,
295 .guard_time = 9,
296 .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB,
297};
298
299#else
300static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
301#endif
302
303
304/*
305 * ADCs and touchscreen
306 */
307static struct at91_adc_data ek_adc_data = {
308 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
309 .use_external_triggers = true,
310 .vref = 3300,
311 .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
312};
313
314/*
315 * GPIO Buttons
316 */
317#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
318static struct gpio_keys_button ek_buttons[] = {
319 { /* BP1, "leftclic" */
320 .code = BTN_LEFT,
321 .gpio = AT91_PIN_PB6,
322 .active_low = 1,
323 .desc = "left_click",
324 .wakeup = 1,
325 },
326 { /* BP2, "rightclic" */
327 .code = BTN_RIGHT,
328 .gpio = AT91_PIN_PB7,
329 .active_low = 1,
330 .desc = "right_click",
331 .wakeup = 1,
332 },
333 /* BP3, "joystick" */
334 {
335 .code = KEY_LEFT,
336 .gpio = AT91_PIN_PB14,
337 .active_low = 1,
338 .desc = "Joystick Left",
339 },
340 {
341 .code = KEY_RIGHT,
342 .gpio = AT91_PIN_PB15,
343 .active_low = 1,
344 .desc = "Joystick Right",
345 },
346 {
347 .code = KEY_UP,
348 .gpio = AT91_PIN_PB16,
349 .active_low = 1,
350 .desc = "Joystick Up",
351 },
352 {
353 .code = KEY_DOWN,
354 .gpio = AT91_PIN_PB17,
355 .active_low = 1,
356 .desc = "Joystick Down",
357 },
358 {
359 .code = KEY_ENTER,
360 .gpio = AT91_PIN_PB18,
361 .active_low = 1,
362 .desc = "Joystick Press",
363 },
364};
365
366static struct gpio_keys_platform_data ek_button_data = {
367 .buttons = ek_buttons,
368 .nbuttons = ARRAY_SIZE(ek_buttons),
369};
370
371static struct platform_device ek_button_device = {
372 .name = "gpio-keys",
373 .id = -1,
374 .num_resources = 0,
375 .dev = {
376 .platform_data = &ek_button_data,
377 }
378};
379
380static void __init ek_add_device_buttons(void)
381{
382 int i;
383
384 for (i = 0; i < ARRAY_SIZE(ek_buttons); i++) {
385 at91_set_GPIO_periph(ek_buttons[i].gpio, 1);
386 at91_set_deglitch(ek_buttons[i].gpio, 1);
387 }
388
389 platform_device_register(&ek_button_device);
390}
391#else
392static void __init ek_add_device_buttons(void) {}
393#endif
394
395
396/*
397 * AC97
398 * reset_pin is not connected: NRST
399 */
400static struct ac97c_platform_data ek_ac97_data = {
401 .reset_pin = -EINVAL,
402};
403
404
405/*
406 * LEDs ... these could all be PWM-driven, for variable brightness
407 */
408static struct gpio_led ek_leds[] = {
409 { /* "top" led, red, powerled */
410 .name = "d8",
411 .gpio = AT91_PIN_PD30,
412 .default_trigger = "heartbeat",
413 },
414 { /* "left" led, green, userled2, pwm3 */
415 .name = "d6",
416 .gpio = AT91_PIN_PD0,
417 .active_low = 1,
418 .default_trigger = "nand-disk",
419 },
420#if !IS_ENABLED(CONFIG_LEDS_PWM)
421 { /* "right" led, green, userled1, pwm1 */
422 .name = "d7",
423 .gpio = AT91_PIN_PD31,
424 .active_low = 1,
425 .default_trigger = "mmc0",
426 },
427#endif
428};
429
430
431/*
432 * PWM Leds
433 */
434static struct pwm_lookup pwm_lookup[] = {
435 PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "d7",
436 5000, PWM_POLARITY_INVERSED),
437};
438
439#if IS_ENABLED(CONFIG_LEDS_PWM)
440static struct led_pwm pwm_leds[] = {
441 { /* "right" led, green, userled1, pwm1 */
442 .name = "d7",
443 .max_brightness = 255,
444 },
445};
446
447static struct led_pwm_platform_data pwm_data = {
448 .num_leds = ARRAY_SIZE(pwm_leds),
449 .leds = pwm_leds,
450};
451
452static struct platform_device leds_pwm = {
453 .name = "leds_pwm",
454 .id = -1,
455 .dev = {
456 .platform_data = &pwm_data,
457 },
458};
459#endif
460
461static struct platform_device *devices[] __initdata = {
462#if defined(CONFIG_SOC_CAMERA_OV2640) || \
463 defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
464 &isi_ov2640,
465#endif
466#if IS_ENABLED(CONFIG_LEDS_PWM)
467 &leds_pwm,
468#endif
469};
470
471static void __init ek_board_init(void)
472{
473 at91_register_devices();
474
475 /* Serial */
476 /* DGBU on ttyS0. (Rx & Tx only) */
477 at91_register_uart(0, 0, 0);
478
479 /* USART0 not connected on the -EK board */
480 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
481 at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
482 at91_add_device_serial();
483 /* USB HS Host */
484 at91_add_device_usbh_ohci(&ek_usbh_hs_data);
485 at91_add_device_usbh_ehci(&ek_usbh_hs_data);
486 /* USB HS Device */
487 at91_add_device_usba(&ek_usba_udc_data);
488 /* SPI */
489 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
490 /* MMC */
491 at91_add_device_mci(0, &mci0_data);
492 at91_add_device_mci(1, &mci1_data);
493 /* Ethernet */
494 at91_add_device_eth(&ek_macb_data);
495 /* NAND */
496 ek_add_device_nand();
497 /* I2C */
498 at91_add_device_i2c(0, NULL, 0);
499 /* ISI, using programmable clock as ISI_MCK */
500 at91_add_device_isi(&isi_data, true);
501 /* LCD Controller */
502 at91_add_device_lcdc(&ek_lcdc_data);
503 /* ADC and touchscreen */
504 at91_add_device_adc(&ek_adc_data);
505 /* Push Buttons */
506 ek_add_device_buttons();
507 /* AC97 */
508 at91_add_device_ac97(&ek_ac97_data);
509 /* LEDs */
510 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
511 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
512#if IS_ENABLED(CONFIG_LEDS_PWM)
513 at91_add_device_pwm(1 << AT91_PWM1);
514#endif
515 /* Other platform devices */
516 platform_add_devices(devices, ARRAY_SIZE(devices));
517}
518
519MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK")
520 /* Maintainer: Atmel */
521 .init_time = at91_init_time,
522 .map_io = at91_map_io,
523 .handle_irq = at91_aic_handle_irq,
524 .init_early = ek_init_early,
525 .init_irq = at91_init_irq_default,
526 .init_machine = ek_board_init,
527MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
deleted file mode 100644
index 8bca329b0293..000000000000
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ /dev/null
@@ -1,333 +0,0 @@
1/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2007 Atmel Corporation
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive for
7 * more details.
8 */
9
10#include <linux/types.h>
11#include <linux/gpio.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/fb.h>
18#include <linux/clk.h>
19#include <linux/input.h>
20#include <linux/gpio_keys.h>
21#include <linux/platform_data/at91_adc.h>
22
23#include <video/atmel_lcdc.h>
24
25#include <asm/setup.h>
26#include <asm/mach-types.h>
27#include <asm/irq.h>
28
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/irq.h>
32
33#include <mach/hardware.h>
34#include <mach/at91sam9_smc.h>
35
36
37#include "at91_aic.h"
38#include "board.h"
39#include "sam9_smc.h"
40#include "generic.h"
41#include "gpio.h"
42
43
44static void __init ek_init_early(void)
45{
46 /* Initialize processor: 12.000 MHz crystal */
47 at91_initialize(12000000);
48}
49
50/*
51 * USB HS Device port
52 */
53static struct usba_platform_data __initdata ek_usba_udc_data = {
54 .vbus_pin = AT91_PIN_PA8,
55};
56
57
58/*
59 * MCI (SD/MMC)
60 */
61static struct mci_platform_data __initdata mci0_data = {
62 .slot[0] = {
63 .bus_width = 4,
64 .detect_pin = AT91_PIN_PA15,
65 .wp_pin = -EINVAL,
66 },
67};
68
69
70/*
71 * NAND flash
72 */
73static struct mtd_partition __initdata ek_nand_partition[] = {
74 {
75 .name = "Partition 1",
76 .offset = 0,
77 .size = SZ_256K,
78 },
79 {
80 .name = "Partition 2",
81 .offset = MTDPART_OFS_NXTBLK,
82 .size = MTDPART_SIZ_FULL,
83 },
84};
85
86static struct atmel_nand_data __initdata ek_nand_data = {
87 .ale = 21,
88 .cle = 22,
89 .det_pin = -EINVAL,
90 .rdy_pin = AT91_PIN_PD17,
91 .enable_pin = AT91_PIN_PB6,
92 .ecc_mode = NAND_ECC_SOFT,
93 .on_flash_bbt = 1,
94 .parts = ek_nand_partition,
95 .num_parts = ARRAY_SIZE(ek_nand_partition),
96};
97
98static struct sam9_smc_config __initdata ek_nand_smc_config = {
99 .ncs_read_setup = 0,
100 .nrd_setup = 1,
101 .ncs_write_setup = 0,
102 .nwe_setup = 1,
103
104 .ncs_read_pulse = 3,
105 .nrd_pulse = 3,
106 .ncs_write_pulse = 3,
107 .nwe_pulse = 3,
108
109 .read_cycle = 5,
110 .write_cycle = 5,
111
112 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
113 .tdf_cycles = 2,
114};
115
116static void __init ek_add_device_nand(void)
117{
118 /* configure chip-select 3 (NAND) */
119 sam9_smc_configure(0, 3, &ek_nand_smc_config);
120
121 at91_add_device_nand(&ek_nand_data);
122}
123
124
125/*
126 * SPI devices
127 */
128static struct spi_board_info ek_spi_devices[] = {
129 { /* DataFlash chip */
130 .modalias = "mtd_dataflash",
131 .chip_select = 0,
132 .max_speed_hz = 15 * 1000 * 1000,
133 .bus_num = 0,
134 },
135};
136
137
138/*
139 * LCD Controller
140 */
141#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
142static struct fb_videomode at91_tft_vga_modes[] = {
143 {
144 .name = "TX09D50VM1CCA @ 60",
145 .refresh = 60,
146 .xres = 240, .yres = 320,
147 .pixclock = KHZ2PICOS(4965),
148
149 .left_margin = 1, .right_margin = 33,
150 .upper_margin = 1, .lower_margin = 0,
151 .hsync_len = 5, .vsync_len = 1,
152
153 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
154 .vmode = FB_VMODE_NONINTERLACED,
155 },
156};
157
158static struct fb_monspecs at91fb_default_monspecs = {
159 .manufacturer = "HIT",
160 .monitor = "TX09D50VM1CCA",
161
162 .modedb = at91_tft_vga_modes,
163 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
164 .hfmin = 15000,
165 .hfmax = 64000,
166 .vfmin = 50,
167 .vfmax = 150,
168};
169
170#define AT91SAM9RL_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
171 | ATMEL_LCDC_DISTYPE_TFT \
172 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
173
174static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
175{
176 if (on)
177 at91_set_gpio_value(AT91_PIN_PC1, 0); /* power up */
178 else
179 at91_set_gpio_value(AT91_PIN_PC1, 1); /* power down */
180}
181
182/* Driver datas */
183static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
184 .lcdcon_is_backlight = true,
185 .default_bpp = 16,
186 .default_dmacon = ATMEL_LCDC_DMAEN,
187 .default_lcdcon2 = AT91SAM9RL_DEFAULT_LCDCON2,
188 .default_monspecs = &at91fb_default_monspecs,
189 .atmel_lcdfb_power_control = at91_lcdc_power_control,
190 .guard_time = 1,
191 .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB,
192};
193
194#else
195static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
196#endif
197
198
199/*
200 * AC97
201 * reset_pin is not connected: NRST
202 */
203static struct ac97c_platform_data ek_ac97_data = {
204 .reset_pin = -EINVAL,
205};
206
207
208/*
209 * LEDs
210 */
211static struct gpio_led ek_leds[] = {
212 { /* "bottom" led, green, userled1 to be defined */
213 .name = "ds1",
214 .gpio = AT91_PIN_PD15,
215 .active_low = 1,
216 .default_trigger = "none",
217 },
218 { /* "bottom" led, green, userled2 to be defined */
219 .name = "ds2",
220 .gpio = AT91_PIN_PD16,
221 .active_low = 1,
222 .default_trigger = "none",
223 },
224 { /* "power" led, yellow */
225 .name = "ds3",
226 .gpio = AT91_PIN_PD14,
227 .default_trigger = "heartbeat",
228 }
229};
230
231
232/*
233 * ADC + Touchscreen
234 */
235static struct at91_adc_data ek_adc_data = {
236 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5),
237 .use_external_triggers = true,
238 .vref = 3300,
239 .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
240};
241
242
243/*
244 * GPIO Buttons
245 */
246#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
247static struct gpio_keys_button ek_buttons[] = {
248 {
249 .gpio = AT91_PIN_PB0,
250 .code = BTN_2,
251 .desc = "Right Click",
252 .active_low = 1,
253 .wakeup = 1,
254 },
255 {
256 .gpio = AT91_PIN_PB1,
257 .code = BTN_1,
258 .desc = "Left Click",
259 .active_low = 1,
260 .wakeup = 1,
261 }
262};
263
264static struct gpio_keys_platform_data ek_button_data = {
265 .buttons = ek_buttons,
266 .nbuttons = ARRAY_SIZE(ek_buttons),
267};
268
269static struct platform_device ek_button_device = {
270 .name = "gpio-keys",
271 .id = -1,
272 .num_resources = 0,
273 .dev = {
274 .platform_data = &ek_button_data,
275 }
276};
277
278static void __init ek_add_device_buttons(void)
279{
280 at91_set_gpio_input(AT91_PIN_PB1, 1); /* btn1 */
281 at91_set_deglitch(AT91_PIN_PB1, 1);
282 at91_set_gpio_input(AT91_PIN_PB0, 1); /* btn2 */
283 at91_set_deglitch(AT91_PIN_PB0, 1);
284
285 platform_device_register(&ek_button_device);
286}
287#else
288static void __init ek_add_device_buttons(void) {}
289#endif
290
291
292static void __init ek_board_init(void)
293{
294 at91_register_devices();
295
296 /* Serial */
297 /* DBGU on ttyS0. (Rx & Tx only) */
298 at91_register_uart(0, 0, 0);
299
300 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
301 at91_register_uart(AT91SAM9RL_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
302 at91_add_device_serial();
303 /* USB HS */
304 at91_add_device_usba(&ek_usba_udc_data);
305 /* I2C */
306 at91_add_device_i2c(NULL, 0);
307 /* NAND */
308 ek_add_device_nand();
309 /* SPI */
310 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
311 /* MMC */
312 at91_add_device_mci(0, &mci0_data);
313 /* LCD Controller */
314 at91_add_device_lcdc(&ek_lcdc_data);
315 /* AC97 */
316 at91_add_device_ac97(&ek_ac97_data);
317 /* Touch Screen Controller + ADC */
318 at91_add_device_adc(&ek_adc_data);
319 /* LEDs */
320 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
321 /* Push Buttons */
322 ek_add_device_buttons();
323}
324
325MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK")
326 /* Maintainer: Atmel */
327 .init_time = at91_init_time,
328 .map_io = at91_map_io,
329 .handle_irq = at91_aic_handle_irq,
330 .init_early = ek_init_early,
331 .init_irq = at91_init_irq_default,
332 .init_machine = ek_board_init,
333MACHINE_END
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
deleted file mode 100644
index b4aff840a1a0..000000000000
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ /dev/null
@@ -1,191 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-snapper9260.c
3 *
4 * Copyright (C) 2010 Bluewater System Ltd
5 *
6 * Author: Andre Renaud <andre@bluewatersys.com>
7 * Author: Ryan Mallon
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <linux/init.h>
26#include <linux/gpio.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/platform_data/pca953x.h>
30
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33
34#include <mach/hardware.h>
35#include <mach/at91sam9_smc.h>
36
37#include "at91_aic.h"
38#include "board.h"
39#include "sam9_smc.h"
40#include "generic.h"
41#include "gpio.h"
42
43#define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x))
44
45static void __init snapper9260_init_early(void)
46{
47 at91_initialize(18432000);
48}
49
50static struct at91_usbh_data __initdata snapper9260_usbh_data = {
51 .ports = 2,
52 .vbus_pin = {-EINVAL, -EINVAL},
53 .overcurrent_pin= {-EINVAL, -EINVAL},
54};
55
56static struct at91_udc_data __initdata snapper9260_udc_data = {
57 .vbus_pin = SNAPPER9260_IO_EXP_GPIO(5),
58 .vbus_active_low = 1,
59 .vbus_polled = 1,
60 .pullup_pin = -EINVAL,
61};
62
63static struct macb_platform_data snapper9260_macb_data = {
64 .phy_irq_pin = -EINVAL,
65 .is_rmii = 1,
66};
67
68static struct mtd_partition __initdata snapper9260_nand_partitions[] = {
69 {
70 .name = "Preboot",
71 .offset = 0,
72 .size = SZ_128K,
73 },
74 {
75 .name = "Bootloader",
76 .offset = MTDPART_OFS_APPEND,
77 .size = SZ_256K,
78 },
79 {
80 .name = "Environment",
81 .offset = MTDPART_OFS_APPEND,
82 .size = SZ_128K,
83 },
84 {
85 .name = "Kernel",
86 .offset = MTDPART_OFS_APPEND,
87 .size = SZ_4M,
88 },
89 {
90 .name = "Filesystem",
91 .offset = MTDPART_OFS_APPEND,
92 .size = MTDPART_SIZ_FULL,
93 },
94};
95
96static struct atmel_nand_data __initdata snapper9260_nand_data = {
97 .ale = 21,
98 .cle = 22,
99 .rdy_pin = AT91_PIN_PC13,
100 .parts = snapper9260_nand_partitions,
101 .num_parts = ARRAY_SIZE(snapper9260_nand_partitions),
102 .bus_width_16 = 0,
103 .enable_pin = -EINVAL,
104 .det_pin = -EINVAL,
105 .ecc_mode = NAND_ECC_SOFT,
106};
107
108static struct sam9_smc_config __initdata snapper9260_nand_smc_config = {
109 .ncs_read_setup = 0,
110 .nrd_setup = 0,
111 .ncs_write_setup = 0,
112 .nwe_setup = 0,
113
114 .ncs_read_pulse = 5,
115 .nrd_pulse = 2,
116 .ncs_write_pulse = 5,
117 .nwe_pulse = 2,
118
119 .read_cycle = 7,
120 .write_cycle = 7,
121
122 .mode = (AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
123 AT91_SMC_EXNWMODE_DISABLE),
124 .tdf_cycles = 1,
125};
126
127static struct pca953x_platform_data snapper9260_io_expander_data = {
128 .gpio_base = SNAPPER9260_IO_EXP_GPIO(0),
129};
130
131static struct i2c_board_info __initdata snapper9260_i2c_devices[] = {
132 {
133 /* IO expander */
134 I2C_BOARD_INFO("max7312", 0x28),
135 .platform_data = &snapper9260_io_expander_data,
136 },
137 {
138 /* Audio codec */
139 I2C_BOARD_INFO("tlv320aic23", 0x1a),
140 },
141};
142
143static struct i2c_board_info __initdata snapper9260_i2c_isl1208 = {
144 /* RTC */
145 I2C_BOARD_INFO("isl1208", 0x6f),
146};
147
148static void __init snapper9260_add_device_nand(void)
149{
150 at91_set_A_periph(AT91_PIN_PC14, 0);
151 sam9_smc_configure(0, 3, &snapper9260_nand_smc_config);
152 at91_add_device_nand(&snapper9260_nand_data);
153}
154
155static void __init snapper9260_board_init(void)
156{
157 at91_register_devices();
158
159 at91_add_device_i2c(snapper9260_i2c_devices,
160 ARRAY_SIZE(snapper9260_i2c_devices));
161
162 snapper9260_i2c_isl1208.irq = gpio_to_irq(AT91_PIN_PA31);
163 i2c_register_board_info(0, &snapper9260_i2c_isl1208, 1);
164
165 /* Debug on ttyS0 */
166 at91_register_uart(0, 0, 0);
167
168 at91_register_uart(AT91SAM9260_ID_US0, 1,
169 ATMEL_UART_CTS | ATMEL_UART_RTS);
170 at91_register_uart(AT91SAM9260_ID_US1, 2,
171 ATMEL_UART_CTS | ATMEL_UART_RTS);
172 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
173 at91_add_device_serial();
174 at91_add_device_usbh(&snapper9260_usbh_data);
175 at91_add_device_udc(&snapper9260_udc_data);
176 at91_add_device_eth(&snapper9260_macb_data);
177 at91_add_device_ssc(AT91SAM9260_ID_SSC, (ATMEL_SSC_TF | ATMEL_SSC_TK |
178 ATMEL_SSC_TD | ATMEL_SSC_RD));
179 snapper9260_add_device_nand();
180}
181
182MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module")
183 .init_time = at91_init_time,
184 .map_io = at91_map_io,
185 .handle_irq = at91_aic_handle_irq,
186 .init_early = snapper9260_init_early,
187 .init_irq = at91_init_irq_default,
188 .init_machine = snapper9260_board_init,
189MACHINE_END
190
191
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
deleted file mode 100644
index e825641a1dee..000000000000
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ /dev/null
@@ -1,294 +0,0 @@
1/*
2 * Copyright (C) 2010 Christian Glindkamp <christian.glindkamp@taskit.de>
3 * taskit GmbH
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/mm.h>
21#include <linux/platform_device.h>
22#include <linux/gpio.h>
23#include <linux/w1-gpio.h>
24
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27
28#include <mach/at91sam9_smc.h>
29#include <mach/hardware.h>
30
31#include "at91_aic.h"
32#include "board.h"
33#include "sam9_smc.h"
34#include "generic.h"
35#include "gpio.h"
36
37
38void __init stamp9g20_init_early(void)
39{
40 /* Initialize processor: 18.432 MHz crystal */
41 at91_initialize(18432000);
42}
43
44/*
45 * NAND flash
46 */
47static struct atmel_nand_data __initdata nand_data = {
48 .ale = 21,
49 .cle = 22,
50 .rdy_pin = AT91_PIN_PC13,
51 .enable_pin = AT91_PIN_PC14,
52 .bus_width_16 = 0,
53 .det_pin = -EINVAL,
54 .ecc_mode = NAND_ECC_SOFT,
55};
56
57static struct sam9_smc_config __initdata nand_smc_config = {
58 .ncs_read_setup = 0,
59 .nrd_setup = 2,
60 .ncs_write_setup = 0,
61 .nwe_setup = 2,
62
63 .ncs_read_pulse = 4,
64 .nrd_pulse = 4,
65 .ncs_write_pulse = 4,
66 .nwe_pulse = 4,
67
68 .read_cycle = 7,
69 .write_cycle = 7,
70
71 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
72 .tdf_cycles = 3,
73};
74
75static void __init add_device_nand(void)
76{
77 /* configure chip-select 3 (NAND) */
78 sam9_smc_configure(0, 3, &nand_smc_config);
79
80 at91_add_device_nand(&nand_data);
81}
82
83
84/*
85 * MCI (SD/MMC)
86 * det_pin, wp_pin and vcc_pin are not connected
87 */
88static struct mci_platform_data __initdata mmc_data = {
89 .slot[0] = {
90 .bus_width = 4,
91 .detect_pin = -1,
92 .wp_pin = -1,
93 },
94};
95
96
97/*
98 * USB Host port
99 */
100static struct at91_usbh_data __initdata usbh_data = {
101 .ports = 2,
102 .vbus_pin = {-EINVAL, -EINVAL},
103 .overcurrent_pin= {-EINVAL, -EINVAL},
104};
105
106
107/*
108 * USB Device port
109 */
110static struct at91_udc_data __initdata portuxg20_udc_data = {
111 .vbus_pin = AT91_PIN_PC7,
112 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
113};
114
115static struct at91_udc_data __initdata stamp9g20evb_udc_data = {
116 .vbus_pin = AT91_PIN_PA22,
117 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
118};
119
120
121/*
122 * MACB Ethernet device
123 */
124static struct macb_platform_data __initdata macb_data = {
125 .phy_irq_pin = AT91_PIN_PA28,
126 .is_rmii = 1,
127};
128
129
130/*
131 * LEDs
132 */
133static struct gpio_led portuxg20_leds[] = {
134 {
135 .name = "LED2",
136 .gpio = AT91_PIN_PC5,
137 .default_trigger = "none",
138 }, {
139 .name = "LED3",
140 .gpio = AT91_PIN_PC4,
141 .default_trigger = "none",
142 }, {
143 .name = "LED4",
144 .gpio = AT91_PIN_PC10,
145 .default_trigger = "heartbeat",
146 }
147};
148
149static struct gpio_led stamp9g20evb_leds[] = {
150 {
151 .name = "D8",
152 .gpio = AT91_PIN_PB18,
153 .active_low = 1,
154 .default_trigger = "none",
155 }, {
156 .name = "D9",
157 .gpio = AT91_PIN_PB19,
158 .active_low = 1,
159 .default_trigger = "none",
160 }, {
161 .name = "D10",
162 .gpio = AT91_PIN_PB20,
163 .active_low = 1,
164 .default_trigger = "heartbeat",
165 }
166};
167
168
169/*
170 * SPI devices
171 */
172static struct spi_board_info portuxg20_spi_devices[] = {
173 {
174 .modalias = "spidev",
175 .chip_select = 0,
176 .max_speed_hz = 1 * 1000 * 1000,
177 .bus_num = 0,
178 }, {
179 .modalias = "spidev",
180 .chip_select = 0,
181 .max_speed_hz = 1 * 1000 * 1000,
182 .bus_num = 1,
183 },
184};
185
186
187/*
188 * Dallas 1-Wire
189 */
190static struct w1_gpio_platform_data w1_gpio_pdata = {
191 .pin = AT91_PIN_PA29,
192 .is_open_drain = 1,
193 .ext_pullup_enable_pin = -EINVAL,
194};
195
196static struct platform_device w1_device = {
197 .name = "w1-gpio",
198 .id = -1,
199 .dev.platform_data = &w1_gpio_pdata,
200};
201
202void add_w1(void)
203{
204 at91_set_GPIO_periph(w1_gpio_pdata.pin, 1);
205 at91_set_multi_drive(w1_gpio_pdata.pin, 1);
206 platform_device_register(&w1_device);
207}
208
209
210void __init stamp9g20_board_init(void)
211{
212 /* Serial */
213 /* DGBU on ttyS0. (Rx & Tx only) */
214 at91_register_uart(0, 0, 0);
215 at91_add_device_serial();
216 /* NAND */
217 add_device_nand();
218 /* MMC */
219 at91_add_device_mci(0, &mmc_data);
220 /* W1 */
221 add_w1();
222}
223
224static void __init portuxg20_board_init(void)
225{
226 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
227 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
228 | ATMEL_UART_DTR | ATMEL_UART_DSR
229 | ATMEL_UART_DCD | ATMEL_UART_RI);
230
231 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
232 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
233
234 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
235 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
236
237 /* USART4 on ttyS5. (Rx, Tx only) */
238 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
239
240 /* USART5 on ttyS6. (Rx, Tx only) */
241 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
242 stamp9g20_board_init();
243 /* USB Host */
244 at91_add_device_usbh(&usbh_data);
245 /* USB Device */
246 at91_add_device_udc(&portuxg20_udc_data);
247 /* Ethernet */
248 at91_add_device_eth(&macb_data);
249 /* I2C */
250 at91_add_device_i2c(NULL, 0);
251 /* SPI */
252 at91_add_device_spi(portuxg20_spi_devices, ARRAY_SIZE(portuxg20_spi_devices));
253 /* LEDs */
254 at91_gpio_leds(portuxg20_leds, ARRAY_SIZE(portuxg20_leds));
255}
256
257static void __init stamp9g20evb_board_init(void)
258{
259 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
260 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
261 | ATMEL_UART_DTR | ATMEL_UART_DSR
262 | ATMEL_UART_DCD | ATMEL_UART_RI);
263 stamp9g20_board_init();
264 /* USB Host */
265 at91_add_device_usbh(&usbh_data);
266 /* USB Device */
267 at91_add_device_udc(&stamp9g20evb_udc_data);
268 /* Ethernet */
269 at91_add_device_eth(&macb_data);
270 /* I2C */
271 at91_add_device_i2c(NULL, 0);
272 /* LEDs */
273 at91_gpio_leds(stamp9g20evb_leds, ARRAY_SIZE(stamp9g20evb_leds));
274}
275
276MACHINE_START(PORTUXG20, "taskit PortuxG20")
277 /* Maintainer: taskit GmbH */
278 .init_time = at91_init_time,
279 .map_io = at91_map_io,
280 .handle_irq = at91_aic_handle_irq,
281 .init_early = stamp9g20_init_early,
282 .init_irq = at91_init_irq_default,
283 .init_machine = portuxg20_board_init,
284MACHINE_END
285
286MACHINE_START(STAMP9G20, "taskit Stamp9G20")
287 /* Maintainer: taskit GmbH */
288 .init_time = at91_init_time,
289 .map_io = at91_map_io,
290 .handle_irq = at91_aic_handle_irq,
291 .init_early = stamp9g20_init_early,
292 .init_irq = at91_init_irq_default,
293 .init_machine = stamp9g20evb_board_init,
294MACHINE_END
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
deleted file mode 100644
index 46fdb0c68a68..000000000000
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ /dev/null
@@ -1,597 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-yl-9200.c
3 *
4 * Adapted from various board files in arch/arm/mach-at91
5 *
6 * Modifications for YL-9200 platform:
7 * Copyright (C) 2007 S. Birtles
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/types.h>
25#include <linux/gpio.h>
26#include <linux/init.h>
27#include <linux/mm.h>
28#include <linux/module.h>
29#include <linux/dma-mapping.h>
30#include <linux/platform_device.h>
31#include <linux/spi/spi.h>
32#include <linux/spi/ads7846.h>
33#include <linux/mtd/physmap.h>
34#include <linux/gpio_keys.h>
35#include <linux/input.h>
36
37#include <asm/setup.h>
38#include <asm/mach-types.h>
39#include <asm/irq.h>
40
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44
45#include <mach/hardware.h>
46#include <mach/at91rm9200_mc.h>
47#include <mach/at91_ramc.h>
48#include <mach/cpu.h>
49
50#include "at91_aic.h"
51#include "board.h"
52#include "generic.h"
53#include "gpio.h"
54
55
56static void __init yl9200_init_early(void)
57{
58 /* Set cpu type: PQFP */
59 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
60
61 /* Initialize processor: 18.432 MHz crystal */
62 at91_initialize(18432000);
63}
64
65/*
66 * LEDs
67 */
68static struct gpio_led yl9200_leds[] = {
69 { /* D2 */
70 .name = "led2",
71 .gpio = AT91_PIN_PB17,
72 .active_low = 1,
73 .default_trigger = "timer",
74 },
75 { /* D3 */
76 .name = "led3",
77 .gpio = AT91_PIN_PB16,
78 .active_low = 1,
79 .default_trigger = "heartbeat",
80 },
81 { /* D4 */
82 .name = "led4",
83 .gpio = AT91_PIN_PB15,
84 .active_low = 1,
85 },
86 { /* D5 */
87 .name = "led5",
88 .gpio = AT91_PIN_PB8,
89 .active_low = 1,
90 }
91};
92
93/*
94 * Ethernet
95 */
96static struct macb_platform_data __initdata yl9200_eth_data = {
97 .phy_irq_pin = AT91_PIN_PB28,
98 .is_rmii = 1,
99};
100
101/*
102 * USB Host
103 */
104static struct at91_usbh_data __initdata yl9200_usbh_data = {
105 .ports = 1, /* PQFP version of AT91RM9200 */
106 .vbus_pin = {-EINVAL, -EINVAL},
107 .overcurrent_pin= {-EINVAL, -EINVAL},
108};
109
110/*
111 * USB Device
112 */
113static struct at91_udc_data __initdata yl9200_udc_data = {
114 .pullup_pin = AT91_PIN_PC4,
115 .vbus_pin = AT91_PIN_PC5,
116 .pullup_active_low = 1, /* Active Low due to PNP transistor (pg 7) */
117
118};
119
120/*
121 * MMC
122 */
123static struct mci_platform_data __initdata yl9200_mci0_data = {
124 .slot[0] = {
125 .bus_width = 4,
126 .detect_pin = AT91_PIN_PB9,
127 .wp_pin = -EINVAL,
128 },
129};
130
131/*
132 * NAND Flash
133 */
134static struct mtd_partition __initdata yl9200_nand_partition[] = {
135 {
136 .name = "AT91 NAND partition 1, boot",
137 .offset = 0,
138 .size = SZ_256K
139 },
140 {
141 .name = "AT91 NAND partition 2, kernel",
142 .offset = MTDPART_OFS_NXTBLK,
143 .size = (2 * SZ_1M) - SZ_256K
144 },
145 {
146 .name = "AT91 NAND partition 3, filesystem",
147 .offset = MTDPART_OFS_NXTBLK,
148 .size = 14 * SZ_1M
149 },
150 {
151 .name = "AT91 NAND partition 4, storage",
152 .offset = MTDPART_OFS_NXTBLK,
153 .size = SZ_16M
154 },
155 {
156 .name = "AT91 NAND partition 5, ext-fs",
157 .offset = MTDPART_OFS_NXTBLK,
158 .size = SZ_32M
159 }
160};
161
162static struct atmel_nand_data __initdata yl9200_nand_data = {
163 .ale = 6,
164 .cle = 7,
165 .det_pin = -EINVAL,
166 .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */
167 .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */
168 .ecc_mode = NAND_ECC_SOFT,
169 .parts = yl9200_nand_partition,
170 .num_parts = ARRAY_SIZE(yl9200_nand_partition),
171};
172
173/*
174 * NOR Flash
175 */
176#define YL9200_FLASH_BASE AT91_CHIPSELECT_0
177#define YL9200_FLASH_SIZE SZ_16M
178
179static struct mtd_partition yl9200_flash_partitions[] = {
180 {
181 .name = "Bootloader",
182 .offset = 0,
183 .size = SZ_256K,
184 .mask_flags = MTD_WRITEABLE, /* force read-only */
185 },
186 {
187 .name = "Kernel",
188 .offset = MTDPART_OFS_NXTBLK,
189 .size = (2 * SZ_1M) - SZ_256K
190 },
191 {
192 .name = "Filesystem",
193 .offset = MTDPART_OFS_NXTBLK,
194 .size = MTDPART_SIZ_FULL
195 }
196};
197
198static struct physmap_flash_data yl9200_flash_data = {
199 .width = 2,
200 .parts = yl9200_flash_partitions,
201 .nr_parts = ARRAY_SIZE(yl9200_flash_partitions),
202};
203
204static struct resource yl9200_flash_resources[] = {
205 {
206 .start = YL9200_FLASH_BASE,
207 .end = YL9200_FLASH_BASE + YL9200_FLASH_SIZE - 1,
208 .flags = IORESOURCE_MEM,
209 }
210};
211
212static struct platform_device yl9200_flash = {
213 .name = "physmap-flash",
214 .id = 0,
215 .dev = {
216 .platform_data = &yl9200_flash_data,
217 },
218 .resource = yl9200_flash_resources,
219 .num_resources = ARRAY_SIZE(yl9200_flash_resources),
220};
221
222/*
223 * I2C (TWI)
224 */
225static struct i2c_board_info __initdata yl9200_i2c_devices[] = {
226 { /* EEPROM */
227 I2C_BOARD_INFO("24c128", 0x50),
228 }
229};
230
231/*
232 * GPIO Buttons
233*/
234#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
235static struct gpio_keys_button yl9200_buttons[] = {
236 {
237 .gpio = AT91_PIN_PA24,
238 .code = BTN_2,
239 .desc = "SW2",
240 .active_low = 1,
241 .wakeup = 1,
242 },
243 {
244 .gpio = AT91_PIN_PB1,
245 .code = BTN_3,
246 .desc = "SW3",
247 .active_low = 1,
248 .wakeup = 1,
249 },
250 {
251 .gpio = AT91_PIN_PB2,
252 .code = BTN_4,
253 .desc = "SW4",
254 .active_low = 1,
255 .wakeup = 1,
256 },
257 {
258 .gpio = AT91_PIN_PB6,
259 .code = BTN_5,
260 .desc = "SW5",
261 .active_low = 1,
262 .wakeup = 1,
263 }
264};
265
266static struct gpio_keys_platform_data yl9200_button_data = {
267 .buttons = yl9200_buttons,
268 .nbuttons = ARRAY_SIZE(yl9200_buttons),
269};
270
271static struct platform_device yl9200_button_device = {
272 .name = "gpio-keys",
273 .id = -1,
274 .num_resources = 0,
275 .dev = {
276 .platform_data = &yl9200_button_data,
277 }
278};
279
280static void __init yl9200_add_device_buttons(void)
281{
282 at91_set_gpio_input(AT91_PIN_PA24, 1); /* SW2 */
283 at91_set_deglitch(AT91_PIN_PA24, 1);
284 at91_set_gpio_input(AT91_PIN_PB1, 1); /* SW3 */
285 at91_set_deglitch(AT91_PIN_PB1, 1);
286 at91_set_gpio_input(AT91_PIN_PB2, 1); /* SW4 */
287 at91_set_deglitch(AT91_PIN_PB2, 1);
288 at91_set_gpio_input(AT91_PIN_PB6, 1); /* SW5 */
289 at91_set_deglitch(AT91_PIN_PB6, 1);
290
291 /* Enable buttons (Sheet 5) */
292 at91_set_gpio_output(AT91_PIN_PB7, 1);
293
294 platform_device_register(&yl9200_button_device);
295}
296#else
297static void __init yl9200_add_device_buttons(void) {}
298#endif
299
300/*
301 * Touchscreen
302 */
303#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
304static int ads7843_pendown_state(void)
305{
306 return !at91_get_gpio_value(AT91_PIN_PB11); /* Touchscreen PENIRQ */
307}
308
309static struct ads7846_platform_data ads_info = {
310 .model = 7843,
311 .x_min = 150,
312 .x_max = 3830,
313 .y_min = 190,
314 .y_max = 3830,
315 .vref_delay_usecs = 100,
316
317 /* For a 8" touch-screen */
318 // .x_plate_ohms = 603,
319 // .y_plate_ohms = 332,
320
321 /* For a 10.4" touch-screen */
322 // .x_plate_ohms = 611,
323 // .y_plate_ohms = 325,
324
325 .x_plate_ohms = 576,
326 .y_plate_ohms = 366,
327
328 .pressure_max = 15000, /* generally nonsense on the 7843 */
329 .debounce_max = 1,
330 .debounce_rep = 0,
331 .debounce_tol = (~0),
332 .get_pendown_state = ads7843_pendown_state,
333};
334
335static void __init yl9200_add_device_ts(void)
336{
337 at91_set_gpio_input(AT91_PIN_PB11, 1); /* Touchscreen interrupt pin */
338 at91_set_gpio_input(AT91_PIN_PB10, 1); /* Touchscreen BUSY signal - not used! */
339}
340#else
341static void __init yl9200_add_device_ts(void) {}
342#endif
343
344/*
345 * SPI devices
346 */
347static struct spi_board_info yl9200_spi_devices[] = {
348#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
349 { /* Touchscreen */
350 .modalias = "ads7846",
351 .chip_select = 0,
352 .max_speed_hz = 5000 * 26,
353 .platform_data = &ads_info,
354 .irq = AT91_PIN_PB11,
355 },
356#endif
357 { /* CAN */
358 .modalias = "mcp2510",
359 .chip_select = 1,
360 .max_speed_hz = 25000 * 26,
361 .irq = AT91_PIN_PC0,
362 }
363};
364
365/*
366 * LCD / VGA
367 *
368 * EPSON S1D13806 FB (discontinued chip)
369 * EPSON S1D13506 FB
370 */
371#if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
372#include <video/s1d13xxxfb.h>
373
374
375static void yl9200_init_video(void)
376{
377 /* NWAIT Signal */
378 at91_set_A_periph(AT91_PIN_PC6, 0);
379
380 /* Initialization of the Static Memory Controller for Chip Select 2 */
381 at91_ramc_write(0, AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
382 | AT91_SMC_WSEN | AT91_SMC_NWS_(0x4) /* wait states */
383 | AT91_SMC_TDF_(0x100) /* float time */
384 );
385}
386
387static struct s1d13xxxfb_regval yl9200_s1dfb_initregs[] =
388{
389 {S1DREG_MISC, 0x00}, /* Miscellaneous Register*/
390 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
391 {S1DREG_GPIO_CNF0, 0x00}, /* General IO Pins Configuration Register*/
392 {S1DREG_GPIO_CTL0, 0x00}, /* General IO Pins Control Register*/
393 {S1DREG_CLK_CNF, 0x11}, /* Memory Clock Configuration Register*/
394 {S1DREG_LCD_CLK_CNF, 0x10}, /* LCD Pixel Clock Configuration Register*/
395 {S1DREG_CRT_CLK_CNF, 0x12}, /* CRT/TV Pixel Clock Configuration Register*/
396 {S1DREG_MPLUG_CLK_CNF, 0x01}, /* MediaPlug Clock Configuration Register*/
397 {S1DREG_CPU2MEM_WST_SEL, 0x02}, /* CPU To Memory Wait State Select Register*/
398 {S1DREG_MEM_CNF, 0x00}, /* Memory Configuration Register*/
399 {S1DREG_SDRAM_REF_RATE, 0x04}, /* DRAM Refresh Rate Register, MCLK source*/
400 {S1DREG_SDRAM_TC0, 0x12}, /* DRAM Timings Control Register 0*/
401 {S1DREG_SDRAM_TC1, 0x02}, /* DRAM Timings Control Register 1*/
402 {S1DREG_PANEL_TYPE, 0x25}, /* Panel Type Register*/
403 {S1DREG_MOD_RATE, 0x00}, /* MOD Rate Register*/
404 {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* LCD Horizontal Display Width Register*/
405 {S1DREG_LCD_NDISP_HPER, 0x13}, /* LCD Horizontal Non-Display Period Register*/
406 {S1DREG_TFT_FPLINE_START, 0x01}, /* TFT FPLINE Start Position Register*/
407 {S1DREG_TFT_FPLINE_PWIDTH, 0x0c}, /* TFT FPLINE Pulse Width Register*/
408 {S1DREG_LCD_DISP_VHEIGHT0, 0xDF}, /* LCD Vertical Display Height Register 0*/
409 {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* LCD Vertical Display Height Register 1*/
410 {S1DREG_LCD_NDISP_VPER, 0x2c}, /* LCD Vertical Non-Display Period Register*/
411 {S1DREG_TFT_FPFRAME_START, 0x0a}, /* TFT FPFRAME Start Position Register*/
412 {S1DREG_TFT_FPFRAME_PWIDTH, 0x02}, /* TFT FPFRAME Pulse Width Register*/
413 {S1DREG_LCD_DISP_MODE, 0x05}, /* LCD Display Mode Register*/
414 {S1DREG_LCD_MISC, 0x01}, /* LCD Miscellaneous Register*/
415 {S1DREG_LCD_DISP_START0, 0x00}, /* LCD Display Start Address Register 0*/
416 {S1DREG_LCD_DISP_START1, 0x00}, /* LCD Display Start Address Register 1*/
417 {S1DREG_LCD_DISP_START2, 0x00}, /* LCD Display Start Address Register 2*/
418 {S1DREG_LCD_MEM_OFF0, 0x80}, /* LCD Memory Address Offset Register 0*/
419 {S1DREG_LCD_MEM_OFF1, 0x02}, /* LCD Memory Address Offset Register 1*/
420 {S1DREG_LCD_PIX_PAN, 0x03}, /* LCD Pixel Panning Register*/
421 {S1DREG_LCD_DISP_FIFO_HTC, 0x00}, /* LCD Display FIFO High Threshold Control Register*/
422 {S1DREG_LCD_DISP_FIFO_LTC, 0x00}, /* LCD Display FIFO Low Threshold Control Register*/
423 {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* CRT/TV Horizontal Display Width Register*/
424 {S1DREG_CRT_NDISP_HPER, 0x13}, /* CRT/TV Horizontal Non-Display Period Register*/
425 {S1DREG_CRT_HRTC_START, 0x01}, /* CRT/TV HRTC Start Position Register*/
426 {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* CRT/TV HRTC Pulse Width Register*/
427 {S1DREG_CRT_DISP_VHEIGHT0, 0xDF}, /* CRT/TV Vertical Display Height Register 0*/
428 {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* CRT/TV Vertical Display Height Register 1*/
429 {S1DREG_CRT_NDISP_VPER, 0x2B}, /* CRT/TV Vertical Non-Display Period Register*/
430 {S1DREG_CRT_VRTC_START, 0x09}, /* CRT/TV VRTC Start Position Register*/
431 {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* CRT/TV VRTC Pulse Width Register*/
432 {S1DREG_TV_OUT_CTL, 0x18}, /* TV Output Control Register */
433 {S1DREG_CRT_DISP_MODE, 0x05}, /* CRT/TV Display Mode Register, 16BPP*/
434 {S1DREG_CRT_DISP_START0, 0x00}, /* CRT/TV Display Start Address Register 0*/
435 {S1DREG_CRT_DISP_START1, 0x00}, /* CRT/TV Display Start Address Register 1*/
436 {S1DREG_CRT_DISP_START2, 0x00}, /* CRT/TV Display Start Address Register 2*/
437 {S1DREG_CRT_MEM_OFF0, 0x80}, /* CRT/TV Memory Address Offset Register 0*/
438 {S1DREG_CRT_MEM_OFF1, 0x02}, /* CRT/TV Memory Address Offset Register 1*/
439 {S1DREG_CRT_PIX_PAN, 0x00}, /* CRT/TV Pixel Panning Register*/
440 {S1DREG_CRT_DISP_FIFO_HTC, 0x00}, /* CRT/TV Display FIFO High Threshold Control Register*/
441 {S1DREG_CRT_DISP_FIFO_LTC, 0x00}, /* CRT/TV Display FIFO Low Threshold Control Register*/
442 {S1DREG_LCD_CUR_CTL, 0x00}, /* LCD Ink/Cursor Control Register*/
443 {S1DREG_LCD_CUR_START, 0x01}, /* LCD Ink/Cursor Start Address Register*/
444 {S1DREG_LCD_CUR_XPOS0, 0x00}, /* LCD Cursor X Position Register 0*/
445 {S1DREG_LCD_CUR_XPOS1, 0x00}, /* LCD Cursor X Position Register 1*/
446 {S1DREG_LCD_CUR_YPOS0, 0x00}, /* LCD Cursor Y Position Register 0*/
447 {S1DREG_LCD_CUR_YPOS1, 0x00}, /* LCD Cursor Y Position Register 1*/
448 {S1DREG_LCD_CUR_BCTL0, 0x00}, /* LCD Ink/Cursor Blue Color 0 Register*/
449 {S1DREG_LCD_CUR_GCTL0, 0x00}, /* LCD Ink/Cursor Green Color 0 Register*/
450 {S1DREG_LCD_CUR_RCTL0, 0x00}, /* LCD Ink/Cursor Red Color 0 Register*/
451 {S1DREG_LCD_CUR_BCTL1, 0x1F}, /* LCD Ink/Cursor Blue Color 1 Register*/
452 {S1DREG_LCD_CUR_GCTL1, 0x3F}, /* LCD Ink/Cursor Green Color 1 Register*/
453 {S1DREG_LCD_CUR_RCTL1, 0x1F}, /* LCD Ink/Cursor Red Color 1 Register*/
454 {S1DREG_LCD_CUR_FIFO_HTC, 0x00}, /* LCD Ink/Cursor FIFO Threshold Register*/
455 {S1DREG_CRT_CUR_CTL, 0x00}, /* CRT/TV Ink/Cursor Control Register*/
456 {S1DREG_CRT_CUR_START, 0x01}, /* CRT/TV Ink/Cursor Start Address Register*/
457 {S1DREG_CRT_CUR_XPOS0, 0x00}, /* CRT/TV Cursor X Position Register 0*/
458 {S1DREG_CRT_CUR_XPOS1, 0x00}, /* CRT/TV Cursor X Position Register 1*/
459 {S1DREG_CRT_CUR_YPOS0, 0x00}, /* CRT/TV Cursor Y Position Register 0*/
460 {S1DREG_CRT_CUR_YPOS1, 0x00}, /* CRT/TV Cursor Y Position Register 1*/
461 {S1DREG_CRT_CUR_BCTL0, 0x00}, /* CRT/TV Ink/Cursor Blue Color 0 Register*/
462 {S1DREG_CRT_CUR_GCTL0, 0x00}, /* CRT/TV Ink/Cursor Green Color 0 Register*/
463 {S1DREG_CRT_CUR_RCTL0, 0x00}, /* CRT/TV Ink/Cursor Red Color 0 Register*/
464 {S1DREG_CRT_CUR_BCTL1, 0x1F}, /* CRT/TV Ink/Cursor Blue Color 1 Register*/
465 {S1DREG_CRT_CUR_GCTL1, 0x3F}, /* CRT/TV Ink/Cursor Green Color 1 Register*/
466 {S1DREG_CRT_CUR_RCTL1, 0x1F}, /* CRT/TV Ink/Cursor Red Color 1 Register*/
467 {S1DREG_CRT_CUR_FIFO_HTC, 0x00}, /* CRT/TV Ink/Cursor FIFO Threshold Register*/
468 {S1DREG_BBLT_CTL0, 0x00}, /* BitBlt Control Register 0*/
469 {S1DREG_BBLT_CTL1, 0x01}, /* BitBlt Control Register 1*/
470 {S1DREG_BBLT_CC_EXP, 0x00}, /* BitBlt ROP Code/Color Expansion Register*/
471 {S1DREG_BBLT_OP, 0x00}, /* BitBlt Operation Register*/
472 {S1DREG_BBLT_SRC_START0, 0x00}, /* BitBlt Source Start Address Register 0*/
473 {S1DREG_BBLT_SRC_START1, 0x00}, /* BitBlt Source Start Address Register 1*/
474 {S1DREG_BBLT_SRC_START2, 0x00}, /* BitBlt Source Start Address Register 2*/
475 {S1DREG_BBLT_DST_START0, 0x00}, /* BitBlt Destination Start Address Register 0*/
476 {S1DREG_BBLT_DST_START1, 0x00}, /* BitBlt Destination Start Address Register 1*/
477 {S1DREG_BBLT_DST_START2, 0x00}, /* BitBlt Destination Start Address Register 2*/
478 {S1DREG_BBLT_MEM_OFF0, 0x00}, /* BitBlt Memory Address Offset Register 0*/
479 {S1DREG_BBLT_MEM_OFF1, 0x00}, /* BitBlt Memory Address Offset Register 1*/
480 {S1DREG_BBLT_WIDTH0, 0x00}, /* BitBlt Width Register 0*/
481 {S1DREG_BBLT_WIDTH1, 0x00}, /* BitBlt Width Register 1*/
482 {S1DREG_BBLT_HEIGHT0, 0x00}, /* BitBlt Height Register 0*/
483 {S1DREG_BBLT_HEIGHT1, 0x00}, /* BitBlt Height Register 1*/
484 {S1DREG_BBLT_BGC0, 0x00}, /* BitBlt Background Color Register 0*/
485 {S1DREG_BBLT_BGC1, 0x00}, /* BitBlt Background Color Register 1*/
486 {S1DREG_BBLT_FGC0, 0x00}, /* BitBlt Foreground Color Register 0*/
487 {S1DREG_BBLT_FGC1, 0x00}, /* BitBlt Foreground Color Register 1*/
488 {S1DREG_LKUP_MODE, 0x00}, /* Look-Up Table Mode Register*/
489 {S1DREG_LKUP_ADDR, 0x00}, /* Look-Up Table Address Register*/
490 {S1DREG_PS_CNF, 0x00}, /* Power Save Configuration Register*/
491 {S1DREG_PS_STATUS, 0x00}, /* Power Save Status Register*/
492 {S1DREG_CPU2MEM_WDOGT, 0x00}, /* CPU-to-Memory Access Watchdog Timer Register*/
493 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
494};
495
496static struct s1d13xxxfb_pdata yl9200_s1dfb_pdata = {
497 .initregs = yl9200_s1dfb_initregs,
498 .initregssize = ARRAY_SIZE(yl9200_s1dfb_initregs),
499 .platform_init_video = yl9200_init_video,
500};
501
502#define YL9200_FB_REG_BASE AT91_CHIPSELECT_7
503#define YL9200_FB_VMEM_BASE YL9200_FB_REG_BASE + SZ_2M
504#define YL9200_FB_VMEM_SIZE SZ_2M
505
506static struct resource yl9200_s1dfb_resource[] = {
507 [0] = { /* video mem */
508 .name = "s1d13xxxfb memory",
509 .start = YL9200_FB_VMEM_BASE,
510 .end = YL9200_FB_VMEM_BASE + YL9200_FB_VMEM_SIZE -1,
511 .flags = IORESOURCE_MEM,
512 },
513 [1] = { /* video registers */
514 .name = "s1d13xxxfb registers",
515 .start = YL9200_FB_REG_BASE,
516 .end = YL9200_FB_REG_BASE + SZ_512 -1,
517 .flags = IORESOURCE_MEM,
518 },
519};
520
521static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
522
523static struct platform_device yl9200_s1dfb_device = {
524 .name = "s1d13806fb",
525 .id = -1,
526 .dev = {
527 .dma_mask = &s1dfb_dmamask,
528 .coherent_dma_mask = DMA_BIT_MASK(32),
529 .platform_data = &yl9200_s1dfb_pdata,
530 },
531 .resource = yl9200_s1dfb_resource,
532 .num_resources = ARRAY_SIZE(yl9200_s1dfb_resource),
533};
534
535void __init yl9200_add_device_video(void)
536{
537 platform_device_register(&yl9200_s1dfb_device);
538}
539#else
540void __init yl9200_add_device_video(void) {}
541#endif
542
543
544static void __init yl9200_board_init(void)
545{
546 /* Serial */
547 /* DBGU on ttyS0. (Rx & Tx only) */
548 at91_register_uart(0, 0, 0);
549
550 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
551 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
552 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
553 | ATMEL_UART_RI);
554
555 /* USART0 on ttyS2. (Rx & Tx only to JP3) */
556 at91_register_uart(AT91RM9200_ID_US0, 2, 0);
557
558 /* USART3 on ttyS3. (Rx, Tx, RTS - RS485 interface) */
559 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_RTS);
560 at91_add_device_serial();
561 /* Ethernet */
562 at91_add_device_eth(&yl9200_eth_data);
563 /* USB Host */
564 at91_add_device_usbh(&yl9200_usbh_data);
565 /* USB Device */
566 at91_add_device_udc(&yl9200_udc_data);
567 /* I2C */
568 at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices));
569 /* MMC */
570 at91_add_device_mci(0, &yl9200_mci0_data);
571 /* NAND */
572 at91_add_device_nand(&yl9200_nand_data);
573 /* NOR Flash */
574 platform_device_register(&yl9200_flash);
575#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
576 /* SPI */
577 at91_add_device_spi(yl9200_spi_devices, ARRAY_SIZE(yl9200_spi_devices));
578 /* Touchscreen */
579 yl9200_add_device_ts();
580#endif
581 /* LEDs. */
582 at91_gpio_leds(yl9200_leds, ARRAY_SIZE(yl9200_leds));
583 /* Push Buttons */
584 yl9200_add_device_buttons();
585 /* VGA */
586 yl9200_add_device_video();
587}
588
589MACHINE_START(YL9200, "uCdragon YL-9200")
590 /* Maintainer: S.Birtles */
591 .init_time = at91rm9200_timer_init,
592 .map_io = at91_map_io,
593 .handle_irq = at91_aic_handle_irq,
594 .init_early = yl9200_init_early,
595 .init_irq = at91_init_irq_default,
596 .init_machine = yl9200_board_init,
597MACHINE_END
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
deleted file mode 100644
index 836e9a537e0c..000000000000
--- a/arch/arm/mach-at91/board.h
+++ /dev/null
@@ -1,127 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/board.h
3 *
4 * Copyright (C) 2005 HP Labs
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/*
22 * These are data structures found in platform_device.dev.platform_data,
23 * and describing board-specific data needed by drivers. For example,
24 * which pin is used for a given GPIO role.
25 *
26 * In 2.6, drivers should strongly avoid board-specific knowledge so
27 * that supporting new boards normally won't require driver patches.
28 * Most board-specific knowledge should be in arch/.../board-*.c files.
29 */
30
31#ifndef __ASM_ARCH_BOARD_H
32#define __ASM_ARCH_BOARD_H
33
34#include <linux/platform_data/atmel.h>
35
36 /* USB Device */
37extern void __init at91_add_device_udc(struct at91_udc_data *data);
38
39 /* USB High Speed Device */
40extern void __init at91_add_device_usba(struct usba_platform_data *data);
41
42 /* Compact Flash */
43extern void __init at91_add_device_cf(struct at91_cf_data *data);
44
45 /* MMC / SD */
46 /* atmel-mci platform config */
47extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
48
49extern void __init at91_add_device_eth(struct macb_platform_data *data);
50
51 /* USB Host */
52extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
53extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
54extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data);
55
56extern void __init at91_add_device_nand(struct atmel_nand_data *data);
57
58 /* I2C*/
59#if defined(CONFIG_ARCH_AT91SAM9G45)
60extern void __init at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, int nr_devices);
61#else
62extern void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices);
63#endif
64
65 /* SPI */
66extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices);
67
68 /* Serial */
69#define ATMEL_UART_CTS 0x01
70#define ATMEL_UART_RTS 0x02
71#define ATMEL_UART_DSR 0x04
72#define ATMEL_UART_DTR 0x08
73#define ATMEL_UART_DCD 0x10
74#define ATMEL_UART_RI 0x20
75
76extern void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins);
77
78extern struct platform_device *atmel_default_console_device;
79
80extern void __init at91_add_device_serial(void);
81
82/*
83 * PWM
84 */
85#define AT91_PWM0 0
86#define AT91_PWM1 1
87#define AT91_PWM2 2
88#define AT91_PWM3 3
89
90extern void __init at91_add_device_pwm(u32 mask);
91
92/*
93 * SSC -- accessed through ssc_request(id). Drivers don't bind to SSC
94 * platform devices. Their SSC ID is part of their configuration data,
95 * along with information about which SSC signals they should use.
96 */
97#define ATMEL_SSC_TK 0x01
98#define ATMEL_SSC_TF 0x02
99#define ATMEL_SSC_TD 0x04
100#define ATMEL_SSC_TX (ATMEL_SSC_TK | ATMEL_SSC_TF | ATMEL_SSC_TD)
101
102#define ATMEL_SSC_RK 0x10
103#define ATMEL_SSC_RF 0x20
104#define ATMEL_SSC_RD 0x40
105#define ATMEL_SSC_RX (ATMEL_SSC_RK | ATMEL_SSC_RF | ATMEL_SSC_RD)
106
107extern void __init at91_add_device_ssc(unsigned id, unsigned pins);
108
109 /* LCD Controller */
110struct atmel_lcdfb_pdata;
111extern void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data);
112
113 /* AC97 */
114extern void __init at91_add_device_ac97(struct ac97c_platform_data *data);
115
116 /* ISI */
117struct isi_platform_data;
118extern void __init at91_add_device_isi(struct isi_platform_data *data,
119 bool use_pck_as_mck);
120
121/* CAN */
122extern void __init at91_add_device_can(struct at91_can_data *data);
123
124 /* LEDs */
125extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
126
127#endif
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
deleted file mode 100644
index d66f102c352a..000000000000
--- a/arch/arm/mach-at91/clock.c
+++ /dev/null
@@ -1,977 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/clock.c
3 *
4 * Copyright (C) 2005 David Brownell
5 * Copyright (C) 2005 Ivan Kokshaysky
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
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/fs.h>
17#include <linux/debugfs.h>
18#include <linux/seq_file.h>
19#include <linux/list.h>
20#include <linux/errno.h>
21#include <linux/err.h>
22#include <linux/spinlock.h>
23#include <linux/delay.h>
24#include <linux/clk.h>
25#include <linux/io.h>
26#include <linux/of_address.h>
27#include <linux/clk/at91_pmc.h>
28
29#include <mach/hardware.h>
30#include <mach/cpu.h>
31
32#include <asm/proc-fns.h>
33
34#include "clock.h"
35#include "generic.h"
36
37void __iomem *at91_pmc_base;
38EXPORT_SYMBOL_GPL(at91_pmc_base);
39
40/*
41 * There's a lot more which can be done with clocks, including cpufreq
42 * integration, slow clock mode support (for system suspend), letting
43 * PLLB be used at other rates (on boards that don't need USB), etc.
44 */
45
46#define clk_is_primary(x) ((x)->type & CLK_TYPE_PRIMARY)
47#define clk_is_programmable(x) ((x)->type & CLK_TYPE_PROGRAMMABLE)
48#define clk_is_peripheral(x) ((x)->type & CLK_TYPE_PERIPHERAL)
49#define clk_is_sys(x) ((x)->type & CLK_TYPE_SYSTEM)
50
51
52/*
53 * Chips have some kind of clocks : group them by functionality
54 */
55#define cpu_has_utmi() ( cpu_is_at91sam9rl() \
56 || cpu_is_at91sam9g45() \
57 || cpu_is_at91sam9x5() \
58 || cpu_is_sama5d3())
59
60#define cpu_has_1056M_plla() (cpu_is_sama5d3())
61
62#define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \
63 || cpu_is_at91sam9g45() \
64 || cpu_is_at91sam9x5() \
65 || cpu_is_at91sam9n12())
66
67#define cpu_has_300M_plla() (cpu_is_at91sam9g10())
68
69#define cpu_has_240M_plla() (cpu_is_at91sam9261() \
70 || cpu_is_at91sam9263() \
71 || cpu_is_at91sam9rl())
72
73#define cpu_has_210M_plla() (cpu_is_at91sam9260())
74
75#define cpu_has_pllb() (!(cpu_is_at91sam9rl() \
76 || cpu_is_at91sam9g45() \
77 || cpu_is_at91sam9x5() \
78 || cpu_is_sama5d3()))
79
80#define cpu_has_upll() (cpu_is_at91sam9g45() \
81 || cpu_is_at91sam9x5() \
82 || cpu_is_sama5d3())
83
84/* USB host HS & FS */
85#define cpu_has_uhp() (!cpu_is_at91sam9rl())
86
87/* USB device FS only */
88#define cpu_has_udpfs() (!(cpu_is_at91sam9rl() \
89 || cpu_is_at91sam9g45() \
90 || cpu_is_at91sam9x5() \
91 || cpu_is_sama5d3()))
92
93#define cpu_has_plladiv2() (cpu_is_at91sam9g45() \
94 || cpu_is_at91sam9x5() \
95 || cpu_is_at91sam9n12() \
96 || cpu_is_sama5d3())
97
98#define cpu_has_mdiv3() (cpu_is_at91sam9g45() \
99 || cpu_is_at91sam9x5() \
100 || cpu_is_at91sam9n12() \
101 || cpu_is_sama5d3())
102
103#define cpu_has_alt_prescaler() (cpu_is_at91sam9x5() \
104 || cpu_is_at91sam9n12() \
105 || cpu_is_sama5d3())
106
107static LIST_HEAD(clocks);
108static DEFINE_SPINLOCK(clk_lock);
109
110static u32 at91_pllb_usb_init;
111
112/*
113 * Four primary clock sources: two crystal oscillators (32K, main), and
114 * two PLLs. PLLA usually runs the master clock; and PLLB must run at
115 * 48 MHz (unless no USB function clocks are needed). The main clock and
116 * both PLLs are turned off to run in "slow clock mode" (system suspend).
117 */
118static struct clk clk32k = {
119 .name = "clk32k",
120 .rate_hz = AT91_SLOW_CLOCK,
121 .users = 1, /* always on */
122 .id = 0,
123 .type = CLK_TYPE_PRIMARY,
124};
125static struct clk main_clk = {
126 .name = "main",
127 .pmc_mask = AT91_PMC_MOSCS, /* in PMC_SR */
128 .id = 1,
129 .type = CLK_TYPE_PRIMARY,
130};
131static struct clk plla = {
132 .name = "plla",
133 .parent = &main_clk,
134 .pmc_mask = AT91_PMC_LOCKA, /* in PMC_SR */
135 .id = 2,
136 .type = CLK_TYPE_PRIMARY | CLK_TYPE_PLL,
137};
138
139static void pllb_mode(struct clk *clk, int is_on)
140{
141 u32 value;
142
143 if (is_on) {
144 is_on = AT91_PMC_LOCKB;
145 value = at91_pllb_usb_init;
146 } else
147 value = 0;
148
149 // REVISIT: Add work-around for AT91RM9200 Errata #26 ?
150 at91_pmc_write(AT91_CKGR_PLLBR, value);
151
152 do {
153 cpu_relax();
154 } while ((at91_pmc_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != is_on);
155}
156
157static struct clk pllb = {
158 .name = "pllb",
159 .parent = &main_clk,
160 .pmc_mask = AT91_PMC_LOCKB, /* in PMC_SR */
161 .mode = pllb_mode,
162 .id = 3,
163 .type = CLK_TYPE_PRIMARY | CLK_TYPE_PLL,
164};
165
166static void pmc_sys_mode(struct clk *clk, int is_on)
167{
168 if (is_on)
169 at91_pmc_write(AT91_PMC_SCER, clk->pmc_mask);
170 else
171 at91_pmc_write(AT91_PMC_SCDR, clk->pmc_mask);
172}
173
174static void pmc_uckr_mode(struct clk *clk, int is_on)
175{
176 unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
177
178 if (is_on) {
179 is_on = AT91_PMC_LOCKU;
180 at91_pmc_write(AT91_CKGR_UCKR, uckr | clk->pmc_mask);
181 } else
182 at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(clk->pmc_mask));
183
184 do {
185 cpu_relax();
186 } while ((at91_pmc_read(AT91_PMC_SR) & AT91_PMC_LOCKU) != is_on);
187}
188
189/* USB function clocks (PLLB must be 48 MHz) */
190static struct clk udpck = {
191 .name = "udpck",
192 .parent = &pllb,
193 .mode = pmc_sys_mode,
194};
195struct clk utmi_clk = {
196 .name = "utmi_clk",
197 .parent = &main_clk,
198 .pmc_mask = AT91_PMC_UPLLEN, /* in CKGR_UCKR */
199 .mode = pmc_uckr_mode,
200 .type = CLK_TYPE_PLL,
201};
202static struct clk uhpck = {
203 .name = "uhpck",
204 /*.parent = ... we choose parent at runtime */
205 .mode = pmc_sys_mode,
206};
207
208
209/*
210 * The master clock is divided from the CPU clock (by 1-4). It's used for
211 * memory, interfaces to on-chip peripherals, the AIC, and sometimes more
212 * (e.g baud rate generation). It's sourced from one of the primary clocks.
213 */
214struct clk mck = {
215 .name = "mck",
216 .pmc_mask = AT91_PMC_MCKRDY, /* in PMC_SR */
217};
218
219static void pmc_periph_mode(struct clk *clk, int is_on)
220{
221 u32 regval = 0;
222
223 /*
224 * With sama5d3 devices, we are managing clock division so we have to
225 * use the Peripheral Control Register introduced from at91sam9x5
226 * devices.
227 */
228 if (cpu_is_sama5d3()) {
229 regval |= AT91_PMC_PCR_CMD; /* write command */
230 regval |= clk->pid & AT91_PMC_PCR_PID; /* peripheral selection */
231 regval |= AT91_PMC_PCR_DIV(clk->div);
232 if (is_on)
233 regval |= AT91_PMC_PCR_EN; /* enable clock */
234 at91_pmc_write(AT91_PMC_PCR, regval);
235 } else {
236 if (is_on)
237 at91_pmc_write(AT91_PMC_PCER, clk->pmc_mask);
238 else
239 at91_pmc_write(AT91_PMC_PCDR, clk->pmc_mask);
240 }
241}
242
243static struct clk __init *at91_css_to_clk(unsigned long css)
244{
245 switch (css) {
246 case AT91_PMC_CSS_SLOW:
247 return &clk32k;
248 case AT91_PMC_CSS_MAIN:
249 return &main_clk;
250 case AT91_PMC_CSS_PLLA:
251 return &plla;
252 case AT91_PMC_CSS_PLLB:
253 if (cpu_has_upll())
254 /* CSS_PLLB == CSS_UPLL */
255 return &utmi_clk;
256 else if (cpu_has_pllb())
257 return &pllb;
258 break;
259 /* alternate PMC: can use master clock */
260 case AT91_PMC_CSS_MASTER:
261 return &mck;
262 }
263
264 return NULL;
265}
266
267static int pmc_prescaler_divider(u32 reg)
268{
269 if (cpu_has_alt_prescaler()) {
270 return 1 << ((reg & AT91_PMC_ALT_PRES) >> PMC_ALT_PRES_OFFSET);
271 } else {
272 return 1 << ((reg & AT91_PMC_PRES) >> PMC_PRES_OFFSET);
273 }
274}
275
276static void __clk_enable(struct clk *clk)
277{
278 if (clk->parent)
279 __clk_enable(clk->parent);
280 if (clk->users++ == 0 && clk->mode)
281 clk->mode(clk, 1);
282}
283
284int clk_enable(struct clk *clk)
285{
286 unsigned long flags;
287
288 spin_lock_irqsave(&clk_lock, flags);
289 __clk_enable(clk);
290 spin_unlock_irqrestore(&clk_lock, flags);
291 return 0;
292}
293EXPORT_SYMBOL(clk_enable);
294
295static void __clk_disable(struct clk *clk)
296{
297 BUG_ON(clk->users == 0);
298 if (--clk->users == 0 && clk->mode)
299 clk->mode(clk, 0);
300 if (clk->parent)
301 __clk_disable(clk->parent);
302}
303
304void clk_disable(struct clk *clk)
305{
306 unsigned long flags;
307
308 spin_lock_irqsave(&clk_lock, flags);
309 __clk_disable(clk);
310 spin_unlock_irqrestore(&clk_lock, flags);
311}
312EXPORT_SYMBOL(clk_disable);
313
314unsigned long clk_get_rate(struct clk *clk)
315{
316 unsigned long flags;
317 unsigned long rate;
318
319 spin_lock_irqsave(&clk_lock, flags);
320 for (;;) {
321 rate = clk->rate_hz;
322 if (rate || !clk->parent)
323 break;
324 clk = clk->parent;
325 }
326 spin_unlock_irqrestore(&clk_lock, flags);
327 return rate;
328}
329EXPORT_SYMBOL(clk_get_rate);
330
331/*------------------------------------------------------------------------*/
332
333/*
334 * For now, only the programmable clocks support reparenting (MCK could
335 * do this too, with care) or rate changing (the PLLs could do this too,
336 * ditto MCK but that's more for cpufreq). Drivers may reparent to get
337 * a better rate match; we don't.
338 */
339
340long clk_round_rate(struct clk *clk, unsigned long rate)
341{
342 unsigned long flags;
343 unsigned prescale;
344 unsigned long actual;
345 unsigned long prev = ULONG_MAX;
346
347 if (!clk_is_programmable(clk))
348 return -EINVAL;
349 spin_lock_irqsave(&clk_lock, flags);
350
351 actual = clk->parent->rate_hz;
352 for (prescale = 0; prescale < 7; prescale++) {
353 if (actual > rate)
354 prev = actual;
355
356 if (actual && actual <= rate) {
357 if ((prev - rate) < (rate - actual)) {
358 actual = prev;
359 prescale--;
360 }
361 break;
362 }
363 actual >>= 1;
364 }
365
366 spin_unlock_irqrestore(&clk_lock, flags);
367 return (prescale < 7) ? actual : -ENOENT;
368}
369EXPORT_SYMBOL(clk_round_rate);
370
371int clk_set_rate(struct clk *clk, unsigned long rate)
372{
373 unsigned long flags;
374 unsigned prescale;
375 unsigned long prescale_offset, css_mask;
376 unsigned long actual;
377
378 if (!clk_is_programmable(clk))
379 return -EINVAL;
380 if (clk->users)
381 return -EBUSY;
382
383 if (cpu_has_alt_prescaler()) {
384 prescale_offset = PMC_ALT_PRES_OFFSET;
385 css_mask = AT91_PMC_ALT_PCKR_CSS;
386 } else {
387 prescale_offset = PMC_PRES_OFFSET;
388 css_mask = AT91_PMC_CSS;
389 }
390
391 spin_lock_irqsave(&clk_lock, flags);
392
393 actual = clk->parent->rate_hz;
394 for (prescale = 0; prescale < 7; prescale++) {
395 if (actual && actual <= rate) {
396 u32 pckr;
397
398 pckr = at91_pmc_read(AT91_PMC_PCKR(clk->id));
399 pckr &= css_mask; /* keep clock selection */
400 pckr |= prescale << prescale_offset;
401 at91_pmc_write(AT91_PMC_PCKR(clk->id), pckr);
402 clk->rate_hz = actual;
403 break;
404 }
405 actual >>= 1;
406 }
407
408 spin_unlock_irqrestore(&clk_lock, flags);
409 return (prescale < 7) ? actual : -ENOENT;
410}
411EXPORT_SYMBOL(clk_set_rate);
412
413struct clk *clk_get_parent(struct clk *clk)
414{
415 return clk->parent;
416}
417EXPORT_SYMBOL(clk_get_parent);
418
419int clk_set_parent(struct clk *clk, struct clk *parent)
420{
421 unsigned long flags;
422
423 if (clk->users)
424 return -EBUSY;
425 if (!clk_is_primary(parent) || !clk_is_programmable(clk))
426 return -EINVAL;
427
428 if (cpu_is_at91sam9rl() && parent->id == AT91_PMC_CSS_PLLB)
429 return -EINVAL;
430
431 spin_lock_irqsave(&clk_lock, flags);
432
433 clk->rate_hz = parent->rate_hz;
434 clk->parent = parent;
435 at91_pmc_write(AT91_PMC_PCKR(clk->id), parent->id);
436
437 spin_unlock_irqrestore(&clk_lock, flags);
438 return 0;
439}
440EXPORT_SYMBOL(clk_set_parent);
441
442/* establish PCK0..PCKN parentage and rate */
443static void __init init_programmable_clock(struct clk *clk)
444{
445 struct clk *parent;
446 u32 pckr;
447 unsigned int css_mask;
448
449 if (cpu_has_alt_prescaler())
450 css_mask = AT91_PMC_ALT_PCKR_CSS;
451 else
452 css_mask = AT91_PMC_CSS;
453
454 pckr = at91_pmc_read(AT91_PMC_PCKR(clk->id));
455 parent = at91_css_to_clk(pckr & css_mask);
456 clk->parent = parent;
457 clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
458}
459
460/*------------------------------------------------------------------------*/
461
462#ifdef CONFIG_DEBUG_FS
463
464static int at91_clk_show(struct seq_file *s, void *unused)
465{
466 u32 scsr, pcsr, pcsr1 = 0, uckr = 0, sr;
467 struct clk *clk;
468
469 scsr = at91_pmc_read(AT91_PMC_SCSR);
470 pcsr = at91_pmc_read(AT91_PMC_PCSR);
471 if (cpu_is_sama5d3())
472 pcsr1 = at91_pmc_read(AT91_PMC_PCSR1);
473 sr = at91_pmc_read(AT91_PMC_SR);
474 seq_printf(s, "SCSR = %8x\n", scsr);
475 seq_printf(s, "PCSR = %8x\n", pcsr);
476 if (cpu_is_sama5d3())
477 seq_printf(s, "PCSR1 = %8x\n", pcsr1);
478 seq_printf(s, "MOR = %8x\n", at91_pmc_read(AT91_CKGR_MOR));
479 seq_printf(s, "MCFR = %8x\n", at91_pmc_read(AT91_CKGR_MCFR));
480 seq_printf(s, "PLLA = %8x\n", at91_pmc_read(AT91_CKGR_PLLAR));
481 if (cpu_has_pllb())
482 seq_printf(s, "PLLB = %8x\n", at91_pmc_read(AT91_CKGR_PLLBR));
483 if (cpu_has_utmi()) {
484 uckr = at91_pmc_read(AT91_CKGR_UCKR);
485 seq_printf(s, "UCKR = %8x\n", uckr);
486 }
487 seq_printf(s, "MCKR = %8x\n", at91_pmc_read(AT91_PMC_MCKR));
488 if (cpu_has_upll() || cpu_is_at91sam9n12())
489 seq_printf(s, "USB = %8x\n", at91_pmc_read(AT91_PMC_USB));
490 seq_printf(s, "SR = %8x\n", sr);
491
492 seq_printf(s, "\n");
493
494 list_for_each_entry(clk, &clocks, node) {
495 char *state;
496
497 if (clk->mode == pmc_sys_mode) {
498 state = (scsr & clk->pmc_mask) ? "on" : "off";
499 } else if (clk->mode == pmc_periph_mode) {
500 if (cpu_is_sama5d3()) {
501 u32 pmc_mask = 1 << (clk->pid % 32);
502
503 if (clk->pid > 31)
504 state = (pcsr1 & pmc_mask) ? "on" : "off";
505 else
506 state = (pcsr & pmc_mask) ? "on" : "off";
507 } else {
508 state = (pcsr & clk->pmc_mask) ? "on" : "off";
509 }
510 } else if (clk->mode == pmc_uckr_mode) {
511 state = (uckr & clk->pmc_mask) ? "on" : "off";
512 } else if (clk->pmc_mask) {
513 state = (sr & clk->pmc_mask) ? "on" : "off";
514 } else if (clk == &clk32k || clk == &main_clk) {
515 state = "on";
516 } else {
517 state = "";
518 }
519
520 seq_printf(s, "%-10s users=%2d %-3s %9lu Hz %s\n",
521 clk->name, clk->users, state, clk_get_rate(clk),
522 clk->parent ? clk->parent->name : "");
523 }
524 return 0;
525}
526
527static int at91_clk_open(struct inode *inode, struct file *file)
528{
529 return single_open(file, at91_clk_show, NULL);
530}
531
532static const struct file_operations at91_clk_operations = {
533 .open = at91_clk_open,
534 .read = seq_read,
535 .llseek = seq_lseek,
536 .release = single_release,
537};
538
539static int __init at91_clk_debugfs_init(void)
540{
541 /* /sys/kernel/debug/at91_clk */
542 (void) debugfs_create_file("at91_clk", S_IFREG | S_IRUGO, NULL, NULL, &at91_clk_operations);
543
544 return 0;
545}
546postcore_initcall(at91_clk_debugfs_init);
547
548#endif
549
550/*------------------------------------------------------------------------*/
551
552/* Register a new clock */
553static void __init at91_clk_add(struct clk *clk)
554{
555 list_add_tail(&clk->node, &clocks);
556
557 clk->cl.con_id = clk->name;
558 clk->cl.clk = clk;
559 clkdev_add(&clk->cl);
560}
561
562int __init clk_register(struct clk *clk)
563{
564 if (clk_is_peripheral(clk)) {
565 if (!clk->parent)
566 clk->parent = &mck;
567 if (cpu_is_sama5d3())
568 clk->rate_hz = DIV_ROUND_UP(clk->parent->rate_hz,
569 1 << clk->div);
570 clk->mode = pmc_periph_mode;
571 }
572 else if (clk_is_sys(clk)) {
573 clk->parent = &mck;
574 clk->mode = pmc_sys_mode;
575 }
576 else if (clk_is_programmable(clk)) {
577 clk->mode = pmc_sys_mode;
578 init_programmable_clock(clk);
579 }
580
581 at91_clk_add(clk);
582
583 return 0;
584}
585
586/*------------------------------------------------------------------------*/
587
588static u32 __init at91_pll_rate(struct clk *pll, u32 freq, u32 reg)
589{
590 unsigned mul, div;
591
592 div = reg & 0xff;
593 if (cpu_is_sama5d3())
594 mul = AT91_PMC3_MUL_GET(reg);
595 else
596 mul = AT91_PMC_MUL_GET(reg);
597
598 if (div && mul) {
599 freq /= div;
600 freq *= mul + 1;
601 } else
602 freq = 0;
603
604 return freq;
605}
606
607static u32 __init at91_usb_rate(struct clk *pll, u32 freq, u32 reg)
608{
609 if (pll == &pllb && (reg & AT91_PMC_USB96M))
610 return freq / 2;
611 else if (pll == &utmi_clk || cpu_is_at91sam9n12())
612 return freq / (1 + ((reg & AT91_PMC_OHCIUSBDIV) >> 8));
613 else
614 return freq;
615}
616
617static unsigned __init at91_pll_calc(unsigned main_freq, unsigned out_freq)
618{
619 unsigned i, div = 0, mul = 0, diff = 1 << 30;
620 unsigned ret = (out_freq > 155000000) ? 0xbe00 : 0x3e00;
621
622 /* PLL output max 240 MHz (or 180 MHz per errata) */
623 if (out_freq > 240000000)
624 goto fail;
625
626 for (i = 1; i < 256; i++) {
627 int diff1;
628 unsigned input, mul1;
629
630 /*
631 * PLL input between 1MHz and 32MHz per spec, but lower
632 * frequences seem necessary in some cases so allow 100K.
633 * Warning: some newer products need 2MHz min.
634 */
635 input = main_freq / i;
636 if (cpu_is_at91sam9g20() && input < 2000000)
637 continue;
638 if (input < 100000)
639 continue;
640 if (input > 32000000)
641 continue;
642
643 mul1 = out_freq / input;
644 if (cpu_is_at91sam9g20() && mul > 63)
645 continue;
646 if (mul1 > 2048)
647 continue;
648 if (mul1 < 2)
649 goto fail;
650
651 diff1 = out_freq - input * mul1;
652 if (diff1 < 0)
653 diff1 = -diff1;
654 if (diff > diff1) {
655 diff = diff1;
656 div = i;
657 mul = mul1;
658 if (diff == 0)
659 break;
660 }
661 }
662 if (i == 256 && diff > (out_freq >> 5))
663 goto fail;
664 return ret | ((mul - 1) << 16) | div;
665fail:
666 return 0;
667}
668
669static struct clk *const standard_pmc_clocks[] __initconst = {
670 /* four primary clocks */
671 &clk32k,
672 &main_clk,
673 &plla,
674
675 /* MCK */
676 &mck
677};
678
679/* PLLB generated USB full speed clock init */
680static void __init at91_pllb_usbfs_clock_init(unsigned long main_clock)
681{
682 unsigned int reg;
683
684 /*
685 * USB clock init: choose 48 MHz PLLB value,
686 * disable 48MHz clock during usb peripheral suspend.
687 *
688 * REVISIT: assumes MCK doesn't derive from PLLB!
689 */
690 uhpck.parent = &pllb;
691
692 reg = at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2);
693 pllb.rate_hz = at91_pll_rate(&pllb, main_clock, at91_pllb_usb_init);
694 if (cpu_is_at91rm9200()) {
695 reg = at91_pllb_usb_init |= AT91_PMC_USB96M;
696 uhpck.pmc_mask = AT91RM9200_PMC_UHP;
697 udpck.pmc_mask = AT91RM9200_PMC_UDP;
698 at91_pmc_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP);
699 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() ||
700 cpu_is_at91sam9263() || cpu_is_at91sam9g20() ||
701 cpu_is_at91sam9g10()) {
702 reg = at91_pllb_usb_init |= AT91_PMC_USB96M;
703 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
704 udpck.pmc_mask = AT91SAM926x_PMC_UDP;
705 } else if (cpu_is_at91sam9n12()) {
706 /* Divider for USB clock is in USB clock register for 9n12 */
707 reg = AT91_PMC_USBS_PLLB;
708
709 /* For PLLB output 96M, set usb divider 2 (USBDIV + 1) */
710 reg |= AT91_PMC_OHCIUSBDIV_2;
711 at91_pmc_write(AT91_PMC_USB, reg);
712
713 /* Still setup masks */
714 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
715 udpck.pmc_mask = AT91SAM926x_PMC_UDP;
716 }
717 at91_pmc_write(AT91_CKGR_PLLBR, 0);
718
719 udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, reg);
720 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, reg);
721}
722
723/* UPLL generated USB full speed clock init */
724static void __init at91_upll_usbfs_clock_init(unsigned long main_clock)
725{
726 /*
727 * USB clock init: choose 480 MHz from UPLL,
728 */
729 unsigned int usbr = AT91_PMC_USBS_UPLL;
730
731 /* Setup divider by 10 to reach 48 MHz */
732 usbr |= ((10 - 1) << 8) & AT91_PMC_OHCIUSBDIV;
733
734 at91_pmc_write(AT91_PMC_USB, usbr);
735
736 /* Now set uhpck values */
737 uhpck.parent = &utmi_clk;
738 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
739 uhpck.rate_hz = at91_usb_rate(&utmi_clk, utmi_clk.rate_hz, usbr);
740}
741
742static int __init at91_pmc_init(unsigned long main_clock)
743{
744 unsigned tmp, freq, mckr;
745 int i;
746 int pll_overclock = false;
747
748 /*
749 * When the bootloader initialized the main oscillator correctly,
750 * there's no problem using the cycle counter. But if it didn't,
751 * or when using oscillator bypass mode, we must be told the speed
752 * of the main clock.
753 */
754 if (!main_clock) {
755 do {
756 tmp = at91_pmc_read(AT91_CKGR_MCFR);
757 } while (!(tmp & AT91_PMC_MAINRDY));
758 main_clock = (tmp & AT91_PMC_MAINF) * (AT91_SLOW_CLOCK / 16);
759 }
760 main_clk.rate_hz = main_clock;
761
762 /* report if PLLA is more than mildly overclocked */
763 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_pmc_read(AT91_CKGR_PLLAR));
764 if (cpu_has_1056M_plla()) {
765 if (plla.rate_hz > 1056000000)
766 pll_overclock = true;
767 } else if (cpu_has_800M_plla()) {
768 if (plla.rate_hz > 800000000)
769 pll_overclock = true;
770 } else if (cpu_has_300M_plla()) {
771 if (plla.rate_hz > 300000000)
772 pll_overclock = true;
773 } else if (cpu_has_240M_plla()) {
774 if (plla.rate_hz > 240000000)
775 pll_overclock = true;
776 } else if (cpu_has_210M_plla()) {
777 if (plla.rate_hz > 210000000)
778 pll_overclock = true;
779 } else {
780 if (plla.rate_hz > 209000000)
781 pll_overclock = true;
782 }
783 if (pll_overclock)
784 pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000);
785
786 if (cpu_has_plladiv2()) {
787 mckr = at91_pmc_read(AT91_PMC_MCKR);
788 plla.rate_hz /= (1 << ((mckr & AT91_PMC_PLLADIV2) >> 12)); /* plla divisor by 2 */
789 }
790
791 if (!cpu_has_pllb() && cpu_has_upll()) {
792 /* setup UTMI clock as the fourth primary clock
793 * (instead of pllb) */
794 utmi_clk.type |= CLK_TYPE_PRIMARY;
795 utmi_clk.id = 3;
796 }
797
798
799 /*
800 * USB HS clock init
801 */
802 if (cpu_has_utmi()) {
803 /*
804 * multiplier is hard-wired to 40
805 * (obtain the USB High Speed 480 MHz when input is 12 MHz)
806 */
807 utmi_clk.rate_hz = 40 * utmi_clk.parent->rate_hz;
808
809 /* UTMI bias and PLL are managed at the same time */
810 if (cpu_has_upll())
811 utmi_clk.pmc_mask |= AT91_PMC_BIASEN;
812 }
813
814 /*
815 * USB FS clock init
816 */
817 if (cpu_has_pllb())
818 at91_pllb_usbfs_clock_init(main_clock);
819 if (cpu_has_upll())
820 /* assumes that we choose UPLL for USB and not PLLA */
821 at91_upll_usbfs_clock_init(main_clock);
822
823 /*
824 * MCK and CPU derive from one of those primary clocks.
825 * For now, assume this parentage won't change.
826 */
827 mckr = at91_pmc_read(AT91_PMC_MCKR);
828 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS);
829 freq = mck.parent->rate_hz;
830 freq /= pmc_prescaler_divider(mckr); /* prescale */
831 if (cpu_is_at91rm9200()) {
832 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
833 } else if (cpu_is_at91sam9g20()) {
834 mck.rate_hz = (mckr & AT91_PMC_MDIV) ?
835 freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */
836 if (mckr & AT91_PMC_PDIV)
837 freq /= 2; /* processor clock division */
838 } else if (cpu_has_mdiv3()) {
839 mck.rate_hz = (mckr & AT91_PMC_MDIV) == AT91SAM9_PMC_MDIV_3 ?
840 freq / 3 : freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
841 } else {
842 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
843 }
844
845 if (cpu_has_alt_prescaler()) {
846 /* Programmable clocks can use MCK */
847 mck.type |= CLK_TYPE_PRIMARY;
848 mck.id = 4;
849 }
850
851 /* Register the PMC's standard clocks */
852 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
853 at91_clk_add(standard_pmc_clocks[i]);
854
855 if (cpu_has_pllb())
856 at91_clk_add(&pllb);
857
858 if (cpu_has_uhp())
859 at91_clk_add(&uhpck);
860
861 if (cpu_has_udpfs())
862 at91_clk_add(&udpck);
863
864 if (cpu_has_utmi())
865 at91_clk_add(&utmi_clk);
866
867 /* MCK and CPU clock are "always on" */
868 clk_enable(&mck);
869
870 printk("Clocks: CPU %u MHz, master %u MHz, main %u.%03u MHz\n",
871 freq / 1000000, (unsigned) mck.rate_hz / 1000000,
872 (unsigned) main_clock / 1000000,
873 ((unsigned) main_clock % 1000000) / 1000);
874
875 return 0;
876}
877
878#if defined(CONFIG_OF)
879static struct of_device_id pmc_ids[] = {
880 { .compatible = "atmel,at91rm9200-pmc" },
881 { .compatible = "atmel,at91sam9260-pmc" },
882 { .compatible = "atmel,at91sam9g45-pmc" },
883 { .compatible = "atmel,at91sam9n12-pmc" },
884 { .compatible = "atmel,at91sam9x5-pmc" },
885 { .compatible = "atmel,sama5d3-pmc" },
886 { /*sentinel*/ }
887};
888
889static struct of_device_id osc_ids[] = {
890 { .compatible = "atmel,osc" },
891 { /*sentinel*/ }
892};
893
894int __init at91_dt_clock_init(void)
895{
896 struct device_node *np;
897 u32 main_clock = 0;
898
899 np = of_find_matching_node(NULL, pmc_ids);
900 if (!np)
901 panic("unable to find compatible pmc node in dtb\n");
902
903 at91_pmc_base = of_iomap(np, 0);
904 if (!at91_pmc_base)
905 panic("unable to map pmc cpu registers\n");
906
907 of_node_put(np);
908
909 /* retrieve the freqency of fixed clocks from device tree */
910 np = of_find_matching_node(NULL, osc_ids);
911 if (np) {
912 u32 rate;
913 if (!of_property_read_u32(np, "clock-frequency", &rate))
914 main_clock = rate;
915 }
916
917 of_node_put(np);
918
919 return at91_pmc_init(main_clock);
920}
921#endif
922
923int __init at91_clock_init(unsigned long main_clock)
924{
925 at91_pmc_base = ioremap(AT91_PMC, 256);
926 if (!at91_pmc_base)
927 panic("Impossible to ioremap AT91_PMC 0x%x\n", AT91_PMC);
928
929 return at91_pmc_init(main_clock);
930}
931
932/*
933 * Several unused clocks may be active. Turn them off.
934 */
935static int __init at91_clock_reset(void)
936{
937 unsigned long pcdr = 0;
938 unsigned long pcdr1 = 0;
939 unsigned long scdr = 0;
940 struct clk *clk;
941
942 list_for_each_entry(clk, &clocks, node) {
943 if (clk->users > 0)
944 continue;
945
946 if (clk->mode == pmc_periph_mode) {
947 if (cpu_is_sama5d3()) {
948 u32 pmc_mask = 1 << (clk->pid % 32);
949
950 if (clk->pid > 31)
951 pcdr1 |= pmc_mask;
952 else
953 pcdr |= pmc_mask;
954 } else
955 pcdr |= clk->pmc_mask;
956 }
957
958 if (clk->mode == pmc_sys_mode)
959 scdr |= clk->pmc_mask;
960
961 pr_debug("Clocks: disable unused %s\n", clk->name);
962 }
963
964 at91_pmc_write(AT91_PMC_SCDR, scdr);
965 at91_pmc_write(AT91_PMC_PCDR, pcdr);
966 if (cpu_is_sama5d3())
967 at91_pmc_write(AT91_PMC_PCDR1, pcdr1);
968
969 return 0;
970}
971late_initcall(at91_clock_reset);
972
973void at91sam9_idle(void)
974{
975 at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK);
976 cpu_do_idle();
977}
diff --git a/arch/arm/mach-at91/clock.h b/arch/arm/mach-at91/clock.h
deleted file mode 100644
index a98a39bbd883..000000000000
--- a/arch/arm/mach-at91/clock.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/clock.h
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/clkdev.h>
10
11#define CLK_TYPE_PRIMARY 0x1
12#define CLK_TYPE_PLL 0x2
13#define CLK_TYPE_PROGRAMMABLE 0x4
14#define CLK_TYPE_PERIPHERAL 0x8
15#define CLK_TYPE_SYSTEM 0x10
16
17
18struct clk {
19 struct list_head node;
20 const char *name; /* unique clock name */
21 struct clk_lookup cl;
22 unsigned long rate_hz;
23 unsigned div; /* parent clock divider */
24 struct clk *parent;
25 unsigned pid; /* peripheral ID */
26 u32 pmc_mask;
27 void (*mode)(struct clk *, int);
28 unsigned id:3; /* PCK0..4, or 32k/main/a/b */
29 unsigned type; /* clock type */
30 u16 users;
31};
32
33
34extern int __init clk_register(struct clk *clk);
35extern struct clk mck;
36extern struct clk utmi_clk;
37
38#define CLKDEV_CON_ID(_id, _clk) \
39 { \
40 .con_id = _id, \
41 .clk = _clk, \
42 }
43
44#define CLKDEV_CON_DEV_ID(_con_id, _dev_id, _clk) \
45 { \
46 .con_id = _con_id, \
47 .dev_id = _dev_id, \
48 .clk = _clk, \
49 }
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 81959cf4a137..d53324210adf 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -11,7 +11,6 @@
11#ifndef _AT91_GENERIC_H 11#ifndef _AT91_GENERIC_H
12#define _AT91_GENERIC_H 12#define _AT91_GENERIC_H
13 13
14#include <linux/clkdev.h>
15#include <linux/of.h> 14#include <linux/of.h>
16#include <linux/reboot.h> 15#include <linux/reboot.h>
17 16
@@ -23,71 +22,19 @@ extern void __init at91_init_sram(int bank, unsigned long base,
23 22
24 /* Processors */ 23 /* Processors */
25extern void __init at91rm9200_set_type(int type); 24extern void __init at91rm9200_set_type(int type);
26extern void __init at91_initialize(unsigned long main_clock);
27extern void __init at91x40_initialize(unsigned long main_clock);
28extern void __init at91rm9200_dt_initialize(void); 25extern void __init at91rm9200_dt_initialize(void);
29extern void __init at91_dt_initialize(void); 26extern void __init at91_dt_initialize(void);
30 27
31 /* Interrupts */ 28 /* Interrupts */
32extern void __init at91_init_irq_default(void);
33extern void __init at91_init_interrupts(unsigned int priority[]);
34extern void __init at91x40_init_interrupts(unsigned int priority[]);
35extern void __init at91_aic_init(unsigned int priority[],
36 unsigned int ext_irq_mask);
37extern int __init at91_aic_of_init(struct device_node *node,
38 struct device_node *parent);
39extern int __init at91_aic5_of_init(struct device_node *node,
40 struct device_node *parent);
41extern void __init at91_sysirq_mask_rtc(u32 rtc_base); 29extern void __init at91_sysirq_mask_rtc(u32 rtc_base);
42extern void __init at91_sysirq_mask_rtt(u32 rtt_base); 30extern void __init at91_sysirq_mask_rtt(u32 rtt_base);
43 31
44 /* Devices */
45extern void __init at91_register_devices(void);
46
47 /* Timer */ 32 /* Timer */
48extern void __init at91_init_time(void);
49extern void at91rm9200_ioremap_st(u32 addr);
50extern void at91rm9200_timer_init(void); 33extern void at91rm9200_timer_init(void);
51extern void at91sam926x_ioremap_pit(u32 addr);
52extern void at91sam926x_pit_init(int irq);
53extern void at91x40_timer_init(void);
54
55 /* Clocks */
56#ifdef CONFIG_OLD_CLK_AT91
57extern int __init at91_clock_init(unsigned long main_clock);
58extern int __init at91_dt_clock_init(void);
59#else
60static int inline at91_clock_init(unsigned long main_clock) { return 0; }
61static int inline at91_dt_clock_init(void) { return 0; }
62#endif
63struct device;
64
65 /* Power Management */
66extern void at91_irq_suspend(void);
67extern void at91_irq_resume(void);
68 34
69/* idle */ 35/* idle */
70extern void at91sam9_idle(void); 36extern void at91sam9_idle(void);
71 37
72/* Matrix */ 38/* Matrix */
73extern void at91_ioremap_matrix(u32 base_addr); 39extern void at91_ioremap_matrix(u32 base_addr);
74
75/* Ram Controler */
76extern void at91_ioremap_ramc(int id, u32 addr, u32 size);
77
78 /* GPIO */
79#define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */
80#define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */
81
82struct at91_gpio_bank {
83 unsigned short id; /* peripheral ID */
84 unsigned long regbase; /* offset from system peripheral base */
85};
86extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks);
87extern void __init at91_gpio_irq_setup(void);
88extern int __init at91_gpio_of_irq_setup(struct device_node *node,
89 struct device_node *parent);
90
91extern u32 at91_get_extern_irq(void);
92
93#endif /* _AT91_GENERIC_H */ 40#endif /* _AT91_GENERIC_H */
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
deleted file mode 100644
index d3f05aaad8ba..000000000000
--- a/arch/arm/mach-at91/gpio.c
+++ /dev/null
@@ -1,982 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/gpio.c
3 *
4 * Copyright (C) 2005 HP Labs
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/clk.h>
13#include <linux/errno.h>
14#include <linux/device.h>
15#include <linux/gpio.h>
16#include <linux/interrupt.h>
17#include <linux/irq.h>
18#include <linux/debugfs.h>
19#include <linux/seq_file.h>
20#include <linux/kernel.h>
21#include <linux/list.h>
22#include <linux/module.h>
23#include <linux/io.h>
24#include <linux/irqdomain.h>
25#include <linux/irqchip/chained_irq.h>
26#include <linux/of_address.h>
27
28#include <mach/hardware.h>
29#include <mach/at91_pio.h>
30
31#include "generic.h"
32#include "gpio.h"
33
34#define MAX_NB_GPIO_PER_BANK 32
35
36struct at91_gpio_chip {
37 struct gpio_chip chip;
38 struct at91_gpio_chip *next; /* Bank sharing same clock */
39 int pioc_hwirq; /* PIO bank interrupt identifier on AIC */
40 int pioc_virq; /* PIO bank Linux virtual interrupt */
41 int pioc_idx; /* PIO bank index */
42 void __iomem *regbase; /* PIO bank virtual address */
43 struct clk *clock; /* associated clock */
44 struct irq_domain *domain; /* associated irq domain */
45};
46
47#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip)
48
49static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset);
50static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip);
51static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val);
52static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset);
53static int at91_gpiolib_get_direction(struct gpio_chip *chip, unsigned offset);
54static int at91_gpiolib_direction_output(struct gpio_chip *chip,
55 unsigned offset, int val);
56static int at91_gpiolib_direction_input(struct gpio_chip *chip,
57 unsigned offset);
58static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset);
59
60#define AT91_GPIO_CHIP(name) \
61 { \
62 .chip = { \
63 .label = name, \
64 .request = at91_gpiolib_request, \
65 .get_direction = at91_gpiolib_get_direction, \
66 .direction_input = at91_gpiolib_direction_input, \
67 .direction_output = at91_gpiolib_direction_output, \
68 .get = at91_gpiolib_get, \
69 .set = at91_gpiolib_set, \
70 .dbg_show = at91_gpiolib_dbg_show, \
71 .to_irq = at91_gpiolib_to_irq, \
72 .ngpio = MAX_NB_GPIO_PER_BANK, \
73 }, \
74 }
75
76static struct at91_gpio_chip gpio_chip[] = {
77 AT91_GPIO_CHIP("pioA"),
78 AT91_GPIO_CHIP("pioB"),
79 AT91_GPIO_CHIP("pioC"),
80 AT91_GPIO_CHIP("pioD"),
81 AT91_GPIO_CHIP("pioE"),
82};
83
84static int gpio_banks;
85static unsigned long at91_gpio_caps;
86
87/* All PIO controllers support PIO3 features */
88#define AT91_GPIO_CAP_PIO3 (1 << 0)
89
90#define has_pio3() (at91_gpio_caps & AT91_GPIO_CAP_PIO3)
91
92/*--------------------------------------------------------------------------*/
93
94static inline void __iomem *pin_to_controller(unsigned pin)
95{
96 pin /= MAX_NB_GPIO_PER_BANK;
97 if (likely(pin < gpio_banks))
98 return gpio_chip[pin].regbase;
99
100 return NULL;
101}
102
103static inline unsigned pin_to_mask(unsigned pin)
104{
105 return 1 << (pin % MAX_NB_GPIO_PER_BANK);
106}
107
108
109static char peripheral_function(void __iomem *pio, unsigned mask)
110{
111 char ret = 'X';
112 u8 select;
113
114 if (pio) {
115 if (has_pio3()) {
116 select = !!(__raw_readl(pio + PIO_ABCDSR1) & mask);
117 select |= (!!(__raw_readl(pio + PIO_ABCDSR2) & mask) << 1);
118 ret = 'A' + select;
119 } else {
120 ret = __raw_readl(pio + PIO_ABSR) & mask ?
121 'B' : 'A';
122 }
123 }
124
125 return ret;
126}
127
128/*--------------------------------------------------------------------------*/
129
130/* Not all hardware capabilities are exposed through these calls; they
131 * only encapsulate the most common features and modes. (So if you
132 * want to change signals in groups, do it directly.)
133 *
134 * Bootloaders will usually handle some of the pin multiplexing setup.
135 * The intent is certainly that by the time Linux is fully booted, all
136 * pins should have been fully initialized. These setup calls should
137 * only be used by board setup routines, or possibly in driver probe().
138 *
139 * For bootloaders doing all that setup, these calls could be inlined
140 * as NOPs so Linux won't duplicate any setup code
141 */
142
143
144/*
145 * mux the pin to the "GPIO" peripheral role.
146 */
147int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup)
148{
149 void __iomem *pio = pin_to_controller(pin);
150 unsigned mask = pin_to_mask(pin);
151
152 if (!pio)
153 return -EINVAL;
154 __raw_writel(mask, pio + PIO_IDR);
155 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
156 __raw_writel(mask, pio + PIO_PER);
157 return 0;
158}
159EXPORT_SYMBOL(at91_set_GPIO_periph);
160
161
162/*
163 * mux the pin to the "A" internal peripheral role.
164 */
165int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup)
166{
167 void __iomem *pio = pin_to_controller(pin);
168 unsigned mask = pin_to_mask(pin);
169
170 if (!pio)
171 return -EINVAL;
172
173 __raw_writel(mask, pio + PIO_IDR);
174 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
175 if (has_pio3()) {
176 __raw_writel(__raw_readl(pio + PIO_ABCDSR1) & ~mask,
177 pio + PIO_ABCDSR1);
178 __raw_writel(__raw_readl(pio + PIO_ABCDSR2) & ~mask,
179 pio + PIO_ABCDSR2);
180 } else {
181 __raw_writel(mask, pio + PIO_ASR);
182 }
183 __raw_writel(mask, pio + PIO_PDR);
184 return 0;
185}
186EXPORT_SYMBOL(at91_set_A_periph);
187
188
189/*
190 * mux the pin to the "B" internal peripheral role.
191 */
192int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup)
193{
194 void __iomem *pio = pin_to_controller(pin);
195 unsigned mask = pin_to_mask(pin);
196
197 if (!pio)
198 return -EINVAL;
199
200 __raw_writel(mask, pio + PIO_IDR);
201 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
202 if (has_pio3()) {
203 __raw_writel(__raw_readl(pio + PIO_ABCDSR1) | mask,
204 pio + PIO_ABCDSR1);
205 __raw_writel(__raw_readl(pio + PIO_ABCDSR2) & ~mask,
206 pio + PIO_ABCDSR2);
207 } else {
208 __raw_writel(mask, pio + PIO_BSR);
209 }
210 __raw_writel(mask, pio + PIO_PDR);
211 return 0;
212}
213EXPORT_SYMBOL(at91_set_B_periph);
214
215
216/*
217 * mux the pin to the "C" internal peripheral role.
218 */
219int __init_or_module at91_set_C_periph(unsigned pin, int use_pullup)
220{
221 void __iomem *pio = pin_to_controller(pin);
222 unsigned mask = pin_to_mask(pin);
223
224 if (!pio || !has_pio3())
225 return -EINVAL;
226
227 __raw_writel(mask, pio + PIO_IDR);
228 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
229 __raw_writel(__raw_readl(pio + PIO_ABCDSR1) & ~mask, pio + PIO_ABCDSR1);
230 __raw_writel(__raw_readl(pio + PIO_ABCDSR2) | mask, pio + PIO_ABCDSR2);
231 __raw_writel(mask, pio + PIO_PDR);
232 return 0;
233}
234EXPORT_SYMBOL(at91_set_C_periph);
235
236
237/*
238 * mux the pin to the "D" internal peripheral role.
239 */
240int __init_or_module at91_set_D_periph(unsigned pin, int use_pullup)
241{
242 void __iomem *pio = pin_to_controller(pin);
243 unsigned mask = pin_to_mask(pin);
244
245 if (!pio || !has_pio3())
246 return -EINVAL;
247
248 __raw_writel(mask, pio + PIO_IDR);
249 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
250 __raw_writel(__raw_readl(pio + PIO_ABCDSR1) | mask, pio + PIO_ABCDSR1);
251 __raw_writel(__raw_readl(pio + PIO_ABCDSR2) | mask, pio + PIO_ABCDSR2);
252 __raw_writel(mask, pio + PIO_PDR);
253 return 0;
254}
255EXPORT_SYMBOL(at91_set_D_periph);
256
257
258/*
259 * mux the pin to the gpio controller (instead of "A", "B", "C"
260 * or "D" peripheral), and configure it for an input.
261 */
262int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup)
263{
264 void __iomem *pio = pin_to_controller(pin);
265 unsigned mask = pin_to_mask(pin);
266
267 if (!pio)
268 return -EINVAL;
269
270 __raw_writel(mask, pio + PIO_IDR);
271 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
272 __raw_writel(mask, pio + PIO_ODR);
273 __raw_writel(mask, pio + PIO_PER);
274 return 0;
275}
276EXPORT_SYMBOL(at91_set_gpio_input);
277
278
279/*
280 * mux the pin to the gpio controller (instead of "A", "B", "C"
281 * or "D" peripheral), and configure it for an output.
282 */
283int __init_or_module at91_set_gpio_output(unsigned pin, int value)
284{
285 void __iomem *pio = pin_to_controller(pin);
286 unsigned mask = pin_to_mask(pin);
287
288 if (!pio)
289 return -EINVAL;
290
291 __raw_writel(mask, pio + PIO_IDR);
292 __raw_writel(mask, pio + PIO_PUDR);
293 __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
294 __raw_writel(mask, pio + PIO_OER);
295 __raw_writel(mask, pio + PIO_PER);
296 return 0;
297}
298EXPORT_SYMBOL(at91_set_gpio_output);
299
300
301/*
302 * enable/disable the glitch filter; mostly used with IRQ handling.
303 */
304int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
305{
306 void __iomem *pio = pin_to_controller(pin);
307 unsigned mask = pin_to_mask(pin);
308
309 if (!pio)
310 return -EINVAL;
311
312 if (has_pio3() && is_on)
313 __raw_writel(mask, pio + PIO_IFSCDR);
314 __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
315 return 0;
316}
317EXPORT_SYMBOL(at91_set_deglitch);
318
319/*
320 * enable/disable the debounce filter;
321 */
322int __init_or_module at91_set_debounce(unsigned pin, int is_on, int div)
323{
324 void __iomem *pio = pin_to_controller(pin);
325 unsigned mask = pin_to_mask(pin);
326
327 if (!pio || !has_pio3())
328 return -EINVAL;
329
330 if (is_on) {
331 __raw_writel(mask, pio + PIO_IFSCER);
332 __raw_writel(div & PIO_SCDR_DIV, pio + PIO_SCDR);
333 __raw_writel(mask, pio + PIO_IFER);
334 } else {
335 __raw_writel(mask, pio + PIO_IFDR);
336 }
337 return 0;
338}
339EXPORT_SYMBOL(at91_set_debounce);
340
341/*
342 * enable/disable the multi-driver; This is only valid for output and
343 * allows the output pin to run as an open collector output.
344 */
345int __init_or_module at91_set_multi_drive(unsigned pin, int is_on)
346{
347 void __iomem *pio = pin_to_controller(pin);
348 unsigned mask = pin_to_mask(pin);
349
350 if (!pio)
351 return -EINVAL;
352
353 __raw_writel(mask, pio + (is_on ? PIO_MDER : PIO_MDDR));
354 return 0;
355}
356EXPORT_SYMBOL(at91_set_multi_drive);
357
358/*
359 * enable/disable the pull-down.
360 * If pull-up already enabled while calling the function, we disable it.
361 */
362int __init_or_module at91_set_pulldown(unsigned pin, int is_on)
363{
364 void __iomem *pio = pin_to_controller(pin);
365 unsigned mask = pin_to_mask(pin);
366
367 if (!pio || !has_pio3())
368 return -EINVAL;
369
370 /* Disable pull-up anyway */
371 __raw_writel(mask, pio + PIO_PUDR);
372 __raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR));
373 return 0;
374}
375EXPORT_SYMBOL(at91_set_pulldown);
376
377/*
378 * disable Schmitt trigger
379 */
380int __init_or_module at91_disable_schmitt_trig(unsigned pin)
381{
382 void __iomem *pio = pin_to_controller(pin);
383 unsigned mask = pin_to_mask(pin);
384
385 if (!pio || !has_pio3())
386 return -EINVAL;
387
388 __raw_writel(__raw_readl(pio + PIO_SCHMITT) | mask, pio + PIO_SCHMITT);
389 return 0;
390}
391EXPORT_SYMBOL(at91_disable_schmitt_trig);
392
393/*
394 * assuming the pin is muxed as a gpio output, set its value.
395 */
396int at91_set_gpio_value(unsigned pin, int value)
397{
398 void __iomem *pio = pin_to_controller(pin);
399 unsigned mask = pin_to_mask(pin);
400
401 if (!pio)
402 return -EINVAL;
403 __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
404 return 0;
405}
406EXPORT_SYMBOL(at91_set_gpio_value);
407
408
409/*
410 * read the pin's value (works even if it's not muxed as a gpio).
411 */
412int at91_get_gpio_value(unsigned pin)
413{
414 void __iomem *pio = pin_to_controller(pin);
415 unsigned mask = pin_to_mask(pin);
416 u32 pdsr;
417
418 if (!pio)
419 return -EINVAL;
420 pdsr = __raw_readl(pio + PIO_PDSR);
421 return (pdsr & mask) != 0;
422}
423EXPORT_SYMBOL(at91_get_gpio_value);
424
425/*--------------------------------------------------------------------------*/
426
427#ifdef CONFIG_PM
428
429static u32 wakeups[MAX_GPIO_BANKS];
430static u32 backups[MAX_GPIO_BANKS];
431
432static int gpio_irq_set_wake(struct irq_data *d, unsigned state)
433{
434 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
435 unsigned mask = 1 << d->hwirq;
436 unsigned bank = at91_gpio->pioc_idx;
437
438 if (unlikely(bank >= MAX_GPIO_BANKS))
439 return -EINVAL;
440
441 if (state)
442 wakeups[bank] |= mask;
443 else
444 wakeups[bank] &= ~mask;
445
446 irq_set_irq_wake(at91_gpio->pioc_virq, state);
447
448 return 0;
449}
450
451void at91_gpio_suspend(void)
452{
453 int i;
454
455 for (i = 0; i < gpio_banks; i++) {
456 void __iomem *pio = gpio_chip[i].regbase;
457
458 backups[i] = __raw_readl(pio + PIO_IMR);
459 __raw_writel(backups[i], pio + PIO_IDR);
460 __raw_writel(wakeups[i], pio + PIO_IER);
461
462 if (!wakeups[i]) {
463 clk_unprepare(gpio_chip[i].clock);
464 clk_disable(gpio_chip[i].clock);
465 } else {
466#ifdef CONFIG_PM_DEBUG
467 printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", 'A'+i, wakeups[i]);
468#endif
469 }
470 }
471}
472
473void at91_gpio_resume(void)
474{
475 int i;
476
477 for (i = 0; i < gpio_banks; i++) {
478 void __iomem *pio = gpio_chip[i].regbase;
479
480 if (!wakeups[i]) {
481 if (clk_prepare(gpio_chip[i].clock) == 0)
482 clk_enable(gpio_chip[i].clock);
483 }
484
485 __raw_writel(wakeups[i], pio + PIO_IDR);
486 __raw_writel(backups[i], pio + PIO_IER);
487 }
488}
489
490#else
491#define gpio_irq_set_wake NULL
492#endif
493
494
495/* Several AIC controller irqs are dispatched through this GPIO handler.
496 * To use any AT91_PIN_* as an externally triggered IRQ, first call
497 * at91_set_gpio_input() then maybe enable its glitch filter.
498 * Then just request_irq() with the pin ID; it works like any ARM IRQ
499 * handler.
500 * First implementation always triggers on rising and falling edges
501 * whereas the newer PIO3 can be additionally configured to trigger on
502 * level, edge with any polarity.
503 *
504 * Alternatively, certain pins may be used directly as IRQ0..IRQ6 after
505 * configuring them with at91_set_a_periph() or at91_set_b_periph().
506 * IRQ0..IRQ6 should be configurable, e.g. level vs edge triggering.
507 */
508
509static void gpio_irq_mask(struct irq_data *d)
510{
511 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
512 void __iomem *pio = at91_gpio->regbase;
513 unsigned mask = 1 << d->hwirq;
514
515 if (pio)
516 __raw_writel(mask, pio + PIO_IDR);
517}
518
519static void gpio_irq_unmask(struct irq_data *d)
520{
521 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
522 void __iomem *pio = at91_gpio->regbase;
523 unsigned mask = 1 << d->hwirq;
524
525 if (pio)
526 __raw_writel(mask, pio + PIO_IER);
527}
528
529static int gpio_irq_type(struct irq_data *d, unsigned type)
530{
531 switch (type) {
532 case IRQ_TYPE_NONE:
533 case IRQ_TYPE_EDGE_BOTH:
534 return 0;
535 default:
536 return -EINVAL;
537 }
538}
539
540/* Alternate irq type for PIO3 support */
541static int alt_gpio_irq_type(struct irq_data *d, unsigned type)
542{
543 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
544 void __iomem *pio = at91_gpio->regbase;
545 unsigned mask = 1 << d->hwirq;
546
547 switch (type) {
548 case IRQ_TYPE_EDGE_RISING:
549 __raw_writel(mask, pio + PIO_ESR);
550 __raw_writel(mask, pio + PIO_REHLSR);
551 break;
552 case IRQ_TYPE_EDGE_FALLING:
553 __raw_writel(mask, pio + PIO_ESR);
554 __raw_writel(mask, pio + PIO_FELLSR);
555 break;
556 case IRQ_TYPE_LEVEL_LOW:
557 __raw_writel(mask, pio + PIO_LSR);
558 __raw_writel(mask, pio + PIO_FELLSR);
559 break;
560 case IRQ_TYPE_LEVEL_HIGH:
561 __raw_writel(mask, pio + PIO_LSR);
562 __raw_writel(mask, pio + PIO_REHLSR);
563 break;
564 case IRQ_TYPE_EDGE_BOTH:
565 /*
566 * disable additional interrupt modes:
567 * fall back to default behavior
568 */
569 __raw_writel(mask, pio + PIO_AIMDR);
570 return 0;
571 case IRQ_TYPE_NONE:
572 default:
573 pr_warn("AT91: No type for irq %d\n", gpio_to_irq(d->irq));
574 return -EINVAL;
575 }
576
577 /* enable additional interrupt modes */
578 __raw_writel(mask, pio + PIO_AIMER);
579
580 return 0;
581}
582
583static struct irq_chip gpio_irqchip = {
584 .name = "GPIO",
585 .irq_disable = gpio_irq_mask,
586 .irq_mask = gpio_irq_mask,
587 .irq_unmask = gpio_irq_unmask,
588 /* .irq_set_type is set dynamically */
589 .irq_set_wake = gpio_irq_set_wake,
590};
591
592static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
593{
594 struct irq_chip *chip = irq_desc_get_chip(desc);
595 struct irq_data *idata = irq_desc_get_irq_data(desc);
596 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(idata);
597 void __iomem *pio = at91_gpio->regbase;
598 unsigned long isr;
599 int n;
600
601 chained_irq_enter(chip, desc);
602 for (;;) {
603 /* Reading ISR acks pending (edge triggered) GPIO interrupts.
604 * When there none are pending, we're finished unless we need
605 * to process multiple banks (like ID_PIOCDE on sam9263).
606 */
607 isr = __raw_readl(pio + PIO_ISR) & __raw_readl(pio + PIO_IMR);
608 if (!isr) {
609 if (!at91_gpio->next)
610 break;
611 at91_gpio = at91_gpio->next;
612 pio = at91_gpio->regbase;
613 continue;
614 }
615
616 n = find_first_bit(&isr, BITS_PER_LONG);
617 while (n < BITS_PER_LONG) {
618 generic_handle_irq(irq_find_mapping(at91_gpio->domain, n));
619 n = find_next_bit(&isr, BITS_PER_LONG, n + 1);
620 }
621 }
622 chained_irq_exit(chip, desc);
623 /* now it may re-trigger */
624}
625
626/*--------------------------------------------------------------------------*/
627
628#ifdef CONFIG_DEBUG_FS
629
630static void gpio_printf(struct seq_file *s, void __iomem *pio, unsigned mask)
631{
632 char *trigger = NULL;
633 char *polarity = NULL;
634
635 if (__raw_readl(pio + PIO_IMR) & mask) {
636 if (!has_pio3() || !(__raw_readl(pio + PIO_AIMMR) & mask )) {
637 trigger = "edge";
638 polarity = "both";
639 } else {
640 if (__raw_readl(pio + PIO_ELSR) & mask) {
641 trigger = "level";
642 polarity = __raw_readl(pio + PIO_FRLHSR) & mask ?
643 "high" : "low";
644 } else {
645 trigger = "edge";
646 polarity = __raw_readl(pio + PIO_FRLHSR) & mask ?
647 "rising" : "falling";
648 }
649 }
650 seq_printf(s, "IRQ:%s-%s\t", trigger, polarity);
651 } else {
652 seq_printf(s, "GPIO:%s\t\t",
653 __raw_readl(pio + PIO_PDSR) & mask ? "1" : "0");
654 }
655}
656
657static int at91_gpio_show(struct seq_file *s, void *unused)
658{
659 int bank, j;
660
661 /* print heading */
662 seq_printf(s, "Pin\t");
663 for (bank = 0; bank < gpio_banks; bank++) {
664 seq_printf(s, "PIO%c\t\t", 'A' + bank);
665 };
666 seq_printf(s, "\n\n");
667
668 /* print pin status */
669 for (j = 0; j < 32; j++) {
670 seq_printf(s, "%i:\t", j);
671
672 for (bank = 0; bank < gpio_banks; bank++) {
673 unsigned pin = (32 * bank) + j;
674 void __iomem *pio = pin_to_controller(pin);
675 unsigned mask = pin_to_mask(pin);
676
677 if (__raw_readl(pio + PIO_PSR) & mask)
678 gpio_printf(s, pio, mask);
679 else
680 seq_printf(s, "%c\t\t",
681 peripheral_function(pio, mask));
682 }
683
684 seq_printf(s, "\n");
685 }
686
687 return 0;
688}
689
690static int at91_gpio_open(struct inode *inode, struct file *file)
691{
692 return single_open(file, at91_gpio_show, NULL);
693}
694
695static const struct file_operations at91_gpio_operations = {
696 .open = at91_gpio_open,
697 .read = seq_read,
698 .llseek = seq_lseek,
699 .release = single_release,
700};
701
702static int __init at91_gpio_debugfs_init(void)
703{
704 /* /sys/kernel/debug/at91_gpio */
705 (void) debugfs_create_file("at91_gpio", S_IFREG | S_IRUGO, NULL, NULL, &at91_gpio_operations);
706 return 0;
707}
708postcore_initcall(at91_gpio_debugfs_init);
709
710#endif
711
712/*--------------------------------------------------------------------------*/
713
714/*
715 * This lock class tells lockdep that GPIO irqs are in a different
716 * category than their parents, so it won't report false recursion.
717 */
718static struct lock_class_key gpio_lock_class;
719
720/*
721 * irqdomain initialization: pile up irqdomains on top of AIC range
722 */
723static void __init at91_gpio_irqdomain(struct at91_gpio_chip *at91_gpio)
724{
725 int irq_base;
726
727 irq_base = irq_alloc_descs(-1, 0, at91_gpio->chip.ngpio, 0);
728 if (irq_base < 0)
729 panic("at91_gpio.%d: error %d: couldn't allocate IRQ numbers.\n",
730 at91_gpio->pioc_idx, irq_base);
731 at91_gpio->domain = irq_domain_add_legacy(NULL, at91_gpio->chip.ngpio,
732 irq_base, 0,
733 &irq_domain_simple_ops, NULL);
734 if (!at91_gpio->domain)
735 panic("at91_gpio.%d: couldn't allocate irq domain.\n",
736 at91_gpio->pioc_idx);
737}
738
739/*
740 * Called from the processor-specific init to enable GPIO interrupt support.
741 */
742void __init at91_gpio_irq_setup(void)
743{
744 unsigned pioc;
745 int gpio_irqnbr = 0;
746 struct at91_gpio_chip *this, *prev;
747
748 /* Setup proper .irq_set_type function */
749 if (has_pio3())
750 gpio_irqchip.irq_set_type = alt_gpio_irq_type;
751 else
752 gpio_irqchip.irq_set_type = gpio_irq_type;
753
754 for (pioc = 0, this = gpio_chip, prev = NULL;
755 pioc++ < gpio_banks;
756 prev = this, this++) {
757 int offset;
758
759 __raw_writel(~0, this->regbase + PIO_IDR);
760
761 /* setup irq domain for this GPIO controller */
762 at91_gpio_irqdomain(this);
763
764 for (offset = 0; offset < this->chip.ngpio; offset++) {
765 unsigned int virq = irq_find_mapping(this->domain, offset);
766 irq_set_lockdep_class(virq, &gpio_lock_class);
767
768 /*
769 * Can use the "simple" and not "edge" handler since it's
770 * shorter, and the AIC handles interrupts sanely.
771 */
772 irq_set_chip_and_handler(virq, &gpio_irqchip,
773 handle_simple_irq);
774 set_irq_flags(virq, IRQF_VALID);
775 irq_set_chip_data(virq, this);
776
777 gpio_irqnbr++;
778 }
779
780 /* The toplevel handler handles one bank of GPIOs, except
781 * on some SoC it can handles up to three...
782 * We only set up the handler for the first of the list.
783 */
784 if (prev && prev->next == this)
785 continue;
786
787 this->pioc_virq = irq_create_mapping(NULL, this->pioc_hwirq);
788 irq_set_chip_data(this->pioc_virq, this);
789 irq_set_chained_handler(this->pioc_virq, gpio_irq_handler);
790 }
791 pr_info("AT91: %d gpio irqs in %d banks\n", gpio_irqnbr, gpio_banks);
792}
793
794/* gpiolib support */
795static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset)
796{
797 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
798 void __iomem *pio = at91_gpio->regbase;
799 unsigned mask = 1 << offset;
800
801 __raw_writel(mask, pio + PIO_PER);
802 return 0;
803}
804
805static int at91_gpiolib_get_direction(struct gpio_chip *chip, unsigned offset)
806{
807 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
808 void __iomem *pio = at91_gpio->regbase;
809 unsigned mask = 1 << offset;
810 u32 osr;
811
812 osr = __raw_readl(pio + PIO_OSR);
813 return !(osr & mask);
814}
815
816static int at91_gpiolib_direction_input(struct gpio_chip *chip,
817 unsigned offset)
818{
819 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
820 void __iomem *pio = at91_gpio->regbase;
821 unsigned mask = 1 << offset;
822
823 __raw_writel(mask, pio + PIO_ODR);
824 return 0;
825}
826
827static int at91_gpiolib_direction_output(struct gpio_chip *chip,
828 unsigned offset, int val)
829{
830 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
831 void __iomem *pio = at91_gpio->regbase;
832 unsigned mask = 1 << offset;
833
834 __raw_writel(mask, pio + (val ? PIO_SODR : PIO_CODR));
835 __raw_writel(mask, pio + PIO_OER);
836 return 0;
837}
838
839static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset)
840{
841 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
842 void __iomem *pio = at91_gpio->regbase;
843 unsigned mask = 1 << offset;
844 u32 pdsr;
845
846 pdsr = __raw_readl(pio + PIO_PDSR);
847 return (pdsr & mask) != 0;
848}
849
850static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val)
851{
852 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
853 void __iomem *pio = at91_gpio->regbase;
854 unsigned mask = 1 << offset;
855
856 __raw_writel(mask, pio + (val ? PIO_SODR : PIO_CODR));
857}
858
859static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
860{
861 int i;
862
863 for (i = 0; i < chip->ngpio; i++) {
864 unsigned pin = chip->base + i;
865 void __iomem *pio = pin_to_controller(pin);
866 unsigned mask = pin_to_mask(pin);
867 const char *gpio_label;
868
869 gpio_label = gpiochip_is_requested(chip, i);
870 if (gpio_label) {
871 seq_printf(s, "[%s] GPIO%s%d: ",
872 gpio_label, chip->label, i);
873 if (__raw_readl(pio + PIO_PSR) & mask)
874 seq_printf(s, "[gpio] %s\n",
875 at91_get_gpio_value(pin) ?
876 "set" : "clear");
877 else
878 seq_printf(s, "[periph %c]\n",
879 peripheral_function(pio, mask));
880 }
881 }
882}
883
884static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset)
885{
886 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
887 int virq;
888
889 if (offset < chip->ngpio)
890 virq = irq_create_mapping(at91_gpio->domain, offset);
891 else
892 virq = -ENXIO;
893
894 dev_dbg(chip->dev, "%s: request IRQ for GPIO %d, return %d\n",
895 chip->label, offset + chip->base, virq);
896 return virq;
897}
898
899static int __init at91_gpio_setup_clk(int idx)
900{
901 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx];
902
903 /* retreive PIO controller's clock */
904 at91_gpio->clock = clk_get_sys(NULL, at91_gpio->chip.label);
905 if (IS_ERR(at91_gpio->clock)) {
906 pr_err("at91_gpio.%d, failed to get clock, ignoring.\n", idx);
907 goto err;
908 }
909
910 if (clk_prepare(at91_gpio->clock))
911 goto clk_prep_err;
912
913 /* enable PIO controller's clock */
914 if (clk_enable(at91_gpio->clock)) {
915 pr_err("at91_gpio.%d, failed to enable clock, ignoring.\n", idx);
916 goto clk_err;
917 }
918
919 return 0;
920
921clk_err:
922 clk_unprepare(at91_gpio->clock);
923clk_prep_err:
924 clk_put(at91_gpio->clock);
925err:
926 return -EINVAL;
927}
928
929static void __init at91_gpio_init_one(int idx, u32 regbase, int pioc_hwirq)
930{
931 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx];
932
933 at91_gpio->chip.base = idx * MAX_NB_GPIO_PER_BANK;
934 at91_gpio->pioc_hwirq = pioc_hwirq;
935 at91_gpio->pioc_idx = idx;
936
937 at91_gpio->regbase = ioremap(regbase, 512);
938 if (!at91_gpio->regbase) {
939 pr_err("at91_gpio.%d, failed to map registers, ignoring.\n", idx);
940 return;
941 }
942
943 if (at91_gpio_setup_clk(idx))
944 goto ioremap_err;
945
946 gpio_banks = max(gpio_banks, idx + 1);
947 return;
948
949ioremap_err:
950 iounmap(at91_gpio->regbase);
951}
952
953/*
954 * Called from the processor-specific init to enable GPIO pin support.
955 */
956void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
957{
958 unsigned i;
959 struct at91_gpio_chip *at91_gpio, *last = NULL;
960
961 BUG_ON(nr_banks > MAX_GPIO_BANKS);
962
963 if (of_have_populated_dt())
964 return;
965
966 for (i = 0; i < nr_banks; i++)
967 at91_gpio_init_one(i, data[i].regbase, data[i].id);
968
969 for (i = 0; i < gpio_banks; i++) {
970 at91_gpio = &gpio_chip[i];
971
972 /*
973 * GPIO controller are grouped on some SoC:
974 * PIOC, PIOD and PIOE can share the same IRQ line
975 */
976 if (last && last->pioc_hwirq == at91_gpio->pioc_hwirq)
977 last->next = at91_gpio;
978 last = at91_gpio;
979
980 gpiochip_add(&at91_gpio->chip);
981 }
982}
diff --git a/arch/arm/mach-at91/gpio.h b/arch/arm/mach-at91/gpio.h
deleted file mode 100644
index eed465ab0dd7..000000000000
--- a/arch/arm/mach-at91/gpio.h
+++ /dev/null
@@ -1,214 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/gpio.h
3 *
4 * Copyright (C) 2005 HP Labs
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#ifndef __ASM_ARCH_AT91RM9200_GPIO_H
14#define __ASM_ARCH_AT91RM9200_GPIO_H
15
16#include <linux/kernel.h>
17#include <asm/irq.h>
18
19#define MAX_GPIO_BANKS 5
20#define NR_BUILTIN_GPIO (MAX_GPIO_BANKS * 32)
21
22/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
23
24#define AT91_PIN_PA0 (0x00 + 0)
25#define AT91_PIN_PA1 (0x00 + 1)
26#define AT91_PIN_PA2 (0x00 + 2)
27#define AT91_PIN_PA3 (0x00 + 3)
28#define AT91_PIN_PA4 (0x00 + 4)
29#define AT91_PIN_PA5 (0x00 + 5)
30#define AT91_PIN_PA6 (0x00 + 6)
31#define AT91_PIN_PA7 (0x00 + 7)
32#define AT91_PIN_PA8 (0x00 + 8)
33#define AT91_PIN_PA9 (0x00 + 9)
34#define AT91_PIN_PA10 (0x00 + 10)
35#define AT91_PIN_PA11 (0x00 + 11)
36#define AT91_PIN_PA12 (0x00 + 12)
37#define AT91_PIN_PA13 (0x00 + 13)
38#define AT91_PIN_PA14 (0x00 + 14)
39#define AT91_PIN_PA15 (0x00 + 15)
40#define AT91_PIN_PA16 (0x00 + 16)
41#define AT91_PIN_PA17 (0x00 + 17)
42#define AT91_PIN_PA18 (0x00 + 18)
43#define AT91_PIN_PA19 (0x00 + 19)
44#define AT91_PIN_PA20 (0x00 + 20)
45#define AT91_PIN_PA21 (0x00 + 21)
46#define AT91_PIN_PA22 (0x00 + 22)
47#define AT91_PIN_PA23 (0x00 + 23)
48#define AT91_PIN_PA24 (0x00 + 24)
49#define AT91_PIN_PA25 (0x00 + 25)
50#define AT91_PIN_PA26 (0x00 + 26)
51#define AT91_PIN_PA27 (0x00 + 27)
52#define AT91_PIN_PA28 (0x00 + 28)
53#define AT91_PIN_PA29 (0x00 + 29)
54#define AT91_PIN_PA30 (0x00 + 30)
55#define AT91_PIN_PA31 (0x00 + 31)
56
57#define AT91_PIN_PB0 (0x20 + 0)
58#define AT91_PIN_PB1 (0x20 + 1)
59#define AT91_PIN_PB2 (0x20 + 2)
60#define AT91_PIN_PB3 (0x20 + 3)
61#define AT91_PIN_PB4 (0x20 + 4)
62#define AT91_PIN_PB5 (0x20 + 5)
63#define AT91_PIN_PB6 (0x20 + 6)
64#define AT91_PIN_PB7 (0x20 + 7)
65#define AT91_PIN_PB8 (0x20 + 8)
66#define AT91_PIN_PB9 (0x20 + 9)
67#define AT91_PIN_PB10 (0x20 + 10)
68#define AT91_PIN_PB11 (0x20 + 11)
69#define AT91_PIN_PB12 (0x20 + 12)
70#define AT91_PIN_PB13 (0x20 + 13)
71#define AT91_PIN_PB14 (0x20 + 14)
72#define AT91_PIN_PB15 (0x20 + 15)
73#define AT91_PIN_PB16 (0x20 + 16)
74#define AT91_PIN_PB17 (0x20 + 17)
75#define AT91_PIN_PB18 (0x20 + 18)
76#define AT91_PIN_PB19 (0x20 + 19)
77#define AT91_PIN_PB20 (0x20 + 20)
78#define AT91_PIN_PB21 (0x20 + 21)
79#define AT91_PIN_PB22 (0x20 + 22)
80#define AT91_PIN_PB23 (0x20 + 23)
81#define AT91_PIN_PB24 (0x20 + 24)
82#define AT91_PIN_PB25 (0x20 + 25)
83#define AT91_PIN_PB26 (0x20 + 26)
84#define AT91_PIN_PB27 (0x20 + 27)
85#define AT91_PIN_PB28 (0x20 + 28)
86#define AT91_PIN_PB29 (0x20 + 29)
87#define AT91_PIN_PB30 (0x20 + 30)
88#define AT91_PIN_PB31 (0x20 + 31)
89
90#define AT91_PIN_PC0 (0x40 + 0)
91#define AT91_PIN_PC1 (0x40 + 1)
92#define AT91_PIN_PC2 (0x40 + 2)
93#define AT91_PIN_PC3 (0x40 + 3)
94#define AT91_PIN_PC4 (0x40 + 4)
95#define AT91_PIN_PC5 (0x40 + 5)
96#define AT91_PIN_PC6 (0x40 + 6)
97#define AT91_PIN_PC7 (0x40 + 7)
98#define AT91_PIN_PC8 (0x40 + 8)
99#define AT91_PIN_PC9 (0x40 + 9)
100#define AT91_PIN_PC10 (0x40 + 10)
101#define AT91_PIN_PC11 (0x40 + 11)
102#define AT91_PIN_PC12 (0x40 + 12)
103#define AT91_PIN_PC13 (0x40 + 13)
104#define AT91_PIN_PC14 (0x40 + 14)
105#define AT91_PIN_PC15 (0x40 + 15)
106#define AT91_PIN_PC16 (0x40 + 16)
107#define AT91_PIN_PC17 (0x40 + 17)
108#define AT91_PIN_PC18 (0x40 + 18)
109#define AT91_PIN_PC19 (0x40 + 19)
110#define AT91_PIN_PC20 (0x40 + 20)
111#define AT91_PIN_PC21 (0x40 + 21)
112#define AT91_PIN_PC22 (0x40 + 22)
113#define AT91_PIN_PC23 (0x40 + 23)
114#define AT91_PIN_PC24 (0x40 + 24)
115#define AT91_PIN_PC25 (0x40 + 25)
116#define AT91_PIN_PC26 (0x40 + 26)
117#define AT91_PIN_PC27 (0x40 + 27)
118#define AT91_PIN_PC28 (0x40 + 28)
119#define AT91_PIN_PC29 (0x40 + 29)
120#define AT91_PIN_PC30 (0x40 + 30)
121#define AT91_PIN_PC31 (0x40 + 31)
122
123#define AT91_PIN_PD0 (0x60 + 0)
124#define AT91_PIN_PD1 (0x60 + 1)
125#define AT91_PIN_PD2 (0x60 + 2)
126#define AT91_PIN_PD3 (0x60 + 3)
127#define AT91_PIN_PD4 (0x60 + 4)
128#define AT91_PIN_PD5 (0x60 + 5)
129#define AT91_PIN_PD6 (0x60 + 6)
130#define AT91_PIN_PD7 (0x60 + 7)
131#define AT91_PIN_PD8 (0x60 + 8)
132#define AT91_PIN_PD9 (0x60 + 9)
133#define AT91_PIN_PD10 (0x60 + 10)
134#define AT91_PIN_PD11 (0x60 + 11)
135#define AT91_PIN_PD12 (0x60 + 12)
136#define AT91_PIN_PD13 (0x60 + 13)
137#define AT91_PIN_PD14 (0x60 + 14)
138#define AT91_PIN_PD15 (0x60 + 15)
139#define AT91_PIN_PD16 (0x60 + 16)
140#define AT91_PIN_PD17 (0x60 + 17)
141#define AT91_PIN_PD18 (0x60 + 18)
142#define AT91_PIN_PD19 (0x60 + 19)
143#define AT91_PIN_PD20 (0x60 + 20)
144#define AT91_PIN_PD21 (0x60 + 21)
145#define AT91_PIN_PD22 (0x60 + 22)
146#define AT91_PIN_PD23 (0x60 + 23)
147#define AT91_PIN_PD24 (0x60 + 24)
148#define AT91_PIN_PD25 (0x60 + 25)
149#define AT91_PIN_PD26 (0x60 + 26)
150#define AT91_PIN_PD27 (0x60 + 27)
151#define AT91_PIN_PD28 (0x60 + 28)
152#define AT91_PIN_PD29 (0x60 + 29)
153#define AT91_PIN_PD30 (0x60 + 30)
154#define AT91_PIN_PD31 (0x60 + 31)
155
156#define AT91_PIN_PE0 (0x80 + 0)
157#define AT91_PIN_PE1 (0x80 + 1)
158#define AT91_PIN_PE2 (0x80 + 2)
159#define AT91_PIN_PE3 (0x80 + 3)
160#define AT91_PIN_PE4 (0x80 + 4)
161#define AT91_PIN_PE5 (0x80 + 5)
162#define AT91_PIN_PE6 (0x80 + 6)
163#define AT91_PIN_PE7 (0x80 + 7)
164#define AT91_PIN_PE8 (0x80 + 8)
165#define AT91_PIN_PE9 (0x80 + 9)
166#define AT91_PIN_PE10 (0x80 + 10)
167#define AT91_PIN_PE11 (0x80 + 11)
168#define AT91_PIN_PE12 (0x80 + 12)
169#define AT91_PIN_PE13 (0x80 + 13)
170#define AT91_PIN_PE14 (0x80 + 14)
171#define AT91_PIN_PE15 (0x80 + 15)
172#define AT91_PIN_PE16 (0x80 + 16)
173#define AT91_PIN_PE17 (0x80 + 17)
174#define AT91_PIN_PE18 (0x80 + 18)
175#define AT91_PIN_PE19 (0x80 + 19)
176#define AT91_PIN_PE20 (0x80 + 20)
177#define AT91_PIN_PE21 (0x80 + 21)
178#define AT91_PIN_PE22 (0x80 + 22)
179#define AT91_PIN_PE23 (0x80 + 23)
180#define AT91_PIN_PE24 (0x80 + 24)
181#define AT91_PIN_PE25 (0x80 + 25)
182#define AT91_PIN_PE26 (0x80 + 26)
183#define AT91_PIN_PE27 (0x80 + 27)
184#define AT91_PIN_PE28 (0x80 + 28)
185#define AT91_PIN_PE29 (0x80 + 29)
186#define AT91_PIN_PE30 (0x80 + 30)
187#define AT91_PIN_PE31 (0x80 + 31)
188
189#ifndef __ASSEMBLY__
190/* setup setup routines, called from board init or driver probe() */
191extern int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup);
192extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup);
193extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup);
194extern int __init_or_module at91_set_C_periph(unsigned pin, int use_pullup);
195extern int __init_or_module at91_set_D_periph(unsigned pin, int use_pullup);
196extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup);
197extern int __init_or_module at91_set_gpio_output(unsigned pin, int value);
198extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on);
199extern int __init_or_module at91_set_debounce(unsigned pin, int is_on, int div);
200extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on);
201extern int __init_or_module at91_set_pulldown(unsigned pin, int is_on);
202extern int __init_or_module at91_disable_schmitt_trig(unsigned pin);
203
204/* callable at any time */
205extern int at91_set_gpio_value(unsigned pin, int value);
206extern int at91_get_gpio_value(unsigned pin);
207
208/* callable only from core power-management code */
209extern void at91_gpio_suspend(void);
210extern void at91_gpio_resume(void);
211
212#endif /* __ASSEMBLY__ */
213
214#endif
diff --git a/arch/arm/mach-at91/gsia18s.h b/arch/arm/mach-at91/gsia18s.h
deleted file mode 100644
index 307c194926f9..000000000000
--- a/arch/arm/mach-at91/gsia18s.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* Buttons */
2#define GPIO_TRIG_NET_IN AT91_PIN_PB21
3#define GPIO_CARD_UNMOUNT_0 AT91_PIN_PB13
4#define GPIO_CARD_UNMOUNT_1 AT91_PIN_PB12
5#define GPIO_KEY_POWER AT91_PIN_PA25
6
7/* PCF8574 0x20 GPIO - U1 on the GS_IA18-CB_V3 board */
8#define GS_IA18_S_PCF_GPIO_BASE0 NR_BUILTIN_GPIO
9#define PCF_GPIO_HDC_POWER (GS_IA18_S_PCF_GPIO_BASE0 + 0)
10#define PCF_GPIO_WIFI_SETUP (GS_IA18_S_PCF_GPIO_BASE0 + 1)
11#define PCF_GPIO_WIFI_ENABLE (GS_IA18_S_PCF_GPIO_BASE0 + 2)
12#define PCF_GPIO_WIFI_RESET (GS_IA18_S_PCF_GPIO_BASE0 + 3)
13#define PCF_GPIO_ETH_DETECT 4 /* this is a GPI */
14#define PCF_GPIO_GPS_SETUP (GS_IA18_S_PCF_GPIO_BASE0 + 5)
15#define PCF_GPIO_GPS_STANDBY (GS_IA18_S_PCF_GPIO_BASE0 + 6)
16#define PCF_GPIO_GPS_POWER (GS_IA18_S_PCF_GPIO_BASE0 + 7)
17
18/* PCF8574 0x22 GPIO - U1 on the GS_2G_OPT1-A_V0 board (Alarm) */
19#define GS_IA18_S_PCF_GPIO_BASE1 (GS_IA18_S_PCF_GPIO_BASE0 + 8)
20#define PCF_GPIO_ALARM1 (GS_IA18_S_PCF_GPIO_BASE1 + 0)
21#define PCF_GPIO_ALARM2 (GS_IA18_S_PCF_GPIO_BASE1 + 1)
22#define PCF_GPIO_ALARM3 (GS_IA18_S_PCF_GPIO_BASE1 + 2)
23#define PCF_GPIO_ALARM4 (GS_IA18_S_PCF_GPIO_BASE1 + 3)
24/* bits 4, 5, 6 not used */
25#define PCF_GPIO_ALARM_V_RELAY_ON (GS_IA18_S_PCF_GPIO_BASE1 + 7)
26
27/* PCF8574 0x24 GPIO U1 on the GS_2G-OPT23-A_V0 board (Modem) */
28#define GS_IA18_S_PCF_GPIO_BASE2 (GS_IA18_S_PCF_GPIO_BASE1 + 8)
29#define PCF_GPIO_MODEM_POWER (GS_IA18_S_PCF_GPIO_BASE2 + 0)
30#define PCF_GPIO_MODEM_RESET (GS_IA18_S_PCF_GPIO_BASE2 + 3)
31/* bits 1, 2, 4, 5 not used */
32#define PCF_GPIO_TRX_RESET (GS_IA18_S_PCF_GPIO_BASE2 + 6)
33/* bit 7 not used */
diff --git a/arch/arm/mach-at91/include/mach/at91_dbgu.h b/arch/arm/mach-at91/include/mach/at91_dbgu.h
index 3b5948566e52..42925e8f78e4 100644
--- a/arch/arm/mach-at91/include/mach/at91_dbgu.h
+++ b/arch/arm/mach-at91/include/mach/at91_dbgu.h
@@ -16,7 +16,6 @@
16#ifndef AT91_DBGU_H 16#ifndef AT91_DBGU_H
17#define AT91_DBGU_H 17#define AT91_DBGU_H
18 18
19#if !defined(CONFIG_ARCH_AT91X40)
20#define AT91_DBGU_CR (0x00) /* Control Register */ 19#define AT91_DBGU_CR (0x00) /* Control Register */
21#define AT91_DBGU_MR (0x04) /* Mode Register */ 20#define AT91_DBGU_MR (0x04) /* Mode Register */
22#define AT91_DBGU_IER (0x08) /* Interrupt Enable Register */ 21#define AT91_DBGU_IER (0x08) /* Interrupt Enable Register */
@@ -34,8 +33,6 @@
34#define AT91_DBGU_FNR (0x48) /* Force NTRST Register [SAM9 only] */ 33#define AT91_DBGU_FNR (0x48) /* Force NTRST Register [SAM9 only] */
35#define AT91_DBGU_FNTRST (1 << 0) /* Force NTRST */ 34#define AT91_DBGU_FNTRST (1 << 0) /* Force NTRST */
36 35
37#endif /* AT91_DBGU */
38
39/* 36/*
40 * Some AT91 parts that don't have full DEBUG units still support the ID 37 * Some AT91 parts that don't have full DEBUG units still support the ID
41 * and extensions register. 38 * and extensions register.
diff --git a/arch/arm/mach-at91/include/mach/at91_ramc.h b/arch/arm/mach-at91/include/mach/at91_ramc.h
index d8aeb278614e..e4492b151fee 100644
--- a/arch/arm/mach-at91/include/mach/at91_ramc.h
+++ b/arch/arm/mach-at91/include/mach/at91_ramc.h
@@ -25,8 +25,8 @@ extern void __iomem *at91_ramc_base[];
25#define AT91_MEMCTRL_SDRAMC 1 25#define AT91_MEMCTRL_SDRAMC 1
26#define AT91_MEMCTRL_DDRSDR 2 26#define AT91_MEMCTRL_DDRSDR 2
27 27
28#include <mach/at91rm9200_sdramc.h> 28#include <soc/at91/at91rm9200_sdramc.h>
29#include <mach/at91sam9_ddrsdr.h> 29#include <soc/at91/at91sam9_ddrsdr.h>
30#include <mach/at91sam9_sdramc.h> 30#include <soc/at91/at91sam9_sdramc.h>
31 31
32#endif /* __AT91_RAMC_H__ */ 32#endif /* __AT91_RAMC_H__ */
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h b/arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h
deleted file mode 100644
index aa047f458f1b..000000000000
--- a/arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Memory Controllers (SDRAMC only) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
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 AT91RM9200_SDRAMC_H
17#define AT91RM9200_SDRAMC_H
18
19/* SDRAM Controller registers */
20#define AT91RM9200_SDRAMC_MR 0x90 /* Mode Register */
21#define AT91RM9200_SDRAMC_MODE (0xf << 0) /* Command Mode */
22#define AT91RM9200_SDRAMC_MODE_NORMAL (0 << 0)
23#define AT91RM9200_SDRAMC_MODE_NOP (1 << 0)
24#define AT91RM9200_SDRAMC_MODE_PRECHARGE (2 << 0)
25#define AT91RM9200_SDRAMC_MODE_LMR (3 << 0)
26#define AT91RM9200_SDRAMC_MODE_REFRESH (4 << 0)
27#define AT91RM9200_SDRAMC_DBW (1 << 4) /* Data Bus Width */
28#define AT91RM9200_SDRAMC_DBW_32 (0 << 4)
29#define AT91RM9200_SDRAMC_DBW_16 (1 << 4)
30
31#define AT91RM9200_SDRAMC_TR 0x94 /* Refresh Timer Register */
32#define AT91RM9200_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Count */
33
34#define AT91RM9200_SDRAMC_CR 0x98 /* Configuration Register */
35#define AT91RM9200_SDRAMC_NC (3 << 0) /* Number of Column Bits */
36#define AT91RM9200_SDRAMC_NC_8 (0 << 0)
37#define AT91RM9200_SDRAMC_NC_9 (1 << 0)
38#define AT91RM9200_SDRAMC_NC_10 (2 << 0)
39#define AT91RM9200_SDRAMC_NC_11 (3 << 0)
40#define AT91RM9200_SDRAMC_NR (3 << 2) /* Number of Row Bits */
41#define AT91RM9200_SDRAMC_NR_11 (0 << 2)
42#define AT91RM9200_SDRAMC_NR_12 (1 << 2)
43#define AT91RM9200_SDRAMC_NR_13 (2 << 2)
44#define AT91RM9200_SDRAMC_NB (1 << 4) /* Number of Banks */
45#define AT91RM9200_SDRAMC_NB_2 (0 << 4)
46#define AT91RM9200_SDRAMC_NB_4 (1 << 4)
47#define AT91RM9200_SDRAMC_CAS (3 << 5) /* CAS Latency */
48#define AT91RM9200_SDRAMC_CAS_2 (2 << 5)
49#define AT91RM9200_SDRAMC_TWR (0xf << 7) /* Write Recovery Delay */
50#define AT91RM9200_SDRAMC_TRC (0xf << 11) /* Row Cycle Delay */
51#define AT91RM9200_SDRAMC_TRP (0xf << 15) /* Row Precharge Delay */
52#define AT91RM9200_SDRAMC_TRCD (0xf << 19) /* Row to Column Delay */
53#define AT91RM9200_SDRAMC_TRAS (0xf << 23) /* Active to Precharge Delay */
54#define AT91RM9200_SDRAMC_TXSR (0xf << 27) /* Exit Self Refresh to Active Delay */
55
56#define AT91RM9200_SDRAMC_SRR 0x9c /* Self Refresh Register */
57#define AT91RM9200_SDRAMC_LPR 0xa0 /* Low Power Register */
58#define AT91RM9200_SDRAMC_IER 0xa4 /* Interrupt Enable Register */
59#define AT91RM9200_SDRAMC_IDR 0xa8 /* Interrupt Disable Register */
60#define AT91RM9200_SDRAMC_IMR 0xac /* Interrupt Mask Register */
61#define AT91RM9200_SDRAMC_ISR 0xb0 /* Interrupt Status Register */
62
63#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
deleted file mode 100644
index 0210797abf2e..000000000000
--- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * Header file for the Atmel DDR/SDR SDRAM Controller
3 *
4 * Copyright (C) 2010 Atmel Corporation
5 * Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12#ifndef AT91SAM9_DDRSDR_H
13#define AT91SAM9_DDRSDR_H
14
15#define AT91_DDRSDRC_MR 0x00 /* Mode Register */
16#define AT91_DDRSDRC_MODE (0x7 << 0) /* Command Mode */
17#define AT91_DDRSDRC_MODE_NORMAL 0
18#define AT91_DDRSDRC_MODE_NOP 1
19#define AT91_DDRSDRC_MODE_PRECHARGE 2
20#define AT91_DDRSDRC_MODE_LMR 3
21#define AT91_DDRSDRC_MODE_REFRESH 4
22#define AT91_DDRSDRC_MODE_EXT_LMR 5
23#define AT91_DDRSDRC_MODE_DEEP 6
24
25#define AT91_DDRSDRC_RTR 0x04 /* Refresh Timer Register */
26#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */
27
28#define AT91_DDRSDRC_CR 0x08 /* Configuration Register */
29#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */
30#define AT91_DDRSDRC_NC_SDR8 (0 << 0)
31#define AT91_DDRSDRC_NC_SDR9 (1 << 0)
32#define AT91_DDRSDRC_NC_SDR10 (2 << 0)
33#define AT91_DDRSDRC_NC_SDR11 (3 << 0)
34#define AT91_DDRSDRC_NC_DDR9 (0 << 0)
35#define AT91_DDRSDRC_NC_DDR10 (1 << 0)
36#define AT91_DDRSDRC_NC_DDR11 (2 << 0)
37#define AT91_DDRSDRC_NC_DDR12 (3 << 0)
38#define AT91_DDRSDRC_NR (3 << 2) /* Number of Row Bits */
39#define AT91_DDRSDRC_NR_11 (0 << 2)
40#define AT91_DDRSDRC_NR_12 (1 << 2)
41#define AT91_DDRSDRC_NR_13 (2 << 2)
42#define AT91_DDRSDRC_NR_14 (3 << 2)
43#define AT91_DDRSDRC_CAS (7 << 4) /* CAS Latency */
44#define AT91_DDRSDRC_CAS_2 (2 << 4)
45#define AT91_DDRSDRC_CAS_3 (3 << 4)
46#define AT91_DDRSDRC_CAS_25 (6 << 4)
47#define AT91_DDRSDRC_RST_DLL (1 << 7) /* Reset DLL */
48#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */
49#define AT91_DDRSDRC_DIS_DLL (1 << 9) /* Disable DLL [SAM9 Only] */
50#define AT91_DDRSDRC_OCD (1 << 12) /* Off-Chip Driver [SAM9 Only] */
51#define AT91_DDRSDRC_DQMS (1 << 16) /* Mask Data is Shared [SAM9 Only] */
52#define AT91_DDRSDRC_ACTBST (1 << 18) /* Active Bank X to Burst Stop Read Access Bank Y [SAM9 Only] */
53
54#define AT91_DDRSDRC_T0PR 0x0C /* Timing 0 Register */
55#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */
56#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */
57#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */
58#define AT91_DDRSDRC_TRC (0xf << 12) /* Row cycle delay */
59#define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */
60#define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */
61#define AT91_DDRSDRC_TWTR (0x7 << 24) /* Internal Write to Read delay */
62#define AT91_DDRSDRC_RED_WRRD (0x1 << 27) /* Reduce Write to Read Delay [SAM9 Only] */
63#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
64
65#define AT91_DDRSDRC_T1PR 0x10 /* Timing 1 Register */
66#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */
67#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */
68#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */
69#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */
70
71#define AT91_DDRSDRC_T2PR 0x14 /* Timing 2 Register [SAM9 Only] */
72#define AT91_DDRSDRC_TXARD (0xf << 0) /* Exit active power down delay to read command in mode "Fast Exit" */
73#define AT91_DDRSDRC_TXARDS (0xf << 4) /* Exit active power down delay to read command in mode "Slow Exit" */
74#define AT91_DDRSDRC_TRPA (0xf << 8) /* Row Precharge All delay */
75#define AT91_DDRSDRC_TRTP (0x7 << 12) /* Read to Precharge delay */
76
77#define AT91_DDRSDRC_LPR 0x1C /* Low Power Register */
78#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
79#define AT91_DDRSDRC_LPCB_DISABLE 0
80#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
81#define AT91_DDRSDRC_LPCB_POWER_DOWN 2
82#define AT91_DDRSDRC_LPCB_DEEP_POWER_DOWN 3
83#define AT91_DDRSDRC_CLKFR (1 << 2) /* Clock Frozen */
84#define AT91_DDRSDRC_PASR (7 << 4) /* Partial Array Self Refresh */
85#define AT91_DDRSDRC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
86#define AT91_DDRSDRC_DS (3 << 10) /* Drive Strength */
87#define AT91_DDRSDRC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
88#define AT91_DDRSDRC_TIMEOUT_0_CLK_CYCLES (0 << 12)
89#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12)
90#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12)
91#define AT91_DDRSDRC_APDE (1 << 16) /* Active power down exit time */
92#define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */
93
94#define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */
95#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
96#define AT91_DDRSDRC_MD_SDR 0
97#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
98#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
99#define AT91_DDRSDRC_MD_DDR2 6 /* [SAM9 Only] */
100#define AT91_DDRSDRC_DBW (1 << 4) /* Data Bus Width */
101#define AT91_DDRSDRC_DBW_32BITS (0 << 4)
102#define AT91_DDRSDRC_DBW_16BITS (1 << 4)
103
104#define AT91_DDRSDRC_DLL 0x24 /* DLL Information Register */
105#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
106#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
107#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
108#define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */
109
110#define AT91_DDRSDRC_HS 0x2C /* High Speed Register [SAM9 Only] */
111#define AT91_DDRSDRC_DIS_ATCP_RD (1 << 2) /* Anticip read access is disabled */
112
113#define AT91_DDRSDRC_DELAY(n) (0x30 + (0x4 * (n))) /* Delay I/O Register n */
114
115#define AT91_DDRSDRC_WPMR 0xE4 /* Write Protect Mode Register [SAM9 Only] */
116#define AT91_DDRSDRC_WP (1 << 0) /* Write protect enable */
117#define AT91_DDRSDRC_WPKEY (0xffffff << 8) /* Write protect key */
118#define AT91_DDRSDRC_KEY (0x444452 << 8) /* Write protect key = "DDR" */
119
120#define AT91_DDRSDRC_WPSR 0xE8 /* Write Protect Status Register [SAM9 Only] */
121#define AT91_DDRSDRC_WPVS (1 << 0) /* Write protect violation status */
122#define AT91_DDRSDRC_WPVSRC (0xffff << 8) /* Write protect violation source */
123
124#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
deleted file mode 100644
index 3d085a9a7450..000000000000
--- a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
7 * SDRAM Controllers (SDRAMC) - System peripherals registers.
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 AT91SAM9_SDRAMC_H
17#define AT91SAM9_SDRAMC_H
18
19/* SDRAM Controller (SDRAMC) registers */
20#define AT91_SDRAMC_MR 0x00 /* SDRAM Controller Mode Register */
21#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
22#define AT91_SDRAMC_MODE_NORMAL 0
23#define AT91_SDRAMC_MODE_NOP 1
24#define AT91_SDRAMC_MODE_PRECHARGE 2
25#define AT91_SDRAMC_MODE_LMR 3
26#define AT91_SDRAMC_MODE_REFRESH 4
27#define AT91_SDRAMC_MODE_EXT_LMR 5
28#define AT91_SDRAMC_MODE_DEEP 6
29
30#define AT91_SDRAMC_TR 0x04 /* SDRAM Controller Refresh Timer Register */
31#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */
32
33#define AT91_SDRAMC_CR 0x08 /* SDRAM Controller Configuration Register */
34#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
35#define AT91_SDRAMC_NC_8 (0 << 0)
36#define AT91_SDRAMC_NC_9 (1 << 0)
37#define AT91_SDRAMC_NC_10 (2 << 0)
38#define AT91_SDRAMC_NC_11 (3 << 0)
39#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
40#define AT91_SDRAMC_NR_11 (0 << 2)
41#define AT91_SDRAMC_NR_12 (1 << 2)
42#define AT91_SDRAMC_NR_13 (2 << 2)
43#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
44#define AT91_SDRAMC_NB_2 (0 << 4)
45#define AT91_SDRAMC_NB_4 (1 << 4)
46#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
47#define AT91_SDRAMC_CAS_1 (1 << 5)
48#define AT91_SDRAMC_CAS_2 (2 << 5)
49#define AT91_SDRAMC_CAS_3 (3 << 5)
50#define AT91_SDRAMC_DBW (1 << 7) /* Data Bus Width */
51#define AT91_SDRAMC_DBW_32 (0 << 7)
52#define AT91_SDRAMC_DBW_16 (1 << 7)
53#define AT91_SDRAMC_TWR (0xf << 8) /* Write Recovery Delay */
54#define AT91_SDRAMC_TRC (0xf << 12) /* Row Cycle Delay */
55#define AT91_SDRAMC_TRP (0xf << 16) /* Row Precharge Delay */
56#define AT91_SDRAMC_TRCD (0xf << 20) /* Row to Column Delay */
57#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */
58#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */
59
60#define AT91_SDRAMC_LPR 0x10 /* SDRAM Controller Low Power Register */
61#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */
62#define AT91_SDRAMC_LPCB_DISABLE 0
63#define AT91_SDRAMC_LPCB_SELF_REFRESH 1
64#define AT91_SDRAMC_LPCB_POWER_DOWN 2
65#define AT91_SDRAMC_LPCB_DEEP_POWER_DOWN 3
66#define AT91_SDRAMC_PASR (7 << 4) /* Partial Array Self Refresh */
67#define AT91_SDRAMC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
68#define AT91_SDRAMC_DS (3 << 10) /* Drive Strength */
69#define AT91_SDRAMC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
70#define AT91_SDRAMC_TIMEOUT_0_CLK_CYCLES (0 << 12)
71#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12)
72#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12)
73
74#define AT91_SDRAMC_IER 0x14 /* SDRAM Controller Interrupt Enable Register */
75#define AT91_SDRAMC_IDR 0x18 /* SDRAM Controller Interrupt Disable Register */
76#define AT91_SDRAMC_IMR 0x1C /* SDRAM Controller Interrupt Mask Register */
77#define AT91_SDRAMC_ISR 0x20 /* SDRAM Controller Interrupt Status Register */
78#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */
79
80#define AT91_SDRAMC_MDR 0x24 /* SDRAM Memory Device Register */
81#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */
82#define AT91_SDRAMC_MD_SDRAM 0
83#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
84
85#endif
diff --git a/arch/arm/mach-at91/include/mach/at91x40.h b/arch/arm/mach-at91/include/mach/at91x40.h
deleted file mode 100644
index 38dca2bb027f..000000000000
--- a/arch/arm/mach-at91/include/mach/at91x40.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91x40.h
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef AT91X40_H
13#define AT91X40_H
14
15/*
16 * IRQ list.
17 */
18#define AT91X40_ID_USART0 2 /* USART port 0 */
19#define AT91X40_ID_USART1 3 /* USART port 1 */
20#define AT91X40_ID_TC0 4 /* Timer/Counter 0 */
21#define AT91X40_ID_TC1 5 /* Timer/Counter 1*/
22#define AT91X40_ID_TC2 6 /* Timer/Counter 2*/
23#define AT91X40_ID_WD 7 /* Watchdog? */
24#define AT91X40_ID_PIOA 8 /* Parallel IO Controller A */
25
26#define AT91X40_ID_IRQ0 16 /* External IRQ 0 */
27#define AT91X40_ID_IRQ1 17 /* External IRQ 1 */
28#define AT91X40_ID_IRQ2 18 /* External IRQ 2 */
29
30/*
31 * System Peripherals
32 */
33#define AT91_BASE_SYS 0xffc00000
34
35#define AT91_EBI 0xffe00000 /* External Bus Interface */
36#define AT91_SF 0xfff00000 /* Special Function */
37#define AT91_USART1 0xfffcc000 /* USART 1 */
38#define AT91_USART0 0xfffd0000 /* USART 0 */
39#define AT91_TC 0xfffe0000 /* Timer Counter */
40#define AT91_PIOA 0xffff0000 /* PIO Controller A */
41#define AT91_PS 0xffff4000 /* Power Save */
42#define AT91_WD 0xffff8000 /* Watchdog Timer */
43
44/*
45 * The AT91x40 series doesn't have a debug unit like the other AT91 parts.
46 * But it does have a chip identify register and extension ID, so define at
47 * least these here.
48 */
49#define AT91_DBGU_CIDR (AT91_SF + 0) /* CIDR in PS segment */
50#define AT91_DBGU_EXID (AT91_SF + 4) /* EXID in PS segment */
51
52/*
53 * Support defines for the simple Power Controller module.
54 */
55#define AT91_PS_CR (AT91_PS + 0) /* PS Control register */
56#define AT91_PS_CR_CPU (1 << 0) /* CPU clock disable bit */
57
58#define AT91X40_MASTER_CLOCK 40000000
59
60#endif /* AT91X40_H */
diff --git a/arch/arm/mach-at91/include/mach/atmel-mci.h b/arch/arm/mach-at91/include/mach/atmel-mci.h
deleted file mode 100644
index 3069e4135573..000000000000
--- a/arch/arm/mach-at91/include/mach/atmel-mci.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __MACH_ATMEL_MCI_H
2#define __MACH_ATMEL_MCI_H
3
4#include <linux/platform_data/dma-atmel.h>
5
6/**
7 * struct mci_dma_data - DMA data for MCI interface
8 */
9struct mci_dma_data {
10 struct at_dma_slave sdata;
11};
12
13/* accessor macros */
14#define slave_data_ptr(s) (&(s)->sdata)
15#define find_slave_dev(s) ((s)->sdata.dma_dev)
16
17#endif /* __MACH_ATMEL_MCI_H */
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index b27e9ca65653..61914fb35f5d 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -62,7 +62,6 @@
62#define ARCH_EXID_SAMA5D43 0x00000003 62#define ARCH_EXID_SAMA5D43 0x00000003
63#define ARCH_EXID_SAMA5D44 0x00000004 63#define ARCH_EXID_SAMA5D44 0x00000004
64 64
65#define ARCH_FAMILY_AT91X92 0x09200000
66#define ARCH_FAMILY_AT91SAM9 0x01900000 65#define ARCH_FAMILY_AT91SAM9 0x01900000
67#define ARCH_FAMILY_AT91SAM9XE 0x02900000 66#define ARCH_FAMILY_AT91SAM9XE 0x02900000
68 67
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index c13797352688..cacbaa52418f 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -24,9 +24,6 @@
24/* sama5d4 */ 24/* sama5d4 */
25#define AT91_BASE_DBGU2 0xfc069000 25#define AT91_BASE_DBGU2 0xfc069000
26 26
27#if defined(CONFIG_ARCH_AT91X40)
28#include <mach/at91x40.h>
29#else
30#include <mach/at91rm9200.h> 27#include <mach/at91rm9200.h>
31#include <mach/at91sam9260.h> 28#include <mach/at91sam9260.h>
32#include <mach/at91sam9261.h> 29#include <mach/at91sam9261.h>
@@ -51,8 +48,6 @@
51 */ 48 */
52#define AT91_BASE_SYS 0xffffc000 49#define AT91_BASE_SYS 0xffffc000
53 50
54#endif
55
56/* 51/*
57 * On sama5d4 there is no system controller, we map some needed peripherals 52 * On sama5d4 there is no system controller, we map some needed peripherals
58 */ 53 */
@@ -132,13 +127,8 @@
132 * called as part of the generic suspend/resume path. 127 * called as part of the generic suspend/resume path.
133 */ 128 */
134#ifndef __ASSEMBLY__ 129#ifndef __ASSEMBLY__
135#ifdef CONFIG_PINCTRL_AT91
136extern void at91_pinctrl_gpio_suspend(void); 130extern void at91_pinctrl_gpio_suspend(void);
137extern void at91_pinctrl_gpio_resume(void); 131extern void at91_pinctrl_gpio_resume(void);
138#else
139static inline void at91_pinctrl_gpio_suspend(void) {}
140static inline void at91_pinctrl_gpio_resume(void) {}
141#endif
142#endif 132#endif
143 133
144#endif 134#endif
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h
index acb2d890ad7e..4ebb609369e3 100644
--- a/arch/arm/mach-at91/include/mach/uncompress.h
+++ b/arch/arm/mach-at91/include/mach/uncompress.h
@@ -31,7 +31,6 @@
31 31
32void __iomem *at91_uart; 32void __iomem *at91_uart;
33 33
34#if !defined(CONFIG_ARCH_AT91X40)
35static const u32 uarts_rm9200[] = { 34static const u32 uarts_rm9200[] = {
36 AT91_BASE_DBGU0, 35 AT91_BASE_DBGU0,
37 AT91RM9200_BASE_US0, 36 AT91RM9200_BASE_US0,
@@ -188,12 +187,6 @@ static inline void arch_decomp_setup(void)
188 187
189 at91_uart = NULL; 188 at91_uart = NULL;
190} 189}
191#else
192static inline void arch_decomp_setup(void)
193{
194 at91_uart = NULL;
195}
196#endif
197 190
198/* 191/*
199 * The following code assumes the serial port has already been 192 * The following code assumes the serial port has already been
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
deleted file mode 100644
index cdb3ec9efd2b..000000000000
--- a/arch/arm/mach-at91/irq.c
+++ /dev/null
@@ -1,296 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/irq.c
3 *
4 * Copyright (C) 2004 SAN People
5 * Copyright (C) 2004 ATMEL
6 * Copyright (C) Rick Bronson
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/mm.h>
26#include <linux/bitmap.h>
27#include <linux/types.h>
28#include <linux/irq.h>
29#include <linux/of.h>
30#include <linux/of_address.h>
31#include <linux/of_irq.h>
32#include <linux/irqdomain.h>
33#include <linux/err.h>
34#include <linux/slab.h>
35
36#include <mach/hardware.h>
37#include <asm/irq.h>
38#include <asm/setup.h>
39
40#include <asm/exception.h>
41#include <asm/mach/arch.h>
42#include <asm/mach/irq.h>
43#include <asm/mach/map.h>
44
45#include "at91_aic.h"
46
47void __iomem *at91_aic_base;
48static struct irq_domain *at91_aic_domain;
49static struct device_node *at91_aic_np;
50static unsigned int n_irqs = NR_AIC_IRQS;
51
52#ifdef CONFIG_PM
53
54static unsigned long *wakeups;
55static unsigned long *backups;
56
57#define set_backup(bit) set_bit(bit, backups)
58#define clear_backup(bit) clear_bit(bit, backups)
59
60static int at91_aic_pm_init(void)
61{
62 backups = kzalloc(BITS_TO_LONGS(n_irqs) * sizeof(*backups), GFP_KERNEL);
63 if (!backups)
64 return -ENOMEM;
65
66 wakeups = kzalloc(BITS_TO_LONGS(n_irqs) * sizeof(*backups), GFP_KERNEL);
67 if (!wakeups) {
68 kfree(backups);
69 return -ENOMEM;
70 }
71
72 return 0;
73}
74
75static int at91_aic_set_wake(struct irq_data *d, unsigned value)
76{
77 if (unlikely(d->hwirq >= n_irqs))
78 return -EINVAL;
79
80 if (value)
81 set_bit(d->hwirq, wakeups);
82 else
83 clear_bit(d->hwirq, wakeups);
84
85 return 0;
86}
87
88void at91_irq_suspend(void)
89{
90 at91_aic_write(AT91_AIC_IDCR, *backups);
91 at91_aic_write(AT91_AIC_IECR, *wakeups);
92}
93
94void at91_irq_resume(void)
95{
96 at91_aic_write(AT91_AIC_IDCR, *wakeups);
97 at91_aic_write(AT91_AIC_IECR, *backups);
98}
99
100#else
101static inline int at91_aic_pm_init(void)
102{
103 return 0;
104}
105
106#define set_backup(bit)
107#define clear_backup(bit)
108#define at91_aic_set_wake NULL
109
110#endif /* CONFIG_PM */
111
112asmlinkage void __exception_irq_entry
113at91_aic_handle_irq(struct pt_regs *regs)
114{
115 u32 irqnr;
116 u32 irqstat;
117
118 irqnr = at91_aic_read(AT91_AIC_IVR);
119 irqstat = at91_aic_read(AT91_AIC_ISR);
120
121 /*
122 * ISR value is 0 when there is no current interrupt or when there is
123 * a spurious interrupt
124 */
125 if (!irqstat)
126 at91_aic_write(AT91_AIC_EOICR, 0);
127 else
128 handle_IRQ(irqnr, regs);
129}
130
131static void at91_aic_mask_irq(struct irq_data *d)
132{
133 /* Disable interrupt on AIC */
134 at91_aic_write(AT91_AIC_IDCR, 1 << d->hwirq);
135 /* Update ISR cache */
136 clear_backup(d->hwirq);
137}
138
139static void at91_aic_unmask_irq(struct irq_data *d)
140{
141 /* Enable interrupt on AIC */
142 at91_aic_write(AT91_AIC_IECR, 1 << d->hwirq);
143 /* Update ISR cache */
144 set_backup(d->hwirq);
145}
146
147static void at91_aic_eoi(struct irq_data *d)
148{
149 /*
150 * Mark end-of-interrupt on AIC, the controller doesn't care about
151 * the value written. Moreover it's a write-only register.
152 */
153 at91_aic_write(AT91_AIC_EOICR, 0);
154}
155
156static unsigned long *at91_extern_irq;
157
158u32 at91_get_extern_irq(void)
159{
160 if (!at91_extern_irq)
161 return 0;
162 return *at91_extern_irq;
163}
164
165#define is_extern_irq(hwirq) test_bit(hwirq, at91_extern_irq)
166
167static int at91_aic_compute_srctype(struct irq_data *d, unsigned type)
168{
169 int srctype;
170
171 switch (type) {
172 case IRQ_TYPE_LEVEL_HIGH:
173 srctype = AT91_AIC_SRCTYPE_HIGH;
174 break;
175 case IRQ_TYPE_EDGE_RISING:
176 srctype = AT91_AIC_SRCTYPE_RISING;
177 break;
178 case IRQ_TYPE_LEVEL_LOW:
179 if ((d->hwirq == AT91_ID_FIQ) || is_extern_irq(d->hwirq)) /* only supported on external interrupts */
180 srctype = AT91_AIC_SRCTYPE_LOW;
181 else
182 srctype = -EINVAL;
183 break;
184 case IRQ_TYPE_EDGE_FALLING:
185 if ((d->hwirq == AT91_ID_FIQ) || is_extern_irq(d->hwirq)) /* only supported on external interrupts */
186 srctype = AT91_AIC_SRCTYPE_FALLING;
187 else
188 srctype = -EINVAL;
189 break;
190 default:
191 srctype = -EINVAL;
192 }
193
194 return srctype;
195}
196
197static int at91_aic_set_type(struct irq_data *d, unsigned type)
198{
199 unsigned int smr;
200 int srctype;
201
202 srctype = at91_aic_compute_srctype(d, type);
203 if (srctype < 0)
204 return srctype;
205
206 smr = at91_aic_read(AT91_AIC_SMR(d->hwirq)) & ~AT91_AIC_SRCTYPE;
207 at91_aic_write(AT91_AIC_SMR(d->hwirq), smr | srctype);
208
209 return 0;
210}
211
212static struct irq_chip at91_aic_chip = {
213 .name = "AIC",
214 .irq_mask = at91_aic_mask_irq,
215 .irq_unmask = at91_aic_unmask_irq,
216 .irq_set_type = at91_aic_set_type,
217 .irq_set_wake = at91_aic_set_wake,
218 .irq_eoi = at91_aic_eoi,
219};
220
221static void __init at91_aic_hw_init(unsigned int spu_vector)
222{
223 int i;
224
225 /*
226 * Perform 8 End Of Interrupt Command to make sure AIC
227 * will not Lock out nIRQ
228 */
229 for (i = 0; i < 8; i++)
230 at91_aic_write(AT91_AIC_EOICR, 0);
231
232 /*
233 * Spurious Interrupt ID in Spurious Vector Register.
234 * When there is no current interrupt, the IRQ Vector Register
235 * reads the value stored in AIC_SPU
236 */
237 at91_aic_write(AT91_AIC_SPU, spu_vector);
238
239 /* No debugging in AIC: Debug (Protect) Control Register */
240 at91_aic_write(AT91_AIC_DCR, 0);
241
242 /* Disable and clear all interrupts initially */
243 at91_aic_write(AT91_AIC_IDCR, 0xFFFFFFFF);
244 at91_aic_write(AT91_AIC_ICCR, 0xFFFFFFFF);
245}
246
247/*
248 * Initialize the AIC interrupt controller.
249 */
250void __init at91_aic_init(unsigned int *priority, unsigned int ext_irq_mask)
251{
252 unsigned int i;
253 int irq_base;
254
255 at91_extern_irq = kzalloc(BITS_TO_LONGS(n_irqs)
256 * sizeof(*at91_extern_irq), GFP_KERNEL);
257
258 if (at91_aic_pm_init() || at91_extern_irq == NULL)
259 panic("Unable to allocate bit maps\n");
260
261 *at91_extern_irq = ext_irq_mask;
262
263 at91_aic_base = ioremap(AT91_AIC, 512);
264 if (!at91_aic_base)
265 panic("Unable to ioremap AIC registers\n");
266
267 /* Add irq domain for AIC */
268 irq_base = irq_alloc_descs(-1, 0, n_irqs, 0);
269 if (irq_base < 0) {
270 WARN(1, "Cannot allocate irq_descs, assuming pre-allocated\n");
271 irq_base = 0;
272 }
273 at91_aic_domain = irq_domain_add_legacy(at91_aic_np, n_irqs,
274 irq_base, 0,
275 &irq_domain_simple_ops, NULL);
276
277 if (!at91_aic_domain)
278 panic("Unable to add AIC irq domain\n");
279
280 irq_set_default_host(at91_aic_domain);
281
282 /*
283 * The IVR is used by macro get_irqnr_and_base to read and verify.
284 * The irq number is NR_AIC_IRQS when a spurious interrupt has occurred.
285 */
286 for (i = 0; i < n_irqs; i++) {
287 /* Put hardware irq number in Source Vector Register: */
288 at91_aic_write(AT91_AIC_SVR(i), NR_IRQS_LEGACY + i);
289 /* Active Low interrupt, with the specified priority */
290 at91_aic_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]);
291 irq_set_chip_and_handler(NR_IRQS_LEGACY + i, &at91_aic_chip, handle_fasteoi_irq);
292 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
293 }
294
295 at91_aic_hw_init(n_irqs);
296}
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
deleted file mode 100644
index eb22e3357e87..000000000000
--- a/arch/arm/mach-at91/leds.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * LED driver for Atmel AT91-based boards.
3 *
4 * Copyright (C) SAN People (Pty) Ltd
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10*/
11
12#include <linux/gpio.h>
13#include <linux/kernel.h>
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17
18#include "board.h"
19#include "gpio.h"
20
21
22/* ------------------------------------------------------------------------- */
23
24#if defined(CONFIG_NEW_LEDS)
25
26/*
27 * New cross-platform LED support.
28 */
29
30static struct gpio_led_platform_data led_data;
31
32static struct platform_device at91_gpio_leds_device = {
33 .name = "leds-gpio",
34 .id = -1,
35 .dev.platform_data = &led_data,
36};
37
38void __init at91_gpio_leds(struct gpio_led *leds, int nr)
39{
40 int i;
41
42 if (!nr)
43 return;
44
45 for (i = 0; i < nr; i++)
46 at91_set_gpio_output(leds[i].gpio, leds[i].active_low);
47
48 led_data.leds = leds;
49 led_data.num_leds = nr;
50 platform_device_register(&at91_gpio_leds_device);
51}
52
53#else
54void __init at91_gpio_leds(struct gpio_led *leds, int nr) {}
55#endif
56
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 4073ab7f38f3..9b15169a1c62 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -29,10 +29,8 @@
29#include <mach/cpu.h> 29#include <mach/cpu.h>
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31 31
32#include "at91_aic.h"
33#include "generic.h" 32#include "generic.h"
34#include "pm.h" 33#include "pm.h"
35#include "gpio.h"
36 34
37static void (*at91_pm_standby)(void); 35static void (*at91_pm_standby)(void);
38 36
@@ -131,23 +129,7 @@ extern u32 at91_slow_clock_sz;
131 129
132static int at91_pm_enter(suspend_state_t state) 130static int at91_pm_enter(suspend_state_t state)
133{ 131{
134 if (of_have_populated_dt()) 132 at91_pinctrl_gpio_suspend();
135 at91_pinctrl_gpio_suspend();
136 else
137 at91_gpio_suspend();
138
139 if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base) {
140 at91_irq_suspend();
141
142 pr_debug("AT91: PM - wake mask %08x, pm state %d\n",
143 /* remember all the always-wake irqs */
144 (at91_pmc_read(AT91_PMC_PCSR)
145 | (1 << AT91_ID_FIQ)
146 | (1 << AT91_ID_SYS)
147 | (at91_get_extern_irq()))
148 & at91_aic_read(AT91_AIC_IMR),
149 state);
150 }
151 133
152 switch (state) { 134 switch (state) {
153 /* 135 /*
@@ -212,21 +194,10 @@ static int at91_pm_enter(suspend_state_t state)
212 goto error; 194 goto error;
213 } 195 }
214 196
215 if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base)
216 pr_debug("AT91: PM - wakeup %08x\n",
217 at91_aic_read(AT91_AIC_IPR) &
218 at91_aic_read(AT91_AIC_IMR));
219
220error: 197error:
221 target_state = PM_SUSPEND_ON; 198 target_state = PM_SUSPEND_ON;
222 199
223 if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base) 200 at91_pinctrl_gpio_resume();
224 at91_irq_resume();
225
226 if (of_have_populated_dt())
227 at91_pinctrl_gpio_resume();
228 else
229 at91_gpio_resume();
230 return 0; 201 return 0;
231} 202}
232 203
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index c5101dcb4fb0..d2c89963af2d 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -14,7 +14,6 @@
14#include <asm/proc-fns.h> 14#include <asm/proc-fns.h>
15 15
16#include <mach/at91_ramc.h> 16#include <mach/at91_ramc.h>
17#include <mach/at91rm9200_sdramc.h>
18 17
19#ifdef CONFIG_PM 18#ifdef CONFIG_PM
20extern void at91_pm_set_standby(void (*at91_standby)(void)); 19extern void at91_pm_set_standby(void (*at91_standby)(void));
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 961079250b83..ce25e85720fb 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -42,35 +42,9 @@ void __init at91rm9200_set_type(int type)
42 at91_get_soc_subtype(&at91_soc_initdata)); 42 at91_get_soc_subtype(&at91_soc_initdata));
43} 43}
44 44
45void __init at91_init_irq_default(void)
46{
47 at91_init_interrupts(at91_boot_soc.default_irq_priority);
48}
49
50void __init at91_init_interrupts(unsigned int *priority)
51{
52 /* Initialize the AIC interrupt controller */
53 if (IS_ENABLED(CONFIG_OLD_IRQ_AT91))
54 at91_aic_init(priority, at91_boot_soc.extern_irq);
55
56 /* Enable GPIO interrupts */
57 at91_gpio_irq_setup();
58}
59
60void __iomem *at91_ramc_base[2]; 45void __iomem *at91_ramc_base[2];
61EXPORT_SYMBOL_GPL(at91_ramc_base); 46EXPORT_SYMBOL_GPL(at91_ramc_base);
62 47
63void __init at91_ioremap_ramc(int id, u32 addr, u32 size)
64{
65 if (id < 0 || id > 1) {
66 pr_emerg("Wrong RAM controller id (%d), cannot continue\n", id);
67 BUG();
68 }
69 at91_ramc_base[id] = ioremap(addr, size);
70 if (!at91_ramc_base[id])
71 panic(pr_fmt("Impossible to ioremap ramc.%d 0x%x\n"), id, addr);
72}
73
74static struct map_desc sram_desc[2] __initdata; 48static struct map_desc sram_desc[2] __initdata;
75 49
76void __init at91_init_sram(int bank, unsigned long base, unsigned int length) 50void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
@@ -418,7 +392,6 @@ void __init at91_ioremap_matrix(u32 base_addr)
418 panic(pr_fmt("Impossible to ioremap at91_matrix_base\n")); 392 panic(pr_fmt("Impossible to ioremap at91_matrix_base\n"));
419} 393}
420 394
421#if defined(CONFIG_OF) && !defined(CONFIG_ARCH_AT91X40)
422static struct of_device_id ramc_ids[] = { 395static struct of_device_id ramc_ids[] = {
423 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, 396 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
424 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, 397 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
@@ -460,13 +433,6 @@ void __init at91rm9200_dt_initialize(void)
460{ 433{
461 at91_dt_ramc(); 434 at91_dt_ramc();
462 435
463 /* Init clock subsystem */
464 at91_dt_clock_init();
465
466 /* Register the processor-specific clocks */
467 if (at91_boot_soc.register_clocks)
468 at91_boot_soc.register_clocks();
469
470 at91_boot_soc.init(); 436 at91_boot_soc.init();
471} 437}
472 438
@@ -474,39 +440,6 @@ void __init at91_dt_initialize(void)
474{ 440{
475 at91_dt_ramc(); 441 at91_dt_ramc();
476 442
477 /* Init clock subsystem */
478 at91_dt_clock_init();
479
480 /* Register the processor-specific clocks */
481 if (at91_boot_soc.register_clocks)
482 at91_boot_soc.register_clocks();
483
484 if (at91_boot_soc.init) 443 if (at91_boot_soc.init)
485 at91_boot_soc.init(); 444 at91_boot_soc.init();
486} 445}
487#endif
488
489void __init at91_initialize(unsigned long main_clock)
490{
491 at91_boot_soc.ioremap_registers();
492
493 /* Init clock subsystem */
494 at91_clock_init(main_clock);
495
496 /* Register the processor-specific clocks */
497 at91_boot_soc.register_clocks();
498
499 at91_boot_soc.init();
500
501 pinctrl_provide_dummies();
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 9a8fd97a8bef..ae6c0b2f1146 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -6,14 +6,8 @@
6 6
7struct at91_init_soc { 7struct at91_init_soc {
8 int builtin; 8 int builtin;
9 u32 extern_irq;
10 unsigned int *default_irq_priority;
11 void (*map_io)(void); 9 void (*map_io)(void);
12 void (*ioremap_registers)(void);
13 void (*register_clocks)(void);
14 void (*register_devices)(void);
15 void (*init)(void); 10 void (*init)(void);
16 void (*init_time)(void);
17}; 11};
18 12
19extern struct at91_init_soc at91_boot_soc; 13extern struct at91_init_soc at91_boot_soc;
diff --git a/arch/arm/mach-at91/stamp9g20.h b/arch/arm/mach-at91/stamp9g20.h
deleted file mode 100644
index f62c0abca4b4..000000000000
--- a/arch/arm/mach-at91/stamp9g20.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __MACH_STAMP9G20_H
2#define __MACH_STAMP9G20_H
3
4void stamp9g20_init_early(void);
5void stamp9g20_board_init(void);
6
7#endif
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 2abad742516d..aaeec78c3ec4 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -5,8 +5,56 @@ menuconfig ARCH_BCM
5 5
6if ARCH_BCM 6if ARCH_BCM
7 7
8comment "IPROC architected SoCs"
9
10config ARCH_BCM_IPROC
11 bool
12 select ARM_GIC
13 select CACHE_L2X0
14 select HAVE_ARM_SCU if SMP
15 select HAVE_ARM_TWD if SMP
16 select ARM_GLOBAL_TIMER
17
18 select CLKSRC_MMIO
19 select ARCH_REQUIRE_GPIOLIB
20 select ARM_AMBA
21 select PINCTRL
22 help
23 This enables support for systems based on Broadcom IPROC architected SoCs.
24 The IPROC complex contains one or more ARM CPUs along with common
25 core periperals. Application specific SoCs are created by adding a
26 uArchitecture containing peripherals outside of the IPROC complex.
27 Currently supported SoCs are Cygnus.
28
29config ARCH_BCM_CYGNUS
30 bool "Broadcom Cygnus Support" if ARCH_MULTI_V7
31 select ARCH_BCM_IPROC
32 help
33 Enable support for the Cygnus family,
34 which includes the following variants:
35 BCM11300, BCM11320, BCM11350, BCM11360,
36 BCM58300, BCM58302, BCM58303, BCM58305.
37
38config ARCH_BCM_5301X
39 bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7
40 select ARCH_BCM_IPROC
41 help
42 Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores.
43
44 This is a network SoC line mostly used in home routers and
45 wifi access points, it's internal name is Northstar.
46 This inclused the following SoC: BCM53010, BCM53011, BCM53012,
47 BCM53014, BCM53015, BCM53016, BCM53017, BCM53018, BCM4707,
48 BCM4708 and BCM4709.
49
50 Do not confuse this with the BCM4760 which is a totally
51 different SoC or with the older BCM47XX and BCM53XX based
52 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx
53
54comment "KONA architected SoCs"
55
8config ARCH_BCM_MOBILE 56config ARCH_BCM_MOBILE
9 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7 57 bool
10 select ARCH_REQUIRE_GPIOLIB 58 select ARCH_REQUIRE_GPIOLIB
11 select ARM_ERRATA_754322 59 select ARM_ERRATA_754322
12 select ARM_ERRATA_775420 60 select ARM_ERRATA_775420
@@ -15,16 +63,13 @@ config ARCH_BCM_MOBILE
15 select TICK_ONESHOT 63 select TICK_ONESHOT
16 select HAVE_ARM_ARCH_TIMER 64 select HAVE_ARM_ARCH_TIMER
17 select PINCTRL 65 select PINCTRL
66 select ARCH_BCM_MOBILE_SMP if SMP
18 help 67 help
19 This enables support for systems based on Broadcom mobile SoCs. 68 This enables support for systems based on Broadcom mobile SoCs.
20 69
21if ARCH_BCM_MOBILE
22
23menu "Broadcom Mobile SoC Selection"
24
25config ARCH_BCM_281XX 70config ARCH_BCM_281XX
26 bool "Broadcom BCM281XX SoC family" 71 bool "Broadcom BCM281XX SoC family"
27 default y 72 select ARCH_BCM_MOBILE
28 select HAVE_SMP 73 select HAVE_SMP
29 help 74 help
30 Enable support for the BCM281XX family, which includes 75 Enable support for the BCM281XX family, which includes
@@ -33,7 +78,7 @@ config ARCH_BCM_281XX
33 78
34config ARCH_BCM_21664 79config ARCH_BCM_21664
35 bool "Broadcom BCM21664 SoC family" 80 bool "Broadcom BCM21664 SoC family"
36 default y 81 select ARCH_BCM_MOBILE
37 select HAVE_SMP 82 select HAVE_SMP
38 help 83 help
39 Enable support for the BCM21664 family, which includes 84 Enable support for the BCM21664 family, which includes
@@ -41,19 +86,18 @@ config ARCH_BCM_21664
41 86
42config ARCH_BCM_MOBILE_L2_CACHE 87config ARCH_BCM_MOBILE_L2_CACHE
43 bool "Broadcom mobile SoC level 2 cache support" 88 bool "Broadcom mobile SoC level 2 cache support"
44 depends on (ARCH_BCM_281XX || ARCH_BCM_21664) 89 depends on ARCH_BCM_MOBILE
45 default y 90 default y
46 select CACHE_L2X0 91 select CACHE_L2X0
47 select ARCH_BCM_MOBILE_SMC 92 select ARCH_BCM_MOBILE_SMC
48 93
49config ARCH_BCM_MOBILE_SMC 94config ARCH_BCM_MOBILE_SMC
50 bool 95 bool
51 depends on ARCH_BCM_281XX || ARCH_BCM_21664 96 depends on ARCH_BCM_MOBILE
52 97
53config ARCH_BCM_MOBILE_SMP 98config ARCH_BCM_MOBILE_SMP
54 bool "Broadcom mobile SoC SMP support" 99 bool
55 depends on (ARCH_BCM_281XX || ARCH_BCM_21664) && SMP 100 depends on ARCH_BCM_MOBILE
56 default y
57 select HAVE_ARM_SCU 101 select HAVE_ARM_SCU
58 select ARM_ERRATA_764369 102 select ARM_ERRATA_764369
59 help 103 help
@@ -61,9 +105,7 @@ config ARCH_BCM_MOBILE_SMP
61 Provided as an option so SMP support for SoCs of this type 105 Provided as an option so SMP support for SoCs of this type
62 can be disabled for an SMP-enabled kernel. 106 can be disabled for an SMP-enabled kernel.
63 107
64endmenu 108comment "Other Architectures"
65
66endif
67 109
68config ARCH_BCM2835 110config ARCH_BCM2835
69 bool "Broadcom BCM2835 family" if ARCH_MULTI_V6 111 bool "Broadcom BCM2835 family" if ARCH_MULTI_V6
@@ -78,27 +120,6 @@ config ARCH_BCM2835
78 This enables support for the Broadcom BCM2835 SoC. This SoC is 120 This enables support for the Broadcom BCM2835 SoC. This SoC is
79 used in the Raspberry Pi and Roku 2 devices. 121 used in the Raspberry Pi and Roku 2 devices.
80 122
81config ARCH_BCM_5301X
82 bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7
83 select ARM_GIC
84 select CACHE_L2X0
85 select HAVE_ARM_SCU if SMP
86 select HAVE_ARM_TWD if SMP
87 select ARM_GLOBAL_TIMER
88 select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
89 help
90 Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores.
91
92 This is a network SoC line mostly used in home routers and
93 wifi access points, it's internal name is Northstar.
94 This inclused the following SoC: BCM53010, BCM53011, BCM53012,
95 BCM53014, BCM53015, BCM53016, BCM53017, BCM53018, BCM4707,
96 BCM4708 and BCM4709.
97
98 Do not confuse this with the BCM4760 which is a totally
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
101
102config ARCH_BCM_63XX 123config ARCH_BCM_63XX
103 bool "Broadcom BCM63xx DSL SoC" if ARCH_MULTI_V7 124 bool "Broadcom BCM63xx DSL SoC" if ARCH_MULTI_V7
104 depends on MMU 125 depends on MMU
@@ -118,13 +139,11 @@ config ARCH_BCM_63XX
118 139
119config ARCH_BRCMSTB 140config ARCH_BRCMSTB
120 bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7 141 bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7
121 depends on MMU
122 select ARM_GIC 142 select ARM_GIC
123 select MIGHT_HAVE_PCI
124 select HAVE_SMP
125 select HAVE_ARM_ARCH_TIMER 143 select HAVE_ARM_ARCH_TIMER
126 select BRCMSTB_GISB_ARB 144 select BRCMSTB_GISB_ARB
127 select BRCMSTB_L2_IRQ 145 select BRCMSTB_L2_IRQ
146 select BCM7120_L2_IRQ
128 help 147 help
129 Say Y if you intend to run the kernel on a Broadcom ARM-based STB 148 Say Y if you intend to run the kernel on a Broadcom ARM-based STB
130 chipset. 149 chipset.
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index 300ae4b79ae6..4c38674c73ec 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -10,6 +10,9 @@
10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details. 11# GNU General Public License for more details.
12 12
13# Cygnus
14obj-$(CONFIG_ARCH_BCM_CYGNUS) += bcm_cygnus.o
15
13# BCM281XX 16# BCM281XX
14obj-$(CONFIG_ARCH_BCM_281XX) += board_bcm281xx.o 17obj-$(CONFIG_ARCH_BCM_281XX) += board_bcm281xx.o
15 18
@@ -38,5 +41,7 @@ obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o
38obj-$(CONFIG_ARCH_BCM_63XX) := bcm63xx.o 41obj-$(CONFIG_ARCH_BCM_63XX) := bcm63xx.o
39 42
40ifeq ($(CONFIG_ARCH_BRCMSTB),y) 43ifeq ($(CONFIG_ARCH_BRCMSTB),y)
44CFLAGS_platsmp-brcmstb.o += -march=armv7-a
41obj-y += brcmstb.o 45obj-y += brcmstb.o
46obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o
42endif 47endif
diff --git a/arch/arm/mach-bcm/bcm_cygnus.c b/arch/arm/mach-bcm/bcm_cygnus.c
new file mode 100644
index 000000000000..30dc58be51b8
--- /dev/null
+++ b/arch/arm/mach-bcm/bcm_cygnus.c
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2014 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <asm/mach/arch.h>
15
16static const char const *bcm_cygnus_dt_compat[] = {
17 "brcm,cygnus",
18 NULL,
19};
20
21DT_MACHINE_START(BCM_CYGNUS_DT, "Broadcom Cygnus SoC")
22 .l2c_aux_val = 0,
23 .l2c_aux_mask = ~0,
24 .dt_compat = bcm_cygnus_dt_compat,
25MACHINE_END
diff --git a/arch/arm/mach-bcm/brcmstb.h b/arch/arm/mach-bcm/brcmstb.h
new file mode 100644
index 000000000000..ec0c3d112b36
--- /dev/null
+++ b/arch/arm/mach-bcm/brcmstb.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) 2013-2014 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef __BRCMSTB_H__
15#define __BRCMSTB_H__
16
17void brcmstb_secondary_startup(void);
18
19#endif /* __BRCMSTB_H__ */
diff --git a/arch/arm/mach-bcm/headsmp-brcmstb.S b/arch/arm/mach-bcm/headsmp-brcmstb.S
new file mode 100644
index 000000000000..199c1ea58248
--- /dev/null
+++ b/arch/arm/mach-bcm/headsmp-brcmstb.S
@@ -0,0 +1,33 @@
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
new file mode 100644
index 000000000000..31c87a284a34
--- /dev/null
+++ b/arch/arm/mach-bcm/platsmp-brcmstb.c
@@ -0,0 +1,329 @@
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
27#include <asm/cacheflush.h>
28#include <asm/cp15.h>
29#include <asm/mach-types.h>
30#include <asm/smp_plat.h>
31
32#include "brcmstb.h"
33
34enum {
35 ZONE_MAN_CLKEN_MASK = BIT(0),
36 ZONE_MAN_RESET_CNTL_MASK = BIT(1),
37 ZONE_MAN_MEM_PWR_MASK = BIT(4),
38 ZONE_RESERVED_1_MASK = BIT(5),
39 ZONE_MAN_ISO_CNTL_MASK = BIT(6),
40 ZONE_MANUAL_CONTROL_MASK = BIT(7),
41 ZONE_PWR_DN_REQ_MASK = BIT(9),
42 ZONE_PWR_UP_REQ_MASK = BIT(10),
43 ZONE_BLK_RST_ASSERT_MASK = BIT(12),
44 ZONE_PWR_OFF_STATE_MASK = BIT(25),
45 ZONE_PWR_ON_STATE_MASK = BIT(26),
46 ZONE_DPG_PWR_STATE_MASK = BIT(28),
47 ZONE_MEM_PWR_STATE_MASK = BIT(29),
48 ZONE_RESET_STATE_MASK = BIT(31),
49 CPU0_PWR_ZONE_CTRL_REG = 1,
50 CPU_RESET_CONFIG_REG = 2,
51};
52
53static void __iomem *cpubiuctrl_block;
54static void __iomem *hif_cont_block;
55static u32 cpu0_pwr_zone_ctrl_reg;
56static u32 cpu_rst_cfg_reg;
57static u32 hif_cont_reg;
58
59#ifdef CONFIG_HOTPLUG_CPU
60/*
61 * We must quiesce a dying CPU before it can be killed by the boot CPU. Because
62 * one or more cache may be disabled, we must flush to ensure coherency. We
63 * cannot use traditionl completion structures or spinlocks as they rely on
64 * coherency.
65 */
66static DEFINE_PER_CPU_ALIGNED(int, per_cpu_sw_state);
67
68static int per_cpu_sw_state_rd(u32 cpu)
69{
70 sync_cache_r(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu)));
71 return per_cpu(per_cpu_sw_state, cpu);
72}
73
74static void per_cpu_sw_state_wr(u32 cpu, int val)
75{
76 dmb();
77 per_cpu(per_cpu_sw_state, cpu) = val;
78 sync_cache_w(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu)));
79}
80#else
81static inline void per_cpu_sw_state_wr(u32 cpu, int val) { }
82#endif
83
84static void __iomem *pwr_ctrl_get_base(u32 cpu)
85{
86 void __iomem *base = cpubiuctrl_block + cpu0_pwr_zone_ctrl_reg;
87 base += (cpu_logical_map(cpu) * 4);
88 return base;
89}
90
91static u32 pwr_ctrl_rd(u32 cpu)
92{
93 void __iomem *base = pwr_ctrl_get_base(cpu);
94 return readl_relaxed(base);
95}
96
97static void pwr_ctrl_wr(u32 cpu, u32 val)
98{
99 void __iomem *base = pwr_ctrl_get_base(cpu);
100 writel(val, base);
101}
102
103static void cpu_rst_cfg_set(u32 cpu, int set)
104{
105 u32 val;
106 val = readl_relaxed(cpubiuctrl_block + cpu_rst_cfg_reg);
107 if (set)
108 val |= BIT(cpu_logical_map(cpu));
109 else
110 val &= ~BIT(cpu_logical_map(cpu));
111 writel_relaxed(val, cpubiuctrl_block + cpu_rst_cfg_reg);
112}
113
114static void cpu_set_boot_addr(u32 cpu, unsigned long boot_addr)
115{
116 const int reg_ofs = cpu_logical_map(cpu) * 8;
117 writel_relaxed(0, hif_cont_block + hif_cont_reg + reg_ofs);
118 writel_relaxed(boot_addr, hif_cont_block + hif_cont_reg + 4 + reg_ofs);
119}
120
121static void brcmstb_cpu_boot(u32 cpu)
122{
123 /* Mark this CPU as "up" */
124 per_cpu_sw_state_wr(cpu, 1);
125
126 /*
127 * Set the reset vector to point to the secondary_startup
128 * routine
129 */
130 cpu_set_boot_addr(cpu, virt_to_phys(brcmstb_secondary_startup));
131
132 /* Unhalt the cpu */
133 cpu_rst_cfg_set(cpu, 0);
134}
135
136static void brcmstb_cpu_power_on(u32 cpu)
137{
138 /*
139 * The secondary cores power was cut, so we must go through
140 * power-on initialization.
141 */
142 u32 tmp;
143
144 /* Request zone power up */
145 pwr_ctrl_wr(cpu, ZONE_PWR_UP_REQ_MASK);
146
147 /* Wait for the power up FSM to complete */
148 do {
149 tmp = pwr_ctrl_rd(cpu);
150 } while (!(tmp & ZONE_PWR_ON_STATE_MASK));
151}
152
153static int brcmstb_cpu_get_power_state(u32 cpu)
154{
155 int tmp = pwr_ctrl_rd(cpu);
156 return (tmp & ZONE_RESET_STATE_MASK) ? 0 : 1;
157}
158
159#ifdef CONFIG_HOTPLUG_CPU
160
161static void brcmstb_cpu_die(u32 cpu)
162{
163 v7_exit_coherency_flush(all);
164
165 per_cpu_sw_state_wr(cpu, 0);
166
167 /* Sit and wait to die */
168 wfi();
169
170 /* We should never get here... */
171 while (1)
172 ;
173}
174
175static int brcmstb_cpu_kill(u32 cpu)
176{
177 u32 tmp;
178
179 while (per_cpu_sw_state_rd(cpu))
180 ;
181
182 /* Program zone reset */
183 pwr_ctrl_wr(cpu, ZONE_RESET_STATE_MASK | ZONE_BLK_RST_ASSERT_MASK |
184 ZONE_PWR_DN_REQ_MASK);
185
186 /* Verify zone reset */
187 tmp = pwr_ctrl_rd(cpu);
188 if (!(tmp & ZONE_RESET_STATE_MASK))
189 pr_err("%s: Zone reset bit for CPU %d not asserted!\n",
190 __func__, cpu);
191
192 /* Wait for power down */
193 do {
194 tmp = pwr_ctrl_rd(cpu);
195 } while (!(tmp & ZONE_PWR_OFF_STATE_MASK));
196
197 /* Flush pipeline before resetting CPU */
198 mb();
199
200 /* Assert reset on the CPU */
201 cpu_rst_cfg_set(cpu, 1);
202
203 return 1;
204}
205
206#endif /* CONFIG_HOTPLUG_CPU */
207
208static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
209{
210 int rc = 0;
211 char *name;
212 struct device_node *syscon_np = NULL;
213
214 name = "syscon-cpu";
215
216 syscon_np = of_parse_phandle(np, name, 0);
217 if (!syscon_np) {
218 pr_err("can't find phandle %s\n", name);
219 rc = -EINVAL;
220 goto cleanup;
221 }
222
223 cpubiuctrl_block = of_iomap(syscon_np, 0);
224 if (!cpubiuctrl_block) {
225 pr_err("iomap failed for cpubiuctrl_block\n");
226 rc = -EINVAL;
227 goto cleanup;
228 }
229
230 rc = of_property_read_u32_index(np, name, CPU0_PWR_ZONE_CTRL_REG,
231 &cpu0_pwr_zone_ctrl_reg);
232 if (rc) {
233 pr_err("failed to read 1st entry from %s property (%d)\n", name,
234 rc);
235 rc = -EINVAL;
236 goto cleanup;
237 }
238
239 rc = of_property_read_u32_index(np, name, CPU_RESET_CONFIG_REG,
240 &cpu_rst_cfg_reg);
241 if (rc) {
242 pr_err("failed to read 2nd entry from %s property (%d)\n", name,
243 rc);
244 rc = -EINVAL;
245 goto cleanup;
246 }
247
248cleanup:
249 of_node_put(syscon_np);
250 return rc;
251}
252
253static int __init setup_hifcont_regs(struct device_node *np)
254{
255 int rc = 0;
256 char *name;
257 struct device_node *syscon_np = NULL;
258
259 name = "syscon-cont";
260
261 syscon_np = of_parse_phandle(np, name, 0);
262 if (!syscon_np) {
263 pr_err("can't find phandle %s\n", name);
264 rc = -EINVAL;
265 goto cleanup;
266 }
267
268 hif_cont_block = of_iomap(syscon_np, 0);
269 if (!hif_cont_block) {
270 pr_err("iomap failed for hif_cont_block\n");
271 rc = -EINVAL;
272 goto cleanup;
273 }
274
275 /* Offset is at top of hif_cont_block */
276 hif_cont_reg = 0;
277
278cleanup:
279 of_node_put(syscon_np);
280 return rc;
281}
282
283static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus)
284{
285 int rc;
286 struct device_node *np;
287 char *name;
288
289 name = "brcm,brcmstb-smpboot";
290 np = of_find_compatible_node(NULL, NULL, name);
291 if (!np) {
292 pr_err("can't find compatible node %s\n", name);
293 return;
294 }
295
296 rc = setup_hifcpubiuctrl_regs(np);
297 if (rc)
298 return;
299
300 rc = setup_hifcont_regs(np);
301 if (rc)
302 return;
303}
304
305static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle)
306{
307 /* Missing the brcm,brcmstb-smpboot DT node? */
308 if (!cpubiuctrl_block || !hif_cont_block)
309 return -ENODEV;
310
311 /* Bring up power to the core if necessary */
312 if (brcmstb_cpu_get_power_state(cpu) == 0)
313 brcmstb_cpu_power_on(cpu);
314
315 brcmstb_cpu_boot(cpu);
316
317 return 0;
318}
319
320static struct smp_operations brcmstb_smp_ops __initdata = {
321 .smp_prepare_cpus = brcmstb_cpu_ctrl_setup,
322 .smp_boot_secondary = brcmstb_boot_secondary,
323#ifdef CONFIG_HOTPLUG_CPU
324 .cpu_kill = brcmstb_cpu_kill,
325 .cpu_die = brcmstb_cpu_die,
326#endif
327};
328
329CPU_METHOD_OF_DECLARE(brcmstb_smp, "brcm,brahma-b15", &brcmstb_smp_ops);
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index 24f85be71671..3e40a947f3ea 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -1,10 +1,11 @@
1menuconfig ARCH_BERLIN 1menuconfig ARCH_BERLIN
2 bool "Marvell Berlin SoCs" if ARCH_MULTI_V7 2 bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
3 select ARCH_HAS_RESET_CONTROLLER
3 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
4 select ARM_GIC 5 select ARM_GIC
5 select GENERIC_IRQ_CHIP
6 select DW_APB_ICTL 6 select DW_APB_ICTL
7 select DW_APB_TIMER_OF 7 select DW_APB_TIMER_OF
8 select GENERIC_IRQ_CHIP
8 select PINCTRL 9 select PINCTRL
9 10
10if ARCH_BERLIN 11if ARCH_BERLIN
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 5623131c4f0b..f8f62fbaa915 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -80,8 +80,8 @@ static int da830_evm_usb_ocic_notify(da8xx_ocic_handler_t handler)
80 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 80 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
81 "OHCI over-current indicator", NULL); 81 "OHCI over-current indicator", NULL);
82 if (error) 82 if (error)
83 printk(KERN_ERR "%s: could not request IRQ to watch " 83 pr_err("%s: could not request IRQ to watch over-current indicator changes\n",
84 "over-current indicator changes\n", __func__); 84 __func__);
85 } else 85 } else
86 free_irq(irq, NULL); 86 free_irq(irq, NULL);
87 87
@@ -145,8 +145,7 @@ static __init void da830_evm_usb_init(void)
145 /* USB_REFCLKIN is not used. */ 145 /* USB_REFCLKIN is not used. */
146 ret = davinci_cfg_reg(DA830_USB0_DRVVBUS); 146 ret = davinci_cfg_reg(DA830_USB0_DRVVBUS);
147 if (ret) 147 if (ret)
148 pr_warning("%s: USB 2.0 PinMux setup failed: %d\n", 148 pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret);
149 __func__, ret);
150 else { 149 else {
151 /* 150 /*
152 * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A), 151 * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
@@ -154,37 +153,35 @@ static __init void da830_evm_usb_init(void)
154 */ 153 */
155 ret = da8xx_register_usb20(1000, 3); 154 ret = da8xx_register_usb20(1000, 3);
156 if (ret) 155 if (ret)
157 pr_warning("%s: USB 2.0 registration failed: %d\n", 156 pr_warn("%s: USB 2.0 registration failed: %d\n",
158 __func__, ret); 157 __func__, ret);
159 } 158 }
160 159
161 ret = davinci_cfg_reg_list(da830_evm_usb11_pins); 160 ret = davinci_cfg_reg_list(da830_evm_usb11_pins);
162 if (ret) { 161 if (ret) {
163 pr_warning("%s: USB 1.1 PinMux setup failed: %d\n", 162 pr_warn("%s: USB 1.1 PinMux setup failed: %d\n", __func__, ret);
164 __func__, ret);
165 return; 163 return;
166 } 164 }
167 165
168 ret = gpio_request(ON_BD_USB_DRV, "ON_BD_USB_DRV"); 166 ret = gpio_request(ON_BD_USB_DRV, "ON_BD_USB_DRV");
169 if (ret) { 167 if (ret) {
170 printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port " 168 pr_err("%s: failed to request GPIO for USB 1.1 port power control: %d\n",
171 "power control: %d\n", __func__, ret); 169 __func__, ret);
172 return; 170 return;
173 } 171 }
174 gpio_direction_output(ON_BD_USB_DRV, 0); 172 gpio_direction_output(ON_BD_USB_DRV, 0);
175 173
176 ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC"); 174 ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC");
177 if (ret) { 175 if (ret) {
178 printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port " 176 pr_err("%s: failed to request GPIO for USB 1.1 port over-current indicator: %d\n",
179 "over-current indicator: %d\n", __func__, ret); 177 __func__, ret);
180 return; 178 return;
181 } 179 }
182 gpio_direction_input(ON_BD_USB_OVC); 180 gpio_direction_input(ON_BD_USB_OVC);
183 181
184 ret = da8xx_register_usb11(&da830_evm_usb11_pdata); 182 ret = da8xx_register_usb11(&da830_evm_usb11_pdata);
185 if (ret) 183 if (ret)
186 pr_warning("%s: USB 1.1 registration failed: %d\n", 184 pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret);
187 __func__, ret);
188} 185}
189 186
190static const short da830_evm_mcasp1_pins[] = { 187static const short da830_evm_mcasp1_pins[] = {
@@ -252,31 +249,29 @@ static inline void da830_evm_init_mmc(void)
252 249
253 ret = davinci_cfg_reg_list(da830_evm_mmc_sd_pins); 250 ret = davinci_cfg_reg_list(da830_evm_mmc_sd_pins);
254 if (ret) { 251 if (ret) {
255 pr_warning("da830_evm_init: mmc/sd mux setup failed: %d\n", 252 pr_warn("%s: mmc/sd mux setup failed: %d\n", __func__, ret);
256 ret);
257 return; 253 return;
258 } 254 }
259 255
260 ret = gpio_request(DA830_MMCSD_WP_PIN, "MMC WP"); 256 ret = gpio_request(DA830_MMCSD_WP_PIN, "MMC WP");
261 if (ret) { 257 if (ret) {
262 pr_warning("da830_evm_init: can not open GPIO %d\n", 258 pr_warn("%s: can not open GPIO %d\n",
263 DA830_MMCSD_WP_PIN); 259 __func__, DA830_MMCSD_WP_PIN);
264 return; 260 return;
265 } 261 }
266 gpio_direction_input(DA830_MMCSD_WP_PIN); 262 gpio_direction_input(DA830_MMCSD_WP_PIN);
267 263
268 ret = gpio_request(DA830_MMCSD_CD_PIN, "MMC CD\n"); 264 ret = gpio_request(DA830_MMCSD_CD_PIN, "MMC CD\n");
269 if (ret) { 265 if (ret) {
270 pr_warning("da830_evm_init: can not open GPIO %d\n", 266 pr_warn("%s: can not open GPIO %d\n",
271 DA830_MMCSD_CD_PIN); 267 __func__, DA830_MMCSD_CD_PIN);
272 return; 268 return;
273 } 269 }
274 gpio_direction_input(DA830_MMCSD_CD_PIN); 270 gpio_direction_input(DA830_MMCSD_CD_PIN);
275 271
276 ret = da8xx_register_mmcsd0(&da830_evm_mmc_config); 272 ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
277 if (ret) { 273 if (ret) {
278 pr_warning("da830_evm_init: mmc/sd registration failed: %d\n", 274 pr_warn("%s: mmc/sd registration failed: %d\n", __func__, ret);
279 ret);
280 gpio_free(DA830_MMCSD_WP_PIN); 275 gpio_free(DA830_MMCSD_WP_PIN);
281 } 276 }
282} 277}
@@ -404,23 +399,21 @@ static inline void da830_evm_init_nand(int mux_mode)
404 int ret; 399 int ret;
405 400
406 if (HAS_MMC) { 401 if (HAS_MMC) {
407 pr_warning("WARNING: both MMC/SD and NAND are " 402 pr_warn("WARNING: both MMC/SD and NAND are enabled, but they share AEMIF pins\n"
408 "enabled, but they share AEMIF pins.\n" 403 "\tDisable MMC/SD for NAND support\n");
409 "\tDisable MMC/SD for NAND support.\n");
410 return; 404 return;
411 } 405 }
412 406
413 ret = davinci_cfg_reg_list(da830_evm_emif25_pins); 407 ret = davinci_cfg_reg_list(da830_evm_emif25_pins);
414 if (ret) 408 if (ret)
415 pr_warning("da830_evm_init: emif25 mux setup failed: %d\n", 409 pr_warn("%s: emif25 mux setup failed: %d\n", __func__, ret);
416 ret);
417 410
418 ret = platform_device_register(&da830_evm_nand_device); 411 ret = platform_device_register(&da830_evm_nand_device);
419 if (ret) 412 if (ret)
420 pr_warning("da830_evm_init: NAND device not registered.\n"); 413 pr_warn("%s: NAND device not registered\n", __func__);
421 414
422 if (davinci_aemif_setup(&da830_evm_nand_device)) 415 if (davinci_aemif_setup(&da830_evm_nand_device))
423 pr_warn("%s: Cannot configure AEMIF.\n", __func__); 416 pr_warn("%s: Cannot configure AEMIF\n", __func__);
424 417
425 gpio_direction_output(mux_mode, 1); 418 gpio_direction_output(mux_mode, 1);
426} 419}
@@ -435,12 +428,11 @@ static inline void da830_evm_init_lcdc(int mux_mode)
435 428
436 ret = davinci_cfg_reg_list(da830_lcdcntl_pins); 429 ret = davinci_cfg_reg_list(da830_lcdcntl_pins);
437 if (ret) 430 if (ret)
438 pr_warning("da830_evm_init: lcdcntl mux setup failed: %d\n", 431 pr_warn("%s: lcdcntl mux setup failed: %d\n", __func__, ret);
439 ret);
440 432
441 ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata); 433 ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata);
442 if (ret) 434 if (ret)
443 pr_warning("da830_evm_init: lcd setup failed: %d\n", ret); 435 pr_warn("%s: lcd setup failed: %d\n", __func__, ret);
444 436
445 gpio_direction_output(mux_mode, 0); 437 gpio_direction_output(mux_mode, 0);
446} 438}
@@ -598,22 +590,19 @@ static __init void da830_evm_init(void)
598 590
599 ret = da830_register_gpio(); 591 ret = da830_register_gpio();
600 if (ret) 592 if (ret)
601 pr_warn("da830_evm_init: GPIO init failed: %d\n", ret); 593 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
602 594
603 ret = da830_register_edma(da830_edma_rsv); 595 ret = da830_register_edma(da830_edma_rsv);
604 if (ret) 596 if (ret)
605 pr_warning("da830_evm_init: edma registration failed: %d\n", 597 pr_warn("%s: edma registration failed: %d\n", __func__, ret);
606 ret);
607 598
608 ret = davinci_cfg_reg_list(da830_i2c0_pins); 599 ret = davinci_cfg_reg_list(da830_i2c0_pins);
609 if (ret) 600 if (ret)
610 pr_warning("da830_evm_init: i2c0 mux setup failed: %d\n", 601 pr_warn("%s: i2c0 mux setup failed: %d\n", __func__, ret);
611 ret);
612 602
613 ret = da8xx_register_i2c(0, &da830_evm_i2c_0_pdata); 603 ret = da8xx_register_i2c(0, &da830_evm_i2c_0_pdata);
614 if (ret) 604 if (ret)
615 pr_warning("da830_evm_init: i2c0 registration failed: %d\n", 605 pr_warn("%s: i2c0 registration failed: %d\n", __func__, ret);
616 ret);
617 606
618 da830_evm_usb_init(); 607 da830_evm_usb_init();
619 608
@@ -622,18 +611,16 @@ static __init void da830_evm_init(void)
622 611
623 ret = davinci_cfg_reg_list(da830_cpgmac_pins); 612 ret = davinci_cfg_reg_list(da830_cpgmac_pins);
624 if (ret) 613 if (ret)
625 pr_warning("da830_evm_init: cpgmac mux setup failed: %d\n", 614 pr_warn("%s: cpgmac mux setup failed: %d\n", __func__, ret);
626 ret);
627 615
628 ret = da8xx_register_emac(); 616 ret = da8xx_register_emac();
629 if (ret) 617 if (ret)
630 pr_warning("da830_evm_init: emac registration failed: %d\n", 618 pr_warn("%s: emac registration failed: %d\n", __func__, ret);
631 ret);
632 619
633 ret = da8xx_register_watchdog(); 620 ret = da8xx_register_watchdog();
634 if (ret) 621 if (ret)
635 pr_warning("da830_evm_init: watchdog registration failed: %d\n", 622 pr_warn("%s: watchdog registration failed: %d\n",
636 ret); 623 __func__, ret);
637 624
638 davinci_serial_init(da8xx_serial_device); 625 davinci_serial_init(da8xx_serial_device);
639 i2c_register_board_info(1, da830_evm_i2c_devices, 626 i2c_register_board_info(1, da830_evm_i2c_devices,
@@ -641,8 +628,7 @@ static __init void da830_evm_init(void)
641 628
642 ret = davinci_cfg_reg_list(da830_evm_mcasp1_pins); 629 ret = davinci_cfg_reg_list(da830_evm_mcasp1_pins);
643 if (ret) 630 if (ret)
644 pr_warning("da830_evm_init: mcasp1 mux setup failed: %d\n", 631 pr_warn("%s: mcasp1 mux setup failed: %d\n", __func__, ret);
645 ret);
646 632
647 da8xx_register_mcasp(1, &da830_evm_snd_data); 633 da8xx_register_mcasp(1, &da830_evm_snd_data);
648 634
@@ -650,18 +636,17 @@ static __init void da830_evm_init(void)
650 636
651 ret = da8xx_register_rtc(); 637 ret = da8xx_register_rtc();
652 if (ret) 638 if (ret)
653 pr_warning("da830_evm_init: rtc setup failed: %d\n", ret); 639 pr_warn("%s: rtc setup failed: %d\n", __func__, ret);
654 640
655 ret = spi_register_board_info(da830evm_spi_info, 641 ret = spi_register_board_info(da830evm_spi_info,
656 ARRAY_SIZE(da830evm_spi_info)); 642 ARRAY_SIZE(da830evm_spi_info));
657 if (ret) 643 if (ret)
658 pr_warn("%s: spi info registration failed: %d\n", __func__, 644 pr_warn("%s: spi info registration failed: %d\n",
659 ret); 645 __func__, ret);
660 646
661 ret = da8xx_register_spi_bus(0, ARRAY_SIZE(da830evm_spi_info)); 647 ret = da8xx_register_spi_bus(0, ARRAY_SIZE(da830evm_spi_info));
662 if (ret) 648 if (ret)
663 pr_warning("da830_evm_init: spi 0 registration failed: %d\n", 649 pr_warn("%s: spi 0 registration failed: %d\n", __func__, ret);
664 ret);
665} 650}
666 651
667#ifdef CONFIG_SERIAL_8250_CONSOLE 652#ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index fa11415e906a..6b5a97da9fe3 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -452,8 +452,7 @@ static void da850_evm_ui_keys_init(unsigned gpio)
452 for (i = 0; i < DA850_N_UI_PB; i++) { 452 for (i = 0; i < DA850_N_UI_PB; i++) {
453 button = &da850_evm_ui_keys[i]; 453 button = &da850_evm_ui_keys[i];
454 button->code = KEY_F8 - i; 454 button->code = KEY_F8 - i;
455 button->desc = (char *) 455 button->desc = da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
456 da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
457 button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i; 456 button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
458 } 457 }
459} 458}
@@ -628,15 +627,13 @@ static void da850_evm_bb_keys_init(unsigned gpio)
628 struct gpio_keys_button *button; 627 struct gpio_keys_button *button;
629 628
630 button = &da850_evm_bb_keys[0]; 629 button = &da850_evm_bb_keys[0];
631 button->desc = (char *) 630 button->desc = da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
632 da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
633 button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1; 631 button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
634 632
635 for (i = 0; i < DA850_N_BB_USER_SW; i++) { 633 for (i = 0; i < DA850_N_BB_USER_SW; i++) {
636 button = &da850_evm_bb_keys[i + 1]; 634 button = &da850_evm_bb_keys[i + 1];
637 button->code = SW_LID + i; 635 button->code = SW_LID + i;
638 button->desc = (char *) 636 button->desc = da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
639 da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
640 button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i; 637 button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
641 } 638 }
642} 639}
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 06d63d5651f3..b46b4d25f93e 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -294,7 +294,7 @@ static struct vpbe_output dm355evm_vpbe_outputs[] = {
294 .default_mode = "ntsc", 294 .default_mode = "ntsc",
295 .num_modes = ARRAY_SIZE(dm355evm_enc_preset_timing), 295 .num_modes = ARRAY_SIZE(dm355evm_enc_preset_timing),
296 .modes = dm355evm_enc_preset_timing, 296 .modes = dm355evm_enc_preset_timing,
297 .if_params = V4L2_MBUS_FMT_FIXED, 297 .if_params = MEDIA_BUS_FMT_FIXED,
298 }, 298 },
299}; 299};
300 300
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index e08a8684ead2..a756003595e9 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -485,7 +485,7 @@ static struct vpbe_output dm365evm_vpbe_outputs[] = {
485 .default_mode = "ntsc", 485 .default_mode = "ntsc",
486 .num_modes = ARRAY_SIZE(dm365evm_enc_std_timing), 486 .num_modes = ARRAY_SIZE(dm365evm_enc_std_timing),
487 .modes = dm365evm_enc_std_timing, 487 .modes = dm365evm_enc_std_timing,
488 .if_params = V4L2_MBUS_FMT_FIXED, 488 .if_params = MEDIA_BUS_FMT_FIXED,
489 }, 489 },
490 { 490 {
491 .output = { 491 .output = {
@@ -498,7 +498,7 @@ static struct vpbe_output dm365evm_vpbe_outputs[] = {
498 .default_mode = "480p59_94", 498 .default_mode = "480p59_94",
499 .num_modes = ARRAY_SIZE(dm365evm_enc_preset_timing), 499 .num_modes = ARRAY_SIZE(dm365evm_enc_preset_timing),
500 .modes = dm365evm_enc_preset_timing, 500 .modes = dm365evm_enc_preset_timing,
501 .if_params = V4L2_MBUS_FMT_FIXED, 501 .if_params = MEDIA_BUS_FMT_FIXED,
502 }, 502 },
503}; 503};
504 504
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index e583e58b5e1e..1a0898c1c17e 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -767,9 +767,8 @@ static __init void davinci_evm_init(void)
767 767
768 if (HAS_ATA) { 768 if (HAS_ATA) {
769 if (HAS_NAND || HAS_NOR) 769 if (HAS_NAND || HAS_NOR)
770 pr_warning("WARNING: both IDE and Flash are " 770 pr_warn("WARNING: both IDE and Flash are enabled, but they share AEMIF pins\n"
771 "enabled, but they share AEMIF pins.\n" 771 "\tDisable IDE for NAND/NOR support\n");
772 "\tDisable IDE for NAND/NOR support.\n");
773 davinci_init_ide(); 772 davinci_init_ide();
774 } else if (HAS_NAND || HAS_NOR) { 773 } else if (HAS_NAND || HAS_NOR) {
775 davinci_cfg_reg(DM644X_HPIEN_DISABLE); 774 davinci_cfg_reg(DM644X_HPIEN_DISABLE);
@@ -780,13 +779,12 @@ static __init void davinci_evm_init(void)
780 platform_device_register(&davinci_evm_nandflash_device); 779 platform_device_register(&davinci_evm_nandflash_device);
781 780
782 if (davinci_aemif_setup(&davinci_evm_nandflash_device)) 781 if (davinci_aemif_setup(&davinci_evm_nandflash_device))
783 pr_warn("%s: Cannot configure AEMIF.\n", 782 pr_warn("%s: Cannot configure AEMIF\n",
784 __func__); 783 __func__);
785 784
786 evm_leds[7].default_trigger = "nand-disk"; 785 evm_leds[7].default_trigger = "nand-disk";
787 if (HAS_NOR) 786 if (HAS_NOR)
788 pr_warning("WARNING: both NAND and NOR flash " 787 pr_warn("WARNING: both NAND and NOR flash are enabled; disable one of them.\n");
789 "are enabled; disable one of them.\n");
790 } else if (HAS_NOR) 788 } else if (HAS_NOR)
791 platform_device_register(&davinci_evm_norflash_device); 789 platform_device_register(&davinci_evm_norflash_device);
792 } 790 }
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index 96fc00a167f5..8cfbfe084535 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -8,6 +8,8 @@
8 * any kind, whether express or implied. 8 * any kind, whether express or implied.
9 */ 9 */
10 10
11#define pr_fmt(fmt) "MityOMAPL138: " fmt
12
11#include <linux/kernel.h> 13#include <linux/kernel.h>
12#include <linux/init.h> 14#include <linux/init.h>
13#include <linux/console.h> 15#include <linux/console.h>
@@ -107,7 +109,7 @@ static void mityomapl138_cpufreq_init(const char *partnum)
107 109
108 ret = da850_register_cpufreq("pll0_sysclk3"); 110 ret = da850_register_cpufreq("pll0_sysclk3");
109 if (ret) 111 if (ret)
110 pr_warning("cpufreq registration failed: %d\n", ret); 112 pr_warn("cpufreq registration failed: %d\n", ret);
111} 113}
112#else 114#else
113static void mityomapl138_cpufreq_init(const char *partnum) { } 115static void mityomapl138_cpufreq_init(const char *partnum) { }
@@ -121,33 +123,31 @@ static void read_factory_config(struct memory_accessor *a, void *context)
121 123
122 ret = a->read(a, (char *)&factory_config, 0, sizeof(factory_config)); 124 ret = a->read(a, (char *)&factory_config, 0, sizeof(factory_config));
123 if (ret != sizeof(struct factory_config)) { 125 if (ret != sizeof(struct factory_config)) {
124 pr_warning("MityOMAPL138: Read Factory Config Failed: %d\n", 126 pr_warn("Read Factory Config Failed: %d\n", ret);
125 ret);
126 goto bad_config; 127 goto bad_config;
127 } 128 }
128 129
129 if (factory_config.magic != FACTORY_CONFIG_MAGIC) { 130 if (factory_config.magic != FACTORY_CONFIG_MAGIC) {
130 pr_warning("MityOMAPL138: Factory Config Magic Wrong (%X)\n", 131 pr_warn("Factory Config Magic Wrong (%X)\n",
131 factory_config.magic); 132 factory_config.magic);
132 goto bad_config; 133 goto bad_config;
133 } 134 }
134 135
135 if (factory_config.version != FACTORY_CONFIG_VERSION) { 136 if (factory_config.version != FACTORY_CONFIG_VERSION) {
136 pr_warning("MityOMAPL138: Factory Config Version Wrong (%X)\n", 137 pr_warn("Factory Config Version Wrong (%X)\n",
137 factory_config.version); 138 factory_config.version);
138 goto bad_config; 139 goto bad_config;
139 } 140 }
140 141
141 pr_info("MityOMAPL138: Found MAC = %pM\n", factory_config.mac); 142 pr_info("Found MAC = %pM\n", factory_config.mac);
142 if (is_valid_ether_addr(factory_config.mac)) 143 if (is_valid_ether_addr(factory_config.mac))
143 memcpy(soc_info->emac_pdata->mac_addr, 144 memcpy(soc_info->emac_pdata->mac_addr,
144 factory_config.mac, ETH_ALEN); 145 factory_config.mac, ETH_ALEN);
145 else 146 else
146 pr_warning("MityOMAPL138: Invalid MAC found " 147 pr_warn("Invalid MAC found in factory config block\n");
147 "in factory config block\n");
148 148
149 partnum = factory_config.partnum; 149 partnum = factory_config.partnum;
150 pr_info("MityOMAPL138: Part Number = %s\n", partnum); 150 pr_info("Part Number = %s\n", partnum);
151 151
152bad_config: 152bad_config:
153 /* default maximum speed is valid for all platforms */ 153 /* default maximum speed is valid for all platforms */
@@ -435,7 +435,7 @@ static void __init mityomapl138_setup_nand(void)
435 ARRAY_SIZE(mityomapl138_devices)); 435 ARRAY_SIZE(mityomapl138_devices));
436 436
437 if (davinci_aemif_setup(&mityomapl138_nandflash_device)) 437 if (davinci_aemif_setup(&mityomapl138_nandflash_device))
438 pr_warn("%s: Cannot configure AEMIF.\n", __func__); 438 pr_warn("%s: Cannot configure AEMIF\n", __func__);
439} 439}
440 440
441static const short mityomap_mii_pins[] = { 441static const short mityomap_mii_pins[] = {
@@ -478,7 +478,7 @@ static void __init mityomapl138_config_emac(void)
478 } 478 }
479 479
480 if (ret) { 480 if (ret) {
481 pr_warning("mii/rmii mux setup failed: %d\n", ret); 481 pr_warn("mii/rmii mux setup failed: %d\n", ret);
482 return; 482 return;
483 } 483 }
484 484
@@ -489,7 +489,7 @@ static void __init mityomapl138_config_emac(void)
489 489
490 ret = da8xx_register_emac(); 490 ret = da8xx_register_emac();
491 if (ret) 491 if (ret)
492 pr_warning("emac registration failed: %d\n", ret); 492 pr_warn("emac registration failed: %d\n", ret);
493} 493}
494 494
495static struct davinci_pm_config da850_pm_pdata = { 495static struct davinci_pm_config da850_pm_pdata = {
@@ -511,21 +511,21 @@ static void __init mityomapl138_init(void)
511 /* for now, no special EDMA channels are reserved */ 511 /* for now, no special EDMA channels are reserved */
512 ret = da850_register_edma(NULL); 512 ret = da850_register_edma(NULL);
513 if (ret) 513 if (ret)
514 pr_warning("edma registration failed: %d\n", ret); 514 pr_warn("edma registration failed: %d\n", ret);
515 515
516 ret = da8xx_register_watchdog(); 516 ret = da8xx_register_watchdog();
517 if (ret) 517 if (ret)
518 pr_warning("watchdog registration failed: %d\n", ret); 518 pr_warn("watchdog registration failed: %d\n", ret);
519 519
520 davinci_serial_init(da8xx_serial_device); 520 davinci_serial_init(da8xx_serial_device);
521 521
522 ret = da8xx_register_i2c(0, &mityomap_i2c_0_pdata); 522 ret = da8xx_register_i2c(0, &mityomap_i2c_0_pdata);
523 if (ret) 523 if (ret)
524 pr_warning("i2c0 registration failed: %d\n", ret); 524 pr_warn("i2c0 registration failed: %d\n", ret);
525 525
526 ret = pmic_tps65023_init(); 526 ret = pmic_tps65023_init();
527 if (ret) 527 if (ret)
528 pr_warning("TPS65023 PMIC init failed: %d\n", ret); 528 pr_warn("TPS65023 PMIC init failed: %d\n", ret);
529 529
530 mityomapl138_setup_nand(); 530 mityomapl138_setup_nand();
531 531
@@ -537,22 +537,21 @@ static void __init mityomapl138_init(void)
537 ret = da8xx_register_spi_bus(1, 537 ret = da8xx_register_spi_bus(1,
538 ARRAY_SIZE(mityomapl138_spi_flash_info)); 538 ARRAY_SIZE(mityomapl138_spi_flash_info));
539 if (ret) 539 if (ret)
540 pr_warning("spi 1 registration failed: %d\n", ret); 540 pr_warn("spi 1 registration failed: %d\n", ret);
541 541
542 mityomapl138_config_emac(); 542 mityomapl138_config_emac();
543 543
544 ret = da8xx_register_rtc(); 544 ret = da8xx_register_rtc();
545 if (ret) 545 if (ret)
546 pr_warning("rtc setup failed: %d\n", ret); 546 pr_warn("rtc setup failed: %d\n", ret);
547 547
548 ret = da8xx_register_cpuidle(); 548 ret = da8xx_register_cpuidle();
549 if (ret) 549 if (ret)
550 pr_warning("cpuidle registration failed: %d\n", ret); 550 pr_warn("cpuidle registration failed: %d\n", ret);
551 551
552 ret = da850_register_pm(&da850_pm_device); 552 ret = da850_register_pm(&da850_pm_device);
553 if (ret) 553 if (ret)
554 pr_warning("da850_evm_init: suspend registration failed: %d\n", 554 pr_warn("suspend registration failed: %d\n", ret);
555 ret);
556} 555}
557 556
558#ifdef CONFIG_SERIAL_8250_CONSOLE 557#ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index bb680af98374..8fcdcf87c47c 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -183,9 +183,8 @@ static __init void davinci_ntosd2_init(void)
183 183
184 if (HAS_ATA) { 184 if (HAS_ATA) {
185 if (HAS_NAND) 185 if (HAS_NAND)
186 pr_warning("WARNING: both IDE and Flash are " 186 pr_warn("WARNING: both IDE and Flash are enabled, but they share AEMIF pins\n"
187 "enabled, but they share AEMIF pins.\n" 187 "\tDisable IDE for NAND/NOR support\n");
188 "\tDisable IDE for NAND/NOR support.\n");
189 davinci_init_ide(); 188 davinci_init_ide();
190 } else if (HAS_NAND) { 189 } else if (HAS_NAND) {
191 davinci_cfg_reg(DM644X_HPIEN_DISABLE); 190 davinci_cfg_reg(DM644X_HPIEN_DISABLE);
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 985e5fd00fb2..c70bb0a4dfb4 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -564,7 +564,7 @@ int davinci_set_refclk_rate(unsigned long rate)
564 564
565 refclk = clk_get(NULL, "ref"); 565 refclk = clk_get(NULL, "ref");
566 if (IS_ERR(refclk)) { 566 if (IS_ERR(refclk)) {
567 pr_err("%s: failed to get reference clock.\n", __func__); 567 pr_err("%s: failed to get reference clock\n", __func__);
568 return PTR_ERR(refclk); 568 return PTR_ERR(refclk);
569 } 569 }
570 570
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
index f1ac1c94ac0f..b4675fc28f83 100644
--- a/arch/arm/mach-davinci/cpuidle.c
+++ b/arch/arm/mach-davinci/cpuidle.c
@@ -66,7 +66,6 @@ static struct cpuidle_driver davinci_idle_driver = {
66 .enter = davinci_enter_idle, 66 .enter = davinci_enter_idle,
67 .exit_latency = 10, 67 .exit_latency = 10,
68 .target_residency = 10000, 68 .target_residency = 10000,
69 .flags = CPUIDLE_FLAG_TIME_VALID,
70 .name = "DDR SR", 69 .name = "DDR SR",
71 .desc = "WFI and DDR Self Refresh", 70 .desc = "WFI and DDR Self Refresh",
72 }, 71 },
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 2f3ed3a58d57..9cbeda798584 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -785,14 +785,13 @@ static struct resource dm355_v4l2_disp_resources[] = {
785 }, 785 },
786}; 786};
787 787
788static int dm355_vpbe_setup_pinmux(enum v4l2_mbus_pixelcode if_type, 788static int dm355_vpbe_setup_pinmux(u32 if_type, int field)
789 int field)
790{ 789{
791 switch (if_type) { 790 switch (if_type) {
792 case V4L2_MBUS_FMT_SGRBG8_1X8: 791 case MEDIA_BUS_FMT_SGRBG8_1X8:
793 davinci_cfg_reg(DM355_VOUT_FIELD_G70); 792 davinci_cfg_reg(DM355_VOUT_FIELD_G70);
794 break; 793 break;
795 case V4L2_MBUS_FMT_YUYV10_1X20: 794 case MEDIA_BUS_FMT_YUYV10_1X20:
796 if (field) 795 if (field)
797 davinci_cfg_reg(DM355_VOUT_FIELD); 796 davinci_cfg_reg(DM355_VOUT_FIELD);
798 else 797 else
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 0ae8114f5cc9..e3a3c54b6832 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1306,16 +1306,15 @@ static struct resource dm365_v4l2_disp_resources[] = {
1306 }, 1306 },
1307}; 1307};
1308 1308
1309static int dm365_vpbe_setup_pinmux(enum v4l2_mbus_pixelcode if_type, 1309static int dm365_vpbe_setup_pinmux(u32 if_type, int field)
1310 int field)
1311{ 1310{
1312 switch (if_type) { 1311 switch (if_type) {
1313 case V4L2_MBUS_FMT_SGRBG8_1X8: 1312 case MEDIA_BUS_FMT_SGRBG8_1X8:
1314 davinci_cfg_reg(DM365_VOUT_FIELD_G81); 1313 davinci_cfg_reg(DM365_VOUT_FIELD_G81);
1315 davinci_cfg_reg(DM365_VOUT_COUTL_EN); 1314 davinci_cfg_reg(DM365_VOUT_COUTL_EN);
1316 davinci_cfg_reg(DM365_VOUT_COUTH_EN); 1315 davinci_cfg_reg(DM365_VOUT_COUTH_EN);
1317 break; 1316 break;
1318 case V4L2_MBUS_FMT_YUYV10_1X20: 1317 case MEDIA_BUS_FMT_YUYV10_1X20:
1319 if (field) 1318 if (field)
1320 davinci_cfg_reg(DM365_VOUT_FIELD); 1319 davinci_cfg_reg(DM365_VOUT_FIELD);
1321 else 1320 else
diff --git a/arch/arm/mach-davinci/mux.c b/arch/arm/mach-davinci/mux.c
index f34a8dcdae2b..a8eb909a2b6c 100644
--- a/arch/arm/mach-davinci/mux.c
+++ b/arch/arm/mach-davinci/mux.c
@@ -15,6 +15,9 @@
15 * 15 *
16 * Copyright (C) 2008 Texas Instruments. 16 * Copyright (C) 2008 Texas Instruments.
17 */ 17 */
18
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20
18#include <linux/io.h> 21#include <linux/io.h>
19#include <linux/module.h> 22#include <linux/module.h>
20#include <linux/spinlock.h> 23#include <linux/spinlock.h>
@@ -46,7 +49,7 @@ int __init_or_module davinci_cfg_reg(const unsigned long index)
46 } 49 }
47 50
48 if (index >= soc_info->pinmux_pins_num) { 51 if (index >= soc_info->pinmux_pins_num) {
49 printk(KERN_ERR "Invalid pin mux index: %lu (%lu)\n", 52 pr_err("Invalid pin mux index: %lu (%lu)\n",
50 index, soc_info->pinmux_pins_num); 53 index, soc_info->pinmux_pins_num);
51 dump_stack(); 54 dump_stack();
52 return -ENODEV; 55 return -ENODEV;
@@ -55,7 +58,7 @@ int __init_or_module davinci_cfg_reg(const unsigned long index)
55 cfg = &soc_info->pinmux_pins[index]; 58 cfg = &soc_info->pinmux_pins[index];
56 59
57 if (cfg->name == NULL) { 60 if (cfg->name == NULL) {
58 printk(KERN_ERR "No entry for the specified index\n"); 61 pr_err("No entry for the specified index\n");
59 return -ENODEV; 62 return -ENODEV;
60 } 63 }
61 64
@@ -82,15 +85,15 @@ int __init_or_module davinci_cfg_reg(const unsigned long index)
82 85
83 if (warn) { 86 if (warn) {
84#ifdef CONFIG_DAVINCI_MUX_WARNINGS 87#ifdef CONFIG_DAVINCI_MUX_WARNINGS
85 printk(KERN_WARNING "MUX: initialized %s\n", cfg->name); 88 pr_warn("initialized %s\n", cfg->name);
86#endif 89#endif
87 } 90 }
88 91
89#ifdef CONFIG_DAVINCI_MUX_DEBUG 92#ifdef CONFIG_DAVINCI_MUX_DEBUG
90 if (cfg->debug || warn) { 93 if (cfg->debug || warn) {
91 printk(KERN_WARNING "MUX: Setting register %s\n", cfg->name); 94 pr_warn("Setting register %s\n", cfg->name);
92 printk(KERN_WARNING " %s (0x%08x) = 0x%08x -> 0x%08x\n", 95 pr_warn(" %s (0x%08x) = 0x%08x -> 0x%08x\n",
93 cfg->mux_reg_name, cfg->mux_reg, reg_orig, reg); 96 cfg->mux_reg_name, cfg->mux_reg, reg_orig, reg);
94 } 97 }
95#endif 98#endif
96 99
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 24ad30f32ae3..160c9602f490 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -342,8 +342,6 @@ void __init davinci_timer_init(void)
342 struct davinci_soc_info *soc_info = &davinci_soc_info; 342 struct davinci_soc_info *soc_info = &davinci_soc_info;
343 unsigned int clockevent_id; 343 unsigned int clockevent_id;
344 unsigned int clocksource_id; 344 unsigned int clocksource_id;
345 static char err[] __initdata = KERN_ERR
346 "%s: can't register clocksource!\n";
347 int i; 345 int i;
348 346
349 clockevent_id = soc_info->timer_info->clockevent_id; 347 clockevent_id = soc_info->timer_info->clockevent_id;
@@ -364,12 +362,12 @@ void __init davinci_timer_init(void)
364 362
365 /* Only bottom timers can use compare regs */ 363 /* Only bottom timers can use compare regs */
366 if (IS_TIMER_TOP(clockevent_id)) 364 if (IS_TIMER_TOP(clockevent_id))
367 pr_warning("davinci_timer_init: Invalid use" 365 pr_warn("%s: Invalid use of system timers. Results unpredictable.\n",
368 " of system timers. Results unpredictable.\n"); 366 __func__);
369 else if ((dtip[event_timer].cmp_off == 0) 367 else if ((dtip[event_timer].cmp_off == 0)
370 || (dtip[event_timer].cmp_irq == 0)) 368 || (dtip[event_timer].cmp_irq == 0))
371 pr_warning("davinci_timer_init: Invalid timer instance" 369 pr_warn("%s: Invalid timer instance setup. Results unpredictable.\n",
372 " setup. Results unpredictable.\n"); 370 __func__);
373 else { 371 else {
374 timers[TID_CLOCKEVENT].opts |= TIMER_OPTS_USE_COMPARE; 372 timers[TID_CLOCKEVENT].opts |= TIMER_OPTS_USE_COMPARE;
375 clockevent_davinci.features = CLOCK_EVT_FEAT_ONESHOT; 373 clockevent_davinci.features = CLOCK_EVT_FEAT_ONESHOT;
@@ -389,7 +387,8 @@ void __init davinci_timer_init(void)
389 clocksource_davinci.name = id_to_name[clocksource_id]; 387 clocksource_davinci.name = id_to_name[clocksource_id];
390 if (clocksource_register_hz(&clocksource_davinci, 388 if (clocksource_register_hz(&clocksource_davinci,
391 davinci_clock_tick_rate)) 389 davinci_clock_tick_rate))
392 printk(err, clocksource_davinci.name); 390 pr_err("%s: can't register clocksource!\n",
391 clocksource_davinci.name);
393 392
394 sched_clock_register(davinci_read_sched_clock, 32, 393 sched_clock_register(davinci_read_sched_clock, 32,
395 davinci_clock_tick_rate); 394 davinci_clock_tick_rate);
diff --git a/arch/arm/mach-ebsa110/include/mach/io.h b/arch/arm/mach-ebsa110/include/mach/io.h
index 11bb0799424b..69975784acfa 100644
--- a/arch/arm/mach-ebsa110/include/mach/io.h
+++ b/arch/arm/mach-ebsa110/include/mach/io.h
@@ -29,9 +29,9 @@ u8 __readb(const volatile void __iomem *addr);
29u16 __readw(const volatile void __iomem *addr); 29u16 __readw(const volatile void __iomem *addr);
30u32 __readl(const volatile void __iomem *addr); 30u32 __readl(const volatile void __iomem *addr);
31 31
32void __writeb(u8 val, void __iomem *addr); 32void __writeb(u8 val, volatile void __iomem *addr);
33void __writew(u16 val, void __iomem *addr); 33void __writew(u16 val, volatile void __iomem *addr);
34void __writel(u32 val, void __iomem *addr); 34void __writel(u32 val, volatile void __iomem *addr);
35 35
36/* 36/*
37 * Argh, someone forgot the IOCS16 line. We therefore have to handle 37 * Argh, someone forgot the IOCS16 line. We therefore have to handle
@@ -62,20 +62,31 @@ void __writel(u32 val, void __iomem *addr);
62#define writew(v,b) __writew(v,b) 62#define writew(v,b) __writew(v,b)
63#define writel(v,b) __writel(v,b) 63#define writel(v,b) __writel(v,b)
64 64
65#define insb insb
65extern void insb(unsigned int port, void *buf, int sz); 66extern void insb(unsigned int port, void *buf, int sz);
67#define insw insw
66extern void insw(unsigned int port, void *buf, int sz); 68extern void insw(unsigned int port, void *buf, int sz);
69#define insl insl
67extern void insl(unsigned int port, void *buf, int sz); 70extern void insl(unsigned int port, void *buf, int sz);
68 71
72#define outsb outsb
69extern void outsb(unsigned int port, const void *buf, int sz); 73extern void outsb(unsigned int port, const void *buf, int sz);
74#define outsw outsw
70extern void outsw(unsigned int port, const void *buf, int sz); 75extern void outsw(unsigned int port, const void *buf, int sz);
76#define outsl outsl
71extern void outsl(unsigned int port, const void *buf, int sz); 77extern void outsl(unsigned int port, const void *buf, int sz);
72 78
73/* can't support writesb atm */ 79/* can't support writesb atm */
74extern void writesw(void __iomem *addr, const void *data, int wordlen); 80#define writesw writesw
75extern void writesl(void __iomem *addr, const void *data, int longlen); 81extern void writesw(volatile void __iomem *addr, const void *data, int wordlen);
82#define writesl writesl
83extern void writesl(volatile void __iomem *addr, const void *data, int longlen);
76 84
77/* can't support readsb atm */ 85/* can't support readsb atm */
78extern void readsw(const void __iomem *addr, void *data, int wordlen); 86#define readsw readsw
79extern void readsl(const void __iomem *addr, void *data, int longlen); 87extern void readsw(const volatile void __iomem *addr, void *data, int wordlen);
88
89#define readsl readsl
90extern void readsl(const volatile void __iomem *addr, void *data, int longlen);
80 91
81#endif 92#endif
diff --git a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c
index 756cc377a73d..b57980b435fd 100644
--- a/arch/arm/mach-ebsa110/io.c
+++ b/arch/arm/mach-ebsa110/io.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL(__readb);
102EXPORT_SYMBOL(__readw); 102EXPORT_SYMBOL(__readw);
103EXPORT_SYMBOL(__readl); 103EXPORT_SYMBOL(__readl);
104 104
105void readsw(const void __iomem *addr, void *data, int len) 105void readsw(const volatile void __iomem *addr, void *data, int len)
106{ 106{
107 void __iomem *a = __isamem_convert_addr(addr); 107 void __iomem *a = __isamem_convert_addr(addr);
108 108
@@ -112,7 +112,7 @@ void readsw(const void __iomem *addr, void *data, int len)
112} 112}
113EXPORT_SYMBOL(readsw); 113EXPORT_SYMBOL(readsw);
114 114
115void readsl(const void __iomem *addr, void *data, int len) 115void readsl(const volatile void __iomem *addr, void *data, int len)
116{ 116{
117 void __iomem *a = __isamem_convert_addr(addr); 117 void __iomem *a = __isamem_convert_addr(addr);
118 118
@@ -122,7 +122,7 @@ void readsl(const void __iomem *addr, void *data, int len)
122} 122}
123EXPORT_SYMBOL(readsl); 123EXPORT_SYMBOL(readsl);
124 124
125void __writeb(u8 val, void __iomem *addr) 125void __writeb(u8 val, volatile void __iomem *addr)
126{ 126{
127 void __iomem *a = __isamem_convert_addr(addr); 127 void __iomem *a = __isamem_convert_addr(addr);
128 128
@@ -132,7 +132,7 @@ void __writeb(u8 val, void __iomem *addr)
132 __raw_writeb(val, a); 132 __raw_writeb(val, a);
133} 133}
134 134
135void __writew(u16 val, void __iomem *addr) 135void __writew(u16 val, volatile void __iomem *addr)
136{ 136{
137 void __iomem *a = __isamem_convert_addr(addr); 137 void __iomem *a = __isamem_convert_addr(addr);
138 138
@@ -142,7 +142,7 @@ void __writew(u16 val, void __iomem *addr)
142 __raw_writew(val, a); 142 __raw_writew(val, a);
143} 143}
144 144
145void __writel(u32 val, void __iomem *addr) 145void __writel(u32 val, volatile void __iomem *addr)
146{ 146{
147 void __iomem *a = __isamem_convert_addr(addr); 147 void __iomem *a = __isamem_convert_addr(addr);
148 148
@@ -157,7 +157,7 @@ EXPORT_SYMBOL(__writeb);
157EXPORT_SYMBOL(__writew); 157EXPORT_SYMBOL(__writew);
158EXPORT_SYMBOL(__writel); 158EXPORT_SYMBOL(__writel);
159 159
160void writesw(void __iomem *addr, const void *data, int len) 160void writesw(volatile void __iomem *addr, const void *data, int len)
161{ 161{
162 void __iomem *a = __isamem_convert_addr(addr); 162 void __iomem *a = __isamem_convert_addr(addr);
163 163
@@ -167,7 +167,7 @@ void writesw(void __iomem *addr, const void *data, int len)
167} 167}
168EXPORT_SYMBOL(writesw); 168EXPORT_SYMBOL(writesw);
169 169
170void writesl(void __iomem *addr, const void *data, int len) 170void writesl(volatile void __iomem *addr, const void *data, int len)
171{ 171{
172 void __iomem *a = __isamem_convert_addr(addr); 172 void __iomem *a = __isamem_convert_addr(addr);
173 173
diff --git a/arch/arm/mach-ep93xx/dma.c b/arch/arm/mach-ep93xx/dma.c
index d8bfd02f5047..88a4c9b089a5 100644
--- a/arch/arm/mach-ep93xx/dma.c
+++ b/arch/arm/mach-ep93xx/dma.c
@@ -66,11 +66,15 @@ static struct ep93xx_dma_platform_data ep93xx_dma_m2p_data = {
66 .num_channels = ARRAY_SIZE(ep93xx_dma_m2p_channels), 66 .num_channels = ARRAY_SIZE(ep93xx_dma_m2p_channels),
67}; 67};
68 68
69static u64 ep93xx_dma_m2p_mask = DMA_BIT_MASK(32);
70
69static struct platform_device ep93xx_dma_m2p_device = { 71static struct platform_device ep93xx_dma_m2p_device = {
70 .name = "ep93xx-dma-m2p", 72 .name = "ep93xx-dma-m2p",
71 .id = -1, 73 .id = -1,
72 .dev = { 74 .dev = {
73 .platform_data = &ep93xx_dma_m2p_data, 75 .platform_data = &ep93xx_dma_m2p_data,
76 .dma_mask = &ep93xx_dma_m2p_mask,
77 .coherent_dma_mask = DMA_BIT_MASK(32),
74 }, 78 },
75}; 79};
76 80
@@ -93,11 +97,15 @@ static struct ep93xx_dma_platform_data ep93xx_dma_m2m_data = {
93 .num_channels = ARRAY_SIZE(ep93xx_dma_m2m_channels), 97 .num_channels = ARRAY_SIZE(ep93xx_dma_m2m_channels),
94}; 98};
95 99
100static u64 ep93xx_dma_m2m_mask = DMA_BIT_MASK(32);
101
96static struct platform_device ep93xx_dma_m2m_device = { 102static struct platform_device ep93xx_dma_m2m_device = {
97 .name = "ep93xx-dma-m2m", 103 .name = "ep93xx-dma-m2m",
98 .id = -1, 104 .id = -1,
99 .dev = { 105 .dev = {
100 .platform_data = &ep93xx_dma_m2m_data, 106 .platform_data = &ep93xx_dma_m2m_data,
107 .dma_mask = &ep93xx_dma_m2m_mask,
108 .coherent_dma_mask = DMA_BIT_MASK(32),
101 }, 109 },
102}; 110};
103 111
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 2d0240f241b8..b9e3f1c61baf 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -24,6 +24,7 @@ menuconfig ARCH_EXYNOS
24 select PM_GENERIC_DOMAINS if PM_RUNTIME 24 select PM_GENERIC_DOMAINS if PM_RUNTIME
25 select S5P_DEV_MFC 25 select S5P_DEV_MFC
26 select SRAM 26 select SRAM
27 select MFD_SYSCON
27 help 28 help
28 Support for SAMSUNG EXYNOS SoCs (EXYNOS4/5) 29 Support for SAMSUNG EXYNOS SoCs (EXYNOS4/5)
29 30
@@ -75,6 +76,11 @@ config SOC_EXYNOS4412
75 default y 76 default y
76 depends on ARCH_EXYNOS4 77 depends on ARCH_EXYNOS4
77 78
79config SOC_EXYNOS4415
80 bool "SAMSUNG EXYNOS4415"
81 default y
82 depends on ARCH_EXYNOS4
83
78config SOC_EXYNOS5250 84config SOC_EXYNOS5250
79 bool "SAMSUNG EXYNOS5250" 85 bool "SAMSUNG EXYNOS5250"
80 default y 86 default y
@@ -123,4 +129,9 @@ config EXYNOS5420_MCPM
123 This is needed to provide CPU and cluster power management 129 This is needed to provide CPU and cluster power management
124 on Exynos5420 implementing big.LITTLE. 130 on Exynos5420 implementing big.LITTLE.
125 131
132config EXYNOS_CPU_SUSPEND
133 bool
134 select ARM_CPU_SUSPEND
135 default PM_SLEEP || ARM_EXYNOS_CPUIDLE
136
126endif 137endif
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 27ae6144679c..bcefb5473ee4 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -11,16 +11,15 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include -I$(srctree)
11 11
12obj-$(CONFIG_ARCH_EXYNOS) += exynos.o pmu.o exynos-smc.o firmware.o 12obj-$(CONFIG_ARCH_EXYNOS) += exynos.o pmu.o exynos-smc.o firmware.o
13 13
14obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o 14obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm.o sleep.o
15obj-$(CONFIG_PM_SLEEP) += suspend.o
15obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o 16obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
16 17
17obj-$(CONFIG_SMP) += platsmp.o headsmp.o 18obj-$(CONFIG_SMP) += platsmp.o headsmp.o
18 19
19obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
20CFLAGS_hotplug.o += -march=armv7-a
21
22plus_sec := $(call as-instr,.arch_extension sec,+sec) 20plus_sec := $(call as-instr,.arch_extension sec,+sec)
23AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec) 21AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec)
22AFLAGS_sleep.o :=-Wa,-march=armv7-a$(plus_sec)
24 23
25obj-$(CONFIG_EXYNOS5420_MCPM) += mcpm-exynos.o 24obj-$(CONFIG_EXYNOS5420_MCPM) += mcpm-exynos.o
26CFLAGS_mcpm-exynos.o += -march=armv7-a 25CFLAGS_mcpm-exynos.o += -march=armv7-a
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 47b904b3b973..865f878063cc 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -12,7 +12,6 @@
12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H 12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H 13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H
14 14
15#include <linux/reboot.h>
16#include <linux/of.h> 15#include <linux/of.h>
17 16
18#define EXYNOS3250_SOC_ID 0xE3472000 17#define EXYNOS3250_SOC_ID 0xE3472000
@@ -111,11 +110,19 @@ IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
111#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5410() || \ 110#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5410() || \
112 soc_is_exynos5420() || soc_is_exynos5800()) 111 soc_is_exynos5420() || soc_is_exynos5800())
113 112
113extern u32 cp15_save_diag;
114extern u32 cp15_save_power;
115
114extern void __iomem *sysram_ns_base_addr; 116extern void __iomem *sysram_ns_base_addr;
115extern void __iomem *sysram_base_addr; 117extern void __iomem *sysram_base_addr;
116extern void __iomem *pmu_base_addr; 118extern void __iomem *pmu_base_addr;
117void exynos_sysram_init(void); 119void exynos_sysram_init(void);
118 120
121enum {
122 FW_DO_IDLE_SLEEP,
123 FW_DO_IDLE_AFTR,
124};
125
119void exynos_firmware_init(void); 126void exynos_firmware_init(void);
120 127
121extern u32 exynos_get_eint_wake_mask(void); 128extern u32 exynos_get_eint_wake_mask(void);
@@ -127,34 +134,20 @@ static inline void exynos_pm_init(void) {}
127#endif 134#endif
128 135
129extern void exynos_cpu_resume(void); 136extern void exynos_cpu_resume(void);
137extern void exynos_cpu_resume_ns(void);
130 138
131extern struct smp_operations exynos_smp_ops; 139extern struct smp_operations exynos_smp_ops;
132 140
133extern void exynos_cpu_die(unsigned int cpu);
134
135/* PMU(Power Management Unit) support */
136
137#define PMU_TABLE_END (-1U)
138
139enum sys_powerdown {
140 SYS_AFTR,
141 SYS_LPA,
142 SYS_SLEEP,
143 NUM_SYS_POWERDOWN,
144};
145
146struct exynos_pmu_conf {
147 unsigned int offset;
148 unsigned int val[NUM_SYS_POWERDOWN];
149};
150
151extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
152extern void exynos_cpu_power_down(int cpu); 141extern void exynos_cpu_power_down(int cpu);
153extern void exynos_cpu_power_up(int cpu); 142extern void exynos_cpu_power_up(int cpu);
154extern int exynos_cpu_power_state(int cpu); 143extern int exynos_cpu_power_state(int cpu);
155extern void exynos_cluster_power_down(int cluster); 144extern void exynos_cluster_power_down(int cluster);
156extern void exynos_cluster_power_up(int cluster); 145extern void exynos_cluster_power_up(int cluster);
157extern int exynos_cluster_power_state(int cluster); 146extern int exynos_cluster_power_state(int cluster);
147extern void exynos_cpu_save_register(void);
148extern void exynos_cpu_restore_register(void);
149extern void exynos_pm_central_suspend(void);
150extern int exynos_pm_central_resume(void);
158extern void exynos_enter_aftr(void); 151extern void exynos_enter_aftr(void);
159 152
160extern void s5p_init_cpu(void __iomem *cpuid_addr); 153extern void s5p_init_cpu(void __iomem *cpuid_addr);
diff --git a/arch/arm/mach-exynos/exynos-pmu.h b/arch/arm/mach-exynos/exynos-pmu.h
new file mode 100644
index 000000000000..a2ab0d52b230
--- /dev/null
+++ b/arch/arm/mach-exynos/exynos-pmu.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Header for EXYNOS PMU Driver support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __EXYNOS_PMU_H
13#define __EXYNOS_PMU_H
14
15enum sys_powerdown {
16 SYS_AFTR,
17 SYS_LPA,
18 SYS_SLEEP,
19 NUM_SYS_POWERDOWN,
20};
21
22extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
23
24#endif /* __EXYNOS_PMU_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 6b283eb3202e..c13d0837fa8c 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -41,41 +41,11 @@ static struct map_desc exynos4_iodesc[] __initdata = {
41 .length = SZ_64K, 41 .length = SZ_64K,
42 .type = MT_DEVICE, 42 .type = MT_DEVICE,
43 }, { 43 }, {
44 .virtual = (unsigned long)S3C_VA_TIMER,
45 .pfn = __phys_to_pfn(EXYNOS4_PA_TIMER),
46 .length = SZ_16K,
47 .type = MT_DEVICE,
48 }, {
49 .virtual = (unsigned long)S3C_VA_WATCHDOG,
50 .pfn = __phys_to_pfn(EXYNOS4_PA_WATCHDOG),
51 .length = SZ_4K,
52 .type = MT_DEVICE,
53 }, {
54 .virtual = (unsigned long)S5P_VA_SROMC, 44 .virtual = (unsigned long)S5P_VA_SROMC,
55 .pfn = __phys_to_pfn(EXYNOS4_PA_SROMC), 45 .pfn = __phys_to_pfn(EXYNOS4_PA_SROMC),
56 .length = SZ_4K, 46 .length = SZ_4K,
57 .type = MT_DEVICE, 47 .type = MT_DEVICE,
58 }, { 48 }, {
59 .virtual = (unsigned long)S5P_VA_SYSTIMER,
60 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSTIMER),
61 .length = SZ_4K,
62 .type = MT_DEVICE,
63 }, {
64 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
65 .pfn = __phys_to_pfn(EXYNOS4_PA_COMBINER),
66 .length = SZ_4K,
67 .type = MT_DEVICE,
68 }, {
69 .virtual = (unsigned long)S5P_VA_GIC_CPU,
70 .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_CPU),
71 .length = SZ_64K,
72 .type = MT_DEVICE,
73 }, {
74 .virtual = (unsigned long)S5P_VA_GIC_DIST,
75 .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_DIST),
76 .length = SZ_64K,
77 .type = MT_DEVICE,
78 }, {
79 .virtual = (unsigned long)S5P_VA_CMU, 49 .virtual = (unsigned long)S5P_VA_CMU,
80 .pfn = __phys_to_pfn(EXYNOS4_PA_CMU), 50 .pfn = __phys_to_pfn(EXYNOS4_PA_CMU),
81 .length = SZ_128K, 51 .length = SZ_128K,
@@ -86,11 +56,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
86 .length = SZ_8K, 56 .length = SZ_8K,
87 .type = MT_DEVICE, 57 .type = MT_DEVICE,
88 }, { 58 }, {
89 .virtual = (unsigned long)S5P_VA_L2CC,
90 .pfn = __phys_to_pfn(EXYNOS4_PA_L2CC),
91 .length = SZ_4K,
92 .type = MT_DEVICE,
93 }, {
94 .virtual = (unsigned long)S5P_VA_DMC0, 59 .virtual = (unsigned long)S5P_VA_DMC0,
95 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0), 60 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0),
96 .length = SZ_64K, 61 .length = SZ_64K,
@@ -100,11 +65,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
100 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC1), 65 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC1),
101 .length = SZ_64K, 66 .length = SZ_64K,
102 .type = MT_DEVICE, 67 .type = MT_DEVICE,
103 }, {
104 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
105 .pfn = __phys_to_pfn(EXYNOS4_PA_HSPHY),
106 .length = SZ_4K,
107 .type = MT_DEVICE,
108 }, 68 },
109}; 69};
110 70
@@ -115,16 +75,6 @@ static struct map_desc exynos5_iodesc[] __initdata = {
115 .length = SZ_64K, 75 .length = SZ_64K,
116 .type = MT_DEVICE, 76 .type = MT_DEVICE,
117 }, { 77 }, {
118 .virtual = (unsigned long)S3C_VA_TIMER,
119 .pfn = __phys_to_pfn(EXYNOS5_PA_TIMER),
120 .length = SZ_16K,
121 .type = MT_DEVICE,
122 }, {
123 .virtual = (unsigned long)S3C_VA_WATCHDOG,
124 .pfn = __phys_to_pfn(EXYNOS5_PA_WATCHDOG),
125 .length = SZ_4K,
126 .type = MT_DEVICE,
127 }, {
128 .virtual = (unsigned long)S5P_VA_SROMC, 78 .virtual = (unsigned long)S5P_VA_SROMC,
129 .pfn = __phys_to_pfn(EXYNOS5_PA_SROMC), 79 .pfn = __phys_to_pfn(EXYNOS5_PA_SROMC),
130 .length = SZ_4K, 80 .length = SZ_4K,
@@ -137,28 +87,6 @@ static struct map_desc exynos5_iodesc[] __initdata = {
137 }, 87 },
138}; 88};
139 89
140static void exynos_restart(enum reboot_mode mode, const char *cmd)
141{
142 struct device_node *np;
143 u32 val = 0x1;
144 void __iomem *addr = pmu_base_addr + EXYNOS_SWRESET;
145
146 if (of_machine_is_compatible("samsung,exynos5440")) {
147 u32 status;
148 np = of_find_compatible_node(NULL, NULL, "samsung,exynos5440-clock");
149
150 addr = of_iomap(np, 0) + 0xbc;
151 status = __raw_readl(addr);
152
153 addr = of_iomap(np, 0) + 0xcc;
154 val = __raw_readl(addr);
155
156 val = (val & 0xffff0000) | (status & 0xffff);
157 }
158
159 __raw_writel(val, addr);
160}
161
162static struct platform_device exynos_cpuidle = { 90static struct platform_device exynos_cpuidle = {
163 .name = "exynos_cpuidle", 91 .name = "exynos_cpuidle",
164#ifdef CONFIG_ARM_EXYNOS_CPUIDLE 92#ifdef CONFIG_ARM_EXYNOS_CPUIDLE
@@ -252,6 +180,7 @@ static const struct of_device_id exynos_dt_pmu_match[] = {
252 { .compatible = "samsung,exynos4210-pmu" }, 180 { .compatible = "samsung,exynos4210-pmu" },
253 { .compatible = "samsung,exynos4212-pmu" }, 181 { .compatible = "samsung,exynos4212-pmu" },
254 { .compatible = "samsung,exynos4412-pmu" }, 182 { .compatible = "samsung,exynos4412-pmu" },
183 { .compatible = "samsung,exynos4415-pmu" },
255 { .compatible = "samsung,exynos5250-pmu" }, 184 { .compatible = "samsung,exynos5250-pmu" },
256 { .compatible = "samsung,exynos5260-pmu" }, 185 { .compatible = "samsung,exynos5260-pmu" },
257 { .compatible = "samsung,exynos5410-pmu" }, 186 { .compatible = "samsung,exynos5410-pmu" },
@@ -318,7 +247,10 @@ static void __init exynos_dt_machine_init(void)
318 exynos_sysram_init(); 247 exynos_sysram_init();
319 248
320 if (of_machine_is_compatible("samsung,exynos4210") || 249 if (of_machine_is_compatible("samsung,exynos4210") ||
321 of_machine_is_compatible("samsung,exynos5250")) 250 of_machine_is_compatible("samsung,exynos4212") ||
251 (of_machine_is_compatible("samsung,exynos4412") &&
252 of_machine_is_compatible("samsung,trats2")) ||
253 of_machine_is_compatible("samsung,exynos5250"))
322 platform_device_register(&exynos_cpuidle); 254 platform_device_register(&exynos_cpuidle);
323 255
324 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); 256 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
@@ -333,6 +265,7 @@ static char const *exynos_dt_compat[] __initconst = {
333 "samsung,exynos4210", 265 "samsung,exynos4210",
334 "samsung,exynos4212", 266 "samsung,exynos4212",
335 "samsung,exynos4412", 267 "samsung,exynos4412",
268 "samsung,exynos4415",
336 "samsung,exynos5", 269 "samsung,exynos5",
337 "samsung,exynos5250", 270 "samsung,exynos5250",
338 "samsung,exynos5260", 271 "samsung,exynos5260",
@@ -378,7 +311,6 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)")
378 .init_machine = exynos_dt_machine_init, 311 .init_machine = exynos_dt_machine_init,
379 .init_late = exynos_init_late, 312 .init_late = exynos_init_late,
380 .dt_compat = exynos_dt_compat, 313 .dt_compat = exynos_dt_compat,
381 .restart = exynos_restart,
382 .reserve = exynos_reserve, 314 .reserve = exynos_reserve,
383 .dt_fixup = exynos_dt_fixup, 315 .dt_fixup = exynos_dt_fixup,
384MACHINE_END 316MACHINE_END
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index e8797bb78871..766f57d2f029 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -14,16 +14,44 @@
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/of_address.h> 15#include <linux/of_address.h>
16 16
17#include <asm/cacheflush.h>
18#include <asm/cputype.h>
17#include <asm/firmware.h> 19#include <asm/firmware.h>
20#include <asm/suspend.h>
18 21
19#include <mach/map.h> 22#include <mach/map.h>
20 23
21#include "common.h" 24#include "common.h"
22#include "smc.h" 25#include "smc.h"
23 26
24static int exynos_do_idle(void) 27#define EXYNOS_SLEEP_MAGIC 0x00000bad
28#define EXYNOS_AFTR_MAGIC 0xfcba0d10
29#define EXYNOS_BOOT_ADDR 0x8
30#define EXYNOS_BOOT_FLAG 0xc
31
32static void exynos_save_cp15(void)
25{ 33{
26 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0); 34 /* Save Power control and Diagnostic registers */
35 asm ("mrc p15, 0, %0, c15, c0, 0\n"
36 "mrc p15, 0, %1, c15, c0, 1\n"
37 : "=r" (cp15_save_power), "=r" (cp15_save_diag)
38 : : "cc");
39}
40
41static int exynos_do_idle(unsigned long mode)
42{
43 switch (mode) {
44 case FW_DO_IDLE_AFTR:
45 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
46 exynos_save_cp15();
47 __raw_writel(virt_to_phys(exynos_cpu_resume_ns),
48 sysram_ns_base_addr + 0x24);
49 __raw_writel(EXYNOS_AFTR_MAGIC, sysram_ns_base_addr + 0x20);
50 exynos_smc(SMC_CMD_CPU0AFTR, 0, 0, 0);
51 break;
52 case FW_DO_IDLE_SLEEP:
53 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
54 }
27 return 0; 55 return 0;
28} 56}
29 57
@@ -69,10 +97,43 @@ static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
69 return 0; 97 return 0;
70} 98}
71 99
100static int exynos_cpu_suspend(unsigned long arg)
101{
102 flush_cache_all();
103 outer_flush_all();
104
105 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
106
107 pr_info("Failed to suspend the system\n");
108 writel(0, sysram_ns_base_addr + EXYNOS_BOOT_FLAG);
109 return 1;
110}
111
112static int exynos_suspend(void)
113{
114 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
115 exynos_save_cp15();
116
117 writel(EXYNOS_SLEEP_MAGIC, sysram_ns_base_addr + EXYNOS_BOOT_FLAG);
118 writel(virt_to_phys(exynos_cpu_resume_ns),
119 sysram_ns_base_addr + EXYNOS_BOOT_ADDR);
120
121 return cpu_suspend(0, exynos_cpu_suspend);
122}
123
124static int exynos_resume(void)
125{
126 writel(0, sysram_ns_base_addr + EXYNOS_BOOT_FLAG);
127
128 return 0;
129}
130
72static const struct firmware_ops exynos_firmware_ops = { 131static const struct firmware_ops exynos_firmware_ops = {
73 .do_idle = exynos_do_idle, 132 .do_idle = IS_ENABLED(CONFIG_EXYNOS_CPU_SUSPEND) ? exynos_do_idle : NULL,
74 .set_cpu_boot_addr = exynos_set_cpu_boot_addr, 133 .set_cpu_boot_addr = exynos_set_cpu_boot_addr,
75 .cpu_boot = exynos_cpu_boot, 134 .cpu_boot = exynos_cpu_boot,
135 .suspend = IS_ENABLED(CONFIG_PM_SLEEP) ? exynos_suspend : NULL,
136 .resume = IS_ENABLED(CONFIG_EXYNOS_CPU_SUSPEND) ? exynos_resume : NULL,
76}; 137};
77 138
78void __init exynos_firmware_init(void) 139void __init exynos_firmware_init(void)
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
deleted file mode 100644
index 4d86961a7957..000000000000
--- a/arch/arm/mach-exynos/hotplug.c
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * Cloned from linux/arch/arm/mach-realview/hotplug.c
3 *
4 * Copyright (C) 2002 ARM Ltd.
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/smp.h>
15#include <linux/io.h>
16
17#include <asm/cacheflush.h>
18#include <asm/cp15.h>
19#include <asm/smp_plat.h>
20
21#include "common.h"
22#include "regs-pmu.h"
23
24static inline void cpu_leave_lowpower(void)
25{
26 unsigned int v;
27
28 asm volatile(
29 "mrc p15, 0, %0, c1, c0, 0\n"
30 " orr %0, %0, %1\n"
31 " mcr p15, 0, %0, c1, c0, 0\n"
32 " mrc p15, 0, %0, c1, c0, 1\n"
33 " orr %0, %0, %2\n"
34 " mcr p15, 0, %0, c1, c0, 1\n"
35 : "=&r" (v)
36 : "Ir" (CR_C), "Ir" (0x40)
37 : "cc");
38}
39
40static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
41{
42 u32 mpidr = cpu_logical_map(cpu);
43 u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
44
45 for (;;) {
46
47 /* Turn the CPU off on next WFI instruction. */
48 exynos_cpu_power_down(core_id);
49
50 wfi();
51
52 if (pen_release == core_id) {
53 /*
54 * OK, proper wakeup, we're done
55 */
56 break;
57 }
58
59 /*
60 * Getting here, means that we have come out of WFI without
61 * having been woken up - this shouldn't happen
62 *
63 * Just note it happening - when we're woken, we can report
64 * its occurrence.
65 */
66 (*spurious)++;
67 }
68}
69
70/*
71 * platform-specific code to shutdown a CPU
72 *
73 * Called with IRQs disabled
74 */
75void __ref exynos_cpu_die(unsigned int cpu)
76{
77 int spurious = 0;
78
79 v7_exit_coherency_flush(louis);
80
81 platform_do_lowpower(cpu, &spurious);
82
83 /*
84 * bring this CPU back into the world of cache
85 * coherency, and then restore interrupts
86 */
87 cpu_leave_lowpower();
88
89 if (spurious)
90 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
91}
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index f0b7e92bad6c..1ad3f496ef56 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -30,40 +30,17 @@
30#define EXYNOS4_PA_CMU 0x10030000 30#define EXYNOS4_PA_CMU 0x10030000
31#define EXYNOS5_PA_CMU 0x10010000 31#define EXYNOS5_PA_CMU 0x10010000
32 32
33#define EXYNOS4_PA_SYSTIMER 0x10050000
34
35#define EXYNOS4_PA_WATCHDOG 0x10060000
36#define EXYNOS5_PA_WATCHDOG 0x101D0000
37
38#define EXYNOS4_PA_DMC0 0x10400000 33#define EXYNOS4_PA_DMC0 0x10400000
39#define EXYNOS4_PA_DMC1 0x10410000 34#define EXYNOS4_PA_DMC1 0x10410000
40 35
41#define EXYNOS4_PA_COMBINER 0x10440000
42#define EXYNOS5_PA_COMBINER 0x10440000
43
44#define EXYNOS4_PA_GIC_CPU 0x10480000
45#define EXYNOS4_PA_GIC_DIST 0x10490000
46#define EXYNOS5_PA_GIC_CPU 0x10482000
47#define EXYNOS5_PA_GIC_DIST 0x10481000
48
49#define EXYNOS4_PA_COREPERI 0x10500000 36#define EXYNOS4_PA_COREPERI 0x10500000
50#define EXYNOS4_PA_L2CC 0x10502000 37#define EXYNOS4_PA_L2CC 0x10502000
51 38
52#define EXYNOS4_PA_SROMC 0x12570000 39#define EXYNOS4_PA_SROMC 0x12570000
53#define EXYNOS5_PA_SROMC 0x12250000 40#define EXYNOS5_PA_SROMC 0x12250000
54 41
55#define EXYNOS4_PA_HSPHY 0x125B0000
56
57#define EXYNOS4_PA_UART 0x13800000
58#define EXYNOS5_PA_UART 0x12C00000
59
60#define EXYNOS4_PA_TIMER 0x139D0000
61#define EXYNOS5_PA_TIMER 0x12DD0000
62
63/* Compatibility UART */ 42/* Compatibility UART */
64 43
65#define EXYNOS5440_PA_UART0 0x000B0000 44#define EXYNOS5440_PA_UART0 0x000B0000
66 45
67#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
68
69#endif /* __ASM_ARCH_MAP_H */ 46#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index dc9a764a7c37..b0d3c2e876fb 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -15,6 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of_address.h> 17#include <linux/of_address.h>
18#include <linux/syscore_ops.h>
18 19
19#include <asm/cputype.h> 20#include <asm/cputype.h>
20#include <asm/cp15.h> 21#include <asm/cp15.h>
@@ -30,6 +31,8 @@
30#define EXYNOS5420_USE_ARM_CORE_DOWN_STATE BIT(29) 31#define EXYNOS5420_USE_ARM_CORE_DOWN_STATE BIT(29)
31#define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30) 32#define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30)
32 33
34static void __iomem *ns_sram_base_addr;
35
33/* 36/*
34 * The common v7_exit_coherency_flush API could not be used because of the 37 * The common v7_exit_coherency_flush API could not be used because of the
35 * Erratum 799270 workaround. This macro is the same as the common one (in 38 * Erratum 799270 workaround. This macro is the same as the common one (in
@@ -318,10 +321,26 @@ static const struct of_device_id exynos_dt_mcpm_match[] = {
318 {}, 321 {},
319}; 322};
320 323
324static void exynos_mcpm_setup_entry_point(void)
325{
326 /*
327 * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr
328 * as part of secondary_cpu_start(). Let's redirect it to the
329 * mcpm_entry_point(). This is done during both secondary boot-up as
330 * well as system resume.
331 */
332 __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */
333 __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */
334 __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8);
335}
336
337static struct syscore_ops exynos_mcpm_syscore_ops = {
338 .resume = exynos_mcpm_setup_entry_point,
339};
340
321static int __init exynos_mcpm_init(void) 341static int __init exynos_mcpm_init(void)
322{ 342{
323 struct device_node *node; 343 struct device_node *node;
324 void __iomem *ns_sram_base_addr;
325 unsigned int value, i; 344 unsigned int value, i;
326 int ret; 345 int ret;
327 346
@@ -387,16 +406,9 @@ static int __init exynos_mcpm_init(void)
387 pmu_raw_writel(value, EXYNOS_COMMON_OPTION(i)); 406 pmu_raw_writel(value, EXYNOS_COMMON_OPTION(i));
388 } 407 }
389 408
390 /* 409 exynos_mcpm_setup_entry_point();
391 * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr
392 * as part of secondary_cpu_start(). Let's redirect it to the
393 * mcpm_entry_point().
394 */
395 __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */
396 __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */
397 __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8);
398 410
399 iounmap(ns_sram_base_addr); 411 register_syscore_ops(&exynos_mcpm_syscore_ops);
400 412
401 return ret; 413 return ret;
402} 414}
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 41ae28d69e6f..7a1ebfeeeeb8 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -22,6 +22,7 @@
22#include <linux/of_address.h> 22#include <linux/of_address.h>
23 23
24#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
25#include <asm/cp15.h>
25#include <asm/smp_plat.h> 26#include <asm/smp_plat.h>
26#include <asm/smp_scu.h> 27#include <asm/smp_scu.h>
27#include <asm/firmware.h> 28#include <asm/firmware.h>
@@ -33,6 +34,88 @@
33 34
34extern void exynos4_secondary_startup(void); 35extern void exynos4_secondary_startup(void);
35 36
37/*
38 * Set or clear the USE_DELAYED_RESET_ASSERTION option, set on Exynos4 SoCs
39 * during hot-(un)plugging CPUx.
40 *
41 * The feature can be cleared safely during first boot of secondary CPU.
42 *
43 * Exynos4 SoCs require setting USE_DELAYED_RESET_ASSERTION during powering
44 * down a CPU so the CPU idle clock down feature could properly detect global
45 * idle state when CPUx is off.
46 */
47static void exynos_set_delayed_reset_assertion(u32 core_id, bool enable)
48{
49 if (soc_is_exynos4()) {
50 unsigned int tmp;
51
52 tmp = pmu_raw_readl(EXYNOS_ARM_CORE_OPTION(core_id));
53 if (enable)
54 tmp |= S5P_USE_DELAYED_RESET_ASSERTION;
55 else
56 tmp &= ~(S5P_USE_DELAYED_RESET_ASSERTION);
57 pmu_raw_writel(tmp, EXYNOS_ARM_CORE_OPTION(core_id));
58 }
59}
60
61#ifdef CONFIG_HOTPLUG_CPU
62static inline void cpu_leave_lowpower(u32 core_id)
63{
64 unsigned int v;
65
66 asm volatile(
67 "mrc p15, 0, %0, c1, c0, 0\n"
68 " orr %0, %0, %1\n"
69 " mcr p15, 0, %0, c1, c0, 0\n"
70 " mrc p15, 0, %0, c1, c0, 1\n"
71 " orr %0, %0, %2\n"
72 " mcr p15, 0, %0, c1, c0, 1\n"
73 : "=&r" (v)
74 : "Ir" (CR_C), "Ir" (0x40)
75 : "cc");
76
77 exynos_set_delayed_reset_assertion(core_id, false);
78}
79
80static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
81{
82 u32 mpidr = cpu_logical_map(cpu);
83 u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
84
85 for (;;) {
86
87 /* Turn the CPU off on next WFI instruction. */
88 exynos_cpu_power_down(core_id);
89
90 /*
91 * Exynos4 SoCs require setting
92 * USE_DELAYED_RESET_ASSERTION so the CPU idle
93 * clock down feature could properly detect
94 * global idle state when CPUx is off.
95 */
96 exynos_set_delayed_reset_assertion(core_id, true);
97
98 wfi();
99
100 if (pen_release == core_id) {
101 /*
102 * OK, proper wakeup, we're done
103 */
104 break;
105 }
106
107 /*
108 * Getting here, means that we have come out of WFI without
109 * having been woken up - this shouldn't happen
110 *
111 * Just note it happening - when we're woken, we can report
112 * its occurrence.
113 */
114 (*spurious)++;
115 }
116}
117#endif /* CONFIG_HOTPLUG_CPU */
118
36/** 119/**
37 * exynos_core_power_down : power down the specified cpu 120 * exynos_core_power_down : power down the specified cpu
38 * @cpu : the cpu to power down 121 * @cpu : the cpu to power down
@@ -43,6 +126,18 @@ extern void exynos4_secondary_startup(void);
43 */ 126 */
44void exynos_cpu_power_down(int cpu) 127void exynos_cpu_power_down(int cpu)
45{ 128{
129 if (cpu == 0 && (of_machine_is_compatible("samsung,exynos5420") ||
130 of_machine_is_compatible("samsung,exynos5800"))) {
131 /*
132 * Bypass power down for CPU0 during suspend. Check for
133 * the SYS_PWR_REG value to decide if we are suspending
134 * the system.
135 */
136 int val = pmu_raw_readl(EXYNOS5_ARM_CORE0_SYS_PWR_REG);
137
138 if (!(val & S5P_CORE_LOCAL_PWR_EN))
139 return;
140 }
46 pmu_raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu)); 141 pmu_raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu));
47} 142}
48 143
@@ -121,6 +216,26 @@ static inline void __iomem *cpu_boot_reg(int cpu)
121} 216}
122 217
123/* 218/*
219 * Set wake up by local power mode and execute software reset for given core.
220 *
221 * Currently this is needed only when booting secondary CPU on Exynos3250.
222 */
223static void exynos_core_restart(u32 core_id)
224{
225 u32 val;
226
227 if (!of_machine_is_compatible("samsung,exynos3250"))
228 return;
229
230 val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));
231 val |= S5P_CORE_WAKEUP_FROM_LOCAL_CFG;
232 pmu_raw_writel(val, EXYNOS_ARM_CORE_STATUS(core_id));
233
234 pr_info("CPU%u: Software reset\n", core_id);
235 pmu_raw_writel(EXYNOS_CORE_PO_RESET(core_id), EXYNOS_SWRESET);
236}
237
238/*
124 * Write pen_release in a way that is guaranteed to be visible to all 239 * Write pen_release in a way that is guaranteed to be visible to all
125 * observers, irrespective of whether they're taking part in coherency 240 * observers, irrespective of whether they're taking part in coherency
126 * or not. This is necessary for the hotplug code to work reliably. 241 * or not. This is necessary for the hotplug code to work reliably.
@@ -196,6 +311,9 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle)
196 return -ETIMEDOUT; 311 return -ETIMEDOUT;
197 } 312 }
198 } 313 }
314
315 exynos_core_restart(core_id);
316
199 /* 317 /*
200 * Send the secondary CPU a soft interrupt, thereby causing 318 * Send the secondary CPU a soft interrupt, thereby causing
201 * the boot monitor to read the system wide flags register, 319 * the boot monitor to read the system wide flags register,
@@ -237,6 +355,9 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle)
237 udelay(10); 355 udelay(10);
238 } 356 }
239 357
358 /* No harm if this is called during first boot of secondary CPU */
359 exynos_set_delayed_reset_assertion(core_id, false);
360
240 /* 361 /*
241 * now the secondary core is starting up let it run its 362 * now the secondary core is starting up let it run its
242 * calibrations, then wait for it to finish 363 * calibrations, then wait for it to finish
@@ -318,6 +439,33 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
318 } 439 }
319} 440}
320 441
442#ifdef CONFIG_HOTPLUG_CPU
443/*
444 * platform-specific code to shutdown a CPU
445 *
446 * Called with IRQs disabled
447 */
448static void exynos_cpu_die(unsigned int cpu)
449{
450 int spurious = 0;
451 u32 mpidr = cpu_logical_map(cpu);
452 u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
453
454 v7_exit_coherency_flush(louis);
455
456 platform_do_lowpower(cpu, &spurious);
457
458 /*
459 * bring this CPU back into the world of cache
460 * coherency, and then restore interrupts
461 */
462 cpu_leave_lowpower(core_id);
463
464 if (spurious)
465 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
466}
467#endif /* CONFIG_HOTPLUG_CPU */
468
321struct smp_operations exynos_smp_ops __initdata = { 469struct smp_operations exynos_smp_ops __initdata = {
322 .smp_init_cpus = exynos_smp_init_cpus, 470 .smp_init_cpus = exynos_smp_init_cpus,
323 .smp_prepare_cpus = exynos_smp_prepare_cpus, 471 .smp_prepare_cpus = exynos_smp_prepare_cpus,
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index abefacb45976..86f3ecd88f78 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com 3 * http://www.samsung.com
4 * 4 *
5 * EXYNOS - Power Management support 5 * EXYNOS - Power Management support
@@ -15,109 +15,45 @@
15 15
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/suspend.h> 17#include <linux/suspend.h>
18#include <linux/syscore_ops.h>
19#include <linux/cpu_pm.h> 18#include <linux/cpu_pm.h>
20#include <linux/io.h> 19#include <linux/io.h>
21#include <linux/irqchip/arm-gic.h>
22#include <linux/err.h> 20#include <linux/err.h>
23#include <linux/clk.h>
24 21
25#include <asm/cacheflush.h> 22#include <asm/firmware.h>
26#include <asm/hardware/cache-l2x0.h>
27#include <asm/smp_scu.h> 23#include <asm/smp_scu.h>
28#include <asm/suspend.h> 24#include <asm/suspend.h>
29 25
30#include <plat/pm-common.h> 26#include <plat/pm-common.h>
31#include <plat/regs-srom.h>
32
33#include <mach/map.h>
34 27
35#include "common.h" 28#include "common.h"
29#include "exynos-pmu.h"
36#include "regs-pmu.h" 30#include "regs-pmu.h"
37#include "regs-sys.h" 31#include "regs-sys.h"
38 32
39/** 33static inline void __iomem *exynos_boot_vector_addr(void)
40 * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping
41 * @hwirq: Hardware IRQ signal of the GIC
42 * @mask: Mask in PMU wake-up mask register
43 */
44struct exynos_wkup_irq {
45 unsigned int hwirq;
46 u32 mask;
47};
48
49static struct sleep_save exynos5_sys_save[] = {
50 SAVE_ITEM(EXYNOS5_SYS_I2C_CFG),
51};
52
53static struct sleep_save exynos_core_save[] = {
54 /* SROM side */
55 SAVE_ITEM(S5P_SROM_BW),
56 SAVE_ITEM(S5P_SROM_BC0),
57 SAVE_ITEM(S5P_SROM_BC1),
58 SAVE_ITEM(S5P_SROM_BC2),
59 SAVE_ITEM(S5P_SROM_BC3),
60};
61
62/*
63 * GIC wake-up support
64 */
65
66static u32 exynos_irqwake_intmask = 0xffffffff;
67
68static const struct exynos_wkup_irq exynos4_wkup_irq[] = {
69 { 76, BIT(1) }, /* RTC alarm */
70 { 77, BIT(2) }, /* RTC tick */
71 { /* sentinel */ },
72};
73
74static const struct exynos_wkup_irq exynos5250_wkup_irq[] = {
75 { 75, BIT(1) }, /* RTC alarm */
76 { 76, BIT(2) }, /* RTC tick */
77 { /* sentinel */ },
78};
79
80static int exynos_irq_set_wake(struct irq_data *data, unsigned int state)
81{ 34{
82 const struct exynos_wkup_irq *wkup_irq; 35 if (samsung_rev() == EXYNOS4210_REV_1_1)
83 36 return pmu_base_addr + S5P_INFORM7;
84 if (soc_is_exynos5250()) 37 else if (samsung_rev() == EXYNOS4210_REV_1_0)
85 wkup_irq = exynos5250_wkup_irq; 38 return sysram_base_addr + 0x24;
86 else 39 return pmu_base_addr + S5P_INFORM0;
87 wkup_irq = exynos4_wkup_irq;
88
89 while (wkup_irq->mask) {
90 if (wkup_irq->hwirq == data->hwirq) {
91 if (!state)
92 exynos_irqwake_intmask |= wkup_irq->mask;
93 else
94 exynos_irqwake_intmask &= ~wkup_irq->mask;
95 return 0;
96 }
97 ++wkup_irq;
98 }
99
100 return -ENOENT;
101} 40}
102 41
103#define EXYNOS_BOOT_VECTOR_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \ 42static inline void __iomem *exynos_boot_vector_flag(void)
104 pmu_base_addr + S5P_INFORM7 : \ 43{
105 (samsung_rev() == EXYNOS4210_REV_1_0 ? \ 44 if (samsung_rev() == EXYNOS4210_REV_1_1)
106 (sysram_base_addr + 0x24) : \ 45 return pmu_base_addr + S5P_INFORM6;
107 pmu_base_addr + S5P_INFORM0)) 46 else if (samsung_rev() == EXYNOS4210_REV_1_0)
108#define EXYNOS_BOOT_VECTOR_FLAG (samsung_rev() == EXYNOS4210_REV_1_1 ? \ 47 return sysram_base_addr + 0x20;
109 pmu_base_addr + S5P_INFORM6 : \ 48 return pmu_base_addr + S5P_INFORM1;
110 (samsung_rev() == EXYNOS4210_REV_1_0 ? \ 49}
111 (sysram_base_addr + 0x20) : \
112 pmu_base_addr + S5P_INFORM1))
113 50
114#define S5P_CHECK_AFTR 0xFCBA0D10 51#define S5P_CHECK_AFTR 0xFCBA0D10
115#define S5P_CHECK_SLEEP 0x00000BAD
116 52
117/* For Cortex-A9 Diagnostic and Power control register */ 53/* For Cortex-A9 Diagnostic and Power control register */
118static unsigned int save_arm_register[2]; 54static unsigned int save_arm_register[2];
119 55
120static void exynos_cpu_save_register(void) 56void exynos_cpu_save_register(void)
121{ 57{
122 unsigned long tmp; 58 unsigned long tmp;
123 59
@@ -134,7 +70,7 @@ static void exynos_cpu_save_register(void)
134 save_arm_register[1] = tmp; 70 save_arm_register[1] = tmp;
135} 71}
136 72
137static void exynos_cpu_restore_register(void) 73void exynos_cpu_restore_register(void)
138{ 74{
139 unsigned long tmp; 75 unsigned long tmp;
140 76
@@ -153,7 +89,7 @@ static void exynos_cpu_restore_register(void)
153 : "cc"); 89 : "cc");
154} 90}
155 91
156static void exynos_pm_central_suspend(void) 92void exynos_pm_central_suspend(void)
157{ 93{
158 unsigned long tmp; 94 unsigned long tmp;
159 95
@@ -161,9 +97,13 @@ static void exynos_pm_central_suspend(void)
161 tmp = pmu_raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); 97 tmp = pmu_raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
162 tmp &= ~S5P_CENTRAL_LOWPWR_CFG; 98 tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
163 pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION); 99 pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
100
101 /* Setting SEQ_OPTION register */
102 pmu_raw_writel(S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0,
103 S5P_CENTRAL_SEQ_OPTION);
164} 104}
165 105
166static int exynos_pm_central_resume(void) 106int exynos_pm_central_resume(void)
167{ 107{
168 unsigned long tmp; 108 unsigned long tmp;
169 109
@@ -194,17 +134,26 @@ static void exynos_set_wakeupmask(long mask)
194 134
195static void exynos_cpu_set_boot_vector(long flags) 135static void exynos_cpu_set_boot_vector(long flags)
196{ 136{
197 __raw_writel(virt_to_phys(exynos_cpu_resume), EXYNOS_BOOT_VECTOR_ADDR); 137 __raw_writel(virt_to_phys(exynos_cpu_resume),
198 __raw_writel(flags, EXYNOS_BOOT_VECTOR_FLAG); 138 exynos_boot_vector_addr());
139 __raw_writel(flags, exynos_boot_vector_flag());
199} 140}
200 141
201static int exynos_aftr_finisher(unsigned long flags) 142static int exynos_aftr_finisher(unsigned long flags)
202{ 143{
144 int ret;
145
203 exynos_set_wakeupmask(0x0000ff3e); 146 exynos_set_wakeupmask(0x0000ff3e);
204 exynos_cpu_set_boot_vector(S5P_CHECK_AFTR);
205 /* Set value of power down register for aftr mode */ 147 /* Set value of power down register for aftr mode */
206 exynos_sys_powerdown_conf(SYS_AFTR); 148 exynos_sys_powerdown_conf(SYS_AFTR);
207 cpu_do_idle(); 149
150 ret = call_firmware_op(do_idle, FW_DO_IDLE_AFTR);
151 if (ret == -ENOSYS) {
152 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
153 exynos_cpu_save_register();
154 exynos_cpu_set_boot_vector(S5P_CHECK_AFTR);
155 cpu_do_idle();
156 }
208 157
209 return 1; 158 return 1;
210} 159}
@@ -214,196 +163,16 @@ void exynos_enter_aftr(void)
214 cpu_pm_enter(); 163 cpu_pm_enter();
215 164
216 exynos_pm_central_suspend(); 165 exynos_pm_central_suspend();
217 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
218 exynos_cpu_save_register();
219 166
220 cpu_suspend(0, exynos_aftr_finisher); 167 cpu_suspend(0, exynos_aftr_finisher);
221 168
222 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { 169 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
223 scu_enable(S5P_VA_SCU); 170 scu_enable(S5P_VA_SCU);
224 exynos_cpu_restore_register(); 171 if (call_firmware_op(resume) == -ENOSYS)
172 exynos_cpu_restore_register();
225 } 173 }
226 174
227 exynos_pm_central_resume(); 175 exynos_pm_central_resume();
228 176
229 cpu_pm_exit(); 177 cpu_pm_exit();
230} 178}
231
232static int exynos_cpu_suspend(unsigned long arg)
233{
234#ifdef CONFIG_CACHE_L2X0
235 outer_flush_all();
236#endif
237
238 if (soc_is_exynos5250())
239 flush_cache_all();
240
241 /* issue the standby signal into the pm unit. */
242 cpu_do_idle();
243
244 pr_info("Failed to suspend the system\n");
245 return 1; /* Aborting suspend */
246}
247
248static void exynos_pm_prepare(void)
249{
250 unsigned int tmp;
251
252 /* Set wake-up mask registers */
253 pmu_raw_writel(exynos_get_eint_wake_mask(), S5P_EINT_WAKEUP_MASK);
254 pmu_raw_writel(exynos_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK);
255
256 s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
257
258 if (soc_is_exynos5250()) {
259 s3c_pm_do_save(exynos5_sys_save, ARRAY_SIZE(exynos5_sys_save));
260 /* Disable USE_RETENTION of JPEG_MEM_OPTION */
261 tmp = pmu_raw_readl(EXYNOS5_JPEG_MEM_OPTION);
262 tmp &= ~EXYNOS5_OPTION_USE_RETENTION;
263 pmu_raw_writel(tmp, EXYNOS5_JPEG_MEM_OPTION);
264 }
265
266 /* Set value of power down register for sleep mode */
267
268 exynos_sys_powerdown_conf(SYS_SLEEP);
269 pmu_raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1);
270
271 /* ensure at least INFORM0 has the resume address */
272
273 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0);
274}
275
276static int exynos_pm_suspend(void)
277{
278 unsigned long tmp;
279
280 exynos_pm_central_suspend();
281
282 /* Setting SEQ_OPTION register */
283
284 tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
285 pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
286
287 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
288 exynos_cpu_save_register();
289
290 return 0;
291}
292
293static void exynos_pm_resume(void)
294{
295 if (exynos_pm_central_resume())
296 goto early_wakeup;
297
298 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
299 exynos_cpu_restore_register();
300
301 /* For release retention */
302
303 pmu_raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION);
304 pmu_raw_writel((1 << 28), S5P_PAD_RET_GPIO_OPTION);
305 pmu_raw_writel((1 << 28), S5P_PAD_RET_UART_OPTION);
306 pmu_raw_writel((1 << 28), S5P_PAD_RET_MMCA_OPTION);
307 pmu_raw_writel((1 << 28), S5P_PAD_RET_MMCB_OPTION);
308 pmu_raw_writel((1 << 28), S5P_PAD_RET_EBIA_OPTION);
309 pmu_raw_writel((1 << 28), S5P_PAD_RET_EBIB_OPTION);
310
311 if (soc_is_exynos5250())
312 s3c_pm_do_restore(exynos5_sys_save,
313 ARRAY_SIZE(exynos5_sys_save));
314
315 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
316
317 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
318 scu_enable(S5P_VA_SCU);
319
320early_wakeup:
321
322 /* Clear SLEEP mode set in INFORM1 */
323 pmu_raw_writel(0x0, S5P_INFORM1);
324
325 return;
326}
327
328static struct syscore_ops exynos_pm_syscore_ops = {
329 .suspend = exynos_pm_suspend,
330 .resume = exynos_pm_resume,
331};
332
333/*
334 * Suspend Ops
335 */
336
337static int exynos_suspend_enter(suspend_state_t state)
338{
339 int ret;
340
341 s3c_pm_debug_init();
342
343 S3C_PMDBG("%s: suspending the system...\n", __func__);
344
345 S3C_PMDBG("%s: wakeup masks: %08x,%08x\n", __func__,
346 exynos_irqwake_intmask, exynos_get_eint_wake_mask());
347
348 if (exynos_irqwake_intmask == -1U
349 && exynos_get_eint_wake_mask() == -1U) {
350 pr_err("%s: No wake-up sources!\n", __func__);
351 pr_err("%s: Aborting sleep\n", __func__);
352 return -EINVAL;
353 }
354
355 s3c_pm_save_uarts();
356 exynos_pm_prepare();
357 flush_cache_all();
358 s3c_pm_check_store();
359
360 ret = cpu_suspend(0, exynos_cpu_suspend);
361 if (ret)
362 return ret;
363
364 s3c_pm_restore_uarts();
365
366 S3C_PMDBG("%s: wakeup stat: %08x\n", __func__,
367 pmu_raw_readl(S5P_WAKEUP_STAT));
368
369 s3c_pm_check_restore();
370
371 S3C_PMDBG("%s: resuming the system...\n", __func__);
372
373 return 0;
374}
375
376static int exynos_suspend_prepare(void)
377{
378 s3c_pm_check_prepare();
379
380 return 0;
381}
382
383static void exynos_suspend_finish(void)
384{
385 s3c_pm_check_cleanup();
386}
387
388static const struct platform_suspend_ops exynos_suspend_ops = {
389 .enter = exynos_suspend_enter,
390 .prepare = exynos_suspend_prepare,
391 .finish = exynos_suspend_finish,
392 .valid = suspend_valid_only_mem,
393};
394
395void __init exynos_pm_init(void)
396{
397 u32 tmp;
398
399 /* Platform-specific GIC callback */
400 gic_arch_extn.irq_set_wake = exynos_irq_set_wake;
401
402 /* All wakeup disable */
403 tmp = pmu_raw_readl(S5P_WAKEUP_MASK);
404 tmp |= ((0xFF << 8) | (0x1F << 1));
405 pmu_raw_writel(tmp, S5P_WAKEUP_MASK);
406
407 register_syscore_ops(&exynos_pm_syscore_ops);
408 suspend_set_ops(&exynos_suspend_ops);
409}
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index ff9d23f0a7d9..c15761ca2f18 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com/ 3 * http://www.samsung.com/
4 * 4 *
5 * EXYNOS - CPU PMU(Power Management Unit) support 5 * EXYNOS - CPU PMU(Power Management Unit) support
@@ -10,12 +10,136 @@
10 */ 10 */
11 11
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/kernel.h> 13#include <linux/of.h>
14#include <linux/of_address.h>
15#include <linux/platform_device.h>
16#include <linux/delay.h>
17#include <linux/notifier.h>
18#include <linux/reboot.h>
14 19
15#include "common.h" 20
21#include "exynos-pmu.h"
16#include "regs-pmu.h" 22#include "regs-pmu.h"
17 23
18static const struct exynos_pmu_conf *exynos_pmu_config; 24#define PMU_TABLE_END (-1U)
25
26struct exynos_pmu_conf {
27 unsigned int offset;
28 u8 val[NUM_SYS_POWERDOWN];
29};
30
31struct exynos_pmu_data {
32 const struct exynos_pmu_conf *pmu_config;
33 const struct exynos_pmu_conf *pmu_config_extra;
34
35 void (*pmu_init)(void);
36 void (*powerdown_conf)(enum sys_powerdown);
37 void (*powerdown_conf_extra)(enum sys_powerdown);
38};
39
40struct exynos_pmu_context {
41 struct device *dev;
42 const struct exynos_pmu_data *pmu_data;
43};
44
45static void __iomem *pmu_base_addr;
46static struct exynos_pmu_context *pmu_context;
47
48static inline void pmu_raw_writel(u32 val, u32 offset)
49{
50 writel_relaxed(val, pmu_base_addr + offset);
51}
52
53static inline u32 pmu_raw_readl(u32 offset)
54{
55 return readl_relaxed(pmu_base_addr + offset);
56}
57
58static struct exynos_pmu_conf exynos3250_pmu_config[] = {
59 /* { .offset = offset, .val = { AFTR, W-AFTR, SLEEP } */
60 { EXYNOS3_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
61 { EXYNOS3_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
62 { EXYNOS3_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
63 { EXYNOS3_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
64 { EXYNOS3_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
65 { EXYNOS3_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
66 { EXYNOS3_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
67 { EXYNOS3_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
68 { EXYNOS3_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
69 { EXYNOS3_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
70 { EXYNOS3_ARM_L2_SYS_PWR_REG, { 0x0, 0x0, 0x3} },
71 { EXYNOS3_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
72 { EXYNOS3_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
73 { EXYNOS3_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
74 { EXYNOS3_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
75 { EXYNOS3_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
76 { EXYNOS3_LPDDR_PHY_DLL_LOCK_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
77 { EXYNOS3_CMU_ACLKSTOP_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
78 { EXYNOS3_CMU_SCLKSTOP_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
79 { EXYNOS3_CMU_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
80 { EXYNOS3_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
81 { EXYNOS3_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
82 { EXYNOS3_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
83 { EXYNOS3_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
84 { EXYNOS3_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
85 { EXYNOS3_UPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
86 { EXYNOS3_EPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
87 { EXYNOS3_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
88 { EXYNOS3_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
89 { EXYNOS3_CMU_CLKSTOP_CAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
90 { EXYNOS3_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
91 { EXYNOS3_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
92 { EXYNOS3_CMU_CLKSTOP_LCD0_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
93 { EXYNOS3_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
94 { EXYNOS3_CMU_CLKSTOP_MAUDIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
95 { EXYNOS3_CMU_RESET_CAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
96 { EXYNOS3_CMU_RESET_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
97 { EXYNOS3_CMU_RESET_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
98 { EXYNOS3_CMU_RESET_LCD0_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
99 { EXYNOS3_CMU_RESET_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
100 { EXYNOS3_CMU_RESET_MAUDIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
101 { EXYNOS3_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
102 { EXYNOS3_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
103 { EXYNOS3_TOP_PWR_SYS_PWR_REG, { 0x3, 0x3, 0x3} },
104 { EXYNOS3_TOP_BUS_COREBLK_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
105 { EXYNOS3_TOP_RETENTION_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
106 { EXYNOS3_TOP_PWR_COREBLK_SYS_PWR_REG, { 0x3, 0x3, 0x3} },
107 { EXYNOS3_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
108 { EXYNOS3_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
109 { EXYNOS3_LOGIC_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
110 { EXYNOS3_OSCCLK_GATE_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
111 { EXYNOS3_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
112 { EXYNOS3_PAD_RETENTION_MAUDIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
113 { EXYNOS3_PAD_RETENTION_GPIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
114 { EXYNOS3_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
115 { EXYNOS3_PAD_RETENTION_MMC0_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
116 { EXYNOS3_PAD_RETENTION_MMC1_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
117 { EXYNOS3_PAD_RETENTION_MMC2_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
118 { EXYNOS3_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
119 { EXYNOS3_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
120 { EXYNOS3_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
121 { EXYNOS3_PAD_RETENTION_JTAG_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
122 { EXYNOS3_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
123 { EXYNOS3_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
124 { EXYNOS3_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
125 { EXYNOS3_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
126 { EXYNOS3_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
127 { EXYNOS3_EXT_REGULATOR_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
128 { EXYNOS3_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
129 { EXYNOS3_GPIO_MODE_MAUDIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
130 { EXYNOS3_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
131 { EXYNOS3_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
132 { EXYNOS3_TOP_ASB_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
133 { EXYNOS3_TOP_ASB_ISOLATION_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
134 { EXYNOS3_CAM_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
135 { EXYNOS3_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
136 { EXYNOS3_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
137 { EXYNOS3_LCD0_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
138 { EXYNOS3_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
139 { EXYNOS3_MAUDIO_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
140 { EXYNOS3_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
141 { PMU_TABLE_END,},
142};
19 143
20static const struct exynos_pmu_conf exynos4210_pmu_config[] = { 144static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
21 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */ 145 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
@@ -264,6 +388,7 @@ static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
264 { EXYNOS5_INTRAM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 388 { EXYNOS5_INTRAM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
265 { EXYNOS5_INTROM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 389 { EXYNOS5_INTROM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
266 { EXYNOS5_JPEG_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 390 { EXYNOS5_JPEG_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
391 { EXYNOS5_JPEG_MEM_OPTION, { 0x10, 0x10, 0x0} },
267 { EXYNOS5_HSI_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 392 { EXYNOS5_HSI_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
268 { EXYNOS5_MCUIOP_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 393 { EXYNOS5_MCUIOP_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
269 { EXYNOS5_SATA_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 394 { EXYNOS5_SATA_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
@@ -315,6 +440,189 @@ static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
315 { PMU_TABLE_END,}, 440 { PMU_TABLE_END,},
316}; 441};
317 442
443static struct exynos_pmu_conf exynos5420_pmu_config[] = {
444 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
445 { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
446 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
447 { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
448 { EXYNOS5_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
449 { EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
450 { EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
451 { EXYNOS5420_ARM_CORE2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
452 { EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
453 { EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
454 { EXYNOS5420_ARM_CORE3_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
455 { EXYNOS5420_DIS_IRQ_ARM_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
456 { EXYNOS5420_DIS_IRQ_ARM_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
457 { EXYNOS5420_KFC_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
458 { EXYNOS5420_DIS_IRQ_KFC_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
459 { EXYNOS5420_DIS_IRQ_KFC_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
460 { EXYNOS5420_KFC_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
461 { EXYNOS5420_DIS_IRQ_KFC_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
462 { EXYNOS5420_DIS_IRQ_KFC_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
463 { EXYNOS5420_KFC_CORE2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
464 { EXYNOS5420_DIS_IRQ_KFC_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
465 { EXYNOS5420_DIS_IRQ_KFC_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
466 { EXYNOS5420_KFC_CORE3_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
467 { EXYNOS5420_DIS_IRQ_KFC_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
468 { EXYNOS5420_DIS_IRQ_KFC_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
469 { EXYNOS5_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
470 { EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
471 { EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
472 { EXYNOS5420_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
473 { EXYNOS5420_KFC_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
474 { EXYNOS5_ARM_L2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
475 { EXYNOS5420_KFC_L2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
476 { EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
477 { EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
478 { EXYNOS5_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
479 { EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
480 { EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
481 { EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
482 { EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
483 { EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
484 { EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
485 { EXYNOS5_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
486 { EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
487 { EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
488 { EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
489 { EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
490 { EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
491 { EXYNOS5420_DPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
492 { EXYNOS5420_IPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
493 { EXYNOS5420_KPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
494 { EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
495 { EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
496 { EXYNOS5420_RPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
497 { EXYNOS5420_SPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
498 { EXYNOS5_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
499 { EXYNOS5_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
500 { EXYNOS5_TOP_PWR_SYS_PWR_REG, { 0x3, 0x3, 0x0} },
501 { EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
502 { EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
503 { EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
504 { EXYNOS5_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
505 { EXYNOS5_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
506 { EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
507 { EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
508 { EXYNOS5420_INTRAM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
509 { EXYNOS5420_INTROM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
510 { EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
511 { EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
512 { EXYNOS5420_PAD_RETENTION_JTAG_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
513 { EXYNOS5420_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
514 { EXYNOS5420_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
515 { EXYNOS5420_PAD_RETENTION_MMC0_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
516 { EXYNOS5420_PAD_RETENTION_MMC1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
517 { EXYNOS5420_PAD_RETENTION_MMC2_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
518 { EXYNOS5420_PAD_RETENTION_HSI_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
519 { EXYNOS5420_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
520 { EXYNOS5420_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
521 { EXYNOS5420_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
522 { EXYNOS5420_PAD_RETENTION_DRAM_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
523 { EXYNOS5_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
524 { EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
525 { EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
526 { EXYNOS5_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
527 { EXYNOS5_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
528 { EXYNOS5_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
529 { EXYNOS5_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
530 { EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
531 { EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
532 { EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
533 { EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
534 { EXYNOS5_GSCL_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
535 { EXYNOS5_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
536 { EXYNOS5_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
537 { EXYNOS5_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
538 { EXYNOS5420_DISP1_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
539 { EXYNOS5420_MAU_SYS_PWR_REG, { 0x7, 0x7, 0x0} },
540 { EXYNOS5420_G2D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
541 { EXYNOS5420_MSC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
542 { EXYNOS5420_FSYS_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
543 { EXYNOS5420_FSYS2_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
544 { EXYNOS5420_PSGEN_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
545 { EXYNOS5420_PERIC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
546 { EXYNOS5420_WCORE_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
547 { EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
548 { EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
549 { EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
550 { EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
551 { EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
552 { EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
553 { EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
554 { EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
555 { EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
556 { EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
557 { EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
558 { EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
559 { EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
560 { EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
561 { EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
562 { EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
563 { EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
564 { EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
565 { EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
566 { EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
567 { EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
568 { EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
569 { EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
570 { EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
571 { EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
572 { EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
573 { EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
574 { EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
575 { EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
576 { EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
577 { EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
578 { EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
579 { EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
580 { EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
581 { EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
582 { EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
583 { EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
584 { EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
585 { PMU_TABLE_END,},
586};
587
588static unsigned int const exynos3250_list_feed[] = {
589 EXYNOS3_ARM_CORE_OPTION(0),
590 EXYNOS3_ARM_CORE_OPTION(1),
591 EXYNOS3_ARM_CORE_OPTION(2),
592 EXYNOS3_ARM_CORE_OPTION(3),
593 EXYNOS3_ARM_COMMON_OPTION,
594 EXYNOS3_TOP_PWR_OPTION,
595 EXYNOS3_CORE_TOP_PWR_OPTION,
596 S5P_CAM_OPTION,
597 S5P_MFC_OPTION,
598 S5P_G3D_OPTION,
599 S5P_LCD0_OPTION,
600 S5P_ISP_OPTION,
601};
602
603static void exynos3250_powerdown_conf_extra(enum sys_powerdown mode)
604{
605 unsigned int i;
606 unsigned int tmp;
607
608 /* Enable only SC_FEEDBACK */
609 for (i = 0; i < ARRAY_SIZE(exynos3250_list_feed); i++) {
610 tmp = pmu_raw_readl(exynos3250_list_feed[i]);
611 tmp &= ~(EXYNOS3_OPTION_USE_SC_COUNTER);
612 tmp |= EXYNOS3_OPTION_USE_SC_FEEDBACK;
613 pmu_raw_writel(tmp, exynos3250_list_feed[i]);
614 }
615
616 if (mode != SYS_SLEEP)
617 return;
618
619 pmu_raw_writel(XUSBXTI_DURATION, EXYNOS3_XUSBXTI_DURATION);
620 pmu_raw_writel(XXTI_DURATION, EXYNOS3_XXTI_DURATION);
621 pmu_raw_writel(EXT_REGULATOR_DURATION, EXYNOS3_EXT_REGULATOR_DURATION);
622 pmu_raw_writel(EXT_REGULATOR_COREBLK_DURATION,
623 EXYNOS3_EXT_REGULATOR_COREBLK_DURATION);
624}
625
318static unsigned int const exynos5_list_both_cnt_feed[] = { 626static unsigned int const exynos5_list_both_cnt_feed[] = {
319 EXYNOS5_ARM_CORE0_OPTION, 627 EXYNOS5_ARM_CORE0_OPTION,
320 EXYNOS5_ARM_CORE1_OPTION, 628 EXYNOS5_ARM_CORE1_OPTION,
@@ -329,13 +637,82 @@ static unsigned int const exynos5_list_both_cnt_feed[] = {
329 EXYNOS5_TOP_PWR_SYSMEM_OPTION, 637 EXYNOS5_TOP_PWR_SYSMEM_OPTION,
330}; 638};
331 639
332static unsigned int const exynos5_list_diable_wfi_wfe[] = { 640static unsigned int const exynos5_list_disable_wfi_wfe[] = {
333 EXYNOS5_ARM_CORE1_OPTION, 641 EXYNOS5_ARM_CORE1_OPTION,
334 EXYNOS5_FSYS_ARM_OPTION, 642 EXYNOS5_FSYS_ARM_OPTION,
335 EXYNOS5_ISP_ARM_OPTION, 643 EXYNOS5_ISP_ARM_OPTION,
336}; 644};
337 645
338static void exynos5_init_pmu(void) 646static unsigned int const exynos5420_list_disable_pmu_reg[] = {
647 EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG,
648 EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG,
649 EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG,
650 EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG,
651 EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG,
652 EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG,
653 EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG,
654 EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG,
655 EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG,
656 EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG,
657 EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG,
658 EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG,
659 EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG,
660 EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG,
661 EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG,
662 EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG,
663 EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG,
664 EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG,
665 EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG,
666 EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG,
667 EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG,
668 EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG,
669 EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG,
670 EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG,
671 EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG,
672 EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG,
673 EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG,
674 EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG,
675 EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG,
676 EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG,
677 EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG,
678 EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG,
679 EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG,
680 EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG,
681 EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,
682};
683
684static void exynos5_power_off(void)
685{
686 unsigned int tmp;
687
688 pr_info("Power down.\n");
689 tmp = pmu_raw_readl(EXYNOS_PS_HOLD_CONTROL);
690 tmp ^= (1 << 8);
691 pmu_raw_writel(tmp, EXYNOS_PS_HOLD_CONTROL);
692
693 /* Wait a little so we don't give a false warning below */
694 mdelay(100);
695
696 pr_err("Power down failed, please power off system manually.\n");
697 while (1)
698 ;
699}
700
701void exynos5420_powerdown_conf(enum sys_powerdown mode)
702{
703 u32 this_cluster;
704
705 this_cluster = MPIDR_AFFINITY_LEVEL(read_cpuid_mpidr(), 1);
706
707 /*
708 * set the cluster id to IROM register to ensure that we wake
709 * up with the current cluster.
710 */
711 pmu_raw_writel(this_cluster, EXYNOS_IROM_DATA2);
712}
713
714
715static void exynos5_powerdown_conf(enum sys_powerdown mode)
339{ 716{
340 unsigned int i; 717 unsigned int i;
341 unsigned int tmp; 718 unsigned int tmp;
@@ -343,7 +720,7 @@ static void exynos5_init_pmu(void)
343 /* 720 /*
344 * Enable both SC_FEEDBACK and SC_COUNTER 721 * Enable both SC_FEEDBACK and SC_COUNTER
345 */ 722 */
346 for (i = 0 ; i < ARRAY_SIZE(exynos5_list_both_cnt_feed) ; i++) { 723 for (i = 0; i < ARRAY_SIZE(exynos5_list_both_cnt_feed); i++) {
347 tmp = pmu_raw_readl(exynos5_list_both_cnt_feed[i]); 724 tmp = pmu_raw_readl(exynos5_list_both_cnt_feed[i]);
348 tmp |= (EXYNOS5_USE_SC_FEEDBACK | 725 tmp |= (EXYNOS5_USE_SC_FEEDBACK |
349 EXYNOS5_USE_SC_COUNTER); 726 EXYNOS5_USE_SC_COUNTER);
@@ -360,11 +737,11 @@ static void exynos5_init_pmu(void)
360 /* 737 /*
361 * Disable WFI/WFE on XXX_OPTION 738 * Disable WFI/WFE on XXX_OPTION
362 */ 739 */
363 for (i = 0 ; i < ARRAY_SIZE(exynos5_list_diable_wfi_wfe) ; i++) { 740 for (i = 0; i < ARRAY_SIZE(exynos5_list_disable_wfi_wfe); i++) {
364 tmp = pmu_raw_readl(exynos5_list_diable_wfi_wfe[i]); 741 tmp = pmu_raw_readl(exynos5_list_disable_wfi_wfe[i]);
365 tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE | 742 tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE |
366 EXYNOS5_OPTION_USE_STANDBYWFI); 743 EXYNOS5_OPTION_USE_STANDBYWFI);
367 pmu_raw_writel(tmp, exynos5_list_diable_wfi_wfe[i]); 744 pmu_raw_writel(tmp, exynos5_list_disable_wfi_wfe[i]);
368 } 745 }
369} 746}
370 747
@@ -372,51 +749,257 @@ void exynos_sys_powerdown_conf(enum sys_powerdown mode)
372{ 749{
373 unsigned int i; 750 unsigned int i;
374 751
375 if (soc_is_exynos5250()) 752 const struct exynos_pmu_data *pmu_data = pmu_context->pmu_data;
376 exynos5_init_pmu(); 753
754 if (pmu_data->powerdown_conf)
755 pmu_data->powerdown_conf(mode);
756
757 if (pmu_data->pmu_config) {
758 for (i = 0; (pmu_data->pmu_config[i].offset != PMU_TABLE_END); i++)
759 pmu_raw_writel(pmu_data->pmu_config[i].val[mode],
760 pmu_data->pmu_config[i].offset);
761 }
377 762
378 for (i = 0; (exynos_pmu_config[i].offset != PMU_TABLE_END) ; i++) 763 if (pmu_data->powerdown_conf_extra)
379 pmu_raw_writel(exynos_pmu_config[i].val[mode], 764 pmu_data->powerdown_conf_extra(mode);
380 exynos_pmu_config[i].offset);
381 765
382 if (soc_is_exynos4412()) { 766 if (pmu_data->pmu_config_extra) {
383 for (i = 0; exynos4412_pmu_config[i].offset != PMU_TABLE_END ; i++) 767 for (i = 0; pmu_data->pmu_config_extra[i].offset != PMU_TABLE_END; i++)
384 pmu_raw_writel(exynos4412_pmu_config[i].val[mode], 768 pmu_raw_writel(pmu_data->pmu_config_extra[i].val[mode],
385 exynos4412_pmu_config[i].offset); 769 pmu_data->pmu_config_extra[i].offset);
386 } 770 }
387} 771}
388 772
389static int __init exynos_pmu_init(void) 773static void exynos3250_pmu_init(void)
774{
775 unsigned int value;
776
777 /*
778 * To prevent from issuing new bus request form L2 memory system
779 * If core status is power down, should be set '1' to L2 power down
780 */
781 value = pmu_raw_readl(EXYNOS3_ARM_COMMON_OPTION);
782 value |= EXYNOS3_OPTION_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
783 pmu_raw_writel(value, EXYNOS3_ARM_COMMON_OPTION);
784
785 /* Enable USE_STANDBY_WFI for all CORE */
786 pmu_raw_writel(S5P_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);
787
788 /*
789 * Set PSHOLD port for output high
790 */
791 value = pmu_raw_readl(S5P_PS_HOLD_CONTROL);
792 value |= S5P_PS_HOLD_OUTPUT_HIGH;
793 pmu_raw_writel(value, S5P_PS_HOLD_CONTROL);
794
795 /*
796 * Enable signal for PSHOLD port
797 */
798 value = pmu_raw_readl(S5P_PS_HOLD_CONTROL);
799 value |= S5P_PS_HOLD_EN;
800 pmu_raw_writel(value, S5P_PS_HOLD_CONTROL);
801}
802
803static void exynos5250_pmu_init(void)
390{ 804{
391 unsigned int value; 805 unsigned int value;
806 /*
807 * When SYS_WDTRESET is set, watchdog timer reset request
808 * is ignored by power management unit.
809 */
810 value = pmu_raw_readl(EXYNOS5_AUTO_WDTRESET_DISABLE);
811 value &= ~EXYNOS5_SYS_WDTRESET;
812 pmu_raw_writel(value, EXYNOS5_AUTO_WDTRESET_DISABLE);
813
814 value = pmu_raw_readl(EXYNOS5_MASK_WDTRESET_REQUEST);
815 value &= ~EXYNOS5_SYS_WDTRESET;
816 pmu_raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST);
817}
818
819static void exynos5420_pmu_init(void)
820{
821 unsigned int value;
822 int i;
823
824 /*
825 * Set the CMU_RESET, CMU_SYSCLK and CMU_CLKSTOP registers
826 * for local power blocks to Low initially as per Table 8-4:
827 * "System-Level Power-Down Configuration Registers".
828 */
829 for (i = 0; i < ARRAY_SIZE(exynos5420_list_disable_pmu_reg); i++)
830 pmu_raw_writel(0, exynos5420_list_disable_pmu_reg[i]);
831
832 /* Enable USE_STANDBY_WFI for all CORE */
833 pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);
834
835 value = pmu_raw_readl(EXYNOS_L2_OPTION(0));
836 value &= ~EXYNOS5_USE_RETENTION;
837 pmu_raw_writel(value, EXYNOS_L2_OPTION(0));
838
839 value = pmu_raw_readl(EXYNOS_L2_OPTION(1));
840 value &= ~EXYNOS5_USE_RETENTION;
841 pmu_raw_writel(value, EXYNOS_L2_OPTION(1));
842
843 /*
844 * If L2_COMMON is turned off, clocks related to ATB async
845 * bridge are gated. Thus, when ISP power is gated, LPI
846 * may get stuck.
847 */
848 value = pmu_raw_readl(EXYNOS5420_LPI_MASK);
849 value |= EXYNOS5420_ATB_ISP_ARM;
850 pmu_raw_writel(value, EXYNOS5420_LPI_MASK);
851
852 value = pmu_raw_readl(EXYNOS5420_LPI_MASK1);
853 value |= EXYNOS5420_ATB_KFC;
854 pmu_raw_writel(value, EXYNOS5420_LPI_MASK1);
855
856 /* Prevent issue of new bus request from L2 memory */
857 value = pmu_raw_readl(EXYNOS5420_ARM_COMMON_OPTION);
858 value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
859 pmu_raw_writel(value, EXYNOS5420_ARM_COMMON_OPTION);
860
861 value = pmu_raw_readl(EXYNOS5420_KFC_COMMON_OPTION);
862 value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
863 pmu_raw_writel(value, EXYNOS5420_KFC_COMMON_OPTION);
864
865 /* This setting is to reduce suspend/resume time */
866 pmu_raw_writel(DUR_WAIT_RESET, EXYNOS5420_LOGIC_RESET_DURATION3);
867
868 /* Serialized CPU wakeup of Eagle */
869 pmu_raw_writel(SPREAD_ENABLE, EXYNOS5420_ARM_INTR_SPREAD_ENABLE);
870
871 pmu_raw_writel(SPREAD_USE_STANDWFI,
872 EXYNOS5420_ARM_INTR_SPREAD_USE_STANDBYWFI);
873
874 pmu_raw_writel(0x1, EXYNOS5420_UP_SCHEDULER);
875
876 pm_power_off = exynos5_power_off;
877 pr_info("EXYNOS5420 PMU initialized\n");
878}
879
880static int pmu_restart_notify(struct notifier_block *this,
881 unsigned long code, void *unused)
882{
883 pmu_raw_writel(0x1, EXYNOS_SWRESET);
884
885 return NOTIFY_DONE;
886}
887
888static const struct exynos_pmu_data exynos3250_pmu_data = {
889 .pmu_config = exynos3250_pmu_config,
890 .pmu_init = exynos3250_pmu_init,
891 .powerdown_conf_extra = exynos3250_powerdown_conf_extra,
892};
392 893
393 exynos_pmu_config = exynos4210_pmu_config; 894static const struct exynos_pmu_data exynos4210_pmu_data = {
394 895 .pmu_config = exynos4210_pmu_config,
395 if (soc_is_exynos4210()) { 896};
396 exynos_pmu_config = exynos4210_pmu_config; 897
397 pr_info("EXYNOS4210 PMU Initialize\n"); 898static const struct exynos_pmu_data exynos4212_pmu_data = {
398 } else if (soc_is_exynos4212() || soc_is_exynos4412()) { 899 .pmu_config = exynos4x12_pmu_config,
399 exynos_pmu_config = exynos4x12_pmu_config; 900};
400 pr_info("EXYNOS4x12 PMU Initialize\n"); 901
401 } else if (soc_is_exynos5250()) { 902static const struct exynos_pmu_data exynos4412_pmu_data = {
402 /* 903 .pmu_config = exynos4x12_pmu_config,
403 * When SYS_WDTRESET is set, watchdog timer reset request 904 .pmu_config_extra = exynos4412_pmu_config,
404 * is ignored by power management unit. 905};
405 */ 906
406 value = pmu_raw_readl(EXYNOS5_AUTO_WDTRESET_DISABLE); 907static const struct exynos_pmu_data exynos5250_pmu_data = {
407 value &= ~EXYNOS5_SYS_WDTRESET; 908 .pmu_config = exynos5250_pmu_config,
408 pmu_raw_writel(value, EXYNOS5_AUTO_WDTRESET_DISABLE); 909 .pmu_init = exynos5250_pmu_init,
409 910 .powerdown_conf = exynos5_powerdown_conf,
410 value = pmu_raw_readl(EXYNOS5_MASK_WDTRESET_REQUEST); 911};
411 value &= ~EXYNOS5_SYS_WDTRESET; 912
412 pmu_raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST); 913static struct exynos_pmu_data exynos5420_pmu_data = {
413 914 .pmu_config = exynos5420_pmu_config,
414 exynos_pmu_config = exynos5250_pmu_config; 915 .pmu_init = exynos5420_pmu_init,
415 pr_info("EXYNOS5250 PMU Initialize\n"); 916 .powerdown_conf = exynos5420_powerdown_conf,
416 } else { 917};
417 pr_info("EXYNOS: PMU not supported\n"); 918
919/*
920 * PMU platform driver and devicetree bindings.
921 */
922static const struct of_device_id exynos_pmu_of_device_ids[] = {
923 {
924 .compatible = "samsung,exynos3250-pmu",
925 .data = &exynos3250_pmu_data,
926 }, {
927 .compatible = "samsung,exynos4210-pmu",
928 .data = &exynos4210_pmu_data,
929 }, {
930 .compatible = "samsung,exynos4212-pmu",
931 .data = &exynos4212_pmu_data,
932 }, {
933 .compatible = "samsung,exynos4412-pmu",
934 .data = &exynos4412_pmu_data,
935 }, {
936 .compatible = "samsung,exynos5250-pmu",
937 .data = &exynos5250_pmu_data,
938 }, {
939 .compatible = "samsung,exynos5420-pmu",
940 .data = &exynos5420_pmu_data,
941 },
942 { /*sentinel*/ },
943};
944
945/*
946 * Exynos PMU restart notifier, handles restart functionality
947 */
948static struct notifier_block pmu_restart_handler = {
949 .notifier_call = pmu_restart_notify,
950 .priority = 128,
951};
952
953static int exynos_pmu_probe(struct platform_device *pdev)
954{
955 const struct of_device_id *match;
956 struct device *dev = &pdev->dev;
957 struct resource *res;
958 int ret;
959
960 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
961 pmu_base_addr = devm_ioremap_resource(dev, res);
962 if (IS_ERR(pmu_base_addr))
963 return PTR_ERR(pmu_base_addr);
964
965 pmu_context = devm_kzalloc(&pdev->dev,
966 sizeof(struct exynos_pmu_context),
967 GFP_KERNEL);
968 if (!pmu_context) {
969 dev_err(dev, "Cannot allocate memory.\n");
970 return -ENOMEM;
418 } 971 }
972 pmu_context->dev = dev;
973
974 match = of_match_node(exynos_pmu_of_device_ids, dev->of_node);
975
976 pmu_context->pmu_data = match->data;
977
978 if (pmu_context->pmu_data->pmu_init)
979 pmu_context->pmu_data->pmu_init();
980
981 platform_set_drvdata(pdev, pmu_context);
419 982
983 ret = register_restart_handler(&pmu_restart_handler);
984 if (ret)
985 dev_warn(dev, "can't register restart handler err=%d\n", ret);
986
987 dev_dbg(dev, "Exynos PMU Driver probe done\n");
420 return 0; 988 return 0;
421} 989}
422arch_initcall(exynos_pmu_init); 990
991static struct platform_driver exynos_pmu_driver = {
992 .driver = {
993 .name = "exynos-pmu",
994 .owner = THIS_MODULE,
995 .of_match_table = exynos_pmu_of_device_ids,
996 },
997 .probe = exynos_pmu_probe,
998};
999
1000static int __init exynos_pmu_init(void)
1001{
1002 return platform_driver_register(&exynos_pmu_driver);
1003
1004}
1005postcore_initcall(exynos_pmu_init);
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 96a1569262b5..b5f4406fc1b5 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -19,8 +19,24 @@
19#define S5P_CENTRAL_SEQ_OPTION 0x0208 19#define S5P_CENTRAL_SEQ_OPTION 0x0208
20 20
21#define S5P_USE_STANDBY_WFI0 (1 << 16) 21#define S5P_USE_STANDBY_WFI0 (1 << 16)
22#define S5P_USE_STANDBY_WFI1 (1 << 17)
23#define S5P_USE_STANDBY_WFI2 (1 << 19)
24#define S5P_USE_STANDBY_WFI3 (1 << 20)
22#define S5P_USE_STANDBY_WFE0 (1 << 24) 25#define S5P_USE_STANDBY_WFE0 (1 << 24)
26#define S5P_USE_STANDBY_WFE1 (1 << 25)
27#define S5P_USE_STANDBY_WFE2 (1 << 27)
28#define S5P_USE_STANDBY_WFE3 (1 << 28)
23 29
30#define S5P_USE_STANDBY_WFI_ALL \
31 (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFI1 | \
32 S5P_USE_STANDBY_WFI2 | S5P_USE_STANDBY_WFI3 | \
33 S5P_USE_STANDBY_WFE0 | S5P_USE_STANDBY_WFE1 | \
34 S5P_USE_STANDBY_WFE2 | S5P_USE_STANDBY_WFE3)
35
36#define S5P_USE_DELAYED_RESET_ASSERTION BIT(12)
37
38#define EXYNOS_CORE_PO_RESET(n) ((1 << 4) << n)
39#define EXYNOS_WAKEUP_FROM_LOWPWR (1 << 28)
24#define EXYNOS_SWRESET 0x0400 40#define EXYNOS_SWRESET 0x0400
25#define EXYNOS5440_SWRESET 0x00C4 41#define EXYNOS5440_SWRESET 0x00C4
26 42
@@ -35,6 +51,7 @@
35#define S5P_INFORM7 0x081C 51#define S5P_INFORM7 0x081C
36#define S5P_PMU_SPARE3 0x090C 52#define S5P_PMU_SPARE3 0x090C
37 53
54#define EXYNOS_IROM_DATA2 0x0988
38#define S5P_ARM_CORE0_LOWPWR 0x1000 55#define S5P_ARM_CORE0_LOWPWR 0x1000
39#define S5P_DIS_IRQ_CORE0 0x1004 56#define S5P_DIS_IRQ_CORE0 0x1004
40#define S5P_DIS_IRQ_CENTRAL0 0x1008 57#define S5P_DIS_IRQ_CENTRAL0 0x1008
@@ -106,6 +123,8 @@
106 (EXYNOS_ARM_CORE0_CONFIGURATION + (0x80 * (_nr))) 123 (EXYNOS_ARM_CORE0_CONFIGURATION + (0x80 * (_nr)))
107#define EXYNOS_ARM_CORE_STATUS(_nr) \ 124#define EXYNOS_ARM_CORE_STATUS(_nr) \
108 (EXYNOS_ARM_CORE_CONFIGURATION(_nr) + 0x4) 125 (EXYNOS_ARM_CORE_CONFIGURATION(_nr) + 0x4)
126#define EXYNOS_ARM_CORE_OPTION(_nr) \
127 (EXYNOS_ARM_CORE_CONFIGURATION(_nr) + 0x8)
109 128
110#define EXYNOS_ARM_COMMON_CONFIGURATION 0x2500 129#define EXYNOS_ARM_COMMON_CONFIGURATION 0x2500
111#define EXYNOS_COMMON_CONFIGURATION(_nr) \ 130#define EXYNOS_COMMON_CONFIGURATION(_nr) \
@@ -115,6 +134,31 @@
115#define EXYNOS_COMMON_OPTION(_nr) \ 134#define EXYNOS_COMMON_OPTION(_nr) \
116 (EXYNOS_COMMON_CONFIGURATION(_nr) + 0x8) 135 (EXYNOS_COMMON_CONFIGURATION(_nr) + 0x8)
117 136
137#define EXYNOS_CORE_LOCAL_PWR_EN 0x3
138
139#define EXYNOS_ARM_COMMON_STATUS 0x2504
140#define EXYNOS_COMMON_OPTION(_nr) \
141 (EXYNOS_COMMON_CONFIGURATION(_nr) + 0x8)
142
143#define EXYNOS_ARM_L2_CONFIGURATION 0x2600
144#define EXYNOS_L2_CONFIGURATION(_nr) \
145 (EXYNOS_ARM_L2_CONFIGURATION + ((_nr) * 0x80))
146#define EXYNOS_L2_STATUS(_nr) \
147 (EXYNOS_L2_CONFIGURATION(_nr) + 0x4)
148#define EXYNOS_L2_OPTION(_nr) \
149 (EXYNOS_L2_CONFIGURATION(_nr) + 0x8)
150#define EXYNOS_L2_COMMON_PWR_EN 0x3
151
152#define EXYNOS_ARM_CORE_X_STATUS_OFFSET 0x4
153
154#define EXYNOS5_APLL_SYSCLK_CONFIGURATION 0x2A00
155#define EXYNOS5_APLL_SYSCLK_STATUS 0x2A04
156
157#define EXYNOS5_ARM_L2_OPTION 0x2608
158#define EXYNOS5_USE_RETENTION BIT(4)
159
160#define EXYNOS5_L2RSTDISABLE_VALUE BIT(3)
161
118#define S5P_PAD_RET_MAUDIO_OPTION 0x3028 162#define S5P_PAD_RET_MAUDIO_OPTION 0x3028
119#define S5P_PAD_RET_GPIO_OPTION 0x3108 163#define S5P_PAD_RET_GPIO_OPTION 0x3108
120#define S5P_PAD_RET_UART_OPTION 0x3128 164#define S5P_PAD_RET_UART_OPTION 0x3128
@@ -123,7 +167,19 @@
123#define S5P_PAD_RET_EBIA_OPTION 0x3188 167#define S5P_PAD_RET_EBIA_OPTION 0x3188
124#define S5P_PAD_RET_EBIB_OPTION 0x31A8 168#define S5P_PAD_RET_EBIB_OPTION 0x31A8
125 169
170#define S5P_PS_HOLD_CONTROL 0x330C
171#define S5P_PS_HOLD_EN (1 << 31)
172#define S5P_PS_HOLD_OUTPUT_HIGH (3 << 8)
173
174#define S5P_CAM_OPTION 0x3C08
175#define S5P_MFC_OPTION 0x3C48
176#define S5P_G3D_OPTION 0x3C68
177#define S5P_LCD0_OPTION 0x3C88
178#define S5P_LCD1_OPTION 0x3CA8
179#define S5P_ISP_OPTION S5P_LCD1_OPTION
180
126#define S5P_CORE_LOCAL_PWR_EN 0x3 181#define S5P_CORE_LOCAL_PWR_EN 0x3
182#define S5P_CORE_WAKEUP_FROM_LOCAL_CFG (0x3 << 8)
127 183
128/* Only for EXYNOS4210 */ 184/* Only for EXYNOS4210 */
129#define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154 185#define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154
@@ -182,11 +238,116 @@
182#define S5P_DIS_IRQ_CORE3 0x1034 238#define S5P_DIS_IRQ_CORE3 0x1034
183#define S5P_DIS_IRQ_CENTRAL3 0x1038 239#define S5P_DIS_IRQ_CENTRAL3 0x1038
184 240
241/* Only for EXYNOS3XXX */
242#define EXYNOS3_ARM_CORE0_SYS_PWR_REG 0x1000
243#define EXYNOS3_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG 0x1004
244#define EXYNOS3_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG 0x1008
245#define EXYNOS3_ARM_CORE1_SYS_PWR_REG 0x1010
246#define EXYNOS3_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG 0x1014
247#define EXYNOS3_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG 0x1018
248#define EXYNOS3_ISP_ARM_SYS_PWR_REG 0x1050
249#define EXYNOS3_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG 0x1054
250#define EXYNOS3_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG 0x1058
251#define EXYNOS3_ARM_COMMON_SYS_PWR_REG 0x1080
252#define EXYNOS3_ARM_L2_SYS_PWR_REG 0x10C0
253#define EXYNOS3_CMU_ACLKSTOP_SYS_PWR_REG 0x1100
254#define EXYNOS3_CMU_SCLKSTOP_SYS_PWR_REG 0x1104
255#define EXYNOS3_CMU_RESET_SYS_PWR_REG 0x110C
256#define EXYNOS3_CMU_ACLKSTOP_COREBLK_SYS_PWR_REG 0x1110
257#define EXYNOS3_CMU_SCLKSTOP_COREBLK_SYS_PWR_REG 0x1114
258#define EXYNOS3_CMU_RESET_COREBLK_SYS_PWR_REG 0x111C
259#define EXYNOS3_APLL_SYSCLK_SYS_PWR_REG 0x1120
260#define EXYNOS3_MPLL_SYSCLK_SYS_PWR_REG 0x1124
261#define EXYNOS3_VPLL_SYSCLK_SYS_PWR_REG 0x1128
262#define EXYNOS3_EPLL_SYSCLK_SYS_PWR_REG 0x112C
263#define EXYNOS3_MPLLUSER_SYSCLK_SYS_PWR_REG 0x1130
264#define EXYNOS3_BPLLUSER_SYSCLK_SYS_PWR_REG 0x1134
265#define EXYNOS3_EPLLUSER_SYSCLK_SYS_PWR_REG 0x1138
266#define EXYNOS3_CMU_CLKSTOP_CAM_SYS_PWR_REG 0x1140
267#define EXYNOS3_CMU_CLKSTOP_MFC_SYS_PWR_REG 0x1148
268#define EXYNOS3_CMU_CLKSTOP_G3D_SYS_PWR_REG 0x114C
269#define EXYNOS3_CMU_CLKSTOP_LCD0_SYS_PWR_REG 0x1150
270#define EXYNOS3_CMU_CLKSTOP_ISP_SYS_PWR_REG 0x1154
271#define EXYNOS3_CMU_CLKSTOP_MAUDIO_SYS_PWR_REG 0x1158
272#define EXYNOS3_CMU_RESET_CAM_SYS_PWR_REG 0x1160
273#define EXYNOS3_CMU_RESET_MFC_SYS_PWR_REG 0x1168
274#define EXYNOS3_CMU_RESET_G3D_SYS_PWR_REG 0x116C
275#define EXYNOS3_CMU_RESET_LCD0_SYS_PWR_REG 0x1170
276#define EXYNOS3_CMU_RESET_ISP_SYS_PWR_REG 0x1174
277#define EXYNOS3_CMU_RESET_MAUDIO_SYS_PWR_REG 0x1178
278#define EXYNOS3_TOP_BUS_SYS_PWR_REG 0x1180
279#define EXYNOS3_TOP_RETENTION_SYS_PWR_REG 0x1184
280#define EXYNOS3_TOP_PWR_SYS_PWR_REG 0x1188
281#define EXYNOS3_TOP_BUS_COREBLK_SYS_PWR_REG 0x1190
282#define EXYNOS3_TOP_RETENTION_COREBLK_SYS_PWR_REG 0x1194
283#define EXYNOS3_TOP_PWR_COREBLK_SYS_PWR_REG 0x1198
284#define EXYNOS3_LOGIC_RESET_SYS_PWR_REG 0x11A0
285#define EXYNOS3_OSCCLK_GATE_SYS_PWR_REG 0x11A4
286#define EXYNOS3_LOGIC_RESET_COREBLK_SYS_PWR_REG 0x11B0
287#define EXYNOS3_OSCCLK_GATE_COREBLK_SYS_PWR_REG 0x11B4
288#define EXYNOS3_PAD_RETENTION_DRAM_SYS_PWR_REG 0x1200
289#define EXYNOS3_PAD_RETENTION_MAUDIO_SYS_PWR_REG 0x1204
290#define EXYNOS3_PAD_RETENTION_SPI_SYS_PWR_REG 0x1208
291#define EXYNOS3_PAD_RETENTION_MMC2_SYS_PWR_REG 0x1218
292#define EXYNOS3_PAD_RETENTION_GPIO_SYS_PWR_REG 0x1220
293#define EXYNOS3_PAD_RETENTION_UART_SYS_PWR_REG 0x1224
294#define EXYNOS3_PAD_RETENTION_MMC0_SYS_PWR_REG 0x1228
295#define EXYNOS3_PAD_RETENTION_MMC1_SYS_PWR_REG 0x122C
296#define EXYNOS3_PAD_RETENTION_EBIA_SYS_PWR_REG 0x1230
297#define EXYNOS3_PAD_RETENTION_EBIB_SYS_PWR_REG 0x1234
298#define EXYNOS3_PAD_RETENTION_JTAG_SYS_PWR_REG 0x1238
299#define EXYNOS3_PAD_ISOLATION_SYS_PWR_REG 0x1240
300#define EXYNOS3_PAD_ALV_SEL_SYS_PWR_REG 0x1260
301#define EXYNOS3_XUSBXTI_SYS_PWR_REG 0x1280
302#define EXYNOS3_XXTI_SYS_PWR_REG 0x1284
303#define EXYNOS3_EXT_REGULATOR_SYS_PWR_REG 0x12C0
304#define EXYNOS3_EXT_REGULATOR_COREBLK_SYS_PWR_REG 0x12C4
305#define EXYNOS3_GPIO_MODE_SYS_PWR_REG 0x1300
306#define EXYNOS3_GPIO_MODE_MAUDIO_SYS_PWR_REG 0x1340
307#define EXYNOS3_TOP_ASB_RESET_SYS_PWR_REG 0x1344
308#define EXYNOS3_TOP_ASB_ISOLATION_SYS_PWR_REG 0x1348
309#define EXYNOS3_TOP_ASB_RESET_COREBLK_SYS_PWR_REG 0x1350
310#define EXYNOS3_TOP_ASB_ISOLATION_COREBLK_SYS_PWR_REG 0x1354
311#define EXYNOS3_CAM_SYS_PWR_REG 0x1380
312#define EXYNOS3_MFC_SYS_PWR_REG 0x1388
313#define EXYNOS3_G3D_SYS_PWR_REG 0x138C
314#define EXYNOS3_LCD0_SYS_PWR_REG 0x1390
315#define EXYNOS3_ISP_SYS_PWR_REG 0x1394
316#define EXYNOS3_MAUDIO_SYS_PWR_REG 0x1398
317#define EXYNOS3_DRAM_FREQ_DOWN_SYS_PWR_REG 0x13B0
318#define EXYNOS3_DDRPHY_DLLOFF_SYS_PWR_REG 0x13B4
319#define EXYNOS3_CMU_SYSCLK_ISP_SYS_PWR_REG 0x13B8
320#define EXYNOS3_LPDDR_PHY_DLL_LOCK_SYS_PWR_REG 0x13C0
321#define EXYNOS3_BPLL_SYSCLK_SYS_PWR_REG 0x13C4
322#define EXYNOS3_UPLL_SYSCLK_SYS_PWR_REG 0x13C8
323
324#define EXYNOS3_ARM_CORE0_OPTION 0x2008
325#define EXYNOS3_ARM_CORE_OPTION(_nr) \
326 (EXYNOS3_ARM_CORE0_OPTION + ((_nr) * 0x80))
327
328#define EXYNOS3_ARM_COMMON_OPTION 0x2408
329#define EXYNOS3_TOP_PWR_OPTION 0x2C48
330#define EXYNOS3_CORE_TOP_PWR_OPTION 0x2CA8
331#define EXYNOS3_XUSBXTI_DURATION 0x341C
332#define EXYNOS3_XXTI_DURATION 0x343C
333#define EXYNOS3_EXT_REGULATOR_DURATION 0x361C
334#define EXYNOS3_EXT_REGULATOR_COREBLK_DURATION 0x363C
335#define XUSBXTI_DURATION 0x00000BB8
336#define XXTI_DURATION XUSBXTI_DURATION
337#define EXT_REGULATOR_DURATION 0x00001D4C
338#define EXT_REGULATOR_COREBLK_DURATION EXT_REGULATOR_DURATION
339
340/* for XXX_OPTION */
341#define EXYNOS3_OPTION_USE_SC_COUNTER (1 << 0)
342#define EXYNOS3_OPTION_USE_SC_FEEDBACK (1 << 1)
343#define EXYNOS3_OPTION_SKIP_DEACTIVATE_ACEACP_IN_PWDN (1 << 7)
344
185/* For EXYNOS5 */ 345/* For EXYNOS5 */
186 346
187#define EXYNOS5_AUTO_WDTRESET_DISABLE 0x0408 347#define EXYNOS5_AUTO_WDTRESET_DISABLE 0x0408
188#define EXYNOS5_MASK_WDTRESET_REQUEST 0x040C 348#define EXYNOS5_MASK_WDTRESET_REQUEST 0x040C
189 349
350#define EXYNOS5_USE_RETENTION BIT(4)
190#define EXYNOS5_SYS_WDTRESET (1 << 20) 351#define EXYNOS5_SYS_WDTRESET (1 << 20)
191 352
192#define EXYNOS5_ARM_CORE0_SYS_PWR_REG 0x1000 353#define EXYNOS5_ARM_CORE0_SYS_PWR_REG 0x1000
@@ -326,4 +487,204 @@ static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
326 + MPIDR_AFFINITY_LEVEL(mpidr, 0)); 487 + MPIDR_AFFINITY_LEVEL(mpidr, 0));
327} 488}
328 489
490/* Only for EXYNOS5420 */
491#define EXYNOS5420_ISP_ARM_OPTION 0x2488
492#define EXYNOS5420_L2RSTDISABLE_VALUE BIT(3)
493
494#define EXYNOS5420_LPI_MASK 0x0004
495#define EXYNOS5420_LPI_MASK1 0x0008
496#define EXYNOS5420_UFS BIT(8)
497#define EXYNOS5420_ATB_KFC BIT(13)
498#define EXYNOS5420_ATB_ISP_ARM BIT(19)
499#define EXYNOS5420_EMULATION BIT(31)
500#define ATB_ISP_ARM BIT(12)
501#define ATB_KFC BIT(13)
502#define ATB_NOC BIT(14)
503
504#define EXYNOS5420_ARM_INTR_SPREAD_ENABLE 0x0100
505#define EXYNOS5420_ARM_INTR_SPREAD_USE_STANDBYWFI 0x0104
506#define EXYNOS5420_UP_SCHEDULER 0x0120
507#define SPREAD_ENABLE 0xF
508#define SPREAD_USE_STANDWFI 0xF
509
510#define EXYNOS5420_BB_CON1 0x0784
511#define EXYNOS5420_BB_SEL_EN BIT(31)
512#define EXYNOS5420_BB_PMOS_EN BIT(7)
513#define EXYNOS5420_BB_1300X 0XF
514
515#define EXYNOS5420_ARM_CORE2_SYS_PWR_REG 0x1020
516#define EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG 0x1024
517#define EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG 0x1028
518#define EXYNOS5420_ARM_CORE3_SYS_PWR_REG 0x1030
519#define EXYNOS5420_DIS_IRQ_ARM_CORE3_LOCAL_SYS_PWR_REG 0x1034
520#define EXYNOS5420_DIS_IRQ_ARM_CORE3_CENTRAL_SYS_PWR_REG 0x1038
521#define EXYNOS5420_KFC_CORE0_SYS_PWR_REG 0x1040
522#define EXYNOS5420_DIS_IRQ_KFC_CORE0_LOCAL_SYS_PWR_REG 0x1044
523#define EXYNOS5420_DIS_IRQ_KFC_CORE0_CENTRAL_SYS_PWR_REG 0x1048
524#define EXYNOS5420_KFC_CORE1_SYS_PWR_REG 0x1050
525#define EXYNOS5420_DIS_IRQ_KFC_CORE1_LOCAL_SYS_PWR_REG 0x1054
526#define EXYNOS5420_DIS_IRQ_KFC_CORE1_CENTRAL_SYS_PWR_REG 0x1058
527#define EXYNOS5420_KFC_CORE2_SYS_PWR_REG 0x1060
528#define EXYNOS5420_DIS_IRQ_KFC_CORE2_LOCAL_SYS_PWR_REG 0x1064
529#define EXYNOS5420_DIS_IRQ_KFC_CORE2_CENTRAL_SYS_PWR_REG 0x1068
530#define EXYNOS5420_KFC_CORE3_SYS_PWR_REG 0x1070
531#define EXYNOS5420_DIS_IRQ_KFC_CORE3_LOCAL_SYS_PWR_REG 0x1074
532#define EXYNOS5420_DIS_IRQ_KFC_CORE3_CENTRAL_SYS_PWR_REG 0x1078
533#define EXYNOS5420_ISP_ARM_SYS_PWR_REG 0x1090
534#define EXYNOS5420_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG 0x1094
535#define EXYNOS5420_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG 0x1098
536#define EXYNOS5420_ARM_COMMON_SYS_PWR_REG 0x10A0
537#define EXYNOS5420_KFC_COMMON_SYS_PWR_REG 0x10B0
538#define EXYNOS5420_KFC_L2_SYS_PWR_REG 0x10D0
539#define EXYNOS5420_DPLL_SYSCLK_SYS_PWR_REG 0x1158
540#define EXYNOS5420_IPLL_SYSCLK_SYS_PWR_REG 0x115C
541#define EXYNOS5420_KPLL_SYSCLK_SYS_PWR_REG 0x1160
542#define EXYNOS5420_RPLL_SYSCLK_SYS_PWR_REG 0x1174
543#define EXYNOS5420_SPLL_SYSCLK_SYS_PWR_REG 0x1178
544#define EXYNOS5420_INTRAM_MEM_SYS_PWR_REG 0x11B8
545#define EXYNOS5420_INTROM_MEM_SYS_PWR_REG 0x11BC
546#define EXYNOS5420_ONENANDXL_MEM_SYS_PWR 0x11C0
547#define EXYNOS5420_USBDEV_MEM_SYS_PWR 0x11CC
548#define EXYNOS5420_USBDEV1_MEM_SYS_PWR 0x11D0
549#define EXYNOS5420_SDMMC_MEM_SYS_PWR 0x11D4
550#define EXYNOS5420_CSSYS_MEM_SYS_PWR 0x11D8
551#define EXYNOS5420_SECSS_MEM_SYS_PWR 0x11DC
552#define EXYNOS5420_ROTATOR_MEM_SYS_PWR 0x11E0
553#define EXYNOS5420_INTRAM_MEM_SYS_PWR 0x11E4
554#define EXYNOS5420_INTROM_MEM_SYS_PWR 0x11E8
555#define EXYNOS5420_PAD_RETENTION_JTAG_SYS_PWR_REG 0x1208
556#define EXYNOS5420_PAD_RETENTION_DRAM_SYS_PWR_REG 0x1210
557#define EXYNOS5420_PAD_RETENTION_UART_SYS_PWR_REG 0x1214
558#define EXYNOS5420_PAD_RETENTION_MMC0_SYS_PWR_REG 0x1218
559#define EXYNOS5420_PAD_RETENTION_MMC1_SYS_PWR_REG 0x121C
560#define EXYNOS5420_PAD_RETENTION_MMC2_SYS_PWR_REG 0x1220
561#define EXYNOS5420_PAD_RETENTION_HSI_SYS_PWR_REG 0x1224
562#define EXYNOS5420_PAD_RETENTION_EBIA_SYS_PWR_REG 0x1228
563#define EXYNOS5420_PAD_RETENTION_EBIB_SYS_PWR_REG 0x122C
564#define EXYNOS5420_PAD_RETENTION_SPI_SYS_PWR_REG 0x1230
565#define EXYNOS5420_PAD_RETENTION_DRAM_COREBLK_SYS_PWR_REG 0x1234
566#define EXYNOS5420_DISP1_SYS_PWR_REG 0x1410
567#define EXYNOS5420_MAU_SYS_PWR_REG 0x1414
568#define EXYNOS5420_G2D_SYS_PWR_REG 0x1418
569#define EXYNOS5420_MSC_SYS_PWR_REG 0x141C
570#define EXYNOS5420_FSYS_SYS_PWR_REG 0x1420
571#define EXYNOS5420_FSYS2_SYS_PWR_REG 0x1424
572#define EXYNOS5420_PSGEN_SYS_PWR_REG 0x1428
573#define EXYNOS5420_PERIC_SYS_PWR_REG 0x142C
574#define EXYNOS5420_WCORE_SYS_PWR_REG 0x1430
575#define EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG 0x1490
576#define EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG 0x1494
577#define EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG 0x1498
578#define EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG 0x149C
579#define EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG 0x14A0
580#define EXYNOS5420_CMU_CLKSTOP_FSYS2_SYS_PWR_REG 0x14A4
581#define EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG 0x14A8
582#define EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG 0x14AC
583#define EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG 0x14B0
584#define EXYNOS5420_CMU_SYSCLK_TOPPWR_SYS_PWR_REG 0x14BC
585#define EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG 0x14D0
586#define EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG 0x14D4
587#define EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG 0x14D8
588#define EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG 0x14DC
589#define EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG 0x14E0
590#define EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG 0x14E4
591#define EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG 0x14E8
592#define EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG 0x14EC
593#define EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG 0x14F0
594#define EXYNOS5420_CMU_SYSCLK_SYSMEM_TOPPWR_SYS_PWR_REG 0x14F4
595#define EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG 0x1570
596#define EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG 0x1574
597#define EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG 0x1578
598#define EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG 0x157C
599#define EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG 0x1590
600#define EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG 0x1594
601#define EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG 0x1598
602#define EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG 0x159C
603#define EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG 0x15A0
604#define EXYNOS5420_SFR_AXI_CGDIS1 0x15E4
605#define EXYNOS_ARM_CORE2_CONFIGURATION 0x2100
606#define EXYNOS5420_ARM_CORE2_OPTION 0x2108
607#define EXYNOS_ARM_CORE3_CONFIGURATION 0x2180
608#define EXYNOS5420_ARM_CORE3_OPTION 0x2188
609#define EXYNOS5420_ARM_COMMON_STATUS 0x2504
610#define EXYNOS5420_ARM_COMMON_OPTION 0x2508
611#define EXYNOS5420_KFC_COMMON_STATUS 0x2584
612#define EXYNOS5420_KFC_COMMON_OPTION 0x2588
613#define EXYNOS5420_LOGIC_RESET_DURATION3 0x2D1C
614
615#define EXYNOS5420_PAD_RET_GPIO_OPTION 0x30C8
616#define EXYNOS5420_PAD_RET_UART_OPTION 0x30E8
617#define EXYNOS5420_PAD_RET_MMCA_OPTION 0x3108
618#define EXYNOS5420_PAD_RET_MMCB_OPTION 0x3128
619#define EXYNOS5420_PAD_RET_MMCC_OPTION 0x3148
620#define EXYNOS5420_PAD_RET_HSI_OPTION 0x3168
621#define EXYNOS5420_PAD_RET_SPI_OPTION 0x31C8
622#define EXYNOS5420_PAD_RET_DRAM_COREBLK_OPTION 0x31E8
623#define EXYNOS_PAD_RET_DRAM_OPTION 0x3008
624#define EXYNOS_PAD_RET_MAUDIO_OPTION 0x3028
625#define EXYNOS_PAD_RET_JTAG_OPTION 0x3048
626#define EXYNOS_PAD_RET_GPIO_OPTION 0x3108
627#define EXYNOS_PAD_RET_UART_OPTION 0x3128
628#define EXYNOS_PAD_RET_MMCA_OPTION 0x3148
629#define EXYNOS_PAD_RET_MMCB_OPTION 0x3168
630#define EXYNOS_PAD_RET_EBIA_OPTION 0x3188
631#define EXYNOS_PAD_RET_EBIB_OPTION 0x31A8
632
633#define EXYNOS_PS_HOLD_CONTROL 0x330C
634
635/* For SYS_PWR_REG */
636#define EXYNOS_SYS_PWR_CFG BIT(0)
637
638#define EXYNOS5420_MFC_CONFIGURATION 0x4060
639#define EXYNOS5420_MFC_STATUS 0x4064
640#define EXYNOS5420_MFC_OPTION 0x4068
641#define EXYNOS5420_G3D_CONFIGURATION 0x4080
642#define EXYNOS5420_G3D_STATUS 0x4084
643#define EXYNOS5420_G3D_OPTION 0x4088
644#define EXYNOS5420_DISP0_CONFIGURATION 0x40A0
645#define EXYNOS5420_DISP0_STATUS 0x40A4
646#define EXYNOS5420_DISP0_OPTION 0x40A8
647#define EXYNOS5420_DISP1_CONFIGURATION 0x40C0
648#define EXYNOS5420_DISP1_STATUS 0x40C4
649#define EXYNOS5420_DISP1_OPTION 0x40C8
650#define EXYNOS5420_MAU_CONFIGURATION 0x40E0
651#define EXYNOS5420_MAU_STATUS 0x40E4
652#define EXYNOS5420_MAU_OPTION 0x40E8
653#define EXYNOS5420_FSYS2_OPTION 0x4168
654#define EXYNOS5420_PSGEN_OPTION 0x4188
655
656/* For EXYNOS_CENTRAL_SEQ_OPTION */
657#define EXYNOS5_USE_STANDBYWFI_ARM_CORE0 BIT(16)
658#define EXYNOS5_USE_STANDBYWFI_ARM_CORE1 BUT(17)
659#define EXYNOS5_USE_STANDBYWFE_ARM_CORE0 BIT(24)
660#define EXYNOS5_USE_STANDBYWFE_ARM_CORE1 BIT(25)
661
662#define EXYNOS5420_ARM_USE_STANDBY_WFI0 BIT(4)
663#define EXYNOS5420_ARM_USE_STANDBY_WFI1 BIT(5)
664#define EXYNOS5420_ARM_USE_STANDBY_WFI2 BIT(6)
665#define EXYNOS5420_ARM_USE_STANDBY_WFI3 BIT(7)
666#define EXYNOS5420_KFC_USE_STANDBY_WFI0 BIT(8)
667#define EXYNOS5420_KFC_USE_STANDBY_WFI1 BIT(9)
668#define EXYNOS5420_KFC_USE_STANDBY_WFI2 BIT(10)
669#define EXYNOS5420_KFC_USE_STANDBY_WFI3 BIT(11)
670#define EXYNOS5420_ARM_USE_STANDBY_WFE0 BIT(16)
671#define EXYNOS5420_ARM_USE_STANDBY_WFE1 BIT(17)
672#define EXYNOS5420_ARM_USE_STANDBY_WFE2 BIT(18)
673#define EXYNOS5420_ARM_USE_STANDBY_WFE3 BIT(19)
674#define EXYNOS5420_KFC_USE_STANDBY_WFE0 BIT(20)
675#define EXYNOS5420_KFC_USE_STANDBY_WFE1 BIT(21)
676#define EXYNOS5420_KFC_USE_STANDBY_WFE2 BIT(22)
677#define EXYNOS5420_KFC_USE_STANDBY_WFE3 BIT(23)
678
679#define DUR_WAIT_RESET 0xF
680
681#define EXYNOS5420_USE_STANDBY_WFI_ALL (EXYNOS5420_ARM_USE_STANDBY_WFI0 \
682 | EXYNOS5420_ARM_USE_STANDBY_WFI1 \
683 | EXYNOS5420_ARM_USE_STANDBY_WFI2 \
684 | EXYNOS5420_ARM_USE_STANDBY_WFI3 \
685 | EXYNOS5420_KFC_USE_STANDBY_WFI0 \
686 | EXYNOS5420_KFC_USE_STANDBY_WFI1 \
687 | EXYNOS5420_KFC_USE_STANDBY_WFI2 \
688 | EXYNOS5420_KFC_USE_STANDBY_WFI3)
689
329#endif /* __ASM_ARCH_REGS_PMU_H */ 690#endif /* __ASM_ARCH_REGS_PMU_H */
diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S
index 108a45f4bb62..e3c373082bbe 100644
--- a/arch/arm/mach-exynos/sleep.S
+++ b/arch/arm/mach-exynos/sleep.S
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19#include "smc.h"
19 20
20#define CPU_MASK 0xff0ffff0 21#define CPU_MASK 0xff0ffff0
21#define CPU_CORTEX_A9 0x410fc090 22#define CPU_CORTEX_A9 0x410fc090
@@ -55,3 +56,30 @@ ENTRY(exynos_cpu_resume)
55#endif 56#endif
56 b cpu_resume 57 b cpu_resume
57ENDPROC(exynos_cpu_resume) 58ENDPROC(exynos_cpu_resume)
59
60 .align
61
62ENTRY(exynos_cpu_resume_ns)
63 mrc p15, 0, r0, c0, c0, 0
64 ldr r1, =CPU_MASK
65 and r0, r0, r1
66 ldr r1, =CPU_CORTEX_A9
67 cmp r0, r1
68 bne skip_cp15
69
70 adr r0, cp15_save_power
71 ldr r1, [r0]
72 adr r0, cp15_save_diag
73 ldr r2, [r0]
74 mov r0, #SMC_CMD_C15RESUME
75 dsb
76 smc #0
77skip_cp15:
78 b cpu_resume
79ENDPROC(exynos_cpu_resume_ns)
80 .globl cp15_save_diag
81cp15_save_diag:
82 .long 0 @ cp15 diagnostic
83 .globl cp15_save_power
84cp15_save_power:
85 .long 0 @ cp15 power control
diff --git a/arch/arm/mach-exynos/smc.h b/arch/arm/mach-exynos/smc.h
index 13a1dc8ecbf2..f7b82f9c1e21 100644
--- a/arch/arm/mach-exynos/smc.h
+++ b/arch/arm/mach-exynos/smc.h
@@ -26,6 +26,10 @@
26#define SMC_CMD_L2X0INVALL (-24) 26#define SMC_CMD_L2X0INVALL (-24)
27#define SMC_CMD_L2X0DEBUG (-25) 27#define SMC_CMD_L2X0DEBUG (-25)
28 28
29#ifndef __ASSEMBLY__
30
29extern void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3); 31extern void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3);
30 32
33#endif /* __ASSEMBLY__ */
34
31#endif 35#endif
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
new file mode 100644
index 000000000000..f8e7dcd17055
--- /dev/null
+++ b/arch/arm/mach-exynos/suspend.c
@@ -0,0 +1,566 @@
1/*
2 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS - Suspend support
6 *
7 * Based on arch/arm/mach-s3c2410/pm.c
8 * Copyright (c) 2006 Simtec Electronics
9 * Ben Dooks <ben@simtec.co.uk>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/init.h>
17#include <linux/suspend.h>
18#include <linux/syscore_ops.h>
19#include <linux/cpu_pm.h>
20#include <linux/io.h>
21#include <linux/irqchip/arm-gic.h>
22#include <linux/err.h>
23#include <linux/regulator/machine.h>
24
25#include <asm/cacheflush.h>
26#include <asm/hardware/cache-l2x0.h>
27#include <asm/firmware.h>
28#include <asm/mcpm.h>
29#include <asm/smp_scu.h>
30#include <asm/suspend.h>
31
32#include <plat/pm-common.h>
33#include <plat/regs-srom.h>
34
35#include "common.h"
36#include "regs-pmu.h"
37#include "regs-sys.h"
38#include "exynos-pmu.h"
39
40#define S5P_CHECK_SLEEP 0x00000BAD
41
42#define REG_TABLE_END (-1U)
43
44#define EXYNOS5420_CPU_STATE 0x28
45
46/**
47 * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping
48 * @hwirq: Hardware IRQ signal of the GIC
49 * @mask: Mask in PMU wake-up mask register
50 */
51struct exynos_wkup_irq {
52 unsigned int hwirq;
53 u32 mask;
54};
55
56static struct sleep_save exynos5_sys_save[] = {
57 SAVE_ITEM(EXYNOS5_SYS_I2C_CFG),
58};
59
60static struct sleep_save exynos_core_save[] = {
61 /* SROM side */
62 SAVE_ITEM(S5P_SROM_BW),
63 SAVE_ITEM(S5P_SROM_BC0),
64 SAVE_ITEM(S5P_SROM_BC1),
65 SAVE_ITEM(S5P_SROM_BC2),
66 SAVE_ITEM(S5P_SROM_BC3),
67};
68
69struct exynos_pm_data {
70 const struct exynos_wkup_irq *wkup_irq;
71 struct sleep_save *extra_save;
72 int num_extra_save;
73 unsigned int wake_disable_mask;
74 unsigned int *release_ret_regs;
75
76 void (*pm_prepare)(void);
77 void (*pm_resume_prepare)(void);
78 void (*pm_resume)(void);
79 int (*pm_suspend)(void);
80 int (*cpu_suspend)(unsigned long);
81};
82
83struct exynos_pm_data *pm_data;
84
85static int exynos5420_cpu_state;
86static unsigned int exynos_pmu_spare3;
87
88/*
89 * GIC wake-up support
90 */
91
92static u32 exynos_irqwake_intmask = 0xffffffff;
93
94static const struct exynos_wkup_irq exynos4_wkup_irq[] = {
95 { 76, BIT(1) }, /* RTC alarm */
96 { 77, BIT(2) }, /* RTC tick */
97 { /* sentinel */ },
98};
99
100static const struct exynos_wkup_irq exynos5250_wkup_irq[] = {
101 { 75, BIT(1) }, /* RTC alarm */
102 { 76, BIT(2) }, /* RTC tick */
103 { /* sentinel */ },
104};
105
106unsigned int exynos_release_ret_regs[] = {
107 S5P_PAD_RET_MAUDIO_OPTION,
108 S5P_PAD_RET_GPIO_OPTION,
109 S5P_PAD_RET_UART_OPTION,
110 S5P_PAD_RET_MMCA_OPTION,
111 S5P_PAD_RET_MMCB_OPTION,
112 S5P_PAD_RET_EBIA_OPTION,
113 S5P_PAD_RET_EBIB_OPTION,
114 REG_TABLE_END,
115};
116
117unsigned int exynos5420_release_ret_regs[] = {
118 EXYNOS_PAD_RET_DRAM_OPTION,
119 EXYNOS_PAD_RET_MAUDIO_OPTION,
120 EXYNOS_PAD_RET_JTAG_OPTION,
121 EXYNOS5420_PAD_RET_GPIO_OPTION,
122 EXYNOS5420_PAD_RET_UART_OPTION,
123 EXYNOS5420_PAD_RET_MMCA_OPTION,
124 EXYNOS5420_PAD_RET_MMCB_OPTION,
125 EXYNOS5420_PAD_RET_MMCC_OPTION,
126 EXYNOS5420_PAD_RET_HSI_OPTION,
127 EXYNOS_PAD_RET_EBIA_OPTION,
128 EXYNOS_PAD_RET_EBIB_OPTION,
129 EXYNOS5420_PAD_RET_SPI_OPTION,
130 EXYNOS5420_PAD_RET_DRAM_COREBLK_OPTION,
131 REG_TABLE_END,
132};
133
134static int exynos_irq_set_wake(struct irq_data *data, unsigned int state)
135{
136 const struct exynos_wkup_irq *wkup_irq;
137
138 if (!pm_data->wkup_irq)
139 return -ENOENT;
140 wkup_irq = pm_data->wkup_irq;
141
142 while (wkup_irq->mask) {
143 if (wkup_irq->hwirq == data->hwirq) {
144 if (!state)
145 exynos_irqwake_intmask |= wkup_irq->mask;
146 else
147 exynos_irqwake_intmask &= ~wkup_irq->mask;
148 return 0;
149 }
150 ++wkup_irq;
151 }
152
153 return -ENOENT;
154}
155
156static int exynos_cpu_do_idle(void)
157{
158 /* issue the standby signal into the pm unit. */
159 cpu_do_idle();
160
161 pr_info("Failed to suspend the system\n");
162 return 1; /* Aborting suspend */
163}
164static void exynos_flush_cache_all(void)
165{
166 flush_cache_all();
167 outer_flush_all();
168}
169
170static int exynos_cpu_suspend(unsigned long arg)
171{
172 exynos_flush_cache_all();
173 return exynos_cpu_do_idle();
174}
175
176static int exynos5420_cpu_suspend(unsigned long arg)
177{
178 /* MCPM works with HW CPU identifiers */
179 unsigned int mpidr = read_cpuid_mpidr();
180 unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
181 unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
182
183 __raw_writel(0x0, sysram_base_addr + EXYNOS5420_CPU_STATE);
184
185 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) {
186 mcpm_set_entry_vector(cpu, cluster, exynos_cpu_resume);
187
188 /*
189 * Residency value passed to mcpm_cpu_suspend back-end
190 * has to be given clear semantics. Set to 0 as a
191 * temporary value.
192 */
193 mcpm_cpu_suspend(0);
194 }
195
196 pr_info("Failed to suspend the system\n");
197
198 /* return value != 0 means failure */
199 return 1;
200}
201
202static void exynos_pm_set_wakeup_mask(void)
203{
204 /* Set wake-up mask registers */
205 pmu_raw_writel(exynos_get_eint_wake_mask(), S5P_EINT_WAKEUP_MASK);
206 pmu_raw_writel(exynos_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK);
207}
208
209static void exynos_pm_enter_sleep_mode(void)
210{
211 /* Set value of power down register for sleep mode */
212 exynos_sys_powerdown_conf(SYS_SLEEP);
213 pmu_raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1);
214}
215
216static void exynos_pm_prepare(void)
217{
218 /* Set wake-up mask registers */
219 exynos_pm_set_wakeup_mask();
220
221 s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
222
223 if (pm_data->extra_save)
224 s3c_pm_do_save(pm_data->extra_save,
225 pm_data->num_extra_save);
226
227 exynos_pm_enter_sleep_mode();
228
229 /* ensure at least INFORM0 has the resume address */
230 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0);
231}
232
233static void exynos5420_pm_prepare(void)
234{
235 unsigned int tmp;
236
237 /* Set wake-up mask registers */
238 exynos_pm_set_wakeup_mask();
239
240 s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
241
242 exynos_pmu_spare3 = pmu_raw_readl(S5P_PMU_SPARE3);
243 /*
244 * The cpu state needs to be saved and restored so that the
245 * secondary CPUs will enter low power start. Though the U-Boot
246 * is setting the cpu state with low power flag, the kernel
247 * needs to restore it back in case, the primary cpu fails to
248 * suspend for any reason.
249 */
250 exynos5420_cpu_state = __raw_readl(sysram_base_addr +
251 EXYNOS5420_CPU_STATE);
252
253 exynos_pm_enter_sleep_mode();
254
255 /* ensure at least INFORM0 has the resume address */
256 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM))
257 pmu_raw_writel(virt_to_phys(mcpm_entry_point), S5P_INFORM0);
258
259 tmp = pmu_raw_readl(EXYNOS5_ARM_L2_OPTION);
260 tmp &= ~EXYNOS5_USE_RETENTION;
261 pmu_raw_writel(tmp, EXYNOS5_ARM_L2_OPTION);
262
263 tmp = pmu_raw_readl(EXYNOS5420_SFR_AXI_CGDIS1);
264 tmp |= EXYNOS5420_UFS;
265 pmu_raw_writel(tmp, EXYNOS5420_SFR_AXI_CGDIS1);
266
267 tmp = pmu_raw_readl(EXYNOS5420_ARM_COMMON_OPTION);
268 tmp &= ~EXYNOS5420_L2RSTDISABLE_VALUE;
269 pmu_raw_writel(tmp, EXYNOS5420_ARM_COMMON_OPTION);
270
271 tmp = pmu_raw_readl(EXYNOS5420_FSYS2_OPTION);
272 tmp |= EXYNOS5420_EMULATION;
273 pmu_raw_writel(tmp, EXYNOS5420_FSYS2_OPTION);
274
275 tmp = pmu_raw_readl(EXYNOS5420_PSGEN_OPTION);
276 tmp |= EXYNOS5420_EMULATION;
277 pmu_raw_writel(tmp, EXYNOS5420_PSGEN_OPTION);
278}
279
280
281static int exynos_pm_suspend(void)
282{
283 exynos_pm_central_suspend();
284
285 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
286 exynos_cpu_save_register();
287
288 return 0;
289}
290
291static int exynos5420_pm_suspend(void)
292{
293 u32 this_cluster;
294
295 exynos_pm_central_suspend();
296
297 /* Setting SEQ_OPTION register */
298
299 this_cluster = MPIDR_AFFINITY_LEVEL(read_cpuid_mpidr(), 1);
300 if (!this_cluster)
301 pmu_raw_writel(EXYNOS5420_ARM_USE_STANDBY_WFI0,
302 S5P_CENTRAL_SEQ_OPTION);
303 else
304 pmu_raw_writel(EXYNOS5420_KFC_USE_STANDBY_WFI0,
305 S5P_CENTRAL_SEQ_OPTION);
306 return 0;
307}
308
309static void exynos_pm_release_retention(void)
310{
311 unsigned int i;
312
313 for (i = 0; (pm_data->release_ret_regs[i] != REG_TABLE_END); i++)
314 pmu_raw_writel(EXYNOS_WAKEUP_FROM_LOWPWR,
315 pm_data->release_ret_regs[i]);
316}
317
318static void exynos_pm_resume(void)
319{
320 u32 cpuid = read_cpuid_part();
321
322 if (exynos_pm_central_resume())
323 goto early_wakeup;
324
325 /* For release retention */
326 exynos_pm_release_retention();
327
328 if (pm_data->extra_save)
329 s3c_pm_do_restore_core(pm_data->extra_save,
330 pm_data->num_extra_save);
331
332 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
333
334 if (cpuid == ARM_CPU_PART_CORTEX_A9)
335 scu_enable(S5P_VA_SCU);
336
337 if (call_firmware_op(resume) == -ENOSYS
338 && cpuid == ARM_CPU_PART_CORTEX_A9)
339 exynos_cpu_restore_register();
340
341early_wakeup:
342
343 /* Clear SLEEP mode set in INFORM1 */
344 pmu_raw_writel(0x0, S5P_INFORM1);
345}
346
347static void exynos5420_prepare_pm_resume(void)
348{
349 if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM))
350 WARN_ON(mcpm_cpu_powered_up());
351}
352
353static void exynos5420_pm_resume(void)
354{
355 unsigned long tmp;
356
357 /* Restore the CPU0 low power state register */
358 tmp = pmu_raw_readl(EXYNOS5_ARM_CORE0_SYS_PWR_REG);
359 pmu_raw_writel(tmp | S5P_CORE_LOCAL_PWR_EN,
360 EXYNOS5_ARM_CORE0_SYS_PWR_REG);
361
362 /* Restore the sysram cpu state register */
363 __raw_writel(exynos5420_cpu_state,
364 sysram_base_addr + EXYNOS5420_CPU_STATE);
365
366 pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL,
367 S5P_CENTRAL_SEQ_OPTION);
368
369 if (exynos_pm_central_resume())
370 goto early_wakeup;
371
372 /* For release retention */
373 exynos_pm_release_retention();
374
375 pmu_raw_writel(exynos_pmu_spare3, S5P_PMU_SPARE3);
376
377 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
378
379early_wakeup:
380
381 tmp = pmu_raw_readl(EXYNOS5420_SFR_AXI_CGDIS1);
382 tmp &= ~EXYNOS5420_UFS;
383 pmu_raw_writel(tmp, EXYNOS5420_SFR_AXI_CGDIS1);
384
385 tmp = pmu_raw_readl(EXYNOS5420_FSYS2_OPTION);
386 tmp &= ~EXYNOS5420_EMULATION;
387 pmu_raw_writel(tmp, EXYNOS5420_FSYS2_OPTION);
388
389 tmp = pmu_raw_readl(EXYNOS5420_PSGEN_OPTION);
390 tmp &= ~EXYNOS5420_EMULATION;
391 pmu_raw_writel(tmp, EXYNOS5420_PSGEN_OPTION);
392
393 /* Clear SLEEP mode set in INFORM1 */
394 pmu_raw_writel(0x0, S5P_INFORM1);
395}
396
397/*
398 * Suspend Ops
399 */
400
401static int exynos_suspend_enter(suspend_state_t state)
402{
403 int ret;
404
405 s3c_pm_debug_init();
406
407 S3C_PMDBG("%s: suspending the system...\n", __func__);
408
409 S3C_PMDBG("%s: wakeup masks: %08x,%08x\n", __func__,
410 exynos_irqwake_intmask, exynos_get_eint_wake_mask());
411
412 if (exynos_irqwake_intmask == -1U
413 && exynos_get_eint_wake_mask() == -1U) {
414 pr_err("%s: No wake-up sources!\n", __func__);
415 pr_err("%s: Aborting sleep\n", __func__);
416 return -EINVAL;
417 }
418
419 s3c_pm_save_uarts();
420 if (pm_data->pm_prepare)
421 pm_data->pm_prepare();
422 flush_cache_all();
423 s3c_pm_check_store();
424
425 ret = call_firmware_op(suspend);
426 if (ret == -ENOSYS)
427 ret = cpu_suspend(0, pm_data->cpu_suspend);
428 if (ret)
429 return ret;
430
431 if (pm_data->pm_resume_prepare)
432 pm_data->pm_resume_prepare();
433 s3c_pm_restore_uarts();
434
435 S3C_PMDBG("%s: wakeup stat: %08x\n", __func__,
436 pmu_raw_readl(S5P_WAKEUP_STAT));
437
438 s3c_pm_check_restore();
439
440 S3C_PMDBG("%s: resuming the system...\n", __func__);
441
442 return 0;
443}
444
445static int exynos_suspend_prepare(void)
446{
447 int ret;
448
449 /*
450 * REVISIT: It would be better if struct platform_suspend_ops
451 * .prepare handler get the suspend_state_t as a parameter to
452 * avoid hard-coding the suspend to mem state. It's safe to do
453 * it now only because the suspend_valid_only_mem function is
454 * used as the .valid callback used to check if a given state
455 * is supported by the platform anyways.
456 */
457 ret = regulator_suspend_prepare(PM_SUSPEND_MEM);
458 if (ret) {
459 pr_err("Failed to prepare regulators for suspend (%d)\n", ret);
460 return ret;
461 }
462
463 s3c_pm_check_prepare();
464
465 return 0;
466}
467
468static void exynos_suspend_finish(void)
469{
470 int ret;
471
472 s3c_pm_check_cleanup();
473
474 ret = regulator_suspend_finish();
475 if (ret)
476 pr_warn("Failed to resume regulators from suspend (%d)\n", ret);
477}
478
479static const struct platform_suspend_ops exynos_suspend_ops = {
480 .enter = exynos_suspend_enter,
481 .prepare = exynos_suspend_prepare,
482 .finish = exynos_suspend_finish,
483 .valid = suspend_valid_only_mem,
484};
485
486static const struct exynos_pm_data exynos4_pm_data = {
487 .wkup_irq = exynos4_wkup_irq,
488 .wake_disable_mask = ((0xFF << 8) | (0x1F << 1)),
489 .release_ret_regs = exynos_release_ret_regs,
490 .pm_suspend = exynos_pm_suspend,
491 .pm_resume = exynos_pm_resume,
492 .pm_prepare = exynos_pm_prepare,
493 .cpu_suspend = exynos_cpu_suspend,
494};
495
496static const struct exynos_pm_data exynos5250_pm_data = {
497 .wkup_irq = exynos5250_wkup_irq,
498 .wake_disable_mask = ((0xFF << 8) | (0x1F << 1)),
499 .release_ret_regs = exynos_release_ret_regs,
500 .extra_save = exynos5_sys_save,
501 .num_extra_save = ARRAY_SIZE(exynos5_sys_save),
502 .pm_suspend = exynos_pm_suspend,
503 .pm_resume = exynos_pm_resume,
504 .pm_prepare = exynos_pm_prepare,
505 .cpu_suspend = exynos_cpu_suspend,
506};
507
508static struct exynos_pm_data exynos5420_pm_data = {
509 .wkup_irq = exynos5250_wkup_irq,
510 .wake_disable_mask = (0x7F << 7) | (0x1F << 1),
511 .release_ret_regs = exynos5420_release_ret_regs,
512 .pm_resume_prepare = exynos5420_prepare_pm_resume,
513 .pm_resume = exynos5420_pm_resume,
514 .pm_suspend = exynos5420_pm_suspend,
515 .pm_prepare = exynos5420_pm_prepare,
516 .cpu_suspend = exynos5420_cpu_suspend,
517};
518
519static struct of_device_id exynos_pmu_of_device_ids[] = {
520 {
521 .compatible = "samsung,exynos4210-pmu",
522 .data = &exynos4_pm_data,
523 }, {
524 .compatible = "samsung,exynos4212-pmu",
525 .data = &exynos4_pm_data,
526 }, {
527 .compatible = "samsung,exynos4412-pmu",
528 .data = &exynos4_pm_data,
529 }, {
530 .compatible = "samsung,exynos5250-pmu",
531 .data = &exynos5250_pm_data,
532 }, {
533 .compatible = "samsung,exynos5420-pmu",
534 .data = &exynos5420_pm_data,
535 },
536 { /*sentinel*/ },
537};
538
539static struct syscore_ops exynos_pm_syscore_ops;
540
541void __init exynos_pm_init(void)
542{
543 const struct of_device_id *match;
544 u32 tmp;
545
546 of_find_matching_node_and_match(NULL, exynos_pmu_of_device_ids, &match);
547 if (!match) {
548 pr_err("Failed to find PMU node\n");
549 return;
550 }
551 pm_data = (struct exynos_pm_data *) match->data;
552
553 /* Platform-specific GIC callback */
554 gic_arch_extn.irq_set_wake = exynos_irq_set_wake;
555
556 /* All wakeup disable */
557 tmp = pmu_raw_readl(S5P_WAKEUP_MASK);
558 tmp |= pm_data->wake_disable_mask;
559 pmu_raw_writel(tmp, S5P_WAKEUP_MASK);
560
561 exynos_pm_syscore_ops.suspend = pm_data->pm_suspend;
562 exynos_pm_syscore_ops.resume = pm_data->pm_resume;
563
564 register_syscore_ops(&exynos_pm_syscore_ops);
565 suspend_set_ops(&exynos_suspend_ops);
566}
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 11b2957f792b..e8627e04e1e6 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -633,12 +633,41 @@ config SOC_VF610
633 bool "Vybrid Family VF610 support" 633 bool "Vybrid Family VF610 support"
634 select ARM_GIC 634 select ARM_GIC
635 select PINCTRL_VF610 635 select PINCTRL_VF610
636 select VF_PIT_TIMER
637 select PL310_ERRATA_769419 if CACHE_L2X0 636 select PL310_ERRATA_769419 if CACHE_L2X0
638 637
639 help 638 help
640 This enable support for Freescale Vybrid VF610 processor. 639 This enable support for Freescale Vybrid VF610 processor.
641 640
641choice
642 prompt "Clocksource for scheduler clock"
643 depends on SOC_VF610
644 default VF_USE_ARM_GLOBAL_TIMER
645
646 config VF_USE_ARM_GLOBAL_TIMER
647 bool "Use ARM Global Timer"
648 select ARM_GLOBAL_TIMER
649 select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
650 help
651 Use the ARM Global Timer as clocksource
652
653 config VF_USE_PIT_TIMER
654 bool "Use PIT timer"
655 select VF_PIT_TIMER
656 help
657 Use SoC Periodic Interrupt Timer (PIT) as clocksource
658
659endchoice
660
661config SOC_LS1021A
662 bool "Freescale LS1021A support"
663 select ARM_GIC
664 select HAVE_ARM_ARCH_TIMER
665 select PCI_DOMAINS if PCI
666 select ZONE_DMA if ARM_LPAE
667
668 help
669 This enable support for Freescale LS1021A processor.
670
642endif 671endif
643 672
644source "arch/arm/mach-imx/devices/Kconfig" 673source "arch/arm/mach-imx/devices/Kconfig"
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 6e4fcd8339cd..f5ac685a29fc 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -12,7 +12,7 @@ obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clk-imx31.o iomux-imx31.o ehci-
12obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o 12obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o
13 13
14imx5-pm-$(CONFIG_PM) += pm-imx5.o 14imx5-pm-$(CONFIG_PM) += pm-imx5.o
15obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o clk-imx51-imx53.o $(imx5-pm-y) 15obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o clk-imx51-imx53.o clk-cpu.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 \
@@ -89,7 +89,7 @@ obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
89obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o 89obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
90obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o 90obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o
91obj-$(CONFIG_HAVE_IMX_SRC) += src.o 91obj-$(CONFIG_HAVE_IMX_SRC) += src.o
92ifdef CONFIG_SOC_IMX6 92ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),)
93AFLAGS_headsmp.o :=-Wa,-march=armv7-a 93AFLAGS_headsmp.o :=-Wa,-march=armv7-a
94obj-$(CONFIG_SMP) += headsmp.o platsmp.o 94obj-$(CONFIG_SMP) += headsmp.o platsmp.o
95obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 95obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
@@ -110,4 +110,6 @@ obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
110 110
111obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o 111obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o
112 112
113obj-$(CONFIG_SOC_LS1021A) += mach-ls1021a.o
114
113obj-y += devices/ 115obj-y += devices/
diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c
index 8259a625a920..7f262fe4ba77 100644
--- a/arch/arm/mach-imx/anatop.c
+++ b/arch/arm/mach-imx/anatop.c
@@ -30,8 +30,11 @@
30#define ANADIG_DIGPROG_IMX6SL 0x280 30#define ANADIG_DIGPROG_IMX6SL 0x280
31 31
32#define BM_ANADIG_REG_2P5_ENABLE_WEAK_LINREG 0x40000 32#define BM_ANADIG_REG_2P5_ENABLE_WEAK_LINREG 0x40000
33#define BM_ANADIG_REG_2P5_ENABLE_PULLDOWN 0x8
33#define BM_ANADIG_REG_CORE_FET_ODRIVE 0x20000000 34#define BM_ANADIG_REG_CORE_FET_ODRIVE 0x20000000
34#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG 0x1000 35#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG 0x1000
36/* Below MISC0_DISCON_HIGH_SNVS is only for i.MX6SL */
37#define BM_ANADIG_ANA_MISC0_DISCON_HIGH_SNVS 0x2000
35#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x80000 38#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x80000
36#define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x100000 39#define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x100000
37 40
@@ -56,16 +59,43 @@ static void imx_anatop_enable_fet_odrive(bool enable)
56 BM_ANADIG_REG_CORE_FET_ODRIVE); 59 BM_ANADIG_REG_CORE_FET_ODRIVE);
57} 60}
58 61
62static inline void imx_anatop_enable_2p5_pulldown(bool enable)
63{
64 regmap_write(anatop, ANADIG_REG_2P5 + (enable ? REG_SET : REG_CLR),
65 BM_ANADIG_REG_2P5_ENABLE_PULLDOWN);
66}
67
68static inline void imx_anatop_disconnect_high_snvs(bool enable)
69{
70 regmap_write(anatop, ANADIG_ANA_MISC0 + (enable ? REG_SET : REG_CLR),
71 BM_ANADIG_ANA_MISC0_DISCON_HIGH_SNVS);
72}
73
59void imx_anatop_pre_suspend(void) 74void imx_anatop_pre_suspend(void)
60{ 75{
61 imx_anatop_enable_weak2p5(true); 76 if (imx_mmdc_get_ddr_type() == IMX_DDR_TYPE_LPDDR2)
77 imx_anatop_enable_2p5_pulldown(true);
78 else
79 imx_anatop_enable_weak2p5(true);
80
62 imx_anatop_enable_fet_odrive(true); 81 imx_anatop_enable_fet_odrive(true);
82
83 if (cpu_is_imx6sl())
84 imx_anatop_disconnect_high_snvs(true);
63} 85}
64 86
65void imx_anatop_post_resume(void) 87void imx_anatop_post_resume(void)
66{ 88{
89 if (imx_mmdc_get_ddr_type() == IMX_DDR_TYPE_LPDDR2)
90 imx_anatop_enable_2p5_pulldown(false);
91 else
92 imx_anatop_enable_weak2p5(false);
93
67 imx_anatop_enable_fet_odrive(false); 94 imx_anatop_enable_fet_odrive(false);
68 imx_anatop_enable_weak2p5(false); 95
96 if (cpu_is_imx6sl())
97 imx_anatop_disconnect_high_snvs(false);
98
69} 99}
70 100
71static void imx_anatop_usb_chrg_detect_disable(void) 101static void imx_anatop_usb_chrg_detect_disable(void)
diff --git a/arch/arm/mach-imx/clk-cpu.c b/arch/arm/mach-imx/clk-cpu.c
new file mode 100644
index 000000000000..aa1c345e2a19
--- /dev/null
+++ b/arch/arm/mach-imx/clk-cpu.c
@@ -0,0 +1,107 @@
1/*
2 * Copyright (c) 2014 Lucas Stach <l.stach@pengutronix.de>, Pengutronix
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 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include <linux/clk.h>
13#include <linux/clk-provider.h>
14#include <linux/slab.h>
15
16struct clk_cpu {
17 struct clk_hw hw;
18 struct clk *div;
19 struct clk *mux;
20 struct clk *pll;
21 struct clk *step;
22};
23
24static inline struct clk_cpu *to_clk_cpu(struct clk_hw *hw)
25{
26 return container_of(hw, struct clk_cpu, hw);
27}
28
29static unsigned long clk_cpu_recalc_rate(struct clk_hw *hw,
30 unsigned long parent_rate)
31{
32 struct clk_cpu *cpu = to_clk_cpu(hw);
33
34 return clk_get_rate(cpu->div);
35}
36
37static long clk_cpu_round_rate(struct clk_hw *hw, unsigned long rate,
38 unsigned long *prate)
39{
40 struct clk_cpu *cpu = to_clk_cpu(hw);
41
42 return clk_round_rate(cpu->pll, rate);
43}
44
45static int clk_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
46 unsigned long parent_rate)
47{
48 struct clk_cpu *cpu = to_clk_cpu(hw);
49 int ret;
50
51 /* switch to PLL bypass clock */
52 ret = clk_set_parent(cpu->mux, cpu->step);
53 if (ret)
54 return ret;
55
56 /* reprogram PLL */
57 ret = clk_set_rate(cpu->pll, rate);
58 if (ret) {
59 clk_set_parent(cpu->mux, cpu->pll);
60 return ret;
61 }
62 /* switch back to PLL clock */
63 clk_set_parent(cpu->mux, cpu->pll);
64
65 /* Ensure the divider is what we expect */
66 clk_set_rate(cpu->div, rate);
67
68 return 0;
69}
70
71static const struct clk_ops clk_cpu_ops = {
72 .recalc_rate = clk_cpu_recalc_rate,
73 .round_rate = clk_cpu_round_rate,
74 .set_rate = clk_cpu_set_rate,
75};
76
77struct clk *imx_clk_cpu(const char *name, const char *parent_name,
78 struct clk *div, struct clk *mux, struct clk *pll,
79 struct clk *step)
80{
81 struct clk_cpu *cpu;
82 struct clk *clk;
83 struct clk_init_data init;
84
85 cpu = kzalloc(sizeof(*cpu), GFP_KERNEL);
86 if (!cpu)
87 return ERR_PTR(-ENOMEM);
88
89 cpu->div = div;
90 cpu->mux = mux;
91 cpu->pll = pll;
92 cpu->step = step;
93
94 init.name = name;
95 init.ops = &clk_cpu_ops;
96 init.flags = 0;
97 init.parent_names = &parent_name;
98 init.num_parents = 1;
99
100 cpu->hw.init = &init;
101
102 clk = clk_register(NULL, &cpu->hw);
103 if (IS_ERR(clk))
104 kfree(cpu);
105
106 return clk;
107}
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 72d65214223e..0f7e536147cb 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -125,6 +125,8 @@ static const char *mx53_spdif_xtal_sel[] = { "osc", "ckih", "ckih2", "pll4_sw",
125static const char *spdif_sel[] = { "pll1_sw", "pll2_sw", "pll3_sw", "spdif_xtal_sel", }; 125static const char *spdif_sel[] = { "pll1_sw", "pll2_sw", "pll3_sw", "spdif_xtal_sel", };
126static const char *spdif0_com_sel[] = { "spdif0_podf", "ssi1_root_gate", }; 126static const char *spdif0_com_sel[] = { "spdif0_podf", "ssi1_root_gate", };
127static const char *mx51_spdif1_com_sel[] = { "spdif1_podf", "ssi2_root_gate", }; 127static const char *mx51_spdif1_com_sel[] = { "spdif1_podf", "ssi2_root_gate", };
128static const char *step_sels[] = { "lp_apm", };
129static const char *cpu_podf_sels[] = { "pll1_sw", "step_sel" };
128 130
129static struct clk *clk[IMX5_CLK_END]; 131static struct clk *clk[IMX5_CLK_END];
130static struct clk_onecell_data clk_data; 132static struct clk_onecell_data clk_data;
@@ -193,7 +195,9 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base)
193 clk[IMX5_CLK_USB_PHY_PODF] = imx_clk_divider("usb_phy_podf", "usb_phy_pred", MXC_CCM_CDCDR, 0, 3); 195 clk[IMX5_CLK_USB_PHY_PODF] = imx_clk_divider("usb_phy_podf", "usb_phy_pred", MXC_CCM_CDCDR, 0, 3);
194 clk[IMX5_CLK_USB_PHY_SEL] = imx_clk_mux("usb_phy_sel", MXC_CCM_CSCMR1, 26, 1, 196 clk[IMX5_CLK_USB_PHY_SEL] = imx_clk_mux("usb_phy_sel", MXC_CCM_CSCMR1, 26, 1,
195 usb_phy_sel_str, ARRAY_SIZE(usb_phy_sel_str)); 197 usb_phy_sel_str, ARRAY_SIZE(usb_phy_sel_str));
196 clk[IMX5_CLK_CPU_PODF] = imx_clk_divider("cpu_podf", "pll1_sw", MXC_CCM_CACRR, 0, 3); 198 clk[IMX5_CLK_STEP_SEL] = imx_clk_mux("step_sel", MXC_CCM_CCSR, 7, 2, step_sels, ARRAY_SIZE(step_sels));
199 clk[IMX5_CLK_CPU_PODF_SEL] = imx_clk_mux("cpu_podf_sel", MXC_CCM_CCSR, 2, 1, cpu_podf_sels, ARRAY_SIZE(cpu_podf_sels));
200 clk[IMX5_CLK_CPU_PODF] = imx_clk_divider("cpu_podf", "cpu_podf_sel", MXC_CCM_CACRR, 0, 3);
197 clk[IMX5_CLK_DI_PRED] = imx_clk_divider("di_pred", "pll3_sw", MXC_CCM_CDCDR, 6, 3); 201 clk[IMX5_CLK_DI_PRED] = imx_clk_divider("di_pred", "pll3_sw", MXC_CCM_CDCDR, 6, 3);
198 clk[IMX5_CLK_IIM_GATE] = imx_clk_gate2("iim_gate", "ipg", MXC_CCM_CCGR0, 30); 202 clk[IMX5_CLK_IIM_GATE] = imx_clk_gate2("iim_gate", "ipg", MXC_CCM_CCGR0, 30);
199 clk[IMX5_CLK_UART1_IPG_GATE] = imx_clk_gate2("uart1_ipg_gate", "ipg", MXC_CCM_CCGR1, 6); 203 clk[IMX5_CLK_UART1_IPG_GATE] = imx_clk_gate2("uart1_ipg_gate", "ipg", MXC_CCM_CCGR1, 6);
@@ -537,6 +541,11 @@ static void __init mx53_clocks_init(struct device_node *np)
537 clk[IMX5_CLK_CKO2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24); 541 clk[IMX5_CLK_CKO2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
538 clk[IMX5_CLK_SPDIF_XTAL_SEL] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2, 542 clk[IMX5_CLK_SPDIF_XTAL_SEL] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
539 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel)); 543 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel));
544 clk[IMX5_CLK_ARM] = imx_clk_cpu("arm", "cpu_podf",
545 clk[IMX5_CLK_CPU_PODF],
546 clk[IMX5_CLK_CPU_PODF_SEL],
547 clk[IMX5_CLK_PLL1_SW],
548 clk[IMX5_CLK_STEP_SEL]);
540 549
541 imx_check_clocks(clk, ARRAY_SIZE(clk)); 550 imx_check_clocks(clk, ARRAY_SIZE(clk));
542 551
@@ -551,6 +560,9 @@ static void __init mx53_clocks_init(struct device_node *np)
551 /* move can bus clk to 24MHz */ 560 /* move can bus clk to 24MHz */
552 clk_set_parent(clk[IMX5_CLK_CAN_SEL], clk[IMX5_CLK_LP_APM]); 561 clk_set_parent(clk[IMX5_CLK_CAN_SEL], clk[IMX5_CLK_LP_APM]);
553 562
563 /* make sure step clock is running from 24MHz */
564 clk_set_parent(clk[IMX5_CLK_STEP_SEL], clk[IMX5_CLK_LP_APM]);
565
554 clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]); 566 clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]);
555 imx_print_silicon_rev("i.MX53", mx53_revision()); 567 imx_print_silicon_rev("i.MX53", mx53_revision());
556 clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]); 568 clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]);
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 4e79da7c5e30..5951660d1bd2 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -145,7 +145,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
145 post_div_table[2].div = 1; 145 post_div_table[2].div = 1;
146 video_div_table[1].div = 1; 146 video_div_table[1].div = 1;
147 video_div_table[2].div = 1; 147 video_div_table[2].div = 1;
148 }; 148 }
149 149
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)); 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));
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)); 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));
diff --git a/arch/arm/mach-imx/clk-pllv3.c b/arch/arm/mach-imx/clk-pllv3.c
index 57de74da0acf..0ad6e5442fd8 100644
--- a/arch/arm/mach-imx/clk-pllv3.c
+++ b/arch/arm/mach-imx/clk-pllv3.c
@@ -69,7 +69,6 @@ static int clk_pllv3_prepare(struct clk_hw *hw)
69{ 69{
70 struct clk_pllv3 *pll = to_clk_pllv3(hw); 70 struct clk_pllv3 *pll = to_clk_pllv3(hw);
71 u32 val; 71 u32 val;
72 int ret;
73 72
74 val = readl_relaxed(pll->base); 73 val = readl_relaxed(pll->base);
75 if (pll->powerup_set) 74 if (pll->powerup_set)
@@ -78,11 +77,7 @@ static int clk_pllv3_prepare(struct clk_hw *hw)
78 val &= ~BM_PLL_POWER; 77 val &= ~BM_PLL_POWER;
79 writel_relaxed(val, pll->base); 78 writel_relaxed(val, pll->base);
80 79
81 ret = clk_pllv3_wait_lock(pll); 80 return clk_pllv3_wait_lock(pll);
82 if (ret)
83 return ret;
84
85 return 0;
86} 81}
87 82
88static void clk_pllv3_unprepare(struct clk_hw *hw) 83static void clk_pllv3_unprepare(struct clk_hw *hw)
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index 409637254594..5937ddee1a99 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -120,6 +120,17 @@ static unsigned int const clks_init_on[] __initconst = {
120 VF610_CLK_DDR_SEL, 120 VF610_CLK_DDR_SEL,
121}; 121};
122 122
123static struct clk * __init vf610_get_fixed_clock(
124 struct device_node *ccm_node, const char *name)
125{
126 struct clk *clk = of_clk_get_by_name(ccm_node, name);
127
128 /* Backward compatibility if device tree is missing clks assignments */
129 if (IS_ERR(clk))
130 clk = imx_obtain_fixed_clock(name, 0);
131 return clk;
132};
133
123static void __init vf610_clocks_init(struct device_node *ccm_node) 134static void __init vf610_clocks_init(struct device_node *ccm_node)
124{ 135{
125 struct device_node *np; 136 struct device_node *np;
@@ -130,13 +141,13 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
130 clk[VF610_CLK_SIRC_32K] = imx_clk_fixed("sirc_32k", 32000); 141 clk[VF610_CLK_SIRC_32K] = imx_clk_fixed("sirc_32k", 32000);
131 clk[VF610_CLK_FIRC] = imx_clk_fixed("firc", 24000000); 142 clk[VF610_CLK_FIRC] = imx_clk_fixed("firc", 24000000);
132 143
133 clk[VF610_CLK_SXOSC] = imx_obtain_fixed_clock("sxosc", 0); 144 clk[VF610_CLK_SXOSC] = vf610_get_fixed_clock(ccm_node, "sxosc");
134 clk[VF610_CLK_FXOSC] = imx_obtain_fixed_clock("fxosc", 0); 145 clk[VF610_CLK_FXOSC] = vf610_get_fixed_clock(ccm_node, "fxosc");
135 clk[VF610_CLK_AUDIO_EXT] = imx_obtain_fixed_clock("audio_ext", 0); 146 clk[VF610_CLK_AUDIO_EXT] = vf610_get_fixed_clock(ccm_node, "audio_ext");
136 clk[VF610_CLK_ENET_EXT] = imx_obtain_fixed_clock("enet_ext", 0); 147 clk[VF610_CLK_ENET_EXT] = vf610_get_fixed_clock(ccm_node, "enet_ext");
137 148
138 /* Clock source from external clock via LVDs PAD */ 149 /* Clock source from external clock via LVDs PAD */
139 clk[VF610_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0); 150 clk[VF610_CLK_ANACLK1] = vf610_get_fixed_clock(ccm_node, "anaclk1");
140 151
141 clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2); 152 clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2);
142 153
diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
index 4cdf8b6a74e8..5ef82e2f8fc5 100644
--- a/arch/arm/mach-imx/clk.h
+++ b/arch/arm/mach-imx/clk.h
@@ -131,4 +131,8 @@ static inline struct clk *imx_clk_fixed_factor(const char *name,
131 CLK_SET_RATE_PARENT, mult, div); 131 CLK_SET_RATE_PARENT, mult, div);
132} 132}
133 133
134struct clk *imx_clk_cpu(const char *name, const char *parent_name,
135 struct clk *div, struct clk *mux, struct clk *pll,
136 struct clk *step);
137
134#endif 138#endif
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 1dabf435c592..cfcdb623d78f 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -61,7 +61,6 @@ struct platform_device *mxc_register_gpio(char *name, int id,
61void mxc_set_cpu_type(unsigned int type); 61void mxc_set_cpu_type(unsigned int type);
62void mxc_restart(enum reboot_mode, const char *); 62void mxc_restart(enum reboot_mode, const char *);
63void mxc_arch_reset_init(void __iomem *); 63void mxc_arch_reset_init(void __iomem *);
64void mxc_arch_reset_init_dt(void);
65int mx51_revision(void); 64int mx51_revision(void);
66int mx53_revision(void); 65int mx53_revision(void);
67void imx_set_aips(void __iomem *); 66void imx_set_aips(void __iomem *);
@@ -108,14 +107,15 @@ void imx_gpc_pre_suspend(bool arm_power_off);
108void imx_gpc_post_resume(void); 107void imx_gpc_post_resume(void);
109void imx_gpc_mask_all(void); 108void imx_gpc_mask_all(void);
110void imx_gpc_restore_all(void); 109void imx_gpc_restore_all(void);
111void imx_gpc_irq_mask(struct irq_data *d); 110void imx_gpc_hwirq_mask(unsigned int hwirq);
112void imx_gpc_irq_unmask(struct irq_data *d); 111void imx_gpc_hwirq_unmask(unsigned int hwirq);
113void imx_anatop_init(void); 112void imx_anatop_init(void);
114void imx_anatop_pre_suspend(void); 113void imx_anatop_pre_suspend(void);
115void imx_anatop_post_resume(void); 114void imx_anatop_post_resume(void);
116int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode); 115int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
117void imx6q_set_int_mem_clk_lpm(bool enable); 116void imx6q_set_int_mem_clk_lpm(bool enable);
118void imx6sl_set_wait_clk(bool enter); 117void imx6sl_set_wait_clk(bool enter);
118int imx_mmdc_get_ddr_type(void);
119 119
120void imx_cpu_die(unsigned int cpu); 120void imx_cpu_die(unsigned int cpu);
121int imx_cpu_kill(unsigned int cpu); 121int imx_cpu_kill(unsigned int cpu);
@@ -157,5 +157,6 @@ static inline void imx_init_l2cache(void) {}
157#endif 157#endif
158 158
159extern struct smp_operations imx_smp_ops; 159extern struct smp_operations imx_smp_ops;
160extern struct smp_operations ls1021a_smp_ops;
160 161
161#endif 162#endif
diff --git a/arch/arm/mach-imx/cpuidle-imx5.c b/arch/arm/mach-imx/cpuidle-imx5.c
index 5a47e3c6172f..3feca526d16b 100644
--- a/arch/arm/mach-imx/cpuidle-imx5.c
+++ b/arch/arm/mach-imx/cpuidle-imx5.c
@@ -24,7 +24,6 @@ static struct cpuidle_driver imx5_cpuidle_driver = {
24 .enter = imx5_cpuidle_enter, 24 .enter = imx5_cpuidle_enter,
25 .exit_latency = 2, 25 .exit_latency = 2,
26 .target_residency = 1, 26 .target_residency = 1,
27 .flags = CPUIDLE_FLAG_TIME_VALID,
28 .name = "IMX5 SRPG", 27 .name = "IMX5 SRPG",
29 .desc = "CPU state retained,powered off", 28 .desc = "CPU state retained,powered off",
30 }, 29 },
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
index aa935787b743..d76d08623f9f 100644
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
@@ -53,8 +53,7 @@ static struct cpuidle_driver imx6q_cpuidle_driver = {
53 { 53 {
54 .exit_latency = 50, 54 .exit_latency = 50,
55 .target_residency = 75, 55 .target_residency = 75,
56 .flags = CPUIDLE_FLAG_TIME_VALID | 56 .flags = CPUIDLE_FLAG_TIMER_STOP,
57 CPUIDLE_FLAG_TIMER_STOP,
58 .enter = imx6q_enter_wait, 57 .enter = imx6q_enter_wait,
59 .name = "WAIT", 58 .name = "WAIT",
60 .desc = "Clock off", 59 .desc = "Clock off",
diff --git a/arch/arm/mach-imx/cpuidle-imx6sl.c b/arch/arm/mach-imx/cpuidle-imx6sl.c
index d4b6b8171fa9..7d92e6584551 100644
--- a/arch/arm/mach-imx/cpuidle-imx6sl.c
+++ b/arch/arm/mach-imx/cpuidle-imx6sl.c
@@ -40,8 +40,7 @@ static struct cpuidle_driver imx6sl_cpuidle_driver = {
40 { 40 {
41 .exit_latency = 50, 41 .exit_latency = 50,
42 .target_residency = 75, 42 .target_residency = 75,
43 .flags = CPUIDLE_FLAG_TIME_VALID | 43 .flags = CPUIDLE_FLAG_TIMER_STOP,
44 CPUIDLE_FLAG_TIMER_STOP,
45 .enter = imx6sl_enter_wait, 44 .enter = imx6sl_enter_wait,
46 .name = "WAIT", 45 .name = "WAIT",
47 .desc = "Clock off", 46 .desc = "Clock off",
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index 82ea74e68482..5f3602ec74fa 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -56,14 +56,14 @@ void imx_gpc_post_resume(void)
56 56
57static int imx_gpc_irq_set_wake(struct irq_data *d, unsigned int on) 57static int imx_gpc_irq_set_wake(struct irq_data *d, unsigned int on)
58{ 58{
59 unsigned int idx = d->irq / 32 - 1; 59 unsigned int idx = d->hwirq / 32 - 1;
60 u32 mask; 60 u32 mask;
61 61
62 /* Sanity check for SPI irq */ 62 /* Sanity check for SPI irq */
63 if (d->irq < 32) 63 if (d->hwirq < 32)
64 return -EINVAL; 64 return -EINVAL;
65 65
66 mask = 1 << d->irq % 32; 66 mask = 1 << d->hwirq % 32;
67 gpc_wake_irqs[idx] = on ? gpc_wake_irqs[idx] | mask : 67 gpc_wake_irqs[idx] = on ? gpc_wake_irqs[idx] | mask :
68 gpc_wake_irqs[idx] & ~mask; 68 gpc_wake_irqs[idx] & ~mask;
69 69
@@ -91,34 +91,44 @@ void imx_gpc_restore_all(void)
91 writel_relaxed(gpc_saved_imrs[i], reg_imr1 + i * 4); 91 writel_relaxed(gpc_saved_imrs[i], reg_imr1 + i * 4);
92} 92}
93 93
94void imx_gpc_irq_unmask(struct irq_data *d) 94void imx_gpc_hwirq_unmask(unsigned int hwirq)
95{ 95{
96 void __iomem *reg; 96 void __iomem *reg;
97 u32 val; 97 u32 val;
98 98
99 /* Sanity check for SPI irq */ 99 reg = gpc_base + GPC_IMR1 + (hwirq / 32 - 1) * 4;
100 if (d->irq < 32)
101 return;
102
103 reg = gpc_base + GPC_IMR1 + (d->irq / 32 - 1) * 4;
104 val = readl_relaxed(reg); 100 val = readl_relaxed(reg);
105 val &= ~(1 << d->irq % 32); 101 val &= ~(1 << hwirq % 32);
106 writel_relaxed(val, reg); 102 writel_relaxed(val, reg);
107} 103}
108 104
109void imx_gpc_irq_mask(struct irq_data *d) 105void imx_gpc_hwirq_mask(unsigned int hwirq)
110{ 106{
111 void __iomem *reg; 107 void __iomem *reg;
112 u32 val; 108 u32 val;
113 109
110 reg = gpc_base + GPC_IMR1 + (hwirq / 32 - 1) * 4;
111 val = readl_relaxed(reg);
112 val |= 1 << (hwirq % 32);
113 writel_relaxed(val, reg);
114}
115
116static void imx_gpc_irq_unmask(struct irq_data *d)
117{
118 /* Sanity check for SPI irq */
119 if (d->hwirq < 32)
120 return;
121
122 imx_gpc_hwirq_unmask(d->hwirq);
123}
124
125static void imx_gpc_irq_mask(struct irq_data *d)
126{
114 /* Sanity check for SPI irq */ 127 /* Sanity check for SPI irq */
115 if (d->irq < 32) 128 if (d->hwirq < 32)
116 return; 129 return;
117 130
118 reg = gpc_base + GPC_IMR1 + (d->irq / 32 - 1) * 4; 131 imx_gpc_hwirq_mask(d->hwirq);
119 val = readl_relaxed(reg);
120 val |= 1 << (d->irq % 32);
121 writel_relaxed(val, reg);
122} 132}
123 133
124void __init imx_gpc_init(void) 134void __init imx_gpc_init(void)
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
index cf8032bae277..25defbdb06c4 100644
--- a/arch/arm/mach-imx/imx25-dt.c
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -17,13 +17,6 @@
17#include "common.h" 17#include "common.h"
18#include "mx25.h" 18#include "mx25.h"
19 19
20static void __init imx25_dt_init(void)
21{
22 mxc_arch_reset_init_dt();
23
24 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
25}
26
27static const char * const imx25_dt_board_compat[] __initconst = { 20static const char * const imx25_dt_board_compat[] __initconst = {
28 "fsl,imx25", 21 "fsl,imx25",
29 NULL 22 NULL
@@ -33,7 +26,5 @@ DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
33 .map_io = mx25_map_io, 26 .map_io = mx25_map_io,
34 .init_early = imx25_init_early, 27 .init_early = imx25_init_early,
35 .init_irq = mx25_init_irq, 28 .init_irq = mx25_init_irq,
36 .init_machine = imx25_dt_init,
37 .dt_compat = imx25_dt_board_compat, 29 .dt_compat = imx25_dt_board_compat,
38 .restart = mxc_restart,
39MACHINE_END 30MACHINE_END
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index dc8f1a6f45f2..bd42d1bd10af 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -22,8 +22,6 @@ static void __init imx27_dt_init(void)
22{ 22{
23 struct platform_device_info devinfo = { .name = "cpufreq-dt", }; 23 struct platform_device_info devinfo = { .name = "cpufreq-dt", };
24 24
25 mxc_arch_reset_init_dt();
26
27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
28 26
29 platform_device_register_full(&devinfo); 27 platform_device_register_full(&devinfo);
@@ -40,5 +38,4 @@ DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)")
40 .init_irq = mx27_init_irq, 38 .init_irq = mx27_init_irq,
41 .init_machine = imx27_dt_init, 39 .init_machine = imx27_dt_init,
42 .dt_compat = imx27_dt_board_compat, 40 .dt_compat = imx27_dt_board_compat,
43 .restart = mxc_restart,
44MACHINE_END 41MACHINE_END
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
index 418dbc82adc4..32100222a017 100644
--- a/arch/arm/mach-imx/imx31-dt.c
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -18,13 +18,6 @@
18#include "common.h" 18#include "common.h"
19#include "mx31.h" 19#include "mx31.h"
20 20
21static void __init imx31_dt_init(void)
22{
23 mxc_arch_reset_init_dt();
24
25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
26}
27
28static const char * const imx31_dt_board_compat[] __initconst = { 21static const char * const imx31_dt_board_compat[] __initconst = {
29 "fsl,imx31", 22 "fsl,imx31",
30 NULL 23 NULL
@@ -40,7 +33,5 @@ DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)")
40 .init_early = imx31_init_early, 33 .init_early = imx31_init_early,
41 .init_irq = mx31_init_irq, 34 .init_irq = mx31_init_irq,
42 .init_time = imx31_dt_timer_init, 35 .init_time = imx31_dt_timer_init,
43 .init_machine = imx31_dt_init,
44 .dt_compat = imx31_dt_board_compat, 36 .dt_compat = imx31_dt_board_compat,
45 .restart = mxc_restart,
46MACHINE_END 37MACHINE_END
diff --git a/arch/arm/mach-imx/imx35-dt.c b/arch/arm/mach-imx/imx35-dt.c
index 584fbe105579..e9396037235d 100644
--- a/arch/arm/mach-imx/imx35-dt.c
+++ b/arch/arm/mach-imx/imx35-dt.c
@@ -20,14 +20,6 @@
20#include "common.h" 20#include "common.h"
21#include "mx35.h" 21#include "mx35.h"
22 22
23static void __init imx35_dt_init(void)
24{
25 mxc_arch_reset_init_dt();
26
27 of_platform_populate(NULL, of_default_bus_match_table,
28 NULL, NULL);
29}
30
31static void __init imx35_irq_init(void) 23static void __init imx35_irq_init(void)
32{ 24{
33 imx_init_l2cache(); 25 imx_init_l2cache();
@@ -43,7 +35,5 @@ DT_MACHINE_START(IMX35_DT, "Freescale i.MX35 (Device Tree Support)")
43 .map_io = mx35_map_io, 35 .map_io = mx35_map_io,
44 .init_early = imx35_init_early, 36 .init_early = imx35_init_early,
45 .init_irq = imx35_irq_init, 37 .init_irq = imx35_irq_init,
46 .init_machine = imx35_dt_init,
47 .dt_compat = imx35_dt_board_compat, 38 .dt_compat = imx35_dt_board_compat,
48 .restart = mxc_restart,
49MACHINE_END 39MACHINE_END
diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
index 1657fe64cd0f..d6a30753ca7c 100644
--- a/arch/arm/mach-imx/iomux-imx31.c
+++ b/arch/arm/mach-imx/iomux-imx31.c
@@ -44,9 +44,11 @@ static unsigned long mxc_pin_alloc_map[NB_PORTS * 32 / BITS_PER_LONG];
44/* 44/*
45 * set the mode for a IOMUX pin. 45 * set the mode for a IOMUX pin.
46 */ 46 */
47int mxc_iomux_mode(unsigned int pin_mode) 47void mxc_iomux_mode(unsigned int pin_mode)
48{ 48{
49 u32 field, l, mode, ret = 0; 49 u32 field;
50 u32 l;
51 u32 mode;
50 void __iomem *reg; 52 void __iomem *reg;
51 53
52 reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK); 54 reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK);
@@ -61,8 +63,6 @@ int mxc_iomux_mode(unsigned int pin_mode)
61 __raw_writel(l, reg); 63 __raw_writel(l, reg);
62 64
63 spin_unlock(&gpio_mux_lock); 65 spin_unlock(&gpio_mux_lock);
64
65 return ret;
66} 66}
67 67
68/* 68/*
diff --git a/arch/arm/mach-imx/iomux-mx3.h b/arch/arm/mach-imx/iomux-mx3.h
index f79f78a1c0ed..0a5adba61e0b 100644
--- a/arch/arm/mach-imx/iomux-mx3.h
+++ b/arch/arm/mach-imx/iomux-mx3.h
@@ -144,7 +144,7 @@ void mxc_iomux_set_gpr(enum iomux_gp_func, bool en);
144 * It is called by the setup functions and should not be called directly anymore. 144 * It is called by the setup functions and should not be called directly anymore.
145 * It is here visible for backward compatibility 145 * It is here visible for backward compatibility
146 */ 146 */
147int mxc_iomux_mode(unsigned int pin_mode); 147void mxc_iomux_mode(unsigned int pin_mode);
148 148
149#define IOMUX_PADNUM_MASK 0x1ff 149#define IOMUX_PADNUM_MASK 0x1ff
150#define IOMUX_GPIONUM_SHIFT 9 150#define IOMUX_GPIONUM_SHIFT 9
diff --git a/arch/arm/mach-imx/mach-imx50.c b/arch/arm/mach-imx/mach-imx50.c
index b1e56a94a382..ecf58b9e974b 100644
--- a/arch/arm/mach-imx/mach-imx50.c
+++ b/arch/arm/mach-imx/mach-imx50.c
@@ -16,13 +16,6 @@
16 16
17#include "common.h" 17#include "common.h"
18 18
19static void __init imx50_dt_init(void)
20{
21 mxc_arch_reset_init_dt();
22
23 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
24}
25
26static const char * const imx50_dt_board_compat[] __initconst = { 19static const char * const imx50_dt_board_compat[] __initconst = {
27 "fsl,imx50", 20 "fsl,imx50",
28 NULL 21 NULL
@@ -30,7 +23,5 @@ static const char * const imx50_dt_board_compat[] __initconst = {
30 23
31DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)") 24DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
32 .init_irq = tzic_init_irq, 25 .init_irq = tzic_init_irq,
33 .init_machine = imx50_dt_init,
34 .dt_compat = imx50_dt_board_compat, 26 .dt_compat = imx50_dt_board_compat,
35 .restart = mxc_restart,
36MACHINE_END 27MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx51.c b/arch/arm/mach-imx/mach-imx51.c
index 2c5fcaf8675b..b015129e4045 100644
--- a/arch/arm/mach-imx/mach-imx51.c
+++ b/arch/arm/mach-imx/mach-imx51.c
@@ -53,7 +53,6 @@ static void __init imx51_dt_init(void)
53{ 53{
54 struct platform_device_info devinfo = { .name = "cpufreq-dt", }; 54 struct platform_device_info devinfo = { .name = "cpufreq-dt", };
55 55
56 mxc_arch_reset_init_dt();
57 imx51_ipu_mipi_setup(); 56 imx51_ipu_mipi_setup();
58 imx_src_init(); 57 imx_src_init();
59 58
@@ -78,5 +77,4 @@ DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
78 .init_machine = imx51_dt_init, 77 .init_machine = imx51_dt_init,
79 .init_late = imx51_init_late, 78 .init_late = imx51_init_late,
80 .dt_compat = imx51_dt_board_compat, 79 .dt_compat = imx51_dt_board_compat,
81 .restart = mxc_restart,
82MACHINE_END 80MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 03dd6ea13acc..86316a979297 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -30,7 +30,6 @@ static void __init imx53_init_early(void)
30 30
31static void __init imx53_dt_init(void) 31static void __init imx53_dt_init(void)
32{ 32{
33 mxc_arch_reset_init_dt();
34 imx_src_init(); 33 imx_src_init();
35 34
36 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 35 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
@@ -41,6 +40,8 @@ static void __init imx53_dt_init(void)
41static void __init imx53_init_late(void) 40static void __init imx53_init_late(void)
42{ 41{
43 imx53_pm_init(); 42 imx53_pm_init();
43
44 platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
44} 45}
45 46
46static const char * const imx53_dt_board_compat[] __initconst = { 47static const char * const imx53_dt_board_compat[] __initconst = {
@@ -54,5 +55,4 @@ DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
54 .init_machine = imx53_dt_init, 55 .init_machine = imx53_dt_init,
55 .init_late = imx53_init_late, 56 .init_late = imx53_init_late,
56 .dt_compat = imx53_dt_board_compat, 57 .dt_compat = imx53_dt_board_compat,
57 .restart = mxc_restart,
58MACHINE_END 58MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index d51c6e99a2e9..5057d61298b7 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -268,8 +268,6 @@ static void __init imx6q_init_machine(void)
268 imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q", 268 imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
269 imx_get_soc_revision()); 269 imx_get_soc_revision());
270 270
271 mxc_arch_reset_init_dt();
272
273 parent = imx_soc_device_init(); 271 parent = imx_soc_device_init();
274 if (parent == NULL) 272 if (parent == NULL)
275 pr_warn("failed to initialize soc device\n"); 273 pr_warn("failed to initialize soc device\n");
@@ -409,5 +407,4 @@ DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)")
409 .init_machine = imx6q_init_machine, 407 .init_machine = imx6q_init_machine,
410 .init_late = imx6q_init_late, 408 .init_late = imx6q_init_late,
411 .dt_compat = imx6q_dt_compat, 409 .dt_compat = imx6q_dt_compat,
412 .restart = mxc_restart,
413MACHINE_END 410MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index ed263a21d928..24bfaaf944c8 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -48,8 +48,6 @@ static void __init imx6sl_init_machine(void)
48{ 48{
49 struct device *parent; 49 struct device *parent;
50 50
51 mxc_arch_reset_init_dt();
52
53 parent = imx_soc_device_init(); 51 parent = imx_soc_device_init();
54 if (parent == NULL) 52 if (parent == NULL)
55 pr_warn("failed to initialize soc device\n"); 53 pr_warn("failed to initialize soc device\n");
@@ -76,10 +74,8 @@ static const char * const imx6sl_dt_compat[] __initconst = {
76}; 74};
77 75
78DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)") 76DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
79 .map_io = debug_ll_io_init,
80 .init_irq = imx6sl_init_irq, 77 .init_irq = imx6sl_init_irq,
81 .init_machine = imx6sl_init_machine, 78 .init_machine = imx6sl_init_machine,
82 .init_late = imx6sl_init_late, 79 .init_late = imx6sl_init_late,
83 .dt_compat = imx6sl_dt_compat, 80 .dt_compat = imx6sl_dt_compat,
84 .restart = mxc_restart,
85MACHINE_END 81MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 3de3b7369aef..7a96c6577234 100644
--- a/arch/arm/mach-imx/mach-imx6sx.c
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -8,24 +8,73 @@
8 8
9#include <linux/irqchip.h> 9#include <linux/irqchip.h>
10#include <linux/of_platform.h> 10#include <linux/of_platform.h>
11#include <linux/phy.h>
12#include <linux/regmap.h>
13#include <linux/mfd/syscon.h>
14#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
11#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
12#include <asm/mach/map.h> 16#include <asm/mach/map.h>
13 17
14#include "common.h" 18#include "common.h"
15#include "cpuidle.h" 19#include "cpuidle.h"
16 20
21static int ar8031_phy_fixup(struct phy_device *dev)
22{
23 u16 val;
24
25 /* Set RGMII IO voltage to 1.8V */
26 phy_write(dev, 0x1d, 0x1f);
27 phy_write(dev, 0x1e, 0x8);
28
29 /* introduce tx clock delay */
30 phy_write(dev, 0x1d, 0x5);
31 val = phy_read(dev, 0x1e);
32 val |= 0x0100;
33 phy_write(dev, 0x1e, val);
34
35 return 0;
36}
37
38#define PHY_ID_AR8031 0x004dd074
39static void __init imx6sx_enet_phy_init(void)
40{
41 if (IS_BUILTIN(CONFIG_PHYLIB))
42 phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff,
43 ar8031_phy_fixup);
44}
45
46static void __init imx6sx_enet_clk_sel(void)
47{
48 struct regmap *gpr;
49
50 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6sx-iomuxc-gpr");
51 if (!IS_ERR(gpr)) {
52 regmap_update_bits(gpr, IOMUXC_GPR1,
53 IMX6SX_GPR1_FEC_CLOCK_MUX_SEL_MASK, 0);
54 regmap_update_bits(gpr, IOMUXC_GPR1,
55 IMX6SX_GPR1_FEC_CLOCK_PAD_DIR_MASK, 0);
56 } else {
57 pr_err("failed to find fsl,imx6sx-iomux-gpr regmap\n");
58 }
59}
60
61static inline void imx6sx_enet_init(void)
62{
63 imx6sx_enet_phy_init();
64 imx6sx_enet_clk_sel();
65}
66
17static void __init imx6sx_init_machine(void) 67static void __init imx6sx_init_machine(void)
18{ 68{
19 struct device *parent; 69 struct device *parent;
20 70
21 mxc_arch_reset_init_dt();
22
23 parent = imx_soc_device_init(); 71 parent = imx_soc_device_init();
24 if (parent == NULL) 72 if (parent == NULL)
25 pr_warn("failed to initialize soc device\n"); 73 pr_warn("failed to initialize soc device\n");
26 74
27 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 75 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
28 76
77 imx6sx_enet_init();
29 imx_anatop_init(); 78 imx_anatop_init();
30 imx6sx_pm_init(); 79 imx6sx_pm_init();
31} 80}
@@ -53,10 +102,8 @@ static const char * const imx6sx_dt_compat[] __initconst = {
53}; 102};
54 103
55DT_MACHINE_START(IMX6SX, "Freescale i.MX6 SoloX (Device Tree)") 104DT_MACHINE_START(IMX6SX, "Freescale i.MX6 SoloX (Device Tree)")
56 .map_io = debug_ll_io_init,
57 .init_irq = imx6sx_init_irq, 105 .init_irq = imx6sx_init_irq,
58 .init_machine = imx6sx_init_machine, 106 .init_machine = imx6sx_init_machine,
59 .dt_compat = imx6sx_dt_compat, 107 .dt_compat = imx6sx_dt_compat,
60 .init_late = imx6sx_init_late, 108 .init_late = imx6sx_init_late,
61 .restart = mxc_restart,
62MACHINE_END 109MACHINE_END
diff --git a/arch/arm/mach-imx/mach-ls1021a.c b/arch/arm/mach-imx/mach-ls1021a.c
new file mode 100644
index 000000000000..b89c858ebfd6
--- /dev/null
+++ b/arch/arm/mach-imx/mach-ls1021a.c
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2013-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 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 <asm/mach/arch.h>
11
12#include "common.h"
13
14static const char * const ls1021a_dt_compat[] __initconst = {
15 "fsl,ls1021a",
16 NULL,
17};
18
19DT_MACHINE_START(LS1021A, "Freescale LS1021A")
20 .smp = smp_ops(ls1021a_smp_ops),
21 .dt_compat = ls1021a_dt_compat,
22MACHINE_END
diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c
index ee7e57b752a7..c11ab6a1dc87 100644
--- a/arch/arm/mach-imx/mach-vf610.c
+++ b/arch/arm/mach-imx/mach-vf610.c
@@ -12,14 +12,6 @@
12#include <asm/mach/arch.h> 12#include <asm/mach/arch.h>
13#include <asm/hardware/cache-l2x0.h> 13#include <asm/hardware/cache-l2x0.h>
14 14
15#include "common.h"
16
17static void __init vf610_init_machine(void)
18{
19 mxc_arch_reset_init_dt();
20 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
21}
22
23static const char * const vf610_dt_compat[] __initconst = { 15static const char * const vf610_dt_compat[] __initconst = {
24 "fsl,vf610", 16 "fsl,vf610",
25 NULL, 17 NULL,
@@ -28,7 +20,5 @@ static const char * const vf610_dt_compat[] __initconst = {
28DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)") 20DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)")
29 .l2c_aux_val = 0, 21 .l2c_aux_val = 0,
30 .l2c_aux_mask = ~0, 22 .l2c_aux_mask = ~0,
31 .init_machine = vf610_init_machine,
32 .dt_compat = vf610_dt_compat, 23 .dt_compat = vf610_dt_compat,
33 .restart = mxc_restart,
34MACHINE_END 24MACHINE_END
diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
index 7a9686ad994c..3729d90cfa46 100644
--- a/arch/arm/mach-imx/mmdc.c
+++ b/arch/arm/mach-imx/mmdc.c
@@ -21,6 +21,12 @@
21#define BP_MMDC_MAPSR_PSD 0 21#define BP_MMDC_MAPSR_PSD 0
22#define BP_MMDC_MAPSR_PSS 4 22#define BP_MMDC_MAPSR_PSS 4
23 23
24#define MMDC_MDMISC 0x18
25#define BM_MMDC_MDMISC_DDR_TYPE 0x18
26#define BP_MMDC_MDMISC_DDR_TYPE 0x3
27
28static int ddr_type;
29
24static int imx_mmdc_probe(struct platform_device *pdev) 30static int imx_mmdc_probe(struct platform_device *pdev)
25{ 31{
26 struct device_node *np = pdev->dev.of_node; 32 struct device_node *np = pdev->dev.of_node;
@@ -31,6 +37,12 @@ static int imx_mmdc_probe(struct platform_device *pdev)
31 mmdc_base = of_iomap(np, 0); 37 mmdc_base = of_iomap(np, 0);
32 WARN_ON(!mmdc_base); 38 WARN_ON(!mmdc_base);
33 39
40 reg = mmdc_base + MMDC_MDMISC;
41 /* Get ddr type */
42 val = readl_relaxed(reg);
43 ddr_type = (val & BM_MMDC_MDMISC_DDR_TYPE) >>
44 BP_MMDC_MDMISC_DDR_TYPE;
45
34 reg = mmdc_base + MMDC_MAPSR; 46 reg = mmdc_base + MMDC_MAPSR;
35 47
36 /* Enable automatic power saving */ 48 /* Enable automatic power saving */
@@ -51,6 +63,11 @@ static int imx_mmdc_probe(struct platform_device *pdev)
51 return 0; 63 return 0;
52} 64}
53 65
66int imx_mmdc_get_ddr_type(void)
67{
68 return ddr_type;
69}
70
54static struct of_device_id imx_mmdc_dt_ids[] = { 71static struct of_device_id imx_mmdc_dt_ids[] = {
55 { .compatible = "fsl,imx6q-mmdc", }, 72 { .compatible = "fsl,imx6q-mmdc", },
56 { /* sentinel */ } 73 { /* sentinel */ }
diff --git a/arch/arm/mach-imx/mxc.h b/arch/arm/mach-imx/mxc.h
index 17a41ca65acf..4c1343df2ba4 100644
--- a/arch/arm/mach-imx/mxc.h
+++ b/arch/arm/mach-imx/mxc.h
@@ -55,6 +55,8 @@
55#define IMX_CHIP_REVISION_3_3 0x33 55#define IMX_CHIP_REVISION_3_3 0x33
56#define IMX_CHIP_REVISION_UNKNOWN 0xff 56#define IMX_CHIP_REVISION_UNKNOWN 0xff
57 57
58#define IMX_DDR_TYPE_LPDDR2 1
59
58#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
59extern unsigned int __mxc_cpu_type; 61extern unsigned int __mxc_cpu_type;
60#endif 62#endif
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 771bd25c1025..7f270015fe58 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -11,7 +11,10 @@
11 */ 11 */
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/of_address.h>
15#include <linux/of.h>
14#include <linux/smp.h> 16#include <linux/smp.h>
17
15#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
16#include <asm/page.h> 19#include <asm/page.h>
17#include <asm/smp_scu.h> 20#include <asm/smp_scu.h>
@@ -94,3 +97,33 @@ struct smp_operations imx_smp_ops __initdata = {
94 .cpu_kill = imx_cpu_kill, 97 .cpu_kill = imx_cpu_kill,
95#endif 98#endif
96}; 99};
100
101#define DCFG_CCSR_SCRATCHRW1 0x200
102
103static int ls1021a_boot_secondary(unsigned int cpu, struct task_struct *idle)
104{
105 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
106
107 return 0;
108}
109
110static void __init ls1021a_smp_prepare_cpus(unsigned int max_cpus)
111{
112 struct device_node *np;
113 void __iomem *dcfg_base;
114 unsigned long paddr;
115
116 np = of_find_compatible_node(NULL, NULL, "fsl,ls1021a-dcfg");
117 dcfg_base = of_iomap(np, 0);
118 BUG_ON(!dcfg_base);
119
120 paddr = virt_to_phys(secondary_startup);
121 writel_relaxed(cpu_to_be32(paddr), dcfg_base + DCFG_CCSR_SCRATCHRW1);
122
123 iounmap(dcfg_base);
124}
125
126struct smp_operations ls1021a_smp_ops __initdata = {
127 .smp_prepare_cpus = ls1021a_smp_prepare_cpus,
128 .smp_boot_secondary = ls1021a_boot_secondary,
129};
diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
index 5c3af8f993d0..5d2c1bd5f5ef 100644
--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -88,7 +88,7 @@ struct imx6_pm_base {
88}; 88};
89 89
90struct imx6_pm_socdata { 90struct imx6_pm_socdata {
91 u32 cpu_type; 91 u32 ddr_type;
92 const char *mmdc_compat; 92 const char *mmdc_compat;
93 const char *src_compat; 93 const char *src_compat;
94 const char *iomuxc_compat; 94 const char *iomuxc_compat;
@@ -138,7 +138,6 @@ static const u32 imx6sx_mmdc_io_offset[] __initconst = {
138}; 138};
139 139
140static const struct imx6_pm_socdata imx6q_pm_data __initconst = { 140static const struct imx6_pm_socdata imx6q_pm_data __initconst = {
141 .cpu_type = MXC_CPU_IMX6Q,
142 .mmdc_compat = "fsl,imx6q-mmdc", 141 .mmdc_compat = "fsl,imx6q-mmdc",
143 .src_compat = "fsl,imx6q-src", 142 .src_compat = "fsl,imx6q-src",
144 .iomuxc_compat = "fsl,imx6q-iomuxc", 143 .iomuxc_compat = "fsl,imx6q-iomuxc",
@@ -148,7 +147,6 @@ static const struct imx6_pm_socdata imx6q_pm_data __initconst = {
148}; 147};
149 148
150static const struct imx6_pm_socdata imx6dl_pm_data __initconst = { 149static const struct imx6_pm_socdata imx6dl_pm_data __initconst = {
151 .cpu_type = MXC_CPU_IMX6DL,
152 .mmdc_compat = "fsl,imx6q-mmdc", 150 .mmdc_compat = "fsl,imx6q-mmdc",
153 .src_compat = "fsl,imx6q-src", 151 .src_compat = "fsl,imx6q-src",
154 .iomuxc_compat = "fsl,imx6dl-iomuxc", 152 .iomuxc_compat = "fsl,imx6dl-iomuxc",
@@ -158,7 +156,6 @@ static const struct imx6_pm_socdata imx6dl_pm_data __initconst = {
158}; 156};
159 157
160static const struct imx6_pm_socdata imx6sl_pm_data __initconst = { 158static const struct imx6_pm_socdata imx6sl_pm_data __initconst = {
161 .cpu_type = MXC_CPU_IMX6SL,
162 .mmdc_compat = "fsl,imx6sl-mmdc", 159 .mmdc_compat = "fsl,imx6sl-mmdc",
163 .src_compat = "fsl,imx6sl-src", 160 .src_compat = "fsl,imx6sl-src",
164 .iomuxc_compat = "fsl,imx6sl-iomuxc", 161 .iomuxc_compat = "fsl,imx6sl-iomuxc",
@@ -168,7 +165,6 @@ static const struct imx6_pm_socdata imx6sl_pm_data __initconst = {
168}; 165};
169 166
170static const struct imx6_pm_socdata imx6sx_pm_data __initconst = { 167static const struct imx6_pm_socdata imx6sx_pm_data __initconst = {
171 .cpu_type = MXC_CPU_IMX6SX,
172 .mmdc_compat = "fsl,imx6sx-mmdc", 168 .mmdc_compat = "fsl,imx6sx-mmdc",
173 .src_compat = "fsl,imx6sx-src", 169 .src_compat = "fsl,imx6sx-src",
174 .iomuxc_compat = "fsl,imx6sx-iomuxc", 170 .iomuxc_compat = "fsl,imx6sx-iomuxc",
@@ -187,7 +183,7 @@ static const struct imx6_pm_socdata imx6sx_pm_data __initconst = {
187struct imx6_cpu_pm_info { 183struct imx6_cpu_pm_info {
188 phys_addr_t pbase; /* The physical address of pm_info. */ 184 phys_addr_t pbase; /* The physical address of pm_info. */
189 phys_addr_t resume_addr; /* The physical resume address for asm code */ 185 phys_addr_t resume_addr; /* The physical resume address for asm code */
190 u32 cpu_type; 186 u32 ddr_type;
191 u32 pm_info_size; /* Size of pm_info. */ 187 u32 pm_info_size; /* Size of pm_info. */
192 struct imx6_pm_base mmdc_base; 188 struct imx6_pm_base mmdc_base;
193 struct imx6_pm_base src_base; 189 struct imx6_pm_base src_base;
@@ -261,7 +257,6 @@ static void imx6q_enable_wb(bool enable)
261 257
262int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) 258int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
263{ 259{
264 struct irq_data *iomuxc_irq_data = irq_get_irq_data(32);
265 u32 val = readl_relaxed(ccm_base + CLPCR); 260 u32 val = readl_relaxed(ccm_base + CLPCR);
266 261
267 val &= ~BM_CLPCR_LPM; 262 val &= ~BM_CLPCR_LPM;
@@ -316,9 +311,9 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
316 * 3) Software should mask IRQ #32 right after CCM Low-Power mode 311 * 3) Software should mask IRQ #32 right after CCM Low-Power mode
317 * is set (set bits 0-1 of CCM_CLPCR). 312 * is set (set bits 0-1 of CCM_CLPCR).
318 */ 313 */
319 imx_gpc_irq_unmask(iomuxc_irq_data); 314 imx_gpc_hwirq_unmask(32);
320 writel_relaxed(val, ccm_base + CLPCR); 315 writel_relaxed(val, ccm_base + CLPCR);
321 imx_gpc_irq_mask(iomuxc_irq_data); 316 imx_gpc_hwirq_mask(32);
322 317
323 return 0; 318 return 0;
324} 319}
@@ -522,7 +517,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
522 goto pl310_cache_map_failed; 517 goto pl310_cache_map_failed;
523 } 518 }
524 519
525 pm_info->cpu_type = socdata->cpu_type; 520 pm_info->ddr_type = imx_mmdc_get_ddr_type();
526 pm_info->mmdc_io_num = socdata->mmdc_io_num; 521 pm_info->mmdc_io_num = socdata->mmdc_io_num;
527 mmdc_offset_array = socdata->mmdc_io_offset; 522 mmdc_offset_array = socdata->mmdc_io_offset;
528 523
diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
index ca4ea2daf25b..b99987b023fa 100644
--- a/arch/arm/mach-imx/suspend-imx6.S
+++ b/arch/arm/mach-imx/suspend-imx6.S
@@ -45,7 +45,7 @@
45 */ 45 */
46#define PM_INFO_PBASE_OFFSET 0x0 46#define PM_INFO_PBASE_OFFSET 0x0
47#define PM_INFO_RESUME_ADDR_OFFSET 0x4 47#define PM_INFO_RESUME_ADDR_OFFSET 0x4
48#define PM_INFO_CPU_TYPE_OFFSET 0x8 48#define PM_INFO_DDR_TYPE_OFFSET 0x8
49#define PM_INFO_PM_INFO_SIZE_OFFSET 0xC 49#define PM_INFO_PM_INFO_SIZE_OFFSET 0xC
50#define PM_INFO_MX6Q_MMDC_P_OFFSET 0x10 50#define PM_INFO_MX6Q_MMDC_P_OFFSET 0x10
51#define PM_INFO_MX6Q_MMDC_V_OFFSET 0x14 51#define PM_INFO_MX6Q_MMDC_V_OFFSET 0x14
@@ -110,7 +110,7 @@
110 ldreq r11, [r0, #PM_INFO_MX6Q_MMDC_V_OFFSET] 110 ldreq r11, [r0, #PM_INFO_MX6Q_MMDC_V_OFFSET]
111 ldrne r11, [r0, #PM_INFO_MX6Q_MMDC_P_OFFSET] 111 ldrne r11, [r0, #PM_INFO_MX6Q_MMDC_P_OFFSET]
112 112
113 cmp r3, #MXC_CPU_IMX6SL 113 cmp r3, #IMX_DDR_TYPE_LPDDR2
114 bne 4f 114 bne 4f
115 115
116 /* reset read FIFO, RST_RD_FIFO */ 116 /* reset read FIFO, RST_RD_FIFO */
@@ -151,7 +151,7 @@
151ENTRY(imx6_suspend) 151ENTRY(imx6_suspend)
152 ldr r1, [r0, #PM_INFO_PBASE_OFFSET] 152 ldr r1, [r0, #PM_INFO_PBASE_OFFSET]
153 ldr r2, [r0, #PM_INFO_RESUME_ADDR_OFFSET] 153 ldr r2, [r0, #PM_INFO_RESUME_ADDR_OFFSET]
154 ldr r3, [r0, #PM_INFO_CPU_TYPE_OFFSET] 154 ldr r3, [r0, #PM_INFO_DDR_TYPE_OFFSET]
155 ldr r4, [r0, #PM_INFO_PM_INFO_SIZE_OFFSET] 155 ldr r4, [r0, #PM_INFO_PM_INFO_SIZE_OFFSET]
156 156
157 /* 157 /*
@@ -209,8 +209,8 @@ poll_dvfs_set:
209 ldr r7, [r0, #PM_INFO_MMDC_IO_NUM_OFFSET] 209 ldr r7, [r0, #PM_INFO_MMDC_IO_NUM_OFFSET]
210 ldr r8, =PM_INFO_MMDC_IO_VAL_OFFSET 210 ldr r8, =PM_INFO_MMDC_IO_VAL_OFFSET
211 add r8, r8, r0 211 add r8, r8, r0
212 /* i.MX6SL's last 3 IOs need special setting */ 212 /* LPDDR2's last 3 IOs need special setting */
213 cmp r3, #MXC_CPU_IMX6SL 213 cmp r3, #IMX_DDR_TYPE_LPDDR2
214 subeq r7, r7, #0x3 214 subeq r7, r7, #0x3
215set_mmdc_io_lpm: 215set_mmdc_io_lpm:
216 ldr r9, [r8], #0x8 216 ldr r9, [r8], #0x8
@@ -218,7 +218,7 @@ set_mmdc_io_lpm:
218 subs r7, r7, #0x1 218 subs r7, r7, #0x1
219 bne set_mmdc_io_lpm 219 bne set_mmdc_io_lpm
220 220
221 cmp r3, #MXC_CPU_IMX6SL 221 cmp r3, #IMX_DDR_TYPE_LPDDR2
222 bne set_mmdc_io_lpm_done 222 bne set_mmdc_io_lpm_done
223 ldr r6, =0x1000 223 ldr r6, =0x1000
224 ldr r9, [r8], #0x8 224 ldr r9, [r8], #0x8
@@ -324,7 +324,7 @@ resume:
324 str r7, [r11, #MX6Q_SRC_GPR1] 324 str r7, [r11, #MX6Q_SRC_GPR1]
325 str r7, [r11, #MX6Q_SRC_GPR2] 325 str r7, [r11, #MX6Q_SRC_GPR2]
326 326
327 ldr r3, [r0, #PM_INFO_CPU_TYPE_OFFSET] 327 ldr r3, [r0, #PM_INFO_DDR_TYPE_OFFSET]
328 mov r5, #0x1 328 mov r5, #0x1
329 resume_mmdc 329 resume_mmdc
330 330
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index d14c33fd6b03..51c35013b673 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -89,21 +89,6 @@ void __init mxc_arch_reset_init(void __iomem *base)
89 clk_prepare(wdog_clk); 89 clk_prepare(wdog_clk);
90} 90}
91 91
92void __init mxc_arch_reset_init_dt(void)
93{
94 struct device_node *np;
95
96 np = of_find_compatible_node(NULL, NULL, "fsl,imx21-wdt");
97 wdog_base = of_iomap(np, 0);
98 WARN_ON(!wdog_base);
99
100 wdog_clk = of_clk_get(np, 0);
101 if (IS_ERR(wdog_clk))
102 pr_warn("%s: failed to get wdog clock\n", __func__);
103 else
104 clk_prepare(wdog_clk);
105}
106
107#ifdef CONFIG_CACHE_L2X0 92#ifdef CONFIG_CACHE_L2X0
108void __init imx_init_l2cache(void) 93void __init imx_init_l2cache(void)
109{ 94{
diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index c455e974bbfe..02d083489a26 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -1,3 +1,26 @@
1config ARCH_INTEGRATOR
2 bool "ARM Ltd. Integrator family" if (ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6)
3 select ARM_AMBA
4 select ARM_PATCH_PHYS_VIRT if MMU
5 select AUTO_ZRELADDR
6 select COMMON_CLK
7 select COMMON_CLK_VERSATILE
8 select GENERIC_CLOCKEVENTS
9 select HAVE_TCM
10 select ICST
11 select MFD_SYSCON
12 select MULTI_IRQ_HANDLER
13 select PLAT_VERSATILE
14 select POWER_RESET
15 select POWER_RESET_VERSATILE
16 select POWER_SUPPLY
17 select SOC_INTEGRATOR_CM
18 select SPARSE_IRQ
19 select USE_OF
20 select VERSATILE_FPGA_IRQ
21 help
22 Support for ARM's Integrator platform.
23
1if ARCH_INTEGRATOR 24if ARCH_INTEGRATOR
2 25
3menu "Integrator Options" 26menu "Integrator Options"
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile
index ec759ded7b60..1ebe45356b09 100644
--- a/arch/arm/mach-integrator/Makefile
+++ b/arch/arm/mach-integrator/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := core.o lm.o leds.o 7obj-y := core.o lm.o
8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o 8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o
9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o 9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
10 10
diff --git a/arch/arm/mach-integrator/cm.h b/arch/arm/mach-integrator/cm.h
index 4ecff7bff482..5b8ba8247f45 100644
--- a/arch/arm/mach-integrator/cm.h
+++ b/arch/arm/mach-integrator/cm.h
@@ -11,7 +11,6 @@ void cm_clear_irqs(void);
11#define CM_CTRL_LED (1 << 0) 11#define CM_CTRL_LED (1 << 0)
12#define CM_CTRL_nMBDET (1 << 1) 12#define CM_CTRL_nMBDET (1 << 1)
13#define CM_CTRL_REMAP (1 << 2) 13#define CM_CTRL_REMAP (1 << 2)
14#define CM_CTRL_RESET (1 << 3)
15 14
16/* 15/*
17 * Integrator/AP,PP2 specific 16 * Integrator/AP,PP2 specific
diff --git a/arch/arm/mach-integrator/common.h b/arch/arm/mach-integrator/common.h
index ad0ac5547b2c..96c9dc56cabf 100644
--- a/arch/arm/mach-integrator/common.h
+++ b/arch/arm/mach-integrator/common.h
@@ -4,5 +4,3 @@ extern struct amba_pl010_data ap_uart_data;
4void integrator_init_early(void); 4void integrator_init_early(void);
5int integrator_init(bool is_cp); 5int integrator_init(bool is_cp);
6void integrator_reserve(void); 6void integrator_reserve(void);
7void integrator_restart(enum reboot_mode, const char *);
8void integrator_init_sysfs(struct device *parent, u32 id);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index e3f3aca43efb..948872a419c1 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -60,40 +60,6 @@ void cm_control(u32 mask, u32 set)
60 raw_spin_unlock_irqrestore(&cm_lock, flags); 60 raw_spin_unlock_irqrestore(&cm_lock, flags);
61} 61}
62 62
63static const char *integrator_arch_str(u32 id)
64{
65 switch ((id >> 16) & 0xff) {
66 case 0x00:
67 return "ASB little-endian";
68 case 0x01:
69 return "AHB little-endian";
70 case 0x03:
71 return "AHB-Lite system bus, bi-endian";
72 case 0x04:
73 return "AHB";
74 case 0x08:
75 return "AHB system bus, ASB processor bus";
76 default:
77 return "Unknown";
78 }
79}
80
81static const char *integrator_fpga_str(u32 id)
82{
83 switch ((id >> 12) & 0xf) {
84 case 0x01:
85 return "XC4062";
86 case 0x02:
87 return "XC4085";
88 case 0x03:
89 return "XVC600";
90 case 0x04:
91 return "EPM7256AE (Altera PLD)";
92 default:
93 return "Unknown";
94 }
95}
96
97void cm_clear_irqs(void) 63void cm_clear_irqs(void)
98{ 64{
99 /* disable core module IRQs */ 65 /* disable core module IRQs */
@@ -109,7 +75,6 @@ static const struct of_device_id cm_match[] = {
109void cm_init(void) 75void cm_init(void)
110{ 76{
111 struct device_node *cm = of_find_matching_node(NULL, cm_match); 77 struct device_node *cm = of_find_matching_node(NULL, cm_match);
112 u32 val;
113 78
114 if (!cm) { 79 if (!cm) {
115 pr_crit("no core module node found in device tree\n"); 80 pr_crit("no core module node found in device tree\n");
@@ -121,13 +86,6 @@ void cm_init(void)
121 return; 86 return;
122 } 87 }
123 cm_clear_irqs(); 88 cm_clear_irqs();
124 val = readl(cm_base + INTEGRATOR_HDR_ID_OFFSET);
125 pr_info("Detected ARM core module:\n");
126 pr_info(" Manufacturer: %02x\n", (val >> 24));
127 pr_info(" Architecture: %s\n", integrator_arch_str(val));
128 pr_info(" FPGA: %s\n", integrator_fpga_str(val));
129 pr_info(" Build: %02x\n", (val >> 4) & 0xFF);
130 pr_info(" Rev: %c\n", ('A' + (val & 0x03)));
131} 89}
132 90
133/* 91/*
@@ -139,64 +97,3 @@ void __init integrator_reserve(void)
139{ 97{
140 memblock_reserve(PHYS_OFFSET, __pa(swapper_pg_dir) - PHYS_OFFSET); 98 memblock_reserve(PHYS_OFFSET, __pa(swapper_pg_dir) - PHYS_OFFSET);
141} 99}
142
143/*
144 * To reset, we hit the on-board reset register in the system FPGA
145 */
146void integrator_restart(enum reboot_mode mode, const char *cmd)
147{
148 cm_control(CM_CTRL_RESET, CM_CTRL_RESET);
149}
150
151static u32 integrator_id;
152
153static ssize_t intcp_get_manf(struct device *dev,
154 struct device_attribute *attr,
155 char *buf)
156{
157 return sprintf(buf, "%02x\n", integrator_id >> 24);
158}
159
160static struct device_attribute intcp_manf_attr =
161 __ATTR(manufacturer, S_IRUGO, intcp_get_manf, NULL);
162
163static ssize_t intcp_get_arch(struct device *dev,
164 struct device_attribute *attr,
165 char *buf)
166{
167 return sprintf(buf, "%s\n", integrator_arch_str(integrator_id));
168}
169
170static struct device_attribute intcp_arch_attr =
171 __ATTR(architecture, S_IRUGO, intcp_get_arch, NULL);
172
173static ssize_t intcp_get_fpga(struct device *dev,
174 struct device_attribute *attr,
175 char *buf)
176{
177 return sprintf(buf, "%s\n", integrator_fpga_str(integrator_id));
178}
179
180static struct device_attribute intcp_fpga_attr =
181 __ATTR(fpga, S_IRUGO, intcp_get_fpga, NULL);
182
183static ssize_t intcp_get_build(struct device *dev,
184 struct device_attribute *attr,
185 char *buf)
186{
187 return sprintf(buf, "%02x\n", (integrator_id >> 4) & 0xFF);
188}
189
190static struct device_attribute intcp_build_attr =
191 __ATTR(build, S_IRUGO, intcp_get_build, NULL);
192
193
194
195void integrator_init_sysfs(struct device *parent, u32 id)
196{
197 integrator_id = id;
198 device_create_file(parent, &intcp_manf_attr);
199 device_create_file(parent, &intcp_arch_attr);
200 device_create_file(parent, &intcp_fpga_attr);
201 device_create_file(parent, &intcp_build_attr);
202}
diff --git a/arch/arm/mach-integrator/include/mach/uncompress.h b/arch/arm/mach-integrator/include/mach/uncompress.h
deleted file mode 100644
index 8f3cc9954c16..000000000000
--- a/arch/arm/mach-integrator/include/mach/uncompress.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * arch/arm/mach-integrator/include/mach/uncompress.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#define AMBA_UART_DR (*(volatile unsigned char *)0x16000000)
22#define AMBA_UART_LCRH (*(volatile unsigned char *)0x16000008)
23#define AMBA_UART_LCRM (*(volatile unsigned char *)0x1600000c)
24#define AMBA_UART_LCRL (*(volatile unsigned char *)0x16000010)
25#define AMBA_UART_CR (*(volatile unsigned char *)0x16000014)
26#define AMBA_UART_FR (*(volatile unsigned char *)0x16000018)
27
28/*
29 * This does not append a newline
30 */
31static void putc(int c)
32{
33 while (AMBA_UART_FR & (1 << 5))
34 barrier();
35
36 AMBA_UART_DR = c;
37}
38
39static inline void flush(void)
40{
41 while (AMBA_UART_FR & (1 << 3))
42 barrier();
43}
44
45/*
46 * nothing to do
47 */
48#define arch_decomp_setup()
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 8ca290b479b1..30003ba447a5 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -27,22 +27,15 @@
27#include <linux/syscore_ops.h> 27#include <linux/syscore_ops.h>
28#include <linux/amba/bus.h> 28#include <linux/amba/bus.h>
29#include <linux/amba/kmi.h> 29#include <linux/amba/kmi.h>
30#include <linux/clocksource.h>
31#include <linux/clockchips.h>
32#include <linux/interrupt.h>
33#include <linux/io.h> 30#include <linux/io.h>
34#include <linux/irqchip.h> 31#include <linux/irqchip.h>
35#include <linux/mtd/physmap.h> 32#include <linux/mtd/physmap.h>
36#include <linux/clk.h>
37#include <linux/platform_data/clk-integrator.h> 33#include <linux/platform_data/clk-integrator.h>
38#include <linux/of_irq.h> 34#include <linux/of_irq.h>
39#include <linux/of_address.h> 35#include <linux/of_address.h>
40#include <linux/of_platform.h> 36#include <linux/of_platform.h>
41#include <linux/stat.h> 37#include <linux/stat.h>
42#include <linux/sys_soc.h>
43#include <linux/termios.h> 38#include <linux/termios.h>
44#include <linux/sched_clock.h>
45#include <linux/clk-provider.h>
46 39
47#include <asm/hardware/arm_timer.h> 40#include <asm/hardware/arm_timer.h>
48#include <asm/setup.h> 41#include <asm/setup.h>
@@ -89,11 +82,6 @@ static void __iomem *ebi_base;
89 82
90static struct map_desc ap_io_desc[] __initdata __maybe_unused = { 83static struct map_desc ap_io_desc[] __initdata __maybe_unused = {
91 { 84 {
92 .virtual = IO_ADDRESS(INTEGRATOR_CT_BASE),
93 .pfn = __phys_to_pfn(INTEGRATOR_CT_BASE),
94 .length = SZ_4K,
95 .type = MT_DEVICE
96 }, {
97 .virtual = IO_ADDRESS(INTEGRATOR_IC_BASE), 85 .virtual = IO_ADDRESS(INTEGRATOR_IC_BASE),
98 .pfn = __phys_to_pfn(INTEGRATOR_IC_BASE), 86 .pfn = __phys_to_pfn(INTEGRATOR_IC_BASE),
99 .length = SZ_4K, 87 .length = SZ_4K,
@@ -257,188 +245,10 @@ struct amba_pl010_data ap_uart_data = {
257 .set_mctrl = integrator_uart_set_mctrl, 245 .set_mctrl = integrator_uart_set_mctrl,
258}; 246};
259 247
260/*
261 * Where is the timer (VA)?
262 */
263#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
264#define TIMER1_VA_BASE __io_address(INTEGRATOR_TIMER1_BASE)
265#define TIMER2_VA_BASE __io_address(INTEGRATOR_TIMER2_BASE)
266
267static unsigned long timer_reload;
268
269static u64 notrace integrator_read_sched_clock(void)
270{
271 return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE);
272}
273
274static void integrator_clocksource_init(unsigned long inrate,
275 void __iomem *base)
276{
277 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC;
278 unsigned long rate = inrate;
279
280 if (rate >= 1500000) {
281 rate /= 16;
282 ctrl |= TIMER_CTRL_DIV16;
283 }
284
285 writel(0xffff, base + TIMER_LOAD);
286 writel(ctrl, base + TIMER_CTRL);
287
288 clocksource_mmio_init(base + TIMER_VALUE, "timer2",
289 rate, 200, 16, clocksource_mmio_readl_down);
290 sched_clock_register(integrator_read_sched_clock, 16, rate);
291}
292
293static void __iomem * clkevt_base;
294
295/*
296 * IRQ handler for the timer
297 */
298static irqreturn_t integrator_timer_interrupt(int irq, void *dev_id)
299{
300 struct clock_event_device *evt = dev_id;
301
302 /* clear the interrupt */
303 writel(1, clkevt_base + TIMER_INTCLR);
304
305 evt->event_handler(evt);
306
307 return IRQ_HANDLED;
308}
309
310static void clkevt_set_mode(enum clock_event_mode mode, struct clock_event_device *evt)
311{
312 u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE;
313
314 /* Disable timer */
315 writel(ctrl, clkevt_base + TIMER_CTRL);
316
317 switch (mode) {
318 case CLOCK_EVT_MODE_PERIODIC:
319 /* Enable the timer and start the periodic tick */
320 writel(timer_reload, clkevt_base + TIMER_LOAD);
321 ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
322 writel(ctrl, clkevt_base + TIMER_CTRL);
323 break;
324 case CLOCK_EVT_MODE_ONESHOT:
325 /* Leave the timer disabled, .set_next_event will enable it */
326 ctrl &= ~TIMER_CTRL_PERIODIC;
327 writel(ctrl, clkevt_base + TIMER_CTRL);
328 break;
329 case CLOCK_EVT_MODE_UNUSED:
330 case CLOCK_EVT_MODE_SHUTDOWN:
331 case CLOCK_EVT_MODE_RESUME:
332 default:
333 /* Just leave in disabled state */
334 break;
335 }
336
337}
338
339static int clkevt_set_next_event(unsigned long next, struct clock_event_device *evt)
340{
341 unsigned long ctrl = readl(clkevt_base + TIMER_CTRL);
342
343 writel(ctrl & ~TIMER_CTRL_ENABLE, clkevt_base + TIMER_CTRL);
344 writel(next, clkevt_base + TIMER_LOAD);
345 writel(ctrl | TIMER_CTRL_ENABLE, clkevt_base + TIMER_CTRL);
346
347 return 0;
348}
349
350static struct clock_event_device integrator_clockevent = {
351 .name = "timer1",
352 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
353 .set_mode = clkevt_set_mode,
354 .set_next_event = clkevt_set_next_event,
355 .rating = 300,
356};
357
358static struct irqaction integrator_timer_irq = {
359 .name = "timer",
360 .flags = IRQF_TIMER | IRQF_IRQPOLL,
361 .handler = integrator_timer_interrupt,
362 .dev_id = &integrator_clockevent,
363};
364
365static void integrator_clockevent_init(unsigned long inrate,
366 void __iomem *base, int irq)
367{
368 unsigned long rate = inrate;
369 unsigned int ctrl = 0;
370
371 clkevt_base = base;
372 /* Calculate and program a divisor */
373 if (rate > 0x100000 * HZ) {
374 rate /= 256;
375 ctrl |= TIMER_CTRL_DIV256;
376 } else if (rate > 0x10000 * HZ) {
377 rate /= 16;
378 ctrl |= TIMER_CTRL_DIV16;
379 }
380 timer_reload = rate / HZ;
381 writel(ctrl, clkevt_base + TIMER_CTRL);
382
383 setup_irq(irq, &integrator_timer_irq);
384 clockevents_config_and_register(&integrator_clockevent,
385 rate,
386 1,
387 0xffffU);
388}
389
390void __init ap_init_early(void) 248void __init ap_init_early(void)
391{ 249{
392} 250}
393 251
394static void __init ap_of_timer_init(void)
395{
396 struct device_node *node;
397 const char *path;
398 void __iomem *base;
399 int err;
400 int irq;
401 struct clk *clk;
402 unsigned long rate;
403
404 of_clk_init(NULL);
405
406 err = of_property_read_string(of_aliases,
407 "arm,timer-primary", &path);
408 if (WARN_ON(err))
409 return;
410 node = of_find_node_by_path(path);
411 base = of_iomap(node, 0);
412 if (WARN_ON(!base))
413 return;
414
415 clk = of_clk_get(node, 0);
416 BUG_ON(IS_ERR(clk));
417 clk_prepare_enable(clk);
418 rate = clk_get_rate(clk);
419
420 writel(0, base + TIMER_CTRL);
421 integrator_clocksource_init(rate, base);
422
423 err = of_property_read_string(of_aliases,
424 "arm,timer-secondary", &path);
425 if (WARN_ON(err))
426 return;
427 node = of_find_node_by_path(path);
428 base = of_iomap(node, 0);
429 if (WARN_ON(!base))
430 return;
431 irq = irq_of_parse_and_map(node, 0);
432
433 clk = of_clk_get(node, 0);
434 BUG_ON(IS_ERR(clk));
435 clk_prepare_enable(clk);
436 rate = clk_get_rate(clk);
437
438 writel(0, base + TIMER_CTRL);
439 integrator_clockevent_init(rate, base, irq);
440}
441
442static void __init ap_init_irq_of(void) 252static void __init ap_init_irq_of(void)
443{ 253{
444 cm_init(); 254 cm_init();
@@ -477,10 +287,6 @@ static void __init ap_init_of(void)
477 unsigned long sc_dec; 287 unsigned long sc_dec;
478 struct device_node *syscon; 288 struct device_node *syscon;
479 struct device_node *ebi; 289 struct device_node *ebi;
480 struct device *parent;
481 struct soc_device *soc_dev;
482 struct soc_device_attribute *soc_dev_attr;
483 u32 ap_sc_id;
484 int i; 290 int i;
485 291
486 syscon = of_find_matching_node(NULL, ap_syscon_match); 292 syscon = of_find_matching_node(NULL, ap_syscon_match);
@@ -500,28 +306,6 @@ static void __init ap_init_of(void)
500 of_platform_populate(NULL, of_default_bus_match_table, 306 of_platform_populate(NULL, of_default_bus_match_table,
501 ap_auxdata_lookup, NULL); 307 ap_auxdata_lookup, NULL);
502 308
503 ap_sc_id = readl(ap_syscon_base);
504
505 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
506 if (!soc_dev_attr)
507 return;
508
509 soc_dev_attr->soc_id = "XVC";
510 soc_dev_attr->machine = "Integrator/AP";
511 soc_dev_attr->family = "Integrator";
512 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
513 'A' + (ap_sc_id & 0x0f));
514
515 soc_dev = soc_device_register(soc_dev_attr);
516 if (IS_ERR(soc_dev)) {
517 kfree(soc_dev_attr->revision);
518 kfree(soc_dev_attr);
519 return;
520 }
521
522 parent = soc_device_to_device(soc_dev);
523 integrator_init_sysfs(parent, ap_sc_id);
524
525 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); 309 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
526 for (i = 0; i < 4; i++) { 310 for (i = 0; i < 4; i++) {
527 struct lm_device *lmdev; 311 struct lm_device *lmdev;
@@ -553,8 +337,6 @@ DT_MACHINE_START(INTEGRATOR_AP_DT, "ARM Integrator/AP (Device Tree)")
553 .map_io = ap_map_io, 337 .map_io = ap_map_io,
554 .init_early = ap_init_early, 338 .init_early = ap_init_early,
555 .init_irq = ap_init_irq_of, 339 .init_irq = ap_init_irq_of,
556 .init_time = ap_of_timer_init,
557 .init_machine = ap_init_of, 340 .init_machine = ap_init_of,
558 .restart = integrator_restart,
559 .dt_compat = ap_dt_board_compat, 341 .dt_compat = ap_dt_board_compat,
560MACHINE_END 342MACHINE_END
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index cca02eb75eb5..b5fb71a36ee6 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -27,7 +27,6 @@
27#include <linux/of_irq.h> 27#include <linux/of_irq.h>
28#include <linux/of_address.h> 28#include <linux/of_address.h>
29#include <linux/of_platform.h> 29#include <linux/of_platform.h>
30#include <linux/sys_soc.h>
31#include <linux/sched_clock.h> 30#include <linux/sched_clock.h>
32 31
33#include <asm/setup.h> 32#include <asm/setup.h>
@@ -274,10 +273,6 @@ static const struct of_device_id intcp_syscon_match[] = {
274static void __init intcp_init_of(void) 273static void __init intcp_init_of(void)
275{ 274{
276 struct device_node *cpcon; 275 struct device_node *cpcon;
277 struct device *parent;
278 struct soc_device *soc_dev;
279 struct soc_device_attribute *soc_dev_attr;
280 u32 intcp_sc_id;
281 276
282 cpcon = of_find_matching_node(NULL, intcp_syscon_match); 277 cpcon = of_find_matching_node(NULL, intcp_syscon_match);
283 if (!cpcon) 278 if (!cpcon)
@@ -289,28 +284,6 @@ static void __init intcp_init_of(void)
289 284
290 of_platform_populate(NULL, of_default_bus_match_table, 285 of_platform_populate(NULL, of_default_bus_match_table,
291 intcp_auxdata_lookup, NULL); 286 intcp_auxdata_lookup, NULL);
292
293 intcp_sc_id = readl(intcp_con_base);
294
295 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
296 if (!soc_dev_attr)
297 return;
298
299 soc_dev_attr->soc_id = "XCV";
300 soc_dev_attr->machine = "Integrator/CP";
301 soc_dev_attr->family = "Integrator";
302 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
303 'A' + (intcp_sc_id & 0x0f));
304
305 soc_dev = soc_device_register(soc_dev_attr);
306 if (IS_ERR(soc_dev)) {
307 kfree(soc_dev_attr->revision);
308 kfree(soc_dev_attr);
309 return;
310 }
311
312 parent = soc_device_to_device(soc_dev);
313 integrator_init_sysfs(parent, intcp_sc_id);
314} 287}
315 288
316static const char * intcp_dt_board_compat[] = { 289static const char * intcp_dt_board_compat[] = {
@@ -324,6 +297,5 @@ DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)")
324 .init_early = intcp_init_early, 297 .init_early = intcp_init_early,
325 .init_irq = intcp_init_irq_of, 298 .init_irq = intcp_init_irq_of,
326 .init_machine = intcp_init_of, 299 .init_machine = intcp_init_of,
327 .restart = integrator_restart,
328 .dt_compat = intcp_dt_board_compat, 300 .dt_compat = intcp_dt_board_compat,
329MACHINE_END 301MACHINE_END
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c
deleted file mode 100644
index f1dcb57a59e2..000000000000
--- a/arch/arm/mach-integrator/leds.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * Driver for the 4 user LEDs found on the Integrator AP/CP baseboard
3 * Based on Versatile and RealView machine LED code
4 *
5 * License terms: GNU General Public License (GPL) version 2
6 * Author: Bryan Wu <bryan.wu@canonical.com>
7 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/io.h>
11#include <linux/slab.h>
12#include <linux/leds.h>
13
14#include "hardware.h"
15#include "cm.h"
16
17#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
18
19#define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE)
20#define LEDREG (__io_address(INTEGRATOR_DBG_BASE) + INTEGRATOR_DBG_LEDS_OFFSET)
21
22struct integrator_led {
23 struct led_classdev cdev;
24 u8 mask;
25};
26
27/*
28 * The triggers lines up below will only be used if the
29 * LED triggers are compiled in.
30 */
31static const struct {
32 const char *name;
33 const char *trigger;
34} integrator_leds[] = {
35 { "integrator:green0", "heartbeat", },
36 { "integrator:yellow", },
37 { "integrator:red", },
38 { "integrator:green1", },
39 { "integrator:core_module", "cpu0", },
40};
41
42static void integrator_led_set(struct led_classdev *cdev,
43 enum led_brightness b)
44{
45 struct integrator_led *led = container_of(cdev,
46 struct integrator_led, cdev);
47 u32 reg = __raw_readl(LEDREG);
48
49 if (b != LED_OFF)
50 reg |= led->mask;
51 else
52 reg &= ~led->mask;
53
54 while (__raw_readl(ALPHA_REG) & 1)
55 cpu_relax();
56
57 __raw_writel(reg, LEDREG);
58}
59
60static enum led_brightness integrator_led_get(struct led_classdev *cdev)
61{
62 struct integrator_led *led = container_of(cdev,
63 struct integrator_led, cdev);
64 u32 reg = __raw_readl(LEDREG);
65
66 return (reg & led->mask) ? LED_FULL : LED_OFF;
67}
68
69static void cm_led_set(struct led_classdev *cdev,
70 enum led_brightness b)
71{
72 if (b != LED_OFF)
73 cm_control(CM_CTRL_LED, CM_CTRL_LED);
74 else
75 cm_control(CM_CTRL_LED, 0);
76}
77
78static enum led_brightness cm_led_get(struct led_classdev *cdev)
79{
80 u32 reg = cm_get();
81
82 return (reg & CM_CTRL_LED) ? LED_FULL : LED_OFF;
83}
84
85static int __init integrator_leds_init(void)
86{
87 int i;
88
89 for (i = 0; i < ARRAY_SIZE(integrator_leds); i++) {
90 struct integrator_led *led;
91
92 led = kzalloc(sizeof(*led), GFP_KERNEL);
93 if (!led)
94 break;
95
96
97 led->cdev.name = integrator_leds[i].name;
98
99 if (i == 4) { /* Setting for LED in core module */
100 led->cdev.brightness_set = cm_led_set;
101 led->cdev.brightness_get = cm_led_get;
102 } else {
103 led->cdev.brightness_set = integrator_led_set;
104 led->cdev.brightness_get = integrator_led_get;
105 }
106
107 led->cdev.default_trigger = integrator_leds[i].trigger;
108 led->mask = BIT(i);
109
110 if (led_classdev_register(NULL, &led->cdev) < 0) {
111 kfree(led);
112 break;
113 }
114 }
115
116 return 0;
117}
118
119/*
120 * Since we may have triggers on any subsystem, defer registration
121 * until after subsystem_init.
122 */
123fs_initcall(integrator_leds_init);
124#endif
diff --git a/arch/arm/mach-iop13xx/msi.c b/arch/arm/mach-iop13xx/msi.c
index e7730cf9c15d..9f89e76dfbb9 100644
--- a/arch/arm/mach-iop13xx/msi.c
+++ b/arch/arm/mach-iop13xx/msi.c
@@ -126,10 +126,10 @@ static void iop13xx_msi_nop(struct irq_data *d)
126static struct irq_chip iop13xx_msi_chip = { 126static struct irq_chip iop13xx_msi_chip = {
127 .name = "PCI-MSI", 127 .name = "PCI-MSI",
128 .irq_ack = iop13xx_msi_nop, 128 .irq_ack = iop13xx_msi_nop,
129 .irq_enable = unmask_msi_irq, 129 .irq_enable = pci_msi_unmask_irq,
130 .irq_disable = mask_msi_irq, 130 .irq_disable = pci_msi_mask_irq,
131 .irq_mask = mask_msi_irq, 131 .irq_mask = pci_msi_mask_irq,
132 .irq_unmask = unmask_msi_irq, 132 .irq_unmask = pci_msi_unmask_irq,
133}; 133};
134 134
135int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) 135int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
@@ -153,7 +153,7 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
153 id = iop13xx_cpu_id(); 153 id = iop13xx_cpu_id();
154 msg.data = (id << IOP13XX_MU_MIMR_CORE_SELECT) | (irq & 0x7f); 154 msg.data = (id << IOP13XX_MU_MIMR_CORE_SELECT) | (irq & 0x7f);
155 155
156 write_msi_msg(irq, &msg); 156 pci_write_msi_msg(irq, &msg);
157 irq_set_chip_and_handler(irq, &iop13xx_msi_chip, handle_simple_irq); 157 irq_set_chip_and_handler(irq, &iop13xx_msi_chip, handle_simple_irq);
158 158
159 return 0; 159 return 0;
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index fc4b7b24265e..8537d4c41e34 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -652,7 +652,7 @@ static void __iomem *ixp4xx_ioremap_caller(phys_addr_t addr, size_t size,
652 return (void __iomem *)addr; 652 return (void __iomem *)addr;
653} 653}
654 654
655static void ixp4xx_iounmap(void __iomem *addr) 655static void ixp4xx_iounmap(volatile void __iomem *addr)
656{ 656{
657 if (!is_pci_memory((__force u32)addr)) 657 if (!is_pci_memory((__force u32)addr))
658 __iounmap(addr); 658 __iounmap(addr);
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 7d11979da030..6a722860e34d 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -58,6 +58,10 @@ static inline int is_pci_memory(u32 addr)
58#define writew(v, p) __indirect_writew(v, p) 58#define writew(v, p) __indirect_writew(v, p)
59#define writel(v, p) __indirect_writel(v, p) 59#define writel(v, p) __indirect_writel(v, p)
60 60
61#define writeb_relaxed(v, p) __indirect_writeb(v, p)
62#define writew_relaxed(v, p) __indirect_writew(v, p)
63#define writel_relaxed(v, p) __indirect_writel(v, p)
64
61#define writesb(p, v, l) __indirect_writesb(p, v, l) 65#define writesb(p, v, l) __indirect_writesb(p, v, l)
62#define writesw(p, v, l) __indirect_writesw(p, v, l) 66#define writesw(p, v, l) __indirect_writesw(p, v, l)
63#define writesl(p, v, l) __indirect_writesl(p, v, l) 67#define writesl(p, v, l) __indirect_writesl(p, v, l)
@@ -66,6 +70,10 @@ static inline int is_pci_memory(u32 addr)
66#define readw(p) __indirect_readw(p) 70#define readw(p) __indirect_readw(p)
67#define readl(p) __indirect_readl(p) 71#define readl(p) __indirect_readl(p)
68 72
73#define readb_relaxed(p) __indirect_readb(p)
74#define readw_relaxed(p) __indirect_readw(p)
75#define readl_relaxed(p) __indirect_readl(p)
76
69#define readsb(p, v, l) __indirect_readsb(p, v, l) 77#define readsb(p, v, l) __indirect_readsb(p, v, l)
70#define readsw(p, v, l) __indirect_readsw(p, v, l) 78#define readsw(p, v, l) __indirect_readsw(p, v, l)
71#define readsl(p, v, l) __indirect_readsl(p, v, l) 79#define readsl(p, v, l) __indirect_readsl(p, v, l)
@@ -99,7 +107,7 @@ static inline void __indirect_writew(u16 value, volatile void __iomem *p)
99 u32 n, byte_enables, data; 107 u32 n, byte_enables, data;
100 108
101 if (!is_pci_memory(addr)) { 109 if (!is_pci_memory(addr)) {
102 __raw_writew(value, addr); 110 __raw_writew(value, p);
103 return; 111 return;
104 } 112 }
105 113
@@ -164,7 +172,7 @@ static inline unsigned short __indirect_readw(const volatile void __iomem *p)
164 u32 n, byte_enables, data; 172 u32 n, byte_enables, data;
165 173
166 if (!is_pci_memory(addr)) 174 if (!is_pci_memory(addr))
167 return __raw_readw(addr); 175 return __raw_readw(p);
168 176
169 n = addr % 4; 177 n = addr % 4;
170 byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL; 178 byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
@@ -226,6 +234,7 @@ static inline void __indirect_readsl(const volatile void __iomem *bus_addr,
226 * I/O functions. 234 * I/O functions.
227 */ 235 */
228 236
237#define outb outb
229static inline void outb(u8 value, u32 addr) 238static inline void outb(u8 value, u32 addr)
230{ 239{
231 u32 n, byte_enables, data; 240 u32 n, byte_enables, data;
@@ -235,12 +244,14 @@ static inline void outb(u8 value, u32 addr)
235 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data); 244 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
236} 245}
237 246
247#define outsb outsb
238static inline void outsb(u32 io_addr, const u8 *vaddr, u32 count) 248static inline void outsb(u32 io_addr, const u8 *vaddr, u32 count)
239{ 249{
240 while (count--) 250 while (count--)
241 outb(*vaddr++, io_addr); 251 outb(*vaddr++, io_addr);
242} 252}
243 253
254#define outw outw
244static inline void outw(u16 value, u32 addr) 255static inline void outw(u16 value, u32 addr)
245{ 256{
246 u32 n, byte_enables, data; 257 u32 n, byte_enables, data;
@@ -250,23 +261,27 @@ static inline void outw(u16 value, u32 addr)
250 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data); 261 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
251} 262}
252 263
264#define outsw outsw
253static inline void outsw(u32 io_addr, const u16 *vaddr, u32 count) 265static inline void outsw(u32 io_addr, const u16 *vaddr, u32 count)
254{ 266{
255 while (count--) 267 while (count--)
256 outw(cpu_to_le16(*vaddr++), io_addr); 268 outw(cpu_to_le16(*vaddr++), io_addr);
257} 269}
258 270
271#define outl outl
259static inline void outl(u32 value, u32 addr) 272static inline void outl(u32 value, u32 addr)
260{ 273{
261 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value); 274 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value);
262} 275}
263 276
277#define outsl outsl
264static inline void outsl(u32 io_addr, const u32 *vaddr, u32 count) 278static inline void outsl(u32 io_addr, const u32 *vaddr, u32 count)
265{ 279{
266 while (count--) 280 while (count--)
267 outl(cpu_to_le32(*vaddr++), io_addr); 281 outl(cpu_to_le32(*vaddr++), io_addr);
268} 282}
269 283
284#define inb inb
270static inline u8 inb(u32 addr) 285static inline u8 inb(u32 addr)
271{ 286{
272 u32 n, byte_enables, data; 287 u32 n, byte_enables, data;
@@ -278,12 +293,14 @@ static inline u8 inb(u32 addr)
278 return data >> (8*n); 293 return data >> (8*n);
279} 294}
280 295
296#define insb insb
281static inline void insb(u32 io_addr, u8 *vaddr, u32 count) 297static inline void insb(u32 io_addr, u8 *vaddr, u32 count)
282{ 298{
283 while (count--) 299 while (count--)
284 *vaddr++ = inb(io_addr); 300 *vaddr++ = inb(io_addr);
285} 301}
286 302
303#define inw inw
287static inline u16 inw(u32 addr) 304static inline u16 inw(u32 addr)
288{ 305{
289 u32 n, byte_enables, data; 306 u32 n, byte_enables, data;
@@ -295,12 +312,14 @@ static inline u16 inw(u32 addr)
295 return data>>(8*n); 312 return data>>(8*n);
296} 313}
297 314
315#define insw insw
298static inline void insw(u32 io_addr, u16 *vaddr, u32 count) 316static inline void insw(u32 io_addr, u16 *vaddr, u32 count)
299{ 317{
300 while (count--) 318 while (count--)
301 *vaddr++ = le16_to_cpu(inw(io_addr)); 319 *vaddr++ = le16_to_cpu(inw(io_addr));
302} 320}
303 321
322#define inl inl
304static inline u32 inl(u32 addr) 323static inline u32 inl(u32 addr)
305{ 324{
306 u32 data; 325 u32 data;
@@ -310,6 +329,7 @@ static inline u32 inl(u32 addr)
310 return data; 329 return data;
311} 330}
312 331
332#define insl insl
313static inline void insl(u32 io_addr, u32 *vaddr, u32 count) 333static inline void insl(u32 io_addr, u32 *vaddr, u32 count)
314{ 334{
315 while (count--) 335 while (count--)
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index 98a156afaa94..ea955f6db8b7 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -9,6 +9,8 @@ config ARCH_KEYSTONE
9 select COMMON_CLK_KEYSTONE 9 select COMMON_CLK_KEYSTONE
10 select ARCH_SUPPORTS_BIG_ENDIAN 10 select ARCH_SUPPORTS_BIG_ENDIAN
11 select ZONE_DMA if ARM_LPAE 11 select ZONE_DMA if ARM_LPAE
12 select MIGHT_HAVE_PCI
13 select PCI_DOMAINS if PCI
12 help 14 help
13 Support for boards based on the Texas Instruments Keystone family of 15 Support for boards based on the Texas Instruments Keystone family of
14 SoCs. 16 SoCs.
diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
index 2c043a210db0..f73f588f649c 100644
--- a/arch/arm/mach-mediatek/Kconfig
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -1,6 +1,6 @@
1config ARCH_MEDIATEK 1config ARCH_MEDIATEK
2 bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 2 bool "Mediatek MT65xx & MT81xx SoC" if ARCH_MULTI_V7
3 select ARM_GIC 3 select ARM_GIC
4 select MTK_TIMER 4 select MTK_TIMER
5 help 5 help
6 Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589. 6 Support for Mediatek MT65xx & MT81xx SoCs
diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index f2acf075350d..a9549005097e 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -19,6 +19,9 @@
19 19
20static const char * const mediatek_board_dt_compat[] = { 20static const char * const mediatek_board_dt_compat[] = {
21 "mediatek,mt6589", 21 "mediatek,mt6589",
22 "mediatek,mt6592",
23 "mediatek,mt8127",
24 "mediatek,mt8135",
22 NULL, 25 NULL,
23}; 26};
24 27
diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig
index 2c1154e1794a..18301dc9d2e7 100644
--- a/arch/arm/mach-meson/Kconfig
+++ b/arch/arm/mach-meson/Kconfig
@@ -2,6 +2,7 @@ menuconfig ARCH_MESON
2 bool "Amlogic Meson SoCs" if ARCH_MULTI_V7 2 bool "Amlogic Meson SoCs" if ARCH_MULTI_V7
3 select GENERIC_IRQ_CHIP 3 select GENERIC_IRQ_CHIP
4 select ARM_GIC 4 select ARM_GIC
5 select CACHE_L2X0
5 6
6if ARCH_MESON 7if ARCH_MESON
7 8
@@ -10,4 +11,9 @@ config MACH_MESON6
10 default ARCH_MESON 11 default ARCH_MESON
11 select MESON6_TIMER 12 select MESON6_TIMER
12 13
14config MACH_MESON8
15 bool "Amlogic Meson8 SoCs support"
16 default ARCH_MESON
17 select MESON6_TIMER
18
13endif 19endif
diff --git a/arch/arm/mach-meson/meson.c b/arch/arm/mach-meson/meson.c
index 5ee064f5a89f..5d6affe6a694 100644
--- a/arch/arm/mach-meson/meson.c
+++ b/arch/arm/mach-meson/meson.c
@@ -16,12 +16,14 @@
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
18 18
19static const char * const m6_common_board_compat[] = { 19static const char * const meson_common_board_compat[] = {
20 "amlogic,meson6", 20 "amlogic,meson6",
21 "amlogic,meson8",
21 NULL, 22 NULL,
22}; 23};
23 24
24DT_MACHINE_START(AML8726_MX, "Amlogic Meson6 platform") 25DT_MACHINE_START(MESON, "Amlogic Meson platform")
25 .dt_compat = m6_common_board_compat, 26 .dt_compat = meson_common_board_compat,
27 .l2c_aux_val = 0,
28 .l2c_aux_mask = ~0,
26MACHINE_END 29MACHINE_END
27
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index e24136b42765..b4f01497ce0b 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -7,7 +7,7 @@ CFLAGS_pmsu.o := -march=armv7-a
7obj-$(CONFIG_MACH_MVEBU_ANY) += system-controller.o mvebu-soc-id.o 7obj-$(CONFIG_MACH_MVEBU_ANY) += system-controller.o mvebu-soc-id.o
8 8
9ifeq ($(CONFIG_MACH_MVEBU_V7),y) 9ifeq ($(CONFIG_MACH_MVEBU_V7),y)
10obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o pmsu_ll.o 10obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o pmsu_ll.o pm.o pm-board.o
11obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o 11obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o
12endif 12endif
13 13
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index 84cd90d9b860..c55bbf81de0e 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -16,14 +16,8 @@
16#define __MACH_ARMADA_370_XP_H 16#define __MACH_ARMADA_370_XP_H
17 17
18#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
19#include <linux/cpumask.h>
20
21#define ARMADA_XP_MAX_CPUS 4
22
23void armada_xp_secondary_startup(void); 19void armada_xp_secondary_startup(void);
24extern struct smp_operations armada_xp_smp_ops; 20extern struct smp_operations armada_xp_smp_ops;
25#endif 21#endif
26 22
27int armada_370_xp_pmsu_idle_enter(unsigned long deepidle);
28
29#endif /* __MACH_ARMADA_370_XP_H */ 23#endif /* __MACH_ARMADA_370_XP_H */
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
index d0d39f150fab..89a139ed7d5b 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -16,10 +16,12 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/clk-provider.h> 17#include <linux/clk-provider.h>
18#include <linux/of_address.h> 18#include <linux/of_address.h>
19#include <linux/of_fdt.h>
19#include <linux/of_platform.h> 20#include <linux/of_platform.h>
20#include <linux/io.h> 21#include <linux/io.h>
21#include <linux/clocksource.h> 22#include <linux/clocksource.h>
22#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/memblock.h>
23#include <linux/mbus.h> 25#include <linux/mbus.h>
24#include <linux/signal.h> 26#include <linux/signal.h>
25#include <linux/slab.h> 27#include <linux/slab.h>
@@ -57,6 +59,54 @@ void __iomem *mvebu_get_scu_base(void)
57} 59}
58 60
59/* 61/*
62 * When returning from suspend, the platform goes through the
63 * bootloader, which executes its DDR3 training code. This code has
64 * the unfortunate idea of using the first 10 KB of each DRAM bank to
65 * exercise the RAM and calculate the optimal timings. Therefore, this
66 * area of RAM is overwritten, and shouldn't be used by the kernel if
67 * suspend/resume is supported.
68 */
69
70#ifdef CONFIG_SUSPEND
71#define MVEBU_DDR_TRAINING_AREA_SZ (10 * SZ_1K)
72static int __init mvebu_scan_mem(unsigned long node, const char *uname,
73 int depth, void *data)
74{
75 const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
76 const __be32 *reg, *endp;
77 int l;
78
79 if (type == NULL || strcmp(type, "memory"))
80 return 0;
81
82 reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
83 if (reg == NULL)
84 reg = of_get_flat_dt_prop(node, "reg", &l);
85 if (reg == NULL)
86 return 0;
87
88 endp = reg + (l / sizeof(__be32));
89 while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
90 u64 base, size;
91
92 base = dt_mem_next_cell(dt_root_addr_cells, &reg);
93 size = dt_mem_next_cell(dt_root_size_cells, &reg);
94
95 memblock_reserve(base, MVEBU_DDR_TRAINING_AREA_SZ);
96 }
97
98 return 0;
99}
100
101static void __init mvebu_memblock_reserve(void)
102{
103 of_scan_flat_dt(mvebu_scan_mem, NULL);
104}
105#else
106static void __init mvebu_memblock_reserve(void) {}
107#endif
108
109/*
60 * Early versions of Armada 375 SoC have a bug where the BootROM 110 * Early versions of Armada 375 SoC have a bug where the BootROM
61 * leaves an external data abort pending. The kernel is hit by this 111 * leaves an external data abort pending. The kernel is hit by this
62 * data abort as soon as it enters userspace, because it unmasks the 112 * data abort as soon as it enters userspace, because it unmasks the
@@ -124,76 +174,12 @@ static void __init i2c_quirk(void)
124 return; 174 return;
125} 175}
126 176
127#define A375_Z1_THERMAL_FIXUP_OFFSET 0xc
128
129static void __init thermal_quirk(void)
130{
131 struct device_node *np;
132 u32 dev, rev;
133 int res;
134
135 /*
136 * The early SoC Z1 revision needs a quirk to be applied in order
137 * for the thermal controller to work properly. This quirk breaks
138 * the thermal support if applied on a SoC that doesn't need it,
139 * so we enforce the SoC revision to be known.
140 */
141 res = mvebu_get_soc_id(&dev, &rev);
142 if (res < 0 || (res == 0 && rev > ARMADA_375_Z1_REV))
143 return;
144
145 for_each_compatible_node(np, NULL, "marvell,armada375-thermal") {
146 struct property *prop;
147 __be32 newval, *newprop, *oldprop;
148 int len;
149
150 /*
151 * The register offset is at a wrong location. This quirk
152 * creates a new reg property as a clone of the previous
153 * one and corrects the offset.
154 */
155 oldprop = (__be32 *)of_get_property(np, "reg", &len);
156 if (!oldprop)
157 continue;
158
159 /* Create a duplicate of the 'reg' property */
160 prop = kzalloc(sizeof(*prop), GFP_KERNEL);
161 prop->length = len;
162 prop->name = kstrdup("reg", GFP_KERNEL);
163 prop->value = kzalloc(len, GFP_KERNEL);
164 memcpy(prop->value, oldprop, len);
165
166 /* Fixup the register offset of the second entry */
167 oldprop += 2;
168 newprop = (__be32 *)prop->value + 2;
169 newval = cpu_to_be32(be32_to_cpu(*oldprop) -
170 A375_Z1_THERMAL_FIXUP_OFFSET);
171 *newprop = newval;
172 of_update_property(np, prop);
173
174 /*
175 * The thermal controller needs some quirk too, so let's change
176 * the compatible string to reflect this and allow the driver
177 * the take the necessary action.
178 */
179 prop = kzalloc(sizeof(*prop), GFP_KERNEL);
180 prop->name = kstrdup("compatible", GFP_KERNEL);
181 prop->length = sizeof("marvell,armada375-z1-thermal");
182 prop->value = kstrdup("marvell,armada375-z1-thermal",
183 GFP_KERNEL);
184 of_update_property(np, prop);
185 }
186 return;
187}
188
189static void __init mvebu_dt_init(void) 177static void __init mvebu_dt_init(void)
190{ 178{
191 if (of_machine_is_compatible("marvell,armadaxp")) 179 if (of_machine_is_compatible("marvell,armadaxp"))
192 i2c_quirk(); 180 i2c_quirk();
193 if (of_machine_is_compatible("marvell,a375-db")) { 181 if (of_machine_is_compatible("marvell,a375-db"))
194 external_abort_quirk(); 182 external_abort_quirk();
195 thermal_quirk();
196 }
197 183
198 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 184 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
199} 185}
@@ -206,10 +192,16 @@ static const char * const armada_370_xp_dt_compat[] = {
206DT_MACHINE_START(ARMADA_370_XP_DT, "Marvell Armada 370/XP (Device Tree)") 192DT_MACHINE_START(ARMADA_370_XP_DT, "Marvell Armada 370/XP (Device Tree)")
207 .l2c_aux_val = 0, 193 .l2c_aux_val = 0,
208 .l2c_aux_mask = ~0, 194 .l2c_aux_mask = ~0,
195/*
196 * The following field (.smp) is still needed to ensure backward
197 * compatibility with old Device Trees that were not specifying the
198 * cpus enable-method property.
199 */
209 .smp = smp_ops(armada_xp_smp_ops), 200 .smp = smp_ops(armada_xp_smp_ops),
210 .init_machine = mvebu_dt_init, 201 .init_machine = mvebu_dt_init,
211 .init_irq = mvebu_init_irq, 202 .init_irq = mvebu_init_irq,
212 .restart = mvebu_restart, 203 .restart = mvebu_restart,
204 .reserve = mvebu_memblock_reserve,
213 .dt_compat = armada_370_xp_dt_compat, 205 .dt_compat = armada_370_xp_dt_compat,
214MACHINE_END 206MACHINE_END
215 207
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 044b51185fcc..3585cb394e9b 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Coherency fabric (Aurora) support for Armada 370 and XP platforms. 2 * Coherency fabric (Aurora) support for Armada 370, 375, 38x and XP
3 * platforms.
3 * 4 *
4 * Copyright (C) 2012 Marvell 5 * Copyright (C) 2012 Marvell
5 * 6 *
@@ -11,7 +12,7 @@
11 * License version 2. This program is licensed "as is" without any 12 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied. 13 * warranty of any kind, whether express or implied.
13 * 14 *
14 * The Armada 370 and Armada XP SOCs have a coherency fabric which is 15 * The Armada 370, 375, 38x and XP SOCs have a coherency fabric which is
15 * responsible for ensuring hardware coherency between all CPUs and between 16 * responsible for ensuring hardware coherency between all CPUs and between
16 * CPUs and I/O masters. This file initializes the coherency fabric and 17 * CPUs and I/O masters. This file initializes the coherency fabric and
17 * supplies basic routines for configuring and controlling hardware coherency 18 * supplies basic routines for configuring and controlling hardware coherency
@@ -28,12 +29,10 @@
28#include <linux/platform_device.h> 29#include <linux/platform_device.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
30#include <linux/mbus.h> 31#include <linux/mbus.h>
31#include <linux/clk.h>
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <asm/smp_plat.h> 33#include <asm/smp_plat.h>
34#include <asm/cacheflush.h> 34#include <asm/cacheflush.h>
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36#include "armada-370-xp.h"
37#include "coherency.h" 36#include "coherency.h"
38#include "mvebu-soc-id.h" 37#include "mvebu-soc-id.h"
39 38
@@ -42,8 +41,6 @@ void __iomem *coherency_base;
42static void __iomem *coherency_cpu_base; 41static void __iomem *coherency_cpu_base;
43 42
44/* Coherency fabric registers */ 43/* Coherency fabric registers */
45#define COHERENCY_FABRIC_CFG_OFFSET 0x4
46
47#define IO_SYNC_BARRIER_CTL_OFFSET 0x0 44#define IO_SYNC_BARRIER_CTL_OFFSET 0x0
48 45
49enum { 46enum {
@@ -79,157 +76,8 @@ int set_cpu_coherent(void)
79 return ll_enable_coherency(); 76 return ll_enable_coherency();
80} 77}
81 78
82/*
83 * The below code implements the I/O coherency workaround on Armada
84 * 375. This workaround consists in using the two channels of the
85 * first XOR engine to trigger a XOR transaction that serves as the
86 * I/O coherency barrier.
87 */
88
89static void __iomem *xor_base, *xor_high_base;
90static dma_addr_t coherency_wa_buf_phys[CONFIG_NR_CPUS];
91static void *coherency_wa_buf[CONFIG_NR_CPUS];
92static bool coherency_wa_enabled;
93
94#define XOR_CONFIG(chan) (0x10 + (chan * 4))
95#define XOR_ACTIVATION(chan) (0x20 + (chan * 4))
96#define WINDOW_BAR_ENABLE(chan) (0x240 + ((chan) << 2))
97#define WINDOW_BASE(w) (0x250 + ((w) << 2))
98#define WINDOW_SIZE(w) (0x270 + ((w) << 2))
99#define WINDOW_REMAP_HIGH(w) (0x290 + ((w) << 2))
100#define WINDOW_OVERRIDE_CTRL(chan) (0x2A0 + ((chan) << 2))
101#define XOR_DEST_POINTER(chan) (0x2B0 + (chan * 4))
102#define XOR_BLOCK_SIZE(chan) (0x2C0 + (chan * 4))
103#define XOR_INIT_VALUE_LOW 0x2E0
104#define XOR_INIT_VALUE_HIGH 0x2E4
105
106static inline void mvebu_hwcc_armada375_sync_io_barrier_wa(void)
107{
108 int idx = smp_processor_id();
109
110 /* Write '1' to the first word of the buffer */
111 writel(0x1, coherency_wa_buf[idx]);
112
113 /* Wait until the engine is idle */
114 while ((readl(xor_base + XOR_ACTIVATION(idx)) >> 4) & 0x3)
115 ;
116
117 dmb();
118
119 /* Trigger channel */
120 writel(0x1, xor_base + XOR_ACTIVATION(idx));
121
122 /* Poll the data until it is cleared by the XOR transaction */
123 while (readl(coherency_wa_buf[idx]))
124 ;
125}
126
127static void __init armada_375_coherency_init_wa(void)
128{
129 const struct mbus_dram_target_info *dram;
130 struct device_node *xor_node;
131 struct property *xor_status;
132 struct clk *xor_clk;
133 u32 win_enable = 0;
134 int i;
135
136 pr_warn("enabling coherency workaround for Armada 375 Z1, one XOR engine disabled\n");
137
138 /*
139 * Since the workaround uses one XOR engine, we grab a
140 * reference to its Device Tree node first.
141 */
142 xor_node = of_find_compatible_node(NULL, NULL, "marvell,orion-xor");
143 BUG_ON(!xor_node);
144
145 /*
146 * Then we mark it as disabled so that the real XOR driver
147 * will not use it.
148 */
149 xor_status = kzalloc(sizeof(struct property), GFP_KERNEL);
150 BUG_ON(!xor_status);
151
152 xor_status->value = kstrdup("disabled", GFP_KERNEL);
153 BUG_ON(!xor_status->value);
154
155 xor_status->length = 8;
156 xor_status->name = kstrdup("status", GFP_KERNEL);
157 BUG_ON(!xor_status->name);
158
159 of_update_property(xor_node, xor_status);
160
161 /*
162 * And we remap the registers, get the clock, and do the
163 * initial configuration of the XOR engine.
164 */
165 xor_base = of_iomap(xor_node, 0);
166 xor_high_base = of_iomap(xor_node, 1);
167
168 xor_clk = of_clk_get_by_name(xor_node, NULL);
169 BUG_ON(!xor_clk);
170
171 clk_prepare_enable(xor_clk);
172
173 dram = mv_mbus_dram_info();
174
175 for (i = 0; i < 8; i++) {
176 writel(0, xor_base + WINDOW_BASE(i));
177 writel(0, xor_base + WINDOW_SIZE(i));
178 if (i < 4)
179 writel(0, xor_base + WINDOW_REMAP_HIGH(i));
180 }
181
182 for (i = 0; i < dram->num_cs; i++) {
183 const struct mbus_dram_window *cs = dram->cs + i;
184 writel((cs->base & 0xffff0000) |
185 (cs->mbus_attr << 8) |
186 dram->mbus_dram_target_id, xor_base + WINDOW_BASE(i));
187 writel((cs->size - 1) & 0xffff0000, xor_base + WINDOW_SIZE(i));
188
189 win_enable |= (1 << i);
190 win_enable |= 3 << (16 + (2 * i));
191 }
192
193 writel(win_enable, xor_base + WINDOW_BAR_ENABLE(0));
194 writel(win_enable, xor_base + WINDOW_BAR_ENABLE(1));
195 writel(0, xor_base + WINDOW_OVERRIDE_CTRL(0));
196 writel(0, xor_base + WINDOW_OVERRIDE_CTRL(1));
197
198 for (i = 0; i < CONFIG_NR_CPUS; i++) {
199 coherency_wa_buf[i] = kzalloc(PAGE_SIZE, GFP_KERNEL);
200 BUG_ON(!coherency_wa_buf[i]);
201
202 /*
203 * We can't use the DMA mapping API, since we don't
204 * have a valid 'struct device' pointer
205 */
206 coherency_wa_buf_phys[i] =
207 virt_to_phys(coherency_wa_buf[i]);
208 BUG_ON(!coherency_wa_buf_phys[i]);
209
210 /*
211 * Configure the XOR engine for memset operation, with
212 * a 128 bytes block size
213 */
214 writel(0x444, xor_base + XOR_CONFIG(i));
215 writel(128, xor_base + XOR_BLOCK_SIZE(i));
216 writel(coherency_wa_buf_phys[i],
217 xor_base + XOR_DEST_POINTER(i));
218 }
219
220 writel(0x0, xor_base + XOR_INIT_VALUE_LOW);
221 writel(0x0, xor_base + XOR_INIT_VALUE_HIGH);
222
223 coherency_wa_enabled = true;
224}
225
226static inline void mvebu_hwcc_sync_io_barrier(void) 79static inline void mvebu_hwcc_sync_io_barrier(void)
227{ 80{
228 if (coherency_wa_enabled) {
229 mvebu_hwcc_armada375_sync_io_barrier_wa();
230 return;
231 }
232
233 writel(0x1, coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET); 81 writel(0x1, coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET);
234 while (readl(coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET) & 0x1); 82 while (readl(coherency_cpu_base + IO_SYNC_BARRIER_CTL_OFFSET) & 0x1);
235} 83}
@@ -361,25 +209,41 @@ static int coherency_type(void)
361{ 209{
362 struct device_node *np; 210 struct device_node *np;
363 const struct of_device_id *match; 211 const struct of_device_id *match;
212 int type;
364 213
365 np = of_find_matching_node_and_match(NULL, of_coherency_table, &match); 214 /*
366 if (np) { 215 * The coherency fabric is needed:
367 int type = (int) match->data; 216 * - For coherency between processors on Armada XP, so only
217 * when SMP is enabled.
218 * - For coherency between the processor and I/O devices, but
219 * this coherency requires many pre-requisites (write
220 * allocate cache policy, shareable pages, SMP bit set) that
221 * are only meant in SMP situations.
222 *
223 * Note that this means that on Armada 370, there is currently
224 * no way to use hardware I/O coherency, because even when
225 * CONFIG_SMP is enabled, is_smp() returns false due to the
226 * Armada 370 being a single-core processor. To lift this
227 * limitation, we would have to find a way to make the cache
228 * policy set to write-allocate (on all Armada SoCs), and to
229 * set the shareable attribute in page tables (on all Armada
230 * SoCs except the Armada 370). Unfortunately, such decisions
231 * are taken very early in the kernel boot process, at a point
232 * where we don't know yet on which SoC we are running.
368 233
369 /* Armada 370/XP coherency works in both UP and SMP */ 234 */
370 if (type == COHERENCY_FABRIC_TYPE_ARMADA_370_XP) 235 if (!is_smp())
371 return type; 236 return COHERENCY_FABRIC_TYPE_NONE;
372 237
373 /* Armada 375 coherency works only on SMP */ 238 np = of_find_matching_node_and_match(NULL, of_coherency_table, &match);
374 else if (type == COHERENCY_FABRIC_TYPE_ARMADA_375 && is_smp()) 239 if (!np)
375 return type; 240 return COHERENCY_FABRIC_TYPE_NONE;
376 241
377 /* Armada 380 coherency works only on SMP */ 242 type = (int) match->data;
378 else if (type == COHERENCY_FABRIC_TYPE_ARMADA_380 && is_smp())
379 return type;
380 }
381 243
382 return COHERENCY_FABRIC_TYPE_NONE; 244 of_node_put(np);
245
246 return type;
383} 247}
384 248
385int coherency_available(void) 249int coherency_available(void)
@@ -407,22 +271,9 @@ int __init coherency_init(void)
407 271
408static int __init coherency_late_init(void) 272static int __init coherency_late_init(void)
409{ 273{
410 int type = coherency_type(); 274 if (coherency_available())
411 275 bus_register_notifier(&platform_bus_type,
412 if (type == COHERENCY_FABRIC_TYPE_NONE) 276 &mvebu_hwcc_nb);
413 return 0;
414
415 if (type == COHERENCY_FABRIC_TYPE_ARMADA_375) {
416 u32 dev, rev;
417
418 if (mvebu_get_soc_id(&dev, &rev) == 0 &&
419 rev == ARMADA_375_Z1_REV)
420 armada_375_coherency_init_wa();
421 }
422
423 bus_register_notifier(&platform_bus_type,
424 &mvebu_hwcc_nb);
425
426 return 0; 277 return 0;
427} 278}
428 279
diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S
index f5d881b5d0f7..8b2fbc8b6bc6 100644
--- a/arch/arm/mach-mvebu/coherency_ll.S
+++ b/arch/arm/mach-mvebu/coherency_ll.S
@@ -24,7 +24,10 @@
24#include <asm/cp15.h> 24#include <asm/cp15.h>
25 25
26 .text 26 .text
27/* Returns the coherency base address in r1 (r0 is untouched) */ 27/*
28 * Returns the coherency base address in r1 (r0 is untouched), or 0 if
29 * the coherency fabric is not enabled.
30 */
28ENTRY(ll_get_coherency_base) 31ENTRY(ll_get_coherency_base)
29 mrc p15, 0, r1, c1, c0, 0 32 mrc p15, 0, r1, c1, c0, 0
30 tst r1, #CR_M @ Check MMU bit enabled 33 tst r1, #CR_M @ Check MMU bit enabled
@@ -32,8 +35,13 @@ ENTRY(ll_get_coherency_base)
32 35
33 /* 36 /*
34 * MMU is disabled, use the physical address of the coherency 37 * MMU is disabled, use the physical address of the coherency
35 * base address. 38 * base address. However, if the coherency fabric isn't mapped
39 * (i.e its virtual address is zero), it means coherency is
40 * not enabled, so we return 0.
36 */ 41 */
42 ldr r1, =coherency_base
43 cmp r1, #0
44 beq 2f
37 adr r1, 3f 45 adr r1, 3f
38 ldr r3, [r1] 46 ldr r3, [r1]
39 ldr r1, [r1, r3] 47 ldr r1, [r1, r3]
@@ -85,6 +93,9 @@ ENTRY(ll_add_cpu_to_smp_group)
85 */ 93 */
86 mov r0, lr 94 mov r0, lr
87 bl ll_get_coherency_base 95 bl ll_get_coherency_base
96 /* Bail out if the coherency is not enabled */
97 cmp r1, #0
98 reteq r0
88 bl ll_get_coherency_cpumask 99 bl ll_get_coherency_cpumask
89 mov lr, r0 100 mov lr, r0
90 add r0, r1, #ARMADA_XP_CFB_CFG_REG_OFFSET 101 add r0, r1, #ARMADA_XP_CFB_CFG_REG_OFFSET
@@ -107,6 +118,9 @@ ENTRY(ll_enable_coherency)
107 */ 118 */
108 mov r0, lr 119 mov r0, lr
109 bl ll_get_coherency_base 120 bl ll_get_coherency_base
121 /* Bail out if the coherency is not enabled */
122 cmp r1, #0
123 reteq r0
110 bl ll_get_coherency_cpumask 124 bl ll_get_coherency_cpumask
111 mov lr, r0 125 mov lr, r0
112 add r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET 126 add r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET
@@ -131,6 +145,9 @@ ENTRY(ll_disable_coherency)
131 */ 145 */
132 mov r0, lr 146 mov r0, lr
133 bl ll_get_coherency_base 147 bl ll_get_coherency_base
148 /* Bail out if the coherency is not enabled */
149 cmp r1, #0
150 reteq r0
134 bl ll_get_coherency_cpumask 151 bl ll_get_coherency_cpumask
135 mov lr, r0 152 mov lr, r0
136 add r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET 153 add r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index 3ccb40c3bf94..3e0aca1f288a 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -25,4 +25,6 @@ int mvebu_system_controller_get_soc_id(u32 *dev, u32 *rev);
25 25
26void __iomem *mvebu_get_scu_base(void); 26void __iomem *mvebu_get_scu_base(void);
27 27
28int mvebu_pm_init(void (*board_pm_enter)(void __iomem *sdram_reg, u32 srcmd));
29
28#endif 30#endif
diff --git a/arch/arm/mach-mvebu/cpu-reset.c b/arch/arm/mach-mvebu/cpu-reset.c
index 60fb53787004..4a2cadd6b48e 100644
--- a/arch/arm/mach-mvebu/cpu-reset.c
+++ b/arch/arm/mach-mvebu/cpu-reset.c
@@ -15,7 +15,6 @@
15#include <linux/of_address.h> 15#include <linux/of_address.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/resource.h> 17#include <linux/resource.h>
18#include "armada-370-xp.h"
19 18
20static void __iomem *cpu_reset_base; 19static void __iomem *cpu_reset_base;
21static size_t cpu_reset_size; 20static size_t cpu_reset_size;
diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S
index be51c998c0cd..08d5ed46b996 100644
--- a/arch/arm/mach-mvebu/headsmp-a9.S
+++ b/arch/arm/mach-mvebu/headsmp-a9.S
@@ -22,5 +22,6 @@
22ENTRY(mvebu_cortex_a9_secondary_startup) 22ENTRY(mvebu_cortex_a9_secondary_startup)
23ARM_BE8(setend be) 23ARM_BE8(setend be)
24 bl v7_invalidate_l1 24 bl v7_invalidate_l1
25 bl armada_38x_scu_power_up
25 b secondary_startup 26 b secondary_startup
26ENDPROC(mvebu_cortex_a9_secondary_startup) 27ENDPROC(mvebu_cortex_a9_secondary_startup)
diff --git a/arch/arm/mach-mvebu/platsmp-a9.c b/arch/arm/mach-mvebu/platsmp-a9.c
index 47a71a924b96..2ec1a42b4321 100644
--- a/arch/arm/mach-mvebu/platsmp-a9.c
+++ b/arch/arm/mach-mvebu/platsmp-a9.c
@@ -43,21 +43,70 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
43 else 43 else
44 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, mvebu_cortex_a9_secondary_startup); 44 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, mvebu_cortex_a9_secondary_startup);
45 smp_wmb(); 45 smp_wmb();
46
47 /*
48 * Doing this before deasserting the CPUs is needed to wake up CPUs
49 * in the offline state after using CPU hotplug.
50 */
51 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
52
46 ret = mvebu_cpu_reset_deassert(hw_cpu); 53 ret = mvebu_cpu_reset_deassert(hw_cpu);
47 if (ret) { 54 if (ret) {
48 pr_err("Could not start the secondary CPU: %d\n", ret); 55 pr_err("Could not start the secondary CPU: %d\n", ret);
49 return ret; 56 return ret;
50 } 57 }
51 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
52 58
53 return 0; 59 return 0;
54} 60}
61/*
62 * When a CPU is brought back online, either through CPU hotplug, or
63 * because of the boot of a kexec'ed kernel, the PMSU configuration
64 * for this CPU might be in the deep idle state, preventing this CPU
65 * from receiving interrupts. Here, we therefore take out the current
66 * CPU from this state, which was entered by armada_38x_cpu_die()
67 * below.
68 */
69static void armada_38x_secondary_init(unsigned int cpu)
70{
71 mvebu_v7_pmsu_idle_exit();
72}
73
74#ifdef CONFIG_HOTPLUG_CPU
75static void armada_38x_cpu_die(unsigned int cpu)
76{
77 /*
78 * CPU hotplug is implemented by putting offline CPUs into the
79 * deep idle sleep state.
80 */
81 armada_38x_do_cpu_suspend(true);
82}
83
84/*
85 * We need a dummy function, so that platform_can_cpu_hotplug() knows
86 * we support CPU hotplug. However, the function does not need to do
87 * anything, because CPUs going offline can enter the deep idle state
88 * by themselves, without any help from a still alive CPU.
89 */
90static int armada_38x_cpu_kill(unsigned int cpu)
91{
92 return 1;
93}
94#endif
55 95
56static struct smp_operations mvebu_cortex_a9_smp_ops __initdata = { 96static struct smp_operations mvebu_cortex_a9_smp_ops __initdata = {
57 .smp_boot_secondary = mvebu_cortex_a9_boot_secondary, 97 .smp_boot_secondary = mvebu_cortex_a9_boot_secondary,
58}; 98};
59 99
100static struct smp_operations armada_38x_smp_ops __initdata = {
101 .smp_boot_secondary = mvebu_cortex_a9_boot_secondary,
102 .smp_secondary_init = armada_38x_secondary_init,
103#ifdef CONFIG_HOTPLUG_CPU
104 .cpu_die = armada_38x_cpu_die,
105 .cpu_kill = armada_38x_cpu_kill,
106#endif
107};
108
60CPU_METHOD_OF_DECLARE(mvebu_armada_375_smp, "marvell,armada-375-smp", 109CPU_METHOD_OF_DECLARE(mvebu_armada_375_smp, "marvell,armada-375-smp",
61 &mvebu_cortex_a9_smp_ops); 110 &mvebu_cortex_a9_smp_ops);
62CPU_METHOD_OF_DECLARE(mvebu_armada_380_smp, "marvell,armada-380-smp", 111CPU_METHOD_OF_DECLARE(mvebu_armada_380_smp, "marvell,armada-380-smp",
63 &mvebu_cortex_a9_smp_ops); 112 &armada_38x_smp_ops);
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index 895dc373c8a1..58cc8c1575eb 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -30,10 +30,12 @@
30#include "pmsu.h" 30#include "pmsu.h"
31#include "coherency.h" 31#include "coherency.h"
32 32
33#define ARMADA_XP_MAX_CPUS 4
34
33#define AXP_BOOTROM_BASE 0xfff00000 35#define AXP_BOOTROM_BASE 0xfff00000
34#define AXP_BOOTROM_SIZE 0x100000 36#define AXP_BOOTROM_SIZE 0x100000
35 37
36static struct clk *__init get_cpu_clk(int cpu) 38static struct clk *get_cpu_clk(int cpu)
37{ 39{
38 struct clk *cpu_clk; 40 struct clk *cpu_clk;
39 struct device_node *np = of_get_cpu_node(cpu, NULL); 41 struct device_node *np = of_get_cpu_node(cpu, NULL);
@@ -46,29 +48,28 @@ static struct clk *__init get_cpu_clk(int cpu)
46 return cpu_clk; 48 return cpu_clk;
47} 49}
48 50
49static void __init set_secondary_cpus_clock(void) 51static void set_secondary_cpu_clock(unsigned int cpu)
50{ 52{
51 int thiscpu, cpu; 53 int thiscpu;
52 unsigned long rate; 54 unsigned long rate;
53 struct clk *cpu_clk; 55 struct clk *cpu_clk;
54 56
55 thiscpu = smp_processor_id(); 57 thiscpu = get_cpu();
58
56 cpu_clk = get_cpu_clk(thiscpu); 59 cpu_clk = get_cpu_clk(thiscpu);
57 if (!cpu_clk) 60 if (!cpu_clk)
58 return; 61 goto out;
59 clk_prepare_enable(cpu_clk); 62 clk_prepare_enable(cpu_clk);
60 rate = clk_get_rate(cpu_clk); 63 rate = clk_get_rate(cpu_clk);
61 64
62 /* set all the other CPU clk to the same rate than the boot CPU */ 65 cpu_clk = get_cpu_clk(cpu);
63 for_each_possible_cpu(cpu) { 66 if (!cpu_clk)
64 if (cpu == thiscpu) 67 goto out;
65 continue; 68 clk_set_rate(cpu_clk, rate);
66 cpu_clk = get_cpu_clk(cpu); 69 clk_prepare_enable(cpu_clk);
67 if (!cpu_clk) 70
68 return; 71out:
69 clk_set_rate(cpu_clk, rate); 72 put_cpu();
70 clk_prepare_enable(cpu_clk);
71 }
72} 73}
73 74
74static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle) 75static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -78,6 +79,7 @@ static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
78 pr_info("Booting CPU %d\n", cpu); 79 pr_info("Booting CPU %d\n", cpu);
79 80
80 hw_cpu = cpu_logical_map(cpu); 81 hw_cpu = cpu_logical_map(cpu);
82 set_secondary_cpu_clock(hw_cpu);
81 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_xp_secondary_startup); 83 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_xp_secondary_startup);
82 84
83 /* 85 /*
@@ -126,7 +128,6 @@ static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
126 struct resource res; 128 struct resource res;
127 int err; 129 int err;
128 130
129 set_secondary_cpus_clock();
130 flush_cache_all(); 131 flush_cache_all();
131 set_cpu_coherent(); 132 set_cpu_coherent();
132 133
diff --git a/arch/arm/mach-mvebu/pm-board.c b/arch/arm/mach-mvebu/pm-board.c
new file mode 100644
index 000000000000..6dfd4ab97b2a
--- /dev/null
+++ b/arch/arm/mach-mvebu/pm-board.c
@@ -0,0 +1,141 @@
1/*
2 * Board-level suspend/resume support.
3 *
4 * Copyright (C) 2014 Marvell
5 *
6 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/delay.h>
14#include <linux/gpio.h>
15#include <linux/init.h>
16#include <linux/io.h>
17#include <linux/of.h>
18#include <linux/of_address.h>
19#include <linux/of_gpio.h>
20#include <linux/slab.h>
21#include "common.h"
22
23#define ARMADA_XP_GP_PIC_NR_GPIOS 3
24
25static void __iomem *gpio_ctrl;
26static int pic_gpios[ARMADA_XP_GP_PIC_NR_GPIOS];
27static int pic_raw_gpios[ARMADA_XP_GP_PIC_NR_GPIOS];
28
29static void mvebu_armada_xp_gp_pm_enter(void __iomem *sdram_reg, u32 srcmd)
30{
31 u32 reg, ackcmd;
32 int i;
33
34 /* Put 001 as value on the GPIOs */
35 reg = readl(gpio_ctrl);
36 for (i = 0; i < ARMADA_XP_GP_PIC_NR_GPIOS; i++)
37 reg &= ~BIT(pic_raw_gpios[i]);
38 reg |= BIT(pic_raw_gpios[0]);
39 writel(reg, gpio_ctrl);
40
41 /* Prepare writing 111 to the GPIOs */
42 ackcmd = readl(gpio_ctrl);
43 for (i = 0; i < ARMADA_XP_GP_PIC_NR_GPIOS; i++)
44 ackcmd |= BIT(pic_raw_gpios[i]);
45
46 /*
47 * Wait a while, the PIC needs quite a bit of time between the
48 * two GPIO commands.
49 */
50 mdelay(3000);
51
52 asm volatile (
53 /* Align to a cache line */
54 ".balign 32\n\t"
55
56 /* Enter self refresh */
57 "str %[srcmd], [%[sdram_reg]]\n\t"
58
59 /*
60 * Wait 100 cycles for DDR to enter self refresh, by
61 * doing 50 times two instructions.
62 */
63 "mov r1, #50\n\t"
64 "1: subs r1, r1, #1\n\t"
65 "bne 1b\n\t"
66
67 /* Issue the command ACK */
68 "str %[ackcmd], [%[gpio_ctrl]]\n\t"
69
70 /* Trap the processor */
71 "b .\n\t"
72 : : [srcmd] "r" (srcmd), [sdram_reg] "r" (sdram_reg),
73 [ackcmd] "r" (ackcmd), [gpio_ctrl] "r" (gpio_ctrl) : "r1");
74}
75
76static int mvebu_armada_xp_gp_pm_init(void)
77{
78 struct device_node *np;
79 struct device_node *gpio_ctrl_np;
80 int ret = 0, i;
81
82 if (!of_machine_is_compatible("marvell,axp-gp"))
83 return -ENODEV;
84
85 np = of_find_node_by_name(NULL, "pm_pic");
86 if (!np)
87 return -ENODEV;
88
89 for (i = 0; i < ARMADA_XP_GP_PIC_NR_GPIOS; i++) {
90 char *name;
91 struct of_phandle_args args;
92
93 pic_gpios[i] = of_get_named_gpio(np, "ctrl-gpios", i);
94 if (pic_gpios[i] < 0) {
95 ret = -ENODEV;
96 goto out;
97 }
98
99 name = kasprintf(GFP_KERNEL, "pic-pin%d", i);
100 if (!name) {
101 ret = -ENOMEM;
102 goto out;
103 }
104
105 ret = gpio_request(pic_gpios[i], name);
106 if (ret < 0) {
107 kfree(name);
108 goto out;
109 }
110
111 ret = gpio_direction_output(pic_gpios[i], 0);
112 if (ret < 0) {
113 gpio_free(pic_gpios[i]);
114 kfree(name);
115 goto out;
116 }
117
118 ret = of_parse_phandle_with_fixed_args(np, "ctrl-gpios", 2,
119 i, &args);
120 if (ret < 0) {
121 gpio_free(pic_gpios[i]);
122 kfree(name);
123 goto out;
124 }
125
126 gpio_ctrl_np = args.np;
127 pic_raw_gpios[i] = args.args[0];
128 }
129
130 gpio_ctrl = of_iomap(gpio_ctrl_np, 0);
131 if (!gpio_ctrl)
132 return -ENOMEM;
133
134 mvebu_pm_init(mvebu_armada_xp_gp_pm_enter);
135
136out:
137 of_node_put(np);
138 return ret;
139}
140
141late_initcall(mvebu_armada_xp_gp_pm_init);
diff --git a/arch/arm/mach-mvebu/pm.c b/arch/arm/mach-mvebu/pm.c
new file mode 100644
index 000000000000..6573a8f11f70
--- /dev/null
+++ b/arch/arm/mach-mvebu/pm.c
@@ -0,0 +1,218 @@
1/*
2 * Suspend/resume support. Currently supporting Armada XP only.
3 *
4 * Copyright (C) 2014 Marvell
5 *
6 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/cpu_pm.h>
14#include <linux/delay.h>
15#include <linux/gpio.h>
16#include <linux/io.h>
17#include <linux/kernel.h>
18#include <linux/mbus.h>
19#include <linux/of_address.h>
20#include <linux/suspend.h>
21#include <asm/cacheflush.h>
22#include <asm/outercache.h>
23#include <asm/suspend.h>
24
25#include "coherency.h"
26#include "pmsu.h"
27
28#define SDRAM_CONFIG_OFFS 0x0
29#define SDRAM_CONFIG_SR_MODE_BIT BIT(24)
30#define SDRAM_OPERATION_OFFS 0x18
31#define SDRAM_OPERATION_SELF_REFRESH 0x7
32#define SDRAM_DLB_EVICTION_OFFS 0x30c
33#define SDRAM_DLB_EVICTION_THRESHOLD_MASK 0xff
34
35static void (*mvebu_board_pm_enter)(void __iomem *sdram_reg, u32 srcmd);
36static void __iomem *sdram_ctrl;
37
38static int mvebu_pm_powerdown(unsigned long data)
39{
40 u32 reg, srcmd;
41
42 flush_cache_all();
43 outer_flush_all();
44
45 /*
46 * Issue a Data Synchronization Barrier instruction to ensure
47 * that all state saving has been completed.
48 */
49 dsb();
50
51 /* Flush the DLB and wait ~7 usec */
52 reg = readl(sdram_ctrl + SDRAM_DLB_EVICTION_OFFS);
53 reg &= ~SDRAM_DLB_EVICTION_THRESHOLD_MASK;
54 writel(reg, sdram_ctrl + SDRAM_DLB_EVICTION_OFFS);
55
56 udelay(7);
57
58 /* Set DRAM in battery backup mode */
59 reg = readl(sdram_ctrl + SDRAM_CONFIG_OFFS);
60 reg &= ~SDRAM_CONFIG_SR_MODE_BIT;
61 writel(reg, sdram_ctrl + SDRAM_CONFIG_OFFS);
62
63 /* Prepare to go to self-refresh */
64
65 srcmd = readl(sdram_ctrl + SDRAM_OPERATION_OFFS);
66 srcmd &= ~0x1F;
67 srcmd |= SDRAM_OPERATION_SELF_REFRESH;
68
69 mvebu_board_pm_enter(sdram_ctrl + SDRAM_OPERATION_OFFS, srcmd);
70
71 return 0;
72}
73
74#define BOOT_INFO_ADDR 0x3000
75#define BOOT_MAGIC_WORD 0xdeadb002
76#define BOOT_MAGIC_LIST_END 0xffffffff
77
78/*
79 * Those registers are accessed before switching the internal register
80 * base, which is why we hardcode the 0xd0000000 base address, the one
81 * used by the SoC out of reset.
82 */
83#define MBUS_WINDOW_12_CTRL 0xd00200b0
84#define MBUS_INTERNAL_REG_ADDRESS 0xd0020080
85
86#define SDRAM_WIN_BASE_REG(x) (0x20180 + (0x8*x))
87#define SDRAM_WIN_CTRL_REG(x) (0x20184 + (0x8*x))
88
89static phys_addr_t mvebu_internal_reg_base(void)
90{
91 struct device_node *np;
92 __be32 in_addr[2];
93
94 np = of_find_node_by_name(NULL, "internal-regs");
95 BUG_ON(!np);
96
97 /*
98 * Ask the DT what is the internal register address on this
99 * platform. In the mvebu-mbus DT binding, 0xf0010000
100 * corresponds to the internal register window.
101 */
102 in_addr[0] = cpu_to_be32(0xf0010000);
103 in_addr[1] = 0x0;
104
105 return of_translate_address(np, in_addr);
106}
107
108static void mvebu_pm_store_bootinfo(void)
109{
110 u32 *store_addr;
111 phys_addr_t resume_pc;
112
113 store_addr = phys_to_virt(BOOT_INFO_ADDR);
114 resume_pc = virt_to_phys(armada_370_xp_cpu_resume);
115
116 /*
117 * The bootloader expects the first two words to be a magic
118 * value (BOOT_MAGIC_WORD), followed by the address of the
119 * resume code to jump to. Then, it expects a sequence of
120 * (address, value) pairs, which can be used to restore the
121 * value of certain registers. This sequence must end with the
122 * BOOT_MAGIC_LIST_END magic value.
123 */
124
125 writel(BOOT_MAGIC_WORD, store_addr++);
126 writel(resume_pc, store_addr++);
127
128 /*
129 * Some platforms remap their internal register base address
130 * to 0xf1000000. However, out of reset, window 12 starts at
131 * 0xf0000000 and ends at 0xf7ffffff, which would overlap with
132 * the internal registers. Therefore, disable window 12.
133 */
134 writel(MBUS_WINDOW_12_CTRL, store_addr++);
135 writel(0x0, store_addr++);
136
137 /*
138 * Set the internal register base address to the value
139 * expected by Linux, as read from the Device Tree.
140 */
141 writel(MBUS_INTERNAL_REG_ADDRESS, store_addr++);
142 writel(mvebu_internal_reg_base(), store_addr++);
143
144 /*
145 * Ask the mvebu-mbus driver to store the SDRAM window
146 * configuration, which has to be restored by the bootloader
147 * before re-entering the kernel on resume.
148 */
149 store_addr += mvebu_mbus_save_cpu_target(store_addr);
150
151 writel(BOOT_MAGIC_LIST_END, store_addr);
152}
153
154static int mvebu_pm_enter(suspend_state_t state)
155{
156 if (state != PM_SUSPEND_MEM)
157 return -EINVAL;
158
159 cpu_pm_enter();
160
161 mvebu_pm_store_bootinfo();
162 cpu_suspend(0, mvebu_pm_powerdown);
163
164 outer_resume();
165
166 mvebu_v7_pmsu_idle_exit();
167
168 set_cpu_coherent();
169
170 cpu_pm_exit();
171
172 return 0;
173}
174
175static const struct platform_suspend_ops mvebu_pm_ops = {
176 .enter = mvebu_pm_enter,
177 .valid = suspend_valid_only_mem,
178};
179
180int mvebu_pm_init(void (*board_pm_enter)(void __iomem *sdram_reg, u32 srcmd))
181{
182 struct device_node *np;
183 struct resource res;
184
185 if (!of_machine_is_compatible("marvell,armadaxp"))
186 return -ENODEV;
187
188 np = of_find_compatible_node(NULL, NULL,
189 "marvell,armada-xp-sdram-controller");
190 if (!np)
191 return -ENODEV;
192
193 if (of_address_to_resource(np, 0, &res)) {
194 of_node_put(np);
195 return -ENODEV;
196 }
197
198 if (!request_mem_region(res.start, resource_size(&res),
199 np->full_name)) {
200 of_node_put(np);
201 return -EBUSY;
202 }
203
204 sdram_ctrl = ioremap(res.start, resource_size(&res));
205 if (!sdram_ctrl) {
206 release_mem_region(res.start, resource_size(&res));
207 of_node_put(np);
208 return -ENOMEM;
209 }
210
211 of_node_put(np);
212
213 mvebu_board_pm_enter = board_pm_enter;
214
215 suspend_set_ops(&mvebu_pm_ops);
216
217 return 0;
218}
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index bbd8664d1bac..d8ab605a44fa 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/cpu_pm.h> 22#include <linux/cpu_pm.h>
23#include <linux/cpufreq-dt.h>
23#include <linux/delay.h> 24#include <linux/delay.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/io.h> 26#include <linux/io.h>
@@ -39,7 +40,6 @@
39#include <asm/suspend.h> 40#include <asm/suspend.h>
40#include <asm/tlbflush.h> 41#include <asm/tlbflush.h>
41#include "common.h" 42#include "common.h"
42#include "armada-370-xp.h"
43 43
44 44
45#define PMSU_BASE_OFFSET 0x100 45#define PMSU_BASE_OFFSET 0x100
@@ -312,7 +312,7 @@ static int armada_370_xp_cpu_suspend(unsigned long deepidle)
312 return cpu_suspend(deepidle, armada_370_xp_pmsu_idle_enter); 312 return cpu_suspend(deepidle, armada_370_xp_pmsu_idle_enter);
313} 313}
314 314
315static int armada_38x_do_cpu_suspend(unsigned long deepidle) 315int armada_38x_do_cpu_suspend(unsigned long deepidle)
316{ 316{
317 unsigned long flags = 0; 317 unsigned long flags = 0;
318 318
@@ -572,6 +572,10 @@ int mvebu_pmsu_dfs_request(int cpu)
572 return 0; 572 return 0;
573} 573}
574 574
575struct cpufreq_dt_platform_data cpufreq_dt_pd = {
576 .independent_clocks = true,
577};
578
575static int __init armada_xp_pmsu_cpufreq_init(void) 579static int __init armada_xp_pmsu_cpufreq_init(void)
576{ 580{
577 struct device_node *np; 581 struct device_node *np;
@@ -644,7 +648,8 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
644 } 648 }
645 } 649 }
646 650
647 platform_device_register_simple("cpufreq-dt", -1, NULL, 0); 651 platform_device_register_data(NULL, "cpufreq-dt", -1,
652 &cpufreq_dt_pd, sizeof(cpufreq_dt_pd));
648 return 0; 653 return 0;
649} 654}
650 655
diff --git a/arch/arm/mach-mvebu/pmsu.h b/arch/arm/mach-mvebu/pmsu.h
index 6b58c1fe2b0d..ea79269c2702 100644
--- a/arch/arm/mach-mvebu/pmsu.h
+++ b/arch/arm/mach-mvebu/pmsu.h
@@ -17,5 +17,8 @@ int mvebu_setup_boot_addr_wa(unsigned int crypto_eng_target,
17 phys_addr_t resume_addr_reg); 17 phys_addr_t resume_addr_reg);
18 18
19void mvebu_v7_pmsu_idle_exit(void); 19void mvebu_v7_pmsu_idle_exit(void);
20void armada_370_xp_cpu_resume(void);
20 21
22int armada_370_xp_pmsu_idle_enter(unsigned long deepidle);
23int armada_38x_do_cpu_suspend(unsigned long deepidle);
21#endif /* __MACH_370_XP_PMSU_H */ 24#endif /* __MACH_370_XP_PMSU_H */
diff --git a/arch/arm/mach-mvebu/pmsu_ll.S b/arch/arm/mach-mvebu/pmsu_ll.S
index a945756cfb45..88651221dbdd 100644
--- a/arch/arm/mach-mvebu/pmsu_ll.S
+++ b/arch/arm/mach-mvebu/pmsu_ll.S
@@ -12,12 +12,32 @@
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14 14
15
16ENTRY(armada_38x_scu_power_up)
17 mrc p15, 4, r1, c15, c0 @ get SCU base address
18 orr r1, r1, #0x8 @ SCU CPU Power Status Register
19 mrc 15, 0, r0, cr0, cr0, 5 @ get the CPU ID
20 and r0, r0, #15
21 add r1, r1, r0
22 mov r0, #0x0
23 strb r0, [r1] @ switch SCU power state to Normal mode
24 ret lr
25ENDPROC(armada_38x_scu_power_up)
26
15/* 27/*
16 * This is the entry point through which CPUs exiting cpuidle deep 28 * This is the entry point through which CPUs exiting cpuidle deep
17 * idle state are going. 29 * idle state are going.
18 */ 30 */
19ENTRY(armada_370_xp_cpu_resume) 31ENTRY(armada_370_xp_cpu_resume)
20ARM_BE8(setend be ) @ go BE8 if entered LE 32ARM_BE8(setend be ) @ go BE8 if entered LE
33 /*
34 * Disable the MMU that might have been enabled in BootROM if
35 * this code is used in the resume path of a suspend/resume
36 * cycle.
37 */
38 mrc p15, 0, r1, c1, c0, 0
39 bic r1, #1
40 mcr p15, 0, r1, c1, c0, 0
21 bl ll_add_cpu_to_smp_group 41 bl ll_add_cpu_to_smp_group
22 bl ll_enable_coherency 42 bl ll_enable_coherency
23 b cpu_resume 43 b cpu_resume
@@ -27,13 +47,7 @@ ENTRY(armada_38x_cpu_resume)
27 /* do we need it for Armada 38x*/ 47 /* do we need it for Armada 38x*/
28ARM_BE8(setend be ) @ go BE8 if entered LE 48ARM_BE8(setend be ) @ go BE8 if entered LE
29 bl v7_invalidate_l1 49 bl v7_invalidate_l1
30 mrc p15, 4, r1, c15, c0 @ get SCU base address 50 bl armada_38x_scu_power_up
31 orr r1, r1, #0x8 @ SCU CPU Power Status Register
32 mrc 15, 0, r0, cr0, cr0, 5 @ get the CPU ID
33 and r0, r0, #15
34 add r1, r1, r0
35 mov r0, #0x0
36 strb r0, [r1] @ switch SCU power state to Normal mode
37 b cpu_resume 51 b cpu_resume
38ENDPROC(armada_38x_cpu_resume) 52ENDPROC(armada_38x_cpu_resume)
39 53
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 9116ca476d7c..9bda46f1fab7 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -144,6 +144,7 @@ static int __init cpu8815_mmcsd_init(void)
144device_initcall(cpu8815_mmcsd_init); 144device_initcall(cpu8815_mmcsd_init);
145 145
146static const char * cpu8815_board_compat[] = { 146static const char * cpu8815_board_compat[] = {
147 "st,nomadik-nhk-15",
147 "calaosystems,usb-s8815", 148 "calaosystems,usb-s8815",
148 NULL, 149 NULL,
149}; 150};
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index f4d06aea8460..6e249324fdd7 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -79,7 +79,9 @@ config ARCH_OMAP2PLUS
79 select CLKSRC_MMIO 79 select CLKSRC_MMIO
80 select GENERIC_IRQ_CHIP 80 select GENERIC_IRQ_CHIP
81 select MACH_OMAP_GENERIC 81 select MACH_OMAP_GENERIC
82 select MEMORY
82 select OMAP_DM_TIMER 83 select OMAP_DM_TIMER
84 select OMAP_GPMC
83 select PINCTRL 85 select PINCTRL
84 select SOC_BUS 86 select SOC_BUS
85 select TI_PRIV_EDMA 87 select TI_PRIV_EDMA
@@ -235,12 +237,6 @@ config MACH_TOUCHBOOK
235 default y 237 default y
236 select OMAP_PACKAGE_CBB 238 select OMAP_PACKAGE_CBB
237 239
238config MACH_OMAP_3430SDP
239 bool "OMAP 3430 SDP board"
240 depends on ARCH_OMAP3
241 default y
242 select OMAP_PACKAGE_CBB
243
244config MACH_NOKIA_N810 240config MACH_NOKIA_N810
245 bool 241 bool
246 242
@@ -282,16 +278,6 @@ config MACH_SBC3530
282 default y 278 default y
283 select OMAP_PACKAGE_CUS 279 select OMAP_PACKAGE_CUS
284 280
285config MACH_TI8168EVM
286 bool "TI8168 Evaluation Module"
287 depends on SOC_TI81XX
288 default y
289
290config MACH_TI8148EVM
291 bool "TI8148 Evaluation Module"
292 depends on SOC_TI81XX
293 default y
294
295config OMAP3_EMU 281config OMAP3_EMU
296 bool "OMAP3 debugging peripherals" 282 bool "OMAP3 debugging peripherals"
297 depends on ARCH_OMAP3 283 depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index d9e94122073e..08cc94474d17 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -6,7 +6,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
6 -I$(srctree)/arch/arm/plat-omap/include 6 -I$(srctree)/arch/arm/plat-omap/include
7 7
8# Common support 8# Common support
9obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \ 9obj-y := id.o io.o control.o mux.o devices.o fb.o serial.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
@@ -113,7 +113,7 @@ obj-y += prm_common.o cm_common.o
113obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o 113obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
114obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o 114obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
115obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 115obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
116omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ 116omap-prcm-4-5-common = cminst44xx.o prm44xx.o \
117 prcm_mpu44xx.o prminst44xx.o \ 117 prcm_mpu44xx.o prminst44xx.o \
118 vc44xx_data.o vp44xx_data.o 118 vc44xx_data.o vp44xx_data.o
119obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) 119obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common)
@@ -246,7 +246,6 @@ obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
246obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o 246obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
247obj-$(CONFIG_MACH_OVERO) += board-overo.o 247obj-$(CONFIG_MACH_OVERO) += board-overo.o
248obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o 248obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o
249obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o
250obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o 249obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
251obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o sdram-nokia.o 250obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o sdram-nokia.o
252obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-peripherals.o 251obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-peripherals.o
@@ -260,8 +259,6 @@ obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
260obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o 259obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o
261 260
262obj-$(CONFIG_MACH_SBC3530) += board-omap3stalker.o 261obj-$(CONFIG_MACH_SBC3530) += board-omap3stalker.o
263obj-$(CONFIG_MACH_TI8168EVM) += board-ti8168evm.o
264obj-$(CONFIG_MACH_TI8148EVM) += board-ti8168evm.o
265 262
266# Platform specific device init code 263# Platform specific device init code
267 264
@@ -284,9 +281,6 @@ obj-y += $(onenand-m) $(onenand-y)
284nand-$(CONFIG_MTD_NAND_OMAP2) := gpmc-nand.o 281nand-$(CONFIG_MTD_NAND_OMAP2) := gpmc-nand.o
285obj-y += $(nand-m) $(nand-y) 282obj-y += $(nand-m) $(nand-y)
286 283
287smc91x-$(CONFIG_SMC91X) := gpmc-smc91x.o
288obj-y += $(smc91x-m) $(smc91x-y)
289
290smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o 284smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o
291obj-y += $(smsc911x-m) $(smsc911x-y) 285obj-y += $(smsc911x-m) $(smsc911x-y)
292ifneq ($(CONFIG_HWSPINLOCK_OMAP),) 286ifneq ($(CONFIG_HWSPINLOCK_OMAP),)
diff --git a/arch/arm/mach-omap2/am33xx-restart.c b/arch/arm/mach-omap2/am33xx-restart.c
index c88d8df753c2..5bace6a45ffb 100644
--- a/arch/arm/mach-omap2/am33xx-restart.c
+++ b/arch/arm/mach-omap2/am33xx-restart.c
@@ -9,8 +9,7 @@
9#include <linux/reboot.h> 9#include <linux/reboot.h>
10 10
11#include "common.h" 11#include "common.h"
12#include "prm-regbits-33xx.h" 12#include "prm.h"
13#include "prm33xx.h"
14 13
15/** 14/**
16 * am3xx_restart - trigger a software restart of the SoC 15 * am3xx_restart - trigger a software restart of the SoC
@@ -24,12 +23,5 @@ void am33xx_restart(enum reboot_mode mode, const char *cmd)
24{ 23{
25 /* TODO: Handle mode and cmd if necessary */ 24 /* TODO: Handle mode and cmd if necessary */
26 25
27 am33xx_prm_rmw_reg_bits(AM33XX_RST_GLOBAL_WARM_SW_MASK, 26 omap_prm_reset_system();
28 AM33XX_RST_GLOBAL_WARM_SW_MASK,
29 AM33XX_PRM_DEVICE_MOD,
30 AM33XX_PRM_RSTCTRL_OFFSET);
31
32 /* OCP barrier */
33 (void)am33xx_prm_read_reg(AM33XX_PRM_DEVICE_MOD,
34 AM33XX_PRM_RSTCTRL_OFFSET);
35} 27}
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
deleted file mode 100644
index d21a3048d06b..000000000000
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ /dev/null
@@ -1,632 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/board-3430sdp.c
3 *
4 * Copyright (C) 2007 Texas Instruments
5 *
6 * Modified from mach-omap2/board-generic.c
7 *
8 * Initial code: Syed Mohammed Khasim
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/delay.h>
19#include <linux/input.h>
20#include <linux/input/matrix_keypad.h>
21#include <linux/spi/spi.h>
22#include <linux/i2c/twl.h>
23#include <linux/regulator/machine.h>
24#include <linux/io.h>
25#include <linux/gpio.h>
26#include <linux/mmc/host.h>
27#include <linux/platform_data/spi-omap2-mcspi.h>
28#include <linux/platform_data/omap-twl4030.h>
29#include <linux/usb/phy.h>
30
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34
35#include "common.h"
36#include <linux/omap-dma.h>
37#include <video/omapdss.h>
38#include <video/omap-panel-data.h>
39
40#include "gpmc.h"
41#include "gpmc-smc91x.h"
42
43#include "soc.h"
44#include "board-flash.h"
45#include "mux.h"
46#include "sdram-qimonda-hyb18m512160af-6.h"
47#include "hsmmc.h"
48#include "pm.h"
49#include "control.h"
50#include "common-board-devices.h"
51
52#define CONFIG_DISABLE_HFCLK 1
53
54#define SDP3430_TS_GPIO_IRQ_SDPV1 3
55#define SDP3430_TS_GPIO_IRQ_SDPV2 2
56
57#define ENABLE_VAUX3_DEDICATED 0x03
58#define ENABLE_VAUX3_DEV_GRP 0x20
59
60#define TWL4030_MSECURE_GPIO 22
61
62static uint32_t board_keymap[] = {
63 KEY(0, 0, KEY_LEFT),
64 KEY(0, 1, KEY_RIGHT),
65 KEY(0, 2, KEY_A),
66 KEY(0, 3, KEY_B),
67 KEY(0, 4, KEY_C),
68 KEY(1, 0, KEY_DOWN),
69 KEY(1, 1, KEY_UP),
70 KEY(1, 2, KEY_E),
71 KEY(1, 3, KEY_F),
72 KEY(1, 4, KEY_G),
73 KEY(2, 0, KEY_ENTER),
74 KEY(2, 1, KEY_I),
75 KEY(2, 2, KEY_J),
76 KEY(2, 3, KEY_K),
77 KEY(2, 4, KEY_3),
78 KEY(3, 0, KEY_M),
79 KEY(3, 1, KEY_N),
80 KEY(3, 2, KEY_O),
81 KEY(3, 3, KEY_P),
82 KEY(3, 4, KEY_Q),
83 KEY(4, 0, KEY_R),
84 KEY(4, 1, KEY_4),
85 KEY(4, 2, KEY_T),
86 KEY(4, 3, KEY_U),
87 KEY(4, 4, KEY_D),
88 KEY(5, 0, KEY_V),
89 KEY(5, 1, KEY_W),
90 KEY(5, 2, KEY_L),
91 KEY(5, 3, KEY_S),
92 KEY(5, 4, KEY_H),
93 0
94};
95
96static struct matrix_keymap_data board_map_data = {
97 .keymap = board_keymap,
98 .keymap_size = ARRAY_SIZE(board_keymap),
99};
100
101static struct twl4030_keypad_data sdp3430_kp_data = {
102 .keymap_data = &board_map_data,
103 .rows = 5,
104 .cols = 6,
105 .rep = 1,
106};
107
108#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
109#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
110
111static void __init sdp3430_display_init(void)
112{
113 int r;
114
115 /*
116 * the backlight GPIO doesn't directly go to the panel, it enables
117 * an internal circuit on 3430sdp to create the signal V_BKL_28V,
118 * this is connected to LED+ pin of the sharp panel. This GPIO
119 * is left enabled in the board file, and not passed to the panel
120 * as platform_data.
121 */
122 r = gpio_request_one(SDP3430_LCD_PANEL_BACKLIGHT_GPIO,
123 GPIOF_OUT_INIT_HIGH, "LCD Backlight");
124 if (r)
125 pr_err("failed to get LCD Backlight GPIO\n");
126
127}
128
129static struct panel_sharp_ls037v7dw01_platform_data sdp3430_lcd_pdata = {
130 .name = "lcd",
131 .source = "dpi.0",
132
133 .data_lines = 16,
134
135 .resb_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO,
136 .ini_gpio = -1,
137 .mo_gpio = -1,
138 .lr_gpio = -1,
139 .ud_gpio = -1,
140};
141
142static struct platform_device sdp3430_lcd_device = {
143 .name = "panel-sharp-ls037v7dw01",
144 .id = 0,
145 .dev.platform_data = &sdp3430_lcd_pdata,
146};
147
148static struct connector_dvi_platform_data sdp3430_dvi_connector_pdata = {
149 .name = "dvi",
150 .source = "tfp410.0",
151 .i2c_bus_num = -1,
152};
153
154static struct platform_device sdp3430_dvi_connector_device = {
155 .name = "connector-dvi",
156 .id = 0,
157 .dev.platform_data = &sdp3430_dvi_connector_pdata,
158};
159
160static struct encoder_tfp410_platform_data sdp3430_tfp410_pdata = {
161 .name = "tfp410.0",
162 .source = "dpi.0",
163 .data_lines = 24,
164 .power_down_gpio = -1,
165};
166
167static struct platform_device sdp3430_tfp410_device = {
168 .name = "tfp410",
169 .id = 0,
170 .dev.platform_data = &sdp3430_tfp410_pdata,
171};
172
173static struct connector_atv_platform_data sdp3430_tv_pdata = {
174 .name = "tv",
175 .source = "venc.0",
176 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
177 .invert_polarity = false,
178};
179
180static struct platform_device sdp3430_tv_connector_device = {
181 .name = "connector-analog-tv",
182 .id = 0,
183 .dev.platform_data = &sdp3430_tv_pdata,
184};
185
186static struct omap_dss_board_info sdp3430_dss_data = {
187 .default_display_name = "lcd",
188};
189
190static struct omap2_hsmmc_info mmc[] = {
191 {
192 .mmc = 1,
193 /* 8 bits (default) requires S6.3 == ON,
194 * so the SIM card isn't used; else 4 bits.
195 */
196 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
197 .gpio_wp = 4,
198 .deferred = true,
199 },
200 {
201 .mmc = 2,
202 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
203 .gpio_wp = 7,
204 .deferred = true,
205 },
206 {} /* Terminator */
207};
208
209static struct omap_tw4030_pdata omap_twl4030_audio_data = {
210 .voice_connected = true,
211 .custom_routing = true,
212
213 .has_hs = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
214 .has_hf = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
215
216 .has_mainmic = true,
217 .has_submic = true,
218 .has_hsmic = true,
219 .has_linein = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
220};
221
222static int sdp3430_twl_gpio_setup(struct device *dev,
223 unsigned gpio, unsigned ngpio)
224{
225 /* gpio + 0 is "mmc0_cd" (input/IRQ),
226 * gpio + 1 is "mmc1_cd" (input/IRQ)
227 */
228 mmc[0].gpio_cd = gpio + 0;
229 mmc[1].gpio_cd = gpio + 1;
230 omap_hsmmc_late_init(mmc);
231
232 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
233 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
234
235 /* gpio + 15 is "sub_lcd_nRST" (output) */
236 gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
237
238 omap_twl4030_audio_data.jack_detect = gpio + 2;
239 omap_twl4030_audio_init("SDP3430", &omap_twl4030_audio_data);
240
241 return 0;
242}
243
244static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
245 .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13)
246 | BIT(16) | BIT(17),
247 .setup = sdp3430_twl_gpio_setup,
248};
249
250/* regulator consumer mappings */
251
252/* ads7846 on SPI */
253static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {
254 REGULATOR_SUPPLY("vcc", "spi1.0"),
255};
256
257static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
258 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
259};
260
261static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
262 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
263};
264
265static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
266 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
267};
268
269/*
270 * Apply all the fixed voltages since most versions of U-Boot
271 * don't bother with that initialization.
272 */
273
274/* VAUX1 for mainboard (irda and sub-lcd) */
275static struct regulator_init_data sdp3430_vaux1 = {
276 .constraints = {
277 .min_uV = 2800000,
278 .max_uV = 2800000,
279 .apply_uV = true,
280 .valid_modes_mask = REGULATOR_MODE_NORMAL
281 | REGULATOR_MODE_STANDBY,
282 .valid_ops_mask = REGULATOR_CHANGE_MODE
283 | REGULATOR_CHANGE_STATUS,
284 },
285};
286
287/* VAUX2 for camera module */
288static struct regulator_init_data sdp3430_vaux2 = {
289 .constraints = {
290 .min_uV = 2800000,
291 .max_uV = 2800000,
292 .apply_uV = true,
293 .valid_modes_mask = REGULATOR_MODE_NORMAL
294 | REGULATOR_MODE_STANDBY,
295 .valid_ops_mask = REGULATOR_CHANGE_MODE
296 | REGULATOR_CHANGE_STATUS,
297 },
298};
299
300/* VAUX3 for LCD board */
301static struct regulator_init_data sdp3430_vaux3 = {
302 .constraints = {
303 .min_uV = 2800000,
304 .max_uV = 2800000,
305 .apply_uV = true,
306 .valid_modes_mask = REGULATOR_MODE_NORMAL
307 | REGULATOR_MODE_STANDBY,
308 .valid_ops_mask = REGULATOR_CHANGE_MODE
309 | REGULATOR_CHANGE_STATUS,
310 },
311 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vaux3_supplies),
312 .consumer_supplies = sdp3430_vaux3_supplies,
313};
314
315/* VAUX4 for OMAP VDD_CSI2 (camera) */
316static struct regulator_init_data sdp3430_vaux4 = {
317 .constraints = {
318 .min_uV = 1800000,
319 .max_uV = 1800000,
320 .apply_uV = true,
321 .valid_modes_mask = REGULATOR_MODE_NORMAL
322 | REGULATOR_MODE_STANDBY,
323 .valid_ops_mask = REGULATOR_CHANGE_MODE
324 | REGULATOR_CHANGE_STATUS,
325 },
326};
327
328/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
329static struct regulator_init_data sdp3430_vmmc1 = {
330 .constraints = {
331 .min_uV = 1850000,
332 .max_uV = 3150000,
333 .valid_modes_mask = REGULATOR_MODE_NORMAL
334 | REGULATOR_MODE_STANDBY,
335 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
336 | REGULATOR_CHANGE_MODE
337 | REGULATOR_CHANGE_STATUS,
338 },
339 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc1_supplies),
340 .consumer_supplies = sdp3430_vmmc1_supplies,
341};
342
343/* VMMC2 for MMC2 card */
344static struct regulator_init_data sdp3430_vmmc2 = {
345 .constraints = {
346 .min_uV = 1850000,
347 .max_uV = 1850000,
348 .apply_uV = true,
349 .valid_modes_mask = REGULATOR_MODE_NORMAL
350 | REGULATOR_MODE_STANDBY,
351 .valid_ops_mask = REGULATOR_CHANGE_MODE
352 | REGULATOR_CHANGE_STATUS,
353 },
354 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc2_supplies),
355 .consumer_supplies = sdp3430_vmmc2_supplies,
356};
357
358/* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
359static struct regulator_init_data sdp3430_vsim = {
360 .constraints = {
361 .min_uV = 1800000,
362 .max_uV = 3000000,
363 .valid_modes_mask = REGULATOR_MODE_NORMAL
364 | REGULATOR_MODE_STANDBY,
365 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
366 | REGULATOR_CHANGE_MODE
367 | REGULATOR_CHANGE_STATUS,
368 },
369 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vsim_supplies),
370 .consumer_supplies = sdp3430_vsim_supplies,
371};
372
373static struct twl4030_platform_data sdp3430_twldata = {
374 /* platform_data for children goes here */
375 .gpio = &sdp3430_gpio_data,
376 .keypad = &sdp3430_kp_data,
377
378 .vaux1 = &sdp3430_vaux1,
379 .vaux2 = &sdp3430_vaux2,
380 .vaux3 = &sdp3430_vaux3,
381 .vaux4 = &sdp3430_vaux4,
382 .vmmc1 = &sdp3430_vmmc1,
383 .vmmc2 = &sdp3430_vmmc2,
384 .vsim = &sdp3430_vsim,
385};
386
387static int __init omap3430_i2c_init(void)
388{
389 /* i2c1 for PMIC only */
390 omap3_pmic_get_config(&sdp3430_twldata,
391 TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_BCI |
392 TWL_COMMON_PDATA_MADC | TWL_COMMON_PDATA_AUDIO,
393 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
394 sdp3430_twldata.vdac->constraints.apply_uV = true;
395 sdp3430_twldata.vpll2->constraints.apply_uV = true;
396 sdp3430_twldata.vpll2->constraints.name = "VDVI";
397
398 sdp3430_twldata.audio->codec->hs_extmute = 1;
399 sdp3430_twldata.audio->codec->hs_extmute_gpio = -EINVAL;
400
401 omap3_pmic_init("twl4030", &sdp3430_twldata);
402
403 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
404 omap_register_i2c_bus(2, 400, NULL, 0);
405 /* i2c3 on display connector (for DVI, tfp410) */
406 omap_register_i2c_bus(3, 400, NULL, 0);
407 return 0;
408}
409
410#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
411
412static struct omap_smc91x_platform_data board_smc91x_data = {
413 .cs = 3,
414 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
415 IORESOURCE_IRQ_LOWLEVEL,
416};
417
418static void __init board_smc91x_init(void)
419{
420 if (omap_rev() > OMAP3430_REV_ES1_0)
421 board_smc91x_data.gpio_irq = 6;
422 else
423 board_smc91x_data.gpio_irq = 29;
424
425 gpmc_smc91x_init(&board_smc91x_data);
426}
427
428#else
429
430static inline void board_smc91x_init(void)
431{
432}
433
434#endif
435
436static void enable_board_wakeup_source(void)
437{
438 /* T2 interrupt line (keypad) */
439 omap_mux_init_signal("sys_nirq",
440 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
441}
442
443static struct usbhs_phy_data phy_data[] __initdata = {
444 {
445 .port = 1,
446 .reset_gpio = 57,
447 .vcc_gpio = -EINVAL,
448 },
449 {
450 .port = 2,
451 .reset_gpio = 61,
452 .vcc_gpio = -EINVAL,
453 },
454};
455
456static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
457
458 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
459 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
460};
461
462#ifdef CONFIG_OMAP_MUX
463static struct omap_board_mux board_mux[] __initdata = {
464 { .reg_offset = OMAP_MUX_TERMINATOR },
465};
466#else
467#define board_mux NULL
468#endif
469
470/*
471 * SDP3430 V2 Board CS organization
472 * Different from SDP3430 V1. Now 4 switches used to specify CS
473 *
474 * See also the Switch S8 settings in the comments.
475 */
476static char chip_sel_3430[][GPMC_CS_NUM] = {
477 {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */
478 {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */
479 {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */
480};
481
482static struct mtd_partition sdp_nor_partitions[] = {
483 /* bootloader (U-Boot, etc) in first sector */
484 {
485 .name = "Bootloader-NOR",
486 .offset = 0,
487 .size = SZ_256K,
488 .mask_flags = MTD_WRITEABLE, /* force read-only */
489 },
490 /* bootloader params in the next sector */
491 {
492 .name = "Params-NOR",
493 .offset = MTDPART_OFS_APPEND,
494 .size = SZ_256K,
495 .mask_flags = 0,
496 },
497 /* kernel */
498 {
499 .name = "Kernel-NOR",
500 .offset = MTDPART_OFS_APPEND,
501 .size = SZ_2M,
502 .mask_flags = 0
503 },
504 /* file system */
505 {
506 .name = "Filesystem-NOR",
507 .offset = MTDPART_OFS_APPEND,
508 .size = MTDPART_SIZ_FULL,
509 .mask_flags = 0
510 }
511};
512
513static struct mtd_partition sdp_onenand_partitions[] = {
514 {
515 .name = "X-Loader-OneNAND",
516 .offset = 0,
517 .size = 4 * (64 * 2048),
518 .mask_flags = MTD_WRITEABLE /* force read-only */
519 },
520 {
521 .name = "U-Boot-OneNAND",
522 .offset = MTDPART_OFS_APPEND,
523 .size = 2 * (64 * 2048),
524 .mask_flags = MTD_WRITEABLE /* force read-only */
525 },
526 {
527 .name = "U-Boot Environment-OneNAND",
528 .offset = MTDPART_OFS_APPEND,
529 .size = 1 * (64 * 2048),
530 },
531 {
532 .name = "Kernel-OneNAND",
533 .offset = MTDPART_OFS_APPEND,
534 .size = 16 * (64 * 2048),
535 },
536 {
537 .name = "File System-OneNAND",
538 .offset = MTDPART_OFS_APPEND,
539 .size = MTDPART_SIZ_FULL,
540 },
541};
542
543static struct mtd_partition sdp_nand_partitions[] = {
544 /* All the partition sizes are listed in terms of NAND block size */
545 {
546 .name = "X-Loader-NAND",
547 .offset = 0,
548 .size = 4 * (64 * 2048),
549 .mask_flags = MTD_WRITEABLE, /* force read-only */
550 },
551 {
552 .name = "U-Boot-NAND",
553 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
554 .size = 10 * (64 * 2048),
555 .mask_flags = MTD_WRITEABLE, /* force read-only */
556 },
557 {
558 .name = "Boot Env-NAND",
559
560 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
561 .size = 6 * (64 * 2048),
562 },
563 {
564 .name = "Kernel-NAND",
565 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
566 .size = 40 * (64 * 2048),
567 },
568 {
569 .name = "File System - NAND",
570 .size = MTDPART_SIZ_FULL,
571 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
572 },
573};
574
575static struct flash_partitions sdp_flash_partitions[] = {
576 {
577 .parts = sdp_nor_partitions,
578 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
579 },
580 {
581 .parts = sdp_onenand_partitions,
582 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
583 },
584 {
585 .parts = sdp_nand_partitions,
586 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
587 },
588};
589
590static void __init omap_3430sdp_init(void)
591{
592 int gpio_pendown;
593
594 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
595 omap_hsmmc_init(mmc);
596 omap3430_i2c_init();
597 omap_display_init(&sdp3430_dss_data);
598 platform_device_register(&sdp3430_lcd_device);
599 platform_device_register(&sdp3430_tfp410_device);
600 platform_device_register(&sdp3430_dvi_connector_device);
601 platform_device_register(&sdp3430_tv_connector_device);
602
603 if (omap_rev() > OMAP3430_REV_ES1_0)
604 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
605 else
606 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
607 omap_ads7846_init(1, gpio_pendown, 310, NULL);
608 omap_serial_init();
609 omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
610 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
611 usb_musb_init(NULL);
612 board_smc91x_init();
613 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
614 sdp3430_display_init();
615 enable_board_wakeup_source();
616
617 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
618 usbhs_init(&usbhs_bdata);
619}
620
621MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
622 /* Maintainer: Syed Khasim - Texas Instruments Inc */
623 .atag_offset = 0x100,
624 .reserve = omap_reserve,
625 .map_io = omap3_map_io,
626 .init_early = omap3430_init_early,
627 .init_irq = omap3_init_irq,
628 .init_machine = omap_3430sdp_init,
629 .init_late = omap3430_init_late,
630 .init_time = omap3_sync32k_timer_init,
631 .restart = omap3xxx_restart,
632MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 212c3160de18..8168ddabaeda 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -24,6 +24,7 @@
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/nand.h> 25#include <linux/mtd/nand.h>
26#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
27#include <linux/omap-gpmc.h>
27 28
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index c6df8eec4553..91738a14ecbe 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -25,6 +25,7 @@
25#include <linux/input/matrix_keypad.h> 25#include <linux/input/matrix_keypad.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/omap-gpmc.h>
28#include <linux/platform_data/gpio-omap.h> 29#include <linux/platform_data/gpio-omap.h>
29 30
30#include <linux/platform_data/at24.h> 31#include <linux/platform_data/at24.h>
@@ -51,8 +52,6 @@
51#include "sdram-micron-mt46h32m32lf-6.h" 52#include "sdram-micron-mt46h32m32lf-6.h"
52#include "hsmmc.h" 53#include "hsmmc.h"
53#include "common-board-devices.h" 54#include "common-board-devices.h"
54#include "gpmc.h"
55#include "gpmc-nand.h"
56 55
57#define CM_T35_GPIO_PENDOWN 57 56#define CM_T35_GPIO_PENDOWN 57
58#define SB_T35_USB_HUB_RESET_GPIO 167 57#define SB_T35_USB_HUB_RESET_GPIO 167
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 8a2c1677964c..794756df8529 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -28,6 +28,7 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/leds.h> 30#include <linux/leds.h>
31#include <linux/omap-gpmc.h>
31#include <linux/rtc-v3020.h> 32#include <linux/rtc-v3020.h>
32#include <linux/mtd/mtd.h> 33#include <linux/mtd/mtd.h>
33#include <linux/mtd/nand.h> 34#include <linux/mtd/nand.h>
@@ -41,7 +42,6 @@
41 42
42#include "common.h" 43#include "common.h"
43#include <linux/platform_data/mtd-nand-omap2.h> 44#include <linux/platform_data/mtd-nand-omap2.h>
44#include "gpmc.h"
45 45
46#include "am35xx.h" 46#include "am35xx.h"
47 47
@@ -50,7 +50,6 @@
50#include "hsmmc.h" 50#include "hsmmc.h"
51#include "common-board-devices.h" 51#include "common-board-devices.h"
52#include "am35xx-emac.h" 52#include "am35xx-emac.h"
53#include "gpmc-nand.h"
54 53
55#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 54#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
56static struct gpio_led cm_t3517_leds[] = { 55static struct gpio_led cm_t3517_leds[] = {
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index 2d245c2e641c..70b21cc279ba 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/omap-gpmc.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/mtd/physmap.h> 18#include <linux/mtd/physmap.h>
18#include <linux/io.h> 19#include <linux/io.h>
@@ -23,8 +24,6 @@
23#include "soc.h" 24#include "soc.h"
24#include "common.h" 25#include "common.h"
25#include "board-flash.h" 26#include "board-flash.h"
26#include "gpmc-onenand.h"
27#include "gpmc-nand.h"
28 27
29#define REG_FPGA_REV 0x10 28#define REG_FPGA_REV 0x10
30#define REG_FPGA_DIP_SWITCH_INPUT2 0x60 29#define REG_FPGA_DIP_SWITCH_INPUT2 0x60
diff --git a/arch/arm/mach-omap2/board-flash.h b/arch/arm/mach-omap2/board-flash.h
index 2fb5d41a9fae..ea9aaebe11e7 100644
--- a/arch/arm/mach-omap2/board-flash.h
+++ b/arch/arm/mach-omap2/board-flash.h
@@ -12,7 +12,6 @@
12 */ 12 */
13#include <linux/mtd/mtd.h> 13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
15#include "gpmc.h"
16 15
17#define PDC_NOR 1 16#define PDC_NOR 1
18#define PDC_NAND 2 17#define PDC_NAND 2
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 97767a27ca9d..b6443a4e0c78 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -21,8 +21,9 @@
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
23#include <linux/usb/musb.h> 23#include <linux/usb/musb.h>
24#include <linux/mmc/host.h>
24#include <linux/platform_data/spi-omap2-mcspi.h> 25#include <linux/platform_data/spi-omap2-mcspi.h>
25#include <linux/platform_data/mtd-onenand-omap2.h> 26#include <linux/platform_data/mmc-omap.h>
26#include <linux/mfd/menelaus.h> 27#include <linux/mfd/menelaus.h>
27#include <sound/tlv320aic3x.h> 28#include <sound/tlv320aic3x.h>
28 29
@@ -32,7 +33,6 @@
32#include "common.h" 33#include "common.h"
33#include "mmc.h" 34#include "mmc.h"
34#include "soc.h" 35#include "soc.h"
35#include "gpmc-onenand.h"
36#include "common-board-devices.h" 36#include "common-board-devices.h"
37 37
38#define TUSB6010_ASYNC_CS 1 38#define TUSB6010_ASYNC_CS 1
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index f32201656cf3..7f1708738c30 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -24,6 +24,7 @@
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
26#include <linux/i2c/twl.h> 26#include <linux/i2c/twl.h>
27#include <linux/omap-gpmc.h>
27#include <linux/wl12xx.h> 28#include <linux/wl12xx.h>
28#include <linux/mtd/partitions.h> 29#include <linux/mtd/partitions.h>
29#include <linux/mtd/nand.h> 30#include <linux/mtd/nand.h>
@@ -51,7 +52,6 @@
51#include "sdram-micron-mt46h32m32lf-6.h" 52#include "sdram-micron-mt46h32m32lf-6.h"
52#include "hsmmc.h" 53#include "hsmmc.h"
53#include "common-board-devices.h" 54#include "common-board-devices.h"
54#include "gpmc-nand.h"
55 55
56#define PANDORA_WIFI_IRQ_GPIO 21 56#define PANDORA_WIFI_IRQ_GPIO 21
57#define PANDORA_WIFI_NRESET_GPIO 23 57#define PANDORA_WIFI_NRESET_GPIO 23
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index ddfc8df83c6a..14edcd7a2a1d 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -23,6 +23,8 @@
23#include <linux/regulator/machine.h> 23#include <linux/regulator/machine.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
26#include <linux/gpio/machine.h>
27#include <linux/omap-gpmc.h>
26#include <linux/mmc/host.h> 28#include <linux/mmc/host.h>
27#include <linux/power/isp1704_charger.h> 29#include <linux/power/isp1704_charger.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 30#include <linux/platform_data/spi-omap2-mcspi.h>
@@ -32,13 +34,11 @@
32 34
33#include "common.h" 35#include "common.h"
34#include <linux/omap-dma.h> 36#include <linux/omap-dma.h>
35#include "gpmc-smc91x.h"
36 37
37#include "board-rx51.h" 38#include "board-rx51.h"
38 39
39#include <sound/tlv320aic3x.h> 40#include <sound/tlv320aic3x.h>
40#include <sound/tpa6130a2-plat.h> 41#include <sound/tpa6130a2-plat.h>
41#include <media/radio-si4713.h>
42#include <media/si4713.h> 42#include <media/si4713.h>
43#include <linux/platform_data/leds-lp55xx.h> 43#include <linux/platform_data/leds-lp55xx.h>
44 44
@@ -55,8 +55,6 @@
55#include "omap-pm.h" 55#include "omap-pm.h"
56#include "hsmmc.h" 56#include "hsmmc.h"
57#include "common-board-devices.h" 57#include "common-board-devices.h"
58#include "gpmc.h"
59#include "gpmc-onenand.h"
60#include "soc.h" 58#include "soc.h"
61#include "omap-secure.h" 59#include "omap-secure.h"
62 60
@@ -484,7 +482,7 @@ static struct omap_mux_partition *partition;
484 * Current flows to eMMC when eMMC is off and the data lines are pulled up, 482 * Current flows to eMMC when eMMC is off and the data lines are pulled up,
485 * so pull them down. N.B. we pull 8 lines because we are using 8 lines. 483 * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
486 */ 484 */
487static void rx51_mmc2_remux(struct device *dev, int slot, int power_on) 485static void rx51_mmc2_remux(struct device *dev, int power_on)
488{ 486{
489 if (power_on) 487 if (power_on)
490 omap_mux_write_array(partition, rx51_mmc2_on_mux); 488 omap_mux_write_array(partition, rx51_mmc2_on_mux);
@@ -500,7 +498,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
500 .cover_only = true, 498 .cover_only = true,
501 .gpio_cd = 160, 499 .gpio_cd = 160,
502 .gpio_wp = -EINVAL, 500 .gpio_wp = -EINVAL,
503 .power_saving = true,
504 }, 501 },
505 { 502 {
506 .name = "internal", 503 .name = "internal",
@@ -510,7 +507,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
510 .gpio_cd = -EINVAL, 507 .gpio_cd = -EINVAL,
511 .gpio_wp = -EINVAL, 508 .gpio_wp = -EINVAL,
512 .nonremovable = true, 509 .nonremovable = true,
513 .power_saving = true,
514 .remux = rx51_mmc2_remux, 510 .remux = rx51_mmc2_remux,
515 }, 511 },
516 {} /* Terminator */ 512 {} /* Terminator */
@@ -760,46 +756,17 @@ static struct regulator_init_data rx51_vintdig = {
760 }, 756 },
761}; 757};
762 758
763static const char * const si4713_supply_names[] = { 759static struct gpiod_lookup_table rx51_fmtx_gpios_table = {
764 "vio", 760 .dev_id = "2-0063",
765 "vdd", 761 .table = {
766}; 762 GPIO_LOOKUP("gpio.6", 3, "reset", GPIO_ACTIVE_HIGH), /* 163 */
767 763 { },
768static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
769 .supplies = ARRAY_SIZE(si4713_supply_names),
770 .supply_names = si4713_supply_names,
771 .gpio_reset = RX51_FMTX_RESET_GPIO,
772};
773
774static struct i2c_board_info rx51_si4713_board_info __initdata_or_module = {
775 I2C_BOARD_INFO("si4713", SI4713_I2C_ADDR_BUSEN_HIGH),
776 .platform_data = &rx51_si4713_i2c_data,
777};
778
779static struct radio_si4713_platform_data rx51_si4713_data __initdata_or_module = {
780 .i2c_bus = 2,
781 .subdev_board_info = &rx51_si4713_board_info,
782};
783
784static struct platform_device rx51_si4713_dev __initdata_or_module = {
785 .name = "radio-si4713",
786 .id = -1,
787 .dev = {
788 .platform_data = &rx51_si4713_data,
789 }, 764 },
790}; 765};
791 766
792static __init void rx51_init_si4713(void) 767static __init void rx51_gpio_init(void)
793{ 768{
794 int err; 769 gpiod_add_lookup_table(&rx51_fmtx_gpios_table);
795
796 err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
797 if (err) {
798 printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
799 return;
800 }
801 rx51_si4713_board_info.irq = gpio_to_irq(RX51_FMTX_IRQ);
802 platform_device_register(&rx51_si4713_dev);
803} 770}
804 771
805static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) 772static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
@@ -1029,7 +996,19 @@ static struct aic3x_pdata rx51_aic3x_data2 = {
1029 .gpio_reset = 60, 996 .gpio_reset = 60,
1030}; 997};
1031 998
999#if IS_ENABLED(CONFIG_I2C_SI4713) && IS_ENABLED(CONFIG_PLATFORM_SI4713)
1000static struct si4713_platform_data rx51_si4713_platform_data = {
1001 .is_platform_device = true
1002};
1003#endif
1004
1032static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = { 1005static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
1006#if IS_ENABLED(CONFIG_I2C_SI4713) && IS_ENABLED(CONFIG_PLATFORM_SI4713)
1007 {
1008 I2C_BOARD_INFO("si4713", 0x63),
1009 .platform_data = &rx51_si4713_platform_data,
1010 },
1011#endif
1033 { 1012 {
1034 I2C_BOARD_INFO("tlv320aic3x", 0x18), 1013 I2C_BOARD_INFO("tlv320aic3x", 0x18),
1035 .platform_data = &rx51_aic3x_data, 1014 .platform_data = &rx51_aic3x_data,
@@ -1070,6 +1049,10 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_3[] = {
1070 1049
1071static int __init rx51_i2c_init(void) 1050static int __init rx51_i2c_init(void)
1072{ 1051{
1052#if IS_ENABLED(CONFIG_I2C_SI4713) && IS_ENABLED(CONFIG_PLATFORM_SI4713)
1053 int err;
1054#endif
1055
1073 if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) || 1056 if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
1074 system_rev >= SYSTEM_REV_B_USES_VAUX3) { 1057 system_rev >= SYSTEM_REV_B_USES_VAUX3) {
1075 rx51_twldata.vaux3 = &rx51_vaux3_mmc; 1058 rx51_twldata.vaux3 = &rx51_vaux3_mmc;
@@ -1087,6 +1070,14 @@ static int __init rx51_i2c_init(void)
1087 rx51_twldata.vdac->constraints.name = "VDAC"; 1070 rx51_twldata.vdac->constraints.name = "VDAC";
1088 1071
1089 omap_pmic_init(1, 2200, "twl5030", 7 + OMAP_INTC_START, &rx51_twldata); 1072 omap_pmic_init(1, 2200, "twl5030", 7 + OMAP_INTC_START, &rx51_twldata);
1073#if IS_ENABLED(CONFIG_I2C_SI4713) && IS_ENABLED(CONFIG_PLATFORM_SI4713)
1074 err = gpio_request_one(RX51_FMTX_IRQ, GPIOF_DIR_IN, "si4713 irq");
1075 if (err) {
1076 printk(KERN_ERR "Cannot request si4713 irq gpio. %d\n", err);
1077 return err;
1078 }
1079 rx51_peripherals_i2c_board_info_2[0].irq = gpio_to_irq(RX51_FMTX_IRQ);
1080#endif
1090 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, 1081 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
1091 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); 1082 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
1092#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE) 1083#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
@@ -1146,33 +1137,6 @@ static struct omap_onenand_platform_data board_onenand_data[] = {
1146}; 1137};
1147#endif 1138#endif
1148 1139
1149#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1150
1151static struct omap_smc91x_platform_data board_smc91x_data = {
1152 .cs = 1,
1153 .gpio_irq = 54,
1154 .gpio_pwrdwn = 86,
1155 .gpio_reset = 164,
1156 .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL,
1157};
1158
1159static void __init board_smc91x_init(void)
1160{
1161 omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN);
1162 omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
1163 omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
1164
1165 gpmc_smc91x_init(&board_smc91x_data);
1166}
1167
1168#else
1169
1170static inline void board_smc91x_init(void)
1171{
1172}
1173
1174#endif
1175
1176static struct gpio rx51_wl1251_gpios[] __initdata = { 1140static struct gpio rx51_wl1251_gpios[] __initdata = {
1177 { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" }, 1141 { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" },
1178}; 1142};
@@ -1300,14 +1264,13 @@ static void __init rx51_init_omap3_rom_rng(void)
1300 1264
1301void __init rx51_peripherals_init(void) 1265void __init rx51_peripherals_init(void)
1302{ 1266{
1267 rx51_gpio_init();
1303 rx51_i2c_init(); 1268 rx51_i2c_init();
1304 regulator_has_full_constraints(); 1269 regulator_has_full_constraints();
1305 gpmc_onenand_init(board_onenand_data); 1270 gpmc_onenand_init(board_onenand_data);
1306 board_smc91x_init();
1307 rx51_add_gpio_keys(); 1271 rx51_add_gpio_keys();
1308 rx51_init_wl1251(); 1272 rx51_init_wl1251();
1309 rx51_init_tsc2005(); 1273 rx51_init_tsc2005();
1310 rx51_init_si4713();
1311 rx51_init_lirc(); 1274 rx51_init_lirc();
1312 spi_register_board_info(rx51_peripherals_spi_board_info, 1275 spi_register_board_info(rx51_peripherals_spi_board_info,
1313 ARRAY_SIZE(rx51_peripherals_spi_board_info)); 1276 ARRAY_SIZE(rx51_peripherals_spi_board_info));
diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
deleted file mode 100644
index 6273c286e1d8..000000000000
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Code for TI8168/TI8148 EVM.
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
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#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/usb/musb.h>
19
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/map.h>
23
24#include "common.h"
25
26static struct omap_musb_board_data musb_board_data = {
27 .set_phy_power = ti81xx_musb_phy_power,
28 .interface_type = MUSB_INTERFACE_ULPI,
29 .mode = MUSB_OTG,
30 .power = 500,
31};
32
33static void __init ti81xx_evm_init(void)
34{
35 omap_serial_init();
36 omap_sdrc_init(NULL, NULL);
37 usb_musb_init(&musb_board_data);
38}
39
40MACHINE_START(TI8168EVM, "ti8168evm")
41 /* Maintainer: Texas Instruments */
42 .atag_offset = 0x100,
43 .map_io = ti81xx_map_io,
44 .init_early = ti81xx_init_early,
45 .init_irq = ti81xx_init_irq,
46 .init_time = omap3_sync32k_timer_init,
47 .init_machine = ti81xx_evm_init,
48 .init_late = ti81xx_init_late,
49 .restart = omap44xx_restart,
50MACHINE_END
51
52MACHINE_START(TI8148EVM, "ti8148evm")
53 /* Maintainer: Texas Instruments */
54 .atag_offset = 0x100,
55 .map_io = ti81xx_map_io,
56 .init_early = ti81xx_init_early,
57 .init_irq = ti81xx_init_irq,
58 .init_time = omap3_sync32k_timer_init,
59 .init_machine = ti81xx_evm_init,
60 .init_late = ti81xx_init_late,
61 .restart = omap44xx_restart,
62MACHINE_END
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index eb8c75ec3b1a..5c5ebb4db5f7 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -257,6 +257,9 @@ static const struct clk_ops dpll1_ck_ops = {
257 .get_parent = &omap2_init_dpll_parent, 257 .get_parent = &omap2_init_dpll_parent,
258 .recalc_rate = &omap3_dpll_recalc, 258 .recalc_rate = &omap3_dpll_recalc,
259 .set_rate = &omap3_noncore_dpll_set_rate, 259 .set_rate = &omap3_noncore_dpll_set_rate,
260 .set_parent = &omap3_noncore_dpll_set_parent,
261 .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent,
262 .determine_rate = &omap3_noncore_dpll_determine_rate,
260 .round_rate = &omap2_dpll_round_rate, 263 .round_rate = &omap2_dpll_round_rate,
261}; 264};
262 265
@@ -367,6 +370,9 @@ static const struct clk_ops dpll4_ck_ops = {
367 .get_parent = &omap2_init_dpll_parent, 370 .get_parent = &omap2_init_dpll_parent,
368 .recalc_rate = &omap3_dpll_recalc, 371 .recalc_rate = &omap3_dpll_recalc,
369 .set_rate = &omap3_dpll4_set_rate, 372 .set_rate = &omap3_dpll4_set_rate,
373 .set_parent = &omap3_noncore_dpll_set_parent,
374 .set_rate_and_parent = &omap3_dpll4_set_rate_and_parent,
375 .determine_rate = &omap3_noncore_dpll_determine_rate,
370 .round_rate = &omap2_dpll_round_rate, 376 .round_rate = &omap2_dpll_round_rate,
371}; 377};
372 378
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 500530d1364a..6ad5b4dbd33e 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -171,7 +171,8 @@ static void _omap2_module_wait_ready(struct clk_hw_omap *clk)
171 _wait_idlest_generic(clk, idlest_reg, (1 << idlest_bit), 171 _wait_idlest_generic(clk, idlest_reg, (1 << idlest_bit),
172 idlest_val, __clk_get_name(clk->hw.clk)); 172 idlest_val, __clk_get_name(clk->hw.clk));
173 } else { 173 } else {
174 cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit); 174 omap_cm_wait_module_ready(0, prcm_mod, idlest_reg_id,
175 idlest_bit);
175 }; 176 };
176} 177}
177 178
@@ -771,4 +772,8 @@ void __init ti_clk_init_features(void)
771 ti_clk_features.cm_idlest_val = OMAP24XX_CM_IDLEST_VAL; 772 ti_clk_features.cm_idlest_val = OMAP24XX_CM_IDLEST_VAL;
772 else if (cpu_is_omap34xx()) 773 else if (cpu_is_omap34xx())
773 ti_clk_features.cm_idlest_val = OMAP34XX_CM_IDLEST_VAL; 774 ti_clk_features.cm_idlest_val = OMAP34XX_CM_IDLEST_VAL;
775
776 /* On OMAP3430 ES1.0, DPLL4 can't be re-programmed */
777 if (omap_rev() == OMAP3430_REV_ES1_0)
778 ti_clk_features.flags |= TI_CLK_DPLL4_DENY_REPROGRAM;
774} 779}
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 4592a2762592..641337c6cde9 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -234,6 +234,7 @@ struct ti_clk_features {
234}; 234};
235 235
236#define TI_CLK_DPLL_HAS_FREQSEL (1 << 0) 236#define TI_CLK_DPLL_HAS_FREQSEL (1 << 0)
237#define TI_CLK_DPLL4_DENY_REPROGRAM (1 << 1)
237 238
238extern struct ti_clk_features ti_clk_features; 239extern struct ti_clk_features ti_clk_features;
239 240
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index 0b02b4161d71..a9e86db5daf9 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -38,6 +38,18 @@
38 38
39/* needed by omap3_core_dpll_m2_set_rate() */ 39/* needed by omap3_core_dpll_m2_set_rate() */
40struct clk *sdrc_ick_p, *arm_fck_p; 40struct clk *sdrc_ick_p, *arm_fck_p;
41
42/**
43 * omap3_dpll4_set_rate - set rate for omap3 per-dpll
44 * @hw: clock to change
45 * @rate: target rate for clock
46 * @parent_rate: rate of the parent clock
47 *
48 * Check if the current SoC supports the per-dpll reprogram operation
49 * or not, and then do the rate change if supported. Returns -EINVAL
50 * if not supported, 0 for success, and potential error codes from the
51 * clock rate change.
52 */
41int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate, 53int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
42 unsigned long parent_rate) 54 unsigned long parent_rate)
43{ 55{
@@ -46,7 +58,7 @@ int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
46 * on 3430ES1 prevents us from changing DPLL multipliers or dividers 58 * on 3430ES1 prevents us from changing DPLL multipliers or dividers
47 * on DPLL4. 59 * on DPLL4.
48 */ 60 */
49 if (omap_rev() == OMAP3430_REV_ES1_0) { 61 if (ti_clk_features.flags & TI_CLK_DPLL4_DENY_REPROGRAM) {
50 pr_err("clock: DPLL4 cannot change rate due to silicon 'Limitation 2.5' on 3430ES1.\n"); 62 pr_err("clock: DPLL4 cannot change rate due to silicon 'Limitation 2.5' on 3430ES1.\n");
51 return -EINVAL; 63 return -EINVAL;
52 } 64 }
@@ -54,6 +66,30 @@ int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
54 return omap3_noncore_dpll_set_rate(hw, rate, parent_rate); 66 return omap3_noncore_dpll_set_rate(hw, rate, parent_rate);
55} 67}
56 68
69/**
70 * omap3_dpll4_set_rate_and_parent - set rate and parent for omap3 per-dpll
71 * @hw: clock to change
72 * @rate: target rate for clock
73 * @parent_rate: rate of the parent clock
74 * @index: parent index, 0 - reference clock, 1 - bypass clock
75 *
76 * Check if the current SoC support the per-dpll reprogram operation
77 * or not, and then do the rate + parent change if supported. Returns
78 * -EINVAL if not supported, 0 for success, and potential error codes
79 * from the clock rate change.
80 */
81int omap3_dpll4_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
82 unsigned long parent_rate, u8 index)
83{
84 if (ti_clk_features.flags & TI_CLK_DPLL4_DENY_REPROGRAM) {
85 pr_err("clock: DPLL4 cannot change rate due to silicon 'Limitation 2.5' on 3430ES1.\n");
86 return -EINVAL;
87 }
88
89 return omap3_noncore_dpll_set_rate_and_parent(hw, rate, parent_rate,
90 index);
91}
92
57void __init omap3_clk_lock_dpll5(void) 93void __init omap3_clk_lock_dpll5(void)
58{ 94{
59 struct clk *dpll5_clk; 95 struct clk *dpll5_clk;
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index 93473f9a551c..6222e87a79b6 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -45,17 +45,29 @@ extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
45 * struct cm_ll_data - fn ptrs to per-SoC CM function implementations 45 * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
46 * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl 46 * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
47 * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl 47 * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
48 * @wait_module_idle: ptr to the SoC CM-specific wait_module_idle impl
49 * @module_enable: ptr to the SoC CM-specific module_enable impl
50 * @module_disable: ptr to the SoC CM-specific module_disable impl
48 */ 51 */
49struct cm_ll_data { 52struct cm_ll_data {
50 int (*split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst, 53 int (*split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst,
51 u8 *idlest_reg_id); 54 u8 *idlest_reg_id);
52 int (*wait_module_ready)(s16 prcm_mod, u8 idlest_id, u8 idlest_shift); 55 int (*wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg,
56 u8 idlest_shift);
57 int (*wait_module_idle)(u8 part, s16 prcm_mod, u16 idlest_reg,
58 u8 idlest_shift);
59 void (*module_enable)(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
60 void (*module_disable)(u8 part, u16 inst, u16 clkctrl_offs);
53}; 61};
54 62
55extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, 63extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
56 u8 *idlest_reg_id); 64 u8 *idlest_reg_id);
57extern int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift); 65int omap_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_reg,
58 66 u8 idlest_shift);
67int omap_cm_wait_module_idle(u8 part, s16 prcm_mod, u16 idlest_reg,
68 u8 idlest_shift);
69int omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
70int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);
59extern int cm_register(struct cm_ll_data *cld); 71extern int cm_register(struct cm_ll_data *cld);
60extern int cm_unregister(struct cm_ll_data *cld); 72extern int cm_unregister(struct cm_ll_data *cld);
61 73
diff --git a/arch/arm/mach-omap2/cm1_44xx.h b/arch/arm/mach-omap2/cm1_44xx.h
index 5ae8fe39d6ee..a5949927b661 100644
--- a/arch/arm/mach-omap2/cm1_44xx.h
+++ b/arch/arm/mach-omap2/cm1_44xx.h
@@ -25,8 +25,6 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_CM1_44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_CM1_44XX_H
26#define __ARCH_ARM_MACH_OMAP2_CM1_44XX_H 26#define __ARCH_ARM_MACH_OMAP2_CM1_44XX_H
27 27
28#include "cm_44xx_54xx.h"
29
30/* CM1 base address */ 28/* CM1 base address */
31#define OMAP4430_CM1_BASE 0x4a004000 29#define OMAP4430_CM1_BASE 0x4a004000
32 30
diff --git a/arch/arm/mach-omap2/cm1_54xx.h b/arch/arm/mach-omap2/cm1_54xx.h
index 90b3348e6672..fd245dfa7391 100644
--- a/arch/arm/mach-omap2/cm1_54xx.h
+++ b/arch/arm/mach-omap2/cm1_54xx.h
@@ -22,8 +22,6 @@
22#ifndef __ARCH_ARM_MACH_OMAP2_CM1_54XX_H 22#ifndef __ARCH_ARM_MACH_OMAP2_CM1_54XX_H
23#define __ARCH_ARM_MACH_OMAP2_CM1_54XX_H 23#define __ARCH_ARM_MACH_OMAP2_CM1_54XX_H
24 24
25#include "cm_44xx_54xx.h"
26
27/* CM1 base address */ 25/* CM1 base address */
28#define OMAP54XX_CM_CORE_AON_BASE 0x4a004000 26#define OMAP54XX_CM_CORE_AON_BASE 0x4a004000
29 27
diff --git a/arch/arm/mach-omap2/cm1_7xx.h b/arch/arm/mach-omap2/cm1_7xx.h
index ca6fa1febaac..2f1c09eea021 100644
--- a/arch/arm/mach-omap2/cm1_7xx.h
+++ b/arch/arm/mach-omap2/cm1_7xx.h
@@ -23,8 +23,6 @@
23#ifndef __ARCH_ARM_MACH_OMAP2_CM1_7XX_H 23#ifndef __ARCH_ARM_MACH_OMAP2_CM1_7XX_H
24#define __ARCH_ARM_MACH_OMAP2_CM1_7XX_H 24#define __ARCH_ARM_MACH_OMAP2_CM1_7XX_H
25 25
26#include "cm_44xx_54xx.h"
27
28/* CM1 base address */ 26/* CM1 base address */
29#define DRA7XX_CM_CORE_AON_BASE 0x4a005000 27#define DRA7XX_CM_CORE_AON_BASE 0x4a005000
30 28
diff --git a/arch/arm/mach-omap2/cm2_44xx.h b/arch/arm/mach-omap2/cm2_44xx.h
index ee5136d7cdda..7521abf3d830 100644
--- a/arch/arm/mach-omap2/cm2_44xx.h
+++ b/arch/arm/mach-omap2/cm2_44xx.h
@@ -25,8 +25,6 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_CM2_44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_CM2_44XX_H
26#define __ARCH_ARM_MACH_OMAP2_CM2_44XX_H 26#define __ARCH_ARM_MACH_OMAP2_CM2_44XX_H
27 27
28#include "cm_44xx_54xx.h"
29
30/* CM2 base address */ 28/* CM2 base address */
31#define OMAP4430_CM2_BASE 0x4a008000 29#define OMAP4430_CM2_BASE 0x4a008000
32 30
diff --git a/arch/arm/mach-omap2/cm2_54xx.h b/arch/arm/mach-omap2/cm2_54xx.h
index 2683231b299b..ff4040c196d8 100644
--- a/arch/arm/mach-omap2/cm2_54xx.h
+++ b/arch/arm/mach-omap2/cm2_54xx.h
@@ -21,8 +21,6 @@
21#ifndef __ARCH_ARM_MACH_OMAP2_CM2_54XX_H 21#ifndef __ARCH_ARM_MACH_OMAP2_CM2_54XX_H
22#define __ARCH_ARM_MACH_OMAP2_CM2_54XX_H 22#define __ARCH_ARM_MACH_OMAP2_CM2_54XX_H
23 23
24#include "cm_44xx_54xx.h"
25
26/* CM2 base address */ 24/* CM2 base address */
27#define OMAP54XX_CM_CORE_BASE 0x4a008000 25#define OMAP54XX_CM_CORE_BASE 0x4a008000
28 26
diff --git a/arch/arm/mach-omap2/cm2_7xx.h b/arch/arm/mach-omap2/cm2_7xx.h
index e966e3a3c931..ce63fdb68056 100644
--- a/arch/arm/mach-omap2/cm2_7xx.h
+++ b/arch/arm/mach-omap2/cm2_7xx.h
@@ -22,8 +22,6 @@
22#ifndef __ARCH_ARM_MACH_OMAP2_CM2_7XX_H 22#ifndef __ARCH_ARM_MACH_OMAP2_CM2_7XX_H
23#define __ARCH_ARM_MACH_OMAP2_CM2_7XX_H 23#define __ARCH_ARM_MACH_OMAP2_CM2_7XX_H
24 24
25#include "cm_44xx_54xx.h"
26
27/* CM2 base address */ 25/* CM2 base address */
28#define DRA7XX_CM_CORE_BASE 0x4a008000 26#define DRA7XX_CM_CORE_BASE 0x4a008000
29 27
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index 8be6ea50c092..a96d901b1d5d 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -53,7 +53,7 @@ static void _write_clktrctrl(u8 c, s16 module, u32 mask)
53 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL); 53 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
54} 54}
55 55
56bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask) 56static bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
57{ 57{
58 u32 v; 58 u32 v;
59 59
@@ -64,12 +64,12 @@ bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
64 return (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0; 64 return (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
65} 65}
66 66
67void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) 67static void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
68{ 68{
69 _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask); 69 _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
70} 70}
71 71
72void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask) 72static void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
73{ 73{
74 _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask); 74 _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
75} 75}
@@ -150,7 +150,7 @@ static int _omap2xxx_apll_enable(u8 enable_bit, u8 status_bit)
150 v |= m; 150 v |= m;
151 omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN); 151 omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
152 152
153 omap2xxx_cm_wait_module_ready(PLL_MOD, 1, status_bit); 153 omap2xxx_cm_wait_module_ready(0, PLL_MOD, 1, status_bit);
154 154
155 /* 155 /*
156 * REVISIT: Should we return an error code if 156 * REVISIT: Should we return an error code if
@@ -204,8 +204,9 @@ void omap2xxx_cm_apll96_disable(void)
204 * XXX This function is only needed until absolute register addresses are 204 * XXX This function is only needed until absolute register addresses are
205 * removed from the OMAP struct clk records. 205 * removed from the OMAP struct clk records.
206 */ 206 */
207int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, 207static int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
208 u8 *idlest_reg_id) 208 s16 *prcm_inst,
209 u8 *idlest_reg_id)
209{ 210{
210 unsigned long offs; 211 unsigned long offs;
211 u8 idlest_offs; 212 u8 idlest_offs;
@@ -238,6 +239,7 @@ int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
238 239
239/** 240/**
240 * omap2xxx_cm_wait_module_ready - wait for a module to leave idle or standby 241 * omap2xxx_cm_wait_module_ready - wait for a module to leave idle or standby
242 * @part: PRCM partition, ignored for OMAP2
241 * @prcm_mod: PRCM module offset 243 * @prcm_mod: PRCM module offset
242 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) 244 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
243 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check 245 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
@@ -246,7 +248,8 @@ int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
246 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon 248 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
247 * success or -EBUSY if the module doesn't enable in time. 249 * success or -EBUSY if the module doesn't enable in time.
248 */ 250 */
249int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) 251int omap2xxx_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_id,
252 u8 idlest_shift)
250{ 253{
251 int ena = 0, i = 0; 254 int ena = 0, i = 0;
252 u8 cm_idlest_reg; 255 u8 cm_idlest_reg;
diff --git a/arch/arm/mach-omap2/cm2xxx.h b/arch/arm/mach-omap2/cm2xxx.h
index 891d81c3c8f4..c89502b168ae 100644
--- a/arch/arm/mach-omap2/cm2xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx.h
@@ -46,9 +46,6 @@
46 46
47#ifndef __ASSEMBLER__ 47#ifndef __ASSEMBLER__
48 48
49extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
50extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
51
52extern void omap2xxx_cm_set_dpll_disable_autoidle(void); 49extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
53extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void); 50extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
54 51
@@ -57,11 +54,8 @@ extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
57extern void omap2xxx_cm_set_apll96_disable_autoidle(void); 54extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
58extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void); 55extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
59 56
60extern bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask); 57int omap2xxx_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_id,
61extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, 58 u8 idlest_shift);
62 u8 idlest_shift);
63extern int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
64 s16 *prcm_inst, u8 *idlest_reg_id);
65extern int omap2xxx_cm_fclks_active(void); 59extern int omap2xxx_cm_fclks_active(void);
66extern int omap2xxx_cm_mpu_retention_allowed(void); 60extern int omap2xxx_cm_mpu_retention_allowed(void);
67extern u32 omap2xxx_cm_get_core_clk_src(void); 61extern u32 omap2xxx_cm_get_core_clk_src(void);
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index b3f99e93def0..b9ad463a368a 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -96,13 +96,12 @@ static inline u32 am33xx_cm_read_reg_bits(u16 inst, s16 idx, u32 mask)
96/** 96/**
97 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield 97 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield
98 * @inst: CM instance register offset (*_INST macro) 98 * @inst: CM instance register offset (*_INST macro)
99 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
100 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 99 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
101 * 100 *
102 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to 101 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
103 * bit 0. 102 * bit 0.
104 */ 103 */
105static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 clkctrl_offs) 104static u32 _clkctrl_idlest(u16 inst, u16 clkctrl_offs)
106{ 105{
107 u32 v = am33xx_cm_read_reg(inst, clkctrl_offs); 106 u32 v = am33xx_cm_read_reg(inst, clkctrl_offs);
108 v &= AM33XX_IDLEST_MASK; 107 v &= AM33XX_IDLEST_MASK;
@@ -113,17 +112,16 @@ static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 clkctrl_offs)
113/** 112/**
114 * _is_module_ready - can module registers be accessed without causing an abort? 113 * _is_module_ready - can module registers be accessed without causing an abort?
115 * @inst: CM instance register offset (*_INST macro) 114 * @inst: CM instance register offset (*_INST macro)
116 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
117 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 115 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
118 * 116 *
119 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either 117 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
120 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise. 118 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
121 */ 119 */
122static bool _is_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs) 120static bool _is_module_ready(u16 inst, u16 clkctrl_offs)
123{ 121{
124 u32 v; 122 u32 v;
125 123
126 v = _clkctrl_idlest(inst, cdoffs, clkctrl_offs); 124 v = _clkctrl_idlest(inst, clkctrl_offs);
127 125
128 return (v == CLKCTRL_IDLEST_FUNCTIONAL || 126 return (v == CLKCTRL_IDLEST_FUNCTIONAL ||
129 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false; 127 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false;
@@ -158,7 +156,7 @@ static void _clktrctrl_write(u8 c, u16 inst, u16 cdoffs)
158 * Returns true if the clockdomain referred to by (@inst, @cdoffs) 156 * Returns true if the clockdomain referred to by (@inst, @cdoffs)
159 * is in hardware-supervised idle mode, or 0 otherwise. 157 * is in hardware-supervised idle mode, or 0 otherwise.
160 */ 158 */
161bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs) 159static bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs)
162{ 160{
163 u32 v; 161 u32 v;
164 162
@@ -177,7 +175,7 @@ bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs)
177 * Put a clockdomain referred to by (@inst, @cdoffs) into 175 * Put a clockdomain referred to by (@inst, @cdoffs) into
178 * hardware-supervised idle mode. No return value. 176 * hardware-supervised idle mode. No return value.
179 */ 177 */
180void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs) 178static void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs)
181{ 179{
182 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs); 180 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs);
183} 181}
@@ -191,7 +189,7 @@ void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs)
191 * software-supervised idle mode, i.e., controlled manually by the 189 * software-supervised idle mode, i.e., controlled manually by the
192 * Linux OMAP clockdomain code. No return value. 190 * Linux OMAP clockdomain code. No return value.
193 */ 191 */
194void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs) 192static void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs)
195{ 193{
196 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs); 194 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs);
197} 195}
@@ -204,7 +202,7 @@ void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs)
204 * Put a clockdomain referred to by (@inst, @cdoffs) into idle 202 * Put a clockdomain referred to by (@inst, @cdoffs) into idle
205 * No return value. 203 * No return value.
206 */ 204 */
207void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs) 205static void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs)
208{ 206{
209 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs); 207 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs);
210} 208}
@@ -217,7 +215,7 @@ void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs)
217 * Take a clockdomain referred to by (@inst, @cdoffs) out of idle, 215 * Take a clockdomain referred to by (@inst, @cdoffs) out of idle,
218 * waking it up. No return value. 216 * waking it up. No return value.
219 */ 217 */
220void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs) 218static void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs)
221{ 219{
222 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, inst, cdoffs); 220 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, inst, cdoffs);
223} 221}
@@ -228,20 +226,22 @@ void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs)
228 226
229/** 227/**
230 * am33xx_cm_wait_module_ready - wait for a module to be in 'func' state 228 * am33xx_cm_wait_module_ready - wait for a module to be in 'func' state
229 * @part: PRCM partition, ignored for AM33xx
231 * @inst: CM instance register offset (*_INST macro) 230 * @inst: CM instance register offset (*_INST macro)
232 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
233 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 231 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
232 * @bit_shift: bit shift for the register, ignored for AM33xx
234 * 233 *
235 * Wait for the module IDLEST to be functional. If the idle state is in any 234 * Wait for the module IDLEST to be functional. If the idle state is in any
236 * the non functional state (trans, idle or disabled), module and thus the 235 * the non functional state (trans, idle or disabled), module and thus the
237 * sysconfig cannot be accessed and will probably lead to an "imprecise 236 * sysconfig cannot be accessed and will probably lead to an "imprecise
238 * external abort" 237 * external abort"
239 */ 238 */
240int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs) 239static int am33xx_cm_wait_module_ready(u8 part, s16 inst, u16 clkctrl_offs,
240 u8 bit_shift)
241{ 241{
242 int i = 0; 242 int i = 0;
243 243
244 omap_test_timeout(_is_module_ready(inst, cdoffs, clkctrl_offs), 244 omap_test_timeout(_is_module_ready(inst, clkctrl_offs),
245 MAX_MODULE_READY_TIME, i); 245 MAX_MODULE_READY_TIME, i);
246 246
247 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 247 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
@@ -250,22 +250,24 @@ int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs)
250/** 250/**
251 * am33xx_cm_wait_module_idle - wait for a module to be in 'disabled' 251 * am33xx_cm_wait_module_idle - wait for a module to be in 'disabled'
252 * state 252 * state
253 * @part: CM partition, ignored for AM33xx
253 * @inst: CM instance register offset (*_INST macro) 254 * @inst: CM instance register offset (*_INST macro)
254 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
255 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 255 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
256 * @bit_shift: bit shift for the register, ignored for AM33xx
256 * 257 *
257 * Wait for the module IDLEST to be disabled. Some PRCM transition, 258 * Wait for the module IDLEST to be disabled. Some PRCM transition,
258 * like reset assertion or parent clock de-activation must wait the 259 * like reset assertion or parent clock de-activation must wait the
259 * module to be fully disabled. 260 * module to be fully disabled.
260 */ 261 */
261int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, u16 clkctrl_offs) 262static int am33xx_cm_wait_module_idle(u8 part, s16 inst, u16 clkctrl_offs,
263 u8 bit_shift)
262{ 264{
263 int i = 0; 265 int i = 0;
264 266
265 if (!clkctrl_offs) 267 if (!clkctrl_offs)
266 return 0; 268 return 0;
267 269
268 omap_test_timeout((_clkctrl_idlest(inst, cdoffs, clkctrl_offs) == 270 omap_test_timeout((_clkctrl_idlest(inst, clkctrl_offs) ==
269 CLKCTRL_IDLEST_DISABLED), 271 CLKCTRL_IDLEST_DISABLED),
270 MAX_MODULE_READY_TIME, i); 272 MAX_MODULE_READY_TIME, i);
271 273
@@ -275,13 +277,14 @@ int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, u16 clkctrl_offs)
275/** 277/**
276 * am33xx_cm_module_enable - Enable the modulemode inside CLKCTRL 278 * am33xx_cm_module_enable - Enable the modulemode inside CLKCTRL
277 * @mode: Module mode (SW or HW) 279 * @mode: Module mode (SW or HW)
280 * @part: CM partition, ignored for AM33xx
278 * @inst: CM instance register offset (*_INST macro) 281 * @inst: CM instance register offset (*_INST macro)
279 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
280 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 282 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
281 * 283 *
282 * No return value. 284 * No return value.
283 */ 285 */
284void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, u16 clkctrl_offs) 286static void am33xx_cm_module_enable(u8 mode, u8 part, u16 inst,
287 u16 clkctrl_offs)
285{ 288{
286 u32 v; 289 u32 v;
287 290
@@ -293,13 +296,13 @@ void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, u16 clkctrl_offs)
293 296
294/** 297/**
295 * am33xx_cm_module_disable - Disable the module inside CLKCTRL 298 * am33xx_cm_module_disable - Disable the module inside CLKCTRL
299 * @part: CM partition, ignored for AM33xx
296 * @inst: CM instance register offset (*_INST macro) 300 * @inst: CM instance register offset (*_INST macro)
297 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
298 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 301 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
299 * 302 *
300 * No return value. 303 * No return value.
301 */ 304 */
302void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs) 305static void am33xx_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs)
303{ 306{
304 u32 v; 307 u32 v;
305 308
@@ -362,3 +365,21 @@ struct clkdm_ops am33xx_clkdm_operations = {
362 .clkdm_clk_enable = am33xx_clkdm_clk_enable, 365 .clkdm_clk_enable = am33xx_clkdm_clk_enable,
363 .clkdm_clk_disable = am33xx_clkdm_clk_disable, 366 .clkdm_clk_disable = am33xx_clkdm_clk_disable,
364}; 367};
368
369static struct cm_ll_data am33xx_cm_ll_data = {
370 .wait_module_ready = &am33xx_cm_wait_module_ready,
371 .wait_module_idle = &am33xx_cm_wait_module_idle,
372 .module_enable = &am33xx_cm_module_enable,
373 .module_disable = &am33xx_cm_module_disable,
374};
375
376int __init am33xx_cm_init(void)
377{
378 return cm_register(&am33xx_cm_ll_data);
379}
380
381static void __exit am33xx_cm_exit(void)
382{
383 cm_unregister(&am33xx_cm_ll_data);
384}
385__exitcall(am33xx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index bd2441790779..046b4b2bc9d9 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -374,41 +374,6 @@
374 374
375 375
376#ifndef __ASSEMBLER__ 376#ifndef __ASSEMBLER__
377bool am33xx_cm_is_clkdm_in_hwsup(u16 inst, u16 cdoffs); 377int am33xx_cm_init(void);
378void am33xx_cm_clkdm_enable_hwsup(u16 inst, u16 cdoffs);
379void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs);
380void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
381void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
382
383#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
384extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
385 u16 clkctrl_offs);
386extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
387 u16 clkctrl_offs);
388extern void am33xx_cm_module_disable(u16 inst, s16 cdoffs,
389 u16 clkctrl_offs);
390extern int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs,
391 u16 clkctrl_offs);
392#else
393static inline int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
394 u16 clkctrl_offs)
395{
396 return 0;
397}
398static inline void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
399 u16 clkctrl_offs)
400{
401}
402static inline void am33xx_cm_module_disable(u16 inst, s16 cdoffs,
403 u16 clkctrl_offs)
404{
405}
406static inline int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs,
407 u16 clkctrl_offs)
408{
409 return 0;
410}
411#endif
412
413#endif /* ASSEMBLER */ 378#endif /* ASSEMBLER */
414#endif 379#endif
diff --git a/arch/arm/mach-omap2/cm3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 129a4e7f6ef5..ebead8f035f9 100644
--- a/arch/arm/mach-omap2/cm3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -42,7 +42,7 @@ static void _write_clktrctrl(u8 c, s16 module, u32 mask)
42 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL); 42 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
43} 43}
44 44
45bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask) 45static bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
46{ 46{
47 u32 v; 47 u32 v;
48 48
@@ -53,22 +53,22 @@ bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
53 return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0; 53 return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
54} 54}
55 55
56void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) 56static void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
57{ 57{
58 _write_clktrctrl(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, module, mask); 58 _write_clktrctrl(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
59} 59}
60 60
61void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask) 61static void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
62{ 62{
63 _write_clktrctrl(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, module, mask); 63 _write_clktrctrl(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
64} 64}
65 65
66void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask) 66static void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask)
67{ 67{
68 _write_clktrctrl(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, module, mask); 68 _write_clktrctrl(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, module, mask);
69} 69}
70 70
71void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask) 71static void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
72{ 72{
73 _write_clktrctrl(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, module, mask); 73 _write_clktrctrl(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, module, mask);
74} 74}
@@ -79,6 +79,7 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
79 79
80/** 80/**
81 * omap3xxx_cm_wait_module_ready - wait for a module to leave idle or standby 81 * omap3xxx_cm_wait_module_ready - wait for a module to leave idle or standby
82 * @part: PRCM partition, ignored for OMAP3
82 * @prcm_mod: PRCM module offset 83 * @prcm_mod: PRCM module offset
83 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) 84 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
84 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check 85 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
@@ -87,7 +88,8 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
87 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon 88 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
88 * success or -EBUSY if the module doesn't enable in time. 89 * success or -EBUSY if the module doesn't enable in time.
89 */ 90 */
90int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) 91static int omap3xxx_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_id,
92 u8 idlest_shift)
91{ 93{
92 int ena = 0, i = 0; 94 int ena = 0, i = 0;
93 u8 cm_idlest_reg; 95 u8 cm_idlest_reg;
@@ -116,8 +118,9 @@ int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
116 * XXX This function is only needed until absolute register addresses are 118 * XXX This function is only needed until absolute register addresses are
117 * removed from the OMAP struct clk records. 119 * removed from the OMAP struct clk records.
118 */ 120 */
119int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, 121static int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
120 u8 *idlest_reg_id) 122 s16 *prcm_inst,
123 u8 *idlest_reg_id)
121{ 124{
122 unsigned long offs; 125 unsigned long offs;
123 u8 idlest_offs; 126 u8 idlest_offs;
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
index 7a16b5598127..734a8581c0c4 100644
--- a/arch/arm/mach-omap2/cm3xxx.h
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -68,18 +68,6 @@
68 68
69#ifndef __ASSEMBLER__ 69#ifndef __ASSEMBLER__
70 70
71extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
72extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
73extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
74extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
75
76extern bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
77extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
78 u8 idlest_shift);
79
80extern int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
81 s16 *prcm_inst, u8 *idlest_reg_id);
82
83extern void omap3_cm_save_context(void); 71extern void omap3_cm_save_context(void);
84extern void omap3_cm_restore_context(void); 72extern void omap3_cm_restore_context(void);
85extern void omap3_cm_save_scratchpad_contents(u32 *ptr); 73extern void omap3_cm_save_scratchpad_contents(u32 *ptr);
diff --git a/arch/arm/mach-omap2/cm44xx.c b/arch/arm/mach-omap2/cm44xx.c
deleted file mode 100644
index fe5cc7bae489..000000000000
--- a/arch/arm/mach-omap2/cm44xx.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * OMAP4 CM1, CM2 module low-level functions
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 * Paul Walmsley
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 * These functions are intended to be used only by the cminst44xx.c file.
12 * XXX Perhaps we should just move them there and make them static.
13 */
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/io.h>
20
21#include "cm.h"
22#include "cm1_44xx.h"
23#include "cm2_44xx.h"
24
25/* CM1 hardware module low-level functions */
26
27/* Read a register in CM1 */
28u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg)
29{
30 return readl_relaxed(cm_base + inst + reg);
31}
32
33/* Write into a register in CM1 */
34void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg)
35{
36 writel_relaxed(val, cm_base + inst + reg);
37}
38
39/* Read a register in CM2 */
40u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg)
41{
42 return readl_relaxed(cm2_base + inst + reg);
43}
44
45/* Write into a register in CM2 */
46void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg)
47{
48 writel_relaxed(val, cm2_base + inst + reg);
49}
diff --git a/arch/arm/mach-omap2/cm44xx.h b/arch/arm/mach-omap2/cm44xx.h
index 3380beeace6e..728d06a4af19 100644
--- a/arch/arm/mach-omap2/cm44xx.h
+++ b/arch/arm/mach-omap2/cm44xx.h
@@ -23,4 +23,7 @@
23#define OMAP4_CM_CLKSTCTRL 0x0000 23#define OMAP4_CM_CLKSTCTRL 0x0000
24#define OMAP4_CM_STATICDEP 0x0004 24#define OMAP4_CM_STATICDEP 0x0004
25 25
26void omap_cm_base_init(void);
27int omap4_cm_init(void);
28
26#endif 29#endif
diff --git a/arch/arm/mach-omap2/cm_44xx_54xx.h b/arch/arm/mach-omap2/cm_44xx_54xx.h
deleted file mode 100644
index cbb211690321..000000000000
--- a/arch/arm/mach-omap2/cm_44xx_54xx.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * OMAP44xx and OMAP54xx CM1/CM2 function prototypes
3 *
4 * Copyright (C) 2009-2013 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 *
21 */
22
23#ifndef __ARCH_ARM_MACH_OMAP2_CM_44XX_54XX_H
24#define __ARCH_ARM_MACH_OMAP2_CM_44XX_55XX_H
25
26/* CM1 Function prototypes */
27extern u32 omap4_cm1_read_inst_reg(s16 inst, u16 idx);
28extern void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 idx);
29extern u32 omap4_cm1_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
30
31/* CM2 Function prototypes */
32extern u32 omap4_cm2_read_inst_reg(s16 inst, u16 idx);
33extern void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 idx);
34extern u32 omap4_cm2_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
35
36#endif
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 8f6c4710877e..8fe02fcedc48 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -72,9 +72,10 @@ int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
72} 72}
73 73
74/** 74/**
75 * cm_wait_module_ready - wait for a module to leave idle or standby 75 * omap_cm_wait_module_ready - wait for a module to leave idle or standby
76 * @part: PRCM partition
76 * @prcm_mod: PRCM module offset 77 * @prcm_mod: PRCM module offset
77 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) 78 * @idlest_reg: CM_IDLESTx register
78 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check 79 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
79 * 80 *
80 * Wait for the PRCM to indicate that the module identified by 81 * Wait for the PRCM to indicate that the module identified by
@@ -83,7 +84,8 @@ int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
83 * no per-SoC wait_module_ready() function pointer has been registered 84 * no per-SoC wait_module_ready() function pointer has been registered
84 * or if the idlest register is unknown on the SoC. 85 * or if the idlest register is unknown on the SoC.
85 */ 86 */
86int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) 87int omap_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_reg,
88 u8 idlest_shift)
87{ 89{
88 if (!cm_ll_data->wait_module_ready) { 90 if (!cm_ll_data->wait_module_ready) {
89 WARN_ONCE(1, "cm: %s: no low-level function defined\n", 91 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
@@ -91,7 +93,79 @@ int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
91 return -EINVAL; 93 return -EINVAL;
92 } 94 }
93 95
94 return cm_ll_data->wait_module_ready(prcm_mod, idlest_id, idlest_shift); 96 return cm_ll_data->wait_module_ready(part, prcm_mod, idlest_reg,
97 idlest_shift);
98}
99
100/**
101 * omap_cm_wait_module_idle - wait for a module to enter idle or standby
102 * @part: PRCM partition
103 * @prcm_mod: PRCM module offset
104 * @idlest_reg: CM_IDLESTx register
105 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
106 *
107 * Wait for the PRCM to indicate that the module identified by
108 * (@prcm_mod, @idlest_id, @idlest_shift) is no longer clocked. Return
109 * 0 upon success, -EBUSY if the module doesn't enable in time, or
110 * -EINVAL if no per-SoC wait_module_idle() function pointer has been
111 * registered or if the idlest register is unknown on the SoC.
112 */
113int omap_cm_wait_module_idle(u8 part, s16 prcm_mod, u16 idlest_reg,
114 u8 idlest_shift)
115{
116 if (!cm_ll_data->wait_module_idle) {
117 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
118 __func__);
119 return -EINVAL;
120 }
121
122 return cm_ll_data->wait_module_idle(part, prcm_mod, idlest_reg,
123 idlest_shift);
124}
125
126/**
127 * omap_cm_module_enable - enable a module
128 * @mode: target mode for the module
129 * @part: PRCM partition
130 * @inst: PRCM instance
131 * @clkctrl_offs: CM_CLKCTRL register offset for the module
132 *
133 * Enables clocks for a module identified by (@part, @inst, @clkctrl_offs)
134 * making its IO space accessible. Return 0 upon success, -EINVAL if no
135 * per-SoC module_enable() function pointer has been registered.
136 */
137int omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs)
138{
139 if (!cm_ll_data->module_enable) {
140 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
141 __func__);
142 return -EINVAL;
143 }
144
145 cm_ll_data->module_enable(mode, part, inst, clkctrl_offs);
146 return 0;
147}
148
149/**
150 * omap_cm_module_disable - disable a module
151 * @part: PRCM partition
152 * @inst: PRCM instance
153 * @clkctrl_offs: CM_CLKCTRL register offset for the module
154 *
155 * Disables clocks for a module identified by (@part, @inst, @clkctrl_offs)
156 * makings its IO space inaccessible. Return 0 upon success, -EINVAL if
157 * no per-SoC module_disable() function pointer has been registered.
158 */
159int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs)
160{
161 if (!cm_ll_data->module_disable) {
162 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
163 __func__);
164 return -EINVAL;
165 }
166
167 cm_ll_data->module_disable(part, inst, clkctrl_offs);
168 return 0;
95} 169}
96 170
97/** 171/**
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 12aca56942c0..95a8cff66aff 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -26,7 +26,6 @@
26#include "cm1_44xx.h" 26#include "cm1_44xx.h"
27#include "cm2_44xx.h" 27#include "cm2_44xx.h"
28#include "cm44xx.h" 28#include "cm44xx.h"
29#include "cminst44xx.h"
30#include "cm-regbits-34xx.h" 29#include "cm-regbits-34xx.h"
31#include "prcm44xx.h" 30#include "prcm44xx.h"
32#include "prm44xx.h" 31#include "prm44xx.h"
@@ -74,17 +73,18 @@ void omap_cm_base_init(void)
74 73
75/* Private functions */ 74/* Private functions */
76 75
76static u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx);
77
77/** 78/**
78 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield 79 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield
79 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 80 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
80 * @inst: CM instance register offset (*_INST macro) 81 * @inst: CM instance register offset (*_INST macro)
81 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
82 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 82 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
83 * 83 *
84 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to 84 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
85 * bit 0. 85 * bit 0.
86 */ 86 */
87static u32 _clkctrl_idlest(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs) 87static u32 _clkctrl_idlest(u8 part, u16 inst, u16 clkctrl_offs)
88{ 88{
89 u32 v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs); 89 u32 v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs);
90 v &= OMAP4430_IDLEST_MASK; 90 v &= OMAP4430_IDLEST_MASK;
@@ -96,26 +96,23 @@ static u32 _clkctrl_idlest(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs)
96 * _is_module_ready - can module registers be accessed without causing an abort? 96 * _is_module_ready - can module registers be accessed without causing an abort?
97 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 97 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
98 * @inst: CM instance register offset (*_INST macro) 98 * @inst: CM instance register offset (*_INST macro)
99 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
100 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 99 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
101 * 100 *
102 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either 101 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
103 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise. 102 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
104 */ 103 */
105static bool _is_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs) 104static bool _is_module_ready(u8 part, u16 inst, u16 clkctrl_offs)
106{ 105{
107 u32 v; 106 u32 v;
108 107
109 v = _clkctrl_idlest(part, inst, cdoffs, clkctrl_offs); 108 v = _clkctrl_idlest(part, inst, clkctrl_offs);
110 109
111 return (v == CLKCTRL_IDLEST_FUNCTIONAL || 110 return (v == CLKCTRL_IDLEST_FUNCTIONAL ||
112 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false; 111 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false;
113} 112}
114 113
115/* Public functions */
116
117/* Read a register in a CM instance */ 114/* Read a register in a CM instance */
118u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx) 115static u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx)
119{ 116{
120 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 117 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
121 part == OMAP4430_INVALID_PRCM_PARTITION || 118 part == OMAP4430_INVALID_PRCM_PARTITION ||
@@ -124,7 +121,7 @@ u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx)
124} 121}
125 122
126/* Write into a register in a CM instance */ 123/* Write into a register in a CM instance */
127void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx) 124static void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx)
128{ 125{
129 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 126 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
130 part == OMAP4430_INVALID_PRCM_PARTITION || 127 part == OMAP4430_INVALID_PRCM_PARTITION ||
@@ -133,8 +130,8 @@ void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx)
133} 130}
134 131
135/* Read-modify-write a register in CM1. Caller must lock */ 132/* Read-modify-write a register in CM1. Caller must lock */
136u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, u16 inst, 133static u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, u16 inst,
137 s16 idx) 134 s16 idx)
138{ 135{
139 u32 v; 136 u32 v;
140 137
@@ -146,17 +143,18 @@ u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, u16 inst,
146 return v; 143 return v;
147} 144}
148 145
149u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, u16 inst, s16 idx) 146static u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, u16 inst, s16 idx)
150{ 147{
151 return omap4_cminst_rmw_inst_reg_bits(bits, bits, part, inst, idx); 148 return omap4_cminst_rmw_inst_reg_bits(bits, bits, part, inst, idx);
152} 149}
153 150
154u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, u16 inst, s16 idx) 151static u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, u16 inst,
152 s16 idx)
155{ 153{
156 return omap4_cminst_rmw_inst_reg_bits(bits, 0x0, part, inst, idx); 154 return omap4_cminst_rmw_inst_reg_bits(bits, 0x0, part, inst, idx);
157} 155}
158 156
159u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, u32 mask) 157static u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, u32 mask)
160{ 158{
161 u32 v; 159 u32 v;
162 160
@@ -200,7 +198,7 @@ static void _clktrctrl_write(u8 c, u8 part, u16 inst, u16 cdoffs)
200 * Returns true if the clockdomain referred to by (@part, @inst, @cdoffs) 198 * Returns true if the clockdomain referred to by (@part, @inst, @cdoffs)
201 * is in hardware-supervised idle mode, or 0 otherwise. 199 * is in hardware-supervised idle mode, or 0 otherwise.
202 */ 200 */
203bool omap4_cminst_is_clkdm_in_hwsup(u8 part, u16 inst, u16 cdoffs) 201static bool omap4_cminst_is_clkdm_in_hwsup(u8 part, u16 inst, u16 cdoffs)
204{ 202{
205 u32 v; 203 u32 v;
206 204
@@ -220,7 +218,7 @@ bool omap4_cminst_is_clkdm_in_hwsup(u8 part, u16 inst, u16 cdoffs)
220 * Put a clockdomain referred to by (@part, @inst, @cdoffs) into 218 * Put a clockdomain referred to by (@part, @inst, @cdoffs) into
221 * hardware-supervised idle mode. No return value. 219 * hardware-supervised idle mode. No return value.
222 */ 220 */
223void omap4_cminst_clkdm_enable_hwsup(u8 part, u16 inst, u16 cdoffs) 221static void omap4_cminst_clkdm_enable_hwsup(u8 part, u16 inst, u16 cdoffs)
224{ 222{
225 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, part, inst, cdoffs); 223 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, part, inst, cdoffs);
226} 224}
@@ -235,7 +233,7 @@ void omap4_cminst_clkdm_enable_hwsup(u8 part, u16 inst, u16 cdoffs)
235 * software-supervised idle mode, i.e., controlled manually by the 233 * software-supervised idle mode, i.e., controlled manually by the
236 * Linux OMAP clockdomain code. No return value. 234 * Linux OMAP clockdomain code. No return value.
237 */ 235 */
238void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs) 236static void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs)
239{ 237{
240 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, part, inst, cdoffs); 238 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, part, inst, cdoffs);
241} 239}
@@ -249,7 +247,7 @@ void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs)
249 * Take a clockdomain referred to by (@part, @inst, @cdoffs) out of idle, 247 * Take a clockdomain referred to by (@part, @inst, @cdoffs) out of idle,
250 * waking it up. No return value. 248 * waking it up. No return value.
251 */ 249 */
252void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs) 250static void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs)
253{ 251{
254 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, part, inst, cdoffs); 252 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, part, inst, cdoffs);
255} 253}
@@ -258,7 +256,7 @@ void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs)
258 * 256 *
259 */ 257 */
260 258
261void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs) 259static void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs)
262{ 260{
263 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, part, inst, cdoffs); 261 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, part, inst, cdoffs);
264} 262}
@@ -267,23 +265,23 @@ void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs)
267 * omap4_cminst_wait_module_ready - wait for a module to be in 'func' state 265 * omap4_cminst_wait_module_ready - wait for a module to be in 'func' state
268 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 266 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
269 * @inst: CM instance register offset (*_INST macro) 267 * @inst: CM instance register offset (*_INST macro)
270 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
271 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 268 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
269 * @bit_shift: bit shift for the register, ignored for OMAP4+
272 * 270 *
273 * Wait for the module IDLEST to be functional. If the idle state is in any 271 * Wait for the module IDLEST to be functional. If the idle state is in any
274 * the non functional state (trans, idle or disabled), module and thus the 272 * the non functional state (trans, idle or disabled), module and thus the
275 * sysconfig cannot be accessed and will probably lead to an "imprecise 273 * sysconfig cannot be accessed and will probably lead to an "imprecise
276 * external abort" 274 * external abort"
277 */ 275 */
278int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, 276static int omap4_cminst_wait_module_ready(u8 part, s16 inst, u16 clkctrl_offs,
279 u16 clkctrl_offs) 277 u8 bit_shift)
280{ 278{
281 int i = 0; 279 int i = 0;
282 280
283 if (!clkctrl_offs) 281 if (!clkctrl_offs)
284 return 0; 282 return 0;
285 283
286 omap_test_timeout(_is_module_ready(part, inst, cdoffs, clkctrl_offs), 284 omap_test_timeout(_is_module_ready(part, inst, clkctrl_offs),
287 MAX_MODULE_READY_TIME, i); 285 MAX_MODULE_READY_TIME, i);
288 286
289 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 287 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
@@ -294,21 +292,22 @@ int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs,
294 * state 292 * state
295 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 293 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
296 * @inst: CM instance register offset (*_INST macro) 294 * @inst: CM instance register offset (*_INST macro)
297 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
298 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 295 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
296 * @bit_shift: Bit shift for the register, ignored for OMAP4+
299 * 297 *
300 * Wait for the module IDLEST to be disabled. Some PRCM transition, 298 * Wait for the module IDLEST to be disabled. Some PRCM transition,
301 * like reset assertion or parent clock de-activation must wait the 299 * like reset assertion or parent clock de-activation must wait the
302 * module to be fully disabled. 300 * module to be fully disabled.
303 */ 301 */
304int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs) 302static int omap4_cminst_wait_module_idle(u8 part, s16 inst, u16 clkctrl_offs,
303 u8 bit_shift)
305{ 304{
306 int i = 0; 305 int i = 0;
307 306
308 if (!clkctrl_offs) 307 if (!clkctrl_offs)
309 return 0; 308 return 0;
310 309
311 omap_test_timeout((_clkctrl_idlest(part, inst, cdoffs, clkctrl_offs) == 310 omap_test_timeout((_clkctrl_idlest(part, inst, clkctrl_offs) ==
312 CLKCTRL_IDLEST_DISABLED), 311 CLKCTRL_IDLEST_DISABLED),
313 MAX_MODULE_DISABLE_TIME, i); 312 MAX_MODULE_DISABLE_TIME, i);
314 313
@@ -320,13 +319,12 @@ int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_off
320 * @mode: Module mode (SW or HW) 319 * @mode: Module mode (SW or HW)
321 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 320 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
322 * @inst: CM instance register offset (*_INST macro) 321 * @inst: CM instance register offset (*_INST macro)
323 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
324 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 322 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
325 * 323 *
326 * No return value. 324 * No return value.
327 */ 325 */
328void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs, 326static void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
329 u16 clkctrl_offs) 327 u16 clkctrl_offs)
330{ 328{
331 u32 v; 329 u32 v;
332 330
@@ -340,13 +338,11 @@ void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
340 * omap4_cminst_module_disable - Disable the module inside CLKCTRL 338 * omap4_cminst_module_disable - Disable the module inside CLKCTRL
341 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 339 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
342 * @inst: CM instance register offset (*_INST macro) 340 * @inst: CM instance register offset (*_INST macro)
343 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
344 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 341 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
345 * 342 *
346 * No return value. 343 * No return value.
347 */ 344 */
348void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs, 345static void omap4_cminst_module_disable(u8 part, u16 inst, u16 clkctrl_offs)
349 u16 clkctrl_offs)
350{ 346{
351 u32 v; 347 u32 v;
352 348
@@ -510,3 +506,21 @@ struct clkdm_ops am43xx_clkdm_operations = {
510 .clkdm_clk_enable = omap4_clkdm_clk_enable, 506 .clkdm_clk_enable = omap4_clkdm_clk_enable,
511 .clkdm_clk_disable = omap4_clkdm_clk_disable, 507 .clkdm_clk_disable = omap4_clkdm_clk_disable,
512}; 508};
509
510static struct cm_ll_data omap4xxx_cm_ll_data = {
511 .wait_module_ready = &omap4_cminst_wait_module_ready,
512 .wait_module_idle = &omap4_cminst_wait_module_idle,
513 .module_enable = &omap4_cminst_module_enable,
514 .module_disable = &omap4_cminst_module_disable,
515};
516
517int __init omap4_cm_init(void)
518{
519 return cm_register(&omap4xxx_cm_ll_data);
520}
521
522static void __exit omap4_cm_exit(void)
523{
524 cm_unregister(&omap4xxx_cm_ll_data);
525}
526__exitcall(omap4_cm_exit);
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
deleted file mode 100644
index 7f56ea444bc4..000000000000
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * OMAP4 Clock Management (CM) function prototypes
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
12#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
13
14bool omap4_cminst_is_clkdm_in_hwsup(u8 part, u16 inst, u16 cdoffs);
15void omap4_cminst_clkdm_enable_hwsup(u8 part, u16 inst, u16 cdoffs);
16void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs);
17void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs);
18void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs);
19extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);
20extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
21 u16 clkctrl_offs);
22extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
23 u16 clkctrl_offs);
24extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
25 u16 clkctrl_offs);
26/*
27 * In an ideal world, we would not export these low-level functions,
28 * but this will probably take some time to fix properly
29 */
30u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx);
31void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx);
32u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
33 u16 inst, s16 idx);
34u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, u16 inst,
35 s16 idx);
36u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, u16 inst,
37 s16 idx);
38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
39 u32 mask);
40
41extern void omap_cm_base_init(void);
42
43#endif
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index e18709d3b95d..aa7b379e2661 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -265,7 +265,6 @@ static struct cpuidle_driver omap3_idle_driver = {
265 .enter = omap3_enter_idle_bm, 265 .enter = omap3_enter_idle_bm,
266 .exit_latency = 2 + 2, 266 .exit_latency = 2 + 2,
267 .target_residency = 5, 267 .target_residency = 5,
268 .flags = CPUIDLE_FLAG_TIME_VALID,
269 .name = "C1", 268 .name = "C1",
270 .desc = "MPU ON + CORE ON", 269 .desc = "MPU ON + CORE ON",
271 }, 270 },
@@ -273,7 +272,6 @@ static struct cpuidle_driver omap3_idle_driver = {
273 .enter = omap3_enter_idle_bm, 272 .enter = omap3_enter_idle_bm,
274 .exit_latency = 10 + 10, 273 .exit_latency = 10 + 10,
275 .target_residency = 30, 274 .target_residency = 30,
276 .flags = CPUIDLE_FLAG_TIME_VALID,
277 .name = "C2", 275 .name = "C2",
278 .desc = "MPU ON + CORE ON", 276 .desc = "MPU ON + CORE ON",
279 }, 277 },
@@ -281,7 +279,6 @@ static struct cpuidle_driver omap3_idle_driver = {
281 .enter = omap3_enter_idle_bm, 279 .enter = omap3_enter_idle_bm,
282 .exit_latency = 50 + 50, 280 .exit_latency = 50 + 50,
283 .target_residency = 300, 281 .target_residency = 300,
284 .flags = CPUIDLE_FLAG_TIME_VALID,
285 .name = "C3", 282 .name = "C3",
286 .desc = "MPU RET + CORE ON", 283 .desc = "MPU RET + CORE ON",
287 }, 284 },
@@ -289,7 +286,6 @@ static struct cpuidle_driver omap3_idle_driver = {
289 .enter = omap3_enter_idle_bm, 286 .enter = omap3_enter_idle_bm,
290 .exit_latency = 1500 + 1800, 287 .exit_latency = 1500 + 1800,
291 .target_residency = 4000, 288 .target_residency = 4000,
292 .flags = CPUIDLE_FLAG_TIME_VALID,
293 .name = "C4", 289 .name = "C4",
294 .desc = "MPU OFF + CORE ON", 290 .desc = "MPU OFF + CORE ON",
295 }, 291 },
@@ -297,7 +293,6 @@ static struct cpuidle_driver omap3_idle_driver = {
297 .enter = omap3_enter_idle_bm, 293 .enter = omap3_enter_idle_bm,
298 .exit_latency = 2500 + 7500, 294 .exit_latency = 2500 + 7500,
299 .target_residency = 12000, 295 .target_residency = 12000,
300 .flags = CPUIDLE_FLAG_TIME_VALID,
301 .name = "C5", 296 .name = "C5",
302 .desc = "MPU RET + CORE RET", 297 .desc = "MPU RET + CORE RET",
303 }, 298 },
@@ -305,7 +300,6 @@ static struct cpuidle_driver omap3_idle_driver = {
305 .enter = omap3_enter_idle_bm, 300 .enter = omap3_enter_idle_bm,
306 .exit_latency = 3000 + 8500, 301 .exit_latency = 3000 + 8500,
307 .target_residency = 15000, 302 .target_residency = 15000,
308 .flags = CPUIDLE_FLAG_TIME_VALID,
309 .name = "C6", 303 .name = "C6",
310 .desc = "MPU OFF + CORE RET", 304 .desc = "MPU OFF + CORE RET",
311 }, 305 },
@@ -313,7 +307,6 @@ static struct cpuidle_driver omap3_idle_driver = {
313 .enter = omap3_enter_idle_bm, 307 .enter = omap3_enter_idle_bm,
314 .exit_latency = 10000 + 30000, 308 .exit_latency = 10000 + 30000,
315 .target_residency = 30000, 309 .target_residency = 30000,
316 .flags = CPUIDLE_FLAG_TIME_VALID,
317 .name = "C7", 310 .name = "C7",
318 .desc = "MPU OFF + CORE OFF", 311 .desc = "MPU OFF + CORE OFF",
319 }, 312 },
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index 2498ab025fa2..01e398a868bc 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -196,7 +196,6 @@ static struct cpuidle_driver omap4_idle_driver = {
196 /* C1 - CPU0 ON + CPU1 ON + MPU ON */ 196 /* C1 - CPU0 ON + CPU1 ON + MPU ON */
197 .exit_latency = 2 + 2, 197 .exit_latency = 2 + 2,
198 .target_residency = 5, 198 .target_residency = 5,
199 .flags = CPUIDLE_FLAG_TIME_VALID,
200 .enter = omap_enter_idle_simple, 199 .enter = omap_enter_idle_simple,
201 .name = "C1", 200 .name = "C1",
202 .desc = "CPUx ON, MPUSS ON" 201 .desc = "CPUx ON, MPUSS ON"
@@ -205,7 +204,7 @@ static struct cpuidle_driver omap4_idle_driver = {
205 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ 204 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
206 .exit_latency = 328 + 440, 205 .exit_latency = 328 + 440,
207 .target_residency = 960, 206 .target_residency = 960,
208 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, 207 .flags = CPUIDLE_FLAG_COUPLED,
209 .enter = omap_enter_idle_coupled, 208 .enter = omap_enter_idle_coupled,
210 .name = "C2", 209 .name = "C2",
211 .desc = "CPUx OFF, MPUSS CSWR", 210 .desc = "CPUx OFF, MPUSS CSWR",
@@ -214,7 +213,7 @@ static struct cpuidle_driver omap4_idle_driver = {
214 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ 213 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
215 .exit_latency = 460 + 518, 214 .exit_latency = 460 + 518,
216 .target_residency = 1100, 215 .target_residency = 1100,
217 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, 216 .flags = CPUIDLE_FLAG_COUPLED,
218 .enter = omap_enter_idle_coupled, 217 .enter = omap_enter_idle_coupled,
219 .name = "C3", 218 .name = "C3",
220 .desc = "CPUx OFF, MPUSS OSWR", 219 .desc = "CPUx OFF, MPUSS OSWR",
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 324f02bf8a51..1afb50d6d636 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -49,7 +49,7 @@ static int __init omap3_l3_init(void)
49 * To avoid code running on other OMAPs in 49 * To avoid code running on other OMAPs in
50 * multi-omap builds 50 * multi-omap builds
51 */ 51 */
52 if (!(cpu_is_omap34xx())) 52 if (!(cpu_is_omap34xx()) || of_have_populated_dt())
53 return -ENODEV; 53 return -ENODEV;
54 54
55 snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main"); 55 snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
@@ -67,62 +67,6 @@ static int __init omap3_l3_init(void)
67} 67}
68omap_postcore_initcall(omap3_l3_init); 68omap_postcore_initcall(omap3_l3_init);
69 69
70static int __init omap4_l3_init(void)
71{
72 int i;
73 struct omap_hwmod *oh[3];
74 struct platform_device *pdev;
75 char oh_name[L3_MODULES_MAX_LEN];
76
77 /* If dtb is there, the devices will be created dynamically */
78 if (of_have_populated_dt())
79 return -ENODEV;
80
81 /*
82 * To avoid code running on other OMAPs in
83 * multi-omap builds
84 */
85 if (!cpu_is_omap44xx() && !soc_is_omap54xx())
86 return -ENODEV;
87
88 for (i = 0; i < L3_MODULES; i++) {
89 snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);
90
91 oh[i] = omap_hwmod_lookup(oh_name);
92 if (!(oh[i]))
93 pr_err("could not look up %s\n", oh_name);
94 }
95
96 pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, 0);
97
98 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
99
100 return PTR_RET(pdev);
101}
102omap_postcore_initcall(omap4_l3_init);
103
104#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
105
106static struct resource omap2cam_resources[] = {
107 {
108 .start = OMAP24XX_CAMERA_BASE,
109 .end = OMAP24XX_CAMERA_BASE + 0xfff,
110 .flags = IORESOURCE_MEM,
111 },
112 {
113 .start = 24 + OMAP_INTC_START,
114 .flags = IORESOURCE_IRQ,
115 }
116};
117
118static struct platform_device omap2cam_device = {
119 .name = "omap24xxcam",
120 .id = -1,
121 .num_resources = ARRAY_SIZE(omap2cam_resources),
122 .resource = omap2cam_resources,
123};
124#endif
125
126#if defined(CONFIG_IOMMU_API) 70#if defined(CONFIG_IOMMU_API)
127 71
128#include <linux/platform_data/iommu-omap.h> 72#include <linux/platform_data/iommu-omap.h>
@@ -245,14 +189,6 @@ int omap3_init_camera(struct isp_platform_data *pdata)
245 189
246#endif 190#endif
247 191
248static inline void omap_init_camera(void)
249{
250#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
251 if (cpu_is_omap24xx())
252 platform_device_register(&omap2cam_device);
253#endif
254}
255
256#if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE) 192#if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE)
257static inline void __init omap_init_mbox(void) 193static inline void __init omap_init_mbox(void)
258{ 194{
@@ -431,7 +367,6 @@ static int __init omap2_init_devices(void)
431 * in alphabetical order so they're easier to sort through. 367 * in alphabetical order so they're easier to sort through.
432 */ 368 */
433 omap_init_audio(); 369 omap_init_audio();
434 omap_init_camera();
435 /* If dtb is there, the devices will be created dynamically */ 370 /* If dtb is there, the devices will be created dynamically */
436 if (!of_have_populated_dt()) { 371 if (!of_have_populated_dt()) {
437 omap_init_mbox(); 372 omap_init_mbox();
@@ -445,3 +380,29 @@ static int __init omap2_init_devices(void)
445 return 0; 380 return 0;
446} 381}
447omap_arch_initcall(omap2_init_devices); 382omap_arch_initcall(omap2_init_devices);
383
384static int __init omap_gpmc_init(void)
385{
386 struct omap_hwmod *oh;
387 struct platform_device *pdev;
388 char *oh_name = "gpmc";
389
390 /*
391 * if the board boots up with a populated DT, do not
392 * manually add the device from this initcall
393 */
394 if (of_have_populated_dt())
395 return -ENODEV;
396
397 oh = omap_hwmod_lookup(oh_name);
398 if (!oh) {
399 pr_err("Could not look up %s\n", oh_name);
400 return -ENODEV;
401 }
402
403 pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0);
404 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
405
406 return PTR_RET(pdev);
407}
408omap_postcore_initcall(omap_gpmc_init);
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index ac3d789ac3cd..20e120d071dd 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -460,25 +460,24 @@ void omap3_noncore_dpll_disable(struct clk_hw *hw)
460/* Non-CORE DPLL rate set code */ 460/* Non-CORE DPLL rate set code */
461 461
462/** 462/**
463 * omap3_noncore_dpll_set_rate - set non-core DPLL rate 463 * omap3_noncore_dpll_determine_rate - determine rate for a DPLL
464 * @clk: struct clk * of DPLL to set 464 * @hw: pointer to the clock to determine rate for
465 * @rate: rounded target rate 465 * @rate: target rate for the DPLL
466 * @best_parent_rate: pointer for returning best parent rate
467 * @best_parent_clk: pointer for returning best parent clock
466 * 468 *
467 * Set the DPLL CLKOUT to the target rate. If the DPLL can enter 469 * Determines which DPLL mode to use for reaching a desired target rate.
468 * low-power bypass, and the target rate is the bypass source clock 470 * Checks whether the DPLL shall be in bypass or locked mode, and if
469 * rate, then configure the DPLL for bypass. Otherwise, round the 471 * locked, calculates the M,N values for the DPLL via round-rate.
470 * target rate if it hasn't been done already, then program and lock 472 * Returns a positive clock rate with success, negative error value
471 * the DPLL. Returns -EINVAL upon error, or 0 upon success. 473 * in failure.
472 */ 474 */
473int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, 475long omap3_noncore_dpll_determine_rate(struct clk_hw *hw, unsigned long rate,
474 unsigned long parent_rate) 476 unsigned long *best_parent_rate,
477 struct clk **best_parent_clk)
475{ 478{
476 struct clk_hw_omap *clk = to_clk_hw_omap(hw); 479 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
477 struct clk *new_parent = NULL;
478 unsigned long rrate;
479 u16 freqsel = 0;
480 struct dpll_data *dd; 480 struct dpll_data *dd;
481 int ret;
482 481
483 if (!hw || !rate) 482 if (!hw || !rate)
484 return -EINVAL; 483 return -EINVAL;
@@ -489,61 +488,121 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
489 488
490 if (__clk_get_rate(dd->clk_bypass) == rate && 489 if (__clk_get_rate(dd->clk_bypass) == rate &&
491 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) { 490 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
492 pr_debug("%s: %s: set rate: entering bypass.\n", 491 *best_parent_clk = dd->clk_bypass;
493 __func__, __clk_get_name(hw->clk)); 492 } else {
493 rate = omap2_dpll_round_rate(hw, rate, best_parent_rate);
494 *best_parent_clk = dd->clk_ref;
495 }
496
497 *best_parent_rate = rate;
498
499 return rate;
500}
501
502/**
503 * omap3_noncore_dpll_set_parent - set parent for a DPLL clock
504 * @hw: pointer to the clock to set parent for
505 * @index: parent index to select
506 *
507 * Sets parent for a DPLL clock. This sets the DPLL into bypass or
508 * locked mode. Returns 0 with success, negative error value otherwise.
509 */
510int omap3_noncore_dpll_set_parent(struct clk_hw *hw, u8 index)
511{
512 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
513 int ret;
494 514
495 __clk_prepare(dd->clk_bypass); 515 if (!hw)
496 clk_enable(dd->clk_bypass); 516 return -EINVAL;
517
518 if (index)
497 ret = _omap3_noncore_dpll_bypass(clk); 519 ret = _omap3_noncore_dpll_bypass(clk);
498 if (!ret) 520 else
499 new_parent = dd->clk_bypass; 521 ret = _omap3_noncore_dpll_lock(clk);
500 clk_disable(dd->clk_bypass);
501 __clk_unprepare(dd->clk_bypass);
502 } else {
503 __clk_prepare(dd->clk_ref);
504 clk_enable(dd->clk_ref);
505
506 /* XXX this check is probably pointless in the CCF context */
507 if (dd->last_rounded_rate != rate) {
508 rrate = __clk_round_rate(hw->clk, rate);
509 if (rrate != rate) {
510 pr_warn("%s: %s: final rate %lu does not match desired rate %lu\n",
511 __func__, __clk_get_name(hw->clk),
512 rrate, rate);
513 rate = rrate;
514 }
515 }
516 522
517 if (dd->last_rounded_rate == 0) 523 return ret;
518 return -EINVAL; 524}
519 525
520 /* Freqsel is available only on OMAP343X devices */ 526/**
521 if (ti_clk_features.flags & TI_CLK_DPLL_HAS_FREQSEL) { 527 * omap3_noncore_dpll_set_rate - set rate for a DPLL clock
522 freqsel = _omap3_dpll_compute_freqsel(clk, 528 * @hw: pointer to the clock to set parent for
523 dd->last_rounded_n); 529 * @rate: target rate for the clock
524 WARN_ON(!freqsel); 530 * @parent_rate: rate of the parent clock
525 } 531 *
532 * Sets rate for a DPLL clock. First checks if the clock parent is
533 * reference clock (in bypass mode, the rate of the clock can't be
534 * changed) and proceeds with the rate change operation. Returns 0
535 * with success, negative error value otherwise.
536 */
537int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
538 unsigned long parent_rate)
539{
540 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
541 struct dpll_data *dd;
542 u16 freqsel = 0;
543 int ret;
544
545 if (!hw || !rate)
546 return -EINVAL;
547
548 dd = clk->dpll_data;
549 if (!dd)
550 return -EINVAL;
526 551
527 pr_debug("%s: %s: set rate: locking rate to %lu.\n", 552 if (__clk_get_parent(hw->clk) != dd->clk_ref)
528 __func__, __clk_get_name(hw->clk), rate); 553 return -EINVAL;
554
555 if (dd->last_rounded_rate == 0)
556 return -EINVAL;
529 557
530 ret = omap3_noncore_dpll_program(clk, freqsel); 558 /* Freqsel is available only on OMAP343X devices */
531 if (!ret) 559 if (ti_clk_features.flags & TI_CLK_DPLL_HAS_FREQSEL) {
532 new_parent = dd->clk_ref; 560 freqsel = _omap3_dpll_compute_freqsel(clk, dd->last_rounded_n);
533 clk_disable(dd->clk_ref); 561 WARN_ON(!freqsel);
534 __clk_unprepare(dd->clk_ref);
535 } 562 }
536 /*
537 * FIXME - this is all wrong. common code handles reparenting and
538 * migrating prepare/enable counts. dplls should be a multiplexer
539 * clock and this should be a set_parent operation so that all of that
540 * stuff is inherited for free
541 */
542 563
543 if (!ret && clk_get_parent(hw->clk) != new_parent) 564 pr_debug("%s: %s: set rate: locking rate to %lu.\n", __func__,
544 __clk_reparent(hw->clk, new_parent); 565 __clk_get_name(hw->clk), rate);
545 566
546 return 0; 567 ret = omap3_noncore_dpll_program(clk, freqsel);
568
569 return ret;
570}
571
572/**
573 * omap3_noncore_dpll_set_rate_and_parent - set rate and parent for a DPLL clock
574 * @hw: pointer to the clock to set rate and parent for
575 * @rate: target rate for the DPLL
576 * @parent_rate: clock rate of the DPLL parent
577 * @index: new parent index for the DPLL, 0 - reference, 1 - bypass
578 *
579 * Sets rate and parent for a DPLL clock. If new parent is the bypass
580 * clock, only selects the parent. Otherwise proceeds with a rate
581 * change, as this will effectively also change the parent as the
582 * DPLL is put into locked mode. Returns 0 with success, negative error
583 * value otherwise.
584 */
585int omap3_noncore_dpll_set_rate_and_parent(struct clk_hw *hw,
586 unsigned long rate,
587 unsigned long parent_rate,
588 u8 index)
589{
590 int ret;
591
592 if (!hw || !rate)
593 return -EINVAL;
594
595 /*
596 * clk-ref at index[0], in which case we only need to set rate,
597 * the parent will be changed automatically with the lock sequence.
598 * With clk-bypass case we only need to change parent.
599 */
600 if (index)
601 ret = omap3_noncore_dpll_set_parent(hw, index);
602 else
603 ret = omap3_noncore_dpll_set_rate(hw, rate, parent_rate);
604
605 return ret;
547} 606}
548 607
549/* DPLL autoidle read/set code */ 608/* DPLL autoidle read/set code */
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index 4613f1e86988..535822fcf4bb 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -207,3 +207,44 @@ out:
207 207
208 return dd->last_rounded_rate; 208 return dd->last_rounded_rate;
209} 209}
210
211/**
212 * omap4_dpll_regm4xen_determine_rate - determine rate for a DPLL
213 * @hw: pointer to the clock to determine rate for
214 * @rate: target rate for the DPLL
215 * @best_parent_rate: pointer for returning best parent rate
216 * @best_parent_clk: pointer for returning best parent clock
217 *
218 * Determines which DPLL mode to use for reaching a desired rate.
219 * Checks whether the DPLL shall be in bypass or locked mode, and if
220 * locked, calculates the M,N values for the DPLL via round-rate.
221 * Returns a positive clock rate with success, negative error value
222 * in failure.
223 */
224long omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw, unsigned long rate,
225 unsigned long *best_parent_rate,
226 struct clk **best_parent_clk)
227{
228 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
229 struct dpll_data *dd;
230
231 if (!hw || !rate)
232 return -EINVAL;
233
234 dd = clk->dpll_data;
235 if (!dd)
236 return -EINVAL;
237
238 if (__clk_get_rate(dd->clk_bypass) == rate &&
239 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
240 *best_parent_clk = dd->clk_bypass;
241 } else {
242 rate = omap4_dpll_regm4xen_round_rate(hw, rate,
243 best_parent_rate);
244 *best_parent_clk = dd->clk_ref;
245 }
246
247 *best_parent_rate = rate;
248
249 return rate;
250}
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index cb7764314f17..d5951b17b736 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -12,14 +12,13 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/omap-gpmc.h>
15#include <linux/mtd/nand.h> 16#include <linux/mtd/nand.h>
16#include <linux/platform_data/mtd-nand-omap2.h> 17#include <linux/platform_data/mtd-nand-omap2.h>
17 18
18#include <asm/mach/flash.h> 19#include <asm/mach/flash.h>
19 20
20#include "gpmc.h"
21#include "soc.h" 21#include "soc.h"
22#include "gpmc-nand.h"
23 22
24/* minimum size for IO mapping */ 23/* minimum size for IO mapping */
25#define NAND_IO_SIZE 4 24#define NAND_IO_SIZE 4
diff --git a/arch/arm/mach-omap2/gpmc-nand.h b/arch/arm/mach-omap2/gpmc-nand.h
deleted file mode 100644
index d59e1281e851..000000000000
--- a/arch/arm/mach-omap2/gpmc-nand.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * arch/arm/mach-omap2/gpmc-nand.h
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __OMAP2_GPMC_NAND_H
11#define __OMAP2_GPMC_NAND_H
12
13#include "gpmc.h"
14#include <linux/platform_data/mtd-nand-omap2.h>
15
16#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
17extern int gpmc_nand_init(struct omap_nand_platform_data *d,
18 struct gpmc_timings *gpmc_t);
19#else
20static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
21 struct gpmc_timings *gpmc_t)
22{
23 return 0;
24}
25#endif
26
27#endif
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 8b6876c98ce1..53d197e0c1f3 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -15,14 +15,13 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/mtd/onenand_regs.h> 16#include <linux/mtd/onenand_regs.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/omap-gpmc.h>
18#include <linux/platform_data/mtd-onenand-omap2.h> 19#include <linux/platform_data/mtd-onenand-omap2.h>
19#include <linux/err.h> 20#include <linux/err.h>
20 21
21#include <asm/mach/flash.h> 22#include <asm/mach/flash.h>
22 23
23#include "gpmc.h"
24#include "soc.h" 24#include "soc.h"
25#include "gpmc-onenand.h"
26 25
27#define ONENAND_IO_SIZE SZ_128K 26#define ONENAND_IO_SIZE SZ_128K
28 27
diff --git a/arch/arm/mach-omap2/gpmc-onenand.h b/arch/arm/mach-omap2/gpmc-onenand.h
deleted file mode 100644
index 216f23a8b45c..000000000000
--- a/arch/arm/mach-omap2/gpmc-onenand.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * arch/arm/mach-omap2/gpmc-onenand.h
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __OMAP2_GPMC_ONENAND_H
11#define __OMAP2_GPMC_ONENAND_H
12
13#include <linux/platform_data/mtd-onenand-omap2.h>
14
15#if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
16extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
17#else
18#define board_onenand_data NULL
19static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
20{
21}
22#endif
23
24#endif
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
deleted file mode 100644
index 61a063595e66..000000000000
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/gpmc-smc91x.c
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Contact: Tony Lindgren
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/platform_device.h>
14#include <linux/gpio.h>
15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/io.h>
18#include <linux/smc91x.h>
19
20#include "gpmc.h"
21#include "gpmc-smc91x.h"
22
23#include "soc.h"
24
25static struct omap_smc91x_platform_data *gpmc_cfg;
26
27static struct resource gpmc_smc91x_resources[] = {
28 [0] = {
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .flags = IORESOURCE_IRQ,
33 },
34};
35
36static struct smc91x_platdata gpmc_smc91x_info = {
37 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_IO_SHIFT_0,
38 .leda = RPC_LED_100_10,
39 .ledb = RPC_LED_TX_RX,
40};
41
42static struct platform_device gpmc_smc91x_device = {
43 .name = "smc91x",
44 .id = -1,
45 .dev = {
46 .platform_data = &gpmc_smc91x_info,
47 },
48 .num_resources = ARRAY_SIZE(gpmc_smc91x_resources),
49 .resource = gpmc_smc91x_resources,
50};
51
52static struct gpmc_settings smc91x_settings = {
53 .device_width = GPMC_DEVWIDTH_16BIT,
54};
55
56/*
57 * Set the gpmc timings for smc91c96. The timings are taken
58 * from the data sheet available at:
59 * http://www.smsc.com/main/catalog/lan91c96.html
60 * REVISIT: Level shifters can add at least to the access latency.
61 */
62static int smc91c96_gpmc_retime(void)
63{
64 struct gpmc_timings t;
65 struct gpmc_device_timings dev_t;
66 const int t3 = 10; /* Figure 12.2 read and 12.4 write */
67 const int t4_r = 20; /* Figure 12.2 read */
68 const int t4_w = 5; /* Figure 12.4 write */
69 const int t5 = 25; /* Figure 12.2 read */
70 const int t6 = 15; /* Figure 12.2 read */
71 const int t7 = 5; /* Figure 12.4 write */
72 const int t8 = 5; /* Figure 12.4 write */
73 const int t20 = 185; /* Figure 12.2 read and 12.4 write */
74
75 /*
76 * FIXME: Calculate the address and data bus muxed timings.
77 * Note that at least adv_rd_off needs to be changed according
78 * to omap3430 TRM Figure 11-11. Are the sdp boards using the
79 * FPGA in between smc91x and omap as the timings are different
80 * from above?
81 */
82 if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA)
83 return 0;
84
85 memset(&dev_t, 0, sizeof(dev_t));
86
87 dev_t.t_oeasu = t3 * 1000;
88 dev_t.t_oe = t5 * 1000;
89 dev_t.t_cez_r = t4_r * 1000;
90 dev_t.t_oez = t6 * 1000;
91 dev_t.t_rd_cycle = (t20 - t3) * 1000;
92
93 dev_t.t_weasu = t3 * 1000;
94 dev_t.t_wpl = t7 * 1000;
95 dev_t.t_wph = t8 * 1000;
96 dev_t.t_cez_w = t4_w * 1000;
97 dev_t.t_wr_cycle = (t20 - t3) * 1000;
98
99 gpmc_calc_timings(&t, &smc91x_settings, &dev_t);
100
101 return gpmc_cs_set_timings(gpmc_cfg->cs, &t);
102}
103
104/*
105 * Initialize smc91x device connected to the GPMC. Note that we
106 * assume that pin multiplexing is done in the board-*.c file,
107 * or in the bootloader.
108 */
109void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data)
110{
111 unsigned long cs_mem_base;
112 int ret;
113
114 gpmc_cfg = board_data;
115
116 if (gpmc_cfg->flags & GPMC_TIMINGS_SMC91C96)
117 gpmc_cfg->retime = smc91c96_gpmc_retime;
118
119 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) {
120 printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
121 return;
122 }
123
124 gpmc_smc91x_resources[0].start = cs_mem_base + 0x300;
125 gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f;
126 gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK);
127
128 if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA)
129 smc91x_settings.mux_add_data = GPMC_MUX_AD;
130 if (gpmc_cfg->flags & GPMC_READ_MON)
131 smc91x_settings.wait_on_read = true;
132 if (gpmc_cfg->flags & GPMC_WRITE_MON)
133 smc91x_settings.wait_on_write = true;
134 if (gpmc_cfg->wait_pin)
135 smc91x_settings.wait_pin = gpmc_cfg->wait_pin;
136 ret = gpmc_cs_program_settings(gpmc_cfg->cs, &smc91x_settings);
137 if (ret < 0)
138 goto free1;
139
140 if (gpmc_cfg->retime) {
141 ret = gpmc_cfg->retime();
142 if (ret != 0)
143 goto free1;
144 }
145
146 if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "SMC91X irq") < 0)
147 goto free1;
148
149 gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq);
150
151 if (gpmc_cfg->gpio_pwrdwn) {
152 ret = gpio_request_one(gpmc_cfg->gpio_pwrdwn,
153 GPIOF_OUT_INIT_LOW, "SMC91X powerdown");
154 if (ret)
155 goto free2;
156 }
157
158 if (gpmc_cfg->gpio_reset) {
159 ret = gpio_request_one(gpmc_cfg->gpio_reset,
160 GPIOF_OUT_INIT_LOW, "SMC91X reset");
161 if (ret)
162 goto free3;
163
164 gpio_set_value(gpmc_cfg->gpio_reset, 1);
165 msleep(100);
166 gpio_set_value(gpmc_cfg->gpio_reset, 0);
167 }
168
169 if (platform_device_register(&gpmc_smc91x_device) < 0) {
170 printk(KERN_ERR "Unable to register smc91x device\n");
171 gpio_free(gpmc_cfg->gpio_reset);
172 goto free3;
173 }
174
175 return;
176
177free3:
178 if (gpmc_cfg->gpio_pwrdwn)
179 gpio_free(gpmc_cfg->gpio_pwrdwn);
180free2:
181 gpio_free(gpmc_cfg->gpio_irq);
182free1:
183 gpmc_cs_free(gpmc_cfg->cs);
184
185 printk(KERN_ERR "Could not initialize smc91x\n");
186}
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.h b/arch/arm/mach-omap2/gpmc-smc91x.h
deleted file mode 100644
index b64fbee4d567..000000000000
--- a/arch/arm/mach-omap2/gpmc-smc91x.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/gpmc-smc91x.h
3 *
4 * Copyright (C) 2009 Nokia 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#ifndef __ASM_ARCH_OMAP_GPMC_SMC91X_H__
12
13#define GPMC_TIMINGS_SMC91C96 (1 << 4)
14#define GPMC_MUX_ADD_DATA (1 << 5) /* GPMC_CONFIG1_MUXADDDATA */
15#define GPMC_READ_MON (1 << 6) /* GPMC_CONFIG1_WAIT_READ_MON */
16#define GPMC_WRITE_MON (1 << 7) /* GPMC_CONFIG1_WAIT_WRITE_MON */
17
18struct omap_smc91x_platform_data {
19 int cs;
20 int gpio_irq;
21 int gpio_pwrdwn;
22 int gpio_reset;
23 int wait_pin; /* Optional GPMC_CONFIG1_WAITPINSELECT */
24 u32 flags;
25 int (*retime)(void);
26};
27
28#if defined(CONFIG_SMC91X) || \
29 defined(CONFIG_SMC91X_MODULE)
30
31extern void gpmc_smc91x_init(struct omap_smc91x_platform_data *d);
32
33#else
34
35#define board_smc91x_data NULL
36
37static inline void gpmc_smc91x_init(struct omap_smc91x_platform_data *d)
38{
39}
40
41#endif
42#endif
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
deleted file mode 100644
index 5fa3755261ce..000000000000
--- a/arch/arm/mach-omap2/gpmc.c
+++ /dev/null
@@ -1,1891 +0,0 @@
1/*
2 * GPMC support functions
3 *
4 * Copyright (C) 2005-2006 Nokia Corporation
5 *
6 * Author: Juha Yrjola
7 *
8 * Copyright (C) 2009 Texas Instruments
9 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15#undef DEBUG
16
17#include <linux/irq.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/err.h>
21#include <linux/clk.h>
22#include <linux/ioport.h>
23#include <linux/spinlock.h>
24#include <linux/io.h>
25#include <linux/module.h>
26#include <linux/interrupt.h>
27#include <linux/platform_device.h>
28#include <linux/of.h>
29#include <linux/of_address.h>
30#include <linux/of_mtd.h>
31#include <linux/of_device.h>
32#include <linux/mtd/nand.h>
33#include <linux/pm_runtime.h>
34
35#include <linux/platform_data/mtd-nand-omap2.h>
36
37#include <asm/mach-types.h>
38
39#include "soc.h"
40#include "common.h"
41#include "omap_device.h"
42#include "gpmc.h"
43#include "gpmc-nand.h"
44#include "gpmc-onenand.h"
45
46#define DEVICE_NAME "omap-gpmc"
47
48/* GPMC register offsets */
49#define GPMC_REVISION 0x00
50#define GPMC_SYSCONFIG 0x10
51#define GPMC_SYSSTATUS 0x14
52#define GPMC_IRQSTATUS 0x18
53#define GPMC_IRQENABLE 0x1c
54#define GPMC_TIMEOUT_CONTROL 0x40
55#define GPMC_ERR_ADDRESS 0x44
56#define GPMC_ERR_TYPE 0x48
57#define GPMC_CONFIG 0x50
58#define GPMC_STATUS 0x54
59#define GPMC_PREFETCH_CONFIG1 0x1e0
60#define GPMC_PREFETCH_CONFIG2 0x1e4
61#define GPMC_PREFETCH_CONTROL 0x1ec
62#define GPMC_PREFETCH_STATUS 0x1f0
63#define GPMC_ECC_CONFIG 0x1f4
64#define GPMC_ECC_CONTROL 0x1f8
65#define GPMC_ECC_SIZE_CONFIG 0x1fc
66#define GPMC_ECC1_RESULT 0x200
67#define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */
68#define GPMC_ECC_BCH_RESULT_1 0x244 /* not available on OMAP2 */
69#define GPMC_ECC_BCH_RESULT_2 0x248 /* not available on OMAP2 */
70#define GPMC_ECC_BCH_RESULT_3 0x24c /* not available on OMAP2 */
71#define GPMC_ECC_BCH_RESULT_4 0x300 /* not available on OMAP2 */
72#define GPMC_ECC_BCH_RESULT_5 0x304 /* not available on OMAP2 */
73#define GPMC_ECC_BCH_RESULT_6 0x308 /* not available on OMAP2 */
74
75/* GPMC ECC control settings */
76#define GPMC_ECC_CTRL_ECCCLEAR 0x100
77#define GPMC_ECC_CTRL_ECCDISABLE 0x000
78#define GPMC_ECC_CTRL_ECCREG1 0x001
79#define GPMC_ECC_CTRL_ECCREG2 0x002
80#define GPMC_ECC_CTRL_ECCREG3 0x003
81#define GPMC_ECC_CTRL_ECCREG4 0x004
82#define GPMC_ECC_CTRL_ECCREG5 0x005
83#define GPMC_ECC_CTRL_ECCREG6 0x006
84#define GPMC_ECC_CTRL_ECCREG7 0x007
85#define GPMC_ECC_CTRL_ECCREG8 0x008
86#define GPMC_ECC_CTRL_ECCREG9 0x009
87
88#define GPMC_CONFIG2_CSEXTRADELAY BIT(7)
89#define GPMC_CONFIG3_ADVEXTRADELAY BIT(7)
90#define GPMC_CONFIG4_OEEXTRADELAY BIT(7)
91#define GPMC_CONFIG4_WEEXTRADELAY BIT(23)
92#define GPMC_CONFIG6_CYCLE2CYCLEDIFFCSEN BIT(6)
93#define GPMC_CONFIG6_CYCLE2CYCLESAMECSEN BIT(7)
94
95#define GPMC_CS0_OFFSET 0x60
96#define GPMC_CS_SIZE 0x30
97#define GPMC_BCH_SIZE 0x10
98
99#define GPMC_MEM_END 0x3FFFFFFF
100
101#define GPMC_CHUNK_SHIFT 24 /* 16 MB */
102#define GPMC_SECTION_SHIFT 28 /* 128 MB */
103
104#define CS_NUM_SHIFT 24
105#define ENABLE_PREFETCH (0x1 << 7)
106#define DMA_MPU_MODE 2
107
108#define GPMC_REVISION_MAJOR(l) ((l >> 4) & 0xf)
109#define GPMC_REVISION_MINOR(l) (l & 0xf)
110
111#define GPMC_HAS_WR_ACCESS 0x1
112#define GPMC_HAS_WR_DATA_MUX_BUS 0x2
113#define GPMC_HAS_MUX_AAD 0x4
114
115#define GPMC_NR_WAITPINS 4
116
117/* XXX: Only NAND irq has been considered,currently these are the only ones used
118 */
119#define GPMC_NR_IRQ 2
120
121struct gpmc_client_irq {
122 unsigned irq;
123 u32 bitmask;
124};
125
126/* Structure to save gpmc cs context */
127struct gpmc_cs_config {
128 u32 config1;
129 u32 config2;
130 u32 config3;
131 u32 config4;
132 u32 config5;
133 u32 config6;
134 u32 config7;
135 int is_valid;
136};
137
138/*
139 * Structure to save/restore gpmc context
140 * to support core off on OMAP3
141 */
142struct omap3_gpmc_regs {
143 u32 sysconfig;
144 u32 irqenable;
145 u32 timeout_ctrl;
146 u32 config;
147 u32 prefetch_config1;
148 u32 prefetch_config2;
149 u32 prefetch_control;
150 struct gpmc_cs_config cs_context[GPMC_CS_NUM];
151};
152
153static struct gpmc_client_irq gpmc_client_irq[GPMC_NR_IRQ];
154static struct irq_chip gpmc_irq_chip;
155static int gpmc_irq_start;
156
157static struct resource gpmc_mem_root;
158static struct resource gpmc_cs_mem[GPMC_CS_NUM];
159static DEFINE_SPINLOCK(gpmc_mem_lock);
160/* Define chip-selects as reserved by default until probe completes */
161static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1);
162static unsigned int gpmc_cs_num = GPMC_CS_NUM;
163static unsigned int gpmc_nr_waitpins;
164static struct device *gpmc_dev;
165static int gpmc_irq;
166static resource_size_t phys_base, mem_size;
167static unsigned gpmc_capability;
168static void __iomem *gpmc_base;
169
170static struct clk *gpmc_l3_clk;
171
172static irqreturn_t gpmc_handle_irq(int irq, void *dev);
173
174static void gpmc_write_reg(int idx, u32 val)
175{
176 writel_relaxed(val, gpmc_base + idx);
177}
178
179static u32 gpmc_read_reg(int idx)
180{
181 return readl_relaxed(gpmc_base + idx);
182}
183
184void gpmc_cs_write_reg(int cs, int idx, u32 val)
185{
186 void __iomem *reg_addr;
187
188 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
189 writel_relaxed(val, reg_addr);
190}
191
192static u32 gpmc_cs_read_reg(int cs, int idx)
193{
194 void __iomem *reg_addr;
195
196 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
197 return readl_relaxed(reg_addr);
198}
199
200/* TODO: Add support for gpmc_fck to clock framework and use it */
201static unsigned long gpmc_get_fclk_period(void)
202{
203 unsigned long rate = clk_get_rate(gpmc_l3_clk);
204
205 if (rate == 0) {
206 printk(KERN_WARNING "gpmc_l3_clk not enabled\n");
207 return 0;
208 }
209
210 rate /= 1000;
211 rate = 1000000000 / rate; /* In picoseconds */
212
213 return rate;
214}
215
216static unsigned int gpmc_ns_to_ticks(unsigned int time_ns)
217{
218 unsigned long tick_ps;
219
220 /* Calculate in picosecs to yield more exact results */
221 tick_ps = gpmc_get_fclk_period();
222
223 return (time_ns * 1000 + tick_ps - 1) / tick_ps;
224}
225
226static unsigned int gpmc_ps_to_ticks(unsigned int time_ps)
227{
228 unsigned long tick_ps;
229
230 /* Calculate in picosecs to yield more exact results */
231 tick_ps = gpmc_get_fclk_period();
232
233 return (time_ps + tick_ps - 1) / tick_ps;
234}
235
236unsigned int gpmc_ticks_to_ns(unsigned int ticks)
237{
238 return ticks * gpmc_get_fclk_period() / 1000;
239}
240
241static unsigned int gpmc_ticks_to_ps(unsigned int ticks)
242{
243 return ticks * gpmc_get_fclk_period();
244}
245
246static unsigned int gpmc_round_ps_to_ticks(unsigned int time_ps)
247{
248 unsigned long ticks = gpmc_ps_to_ticks(time_ps);
249
250 return ticks * gpmc_get_fclk_period();
251}
252
253static inline void gpmc_cs_modify_reg(int cs, int reg, u32 mask, bool value)
254{
255 u32 l;
256
257 l = gpmc_cs_read_reg(cs, reg);
258 if (value)
259 l |= mask;
260 else
261 l &= ~mask;
262 gpmc_cs_write_reg(cs, reg, l);
263}
264
265static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p)
266{
267 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG1,
268 GPMC_CONFIG1_TIME_PARA_GRAN,
269 p->time_para_granularity);
270 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG2,
271 GPMC_CONFIG2_CSEXTRADELAY, p->cs_extra_delay);
272 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG3,
273 GPMC_CONFIG3_ADVEXTRADELAY, p->adv_extra_delay);
274 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG4,
275 GPMC_CONFIG4_OEEXTRADELAY, p->oe_extra_delay);
276 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG4,
277 GPMC_CONFIG4_OEEXTRADELAY, p->we_extra_delay);
278 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG6,
279 GPMC_CONFIG6_CYCLE2CYCLESAMECSEN,
280 p->cycle2cyclesamecsen);
281 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG6,
282 GPMC_CONFIG6_CYCLE2CYCLEDIFFCSEN,
283 p->cycle2cyclediffcsen);
284}
285
286#ifdef DEBUG
287static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
288 int time, const char *name)
289#else
290static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
291 int time)
292#endif
293{
294 u32 l;
295 int ticks, mask, nr_bits;
296
297 if (time == 0)
298 ticks = 0;
299 else
300 ticks = gpmc_ns_to_ticks(time);
301 nr_bits = end_bit - st_bit + 1;
302 if (ticks >= 1 << nr_bits) {
303#ifdef DEBUG
304 printk(KERN_INFO "GPMC CS%d: %-10s* %3d ns, %3d ticks >= %d\n",
305 cs, name, time, ticks, 1 << nr_bits);
306#endif
307 return -1;
308 }
309
310 mask = (1 << nr_bits) - 1;
311 l = gpmc_cs_read_reg(cs, reg);
312#ifdef DEBUG
313 printk(KERN_INFO
314 "GPMC CS%d: %-10s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n",
315 cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000,
316 (l >> st_bit) & mask, time);
317#endif
318 l &= ~(mask << st_bit);
319 l |= ticks << st_bit;
320 gpmc_cs_write_reg(cs, reg, l);
321
322 return 0;
323}
324
325#ifdef DEBUG
326#define GPMC_SET_ONE(reg, st, end, field) \
327 if (set_gpmc_timing_reg(cs, (reg), (st), (end), \
328 t->field, #field) < 0) \
329 return -1
330#else
331#define GPMC_SET_ONE(reg, st, end, field) \
332 if (set_gpmc_timing_reg(cs, (reg), (st), (end), t->field) < 0) \
333 return -1
334#endif
335
336int gpmc_calc_divider(unsigned int sync_clk)
337{
338 int div;
339 u32 l;
340
341 l = sync_clk + (gpmc_get_fclk_period() - 1);
342 div = l / gpmc_get_fclk_period();
343 if (div > 4)
344 return -1;
345 if (div <= 0)
346 div = 1;
347
348 return div;
349}
350
351int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
352{
353 int div;
354 u32 l;
355
356 div = gpmc_calc_divider(t->sync_clk);
357 if (div < 0)
358 return div;
359
360 GPMC_SET_ONE(GPMC_CS_CONFIG2, 0, 3, cs_on);
361 GPMC_SET_ONE(GPMC_CS_CONFIG2, 8, 12, cs_rd_off);
362 GPMC_SET_ONE(GPMC_CS_CONFIG2, 16, 20, cs_wr_off);
363
364 GPMC_SET_ONE(GPMC_CS_CONFIG3, 0, 3, adv_on);
365 GPMC_SET_ONE(GPMC_CS_CONFIG3, 8, 12, adv_rd_off);
366 GPMC_SET_ONE(GPMC_CS_CONFIG3, 16, 20, adv_wr_off);
367
368 GPMC_SET_ONE(GPMC_CS_CONFIG4, 0, 3, oe_on);
369 GPMC_SET_ONE(GPMC_CS_CONFIG4, 8, 12, oe_off);
370 GPMC_SET_ONE(GPMC_CS_CONFIG4, 16, 19, we_on);
371 GPMC_SET_ONE(GPMC_CS_CONFIG4, 24, 28, we_off);
372
373 GPMC_SET_ONE(GPMC_CS_CONFIG5, 0, 4, rd_cycle);
374 GPMC_SET_ONE(GPMC_CS_CONFIG5, 8, 12, wr_cycle);
375 GPMC_SET_ONE(GPMC_CS_CONFIG5, 16, 20, access);
376
377 GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access);
378
379 GPMC_SET_ONE(GPMC_CS_CONFIG6, 0, 3, bus_turnaround);
380 GPMC_SET_ONE(GPMC_CS_CONFIG6, 8, 11, cycle2cycle_delay);
381
382 GPMC_SET_ONE(GPMC_CS_CONFIG1, 18, 19, wait_monitoring);
383 GPMC_SET_ONE(GPMC_CS_CONFIG1, 25, 26, clk_activation);
384
385 if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS)
386 GPMC_SET_ONE(GPMC_CS_CONFIG6, 16, 19, wr_data_mux_bus);
387 if (gpmc_capability & GPMC_HAS_WR_ACCESS)
388 GPMC_SET_ONE(GPMC_CS_CONFIG6, 24, 28, wr_access);
389
390 /* caller is expected to have initialized CONFIG1 to cover
391 * at least sync vs async
392 */
393 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
394 if (l & (GPMC_CONFIG1_READTYPE_SYNC | GPMC_CONFIG1_WRITETYPE_SYNC)) {
395#ifdef DEBUG
396 printk(KERN_INFO "GPMC CS%d CLK period is %lu ns (div %d)\n",
397 cs, (div * gpmc_get_fclk_period()) / 1000, div);
398#endif
399 l &= ~0x03;
400 l |= (div - 1);
401 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l);
402 }
403
404 gpmc_cs_bool_timings(cs, &t->bool_timings);
405
406 return 0;
407}
408
409static int gpmc_cs_enable_mem(int cs, u32 base, u32 size)
410{
411 u32 l;
412 u32 mask;
413
414 /*
415 * Ensure that base address is aligned on a
416 * boundary equal to or greater than size.
417 */
418 if (base & (size - 1))
419 return -EINVAL;
420
421 mask = (1 << GPMC_SECTION_SHIFT) - size;
422 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
423 l &= ~0x3f;
424 l = (base >> GPMC_CHUNK_SHIFT) & 0x3f;
425 l &= ~(0x0f << 8);
426 l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8;
427 l |= GPMC_CONFIG7_CSVALID;
428 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l);
429
430 return 0;
431}
432
433static void gpmc_cs_disable_mem(int cs)
434{
435 u32 l;
436
437 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
438 l &= ~GPMC_CONFIG7_CSVALID;
439 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l);
440}
441
442static void gpmc_cs_get_memconf(int cs, u32 *base, u32 *size)
443{
444 u32 l;
445 u32 mask;
446
447 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
448 *base = (l & 0x3f) << GPMC_CHUNK_SHIFT;
449 mask = (l >> 8) & 0x0f;
450 *size = (1 << GPMC_SECTION_SHIFT) - (mask << GPMC_CHUNK_SHIFT);
451}
452
453static int gpmc_cs_mem_enabled(int cs)
454{
455 u32 l;
456
457 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
458 return l & GPMC_CONFIG7_CSVALID;
459}
460
461static void gpmc_cs_set_reserved(int cs, int reserved)
462{
463 gpmc_cs_map &= ~(1 << cs);
464 gpmc_cs_map |= (reserved ? 1 : 0) << cs;
465}
466
467static bool gpmc_cs_reserved(int cs)
468{
469 return gpmc_cs_map & (1 << cs);
470}
471
472static unsigned long gpmc_mem_align(unsigned long size)
473{
474 int order;
475
476 size = (size - 1) >> (GPMC_CHUNK_SHIFT - 1);
477 order = GPMC_CHUNK_SHIFT - 1;
478 do {
479 size >>= 1;
480 order++;
481 } while (size);
482 size = 1 << order;
483 return size;
484}
485
486static int gpmc_cs_insert_mem(int cs, unsigned long base, unsigned long size)
487{
488 struct resource *res = &gpmc_cs_mem[cs];
489 int r;
490
491 size = gpmc_mem_align(size);
492 spin_lock(&gpmc_mem_lock);
493 res->start = base;
494 res->end = base + size - 1;
495 r = request_resource(&gpmc_mem_root, res);
496 spin_unlock(&gpmc_mem_lock);
497
498 return r;
499}
500
501static int gpmc_cs_delete_mem(int cs)
502{
503 struct resource *res = &gpmc_cs_mem[cs];
504 int r;
505
506 spin_lock(&gpmc_mem_lock);
507 r = release_resource(res);
508 res->start = 0;
509 res->end = 0;
510 spin_unlock(&gpmc_mem_lock);
511
512 return r;
513}
514
515/**
516 * gpmc_cs_remap - remaps a chip-select physical base address
517 * @cs: chip-select to remap
518 * @base: physical base address to re-map chip-select to
519 *
520 * Re-maps a chip-select to a new physical base address specified by
521 * "base". Returns 0 on success and appropriate negative error code
522 * on failure.
523 */
524static int gpmc_cs_remap(int cs, u32 base)
525{
526 int ret;
527 u32 old_base, size;
528
529 if (cs > gpmc_cs_num) {
530 pr_err("%s: requested chip-select is disabled\n", __func__);
531 return -ENODEV;
532 }
533
534 /*
535 * Make sure we ignore any device offsets from the GPMC partition
536 * allocated for the chip select and that the new base confirms
537 * to the GPMC 16MB minimum granularity.
538 */
539 base &= ~(SZ_16M - 1);
540
541 gpmc_cs_get_memconf(cs, &old_base, &size);
542 if (base == old_base)
543 return 0;
544 gpmc_cs_disable_mem(cs);
545 ret = gpmc_cs_delete_mem(cs);
546 if (ret < 0)
547 return ret;
548 ret = gpmc_cs_insert_mem(cs, base, size);
549 if (ret < 0)
550 return ret;
551 ret = gpmc_cs_enable_mem(cs, base, size);
552 if (ret < 0)
553 return ret;
554
555 return 0;
556}
557
558int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
559{
560 struct resource *res = &gpmc_cs_mem[cs];
561 int r = -1;
562
563 if (cs > gpmc_cs_num) {
564 pr_err("%s: requested chip-select is disabled\n", __func__);
565 return -ENODEV;
566 }
567 size = gpmc_mem_align(size);
568 if (size > (1 << GPMC_SECTION_SHIFT))
569 return -ENOMEM;
570
571 spin_lock(&gpmc_mem_lock);
572 if (gpmc_cs_reserved(cs)) {
573 r = -EBUSY;
574 goto out;
575 }
576 if (gpmc_cs_mem_enabled(cs))
577 r = adjust_resource(res, res->start & ~(size - 1), size);
578 if (r < 0)
579 r = allocate_resource(&gpmc_mem_root, res, size, 0, ~0,
580 size, NULL, NULL);
581 if (r < 0)
582 goto out;
583
584 r = gpmc_cs_enable_mem(cs, res->start, resource_size(res));
585 if (r < 0) {
586 release_resource(res);
587 goto out;
588 }
589
590 *base = res->start;
591 gpmc_cs_set_reserved(cs, 1);
592out:
593 spin_unlock(&gpmc_mem_lock);
594 return r;
595}
596EXPORT_SYMBOL(gpmc_cs_request);
597
598void gpmc_cs_free(int cs)
599{
600 struct resource *res = &gpmc_cs_mem[cs];
601
602 spin_lock(&gpmc_mem_lock);
603 if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) {
604 printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
605 BUG();
606 spin_unlock(&gpmc_mem_lock);
607 return;
608 }
609 gpmc_cs_disable_mem(cs);
610 if (res->flags)
611 release_resource(res);
612 gpmc_cs_set_reserved(cs, 0);
613 spin_unlock(&gpmc_mem_lock);
614}
615EXPORT_SYMBOL(gpmc_cs_free);
616
617/**
618 * gpmc_configure - write request to configure gpmc
619 * @cmd: command type
620 * @wval: value to write
621 * @return status of the operation
622 */
623int gpmc_configure(int cmd, int wval)
624{
625 u32 regval;
626
627 switch (cmd) {
628 case GPMC_ENABLE_IRQ:
629 gpmc_write_reg(GPMC_IRQENABLE, wval);
630 break;
631
632 case GPMC_SET_IRQ_STATUS:
633 gpmc_write_reg(GPMC_IRQSTATUS, wval);
634 break;
635
636 case GPMC_CONFIG_WP:
637 regval = gpmc_read_reg(GPMC_CONFIG);
638 if (wval)
639 regval &= ~GPMC_CONFIG_WRITEPROTECT; /* WP is ON */
640 else
641 regval |= GPMC_CONFIG_WRITEPROTECT; /* WP is OFF */
642 gpmc_write_reg(GPMC_CONFIG, regval);
643 break;
644
645 default:
646 pr_err("%s: command not supported\n", __func__);
647 return -EINVAL;
648 }
649
650 return 0;
651}
652EXPORT_SYMBOL(gpmc_configure);
653
654void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
655{
656 int i;
657
658 reg->gpmc_status = gpmc_base + GPMC_STATUS;
659 reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET +
660 GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs;
661 reg->gpmc_nand_address = gpmc_base + GPMC_CS0_OFFSET +
662 GPMC_CS_NAND_ADDRESS + GPMC_CS_SIZE * cs;
663 reg->gpmc_nand_data = gpmc_base + GPMC_CS0_OFFSET +
664 GPMC_CS_NAND_DATA + GPMC_CS_SIZE * cs;
665 reg->gpmc_prefetch_config1 = gpmc_base + GPMC_PREFETCH_CONFIG1;
666 reg->gpmc_prefetch_config2 = gpmc_base + GPMC_PREFETCH_CONFIG2;
667 reg->gpmc_prefetch_control = gpmc_base + GPMC_PREFETCH_CONTROL;
668 reg->gpmc_prefetch_status = gpmc_base + GPMC_PREFETCH_STATUS;
669 reg->gpmc_ecc_config = gpmc_base + GPMC_ECC_CONFIG;
670 reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL;
671 reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG;
672 reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT;
673
674 for (i = 0; i < GPMC_BCH_NUM_REMAINDER; i++) {
675 reg->gpmc_bch_result0[i] = gpmc_base + GPMC_ECC_BCH_RESULT_0 +
676 GPMC_BCH_SIZE * i;
677 reg->gpmc_bch_result1[i] = gpmc_base + GPMC_ECC_BCH_RESULT_1 +
678 GPMC_BCH_SIZE * i;
679 reg->gpmc_bch_result2[i] = gpmc_base + GPMC_ECC_BCH_RESULT_2 +
680 GPMC_BCH_SIZE * i;
681 reg->gpmc_bch_result3[i] = gpmc_base + GPMC_ECC_BCH_RESULT_3 +
682 GPMC_BCH_SIZE * i;
683 reg->gpmc_bch_result4[i] = gpmc_base + GPMC_ECC_BCH_RESULT_4 +
684 i * GPMC_BCH_SIZE;
685 reg->gpmc_bch_result5[i] = gpmc_base + GPMC_ECC_BCH_RESULT_5 +
686 i * GPMC_BCH_SIZE;
687 reg->gpmc_bch_result6[i] = gpmc_base + GPMC_ECC_BCH_RESULT_6 +
688 i * GPMC_BCH_SIZE;
689 }
690}
691
692int gpmc_get_client_irq(unsigned irq_config)
693{
694 int i;
695
696 if (hweight32(irq_config) > 1)
697 return 0;
698
699 for (i = 0; i < GPMC_NR_IRQ; i++)
700 if (gpmc_client_irq[i].bitmask & irq_config)
701 return gpmc_client_irq[i].irq;
702
703 return 0;
704}
705
706static int gpmc_irq_endis(unsigned irq, bool endis)
707{
708 int i;
709 u32 regval;
710
711 for (i = 0; i < GPMC_NR_IRQ; i++)
712 if (irq == gpmc_client_irq[i].irq) {
713 regval = gpmc_read_reg(GPMC_IRQENABLE);
714 if (endis)
715 regval |= gpmc_client_irq[i].bitmask;
716 else
717 regval &= ~gpmc_client_irq[i].bitmask;
718 gpmc_write_reg(GPMC_IRQENABLE, regval);
719 break;
720 }
721
722 return 0;
723}
724
725static void gpmc_irq_disable(struct irq_data *p)
726{
727 gpmc_irq_endis(p->irq, false);
728}
729
730static void gpmc_irq_enable(struct irq_data *p)
731{
732 gpmc_irq_endis(p->irq, true);
733}
734
735static void gpmc_irq_noop(struct irq_data *data) { }
736
737static unsigned int gpmc_irq_noop_ret(struct irq_data *data) { return 0; }
738
739static int gpmc_setup_irq(void)
740{
741 int i;
742 u32 regval;
743
744 if (!gpmc_irq)
745 return -EINVAL;
746
747 gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0);
748 if (gpmc_irq_start < 0) {
749 pr_err("irq_alloc_descs failed\n");
750 return gpmc_irq_start;
751 }
752
753 gpmc_irq_chip.name = "gpmc";
754 gpmc_irq_chip.irq_startup = gpmc_irq_noop_ret;
755 gpmc_irq_chip.irq_enable = gpmc_irq_enable;
756 gpmc_irq_chip.irq_disable = gpmc_irq_disable;
757 gpmc_irq_chip.irq_shutdown = gpmc_irq_noop;
758 gpmc_irq_chip.irq_ack = gpmc_irq_noop;
759 gpmc_irq_chip.irq_mask = gpmc_irq_noop;
760 gpmc_irq_chip.irq_unmask = gpmc_irq_noop;
761
762 gpmc_client_irq[0].bitmask = GPMC_IRQ_FIFOEVENTENABLE;
763 gpmc_client_irq[1].bitmask = GPMC_IRQ_COUNT_EVENT;
764
765 for (i = 0; i < GPMC_NR_IRQ; i++) {
766 gpmc_client_irq[i].irq = gpmc_irq_start + i;
767 irq_set_chip_and_handler(gpmc_client_irq[i].irq,
768 &gpmc_irq_chip, handle_simple_irq);
769 set_irq_flags(gpmc_client_irq[i].irq,
770 IRQF_VALID | IRQF_NOAUTOEN);
771 }
772
773 /* Disable interrupts */
774 gpmc_write_reg(GPMC_IRQENABLE, 0);
775
776 /* clear interrupts */
777 regval = gpmc_read_reg(GPMC_IRQSTATUS);
778 gpmc_write_reg(GPMC_IRQSTATUS, regval);
779
780 return request_irq(gpmc_irq, gpmc_handle_irq, 0, "gpmc", NULL);
781}
782
783static int gpmc_free_irq(void)
784{
785 int i;
786
787 if (gpmc_irq)
788 free_irq(gpmc_irq, NULL);
789
790 for (i = 0; i < GPMC_NR_IRQ; i++) {
791 irq_set_handler(gpmc_client_irq[i].irq, NULL);
792 irq_set_chip(gpmc_client_irq[i].irq, &no_irq_chip);
793 irq_modify_status(gpmc_client_irq[i].irq, 0, 0);
794 }
795
796 irq_free_descs(gpmc_irq_start, GPMC_NR_IRQ);
797
798 return 0;
799}
800
801static void gpmc_mem_exit(void)
802{
803 int cs;
804
805 for (cs = 0; cs < gpmc_cs_num; cs++) {
806 if (!gpmc_cs_mem_enabled(cs))
807 continue;
808 gpmc_cs_delete_mem(cs);
809 }
810
811}
812
813static void gpmc_mem_init(void)
814{
815 int cs;
816
817 /*
818 * The first 1MB of GPMC address space is typically mapped to
819 * the internal ROM. Never allocate the first page, to
820 * facilitate bug detection; even if we didn't boot from ROM.
821 */
822 gpmc_mem_root.start = SZ_1M;
823 gpmc_mem_root.end = GPMC_MEM_END;
824
825 /* Reserve all regions that has been set up by bootloader */
826 for (cs = 0; cs < gpmc_cs_num; cs++) {
827 u32 base, size;
828
829 if (!gpmc_cs_mem_enabled(cs))
830 continue;
831 gpmc_cs_get_memconf(cs, &base, &size);
832 if (gpmc_cs_insert_mem(cs, base, size)) {
833 pr_warn("%s: disabling cs %d mapped at 0x%x-0x%x\n",
834 __func__, cs, base, base + size);
835 gpmc_cs_disable_mem(cs);
836 }
837 }
838}
839
840static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk)
841{
842 u32 temp;
843 int div;
844
845 div = gpmc_calc_divider(sync_clk);
846 temp = gpmc_ps_to_ticks(time_ps);
847 temp = (temp + div - 1) / div;
848 return gpmc_ticks_to_ps(temp * div);
849}
850
851/* XXX: can the cycles be avoided ? */
852static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t,
853 struct gpmc_device_timings *dev_t,
854 bool mux)
855{
856 u32 temp;
857
858 /* adv_rd_off */
859 temp = dev_t->t_avdp_r;
860 /* XXX: mux check required ? */
861 if (mux) {
862 /* XXX: t_avdp not to be required for sync, only added for tusb
863 * this indirectly necessitates requirement of t_avdp_r and
864 * t_avdp_w instead of having a single t_avdp
865 */
866 temp = max_t(u32, temp, gpmc_t->clk_activation + dev_t->t_avdh);
867 temp = max_t(u32, gpmc_t->adv_on + gpmc_ticks_to_ps(1), temp);
868 }
869 gpmc_t->adv_rd_off = gpmc_round_ps_to_ticks(temp);
870
871 /* oe_on */
872 temp = dev_t->t_oeasu; /* XXX: remove this ? */
873 if (mux) {
874 temp = max_t(u32, temp, gpmc_t->clk_activation + dev_t->t_ach);
875 temp = max_t(u32, temp, gpmc_t->adv_rd_off +
876 gpmc_ticks_to_ps(dev_t->cyc_aavdh_oe));
877 }
878 gpmc_t->oe_on = gpmc_round_ps_to_ticks(temp);
879
880 /* access */
881 /* XXX: any scope for improvement ?, by combining oe_on
882 * and clk_activation, need to check whether
883 * access = clk_activation + round to sync clk ?
884 */
885 temp = max_t(u32, dev_t->t_iaa, dev_t->cyc_iaa * gpmc_t->sync_clk);
886 temp += gpmc_t->clk_activation;
887 if (dev_t->cyc_oe)
888 temp = max_t(u32, temp, gpmc_t->oe_on +
889 gpmc_ticks_to_ps(dev_t->cyc_oe));
890 gpmc_t->access = gpmc_round_ps_to_ticks(temp);
891
892 gpmc_t->oe_off = gpmc_t->access + gpmc_ticks_to_ps(1);
893 gpmc_t->cs_rd_off = gpmc_t->oe_off;
894
895 /* rd_cycle */
896 temp = max_t(u32, dev_t->t_cez_r, dev_t->t_oez);
897 temp = gpmc_round_ps_to_sync_clk(temp, gpmc_t->sync_clk) +
898 gpmc_t->access;
899 /* XXX: barter t_ce_rdyz with t_cez_r ? */
900 if (dev_t->t_ce_rdyz)
901 temp = max_t(u32, temp, gpmc_t->cs_rd_off + dev_t->t_ce_rdyz);
902 gpmc_t->rd_cycle = gpmc_round_ps_to_ticks(temp);
903
904 return 0;
905}
906
907static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t,
908 struct gpmc_device_timings *dev_t,
909 bool mux)
910{
911 u32 temp;
912
913 /* adv_wr_off */
914 temp = dev_t->t_avdp_w;
915 if (mux) {
916 temp = max_t(u32, temp,
917 gpmc_t->clk_activation + dev_t->t_avdh);
918 temp = max_t(u32, gpmc_t->adv_on + gpmc_ticks_to_ps(1), temp);
919 }
920 gpmc_t->adv_wr_off = gpmc_round_ps_to_ticks(temp);
921
922 /* wr_data_mux_bus */
923 temp = max_t(u32, dev_t->t_weasu,
924 gpmc_t->clk_activation + dev_t->t_rdyo);
925 /* XXX: shouldn't mux be kept as a whole for wr_data_mux_bus ?,
926 * and in that case remember to handle we_on properly
927 */
928 if (mux) {
929 temp = max_t(u32, temp,
930 gpmc_t->adv_wr_off + dev_t->t_aavdh);
931 temp = max_t(u32, temp, gpmc_t->adv_wr_off +
932 gpmc_ticks_to_ps(dev_t->cyc_aavdh_we));
933 }
934 gpmc_t->wr_data_mux_bus = gpmc_round_ps_to_ticks(temp);
935
936 /* we_on */
937 if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS)
938 gpmc_t->we_on = gpmc_round_ps_to_ticks(dev_t->t_weasu);
939 else
940 gpmc_t->we_on = gpmc_t->wr_data_mux_bus;
941
942 /* wr_access */
943 /* XXX: gpmc_capability check reqd ? , even if not, will not harm */
944 gpmc_t->wr_access = gpmc_t->access;
945
946 /* we_off */
947 temp = gpmc_t->we_on + dev_t->t_wpl;
948 temp = max_t(u32, temp,
949 gpmc_t->wr_access + gpmc_ticks_to_ps(1));
950 temp = max_t(u32, temp,
951 gpmc_t->we_on + gpmc_ticks_to_ps(dev_t->cyc_wpl));
952 gpmc_t->we_off = gpmc_round_ps_to_ticks(temp);
953
954 gpmc_t->cs_wr_off = gpmc_round_ps_to_ticks(gpmc_t->we_off +
955 dev_t->t_wph);
956
957 /* wr_cycle */
958 temp = gpmc_round_ps_to_sync_clk(dev_t->t_cez_w, gpmc_t->sync_clk);
959 temp += gpmc_t->wr_access;
960 /* XXX: barter t_ce_rdyz with t_cez_w ? */
961 if (dev_t->t_ce_rdyz)
962 temp = max_t(u32, temp,
963 gpmc_t->cs_wr_off + dev_t->t_ce_rdyz);
964 gpmc_t->wr_cycle = gpmc_round_ps_to_ticks(temp);
965
966 return 0;
967}
968
969static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t,
970 struct gpmc_device_timings *dev_t,
971 bool mux)
972{
973 u32 temp;
974
975 /* adv_rd_off */
976 temp = dev_t->t_avdp_r;
977 if (mux)
978 temp = max_t(u32, gpmc_t->adv_on + gpmc_ticks_to_ps(1), temp);
979 gpmc_t->adv_rd_off = gpmc_round_ps_to_ticks(temp);
980
981 /* oe_on */
982 temp = dev_t->t_oeasu;
983 if (mux)
984 temp = max_t(u32, temp,
985 gpmc_t->adv_rd_off + dev_t->t_aavdh);
986 gpmc_t->oe_on = gpmc_round_ps_to_ticks(temp);
987
988 /* access */
989 temp = max_t(u32, dev_t->t_iaa, /* XXX: remove t_iaa in async ? */
990 gpmc_t->oe_on + dev_t->t_oe);
991 temp = max_t(u32, temp,
992 gpmc_t->cs_on + dev_t->t_ce);
993 temp = max_t(u32, temp,
994 gpmc_t->adv_on + dev_t->t_aa);
995 gpmc_t->access = gpmc_round_ps_to_ticks(temp);
996
997 gpmc_t->oe_off = gpmc_t->access + gpmc_ticks_to_ps(1);
998 gpmc_t->cs_rd_off = gpmc_t->oe_off;
999
1000 /* rd_cycle */
1001 temp = max_t(u32, dev_t->t_rd_cycle,
1002 gpmc_t->cs_rd_off + dev_t->t_cez_r);
1003 temp = max_t(u32, temp, gpmc_t->oe_off + dev_t->t_oez);
1004 gpmc_t->rd_cycle = gpmc_round_ps_to_ticks(temp);
1005
1006 return 0;
1007}
1008
1009static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t,
1010 struct gpmc_device_timings *dev_t,
1011 bool mux)
1012{
1013 u32 temp;
1014
1015 /* adv_wr_off */
1016 temp = dev_t->t_avdp_w;
1017 if (mux)
1018 temp = max_t(u32, gpmc_t->adv_on + gpmc_ticks_to_ps(1), temp);
1019 gpmc_t->adv_wr_off = gpmc_round_ps_to_ticks(temp);
1020
1021 /* wr_data_mux_bus */
1022 temp = dev_t->t_weasu;
1023 if (mux) {
1024 temp = max_t(u32, temp, gpmc_t->adv_wr_off + dev_t->t_aavdh);
1025 temp = max_t(u32, temp, gpmc_t->adv_wr_off +
1026 gpmc_ticks_to_ps(dev_t->cyc_aavdh_we));
1027 }
1028 gpmc_t->wr_data_mux_bus = gpmc_round_ps_to_ticks(temp);
1029
1030 /* we_on */
1031 if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS)
1032 gpmc_t->we_on = gpmc_round_ps_to_ticks(dev_t->t_weasu);
1033 else
1034 gpmc_t->we_on = gpmc_t->wr_data_mux_bus;
1035
1036 /* we_off */
1037 temp = gpmc_t->we_on + dev_t->t_wpl;
1038 gpmc_t->we_off = gpmc_round_ps_to_ticks(temp);
1039
1040 gpmc_t->cs_wr_off = gpmc_round_ps_to_ticks(gpmc_t->we_off +
1041 dev_t->t_wph);
1042
1043 /* wr_cycle */
1044 temp = max_t(u32, dev_t->t_wr_cycle,
1045 gpmc_t->cs_wr_off + dev_t->t_cez_w);
1046 gpmc_t->wr_cycle = gpmc_round_ps_to_ticks(temp);
1047
1048 return 0;
1049}
1050
1051static int gpmc_calc_sync_common_timings(struct gpmc_timings *gpmc_t,
1052 struct gpmc_device_timings *dev_t)
1053{
1054 u32 temp;
1055
1056 gpmc_t->sync_clk = gpmc_calc_divider(dev_t->clk) *
1057 gpmc_get_fclk_period();
1058
1059 gpmc_t->page_burst_access = gpmc_round_ps_to_sync_clk(
1060 dev_t->t_bacc,
1061 gpmc_t->sync_clk);
1062
1063 temp = max_t(u32, dev_t->t_ces, dev_t->t_avds);
1064 gpmc_t->clk_activation = gpmc_round_ps_to_ticks(temp);
1065
1066 if (gpmc_calc_divider(gpmc_t->sync_clk) != 1)
1067 return 0;
1068
1069 if (dev_t->ce_xdelay)
1070 gpmc_t->bool_timings.cs_extra_delay = true;
1071 if (dev_t->avd_xdelay)
1072 gpmc_t->bool_timings.adv_extra_delay = true;
1073 if (dev_t->oe_xdelay)
1074 gpmc_t->bool_timings.oe_extra_delay = true;
1075 if (dev_t->we_xdelay)
1076 gpmc_t->bool_timings.we_extra_delay = true;
1077
1078 return 0;
1079}
1080
1081static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t,
1082 struct gpmc_device_timings *dev_t,
1083 bool sync)
1084{
1085 u32 temp;
1086
1087 /* cs_on */
1088 gpmc_t->cs_on = gpmc_round_ps_to_ticks(dev_t->t_ceasu);
1089
1090 /* adv_on */
1091 temp = dev_t->t_avdasu;
1092 if (dev_t->t_ce_avd)
1093 temp = max_t(u32, temp,
1094 gpmc_t->cs_on + dev_t->t_ce_avd);
1095 gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp);
1096
1097 if (sync)
1098 gpmc_calc_sync_common_timings(gpmc_t, dev_t);
1099
1100 return 0;
1101}
1102
1103/* TODO: remove this function once all peripherals are confirmed to
1104 * work with generic timing. Simultaneously gpmc_cs_set_timings()
1105 * has to be modified to handle timings in ps instead of ns
1106*/
1107static void gpmc_convert_ps_to_ns(struct gpmc_timings *t)
1108{
1109 t->cs_on /= 1000;
1110 t->cs_rd_off /= 1000;
1111 t->cs_wr_off /= 1000;
1112 t->adv_on /= 1000;
1113 t->adv_rd_off /= 1000;
1114 t->adv_wr_off /= 1000;
1115 t->we_on /= 1000;
1116 t->we_off /= 1000;
1117 t->oe_on /= 1000;
1118 t->oe_off /= 1000;
1119 t->page_burst_access /= 1000;
1120 t->access /= 1000;
1121 t->rd_cycle /= 1000;
1122 t->wr_cycle /= 1000;
1123 t->bus_turnaround /= 1000;
1124 t->cycle2cycle_delay /= 1000;
1125 t->wait_monitoring /= 1000;
1126 t->clk_activation /= 1000;
1127 t->wr_access /= 1000;
1128 t->wr_data_mux_bus /= 1000;
1129}
1130
1131int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
1132 struct gpmc_settings *gpmc_s,
1133 struct gpmc_device_timings *dev_t)
1134{
1135 bool mux = false, sync = false;
1136
1137 if (gpmc_s) {
1138 mux = gpmc_s->mux_add_data ? true : false;
1139 sync = (gpmc_s->sync_read || gpmc_s->sync_write);
1140 }
1141
1142 memset(gpmc_t, 0, sizeof(*gpmc_t));
1143
1144 gpmc_calc_common_timings(gpmc_t, dev_t, sync);
1145
1146 if (gpmc_s && gpmc_s->sync_read)
1147 gpmc_calc_sync_read_timings(gpmc_t, dev_t, mux);
1148 else
1149 gpmc_calc_async_read_timings(gpmc_t, dev_t, mux);
1150
1151 if (gpmc_s && gpmc_s->sync_write)
1152 gpmc_calc_sync_write_timings(gpmc_t, dev_t, mux);
1153 else
1154 gpmc_calc_async_write_timings(gpmc_t, dev_t, mux);
1155
1156 /* TODO: remove, see function definition */
1157 gpmc_convert_ps_to_ns(gpmc_t);
1158
1159 return 0;
1160}
1161
1162/**
1163 * gpmc_cs_program_settings - programs non-timing related settings
1164 * @cs: GPMC chip-select to program
1165 * @p: pointer to GPMC settings structure
1166 *
1167 * Programs non-timing related settings for a GPMC chip-select, such as
1168 * bus-width, burst configuration, etc. Function should be called once
1169 * for each chip-select that is being used and must be called before
1170 * calling gpmc_cs_set_timings() as timing parameters in the CONFIG1
1171 * register will be initialised to zero by this function. Returns 0 on
1172 * success and appropriate negative error code on failure.
1173 */
1174int gpmc_cs_program_settings(int cs, struct gpmc_settings *p)
1175{
1176 u32 config1;
1177
1178 if ((!p->device_width) || (p->device_width > GPMC_DEVWIDTH_16BIT)) {
1179 pr_err("%s: invalid width %d!", __func__, p->device_width);
1180 return -EINVAL;
1181 }
1182
1183 /* Address-data multiplexing not supported for NAND devices */
1184 if (p->device_nand && p->mux_add_data) {
1185 pr_err("%s: invalid configuration!\n", __func__);
1186 return -EINVAL;
1187 }
1188
1189 if ((p->mux_add_data > GPMC_MUX_AD) ||
1190 ((p->mux_add_data == GPMC_MUX_AAD) &&
1191 !(gpmc_capability & GPMC_HAS_MUX_AAD))) {
1192 pr_err("%s: invalid multiplex configuration!\n", __func__);
1193 return -EINVAL;
1194 }
1195
1196 /* Page/burst mode supports lengths of 4, 8 and 16 bytes */
1197 if (p->burst_read || p->burst_write) {
1198 switch (p->burst_len) {
1199 case GPMC_BURST_4:
1200 case GPMC_BURST_8:
1201 case GPMC_BURST_16:
1202 break;
1203 default:
1204 pr_err("%s: invalid page/burst-length (%d)\n",
1205 __func__, p->burst_len);
1206 return -EINVAL;
1207 }
1208 }
1209
1210 if (p->wait_pin > gpmc_nr_waitpins) {
1211 pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin);
1212 return -EINVAL;
1213 }
1214
1215 config1 = GPMC_CONFIG1_DEVICESIZE((p->device_width - 1));
1216
1217 if (p->sync_read)
1218 config1 |= GPMC_CONFIG1_READTYPE_SYNC;
1219 if (p->sync_write)
1220 config1 |= GPMC_CONFIG1_WRITETYPE_SYNC;
1221 if (p->wait_on_read)
1222 config1 |= GPMC_CONFIG1_WAIT_READ_MON;
1223 if (p->wait_on_write)
1224 config1 |= GPMC_CONFIG1_WAIT_WRITE_MON;
1225 if (p->wait_on_read || p->wait_on_write)
1226 config1 |= GPMC_CONFIG1_WAIT_PIN_SEL(p->wait_pin);
1227 if (p->device_nand)
1228 config1 |= GPMC_CONFIG1_DEVICETYPE(GPMC_DEVICETYPE_NAND);
1229 if (p->mux_add_data)
1230 config1 |= GPMC_CONFIG1_MUXTYPE(p->mux_add_data);
1231 if (p->burst_read)
1232 config1 |= GPMC_CONFIG1_READMULTIPLE_SUPP;
1233 if (p->burst_write)
1234 config1 |= GPMC_CONFIG1_WRITEMULTIPLE_SUPP;
1235 if (p->burst_read || p->burst_write) {
1236 config1 |= GPMC_CONFIG1_PAGE_LEN(p->burst_len >> 3);
1237 config1 |= p->burst_wrap ? GPMC_CONFIG1_WRAPBURST_SUPP : 0;
1238 }
1239
1240 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, config1);
1241
1242 return 0;
1243}
1244
1245#ifdef CONFIG_OF
1246static const struct of_device_id gpmc_dt_ids[] = {
1247 { .compatible = "ti,omap2420-gpmc" },
1248 { .compatible = "ti,omap2430-gpmc" },
1249 { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */
1250 { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */
1251 { .compatible = "ti,am3352-gpmc" }, /* am335x devices */
1252 { }
1253};
1254MODULE_DEVICE_TABLE(of, gpmc_dt_ids);
1255
1256/**
1257 * gpmc_read_settings_dt - read gpmc settings from device-tree
1258 * @np: pointer to device-tree node for a gpmc child device
1259 * @p: pointer to gpmc settings structure
1260 *
1261 * Reads the GPMC settings for a GPMC child device from device-tree and
1262 * stores them in the GPMC settings structure passed. The GPMC settings
1263 * structure is initialised to zero by this function and so any
1264 * previously stored settings will be cleared.
1265 */
1266void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p)
1267{
1268 memset(p, 0, sizeof(struct gpmc_settings));
1269
1270 p->sync_read = of_property_read_bool(np, "gpmc,sync-read");
1271 p->sync_write = of_property_read_bool(np, "gpmc,sync-write");
1272 of_property_read_u32(np, "gpmc,device-width", &p->device_width);
1273 of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data);
1274
1275 if (!of_property_read_u32(np, "gpmc,burst-length", &p->burst_len)) {
1276 p->burst_wrap = of_property_read_bool(np, "gpmc,burst-wrap");
1277 p->burst_read = of_property_read_bool(np, "gpmc,burst-read");
1278 p->burst_write = of_property_read_bool(np, "gpmc,burst-write");
1279 if (!p->burst_read && !p->burst_write)
1280 pr_warn("%s: page/burst-length set but not used!\n",
1281 __func__);
1282 }
1283
1284 if (!of_property_read_u32(np, "gpmc,wait-pin", &p->wait_pin)) {
1285 p->wait_on_read = of_property_read_bool(np,
1286 "gpmc,wait-on-read");
1287 p->wait_on_write = of_property_read_bool(np,
1288 "gpmc,wait-on-write");
1289 if (!p->wait_on_read && !p->wait_on_write)
1290 pr_debug("%s: rd/wr wait monitoring not enabled!\n",
1291 __func__);
1292 }
1293}
1294
1295static void __maybe_unused gpmc_read_timings_dt(struct device_node *np,
1296 struct gpmc_timings *gpmc_t)
1297{
1298 struct gpmc_bool_timings *p;
1299
1300 if (!np || !gpmc_t)
1301 return;
1302
1303 memset(gpmc_t, 0, sizeof(*gpmc_t));
1304
1305 /* minimum clock period for syncronous mode */
1306 of_property_read_u32(np, "gpmc,sync-clk-ps", &gpmc_t->sync_clk);
1307
1308 /* chip select timtings */
1309 of_property_read_u32(np, "gpmc,cs-on-ns", &gpmc_t->cs_on);
1310 of_property_read_u32(np, "gpmc,cs-rd-off-ns", &gpmc_t->cs_rd_off);
1311 of_property_read_u32(np, "gpmc,cs-wr-off-ns", &gpmc_t->cs_wr_off);
1312
1313 /* ADV signal timings */
1314 of_property_read_u32(np, "gpmc,adv-on-ns", &gpmc_t->adv_on);
1315 of_property_read_u32(np, "gpmc,adv-rd-off-ns", &gpmc_t->adv_rd_off);
1316 of_property_read_u32(np, "gpmc,adv-wr-off-ns", &gpmc_t->adv_wr_off);
1317
1318 /* WE signal timings */
1319 of_property_read_u32(np, "gpmc,we-on-ns", &gpmc_t->we_on);
1320 of_property_read_u32(np, "gpmc,we-off-ns", &gpmc_t->we_off);
1321
1322 /* OE signal timings */
1323 of_property_read_u32(np, "gpmc,oe-on-ns", &gpmc_t->oe_on);
1324 of_property_read_u32(np, "gpmc,oe-off-ns", &gpmc_t->oe_off);
1325
1326 /* access and cycle timings */
1327 of_property_read_u32(np, "gpmc,page-burst-access-ns",
1328 &gpmc_t->page_burst_access);
1329 of_property_read_u32(np, "gpmc,access-ns", &gpmc_t->access);
1330 of_property_read_u32(np, "gpmc,rd-cycle-ns", &gpmc_t->rd_cycle);
1331 of_property_read_u32(np, "gpmc,wr-cycle-ns", &gpmc_t->wr_cycle);
1332 of_property_read_u32(np, "gpmc,bus-turnaround-ns",
1333 &gpmc_t->bus_turnaround);
1334 of_property_read_u32(np, "gpmc,cycle2cycle-delay-ns",
1335 &gpmc_t->cycle2cycle_delay);
1336 of_property_read_u32(np, "gpmc,wait-monitoring-ns",
1337 &gpmc_t->wait_monitoring);
1338 of_property_read_u32(np, "gpmc,clk-activation-ns",
1339 &gpmc_t->clk_activation);
1340
1341 /* only applicable to OMAP3+ */
1342 of_property_read_u32(np, "gpmc,wr-access-ns", &gpmc_t->wr_access);
1343 of_property_read_u32(np, "gpmc,wr-data-mux-bus-ns",
1344 &gpmc_t->wr_data_mux_bus);
1345
1346 /* bool timing parameters */
1347 p = &gpmc_t->bool_timings;
1348
1349 p->cycle2cyclediffcsen =
1350 of_property_read_bool(np, "gpmc,cycle2cycle-diffcsen");
1351 p->cycle2cyclesamecsen =
1352 of_property_read_bool(np, "gpmc,cycle2cycle-samecsen");
1353 p->we_extra_delay = of_property_read_bool(np, "gpmc,we-extra-delay");
1354 p->oe_extra_delay = of_property_read_bool(np, "gpmc,oe-extra-delay");
1355 p->adv_extra_delay = of_property_read_bool(np, "gpmc,adv-extra-delay");
1356 p->cs_extra_delay = of_property_read_bool(np, "gpmc,cs-extra-delay");
1357 p->time_para_granularity =
1358 of_property_read_bool(np, "gpmc,time-para-granularity");
1359}
1360
1361#if IS_ENABLED(CONFIG_MTD_NAND)
1362
1363static const char * const nand_xfer_types[] = {
1364 [NAND_OMAP_PREFETCH_POLLED] = "prefetch-polled",
1365 [NAND_OMAP_POLLED] = "polled",
1366 [NAND_OMAP_PREFETCH_DMA] = "prefetch-dma",
1367 [NAND_OMAP_PREFETCH_IRQ] = "prefetch-irq",
1368};
1369
1370static int gpmc_probe_nand_child(struct platform_device *pdev,
1371 struct device_node *child)
1372{
1373 u32 val;
1374 const char *s;
1375 struct gpmc_timings gpmc_t;
1376 struct omap_nand_platform_data *gpmc_nand_data;
1377
1378 if (of_property_read_u32(child, "reg", &val) < 0) {
1379 dev_err(&pdev->dev, "%s has no 'reg' property\n",
1380 child->full_name);
1381 return -ENODEV;
1382 }
1383
1384 gpmc_nand_data = devm_kzalloc(&pdev->dev, sizeof(*gpmc_nand_data),
1385 GFP_KERNEL);
1386 if (!gpmc_nand_data)
1387 return -ENOMEM;
1388
1389 gpmc_nand_data->cs = val;
1390 gpmc_nand_data->of_node = child;
1391
1392 /* Detect availability of ELM module */
1393 gpmc_nand_data->elm_of_node = of_parse_phandle(child, "ti,elm-id", 0);
1394 if (gpmc_nand_data->elm_of_node == NULL)
1395 gpmc_nand_data->elm_of_node =
1396 of_parse_phandle(child, "elm_id", 0);
1397 if (gpmc_nand_data->elm_of_node == NULL)
1398 pr_warn("%s: ti,elm-id property not found\n", __func__);
1399
1400 /* select ecc-scheme for NAND */
1401 if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) {
1402 pr_err("%s: ti,nand-ecc-opt not found\n", __func__);
1403 return -ENODEV;
1404 }
1405
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"))
1410 gpmc_nand_data->ecc_opt =
1411 OMAP_ECC_HAM1_CODE_HW;
1412 else if (!strcmp(s, "bch4"))
1413 if (gpmc_nand_data->elm_of_node)
1414 gpmc_nand_data->ecc_opt =
1415 OMAP_ECC_BCH4_CODE_HW;
1416 else
1417 gpmc_nand_data->ecc_opt =
1418 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW;
1419 else if (!strcmp(s, "bch8"))
1420 if (gpmc_nand_data->elm_of_node)
1421 gpmc_nand_data->ecc_opt =
1422 OMAP_ECC_BCH8_CODE_HW;
1423 else
1424 gpmc_nand_data->ecc_opt =
1425 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW;
1426 else if (!strcmp(s, "bch16"))
1427 if (gpmc_nand_data->elm_of_node)
1428 gpmc_nand_data->ecc_opt =
1429 OMAP_ECC_BCH16_CODE_HW;
1430 else
1431 pr_err("%s: BCH16 requires ELM support\n", __func__);
1432 else
1433 pr_err("%s: ti,nand-ecc-opt invalid value\n", __func__);
1434
1435 /* select data transfer mode for NAND controller */
1436 if (!of_property_read_string(child, "ti,nand-xfer-type", &s))
1437 for (val = 0; val < ARRAY_SIZE(nand_xfer_types); val++)
1438 if (!strcasecmp(s, nand_xfer_types[val])) {
1439 gpmc_nand_data->xfer_type = val;
1440 break;
1441 }
1442
1443 gpmc_nand_data->flash_bbt = of_get_nand_on_flash_bbt(child);
1444
1445 val = of_get_nand_bus_width(child);
1446 if (val == 16)
1447 gpmc_nand_data->devsize = NAND_BUSWIDTH_16;
1448
1449 gpmc_read_timings_dt(child, &gpmc_t);
1450 gpmc_nand_init(gpmc_nand_data, &gpmc_t);
1451
1452 return 0;
1453}
1454#else
1455static int gpmc_probe_nand_child(struct platform_device *pdev,
1456 struct device_node *child)
1457{
1458 return 0;
1459}
1460#endif
1461
1462#if IS_ENABLED(CONFIG_MTD_ONENAND)
1463static int gpmc_probe_onenand_child(struct platform_device *pdev,
1464 struct device_node *child)
1465{
1466 u32 val;
1467 struct omap_onenand_platform_data *gpmc_onenand_data;
1468
1469 if (of_property_read_u32(child, "reg", &val) < 0) {
1470 dev_err(&pdev->dev, "%s has no 'reg' property\n",
1471 child->full_name);
1472 return -ENODEV;
1473 }
1474
1475 gpmc_onenand_data = devm_kzalloc(&pdev->dev, sizeof(*gpmc_onenand_data),
1476 GFP_KERNEL);
1477 if (!gpmc_onenand_data)
1478 return -ENOMEM;
1479
1480 gpmc_onenand_data->cs = val;
1481 gpmc_onenand_data->of_node = child;
1482 gpmc_onenand_data->dma_channel = -1;
1483
1484 if (!of_property_read_u32(child, "dma-channel", &val))
1485 gpmc_onenand_data->dma_channel = val;
1486
1487 gpmc_onenand_init(gpmc_onenand_data);
1488
1489 return 0;
1490}
1491#else
1492static int gpmc_probe_onenand_child(struct platform_device *pdev,
1493 struct device_node *child)
1494{
1495 return 0;
1496}
1497#endif
1498
1499/**
1500 * gpmc_probe_generic_child - configures the gpmc for a child device
1501 * @pdev: pointer to gpmc platform device
1502 * @child: pointer to device-tree node for child device
1503 *
1504 * Allocates and configures a GPMC chip-select for a child device.
1505 * Returns 0 on success and appropriate negative error code on failure.
1506 */
1507static int gpmc_probe_generic_child(struct platform_device *pdev,
1508 struct device_node *child)
1509{
1510 struct gpmc_settings gpmc_s;
1511 struct gpmc_timings gpmc_t;
1512 struct resource res;
1513 unsigned long base;
1514 int ret, cs;
1515
1516 if (of_property_read_u32(child, "reg", &cs) < 0) {
1517 dev_err(&pdev->dev, "%s has no 'reg' property\n",
1518 child->full_name);
1519 return -ENODEV;
1520 }
1521
1522 if (of_address_to_resource(child, 0, &res) < 0) {
1523 dev_err(&pdev->dev, "%s has malformed 'reg' property\n",
1524 child->full_name);
1525 return -ENODEV;
1526 }
1527
1528 ret = gpmc_cs_request(cs, resource_size(&res), &base);
1529 if (ret < 0) {
1530 dev_err(&pdev->dev, "cannot request GPMC CS %d\n", cs);
1531 return ret;
1532 }
1533
1534 /*
1535 * For some GPMC devices we still need to rely on the bootloader
1536 * timings because the devices can be connected via FPGA. So far
1537 * the list is smc91x on the omap2 SDP boards, and 8250 on zooms.
1538 * REVISIT: Add timing support from slls644g.pdf and from the
1539 * lan91c96 manual.
1540 */
1541 if (of_device_is_compatible(child, "ns16550a") ||
1542 of_device_is_compatible(child, "smsc,lan91c94") ||
1543 of_device_is_compatible(child, "smsc,lan91c111")) {
1544 dev_warn(&pdev->dev,
1545 "%s using bootloader timings on CS%d\n",
1546 child->name, cs);
1547 goto no_timings;
1548 }
1549
1550 /*
1551 * FIXME: gpmc_cs_request() will map the CS to an arbitary
1552 * location in the gpmc address space. When booting with
1553 * device-tree we want the NOR flash to be mapped to the
1554 * location specified in the device-tree blob. So remap the
1555 * CS to this location. Once DT migration is complete should
1556 * just make gpmc_cs_request() map a specific address.
1557 */
1558 ret = gpmc_cs_remap(cs, res.start);
1559 if (ret < 0) {
1560 dev_err(&pdev->dev, "cannot remap GPMC CS %d to %pa\n",
1561 cs, &res.start);
1562 goto err;
1563 }
1564
1565 gpmc_read_settings_dt(child, &gpmc_s);
1566
1567 ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width);
1568 if (ret < 0)
1569 goto err;
1570
1571 ret = gpmc_cs_program_settings(cs, &gpmc_s);
1572 if (ret < 0)
1573 goto err;
1574
1575 gpmc_read_timings_dt(child, &gpmc_t);
1576 gpmc_cs_set_timings(cs, &gpmc_t);
1577
1578no_timings:
1579 if (of_platform_device_create(child, NULL, &pdev->dev))
1580 return 0;
1581
1582 dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name);
1583 ret = -ENODEV;
1584
1585err:
1586 gpmc_cs_free(cs);
1587
1588 return ret;
1589}
1590
1591static int gpmc_probe_dt(struct platform_device *pdev)
1592{
1593 int ret;
1594 struct device_node *child;
1595 const struct of_device_id *of_id =
1596 of_match_device(gpmc_dt_ids, &pdev->dev);
1597
1598 if (!of_id)
1599 return 0;
1600
1601 ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-cs",
1602 &gpmc_cs_num);
1603 if (ret < 0) {
1604 pr_err("%s: number of chip-selects not defined\n", __func__);
1605 return ret;
1606 } else if (gpmc_cs_num < 1) {
1607 pr_err("%s: all chip-selects are disabled\n", __func__);
1608 return -EINVAL;
1609 } else if (gpmc_cs_num > GPMC_CS_NUM) {
1610 pr_err("%s: number of supported chip-selects cannot be > %d\n",
1611 __func__, GPMC_CS_NUM);
1612 return -EINVAL;
1613 }
1614
1615 ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-waitpins",
1616 &gpmc_nr_waitpins);
1617 if (ret < 0) {
1618 pr_err("%s: number of wait pins not found!\n", __func__);
1619 return ret;
1620 }
1621
1622 for_each_available_child_of_node(pdev->dev.of_node, child) {
1623
1624 if (!child->name)
1625 continue;
1626
1627 if (of_node_cmp(child->name, "nand") == 0)
1628 ret = gpmc_probe_nand_child(pdev, child);
1629 else if (of_node_cmp(child->name, "onenand") == 0)
1630 ret = gpmc_probe_onenand_child(pdev, child);
1631 else if (of_node_cmp(child->name, "ethernet") == 0 ||
1632 of_node_cmp(child->name, "nor") == 0 ||
1633 of_node_cmp(child->name, "uart") == 0)
1634 ret = gpmc_probe_generic_child(pdev, child);
1635
1636 if (WARN(ret < 0, "%s: probing gpmc child %s failed\n",
1637 __func__, child->full_name))
1638 of_node_put(child);
1639 }
1640
1641 return 0;
1642}
1643#else
1644static int gpmc_probe_dt(struct platform_device *pdev)
1645{
1646 return 0;
1647}
1648#endif
1649
1650static int gpmc_probe(struct platform_device *pdev)
1651{
1652 int rc;
1653 u32 l;
1654 struct resource *res;
1655
1656 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1657 if (res == NULL)
1658 return -ENOENT;
1659
1660 phys_base = res->start;
1661 mem_size = resource_size(res);
1662
1663 gpmc_base = devm_ioremap_resource(&pdev->dev, res);
1664 if (IS_ERR(gpmc_base))
1665 return PTR_ERR(gpmc_base);
1666
1667 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1668 if (res == NULL)
1669 dev_warn(&pdev->dev, "Failed to get resource: irq\n");
1670 else
1671 gpmc_irq = res->start;
1672
1673 gpmc_l3_clk = clk_get(&pdev->dev, "fck");
1674 if (IS_ERR(gpmc_l3_clk)) {
1675 dev_err(&pdev->dev, "error: clk_get\n");
1676 gpmc_irq = 0;
1677 return PTR_ERR(gpmc_l3_clk);
1678 }
1679
1680 pm_runtime_enable(&pdev->dev);
1681 pm_runtime_get_sync(&pdev->dev);
1682
1683 gpmc_dev = &pdev->dev;
1684
1685 l = gpmc_read_reg(GPMC_REVISION);
1686
1687 /*
1688 * FIXME: Once device-tree migration is complete the below flags
1689 * should be populated based upon the device-tree compatible
1690 * string. For now just use the IP revision. OMAP3+ devices have
1691 * the wr_access and wr_data_mux_bus register fields. OMAP4+
1692 * devices support the addr-addr-data multiplex protocol.
1693 *
1694 * GPMC IP revisions:
1695 * - OMAP24xx = 2.0
1696 * - OMAP3xxx = 5.0
1697 * - OMAP44xx/54xx/AM335x = 6.0
1698 */
1699 if (GPMC_REVISION_MAJOR(l) > 0x4)
1700 gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS;
1701 if (GPMC_REVISION_MAJOR(l) > 0x5)
1702 gpmc_capability |= GPMC_HAS_MUX_AAD;
1703 dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l),
1704 GPMC_REVISION_MINOR(l));
1705
1706 gpmc_mem_init();
1707
1708 if (gpmc_setup_irq() < 0)
1709 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n");
1710
1711 /* Now the GPMC is initialised, unreserve the chip-selects */
1712 gpmc_cs_map = 0;
1713
1714 if (!pdev->dev.of_node) {
1715 gpmc_cs_num = GPMC_CS_NUM;
1716 gpmc_nr_waitpins = GPMC_NR_WAITPINS;
1717 }
1718
1719 rc = gpmc_probe_dt(pdev);
1720 if (rc < 0) {
1721 pm_runtime_put_sync(&pdev->dev);
1722 clk_put(gpmc_l3_clk);
1723 dev_err(gpmc_dev, "failed to probe DT parameters\n");
1724 return rc;
1725 }
1726
1727 return 0;
1728}
1729
1730static int gpmc_remove(struct platform_device *pdev)
1731{
1732 gpmc_free_irq();
1733 gpmc_mem_exit();
1734 pm_runtime_put_sync(&pdev->dev);
1735 pm_runtime_disable(&pdev->dev);
1736 gpmc_dev = NULL;
1737 return 0;
1738}
1739
1740#ifdef CONFIG_PM_SLEEP
1741static int gpmc_suspend(struct device *dev)
1742{
1743 omap3_gpmc_save_context();
1744 pm_runtime_put_sync(dev);
1745 return 0;
1746}
1747
1748static int gpmc_resume(struct device *dev)
1749{
1750 pm_runtime_get_sync(dev);
1751 omap3_gpmc_restore_context();
1752 return 0;
1753}
1754#endif
1755
1756static SIMPLE_DEV_PM_OPS(gpmc_pm_ops, gpmc_suspend, gpmc_resume);
1757
1758static struct platform_driver gpmc_driver = {
1759 .probe = gpmc_probe,
1760 .remove = gpmc_remove,
1761 .driver = {
1762 .name = DEVICE_NAME,
1763 .owner = THIS_MODULE,
1764 .of_match_table = of_match_ptr(gpmc_dt_ids),
1765 .pm = &gpmc_pm_ops,
1766 },
1767};
1768
1769static __init int gpmc_init(void)
1770{
1771 return platform_driver_register(&gpmc_driver);
1772}
1773
1774static __exit void gpmc_exit(void)
1775{
1776 platform_driver_unregister(&gpmc_driver);
1777
1778}
1779
1780omap_postcore_initcall(gpmc_init);
1781module_exit(gpmc_exit);
1782
1783static int __init omap_gpmc_init(void)
1784{
1785 struct omap_hwmod *oh;
1786 struct platform_device *pdev;
1787 char *oh_name = "gpmc";
1788
1789 /*
1790 * if the board boots up with a populated DT, do not
1791 * manually add the device from this initcall
1792 */
1793 if (of_have_populated_dt())
1794 return -ENODEV;
1795
1796 oh = omap_hwmod_lookup(oh_name);
1797 if (!oh) {
1798 pr_err("Could not look up %s\n", oh_name);
1799 return -ENODEV;
1800 }
1801
1802 pdev = omap_device_build(DEVICE_NAME, -1, oh, NULL, 0);
1803 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
1804
1805 return PTR_RET(pdev);
1806}
1807omap_postcore_initcall(omap_gpmc_init);
1808
1809static irqreturn_t gpmc_handle_irq(int irq, void *dev)
1810{
1811 int i;
1812 u32 regval;
1813
1814 regval = gpmc_read_reg(GPMC_IRQSTATUS);
1815
1816 if (!regval)
1817 return IRQ_NONE;
1818
1819 for (i = 0; i < GPMC_NR_IRQ; i++)
1820 if (regval & gpmc_client_irq[i].bitmask)
1821 generic_handle_irq(gpmc_client_irq[i].irq);
1822
1823 gpmc_write_reg(GPMC_IRQSTATUS, regval);
1824
1825 return IRQ_HANDLED;
1826}
1827
1828static struct omap3_gpmc_regs gpmc_context;
1829
1830void omap3_gpmc_save_context(void)
1831{
1832 int i;
1833
1834 gpmc_context.sysconfig = gpmc_read_reg(GPMC_SYSCONFIG);
1835 gpmc_context.irqenable = gpmc_read_reg(GPMC_IRQENABLE);
1836 gpmc_context.timeout_ctrl = gpmc_read_reg(GPMC_TIMEOUT_CONTROL);
1837 gpmc_context.config = gpmc_read_reg(GPMC_CONFIG);
1838 gpmc_context.prefetch_config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
1839 gpmc_context.prefetch_config2 = gpmc_read_reg(GPMC_PREFETCH_CONFIG2);
1840 gpmc_context.prefetch_control = gpmc_read_reg(GPMC_PREFETCH_CONTROL);
1841 for (i = 0; i < gpmc_cs_num; i++) {
1842 gpmc_context.cs_context[i].is_valid = gpmc_cs_mem_enabled(i);
1843 if (gpmc_context.cs_context[i].is_valid) {
1844 gpmc_context.cs_context[i].config1 =
1845 gpmc_cs_read_reg(i, GPMC_CS_CONFIG1);
1846 gpmc_context.cs_context[i].config2 =
1847 gpmc_cs_read_reg(i, GPMC_CS_CONFIG2);
1848 gpmc_context.cs_context[i].config3 =
1849 gpmc_cs_read_reg(i, GPMC_CS_CONFIG3);
1850 gpmc_context.cs_context[i].config4 =
1851 gpmc_cs_read_reg(i, GPMC_CS_CONFIG4);
1852 gpmc_context.cs_context[i].config5 =
1853 gpmc_cs_read_reg(i, GPMC_CS_CONFIG5);
1854 gpmc_context.cs_context[i].config6 =
1855 gpmc_cs_read_reg(i, GPMC_CS_CONFIG6);
1856 gpmc_context.cs_context[i].config7 =
1857 gpmc_cs_read_reg(i, GPMC_CS_CONFIG7);
1858 }
1859 }
1860}
1861
1862void omap3_gpmc_restore_context(void)
1863{
1864 int i;
1865
1866 gpmc_write_reg(GPMC_SYSCONFIG, gpmc_context.sysconfig);
1867 gpmc_write_reg(GPMC_IRQENABLE, gpmc_context.irqenable);
1868 gpmc_write_reg(GPMC_TIMEOUT_CONTROL, gpmc_context.timeout_ctrl);
1869 gpmc_write_reg(GPMC_CONFIG, gpmc_context.config);
1870 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, gpmc_context.prefetch_config1);
1871 gpmc_write_reg(GPMC_PREFETCH_CONFIG2, gpmc_context.prefetch_config2);
1872 gpmc_write_reg(GPMC_PREFETCH_CONTROL, gpmc_context.prefetch_control);
1873 for (i = 0; i < gpmc_cs_num; i++) {
1874 if (gpmc_context.cs_context[i].is_valid) {
1875 gpmc_cs_write_reg(i, GPMC_CS_CONFIG1,
1876 gpmc_context.cs_context[i].config1);
1877 gpmc_cs_write_reg(i, GPMC_CS_CONFIG2,
1878 gpmc_context.cs_context[i].config2);
1879 gpmc_cs_write_reg(i, GPMC_CS_CONFIG3,
1880 gpmc_context.cs_context[i].config3);
1881 gpmc_cs_write_reg(i, GPMC_CS_CONFIG4,
1882 gpmc_context.cs_context[i].config4);
1883 gpmc_cs_write_reg(i, GPMC_CS_CONFIG5,
1884 gpmc_context.cs_context[i].config5);
1885 gpmc_cs_write_reg(i, GPMC_CS_CONFIG6,
1886 gpmc_context.cs_context[i].config6);
1887 gpmc_cs_write_reg(i, GPMC_CS_CONFIG7,
1888 gpmc_context.cs_context[i].config7);
1889 }
1890 }
1891}
diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index 707f6d58edd5..9caa41a6cb04 100644
--- a/arch/arm/mach-omap2/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -6,226 +6,9 @@
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 *
10 * Do not include this file in any new code, this will get removed
11 * once omap3 boots in device tree only mode.
12 *
9 */ 13 */
10 14#include <linux/omap-gpmc.h>
11#ifndef __OMAP2_GPMC_H
12#define __OMAP2_GPMC_H
13
14#include <linux/platform_data/mtd-nand-omap2.h>
15
16/* Maximum Number of Chip Selects */
17#define GPMC_CS_NUM 8
18
19#define GPMC_CS_CONFIG1 0x00
20#define GPMC_CS_CONFIG2 0x04
21#define GPMC_CS_CONFIG3 0x08
22#define GPMC_CS_CONFIG4 0x0c
23#define GPMC_CS_CONFIG5 0x10
24#define GPMC_CS_CONFIG6 0x14
25#define GPMC_CS_CONFIG7 0x18
26#define GPMC_CS_NAND_COMMAND 0x1c
27#define GPMC_CS_NAND_ADDRESS 0x20
28#define GPMC_CS_NAND_DATA 0x24
29
30/* Control Commands */
31#define GPMC_CONFIG_RDY_BSY 0x00000001
32#define GPMC_CONFIG_DEV_SIZE 0x00000002
33#define GPMC_CONFIG_DEV_TYPE 0x00000003
34#define GPMC_SET_IRQ_STATUS 0x00000004
35#define GPMC_CONFIG_WP 0x00000005
36
37#define GPMC_ENABLE_IRQ 0x0000000d
38
39/* ECC commands */
40#define GPMC_ECC_READ 0 /* Reset Hardware ECC for read */
41#define GPMC_ECC_WRITE 1 /* Reset Hardware ECC for write */
42#define GPMC_ECC_READSYN 2 /* Reset before syndrom is read back */
43
44#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
45#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
46#define GPMC_CONFIG1_READTYPE_ASYNC (0 << 29)
47#define GPMC_CONFIG1_READTYPE_SYNC (1 << 29)
48#define GPMC_CONFIG1_WRITEMULTIPLE_SUPP (1 << 28)
49#define GPMC_CONFIG1_WRITETYPE_ASYNC (0 << 27)
50#define GPMC_CONFIG1_WRITETYPE_SYNC (1 << 27)
51#define GPMC_CONFIG1_CLKACTIVATIONTIME(val) ((val & 3) << 25)
52#define GPMC_CONFIG1_PAGE_LEN(val) ((val & 3) << 23)
53#define GPMC_CONFIG1_WAIT_READ_MON (1 << 22)
54#define GPMC_CONFIG1_WAIT_WRITE_MON (1 << 21)
55#define GPMC_CONFIG1_WAIT_MON_IIME(val) ((val & 3) << 18)
56#define GPMC_CONFIG1_WAIT_PIN_SEL(val) ((val & 3) << 16)
57#define GPMC_CONFIG1_DEVICESIZE(val) ((val & 3) << 12)
58#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1)
59#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10)
60#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
61#define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8)
62#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4)
63#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
64#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))
65#define GPMC_CONFIG1_FCLK_DIV3 (GPMC_CONFIG1_FCLK_DIV(2))
66#define GPMC_CONFIG1_FCLK_DIV4 (GPMC_CONFIG1_FCLK_DIV(3))
67#define GPMC_CONFIG7_CSVALID (1 << 6)
68
69#define GPMC_DEVICETYPE_NOR 0
70#define GPMC_DEVICETYPE_NAND 2
71#define GPMC_CONFIG_WRITEPROTECT 0x00000010
72#define WR_RD_PIN_MONITORING 0x00600000
73#define GPMC_IRQ_FIFOEVENTENABLE 0x01
74#define GPMC_IRQ_COUNT_EVENT 0x02
75
76#define GPMC_BURST_4 4 /* 4 word burst */
77#define GPMC_BURST_8 8 /* 8 word burst */
78#define GPMC_BURST_16 16 /* 16 word burst */
79#define GPMC_DEVWIDTH_8BIT 1 /* 8-bit device width */
80#define GPMC_DEVWIDTH_16BIT 2 /* 16-bit device width */
81#define GPMC_MUX_AAD 1 /* Addr-Addr-Data multiplex */
82#define GPMC_MUX_AD 2 /* Addr-Data multiplex */
83
84/* bool type time settings */
85struct gpmc_bool_timings {
86 bool cycle2cyclediffcsen;
87 bool cycle2cyclesamecsen;
88 bool we_extra_delay;
89 bool oe_extra_delay;
90 bool adv_extra_delay;
91 bool cs_extra_delay;
92 bool time_para_granularity;
93};
94
95/*
96 * Note that all values in this struct are in nanoseconds except sync_clk
97 * (which is in picoseconds), while the register values are in gpmc_fck cycles.
98 */
99struct gpmc_timings {
100 /* Minimum clock period for synchronous mode (in picoseconds) */
101 u32 sync_clk;
102
103 /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
104 u32 cs_on; /* Assertion time */
105 u32 cs_rd_off; /* Read deassertion time */
106 u32 cs_wr_off; /* Write deassertion time */
107
108 /* ADV signal timings corresponding to GPMC_CONFIG3 */
109 u32 adv_on; /* Assertion time */
110 u32 adv_rd_off; /* Read deassertion time */
111 u32 adv_wr_off; /* Write deassertion time */
112
113 /* WE signals timings corresponding to GPMC_CONFIG4 */
114 u32 we_on; /* WE assertion time */
115 u32 we_off; /* WE deassertion time */
116
117 /* OE signals timings corresponding to GPMC_CONFIG4 */
118 u32 oe_on; /* OE assertion time */
119 u32 oe_off; /* OE deassertion time */
120
121 /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */
122 u32 page_burst_access; /* Multiple access word delay */
123 u32 access; /* Start-cycle to first data valid delay */
124 u32 rd_cycle; /* Total read cycle time */
125 u32 wr_cycle; /* Total write cycle time */
126
127 u32 bus_turnaround;
128 u32 cycle2cycle_delay;
129
130 u32 wait_monitoring;
131 u32 clk_activation;
132
133 /* The following are only on OMAP3430 */
134 u32 wr_access; /* WRACCESSTIME */
135 u32 wr_data_mux_bus; /* WRDATAONADMUXBUS */
136
137 struct gpmc_bool_timings bool_timings;
138};
139
140/* Device timings in picoseconds */
141struct gpmc_device_timings {
142 u32 t_ceasu; /* address setup to CS valid */
143 u32 t_avdasu; /* address setup to ADV valid */
144 /* XXX: try to combine t_avdp_r & t_avdp_w. Issue is
145 * of tusb using these timings even for sync whilst
146 * ideally for adv_rd/(wr)_off it should have considered
147 * t_avdh instead. This indirectly necessitates r/w
148 * variations of t_avdp as it is possible to have one
149 * sync & other async
150 */
151 u32 t_avdp_r; /* ADV low time (what about t_cer ?) */
152 u32 t_avdp_w;
153 u32 t_aavdh; /* address hold time */
154 u32 t_oeasu; /* address setup to OE valid */
155 u32 t_aa; /* access time from ADV assertion */
156 u32 t_iaa; /* initial access time */
157 u32 t_oe; /* access time from OE assertion */
158 u32 t_ce; /* access time from CS asertion */
159 u32 t_rd_cycle; /* read cycle time */
160 u32 t_cez_r; /* read CS deassertion to high Z */
161 u32 t_cez_w; /* write CS deassertion to high Z */
162 u32 t_oez; /* OE deassertion to high Z */
163 u32 t_weasu; /* address setup to WE valid */
164 u32 t_wpl; /* write assertion time */
165 u32 t_wph; /* write deassertion time */
166 u32 t_wr_cycle; /* write cycle time */
167
168 u32 clk;
169 u32 t_bacc; /* burst access valid clock to output delay */
170 u32 t_ces; /* CS setup time to clk */
171 u32 t_avds; /* ADV setup time to clk */
172 u32 t_avdh; /* ADV hold time from clk */
173 u32 t_ach; /* address hold time from clk */
174 u32 t_rdyo; /* clk to ready valid */
175
176 u32 t_ce_rdyz; /* XXX: description ?, or use t_cez instead */
177 u32 t_ce_avd; /* CS on to ADV on delay */
178
179 /* XXX: check the possibility of combining
180 * cyc_aavhd_oe & cyc_aavdh_we
181 */
182 u8 cyc_aavdh_oe;/* read address hold time in cycles */
183 u8 cyc_aavdh_we;/* write address hold time in cycles */
184 u8 cyc_oe; /* access time from OE assertion in cycles */
185 u8 cyc_wpl; /* write deassertion time in cycles */
186 u32 cyc_iaa; /* initial access time in cycles */
187
188 /* extra delays */
189 bool ce_xdelay;
190 bool avd_xdelay;
191 bool oe_xdelay;
192 bool we_xdelay;
193};
194
195struct gpmc_settings {
196 bool burst_wrap; /* enables wrap bursting */
197 bool burst_read; /* enables read page/burst mode */
198 bool burst_write; /* enables write page/burst mode */
199 bool device_nand; /* device is NAND */
200 bool sync_read; /* enables synchronous reads */
201 bool sync_write; /* enables synchronous writes */
202 bool wait_on_read; /* monitor wait on reads */
203 bool wait_on_write; /* monitor wait on writes */
204 u32 burst_len; /* page/burst length */
205 u32 device_width; /* device bus width (8 or 16 bit) */
206 u32 mux_add_data; /* multiplex address & data */
207 u32 wait_pin; /* wait-pin to be used */
208};
209
210extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
211 struct gpmc_settings *gpmc_s,
212 struct gpmc_device_timings *dev_t);
213
214extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
215extern int gpmc_get_client_irq(unsigned irq_config);
216
217extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
218
219extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
220extern int gpmc_calc_divider(unsigned int sync_clk);
221extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
222extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p);
223extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
224extern void gpmc_cs_free(int cs);
225extern void omap3_gpmc_save_context(void);
226extern void omap3_gpmc_restore_context(void);
227extern int gpmc_configure(int cmd, int wval);
228extern void gpmc_read_settings_dt(struct device_node *np,
229 struct gpmc_settings *p);
230
231#endif
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 07d4c7b35754..dc6e79c4484a 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -14,14 +14,15 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/mmc/host.h>
17#include <linux/platform_data/gpio-omap.h> 18#include <linux/platform_data/gpio-omap.h>
19#include <linux/platform_data/hsmmc-omap.h>
18 20
19#include "soc.h" 21#include "soc.h"
20#include "omap_device.h" 22#include "omap_device.h"
21#include "omap-pm.h" 23#include "omap-pm.h"
22 24
23#include "mux.h" 25#include "mux.h"
24#include "mmc.h"
25#include "hsmmc.h" 26#include "hsmmc.h"
26#include "control.h" 27#include "control.h"
27 28
@@ -32,25 +33,14 @@ static u16 control_devconf1_offset;
32 33
33#define HSMMC_NAME_LEN 9 34#define HSMMC_NAME_LEN 9
34 35
35#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) 36static void omap_hsmmc1_before_set_reg(struct device *dev,
36 37 int power_on, int vdd)
37static int hsmmc_get_context_loss(struct device *dev)
38{
39 return omap_pm_get_dev_context_loss_count(dev);
40}
41
42#else
43#define hsmmc_get_context_loss NULL
44#endif
45
46static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
47 int power_on, int vdd)
48{ 38{
49 u32 reg, prog_io; 39 u32 reg, prog_io;
50 struct omap_mmc_platform_data *mmc = dev->platform_data; 40 struct omap_hsmmc_platform_data *mmc = dev->platform_data;
51 41
52 if (mmc->slots[0].remux) 42 if (mmc->remux)
53 mmc->slots[0].remux(dev, slot, power_on); 43 mmc->remux(dev, power_on);
54 44
55 /* 45 /*
56 * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the 46 * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
@@ -72,7 +62,7 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
72 omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1); 62 omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
73 } 63 }
74 64
75 if (mmc->slots[0].internal_clock) { 65 if (mmc->internal_clock) {
76 reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); 66 reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
77 reg |= OMAP2_MMCSDIO1ADPCLKISEL; 67 reg |= OMAP2_MMCSDIO1ADPCLKISEL;
78 omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0); 68 omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0);
@@ -96,8 +86,7 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
96 } 86 }
97} 87}
98 88
99static void omap_hsmmc1_after_set_reg(struct device *dev, int slot, 89static void omap_hsmmc1_after_set_reg(struct device *dev, int power_on, int vdd)
100 int power_on, int vdd)
101{ 90{
102 u32 reg; 91 u32 reg;
103 92
@@ -120,34 +109,32 @@ static void omap_hsmmc1_after_set_reg(struct device *dev, int slot,
120 } 109 }
121} 110}
122 111
123static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc) 112static void hsmmc2_select_input_clk_src(struct omap_hsmmc_platform_data *mmc)
124{ 113{
125 u32 reg; 114 u32 reg;
126 115
127 reg = omap_ctrl_readl(control_devconf1_offset); 116 reg = omap_ctrl_readl(control_devconf1_offset);
128 if (mmc->slots[0].internal_clock) 117 if (mmc->internal_clock)
129 reg |= OMAP2_MMCSDIO2ADPCLKISEL; 118 reg |= OMAP2_MMCSDIO2ADPCLKISEL;
130 else 119 else
131 reg &= ~OMAP2_MMCSDIO2ADPCLKISEL; 120 reg &= ~OMAP2_MMCSDIO2ADPCLKISEL;
132 omap_ctrl_writel(reg, control_devconf1_offset); 121 omap_ctrl_writel(reg, control_devconf1_offset);
133} 122}
134 123
135static void hsmmc2_before_set_reg(struct device *dev, int slot, 124static void hsmmc2_before_set_reg(struct device *dev, int power_on, int vdd)
136 int power_on, int vdd)
137{ 125{
138 struct omap_mmc_platform_data *mmc = dev->platform_data; 126 struct omap_hsmmc_platform_data *mmc = dev->platform_data;
139 127
140 if (mmc->slots[0].remux) 128 if (mmc->remux)
141 mmc->slots[0].remux(dev, slot, power_on); 129 mmc->remux(dev, power_on);
142 130
143 if (power_on) 131 if (power_on)
144 hsmmc2_select_input_clk_src(mmc); 132 hsmmc2_select_input_clk_src(mmc);
145} 133}
146 134
147static int am35x_hsmmc2_set_power(struct device *dev, int slot, 135static int am35x_hsmmc2_set_power(struct device *dev, int power_on, int vdd)
148 int power_on, int vdd)
149{ 136{
150 struct omap_mmc_platform_data *mmc = dev->platform_data; 137 struct omap_hsmmc_platform_data *mmc = dev->platform_data;
151 138
152 if (power_on) 139 if (power_on)
153 hsmmc2_select_input_clk_src(mmc); 140 hsmmc2_select_input_clk_src(mmc);
@@ -155,23 +142,22 @@ static int am35x_hsmmc2_set_power(struct device *dev, int slot,
155 return 0; 142 return 0;
156} 143}
157 144
158static int nop_mmc_set_power(struct device *dev, int slot, int power_on, 145static int nop_mmc_set_power(struct device *dev, int power_on, int vdd)
159 int vdd)
160{ 146{
161 return 0; 147 return 0;
162} 148}
163 149
164static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, 150static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
165 int controller_nr) 151 *mmc_controller, int controller_nr)
166{ 152{
167 if (gpio_is_valid(mmc_controller->slots[0].switch_pin) && 153 if (gpio_is_valid(mmc_controller->switch_pin) &&
168 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) 154 (mmc_controller->switch_pin < OMAP_MAX_GPIO_LINES))
169 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, 155 omap_mux_init_gpio(mmc_controller->switch_pin,
170 OMAP_PIN_INPUT_PULLUP); 156 OMAP_PIN_INPUT_PULLUP);
171 if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) && 157 if (gpio_is_valid(mmc_controller->gpio_wp) &&
172 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES)) 158 (mmc_controller->gpio_wp < OMAP_MAX_GPIO_LINES))
173 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, 159 omap_mux_init_gpio(mmc_controller->gpio_wp,
174 OMAP_PIN_INPUT_PULLUP); 160 OMAP_PIN_INPUT_PULLUP);
175 if (cpu_is_omap34xx()) { 161 if (cpu_is_omap34xx()) {
176 if (controller_nr == 0) { 162 if (controller_nr == 0) {
177 omap_mux_init_signal("sdmmc1_clk", 163 omap_mux_init_signal("sdmmc1_clk",
@@ -180,7 +166,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
180 OMAP_PIN_INPUT_PULLUP); 166 OMAP_PIN_INPUT_PULLUP);
181 omap_mux_init_signal("sdmmc1_dat0", 167 omap_mux_init_signal("sdmmc1_dat0",
182 OMAP_PIN_INPUT_PULLUP); 168 OMAP_PIN_INPUT_PULLUP);
183 if (mmc_controller->slots[0].caps & 169 if (mmc_controller->caps &
184 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { 170 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
185 omap_mux_init_signal("sdmmc1_dat1", 171 omap_mux_init_signal("sdmmc1_dat1",
186 OMAP_PIN_INPUT_PULLUP); 172 OMAP_PIN_INPUT_PULLUP);
@@ -189,7 +175,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
189 omap_mux_init_signal("sdmmc1_dat3", 175 omap_mux_init_signal("sdmmc1_dat3",
190 OMAP_PIN_INPUT_PULLUP); 176 OMAP_PIN_INPUT_PULLUP);
191 } 177 }
192 if (mmc_controller->slots[0].caps & 178 if (mmc_controller->caps &
193 MMC_CAP_8_BIT_DATA) { 179 MMC_CAP_8_BIT_DATA) {
194 omap_mux_init_signal("sdmmc1_dat4", 180 omap_mux_init_signal("sdmmc1_dat4",
195 OMAP_PIN_INPUT_PULLUP); 181 OMAP_PIN_INPUT_PULLUP);
@@ -214,7 +200,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
214 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 200 * For 8 wire configurations, Lines DAT4, 5, 6 and 7
215 * need to be muxed in the board-*.c files 201 * need to be muxed in the board-*.c files
216 */ 202 */
217 if (mmc_controller->slots[0].caps & 203 if (mmc_controller->caps &
218 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { 204 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
219 omap_mux_init_signal("sdmmc2_dat1", 205 omap_mux_init_signal("sdmmc2_dat1",
220 OMAP_PIN_INPUT_PULLUP); 206 OMAP_PIN_INPUT_PULLUP);
@@ -223,7 +209,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
223 omap_mux_init_signal("sdmmc2_dat3", 209 omap_mux_init_signal("sdmmc2_dat3",
224 OMAP_PIN_INPUT_PULLUP); 210 OMAP_PIN_INPUT_PULLUP);
225 } 211 }
226 if (mmc_controller->slots[0].caps & 212 if (mmc_controller->caps &
227 MMC_CAP_8_BIT_DATA) { 213 MMC_CAP_8_BIT_DATA) {
228 omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4", 214 omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
229 OMAP_PIN_INPUT_PULLUP); 215 OMAP_PIN_INPUT_PULLUP);
@@ -243,7 +229,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
243} 229}
244 230
245static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, 231static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
246 struct omap_mmc_platform_data *mmc) 232 struct omap_hsmmc_platform_data *mmc)
247{ 233{
248 char *hc_name; 234 char *hc_name;
249 235
@@ -259,38 +245,22 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
259 else 245 else
260 snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i", 246 snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i",
261 c->mmc, 1); 247 c->mmc, 1);
262 mmc->slots[0].name = hc_name; 248 mmc->name = hc_name;
263 mmc->nr_slots = 1; 249 mmc->caps = c->caps;
264 mmc->slots[0].caps = c->caps; 250 mmc->internal_clock = !c->ext_clock;
265 mmc->slots[0].pm_caps = c->pm_caps;
266 mmc->slots[0].internal_clock = !c->ext_clock;
267 mmc->max_freq = c->max_freq;
268 mmc->reg_offset = 0; 251 mmc->reg_offset = 0;
269 mmc->get_context_loss_count = hsmmc_get_context_loss;
270 252
271 mmc->slots[0].switch_pin = c->gpio_cd; 253 mmc->switch_pin = c->gpio_cd;
272 mmc->slots[0].gpio_wp = c->gpio_wp; 254 mmc->gpio_wp = c->gpio_wp;
273 255
274 mmc->slots[0].remux = c->remux; 256 mmc->remux = c->remux;
275 mmc->slots[0].init_card = c->init_card; 257 mmc->init_card = c->init_card;
276 258
277 if (c->cover_only) 259 if (c->cover_only)
278 mmc->slots[0].cover = 1; 260 mmc->cover = 1;
279 261
280 if (c->nonremovable) 262 if (c->nonremovable)
281 mmc->slots[0].nonremovable = 1; 263 mmc->nonremovable = 1;
282
283 if (c->power_saving)
284 mmc->slots[0].power_saving = 1;
285
286 if (c->no_off)
287 mmc->slots[0].no_off = 1;
288
289 if (c->no_off_init)
290 mmc->slots[0].no_regulator_off_init = c->no_off_init;
291
292 if (c->vcc_aux_disable_is_sleep)
293 mmc->slots[0].vcc_aux_disable_is_sleep = 1;
294 264
295 /* 265 /*
296 * NOTE: MMC slots should have a Vcc regulator set up. 266 * NOTE: MMC slots should have a Vcc regulator set up.
@@ -300,42 +270,42 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
300 * temporary HACK: ocr_mask instead of fixed supply 270 * temporary HACK: ocr_mask instead of fixed supply
301 */ 271 */
302 if (soc_is_am35xx()) 272 if (soc_is_am35xx())
303 mmc->slots[0].ocr_mask = MMC_VDD_165_195 | 273 mmc->ocr_mask = MMC_VDD_165_195 |
304 MMC_VDD_26_27 | 274 MMC_VDD_26_27 |
305 MMC_VDD_27_28 | 275 MMC_VDD_27_28 |
306 MMC_VDD_29_30 | 276 MMC_VDD_29_30 |
307 MMC_VDD_30_31 | 277 MMC_VDD_30_31 |
308 MMC_VDD_31_32; 278 MMC_VDD_31_32;
309 else 279 else
310 mmc->slots[0].ocr_mask = c->ocr_mask; 280 mmc->ocr_mask = c->ocr_mask;
311 281
312 if (!soc_is_am35xx()) 282 if (!soc_is_am35xx())
313 mmc->slots[0].features |= HSMMC_HAS_PBIAS; 283 mmc->features |= HSMMC_HAS_PBIAS;
314 284
315 switch (c->mmc) { 285 switch (c->mmc) {
316 case 1: 286 case 1:
317 if (mmc->slots[0].features & HSMMC_HAS_PBIAS) { 287 if (mmc->features & HSMMC_HAS_PBIAS) {
318 /* on-chip level shifting via PBIAS0/PBIAS1 */ 288 /* on-chip level shifting via PBIAS0/PBIAS1 */
319 mmc->slots[0].before_set_reg = 289 mmc->before_set_reg =
320 omap_hsmmc1_before_set_reg; 290 omap_hsmmc1_before_set_reg;
321 mmc->slots[0].after_set_reg = 291 mmc->after_set_reg =
322 omap_hsmmc1_after_set_reg; 292 omap_hsmmc1_after_set_reg;
323 } 293 }
324 294
325 if (soc_is_am35xx()) 295 if (soc_is_am35xx())
326 mmc->slots[0].set_power = nop_mmc_set_power; 296 mmc->set_power = nop_mmc_set_power;
327 297
328 /* OMAP3630 HSMMC1 supports only 4-bit */ 298 /* OMAP3630 HSMMC1 supports only 4-bit */
329 if (cpu_is_omap3630() && 299 if (cpu_is_omap3630() &&
330 (c->caps & MMC_CAP_8_BIT_DATA)) { 300 (c->caps & MMC_CAP_8_BIT_DATA)) {
331 c->caps &= ~MMC_CAP_8_BIT_DATA; 301 c->caps &= ~MMC_CAP_8_BIT_DATA;
332 c->caps |= MMC_CAP_4_BIT_DATA; 302 c->caps |= MMC_CAP_4_BIT_DATA;
333 mmc->slots[0].caps = c->caps; 303 mmc->caps = c->caps;
334 } 304 }
335 break; 305 break;
336 case 2: 306 case 2:
337 if (soc_is_am35xx()) 307 if (soc_is_am35xx())
338 mmc->slots[0].set_power = am35x_hsmmc2_set_power; 308 mmc->set_power = am35x_hsmmc2_set_power;
339 309
340 if (c->ext_clock) 310 if (c->ext_clock)
341 c->transceiver = 1; 311 c->transceiver = 1;
@@ -343,17 +313,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
343 c->caps &= ~MMC_CAP_8_BIT_DATA; 313 c->caps &= ~MMC_CAP_8_BIT_DATA;
344 c->caps |= MMC_CAP_4_BIT_DATA; 314 c->caps |= MMC_CAP_4_BIT_DATA;
345 } 315 }
346 if (mmc->slots[0].features & HSMMC_HAS_PBIAS) { 316 if (mmc->features & HSMMC_HAS_PBIAS) {
347 /* off-chip level shifting, or none */ 317 /* off-chip level shifting, or none */
348 mmc->slots[0].before_set_reg = hsmmc2_before_set_reg; 318 mmc->before_set_reg = hsmmc2_before_set_reg;
349 mmc->slots[0].after_set_reg = NULL; 319 mmc->after_set_reg = NULL;
350 } 320 }
351 break; 321 break;
352 case 3: 322 case 3:
353 case 4: 323 case 4:
354 case 5: 324 case 5:
355 mmc->slots[0].before_set_reg = NULL; 325 mmc->before_set_reg = NULL;
356 mmc->slots[0].after_set_reg = NULL; 326 mmc->after_set_reg = NULL;
357 break; 327 break;
358 default: 328 default:
359 pr_err("MMC%d configuration not supported!\n", c->mmc); 329 pr_err("MMC%d configuration not supported!\n", c->mmc);
@@ -368,7 +338,7 @@ static int omap_hsmmc_done;
368void omap_hsmmc_late_init(struct omap2_hsmmc_info *c) 338void omap_hsmmc_late_init(struct omap2_hsmmc_info *c)
369{ 339{
370 struct platform_device *pdev; 340 struct platform_device *pdev;
371 struct omap_mmc_platform_data *mmc_pdata; 341 struct omap_hsmmc_platform_data *mmc_pdata;
372 int res; 342 int res;
373 343
374 if (omap_hsmmc_done != 1) 344 if (omap_hsmmc_done != 1)
@@ -388,8 +358,8 @@ void omap_hsmmc_late_init(struct omap2_hsmmc_info *c)
388 if (!mmc_pdata) 358 if (!mmc_pdata)
389 continue; 359 continue;
390 360
391 mmc_pdata->slots[0].switch_pin = c->gpio_cd; 361 mmc_pdata->switch_pin = c->gpio_cd;
392 mmc_pdata->slots[0].gpio_wp = c->gpio_wp; 362 mmc_pdata->gpio_wp = c->gpio_wp;
393 363
394 res = omap_device_register(pdev); 364 res = omap_device_register(pdev);
395 if (res) 365 if (res)
@@ -408,12 +378,12 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
408 struct omap_device *od; 378 struct omap_device *od;
409 struct platform_device *pdev; 379 struct platform_device *pdev;
410 char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; 380 char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
411 struct omap_mmc_platform_data *mmc_data; 381 struct omap_hsmmc_platform_data *mmc_data;
412 struct omap_mmc_dev_attr *mmc_dev_attr; 382 struct omap_hsmmc_dev_attr *mmc_dev_attr;
413 char *name; 383 char *name;
414 int res; 384 int res;
415 385
416 mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL); 386 mmc_data = kzalloc(sizeof(*mmc_data), GFP_KERNEL);
417 if (!mmc_data) { 387 if (!mmc_data) {
418 pr_err("Cannot allocate memory for mmc device!\n"); 388 pr_err("Cannot allocate memory for mmc device!\n");
419 return; 389 return;
@@ -463,7 +433,7 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
463 } 433 }
464 434
465 res = platform_device_add_data(pdev, mmc_data, 435 res = platform_device_add_data(pdev, mmc_data,
466 sizeof(struct omap_mmc_platform_data)); 436 sizeof(struct omap_hsmmc_platform_data));
467 if (res) { 437 if (res) {
468 pr_err("Could not add pdata for %s\n", name); 438 pr_err("Could not add pdata for %s\n", name);
469 goto put_pdev; 439 goto put_pdev;
@@ -489,7 +459,7 @@ put_pdev:
489 platform_device_put(pdev); 459 platform_device_put(pdev);
490 460
491free_name: 461free_name:
492 kfree(mmc_data->slots[0].name); 462 kfree(mmc_data->name);
493 463
494free_mmc: 464free_mmc:
495 kfree(mmc_data); 465 kfree(mmc_data);
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index 7f2e790e0929..148cd9b15499 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -12,25 +12,18 @@ struct omap2_hsmmc_info {
12 u8 mmc; /* controller 1/2/3 */ 12 u8 mmc; /* controller 1/2/3 */
13 u32 caps; /* 4/8 wires and any additional host 13 u32 caps; /* 4/8 wires and any additional host
14 * capabilities OR'd (ref. linux/mmc/host.h) */ 14 * capabilities OR'd (ref. linux/mmc/host.h) */
15 u32 pm_caps; /* PM capabilities */
16 bool transceiver; /* MMC-2 option */ 15 bool transceiver; /* MMC-2 option */
17 bool ext_clock; /* use external pin for input clock */ 16 bool ext_clock; /* use external pin for input clock */
18 bool cover_only; /* No card detect - just cover switch */ 17 bool cover_only; /* No card detect - just cover switch */
19 bool nonremovable; /* Nonremovable e.g. eMMC */ 18 bool nonremovable; /* Nonremovable e.g. eMMC */
20 bool power_saving; /* Try to sleep or power off when possible */
21 bool no_off; /* power_saving and power is not to go off */
22 bool no_off_init; /* no power off when not in MMC sleep state */
23 bool vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
24 bool deferred; /* mmc needs a deferred probe */ 19 bool deferred; /* mmc needs a deferred probe */
25 int gpio_cd; /* or -EINVAL */ 20 int gpio_cd; /* or -EINVAL */
26 int gpio_wp; /* or -EINVAL */ 21 int gpio_wp; /* or -EINVAL */
27 char *name; /* or NULL for default */ 22 char *name; /* or NULL for default */
28 struct platform_device *pdev; /* mmc controller instance */ 23 struct platform_device *pdev; /* mmc controller instance */
29 int ocr_mask; /* temporary HACK */ 24 int ocr_mask; /* temporary HACK */
30 int max_freq; /* maximum clock, if constrained by external
31 * circuitry, or 0 for default */
32 /* Remux (pad configuration) when powering on/off */ 25 /* Remux (pad configuration) when powering on/off */
33 void (*remux)(struct device *dev, int slot, int power_on); 26 void (*remux)(struct device *dev, int power_on);
34 /* init some special card */ 27 /* init some special card */
35 void (*init_card)(struct mmc_card *card); 28 void (*init_card)(struct mmc_card *card);
36}; 29};
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 03cbb16898a3..4fc838354e31 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -45,13 +45,15 @@
45#include "sram.h" 45#include "sram.h"
46#include "cm2xxx.h" 46#include "cm2xxx.h"
47#include "cm3xxx.h" 47#include "cm3xxx.h"
48#include "cm33xx.h"
49#include "cm44xx.h"
48#include "prm.h" 50#include "prm.h"
49#include "cm.h" 51#include "cm.h"
50#include "prcm_mpu44xx.h" 52#include "prcm_mpu44xx.h"
51#include "prminst44xx.h" 53#include "prminst44xx.h"
52#include "cminst44xx.h"
53#include "prm2xxx.h" 54#include "prm2xxx.h"
54#include "prm3xxx.h" 55#include "prm3xxx.h"
56#include "prm33xx.h"
55#include "prm44xx.h" 57#include "prm44xx.h"
56#include "opp2xxx.h" 58#include "opp2xxx.h"
57 59
@@ -565,6 +567,8 @@ void __init am33xx_init_early(void)
565 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL); 567 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
566 omap3xxx_check_revision(); 568 omap3xxx_check_revision();
567 am33xx_check_features(); 569 am33xx_check_features();
570 am33xx_prm_init();
571 am33xx_cm_init();
568 am33xx_powerdomains_init(); 572 am33xx_powerdomains_init();
569 am33xx_clockdomains_init(); 573 am33xx_clockdomains_init();
570 am33xx_hwmod_init(); 574 am33xx_hwmod_init();
@@ -591,6 +595,8 @@ void __init am43xx_init_early(void)
591 omap_cm_base_init(); 595 omap_cm_base_init();
592 omap3xxx_check_revision(); 596 omap3xxx_check_revision();
593 am33xx_check_features(); 597 am33xx_check_features();
598 omap44xx_prm_init();
599 omap4_cm_init();
594 am43xx_powerdomains_init(); 600 am43xx_powerdomains_init();
595 am43xx_clockdomains_init(); 601 am43xx_clockdomains_init();
596 am43xx_hwmod_init(); 602 am43xx_hwmod_init();
@@ -620,6 +626,7 @@ void __init omap4430_init_early(void)
620 omap_cm_base_init(); 626 omap_cm_base_init();
621 omap4xxx_check_revision(); 627 omap4xxx_check_revision();
622 omap4xxx_check_features(); 628 omap4xxx_check_features();
629 omap4_cm_init();
623 omap4_pm_init_early(); 630 omap4_pm_init_early();
624 omap44xx_prm_init(); 631 omap44xx_prm_init();
625 omap44xx_voltagedomains_init(); 632 omap44xx_voltagedomains_init();
@@ -655,6 +662,7 @@ void __init omap5_init_early(void)
655 omap_cm_base_init(); 662 omap_cm_base_init();
656 omap44xx_prm_init(); 663 omap44xx_prm_init();
657 omap5xxx_check_revision(); 664 omap5xxx_check_revision();
665 omap4_cm_init();
658 omap54xx_voltagedomains_init(); 666 omap54xx_voltagedomains_init();
659 omap54xx_powerdomains_init(); 667 omap54xx_powerdomains_init();
660 omap54xx_clockdomains_init(); 668 omap54xx_clockdomains_init();
@@ -686,6 +694,7 @@ void __init dra7xx_init_early(void)
686 omap_cm_base_init(); 694 omap_cm_base_init();
687 omap44xx_prm_init(); 695 omap44xx_prm_init();
688 dra7xxx_check_revision(); 696 dra7xxx_check_revision();
697 omap4_cm_init();
689 dra7xx_powerdomains_init(); 698 dra7xx_powerdomains_init();
690 dra7xx_clockdomains_init(); 699 dra7xx_clockdomains_init();
691 dra7xx_hwmod_init(); 700 dra7xx_hwmod_init();
diff --git a/arch/arm/mach-omap2/mmc.h b/arch/arm/mach-omap2/mmc.h
index 0cd4b089da9c..30d39b97e7dd 100644
--- a/arch/arm/mach-omap2/mmc.h
+++ b/arch/arm/mach-omap2/mmc.h
@@ -1,5 +1,3 @@
1#include <linux/mmc/host.h>
2#include <linux/platform_data/mmc-omap.h>
3 1
4#define OMAP24XX_NR_MMC 2 2#define OMAP24XX_NR_MMC 2
5#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE 3#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
@@ -7,14 +5,6 @@
7 5
8#define OMAP4_MMC_REG_OFFSET 0x100 6#define OMAP4_MMC_REG_OFFSET 0x100
9 7
10#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
11void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
12#else
13static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
14{
15}
16#endif
17
18struct omap_hwmod; 8struct omap_hwmod;
19int omap_msdi_reset(struct omap_hwmod *oh); 9int omap_msdi_reset(struct omap_hwmod *oh);
20 10
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 6944ae3674e8..79f49d904a06 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -227,7 +227,7 @@ static void __init save_l2x0_context(void)
227int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state) 227int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
228{ 228{
229 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu); 229 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
230 unsigned int save_state = 0; 230 unsigned int save_state = 0, cpu_logic_state = PWRDM_POWER_RET;
231 unsigned int wakeup_cpu; 231 unsigned int wakeup_cpu;
232 232
233 if (omap_rev() == OMAP4430_REV_ES1_0) 233 if (omap_rev() == OMAP4430_REV_ES1_0)
@@ -239,6 +239,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
239 save_state = 0; 239 save_state = 0;
240 break; 240 break;
241 case PWRDM_POWER_OFF: 241 case PWRDM_POWER_OFF:
242 cpu_logic_state = PWRDM_POWER_OFF;
242 save_state = 1; 243 save_state = 1;
243 break; 244 break;
244 case PWRDM_POWER_RET: 245 case PWRDM_POWER_RET:
@@ -270,6 +271,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
270 271
271 cpu_clear_prev_logic_pwrst(cpu); 272 cpu_clear_prev_logic_pwrst(cpu);
272 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state); 273 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
274 pwrdm_set_logic_retst(pm_info->pwrdm, cpu_logic_state);
273 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.resume)); 275 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.resume));
274 omap_pm_ops.scu_prepare(cpu, power_state); 276 omap_pm_ops.scu_prepare(cpu, power_state);
275 l2x0_pwrst_prepare(cpu, save_state); 277 l2x0_pwrst_prepare(cpu, save_state);
diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c
index 68423e26399d..d937b2e4040b 100644
--- a/arch/arm/mach-omap2/omap2-restart.c
+++ b/arch/arm/mach-omap2/omap2-restart.c
@@ -15,7 +15,7 @@
15 15
16#include "soc.h" 16#include "soc.h"
17#include "common.h" 17#include "common.h"
18#include "prm2xxx.h" 18#include "prm.h"
19 19
20/* 20/*
21 * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set 21 * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set
@@ -40,8 +40,7 @@ void omap2xxx_restart(enum reboot_mode mode, const char *cmd)
40 40
41 /* XXX Should save the cmd argument for use after the reboot */ 41 /* XXX Should save the cmd argument for use after the reboot */
42 42
43 omap2xxx_prm_dpll_reset(); /* never returns */ 43 omap_prm_reset_system();
44 while (1);
45} 44}
46 45
47/** 46/**
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c
index 5de2a0c2979d..103a49f68bcb 100644
--- a/arch/arm/mach-omap2/omap3-restart.c
+++ b/arch/arm/mach-omap2/omap3-restart.c
@@ -14,10 +14,8 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16 16
17#include "iomap.h"
18#include "common.h"
19#include "control.h" 17#include "control.h"
20#include "prm3xxx.h" 18#include "prm.h"
21 19
22/* Global address base setup code */ 20/* Global address base setup code */
23 21
@@ -32,6 +30,5 @@
32void omap3xxx_restart(enum reboot_mode mode, const char *cmd) 30void omap3xxx_restart(enum reboot_mode mode, const char *cmd)
33{ 31{
34 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0)); 32 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
35 omap3xxx_prm_dpll3_reset(); /* never returns */ 33 omap_prm_reset_system();
36 while (1);
37} 34}
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 16b20cedc38d..b7cb44abe49b 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -36,7 +36,6 @@
36#include "soc.h" 36#include "soc.h"
37#include "iomap.h" 37#include "iomap.h"
38#include "common.h" 38#include "common.h"
39#include "mmc.h"
40#include "prminst44xx.h" 39#include "prminst44xx.h"
41#include "prcm_mpu44xx.h" 40#include "prcm_mpu44xx.h"
42#include "omap4-sar-layout.h" 41#include "omap4-sar-layout.h"
diff --git a/arch/arm/mach-omap2/omap4-restart.c b/arch/arm/mach-omap2/omap4-restart.c
index 41dfd7da8170..a99e7f7fb5be 100644
--- a/arch/arm/mach-omap2/omap4-restart.c
+++ b/arch/arm/mach-omap2/omap4-restart.c
@@ -9,7 +9,7 @@
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/reboot.h> 11#include <linux/reboot.h>
12#include "prminst44xx.h" 12#include "prm.h"
13 13
14/** 14/**
15 * omap44xx_restart - trigger a software restart of the SoC 15 * omap44xx_restart - trigger a software restart of the SoC
@@ -22,7 +22,5 @@
22void omap44xx_restart(enum reboot_mode mode, const char *cmd) 22void omap44xx_restart(enum reboot_mode mode, const char *cmd)
23{ 23{
24 /* XXX Should save 'cmd' into scratchpad for use after reboot */ 24 /* XXX Should save 'cmd' into scratchpad for use after reboot */
25 omap4_prminst_global_warm_sw_reset(); /* never returns */ 25 omap_prm_reset_system();
26 while (1)
27 ;
28} 26}
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 716247ed9e0c..cbb908dc5cf0 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -153,7 +153,6 @@
153#include "powerdomain.h" 153#include "powerdomain.h"
154#include "cm2xxx.h" 154#include "cm2xxx.h"
155#include "cm3xxx.h" 155#include "cm3xxx.h"
156#include "cminst44xx.h"
157#include "cm33xx.h" 156#include "cm33xx.h"
158#include "prm.h" 157#include "prm.h"
159#include "prm3xxx.h" 158#include "prm3xxx.h"
@@ -979,31 +978,9 @@ static void _omap4_enable_module(struct omap_hwmod *oh)
979 pr_debug("omap_hwmod: %s: %s: %d\n", 978 pr_debug("omap_hwmod: %s: %s: %d\n",
980 oh->name, __func__, oh->prcm.omap4.modulemode); 979 oh->name, __func__, oh->prcm.omap4.modulemode);
981 980
982 omap4_cminst_module_enable(oh->prcm.omap4.modulemode, 981 omap_cm_module_enable(oh->prcm.omap4.modulemode,
983 oh->clkdm->prcm_partition, 982 oh->clkdm->prcm_partition,
984 oh->clkdm->cm_inst, 983 oh->clkdm->cm_inst, oh->prcm.omap4.clkctrl_offs);
985 oh->clkdm->clkdm_offs,
986 oh->prcm.omap4.clkctrl_offs);
987}
988
989/**
990 * _am33xx_enable_module - enable CLKCTRL modulemode on AM33XX
991 * @oh: struct omap_hwmod *
992 *
993 * Enables the PRCM module mode related to the hwmod @oh.
994 * No return value.
995 */
996static void _am33xx_enable_module(struct omap_hwmod *oh)
997{
998 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
999 return;
1000
1001 pr_debug("omap_hwmod: %s: %s: %d\n",
1002 oh->name, __func__, oh->prcm.omap4.modulemode);
1003
1004 am33xx_cm_module_enable(oh->prcm.omap4.modulemode, oh->clkdm->cm_inst,
1005 oh->clkdm->clkdm_offs,
1006 oh->prcm.omap4.clkctrl_offs);
1007} 984}
1008 985
1009/** 986/**
@@ -1026,35 +1003,9 @@ static int _omap4_wait_target_disable(struct omap_hwmod *oh)
1026 if (oh->flags & HWMOD_NO_IDLEST) 1003 if (oh->flags & HWMOD_NO_IDLEST)
1027 return 0; 1004 return 0;
1028 1005
1029 return omap4_cminst_wait_module_idle(oh->clkdm->prcm_partition, 1006 return omap_cm_wait_module_idle(oh->clkdm->prcm_partition,
1030 oh->clkdm->cm_inst, 1007 oh->clkdm->cm_inst,
1031 oh->clkdm->clkdm_offs, 1008 oh->prcm.omap4.clkctrl_offs, 0);
1032 oh->prcm.omap4.clkctrl_offs);
1033}
1034
1035/**
1036 * _am33xx_wait_target_disable - wait for a module to be disabled on AM33XX
1037 * @oh: struct omap_hwmod *
1038 *
1039 * Wait for a module @oh to enter slave idle. Returns 0 if the module
1040 * does not have an IDLEST bit or if the module successfully enters
1041 * slave idle; otherwise, pass along the return value of the
1042 * appropriate *_cm*_wait_module_idle() function.
1043 */
1044static int _am33xx_wait_target_disable(struct omap_hwmod *oh)
1045{
1046 if (!oh)
1047 return -EINVAL;
1048
1049 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
1050 return 0;
1051
1052 if (oh->flags & HWMOD_NO_IDLEST)
1053 return 0;
1054
1055 return am33xx_cm_wait_module_idle(oh->clkdm->cm_inst,
1056 oh->clkdm->clkdm_offs,
1057 oh->prcm.omap4.clkctrl_offs);
1058} 1009}
1059 1010
1060/** 1011/**
@@ -1859,10 +1810,8 @@ static int _omap4_disable_module(struct omap_hwmod *oh)
1859 1810
1860 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__); 1811 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__);
1861 1812
1862 omap4_cminst_module_disable(oh->clkdm->prcm_partition, 1813 omap_cm_module_disable(oh->clkdm->prcm_partition, oh->clkdm->cm_inst,
1863 oh->clkdm->cm_inst, 1814 oh->prcm.omap4.clkctrl_offs);
1864 oh->clkdm->clkdm_offs,
1865 oh->prcm.omap4.clkctrl_offs);
1866 1815
1867 v = _omap4_wait_target_disable(oh); 1816 v = _omap4_wait_target_disable(oh);
1868 if (v) 1817 if (v)
@@ -1873,36 +1822,6 @@ static int _omap4_disable_module(struct omap_hwmod *oh)
1873} 1822}
1874 1823
1875/** 1824/**
1876 * _am33xx_disable_module - enable CLKCTRL modulemode on AM33XX
1877 * @oh: struct omap_hwmod *
1878 *
1879 * Disable the PRCM module mode related to the hwmod @oh.
1880 * Return EINVAL if the modulemode is not supported and 0 in case of success.
1881 */
1882static int _am33xx_disable_module(struct omap_hwmod *oh)
1883{
1884 int v;
1885
1886 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
1887 return -EINVAL;
1888
1889 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__);
1890
1891 if (_are_any_hardreset_lines_asserted(oh))
1892 return 0;
1893
1894 am33xx_cm_module_disable(oh->clkdm->cm_inst, oh->clkdm->clkdm_offs,
1895 oh->prcm.omap4.clkctrl_offs);
1896
1897 v = _am33xx_wait_target_disable(oh);
1898 if (v)
1899 pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
1900 oh->name);
1901
1902 return 0;
1903}
1904
1905/**
1906 * _ocp_softreset - reset an omap_hwmod via the OCP_SYSCONFIG bit 1825 * _ocp_softreset - reset an omap_hwmod via the OCP_SYSCONFIG bit
1907 * @oh: struct omap_hwmod * 1826 * @oh: struct omap_hwmod *
1908 * 1827 *
@@ -2065,10 +1984,7 @@ static void _reconfigure_io_chain(void)
2065 1984
2066 spin_lock_irqsave(&io_chain_lock, flags); 1985 spin_lock_irqsave(&io_chain_lock, flags);
2067 1986
2068 if (cpu_is_omap34xx()) 1987 omap_prm_reconfigure_io_chain();
2069 omap3xxx_prm_reconfigure_io_chain();
2070 else if (cpu_is_omap44xx())
2071 omap44xx_prm_reconfigure_io_chain();
2072 1988
2073 spin_unlock_irqrestore(&io_chain_lock, flags); 1989 spin_unlock_irqrestore(&io_chain_lock, flags);
2074} 1990}
@@ -2719,11 +2635,33 @@ static int __init _setup(struct omap_hwmod *oh, void *data)
2719 if (oh->_state != _HWMOD_STATE_INITIALIZED) 2635 if (oh->_state != _HWMOD_STATE_INITIALIZED)
2720 return 0; 2636 return 0;
2721 2637
2638 if (oh->parent_hwmod) {
2639 int r;
2640
2641 r = _enable(oh->parent_hwmod);
2642 WARN(r, "hwmod: %s: setup: failed to enable parent hwmod %s\n",
2643 oh->name, oh->parent_hwmod->name);
2644 }
2645
2722 _setup_iclk_autoidle(oh); 2646 _setup_iclk_autoidle(oh);
2723 2647
2724 if (!_setup_reset(oh)) 2648 if (!_setup_reset(oh))
2725 _setup_postsetup(oh); 2649 _setup_postsetup(oh);
2726 2650
2651 if (oh->parent_hwmod) {
2652 u8 postsetup_state;
2653
2654 postsetup_state = oh->parent_hwmod->_postsetup_state;
2655
2656 if (postsetup_state == _HWMOD_STATE_IDLE)
2657 _idle(oh->parent_hwmod);
2658 else if (postsetup_state == _HWMOD_STATE_DISABLED)
2659 _shutdown(oh->parent_hwmod);
2660 else if (postsetup_state != _HWMOD_STATE_ENABLED)
2661 WARN(1, "hwmod: %s: unknown postsetup state %d! defaulting to enabled\n",
2662 oh->parent_hwmod->name, postsetup_state);
2663 }
2664
2727 return 0; 2665 return 0;
2728} 2666}
2729 2667
@@ -2832,12 +2770,10 @@ static int __init _add_link(struct omap_hwmod_ocp_if *oi)
2832 _alloc_links(&ml, &sl); 2770 _alloc_links(&ml, &sl);
2833 2771
2834 ml->ocp_if = oi; 2772 ml->ocp_if = oi;
2835 INIT_LIST_HEAD(&ml->node);
2836 list_add(&ml->node, &oi->master->master_ports); 2773 list_add(&ml->node, &oi->master->master_ports);
2837 oi->master->masters_cnt++; 2774 oi->master->masters_cnt++;
2838 2775
2839 sl->ocp_if = oi; 2776 sl->ocp_if = oi;
2840 INIT_LIST_HEAD(&sl->node);
2841 list_add(&sl->node, &oi->slave->slave_ports); 2777 list_add(&sl->node, &oi->slave->slave_ports);
2842 oi->slave->slaves_cnt++; 2778 oi->slave->slaves_cnt++;
2843 2779
@@ -2927,34 +2863,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2927/* Static functions intended only for use in soc_ops field function pointers */ 2863/* Static functions intended only for use in soc_ops field function pointers */
2928 2864
2929/** 2865/**
2930 * _omap2xxx_wait_target_ready - wait for a module to leave slave idle 2866 * _omap2xxx_3xxx_wait_target_ready - wait for a module to leave slave idle
2931 * @oh: struct omap_hwmod *
2932 *
2933 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2934 * does not have an IDLEST bit or if the module successfully leaves
2935 * slave idle; otherwise, pass along the return value of the
2936 * appropriate *_cm*_wait_module_ready() function.
2937 */
2938static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
2939{
2940 if (!oh)
2941 return -EINVAL;
2942
2943 if (oh->flags & HWMOD_NO_IDLEST)
2944 return 0;
2945
2946 if (!_find_mpu_rt_port(oh))
2947 return 0;
2948
2949 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2950
2951 return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2952 oh->prcm.omap2.idlest_reg_id,
2953 oh->prcm.omap2.idlest_idle_bit);
2954}
2955
2956/**
2957 * _omap3xxx_wait_target_ready - wait for a module to leave slave idle
2958 * @oh: struct omap_hwmod * 2867 * @oh: struct omap_hwmod *
2959 * 2868 *
2960 * Wait for a module @oh to leave slave idle. Returns 0 if the module 2869 * Wait for a module @oh to leave slave idle. Returns 0 if the module
@@ -2962,7 +2871,7 @@ static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
2962 * slave idle; otherwise, pass along the return value of the 2871 * slave idle; otherwise, pass along the return value of the
2963 * appropriate *_cm*_wait_module_ready() function. 2872 * appropriate *_cm*_wait_module_ready() function.
2964 */ 2873 */
2965static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh) 2874static int _omap2xxx_3xxx_wait_target_ready(struct omap_hwmod *oh)
2966{ 2875{
2967 if (!oh) 2876 if (!oh)
2968 return -EINVAL; 2877 return -EINVAL;
@@ -2975,9 +2884,9 @@ static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh)
2975 2884
2976 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ 2885 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2977 2886
2978 return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs, 2887 return omap_cm_wait_module_ready(0, oh->prcm.omap2.module_offs,
2979 oh->prcm.omap2.idlest_reg_id, 2888 oh->prcm.omap2.idlest_reg_id,
2980 oh->prcm.omap2.idlest_idle_bit); 2889 oh->prcm.omap2.idlest_idle_bit);
2981} 2890}
2982 2891
2983/** 2892/**
@@ -3002,37 +2911,9 @@ static int _omap4_wait_target_ready(struct omap_hwmod *oh)
3002 2911
3003 /* XXX check module SIDLEMODE, hardreset status */ 2912 /* XXX check module SIDLEMODE, hardreset status */
3004 2913
3005 return omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition, 2914 return omap_cm_wait_module_ready(oh->clkdm->prcm_partition,
3006 oh->clkdm->cm_inst, 2915 oh->clkdm->cm_inst,
3007 oh->clkdm->clkdm_offs, 2916 oh->prcm.omap4.clkctrl_offs, 0);
3008 oh->prcm.omap4.clkctrl_offs);
3009}
3010
3011/**
3012 * _am33xx_wait_target_ready - wait for a module to leave slave idle
3013 * @oh: struct omap_hwmod *
3014 *
3015 * Wait for a module @oh to leave slave idle. Returns 0 if the module
3016 * does not have an IDLEST bit or if the module successfully leaves
3017 * slave idle; otherwise, pass along the return value of the
3018 * appropriate *_cm*_wait_module_ready() function.
3019 */
3020static int _am33xx_wait_target_ready(struct omap_hwmod *oh)
3021{
3022 if (!oh || !oh->clkdm)
3023 return -EINVAL;
3024
3025 if (oh->flags & HWMOD_NO_IDLEST)
3026 return 0;
3027
3028 if (!_find_mpu_rt_port(oh))
3029 return 0;
3030
3031 /* XXX check module SIDLEMODE, hardreset status */
3032
3033 return am33xx_cm_wait_module_ready(oh->clkdm->cm_inst,
3034 oh->clkdm->clkdm_offs,
3035 oh->prcm.omap4.clkctrl_offs);
3036} 2917}
3037 2918
3038/** 2919/**
@@ -3049,8 +2930,8 @@ static int _am33xx_wait_target_ready(struct omap_hwmod *oh)
3049static int _omap2_assert_hardreset(struct omap_hwmod *oh, 2930static int _omap2_assert_hardreset(struct omap_hwmod *oh,
3050 struct omap_hwmod_rst_info *ohri) 2931 struct omap_hwmod_rst_info *ohri)
3051{ 2932{
3052 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, 2933 return omap_prm_assert_hardreset(ohri->rst_shift, 0,
3053 ohri->rst_shift); 2934 oh->prcm.omap2.module_offs, 0);
3054} 2935}
3055 2936
3056/** 2937/**
@@ -3067,9 +2948,8 @@ static int _omap2_assert_hardreset(struct omap_hwmod *oh,
3067static int _omap2_deassert_hardreset(struct omap_hwmod *oh, 2948static int _omap2_deassert_hardreset(struct omap_hwmod *oh,
3068 struct omap_hwmod_rst_info *ohri) 2949 struct omap_hwmod_rst_info *ohri)
3069{ 2950{
3070 return omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs, 2951 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, 0,
3071 ohri->rst_shift, 2952 oh->prcm.omap2.module_offs, 0, 0);
3072 ohri->st_shift);
3073} 2953}
3074 2954
3075/** 2955/**
@@ -3087,8 +2967,8 @@ static int _omap2_deassert_hardreset(struct omap_hwmod *oh,
3087static int _omap2_is_hardreset_asserted(struct omap_hwmod *oh, 2967static int _omap2_is_hardreset_asserted(struct omap_hwmod *oh,
3088 struct omap_hwmod_rst_info *ohri) 2968 struct omap_hwmod_rst_info *ohri)
3089{ 2969{
3090 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs, 2970 return omap_prm_is_hardreset_asserted(ohri->st_shift, 0,
3091 ohri->st_shift); 2971 oh->prcm.omap2.module_offs, 0);
3092} 2972}
3093 2973
3094/** 2974/**
@@ -3109,10 +2989,10 @@ static int _omap4_assert_hardreset(struct omap_hwmod *oh,
3109 if (!oh->clkdm) 2989 if (!oh->clkdm)
3110 return -EINVAL; 2990 return -EINVAL;
3111 2991
3112 return omap4_prminst_assert_hardreset(ohri->rst_shift, 2992 return omap_prm_assert_hardreset(ohri->rst_shift,
3113 oh->clkdm->pwrdm.ptr->prcm_partition, 2993 oh->clkdm->pwrdm.ptr->prcm_partition,
3114 oh->clkdm->pwrdm.ptr->prcm_offs, 2994 oh->clkdm->pwrdm.ptr->prcm_offs,
3115 oh->prcm.omap4.rstctrl_offs); 2995 oh->prcm.omap4.rstctrl_offs);
3116} 2996}
3117 2997
3118/** 2998/**
@@ -3136,10 +3016,10 @@ static int _omap4_deassert_hardreset(struct omap_hwmod *oh,
3136 if (ohri->st_shift) 3016 if (ohri->st_shift)
3137 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", 3017 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
3138 oh->name, ohri->name); 3018 oh->name, ohri->name);
3139 return omap4_prminst_deassert_hardreset(ohri->rst_shift, 3019 return omap_prm_deassert_hardreset(ohri->rst_shift, 0,
3140 oh->clkdm->pwrdm.ptr->prcm_partition, 3020 oh->clkdm->pwrdm.ptr->prcm_partition,
3141 oh->clkdm->pwrdm.ptr->prcm_offs, 3021 oh->clkdm->pwrdm.ptr->prcm_offs,
3142 oh->prcm.omap4.rstctrl_offs); 3022 oh->prcm.omap4.rstctrl_offs, 0);
3143} 3023}
3144 3024
3145/** 3025/**
@@ -3160,10 +3040,11 @@ static int _omap4_is_hardreset_asserted(struct omap_hwmod *oh,
3160 if (!oh->clkdm) 3040 if (!oh->clkdm)
3161 return -EINVAL; 3041 return -EINVAL;
3162 3042
3163 return omap4_prminst_is_hardreset_asserted(ohri->rst_shift, 3043 return omap_prm_is_hardreset_asserted(ohri->rst_shift,
3164 oh->clkdm->pwrdm.ptr->prcm_partition, 3044 oh->clkdm->pwrdm.ptr->
3165 oh->clkdm->pwrdm.ptr->prcm_offs, 3045 prcm_partition,
3166 oh->prcm.omap4.rstctrl_offs); 3046 oh->clkdm->pwrdm.ptr->prcm_offs,
3047 oh->prcm.omap4.rstctrl_offs);
3167} 3048}
3168 3049
3169/** 3050/**
@@ -3182,9 +3063,9 @@ static int _am33xx_assert_hardreset(struct omap_hwmod *oh,
3182 struct omap_hwmod_rst_info *ohri) 3063 struct omap_hwmod_rst_info *ohri)
3183 3064
3184{ 3065{
3185 return am33xx_prm_assert_hardreset(ohri->rst_shift, 3066 return omap_prm_assert_hardreset(ohri->rst_shift, 0,
3186 oh->clkdm->pwrdm.ptr->prcm_offs, 3067 oh->clkdm->pwrdm.ptr->prcm_offs,
3187 oh->prcm.omap4.rstctrl_offs); 3068 oh->prcm.omap4.rstctrl_offs);
3188} 3069}
3189 3070
3190/** 3071/**
@@ -3202,11 +3083,10 @@ static int _am33xx_assert_hardreset(struct omap_hwmod *oh,
3202static int _am33xx_deassert_hardreset(struct omap_hwmod *oh, 3083static int _am33xx_deassert_hardreset(struct omap_hwmod *oh,
3203 struct omap_hwmod_rst_info *ohri) 3084 struct omap_hwmod_rst_info *ohri)
3204{ 3085{
3205 return am33xx_prm_deassert_hardreset(ohri->rst_shift, 3086 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, 0,
3206 ohri->st_shift, 3087 oh->clkdm->pwrdm.ptr->prcm_offs,
3207 oh->clkdm->pwrdm.ptr->prcm_offs, 3088 oh->prcm.omap4.rstctrl_offs,
3208 oh->prcm.omap4.rstctrl_offs, 3089 oh->prcm.omap4.rstst_offs);
3209 oh->prcm.omap4.rstst_offs);
3210} 3090}
3211 3091
3212/** 3092/**
@@ -3224,9 +3104,9 @@ static int _am33xx_deassert_hardreset(struct omap_hwmod *oh,
3224static int _am33xx_is_hardreset_asserted(struct omap_hwmod *oh, 3104static int _am33xx_is_hardreset_asserted(struct omap_hwmod *oh,
3225 struct omap_hwmod_rst_info *ohri) 3105 struct omap_hwmod_rst_info *ohri)
3226{ 3106{
3227 return am33xx_prm_is_hardreset_asserted(ohri->rst_shift, 3107 return omap_prm_is_hardreset_asserted(ohri->rst_shift, 0,
3228 oh->clkdm->pwrdm.ptr->prcm_offs, 3108 oh->clkdm->pwrdm.ptr->prcm_offs,
3229 oh->prcm.omap4.rstctrl_offs); 3109 oh->prcm.omap4.rstctrl_offs);
3230} 3110}
3231 3111
3232/* Public functions */ 3112/* Public functions */
@@ -4234,12 +4114,12 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
4234void __init omap_hwmod_init(void) 4114void __init omap_hwmod_init(void)
4235{ 4115{
4236 if (cpu_is_omap24xx()) { 4116 if (cpu_is_omap24xx()) {
4237 soc_ops.wait_target_ready = _omap2xxx_wait_target_ready; 4117 soc_ops.wait_target_ready = _omap2xxx_3xxx_wait_target_ready;
4238 soc_ops.assert_hardreset = _omap2_assert_hardreset; 4118 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4239 soc_ops.deassert_hardreset = _omap2_deassert_hardreset; 4119 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4240 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; 4120 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
4241 } else if (cpu_is_omap34xx()) { 4121 } else if (cpu_is_omap34xx()) {
4242 soc_ops.wait_target_ready = _omap3xxx_wait_target_ready; 4122 soc_ops.wait_target_ready = _omap2xxx_3xxx_wait_target_ready;
4243 soc_ops.assert_hardreset = _omap2_assert_hardreset; 4123 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4244 soc_ops.deassert_hardreset = _omap2_deassert_hardreset; 4124 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4245 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; 4125 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
@@ -4258,14 +4138,14 @@ void __init omap_hwmod_init(void)
4258 soc_ops.enable_module = _omap4_enable_module; 4138 soc_ops.enable_module = _omap4_enable_module;
4259 soc_ops.disable_module = _omap4_disable_module; 4139 soc_ops.disable_module = _omap4_disable_module;
4260 soc_ops.wait_target_ready = _omap4_wait_target_ready; 4140 soc_ops.wait_target_ready = _omap4_wait_target_ready;
4261 soc_ops.assert_hardreset = _am33xx_assert_hardreset; 4141 soc_ops.assert_hardreset = _omap4_assert_hardreset;
4262 soc_ops.deassert_hardreset = _am33xx_deassert_hardreset; 4142 soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
4263 soc_ops.is_hardreset_asserted = _am33xx_is_hardreset_asserted; 4143 soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
4264 soc_ops.init_clkdm = _init_clkdm; 4144 soc_ops.init_clkdm = _init_clkdm;
4265 } else if (soc_is_am33xx()) { 4145 } else if (soc_is_am33xx()) {
4266 soc_ops.enable_module = _am33xx_enable_module; 4146 soc_ops.enable_module = _omap4_enable_module;
4267 soc_ops.disable_module = _am33xx_disable_module; 4147 soc_ops.disable_module = _omap4_disable_module;
4268 soc_ops.wait_target_ready = _am33xx_wait_target_ready; 4148 soc_ops.wait_target_ready = _omap4_wait_target_ready;
4269 soc_ops.assert_hardreset = _am33xx_assert_hardreset; 4149 soc_ops.assert_hardreset = _am33xx_assert_hardreset;
4270 soc_ops.deassert_hardreset = _am33xx_deassert_hardreset; 4150 soc_ops.deassert_hardreset = _am33xx_deassert_hardreset;
4271 soc_ops.is_hardreset_asserted = _am33xx_is_hardreset_asserted; 4151 soc_ops.is_hardreset_asserted = _am33xx_is_hardreset_asserted;
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 512f809a3f4d..35ca6efbec31 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -633,6 +633,7 @@ struct omap_hwmod_link {
633 * @flags: hwmod flags (documented below) 633 * @flags: hwmod flags (documented below)
634 * @_lock: spinlock serializing operations on this hwmod 634 * @_lock: spinlock serializing operations on this hwmod
635 * @node: list node for hwmod list (internal use) 635 * @node: list node for hwmod list (internal use)
636 * @parent_hwmod: (temporary) a pointer to the hierarchical parent of this hwmod
636 * 637 *
637 * @main_clk refers to this module's "main clock," which for our 638 * @main_clk refers to this module's "main clock," which for our
638 * purposes is defined as "the functional clock needed for register 639 * purposes is defined as "the functional clock needed for register
@@ -643,6 +644,12 @@ struct omap_hwmod_link {
643 * the omap_hwmod code and should not be set during initialization. 644 * the omap_hwmod code and should not be set during initialization.
644 * 645 *
645 * @masters and @slaves are now deprecated. 646 * @masters and @slaves are now deprecated.
647 *
648 * @parent_hwmod is temporary; there should be no need for it, as this
649 * information should already be expressed in the OCP interface
650 * structures. @parent_hwmod is present as a workaround until we improve
651 * handling for hwmods with multiple parents (e.g., OMAP4+ DSS with
652 * multiple register targets across different interconnects).
646 */ 653 */
647struct omap_hwmod { 654struct omap_hwmod {
648 const char *name; 655 const char *name;
@@ -680,6 +687,7 @@ struct omap_hwmod {
680 u8 _int_flags; 687 u8 _int_flags;
681 u8 _state; 688 u8 _state;
682 u8 _postsetup_state; 689 u8 _postsetup_state;
690 struct omap_hwmod *parent_hwmod;
683}; 691};
684 692
685struct omap_hwmod *omap_hwmod_lookup(const char *name); 693struct omap_hwmod *omap_hwmod_lookup(const char *name);
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index c2555cb95e71..79127b35fe60 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -15,12 +15,12 @@
15 15
16#include <linux/i2c-omap.h> 16#include <linux/i2c-omap.h>
17#include <linux/platform_data/asoc-ti-mcbsp.h> 17#include <linux/platform_data/asoc-ti-mcbsp.h>
18#include <linux/platform_data/hsmmc-omap.h>
18#include <linux/platform_data/spi-omap2-mcspi.h> 19#include <linux/platform_data/spi-omap2-mcspi.h>
19#include <linux/omap-dma.h> 20#include <linux/omap-dma.h>
20#include <plat/dmtimer.h> 21#include <plat/dmtimer.h>
21 22
22#include "omap_hwmod.h" 23#include "omap_hwmod.h"
23#include "mmc.h"
24#include "l3_2xxx.h" 24#include "l3_2xxx.h"
25 25
26#include "soc.h" 26#include "soc.h"
@@ -372,7 +372,7 @@ static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = {
372 { .role = "dbck", .clk = "mmchsdb1_fck" }, 372 { .role = "dbck", .clk = "mmchsdb1_fck" },
373}; 373};
374 374
375static struct omap_mmc_dev_attr mmc1_dev_attr = { 375static struct omap_hsmmc_dev_attr mmc1_dev_attr = {
376 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 376 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
377}; 377};
378 378
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index a579b89ce9b7..cabc5695b504 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -15,10 +15,10 @@
15 */ 15 */
16 16
17#include <linux/platform_data/gpio-omap.h> 17#include <linux/platform_data/gpio-omap.h>
18#include <linux/platform_data/hsmmc-omap.h>
18#include <linux/platform_data/spi-omap2-mcspi.h> 19#include <linux/platform_data/spi-omap2-mcspi.h>
19#include "omap_hwmod.h" 20#include "omap_hwmod.h"
20#include "i2c.h" 21#include "i2c.h"
21#include "mmc.h"
22#include "wd_timer.h" 22#include "wd_timer.h"
23#include "cm33xx.h" 23#include "cm33xx.h"
24#include "prm33xx.h" 24#include "prm33xx.h"
@@ -836,7 +836,7 @@ static struct omap_hwmod_class am33xx_mmc_hwmod_class = {
836}; 836};
837 837
838/* mmc0 */ 838/* mmc0 */
839static struct omap_mmc_dev_attr am33xx_mmc0_dev_attr = { 839static struct omap_hsmmc_dev_attr am33xx_mmc0_dev_attr = {
840 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 840 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
841}; 841};
842 842
@@ -854,7 +854,7 @@ struct omap_hwmod am33xx_mmc0_hwmod = {
854}; 854};
855 855
856/* mmc1 */ 856/* mmc1 */
857static struct omap_mmc_dev_attr am33xx_mmc1_dev_attr = { 857static struct omap_hsmmc_dev_attr am33xx_mmc1_dev_attr = {
858 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 858 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
859}; 859};
860 860
@@ -872,7 +872,7 @@ struct omap_hwmod am33xx_mmc1_hwmod = {
872}; 872};
873 873
874/* mmc2 */ 874/* mmc2 */
875static struct omap_mmc_dev_attr am33xx_mmc2_dev_attr = { 875static struct omap_hsmmc_dev_attr am33xx_mmc2_dev_attr = {
876 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 876 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
877}; 877};
878struct omap_hwmod am33xx_mmc2_hwmod = { 878struct omap_hwmod am33xx_mmc2_hwmod = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 6b406ca4bd3b..0cf7b563dcd1 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -27,7 +27,6 @@
27#include "prm33xx.h" 27#include "prm33xx.h"
28#include "prm-regbits-33xx.h" 28#include "prm-regbits-33xx.h"
29#include "i2c.h" 29#include "i2c.h"
30#include "mmc.h"
31#include "wd_timer.h" 30#include "wd_timer.h"
32#include "omap_hwmod_33xx_43xx_common_data.h" 31#include "omap_hwmod_33xx_43xx_common_data.h"
33 32
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 2a78b093c0ce..11468eea3871 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -18,6 +18,7 @@
18#include <linux/i2c-omap.h> 18#include <linux/i2c-omap.h>
19#include <linux/power/smartreflex.h> 19#include <linux/power/smartreflex.h>
20#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
21#include <linux/platform_data/hsmmc-omap.h>
21 22
22#include <linux/omap-dma.h> 23#include <linux/omap-dma.h>
23#include "l3_3xxx.h" 24#include "l3_3xxx.h"
@@ -37,7 +38,6 @@
37#include "cm-regbits-34xx.h" 38#include "cm-regbits-34xx.h"
38 39
39#include "i2c.h" 40#include "i2c.h"
40#include "mmc.h"
41#include "wd_timer.h" 41#include "wd_timer.h"
42#include "serial.h" 42#include "serial.h"
43 43
@@ -1786,12 +1786,12 @@ static struct omap_hwmod_opt_clk omap34xx_mmc1_opt_clks[] = {
1786 { .role = "dbck", .clk = "omap_32k_fck", }, 1786 { .role = "dbck", .clk = "omap_32k_fck", },
1787}; 1787};
1788 1788
1789static struct omap_mmc_dev_attr mmc1_dev_attr = { 1789static struct omap_hsmmc_dev_attr mmc1_dev_attr = {
1790 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 1790 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1791}; 1791};
1792 1792
1793/* See 35xx errata 2.1.1.128 in SPRZ278F */ 1793/* See 35xx errata 2.1.1.128 in SPRZ278F */
1794static struct omap_mmc_dev_attr mmc1_pre_es3_dev_attr = { 1794static struct omap_hsmmc_dev_attr mmc1_pre_es3_dev_attr = {
1795 .flags = (OMAP_HSMMC_SUPPORTS_DUAL_VOLT | 1795 .flags = (OMAP_HSMMC_SUPPORTS_DUAL_VOLT |
1796 OMAP_HSMMC_BROKEN_MULTIBLOCK_READ), 1796 OMAP_HSMMC_BROKEN_MULTIBLOCK_READ),
1797}; 1797};
@@ -1854,7 +1854,7 @@ static struct omap_hwmod_opt_clk omap34xx_mmc2_opt_clks[] = {
1854}; 1854};
1855 1855
1856/* See 35xx errata 2.1.1.128 in SPRZ278F */ 1856/* See 35xx errata 2.1.1.128 in SPRZ278F */
1857static struct omap_mmc_dev_attr mmc2_pre_es3_dev_attr = { 1857static struct omap_hsmmc_dev_attr mmc2_pre_es3_dev_attr = {
1858 .flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ, 1858 .flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ,
1859}; 1859};
1860 1860
diff --git a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
index fea01aa3ef42..5c6c8410160e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
@@ -417,6 +417,37 @@ static struct omap_hwmod am43xx_qspi_hwmod = {
417 }, 417 },
418}; 418};
419 419
420/*
421 * 'adc/tsc' class
422 * TouchScreen Controller (Analog-To-Digital Converter)
423 */
424static struct omap_hwmod_class_sysconfig am43xx_adc_tsc_sysc = {
425 .rev_offs = 0x00,
426 .sysc_offs = 0x10,
427 .sysc_flags = SYSC_HAS_SIDLEMODE,
428 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
429 SIDLE_SMART_WKUP),
430 .sysc_fields = &omap_hwmod_sysc_type2,
431};
432
433static struct omap_hwmod_class am43xx_adc_tsc_hwmod_class = {
434 .name = "adc_tsc",
435 .sysc = &am43xx_adc_tsc_sysc,
436};
437
438static struct omap_hwmod am43xx_adc_tsc_hwmod = {
439 .name = "adc_tsc",
440 .class = &am43xx_adc_tsc_hwmod_class,
441 .clkdm_name = "l3s_tsc_clkdm",
442 .main_clk = "adc_tsc_fck",
443 .prcm = {
444 .omap4 = {
445 .clkctrl_offs = AM43XX_CM_WKUP_ADC_TSC_CLKCTRL_OFFSET,
446 .modulemode = MODULEMODE_SWCTRL,
447 },
448 },
449};
450
420/* dss */ 451/* dss */
421 452
422static struct omap_hwmod am43xx_dss_core_hwmod = { 453static struct omap_hwmod am43xx_dss_core_hwmod = {
@@ -547,6 +578,13 @@ static struct omap_hwmod_ocp_if am43xx_l4_wkup__gpio0 = {
547 .user = OCP_USER_MPU | OCP_USER_SDMA, 578 .user = OCP_USER_MPU | OCP_USER_SDMA,
548}; 579};
549 580
581static struct omap_hwmod_ocp_if am43xx_l4_wkup__adc_tsc = {
582 .master = &am33xx_l4_wkup_hwmod,
583 .slave = &am43xx_adc_tsc_hwmod,
584 .clk = "dpll_core_m4_div2_ck",
585 .user = OCP_USER_MPU,
586};
587
550static struct omap_hwmod_ocp_if am43xx_l4_hs__cpgmac0 = { 588static struct omap_hwmod_ocp_if am43xx_l4_hs__cpgmac0 = {
551 .master = &am43xx_l4_hs_hwmod, 589 .master = &am43xx_l4_hs_hwmod,
552 .slave = &am33xx_cpgmac0_hwmod, 590 .slave = &am33xx_cpgmac0_hwmod,
@@ -789,6 +827,7 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
789 &am43xx_l4_wkup__i2c1, 827 &am43xx_l4_wkup__i2c1,
790 &am43xx_l4_wkup__gpio0, 828 &am43xx_l4_wkup__gpio0,
791 &am43xx_l4_wkup__wd_timer1, 829 &am43xx_l4_wkup__wd_timer1,
830 &am43xx_l4_wkup__adc_tsc,
792 &am43xx_l3_s__qspi, 831 &am43xx_l3_s__qspi,
793 &am33xx_l4_per__dcan0, 832 &am33xx_l4_per__dcan0,
794 &am33xx_l4_per__dcan1, 833 &am33xx_l4_per__dcan1,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 44e5634bba34..c314b3c31117 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/platform_data/gpio-omap.h> 24#include <linux/platform_data/gpio-omap.h>
25#include <linux/platform_data/hsmmc-omap.h>
25#include <linux/power/smartreflex.h> 26#include <linux/power/smartreflex.h>
26#include <linux/i2c-omap.h> 27#include <linux/i2c-omap.h>
27 28
@@ -39,7 +40,6 @@
39#include "prm44xx.h" 40#include "prm44xx.h"
40#include "prm-regbits-44xx.h" 41#include "prm-regbits-44xx.h"
41#include "i2c.h" 42#include "i2c.h"
42#include "mmc.h"
43#include "wd_timer.h" 43#include "wd_timer.h"
44 44
45/* Base offset for all OMAP4 interrupts external to MPUSS */ 45/* Base offset for all OMAP4 interrupts external to MPUSS */
@@ -589,6 +589,7 @@ static struct omap_hwmod omap44xx_dss_hwmod = {
589 .omap4 = { 589 .omap4 = {
590 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET, 590 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
591 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET, 591 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
592 .modulemode = MODULEMODE_SWCTRL,
592 }, 593 },
593 }, 594 },
594 .opt_clks = dss_opt_clks, 595 .opt_clks = dss_opt_clks,
@@ -647,7 +648,8 @@ static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
647 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET, 648 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
648 }, 649 },
649 }, 650 },
650 .dev_attr = &omap44xx_dss_dispc_dev_attr 651 .dev_attr = &omap44xx_dss_dispc_dev_attr,
652 .parent_hwmod = &omap44xx_dss_hwmod,
651}; 653};
652 654
653/* 655/*
@@ -701,6 +703,7 @@ static struct omap_hwmod omap44xx_dss_dsi1_hwmod = {
701 }, 703 },
702 .opt_clks = dss_dsi1_opt_clks, 704 .opt_clks = dss_dsi1_opt_clks,
703 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks), 705 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks),
706 .parent_hwmod = &omap44xx_dss_hwmod,
704}; 707};
705 708
706/* dss_dsi2 */ 709/* dss_dsi2 */
@@ -733,6 +736,7 @@ static struct omap_hwmod omap44xx_dss_dsi2_hwmod = {
733 }, 736 },
734 .opt_clks = dss_dsi2_opt_clks, 737 .opt_clks = dss_dsi2_opt_clks,
735 .opt_clks_cnt = ARRAY_SIZE(dss_dsi2_opt_clks), 738 .opt_clks_cnt = ARRAY_SIZE(dss_dsi2_opt_clks),
739 .parent_hwmod = &omap44xx_dss_hwmod,
736}; 740};
737 741
738/* 742/*
@@ -790,6 +794,7 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
790 }, 794 },
791 .opt_clks = dss_hdmi_opt_clks, 795 .opt_clks = dss_hdmi_opt_clks,
792 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks), 796 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks),
797 .parent_hwmod = &omap44xx_dss_hwmod,
793}; 798};
794 799
795/* 800/*
@@ -819,7 +824,7 @@ static struct omap_hwmod_dma_info omap44xx_dss_rfbi_sdma_reqs[] = {
819}; 824};
820 825
821static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = { 826static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
822 { .role = "ick", .clk = "dss_fck" }, 827 { .role = "ick", .clk = "l3_div_ck" },
823}; 828};
824 829
825static struct omap_hwmod omap44xx_dss_rfbi_hwmod = { 830static struct omap_hwmod omap44xx_dss_rfbi_hwmod = {
@@ -836,6 +841,7 @@ static struct omap_hwmod omap44xx_dss_rfbi_hwmod = {
836 }, 841 },
837 .opt_clks = dss_rfbi_opt_clks, 842 .opt_clks = dss_rfbi_opt_clks,
838 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks), 843 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
844 .parent_hwmod = &omap44xx_dss_hwmod,
839}; 845};
840 846
841/* 847/*
@@ -859,6 +865,7 @@ static struct omap_hwmod omap44xx_dss_venc_hwmod = {
859 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET, 865 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
860 }, 866 },
861 }, 867 },
868 .parent_hwmod = &omap44xx_dss_hwmod,
862}; 869};
863 870
864/* 871/*
@@ -1952,7 +1959,7 @@ static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = {
1952}; 1959};
1953 1960
1954/* mmc1 dev_attr */ 1961/* mmc1 dev_attr */
1955static struct omap_mmc_dev_attr mmc1_dev_attr = { 1962static struct omap_hsmmc_dev_attr mmc1_dev_attr = {
1956 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 1963 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1957}; 1964};
1958 1965
@@ -3671,7 +3678,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_dma_addrs[] = {
3671static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss = { 3678static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss = {
3672 .master = &omap44xx_l3_main_2_hwmod, 3679 .master = &omap44xx_l3_main_2_hwmod,
3673 .slave = &omap44xx_dss_hwmod, 3680 .slave = &omap44xx_dss_hwmod,
3674 .clk = "dss_fck", 3681 .clk = "l3_div_ck",
3675 .addr = omap44xx_dss_dma_addrs, 3682 .addr = omap44xx_dss_dma_addrs,
3676 .user = OCP_USER_SDMA, 3683 .user = OCP_USER_SDMA,
3677}; 3684};
@@ -3707,7 +3714,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_dispc_dma_addrs[] = {
3707static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dispc = { 3714static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dispc = {
3708 .master = &omap44xx_l3_main_2_hwmod, 3715 .master = &omap44xx_l3_main_2_hwmod,
3709 .slave = &omap44xx_dss_dispc_hwmod, 3716 .slave = &omap44xx_dss_dispc_hwmod,
3710 .clk = "dss_fck", 3717 .clk = "l3_div_ck",
3711 .addr = omap44xx_dss_dispc_dma_addrs, 3718 .addr = omap44xx_dss_dispc_dma_addrs,
3712 .user = OCP_USER_SDMA, 3719 .user = OCP_USER_SDMA,
3713}; 3720};
@@ -3743,7 +3750,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_dsi1_dma_addrs[] = {
3743static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi1 = { 3750static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi1 = {
3744 .master = &omap44xx_l3_main_2_hwmod, 3751 .master = &omap44xx_l3_main_2_hwmod,
3745 .slave = &omap44xx_dss_dsi1_hwmod, 3752 .slave = &omap44xx_dss_dsi1_hwmod,
3746 .clk = "dss_fck", 3753 .clk = "l3_div_ck",
3747 .addr = omap44xx_dss_dsi1_dma_addrs, 3754 .addr = omap44xx_dss_dsi1_dma_addrs,
3748 .user = OCP_USER_SDMA, 3755 .user = OCP_USER_SDMA,
3749}; 3756};
@@ -3779,7 +3786,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_dsi2_dma_addrs[] = {
3779static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi2 = { 3786static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi2 = {
3780 .master = &omap44xx_l3_main_2_hwmod, 3787 .master = &omap44xx_l3_main_2_hwmod,
3781 .slave = &omap44xx_dss_dsi2_hwmod, 3788 .slave = &omap44xx_dss_dsi2_hwmod,
3782 .clk = "dss_fck", 3789 .clk = "l3_div_ck",
3783 .addr = omap44xx_dss_dsi2_dma_addrs, 3790 .addr = omap44xx_dss_dsi2_dma_addrs,
3784 .user = OCP_USER_SDMA, 3791 .user = OCP_USER_SDMA,
3785}; 3792};
@@ -3815,7 +3822,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_hdmi_dma_addrs[] = {
3815static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_hdmi = { 3822static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_hdmi = {
3816 .master = &omap44xx_l3_main_2_hwmod, 3823 .master = &omap44xx_l3_main_2_hwmod,
3817 .slave = &omap44xx_dss_hdmi_hwmod, 3824 .slave = &omap44xx_dss_hdmi_hwmod,
3818 .clk = "dss_fck", 3825 .clk = "l3_div_ck",
3819 .addr = omap44xx_dss_hdmi_dma_addrs, 3826 .addr = omap44xx_dss_hdmi_dma_addrs,
3820 .user = OCP_USER_SDMA, 3827 .user = OCP_USER_SDMA,
3821}; 3828};
@@ -3851,7 +3858,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_rfbi_dma_addrs[] = {
3851static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_rfbi = { 3858static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_rfbi = {
3852 .master = &omap44xx_l3_main_2_hwmod, 3859 .master = &omap44xx_l3_main_2_hwmod,
3853 .slave = &omap44xx_dss_rfbi_hwmod, 3860 .slave = &omap44xx_dss_rfbi_hwmod,
3854 .clk = "dss_fck", 3861 .clk = "l3_div_ck",
3855 .addr = omap44xx_dss_rfbi_dma_addrs, 3862 .addr = omap44xx_dss_rfbi_dma_addrs,
3856 .user = OCP_USER_SDMA, 3863 .user = OCP_USER_SDMA,
3857}; 3864};
@@ -3887,7 +3894,7 @@ static struct omap_hwmod_addr_space omap44xx_dss_venc_dma_addrs[] = {
3887static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_venc = { 3894static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_venc = {
3888 .master = &omap44xx_l3_main_2_hwmod, 3895 .master = &omap44xx_l3_main_2_hwmod,
3889 .slave = &omap44xx_dss_venc_hwmod, 3896 .slave = &omap44xx_dss_venc_hwmod,
3890 .clk = "dss_fck", 3897 .clk = "l3_div_ck",
3891 .addr = omap44xx_dss_venc_dma_addrs, 3898 .addr = omap44xx_dss_venc_dma_addrs,
3892 .user = OCP_USER_SDMA, 3899 .user = OCP_USER_SDMA,
3893}; 3900};
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 1103aa0e0d29..3e9523084b2a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -19,6 +19,7 @@
19 19
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/platform_data/gpio-omap.h> 21#include <linux/platform_data/gpio-omap.h>
22#include <linux/platform_data/hsmmc-omap.h>
22#include <linux/power/smartreflex.h> 23#include <linux/power/smartreflex.h>
23#include <linux/i2c-omap.h> 24#include <linux/i2c-omap.h>
24 25
@@ -33,7 +34,6 @@
33#include "cm2_54xx.h" 34#include "cm2_54xx.h"
34#include "prm54xx.h" 35#include "prm54xx.h"
35#include "i2c.h" 36#include "i2c.h"
36#include "mmc.h"
37#include "wd_timer.h" 37#include "wd_timer.h"
38 38
39/* Base offset for all OMAP5 interrupts external to MPUSS */ 39/* Base offset for all OMAP5 interrupts external to MPUSS */
@@ -421,6 +421,7 @@ static struct omap_hwmod omap54xx_dss_dispc_hwmod = {
421 .opt_clks = dss_dispc_opt_clks, 421 .opt_clks = dss_dispc_opt_clks,
422 .opt_clks_cnt = ARRAY_SIZE(dss_dispc_opt_clks), 422 .opt_clks_cnt = ARRAY_SIZE(dss_dispc_opt_clks),
423 .dev_attr = &dss_dispc_dev_attr, 423 .dev_attr = &dss_dispc_dev_attr,
424 .parent_hwmod = &omap54xx_dss_hwmod,
424}; 425};
425 426
426/* 427/*
@@ -462,6 +463,7 @@ static struct omap_hwmod omap54xx_dss_dsi1_a_hwmod = {
462 }, 463 },
463 .opt_clks = dss_dsi1_a_opt_clks, 464 .opt_clks = dss_dsi1_a_opt_clks,
464 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_a_opt_clks), 465 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_a_opt_clks),
466 .parent_hwmod = &omap54xx_dss_hwmod,
465}; 467};
466 468
467/* dss_dsi1_c */ 469/* dss_dsi1_c */
@@ -482,6 +484,7 @@ static struct omap_hwmod omap54xx_dss_dsi1_c_hwmod = {
482 }, 484 },
483 .opt_clks = dss_dsi1_c_opt_clks, 485 .opt_clks = dss_dsi1_c_opt_clks,
484 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_c_opt_clks), 486 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_c_opt_clks),
487 .parent_hwmod = &omap54xx_dss_hwmod,
485}; 488};
486 489
487/* 490/*
@@ -521,6 +524,7 @@ static struct omap_hwmod omap54xx_dss_hdmi_hwmod = {
521 }, 524 },
522 .opt_clks = dss_hdmi_opt_clks, 525 .opt_clks = dss_hdmi_opt_clks,
523 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks), 526 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks),
527 .parent_hwmod = &omap54xx_dss_hwmod,
524}; 528};
525 529
526/* 530/*
@@ -560,6 +564,7 @@ static struct omap_hwmod omap54xx_dss_rfbi_hwmod = {
560 }, 564 },
561 .opt_clks = dss_rfbi_opt_clks, 565 .opt_clks = dss_rfbi_opt_clks,
562 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks), 566 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
567 .parent_hwmod = &omap54xx_dss_hwmod,
563}; 568};
564 569
565/* 570/*
@@ -1269,7 +1274,7 @@ static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
1269}; 1274};
1270 1275
1271/* mmc1 dev_attr */ 1276/* mmc1 dev_attr */
1272static struct omap_mmc_dev_attr mmc1_dev_attr = { 1277static struct omap_hsmmc_dev_attr mmc1_dev_attr = {
1273 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 1278 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1274}; 1279};
1275 1280
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 5684f112654b..ffd6604cd546 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -19,6 +19,7 @@
19 19
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/platform_data/gpio-omap.h> 21#include <linux/platform_data/gpio-omap.h>
22#include <linux/platform_data/hsmmc-omap.h>
22#include <linux/power/smartreflex.h> 23#include <linux/power/smartreflex.h>
23#include <linux/i2c-omap.h> 24#include <linux/i2c-omap.h>
24 25
@@ -33,7 +34,6 @@
33#include "cm2_7xx.h" 34#include "cm2_7xx.h"
34#include "prm7xx.h" 35#include "prm7xx.h"
35#include "i2c.h" 36#include "i2c.h"
36#include "mmc.h"
37#include "wd_timer.h" 37#include "wd_timer.h"
38#include "soc.h" 38#include "soc.h"
39 39
@@ -1301,7 +1301,7 @@ static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
1301}; 1301};
1302 1302
1303/* mmc1 dev_attr */ 1303/* mmc1 dev_attr */
1304static struct omap_mmc_dev_attr mmc1_dev_attr = { 1304static struct omap_hsmmc_dev_attr mmc1_dev_attr = {
1305 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 1305 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1306}; 1306};
1307 1307
@@ -2075,6 +2075,70 @@ static struct omap_hwmod dra7xx_uart6_hwmod = {
2075 }, 2075 },
2076}; 2076};
2077 2077
2078/* uart7 */
2079static struct omap_hwmod dra7xx_uart7_hwmod = {
2080 .name = "uart7",
2081 .class = &dra7xx_uart_hwmod_class,
2082 .clkdm_name = "l4per2_clkdm",
2083 .main_clk = "uart7_gfclk_mux",
2084 .flags = HWMOD_SWSUP_SIDLE_ACT,
2085 .prcm = {
2086 .omap4 = {
2087 .clkctrl_offs = DRA7XX_CM_L4PER2_UART7_CLKCTRL_OFFSET,
2088 .context_offs = DRA7XX_RM_L4PER2_UART7_CONTEXT_OFFSET,
2089 .modulemode = MODULEMODE_SWCTRL,
2090 },
2091 },
2092};
2093
2094/* uart8 */
2095static struct omap_hwmod dra7xx_uart8_hwmod = {
2096 .name = "uart8",
2097 .class = &dra7xx_uart_hwmod_class,
2098 .clkdm_name = "l4per2_clkdm",
2099 .main_clk = "uart8_gfclk_mux",
2100 .flags = HWMOD_SWSUP_SIDLE_ACT,
2101 .prcm = {
2102 .omap4 = {
2103 .clkctrl_offs = DRA7XX_CM_L4PER2_UART8_CLKCTRL_OFFSET,
2104 .context_offs = DRA7XX_RM_L4PER2_UART8_CONTEXT_OFFSET,
2105 .modulemode = MODULEMODE_SWCTRL,
2106 },
2107 },
2108};
2109
2110/* uart9 */
2111static struct omap_hwmod dra7xx_uart9_hwmod = {
2112 .name = "uart9",
2113 .class = &dra7xx_uart_hwmod_class,
2114 .clkdm_name = "l4per2_clkdm",
2115 .main_clk = "uart9_gfclk_mux",
2116 .flags = HWMOD_SWSUP_SIDLE_ACT,
2117 .prcm = {
2118 .omap4 = {
2119 .clkctrl_offs = DRA7XX_CM_L4PER2_UART9_CLKCTRL_OFFSET,
2120 .context_offs = DRA7XX_RM_L4PER2_UART9_CONTEXT_OFFSET,
2121 .modulemode = MODULEMODE_SWCTRL,
2122 },
2123 },
2124};
2125
2126/* uart10 */
2127static struct omap_hwmod dra7xx_uart10_hwmod = {
2128 .name = "uart10",
2129 .class = &dra7xx_uart_hwmod_class,
2130 .clkdm_name = "wkupaon_clkdm",
2131 .main_clk = "uart10_gfclk_mux",
2132 .flags = HWMOD_SWSUP_SIDLE_ACT,
2133 .prcm = {
2134 .omap4 = {
2135 .clkctrl_offs = DRA7XX_CM_WKUPAON_UART10_CLKCTRL_OFFSET,
2136 .context_offs = DRA7XX_RM_WKUPAON_UART10_CONTEXT_OFFSET,
2137 .modulemode = MODULEMODE_SWCTRL,
2138 },
2139 },
2140};
2141
2078/* 2142/*
2079 * 'usb_otg_ss' class 2143 * 'usb_otg_ss' class
2080 * 2144 *
@@ -3095,6 +3159,38 @@ static struct omap_hwmod_ocp_if dra7xx_l4_per1__uart6 = {
3095 .user = OCP_USER_MPU | OCP_USER_SDMA, 3159 .user = OCP_USER_MPU | OCP_USER_SDMA,
3096}; 3160};
3097 3161
3162/* l4_per2 -> uart7 */
3163static struct omap_hwmod_ocp_if dra7xx_l4_per2__uart7 = {
3164 .master = &dra7xx_l4_per2_hwmod,
3165 .slave = &dra7xx_uart7_hwmod,
3166 .clk = "l3_iclk_div",
3167 .user = OCP_USER_MPU | OCP_USER_SDMA,
3168};
3169
3170/* l4_per2 -> uart8 */
3171static struct omap_hwmod_ocp_if dra7xx_l4_per2__uart8 = {
3172 .master = &dra7xx_l4_per2_hwmod,
3173 .slave = &dra7xx_uart8_hwmod,
3174 .clk = "l3_iclk_div",
3175 .user = OCP_USER_MPU | OCP_USER_SDMA,
3176};
3177
3178/* l4_per2 -> uart9 */
3179static struct omap_hwmod_ocp_if dra7xx_l4_per2__uart9 = {
3180 .master = &dra7xx_l4_per2_hwmod,
3181 .slave = &dra7xx_uart9_hwmod,
3182 .clk = "l3_iclk_div",
3183 .user = OCP_USER_MPU | OCP_USER_SDMA,
3184};
3185
3186/* l4_wkup -> uart10 */
3187static struct omap_hwmod_ocp_if dra7xx_l4_wkup__uart10 = {
3188 .master = &dra7xx_l4_wkup_hwmod,
3189 .slave = &dra7xx_uart10_hwmod,
3190 .clk = "wkupaon_iclk_mux",
3191 .user = OCP_USER_MPU | OCP_USER_SDMA,
3192};
3193
3098/* l4_per3 -> usb_otg_ss1 */ 3194/* l4_per3 -> usb_otg_ss1 */
3099static struct omap_hwmod_ocp_if dra7xx_l4_per3__usb_otg_ss1 = { 3195static struct omap_hwmod_ocp_if dra7xx_l4_per3__usb_otg_ss1 = {
3100 .master = &dra7xx_l4_per3_hwmod, 3196 .master = &dra7xx_l4_per3_hwmod,
@@ -3259,6 +3355,10 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
3259 &dra7xx_l4_per1__uart4, 3355 &dra7xx_l4_per1__uart4,
3260 &dra7xx_l4_per1__uart5, 3356 &dra7xx_l4_per1__uart5,
3261 &dra7xx_l4_per1__uart6, 3357 &dra7xx_l4_per1__uart6,
3358 &dra7xx_l4_per2__uart7,
3359 &dra7xx_l4_per2__uart8,
3360 &dra7xx_l4_per2__uart9,
3361 &dra7xx_l4_wkup__uart10,
3262 &dra7xx_l4_per3__usb_otg_ss1, 3362 &dra7xx_l4_per3__usb_otg_ss1,
3263 &dra7xx_l4_per3__usb_otg_ss2, 3363 &dra7xx_l4_per3__usb_otg_ss2,
3264 &dra7xx_l4_per3__usb_otg_ss3, 3364 &dra7xx_l4_per3__usb_otg_ss3,
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index 50640b38f0bf..1a19fa096bab 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -21,6 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/types.h> 26#include <linux/types.h>
25#include <linux/delay.h> 27#include <linux/delay.h>
26#include <linux/clk.h> 28#include <linux/clk.h>
@@ -97,13 +99,13 @@ void am35x_musb_phy_power(u8 on)
97 99
98 omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2); 100 omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
99 101
100 pr_info(KERN_INFO "Waiting for PHY clock good...\n"); 102 pr_info("Waiting for PHY clock good...\n");
101 while (!(omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2) 103 while (!(omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2)
102 & CONF2_PHYCLKGD)) { 104 & CONF2_PHYCLKGD)) {
103 cpu_relax(); 105 cpu_relax();
104 106
105 if (time_after(jiffies, timeout)) { 107 if (time_after(jiffies, timeout)) {
106 pr_err(KERN_ERR "musb PHY clock good timed out\n"); 108 pr_err("musb PHY clock good timed out\n");
107 break; 109 break;
108 } 110 }
109 } 111 }
@@ -145,7 +147,7 @@ void am35x_set_mode(u8 musb_mode)
145 devconf2 |= CONF2_NO_OVERRIDE; 147 devconf2 |= CONF2_NO_OVERRIDE;
146 break; 148 break;
147 default: 149 default:
148 pr_info(KERN_INFO "Unsupported mode %u\n", musb_mode); 150 pr_info("Unsupported mode %u\n", musb_mode);
149 } 151 }
150 152
151 omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2); 153 omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index cec9d6c6442c..3d7eee1d3cfa 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/of_platform.h> 15#include <linux/of_platform.h>
16#include <linux/ti_wilink_st.h>
16#include <linux/wl12xx.h> 17#include <linux/wl12xx.h>
17 18
18#include <linux/platform_data/pinctrl-single.h> 19#include <linux/platform_data/pinctrl-single.h>
@@ -130,17 +131,45 @@ static void __init omap3_sbc_t3730_legacy_init(void)
130{ 131{
131 omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub"); 132 omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
132 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 136); 133 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 136);
133 omap_ads7846_init(1, 57, 0, NULL);
134} 134}
135 135
136static void __init omap3_sbc_t3530_legacy_init(void) 136static void __init omap3_sbc_t3530_legacy_init(void)
137{ 137{
138 omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub"); 138 omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
139 omap_ads7846_init(1, 57, 0, NULL);
140} 139}
141 140
142static void __init omap3_igep0020_legacy_init(void) 141struct ti_st_plat_data wilink_pdata = {
142 .nshutdown_gpio = 137,
143 .dev_name = "/dev/ttyO1",
144 .flow_cntrl = 1,
145 .baud_rate = 300000,
146};
147
148static struct platform_device wl18xx_device = {
149 .name = "kim",
150 .id = -1,
151 .dev = {
152 .platform_data = &wilink_pdata,
153 }
154};
155
156static struct platform_device btwilink_device = {
157 .name = "btwilink",
158 .id = -1,
159};
160
161static void __init omap3_igep0020_rev_f_legacy_init(void)
162{
163 legacy_init_wl12xx(0, 0, 177);
164 platform_device_register(&wl18xx_device);
165 platform_device_register(&btwilink_device);
166}
167
168static void __init omap3_igep0030_rev_g_legacy_init(void)
143{ 169{
170 legacy_init_wl12xx(0, 0, 136);
171 platform_device_register(&wl18xx_device);
172 platform_device_register(&btwilink_device);
144} 173}
145 174
146static void __init omap3_evm_legacy_init(void) 175static void __init omap3_evm_legacy_init(void)
@@ -218,7 +247,6 @@ static void __init omap3_sbc_t3517_legacy_init(void)
218 hsmmc2_internal_input_clk(); 247 hsmmc2_internal_input_clk();
219 omap3_sbc_t3517_wifi_init(); 248 omap3_sbc_t3517_wifi_init();
220 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 145); 249 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 145);
221 omap_ads7846_init(1, 57, 0, NULL);
222} 250}
223 251
224static void __init am3517_evm_legacy_init(void) 252static void __init am3517_evm_legacy_init(void)
@@ -390,7 +418,8 @@ static struct pdata_init pdata_quirks[] __initdata = {
390 { "nokia,omap3-n900", nokia_n900_legacy_init, }, 418 { "nokia,omap3-n900", nokia_n900_legacy_init, },
391 { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, 419 { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
392 { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, 420 { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
393 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, 421 { "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
422 { "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
394 { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, 423 { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
395 { "ti,omap3-zoom3", omap3_zoom_legacy_init, }, 424 { "ti,omap3-zoom3", omap3_zoom_legacy_init, },
396 { "ti,am3517-evm", am3517_evm_legacy_init, }, 425 { "ti,am3517-evm", am3517_evm_legacy_init, },
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 175564c88a30..88721df6001d 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -29,6 +29,7 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/omap-dma.h> 31#include <linux/omap-dma.h>
32#include <linux/omap-gpmc.h>
32#include <linux/platform_data/gpio-omap.h> 33#include <linux/platform_data/gpio-omap.h>
33 34
34#include <trace/events/power.h> 35#include <trace/events/power.h>
@@ -43,7 +44,6 @@
43#include "common.h" 44#include "common.h"
44#include "cm3xxx.h" 45#include "cm3xxx.h"
45#include "cm-regbits-34xx.h" 46#include "cm-regbits-34xx.h"
46#include "gpmc.h"
47#include "prm-regbits-34xx.h" 47#include "prm-regbits-34xx.h"
48#include "prm3xxx.h" 48#include "prm3xxx.h"
49#include "pm.h" 49#include "pm.h"
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 503097c72b82..d697cecf762b 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -37,6 +37,16 @@ struct power_state {
37 struct list_head node; 37 struct list_head node;
38}; 38};
39 39
40/**
41 * struct static_dep_map - Static dependency map
42 * @from: from clockdomain
43 * @to: to clockdomain
44 */
45struct static_dep_map {
46 const char *from;
47 const char *to;
48};
49
40static u32 cpu_suspend_state = PWRDM_POWER_OFF; 50static u32 cpu_suspend_state = PWRDM_POWER_OFF;
41 51
42static LIST_HEAD(pwrst_list); 52static LIST_HEAD(pwrst_list);
@@ -148,94 +158,61 @@ static void omap_default_idle(void)
148 omap_do_wfi(); 158 omap_do_wfi();
149} 159}
150 160
151/** 161/*
152 * omap4_init_static_deps - Add OMAP4 static dependencies 162 * The dynamic dependency between MPUSS -> MEMIF and
153 * 163 * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as
154 * Add needed static clockdomain dependencies on OMAP4 devices. 164 * expected. The hardware recommendation is to enable static
155 * Return: 0 on success or 'err' on failures 165 * dependencies for these to avoid system lock ups or random crashes.
166 * The L4 wakeup depedency is added to workaround the OCP sync hardware
167 * BUG with 32K synctimer which lead to incorrect timer value read
168 * from the 32K counter. The BUG applies for GPTIMER1 and WDT2 which
169 * are part of L4 wakeup clockdomain.
156 */ 170 */
157static inline int omap4_init_static_deps(void) 171static const struct static_dep_map omap4_static_dep_map[] = {
158{ 172 {.from = "mpuss_clkdm", .to = "l3_emif_clkdm"},
159 struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm; 173 {.from = "mpuss_clkdm", .to = "l3_1_clkdm"},
160 struct clockdomain *ducati_clkdm, *l3_2_clkdm; 174 {.from = "mpuss_clkdm", .to = "l3_2_clkdm"},
161 int ret = 0; 175 {.from = "ducati_clkdm", .to = "l3_1_clkdm"},
162 176 {.from = "ducati_clkdm", .to = "l3_2_clkdm"},
163 if (omap_rev() == OMAP4430_REV_ES1_0) { 177 {.from = NULL} /* TERMINATION */
164 WARN(1, "Power Management not supported on OMAP4430 ES1.0\n"); 178};
165 return -ENODEV;
166 }
167
168 pr_err("Power Management for TI OMAP4.\n");
169 /*
170 * OMAP4 chip PM currently works only with certain (newer)
171 * versions of bootloaders. This is due to missing code in the
172 * kernel to properly reset and initialize some devices.
173 * http://www.spinics.net/lists/arm-kernel/msg218641.html
174 */
175 pr_warn("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n");
176
177 ret = pwrdm_for_each(pwrdms_setup, NULL);
178 if (ret) {
179 pr_err("Failed to setup powerdomains\n");
180 return ret;
181 }
182
183 /*
184 * The dynamic dependency between MPUSS -> MEMIF and
185 * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as
186 * expected. The hardware recommendation is to enable static
187 * dependencies for these to avoid system lock ups or random crashes.
188 * The L4 wakeup depedency is added to workaround the OCP sync hardware
189 * BUG with 32K synctimer which lead to incorrect timer value read
190 * from the 32K counter. The BUG applies for GPTIMER1 and WDT2 which
191 * are part of L4 wakeup clockdomain.
192 */
193 mpuss_clkdm = clkdm_lookup("mpuss_clkdm");
194 emif_clkdm = clkdm_lookup("l3_emif_clkdm");
195 l3_1_clkdm = clkdm_lookup("l3_1_clkdm");
196 l3_2_clkdm = clkdm_lookup("l3_2_clkdm");
197 ducati_clkdm = clkdm_lookup("ducati_clkdm");
198 if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) ||
199 (!l3_2_clkdm) || (!ducati_clkdm))
200 return -EINVAL;
201
202 ret = clkdm_add_wkdep(mpuss_clkdm, emif_clkdm);
203 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm);
204 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_2_clkdm);
205 ret |= clkdm_add_wkdep(ducati_clkdm, l3_1_clkdm);
206 ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm);
207 if (ret) {
208 pr_err("Failed to add MPUSS -> L3/EMIF/L4PER, DUCATI -> L3 wakeup dependency\n");
209 return -EINVAL;
210 }
211 179
212 return ret; 180static const struct static_dep_map omap5_dra7_static_dep_map[] = {
213} 181 {.from = "mpu_clkdm", .to = "emif_clkdm"},
182 {.from = NULL} /* TERMINATION */
183};
214 184
215/** 185/**
216 * omap5_dra7_init_static_deps - Init static clkdm dependencies on OMAP5 and 186 * omap4plus_init_static_deps() - Initialize a static dependency map
217 * DRA7 187 * @map: Mapping of clock domains
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 */ 188 */
224static inline int omap5_dra7_init_static_deps(void) 189static inline int omap4plus_init_static_deps(const struct static_dep_map *map)
225{ 190{
226 struct clockdomain *mpuss_clkdm, *emif_clkdm;
227 int ret; 191 int ret;
192 struct clockdomain *from, *to;
193
194 if (!map)
195 return 0;
228 196
229 mpuss_clkdm = clkdm_lookup("mpu_clkdm"); 197 while (map->from) {
230 emif_clkdm = clkdm_lookup("emif_clkdm"); 198 from = clkdm_lookup(map->from);
231 if (!mpuss_clkdm || !emif_clkdm) 199 to = clkdm_lookup(map->to);
232 return -EINVAL; 200 if (!from || !to) {
201 pr_err("Failed lookup %s or %s for wakeup dependency\n",
202 map->from, map->to);
203 return -EINVAL;
204 }
205 ret = clkdm_add_wkdep(from, to);
206 if (ret) {
207 pr_err("Failed to add %s -> %s wakeup dependency(%d)\n",
208 map->from, map->to, ret);
209 return ret;
210 }
233 211
234 ret = clkdm_add_wkdep(mpuss_clkdm, emif_clkdm); 212 map++;
235 if (ret) 213 };
236 pr_err("Failed to add MPUSS -> EMIF wakeup dependency\n");
237 214
238 return ret; 215 return 0;
239} 216}
240 217
241/** 218/**
@@ -272,6 +249,15 @@ int __init omap4_pm_init(void)
272 249
273 pr_info("Power Management for TI OMAP4+ devices.\n"); 250 pr_info("Power Management for TI OMAP4+ devices.\n");
274 251
252 /*
253 * OMAP4 chip PM currently works only with certain (newer)
254 * versions of bootloaders. This is due to missing code in the
255 * kernel to properly reset and initialize some devices.
256 * http://www.spinics.net/lists/arm-kernel/msg218641.html
257 */
258 if (cpu_is_omap44xx())
259 pr_warn("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n");
260
275 ret = pwrdm_for_each(pwrdms_setup, NULL); 261 ret = pwrdm_for_each(pwrdms_setup, NULL);
276 if (ret) { 262 if (ret) {
277 pr_err("Failed to setup powerdomains.\n"); 263 pr_err("Failed to setup powerdomains.\n");
@@ -279,9 +265,9 @@ int __init omap4_pm_init(void)
279 } 265 }
280 266
281 if (cpu_is_omap44xx()) 267 if (cpu_is_omap44xx())
282 ret = omap4_init_static_deps(); 268 ret = omap4plus_init_static_deps(omap4_static_dep_map);
283 else if (soc_is_omap54xx() || soc_is_dra7xx()) 269 else if (soc_is_omap54xx() || soc_is_dra7xx())
284 ret = omap5_dra7_init_static_deps(); 270 ret = omap4plus_init_static_deps(omap5_dra7_static_dep_map);
285 271
286 if (ret) { 272 if (ret) {
287 pr_err("Failed to initialise static dependencies.\n"); 273 pr_err("Failed to initialise static dependencies.\n");
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 48480d557b61..77752e49d8d4 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -29,6 +29,7 @@ int of_prcm_init(void);
29 * PRM_HAS_VOLTAGE: has voltage domains 29 * PRM_HAS_VOLTAGE: has voltage domains
30 */ 30 */
31#define PRM_HAS_IO_WAKEUP (1 << 0) 31#define PRM_HAS_IO_WAKEUP (1 << 0)
32#define PRM_HAS_VOLTAGE (1 << 1)
32 33
33/* 34/*
34 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP 35 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
@@ -127,6 +128,8 @@ struct prm_reset_src_map {
127 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn 128 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn
128 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn 129 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
129 * @late_init: ptr to the late init function 130 * @late_init: ptr to the late init function
131 * @assert_hardreset: ptr to the SoC PRM hardreset assert impl
132 * @deassert_hardreset: ptr to the SoC PRM hardreset deassert impl
130 * 133 *
131 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are 134 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
132 * deprecated. 135 * deprecated.
@@ -136,14 +139,27 @@ struct prm_ll_data {
136 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx); 139 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx);
137 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx); 140 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
138 int (*late_init)(void); 141 int (*late_init)(void);
142 int (*assert_hardreset)(u8 shift, u8 part, s16 prm_mod, u16 offset);
143 int (*deassert_hardreset)(u8 shift, u8 st_shift, u8 part, s16 prm_mod,
144 u16 offset, u16 st_offset);
145 int (*is_hardreset_asserted)(u8 shift, u8 part, s16 prm_mod,
146 u16 offset);
147 void (*reset_system)(void);
139}; 148};
140 149
141extern int prm_register(struct prm_ll_data *pld); 150extern int prm_register(struct prm_ll_data *pld);
142extern int prm_unregister(struct prm_ll_data *pld); 151extern int prm_unregister(struct prm_ll_data *pld);
143 152
153int omap_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset);
154int omap_prm_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 prm_mod,
155 u16 offset, u16 st_offset);
156int omap_prm_is_hardreset_asserted(u8 shift, u8 part, s16 prm_mod, u16 offset);
144extern u32 prm_read_reset_sources(void); 157extern u32 prm_read_reset_sources(void);
145extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx); 158extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx);
146extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx); 159extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx);
160void omap_prm_reset_system(void);
161
162void omap_prm_reconfigure_io_chain(void);
147 163
148#endif 164#endif
149 165
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index 86958050547a..af0f15278fc2 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -106,7 +106,7 @@ static int omap2xxx_pwrst_to_common_pwrst(u8 omap2xxx_pwrst)
106 * Set the DPLL reset bit, which should reboot the SoC. This is the 106 * Set the DPLL reset bit, which should reboot the SoC. This is the
107 * recommended way to restart the SoC. No return value. 107 * recommended way to restart the SoC. No return value.
108 */ 108 */
109void omap2xxx_prm_dpll_reset(void) 109static void omap2xxx_prm_dpll_reset(void)
110{ 110{
111 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, WKUP_MOD, 111 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, WKUP_MOD,
112 OMAP2_RM_RSTCTRL); 112 OMAP2_RM_RSTCTRL);
@@ -212,6 +212,10 @@ struct pwrdm_ops omap2_pwrdm_operations = {
212 212
213static struct prm_ll_data omap2xxx_prm_ll_data = { 213static struct prm_ll_data omap2xxx_prm_ll_data = {
214 .read_reset_sources = &omap2xxx_prm_read_reset_sources, 214 .read_reset_sources = &omap2xxx_prm_read_reset_sources,
215 .assert_hardreset = &omap2_prm_assert_hardreset,
216 .deassert_hardreset = &omap2_prm_deassert_hardreset,
217 .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted,
218 .reset_system = &omap2xxx_prm_dpll_reset,
215}; 219};
216 220
217int __init omap2xxx_prm_init(void) 221int __init omap2xxx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
index d73414139292..1d51643062f7 100644
--- a/arch/arm/mach-omap2/prm2xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -124,7 +124,6 @@
124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm); 124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm);
125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm); 125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm);
126 126
127extern void omap2xxx_prm_dpll_reset(void);
128void omap2xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask); 127void omap2xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask);
129 128
130extern int __init omap2xxx_prm_init(void); 129extern int __init omap2xxx_prm_init(void);
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index c13b4e293ffa..cc3341f263cd 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -24,14 +24,16 @@
24/** 24/**
25 * omap2_prm_is_hardreset_asserted - read the HW reset line state of 25 * omap2_prm_is_hardreset_asserted - read the HW reset line state of
26 * submodules contained in the hwmod module 26 * submodules contained in the hwmod module
27 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
28 * @shift: register bit shift corresponding to the reset line to check 27 * @shift: register bit shift corresponding to the reset line to check
28 * @part: PRM partition, ignored for OMAP2
29 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
30 * @offset: register offset, ignored for OMAP2
29 * 31 *
30 * Returns 1 if the (sub)module hardreset line is currently asserted, 32 * Returns 1 if the (sub)module hardreset line is currently asserted,
31 * 0 if the (sub)module hardreset line is not currently asserted, or 33 * 0 if the (sub)module hardreset line is not currently asserted, or
32 * -EINVAL if called while running on a non-OMAP2/3 chip. 34 * -EINVAL if called while running on a non-OMAP2/3 chip.
33 */ 35 */
34int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) 36int omap2_prm_is_hardreset_asserted(u8 shift, u8 part, s16 prm_mod, u16 offset)
35{ 37{
36 return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, 38 return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL,
37 (1 << shift)); 39 (1 << shift));
@@ -39,8 +41,10 @@ int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
39 41
40/** 42/**
41 * omap2_prm_assert_hardreset - assert the HW reset line of a submodule 43 * omap2_prm_assert_hardreset - assert the HW reset line of a submodule
42 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
43 * @shift: register bit shift corresponding to the reset line to assert 44 * @shift: register bit shift corresponding to the reset line to assert
45 * @part: PRM partition, ignored for OMAP2
46 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
47 * @offset: register offset, ignored for OMAP2
44 * 48 *
45 * Some IPs like dsp or iva contain processors that require an HW 49 * Some IPs like dsp or iva contain processors that require an HW
46 * reset line to be asserted / deasserted in order to fully enable the 50 * reset line to be asserted / deasserted in order to fully enable the
@@ -49,7 +53,7 @@ int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
49 * place the submodule into reset. Returns 0 upon success or -EINVAL 53 * place the submodule into reset. Returns 0 upon success or -EINVAL
50 * upon an argument error. 54 * upon an argument error.
51 */ 55 */
52int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift) 56int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset)
53{ 57{
54 u32 mask; 58 u32 mask;
55 59
@@ -64,6 +68,10 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
64 * @prm_mod: PRM submodule base (e.g. CORE_MOD) 68 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
65 * @rst_shift: register bit shift corresponding to the reset line to deassert 69 * @rst_shift: register bit shift corresponding to the reset line to deassert
66 * @st_shift: register bit shift for the status of the deasserted submodule 70 * @st_shift: register bit shift for the status of the deasserted submodule
71 * @part: PRM partition, not used for OMAP2
72 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
73 * @rst_offset: reset register offset, not used for OMAP2
74 * @st_offset: reset status register offset, not used for OMAP2
67 * 75 *
68 * Some IPs like dsp or iva contain processors that require an HW 76 * Some IPs like dsp or iva contain processors that require an HW
69 * reset line to be asserted / deasserted in order to fully enable the 77 * reset line to be asserted / deasserted in order to fully enable the
@@ -74,7 +82,8 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
74 * -EINVAL upon an argument error, -EEXIST if the submodule was already out 82 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
75 * of reset, or -EBUSY if the submodule did not exit reset promptly. 83 * of reset, or -EBUSY if the submodule did not exit reset promptly.
76 */ 84 */
77int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift) 85int omap2_prm_deassert_hardreset(u8 rst_shift, u8 st_shift, u8 part,
86 s16 prm_mod, u16 rst_offset, u16 st_offset)
78{ 87{
79 u32 rst, st; 88 u32 rst, st;
80 int c; 89 int c;
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index 1a3a96392b97..f57e29b0e041 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -100,9 +100,12 @@ static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
100} 100}
101 101
102/* These omap2_ PRM functions apply to both OMAP2 and 3 */ 102/* These omap2_ PRM functions apply to both OMAP2 and 3 */
103extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); 103int omap2_prm_is_hardreset_asserted(u8 shift, u8 part, s16 prm_mod, u16 offset);
104extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); 104int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod,
105extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); 105 u16 offset);
106int omap2_prm_deassert_hardreset(u8 rst_shift, u8 st_shift, u8 part,
107 s16 prm_mod, u16 reset_offset,
108 u16 st_offset);
106 109
107extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); 110extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
108extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm); 111extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index 62709cd2f9c5..02f628601b09 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -23,20 +23,24 @@
23#include "prm33xx.h" 23#include "prm33xx.h"
24#include "prm-regbits-33xx.h" 24#include "prm-regbits-33xx.h"
25 25
26#define AM33XX_PRM_RSTCTRL_OFFSET 0x0000
27
28#define AM33XX_RST_GLOBAL_WARM_SW_MASK (1 << 0)
29
26/* Read a register in a PRM instance */ 30/* Read a register in a PRM instance */
27u32 am33xx_prm_read_reg(s16 inst, u16 idx) 31static u32 am33xx_prm_read_reg(s16 inst, u16 idx)
28{ 32{
29 return readl_relaxed(prm_base + inst + idx); 33 return readl_relaxed(prm_base + inst + idx);
30} 34}
31 35
32/* Write into a register in a PRM instance */ 36/* Write into a register in a PRM instance */
33void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx) 37static void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx)
34{ 38{
35 writel_relaxed(val, prm_base + inst + idx); 39 writel_relaxed(val, prm_base + inst + idx);
36} 40}
37 41
38/* Read-modify-write a register in PRM. Caller must lock */ 42/* Read-modify-write a register in PRM. Caller must lock */
39u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx) 43static u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx)
40{ 44{
41 u32 v; 45 u32 v;
42 46
@@ -52,6 +56,7 @@ u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx)
52 * am33xx_prm_is_hardreset_asserted - read the HW reset line state of 56 * am33xx_prm_is_hardreset_asserted - read the HW reset line state of
53 * submodules contained in the hwmod module 57 * submodules contained in the hwmod module
54 * @shift: register bit shift corresponding to the reset line to check 58 * @shift: register bit shift corresponding to the reset line to check
59 * @part: PRM partition, ignored for AM33xx
55 * @inst: CM instance register offset (*_INST macro) 60 * @inst: CM instance register offset (*_INST macro)
56 * @rstctrl_offs: RM_RSTCTRL register address offset for this module 61 * @rstctrl_offs: RM_RSTCTRL register address offset for this module
57 * 62 *
@@ -59,7 +64,8 @@ u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx)
59 * 0 if the (sub)module hardreset line is not currently asserted, or 64 * 0 if the (sub)module hardreset line is not currently asserted, or
60 * -EINVAL upon parameter error. 65 * -EINVAL upon parameter error.
61 */ 66 */
62int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst, u16 rstctrl_offs) 67static int am33xx_prm_is_hardreset_asserted(u8 shift, u8 part, s16 inst,
68 u16 rstctrl_offs)
63{ 69{
64 u32 v; 70 u32 v;
65 71
@@ -73,6 +79,7 @@ int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst, u16 rstctrl_offs)
73/** 79/**
74 * am33xx_prm_assert_hardreset - assert the HW reset line of a submodule 80 * am33xx_prm_assert_hardreset - assert the HW reset line of a submodule
75 * @shift: register bit shift corresponding to the reset line to assert 81 * @shift: register bit shift corresponding to the reset line to assert
82 * @part: CM partition, ignored for AM33xx
76 * @inst: CM instance register offset (*_INST macro) 83 * @inst: CM instance register offset (*_INST macro)
77 * @rstctrl_reg: RM_RSTCTRL register address for this module 84 * @rstctrl_reg: RM_RSTCTRL register address for this module
78 * 85 *
@@ -83,7 +90,8 @@ int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst, u16 rstctrl_offs)
83 * place the submodule into reset. Returns 0 upon success or -EINVAL 90 * place the submodule into reset. Returns 0 upon success or -EINVAL
84 * upon an argument error. 91 * upon an argument error.
85 */ 92 */
86int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs) 93static int am33xx_prm_assert_hardreset(u8 shift, u8 part, s16 inst,
94 u16 rstctrl_offs)
87{ 95{
88 u32 mask = 1 << shift; 96 u32 mask = 1 << shift;
89 97
@@ -96,6 +104,8 @@ int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs)
96 * am33xx_prm_deassert_hardreset - deassert a submodule hardreset line and 104 * am33xx_prm_deassert_hardreset - deassert a submodule hardreset line and
97 * wait 105 * wait
98 * @shift: register bit shift corresponding to the reset line to deassert 106 * @shift: register bit shift corresponding to the reset line to deassert
107 * @st_shift: reset status register bit shift corresponding to the reset line
108 * @part: PRM partition, not used for AM33xx
99 * @inst: CM instance register offset (*_INST macro) 109 * @inst: CM instance register offset (*_INST macro)
100 * @rstctrl_reg: RM_RSTCTRL register address for this module 110 * @rstctrl_reg: RM_RSTCTRL register address for this module
101 * @rstst_reg: RM_RSTST register address for this module 111 * @rstst_reg: RM_RSTST register address for this module
@@ -109,14 +119,15 @@ int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs)
109 * -EINVAL upon an argument error, -EEXIST if the submodule was already out 119 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
110 * of reset, or -EBUSY if the submodule did not exit reset promptly. 120 * of reset, or -EBUSY if the submodule did not exit reset promptly.
111 */ 121 */
112int am33xx_prm_deassert_hardreset(u8 shift, u8 st_shift, s16 inst, 122static int am33xx_prm_deassert_hardreset(u8 shift, u8 st_shift, u8 part,
113 u16 rstctrl_offs, u16 rstst_offs) 123 s16 inst, u16 rstctrl_offs,
124 u16 rstst_offs)
114{ 125{
115 int c; 126 int c;
116 u32 mask = 1 << st_shift; 127 u32 mask = 1 << st_shift;
117 128
118 /* Check the current status to avoid de-asserting the line twice */ 129 /* Check the current status to avoid de-asserting the line twice */
119 if (am33xx_prm_is_hardreset_asserted(shift, inst, rstctrl_offs) == 0) 130 if (am33xx_prm_is_hardreset_asserted(shift, 0, inst, rstctrl_offs) == 0)
120 return -EEXIST; 131 return -EEXIST;
121 132
122 /* Clear the reset status by writing 1 to the status bit */ 133 /* Clear the reset status by writing 1 to the status bit */
@@ -128,7 +139,7 @@ int am33xx_prm_deassert_hardreset(u8 shift, u8 st_shift, s16 inst,
128 am33xx_prm_rmw_reg_bits(mask, 0, inst, rstctrl_offs); 139 am33xx_prm_rmw_reg_bits(mask, 0, inst, rstctrl_offs);
129 140
130 /* wait the status to be set */ 141 /* wait the status to be set */
131 omap_test_timeout(am33xx_prm_is_hardreset_asserted(st_shift, inst, 142 omap_test_timeout(am33xx_prm_is_hardreset_asserted(st_shift, 0, inst,
132 rstst_offs), 143 rstst_offs),
133 MAX_MODULE_HARDRESET_WAIT, c); 144 MAX_MODULE_HARDRESET_WAIT, c);
134 145
@@ -325,6 +336,23 @@ static int am33xx_check_vcvp(void)
325 return 0; 336 return 0;
326} 337}
327 338
339/**
340 * am33xx_prm_global_warm_sw_reset - reboot the device via warm reset
341 *
342 * Immediately reboots the device through warm reset.
343 */
344static void am33xx_prm_global_warm_sw_reset(void)
345{
346 am33xx_prm_rmw_reg_bits(AM33XX_RST_GLOBAL_WARM_SW_MASK,
347 AM33XX_RST_GLOBAL_WARM_SW_MASK,
348 AM33XX_PRM_DEVICE_MOD,
349 AM33XX_PRM_RSTCTRL_OFFSET);
350
351 /* OCP barrier */
352 (void)am33xx_prm_read_reg(AM33XX_PRM_DEVICE_MOD,
353 AM33XX_PRM_RSTCTRL_OFFSET);
354}
355
328struct pwrdm_ops am33xx_pwrdm_operations = { 356struct pwrdm_ops am33xx_pwrdm_operations = {
329 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst, 357 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
330 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst, 358 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
@@ -342,3 +370,21 @@ struct pwrdm_ops am33xx_pwrdm_operations = {
342 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition, 370 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
343 .pwrdm_has_voltdm = am33xx_check_vcvp, 371 .pwrdm_has_voltdm = am33xx_check_vcvp,
344}; 372};
373
374static struct prm_ll_data am33xx_prm_ll_data = {
375 .assert_hardreset = am33xx_prm_assert_hardreset,
376 .deassert_hardreset = am33xx_prm_deassert_hardreset,
377 .is_hardreset_asserted = am33xx_prm_is_hardreset_asserted,
378 .reset_system = am33xx_prm_global_warm_sw_reset,
379};
380
381int __init am33xx_prm_init(void)
382{
383 return prm_register(&am33xx_prm_ll_data);
384}
385
386static void __exit am33xx_prm_exit(void)
387{
388 prm_unregister(&am33xx_prm_ll_data);
389}
390__exitcall(am33xx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm33xx.h b/arch/arm/mach-omap2/prm33xx.h
index 9b9918dfb119..98ac41f271da 100644
--- a/arch/arm/mach-omap2/prm33xx.h
+++ b/arch/arm/mach-omap2/prm33xx.h
@@ -118,14 +118,7 @@
118#define AM33XX_PM_CEFUSE_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_CEFUSE_MOD, 0x0004) 118#define AM33XX_PM_CEFUSE_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_CEFUSE_MOD, 0x0004)
119 119
120#ifndef __ASSEMBLER__ 120#ifndef __ASSEMBLER__
121extern u32 am33xx_prm_read_reg(s16 inst, u16 idx); 121int am33xx_prm_init(void);
122extern void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx); 122
123extern u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
124extern void am33xx_prm_global_warm_sw_reset(void);
125extern int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst,
126 u16 rstctrl_offs);
127extern int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs);
128extern int am33xx_prm_deassert_hardreset(u8 shift, u8 st_shift, s16 inst,
129 u16 rstctrl_offs, u16 rstst_offs);
130#endif /* ASSEMBLER */ 123#endif /* ASSEMBLER */
131#endif 124#endif
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index ff08da385a2d..c5e00c6714b1 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -30,6 +30,11 @@
30#include "cm3xxx.h" 30#include "cm3xxx.h"
31#include "cm-regbits-34xx.h" 31#include "cm-regbits-34xx.h"
32 32
33static void omap3xxx_prm_read_pending_irqs(unsigned long *events);
34static void omap3xxx_prm_ocp_barrier(void);
35static void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
36static void omap3xxx_prm_restore_irqen(u32 *saved_mask);
37
33static const struct omap_prcm_irq omap3_prcm_irqs[] = { 38static const struct omap_prcm_irq omap3_prcm_irqs[] = {
34 OMAP_PRCM_IRQ("wkup", 0, 0), 39 OMAP_PRCM_IRQ("wkup", 0, 0),
35 OMAP_PRCM_IRQ("io", 9, 1), 40 OMAP_PRCM_IRQ("io", 9, 1),
@@ -131,7 +136,7 @@ u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
131 * recommended way to restart the SoC, considering Errata i520. No 136 * recommended way to restart the SoC, considering Errata i520. No
132 * return value. 137 * return value.
133 */ 138 */
134void omap3xxx_prm_dpll3_reset(void) 139static void omap3xxx_prm_dpll3_reset(void)
135{ 140{
136 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD, 141 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD,
137 OMAP2_RM_RSTCTRL); 142 OMAP2_RM_RSTCTRL);
@@ -147,7 +152,7 @@ void omap3xxx_prm_dpll3_reset(void)
147 * MPU IRQs, and store the result into the u32 pointed to by @events. 152 * MPU IRQs, and store the result into the u32 pointed to by @events.
148 * No return value. 153 * No return value.
149 */ 154 */
150void omap3xxx_prm_read_pending_irqs(unsigned long *events) 155static void omap3xxx_prm_read_pending_irqs(unsigned long *events)
151{ 156{
152 u32 mask, st; 157 u32 mask, st;
153 158
@@ -166,7 +171,7 @@ void omap3xxx_prm_read_pending_irqs(unsigned long *events)
166 * block, to avoid race conditions after acknowledging or clearing IRQ 171 * block, to avoid race conditions after acknowledging or clearing IRQ
167 * bits. No return value. 172 * bits. No return value.
168 */ 173 */
169void omap3xxx_prm_ocp_barrier(void) 174static void omap3xxx_prm_ocp_barrier(void)
170{ 175{
171 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); 176 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
172} 177}
@@ -182,7 +187,7 @@ void omap3xxx_prm_ocp_barrier(void)
182 * returning; otherwise, spurious interrupts might occur. No return 187 * returning; otherwise, spurious interrupts might occur. No return
183 * value. 188 * value.
184 */ 189 */
185void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask) 190static void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
186{ 191{
187 saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD, 192 saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD,
188 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 193 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
@@ -202,7 +207,7 @@ void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
202 * barrier should be needed here; any pending PRM interrupts will fire 207 * barrier should be needed here; any pending PRM interrupts will fire
203 * once the writes reach the PRM. No return value. 208 * once the writes reach the PRM. No return value.
204 */ 209 */
205void omap3xxx_prm_restore_irqen(u32 *saved_mask) 210static void omap3xxx_prm_restore_irqen(u32 *saved_mask)
206{ 211{
207 omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD, 212 omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD,
208 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 213 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
@@ -375,7 +380,7 @@ void __init omap3_prm_init_pm(bool has_uart4, bool has_iva)
375 * The ST_IO_CHAIN bit does not exist in 3430 before es3.1. The only 380 * 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. 381 * thing we can do is toggle EN_IO bit for earlier omaps.
377 */ 382 */
378void omap3430_pre_es3_1_reconfigure_io_chain(void) 383static void omap3430_pre_es3_1_reconfigure_io_chain(void)
379{ 384{
380 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, 385 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
381 PM_WKEN); 386 PM_WKEN);
@@ -393,7 +398,7 @@ void omap3430_pre_es3_1_reconfigure_io_chain(void)
393 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No 398 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
394 * return value. These registers are only available in 3430 es3.1 and later. 399 * return value. These registers are only available in 3430 es3.1 and later.
395 */ 400 */
396void omap3_prm_reconfigure_io_chain(void) 401static void omap3_prm_reconfigure_io_chain(void)
397{ 402{
398 int i = 0; 403 int i = 0;
399 404
@@ -416,15 +421,6 @@ void omap3_prm_reconfigure_io_chain(void)
416} 421}
417 422
418/** 423/**
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/**
428 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches 424 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
429 * 425 *
430 * Activates the I/O wakeup event latches and allows events logged by 426 * Activates the I/O wakeup event latches and allows events logged by
@@ -664,6 +660,10 @@ static int omap3xxx_prm_late_init(void);
664static struct prm_ll_data omap3xxx_prm_ll_data = { 660static struct prm_ll_data omap3xxx_prm_ll_data = {
665 .read_reset_sources = &omap3xxx_prm_read_reset_sources, 661 .read_reset_sources = &omap3xxx_prm_read_reset_sources,
666 .late_init = &omap3xxx_prm_late_init, 662 .late_init = &omap3xxx_prm_late_init,
663 .assert_hardreset = &omap2_prm_assert_hardreset,
664 .deassert_hardreset = &omap2_prm_deassert_hardreset,
665 .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted,
666 .reset_system = &omap3xxx_prm_dpll3_reset,
667}; 667};
668 668
669int __init omap3xxx_prm_init(void) 669int __init omap3xxx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
index bc37d42a8704..cfde3f4a03cc 100644
--- a/arch/arm/mach-omap2/prm3xxx.h
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -144,22 +144,6 @@ extern u32 omap3_prm_vcvp_read(u8 offset);
144extern void omap3_prm_vcvp_write(u32 val, u8 offset); 144extern void omap3_prm_vcvp_write(u32 val, u8 offset);
145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
146 146
147#ifdef CONFIG_ARCH_OMAP3
148void omap3xxx_prm_reconfigure_io_chain(void);
149#else
150static inline void omap3xxx_prm_reconfigure_io_chain(void)
151{
152}
153#endif
154
155/* PRM interrupt-related functions */
156extern void omap3xxx_prm_read_pending_irqs(unsigned long *events);
157extern void omap3xxx_prm_ocp_barrier(void);
158extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
159extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
160
161extern void omap3xxx_prm_dpll3_reset(void);
162
163extern int __init omap3xxx_prm_init(void); 147extern int __init omap3xxx_prm_init(void);
164extern u32 omap3xxx_prm_get_reset_sources(void); 148extern u32 omap3xxx_prm_get_reset_sources(void);
165int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits); 149int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits);
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 0958d070d3db..cc170fb81ff7 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -32,6 +32,12 @@
32 32
33/* Static data */ 33/* Static data */
34 34
35static void omap44xx_prm_read_pending_irqs(unsigned long *events);
36static void omap44xx_prm_ocp_barrier(void);
37static void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask);
38static void omap44xx_prm_restore_irqen(u32 *saved_mask);
39static void omap44xx_prm_reconfigure_io_chain(void);
40
35static const struct omap_prcm_irq omap4_prcm_irqs[] = { 41static const struct omap_prcm_irq omap4_prcm_irqs[] = {
36 OMAP_PRCM_IRQ("io", 9, 1), 42 OMAP_PRCM_IRQ("io", 9, 1),
37}; 43};
@@ -80,19 +86,19 @@ static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
80/* PRM low-level functions */ 86/* PRM low-level functions */
81 87
82/* Read a register in a CM/PRM instance in the PRM module */ 88/* Read a register in a CM/PRM instance in the PRM module */
83u32 omap4_prm_read_inst_reg(s16 inst, u16 reg) 89static u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
84{ 90{
85 return readl_relaxed(prm_base + inst + reg); 91 return readl_relaxed(prm_base + inst + reg);
86} 92}
87 93
88/* Write into a register in a CM/PRM instance in the PRM module */ 94/* Write into a register in a CM/PRM instance in the PRM module */
89void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg) 95static void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
90{ 96{
91 writel_relaxed(val, prm_base + inst + reg); 97 writel_relaxed(val, prm_base + inst + reg);
92} 98}
93 99
94/* Read-modify-write a register in a PRM module. Caller must lock */ 100/* Read-modify-write a register in a PRM module. Caller must lock */
95u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg) 101static u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
96{ 102{
97 u32 v; 103 u32 v;
98 104
@@ -207,7 +213,7 @@ static inline u32 _read_pending_irq_reg(u16 irqen_offs, u16 irqst_offs)
207 * MPU IRQs, and store the result into the two u32s pointed to by @events. 213 * MPU IRQs, and store the result into the two u32s pointed to by @events.
208 * No return value. 214 * No return value.
209 */ 215 */
210void omap44xx_prm_read_pending_irqs(unsigned long *events) 216static void omap44xx_prm_read_pending_irqs(unsigned long *events)
211{ 217{
212 events[0] = _read_pending_irq_reg(OMAP4_PRM_IRQENABLE_MPU_OFFSET, 218 events[0] = _read_pending_irq_reg(OMAP4_PRM_IRQENABLE_MPU_OFFSET,
213 OMAP4_PRM_IRQSTATUS_MPU_OFFSET); 219 OMAP4_PRM_IRQSTATUS_MPU_OFFSET);
@@ -224,7 +230,7 @@ void omap44xx_prm_read_pending_irqs(unsigned long *events)
224 * block, to avoid race conditions after acknowledging or clearing IRQ 230 * block, to avoid race conditions after acknowledging or clearing IRQ
225 * bits. No return value. 231 * bits. No return value.
226 */ 232 */
227void omap44xx_prm_ocp_barrier(void) 233static void omap44xx_prm_ocp_barrier(void)
228{ 234{
229 omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, 235 omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
230 OMAP4_REVISION_PRM_OFFSET); 236 OMAP4_REVISION_PRM_OFFSET);
@@ -241,7 +247,7 @@ void omap44xx_prm_ocp_barrier(void)
241 * interrupts reaches the PRM before returning; otherwise, spurious 247 * interrupts reaches the PRM before returning; otherwise, spurious
242 * interrupts might occur. No return value. 248 * interrupts might occur. No return value.
243 */ 249 */
244void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask) 250static void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask)
245{ 251{
246 saved_mask[0] = 252 saved_mask[0] =
247 omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, 253 omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
@@ -270,7 +276,7 @@ void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask)
270 * No OCP barrier should be needed here; any pending PRM interrupts will fire 276 * No OCP barrier should be needed here; any pending PRM interrupts will fire
271 * once the writes reach the PRM. No return value. 277 * once the writes reach the PRM. No return value.
272 */ 278 */
273void omap44xx_prm_restore_irqen(u32 *saved_mask) 279static void omap44xx_prm_restore_irqen(u32 *saved_mask)
274{ 280{
275 omap4_prm_write_inst_reg(saved_mask[0], OMAP4430_PRM_OCP_SOCKET_INST, 281 omap4_prm_write_inst_reg(saved_mask[0], OMAP4430_PRM_OCP_SOCKET_INST,
276 OMAP4_PRM_IRQENABLE_MPU_OFFSET); 282 OMAP4_PRM_IRQENABLE_MPU_OFFSET);
@@ -287,7 +293,7 @@ void omap44xx_prm_restore_irqen(u32 *saved_mask)
287 * deasserting WUCLKIN and waiting for WUCLKOUT to be deasserted. 293 * deasserting WUCLKIN and waiting for WUCLKOUT to be deasserted.
288 * No return value. XXX Are the final two steps necessary? 294 * No return value. XXX Are the final two steps necessary?
289 */ 295 */
290void omap44xx_prm_reconfigure_io_chain(void) 296static void omap44xx_prm_reconfigure_io_chain(void)
291{ 297{
292 int i = 0; 298 int i = 0;
293 s32 inst = omap4_prmst_get_prm_dev_inst(); 299 s32 inst = omap4_prmst_get_prm_dev_inst();
@@ -652,11 +658,10 @@ static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
652 658
653static int omap4_check_vcvp(void) 659static int omap4_check_vcvp(void)
654{ 660{
655 /* No VC/VP on dra7xx devices */ 661 if (prm_features & PRM_HAS_VOLTAGE)
656 if (soc_is_dra7xx()) 662 return 1;
657 return 0;
658 663
659 return 1; 664 return 0;
660} 665}
661 666
662struct pwrdm_ops omap4_pwrdm_operations = { 667struct pwrdm_ops omap4_pwrdm_operations = {
@@ -689,6 +694,10 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
689 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old, 694 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
690 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old, 695 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
691 .late_init = &omap44xx_prm_late_init, 696 .late_init = &omap44xx_prm_late_init,
697 .assert_hardreset = omap4_prminst_assert_hardreset,
698 .deassert_hardreset = omap4_prminst_deassert_hardreset,
699 .is_hardreset_asserted = omap4_prminst_is_hardreset_asserted,
700 .reset_system = omap4_prminst_global_warm_sw_reset,
692}; 701};
693 702
694int __init omap44xx_prm_init(void) 703int __init omap44xx_prm_init(void)
@@ -696,6 +705,9 @@ int __init omap44xx_prm_init(void)
696 if (cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx()) 705 if (cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx())
697 prm_features |= PRM_HAS_IO_WAKEUP; 706 prm_features |= PRM_HAS_IO_WAKEUP;
698 707
708 if (!soc_is_dra7xx())
709 prm_features |= PRM_HAS_VOLTAGE;
710
699 return prm_register(&omap44xx_prm_ll_data); 711 return prm_register(&omap44xx_prm_ll_data);
700} 712}
701 713
diff --git a/arch/arm/mach-omap2/prm44xx_54xx.h b/arch/arm/mach-omap2/prm44xx_54xx.h
index 8d95aa543ef5..f7512515fde5 100644
--- a/arch/arm/mach-omap2/prm44xx_54xx.h
+++ b/arch/arm/mach-omap2/prm44xx_54xx.h
@@ -26,10 +26,6 @@
26/* Function prototypes */ 26/* Function prototypes */
27#ifndef __ASSEMBLER__ 27#ifndef __ASSEMBLER__
28 28
29extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
30extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
31extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
32
33/* OMAP4/OMAP5-specific VP functions */ 29/* OMAP4/OMAP5-specific VP functions */
34u32 omap4_prm_vp_check_txdone(u8 vp_id); 30u32 omap4_prm_vp_check_txdone(u8 vp_id);
35void omap4_prm_vp_clear_txdone(u8 vp_id); 31void omap4_prm_vp_clear_txdone(u8 vp_id);
@@ -42,21 +38,6 @@ extern u32 omap4_prm_vcvp_read(u8 offset);
42extern void omap4_prm_vcvp_write(u32 val, u8 offset); 38extern void omap4_prm_vcvp_write(u32 val, u8 offset);
43extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 39extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
44 40
45#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
46 defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM43XX)
47void omap44xx_prm_reconfigure_io_chain(void);
48#else
49static inline void omap44xx_prm_reconfigure_io_chain(void)
50{
51}
52#endif
53
54/* PRM interrupt-related functions */
55extern void omap44xx_prm_read_pending_irqs(unsigned long *events);
56extern void omap44xx_prm_ocp_barrier(void);
57extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask);
58extern void omap44xx_prm_restore_irqen(u32 *saved_mask);
59
60extern int __init omap44xx_prm_init(void); 41extern int __init omap44xx_prm_init(void);
61extern u32 omap44xx_prm_get_reset_sources(void); 42extern u32 omap44xx_prm_get_reset_sources(void);
62 43
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index ee2b5222eac0..779940cb6e56 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -423,6 +423,105 @@ void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx)
423} 423}
424 424
425/** 425/**
426 * omap_prm_assert_hardreset - assert hardreset for an IP block
427 * @shift: register bit shift corresponding to the reset line
428 * @part: PRM partition
429 * @prm_mod: PRM submodule base or instance offset
430 * @offset: register offset
431 *
432 * Asserts a hardware reset line for an IP block.
433 */
434int omap_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset)
435{
436 if (!prm_ll_data->assert_hardreset) {
437 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
438 __func__);
439 return -EINVAL;
440 }
441
442 return prm_ll_data->assert_hardreset(shift, part, prm_mod, offset);
443}
444
445/**
446 * omap_prm_deassert_hardreset - deassert hardreset for an IP block
447 * @shift: register bit shift corresponding to the reset line
448 * @st_shift: reset status bit shift corresponding to the reset line
449 * @part: PRM partition
450 * @prm_mod: PRM submodule base or instance offset
451 * @offset: register offset
452 * @st_offset: status register offset
453 *
454 * Deasserts a hardware reset line for an IP block.
455 */
456int omap_prm_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 prm_mod,
457 u16 offset, u16 st_offset)
458{
459 if (!prm_ll_data->deassert_hardreset) {
460 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
461 __func__);
462 return -EINVAL;
463 }
464
465 return prm_ll_data->deassert_hardreset(shift, st_shift, part, prm_mod,
466 offset, st_offset);
467}
468
469/**
470 * omap_prm_is_hardreset_asserted - check the hardreset status for an IP block
471 * @shift: register bit shift corresponding to the reset line
472 * @part: PRM partition
473 * @prm_mod: PRM submodule base or instance offset
474 * @offset: register offset
475 *
476 * Checks if a hardware reset line for an IP block is enabled or not.
477 */
478int omap_prm_is_hardreset_asserted(u8 shift, u8 part, s16 prm_mod, u16 offset)
479{
480 if (!prm_ll_data->is_hardreset_asserted) {
481 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
482 __func__);
483 return -EINVAL;
484 }
485
486 return prm_ll_data->is_hardreset_asserted(shift, part, prm_mod, offset);
487}
488
489/**
490 * omap_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
491 *
492 * Clear any previously-latched I/O wakeup events and ensure that the
493 * I/O wakeup gates are aligned with the current mux settings.
494 * Calls SoC specific I/O chain reconfigure function if available,
495 * otherwise does nothing.
496 */
497void omap_prm_reconfigure_io_chain(void)
498{
499 if (!prcm_irq_setup || !prcm_irq_setup->reconfigure_io_chain)
500 return;
501
502 prcm_irq_setup->reconfigure_io_chain();
503}
504
505/**
506 * omap_prm_reset_system - trigger global SW reset
507 *
508 * Triggers SoC specific global warm reset to reboot the device.
509 */
510void omap_prm_reset_system(void)
511{
512 if (!prm_ll_data->reset_system) {
513 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
514 __func__);
515 return;
516 }
517
518 prm_ll_data->reset_system();
519
520 while (1)
521 cpu_relax();
522}
523
524/**
426 * prm_register - register per-SoC low-level data with the PRM 525 * prm_register - register per-SoC low-level data with the PRM
427 * @pld: low-level per-SoC OMAP PRM data & function pointers to register 526 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
428 * 527 *
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 225e0258d76d..8adf7b1a1dce 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -148,8 +148,12 @@ int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
148/** 148/**
149 * omap4_prminst_deassert_hardreset - deassert a submodule hardreset line and 149 * omap4_prminst_deassert_hardreset - deassert a submodule hardreset line and
150 * wait 150 * wait
151 * @rstctrl_reg: RM_RSTCTRL register address for this module
152 * @shift: register bit shift corresponding to the reset line to deassert 151 * @shift: register bit shift corresponding to the reset line to deassert
152 * @st_shift: status bit offset, not used for OMAP4+
153 * @part: PRM partition
154 * @inst: PRM instance offset
155 * @rstctrl_offs: reset register offset
156 * @st_offs: reset status register offset, not used for OMAP4+
153 * 157 *
154 * Some IPs like dsp, ipu or iva contain processors that require an HW 158 * Some IPs like dsp, ipu or iva contain processors that require an HW
155 * reset line to be asserted / deasserted in order to fully enable the 159 * reset line to be asserted / deasserted in order to fully enable the
@@ -160,8 +164,8 @@ int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
160 * -EINVAL upon an argument error, -EEXIST if the submodule was already out 164 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
161 * of reset, or -EBUSY if the submodule did not exit reset promptly. 165 * of reset, or -EBUSY if the submodule did not exit reset promptly.
162 */ 166 */
163int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, 167int omap4_prminst_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 inst,
164 u16 rstctrl_offs) 168 u16 rstctrl_offs, u16 st_offs)
165{ 169{
166 int c; 170 int c;
167 u32 mask = 1 << shift; 171 u32 mask = 1 << shift;
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index 583aa3774571..fb1c9d7a2f9d 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -30,8 +30,9 @@ extern int omap4_prminst_is_hardreset_asserted(u8 shift, u8 part, s16 inst,
30 u16 rstctrl_offs); 30 u16 rstctrl_offs);
31extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst, 31extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
32 u16 rstctrl_offs); 32 u16 rstctrl_offs);
33extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, 33int omap4_prminst_deassert_hardreset(u8 shift, u8 st_shift, u8 part,
34 u16 rstctrl_offs); 34 s16 inst, u16 rstctrl_offs,
35 u16 rstst_offs);
35 36
36extern void omap_prm_base_init(void); 37extern void omap_prm_base_init(void);
37 38
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index a388f8c1bcb3..57dee0c7cd2b 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -263,9 +263,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
263 omap_up.dma_rx_timeout = info->dma_rx_timeout; 263 omap_up.dma_rx_timeout = info->dma_rx_timeout;
264 omap_up.dma_rx_poll_rate = info->dma_rx_poll_rate; 264 omap_up.dma_rx_poll_rate = info->dma_rx_poll_rate;
265 omap_up.autosuspend_timeout = info->autosuspend_timeout; 265 omap_up.autosuspend_timeout = info->autosuspend_timeout;
266 omap_up.DTR_gpio = info->DTR_gpio;
267 omap_up.DTR_inverted = info->DTR_inverted;
268 omap_up.DTR_present = info->DTR_present;
269 266
270 pdata = &omap_up; 267 pdata = &omap_up;
271 pdata_size = sizeof(struct omap_uart_port_info); 268 pdata_size = sizeof(struct omap_uart_port_info);
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index e6690a44917d..83efe914bf7d 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -4,6 +4,17 @@ menu "Intel PXA2xx/PXA3xx Implementations"
4 4
5comment "Intel/Marvell Dev Platforms (sorted by hardware release time)" 5comment "Intel/Marvell Dev Platforms (sorted by hardware release time)"
6 6
7config MACH_PXA27X_DT
8 bool "Support PXA27x platforms from device tree"
9 select CPU_PXA27x
10 select POWER_SUPPLY
11 select PXA27x
12 select USE_OF
13 help
14 Include support for Marvell PXA27x based platforms using
15 the device tree. Needn't select any other machine while
16 MACH_PXA27X_DT is enabled.
17
7config MACH_PXA3XX_DT 18config MACH_PXA3XX_DT
8 bool "Support PXA3xx platforms from device tree" 19 bool "Support PXA3xx platforms from device tree"
9 select CPU_PXA300 20 select CPU_PXA300
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 2fe1824c6dcb..eb0bf7678a99 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_CPU_PXA930) += pxa930.o
21 21
22# Device Tree support 22# Device Tree support
23obj-$(CONFIG_MACH_PXA3XX_DT) += pxa-dt.o 23obj-$(CONFIG_MACH_PXA3XX_DT) += pxa-dt.o
24obj-$(CONFIG_MACH_PXA27X_DT) += pxa-dt.o
24 25
25# Intel/Marvell Dev Platforms 26# Intel/Marvell Dev Platforms
26obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 27obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 6915a9f6b3a3..51531ecffca8 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -378,7 +378,7 @@ static void __init em_x270_init_nand(void)
378 378
379 err = gpio_request(GPIO11_NAND_CS, "NAND CS"); 379 err = gpio_request(GPIO11_NAND_CS, "NAND CS");
380 if (err) { 380 if (err) {
381 pr_warning("EM-X270: failed to request NAND CS gpio\n"); 381 pr_warn("EM-X270: failed to request NAND CS gpio\n");
382 return; 382 return;
383 } 383 }
384 384
@@ -386,7 +386,7 @@ static void __init em_x270_init_nand(void)
386 386
387 err = gpio_request(nand_rb, "NAND R/B"); 387 err = gpio_request(nand_rb, "NAND R/B");
388 if (err) { 388 if (err) {
389 pr_warning("EM-X270: failed to request NAND R/B gpio\n"); 389 pr_warn("EM-X270: failed to request NAND R/B gpio\n");
390 gpio_free(GPIO11_NAND_CS); 390 gpio_free(GPIO11_NAND_CS);
391 return; 391 return;
392 } 392 }
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 8963984d1f43..7a9fa1aa4e41 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -13,11 +13,11 @@
13 13
14struct irq_data; 14struct irq_data;
15 15
16extern void pxa_timer_init(void);
17
18extern void __init pxa_map_io(void);
19
20extern unsigned int get_clk_frequency_khz(int info); 16extern unsigned int get_clk_frequency_khz(int info);
17extern void __init pxa_dt_irq_init(int (*fn)(struct irq_data *,
18 unsigned int));
19extern void __init pxa_map_io(void);
20extern void pxa_timer_init(void);
21 21
22#define SET_BANK(__nr,__start,__size) \ 22#define SET_BANK(__nr,__start,__size) \
23 mi->bank[__nr].start = (__start), \ 23 mi->bank[__nr].start = (__start), \
@@ -25,6 +25,43 @@ extern unsigned int get_clk_frequency_khz(int info);
25 25
26#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) 26#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
27 27
28#define pxa25x_handle_irq icip_handle_irq
29extern void __init pxa25x_init_irq(void);
30extern void __init pxa25x_map_io(void);
31extern void __init pxa26x_init_irq(void);
32
33#define pxa27x_handle_irq ichp_handle_irq
34extern void __init pxa27x_dt_init_irq(void);
35extern unsigned pxa27x_get_clk_frequency_khz(int);
36extern void __init pxa27x_init_irq(void);
37extern void __init pxa27x_map_io(void);
38
39#define pxa3xx_handle_irq ichp_handle_irq
40extern void __init pxa3xx_dt_init_irq(void);
41extern void __init pxa3xx_init_irq(void);
42extern void __init pxa3xx_map_io(void);
43
44extern struct syscore_ops pxa_irq_syscore_ops;
45extern struct syscore_ops pxa2xx_mfp_syscore_ops;
46extern struct syscore_ops pxa3xx_mfp_syscore_ops;
47
48void __init pxa_set_ffuart_info(void *info);
49void __init pxa_set_btuart_info(void *info);
50void __init pxa_set_stuart_info(void *info);
51void __init pxa_set_hwuart_info(void *info);
52
53void pxa_restart(enum reboot_mode, const char *);
54
55#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
56extern void pxa2xx_clear_reset_status(unsigned int);
57#else
58static inline void pxa2xx_clear_reset_status(unsigned int mask) {}
59#endif
60
61/*
62 * Once fully converted to the clock framework, all these functions should be
63 * removed, and replaced with a clk_get(NULL, "core").
64 */
28#ifdef CONFIG_PXA25x 65#ifdef CONFIG_PXA25x
29extern unsigned pxa25x_get_clk_frequency_khz(int); 66extern unsigned pxa25x_get_clk_frequency_khz(int);
30#else 67#else
@@ -32,30 +69,12 @@ extern unsigned pxa25x_get_clk_frequency_khz(int);
32#endif 69#endif
33 70
34#ifdef CONFIG_PXA27x 71#ifdef CONFIG_PXA27x
35extern unsigned pxa27x_get_clk_frequency_khz(int);
36#else 72#else
37#define pxa27x_get_clk_frequency_khz(x) (0) 73#define pxa27x_get_clk_frequency_khz(x) (0)
38#endif 74#endif
39 75
40#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
41extern void pxa2xx_clear_reset_status(unsigned int);
42#else
43static inline void pxa2xx_clear_reset_status(unsigned int mask) {}
44#endif
45
46#ifdef CONFIG_PXA3xx 76#ifdef CONFIG_PXA3xx
47extern unsigned pxa3xx_get_clk_frequency_khz(int); 77extern unsigned pxa3xx_get_clk_frequency_khz(int);
48#else 78#else
49#define pxa3xx_get_clk_frequency_khz(x) (0) 79#define pxa3xx_get_clk_frequency_khz(x) (0)
50#endif 80#endif
51
52extern struct syscore_ops pxa_irq_syscore_ops;
53extern struct syscore_ops pxa2xx_mfp_syscore_ops;
54extern struct syscore_ops pxa3xx_mfp_syscore_ops;
55
56void __init pxa_set_ffuart_info(void *info);
57void __init pxa_set_btuart_info(void *info);
58void __init pxa_set_stuart_info(void *info);
59void __init pxa_set_hwuart_info(void *info);
60
61void pxa_restart(enum reboot_mode, const char *);
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index 00b92dad7b81..f6c76a3ee3b2 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -140,8 +140,7 @@ static void gumstix_setup_bt_clock(void)
140 int timeout = 500; 140 int timeout = 500;
141 141
142 if (!(OSCC & OSCC_OOK)) 142 if (!(OSCC & OSCC_OOK))
143 pr_warning("32kHz clock was not on. Bootloader may need to " 143 pr_warn("32kHz clock was not on. Bootloader may need to be updated\n");
144 "be updated\n");
145 else 144 else
146 return; 145 return;
147 146
diff --git a/arch/arm/mach-pxa/include/mach/pxa25x.h b/arch/arm/mach-pxa/include/mach/pxa25x.h
index 3ac0baac7350..5a341752e32c 100644
--- a/arch/arm/mach-pxa/include/mach/pxa25x.h
+++ b/arch/arm/mach-pxa/include/mach/pxa25x.h
@@ -6,12 +6,4 @@
6#include <mach/mfp-pxa25x.h> 6#include <mach/mfp-pxa25x.h>
7#include <mach/irqs.h> 7#include <mach/irqs.h>
8 8
9extern void __init pxa25x_map_io(void);
10extern void __init pxa25x_init_irq(void);
11#ifdef CONFIG_CPU_PXA26x
12extern void __init pxa26x_init_irq(void);
13#endif
14
15#define pxa25x_handle_irq icip_handle_irq
16
17#endif /* __MACH_PXA25x_H */ 9#endif /* __MACH_PXA25x_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h
index 7cff640582b8..599b925a657c 100644
--- a/arch/arm/mach-pxa/include/mach/pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/pxa27x.h
@@ -19,11 +19,7 @@
19#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ 19#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
20#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ 20#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
21 21
22extern void __init pxa27x_map_io(void);
23extern void __init pxa27x_init_irq(void);
24extern int __init pxa27x_set_pwrmode(unsigned int mode); 22extern int __init pxa27x_set_pwrmode(unsigned int mode);
25extern void pxa27x_cpu_pm_enter(suspend_state_t state); 23extern void pxa27x_cpu_pm_enter(suspend_state_t state);
26 24
27#define pxa27x_handle_irq ichp_handle_irq
28
29#endif /* __MACH_PXA27x_H */ 25#endif /* __MACH_PXA27x_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx.h b/arch/arm/mach-pxa/include/mach/pxa3xx.h
index 6dd7fa163e29..b4143fb6631f 100644
--- a/arch/arm/mach-pxa/include/mach/pxa3xx.h
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx.h
@@ -5,9 +5,4 @@
5#include <mach/pxa3xx-regs.h> 5#include <mach/pxa3xx-regs.h>
6#include <mach/irqs.h> 6#include <mach/irqs.h>
7 7
8extern void __init pxa3xx_map_io(void);
9extern void __init pxa3xx_init_irq(void);
10
11#define pxa3xx_handle_irq ichp_handle_irq
12
13#endif /* __MACH_PXA3XX_H */ 8#endif /* __MACH_PXA3XX_H */
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index ef0426a159d4..666b78972c40 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -93,8 +93,8 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
93 break; 93 break;
94 default: 94 default:
95 /* warning and fall through, treat as MFP_LPM_DEFAULT */ 95 /* warning and fall through, treat as MFP_LPM_DEFAULT */
96 pr_warning("%s: GPIO%d: unsupported low power mode\n", 96 pr_warn("%s: GPIO%d: unsupported low power mode\n",
97 __func__, gpio); 97 __func__, gpio);
98 break; 98 break;
99 } 99 }
100 100
@@ -107,14 +107,12 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
107 * configurations of those pins not able to wakeup 107 * configurations of those pins not able to wakeup
108 */ 108 */
109 if ((c & MFP_LPM_CAN_WAKEUP) && !gpio_desc[gpio].can_wakeup) { 109 if ((c & MFP_LPM_CAN_WAKEUP) && !gpio_desc[gpio].can_wakeup) {
110 pr_warning("%s: GPIO%d unable to wakeup\n", 110 pr_warn("%s: GPIO%d unable to wakeup\n", __func__, gpio);
111 __func__, gpio);
112 return -EINVAL; 111 return -EINVAL;
113 } 112 }
114 113
115 if ((c & MFP_LPM_CAN_WAKEUP) && is_out) { 114 if ((c & MFP_LPM_CAN_WAKEUP) && is_out) {
116 pr_warning("%s: output GPIO%d unable to wakeup\n", 115 pr_warn("%s: output GPIO%d unable to wakeup\n", __func__, gpio);
117 __func__, gpio);
118 return -EINVAL; 116 return -EINVAL;
119 } 117 }
120 118
@@ -126,7 +124,7 @@ static inline int __mfp_validate(int mfp)
126 int gpio = mfp_to_gpio(mfp); 124 int gpio = mfp_to_gpio(mfp);
127 125
128 if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) { 126 if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
129 pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio); 127 pr_warn("%s: GPIO%d is invalid pin\n", __func__, gpio);
130 return -1; 128 return -1;
131 } 129 }
132 130
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 131991629116..29019beae591 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -446,7 +446,7 @@ static void __init poodle_init(void)
446 446
447 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 447 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
448 if (ret) 448 if (ret)
449 pr_warning("poodle: Unable to register LoCoMo device\n"); 449 pr_warn("poodle: Unable to register LoCoMo device\n");
450 450
451 pxa_set_fb_info(&poodle_locomo_device.dev, &poodle_fb_info); 451 pxa_set_fb_info(&poodle_locomo_device.dev, &poodle_fb_info);
452 pxa_set_udc_info(&udc_info); 452 pxa_set_udc_info(&udc_info);
diff --git a/arch/arm/mach-pxa/pxa-dt.c b/arch/arm/mach-pxa/pxa-dt.c
index f6a2c4b1c1dc..7e0e5bd0c9de 100644
--- a/arch/arm/mach-pxa/pxa-dt.c
+++ b/arch/arm/mach-pxa/pxa-dt.c
@@ -15,13 +15,10 @@
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/mach/time.h> 16#include <asm/mach/time.h>
17#include <mach/irqs.h> 17#include <mach/irqs.h>
18#include <mach/pxa3xx.h>
19 18
20#include "generic.h" 19#include "generic.h"
21 20
22#ifdef CONFIG_PXA3xx 21#ifdef CONFIG_PXA3xx
23extern void __init pxa3xx_dt_init_irq(void);
24
25static const struct of_dev_auxdata pxa3xx_auxdata_lookup[] __initconst = { 22static const struct of_dev_auxdata pxa3xx_auxdata_lookup[] __initconst = {
26 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40100000, "pxa2xx-uart.0", NULL), 23 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40100000, "pxa2xx-uart.0", NULL),
27 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40200000, "pxa2xx-uart.1", NULL), 24 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40200000, "pxa2xx-uart.1", NULL),
@@ -61,3 +58,18 @@ DT_MACHINE_START(PXA_DT, "Marvell PXA3xx (Device Tree Support)")
61 .dt_compat = pxa3xx_dt_board_compat, 58 .dt_compat = pxa3xx_dt_board_compat,
62MACHINE_END 59MACHINE_END
63#endif 60#endif
61
62#ifdef CONFIG_PXA27x
63static const char * const pxa27x_dt_board_compat[] __initconst = {
64 "marvell,pxa270",
65 NULL,
66};
67
68DT_MACHINE_START(PXA27X_DT, "Marvell PXA2xx (Device Tree Support)")
69 .map_io = pxa27x_map_io,
70 .init_irq = pxa27x_dt_init_irq,
71 .handle_irq = pxa27x_handle_irq,
72 .restart = pxa_restart,
73 .dt_compat = pxa27x_dt_board_compat,
74MACHINE_END
75#endif
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index b040d7d14888..af423a48c2e3 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -398,6 +398,12 @@ void __init pxa27x_init_irq(void)
398 pxa_init_irq(34, pxa27x_set_wake); 398 pxa_init_irq(34, pxa27x_set_wake);
399} 399}
400 400
401void __init pxa27x_dt_init_irq(void)
402{
403 if (IS_ENABLED(CONFIG_OF))
404 pxa_dt_irq_init(pxa27x_set_wake);
405}
406
401static struct map_desc pxa27x_io_desc[] __initdata = { 407static struct map_desc pxa27x_io_desc[] __initdata = {
402 { /* Mem Ctl */ 408 { /* Mem Ctl */
403 .virtual = (unsigned long)SMEMC_VIRT, 409 .virtual = (unsigned long)SMEMC_VIRT,
diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index e329ccefd364..614003e8b081 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -74,7 +74,7 @@ static int pxa310_ulpi_poll(void)
74 cpu_relax(); 74 cpu_relax();
75 } 75 }
76 76
77 pr_warning("%s: ULPI access timed out!\n", __func__); 77 pr_warn("%s: ULPI access timed out!\n", __func__);
78 78
79 return -ETIMEDOUT; 79 return -ETIMEDOUT;
80} 80}
@@ -84,7 +84,7 @@ static int pxa310_ulpi_read(struct usb_phy *otg, u32 reg)
84 int err; 84 int err;
85 85
86 if (pxa310_ulpi_get_phymode() != SYNCH) { 86 if (pxa310_ulpi_get_phymode() != SYNCH) {
87 pr_warning("%s: PHY is not in SYNCH mode!\n", __func__); 87 pr_warn("%s: PHY is not in SYNCH mode!\n", __func__);
88 return -EBUSY; 88 return -EBUSY;
89 } 89 }
90 90
@@ -101,7 +101,7 @@ static int pxa310_ulpi_read(struct usb_phy *otg, u32 reg)
101static int pxa310_ulpi_write(struct usb_phy *otg, u32 val, u32 reg) 101static int pxa310_ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
102{ 102{
103 if (pxa310_ulpi_get_phymode() != SYNCH) { 103 if (pxa310_ulpi_get_phymode() != SYNCH) {
104 pr_warning("%s: PHY is not in SYNCH mode!\n", __func__); 104 pr_warn("%s: PHY is not in SYNCH mode!\n", __func__);
105 return -EBUSY; 105 return -EBUSY;
106 } 106 }
107 107
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index 8386dc30b3e4..a762b23ac830 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -521,7 +521,7 @@ static void __init raumfeld_w1_init(void)
521 "W1 external pullup enable"); 521 "W1 external pullup enable");
522 522
523 if (ret < 0) 523 if (ret < 0)
524 pr_warning("Unable to request GPIO_W1_PULLUP_ENABLE\n"); 524 pr_warn("Unable to request GPIO_W1_PULLUP_ENABLE\n");
525 else 525 else
526 gpio_direction_output(GPIO_W1_PULLUP_ENABLE, 0); 526 gpio_direction_output(GPIO_W1_PULLUP_ENABLE, 0);
527 527
@@ -600,7 +600,7 @@ static void __init raumfeld_lcd_init(void)
600 600
601 ret = gpio_request(GPIO_TFT_VA_EN, "display VA enable"); 601 ret = gpio_request(GPIO_TFT_VA_EN, "display VA enable");
602 if (ret < 0) 602 if (ret < 0)
603 pr_warning("Unable to request GPIO_TFT_VA_EN\n"); 603 pr_warn("Unable to request GPIO_TFT_VA_EN\n");
604 else 604 else
605 gpio_direction_output(GPIO_TFT_VA_EN, 1); 605 gpio_direction_output(GPIO_TFT_VA_EN, 1);
606 606
@@ -608,7 +608,7 @@ static void __init raumfeld_lcd_init(void)
608 608
609 ret = gpio_request(GPIO_DISPLAY_ENABLE, "display enable"); 609 ret = gpio_request(GPIO_DISPLAY_ENABLE, "display enable");
610 if (ret < 0) 610 if (ret < 0)
611 pr_warning("Unable to request GPIO_DISPLAY_ENABLE\n"); 611 pr_warn("Unable to request GPIO_DISPLAY_ENABLE\n");
612 else 612 else
613 gpio_direction_output(GPIO_DISPLAY_ENABLE, 1); 613 gpio_direction_output(GPIO_DISPLAY_ENABLE, 1);
614 614
@@ -814,17 +814,17 @@ static void __init raumfeld_power_init(void)
814 /* Set PEN2 high to enable maximum charge current */ 814 /* Set PEN2 high to enable maximum charge current */
815 ret = gpio_request(GPIO_CHRG_PEN2, "CHRG_PEN2"); 815 ret = gpio_request(GPIO_CHRG_PEN2, "CHRG_PEN2");
816 if (ret < 0) 816 if (ret < 0)
817 pr_warning("Unable to request GPIO_CHRG_PEN2\n"); 817 pr_warn("Unable to request GPIO_CHRG_PEN2\n");
818 else 818 else
819 gpio_direction_output(GPIO_CHRG_PEN2, 1); 819 gpio_direction_output(GPIO_CHRG_PEN2, 1);
820 820
821 ret = gpio_request(GPIO_CHARGE_DC_OK, "CABLE_DC_OK"); 821 ret = gpio_request(GPIO_CHARGE_DC_OK, "CABLE_DC_OK");
822 if (ret < 0) 822 if (ret < 0)
823 pr_warning("Unable to request GPIO_CHARGE_DC_OK\n"); 823 pr_warn("Unable to request GPIO_CHARGE_DC_OK\n");
824 824
825 ret = gpio_request(GPIO_CHARGE_USB_SUSP, "CHARGE_USB_SUSP"); 825 ret = gpio_request(GPIO_CHARGE_USB_SUSP, "CHARGE_USB_SUSP");
826 if (ret < 0) 826 if (ret < 0)
827 pr_warning("Unable to request GPIO_CHARGE_USB_SUSP\n"); 827 pr_warn("Unable to request GPIO_CHARGE_USB_SUSP\n");
828 else 828 else
829 gpio_direction_output(GPIO_CHARGE_USB_SUSP, 0); 829 gpio_direction_output(GPIO_CHARGE_USB_SUSP, 0);
830 830
@@ -976,19 +976,19 @@ static void __init raumfeld_audio_init(void)
976 976
977 ret = gpio_request(GPIO_CODEC_RESET, "cs4270 reset"); 977 ret = gpio_request(GPIO_CODEC_RESET, "cs4270 reset");
978 if (ret < 0) 978 if (ret < 0)
979 pr_warning("unable to request GPIO_CODEC_RESET\n"); 979 pr_warn("unable to request GPIO_CODEC_RESET\n");
980 else 980 else
981 gpio_direction_output(GPIO_CODEC_RESET, 1); 981 gpio_direction_output(GPIO_CODEC_RESET, 1);
982 982
983 ret = gpio_request(GPIO_SPDIF_RESET, "ak4104 s/pdif reset"); 983 ret = gpio_request(GPIO_SPDIF_RESET, "ak4104 s/pdif reset");
984 if (ret < 0) 984 if (ret < 0)
985 pr_warning("unable to request GPIO_SPDIF_RESET\n"); 985 pr_warn("unable to request GPIO_SPDIF_RESET\n");
986 else 986 else
987 gpio_direction_output(GPIO_SPDIF_RESET, 1); 987 gpio_direction_output(GPIO_SPDIF_RESET, 1);
988 988
989 ret = gpio_request(GPIO_MCLK_RESET, "MCLK reset"); 989 ret = gpio_request(GPIO_MCLK_RESET, "MCLK reset");
990 if (ret < 0) 990 if (ret < 0)
991 pr_warning("unable to request GPIO_MCLK_RESET\n"); 991 pr_warn("unable to request GPIO_MCLK_RESET\n");
992 else 992 else
993 gpio_direction_output(GPIO_MCLK_RESET, 1); 993 gpio_direction_output(GPIO_MCLK_RESET, 1);
994 994
@@ -1019,20 +1019,20 @@ static void __init raumfeld_common_init(void)
1019 1019
1020 ret = gpio_request(GPIO_W2W_RESET, "Wi2Wi reset"); 1020 ret = gpio_request(GPIO_W2W_RESET, "Wi2Wi reset");
1021 if (ret < 0) 1021 if (ret < 0)
1022 pr_warning("Unable to request GPIO_W2W_RESET\n"); 1022 pr_warn("Unable to request GPIO_W2W_RESET\n");
1023 else 1023 else
1024 gpio_direction_output(GPIO_W2W_RESET, 0); 1024 gpio_direction_output(GPIO_W2W_RESET, 0);
1025 1025
1026 ret = gpio_request(GPIO_W2W_PDN, "Wi2Wi powerup"); 1026 ret = gpio_request(GPIO_W2W_PDN, "Wi2Wi powerup");
1027 if (ret < 0) 1027 if (ret < 0)
1028 pr_warning("Unable to request GPIO_W2W_PDN\n"); 1028 pr_warn("Unable to request GPIO_W2W_PDN\n");
1029 else 1029 else
1030 gpio_direction_output(GPIO_W2W_PDN, 0); 1030 gpio_direction_output(GPIO_W2W_PDN, 0);
1031 1031
1032 /* this can be used to switch off the device */ 1032 /* this can be used to switch off the device */
1033 ret = gpio_request(GPIO_SHUTDOWN_SUPPLY, "supply shutdown"); 1033 ret = gpio_request(GPIO_SHUTDOWN_SUPPLY, "supply shutdown");
1034 if (ret < 0) 1034 if (ret < 0)
1035 pr_warning("Unable to request GPIO_SHUTDOWN_SUPPLY\n"); 1035 pr_warn("Unable to request GPIO_SHUTDOWN_SUPPLY\n");
1036 else 1036 else
1037 gpio_direction_output(GPIO_SHUTDOWN_SUPPLY, 0); 1037 gpio_direction_output(GPIO_SHUTDOWN_SUPPLY, 0);
1038 1038
@@ -1051,7 +1051,7 @@ static void __init raumfeld_controller_init(void)
1051 1051
1052 ret = gpio_request(GPIO_SHUTDOWN_BATT, "battery shutdown"); 1052 ret = gpio_request(GPIO_SHUTDOWN_BATT, "battery shutdown");
1053 if (ret < 0) 1053 if (ret < 0)
1054 pr_warning("Unable to request GPIO_SHUTDOWN_BATT\n"); 1054 pr_warn("Unable to request GPIO_SHUTDOWN_BATT\n");
1055 else 1055 else
1056 gpio_direction_output(GPIO_SHUTDOWN_BATT, 0); 1056 gpio_direction_output(GPIO_SHUTDOWN_BATT, 0);
1057 1057
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 840c3a48e720..962a7f31f596 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -924,6 +924,14 @@ static inline void spitz_i2c_init(void) {}
924#endif 924#endif
925 925
926/****************************************************************************** 926/******************************************************************************
927 * Audio devices
928 ******************************************************************************/
929static inline void spitz_audio_init(void)
930{
931 platform_device_register_simple("spitz-audio", -1, NULL, 0);
932}
933
934/******************************************************************************
927 * Machine init 935 * Machine init
928 ******************************************************************************/ 936 ******************************************************************************/
929static void spitz_poweroff(void) 937static void spitz_poweroff(void)
@@ -970,6 +978,7 @@ static void __init spitz_init(void)
970 spitz_nor_init(); 978 spitz_nor_init();
971 spitz_nand_init(); 979 spitz_nand_init();
972 spitz_i2c_init(); 980 spitz_i2c_init();
981 spitz_audio_init();
973} 982}
974 983
975static void __init spitz_fixup(struct tag *tags, char **cmdline) 984static void __init spitz_fixup(struct tag *tags, char **cmdline)
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index c158a6e3e0aa..7780d1faa06f 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -30,7 +30,7 @@
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/input.h> 31#include <linux/input.h>
32#include <linux/gpio.h> 32#include <linux/gpio.h>
33#include <linux/pda_power.h> 33#include <linux/power/gpio-charger.h>
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/pxa2xx_spi.h> 35#include <linux/spi/pxa2xx_spi.h>
36#include <linux/input/matrix_keypad.h> 36#include <linux/input/matrix_keypad.h>
@@ -361,44 +361,17 @@ static struct pxaficp_platform_data tosa_ficp_platform_data = {
361/* 361/*
362 * Tosa AC IN 362 * Tosa AC IN
363 */ 363 */
364static int tosa_power_init(struct device *dev)
365{
366 int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in");
367 if (ret)
368 goto err_gpio_req;
369
370 ret = gpio_direction_input(TOSA_GPIO_AC_IN);
371 if (ret)
372 goto err_gpio_in;
373
374 return 0;
375
376err_gpio_in:
377 gpio_free(TOSA_GPIO_AC_IN);
378err_gpio_req:
379 return ret;
380}
381
382static void tosa_power_exit(struct device *dev)
383{
384 gpio_free(TOSA_GPIO_AC_IN);
385}
386
387static int tosa_power_ac_online(void)
388{
389 return gpio_get_value(TOSA_GPIO_AC_IN) == 0;
390}
391
392static char *tosa_ac_supplied_to[] = { 364static char *tosa_ac_supplied_to[] = {
393 "main-battery", 365 "main-battery",
394 "backup-battery", 366 "backup-battery",
395 "jacket-battery", 367 "jacket-battery",
396}; 368};
397 369
398static struct pda_power_pdata tosa_power_data = { 370static struct gpio_charger_platform_data tosa_power_data = {
399 .init = tosa_power_init, 371 .name = "charger",
400 .is_ac_online = tosa_power_ac_online, 372 .type = POWER_SUPPLY_TYPE_MAINS,
401 .exit = tosa_power_exit, 373 .gpio = TOSA_GPIO_AC_IN,
374 .gpio_active_low = 1,
402 .supplied_to = tosa_ac_supplied_to, 375 .supplied_to = tosa_ac_supplied_to,
403 .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to), 376 .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to),
404}; 377};
@@ -415,7 +388,7 @@ static struct resource tosa_power_resource[] = {
415}; 388};
416 389
417static struct platform_device tosa_power_device = { 390static struct platform_device tosa_power_device = {
418 .name = "pda-power", 391 .name = "gpio-charger",
419 .id = -1, 392 .id = -1,
420 .dev.platform_data = &tosa_power_data, 393 .dev.platform_data = &tosa_power_data,
421 .resource = tosa_power_resource, 394 .resource = tosa_power_resource,
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index 9db2029aa632..565925f37dc5 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -1,6 +1,19 @@
1menu "RealView platform type" 1menu "RealView platform type"
2 depends on ARCH_REALVIEW 2 depends on ARCH_REALVIEW
3 3
4config REALVIEW_DT
5 bool "Support RealView(R) Device Tree based boot"
6 select ARM_GIC
7 select MFD_SYSCON
8 select POWER_RESET
9 select POWER_RESET_VERSATILE
10 select POWER_SUPPLY
11 select SOC_REALVIEW
12 select USE_OF
13 help
14 Include support for booting the ARM(R) RealView(R) evaluation
15 boards using a device tree machine description.
16
4config MACH_REALVIEW_EB 17config MACH_REALVIEW_EB
5 bool "Support RealView(R) Emulation Baseboard" 18 bool "Support RealView(R) Emulation Baseboard"
6 select ARM_GIC 19 select ARM_GIC
diff --git a/arch/arm/mach-realview/Makefile b/arch/arm/mach-realview/Makefile
index 541fa4c109ef..e07fdf7ae8a7 100644
--- a/arch/arm/mach-realview/Makefile
+++ b/arch/arm/mach-realview/Makefile
@@ -3,6 +3,7 @@
3# 3#
4 4
5obj-y := core.o 5obj-y := core.o
6obj-$(CONFIG_REALVIEW_DT) += realview-dt.o
6obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o 7obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o
7obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o 8obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o
8obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o 9obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o
diff --git a/arch/arm/mach-realview/realview-dt.c b/arch/arm/mach-realview/realview-dt.c
new file mode 100644
index 000000000000..cc28b89dd48f
--- /dev/null
+++ b/arch/arm/mach-realview/realview-dt.c
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd.
3 *
4 * Author: Linus Walleij <linus.walleij@linaro.org>
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/of_platform.h>
12#include <asm/mach/arch.h>
13#include <asm/hardware/cache-l2x0.h>
14#include "core.h"
15
16static const char *realview_dt_platform_compat[] __initconst = {
17 "arm,realview-eb",
18 "arm,realview-pb1176",
19 "arm,realview-pb11mp",
20 "arm,realview-pba8",
21 "arm,realview-pbx",
22 NULL,
23};
24
25DT_MACHINE_START(REALVIEW_DT, "ARM RealView Machine (Device Tree Support)")
26#ifdef CONFIG_ZONE_DMA
27 .dma_zone_size = SZ_256M,
28#endif
29 .dt_compat = realview_dt_platform_compat,
30 .l2c_aux_val = 0x0,
31 .l2c_aux_mask = ~0x0,
32MACHINE_END
diff --git a/arch/arm/mach-rockchip/headsmp.S b/arch/arm/mach-rockchip/headsmp.S
index 73206e360e31..46c22dedf632 100644
--- a/arch/arm/mach-rockchip/headsmp.S
+++ b/arch/arm/mach-rockchip/headsmp.S
@@ -16,7 +16,10 @@
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18ENTRY(rockchip_secondary_startup) 18ENTRY(rockchip_secondary_startup)
19 bl v7_invalidate_l1 19 mrc p15, 0, r0, c0, c0, 0 @ read main ID register
20 ldr r1, =0x00000c09 @ Cortex-A9 primary part number
21 teq r0, r1
22 beq v7_invalidate_l1
20 b secondary_startup 23 b secondary_startup
21ENDPROC(rockchip_secondary_startup) 24ENDPROC(rockchip_secondary_startup)
22 25
diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
index 189684f55927..f26fcdca2445 100644
--- a/arch/arm/mach-rockchip/platsmp.c
+++ b/arch/arm/mach-rockchip/platsmp.c
@@ -19,7 +19,11 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_address.h> 21#include <linux/of_address.h>
22#include <linux/regmap.h>
23#include <linux/mfd/syscon.h>
22 24
25#include <linux/reset.h>
26#include <linux/cpu.h>
23#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
24#include <asm/cp15.h> 28#include <asm/cp15.h>
25#include <asm/smp_scu.h> 29#include <asm/smp_scu.h>
@@ -37,23 +41,78 @@ static int ncores;
37 41
38#define PMU_PWRDN_SCU 4 42#define PMU_PWRDN_SCU 4
39 43
40static void __iomem *pmu_base_addr; 44static struct regmap *pmu;
41 45
42static inline bool pmu_power_domain_is_on(int pd) 46static int pmu_power_domain_is_on(int pd)
43{ 47{
44 return !(readl_relaxed(pmu_base_addr + PMU_PWRDN_ST) & BIT(pd)); 48 u32 val;
49 int ret;
50
51 ret = regmap_read(pmu, PMU_PWRDN_ST, &val);
52 if (ret < 0)
53 return ret;
54
55 return !(val & BIT(pd));
45} 56}
46 57
47static void pmu_set_power_domain(int pd, bool on) 58struct reset_control *rockchip_get_core_reset(int cpu)
48{ 59{
49 u32 val = readl_relaxed(pmu_base_addr + PMU_PWRDN_CON); 60 struct device *dev = get_cpu_device(cpu);
50 if (on) 61 struct device_node *np;
51 val &= ~BIT(pd); 62
63 /* The cpu device is only available after the initial core bringup */
64 if (dev)
65 np = dev->of_node;
52 else 66 else
53 val |= BIT(pd); 67 np = of_get_cpu_node(cpu, 0);
54 writel(val, pmu_base_addr + PMU_PWRDN_CON);
55 68
56 while (pmu_power_domain_is_on(pd) != on) { } 69 return of_reset_control_get(np, NULL);
70}
71
72static int pmu_set_power_domain(int pd, bool on)
73{
74 u32 val = (on) ? 0 : BIT(pd);
75 int ret;
76
77 /*
78 * We need to soft reset the cpu when we turn off the cpu power domain,
79 * or else the active processors might be stalled when the individual
80 * processor is powered down.
81 */
82 if (read_cpuid_part() != ARM_CPU_PART_CORTEX_A9) {
83 struct reset_control *rstc = rockchip_get_core_reset(pd);
84
85 if (IS_ERR(rstc)) {
86 pr_err("%s: could not get reset control for core %d\n",
87 __func__, pd);
88 return PTR_ERR(rstc);
89 }
90
91 if (on)
92 reset_control_deassert(rstc);
93 else
94 reset_control_assert(rstc);
95
96 reset_control_put(rstc);
97 }
98
99 ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
100 if (ret < 0) {
101 pr_err("%s: could not update power domain\n", __func__);
102 return ret;
103 }
104
105 ret = -1;
106 while (ret != on) {
107 ret = pmu_power_domain_is_on(pd);
108 if (ret < 0) {
109 pr_err("%s: could not read power domain state\n",
110 __func__);
111 return ret;
112 }
113 }
114
115 return 0;
57} 116}
58 117
59/* 118/*
@@ -63,7 +122,9 @@ static void pmu_set_power_domain(int pd, bool on)
63static int __cpuinit rockchip_boot_secondary(unsigned int cpu, 122static int __cpuinit rockchip_boot_secondary(unsigned int cpu,
64 struct task_struct *idle) 123 struct task_struct *idle)
65{ 124{
66 if (!sram_base_addr || !pmu_base_addr) { 125 int ret;
126
127 if (!sram_base_addr || !pmu) {
67 pr_err("%s: sram or pmu missing for cpu boot\n", __func__); 128 pr_err("%s: sram or pmu missing for cpu boot\n", __func__);
68 return -ENXIO; 129 return -ENXIO;
69 } 130 }
@@ -75,7 +136,24 @@ static int __cpuinit rockchip_boot_secondary(unsigned int cpu,
75 } 136 }
76 137
77 /* start the core */ 138 /* start the core */
78 pmu_set_power_domain(0 + cpu, true); 139 ret = pmu_set_power_domain(0 + cpu, true);
140 if (ret < 0)
141 return ret;
142
143 if (read_cpuid_part() != ARM_CPU_PART_CORTEX_A9) {
144 /* We communicate with the bootrom to active the cpus other
145 * than cpu0, after a blob of initialize code, they will
146 * stay at wfe state, once they are actived, they will check
147 * the mailbox:
148 * sram_base_addr + 4: 0xdeadbeaf
149 * sram_base_addr + 8: start address for pc
150 * */
151 udelay(10);
152 writel(virt_to_phys(rockchip_secondary_startup),
153 sram_base_addr + 8);
154 writel(0xDEADBEAF, sram_base_addr + 4);
155 dsb_sev();
156 }
79 157
80 return 0; 158 return 0;
81} 159}
@@ -110,8 +188,6 @@ static int __init rockchip_smp_prepare_sram(struct device_node *node)
110 return -EINVAL; 188 return -EINVAL;
111 } 189 }
112 190
113 sram_base_addr = of_iomap(node, 0);
114
115 /* set the boot function for the sram code */ 191 /* set the boot function for the sram code */
116 rockchip_boot_fn = virt_to_phys(rockchip_secondary_startup); 192 rockchip_boot_fn = virt_to_phys(rockchip_secondary_startup);
117 193
@@ -125,54 +201,115 @@ static int __init rockchip_smp_prepare_sram(struct device_node *node)
125 return 0; 201 return 0;
126} 202}
127 203
128static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) 204static struct regmap_config rockchip_pmu_regmap_config = {
205 .reg_bits = 32,
206 .val_bits = 32,
207 .reg_stride = 4,
208};
209
210static int __init rockchip_smp_prepare_pmu(void)
129{ 211{
130 struct device_node *node; 212 struct device_node *node;
131 unsigned int i; 213 void __iomem *pmu_base;
132 214
133 node = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); 215 /*
216 * This function is only called via smp_ops->smp_prepare_cpu().
217 * That only happens if a "/cpus" device tree node exists
218 * and has an "enable-method" property that selects the SMP
219 * operations defined herein.
220 */
221 node = of_find_node_by_path("/cpus");
222
223 pmu = syscon_regmap_lookup_by_phandle(node, "rockchip,pmu");
224 of_node_put(node);
225 if (!IS_ERR(pmu))
226 return 0;
227
228 pmu = syscon_regmap_lookup_by_compatible("rockchip,rk3066-pmu");
229 if (!IS_ERR(pmu))
230 return 0;
231
232 /* fallback, create our own regmap for the pmu area */
233 pmu = NULL;
234 node = of_find_compatible_node(NULL, NULL, "rockchip,rk3066-pmu");
134 if (!node) { 235 if (!node) {
135 pr_err("%s: missing scu\n", __func__); 236 pr_err("%s: could not find pmu dt node\n", __func__);
136 return; 237 return -ENODEV;
137 } 238 }
138 239
139 scu_base_addr = of_iomap(node, 0); 240 pmu_base = of_iomap(node, 0);
140 if (!scu_base_addr) { 241 if (!pmu_base) {
141 pr_err("%s: could not map scu registers\n", __func__); 242 pr_err("%s: could not map pmu registers\n", __func__);
142 return; 243 return -ENOMEM;
143 } 244 }
144 245
145 node = of_find_compatible_node(NULL, NULL, "rockchip,rk3066-smp-sram"); 246 pmu = regmap_init_mmio(NULL, pmu_base, &rockchip_pmu_regmap_config);
146 if (!node) { 247 if (IS_ERR(pmu)) {
147 pr_err("%s: could not find sram dt node\n", __func__); 248 int ret = PTR_ERR(pmu);
148 return; 249
250 iounmap(pmu_base);
251 pmu = NULL;
252 pr_err("%s: regmap init failed\n", __func__);
253 return ret;
149 } 254 }
150 255
151 if (rockchip_smp_prepare_sram(node)) 256 return 0;
152 return; 257}
153 258
154 node = of_find_compatible_node(NULL, NULL, "rockchip,rk3066-pmu"); 259static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
260{
261 struct device_node *node;
262 unsigned int i;
263
264 node = of_find_compatible_node(NULL, NULL, "rockchip,rk3066-smp-sram");
155 if (!node) { 265 if (!node) {
156 pr_err("%s: could not find pmu dt node\n", __func__); 266 pr_err("%s: could not find sram dt node\n", __func__);
157 return; 267 return;
158 } 268 }
159 269
160 pmu_base_addr = of_iomap(node, 0); 270 sram_base_addr = of_iomap(node, 0);
161 if (!pmu_base_addr) { 271 if (!sram_base_addr) {
162 pr_err("%s: could not map pmu registers\n", __func__); 272 pr_err("%s: could not map sram registers\n", __func__);
163 return; 273 return;
164 } 274 }
165 275
166 /* enable the SCU power domain */ 276 if (rockchip_smp_prepare_pmu())
167 pmu_set_power_domain(PMU_PWRDN_SCU, true); 277 return;
168
169 /*
170 * While the number of cpus is gathered from dt, also get the number
171 * of cores from the scu to verify this value when booting the cores.
172 */
173 ncores = scu_get_core_count(scu_base_addr);
174 278
175 scu_enable(scu_base_addr); 279 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
280 if (rockchip_smp_prepare_sram(node))
281 return;
282
283 /* enable the SCU power domain */
284 pmu_set_power_domain(PMU_PWRDN_SCU, true);
285
286 node = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
287 if (!node) {
288 pr_err("%s: missing scu\n", __func__);
289 return;
290 }
291
292 scu_base_addr = of_iomap(node, 0);
293 if (!scu_base_addr) {
294 pr_err("%s: could not map scu registers\n", __func__);
295 return;
296 }
297
298 /*
299 * While the number of cpus is gathered from dt, also get the
300 * number of cores from the scu to verify this value when
301 * booting the cores.
302 */
303 ncores = scu_get_core_count(scu_base_addr);
304 pr_err("%s: ncores %d\n", __func__, ncores);
305
306 scu_enable(scu_base_addr);
307 } else {
308 unsigned int l2ctlr;
309
310 asm ("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr));
311 ncores = ((l2ctlr >> 24) & 0x3) + 1;
312 }
176 313
177 /* Make sure that all cores except the first are really off */ 314 /* Make sure that all cores except the first are really off */
178 for (i = 1; i < ncores; i++) 315 for (i = 1; i < ncores; i++)
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 8ab9e0e7ff04..d226b71d21d5 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -24,6 +24,12 @@
24#include <asm/hardware/cache-l2x0.h> 24#include <asm/hardware/cache-l2x0.h>
25#include "core.h" 25#include "core.h"
26 26
27static void __init rockchip_dt_init(void)
28{
29 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
30 platform_device_register_simple("cpufreq-dt", 0, NULL, 0);
31}
32
27static const char * const rockchip_board_dt_compat[] = { 33static const char * const rockchip_board_dt_compat[] = {
28 "rockchip,rk2928", 34 "rockchip,rk2928",
29 "rockchip,rk3066a", 35 "rockchip,rk3066a",
@@ -37,4 +43,5 @@ DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
37 .l2c_aux_val = 0, 43 .l2c_aux_val = 0,
38 .l2c_aux_mask = ~0, 44 .l2c_aux_mask = ~0,
39 .dt_compat = rockchip_board_dt_compat, 45 .dt_compat = rockchip_board_dt_compat,
46 .init_machine = rockchip_dt_init,
40MACHINE_END 47MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
index b4d14b864367..9c8b1279a4ba 100644
--- a/arch/arm/mach-s3c24xx/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
@@ -41,7 +41,7 @@ static void h1940bt_enable(int on)
41 mdelay(10); 41 mdelay(10);
42 gpio_set_value(S3C2410_GPH(1), 0); 42 gpio_set_value(S3C2410_GPH(1), 0);
43 43
44 h1940_led_blink_set(-EINVAL, GPIO_LED_BLINK, NULL, NULL); 44 h1940_led_blink_set(NULL, GPIO_LED_BLINK, NULL, NULL);
45 } 45 }
46 else { 46 else {
47 gpio_set_value(S3C2410_GPH(1), 1); 47 gpio_set_value(S3C2410_GPH(1), 1);
@@ -50,7 +50,7 @@ static void h1940bt_enable(int on)
50 mdelay(10); 50 mdelay(10);
51 gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0); 51 gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);
52 52
53 h1940_led_blink_set(-EINVAL, GPIO_LED_NO_BLINK_LOW, NULL, NULL); 53 h1940_led_blink_set(NULL, GPIO_LED_NO_BLINK_LOW, NULL, NULL);
54 } 54 }
55} 55}
56 56
diff --git a/arch/arm/mach-s3c24xx/h1940.h b/arch/arm/mach-s3c24xx/h1940.h
index 2950cc466840..596d9f64c5b6 100644
--- a/arch/arm/mach-s3c24xx/h1940.h
+++ b/arch/arm/mach-s3c24xx/h1940.h
@@ -19,8 +19,10 @@
19#define H1940_SUSPEND_RESUMEAT (0x30081000) 19#define H1940_SUSPEND_RESUMEAT (0x30081000)
20#define H1940_SUSPEND_CHECK (0x30080000) 20#define H1940_SUSPEND_CHECK (0x30080000)
21 21
22struct gpio_desc;
23
22extern void h1940_pm_return(void); 24extern void h1940_pm_return(void);
23extern int h1940_led_blink_set(unsigned gpio, int state, 25extern int h1940_led_blink_set(struct gpio_desc *desc, int state,
24 unsigned long *delay_on, 26 unsigned long *delay_on,
25 unsigned long *delay_off); 27 unsigned long *delay_off);
26 28
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index d35ddc1d9991..d40d4f5244c6 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -359,10 +359,11 @@ static struct platform_device h1940_battery = {
359 359
360static DEFINE_SPINLOCK(h1940_blink_spin); 360static DEFINE_SPINLOCK(h1940_blink_spin);
361 361
362int h1940_led_blink_set(unsigned gpio, int state, 362int h1940_led_blink_set(struct gpio_desc *desc, int state,
363 unsigned long *delay_on, unsigned long *delay_off) 363 unsigned long *delay_on, unsigned long *delay_off)
364{ 364{
365 int blink_gpio, check_gpio1, check_gpio2; 365 int blink_gpio, check_gpio1, check_gpio2;
366 int gpio = desc ? desc_to_gpio(desc) : -EINVAL;
366 367
367 switch (gpio) { 368 switch (gpio) {
368 case H1940_LATCH_LED_GREEN: 369 case H1940_LATCH_LED_GREEN:
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index c3f2682d0c62..1d35ff375a01 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -250,9 +250,10 @@ static void rx1950_disable_charger(void)
250 250
251static DEFINE_SPINLOCK(rx1950_blink_spin); 251static DEFINE_SPINLOCK(rx1950_blink_spin);
252 252
253static int rx1950_led_blink_set(unsigned gpio, int state, 253static int rx1950_led_blink_set(struct gpio_desc *desc, int state,
254 unsigned long *delay_on, unsigned long *delay_off) 254 unsigned long *delay_on, unsigned long *delay_off)
255{ 255{
256 int gpio = desc_to_gpio(desc);
256 int blink_gpio, check_gpio; 257 int blink_gpio, check_gpio;
257 258
258 switch (gpio) { 259 switch (gpio) {
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
index 3c8ab07c2012..2eb072440dfa 100644
--- a/arch/arm/mach-s3c64xx/cpuidle.c
+++ b/arch/arm/mach-s3c64xx/cpuidle.c
@@ -48,7 +48,6 @@ static struct cpuidle_driver s3c64xx_cpuidle_driver = {
48 .enter = s3c64xx_enter_idle, 48 .enter = s3c64xx_enter_idle,
49 .exit_latency = 1, 49 .exit_latency = 1,
50 .target_residency = 1, 50 .target_residency = 1,
51 .flags = CPUIDLE_FLAG_TIME_VALID,
52 .name = "IDLE", 51 .name = "IDLE",
53 .desc = "System active, ARM gated", 52 .desc = "System active, ARM gated",
54 }, 53 },
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
index ff02e2da99f2..b704433c529c 100644
--- a/arch/arm/mach-sa1100/pci-nanoengine.c
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -33,12 +33,12 @@
33static DEFINE_SPINLOCK(nano_lock); 33static DEFINE_SPINLOCK(nano_lock);
34 34
35static int nanoengine_get_pci_address(struct pci_bus *bus, 35static int nanoengine_get_pci_address(struct pci_bus *bus,
36 unsigned int devfn, int where, unsigned long *address) 36 unsigned int devfn, int where, void __iomem **address)
37{ 37{
38 int ret = PCIBIOS_DEVICE_NOT_FOUND; 38 int ret = PCIBIOS_DEVICE_NOT_FOUND;
39 unsigned int busnr = bus->number; 39 unsigned int busnr = bus->number;
40 40
41 *address = NANO_PCI_CONFIG_SPACE_VIRT + 41 *address = (void __iomem *)NANO_PCI_CONFIG_SPACE_VIRT +
42 ((bus->number << 16) | (devfn << 8) | (where & ~3)); 42 ((bus->number << 16) | (devfn << 8) | (where & ~3));
43 43
44 ret = (busnr > 255 || devfn > 255 || where > 255) ? 44 ret = (busnr > 255 || devfn > 255 || where > 255) ?
@@ -51,7 +51,7 @@ static int nanoengine_read_config(struct pci_bus *bus, unsigned int devfn, int w
51 int size, u32 *val) 51 int size, u32 *val)
52{ 52{
53 int ret; 53 int ret;
54 unsigned long address; 54 void __iomem *address;
55 unsigned long flags; 55 unsigned long flags;
56 u32 v; 56 u32 v;
57 57
@@ -85,7 +85,7 @@ static int nanoengine_write_config(struct pci_bus *bus, unsigned int devfn, int
85 int size, u32 val) 85 int size, u32 val)
86{ 86{
87 int ret; 87 int ret;
88 unsigned long address; 88 void __iomem *address;
89 unsigned long flags; 89 unsigned long flags;
90 unsigned shift; 90 unsigned shift;
91 u32 v; 91 u32 v;
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 21f457b56c01..1b4fafe524ff 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -1,5 +1,6 @@
1config ARCH_SHMOBILE 1config ARCH_SHMOBILE
2 bool 2 bool
3 select ZONE_DMA if ARM_LPAE
3 4
4config PM_RCAR 5config PM_RCAR
5 bool 6 bool
@@ -18,6 +19,7 @@ config ARCH_RCAR_GEN2
18 select PM_RCAR if PM || SMP 19 select PM_RCAR if PM || SMP
19 select RENESAS_IRQC 20 select RENESAS_IRQC
20 select SYS_SUPPORTS_SH_CMT 21 select SYS_SUPPORTS_SH_CMT
22 select PCI_DOMAINS if PCI
21 23
22config ARCH_RMOBILE 24config ARCH_RMOBILE
23 bool 25 bool
@@ -36,7 +38,6 @@ menuconfig ARCH_SHMOBILE_MULTI
36 select NO_IOPORT_MAP 38 select NO_IOPORT_MAP
37 select PINCTRL 39 select PINCTRL
38 select ARCH_REQUIRE_GPIOLIB 40 select ARCH_REQUIRE_GPIOLIB
39 select ARCH_HAS_OPP
40 41
41if ARCH_SHMOBILE_MULTI 42if ARCH_SHMOBILE_MULTI
42 43
@@ -73,11 +74,6 @@ config ARCH_R8A7794
73 74
74comment "Renesas ARM SoCs Board Type" 75comment "Renesas ARM SoCs Board Type"
75 76
76config MACH_KOELSCH
77 bool "Koelsch board"
78 depends on ARCH_R8A7791
79 select MICREL_PHY if SH_ETH
80
81config MACH_LAGER 77config MACH_LAGER
82 bool "Lager board" 78 bool "Lager board"
83 depends on ARCH_R8A7790 79 depends on ARCH_R8A7790
@@ -145,14 +141,6 @@ config ARCH_R8A7790
145 select MIGHT_HAVE_PCI 141 select MIGHT_HAVE_PCI
146 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 142 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
147 143
148config ARCH_R8A7791
149 bool "R-Car M2-W (R8A77910)"
150 select ARCH_RCAR_GEN2
151 select ARCH_WANT_OPTIONAL_GPIOLIB
152 select ARM_GIC
153 select MIGHT_HAVE_PCI
154 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
155
156comment "Renesas ARM SoCs Board Type" 144comment "Renesas ARM SoCs Board Type"
157 145
158config MACH_APE6EVM 146config MACH_APE6EVM
@@ -227,12 +215,6 @@ config MACH_LAGER
227 select MICREL_PHY if SH_ETH 215 select MICREL_PHY if SH_ETH
228 select SND_SOC_AK4642 if SND_SIMPLE_CARD 216 select SND_SOC_AK4642 if SND_SIMPLE_CARD
229 217
230config MACH_KOELSCH
231 bool "Koelsch board"
232 depends on ARCH_R8A7791
233 select USE_OF
234 select MICREL_PHY if SH_ETH
235
236config MACH_KZM9G 218config MACH_KZM9G
237 bool "KZM-A9-GT board" 219 bool "KZM-A9-GT board"
238 depends on ARCH_SH73A0 220 depends on ARCH_SH73A0
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index e20f2786ec72..b55cac0e5b2b 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -19,8 +19,8 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
19obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o 19obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
20 20
21# Clock objects 21# Clock objects
22obj-y += clock.o
23ifndef CONFIG_COMMON_CLK 22ifndef CONFIG_COMMON_CLK
23obj-y += clock.o
24obj-$(CONFIG_ARCH_SH7372) += clock-sh7372.o 24obj-$(CONFIG_ARCH_SH7372) += clock-sh7372.o
25obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o 25obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o
26obj-$(CONFIG_ARCH_R8A73A4) += clock-r8a73a4.o 26obj-$(CONFIG_ARCH_R8A73A4) += clock-r8a73a4.o
@@ -28,7 +28,6 @@ obj-$(CONFIG_ARCH_R8A7740) += clock-r8a7740.o
28obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o 28obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
29obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o 29obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
30obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o 30obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o
31obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o
32endif 31endif
33 32
34# CPU reset vector handling objects 33# CPU reset vector handling objects
@@ -36,6 +35,7 @@ cpu-y := platsmp.o headsmp.o
36 35
37# Shared SoC family objects 36# Shared SoC family objects
38obj-$(CONFIG_ARCH_RCAR_GEN2) += setup-rcar-gen2.o platsmp-apmu.o $(cpu-y) 37obj-$(CONFIG_ARCH_RCAR_GEN2) += setup-rcar-gen2.o platsmp-apmu.o $(cpu-y)
38CFLAGS_setup-rcar-gen2.o += -march=armv7-a
39 39
40# SMP objects 40# SMP objects
41smp-y := $(cpu-y) 41smp-y := $(cpu-y)
@@ -57,7 +57,6 @@ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o sleep-sh7372.o
57 57
58# Board objects 58# Board objects
59ifdef CONFIG_ARCH_SHMOBILE_MULTI 59ifdef CONFIG_ARCH_SHMOBILE_MULTI
60obj-$(CONFIG_MACH_KOELSCH) += board-koelsch-reference.o
61obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o 60obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o
62obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o 61obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o
63else 62else
@@ -69,7 +68,6 @@ obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
69obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 68obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
70obj-$(CONFIG_MACH_LAGER) += board-lager.o 69obj-$(CONFIG_MACH_LAGER) += board-lager.o
71obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 70obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
72obj-$(CONFIG_MACH_KOELSCH) += board-koelsch.o
73obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 71obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
74obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o 72obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
75endif 73endif
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index de9a23852fc8..57d00ed6ec0c 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -5,7 +5,6 @@ loadaddr-$(CONFIG_MACH_APE6EVM_REFERENCE) += 0x40008000
5loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000 5loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
6loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000 6loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
7loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000 7loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
8loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000
9loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000 8loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
10loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000 9loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
11loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000 10loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
diff --git a/arch/arm/mach-shmobile/board-ape6evm-reference.c b/arch/arm/mach-shmobile/board-ape6evm-reference.c
index a6503d8c77de..3b68370b03a0 100644
--- a/arch/arm/mach-shmobile/board-ape6evm-reference.c
+++ b/arch/arm/mach-shmobile/board-ape6evm-reference.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20 16
21#include <linux/gpio.h> 17#include <linux/gpio.h>
@@ -48,7 +44,6 @@ static void __init ape6evm_add_standard_devices(void)
48 clk_put(parent); 44 clk_put(parent);
49 clk_put(mp); 45 clk_put(mp);
50 46
51 r8a73a4_add_dt_devices();
52 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 47 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
53} 48}
54 49
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index b222f68d55b7..66f67816a844 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20 16
21#include <linux/gpio.h> 17#include <linux/gpio.h>
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index e70983534403..6d949f1c850b 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -12,53 +12,48 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
21 16
22#include <linux/clk.h> 17#include <linux/clk.h>
23#include <linux/delay.h> 18#include <linux/delay.h>
24#include <linux/err.h> 19#include <linux/err.h>
25#include <linux/kernel.h>
26#include <linux/input.h>
27#include <linux/platform_data/st1232_pdata.h>
28#include <linux/irq.h>
29#include <linux/platform_device.h>
30#include <linux/gpio.h> 20#include <linux/gpio.h>
31#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
32#include <linux/regulator/driver.h> 22#include <linux/i2c-gpio.h>
23#include <linux/input.h>
24#include <linux/irq.h>
25#include <linux/kernel.h>
26#include <linux/mfd/tmio.h>
27#include <linux/mmc/host.h>
28#include <linux/mmc/sh_mmcif.h>
29#include <linux/mmc/sh_mobile_sdhi.h>
33#include <linux/pinctrl/machine.h> 30#include <linux/pinctrl/machine.h>
31#include <linux/platform_data/st1232_pdata.h>
32#include <linux/platform_device.h>
34#include <linux/pwm.h> 33#include <linux/pwm.h>
35#include <linux/pwm_backlight.h> 34#include <linux/pwm_backlight.h>
35#include <linux/reboot.h>
36#include <linux/regulator/driver.h>
36#include <linux/regulator/fixed.h> 37#include <linux/regulator/fixed.h>
37#include <linux/regulator/gpio-regulator.h> 38#include <linux/regulator/gpio-regulator.h>
38#include <linux/regulator/machine.h> 39#include <linux/regulator/machine.h>
39#include <linux/sh_eth.h> 40#include <linux/sh_eth.h>
40#include <linux/videodev2.h>
41#include <linux/usb/renesas_usbhs.h> 41#include <linux/usb/renesas_usbhs.h>
42#include <linux/mfd/tmio.h> 42#include <linux/videodev2.h>
43#include <linux/mmc/host.h>
44#include <linux/mmc/sh_mmcif.h>
45#include <linux/mmc/sh_mobile_sdhi.h>
46#include <linux/i2c-gpio.h>
47#include <linux/reboot.h>
48 43
49#include <media/mt9t112.h> 44#include <asm/hardware/cache-l2x0.h>
50#include <media/sh_mobile_ceu.h>
51#include <media/soc_camera.h>
52#include <asm/page.h>
53#include <asm/mach-types.h> 45#include <asm/mach-types.h>
54#include <asm/mach/arch.h> 46#include <asm/mach/arch.h>
55#include <asm/mach/map.h> 47#include <asm/mach/map.h>
56#include <asm/mach/time.h> 48#include <asm/mach/time.h>
57#include <asm/hardware/cache-l2x0.h> 49#include <asm/page.h>
58#include <video/sh_mobile_lcdc.h> 50#include <media/mt9t112.h>
59#include <video/sh_mobile_hdmi.h> 51#include <media/sh_mobile_ceu.h>
52#include <media/soc_camera.h>
60#include <sound/sh_fsi.h> 53#include <sound/sh_fsi.h>
61#include <sound/simple_card.h> 54#include <sound/simple_card.h>
55#include <video/sh_mobile_hdmi.h>
56#include <video/sh_mobile_lcdc.h>
62 57
63#include "common.h" 58#include "common.h"
64#include "irqs.h" 59#include "irqs.h"
@@ -1234,8 +1229,15 @@ static void __init eva_init(void)
1234 static struct pm_domain_device domain_devices[] __initdata = { 1229 static struct pm_domain_device domain_devices[] __initdata = {
1235 { "A4LC", &lcdc0_device }, 1230 { "A4LC", &lcdc0_device },
1236 { "A4LC", &hdmi_lcdc_device }, 1231 { "A4LC", &hdmi_lcdc_device },
1232 { "A4MP", &hdmi_device },
1233 { "A4MP", &fsi_device },
1234 { "A4R", &ceu0_device },
1235 { "A4S", &sh_eth_device },
1236 { "A3SP", &pwm_device },
1237 { "A3SP", &sdhi0_device },
1238 { "A3SP", &sh_mmcif_device },
1237 }; 1239 };
1238 struct platform_device *usb = NULL; 1240 struct platform_device *usb = NULL, *sdhi1 = NULL;
1239 1241
1240 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 1242 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
1241 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 1243 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
@@ -1304,6 +1306,7 @@ static void __init eva_init(void)
1304 1306
1305 platform_device_register(&vcc_sdhi1); 1307 platform_device_register(&vcc_sdhi1);
1306 platform_device_register(&sdhi1_device); 1308 platform_device_register(&sdhi1_device);
1309 sdhi1 = &sdhi1_device;
1307 } 1310 }
1308 1311
1309 1312
@@ -1324,6 +1327,8 @@ static void __init eva_init(void)
1324 ARRAY_SIZE(domain_devices)); 1327 ARRAY_SIZE(domain_devices));
1325 if (usb) 1328 if (usb)
1326 rmobile_add_device_to_domain("A3SP", usb); 1329 rmobile_add_device_to_domain("A3SP", usb);
1330 if (sdhi1)
1331 rmobile_add_device_to_domain("A3SP", sdhi1);
1327 1332
1328 r8a7740_pm_init(); 1333 r8a7740_pm_init();
1329} 1334}
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
index 79c47847f200..d649ade4a202 100644
--- a/arch/arm/mach-shmobile/board-bockw-reference.c
+++ b/arch/arm/mach-shmobile/board-bockw-reference.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20 16
21#include <linux/of_platform.h> 17#include <linux/of_platform.h>
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 1cf2c75dacfb..f27b5a833bf0 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21 17
22#include <linux/mfd/tmio.h> 18#include <linux/mfd/tmio.h>
diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
deleted file mode 100644
index 46aa540133d6..000000000000
--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * Koelsch board support - Reference DT implementation
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 * Copyright (C) 2013 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 * 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/dma-mapping.h>
23#include <linux/kernel.h>
24#include <linux/of_platform.h>
25#include <linux/platform_data/rcar-du.h>
26
27#include <asm/mach/arch.h>
28
29#include "clock.h"
30#include "common.h"
31#include "irqs.h"
32#include "r8a7791.h"
33#include "rcar-gen2.h"
34
35/* DU */
36static struct rcar_du_encoder_data koelsch_du_encoders[] = {
37 {
38 .type = RCAR_DU_ENCODER_NONE,
39 .output = RCAR_DU_OUTPUT_LVDS0,
40 .connector.lvds.panel = {
41 .width_mm = 210,
42 .height_mm = 158,
43 .mode = {
44 .pixelclock = 65000000,
45 .hactive = 1024,
46 .hfront_porch = 20,
47 .hback_porch = 160,
48 .hsync_len = 136,
49 .vactive = 768,
50 .vfront_porch = 3,
51 .vback_porch = 29,
52 .vsync_len = 6,
53 },
54 },
55 },
56};
57
58static struct rcar_du_platform_data koelsch_du_pdata = {
59 .encoders = koelsch_du_encoders,
60 .num_encoders = ARRAY_SIZE(koelsch_du_encoders),
61};
62
63static const struct resource du_resources[] __initconst = {
64 DEFINE_RES_MEM(0xfeb00000, 0x40000),
65 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
66 DEFINE_RES_IRQ(gic_spi(256)),
67 DEFINE_RES_IRQ(gic_spi(268)),
68};
69
70static void __init koelsch_add_du_device(void)
71{
72 struct platform_device_info info = {
73 .name = "rcar-du-r8a7791",
74 .id = -1,
75 .res = du_resources,
76 .num_res = ARRAY_SIZE(du_resources),
77 .data = &koelsch_du_pdata,
78 .size_data = sizeof(koelsch_du_pdata),
79 .dma_mask = DMA_BIT_MASK(32),
80 };
81
82 platform_device_register_full(&info);
83}
84
85/*
86 * This is a really crude hack to provide clkdev support to platform
87 * devices until they get moved to DT.
88 */
89static const struct clk_name clk_names[] __initconst = {
90 { "du0", "du.0", "rcar-du-r8a7791" },
91 { "du1", "du.1", "rcar-du-r8a7791" },
92 { "lvds0", "lvds.0", "rcar-du-r8a7791" },
93};
94
95static void __init koelsch_add_standard_devices(void)
96{
97 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
98 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
99
100 koelsch_add_du_device();
101}
102
103static const char * const koelsch_boards_compat_dt[] __initconst = {
104 "renesas,koelsch",
105 "renesas,koelsch-reference",
106 NULL,
107};
108
109DT_MACHINE_START(KOELSCH_DT, "koelsch")
110 .smp = smp_ops(r8a7791_smp_ops),
111 .init_early = shmobile_init_delay,
112 .init_time = rcar_gen2_timer_init,
113 .init_machine = koelsch_add_standard_devices,
114 .init_late = shmobile_init_late,
115 .reserve = rcar_gen2_reserve,
116 .dt_compat = koelsch_boards_compat_dt,
117MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
deleted file mode 100644
index 7111b5c1d67b..000000000000
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ /dev/null
@@ -1,527 +0,0 @@
1/*
2 * Koelsch board support
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013-2014 Renesas Solutions Corp.
6 * Copyright (C) 2013 Magnus Damm
7 * Copyright (C) 2014 Cogent Embedded, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include <linux/dma-mapping.h>
24#include <linux/gpio.h>
25#include <linux/gpio_keys.h>
26#include <linux/input.h>
27#include <linux/irq.h>
28#include <linux/kernel.h>
29#include <linux/leds.h>
30#include <linux/mfd/tmio.h>
31#include <linux/mmc/host.h>
32#include <linux/mmc/sh_mobile_sdhi.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
35#include <linux/phy.h>
36#include <linux/pinctrl/machine.h>
37#include <linux/platform_data/gpio-rcar.h>
38#include <linux/platform_data/rcar-du.h>
39#include <linux/platform_device.h>
40#include <linux/regulator/driver.h>
41#include <linux/regulator/fixed.h>
42#include <linux/regulator/gpio-regulator.h>
43#include <linux/regulator/machine.h>
44#include <linux/sh_eth.h>
45#include <linux/spi/flash.h>
46#include <linux/spi/rspi.h>
47#include <linux/spi/spi.h>
48
49#include <asm/mach-types.h>
50#include <asm/mach/arch.h>
51
52#include "common.h"
53#include "irqs.h"
54#include "r8a7791.h"
55#include "rcar-gen2.h"
56
57/* DU */
58static struct rcar_du_encoder_data koelsch_du_encoders[] = {
59 {
60 .type = RCAR_DU_ENCODER_NONE,
61 .output = RCAR_DU_OUTPUT_LVDS0,
62 .connector.lvds.panel = {
63 .width_mm = 210,
64 .height_mm = 158,
65 .mode = {
66 .pixelclock = 65000000,
67 .hactive = 1024,
68 .hfront_porch = 20,
69 .hback_porch = 160,
70 .hsync_len = 136,
71 .vactive = 768,
72 .vfront_porch = 3,
73 .vback_porch = 29,
74 .vsync_len = 6,
75 },
76 },
77 },
78};
79
80static const struct rcar_du_platform_data koelsch_du_pdata __initconst = {
81 .encoders = koelsch_du_encoders,
82 .num_encoders = ARRAY_SIZE(koelsch_du_encoders),
83};
84
85static const struct resource du_resources[] __initconst = {
86 DEFINE_RES_MEM(0xfeb00000, 0x40000),
87 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
88 DEFINE_RES_IRQ(gic_spi(256)),
89 DEFINE_RES_IRQ(gic_spi(268)),
90};
91
92static void __init koelsch_add_du_device(void)
93{
94 struct platform_device_info info = {
95 .name = "rcar-du-r8a7791",
96 .id = -1,
97 .res = du_resources,
98 .num_res = ARRAY_SIZE(du_resources),
99 .data = &koelsch_du_pdata,
100 .size_data = sizeof(koelsch_du_pdata),
101 .dma_mask = DMA_BIT_MASK(32),
102 };
103
104 platform_device_register_full(&info);
105}
106
107/* Ether */
108static const struct sh_eth_plat_data ether_pdata __initconst = {
109 .phy = 0x1,
110 .phy_irq = irq_pin(0),
111 .edmac_endian = EDMAC_LITTLE_ENDIAN,
112 .phy_interface = PHY_INTERFACE_MODE_RMII,
113 .ether_link_active_low = 1,
114};
115
116static const struct resource ether_resources[] __initconst = {
117 DEFINE_RES_MEM(0xee700000, 0x400),
118 DEFINE_RES_IRQ(gic_spi(162)),
119};
120
121static const struct platform_device_info ether_info __initconst = {
122 .name = "r8a7791-ether",
123 .id = -1,
124 .res = ether_resources,
125 .num_res = ARRAY_SIZE(ether_resources),
126 .data = &ether_pdata,
127 .size_data = sizeof(ether_pdata),
128 .dma_mask = DMA_BIT_MASK(32),
129};
130
131/* LEDS */
132static struct gpio_led koelsch_leds[] = {
133 {
134 .name = "led8",
135 .gpio = RCAR_GP_PIN(2, 21),
136 .default_state = LEDS_GPIO_DEFSTATE_ON,
137 }, {
138 .name = "led7",
139 .gpio = RCAR_GP_PIN(2, 20),
140 .default_state = LEDS_GPIO_DEFSTATE_ON,
141 }, {
142 .name = "led6",
143 .gpio = RCAR_GP_PIN(2, 19),
144 .default_state = LEDS_GPIO_DEFSTATE_ON,
145 },
146};
147
148static const struct gpio_led_platform_data koelsch_leds_pdata __initconst = {
149 .leds = koelsch_leds,
150 .num_leds = ARRAY_SIZE(koelsch_leds),
151};
152
153/* GPIO KEY */
154#define GPIO_KEY(c, g, d, ...) \
155 { .code = c, .gpio = g, .desc = d, .active_low = 1, \
156 .wakeup = 1, .debounce_interval = 20 }
157
158static struct gpio_keys_button gpio_buttons[] = {
159 GPIO_KEY(KEY_4, RCAR_GP_PIN(5, 3), "SW2-pin4"),
160 GPIO_KEY(KEY_3, RCAR_GP_PIN(5, 2), "SW2-pin3"),
161 GPIO_KEY(KEY_2, RCAR_GP_PIN(5, 1), "SW2-pin2"),
162 GPIO_KEY(KEY_1, RCAR_GP_PIN(5, 0), "SW2-pin1"),
163 GPIO_KEY(KEY_G, RCAR_GP_PIN(7, 6), "SW36"),
164 GPIO_KEY(KEY_F, RCAR_GP_PIN(7, 5), "SW35"),
165 GPIO_KEY(KEY_E, RCAR_GP_PIN(7, 4), "SW34"),
166 GPIO_KEY(KEY_D, RCAR_GP_PIN(7, 3), "SW33"),
167 GPIO_KEY(KEY_C, RCAR_GP_PIN(7, 2), "SW32"),
168 GPIO_KEY(KEY_B, RCAR_GP_PIN(7, 1), "SW31"),
169 GPIO_KEY(KEY_A, RCAR_GP_PIN(7, 0), "SW30"),
170};
171
172static const struct gpio_keys_platform_data koelsch_keys_pdata __initconst = {
173 .buttons = gpio_buttons,
174 .nbuttons = ARRAY_SIZE(gpio_buttons),
175};
176
177/* QSPI */
178static const struct resource qspi_resources[] __initconst = {
179 DEFINE_RES_MEM(0xe6b10000, 0x1000),
180 DEFINE_RES_IRQ_NAMED(gic_spi(184), "mux"),
181};
182
183static const struct rspi_plat_data qspi_pdata __initconst = {
184 .num_chipselect = 1,
185};
186
187/* SPI Flash memory (Spansion S25FL512SAGMFIG11 64 MiB) */
188static struct mtd_partition spi_flash_part[] = {
189 {
190 .name = "loader",
191 .offset = 0x00000000,
192 .size = 512 * 1024,
193 .mask_flags = MTD_WRITEABLE,
194 },
195 {
196 .name = "bootenv",
197 .offset = MTDPART_OFS_APPEND,
198 .size = 512 * 1024,
199 .mask_flags = MTD_WRITEABLE,
200 },
201 {
202 .name = "data",
203 .offset = MTDPART_OFS_APPEND,
204 .size = MTDPART_SIZ_FULL,
205 },
206};
207
208static const struct flash_platform_data spi_flash_data = {
209 .name = "m25p80",
210 .parts = spi_flash_part,
211 .nr_parts = ARRAY_SIZE(spi_flash_part),
212 .type = "s25fl512s",
213};
214
215static const struct spi_board_info spi_info[] __initconst = {
216 {
217 .modalias = "m25p80",
218 .platform_data = &spi_flash_data,
219 .mode = SPI_MODE_0 | SPI_TX_QUAD | SPI_RX_QUAD,
220 .max_speed_hz = 30000000,
221 .bus_num = 0,
222 .chip_select = 0,
223 },
224};
225
226/* SATA0 */
227static const struct resource sata0_resources[] __initconst = {
228 DEFINE_RES_MEM(0xee300000, 0x2000),
229 DEFINE_RES_IRQ(gic_spi(105)),
230};
231
232static const struct platform_device_info sata0_info __initconst = {
233 .name = "sata-r8a7791",
234 .id = 0,
235 .res = sata0_resources,
236 .num_res = ARRAY_SIZE(sata0_resources),
237 .dma_mask = DMA_BIT_MASK(32),
238};
239
240/* I2C */
241static const struct resource i2c_resources[] __initconst = {
242 /* I2C0 */
243 DEFINE_RES_MEM(0xE6508000, 0x40),
244 DEFINE_RES_IRQ(gic_spi(287)),
245 /* I2C1 */
246 DEFINE_RES_MEM(0xE6518000, 0x40),
247 DEFINE_RES_IRQ(gic_spi(288)),
248 /* I2C2 */
249 DEFINE_RES_MEM(0xE6530000, 0x40),
250 DEFINE_RES_IRQ(gic_spi(286)),
251 /* I2C3 */
252 DEFINE_RES_MEM(0xE6540000, 0x40),
253 DEFINE_RES_IRQ(gic_spi(290)),
254 /* I2C4 */
255 DEFINE_RES_MEM(0xE6520000, 0x40),
256 DEFINE_RES_IRQ(gic_spi(19)),
257 /* I2C5 */
258 DEFINE_RES_MEM(0xE6528000, 0x40),
259 DEFINE_RES_IRQ(gic_spi(20)),
260};
261
262static void __init koelsch_add_i2c(unsigned idx)
263{
264 unsigned res_idx = idx * 2;
265
266 BUG_ON(res_idx >= ARRAY_SIZE(i2c_resources));
267
268 platform_device_register_simple("i2c-rcar_gen2", idx,
269 i2c_resources + res_idx, 2);
270}
271
272#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin) \
273static struct regulator_consumer_supply vcc_sdhi##idx##_consumer = \
274 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx); \
275 \
276static struct regulator_init_data vcc_sdhi##idx##_init_data = { \
277 .constraints = { \
278 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
279 }, \
280 .consumer_supplies = &vcc_sdhi##idx##_consumer, \
281 .num_consumer_supplies = 1, \
282}; \
283 \
284static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\
285 .supply_name = "SDHI" #idx "Vcc", \
286 .microvolts = 3300000, \
287 .gpio = vdd_pin, \
288 .enable_high = 1, \
289 .init_data = &vcc_sdhi##idx##_init_data, \
290}; \
291 \
292static struct regulator_consumer_supply vccq_sdhi##idx##_consumer = \
293 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx); \
294 \
295static struct regulator_init_data vccq_sdhi##idx##_init_data = { \
296 .constraints = { \
297 .input_uV = 3300000, \
298 .min_uV = 1800000, \
299 .max_uV = 3300000, \
300 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | \
301 REGULATOR_CHANGE_STATUS, \
302 }, \
303 .consumer_supplies = &vccq_sdhi##idx##_consumer, \
304 .num_consumer_supplies = 1, \
305}; \
306 \
307static struct gpio vccq_sdhi##idx##_gpio = \
308 { vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx }; \
309 \
310static struct gpio_regulator_state vccq_sdhi##idx##_states[] = { \
311 { .value = 1800000, .gpios = 0 }, \
312 { .value = 3300000, .gpios = 1 }, \
313}; \
314 \
315static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\
316 .supply_name = "vqmmc", \
317 .gpios = &vccq_sdhi##idx##_gpio, \
318 .nr_gpios = 1, \
319 .states = vccq_sdhi##idx##_states, \
320 .nr_states = ARRAY_SIZE(vccq_sdhi##idx##_states), \
321 .type = REGULATOR_VOLTAGE, \
322 .init_data = &vccq_sdhi##idx##_init_data, \
323};
324
325SDHI_REGULATOR(0, RCAR_GP_PIN(7, 17), RCAR_GP_PIN(2, 12));
326SDHI_REGULATOR(1, RCAR_GP_PIN(7, 18), RCAR_GP_PIN(2, 13));
327SDHI_REGULATOR(2, RCAR_GP_PIN(7, 19), RCAR_GP_PIN(2, 26));
328
329/* SDHI0 */
330static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
331 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
332 MMC_CAP_POWER_OFF_CARD,
333 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
334};
335
336static struct resource sdhi0_resources[] __initdata = {
337 DEFINE_RES_MEM(0xee100000, 0x200),
338 DEFINE_RES_IRQ(gic_spi(165)),
339};
340
341/* SDHI1 */
342static struct sh_mobile_sdhi_info sdhi1_info __initdata = {
343 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
344 MMC_CAP_POWER_OFF_CARD,
345 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
346};
347
348static struct resource sdhi1_resources[] __initdata = {
349 DEFINE_RES_MEM(0xee140000, 0x100),
350 DEFINE_RES_IRQ(gic_spi(167)),
351};
352
353/* SDHI2 */
354static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
355 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
356 MMC_CAP_POWER_OFF_CARD,
357 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT |
358 TMIO_MMC_WRPROTECT_DISABLE,
359};
360
361static struct resource sdhi2_resources[] __initdata = {
362 DEFINE_RES_MEM(0xee160000, 0x100),
363 DEFINE_RES_IRQ(gic_spi(168)),
364};
365
366static const struct pinctrl_map koelsch_pinctrl_map[] = {
367 /* DU */
368 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
369 "du_rgb666", "du"),
370 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
371 "du_sync", "du"),
372 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
373 "du_clk_out_0", "du"),
374 /* Ether */
375 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
376 "eth_link", "eth"),
377 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
378 "eth_mdio", "eth"),
379 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
380 "eth_rmii", "eth"),
381 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
382 "intc_irq0", "intc"),
383 /* QSPI */
384 PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7791",
385 "qspi_ctrl", "qspi"),
386 PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7791",
387 "qspi_data4", "qspi"),
388 /* SCIF0 (CN19: DEBUG SERIAL0) */
389 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7791",
390 "scif0_data_d", "scif0"),
391 /* SCIF1 (CN20: DEBUG SERIAL1) */
392 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791",
393 "scif1_data_d", "scif1"),
394 /* I2C1 */
395 PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.1", "pfc-r8a7791",
396 "i2c1_e", "i2c1"),
397 /* I2C2 */
398 PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.2", "pfc-r8a7791",
399 "i2c2", "i2c2"),
400 /* I2C4 */
401 PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.4", "pfc-r8a7791",
402 "i2c4_c", "i2c4"),
403 /* SDHI0 */
404 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7791",
405 "sdhi0_data4", "sdhi0"),
406 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7791",
407 "sdhi0_ctrl", "sdhi0"),
408 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7791",
409 "sdhi0_cd", "sdhi0"),
410 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7791",
411 "sdhi0_wp", "sdhi0"),
412 /* SDHI2 */
413 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7791",
414 "sdhi1_data4", "sdhi1"),
415 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7791",
416 "sdhi1_ctrl", "sdhi1"),
417 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7791",
418 "sdhi1_cd", "sdhi1"),
419 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7791",
420 "sdhi1_wp", "sdhi1"),
421 /* SDHI2 */
422 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7791",
423 "sdhi2_data4", "sdhi2"),
424 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7791",
425 "sdhi2_ctrl", "sdhi2"),
426 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7791",
427 "sdhi2_cd", "sdhi2"),
428};
429
430static void __init koelsch_add_standard_devices(void)
431{
432 r8a7791_clock_init();
433 pinctrl_register_mappings(koelsch_pinctrl_map,
434 ARRAY_SIZE(koelsch_pinctrl_map));
435 r8a7791_pinmux_init();
436 r8a7791_add_standard_devices();
437 platform_device_register_full(&ether_info);
438 platform_device_register_data(NULL, "leds-gpio", -1,
439 &koelsch_leds_pdata,
440 sizeof(koelsch_leds_pdata));
441 platform_device_register_data(NULL, "gpio-keys", -1,
442 &koelsch_keys_pdata,
443 sizeof(koelsch_keys_pdata));
444 platform_device_register_resndata(NULL, "qspi", 0,
445 qspi_resources,
446 ARRAY_SIZE(qspi_resources),
447 &qspi_pdata, sizeof(qspi_pdata));
448 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
449
450 koelsch_add_du_device();
451
452 platform_device_register_full(&sata0_info);
453
454 koelsch_add_i2c(1);
455 koelsch_add_i2c(2);
456 koelsch_add_i2c(4);
457 koelsch_add_i2c(5);
458
459 platform_device_register_data(NULL, "reg-fixed-voltage", 0,
460 &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
461 platform_device_register_data(NULL, "reg-fixed-voltage", 1,
462 &vcc_sdhi1_info, sizeof(struct fixed_voltage_config));
463 platform_device_register_data(NULL, "reg-fixed-voltage", 2,
464 &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
465 platform_device_register_data(NULL, "gpio-regulator", 0,
466 &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
467 platform_device_register_data(NULL, "gpio-regulator", 1,
468 &vccq_sdhi1_info, sizeof(struct gpio_regulator_config));
469 platform_device_register_data(NULL, "gpio-regulator", 2,
470 &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
471
472 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0,
473 sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
474 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
475
476 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 1,
477 sdhi1_resources, ARRAY_SIZE(sdhi1_resources),
478 &sdhi1_info, sizeof(struct sh_mobile_sdhi_info));
479
480 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 2,
481 sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
482 &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
483
484}
485
486/*
487 * Ether LEDs on the Koelsch board are named LINK and ACTIVE which corresponds
488 * to non-default 01 setting of the Micrel KSZ8041 PHY control register 1 bits
489 * 14-15. We have to set them back to 01 from the default 00 value each time
490 * the PHY is reset. It's also important because the PHY's LED0 signal is
491 * connected to SoC's ETH_LINK signal and in the PHY's default mode it will
492 * bounce on and off after each packet, which we apparently want to avoid.
493 */
494static int koelsch_ksz8041_fixup(struct phy_device *phydev)
495{
496 u16 phyctrl1 = phy_read(phydev, 0x1e);
497
498 phyctrl1 &= ~0xc000;
499 phyctrl1 |= 0x4000;
500 return phy_write(phydev, 0x1e, phyctrl1);
501}
502
503static void __init koelsch_init(void)
504{
505 koelsch_add_standard_devices();
506
507 irq_set_irq_type(irq_pin(0), IRQ_TYPE_LEVEL_LOW);
508
509 if (IS_ENABLED(CONFIG_PHYLIB))
510 phy_register_fixup_for_id("r8a7791-ether-ff:01",
511 koelsch_ksz8041_fixup);
512}
513
514static const char * const koelsch_boards_compat_dt[] __initconst = {
515 "renesas,koelsch",
516 NULL,
517};
518
519DT_MACHINE_START(KOELSCH_DT, "koelsch")
520 .smp = smp_ops(r8a7791_smp_ops),
521 .init_early = shmobile_init_delay,
522 .init_time = rcar_gen2_timer_init,
523 .init_machine = koelsch_init,
524 .init_late = shmobile_init_late,
525 .reserve = rcar_gen2_reserve,
526 .dt_compat = koelsch_boards_compat_dt,
527MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
index d9cdf9a97e23..2e82e44ab852 100644
--- a/arch/arm/mach-shmobile/board-kzm9g-reference.c
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -14,10 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */ 17 */
22 18
23#include <linux/delay.h> 19#include <linux/delay.h>
@@ -43,6 +39,13 @@ static void __init kzm_init(void)
43#endif 39#endif
44} 40}
45 41
42#define RESCNT2 IOMEM(0xe6188020)
43static void kzm9g_restart(enum reboot_mode mode, const char *cmd)
44{
45 /* Do soft power on reset */
46 writel((1 << 31), RESCNT2);
47}
48
46static const char *kzm9g_boards_compat_dt[] __initdata = { 49static const char *kzm9g_boards_compat_dt[] __initdata = {
47 "renesas,kzm9g-reference", 50 "renesas,kzm9g-reference",
48 NULL, 51 NULL,
@@ -54,5 +57,6 @@ DT_MACHINE_START(KZM9G_DT, "kzm9g-reference")
54 .init_early = shmobile_init_delay, 57 .init_early = shmobile_init_delay,
55 .init_machine = kzm_init, 58 .init_machine = kzm_init,
56 .init_late = shmobile_init_late, 59 .init_late = shmobile_init_late,
60 .restart = kzm9g_restart,
57 .dt_compat = kzm9g_boards_compat_dt, 61 .dt_compat = kzm9g_boards_compat_dt,
58MACHINE_END 62MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 77e36fa0b142..7c9b63bdde9f 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 14 */
19 15
20#include <linux/delay.h> 16#include <linux/delay.h>
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index bc4b48357dde..fa06bdba61df 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -12,100 +12,17 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20 16
21#include <linux/dma-mapping.h>
22#include <linux/init.h> 17#include <linux/init.h>
23#include <linux/of_platform.h> 18#include <linux/of_platform.h>
24#include <linux/platform_data/rcar-du.h>
25 19
26#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
27 21
28#include "clock.h"
29#include "common.h" 22#include "common.h"
30#include "irqs.h"
31#include "r8a7790.h" 23#include "r8a7790.h"
32#include "rcar-gen2.h" 24#include "rcar-gen2.h"
33 25
34/* DU */
35static struct rcar_du_encoder_data lager_du_encoders[] = {
36 {
37 .type = RCAR_DU_ENCODER_VGA,
38 .output = RCAR_DU_OUTPUT_DPAD0,
39 }, {
40 .type = RCAR_DU_ENCODER_NONE,
41 .output = RCAR_DU_OUTPUT_LVDS1,
42 .connector.lvds.panel = {
43 .width_mm = 210,
44 .height_mm = 158,
45 .mode = {
46 .pixelclock = 65000000,
47 .hactive = 1024,
48 .hfront_porch = 20,
49 .hback_porch = 160,
50 .hsync_len = 136,
51 .vactive = 768,
52 .vfront_porch = 3,
53 .vback_porch = 29,
54 .vsync_len = 6,
55 },
56 },
57 },
58};
59
60static struct rcar_du_platform_data lager_du_pdata = {
61 .encoders = lager_du_encoders,
62 .num_encoders = ARRAY_SIZE(lager_du_encoders),
63};
64
65static const struct resource du_resources[] __initconst = {
66 DEFINE_RES_MEM(0xfeb00000, 0x70000),
67 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
68 DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
69 DEFINE_RES_IRQ(gic_spi(256)),
70 DEFINE_RES_IRQ(gic_spi(268)),
71 DEFINE_RES_IRQ(gic_spi(269)),
72};
73
74static void __init lager_add_du_device(void)
75{
76 struct platform_device_info info = {
77 .name = "rcar-du-r8a7790",
78 .id = -1,
79 .res = du_resources,
80 .num_res = ARRAY_SIZE(du_resources),
81 .data = &lager_du_pdata,
82 .size_data = sizeof(lager_du_pdata),
83 .dma_mask = DMA_BIT_MASK(32),
84 };
85
86 platform_device_register_full(&info);
87}
88
89/*
90 * This is a really crude hack to provide clkdev support to platform
91 * devices until they get moved to DT.
92 */
93static const struct clk_name clk_names[] __initconst = {
94 { "du0", "du.0", "rcar-du-r8a7790" },
95 { "du1", "du.1", "rcar-du-r8a7790" },
96 { "du2", "du.2", "rcar-du-r8a7790" },
97 { "lvds0", "lvds.0", "rcar-du-r8a7790" },
98 { "lvds1", "lvds.1", "rcar-du-r8a7790" },
99};
100
101static void __init lager_add_standard_devices(void)
102{
103 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
104 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
105
106 lager_add_du_device();
107}
108
109static const char *lager_boards_compat_dt[] __initdata = { 26static const char *lager_boards_compat_dt[] __initdata = {
110 "renesas,lager", 27 "renesas,lager",
111 "renesas,lager-reference", 28 "renesas,lager-reference",
@@ -116,7 +33,6 @@ DT_MACHINE_START(LAGER_DT, "lager")
116 .smp = smp_ops(r8a7790_smp_ops), 33 .smp = smp_ops(r8a7790_smp_ops),
117 .init_early = shmobile_init_delay, 34 .init_early = shmobile_init_delay,
118 .init_time = rcar_gen2_timer_init, 35 .init_time = rcar_gen2_timer_init,
119 .init_machine = lager_add_standard_devices,
120 .init_late = shmobile_init_late, 36 .init_late = shmobile_init_late,
121 .reserve = rcar_gen2_reserve, 37 .reserve = rcar_gen2_reserve,
122 .dt_compat = lager_boards_compat_dt, 38 .dt_compat = lager_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 571327b1c942..b47262afb240 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21 17
22#include <linux/gpio.h> 18#include <linux/gpio.h>
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index ca5d34b92aa7..a1c1dfb6a67a 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -16,10 +16,6 @@
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details. 18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */ 19 */
24#include <linux/delay.h> 20#include <linux/delay.h>
25#include <linux/kernel.h> 21#include <linux/kernel.h>
@@ -1153,7 +1149,7 @@ static struct soc_camera_platform_info camera_info = {
1153 .format_name = "UYVY", 1149 .format_name = "UYVY",
1154 .format_depth = 16, 1150 .format_depth = 16,
1155 .format = { 1151 .format = {
1156 .code = V4L2_MBUS_FMT_UYVY8_2X8, 1152 .code = MEDIA_BUS_FMT_UYVY8_2X8,
1157 .colorspace = V4L2_COLORSPACE_SMPTE170M, 1153 .colorspace = V4L2_COLORSPACE_SMPTE170M,
1158 .field = V4L2_FIELD_NONE, 1154 .field = V4L2_FIELD_NONE,
1159 .width = 640, 1155 .width = 640,
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
index 38d9cdd26587..b15eb923263f 100644
--- a/arch/arm/mach-shmobile/board-marzen-reference.c
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21 17
22#include <linux/clk/shmobile.h> 18#include <linux/clk/shmobile.h>
@@ -26,7 +22,6 @@
26#include <asm/irq.h> 22#include <asm/irq.h>
27#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
28 24
29#include "clock.h"
30#include "common.h" 25#include "common.h"
31#include "irqs.h" 26#include "irqs.h"
32#include "r8a7779.h" 27#include "r8a7779.h"
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index ce33d7825c49..994dc7d86ae2 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21 17
22#include <linux/kernel.h> 18#include <linux/kernel.h>
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index c2330ea1802c..1cf44dc6d718 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20#include <linux/init.h> 16#include <linux/init.h>
21#include <linux/io.h> 17#include <linux/io.h>
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 19df9cb30495..9cac8247c72b 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20#include <linux/init.h> 16#include <linux/init.h>
21#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index 67980a08a601..e8510c35558c 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -17,10 +17,6 @@
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details. 19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 20 */
25 21
26/* 22/*
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index c51f9db3f66f..fa8ab2cc9187 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20#include <linux/bitops.h> 16#include <linux/bitops.h>
21#include <linux/init.h> 17#include <linux/init.h>
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index f62265200592..f9bbc5f0a9a1 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20#include <linux/init.h> 16#include <linux/init.h>
21#include <linux/io.h> 17#include <linux/io.h>
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
deleted file mode 100644
index 453b23129cfa..000000000000
--- a/arch/arm/mach-shmobile/clock-r8a7791.c
+++ /dev/null
@@ -1,342 +0,0 @@
1/*
2 * r8a7791 clock framework support
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 * Copyright (C) 2013 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 * 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#include <linux/init.h>
22#include <linux/io.h>
23#include <linux/kernel.h>
24#include <linux/sh_clk.h>
25#include <linux/clkdev.h>
26#include "clock.h"
27#include "common.h"
28#include "rcar-gen2.h"
29
30/*
31 * MD EXTAL PLL0 PLL1 PLL3
32 * 14 13 19 (MHz) *1 *1
33 *---------------------------------------------------
34 * 0 0 0 15 x 1 x172/2 x208/2 x106
35 * 0 0 1 15 x 1 x172/2 x208/2 x88
36 * 0 1 0 20 x 1 x130/2 x156/2 x80
37 * 0 1 1 20 x 1 x130/2 x156/2 x66
38 * 1 0 0 26 / 2 x200/2 x240/2 x122
39 * 1 0 1 26 / 2 x200/2 x240/2 x102
40 * 1 1 0 30 / 2 x172/2 x208/2 x106
41 * 1 1 1 30 / 2 x172/2 x208/2 x88
42 *
43 * *1 : Table 7.6 indicates VCO ouput (PLLx = VCO/2)
44 * see "p1 / 2" on R8A7791_CLOCK_ROOT() below
45 */
46
47#define CPG_BASE 0xe6150000
48#define CPG_LEN 0x1000
49
50#define SMSTPCR0 0xE6150130
51#define SMSTPCR1 0xE6150134
52#define SMSTPCR2 0xe6150138
53#define SMSTPCR3 0xE615013C
54#define SMSTPCR5 0xE6150144
55#define SMSTPCR7 0xe615014c
56#define SMSTPCR8 0xE6150990
57#define SMSTPCR9 0xE6150994
58#define SMSTPCR10 0xE6150998
59#define SMSTPCR11 0xE615099C
60
61#define MSTPSR1 IOMEM(0xe6150038)
62#define MSTPSR2 IOMEM(0xe6150040)
63#define MSTPSR3 IOMEM(0xe6150048)
64#define MSTPSR5 IOMEM(0xe615003c)
65#define MSTPSR7 IOMEM(0xe61501c4)
66#define MSTPSR8 IOMEM(0xe61509a0)
67#define MSTPSR9 IOMEM(0xe61509a4)
68#define MSTPSR11 IOMEM(0xe61509ac)
69
70#define SDCKCR 0xE6150074
71#define SD1CKCR 0xE6150078
72#define SD2CKCR 0xE615026c
73#define MMC0CKCR 0xE6150240
74#define MMC1CKCR 0xE6150244
75#define SSPCKCR 0xE6150248
76#define SSPRSCKCR 0xE615024C
77
78static struct clk_mapping cpg_mapping = {
79 .phys = CPG_BASE,
80 .len = CPG_LEN,
81};
82
83static struct clk extal_clk = {
84 /* .rate will be updated on r8a7791_clock_init() */
85 .mapping = &cpg_mapping,
86};
87
88static struct sh_clk_ops followparent_clk_ops = {
89 .recalc = followparent_recalc,
90};
91
92static struct clk main_clk = {
93 /* .parent will be set r8a73a4_clock_init */
94 .ops = &followparent_clk_ops,
95};
96
97/*
98 * clock ratio of these clock will be updated
99 * on r8a7791_clock_init()
100 */
101SH_FIXED_RATIO_CLK_SET(pll1_clk, main_clk, 1, 1);
102SH_FIXED_RATIO_CLK_SET(pll3_clk, main_clk, 1, 1);
103SH_FIXED_RATIO_CLK_SET(qspi_clk, pll1_clk, 1, 1);
104
105/* fixed ratio clock */
106SH_FIXED_RATIO_CLK_SET(extal_div2_clk, extal_clk, 1, 2);
107SH_FIXED_RATIO_CLK_SET(cp_clk, extal_clk, 1, 2);
108
109SH_FIXED_RATIO_CLK_SET(pll1_div2_clk, pll1_clk, 1, 2);
110SH_FIXED_RATIO_CLK_SET(hp_clk, pll1_clk, 1, 12);
111SH_FIXED_RATIO_CLK_SET(p_clk, pll1_clk, 1, 24);
112SH_FIXED_RATIO_CLK_SET(rclk_clk, pll1_clk, 1, (48 * 1024));
113SH_FIXED_RATIO_CLK_SET(mp_clk, pll1_div2_clk, 1, 15);
114SH_FIXED_RATIO_CLK_SET(zg_clk, pll1_clk, 1, 3);
115SH_FIXED_RATIO_CLK_SET(zx_clk, pll1_clk, 1, 3);
116SH_FIXED_RATIO_CLK_SET(zs_clk, pll1_clk, 1, 6);
117
118static struct clk *main_clks[] = {
119 &extal_clk,
120 &extal_div2_clk,
121 &main_clk,
122 &pll1_clk,
123 &pll1_div2_clk,
124 &pll3_clk,
125 &hp_clk,
126 &p_clk,
127 &qspi_clk,
128 &rclk_clk,
129 &mp_clk,
130 &cp_clk,
131 &zg_clk,
132 &zx_clk,
133 &zs_clk,
134};
135
136/* SDHI (DIV4) clock */
137static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, 24, 0, 36, 48, 10 };
138
139static struct clk_div_mult_table div4_div_mult_table = {
140 .divisors = divisors,
141 .nr_divisors = ARRAY_SIZE(divisors),
142};
143
144static struct clk_div4_table div4_table = {
145 .div_mult_table = &div4_div_mult_table,
146};
147
148enum {
149 DIV4_SDH, DIV4_SD0,
150 DIV4_NR
151};
152
153static struct clk div4_clks[DIV4_NR] = {
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, 0x1df0, CLK_ENABLE_ON_INIT),
156};
157
158/* DIV6 clocks */
159enum {
160 DIV6_SD1, DIV6_SD2,
161 DIV6_NR
162};
163
164static struct clk div6_clks[DIV6_NR] = {
165 [DIV6_SD1] = SH_CLK_DIV6(&pll1_div2_clk, SD1CKCR, 0),
166 [DIV6_SD2] = SH_CLK_DIV6(&pll1_div2_clk, SD2CKCR, 0),
167};
168
169/* MSTP */
170enum {
171 MSTP1108, MSTP1107, MSTP1106,
172 MSTP931, MSTP930, MSTP929, MSTP928, MSTP927, MSTP925,
173 MSTP917,
174 MSTP815, MSTP814,
175 MSTP813,
176 MSTP811, MSTP810, MSTP809,
177 MSTP726, MSTP724, MSTP723, MSTP721, MSTP720,
178 MSTP719, MSTP718, MSTP715, MSTP714,
179 MSTP522,
180 MSTP314, MSTP312, MSTP311,
181 MSTP216, MSTP207, MSTP206,
182 MSTP204, MSTP203, MSTP202,
183 MSTP124,
184 MSTP_NR
185};
186
187static struct clk mstp_clks[MSTP_NR] = {
188 [MSTP1108] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 8, MSTPSR11, 0), /* SCIFA5 */
189 [MSTP1107] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 7, MSTPSR11, 0), /* SCIFA4 */
190 [MSTP1106] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR11, 6, MSTPSR11, 0), /* SCIFA3 */
191 [MSTP931] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 31, MSTPSR9, 0), /* I2C0 */
192 [MSTP930] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 30, MSTPSR9, 0), /* I2C1 */
193 [MSTP929] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 29, MSTPSR9, 0), /* I2C2 */
194 [MSTP928] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 28, MSTPSR9, 0), /* I2C3 */
195 [MSTP927] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 27, MSTPSR9, 0), /* I2C4 */
196 [MSTP925] = SH_CLK_MSTP32_STS(&hp_clk, SMSTPCR9, 25, MSTPSR9, 0), /* I2C5 */
197 [MSTP917] = SH_CLK_MSTP32_STS(&qspi_clk, SMSTPCR9, 17, MSTPSR9, 0), /* QSPI */
198 [MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */
199 [MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */
200 [MSTP813] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR8, 13, MSTPSR8, 0), /* Ether */
201 [MSTP811] = SH_CLK_MSTP32_STS(&zg_clk, SMSTPCR8, 11, MSTPSR8, 0), /* VIN0 */
202 [MSTP810] = SH_CLK_MSTP32_STS(&zg_clk, SMSTPCR8, 10, MSTPSR8, 0), /* VIN1 */
203 [MSTP809] = SH_CLK_MSTP32_STS(&zg_clk, SMSTPCR8, 9, MSTPSR8, 0), /* VIN2 */
204 [MSTP726] = SH_CLK_MSTP32_STS(&zx_clk, SMSTPCR7, 26, MSTPSR7, 0), /* LVDS0 */
205 [MSTP724] = SH_CLK_MSTP32_STS(&zx_clk, SMSTPCR7, 24, MSTPSR7, 0), /* DU0 */
206 [MSTP723] = SH_CLK_MSTP32_STS(&zx_clk, SMSTPCR7, 23, MSTPSR7, 0), /* DU1 */
207 [MSTP721] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 21, MSTPSR7, 0), /* SCIF0 */
208 [MSTP720] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 20, MSTPSR7, 0), /* SCIF1 */
209 [MSTP719] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 19, MSTPSR7, 0), /* SCIF2 */
210 [MSTP718] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 18, MSTPSR7, 0), /* SCIF3 */
211 [MSTP715] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 15, MSTPSR7, 0), /* SCIF4 */
212 [MSTP714] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 14, MSTPSR7, 0), /* SCIF5 */
213 [MSTP522] = SH_CLK_MSTP32_STS(&extal_clk, SMSTPCR5, 22, MSTPSR5, 0), /* Thermal */
214 [MSTP314] = SH_CLK_MSTP32_STS(&div4_clks[DIV4_SD0], SMSTPCR3, 14, MSTPSR3, 0), /* SDHI0 */
215 [MSTP312] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD1], SMSTPCR3, 12, MSTPSR3, 0), /* SDHI1 */
216 [MSTP311] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD2], SMSTPCR3, 11, MSTPSR3, 0), /* SDHI2 */
217 [MSTP216] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 16, MSTPSR2, 0), /* SCIFB2 */
218 [MSTP207] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 7, MSTPSR2, 0), /* SCIFB1 */
219 [MSTP206] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 6, MSTPSR2, 0), /* SCIFB0 */
220 [MSTP204] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 4, MSTPSR2, 0), /* SCIFA0 */
221 [MSTP203] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 3, MSTPSR2, 0), /* SCIFA1 */
222 [MSTP202] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 2, MSTPSR2, 0), /* SCIFA2 */
223 [MSTP124] = SH_CLK_MSTP32_STS(&rclk_clk, SMSTPCR1, 24, MSTPSR1, 0), /* CMT0 */
224};
225
226static struct clk_lookup lookups[] = {
227
228 /* main clocks */
229 CLKDEV_CON_ID("extal", &extal_clk),
230 CLKDEV_CON_ID("extal_div2", &extal_div2_clk),
231 CLKDEV_CON_ID("main", &main_clk),
232 CLKDEV_CON_ID("pll1", &pll1_clk),
233 CLKDEV_CON_ID("pll1_div2", &pll1_div2_clk),
234 CLKDEV_CON_ID("pll3", &pll3_clk),
235 CLKDEV_CON_ID("zg", &zg_clk),
236 CLKDEV_CON_ID("zs", &zs_clk),
237 CLKDEV_CON_ID("hp", &hp_clk),
238 CLKDEV_CON_ID("p", &p_clk),
239 CLKDEV_CON_ID("qspi", &qspi_clk),
240 CLKDEV_CON_ID("rclk", &rclk_clk),
241 CLKDEV_CON_ID("mp", &mp_clk),
242 CLKDEV_CON_ID("cp", &cp_clk),
243 CLKDEV_CON_ID("peripheral_clk", &hp_clk),
244
245 /* MSTP */
246 CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7791", &mstp_clks[MSTP726]),
247 CLKDEV_ICK_ID("du.0", "rcar-du-r8a7791", &mstp_clks[MSTP724]),
248 CLKDEV_ICK_ID("du.1", "rcar-du-r8a7791", &mstp_clks[MSTP723]),
249 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
250 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
251 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), /* SCIFB0 */
252 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), /* SCIFB1 */
253 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), /* SCIFB2 */
254 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP202]), /* SCIFA2 */
255 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP721]), /* SCIF0 */
256 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]), /* SCIF1 */
257 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP719]), /* SCIF2 */
258 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP718]), /* SCIF3 */
259 CLKDEV_DEV_ID("sh-sci.10", &mstp_clks[MSTP715]), /* SCIF4 */
260 CLKDEV_DEV_ID("sh-sci.11", &mstp_clks[MSTP714]), /* SCIF5 */
261 CLKDEV_DEV_ID("sh-sci.12", &mstp_clks[MSTP1106]), /* SCIFA3 */
262 CLKDEV_DEV_ID("sh-sci.13", &mstp_clks[MSTP1107]), /* SCIFA4 */
263 CLKDEV_DEV_ID("sh-sci.14", &mstp_clks[MSTP1108]), /* SCIFA5 */
264 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
265 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP312]),
266 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]),
267 CLKDEV_ICK_ID("fck", "sh-cmt-48-gen2.0", &mstp_clks[MSTP124]),
268 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]),
269 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
270 CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]),
271 CLKDEV_DEV_ID("i2c-rcar_gen2.1", &mstp_clks[MSTP930]),
272 CLKDEV_DEV_ID("i2c-rcar_gen2.2", &mstp_clks[MSTP929]),
273 CLKDEV_DEV_ID("i2c-rcar_gen2.3", &mstp_clks[MSTP928]),
274 CLKDEV_DEV_ID("i2c-rcar_gen2.4", &mstp_clks[MSTP927]),
275 CLKDEV_DEV_ID("i2c-rcar_gen2.5", &mstp_clks[MSTP925]),
276 CLKDEV_DEV_ID("r8a7791-ether", &mstp_clks[MSTP813]), /* Ether */
277 CLKDEV_DEV_ID("r8a7791-vin.0", &mstp_clks[MSTP811]),
278 CLKDEV_DEV_ID("r8a7791-vin.1", &mstp_clks[MSTP810]),
279 CLKDEV_DEV_ID("r8a7791-vin.2", &mstp_clks[MSTP809]),
280 CLKDEV_DEV_ID("sata-r8a7791.0", &mstp_clks[MSTP815]),
281 CLKDEV_DEV_ID("sata-r8a7791.1", &mstp_clks[MSTP814]),
282};
283
284#define R8A7791_CLOCK_ROOT(e, m, p0, p1, p30, p31) \
285 extal_clk.rate = e * 1000 * 1000; \
286 main_clk.parent = m; \
287 SH_CLK_SET_RATIO(&pll1_clk_ratio, p1 / 2, 1); \
288 if (mode & MD(19)) \
289 SH_CLK_SET_RATIO(&pll3_clk_ratio, p31, 1); \
290 else \
291 SH_CLK_SET_RATIO(&pll3_clk_ratio, p30, 1)
292
293
294void __init r8a7791_clock_init(void)
295{
296 u32 mode = rcar_gen2_read_mode_pins();
297 int k, ret = 0;
298
299 switch (mode & (MD(14) | MD(13))) {
300 case 0:
301 R8A7791_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88);
302 break;
303 case MD(13):
304 R8A7791_CLOCK_ROOT(20, &extal_clk, 130, 156, 80, 66);
305 break;
306 case MD(14):
307 R8A7791_CLOCK_ROOT(26, &extal_div2_clk, 200, 240, 122, 102);
308 break;
309 case MD(13) | MD(14):
310 R8A7791_CLOCK_ROOT(30, &extal_div2_clk, 172, 208, 106, 88);
311 break;
312 }
313
314 if ((mode & (MD(3) | MD(2) | MD(1))) == MD(2))
315 SH_CLK_SET_RATIO(&qspi_clk_ratio, 1, 16);
316 else
317 SH_CLK_SET_RATIO(&qspi_clk_ratio, 1, 20);
318
319 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
320 ret = clk_register(main_clks[k]);
321
322 if (!ret)
323 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
324
325 if (!ret)
326 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
327
328 if (!ret)
329 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
330
331 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
332
333 if (!ret)
334 shmobile_clk_init();
335 else
336 goto epanic;
337
338 return;
339
340epanic:
341 panic("failed to setup r8a7791 clocks\n");
342}
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 7071676145c4..3bc92f46060e 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 14 */
19#include <linux/init.h> 15#include <linux/init.h>
20#include <linux/kernel.h> 16#include <linux/kernel.h>
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 02a6f45a0b9e..6b4c1f313cc9 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 14 */
19#include <linux/init.h> 15#include <linux/init.h>
20#include <linux/kernel.h> 16#include <linux/kernel.h>
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index 806f94038cc4..34f056fc3756 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -14,41 +14,13 @@
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 * 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 */ 17 */
18
19#include <linux/export.h>
22#include <linux/kernel.h> 20#include <linux/kernel.h>
23#include <linux/init.h> 21#include <linux/init.h>
24
25#ifdef CONFIG_COMMON_CLK
26#include <linux/clk.h>
27#include <linux/clkdev.h>
28#include "clock.h"
29
30void __init shmobile_clk_workaround(const struct clk_name *clks,
31 int nr_clks, bool enable)
32{
33 const struct clk_name *clkn;
34 struct clk *clk;
35 unsigned int i;
36
37 for (i = 0; i < nr_clks; ++i) {
38 clkn = clks + i;
39 clk = clk_get(NULL, clkn->clk);
40 if (!IS_ERR(clk)) {
41 clk_register_clkdev(clk, clkn->con_id, clkn->dev_id);
42 if (enable)
43 clk_prepare_enable(clk);
44 clk_put(clk);
45 }
46 }
47}
48
49#else /* CONFIG_COMMON_CLK */
50#include <linux/sh_clk.h> 22#include <linux/sh_clk.h>
51#include <linux/export.h> 23
52#include "clock.h" 24#include "clock.h"
53#include "common.h" 25#include "common.h"
54 26
@@ -84,5 +56,3 @@ void __clk_put(struct clk *clk)
84{ 56{
85} 57}
86EXPORT_SYMBOL(__clk_put); 58EXPORT_SYMBOL(__clk_put);
87
88#endif /* CONFIG_COMMON_CLK */
diff --git a/arch/arm/mach-shmobile/clock.h b/arch/arm/mach-shmobile/clock.h
index 31b6417463e6..cf3552ea1019 100644
--- a/arch/arm/mach-shmobile/clock.h
+++ b/arch/arm/mach-shmobile/clock.h
@@ -1,19 +1,6 @@
1#ifndef CLOCK_H 1#ifndef CLOCK_H
2#define CLOCK_H 2#define CLOCK_H
3 3
4#ifdef CONFIG_COMMON_CLK
5/* temporary clock configuration helper for platform devices */
6
7struct clk_name {
8 const char *clk;
9 const char *con_id;
10 const char *dev_id;
11};
12
13void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks,
14 bool enable);
15
16#else /* CONFIG_COMMON_CLK */
17/* legacy clock implementation */ 4/* legacy clock implementation */
18 5
19struct clk; 6struct clk;
@@ -52,5 +39,4 @@ do { \
52 (p)->div = d; \ 39 (p)->div = d; \
53} while (0) 40} while (0)
54 41
55#endif /* CONFIG_COMMON_CLK */
56#endif 42#endif
diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
index 72087c79ad7b..309025efd4cf 100644
--- a/arch/arm/mach-shmobile/common.h
+++ b/arch/arm/mach-shmobile/common.h
@@ -19,11 +19,6 @@ extern void shmobile_boot_scu(void);
19extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus); 19extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus);
20extern void shmobile_smp_scu_cpu_die(unsigned int cpu); 20extern void shmobile_smp_scu_cpu_die(unsigned int cpu);
21extern int shmobile_smp_scu_cpu_kill(unsigned int cpu); 21extern int shmobile_smp_scu_cpu_kill(unsigned int cpu);
22extern void shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus);
23extern int shmobile_smp_apmu_boot_secondary(unsigned int cpu,
24 struct task_struct *idle);
25extern void shmobile_smp_apmu_cpu_die(unsigned int cpu);
26extern int shmobile_smp_apmu_cpu_kill(unsigned int cpu);
27struct clk; 22struct clk;
28extern int shmobile_clk_init(void); 23extern int shmobile_clk_init(void);
29extern void shmobile_handle_irq_intc(struct pt_regs *); 24extern void shmobile_handle_irq_intc(struct pt_regs *);
diff --git a/arch/arm/mach-shmobile/console.c b/arch/arm/mach-shmobile/console.c
index f2e79f2376e1..e329ccbd0a67 100644
--- a/arch/arm/mach-shmobile/console.c
+++ b/arch/arm/mach-shmobile/console.c
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 14 */
19#include <linux/kernel.h> 15#include <linux/kernel.h>
20#include <linux/init.h> 16#include <linux/init.h>
diff --git a/arch/arm/mach-shmobile/headsmp-scu.S b/arch/arm/mach-shmobile/headsmp-scu.S
index f45dde701d7b..69df8bfac167 100644
--- a/arch/arm/mach-shmobile/headsmp-scu.S
+++ b/arch/arm/mach-shmobile/headsmp-scu.S
@@ -12,11 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 * MA 02111-1307 USA
20 */ 15 */
21 16
22#include <linux/linkage.h> 17#include <linux/linkage.h>
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index e2af00b1bd9d..1ccf49cb485f 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 14 */
19#include <linux/kernel.h> 15#include <linux/kernel.h>
20#include <linux/init.h> 16#include <linux/init.h>
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index 44457a94897b..9e3618028acc 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 14 */
19#include <linux/kernel.h> 15#include <linux/kernel.h>
20#include <linux/init.h> 16#include <linux/init.h>
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index 2c06810d3a70..f483b560b066 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * SMP support for SoCs with APMU 2 * SMP support for SoCs with APMU
3 * 3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
4 * Copyright (C) 2013 Magnus Damm 5 * Copyright (C) 2013 Magnus Damm
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -22,6 +23,7 @@
22#include <asm/smp_plat.h> 23#include <asm/smp_plat.h>
23#include <asm/suspend.h> 24#include <asm/suspend.h>
24#include "common.h" 25#include "common.h"
26#include "platsmp-apmu.h"
25 27
26static struct { 28static struct {
27 void __iomem *iomem; 29 void __iomem *iomem;
@@ -83,28 +85,15 @@ static void apmu_init_cpu(struct resource *res, int cpu, int bit)
83 pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res); 85 pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res);
84} 86}
85 87
86static struct { 88static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit),
87 struct resource iomem; 89 struct rcar_apmu_config *apmu_config, int num)
88 int cpus[4];
89} apmu_config[] = {
90 {
91 .iomem = DEFINE_RES_MEM(0xe6152000, 0x88),
92 .cpus = { 0, 1, 2, 3 },
93 },
94 {
95 .iomem = DEFINE_RES_MEM(0xe6151000, 0x88),
96 .cpus = { 0x100, 0x101, 0x102, 0x103 },
97 }
98};
99
100static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit))
101{ 90{
102 u32 id; 91 u32 id;
103 int k; 92 int k;
104 int bit, index; 93 int bit, index;
105 bool is_allowed; 94 bool is_allowed;
106 95
107 for (k = 0; k < ARRAY_SIZE(apmu_config); k++) { 96 for (k = 0; k < num; k++) {
108 /* only enable the cluster that includes the boot CPU */ 97 /* only enable the cluster that includes the boot CPU */
109 is_allowed = false; 98 is_allowed = false;
110 for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) { 99 for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) {
@@ -128,14 +117,16 @@ static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit))
128 } 117 }
129} 118}
130 119
131void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus) 120void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
121 struct rcar_apmu_config *apmu_config,
122 int num)
132{ 123{
133 /* install boot code shared by all CPUs */ 124 /* install boot code shared by all CPUs */
134 shmobile_boot_fn = virt_to_phys(shmobile_smp_boot); 125 shmobile_boot_fn = virt_to_phys(shmobile_smp_boot);
135 shmobile_boot_arg = MPIDR_HWID_BITMASK; 126 shmobile_boot_arg = MPIDR_HWID_BITMASK;
136 127
137 /* perform per-cpu setup */ 128 /* perform per-cpu setup */
138 apmu_parse_cfg(apmu_init_cpu); 129 apmu_parse_cfg(apmu_init_cpu, apmu_config, num);
139} 130}
140 131
141#ifdef CONFIG_SMP 132#ifdef CONFIG_SMP
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.h b/arch/arm/mach-shmobile/platsmp-apmu.h
new file mode 100644
index 000000000000..76512c9a2545
--- /dev/null
+++ b/arch/arm/mach-shmobile/platsmp-apmu.h
@@ -0,0 +1,32 @@
1/*
2 * rmobile apmu definition
3 *
4 * Copyright (C) 2014 Renesas Electronics 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 as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef PLATSMP_APMU_H
17#define PLATSMP_APMU_H
18
19struct rcar_apmu_config {
20 struct resource iomem;
21 int cpus[4];
22};
23
24extern void shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
25 struct rcar_apmu_config *apmu_config,
26 int num);
27extern int shmobile_smp_apmu_boot_secondary(unsigned int cpu,
28 struct task_struct *idle);
29extern void shmobile_smp_apmu_cpu_die(unsigned int cpu);
30extern int shmobile_smp_apmu_cpu_kill(unsigned int cpu);
31
32#endif /* PLATSMP_APMU_H */
diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
index e3f146448237..ac2eecd6f5ea 100644
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ b/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -14,10 +14,10 @@
14#include "pm-rmobile.h" 14#include "pm-rmobile.h"
15 15
16#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM) 16#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
17static int r8a7740_pd_a4s_suspend(void) 17static int r8a7740_pd_a3sm_suspend(void)
18{ 18{
19 /* 19 /*
20 * The A4S domain contains the CPU core and therefore it should 20 * The A3SM domain contains the CPU core and therefore it should
21 * only be turned off if the CPU is not in use. 21 * only be turned off if the CPU is not in use.
22 */ 22 */
23 return -EBUSY; 23 return -EBUSY;
@@ -32,29 +32,65 @@ static int r8a7740_pd_a3sp_suspend(void)
32 return console_suspend_enabled ? 0 : -EBUSY; 32 return console_suspend_enabled ? 0 : -EBUSY;
33} 33}
34 34
35static int r8a7740_pd_d4_suspend(void)
36{
37 /*
38 * The D4 domain contains the Coresight-ETM hardware block and
39 * therefore it should only be turned off if the debug module is
40 * not in use.
41 */
42 return -EBUSY;
43}
44
35static struct rmobile_pm_domain r8a7740_pm_domains[] = { 45static struct rmobile_pm_domain r8a7740_pm_domains[] = {
36 { 46 {
37 .genpd.name = "A4LC", 47 .genpd.name = "A4LC",
38 .bit_shift = 1, 48 .bit_shift = 1,
39 }, { 49 }, {
50 .genpd.name = "A4MP",
51 .bit_shift = 2,
52 }, {
53 .genpd.name = "D4",
54 .bit_shift = 3,
55 .gov = &pm_domain_always_on_gov,
56 .suspend = r8a7740_pd_d4_suspend,
57 }, {
58 .genpd.name = "A4R",
59 .bit_shift = 5,
60 }, {
61 .genpd.name = "A3RV",
62 .bit_shift = 6,
63 }, {
40 .genpd.name = "A4S", 64 .genpd.name = "A4S",
41 .bit_shift = 10, 65 .bit_shift = 10,
42 .gov = &pm_domain_always_on_gov,
43 .no_debug = true, 66 .no_debug = true,
44 .suspend = r8a7740_pd_a4s_suspend,
45 }, { 67 }, {
46 .genpd.name = "A3SP", 68 .genpd.name = "A3SP",
47 .bit_shift = 11, 69 .bit_shift = 11,
48 .gov = &pm_domain_always_on_gov, 70 .gov = &pm_domain_always_on_gov,
49 .no_debug = true, 71 .no_debug = true,
50 .suspend = r8a7740_pd_a3sp_suspend, 72 .suspend = r8a7740_pd_a3sp_suspend,
73 }, {
74 .genpd.name = "A3SM",
75 .bit_shift = 12,
76 .gov = &pm_domain_always_on_gov,
77 .suspend = r8a7740_pd_a3sm_suspend,
78 }, {
79 .genpd.name = "A3SG",
80 .bit_shift = 13,
81 }, {
82 .genpd.name = "A4SU",
83 .bit_shift = 20,
51 }, 84 },
52}; 85};
53 86
54void __init r8a7740_init_pm_domains(void) 87void __init r8a7740_init_pm_domains(void)
55{ 88{
56 rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains)); 89 rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
90 pm_genpd_add_subdomain_names("A4R", "A3RV");
57 pm_genpd_add_subdomain_names("A4S", "A3SP"); 91 pm_genpd_add_subdomain_names("A4S", "A3SP");
92 pm_genpd_add_subdomain_names("A4S", "A3SM");
93 pm_genpd_add_subdomain_names("A4S", "A3SG");
58} 94}
59#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */ 95#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
60 96
diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
index 82fe3d7f9662..44a74c4c5a01 100644
--- a/arch/arm/mach-shmobile/pm-r8a7779.c
+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -83,9 +83,8 @@ static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
83{ 83{
84 struct generic_pm_domain *genpd = &r8a7779_pd->genpd; 84 struct generic_pm_domain *genpd = &r8a7779_pd->genpd;
85 85
86 genpd->flags = GENPD_FLAG_PM_CLK;
86 pm_genpd_init(genpd, NULL, false); 87 pm_genpd_init(genpd, NULL, false);
87 genpd->dev_ops.stop = pm_clk_suspend;
88 genpd->dev_ops.start = pm_clk_resume;
89 genpd->dev_ops.active_wakeup = pd_active_wakeup; 88 genpd->dev_ops.active_wakeup = pd_active_wakeup;
90 genpd->power_off = pd_power_down; 89 genpd->power_off = pd_power_down;
91 genpd->power_on = pd_power_up; 90 genpd->power_on = pd_power_up;
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 717e6413d29c..6f7d56ecf969 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -106,9 +106,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
106 struct generic_pm_domain *genpd = &rmobile_pd->genpd; 106 struct generic_pm_domain *genpd = &rmobile_pd->genpd;
107 struct dev_power_governor *gov = rmobile_pd->gov; 107 struct dev_power_governor *gov = rmobile_pd->gov;
108 108
109 genpd->flags = GENPD_FLAG_PM_CLK;
109 pm_genpd_init(genpd, gov ? : &simple_qos_governor, false); 110 pm_genpd_init(genpd, gov ? : &simple_qos_governor, false);
110 genpd->dev_ops.stop = pm_clk_suspend;
111 genpd->dev_ops.start = pm_clk_resume;
112 genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; 111 genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup;
113 genpd->power_off = rmobile_pd_power_down; 112 genpd->power_off = rmobile_pd_power_down;
114 genpd->power_on = rmobile_pd_power_up; 113 genpd->power_on = rmobile_pd_power_up;
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 7e5c2676c489..0e37da654ed5 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -423,7 +423,6 @@ static struct cpuidle_driver sh7372_cpuidle_driver = {
423 .desc = "Core Standby Mode", 423 .desc = "Core Standby Mode",
424 .exit_latency = 10, 424 .exit_latency = 10,
425 .target_residency = 20 + 10, 425 .target_residency = 20 + 10,
426 .flags = CPUIDLE_FLAG_TIME_VALID,
427 .enter = sh7372_enter_core_standby, 426 .enter = sh7372_enter_core_standby,
428 }, 427 },
429 .states[2] = { 428 .states[2] = {
@@ -431,7 +430,6 @@ static struct cpuidle_driver sh7372_cpuidle_driver = {
431 .desc = "A3SM PLL ON", 430 .desc = "A3SM PLL ON",
432 .exit_latency = 20, 431 .exit_latency = 20,
433 .target_residency = 30 + 20, 432 .target_residency = 30 + 20,
434 .flags = CPUIDLE_FLAG_TIME_VALID,
435 .enter = sh7372_enter_a3sm_pll_on, 433 .enter = sh7372_enter_a3sm_pll_on,
436 }, 434 },
437 .states[3] = { 435 .states[3] = {
@@ -439,7 +437,6 @@ static struct cpuidle_driver sh7372_cpuidle_driver = {
439 .desc = "A3SM PLL OFF", 437 .desc = "A3SM PLL OFF",
440 .exit_latency = 120, 438 .exit_latency = 120,
441 .target_residency = 30 + 120, 439 .target_residency = 30 + 120,
442 .flags = CPUIDLE_FLAG_TIME_VALID,
443 .enter = sh7372_enter_a3sm_pll_off, 440 .enter = sh7372_enter_a3sm_pll_off,
444 }, 441 },
445 .states[4] = { 442 .states[4] = {
@@ -447,7 +444,6 @@ static struct cpuidle_driver sh7372_cpuidle_driver = {
447 .desc = "A4S PLL OFF", 444 .desc = "A4S PLL OFF",
448 .exit_latency = 240, 445 .exit_latency = 240,
449 .target_residency = 30 + 240, 446 .target_residency = 30 + 240,
450 .flags = CPUIDLE_FLAG_TIME_VALID,
451 .enter = sh7372_enter_a4s, 447 .enter = sh7372_enter_a4s,
452 .disabled = true, 448 .disabled = true,
453 }, 449 },
diff --git a/arch/arm/mach-shmobile/r8a73a4.h b/arch/arm/mach-shmobile/r8a73a4.h
index 5fafd6fcedf7..70dcd847a86e 100644
--- a/arch/arm/mach-shmobile/r8a73a4.h
+++ b/arch/arm/mach-shmobile/r8a73a4.h
@@ -11,7 +11,6 @@ enum {
11}; 11};
12 12
13void r8a73a4_add_standard_devices(void); 13void r8a73a4_add_standard_devices(void);
14void r8a73a4_add_dt_devices(void);
15void r8a73a4_clock_init(void); 14void r8a73a4_clock_init(void);
16void r8a73a4_pinmux_init(void); 15void r8a73a4_pinmux_init(void);
17 16
diff --git a/arch/arm/mach-shmobile/r8a7740.h b/arch/arm/mach-shmobile/r8a7740.h
index f369b4b0863d..ca7805ad7ea3 100644
--- a/arch/arm/mach-shmobile/r8a7740.h
+++ b/arch/arm/mach-shmobile/r8a7740.h
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 13 */
18 14
19#ifndef __ASM_R8A7740_H__ 15#ifndef __ASM_R8A7740_H__
diff --git a/arch/arm/mach-shmobile/r8a7778.h b/arch/arm/mach-shmobile/r8a7778.h
index f4076a50e970..f64fedb1f2cc 100644
--- a/arch/arm/mach-shmobile/r8a7778.h
+++ b/arch/arm/mach-shmobile/r8a7778.h
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 14 */
19#ifndef __ASM_R8A7778_H__ 15#ifndef __ASM_R8A7778_H__
20#define __ASM_R8A7778_H__ 16#define __ASM_R8A7778_H__
@@ -71,7 +67,6 @@ extern void r8a7778_add_standard_devices_dt(void);
71extern void r8a7778_add_dt_devices(void); 67extern void r8a7778_add_dt_devices(void);
72 68
73extern void r8a7778_init_late(void); 69extern void r8a7778_init_late(void);
74extern void r8a7778_init_delay(void);
75extern void r8a7778_init_irq_dt(void); 70extern void r8a7778_init_irq_dt(void);
76extern void r8a7778_clock_init(void); 71extern void r8a7778_clock_init(void);
77extern void r8a7778_init_irq_extpin(int irlm); 72extern void r8a7778_init_irq_extpin(int irlm);
diff --git a/arch/arm/mach-shmobile/r8a7791.h b/arch/arm/mach-shmobile/r8a7791.h
index c1bf7abefa5a..6cf11eb69d10 100644
--- a/arch/arm/mach-shmobile/r8a7791.h
+++ b/arch/arm/mach-shmobile/r8a7791.h
@@ -1,9 +1,6 @@
1#ifndef __ASM_R8A7791_H__ 1#ifndef __ASM_R8A7791_H__
2#define __ASM_R8A7791_H__ 2#define __ASM_R8A7791_H__
3 3
4void r8a7791_add_standard_devices(void);
5void r8a7791_clock_init(void);
6void r8a7791_pinmux_init(void);
7void r8a7791_pm_init(void); 4void r8a7791_pm_init(void);
8extern struct smp_operations r8a7791_smp_ops; 5extern struct smp_operations r8a7791_smp_ops;
9 6
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index b06a9e8f59a5..aad97be9cbe1 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 14 */
19#include <linux/kernel.h> 15#include <linux/kernel.h>
20#include <linux/init.h> 16#include <linux/init.h>
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
index 4122104359f9..171174777b6f 100644
--- a/arch/arm/mach-shmobile/setup-r7s72100.c
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20 16
21#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 53f40b70680d..c27682291cbf 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20#include <linux/irq.h> 16#include <linux/irq.h>
21#include <linux/kernel.h> 17#include <linux/kernel.h>
@@ -180,18 +176,13 @@ static struct resource cmt1_resources[] = {
180 DEFINE_RES_IRQ(gic_spi(120)), 176 DEFINE_RES_IRQ(gic_spi(120)),
181}; 177};
182 178
183#define r8a7790_register_cmt(idx) \ 179#define r8a73a4_register_cmt(idx) \
184 platform_device_register_resndata(NULL, "sh-cmt-48-gen2", \ 180 platform_device_register_resndata(NULL, "sh-cmt-48-gen2", \
185 idx, cmt##idx##_resources, \ 181 idx, cmt##idx##_resources, \
186 ARRAY_SIZE(cmt##idx##_resources), \ 182 ARRAY_SIZE(cmt##idx##_resources), \
187 &cmt##idx##_platform_data, \ 183 &cmt##idx##_platform_data, \
188 sizeof(struct sh_timer_config)) 184 sizeof(struct sh_timer_config))
189 185
190void __init r8a73a4_add_dt_devices(void)
191{
192 r8a7790_register_cmt(1);
193}
194
195/* DMA */ 186/* DMA */
196static const struct sh_dmae_slave_config dma_slaves[] = { 187static const struct sh_dmae_slave_config dma_slaves[] = {
197 { 188 {
@@ -282,7 +273,7 @@ static struct resource dma_resources[] = {
282 273
283void __init r8a73a4_add_standard_devices(void) 274void __init r8a73a4_add_standard_devices(void)
284{ 275{
285 r8a73a4_add_dt_devices(); 276 r8a73a4_register_cmt(1);
286 r8a73a4_register_scif(0); 277 r8a73a4_register_scif(0);
287 r8a73a4_register_scif(1); 278 r8a73a4_register_scif(1);
288 r8a73a4_register_scif(2); 279 r8a73a4_register_scif(2);
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 8894e1b7ab0e..79ad93dfdae4 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20#include <linux/delay.h> 16#include <linux/delay.h>
21#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
@@ -71,6 +67,7 @@ static struct map_desc r8a7740_io_desc[] __initdata = {
71 67
72void __init r8a7740_map_io(void) 68void __init r8a7740_map_io(void)
73{ 69{
70 debug_ll_io_init();
74 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); 71 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
75} 72}
76 73
@@ -746,6 +743,12 @@ static void r8a7740_i2c_workaround(struct platform_device *pdev)
746void __init r8a7740_add_standard_devices(void) 743void __init r8a7740_add_standard_devices(void)
747{ 744{
748 static struct pm_domain_device domain_devices[] __initdata = { 745 static struct pm_domain_device domain_devices[] __initdata = {
746 { "A4R", &tmu0_device },
747 { "A4R", &i2c0_device },
748 { "A4S", &irqpin0_device },
749 { "A4S", &irqpin1_device },
750 { "A4S", &irqpin2_device },
751 { "A4S", &irqpin3_device },
749 { "A3SP", &scif0_device }, 752 { "A3SP", &scif0_device },
750 { "A3SP", &scif1_device }, 753 { "A3SP", &scif1_device },
751 { "A3SP", &scif2_device }, 754 { "A3SP", &scif2_device },
@@ -756,6 +759,11 @@ void __init r8a7740_add_standard_devices(void)
756 { "A3SP", &scif7_device }, 759 { "A3SP", &scif7_device },
757 { "A3SP", &scif8_device }, 760 { "A3SP", &scif8_device },
758 { "A3SP", &i2c1_device }, 761 { "A3SP", &i2c1_device },
762 { "A3SP", &ipmmu_device },
763 { "A3SP", &dma0_device },
764 { "A3SP", &dma1_device },
765 { "A3SP", &dma2_device },
766 { "A3SP", &usb_dma_device },
759 }; 767 };
760 768
761 /* I2C work-around */ 769 /* I2C work-around */
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 85fe016d6a87..170bd146ba17 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21 17
22#include <linux/kernel.h> 18#include <linux/kernel.h>
@@ -292,8 +288,6 @@ void __init r8a7778_add_dt_devices(void)
292 l2x0_init(base, 0x00400000, 0xc20f0fff); 288 l2x0_init(base, 0x00400000, 0xc20f0fff);
293 } 289 }
294#endif 290#endif
295
296 r8a7778_register_tmu(0);
297} 291}
298 292
299/* HPB-DMA */ 293/* HPB-DMA */
@@ -501,6 +495,7 @@ static void __init r8a7778_register_hpb_dmae(void)
501void __init r8a7778_add_standard_devices(void) 495void __init r8a7778_add_standard_devices(void)
502{ 496{
503 r8a7778_add_dt_devices(); 497 r8a7778_add_dt_devices();
498 r8a7778_register_tmu(0);
504 r8a7778_register_scif(0); 499 r8a7778_register_scif(0);
505 r8a7778_register_scif(1); 500 r8a7778_register_scif(1);
506 r8a7778_register_scif(2); 501 r8a7778_register_scif(2);
@@ -572,11 +567,6 @@ void __init r8a7778_init_irq_extpin(int irlm)
572 &irqpin_platform_data, sizeof(irqpin_platform_data)); 567 &irqpin_platform_data, sizeof(irqpin_platform_data));
573} 568}
574 569
575void __init r8a7778_init_delay(void)
576{
577 shmobile_init_delay();
578}
579
580#ifdef CONFIG_USE_OF 570#ifdef CONFIG_USE_OF
581#define INT2SMSKCR0 0x82288 /* 0xfe782288 */ 571#define INT2SMSKCR0 0x82288 /* 0xfe782288 */
582#define INT2SMSKCR1 0x8228c /* 0xfe78228c */ 572#define INT2SMSKCR1 0x8228c /* 0xfe78228c */
@@ -608,7 +598,7 @@ static const char *r8a7778_compat_dt[] __initdata = {
608}; 598};
609 599
610DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)") 600DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)")
611 .init_early = r8a7778_init_delay, 601 .init_early = shmobile_init_delay,
612 .init_irq = r8a7778_init_irq_dt, 602 .init_irq = r8a7778_init_irq_dt,
613 .init_late = shmobile_init_late, 603 .init_late = shmobile_init_late,
614 .dt_compat = r8a7778_compat_dt, 604 .dt_compat = r8a7778_compat_dt,
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 136078ab9407..6156d172cf31 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21#include <linux/kernel.h> 17#include <linux/kernel.h>
22#include <linux/init.h> 18#include <linux/init.h>
@@ -52,14 +48,14 @@
52#include "r8a7779.h" 48#include "r8a7779.h"
53 49
54static struct map_desc r8a7779_io_desc[] __initdata = { 50static struct map_desc r8a7779_io_desc[] __initdata = {
55 /* 2M entity map for 0xf0000000 (MPCORE) */ 51 /* 2M identity mapping for 0xf0000000 (MPCORE) */
56 { 52 {
57 .virtual = 0xf0000000, 53 .virtual = 0xf0000000,
58 .pfn = __phys_to_pfn(0xf0000000), 54 .pfn = __phys_to_pfn(0xf0000000),
59 .length = SZ_2M, 55 .length = SZ_2M,
60 .type = MT_DEVICE_NONSHARED 56 .type = MT_DEVICE_NONSHARED
61 }, 57 },
62 /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */ 58 /* 16M identity mapping for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */
63 { 59 {
64 .virtual = 0xfe000000, 60 .virtual = 0xfe000000,
65 .pfn = __phys_to_pfn(0xfe000000), 61 .pfn = __phys_to_pfn(0xfe000000),
@@ -70,6 +66,7 @@ static struct map_desc r8a7779_io_desc[] __initdata = {
70 66
71void __init r8a7779_map_io(void) 67void __init r8a7779_map_io(void)
72{ 68{
69 debug_ll_io_init();
73 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc)); 70 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
74} 71}
75 72
@@ -683,7 +680,7 @@ void __init r8a7779_add_early_devices(void)
683 680
684 /* Early serial console setup is not included here due to 681 /* Early serial console setup is not included here due to
685 * memory map collisions. The SCIF serial ports in r8a7779 682 * memory map collisions. The SCIF serial ports in r8a7779
686 * are difficult to entity map 1:1 due to collision with the 683 * are difficult to identity map 1:1 due to collision with the
687 * virtual memory range used by the coherent DMA code on ARM. 684 * virtual memory range used by the coherent DMA code on ARM.
688 * 685 *
689 * Anyone wanting to debug early can remove UPF_IOREMAP from 686 * Anyone wanting to debug early can remove UPF_IOREMAP from
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 877fdeb985d0..ec7d97dca4de 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20 16
21#include <linux/irq.h> 17#include <linux/irq.h>
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index 35d78639244f..ef8eb3af586d 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -13,198 +13,16 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21 17
22#include <linux/irq.h> 18#include <linux/init.h>
23#include <linux/kernel.h>
24#include <linux/of_platform.h>
25#include <linux/platform_data/gpio-rcar.h>
26#include <linux/platform_data/irq-renesas-irqc.h>
27#include <linux/serial_sci.h>
28#include <linux/sh_timer.h>
29 19
30#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
31 21
32#include "common.h" 22#include "common.h"
33#include "irqs.h"
34#include "r8a7791.h" 23#include "r8a7791.h"
35#include "rcar-gen2.h" 24#include "rcar-gen2.h"
36 25
37static const struct resource pfc_resources[] __initconst = {
38 DEFINE_RES_MEM(0xe6060000, 0x250),
39};
40
41#define r8a7791_register_pfc() \
42 platform_device_register_simple("pfc-r8a7791", -1, pfc_resources, \
43 ARRAY_SIZE(pfc_resources))
44
45#define R8A7791_GPIO(idx, base, nr) \
46static const struct resource r8a7791_gpio##idx##_resources[] __initconst = { \
47 DEFINE_RES_MEM((base), 0x50), \
48 DEFINE_RES_IRQ(gic_spi(4 + (idx))), \
49}; \
50 \
51static const struct gpio_rcar_config \
52r8a7791_gpio##idx##_platform_data __initconst = { \
53 .gpio_base = 32 * (idx), \
54 .irq_base = 0, \
55 .number_of_pins = (nr), \
56 .pctl_name = "pfc-r8a7791", \
57 .has_both_edge_trigger = 1, \
58}; \
59
60R8A7791_GPIO(0, 0xe6050000, 32);
61R8A7791_GPIO(1, 0xe6051000, 32);
62R8A7791_GPIO(2, 0xe6052000, 32);
63R8A7791_GPIO(3, 0xe6053000, 32);
64R8A7791_GPIO(4, 0xe6054000, 32);
65R8A7791_GPIO(5, 0xe6055000, 32);
66R8A7791_GPIO(6, 0xe6055400, 32);
67R8A7791_GPIO(7, 0xe6055800, 26);
68
69#define r8a7791_register_gpio(idx) \
70 platform_device_register_resndata(NULL, "gpio_rcar", idx, \
71 r8a7791_gpio##idx##_resources, \
72 ARRAY_SIZE(r8a7791_gpio##idx##_resources), \
73 &r8a7791_gpio##idx##_platform_data, \
74 sizeof(r8a7791_gpio##idx##_platform_data))
75
76void __init r8a7791_pinmux_init(void)
77{
78 r8a7791_register_pfc();
79 r8a7791_register_gpio(0);
80 r8a7791_register_gpio(1);
81 r8a7791_register_gpio(2);
82 r8a7791_register_gpio(3);
83 r8a7791_register_gpio(4);
84 r8a7791_register_gpio(5);
85 r8a7791_register_gpio(6);
86 r8a7791_register_gpio(7);
87}
88
89#define __R8A7791_SCIF(scif_type, index, baseaddr, irq) \
90static struct plat_sci_port scif##index##_platform_data = { \
91 .type = scif_type, \
92 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
93 .scscr = SCSCR_RE | SCSCR_TE, \
94}; \
95 \
96static struct resource scif##index##_resources[] = { \
97 DEFINE_RES_MEM(baseaddr, 0x100), \
98 DEFINE_RES_IRQ(irq), \
99}
100
101#define R8A7791_SCIF(index, baseaddr, irq) \
102 __R8A7791_SCIF(PORT_SCIF, index, baseaddr, irq)
103
104#define R8A7791_SCIFA(index, baseaddr, irq) \
105 __R8A7791_SCIF(PORT_SCIFA, index, baseaddr, irq)
106
107#define R8A7791_SCIFB(index, baseaddr, irq) \
108 __R8A7791_SCIF(PORT_SCIFB, index, baseaddr, irq)
109
110R8A7791_SCIFA(0, 0xe6c40000, gic_spi(144)); /* SCIFA0 */
111R8A7791_SCIFA(1, 0xe6c50000, gic_spi(145)); /* SCIFA1 */
112R8A7791_SCIFB(2, 0xe6c20000, gic_spi(148)); /* SCIFB0 */
113R8A7791_SCIFB(3, 0xe6c30000, gic_spi(149)); /* SCIFB1 */
114R8A7791_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
115R8A7791_SCIFA(5, 0xe6c60000, gic_spi(151)); /* SCIFA2 */
116R8A7791_SCIF(6, 0xe6e60000, gic_spi(152)); /* SCIF0 */
117R8A7791_SCIF(7, 0xe6e68000, gic_spi(153)); /* SCIF1 */
118R8A7791_SCIF(8, 0xe6e58000, gic_spi(22)); /* SCIF2 */
119R8A7791_SCIF(9, 0xe6ea8000, gic_spi(23)); /* SCIF3 */
120R8A7791_SCIF(10, 0xe6ee0000, gic_spi(24)); /* SCIF4 */
121R8A7791_SCIF(11, 0xe6ee8000, gic_spi(25)); /* SCIF5 */
122R8A7791_SCIFA(12, 0xe6c70000, gic_spi(29)); /* SCIFA3 */
123R8A7791_SCIFA(13, 0xe6c78000, gic_spi(30)); /* SCIFA4 */
124R8A7791_SCIFA(14, 0xe6c80000, gic_spi(31)); /* SCIFA5 */
125
126#define r8a7791_register_scif(index) \
127 platform_device_register_resndata(NULL, "sh-sci", index, \
128 scif##index##_resources, \
129 ARRAY_SIZE(scif##index##_resources), \
130 &scif##index##_platform_data, \
131 sizeof(scif##index##_platform_data))
132
133static struct sh_timer_config cmt0_platform_data = {
134 .channels_mask = 0x60,
135};
136
137static struct resource cmt0_resources[] = {
138 DEFINE_RES_MEM(0xffca0000, 0x1004),
139 DEFINE_RES_IRQ(gic_spi(142)),
140};
141
142#define r8a7791_register_cmt(idx) \
143 platform_device_register_resndata(NULL, "sh-cmt-48-gen2", \
144 idx, cmt##idx##_resources, \
145 ARRAY_SIZE(cmt##idx##_resources), \
146 &cmt##idx##_platform_data, \
147 sizeof(struct sh_timer_config))
148
149static struct renesas_irqc_config irqc0_data = {
150 .irq_base = irq_pin(0), /* IRQ0 -> IRQ9 */
151};
152
153static struct resource irqc0_resources[] = {
154 DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */
155 DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */
156 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */
157 DEFINE_RES_IRQ(gic_spi(2)), /* IRQ2 */
158 DEFINE_RES_IRQ(gic_spi(3)), /* IRQ3 */
159 DEFINE_RES_IRQ(gic_spi(12)), /* IRQ4 */
160 DEFINE_RES_IRQ(gic_spi(13)), /* IRQ5 */
161 DEFINE_RES_IRQ(gic_spi(14)), /* IRQ6 */
162 DEFINE_RES_IRQ(gic_spi(15)), /* IRQ7 */
163 DEFINE_RES_IRQ(gic_spi(16)), /* IRQ8 */
164 DEFINE_RES_IRQ(gic_spi(17)), /* IRQ9 */
165};
166
167#define r8a7791_register_irqc(idx) \
168 platform_device_register_resndata(NULL, "renesas_irqc", \
169 idx, irqc##idx##_resources, \
170 ARRAY_SIZE(irqc##idx##_resources), \
171 &irqc##idx##_data, \
172 sizeof(struct renesas_irqc_config))
173
174static const struct resource thermal_resources[] __initconst = {
175 DEFINE_RES_MEM(0xe61f0000, 0x14),
176 DEFINE_RES_MEM(0xe61f0100, 0x38),
177 DEFINE_RES_IRQ(gic_spi(69)),
178};
179
180#define r8a7791_register_thermal() \
181 platform_device_register_simple("rcar_thermal", -1, \
182 thermal_resources, \
183 ARRAY_SIZE(thermal_resources))
184
185void __init r8a7791_add_standard_devices(void)
186{
187 r8a7791_register_scif(0);
188 r8a7791_register_scif(1);
189 r8a7791_register_scif(2);
190 r8a7791_register_scif(3);
191 r8a7791_register_scif(4);
192 r8a7791_register_scif(5);
193 r8a7791_register_scif(6);
194 r8a7791_register_scif(7);
195 r8a7791_register_scif(8);
196 r8a7791_register_scif(9);
197 r8a7791_register_scif(10);
198 r8a7791_register_scif(11);
199 r8a7791_register_scif(12);
200 r8a7791_register_scif(13);
201 r8a7791_register_scif(14);
202 r8a7791_register_cmt(0);
203 r8a7791_register_irqc(0);
204 r8a7791_register_thermal();
205}
206
207#ifdef CONFIG_USE_OF
208static const char *r8a7791_boards_compat_dt[] __initdata = { 26static const char *r8a7791_boards_compat_dt[] __initdata = {
209 "renesas,r8a7791", 27 "renesas,r8a7791",
210 NULL, 28 NULL,
@@ -218,4 +36,3 @@ DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
218 .reserve = rcar_gen2_reserve, 36 .reserve = rcar_gen2_reserve,
219 .dt_compat = r8a7791_boards_compat_dt, 37 .dt_compat = r8a7791_boards_compat_dt,
220MACHINE_END 38MACHINE_END
221#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 42d5b4308923..3dd6edd9bd1d 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2013 Renesas Solutions Corp. 4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm 5 * Copyright (C) 2013 Magnus Damm
6 * Copyright (C) 2014 Ulrich Hecht
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -12,10 +13,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 15 * 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 */ 16 */
20 17
21#include <linux/clk/shmobile.h> 18#include <linux/clk/shmobile.h>
@@ -24,6 +21,7 @@
24#include <linux/dma-contiguous.h> 21#include <linux/dma-contiguous.h>
25#include <linux/io.h> 22#include <linux/io.h>
26#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of.h>
27#include <linux/of_fdt.h> 25#include <linux/of_fdt.h>
28#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
29#include "common.h" 27#include "common.h"
@@ -54,37 +52,61 @@ void __init rcar_gen2_timer_init(void)
54{ 52{
55#if defined(CONFIG_ARM_ARCH_TIMER) || defined(CONFIG_COMMON_CLK) 53#if defined(CONFIG_ARM_ARCH_TIMER) || defined(CONFIG_COMMON_CLK)
56 u32 mode = rcar_gen2_read_mode_pins(); 54 u32 mode = rcar_gen2_read_mode_pins();
55 bool is_e2 = (bool)of_find_compatible_node(NULL, NULL,
56 "renesas,r8a7794");
57#endif 57#endif
58#ifdef CONFIG_ARM_ARCH_TIMER 58#ifdef CONFIG_ARM_ARCH_TIMER
59 void __iomem *base; 59 void __iomem *base;
60 int extal_mhz = 0; 60 int extal_mhz = 0;
61 u32 freq; 61 u32 freq;
62 62
63 /* At Linux boot time the r8a7790 arch timer comes up 63 if (is_e2) {
64 * with the counter disabled. Moreover, it may also report 64 freq = 260000000 / 8; /* ZS / 8 */
65 * a potentially incorrect fixed 13 MHz frequency. To be 65 /* CNTVOFF has to be initialized either from non-secure
66 * correct these registers need to be updated to use the 66 * Hypervisor mode or secure Monitor mode with SCR.NS==1.
67 * frequency EXTAL / 2 which can be determined by the MD pins. 67 * If TrustZone is enabled then it should be handled by the
68 */ 68 * secure code.
69 69 */
70 switch (mode & (MD(14) | MD(13))) { 70 asm volatile(
71 case 0: 71 " cps 0x16\n"
72 extal_mhz = 15; 72 " mrc p15, 0, r1, c1, c1, 0\n"
73 break; 73 " orr r0, r1, #1\n"
74 case MD(13): 74 " mcr p15, 0, r0, c1, c1, 0\n"
75 extal_mhz = 20; 75 " isb\n"
76 break; 76 " mov r0, #0\n"
77 case MD(14): 77 " mcrr p15, 4, r0, r0, c14\n"
78 extal_mhz = 26; 78 " isb\n"
79 break; 79 " mcr p15, 0, r1, c1, c1, 0\n"
80 case MD(13) | MD(14): 80 " isb\n"
81 extal_mhz = 30; 81 " cps 0x13\n"
82 break; 82 : : : "r0", "r1");
83 } else {
84 /* At Linux boot time the r8a7790 arch timer comes up
85 * with the counter disabled. Moreover, it may also report
86 * a potentially incorrect fixed 13 MHz frequency. To be
87 * correct these registers need to be updated to use the
88 * frequency EXTAL / 2 which can be determined by the MD pins.
89 */
90
91 switch (mode & (MD(14) | MD(13))) {
92 case 0:
93 extal_mhz = 15;
94 break;
95 case MD(13):
96 extal_mhz = 20;
97 break;
98 case MD(14):
99 extal_mhz = 26;
100 break;
101 case MD(13) | MD(14):
102 extal_mhz = 30;
103 break;
104 }
105
106 /* The arch timer frequency equals EXTAL / 2 */
107 freq = extal_mhz * (1000000 / 2);
83 } 108 }
84 109
85 /* The arch timer frequency equals EXTAL / 2 */
86 freq = extal_mhz * (1000000 / 2);
87
88 /* Remap "armgcnt address map" space */ 110 /* Remap "armgcnt address map" space */
89 base = ioremap(0xe6080000, PAGE_SIZE); 111 base = ioremap(0xe6080000, PAGE_SIZE);
90 112
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index d646c8d12423..458a2cfad417 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20#include <linux/kernel.h> 16#include <linux/kernel.h>
21#include <linux/init.h> 17#include <linux/init.h>
@@ -47,7 +43,7 @@
47#include "sh7372.h" 43#include "sh7372.h"
48 44
49static struct map_desc sh7372_io_desc[] __initdata = { 45static struct map_desc sh7372_io_desc[] __initdata = {
50 /* create a 1:1 entity map for 0xe6xxxxxx 46 /* create a 1:1 identity mapping for 0xe6xxxxxx
51 * used by CPGA, INTC and PFC. 47 * used by CPGA, INTC and PFC.
52 */ 48 */
53 { 49 {
@@ -60,6 +56,7 @@ static struct map_desc sh7372_io_desc[] __initdata = {
60 56
61void __init sh7372_map_io(void) 57void __init sh7372_map_io(void)
62{ 58{
59 debug_ll_io_init();
63 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc)); 60 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
64} 61}
65 62
@@ -1012,6 +1009,7 @@ DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1012 .init_irq = sh7372_init_irq, 1009 .init_irq = sh7372_init_irq,
1013 .handle_irq = shmobile_handle_irq_intc, 1010 .handle_irq = shmobile_handle_irq_intc,
1014 .init_machine = sh7372_add_standard_devices_dt, 1011 .init_machine = sh7372_add_standard_devices_dt,
1012 .init_late = shmobile_init_late,
1015 .dt_compat = sh7372_boards_compat_dt, 1013 .dt_compat = sh7372_boards_compat_dt,
1016MACHINE_END 1014MACHINE_END
1017 1015
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 328657d011d5..93ebe3430bfe 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21#include <linux/kernel.h> 17#include <linux/kernel.h>
22#include <linux/init.h> 18#include <linux/init.h>
@@ -46,7 +42,7 @@
46#include "sh73a0.h" 42#include "sh73a0.h"
47 43
48static struct map_desc sh73a0_io_desc[] __initdata = { 44static struct map_desc sh73a0_io_desc[] __initdata = {
49 /* create a 1:1 entity map for 0xe6xxxxxx 45 /* create a 1:1 identity mapping for 0xe6xxxxxx
50 * used by CPGA, INTC and PFC. 46 * used by CPGA, INTC and PFC.
51 */ 47 */
52 { 48 {
@@ -59,6 +55,7 @@ static struct map_desc sh73a0_io_desc[] __initdata = {
59 55
60void __init sh73a0_map_io(void) 56void __init sh73a0_map_io(void)
61{ 57{
58 debug_ll_io_init();
62 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc)); 59 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
63} 60}
64 61
@@ -760,17 +757,12 @@ void __init sh73a0_add_standard_devices(void)
760 ARRAY_SIZE(sh73a0_late_devices)); 757 ARRAY_SIZE(sh73a0_late_devices));
761} 758}
762 759
763void __init sh73a0_init_delay(void)
764{
765 shmobile_init_delay();
766}
767
768/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ 760/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
769void __init __weak sh73a0_register_twd(void) { } 761void __init __weak sh73a0_register_twd(void) { }
770 762
771void __init sh73a0_earlytimer_init(void) 763void __init sh73a0_earlytimer_init(void)
772{ 764{
773 sh73a0_init_delay(); 765 shmobile_init_delay();
774 sh73a0_clock_init(); 766 sh73a0_clock_init();
775 shmobile_earlytimer_init(); 767 shmobile_earlytimer_init();
776 sh73a0_register_twd(); 768 sh73a0_register_twd();
@@ -795,6 +787,13 @@ void __init sh73a0_add_standard_devices_dt(void)
795 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 787 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
796} 788}
797 789
790#define RESCNT2 IOMEM(0xe6188020)
791static void sh73a0_restart(enum reboot_mode mode, const char *cmd)
792{
793 /* Do soft power on reset */
794 writel((1 << 31), RESCNT2);
795}
796
798static const char *sh73a0_boards_compat_dt[] __initdata = { 797static const char *sh73a0_boards_compat_dt[] __initdata = {
799 "renesas,sh73a0", 798 "renesas,sh73a0",
800 NULL, 799 NULL,
@@ -803,9 +802,10 @@ static const char *sh73a0_boards_compat_dt[] __initdata = {
803DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") 802DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
804 .smp = smp_ops(sh73a0_smp_ops), 803 .smp = smp_ops(sh73a0_smp_ops),
805 .map_io = sh73a0_map_io, 804 .map_io = sh73a0_map_io,
806 .init_early = sh73a0_init_delay, 805 .init_early = shmobile_init_delay,
807 .init_machine = sh73a0_add_standard_devices_dt, 806 .init_machine = sh73a0_add_standard_devices_dt,
808 .init_late = shmobile_init_late, 807 .init_late = shmobile_init_late,
808 .restart = sh73a0_restart,
809 .dt_compat = sh73a0_boards_compat_dt, 809 .dt_compat = sh73a0_boards_compat_dt,
810MACHINE_END 810MACHINE_END
811#endif /* CONFIG_USE_OF */ 811#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/sh73a0.h b/arch/arm/mach-shmobile/sh73a0.h
index 359b582dc270..f037c64b14fc 100644
--- a/arch/arm/mach-shmobile/sh73a0.h
+++ b/arch/arm/mach-shmobile/sh73a0.h
@@ -71,7 +71,6 @@ enum {
71#define SH73A0_PINT0_IRQ(irq) ((irq) + 700) 71#define SH73A0_PINT0_IRQ(irq) ((irq) + 700)
72#define SH73A0_PINT1_IRQ(irq) ((irq) + 732) 72#define SH73A0_PINT1_IRQ(irq) ((irq) + 732)
73 73
74extern void sh73a0_init_delay(void);
75extern void sh73a0_init_irq(void); 74extern void sh73a0_init_irq(void);
76extern void sh73a0_init_irq_dt(void); 75extern void sh73a0_init_irq_dt(void);
77extern void sh73a0_map_io(void); 76extern void sh73a0_map_io(void);
diff --git a/arch/arm/mach-shmobile/sleep-sh7372.S b/arch/arm/mach-shmobile/sleep-sh7372.S
index 9782862899e8..146b8de16432 100644
--- a/arch/arm/mach-shmobile/sleep-sh7372.S
+++ b/arch/arm/mach-shmobile/sleep-sh7372.S
@@ -22,11 +22,6 @@
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the
24 * GNU General Public License for more details. 24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 */ 25 */
31 26
32#include <linux/linkage.h> 27#include <linux/linkage.h>
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 6ff1df1df9a7..baff3b5efed8 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20#include <linux/kernel.h> 16#include <linux/kernel.h>
21#include <linux/init.h> 17#include <linux/init.h>
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 3100e355c3fd..3f761f839043 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20#include <linux/kernel.h> 16#include <linux/kernel.h>
21#include <linux/init.h> 17#include <linux/init.h>
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
index 2311694636e1..9c3da1345b8b 100644
--- a/arch/arm/mach-shmobile/smp-r8a7790.c
+++ b/arch/arm/mach-shmobile/smp-r8a7790.c
@@ -21,6 +21,7 @@
21#include <asm/smp_plat.h> 21#include <asm/smp_plat.h>
22 22
23#include "common.h" 23#include "common.h"
24#include "platsmp-apmu.h"
24#include "pm-rcar.h" 25#include "pm-rcar.h"
25#include "r8a7790.h" 26#include "r8a7790.h"
26 27
@@ -34,10 +35,23 @@ static struct rcar_sysc_ch r8a7790_ca7_scu = {
34 .isr_bit = 21, /* CA7-SCU */ 35 .isr_bit = 21, /* CA7-SCU */
35}; 36};
36 37
38static struct rcar_apmu_config r8a7790_apmu_config[] = {
39 {
40 .iomem = DEFINE_RES_MEM(0xe6152000, 0x88),
41 .cpus = { 0, 1, 2, 3 },
42 },
43 {
44 .iomem = DEFINE_RES_MEM(0xe6151000, 0x88),
45 .cpus = { 0x100, 0x0101, 0x102, 0x103 },
46 }
47};
48
37static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus) 49static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
38{ 50{
39 /* let APMU code install data related to shmobile_boot_vector */ 51 /* let APMU code install data related to shmobile_boot_vector */
40 shmobile_smp_apmu_prepare_cpus(max_cpus); 52 shmobile_smp_apmu_prepare_cpus(max_cpus,
53 r8a7790_apmu_config,
54 ARRAY_SIZE(r8a7790_apmu_config));
41 55
42 /* turn on power to SCU */ 56 /* turn on power to SCU */
43 r8a7790_pm_init(); 57 r8a7790_pm_init();
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
index f743386166fb..7e49e0a52e32 100644
--- a/arch/arm/mach-shmobile/smp-r8a7791.c
+++ b/arch/arm/mach-shmobile/smp-r8a7791.c
@@ -21,13 +21,23 @@
21#include <asm/smp_plat.h> 21#include <asm/smp_plat.h>
22 22
23#include "common.h" 23#include "common.h"
24#include "platsmp-apmu.h"
24#include "r8a7791.h" 25#include "r8a7791.h"
25#include "rcar-gen2.h" 26#include "rcar-gen2.h"
26 27
28static struct rcar_apmu_config r8a7791_apmu_config[] = {
29 {
30 .iomem = DEFINE_RES_MEM(0xe6152000, 0x88),
31 .cpus = { 0, 1 },
32 }
33};
34
27static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus) 35static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
28{ 36{
29 /* let APMU code install data related to shmobile_boot_vector */ 37 /* let APMU code install data related to shmobile_boot_vector */
30 shmobile_smp_apmu_prepare_cpus(max_cpus); 38 shmobile_smp_apmu_prepare_cpus(max_cpus,
39 r8a7791_apmu_config,
40 ARRAY_SIZE(r8a7791_apmu_config));
31 41
32 r8a7791_pm_init(); 42 r8a7791_pm_init();
33} 43}
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 22d8f87b23e9..c16dbfe9836c 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
20#include <linux/kernel.h> 16#include <linux/kernel.h>
21#include <linux/init.h> 17#include <linux/init.h>
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 87c6be1e79bd..f1d027aa7a81 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -12,11 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 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 */ 15 */
21#include <linux/platform_device.h> 16#include <linux/platform_device.h>
22#include <linux/clocksource.h> 17#include <linux/clocksource.h>
@@ -45,6 +40,7 @@ void __init shmobile_init_delay(void)
45 struct device_node *np, *cpus; 40 struct device_node *np, *cpus;
46 bool is_a7_a8_a9 = false; 41 bool is_a7_a8_a9 = false;
47 bool is_a15 = false; 42 bool is_a15 = false;
43 bool has_arch_timer = false;
48 u32 max_freq = 0; 44 u32 max_freq = 0;
49 45
50 cpus = of_find_node_by_path("/cpus"); 46 cpus = of_find_node_by_path("/cpus");
@@ -57,12 +53,16 @@ void __init shmobile_init_delay(void)
57 if (!of_property_read_u32(np, "clock-frequency", &freq)) 53 if (!of_property_read_u32(np, "clock-frequency", &freq))
58 max_freq = max(max_freq, freq); 54 max_freq = max(max_freq, freq);
59 55
60 if (of_device_is_compatible(np, "arm,cortex-a7") || 56 if (of_device_is_compatible(np, "arm,cortex-a8") ||
61 of_device_is_compatible(np, "arm,cortex-a8") || 57 of_device_is_compatible(np, "arm,cortex-a9")) {
62 of_device_is_compatible(np, "arm,cortex-a9"))
63 is_a7_a8_a9 = true; 58 is_a7_a8_a9 = true;
64 else if (of_device_is_compatible(np, "arm,cortex-a15")) 59 } else if (of_device_is_compatible(np, "arm,cortex-a7")) {
60 is_a7_a8_a9 = true;
61 has_arch_timer = true;
62 } else if (of_device_is_compatible(np, "arm,cortex-a15")) {
65 is_a15 = true; 63 is_a15 = true;
64 has_arch_timer = true;
65 }
66 } 66 }
67 67
68 of_node_put(cpus); 68 of_node_put(cpus);
@@ -70,10 +70,12 @@ void __init shmobile_init_delay(void)
70 if (!max_freq) 70 if (!max_freq)
71 return; 71 return;
72 72
73 if (is_a7_a8_a9) 73 if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) {
74 shmobile_setup_delay_hz(max_freq, 1, 3); 74 if (is_a7_a8_a9)
75 else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) 75 shmobile_setup_delay_hz(max_freq, 1, 3);
76 shmobile_setup_delay_hz(max_freq, 2, 4); 76 else if (is_a15)
77 shmobile_setup_delay_hz(max_freq, 2, 4);
78 }
77} 79}
78 80
79static void __init shmobile_late_time_init(void) 81static void __init shmobile_late_time_init(void)
diff --git a/arch/arm/mach-socfpga/core.h b/arch/arm/mach-socfpga/core.h
index 60c443dadb58..483cb467bf65 100644
--- a/arch/arm/mach-socfpga/core.h
+++ b/arch/arm/mach-socfpga/core.h
@@ -21,6 +21,7 @@
21#define __MACH_CORE_H 21#define __MACH_CORE_H
22 22
23#define SOCFPGA_RSTMGR_CTRL 0x04 23#define SOCFPGA_RSTMGR_CTRL 0x04
24#define SOCFPGA_RSTMGR_MODMPURST 0x10
24#define SOCFPGA_RSTMGR_MODPERRST 0x14 25#define SOCFPGA_RSTMGR_MODPERRST 0x14
25#define SOCFPGA_RSTMGR_BRGMODRST 0x1c 26#define SOCFPGA_RSTMGR_BRGMODRST 0x1c
26 27
@@ -28,6 +29,8 @@
28#define RSTMGR_CTRL_SWCOLDRSTREQ 0x1 /* Cold Reset */ 29#define RSTMGR_CTRL_SWCOLDRSTREQ 0x1 /* Cold Reset */
29#define RSTMGR_CTRL_SWWARMRSTREQ 0x2 /* Warm Reset */ 30#define RSTMGR_CTRL_SWWARMRSTREQ 0x2 /* Warm Reset */
30 31
32#define RSTMGR_MPUMODRST_CPU1 0x2 /* CPU1 Reset */
33
31extern void socfpga_secondary_startup(void); 34extern void socfpga_secondary_startup(void);
32extern void __iomem *socfpga_scu_base_addr; 35extern void __iomem *socfpga_scu_base_addr;
33 36
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index 16ca97b039f9..c64d89b7c0ca 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -34,17 +34,21 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
34 int trampoline_size = &secondary_trampoline_end - &secondary_trampoline; 34 int trampoline_size = &secondary_trampoline_end - &secondary_trampoline;
35 35
36 if (socfpga_cpu1start_addr) { 36 if (socfpga_cpu1start_addr) {
37 /* This will put CPU #1 into reset. */
38 writel(RSTMGR_MPUMODRST_CPU1,
39 rst_manager_base_addr + SOCFPGA_RSTMGR_MODMPURST);
40
37 memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size); 41 memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
38 42
39 __raw_writel(virt_to_phys(socfpga_secondary_startup), 43 writel(virt_to_phys(socfpga_secondary_startup),
40 (sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff))); 44 sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff));
41 45
42 flush_cache_all(); 46 flush_cache_all();
43 smp_wmb(); 47 smp_wmb();
44 outer_clean_range(0, trampoline_size); 48 outer_clean_range(0, trampoline_size);
45 49
46 /* This will release CPU #1 out of reset.*/ 50 /* This will release CPU #1 out of reset. */
47 __raw_writel(0, rst_manager_base_addr + 0x10); 51 writel(0, rst_manager_base_addr + SOCFPGA_RSTMGR_MODMPURST);
48 } 52 }
49 53
50 return 0; 54 return 0;
@@ -86,10 +90,9 @@ static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
86 */ 90 */
87static void socfpga_cpu_die(unsigned int cpu) 91static void socfpga_cpu_die(unsigned int cpu)
88{ 92{
89 cpu_do_idle(); 93 /* Do WFI. If we wake up early, go back into WFI */
90 94 while (1)
91 /* We should have never returned from idle */ 95 cpu_do_idle();
92 panic("cpu %d unexpectedly exit from shutdown\n", cpu);
93} 96}
94 97
95struct smp_operations socfpga_smp_ops __initdata = { 98struct smp_operations socfpga_smp_ops __initdata = {
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig
index 878e9ec97d0f..8825bc9e2553 100644
--- a/arch/arm/mach-sti/Kconfig
+++ b/arch/arm/mach-sti/Kconfig
@@ -42,4 +42,14 @@ config SOC_STIH416
42 and other digital audio/video applications using Flattened Device 42 and other digital audio/video applications using Flattened Device
43 Trees. 43 Trees.
44 44
45config SOC_STIH407
46 bool "STiH407 STMicroelectronics Consumer Electronics family"
47 default y
48 select STIH407_RESET
49 help
50 This enables support for STMicroelectronics Digital Consumer
51 Electronics family StiH407 parts, targetted at set-top-box
52 and other digital audio/video applications using Flattened Device
53 Trees.
54
45endif 55endif
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 1aaa1e15ef70..a77604fbaf25 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -42,4 +42,11 @@ config MACH_SUN8I
42 select MFD_SUN6I_PRCM 42 select MFD_SUN6I_PRCM
43 select RESET_CONTROLLER 43 select RESET_CONTROLLER
44 44
45config MACH_SUN9I
46 bool "Allwinner (sun9i) SoCs support"
47 default ARCH_SUNXI
48 select ARCH_HAS_RESET_CONTROLLER
49 select ARM_GIC
50 select RESET_CONTROLLER
51
45endif 52endif
diff --git a/arch/arm/mach-sunxi/platsmp.c b/arch/arm/mach-sunxi/platsmp.c
index c53077bb8c3f..e44d028555a4 100644
--- a/arch/arm/mach-sunxi/platsmp.c
+++ b/arch/arm/mach-sunxi/platsmp.c
@@ -116,7 +116,7 @@ static int sun6i_smp_boot_secondary(unsigned int cpu,
116 return 0; 116 return 0;
117} 117}
118 118
119struct smp_operations sun6i_smp_ops __initdata = { 119static struct smp_operations sun6i_smp_ops __initdata = {
120 .smp_prepare_cpus = sun6i_smp_prepare_cpus, 120 .smp_prepare_cpus = sun6i_smp_prepare_cpus,
121 .smp_boot_secondary = sun6i_smp_boot_secondary, 121 .smp_boot_secondary = sun6i_smp_boot_secondary,
122}; 122};
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index d7598aeed803..1f986758784a 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -63,3 +63,12 @@ static const char * const sun8i_board_dt_compat[] = {
63DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i (A23) Family") 63DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i (A23) Family")
64 .dt_compat = sun8i_board_dt_compat, 64 .dt_compat = sun8i_board_dt_compat,
65MACHINE_END 65MACHINE_END
66
67static const char * const sun9i_board_dt_compat[] = {
68 "allwinner,sun9i-a80",
69 NULL,
70};
71
72DT_MACHINE_START(SUN9I_DT, "Allwinner sun9i Family")
73 .dt_compat = sun9i_board_dt_compat,
74MACHINE_END
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 095399618ca5..d0be9a1ef6b8 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -2,6 +2,7 @@ menuconfig ARCH_TEGRA
2 bool "NVIDIA Tegra" if ARCH_MULTI_V7 2 bool "NVIDIA Tegra" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS 4 select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
5 select ARM_AMBA
5 select ARM_GIC 6 select ARM_GIC
6 select CLKSRC_MMIO 7 select CLKSRC_MMIO
7 select HAVE_ARM_SCU if SMP 8 select HAVE_ARM_SCU if SMP
@@ -59,12 +60,4 @@ config ARCH_TEGRA_124_SOC
59 Support for NVIDIA Tegra T124 processor family, based on the 60 Support for NVIDIA Tegra T124 processor family, based on the
60 ARM CortexA15MP CPU 61 ARM CortexA15MP CPU
61 62
62config TEGRA_AHB
63 bool "Enable AHB driver for NVIDIA Tegra SoCs"
64 default y
65 help
66 Adds AHB configuration functionality for NVIDIA Tegra SoCs,
67 which controls AHB bus master arbitration and some
68 performance parameters(priority, prefech size).
69
70endif 63endif
diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c
index e3ebdce3e71f..f2b586d7b15d 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra114.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra114.c
@@ -49,7 +49,7 @@ static int tegra114_idle_power_down(struct cpuidle_device *dev,
49 call_firmware_op(prepare_idle); 49 call_firmware_op(prepare_idle);
50 50
51 /* Do suspend by ourselves if the firmware does not implement it */ 51 /* Do suspend by ourselves if the firmware does not implement it */
52 if (call_firmware_op(do_idle) == -ENOSYS) 52 if (call_firmware_op(do_idle, 0) == -ENOSYS)
53 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish); 53 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
54 54
55 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); 55 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
@@ -75,7 +75,6 @@ static struct cpuidle_driver tegra_idle_driver = {
75 .exit_latency = 500, 75 .exit_latency = 500,
76 .target_residency = 1000, 76 .target_residency = 1000,
77 .power_usage = 0, 77 .power_usage = 0,
78 .flags = CPUIDLE_FLAG_TIME_VALID,
79 .name = "powered-down", 78 .name = "powered-down",
80 .desc = "CPU power gated", 79 .desc = "CPU power gated",
81 }, 80 },
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
index b30bf5cba65b..4f25a7c7ca0f 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
@@ -59,8 +59,7 @@ static struct cpuidle_driver tegra_idle_driver = {
59 .exit_latency = 5000, 59 .exit_latency = 5000,
60 .target_residency = 10000, 60 .target_residency = 10000,
61 .power_usage = 0, 61 .power_usage = 0,
62 .flags = CPUIDLE_FLAG_TIME_VALID | 62 .flags = CPUIDLE_FLAG_COUPLED,
63 CPUIDLE_FLAG_COUPLED,
64 .name = "powered-down", 63 .name = "powered-down",
65 .desc = "CPU power gated", 64 .desc = "CPU power gated",
66 }, 65 },
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c
index 35561274f6cf..f8815ed65d9d 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra30.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra30.c
@@ -56,7 +56,6 @@ static struct cpuidle_driver tegra_idle_driver = {
56 .exit_latency = 2000, 56 .exit_latency = 2000,
57 .target_residency = 2200, 57 .target_residency = 2200,
58 .power_usage = 0, 58 .power_usage = 0,
59 .flags = CPUIDLE_FLAG_TIME_VALID,
60 .name = "powered-down", 59 .name = "powered-down",
61 .desc = "CPU power gated", 60 .desc = "CPU power gated",
62 }, 61 },
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index 7b2baab0f0bd..71be4af5e975 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -51,6 +51,7 @@ ENTRY(tegra_resume)
51 THUMB( it ne ) 51 THUMB( it ne )
52 bne cpu_resume @ no 52 bne cpu_resume @ no
53 53
54 tegra_get_soc_id TEGRA_APB_MISC_BASE, r6
54 /* Are we on Tegra20? */ 55 /* Are we on Tegra20? */
55 cmp r6, #TEGRA20 56 cmp r6, #TEGRA20
56 beq 1f @ Yes 57 beq 1f @ Yes
diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index ec0283cf9a32..131996805690 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -80,8 +80,8 @@ static ssize_t dummy_looptest(struct device *dev,
80 "in 8bit mode\n"); 80 "in 8bit mode\n");
81 status = spi_w8r8(spi, 0xAA); 81 status = spi_w8r8(spi, 0xAA);
82 if (status < 0) 82 if (status < 0)
83 pr_warning("Siple test 1: FAILURE: spi_write_then_read " 83 pr_warn("Simple test 1: FAILURE: spi_write_then_read failed with status %d\n",
84 "failed with status %d\n", status); 84 status);
85 else 85 else
86 pr_info("Simple test 1: SUCCESS!\n"); 86 pr_info("Simple test 1: SUCCESS!\n");
87 87
@@ -89,8 +89,8 @@ static ssize_t dummy_looptest(struct device *dev,
89 "in 8bit mode (full FIFO)\n"); 89 "in 8bit mode (full FIFO)\n");
90 status = spi_write_then_read(spi, &txbuf[0], 8, &rxbuf[0], 8); 90 status = spi_write_then_read(spi, &txbuf[0], 8, &rxbuf[0], 8);
91 if (status < 0) 91 if (status < 0)
92 pr_warning("Simple test 2: FAILURE: spi_write_then_read() " 92 pr_warn("Simple test 2: FAILURE: spi_write_then_read() failed with status %d\n",
93 "failed with status %d\n", status); 93 status);
94 else 94 else
95 pr_info("Simple test 2: SUCCESS!\n"); 95 pr_info("Simple test 2: SUCCESS!\n");
96 96
@@ -98,8 +98,8 @@ static ssize_t dummy_looptest(struct device *dev,
98 "in 8bit mode (see if we overflow FIFO)\n"); 98 "in 8bit mode (see if we overflow FIFO)\n");
99 status = spi_write_then_read(spi, &txbuf[0], 14, &rxbuf[0], 14); 99 status = spi_write_then_read(spi, &txbuf[0], 14, &rxbuf[0], 14);
100 if (status < 0) 100 if (status < 0)
101 pr_warning("Simple test 3: FAILURE: failed with status %d " 101 pr_warn("Simple test 3: FAILURE: failed with status %d (probably FIFO overrun)\n",
102 "(probably FIFO overrun)\n", status); 102 status);
103 else 103 else
104 pr_info("Simple test 3: SUCCESS!\n"); 104 pr_info("Simple test 3: SUCCESS!\n");
105 105
@@ -107,14 +107,14 @@ static ssize_t dummy_looptest(struct device *dev,
107 "bytes garbage with spi_read() in 8bit mode\n"); 107 "bytes garbage with spi_read() in 8bit mode\n");
108 status = spi_write(spi, &txbuf[0], 8); 108 status = spi_write(spi, &txbuf[0], 8);
109 if (status < 0) 109 if (status < 0)
110 pr_warning("Simple test 4 step 1: FAILURE: spi_write() " 110 pr_warn("Simple test 4 step 1: FAILURE: spi_write() failed with status %d\n",
111 "failed with status %d\n", status); 111 status);
112 else 112 else
113 pr_info("Simple test 4 step 1: SUCCESS!\n"); 113 pr_info("Simple test 4 step 1: SUCCESS!\n");
114 status = spi_read(spi, &rxbuf[0], 8); 114 status = spi_read(spi, &rxbuf[0], 8);
115 if (status < 0) 115 if (status < 0)
116 pr_warning("Simple test 4 step 2: FAILURE: spi_read() " 116 pr_warn("Simple test 4 step 2: FAILURE: spi_read() failed with status %d\n",
117 "failed with status %d\n", status); 117 status);
118 else 118 else
119 pr_info("Simple test 4 step 2: SUCCESS!\n"); 119 pr_info("Simple test 4 step 2: SUCCESS!\n");
120 120
@@ -122,16 +122,14 @@ static ssize_t dummy_looptest(struct device *dev,
122 "14 bytes garbage with spi_read() in 8bit mode\n"); 122 "14 bytes garbage with spi_read() in 8bit mode\n");
123 status = spi_write(spi, &txbuf[0], 14); 123 status = spi_write(spi, &txbuf[0], 14);
124 if (status < 0) 124 if (status < 0)
125 pr_warning("Simple test 5 step 1: FAILURE: spi_write() " 125 pr_warn("Simple test 5 step 1: FAILURE: spi_write() failed with status %d (probably FIFO overrun)\n",
126 "failed with status %d (probably FIFO overrun)\n", 126 status);
127 status);
128 else 127 else
129 pr_info("Simple test 5 step 1: SUCCESS!\n"); 128 pr_info("Simple test 5 step 1: SUCCESS!\n");
130 status = spi_read(spi, &rxbuf[0], 14); 129 status = spi_read(spi, &rxbuf[0], 14);
131 if (status < 0) 130 if (status < 0)
132 pr_warning("Simple test 5 step 2: FAILURE: spi_read() " 131 pr_warn("Simple test 5 step 2: FAILURE: spi_read() failed with status %d (probably FIFO overrun)\n",
133 "failed with status %d (probably FIFO overrun)\n", 132 status);
134 status);
135 else 133 else
136 pr_info("Simple test 5: SUCCESS!\n"); 134 pr_info("Simple test 5: SUCCESS!\n");
137 135
@@ -140,16 +138,14 @@ static ssize_t dummy_looptest(struct device *dev,
140 DMA_TEST_SIZE, DMA_TEST_SIZE); 138 DMA_TEST_SIZE, DMA_TEST_SIZE);
141 status = spi_write(spi, &bigtxbuf_virtual[0], DMA_TEST_SIZE); 139 status = spi_write(spi, &bigtxbuf_virtual[0], DMA_TEST_SIZE);
142 if (status < 0) 140 if (status < 0)
143 pr_warning("Simple test 6 step 1: FAILURE: spi_write() " 141 pr_warn("Simple test 6 step 1: FAILURE: spi_write() failed with status %d (probably FIFO overrun)\n",
144 "failed with status %d (probably FIFO overrun)\n", 142 status);
145 status);
146 else 143 else
147 pr_info("Simple test 6 step 1: SUCCESS!\n"); 144 pr_info("Simple test 6 step 1: SUCCESS!\n");
148 status = spi_read(spi, &bigrxbuf_virtual[0], DMA_TEST_SIZE); 145 status = spi_read(spi, &bigrxbuf_virtual[0], DMA_TEST_SIZE);
149 if (status < 0) 146 if (status < 0)
150 pr_warning("Simple test 6 step 2: FAILURE: spi_read() " 147 pr_warn("Simple test 6 step 2: FAILURE: spi_read() failed with status %d (probably FIFO overrun)\n",
151 "failed with status %d (probably FIFO overrun)\n", 148 status);
152 status);
153 else 149 else
154 pr_info("Simple test 6: SUCCESS!\n"); 150 pr_info("Simple test 6: SUCCESS!\n");
155 151
@@ -169,18 +165,17 @@ static ssize_t dummy_looptest(struct device *dev,
169 pr_info("Simple test 7: SUCCESS! (expected failure with " 165 pr_info("Simple test 7: SUCCESS! (expected failure with "
170 "status EIO)\n"); 166 "status EIO)\n");
171 else if (status < 0) 167 else if (status < 0)
172 pr_warning("Siple test 7: FAILURE: spi_write_then_read " 168 pr_warn("Simple test 7: FAILURE: spi_write_then_read failed with status %d\n",
173 "failed with status %d\n", status); 169 status);
174 else 170 else
175 pr_warning("Siple test 7: FAILURE: spi_write_then_read " 171 pr_warn("Simple test 7: FAILURE: spi_write_then_read succeeded but it was expected to fail!\n");
176 "succeeded but it was expected to fail!\n");
177 172
178 pr_info("Simple test 8: write 8 bytes, read back 8 bytes garbage " 173 pr_info("Simple test 8: write 8 bytes, read back 8 bytes garbage "
179 "in 16bit mode (full FIFO)\n"); 174 "in 16bit mode (full FIFO)\n");
180 status = spi_write_then_read(spi, &txbuf[0], 8, &rxbuf[0], 8); 175 status = spi_write_then_read(spi, &txbuf[0], 8, &rxbuf[0], 8);
181 if (status < 0) 176 if (status < 0)
182 pr_warning("Simple test 8: FAILURE: spi_write_then_read() " 177 pr_warn("Simple test 8: FAILURE: spi_write_then_read() failed with status %d\n",
183 "failed with status %d\n", status); 178 status);
184 else 179 else
185 pr_info("Simple test 8: SUCCESS!\n"); 180 pr_info("Simple test 8: SUCCESS!\n");
186 181
@@ -188,8 +183,8 @@ static ssize_t dummy_looptest(struct device *dev,
188 "in 16bit mode (see if we overflow FIFO)\n"); 183 "in 16bit mode (see if we overflow FIFO)\n");
189 status = spi_write_then_read(spi, &txbuf[0], 14, &rxbuf[0], 14); 184 status = spi_write_then_read(spi, &txbuf[0], 14, &rxbuf[0], 14);
190 if (status < 0) 185 if (status < 0)
191 pr_warning("Simple test 9: FAILURE: failed with status %d " 186 pr_warn("Simple test 9: FAILURE: failed with status %d (probably FIFO overrun)\n",
192 "(probably FIFO overrun)\n", status); 187 status);
193 else 188 else
194 pr_info("Simple test 9: SUCCESS!\n"); 189 pr_info("Simple test 9: SUCCESS!\n");
195 190
@@ -198,17 +193,15 @@ static ssize_t dummy_looptest(struct device *dev,
198 DMA_TEST_SIZE, DMA_TEST_SIZE); 193 DMA_TEST_SIZE, DMA_TEST_SIZE);
199 status = spi_write(spi, &bigtxbuf_virtual[0], DMA_TEST_SIZE); 194 status = spi_write(spi, &bigtxbuf_virtual[0], DMA_TEST_SIZE);
200 if (status < 0) 195 if (status < 0)
201 pr_warning("Simple test 10 step 1: FAILURE: spi_write() " 196 pr_warn("Simple test 10 step 1: FAILURE: spi_write() failed with status %d (probably FIFO overrun)\n",
202 "failed with status %d (probably FIFO overrun)\n", 197 status);
203 status);
204 else 198 else
205 pr_info("Simple test 10 step 1: SUCCESS!\n"); 199 pr_info("Simple test 10 step 1: SUCCESS!\n");
206 200
207 status = spi_read(spi, &bigrxbuf_virtual[0], DMA_TEST_SIZE); 201 status = spi_read(spi, &bigrxbuf_virtual[0], DMA_TEST_SIZE);
208 if (status < 0) 202 if (status < 0)
209 pr_warning("Simple test 10 step 2: FAILURE: spi_read() " 203 pr_warn("Simple test 10 step 2: FAILURE: spi_read() failed with status %d (probably FIFO overrun)\n",
210 "failed with status %d (probably FIFO overrun)\n", 204 status);
211 status);
212 else 205 else
213 pr_info("Simple test 10: SUCCESS!\n"); 206 pr_info("Simple test 10: SUCCESS!\n");
214 207
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 699e8601dbf0..c9ac19b24e5a 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -32,6 +32,7 @@ config UX500_SOC_DB8500
32 select PINCTRL_AB8540 32 select PINCTRL_AB8540
33 select REGULATOR 33 select REGULATOR
34 select REGULATOR_DB8500_PRCMU 34 select REGULATOR_DB8500_PRCMU
35 select PM_GENERIC_DOMAINS if PM
35 36
36config MACH_MOP500 37config MACH_MOP500
37 bool "U8500 Development platform, MOP500 versions" 38 bool "U8500 Development platform, MOP500 versions"
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 9741de956b3e..4418a5078833 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -9,5 +9,6 @@ obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \
9 board-mop500-audio.o 9 board-mop500-audio.o
10obj-$(CONFIG_SMP) += platsmp.o headsmp.o 10obj-$(CONFIG_SMP) += platsmp.o headsmp.o
11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
12obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
12 13
13CFLAGS_hotplug.o += -march=armv7-a 14CFLAGS_hotplug.o += -march=armv7-a
diff --git a/arch/arm/mach-ux500/pm.c b/arch/arm/mach-ux500/pm.c
index b80a9a2e356e..2cb587b50905 100644
--- a/arch/arm/mach-ux500/pm.c
+++ b/arch/arm/mach-ux500/pm.c
@@ -17,6 +17,7 @@
17#include <linux/platform_data/arm-ux500-pm.h> 17#include <linux/platform_data/arm-ux500-pm.h>
18 18
19#include "db8500-regs.h" 19#include "db8500-regs.h"
20#include "pm_domains.h"
20 21
21/* ARM WFI Standby signal register */ 22/* ARM WFI Standby signal register */
22#define PRCM_ARM_WFI_STANDBY (prcmu_base + 0x130) 23#define PRCM_ARM_WFI_STANDBY (prcmu_base + 0x130)
@@ -191,4 +192,7 @@ void __init ux500_pm_init(u32 phy_base, u32 size)
191 192
192 /* Set up ux500 suspend callbacks. */ 193 /* Set up ux500 suspend callbacks. */
193 suspend_set_ops(UX500_SUSPEND_OPS); 194 suspend_set_ops(UX500_SUSPEND_OPS);
195
196 /* Initialize ux500 power domains */
197 ux500_pm_domains_init();
194} 198}
diff --git a/arch/arm/mach-ux500/pm_domains.c b/arch/arm/mach-ux500/pm_domains.c
new file mode 100644
index 000000000000..0d4b5b46f15b
--- /dev/null
+++ b/arch/arm/mach-ux500/pm_domains.c
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd.
3 *
4 * Author: Ulf Hansson <ulf.hansson@linaro.org>
5 * License terms: GNU General Public License (GPL) version 2
6 *
7 * Implements PM domains using the generic PM domain for ux500.
8 */
9#include <linux/printk.h>
10#include <linux/slab.h>
11#include <linux/err.h>
12#include <linux/of.h>
13#include <linux/pm_domain.h>
14
15#include <dt-bindings/arm/ux500_pm_domains.h>
16#include "pm_domains.h"
17
18static int pd_power_off(struct generic_pm_domain *domain)
19{
20 /*
21 * Handle the gating of the PM domain regulator here.
22 *
23 * Drivers/subsystems handling devices in the PM domain needs to perform
24 * register context save/restore from their respective runtime PM
25 * callbacks, to be able to enable PM domain gating/ungating.
26 */
27 return 0;
28}
29
30static int pd_power_on(struct generic_pm_domain *domain)
31{
32 /*
33 * Handle the ungating of the PM domain regulator here.
34 *
35 * Drivers/subsystems handling devices in the PM domain needs to perform
36 * register context save/restore from their respective runtime PM
37 * callbacks, to be able to enable PM domain gating/ungating.
38 */
39 return 0;
40}
41
42static struct generic_pm_domain ux500_pm_domain_vape = {
43 .name = "VAPE",
44 .power_off = pd_power_off,
45 .power_on = pd_power_on,
46};
47
48static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = {
49 [DOMAIN_VAPE] = &ux500_pm_domain_vape,
50};
51
52static struct of_device_id ux500_pm_domain_matches[] = {
53 { .compatible = "stericsson,ux500-pm-domains", },
54 { },
55};
56
57int __init ux500_pm_domains_init(void)
58{
59 struct device_node *np;
60 struct genpd_onecell_data *genpd_data;
61 int i;
62
63 np = of_find_matching_node(NULL, ux500_pm_domain_matches);
64 if (!np)
65 return -ENODEV;
66
67 genpd_data = kzalloc(sizeof(*genpd_data), GFP_KERNEL);
68 if (!genpd_data)
69 return -ENOMEM;
70
71 genpd_data->domains = ux500_pm_domains;
72 genpd_data->num_domains = ARRAY_SIZE(ux500_pm_domains);
73
74 for (i = 0; i < ARRAY_SIZE(ux500_pm_domains); ++i)
75 pm_genpd_init(ux500_pm_domains[i], NULL, false);
76
77 of_genpd_add_provider_onecell(np, genpd_data);
78 return 0;
79}
diff --git a/arch/arm/mach-ux500/pm_domains.h b/arch/arm/mach-ux500/pm_domains.h
new file mode 100644
index 000000000000..263d3ba97177
--- /dev/null
+++ b/arch/arm/mach-ux500/pm_domains.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd.
3 *
4 * Author: Ulf Hansson <ulf.hansson@linaro.org>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_UX500_PM_DOMAINS_H
9#define __MACH_UX500_PM_DOMAINS_H
10
11#ifdef CONFIG_PM_GENERIC_DOMAINS
12extern int __init ux500_pm_domains_init(void);
13#else
14static inline int ux500_pm_domains_init(void) { return 0; }
15#endif
16
17#endif
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index b2cfba16c4e8..d6b16d9a7838 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -16,6 +16,7 @@ menuconfig ARCH_VEXPRESS
16 select POWER_RESET 16 select POWER_RESET
17 select POWER_RESET_VEXPRESS 17 select POWER_RESET_VEXPRESS
18 select POWER_SUPPLY 18 select POWER_SUPPLY
19 select REGULATOR if MMC_ARMMMCI
19 select REGULATOR_FIXED_VOLTAGE if REGULATOR 20 select REGULATOR_FIXED_VOLTAGE if REGULATOR
20 select VEXPRESS_CONFIG 21 select VEXPRESS_CONFIG
21 select VEXPRESS_SYSCFG 22 select VEXPRESS_SYSCFG
@@ -49,9 +50,6 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
49 build a working kernel, you must also enable relevant core 50 build a working kernel, you must also enable relevant core
50 tile support or Flattened Device Tree based support options. 51 tile support or Flattened Device Tree based support options.
51 52
52config ARCH_VEXPRESS_CA9X4
53 bool "Versatile Express Cortex-A9x4 tile"
54
55config ARCH_VEXPRESS_DCSCB 53config ARCH_VEXPRESS_DCSCB
56 bool "Dual Cluster System Control Block (DCSCB) support" 54 bool "Dual Cluster System Control Block (DCSCB) support"
57 depends on MCPM 55 depends on MCPM
diff --git a/arch/arm/mach-vexpress/Makefile b/arch/arm/mach-vexpress/Makefile
index fc649bc09d0c..f5c1006dd6a1 100644
--- a/arch/arm/mach-vexpress/Makefile
+++ b/arch/arm/mach-vexpress/Makefile
@@ -1,11 +1,10 @@
1# 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ 4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := \
5 -I$(srctree)/arch/arm/plat-versatile/include 5 -I$(srctree)/arch/arm/plat-versatile/include
6 6
7obj-y := v2m.o 7obj-y := v2m.o
8obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o
9obj-$(CONFIG_ARCH_VEXPRESS_DCSCB) += dcscb.o dcscb_setup.o 8obj-$(CONFIG_ARCH_VEXPRESS_DCSCB) += dcscb.o dcscb_setup.o
10CFLAGS_dcscb.o += -march=armv7-a 9CFLAGS_dcscb.o += -march=armv7-a
11CFLAGS_REMOVE_dcscb.o = -pg 10CFLAGS_REMOVE_dcscb.o = -pg
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index 152fad91b3ae..2a11d3ac8c68 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -1,12 +1,5 @@
1/* 2MB large area for motherboard's peripherals static mapping */
2#define V2M_PERIPH 0xf8000000
3
4/* Tile's peripherals static mappings should start here */
5#define V2T_PERIPH 0xf8200000
6
7bool vexpress_smp_init_ops(void); 1bool vexpress_smp_init_ops(void);
8 2
9extern struct smp_operations vexpress_smp_ops;
10extern struct smp_operations vexpress_smp_dt_ops; 3extern struct smp_operations vexpress_smp_dt_ops;
11 4
12extern void vexpress_cpu_die(unsigned int cpu); 5extern void vexpress_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
deleted file mode 100644
index 27bea049380a..000000000000
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ /dev/null
@@ -1,212 +0,0 @@
1/*
2 * Versatile Express Core Tile Cortex A9x4 Support
3 */
4#include <linux/init.h>
5#include <linux/gfp.h>
6#include <linux/device.h>
7#include <linux/dma-mapping.h>
8#include <linux/platform_device.h>
9#include <linux/amba/bus.h>
10#include <linux/amba/clcd.h>
11#include <linux/platform_data/video-clcd-versatile.h>
12#include <linux/clkdev.h>
13#include <linux/vexpress.h>
14#include <linux/irqchip/arm-gic.h>
15
16#include <asm/hardware/arm_timer.h>
17#include <asm/hardware/cache-l2x0.h>
18#include <asm/smp_scu.h>
19#include <asm/smp_twd.h>
20
21#include <mach/ct-ca9x4.h>
22
23#include <asm/hardware/timer-sp.h>
24
25#include <asm/mach/map.h>
26#include <asm/mach/time.h>
27
28#include "core.h"
29
30#include <mach/motherboard.h>
31#include <mach/irqs.h>
32
33static struct map_desc ct_ca9x4_io_desc[] __initdata = {
34 {
35 .virtual = V2T_PERIPH,
36 .pfn = __phys_to_pfn(CT_CA9X4_MPIC),
37 .length = SZ_8K,
38 .type = MT_DEVICE,
39 },
40};
41
42static void __init ct_ca9x4_map_io(void)
43{
44 iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc));
45}
46
47static void __init ca9x4_l2_init(void)
48{
49#ifdef CONFIG_CACHE_L2X0
50 void __iomem *l2x0_base = ioremap(CT_CA9X4_L2CC, SZ_4K);
51
52 if (l2x0_base) {
53 /* set RAM latencies to 1 cycle for this core tile. */
54 writel(0, l2x0_base + L310_TAG_LATENCY_CTRL);
55 writel(0, l2x0_base + L310_DATA_LATENCY_CTRL);
56
57 l2x0_init(l2x0_base, 0x00400000, 0xfe0fffff);
58 } else {
59 pr_err("L2C: unable to map L2 cache controller\n");
60 }
61#endif
62}
63
64#ifdef CONFIG_HAVE_ARM_TWD
65static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, A9_MPCORE_TWD, IRQ_LOCALTIMER);
66
67static void __init ca9x4_twd_init(void)
68{
69 int err = twd_local_timer_register(&twd_local_timer);
70 if (err)
71 pr_err("twd_local_timer_register failed %d\n", err);
72}
73#else
74#define ca9x4_twd_init() do {} while(0)
75#endif
76
77static void __init ct_ca9x4_init_irq(void)
78{
79 gic_init(0, 29, ioremap(A9_MPCORE_GIC_DIST, SZ_4K),
80 ioremap(A9_MPCORE_GIC_CPU, SZ_256));
81 ca9x4_twd_init();
82 ca9x4_l2_init();
83}
84
85static int ct_ca9x4_clcd_setup(struct clcd_fb *fb)
86{
87 unsigned long framesize = 1024 * 768 * 2;
88
89 fb->panel = versatile_clcd_get_panel("XVGA");
90 if (!fb->panel)
91 return -EINVAL;
92
93 return versatile_clcd_setup_dma(fb, framesize);
94}
95
96static struct clcd_board ct_ca9x4_clcd_data = {
97 .name = "CT-CA9X4",
98 .caps = CLCD_CAP_5551 | CLCD_CAP_565,
99 .check = clcdfb_check,
100 .decode = clcdfb_decode,
101 .setup = ct_ca9x4_clcd_setup,
102 .mmap = versatile_clcd_mmap_dma,
103 .remove = versatile_clcd_remove_dma,
104};
105
106static AMBA_AHB_DEVICE(clcd, "ct:clcd", 0, CT_CA9X4_CLCDC, IRQ_CT_CA9X4_CLCDC, &ct_ca9x4_clcd_data);
107static AMBA_APB_DEVICE(dmc, "ct:dmc", 0, CT_CA9X4_DMC, IRQ_CT_CA9X4_DMC, NULL);
108static AMBA_APB_DEVICE(smc, "ct:smc", 0, CT_CA9X4_SMC, IRQ_CT_CA9X4_SMC, NULL);
109static AMBA_APB_DEVICE(gpio, "ct:gpio", 0, CT_CA9X4_GPIO, IRQ_CT_CA9X4_GPIO, NULL);
110
111static struct amba_device *ct_ca9x4_amba_devs[] __initdata = {
112 &clcd_device,
113 &dmc_device,
114 &smc_device,
115 &gpio_device,
116};
117
118static struct resource pmu_resources[] = {
119 [0] = {
120 .start = IRQ_CT_CA9X4_PMU_CPU0,
121 .end = IRQ_CT_CA9X4_PMU_CPU0,
122 .flags = IORESOURCE_IRQ,
123 },
124 [1] = {
125 .start = IRQ_CT_CA9X4_PMU_CPU1,
126 .end = IRQ_CT_CA9X4_PMU_CPU1,
127 .flags = IORESOURCE_IRQ,
128 },
129 [2] = {
130 .start = IRQ_CT_CA9X4_PMU_CPU2,
131 .end = IRQ_CT_CA9X4_PMU_CPU2,
132 .flags = IORESOURCE_IRQ,
133 },
134 [3] = {
135 .start = IRQ_CT_CA9X4_PMU_CPU3,
136 .end = IRQ_CT_CA9X4_PMU_CPU3,
137 .flags = IORESOURCE_IRQ,
138 },
139};
140
141static struct platform_device pmu_device = {
142 .name = "arm-pmu",
143 .id = -1,
144 .num_resources = ARRAY_SIZE(pmu_resources),
145 .resource = pmu_resources,
146};
147
148static struct clk_lookup osc1_lookup = {
149 .dev_id = "ct:clcd",
150};
151
152static struct platform_device osc1_device = {
153 .name = "vexpress-osc",
154 .id = 1,
155 .num_resources = 1,
156 .resource = (struct resource []) {
157 VEXPRESS_RES_FUNC(0xf, 1),
158 },
159 .dev.platform_data = &osc1_lookup,
160};
161
162static void __init ct_ca9x4_init(void)
163{
164 int i;
165
166 for (i = 0; i < ARRAY_SIZE(ct_ca9x4_amba_devs); i++)
167 amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource);
168
169 platform_device_register(&pmu_device);
170 vexpress_syscfg_device_register(&osc1_device);
171}
172
173#ifdef CONFIG_SMP
174static void *ct_ca9x4_scu_base __initdata;
175
176static void __init ct_ca9x4_init_cpu_map(void)
177{
178 int i, ncores;
179
180 ct_ca9x4_scu_base = ioremap(A9_MPCORE_SCU, SZ_128);
181 if (WARN_ON(!ct_ca9x4_scu_base))
182 return;
183
184 ncores = scu_get_core_count(ct_ca9x4_scu_base);
185
186 if (ncores > nr_cpu_ids) {
187 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
188 ncores, nr_cpu_ids);
189 ncores = nr_cpu_ids;
190 }
191
192 for (i = 0; i < ncores; ++i)
193 set_cpu_possible(i, true);
194}
195
196static void __init ct_ca9x4_smp_enable(unsigned int max_cpus)
197{
198 scu_enable(ct_ca9x4_scu_base);
199}
200#endif
201
202struct ct_desc ct_ca9x4_desc __initdata = {
203 .id = V2M_CT_ID_CA9,
204 .name = "CA9x4",
205 .map_io = ct_ca9x4_map_io,
206 .init_irq = ct_ca9x4_init_irq,
207 .init_tile = ct_ca9x4_init,
208#ifdef CONFIG_SMP
209 .init_cpu_map = ct_ca9x4_init_cpu_map,
210 .smp_enable = ct_ca9x4_smp_enable,
211#endif
212};
diff --git a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
deleted file mode 100644
index 84acf8439d4b..000000000000
--- a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef __MACH_CT_CA9X4_H
2#define __MACH_CT_CA9X4_H
3
4/*
5 * Physical base addresses
6 */
7#define CT_CA9X4_CLCDC (0x10020000)
8#define CT_CA9X4_AXIRAM (0x10060000)
9#define CT_CA9X4_DMC (0x100e0000)
10#define CT_CA9X4_SMC (0x100e1000)
11#define CT_CA9X4_SCC (0x100e2000)
12#define CT_CA9X4_SP804_TIMER (0x100e4000)
13#define CT_CA9X4_SP805_WDT (0x100e5000)
14#define CT_CA9X4_TZPC (0x100e6000)
15#define CT_CA9X4_GPIO (0x100e8000)
16#define CT_CA9X4_FASTAXI (0x100e9000)
17#define CT_CA9X4_SLOWAXI (0x100ea000)
18#define CT_CA9X4_TZASC (0x100ec000)
19#define CT_CA9X4_CORESIGHT (0x10200000)
20#define CT_CA9X4_MPIC (0x1e000000)
21#define CT_CA9X4_SYSTIMER (0x1e004000)
22#define CT_CA9X4_SYSWDT (0x1e007000)
23#define CT_CA9X4_L2CC (0x1e00a000)
24
25#define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000)
26#define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100)
27#define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200)
28#define A9_MPCORE_TWD (CT_CA9X4_MPIC + 0x0600)
29#define A9_MPCORE_GIC_DIST (CT_CA9X4_MPIC + 0x1000)
30
31/*
32 * Interrupts. Those in {} are for AMBA devices
33 */
34#define IRQ_CT_CA9X4_CLCDC { 76 }
35#define IRQ_CT_CA9X4_DMC { 0 }
36#define IRQ_CT_CA9X4_SMC { 77, 78 }
37#define IRQ_CT_CA9X4_TIMER0 80
38#define IRQ_CT_CA9X4_TIMER1 81
39#define IRQ_CT_CA9X4_GPIO { 82 }
40#define IRQ_CT_CA9X4_PMU_CPU0 92
41#define IRQ_CT_CA9X4_PMU_CPU1 93
42#define IRQ_CT_CA9X4_PMU_CPU2 94
43#define IRQ_CT_CA9X4_PMU_CPU3 95
44
45extern struct ct_desc ct_ca9x4_desc;
46
47#endif
diff --git a/arch/arm/mach-vexpress/include/mach/hardware.h b/arch/arm/mach-vexpress/include/mach/hardware.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-vexpress/include/mach/hardware.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-vexpress/include/mach/irqs.h b/arch/arm/mach-vexpress/include/mach/irqs.h
deleted file mode 100644
index f8f7f782eb55..000000000000
--- a/arch/arm/mach-vexpress/include/mach/irqs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#define IRQ_LOCALTIMER 29
2#define IRQ_LOCALWDOG 30
3
4#ifndef CONFIG_SPARSE_IRQ
5#define NR_IRQS 256
6#endif
diff --git a/arch/arm/mach-vexpress/include/mach/motherboard.h b/arch/arm/mach-vexpress/include/mach/motherboard.h
deleted file mode 100644
index 68abc8b72781..000000000000
--- a/arch/arm/mach-vexpress/include/mach/motherboard.h
+++ /dev/null
@@ -1,88 +0,0 @@
1#ifndef __MACH_MOTHERBOARD_H
2#define __MACH_MOTHERBOARD_H
3
4/*
5 * Physical addresses, offset from V2M_PA_CS0-3
6 */
7#define V2M_NOR0 (V2M_PA_CS0)
8#define V2M_NOR1 (V2M_PA_CS1)
9#define V2M_SRAM (V2M_PA_CS2)
10#define V2M_VIDEO_SRAM (V2M_PA_CS3 + 0x00000000)
11#define V2M_LAN9118 (V2M_PA_CS3 + 0x02000000)
12#define V2M_ISP1761 (V2M_PA_CS3 + 0x03000000)
13
14/*
15 * Physical addresses, offset from V2M_PA_CS7
16 */
17#define V2M_SYSREGS (V2M_PA_CS7 + 0x00000000)
18#define V2M_SYSCTL (V2M_PA_CS7 + 0x00001000)
19#define V2M_SERIAL_BUS_PCI (V2M_PA_CS7 + 0x00002000)
20
21#define V2M_AACI (V2M_PA_CS7 + 0x00004000)
22#define V2M_MMCI (V2M_PA_CS7 + 0x00005000)
23#define V2M_KMI0 (V2M_PA_CS7 + 0x00006000)
24#define V2M_KMI1 (V2M_PA_CS7 + 0x00007000)
25
26#define V2M_UART0 (V2M_PA_CS7 + 0x00009000)
27#define V2M_UART1 (V2M_PA_CS7 + 0x0000a000)
28#define V2M_UART2 (V2M_PA_CS7 + 0x0000b000)
29#define V2M_UART3 (V2M_PA_CS7 + 0x0000c000)
30
31#define V2M_WDT (V2M_PA_CS7 + 0x0000f000)
32
33#define V2M_TIMER01 (V2M_PA_CS7 + 0x00011000)
34#define V2M_TIMER23 (V2M_PA_CS7 + 0x00012000)
35
36#define V2M_SERIAL_BUS_DVI (V2M_PA_CS7 + 0x00016000)
37#define V2M_RTC (V2M_PA_CS7 + 0x00017000)
38
39#define V2M_CF (V2M_PA_CS7 + 0x0001a000)
40#define V2M_CLCD (V2M_PA_CS7 + 0x0001f000)
41
42
43/*
44 * Interrupts. Those in {} are for AMBA devices
45 */
46#define IRQ_V2M_WDT { (32 + 0) }
47#define IRQ_V2M_TIMER0 (32 + 2)
48#define IRQ_V2M_TIMER1 (32 + 2)
49#define IRQ_V2M_TIMER2 (32 + 3)
50#define IRQ_V2M_TIMER3 (32 + 3)
51#define IRQ_V2M_RTC { (32 + 4) }
52#define IRQ_V2M_UART0 { (32 + 5) }
53#define IRQ_V2M_UART1 { (32 + 6) }
54#define IRQ_V2M_UART2 { (32 + 7) }
55#define IRQ_V2M_UART3 { (32 + 8) }
56#define IRQ_V2M_MMCI { (32 + 9), (32 + 10) }
57#define IRQ_V2M_AACI { (32 + 11) }
58#define IRQ_V2M_KMI0 { (32 + 12) }
59#define IRQ_V2M_KMI1 { (32 + 13) }
60#define IRQ_V2M_CLCD { (32 + 14) }
61#define IRQ_V2M_LAN9118 (32 + 15)
62#define IRQ_V2M_ISP1761 (32 + 16)
63#define IRQ_V2M_PCIE (32 + 17)
64
65
66/*
67 * Core tile IDs
68 */
69#define V2M_CT_ID_CA9 0x0c000191
70#define V2M_CT_ID_UNSUPPORTED 0xff000191
71#define V2M_CT_ID_MASK 0xff000fff
72
73struct ct_desc {
74 u32 id;
75 const char *name;
76 void (*map_io)(void);
77 void (*init_early)(void);
78 void (*init_irq)(void);
79 void (*init_tile)(void);
80#ifdef CONFIG_SMP
81 void (*init_cpu_map)(void);
82 void (*smp_enable)(unsigned int);
83#endif
84};
85
86extern struct ct_desc *ct_desc;
87
88#endif
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index a1f3804fd5a5..83188cf1875d 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -19,48 +19,10 @@
19#include <asm/smp_scu.h> 19#include <asm/smp_scu.h>
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21 21
22#include <mach/motherboard.h>
23
24#include <plat/platsmp.h> 22#include <plat/platsmp.h>
25 23
26#include "core.h" 24#include "core.h"
27 25
28/*
29 * Initialise the CPU possible map early - this describes the CPUs
30 * which may be present or become present in the system.
31 */
32static void __init vexpress_smp_init_cpus(void)
33{
34 ct_desc->init_cpu_map();
35}
36
37static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
38{
39 /*
40 * Initialise the present map, which describes the set of CPUs
41 * actually populated at the present time.
42 */
43 ct_desc->smp_enable(max_cpus);
44
45 /*
46 * Write the address of secondary startup into the
47 * system-wide flags register. The boot monitor waits
48 * until it receives a soft interrupt, and then the
49 * secondary CPU branches to this address.
50 */
51 vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
52}
53
54struct smp_operations __initdata vexpress_smp_ops = {
55 .smp_init_cpus = vexpress_smp_init_cpus,
56 .smp_prepare_cpus = vexpress_smp_prepare_cpus,
57 .smp_secondary_init = versatile_secondary_init,
58 .smp_boot_secondary = versatile_boot_secondary,
59#ifdef CONFIG_HOTPLUG_CPU
60 .cpu_die = vexpress_cpu_die,
61#endif
62};
63
64bool __init vexpress_smp_init_ops(void) 26bool __init vexpress_smp_init_ops(void)
65{ 27{
66#ifdef CONFIG_MCPM 28#ifdef CONFIG_MCPM
@@ -79,8 +41,6 @@ bool __init vexpress_smp_init_ops(void)
79 return false; 41 return false;
80} 42}
81 43
82#if defined(CONFIG_OF)
83
84static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = { 44static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = {
85 { .compatible = "arm,cortex-a5-scu", }, 45 { .compatible = "arm,cortex-a5-scu", },
86 { .compatible = "arm,cortex-a9-scu", }, 46 { .compatible = "arm,cortex-a9-scu", },
@@ -112,5 +72,3 @@ struct smp_operations __initdata vexpress_smp_dt_ops = {
112 .cpu_die = vexpress_cpu_die, 72 .cpu_die = vexpress_cpu_die,
113#endif 73#endif
114}; 74};
115
116#endif
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 6ff681a24ba7..a0400f4cca89 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -1,380 +1,7 @@
1/*
2 * Versatile Express V2M Motherboard Support
3 */
4#include <linux/device.h>
5#include <linux/amba/bus.h>
6#include <linux/amba/mmci.h>
7#include <linux/io.h>
8#include <linux/smp.h>
9#include <linux/init.h>
10#include <linux/of_address.h>
11#include <linux/of_fdt.h>
12#include <linux/of_irq.h>
13#include <linux/of_platform.h>
14#include <linux/platform_device.h>
15#include <linux/ata_platform.h>
16#include <linux/smsc911x.h>
17#include <linux/spinlock.h>
18#include <linux/usb/isp1760.h>
19#include <linux/mtd/physmap.h>
20#include <linux/regulator/fixed.h>
21#include <linux/regulator/machine.h>
22#include <linux/vexpress.h>
23#include <linux/clkdev.h>
24
25#include <asm/mach-types.h>
26#include <asm/sizes.h>
27#include <asm/mach/arch.h> 1#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/time.h>
30#include <asm/hardware/arm_timer.h>
31#include <asm/hardware/cache-l2x0.h>
32#include <asm/hardware/timer-sp.h>
33
34#include <mach/ct-ca9x4.h>
35#include <mach/motherboard.h>
36
37#include <plat/sched_clock.h>
38#include <plat/platsmp.h>
39 2
40#include "core.h" 3#include "core.h"
41 4
42#define V2M_PA_CS0 0x40000000
43#define V2M_PA_CS1 0x44000000
44#define V2M_PA_CS2 0x48000000
45#define V2M_PA_CS3 0x4c000000
46#define V2M_PA_CS7 0x10000000
47
48static struct map_desc v2m_io_desc[] __initdata = {
49 {
50 .virtual = V2M_PERIPH,
51 .pfn = __phys_to_pfn(V2M_PA_CS7),
52 .length = SZ_128K,
53 .type = MT_DEVICE,
54 },
55};
56
57static void __init v2m_sp804_init(void __iomem *base, unsigned int irq)
58{
59 if (WARN_ON(!base || irq == NO_IRQ))
60 return;
61
62 sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1");
63 sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0");
64}
65
66
67static struct resource v2m_pcie_i2c_resource = {
68 .start = V2M_SERIAL_BUS_PCI,
69 .end = V2M_SERIAL_BUS_PCI + SZ_4K - 1,
70 .flags = IORESOURCE_MEM,
71};
72
73static struct platform_device v2m_pcie_i2c_device = {
74 .name = "versatile-i2c",
75 .id = 0,
76 .num_resources = 1,
77 .resource = &v2m_pcie_i2c_resource,
78};
79
80static struct resource v2m_ddc_i2c_resource = {
81 .start = V2M_SERIAL_BUS_DVI,
82 .end = V2M_SERIAL_BUS_DVI + SZ_4K - 1,
83 .flags = IORESOURCE_MEM,
84};
85
86static struct platform_device v2m_ddc_i2c_device = {
87 .name = "versatile-i2c",
88 .id = 1,
89 .num_resources = 1,
90 .resource = &v2m_ddc_i2c_resource,
91};
92
93static struct resource v2m_eth_resources[] = {
94 {
95 .start = V2M_LAN9118,
96 .end = V2M_LAN9118 + SZ_64K - 1,
97 .flags = IORESOURCE_MEM,
98 }, {
99 .start = IRQ_V2M_LAN9118,
100 .end = IRQ_V2M_LAN9118,
101 .flags = IORESOURCE_IRQ,
102 },
103};
104
105static struct smsc911x_platform_config v2m_eth_config = {
106 .flags = SMSC911X_USE_32BIT,
107 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
108 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
109 .phy_interface = PHY_INTERFACE_MODE_MII,
110};
111
112static struct platform_device v2m_eth_device = {
113 .name = "smsc911x",
114 .id = -1,
115 .resource = v2m_eth_resources,
116 .num_resources = ARRAY_SIZE(v2m_eth_resources),
117 .dev.platform_data = &v2m_eth_config,
118};
119
120static struct regulator_consumer_supply v2m_eth_supplies[] = {
121 REGULATOR_SUPPLY("vddvario", "smsc911x"),
122 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
123};
124
125static struct resource v2m_usb_resources[] = {
126 {
127 .start = V2M_ISP1761,
128 .end = V2M_ISP1761 + SZ_128K - 1,
129 .flags = IORESOURCE_MEM,
130 }, {
131 .start = IRQ_V2M_ISP1761,
132 .end = IRQ_V2M_ISP1761,
133 .flags = IORESOURCE_IRQ,
134 },
135};
136
137static struct isp1760_platform_data v2m_usb_config = {
138 .is_isp1761 = true,
139 .bus_width_16 = false,
140 .port1_otg = true,
141 .analog_oc = false,
142 .dack_polarity_high = false,
143 .dreq_polarity_high = false,
144};
145
146static struct platform_device v2m_usb_device = {
147 .name = "isp1760",
148 .id = -1,
149 .resource = v2m_usb_resources,
150 .num_resources = ARRAY_SIZE(v2m_usb_resources),
151 .dev.platform_data = &v2m_usb_config,
152};
153
154static struct physmap_flash_data v2m_flash_data = {
155 .width = 4,
156};
157
158static struct resource v2m_flash_resources[] = {
159 {
160 .start = V2M_NOR0,
161 .end = V2M_NOR0 + SZ_64M - 1,
162 .flags = IORESOURCE_MEM,
163 }, {
164 .start = V2M_NOR1,
165 .end = V2M_NOR1 + SZ_64M - 1,
166 .flags = IORESOURCE_MEM,
167 },
168};
169
170static struct platform_device v2m_flash_device = {
171 .name = "physmap-flash",
172 .id = -1,
173 .resource = v2m_flash_resources,
174 .num_resources = ARRAY_SIZE(v2m_flash_resources),
175 .dev.platform_data = &v2m_flash_data,
176};
177
178static struct pata_platform_info v2m_pata_data = {
179 .ioport_shift = 2,
180};
181
182static struct resource v2m_pata_resources[] = {
183 {
184 .start = V2M_CF,
185 .end = V2M_CF + 0xff,
186 .flags = IORESOURCE_MEM,
187 }, {
188 .start = V2M_CF + 0x100,
189 .end = V2M_CF + SZ_4K - 1,
190 .flags = IORESOURCE_MEM,
191 },
192};
193
194static struct platform_device v2m_cf_device = {
195 .name = "pata_platform",
196 .id = -1,
197 .resource = v2m_pata_resources,
198 .num_resources = ARRAY_SIZE(v2m_pata_resources),
199 .dev.platform_data = &v2m_pata_data,
200};
201
202static struct mmci_platform_data v2m_mmci_data = {
203 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
204 .status = vexpress_get_mci_cardin,
205 .gpio_cd = -1,
206 .gpio_wp = -1,
207};
208
209static struct resource v2m_sysreg_resources[] = {
210 {
211 .start = V2M_SYSREGS,
212 .end = V2M_SYSREGS + 0xfff,
213 .flags = IORESOURCE_MEM,
214 },
215};
216
217static struct platform_device v2m_sysreg_device = {
218 .name = "vexpress-sysreg",
219 .id = -1,
220 .resource = v2m_sysreg_resources,
221 .num_resources = ARRAY_SIZE(v2m_sysreg_resources),
222};
223
224static struct platform_device v2m_muxfpga_device = {
225 .name = "vexpress-muxfpga",
226 .id = 0,
227 .num_resources = 1,
228 .resource = (struct resource []) {
229 VEXPRESS_RES_FUNC(0, 7),
230 }
231};
232
233static struct platform_device v2m_shutdown_device = {
234 .name = "vexpress-shutdown",
235 .id = 0,
236 .num_resources = 1,
237 .resource = (struct resource []) {
238 VEXPRESS_RES_FUNC(0, 8),
239 }
240};
241
242static struct platform_device v2m_reboot_device = {
243 .name = "vexpress-reboot",
244 .id = 0,
245 .num_resources = 1,
246 .resource = (struct resource []) {
247 VEXPRESS_RES_FUNC(0, 9),
248 }
249};
250
251static struct platform_device v2m_dvimode_device = {
252 .name = "vexpress-dvimode",
253 .id = 0,
254 .num_resources = 1,
255 .resource = (struct resource []) {
256 VEXPRESS_RES_FUNC(0, 11),
257 }
258};
259
260static AMBA_APB_DEVICE(aaci, "mb:aaci", 0, V2M_AACI, IRQ_V2M_AACI, NULL);
261static AMBA_APB_DEVICE(mmci, "mb:mmci", 0, V2M_MMCI, IRQ_V2M_MMCI, &v2m_mmci_data);
262static AMBA_APB_DEVICE(kmi0, "mb:kmi0", 0, V2M_KMI0, IRQ_V2M_KMI0, NULL);
263static AMBA_APB_DEVICE(kmi1, "mb:kmi1", 0, V2M_KMI1, IRQ_V2M_KMI1, NULL);
264static AMBA_APB_DEVICE(uart0, "mb:uart0", 0, V2M_UART0, IRQ_V2M_UART0, NULL);
265static AMBA_APB_DEVICE(uart1, "mb:uart1", 0, V2M_UART1, IRQ_V2M_UART1, NULL);
266static AMBA_APB_DEVICE(uart2, "mb:uart2", 0, V2M_UART2, IRQ_V2M_UART2, NULL);
267static AMBA_APB_DEVICE(uart3, "mb:uart3", 0, V2M_UART3, IRQ_V2M_UART3, NULL);
268static AMBA_APB_DEVICE(wdt, "mb:wdt", 0, V2M_WDT, IRQ_V2M_WDT, NULL);
269static AMBA_APB_DEVICE(rtc, "mb:rtc", 0, V2M_RTC, IRQ_V2M_RTC, NULL);
270
271static struct amba_device *v2m_amba_devs[] __initdata = {
272 &aaci_device,
273 &mmci_device,
274 &kmi0_device,
275 &kmi1_device,
276 &uart0_device,
277 &uart1_device,
278 &uart2_device,
279 &uart3_device,
280 &wdt_device,
281 &rtc_device,
282};
283
284static void __init v2m_timer_init(void)
285{
286 vexpress_clk_init(ioremap(V2M_SYSCTL, SZ_4K));
287 v2m_sp804_init(ioremap(V2M_TIMER01, SZ_4K), IRQ_V2M_TIMER0);
288}
289
290static void __init v2m_init_early(void)
291{
292 if (ct_desc->init_early)
293 ct_desc->init_early();
294 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000);
295}
296
297struct ct_desc *ct_desc;
298
299static struct ct_desc *ct_descs[] __initdata = {
300#ifdef CONFIG_ARCH_VEXPRESS_CA9X4
301 &ct_ca9x4_desc,
302#endif
303};
304
305static void __init v2m_populate_ct_desc(void)
306{
307 int i;
308 u32 current_tile_id;
309
310 ct_desc = NULL;
311 current_tile_id = vexpress_get_procid(VEXPRESS_SITE_MASTER)
312 & V2M_CT_ID_MASK;
313
314 for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i)
315 if (ct_descs[i]->id == current_tile_id)
316 ct_desc = ct_descs[i];
317
318 if (!ct_desc)
319 panic("vexpress: this kernel does not support core tile ID 0x%08x when booting via ATAGs.\n"
320 "You may need a device tree blob or a different kernel to boot on this board.\n",
321 current_tile_id);
322}
323
324static void __init v2m_map_io(void)
325{
326 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc));
327 vexpress_sysreg_early_init(ioremap(V2M_SYSREGS, SZ_4K));
328 v2m_populate_ct_desc();
329 ct_desc->map_io();
330}
331
332static void __init v2m_init_irq(void)
333{
334 ct_desc->init_irq();
335}
336
337static void __init v2m_init(void)
338{
339 int i;
340
341 regulator_register_fixed(0, v2m_eth_supplies,
342 ARRAY_SIZE(v2m_eth_supplies));
343
344 platform_device_register(&v2m_sysreg_device);
345 platform_device_register(&v2m_pcie_i2c_device);
346 platform_device_register(&v2m_ddc_i2c_device);
347 platform_device_register(&v2m_flash_device);
348 platform_device_register(&v2m_cf_device);
349 platform_device_register(&v2m_eth_device);
350 platform_device_register(&v2m_usb_device);
351
352 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++)
353 amba_device_register(v2m_amba_devs[i], &iomem_resource);
354
355 vexpress_syscfg_device_register(&v2m_muxfpga_device);
356 vexpress_syscfg_device_register(&v2m_shutdown_device);
357 vexpress_syscfg_device_register(&v2m_reboot_device);
358 vexpress_syscfg_device_register(&v2m_dvimode_device);
359
360 ct_desc->init_tile();
361}
362
363MACHINE_START(VEXPRESS, "ARM-Versatile Express")
364 .atag_offset = 0x100,
365 .smp = smp_ops(vexpress_smp_ops),
366 .map_io = v2m_map_io,
367 .init_early = v2m_init_early,
368 .init_irq = v2m_init_irq,
369 .init_time = v2m_timer_init,
370 .init_machine = v2m_init,
371MACHINE_END
372
373static void __init v2m_dt_init(void)
374{
375 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
376}
377
378static const char * const v2m_dt_match[] __initconst = { 5static const char * const v2m_dt_match[] __initconst = {
379 "arm,vexpress", 6 "arm,vexpress",
380 NULL, 7 NULL,
@@ -386,5 +13,4 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
386 .l2c_aux_mask = 0xfe0fffff, 13 .l2c_aux_mask = 0xfe0fffff,
387 .smp = smp_ops(vexpress_smp_dt_ops), 14 .smp = smp_ops(vexpress_smp_dt_ops),
388 .smp_init = smp_init_ops(vexpress_smp_init_ops), 15 .smp_init = smp_init_ops(vexpress_smp_init_ops),
389 .init_machine = v2m_dt_init,
390MACHINE_END 16MACHINE_END
diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile
index c85fb3f7d5cd..b03a97eb7501 100644
--- a/arch/arm/mach-zynq/Makefile
+++ b/arch/arm/mach-zynq/Makefile
@@ -4,6 +4,4 @@
4 4
5# Common support 5# Common support
6obj-y := common.o slcr.o pm.o 6obj-y := common.o slcr.o pm.o
7CFLAGS_REMOVE_hotplug.o =-march=armv6k
8CFLAGS_hotplug.o =-Wa,-march=armv7-a -mcpu=cortex-a9
9obj-$(CONFIG_SMP) += headsmp.o platsmp.o 7obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index 2bc71273c73c..382c60e9aa16 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -29,7 +29,6 @@ extern void zynq_slcr_cpu_state_write(int cpu, bool die);
29extern u32 zynq_slcr_get_device_id(void); 29extern u32 zynq_slcr_get_device_id(void);
30 30
31#ifdef CONFIG_SMP 31#ifdef CONFIG_SMP
32extern void secondary_startup(void);
33extern char zynq_secondary_trampoline; 32extern char zynq_secondary_trampoline;
34extern char zynq_secondary_trampoline_jump; 33extern char zynq_secondary_trampoline_jump;
35extern char zynq_secondary_trampoline_end; 34extern char zynq_secondary_trampoline_end;
diff --git a/arch/arm/mach-zynq/hotplug.c b/arch/arm/mach-zynq/hotplug.c
deleted file mode 100644
index b685c89f11e4..000000000000
--- a/arch/arm/mach-zynq/hotplug.c
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright (C) 2012-2013 Xilinx
3 *
4 * based on linux/arch/arm/mach-realview/hotplug.c
5 *
6 * Copyright (C) 2002 ARM Ltd.
7 * All Rights Reserved
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#include <asm/proc-fns.h>
14
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 7eb94e6fc376..ab906b801047 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -21,7 +21,7 @@ config CPU_ARM7TDMI
21 21
22# ARM720T 22# ARM720T
23config CPU_ARM720T 23config CPU_ARM720T
24 bool "Support ARM720T processor" if ARCH_INTEGRATOR 24 bool "Support ARM720T processor" if (ARCH_MULTI_V4T && ARCH_INTEGRATOR)
25 select CPU_32v4T 25 select CPU_32v4T
26 select CPU_ABRT_LV4T 26 select CPU_ABRT_LV4T
27 select CPU_CACHE_V4 27 select CPU_CACHE_V4
@@ -39,7 +39,7 @@ config CPU_ARM720T
39 39
40# ARM740T 40# ARM740T
41config CPU_ARM740T 41config CPU_ARM740T
42 bool "Support ARM740T processor" if ARCH_INTEGRATOR 42 bool "Support ARM740T processor" if (ARCH_MULTI_V4T && ARCH_INTEGRATOR)
43 depends on !MMU 43 depends on !MMU
44 select CPU_32v4T 44 select CPU_32v4T
45 select CPU_ABRT_LV4T 45 select CPU_ABRT_LV4T
@@ -71,7 +71,7 @@ config CPU_ARM9TDMI
71 71
72# ARM920T 72# ARM920T
73config CPU_ARM920T 73config CPU_ARM920T
74 bool "Support ARM920T processor" if ARCH_INTEGRATOR 74 bool "Support ARM920T processor" if (ARCH_MULTI_V4T && ARCH_INTEGRATOR)
75 select CPU_32v4T 75 select CPU_32v4T
76 select CPU_ABRT_EV4T 76 select CPU_ABRT_EV4T
77 select CPU_CACHE_V4WT 77 select CPU_CACHE_V4WT
@@ -89,7 +89,7 @@ config CPU_ARM920T
89 89
90# ARM922T 90# ARM922T
91config CPU_ARM922T 91config CPU_ARM922T
92 bool "Support ARM922T processor" if ARCH_INTEGRATOR 92 bool "Support ARM922T processor" if (ARCH_MULTI_V4T && ARCH_INTEGRATOR)
93 select CPU_32v4T 93 select CPU_32v4T
94 select CPU_ABRT_EV4T 94 select CPU_ABRT_EV4T
95 select CPU_CACHE_V4WT 95 select CPU_CACHE_V4WT
@@ -127,7 +127,7 @@ config CPU_ARM925T
127 127
128# ARM926T 128# ARM926T
129config CPU_ARM926T 129config CPU_ARM926T
130 bool "Support ARM926T processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB 130 bool "Support ARM926T processor" if (!ARCH_MULTIPLATFORM || ARCH_MULTI_V5) && (ARCH_INTEGRATOR || MACH_REALVIEW_EB)
131 select CPU_32v5 131 select CPU_32v5
132 select CPU_ABRT_EV5TJ 132 select CPU_ABRT_EV5TJ
133 select CPU_CACHE_VIVT 133 select CPU_CACHE_VIVT
@@ -163,7 +163,7 @@ config CPU_FA526
163 163
164# ARM940T 164# ARM940T
165config CPU_ARM940T 165config CPU_ARM940T
166 bool "Support ARM940T processor" if ARCH_INTEGRATOR 166 bool "Support ARM940T processor" if (ARCH_MULTI_V4T && ARCH_INTEGRATOR)
167 depends on !MMU 167 depends on !MMU
168 select CPU_32v4T 168 select CPU_32v4T
169 select CPU_ABRT_NOMMU 169 select CPU_ABRT_NOMMU
@@ -181,7 +181,7 @@ config CPU_ARM940T
181 181
182# ARM946E-S 182# ARM946E-S
183config CPU_ARM946E 183config CPU_ARM946E
184 bool "Support ARM946E-S processor" if ARCH_INTEGRATOR 184 bool "Support ARM946E-S processor" if (ARCH_MULTI_V5 && ARCH_INTEGRATOR)
185 depends on !MMU 185 depends on !MMU
186 select CPU_32v5 186 select CPU_32v5
187 select CPU_ABRT_NOMMU 187 select CPU_ABRT_NOMMU
@@ -198,7 +198,7 @@ config CPU_ARM946E
198 198
199# ARM1020 - needs validating 199# ARM1020 - needs validating
200config CPU_ARM1020 200config CPU_ARM1020
201 bool "Support ARM1020T (rev 0) processor" if ARCH_INTEGRATOR 201 bool "Support ARM1020T (rev 0) processor" if (ARCH_MULTI_V5 && ARCH_INTEGRATOR)
202 select CPU_32v5 202 select CPU_32v5
203 select CPU_ABRT_EV4T 203 select CPU_ABRT_EV4T
204 select CPU_CACHE_V4WT 204 select CPU_CACHE_V4WT
@@ -216,7 +216,7 @@ config CPU_ARM1020
216 216
217# ARM1020E - needs validating 217# ARM1020E - needs validating
218config CPU_ARM1020E 218config CPU_ARM1020E
219 bool "Support ARM1020E processor" if ARCH_INTEGRATOR 219 bool "Support ARM1020E processor" if (ARCH_MULTI_V5 && ARCH_INTEGRATOR)
220 depends on n 220 depends on n
221 select CPU_32v5 221 select CPU_32v5
222 select CPU_ABRT_EV4T 222 select CPU_ABRT_EV4T
@@ -229,7 +229,7 @@ config CPU_ARM1020E
229 229
230# ARM1022E 230# ARM1022E
231config CPU_ARM1022 231config CPU_ARM1022
232 bool "Support ARM1022E processor" if ARCH_INTEGRATOR 232 bool "Support ARM1022E processor" if (ARCH_MULTI_V5 && ARCH_INTEGRATOR)
233 select CPU_32v5 233 select CPU_32v5
234 select CPU_ABRT_EV4T 234 select CPU_ABRT_EV4T
235 select CPU_CACHE_VIVT 235 select CPU_CACHE_VIVT
@@ -247,7 +247,7 @@ config CPU_ARM1022
247 247
248# ARM1026EJ-S 248# ARM1026EJ-S
249config CPU_ARM1026 249config CPU_ARM1026
250 bool "Support ARM1026EJ-S processor" if ARCH_INTEGRATOR 250 bool "Support ARM1026EJ-S processor" if (ARCH_MULTI_V5 && ARCH_INTEGRATOR)
251 select CPU_32v5 251 select CPU_32v5
252 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10 252 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10
253 select CPU_CACHE_VIVT 253 select CPU_CACHE_VIVT
@@ -358,7 +358,7 @@ config CPU_PJ4B
358 358
359# ARMv6 359# ARMv6
360config CPU_V6 360config CPU_V6
361 bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX 361 bool "Support ARM V6 processor" if (!ARCH_MULTIPLATFORM || ARCH_MULTI_V6) && (ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX)
362 select CPU_32v6 362 select CPU_32v6
363 select CPU_ABRT_EV6 363 select CPU_ABRT_EV6
364 select CPU_CACHE_V6 364 select CPU_CACHE_V6
@@ -371,7 +371,7 @@ config CPU_V6
371 371
372# ARMv6k 372# ARMv6k
373config CPU_V6K 373config CPU_V6K
374 bool "Support ARM V6K processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX 374 bool "Support ARM V6K processor" if (!ARCH_MULTIPLATFORM || ARCH_MULTI_V6) && (ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX)
375 select CPU_32v6 375 select CPU_32v6
376 select CPU_32v6K 376 select CPU_32v6K
377 select CPU_ABRT_EV6 377 select CPU_ABRT_EV6
@@ -385,7 +385,7 @@ config CPU_V6K
385 385
386# ARMv7 386# ARMv7
387config CPU_V7 387config CPU_V7
388 bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX 388 bool "Support ARM V7 processor" if (!ARCH_MULTIPLATFORM || ARCH_MULTI_V7) && (ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX)
389 select CPU_32v6K 389 select CPU_32v6K
390 select CPU_32v7 390 select CPU_32v7
391 select CPU_ABRT_EV7 391 select CPU_ABRT_EV7
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index e048f6198d68..5168a52a17f9 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -306,9 +306,10 @@ EXPORT_SYMBOL(orion_gpio_set_blink);
306 306
307#define ORION_BLINK_HALF_PERIOD 100 /* ms */ 307#define ORION_BLINK_HALF_PERIOD 100 /* ms */
308 308
309int orion_gpio_led_blink_set(unsigned gpio, int state, 309int orion_gpio_led_blink_set(struct gpio_desc *desc, int state,
310 unsigned long *delay_on, unsigned long *delay_off) 310 unsigned long *delay_on, unsigned long *delay_off)
311{ 311{
312 unsigned gpio = desc_to_gpio(desc);
312 313
313 if (delay_on && delay_off && !*delay_on && !*delay_off) 314 if (delay_on && delay_off && !*delay_on && !*delay_off)
314 *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD; 315 *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD;
@@ -505,9 +506,9 @@ static void orion_gpio_unmask_irq(struct irq_data *d)
505 u32 mask = d->mask; 506 u32 mask = d->mask;
506 507
507 irq_gc_lock(gc); 508 irq_gc_lock(gc);
508 reg_val = irq_reg_readl(gc->reg_base + ct->regs.mask); 509 reg_val = irq_reg_readl(gc, ct->regs.mask);
509 reg_val |= mask; 510 reg_val |= mask;
510 irq_reg_writel(reg_val, gc->reg_base + ct->regs.mask); 511 irq_reg_writel(gc, reg_val, ct->regs.mask);
511 irq_gc_unlock(gc); 512 irq_gc_unlock(gc);
512} 513}
513 514
@@ -519,9 +520,9 @@ static void orion_gpio_mask_irq(struct irq_data *d)
519 u32 reg_val; 520 u32 reg_val;
520 521
521 irq_gc_lock(gc); 522 irq_gc_lock(gc);
522 reg_val = irq_reg_readl(gc->reg_base + ct->regs.mask); 523 reg_val = irq_reg_readl(gc, ct->regs.mask);
523 reg_val &= ~mask; 524 reg_val &= ~mask;
524 irq_reg_writel(reg_val, gc->reg_base + ct->regs.mask); 525 irq_reg_writel(gc, reg_val, ct->regs.mask);
525 irq_gc_unlock(gc); 526 irq_gc_unlock(gc);
526} 527}
527 528
diff --git a/arch/arm/plat-orion/include/plat/orion-gpio.h b/arch/arm/plat-orion/include/plat/orion-gpio.h
index e763988b04b9..e856b073a9c8 100644
--- a/arch/arm/plat-orion/include/plat/orion-gpio.h
+++ b/arch/arm/plat-orion/include/plat/orion-gpio.h
@@ -14,12 +14,15 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/irqdomain.h> 16#include <linux/irqdomain.h>
17
18struct gpio_desc;
19
17/* 20/*
18 * Orion-specific GPIO API extensions. 21 * Orion-specific GPIO API extensions.
19 */ 22 */
20void orion_gpio_set_unused(unsigned pin); 23void orion_gpio_set_unused(unsigned pin);
21void orion_gpio_set_blink(unsigned pin, int blink); 24void orion_gpio_set_blink(unsigned pin, int blink);
22int orion_gpio_led_blink_set(unsigned gpio, int state, 25int orion_gpio_led_blink_set(struct gpio_desc *desc, int state,
23 unsigned long *delay_on, unsigned long *delay_off); 26 unsigned long *delay_on, unsigned long *delay_off);
24 27
25#define GPIO_INPUT_OK (1 << 0) 28#define GPIO_INPUT_OK (1 << 0)
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index f0a008496993..87746c37f030 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_SAMSUNG_DMADEV) += dma-ops.o
35# PM support 35# PM support
36 36
37obj-$(CONFIG_PM_SLEEP) += pm-common.o 37obj-$(CONFIG_PM_SLEEP) += pm-common.o
38obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm-common.o
38obj-$(CONFIG_SAMSUNG_PM) += pm.o 39obj-$(CONFIG_SAMSUNG_PM) += pm.o
39obj-$(CONFIG_SAMSUNG_PM_GPIO) += pm-gpio.o 40obj-$(CONFIG_SAMSUNG_PM_GPIO) += pm-gpio.o
40obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o 41obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h
index f5b9d3ff9cd4..f5cf2bd208e0 100644
--- a/arch/arm/plat-samsung/include/plat/map-s5p.h
+++ b/arch/arm/plat-samsung/include/plat/map-s5p.h
@@ -15,43 +15,22 @@
15 15
16#define S5P_VA_CHIPID S3C_ADDR(0x02000000) 16#define S5P_VA_CHIPID S3C_ADDR(0x02000000)
17#define S5P_VA_CMU S3C_ADDR(0x02100000) 17#define S5P_VA_CMU S3C_ADDR(0x02100000)
18#define S5P_VA_GPIO S3C_ADDR(0x02200000)
19#define S5P_VA_GPIO1 S5P_VA_GPIO
20#define S5P_VA_GPIO2 S3C_ADDR(0x02240000)
21#define S5P_VA_GPIO3 S3C_ADDR(0x02280000)
22 18
23#define S5P_VA_SYSRAM S3C_ADDR(0x02400000)
24#define S5P_VA_SYSRAM_NS S3C_ADDR(0x02410000)
25#define S5P_VA_DMC0 S3C_ADDR(0x02440000) 19#define S5P_VA_DMC0 S3C_ADDR(0x02440000)
26#define S5P_VA_DMC1 S3C_ADDR(0x02480000) 20#define S5P_VA_DMC1 S3C_ADDR(0x02480000)
27#define S5P_VA_SROMC S3C_ADDR(0x024C0000) 21#define S5P_VA_SROMC S3C_ADDR(0x024C0000)
28 22
29#define S5P_VA_SYSTIMER S3C_ADDR(0x02500000)
30#define S5P_VA_L2CC S3C_ADDR(0x02600000)
31
32#define S5P_VA_COMBINER_BASE S3C_ADDR(0x02700000)
33#define S5P_VA_COMBINER(x) (S5P_VA_COMBINER_BASE + ((x) >> 2) * 0x10)
34
35#define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000) 23#define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000)
36#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x)) 24#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x))
37#define S5P_VA_SCU S5P_VA_COREPERI(0x0) 25#define S5P_VA_SCU S5P_VA_COREPERI(0x0)
38#define S5P_VA_TWD S5P_VA_COREPERI(0x600) 26#define S5P_VA_TWD S5P_VA_COREPERI(0x600)
39 27
40#define S5P_VA_GIC_CPU S3C_ADDR(0x02810000)
41#define S5P_VA_GIC_DIST S3C_ADDR(0x02820000)
42
43#define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000)) 28#define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000))
44#define VA_VIC0 VA_VIC(0) 29#define VA_VIC0 VA_VIC(0)
45#define VA_VIC1 VA_VIC(1) 30#define VA_VIC1 VA_VIC(1)
46#define VA_VIC2 VA_VIC(2) 31#define VA_VIC2 VA_VIC(2)
47#define VA_VIC3 VA_VIC(3) 32#define VA_VIC3 VA_VIC(3)
48 33
49#define S5P_VA_UART(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
50#define S5P_VA_UART0 S5P_VA_UART(0)
51#define S5P_VA_UART1 S5P_VA_UART(1)
52#define S5P_VA_UART2 S5P_VA_UART(2)
53#define S5P_VA_UART3 S5P_VA_UART(3)
54
55#ifndef S3C_UART_OFFSET 34#ifndef S3C_UART_OFFSET
56#define S3C_UART_OFFSET (0x400) 35#define S3C_UART_OFFSET (0x400)
57#endif 36#endif
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index a301ca2c7d00..49b8ef91584a 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -4,6 +4,6 @@ config PLAT_VERSATILE_CLOCK
4 bool 4 bool
5 5
6config PLAT_VERSATILE_SCHED_CLOCK 6config PLAT_VERSATILE_SCHED_CLOCK
7 def_bool y 7 bool
8 8
9endif 9endif
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 9532f8d5857e..6b1ebd964c10 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -24,9 +24,9 @@ config ARM64
24 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 24 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
25 select GENERIC_CPU_AUTOPROBE 25 select GENERIC_CPU_AUTOPROBE
26 select GENERIC_EARLY_IOREMAP 26 select GENERIC_EARLY_IOREMAP
27 select GENERIC_IOMAP
28 select GENERIC_IRQ_PROBE 27 select GENERIC_IRQ_PROBE
29 select GENERIC_IRQ_SHOW 28 select GENERIC_IRQ_SHOW
29 select GENERIC_PCI_IOMAP
30 select GENERIC_SCHED_CLOCK 30 select GENERIC_SCHED_CLOCK
31 select GENERIC_SMP_IDLE_THREAD 31 select GENERIC_SMP_IDLE_THREAD
32 select GENERIC_STRNCPY_FROM_USER 32 select GENERIC_STRNCPY_FROM_USER
@@ -34,13 +34,16 @@ config ARM64
34 select GENERIC_TIME_VSYSCALL 34 select GENERIC_TIME_VSYSCALL
35 select HANDLE_DOMAIN_IRQ 35 select HANDLE_DOMAIN_IRQ
36 select HARDIRQS_SW_RESEND 36 select HARDIRQS_SW_RESEND
37 select HAVE_ALIGNED_STRUCT_PAGE if SLUB
37 select HAVE_ARCH_AUDITSYSCALL 38 select HAVE_ARCH_AUDITSYSCALL
38 select HAVE_ARCH_JUMP_LABEL 39 select HAVE_ARCH_JUMP_LABEL
39 select HAVE_ARCH_KGDB 40 select HAVE_ARCH_KGDB
41 select HAVE_ARCH_SECCOMP_FILTER
40 select HAVE_ARCH_TRACEHOOK 42 select HAVE_ARCH_TRACEHOOK
41 select HAVE_BPF_JIT 43 select HAVE_BPF_JIT
42 select HAVE_C_RECORDMCOUNT 44 select HAVE_C_RECORDMCOUNT
43 select HAVE_CC_STACKPROTECTOR 45 select HAVE_CC_STACKPROTECTOR
46 select HAVE_CMPXCHG_DOUBLE
44 select HAVE_DEBUG_BUGVERBOSE 47 select HAVE_DEBUG_BUGVERBOSE
45 select HAVE_DEBUG_KMEMLEAK 48 select HAVE_DEBUG_KMEMLEAK
46 select HAVE_DMA_API_DEBUG 49 select HAVE_DMA_API_DEBUG
@@ -142,6 +145,11 @@ source "kernel/Kconfig.freezer"
142 145
143menu "Platform selection" 146menu "Platform selection"
144 147
148config ARCH_SEATTLE
149 bool "AMD Seattle SoC Family"
150 help
151 This enables support for AMD Seattle SOC Family
152
145config ARCH_THUNDER 153config ARCH_THUNDER
146 bool "Cavium Inc. Thunder SoC Family" 154 bool "Cavium Inc. Thunder SoC Family"
147 help 155 help
@@ -166,9 +174,6 @@ endmenu
166 174
167menu "Bus support" 175menu "Bus support"
168 176
169config ARM_AMBA
170 bool
171
172config PCI 177config PCI
173 bool "PCI support" 178 bool "PCI support"
174 help 179 help
@@ -193,6 +198,114 @@ endmenu
193 198
194menu "Kernel Features" 199menu "Kernel Features"
195 200
201menu "ARM errata workarounds via the alternatives framework"
202
203config ARM64_ERRATUM_826319
204 bool "Cortex-A53: 826319: System might deadlock if a write cannot complete until read data is accepted"
205 default y
206 help
207 This option adds an alternative code sequence to work around ARM
208 erratum 826319 on Cortex-A53 parts up to r0p2 with an AMBA 4 ACE or
209 AXI master interface and an L2 cache.
210
211 If a Cortex-A53 uses an AMBA AXI4 ACE interface to other processors
212 and is unable to accept a certain write via this interface, it will
213 not progress on read data presented on the read data channel and the
214 system can deadlock.
215
216 The workaround promotes data cache clean instructions to
217 data cache clean-and-invalidate.
218 Please note that this does not necessarily enable the workaround,
219 as it depends on the alternative framework, which will only patch
220 the kernel if an affected CPU is detected.
221
222 If unsure, say Y.
223
224config ARM64_ERRATUM_827319
225 bool "Cortex-A53: 827319: Data cache clean instructions might cause overlapping transactions to the interconnect"
226 default y
227 help
228 This option adds an alternative code sequence to work around ARM
229 erratum 827319 on Cortex-A53 parts up to r0p2 with an AMBA 5 CHI
230 master interface and an L2 cache.
231
232 Under certain conditions this erratum can cause a clean line eviction
233 to occur at the same time as another transaction to the same address
234 on the AMBA 5 CHI interface, which can cause data corruption if the
235 interconnect reorders the two transactions.
236
237 The workaround promotes data cache clean instructions to
238 data cache clean-and-invalidate.
239 Please note that this does not necessarily enable the workaround,
240 as it depends on the alternative framework, which will only patch
241 the kernel if an affected CPU is detected.
242
243 If unsure, say Y.
244
245config ARM64_ERRATUM_824069
246 bool "Cortex-A53: 824069: Cache line might not be marked as clean after a CleanShared snoop"
247 default y
248 help
249 This option adds an alternative code sequence to work around ARM
250 erratum 824069 on Cortex-A53 parts up to r0p2 when it is connected
251 to a coherent interconnect.
252
253 If a Cortex-A53 processor is executing a store or prefetch for
254 write instruction at the same time as a processor in another
255 cluster is executing a cache maintenance operation to the same
256 address, then this erratum might cause a clean cache line to be
257 incorrectly marked as dirty.
258
259 The workaround promotes data cache clean instructions to
260 data cache clean-and-invalidate.
261 Please note that this option does not necessarily enable the
262 workaround, as it depends on the alternative framework, which will
263 only patch the kernel if an affected CPU is detected.
264
265 If unsure, say Y.
266
267config ARM64_ERRATUM_819472
268 bool "Cortex-A53: 819472: Store exclusive instructions might cause data corruption"
269 default y
270 help
271 This option adds an alternative code sequence to work around ARM
272 erratum 819472 on Cortex-A53 parts up to r0p1 with an L2 cache
273 present when it is connected to a coherent interconnect.
274
275 If the processor is executing a load and store exclusive sequence at
276 the same time as a processor in another cluster is executing a cache
277 maintenance operation to the same address, then this erratum might
278 cause data corruption.
279
280 The workaround promotes data cache clean instructions to
281 data cache clean-and-invalidate.
282 Please note that this does not necessarily enable the workaround,
283 as it depends on the alternative framework, which will only patch
284 the kernel if an affected CPU is detected.
285
286 If unsure, say Y.
287
288config ARM64_ERRATUM_832075
289 bool "Cortex-A57: 832075: possible deadlock on mixing exclusive memory accesses with device loads"
290 default y
291 help
292 This option adds an alternative code sequence to work around ARM
293 erratum 832075 on Cortex-A57 parts up to r1p2.
294
295 Affected Cortex-A57 parts might deadlock when exclusive load/store
296 instructions to Write-Back memory are mixed with Device loads.
297
298 The workaround is to promote device loads to use Load-Acquire
299 semantics.
300 Please note that this does not necessarily enable the workaround,
301 as it depends on the alternative framework, which will only patch
302 the kernel if an affected CPU is detected.
303
304 If unsure, say Y.
305
306endmenu
307
308
196choice 309choice
197 prompt "Page size" 310 prompt "Page size"
198 default ARM64_4K_PAGES 311 default ARM64_4K_PAGES
@@ -345,6 +458,19 @@ config ARCH_HAS_CACHE_LINE_SIZE
345 458
346source "mm/Kconfig" 459source "mm/Kconfig"
347 460
461config SECCOMP
462 bool "Enable seccomp to safely compute untrusted bytecode"
463 ---help---
464 This kernel feature is useful for number crunching applications
465 that may need to compute untrusted bytecode during their
466 execution. By using pipes or other transports made available to
467 the process as file descriptors supporting the read/write
468 syscalls, it's possible to isolate those applications in
469 their own address space using seccomp. Once seccomp is
470 enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
471 and the task is only allowed to execute a few safe syscalls
472 defined by each seccomp mode.
473
348config XEN_DOM0 474config XEN_DOM0
349 def_bool y 475 def_bool y
350 depends on XEN 476 depends on XEN
@@ -361,6 +487,58 @@ config FORCE_MAX_ZONEORDER
361 default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE) 487 default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE)
362 default "11" 488 default "11"
363 489
490menuconfig ARMV8_DEPRECATED
491 bool "Emulate deprecated/obsolete ARMv8 instructions"
492 depends on COMPAT
493 help
494 Legacy software support may require certain instructions
495 that have been deprecated or obsoleted in the architecture.
496
497 Enable this config to enable selective emulation of these
498 features.
499
500 If unsure, say Y
501
502if ARMV8_DEPRECATED
503
504config SWP_EMULATION
505 bool "Emulate SWP/SWPB instructions"
506 help
507 ARMv8 obsoletes the use of A32 SWP/SWPB instructions such that
508 they are always undefined. Say Y here to enable software
509 emulation of these instructions for userspace using LDXR/STXR.
510
511 In some older versions of glibc [<=2.8] SWP is used during futex
512 trylock() operations with the assumption that the code will not
513 be preempted. This invalid assumption may be more likely to fail
514 with SWP emulation enabled, leading to deadlock of the user
515 application.
516
517 NOTE: when accessing uncached shared regions, LDXR/STXR rely
518 on an external transaction monitoring block called a global
519 monitor to maintain update atomicity. If your system does not
520 implement a global monitor, this option can cause programs that
521 perform SWP operations to uncached memory to deadlock.
522
523 If unsure, say Y
524
525config CP15_BARRIER_EMULATION
526 bool "Emulate CP15 Barrier instructions"
527 help
528 The CP15 barrier instructions - CP15ISB, CP15DSB, and
529 CP15DMB - are deprecated in ARMv8 (and ARMv7). It is
530 strongly recommended to use the ISB, DSB, and DMB
531 instructions instead.
532
533 Say Y here to enable software emulation of these
534 instructions for AArch32 userspace code. When this option is
535 enabled, CP15 barrier usage is traced which can help
536 identify software that needs updating.
537
538 If unsure, say Y
539
540endif
541
364endmenu 542endmenu
365 543
366menu "Boot options" 544menu "Boot options"
@@ -401,6 +579,17 @@ config EFI
401 allow the kernel to be booted as an EFI application. This 579 allow the kernel to be booted as an EFI application. This
402 is only useful on systems that have UEFI firmware. 580 is only useful on systems that have UEFI firmware.
403 581
582config DMI
583 bool "Enable support for SMBIOS (DMI) tables"
584 depends on EFI
585 default y
586 help
587 This enables SMBIOS/DMI feature for systems.
588
589 This option is only useful on systems that have UEFI firmware.
590 However, even with this option, the resultant kernel should
591 continue to boot on existing non-UEFI platforms.
592
404endmenu 593endmenu
405 594
406menu "Userspace binary formats" 595menu "Userspace binary formats"
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index 0a12933e50ed..5fdd6dce8061 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -6,6 +6,18 @@ config FRAME_POINTER
6 bool 6 bool
7 default y 7 default y
8 8
9config ARM64_PTDUMP
10 bool "Export kernel pagetable layout to userspace via debugfs"
11 depends on DEBUG_KERNEL
12 select DEBUG_FS
13 help
14 Say Y here if you want to show the kernel pagetable layout in a
15 debugfs file. This information is only useful for kernel developers
16 who are working in architecture specific areas of the kernel.
17 It is probably not a good idea to enable this feature in a production
18 kernel.
19 If in doubt, say "N"
20
9config STRICT_DEVMEM 21config STRICT_DEVMEM
10 bool "Filter access to /dev/mem" 22 bool "Filter access to /dev/mem"
11 depends on MMU 23 depends on MMU
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 20901ffed182..1c43cec971b5 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -70,8 +70,13 @@ zinstall install: vmlinux
70%.dtb: scripts 70%.dtb: scripts
71 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@ 71 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
72 72
73dtbs: scripts 73PHONY += dtbs dtbs_install
74 $(Q)$(MAKE) $(build)=$(boot)/dts dtbs 74
75dtbs: prepare scripts
76 $(Q)$(MAKE) $(build)=$(boot)/dts
77
78dtbs_install:
79 $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
75 80
76PHONY += vdso_install 81PHONY += vdso_install
77vdso_install: 82vdso_install:
@@ -85,6 +90,7 @@ define archhelp
85 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' 90 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
86 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' 91 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
87 echo '* dtbs - Build device tree blobs for enabled boards' 92 echo '* dtbs - Build device tree blobs for enabled boards'
93 echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'
88 echo ' install - Install uncompressed kernel' 94 echo ' install - Install uncompressed kernel'
89 echo ' zinstall - Install compressed kernel' 95 echo ' zinstall - Install compressed kernel'
90 echo ' Install using (your) ~/bin/installkernel or' 96 echo ' Install using (your) ~/bin/installkernel or'
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index f8001a62029c..3b8d427c3985 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,10 +1,8 @@
1dtb-$(CONFIG_ARCH_THUNDER) += thunder-88xx.dtb 1dts-dirs += amd
2dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb 2dts-dirs += apm
3dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb 3dts-dirs += arm
4dts-dirs += cavium
4 5
5targets += dtbs 6always := $(dtb-y)
6targets += $(dtb-y) 7subdir-y := $(dts-dirs)
7 8clean-files := *.dtb
8dtbs: $(addprefix $(obj)/, $(dtb-y))
9
10clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/amd/Makefile b/arch/arm64/boot/dts/amd/Makefile
new file mode 100644
index 000000000000..cfdf701e05df
--- /dev/null
+++ b/arch/arm64/boot/dts/amd/Makefile
@@ -0,0 +1,5 @@
1dtb-$(CONFIG_ARCH_SEATTLE) += amd-overdrive.dtb
2
3always := $(dtb-y)
4subdir-y := $(dts-dirs)
5clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/amd/amd-overdrive.dts b/arch/arm64/boot/dts/amd/amd-overdrive.dts
new file mode 100644
index 000000000000..564a3f7df71d
--- /dev/null
+++ b/arch/arm64/boot/dts/amd/amd-overdrive.dts
@@ -0,0 +1,66 @@
1/*
2 * DTS file for AMD Seattle Overdrive Development Board
3 *
4 * Copyright (C) 2014 Advanced Micro Devices, Inc.
5 */
6
7/dts-v1/;
8
9/include/ "amd-seattle-soc.dtsi"
10
11/ {
12 model = "AMD Seattle Development Board (Overdrive)";
13 compatible = "amd,seattle-overdrive", "amd,seattle";
14
15 chosen {
16 stdout-path = &serial0;
17 linux,pci-probe-only;
18 };
19};
20
21&ccp0 {
22 status = "ok";
23};
24
25&gpio0 {
26 status = "ok";
27};
28
29&gpio1 {
30 status = "ok";
31};
32
33&i2c0 {
34 status = "ok";
35};
36
37&pcie0 {
38 status = "ok";
39};
40
41&spi0 {
42 status = "ok";
43};
44
45&spi1 {
46 status = "ok";
47 sdcard0: sdcard@0 {
48 compatible = "mmc-spi-slot";
49 reg = <0>;
50 spi-max-frequency = <20000000>;
51 voltage-ranges = <3200 3400>;
52 gpios = <&gpio0 7 0>;
53 interrupt-parent = <&gpio0>;
54 interrupts = <7 3>;
55 pl022,hierarchy = <0>;
56 pl022,interface = <0>;
57 pl022,com-mode = <0x0>;
58 pl022,rx-level-trig = <0>;
59 pl022,tx-level-trig = <0>;
60 };
61};
62
63&v2m0 {
64 arm,msi-base-spi = <64>;
65 arm,msi-num-spis = <256>;
66};
diff --git a/arch/arm64/boot/dts/amd/amd-seattle-clks.dtsi b/arch/arm64/boot/dts/amd/amd-seattle-clks.dtsi
new file mode 100644
index 000000000000..f623c46525a6
--- /dev/null
+++ b/arch/arm64/boot/dts/amd/amd-seattle-clks.dtsi
@@ -0,0 +1,54 @@
1/*
2 * DTS file for AMD Seattle Clocks
3 *
4 * Copyright (C) 2014 Advanced Micro Devices, Inc.
5 */
6
7 adl3clk_100mhz: clk100mhz_0 {
8 compatible = "fixed-clock";
9 #clock-cells = <0>;
10 clock-frequency = <100000000>;
11 clock-output-names = "adl3clk_100mhz";
12 };
13
14 ccpclk_375mhz: clk375mhz {
15 compatible = "fixed-clock";
16 #clock-cells = <0>;
17 clock-frequency = <375000000>;
18 clock-output-names = "ccpclk_375mhz";
19 };
20
21 sataclk_333mhz: clk333mhz {
22 compatible = "fixed-clock";
23 #clock-cells = <0>;
24 clock-frequency = <333000000>;
25 clock-output-names = "sataclk_333mhz";
26 };
27
28 pcieclk_500mhz: clk500mhz_0 {
29 compatible = "fixed-clock";
30 #clock-cells = <0>;
31 clock-frequency = <500000000>;
32 clock-output-names = "pcieclk_500mhz";
33 };
34
35 dmaclk_500mhz: clk500mhz_1 {
36 compatible = "fixed-clock";
37 #clock-cells = <0>;
38 clock-frequency = <500000000>;
39 clock-output-names = "dmaclk_500mhz";
40 };
41
42 miscclk_250mhz: clk250mhz_4 {
43 compatible = "fixed-clock";
44 #clock-cells = <0>;
45 clock-frequency = <250000000>;
46 clock-output-names = "miscclk_250mhz";
47 };
48
49 uartspiclk_100mhz: clk100mhz_1 {
50 compatible = "fixed-clock";
51 #clock-cells = <0>;
52 clock-frequency = <100000000>;
53 clock-output-names = "uartspiclk_100mhz";
54 };
diff --git a/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi b/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi
new file mode 100644
index 000000000000..2874d92881fd
--- /dev/null
+++ b/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi
@@ -0,0 +1,172 @@
1/*
2 * DTS file for AMD Seattle SoC
3 *
4 * Copyright (C) 2014 Advanced Micro Devices, Inc.
5 */
6
7/ {
8 compatible = "amd,seattle";
9 interrupt-parent = <&gic0>;
10 #address-cells = <2>;
11 #size-cells = <2>;
12
13 gic0: interrupt-controller@e1101000 {
14 compatible = "arm,gic-400", "arm,cortex-a15-gic";
15 interrupt-controller;
16 #interrupt-cells = <3>;
17 #address-cells = <2>;
18 #size-cells = <2>;
19 reg = <0x0 0xe1110000 0 0x1000>,
20 <0x0 0xe112f000 0 0x2000>,
21 <0x0 0xe1140000 0 0x10000>,
22 <0x0 0xe1160000 0 0x10000>;
23 interrupts = <1 9 0xf04>;
24 ranges = <0 0 0 0xe1100000 0 0x100000>;
25 v2m0: v2m@e0080000 {
26 compatible = "arm,gic-v2m-frame";
27 msi-controller;
28 reg = <0x0 0x00080000 0 0x1000>;
29 };
30 };
31
32 timer {
33 compatible = "arm,armv8-timer";
34 interrupts = <1 13 0xff04>,
35 <1 14 0xff04>,
36 <1 11 0xff04>,
37 <1 10 0xff04>;
38 };
39
40 pmu {
41 compatible = "arm,armv8-pmuv3";
42 interrupts = <0 7 4>,
43 <0 8 4>,
44 <0 9 4>,
45 <0 10 4>,
46 <0 11 4>,
47 <0 12 4>,
48 <0 13 4>,
49 <0 14 4>;
50 };
51
52 smb0: smb {
53 compatible = "simple-bus";
54 #address-cells = <2>;
55 #size-cells = <2>;
56 ranges;
57
58 /* DDR range is 40-bit addressing */
59 dma-ranges = <0x80 0x0 0x80 0x0 0x7f 0xffffffff>;
60
61 /include/ "amd-seattle-clks.dtsi"
62
63 sata0: sata@e0300000 {
64 compatible = "snps,dwc-ahci";
65 reg = <0 0xe0300000 0 0x800>;
66 interrupts = <0 355 4>;
67 clocks = <&sataclk_333mhz>;
68 dma-coherent;
69 };
70
71 i2c0: i2c@e1000000 {
72 status = "disabled";
73 compatible = "snps,designware-i2c";
74 reg = <0 0xe1000000 0 0x1000>;
75 interrupts = <0 357 4>;
76 clocks = <&uartspiclk_100mhz>;
77 };
78
79 serial0: serial@e1010000 {
80 compatible = "arm,pl011", "arm,primecell";
81 reg = <0 0xe1010000 0 0x1000>;
82 interrupts = <0 328 4>;
83 clocks = <&uartspiclk_100mhz>, <&uartspiclk_100mhz>;
84 clock-names = "uartclk", "apb_pclk";
85 };
86
87 spi0: ssp@e1020000 {
88 status = "disabled";
89 compatible = "arm,pl022", "arm,primecell";
90 #gpio-cells = <2>;
91 reg = <0 0xe1020000 0 0x1000>;
92 spi-controller;
93 interrupts = <0 330 4>;
94 clocks = <&uartspiclk_100mhz>;
95 clock-names = "apb_pclk";
96 };
97
98 spi1: ssp@e1030000 {
99 status = "disabled";
100 compatible = "arm,pl022", "arm,primecell";
101 #gpio-cells = <2>;
102 reg = <0 0xe1030000 0 0x1000>;
103 spi-controller;
104 interrupts = <0 329 4>;
105 clocks = <&uartspiclk_100mhz>;
106 clock-names = "apb_pclk";
107 num-cs = <1>;
108 #address-cells = <1>;
109 #size-cells = <0>;
110 };
111
112 gpio0: gpio@e1040000 {
113 status = "disabled";
114 compatible = "arm,pl061", "arm,primecell";
115 #gpio-cells = <2>;
116 reg = <0 0xe1040000 0 0x1000>;
117 gpio-controller;
118 interrupts = <0 359 4>;
119 interrupt-controller;
120 #interrupt-cells = <2>;
121 clocks = <&uartspiclk_100mhz>;
122 clock-names = "apb_pclk";
123 };
124
125 gpio1: gpio@e1050000 {
126 status = "disabled";
127 compatible = "arm,pl061", "arm,primecell";
128 #gpio-cells = <2>;
129 reg = <0 0xe1050000 0 0x1000>;
130 gpio-controller;
131 interrupts = <0 358 4>;
132 clocks = <&uartspiclk_100mhz>;
133 clock-names = "apb_pclk";
134 };
135
136 ccp0: ccp@e0100000 {
137 status = "disabled";
138 compatible = "amd,ccp-seattle-v1a";
139 reg = <0 0xe0100000 0 0x10000>;
140 interrupts = <0 3 4>;
141 dma-coherent;
142 };
143
144 pcie0: pcie@f0000000 {
145 compatible = "pci-host-ecam-generic";
146 #address-cells = <3>;
147 #size-cells = <2>;
148 #interrupt-cells = <1>;
149 device_type = "pci";
150 bus-range = <0 0x7f>;
151 msi-parent = <&v2m0>;
152 reg = <0 0xf0000000 0 0x10000000>;
153
154 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
155 interrupt-map =
156 <0x1000 0x0 0x0 0x1 &gic0 0x0 0x0 0x0 0x120 0x1>,
157 <0x1000 0x0 0x0 0x2 &gic0 0x0 0x0 0x0 0x121 0x1>,
158 <0x1000 0x0 0x0 0x3 &gic0 0x0 0x0 0x0 0x122 0x1>,
159 <0x1000 0x0 0x0 0x4 &gic0 0x0 0x0 0x0 0x123 0x1>;
160
161 dma-coherent;
162 dma-ranges = <0x43000000 0x80 0x0 0x80 0x0 0x7f 0xffffffff>;
163 ranges =
164 /* I/O Memory (size=64K) */
165 <0x01000000 0x00 0x00000000 0x00 0xefff0000 0x00 0x00010000>,
166 /* 32-bit MMIO (size=2G) */
167 <0x02000000 0x00 0x40000000 0x00 0x40000000 0x00 0x80000000>,
168 /* 64-bit MMIO (size= 124G) */
169 <0x03000000 0x01 0x00000000 0x01 0x00000000 0x7f 0x00000000>;
170 };
171 };
172};
diff --git a/arch/arm64/boot/dts/apm/Makefile b/arch/arm64/boot/dts/apm/Makefile
new file mode 100644
index 000000000000..a2afabbc1717
--- /dev/null
+++ b/arch/arm64/boot/dts/apm/Makefile
@@ -0,0 +1,5 @@
1dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
2
3always := $(dtb-y)
4subdir-y := $(dts-dirs)
5clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm/apm-mustang.dts
index 2e25de0800b9..2e25de0800b9 100644
--- a/arch/arm64/boot/dts/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm/apm-mustang.dts
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm/apm-storm.dtsi
index f1ad9c2ab2e9..f1ad9c2ab2e9 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm/apm-storm.dtsi
diff --git a/arch/arm64/boot/dts/arm/Makefile b/arch/arm64/boot/dts/arm/Makefile
new file mode 100644
index 000000000000..301a0dada1fe
--- /dev/null
+++ b/arch/arm64/boot/dts/arm/Makefile
@@ -0,0 +1,7 @@
1dtb-$(CONFIG_ARCH_VEXPRESS) += foundation-v8.dtb
2dtb-$(CONFIG_ARCH_VEXPRESS) += juno.dtb
3dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb
4
5always := $(dtb-y)
6subdir-y := $(dts-dirs)
7clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/foundation-v8.dts b/arch/arm64/boot/dts/arm/foundation-v8.dts
index 4a060906809d..27f32962e55c 100644
--- a/arch/arm64/boot/dts/foundation-v8.dts
+++ b/arch/arm64/boot/dts/arm/foundation-v8.dts
@@ -78,10 +78,10 @@
78 78
79 timer { 79 timer {
80 compatible = "arm,armv8-timer"; 80 compatible = "arm,armv8-timer";
81 interrupts = <1 13 0xff01>, 81 interrupts = <1 13 0xf08>,
82 <1 14 0xff01>, 82 <1 14 0xf08>,
83 <1 11 0xff01>, 83 <1 11 0xf08>,
84 <1 10 0xff01>; 84 <1 10 0xf08>;
85 clock-frequency = <100000000>; 85 clock-frequency = <100000000>;
86 }; 86 };
87 87
diff --git a/arch/arm64/boot/dts/arm/juno-clocks.dtsi b/arch/arm64/boot/dts/arm/juno-clocks.dtsi
new file mode 100644
index 000000000000..ea2b5666a16f
--- /dev/null
+++ b/arch/arm64/boot/dts/arm/juno-clocks.dtsi
@@ -0,0 +1,44 @@
1/*
2 * ARM Juno Platform clocks
3 *
4 * Copyright (c) 2013-2014 ARM Ltd
5 *
6 * This file is licensed under a dual GPLv2 or BSD license.
7 *
8 */
9
10 /* SoC fixed clocks */
11 soc_uartclk: refclk72738khz {
12 compatible = "fixed-clock";
13 #clock-cells = <0>;
14 clock-frequency = <7273800>;
15 clock-output-names = "juno:uartclk";
16 };
17
18 soc_usb48mhz: clk48mhz {
19 compatible = "fixed-clock";
20 #clock-cells = <0>;
21 clock-frequency = <48000000>;
22 clock-output-names = "clk48mhz";
23 };
24
25 soc_smc50mhz: clk50mhz {
26 compatible = "fixed-clock";
27 #clock-cells = <0>;
28 clock-frequency = <50000000>;
29 clock-output-names = "smc_clk";
30 };
31
32 soc_refclk100mhz: refclk100mhz {
33 compatible = "fixed-clock";
34 #clock-cells = <0>;
35 clock-frequency = <100000000>;
36 clock-output-names = "apb_pclk";
37 };
38
39 soc_faxiclk: refclk533mhz {
40 compatible = "fixed-clock";
41 #clock-cells = <0>;
42 clock-frequency = <533000000>;
43 clock-output-names = "faxi_clk";
44 };
diff --git a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi
new file mode 100644
index 000000000000..c138b95a8356
--- /dev/null
+++ b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi
@@ -0,0 +1,129 @@
1/*
2 * ARM Juno Platform motherboard peripherals
3 *
4 * Copyright (c) 2013-2014 ARM Ltd
5 *
6 * This file is licensed under a dual GPLv2 or BSD license.
7 *
8 */
9
10 mb_clk24mhz: clk24mhz {
11 compatible = "fixed-clock";
12 #clock-cells = <0>;
13 clock-frequency = <24000000>;
14 clock-output-names = "juno_mb:clk24mhz";
15 };
16
17 mb_clk25mhz: clk25mhz {
18 compatible = "fixed-clock";
19 #clock-cells = <0>;
20 clock-frequency = <25000000>;
21 clock-output-names = "juno_mb:clk25mhz";
22 };
23
24 motherboard {
25 compatible = "arm,vexpress,v2p-p1", "simple-bus";
26 #address-cells = <2>; /* SMB chipselect number and offset */
27 #size-cells = <1>;
28 #interrupt-cells = <1>;
29 ranges;
30 model = "V2M-Juno";
31 arm,hbi = <0x252>;
32 arm,vexpress,site = <0>;
33 arm,v2m-memory-map = "rs1";
34
35 mb_fixed_3v3: fixedregulator@0 {
36 compatible = "regulator-fixed";
37 regulator-name = "MCC_SB_3V3";
38 regulator-min-microvolt = <3300000>;
39 regulator-max-microvolt = <3300000>;
40 regulator-always-on;
41 };
42
43 ethernet@2,00000000 {
44 compatible = "smsc,lan9118", "smsc,lan9115";
45 reg = <2 0x00000000 0x10000>;
46 interrupts = <3>;
47 phy-mode = "mii";
48 reg-io-width = <4>;
49 smsc,irq-active-high;
50 smsc,irq-push-pull;
51 clocks = <&mb_clk25mhz>;
52 vdd33a-supply = <&mb_fixed_3v3>;
53 vddvario-supply = <&mb_fixed_3v3>;
54 };
55
56 usb@5,00000000 {
57 compatible = "nxp,usb-isp1763";
58 reg = <5 0x00000000 0x20000>;
59 bus-width = <16>;
60 interrupts = <4>;
61 };
62
63 iofpga@3,00000000 {
64 compatible = "arm,amba-bus", "simple-bus";
65 #address-cells = <1>;
66 #size-cells = <1>;
67 ranges = <0 3 0 0x200000>;
68
69 mmci@050000 {
70 compatible = "arm,pl180", "arm,primecell";
71 reg = <0x050000 0x1000>;
72 interrupts = <5>;
73 /* cd-gpios = <&v2m_mmc_gpios 0 0>;
74 wp-gpios = <&v2m_mmc_gpios 1 0>; */
75 max-frequency = <12000000>;
76 vmmc-supply = <&mb_fixed_3v3>;
77 clocks = <&mb_clk24mhz>, <&soc_smc50mhz>;
78 clock-names = "mclk", "apb_pclk";
79 };
80
81 kmi@060000 {
82 compatible = "arm,pl050", "arm,primecell";
83 reg = <0x060000 0x1000>;
84 interrupts = <8>;
85 clocks = <&mb_clk24mhz>, <&soc_smc50mhz>;
86 clock-names = "KMIREFCLK", "apb_pclk";
87 };
88
89 kmi@070000 {
90 compatible = "arm,pl050", "arm,primecell";
91 reg = <0x070000 0x1000>;
92 interrupts = <8>;
93 clocks = <&mb_clk24mhz>, <&soc_smc50mhz>;
94 clock-names = "KMIREFCLK", "apb_pclk";
95 };
96
97 wdt@0f0000 {
98 compatible = "arm,sp805", "arm,primecell";
99 reg = <0x0f0000 0x10000>;
100 interrupts = <7>;
101 clocks = <&mb_clk24mhz>, <&soc_smc50mhz>;
102 clock-names = "wdogclk", "apb_pclk";
103 };
104
105 v2m_timer01: timer@110000 {
106 compatible = "arm,sp804", "arm,primecell";
107 reg = <0x110000 0x10000>;
108 interrupts = <9>;
109 clocks = <&mb_clk24mhz>, <&soc_smc50mhz>;
110 clock-names = "timclken1", "apb_pclk";
111 };
112
113 v2m_timer23: timer@120000 {
114 compatible = "arm,sp804", "arm,primecell";
115 reg = <0x120000 0x10000>;
116 interrupts = <9>;
117 clocks = <&mb_clk24mhz>, <&soc_smc50mhz>;
118 clock-names = "timclken1", "apb_pclk";
119 };
120
121 rtc@170000 {
122 compatible = "arm,pl031", "arm,primecell";
123 reg = <0x170000 0x10000>;
124 interrupts = <0>;
125 clocks = <&soc_smc50mhz>;
126 clock-names = "apb_pclk";
127 };
128 };
129 };
diff --git a/arch/arm64/boot/dts/arm/juno.dts b/arch/arm64/boot/dts/arm/juno.dts
new file mode 100644
index 000000000000..cb3073e4e7a8
--- /dev/null
+++ b/arch/arm64/boot/dts/arm/juno.dts
@@ -0,0 +1,218 @@
1/*
2 * ARM Ltd. Juno Platform
3 *
4 * Copyright (c) 2013-2014 ARM Ltd.
5 *
6 * This file is licensed under a dual GPLv2 or BSD license.
7 */
8
9/dts-v1/;
10
11#include <dt-bindings/interrupt-controller/arm-gic.h>
12
13/ {
14 model = "ARM Juno development board (r0)";
15 compatible = "arm,juno", "arm,vexpress";
16 interrupt-parent = <&gic>;
17 #address-cells = <2>;
18 #size-cells = <2>;
19
20 aliases {
21 serial0 = &soc_uart0;
22 };
23
24 chosen {
25 stdout-path = &soc_uart0;
26 };
27
28 psci {
29 compatible = "arm,psci-0.2";
30 method = "smc";
31 };
32
33 cpus {
34 #address-cells = <2>;
35 #size-cells = <0>;
36
37 A57_0: cpu@0 {
38 compatible = "arm,cortex-a57","arm,armv8";
39 reg = <0x0 0x0>;
40 device_type = "cpu";
41 enable-method = "psci";
42 };
43
44 A57_1: cpu@1 {
45 compatible = "arm,cortex-a57","arm,armv8";
46 reg = <0x0 0x1>;
47 device_type = "cpu";
48 enable-method = "psci";
49 };
50
51 A53_0: cpu@100 {
52 compatible = "arm,cortex-a53","arm,armv8";
53 reg = <0x0 0x100>;
54 device_type = "cpu";
55 enable-method = "psci";
56 };
57
58 A53_1: cpu@101 {
59 compatible = "arm,cortex-a53","arm,armv8";
60 reg = <0x0 0x101>;
61 device_type = "cpu";
62 enable-method = "psci";
63 };
64
65 A53_2: cpu@102 {
66 compatible = "arm,cortex-a53","arm,armv8";
67 reg = <0x0 0x102>;
68 device_type = "cpu";
69 enable-method = "psci";
70 };
71
72 A53_3: cpu@103 {
73 compatible = "arm,cortex-a53","arm,armv8";
74 reg = <0x0 0x103>;
75 device_type = "cpu";
76 enable-method = "psci";
77 };
78 };
79
80 memory@80000000 {
81 device_type = "memory";
82 /* last 16MB of the first memory area is reserved for secure world use by firmware */
83 reg = <0x00000000 0x80000000 0x0 0x7f000000>,
84 <0x00000008 0x80000000 0x1 0x80000000>;
85 };
86
87 gic: interrupt-controller@2c001000 {
88 compatible = "arm,gic-400", "arm,cortex-a15-gic";
89 reg = <0x0 0x2c010000 0 0x1000>,
90 <0x0 0x2c02f000 0 0x2000>,
91 <0x0 0x2c04f000 0 0x2000>,
92 <0x0 0x2c06f000 0 0x2000>;
93 #address-cells = <0>;
94 #interrupt-cells = <3>;
95 interrupt-controller;
96 interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_HIGH)>;
97 };
98
99 timer {
100 compatible = "arm,armv8-timer";
101 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_LOW)>,
102 <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_LOW)>,
103 <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_LOW)>,
104 <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_LOW)>;
105 };
106
107 pmu {
108 compatible = "arm,armv8-pmuv3";
109 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
110 <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>,
111 <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>,
112 <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>,
113 <GIC_SPI 02 IRQ_TYPE_LEVEL_HIGH>,
114 <GIC_SPI 06 IRQ_TYPE_LEVEL_HIGH>;
115 };
116
117 /include/ "juno-clocks.dtsi"
118
119 dma@7ff00000 {
120 compatible = "arm,pl330", "arm,primecell";
121 reg = <0x0 0x7ff00000 0 0x1000>;
122 #dma-cells = <1>;
123 #dma-channels = <8>;
124 #dma-requests = <32>;
125 interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>,
126 <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
127 <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>,
128 <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>,
129 <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>,
130 <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
131 <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
132 <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
133 clocks = <&soc_faxiclk>;
134 clock-names = "apb_pclk";
135 };
136
137 soc_uart0: uart@7ff80000 {
138 compatible = "arm,pl011", "arm,primecell";
139 reg = <0x0 0x7ff80000 0x0 0x1000>;
140 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
141 clocks = <&soc_uartclk>, <&soc_refclk100mhz>;
142 clock-names = "uartclk", "apb_pclk";
143 };
144
145 i2c@7ffa0000 {
146 compatible = "snps,designware-i2c";
147 reg = <0x0 0x7ffa0000 0x0 0x1000>;
148 #address-cells = <1>;
149 #size-cells = <0>;
150 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
151 clock-frequency = <400000>;
152 i2c-sda-hold-time-ns = <500>;
153 clocks = <&soc_smc50mhz>;
154
155 dvi0: dvi-transmitter@70 {
156 compatible = "nxp,tda998x";
157 reg = <0x70>;
158 };
159
160 dvi1: dvi-transmitter@71 {
161 compatible = "nxp,tda998x";
162 reg = <0x71>;
163 };
164 };
165
166 ohci@7ffb0000 {
167 compatible = "generic-ohci";
168 reg = <0x0 0x7ffb0000 0x0 0x10000>;
169 interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
170 clocks = <&soc_usb48mhz>;
171 };
172
173 ehci@7ffc0000 {
174 compatible = "generic-ehci";
175 reg = <0x0 0x7ffc0000 0x0 0x10000>;
176 interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
177 clocks = <&soc_usb48mhz>;
178 };
179
180 memory-controller@7ffd0000 {
181 compatible = "arm,pl354", "arm,primecell";
182 reg = <0 0x7ffd0000 0 0x1000>;
183 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>,
184 <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
185 clocks = <&soc_smc50mhz>;
186 clock-names = "apb_pclk";
187 };
188
189 smb {
190 compatible = "simple-bus";
191 #address-cells = <2>;
192 #size-cells = <1>;
193 ranges = <0 0 0 0x08000000 0x04000000>,
194 <1 0 0 0x14000000 0x04000000>,
195 <2 0 0 0x18000000 0x04000000>,
196 <3 0 0 0x1c000000 0x04000000>,
197 <4 0 0 0x0c000000 0x04000000>,
198 <5 0 0 0x10000000 0x04000000>;
199
200 #interrupt-cells = <1>;
201 interrupt-map-mask = <0 0 15>;
202 interrupt-map = <0 0 0 &gic 0 68 IRQ_TYPE_LEVEL_HIGH>,
203 <0 0 1 &gic 0 69 IRQ_TYPE_LEVEL_HIGH>,
204 <0 0 2 &gic 0 70 IRQ_TYPE_LEVEL_HIGH>,
205 <0 0 3 &gic 0 160 IRQ_TYPE_LEVEL_HIGH>,
206 <0 0 4 &gic 0 161 IRQ_TYPE_LEVEL_HIGH>,
207 <0 0 5 &gic 0 162 IRQ_TYPE_LEVEL_HIGH>,
208 <0 0 6 &gic 0 163 IRQ_TYPE_LEVEL_HIGH>,
209 <0 0 7 &gic 0 164 IRQ_TYPE_LEVEL_HIGH>,
210 <0 0 8 &gic 0 165 IRQ_TYPE_LEVEL_HIGH>,
211 <0 0 9 &gic 0 166 IRQ_TYPE_LEVEL_HIGH>,
212 <0 0 10 &gic 0 167 IRQ_TYPE_LEVEL_HIGH>,
213 <0 0 11 &gic 0 168 IRQ_TYPE_LEVEL_HIGH>,
214 <0 0 12 &gic 0 169 IRQ_TYPE_LEVEL_HIGH>;
215
216 /include/ "juno-motherboard.dtsi"
217 };
218};
diff --git a/arch/arm64/boot/dts/rtsm_ve-aemv8a.dts b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
index 572005ea2217..efc59b3baf63 100644
--- a/arch/arm64/boot/dts/rtsm_ve-aemv8a.dts
+++ b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
@@ -81,10 +81,10 @@
81 81
82 timer { 82 timer {
83 compatible = "arm,armv8-timer"; 83 compatible = "arm,armv8-timer";
84 interrupts = <1 13 0xff01>, 84 interrupts = <1 13 0xf08>,
85 <1 14 0xff01>, 85 <1 14 0xf08>,
86 <1 11 0xff01>, 86 <1 11 0xf08>,
87 <1 10 0xff01>; 87 <1 10 0xf08>;
88 clock-frequency = <100000000>; 88 clock-frequency = <100000000>;
89 }; 89 };
90 90
diff --git a/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
index c46cbb29f3c6..c46cbb29f3c6 100644
--- a/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
+++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
diff --git a/arch/arm64/boot/dts/cavium/Makefile b/arch/arm64/boot/dts/cavium/Makefile
new file mode 100644
index 000000000000..e34f89ddabb2
--- /dev/null
+++ b/arch/arm64/boot/dts/cavium/Makefile
@@ -0,0 +1,5 @@
1dtb-$(CONFIG_ARCH_THUNDER) += thunder-88xx.dtb
2
3always := $(dtb-y)
4subdir-y := $(dts-dirs)
5clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/thunder-88xx.dts b/arch/arm64/boot/dts/cavium/thunder-88xx.dts
index 800ba65991f7..800ba65991f7 100644
--- a/arch/arm64/boot/dts/thunder-88xx.dts
+++ b/arch/arm64/boot/dts/cavium/thunder-88xx.dts
diff --git a/arch/arm64/boot/dts/thunder-88xx.dtsi b/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi
index d8c0bdc51882..d8c0bdc51882 100644
--- a/arch/arm64/boot/dts/thunder-88xx.dtsi
+++ b/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi
diff --git a/arch/arm64/boot/dts/include/dt-bindings b/arch/arm64/boot/dts/include/dt-bindings
new file mode 120000
index 000000000000..08c00e4972fa
--- /dev/null
+++ b/arch/arm64/boot/dts/include/dt-bindings
@@ -0,0 +1 @@
../../../../../include/dt-bindings \ No newline at end of file
diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig
index 5562652c5316..a38b02ce5f9a 100644
--- a/arch/arm64/crypto/Kconfig
+++ b/arch/arm64/crypto/Kconfig
@@ -27,20 +27,19 @@ config CRYPTO_AES_ARM64_CE
27 tristate "AES core cipher using ARMv8 Crypto Extensions" 27 tristate "AES core cipher using ARMv8 Crypto Extensions"
28 depends on ARM64 && KERNEL_MODE_NEON 28 depends on ARM64 && KERNEL_MODE_NEON
29 select CRYPTO_ALGAPI 29 select CRYPTO_ALGAPI
30 select CRYPTO_AES
31 30
32config CRYPTO_AES_ARM64_CE_CCM 31config CRYPTO_AES_ARM64_CE_CCM
33 tristate "AES in CCM mode using ARMv8 Crypto Extensions" 32 tristate "AES in CCM mode using ARMv8 Crypto Extensions"
34 depends on ARM64 && KERNEL_MODE_NEON 33 depends on ARM64 && KERNEL_MODE_NEON
35 select CRYPTO_ALGAPI 34 select CRYPTO_ALGAPI
36 select CRYPTO_AES 35 select CRYPTO_AES_ARM64_CE
37 select CRYPTO_AEAD 36 select CRYPTO_AEAD
38 37
39config CRYPTO_AES_ARM64_CE_BLK 38config CRYPTO_AES_ARM64_CE_BLK
40 tristate "AES in ECB/CBC/CTR/XTS modes using ARMv8 Crypto Extensions" 39 tristate "AES in ECB/CBC/CTR/XTS modes using ARMv8 Crypto Extensions"
41 depends on ARM64 && KERNEL_MODE_NEON 40 depends on ARM64 && KERNEL_MODE_NEON
42 select CRYPTO_BLKCIPHER 41 select CRYPTO_BLKCIPHER
43 select CRYPTO_AES 42 select CRYPTO_AES_ARM64_CE
44 select CRYPTO_ABLK_HELPER 43 select CRYPTO_ABLK_HELPER
45 44
46config CRYPTO_AES_ARM64_NEON_BLK 45config CRYPTO_AES_ARM64_NEON_BLK
diff --git a/arch/arm64/crypto/aes-ce-ccm-glue.c b/arch/arm64/crypto/aes-ce-ccm-glue.c
index 9e6cdde9b43d..0ac73b838fa3 100644
--- a/arch/arm64/crypto/aes-ce-ccm-glue.c
+++ b/arch/arm64/crypto/aes-ce-ccm-glue.c
@@ -16,6 +16,8 @@
16#include <linux/crypto.h> 16#include <linux/crypto.h>
17#include <linux/module.h> 17#include <linux/module.h>
18 18
19#include "aes-ce-setkey.h"
20
19static int num_rounds(struct crypto_aes_ctx *ctx) 21static int num_rounds(struct crypto_aes_ctx *ctx)
20{ 22{
21 /* 23 /*
@@ -48,7 +50,7 @@ static int ccm_setkey(struct crypto_aead *tfm, const u8 *in_key,
48 struct crypto_aes_ctx *ctx = crypto_aead_ctx(tfm); 50 struct crypto_aes_ctx *ctx = crypto_aead_ctx(tfm);
49 int ret; 51 int ret;
50 52
51 ret = crypto_aes_expand_key(ctx, in_key, key_len); 53 ret = ce_aes_expandkey(ctx, in_key, key_len);
52 if (!ret) 54 if (!ret)
53 return 0; 55 return 0;
54 56
diff --git a/arch/arm64/crypto/aes-ce-cipher.c b/arch/arm64/crypto/aes-ce-cipher.c
index 2075e1acae6b..ce47792a983d 100644
--- a/arch/arm64/crypto/aes-ce-cipher.c
+++ b/arch/arm64/crypto/aes-ce-cipher.c
@@ -14,6 +14,8 @@
14#include <linux/crypto.h> 14#include <linux/crypto.h>
15#include <linux/module.h> 15#include <linux/module.h>
16 16
17#include "aes-ce-setkey.h"
18
17MODULE_DESCRIPTION("Synchronous AES cipher using ARMv8 Crypto Extensions"); 19MODULE_DESCRIPTION("Synchronous AES cipher using ARMv8 Crypto Extensions");
18MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>"); 20MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
19MODULE_LICENSE("GPL v2"); 21MODULE_LICENSE("GPL v2");
@@ -124,6 +126,114 @@ static void aes_cipher_decrypt(struct crypto_tfm *tfm, u8 dst[], u8 const src[])
124 kernel_neon_end(); 126 kernel_neon_end();
125} 127}
126 128
129/*
130 * aes_sub() - use the aese instruction to perform the AES sbox substitution
131 * on each byte in 'input'
132 */
133static u32 aes_sub(u32 input)
134{
135 u32 ret;
136
137 __asm__("dup v1.4s, %w[in] ;"
138 "movi v0.16b, #0 ;"
139 "aese v0.16b, v1.16b ;"
140 "umov %w[out], v0.4s[0] ;"
141
142 : [out] "=r"(ret)
143 : [in] "r"(input)
144 : "v0","v1");
145
146 return ret;
147}
148
149int ce_aes_expandkey(struct crypto_aes_ctx *ctx, const u8 *in_key,
150 unsigned int key_len)
151{
152 /*
153 * The AES key schedule round constants
154 */
155 static u8 const rcon[] = {
156 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36,
157 };
158
159 u32 kwords = key_len / sizeof(u32);
160 struct aes_block *key_enc, *key_dec;
161 int i, j;
162
163 if (key_len != AES_KEYSIZE_128 &&
164 key_len != AES_KEYSIZE_192 &&
165 key_len != AES_KEYSIZE_256)
166 return -EINVAL;
167
168 memcpy(ctx->key_enc, in_key, key_len);
169 ctx->key_length = key_len;
170
171 kernel_neon_begin_partial(2);
172 for (i = 0; i < sizeof(rcon); i++) {
173 u32 *rki = ctx->key_enc + (i * kwords);
174 u32 *rko = rki + kwords;
175
176 rko[0] = ror32(aes_sub(rki[kwords - 1]), 8) ^ rcon[i] ^ rki[0];
177 rko[1] = rko[0] ^ rki[1];
178 rko[2] = rko[1] ^ rki[2];
179 rko[3] = rko[2] ^ rki[3];
180
181 if (key_len == AES_KEYSIZE_192) {
182 if (i >= 7)
183 break;
184 rko[4] = rko[3] ^ rki[4];
185 rko[5] = rko[4] ^ rki[5];
186 } else if (key_len == AES_KEYSIZE_256) {
187 if (i >= 6)
188 break;
189 rko[4] = aes_sub(rko[3]) ^ rki[4];
190 rko[5] = rko[4] ^ rki[5];
191 rko[6] = rko[5] ^ rki[6];
192 rko[7] = rko[6] ^ rki[7];
193 }
194 }
195
196 /*
197 * Generate the decryption keys for the Equivalent Inverse Cipher.
198 * This involves reversing the order of the round keys, and applying
199 * the Inverse Mix Columns transformation on all but the first and
200 * the last one.
201 */
202 key_enc = (struct aes_block *)ctx->key_enc;
203 key_dec = (struct aes_block *)ctx->key_dec;
204 j = num_rounds(ctx);
205
206 key_dec[0] = key_enc[j];
207 for (i = 1, j--; j > 0; i++, j--)
208 __asm__("ld1 {v0.16b}, %[in] ;"
209 "aesimc v1.16b, v0.16b ;"
210 "st1 {v1.16b}, %[out] ;"
211
212 : [out] "=Q"(key_dec[i])
213 : [in] "Q"(key_enc[j])
214 : "v0","v1");
215 key_dec[i] = key_enc[0];
216
217 kernel_neon_end();
218 return 0;
219}
220EXPORT_SYMBOL(ce_aes_expandkey);
221
222int ce_aes_setkey(struct crypto_tfm *tfm, const u8 *in_key,
223 unsigned int key_len)
224{
225 struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
226 int ret;
227
228 ret = ce_aes_expandkey(ctx, in_key, key_len);
229 if (!ret)
230 return 0;
231
232 tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
233 return -EINVAL;
234}
235EXPORT_SYMBOL(ce_aes_setkey);
236
127static struct crypto_alg aes_alg = { 237static struct crypto_alg aes_alg = {
128 .cra_name = "aes", 238 .cra_name = "aes",
129 .cra_driver_name = "aes-ce", 239 .cra_driver_name = "aes-ce",
@@ -135,7 +245,7 @@ static struct crypto_alg aes_alg = {
135 .cra_cipher = { 245 .cra_cipher = {
136 .cia_min_keysize = AES_MIN_KEY_SIZE, 246 .cia_min_keysize = AES_MIN_KEY_SIZE,
137 .cia_max_keysize = AES_MAX_KEY_SIZE, 247 .cia_max_keysize = AES_MAX_KEY_SIZE,
138 .cia_setkey = crypto_aes_set_key, 248 .cia_setkey = ce_aes_setkey,
139 .cia_encrypt = aes_cipher_encrypt, 249 .cia_encrypt = aes_cipher_encrypt,
140 .cia_decrypt = aes_cipher_decrypt 250 .cia_decrypt = aes_cipher_decrypt
141 } 251 }
diff --git a/arch/arm64/crypto/aes-ce-setkey.h b/arch/arm64/crypto/aes-ce-setkey.h
new file mode 100644
index 000000000000..f08a6471d034
--- /dev/null
+++ b/arch/arm64/crypto/aes-ce-setkey.h
@@ -0,0 +1,5 @@
1
2int ce_aes_setkey(struct crypto_tfm *tfm, const u8 *in_key,
3 unsigned int key_len);
4int ce_aes_expandkey(struct crypto_aes_ctx *ctx, const u8 *in_key,
5 unsigned int key_len);
diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c
index 79cd911ef88c..801aae32841f 100644
--- a/arch/arm64/crypto/aes-glue.c
+++ b/arch/arm64/crypto/aes-glue.c
@@ -16,9 +16,13 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/cpufeature.h> 17#include <linux/cpufeature.h>
18 18
19#include "aes-ce-setkey.h"
20
19#ifdef USE_V8_CRYPTO_EXTENSIONS 21#ifdef USE_V8_CRYPTO_EXTENSIONS
20#define MODE "ce" 22#define MODE "ce"
21#define PRIO 300 23#define PRIO 300
24#define aes_setkey ce_aes_setkey
25#define aes_expandkey ce_aes_expandkey
22#define aes_ecb_encrypt ce_aes_ecb_encrypt 26#define aes_ecb_encrypt ce_aes_ecb_encrypt
23#define aes_ecb_decrypt ce_aes_ecb_decrypt 27#define aes_ecb_decrypt ce_aes_ecb_decrypt
24#define aes_cbc_encrypt ce_aes_cbc_encrypt 28#define aes_cbc_encrypt ce_aes_cbc_encrypt
@@ -30,6 +34,8 @@ MODULE_DESCRIPTION("AES-ECB/CBC/CTR/XTS using ARMv8 Crypto Extensions");
30#else 34#else
31#define MODE "neon" 35#define MODE "neon"
32#define PRIO 200 36#define PRIO 200
37#define aes_setkey crypto_aes_set_key
38#define aes_expandkey crypto_aes_expand_key
33#define aes_ecb_encrypt neon_aes_ecb_encrypt 39#define aes_ecb_encrypt neon_aes_ecb_encrypt
34#define aes_ecb_decrypt neon_aes_ecb_decrypt 40#define aes_ecb_decrypt neon_aes_ecb_decrypt
35#define aes_cbc_encrypt neon_aes_cbc_encrypt 41#define aes_cbc_encrypt neon_aes_cbc_encrypt
@@ -79,10 +85,10 @@ static int xts_set_key(struct crypto_tfm *tfm, const u8 *in_key,
79 struct crypto_aes_xts_ctx *ctx = crypto_tfm_ctx(tfm); 85 struct crypto_aes_xts_ctx *ctx = crypto_tfm_ctx(tfm);
80 int ret; 86 int ret;
81 87
82 ret = crypto_aes_expand_key(&ctx->key1, in_key, key_len / 2); 88 ret = aes_expandkey(&ctx->key1, in_key, key_len / 2);
83 if (!ret) 89 if (!ret)
84 ret = crypto_aes_expand_key(&ctx->key2, &in_key[key_len / 2], 90 ret = aes_expandkey(&ctx->key2, &in_key[key_len / 2],
85 key_len / 2); 91 key_len / 2);
86 if (!ret) 92 if (!ret)
87 return 0; 93 return 0;
88 94
@@ -288,7 +294,7 @@ static struct crypto_alg aes_algs[] = { {
288 .min_keysize = AES_MIN_KEY_SIZE, 294 .min_keysize = AES_MIN_KEY_SIZE,
289 .max_keysize = AES_MAX_KEY_SIZE, 295 .max_keysize = AES_MAX_KEY_SIZE,
290 .ivsize = AES_BLOCK_SIZE, 296 .ivsize = AES_BLOCK_SIZE,
291 .setkey = crypto_aes_set_key, 297 .setkey = aes_setkey,
292 .encrypt = ecb_encrypt, 298 .encrypt = ecb_encrypt,
293 .decrypt = ecb_decrypt, 299 .decrypt = ecb_decrypt,
294 }, 300 },
@@ -306,7 +312,7 @@ static struct crypto_alg aes_algs[] = { {
306 .min_keysize = AES_MIN_KEY_SIZE, 312 .min_keysize = AES_MIN_KEY_SIZE,
307 .max_keysize = AES_MAX_KEY_SIZE, 313 .max_keysize = AES_MAX_KEY_SIZE,
308 .ivsize = AES_BLOCK_SIZE, 314 .ivsize = AES_BLOCK_SIZE,
309 .setkey = crypto_aes_set_key, 315 .setkey = aes_setkey,
310 .encrypt = cbc_encrypt, 316 .encrypt = cbc_encrypt,
311 .decrypt = cbc_decrypt, 317 .decrypt = cbc_decrypt,
312 }, 318 },
@@ -324,7 +330,7 @@ static struct crypto_alg aes_algs[] = { {
324 .min_keysize = AES_MIN_KEY_SIZE, 330 .min_keysize = AES_MIN_KEY_SIZE,
325 .max_keysize = AES_MAX_KEY_SIZE, 331 .max_keysize = AES_MAX_KEY_SIZE,
326 .ivsize = AES_BLOCK_SIZE, 332 .ivsize = AES_BLOCK_SIZE,
327 .setkey = crypto_aes_set_key, 333 .setkey = aes_setkey,
328 .encrypt = ctr_encrypt, 334 .encrypt = ctr_encrypt,
329 .decrypt = ctr_encrypt, 335 .decrypt = ctr_encrypt,
330 }, 336 },
diff --git a/arch/arm64/include/asm/alternative-asm.h b/arch/arm64/include/asm/alternative-asm.h
new file mode 100644
index 000000000000..919a67855b63
--- /dev/null
+++ b/arch/arm64/include/asm/alternative-asm.h
@@ -0,0 +1,29 @@
1#ifndef __ASM_ALTERNATIVE_ASM_H
2#define __ASM_ALTERNATIVE_ASM_H
3
4#ifdef __ASSEMBLY__
5
6.macro altinstruction_entry orig_offset alt_offset feature orig_len alt_len
7 .word \orig_offset - .
8 .word \alt_offset - .
9 .hword \feature
10 .byte \orig_len
11 .byte \alt_len
12.endm
13
14.macro alternative_insn insn1 insn2 cap
15661: \insn1
16662: .pushsection .altinstructions, "a"
17 altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f
18 .popsection
19 .pushsection .altinstr_replacement, "ax"
20663: \insn2
21664: .popsection
22 .if ((664b-663b) != (662b-661b))
23 .error "Alternatives instruction length mismatch"
24 .endif
25.endm
26
27#endif /* __ASSEMBLY__ */
28
29#endif /* __ASM_ALTERNATIVE_ASM_H */
diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
new file mode 100644
index 000000000000..d261f01e2bae
--- /dev/null
+++ b/arch/arm64/include/asm/alternative.h
@@ -0,0 +1,44 @@
1#ifndef __ASM_ALTERNATIVE_H
2#define __ASM_ALTERNATIVE_H
3
4#include <linux/types.h>
5#include <linux/stddef.h>
6#include <linux/stringify.h>
7
8struct alt_instr {
9 s32 orig_offset; /* offset to original instruction */
10 s32 alt_offset; /* offset to replacement instruction */
11 u16 cpufeature; /* cpufeature bit set for replacement */
12 u8 orig_len; /* size of original instruction(s) */
13 u8 alt_len; /* size of new instruction(s), <= orig_len */
14};
15
16void apply_alternatives_all(void);
17void apply_alternatives(void *start, size_t length);
18void free_alternatives_memory(void);
19
20#define ALTINSTR_ENTRY(feature) \
21 " .word 661b - .\n" /* label */ \
22 " .word 663f - .\n" /* new instruction */ \
23 " .hword " __stringify(feature) "\n" /* feature bit */ \
24 " .byte 662b-661b\n" /* source len */ \
25 " .byte 664f-663f\n" /* replacement len */
26
27/* alternative assembly primitive: */
28#define ALTERNATIVE(oldinstr, newinstr, feature) \
29 "661:\n\t" \
30 oldinstr "\n" \
31 "662:\n" \
32 ".pushsection .altinstructions,\"a\"\n" \
33 ALTINSTR_ENTRY(feature) \
34 ".popsection\n" \
35 ".pushsection .altinstr_replacement, \"a\"\n" \
36 "663:\n\t" \
37 newinstr "\n" \
38 "664:\n\t" \
39 ".popsection\n\t" \
40 ".if ((664b-663b) != (662b-661b))\n\t" \
41 " .error \"Alternatives instruction length mismatch\"\n\t"\
42 ".endif\n"
43
44#endif /* __ASM_ALTERNATIVE_H */
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index f19097134b02..b1fa4e614718 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -104,6 +104,15 @@ 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 u64 arch_counter_get_cntpct(void)
108{
109 /*
110 * AArch64 kernel and user space mandate the use of CNTVCT.
111 */
112 BUG();
113 return 0;
114}
115
107static inline u64 arch_counter_get_cntvct(void) 116static inline u64 arch_counter_get_cntvct(void)
108{ 117{
109 u64 cval; 118 u64 cval;
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index 88cc05b5f3ac..bde449936e2f 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -32,6 +32,8 @@
32 32
33#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
34 34
35#define __read_mostly __attribute__((__section__(".data..read_mostly")))
36
35static inline int cache_line_size(void) 37static inline int cache_line_size(void)
36{ 38{
37 u32 cwg = cache_type_cwg(); 39 u32 cwg = cache_type_cwg();
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h
index 689b6379188c..7ae31a2cc6c0 100644
--- a/arch/arm64/include/asm/cacheflush.h
+++ b/arch/arm64/include/asm/cacheflush.h
@@ -73,7 +73,7 @@ extern void flush_cache_all(void);
73extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); 73extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
74extern void flush_icache_range(unsigned long start, unsigned long end); 74extern void flush_icache_range(unsigned long start, unsigned long end);
75extern void __flush_dcache_area(void *addr, size_t len); 75extern void __flush_dcache_area(void *addr, size_t len);
76extern void __flush_cache_user_range(unsigned long start, unsigned long end); 76extern long __flush_cache_user_range(unsigned long start, unsigned long end);
77 77
78static inline void flush_cache_mm(struct mm_struct *mm) 78static inline void flush_cache_mm(struct mm_struct *mm)
79{ 79{
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index ddb9d7830558..cb9593079f29 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -19,6 +19,7 @@
19#define __ASM_CMPXCHG_H 19#define __ASM_CMPXCHG_H
20 20
21#include <linux/bug.h> 21#include <linux/bug.h>
22#include <linux/mmdebug.h>
22 23
23#include <asm/barrier.h> 24#include <asm/barrier.h>
24 25
@@ -152,6 +153,51 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
152 return oldval; 153 return oldval;
153} 154}
154 155
156#define system_has_cmpxchg_double() 1
157
158static inline int __cmpxchg_double(volatile void *ptr1, volatile void *ptr2,
159 unsigned long old1, unsigned long old2,
160 unsigned long new1, unsigned long new2, int size)
161{
162 unsigned long loop, lost;
163
164 switch (size) {
165 case 8:
166 VM_BUG_ON((unsigned long *)ptr2 - (unsigned long *)ptr1 != 1);
167 do {
168 asm volatile("// __cmpxchg_double8\n"
169 " ldxp %0, %1, %2\n"
170 " eor %0, %0, %3\n"
171 " eor %1, %1, %4\n"
172 " orr %1, %0, %1\n"
173 " mov %w0, #0\n"
174 " cbnz %1, 1f\n"
175 " stxp %w0, %5, %6, %2\n"
176 "1:\n"
177 : "=&r"(loop), "=&r"(lost), "+Q" (*(u64 *)ptr1)
178 : "r" (old1), "r"(old2), "r"(new1), "r"(new2));
179 } while (loop);
180 break;
181 default:
182 BUILD_BUG();
183 }
184
185 return !lost;
186}
187
188static inline int __cmpxchg_double_mb(volatile void *ptr1, volatile void *ptr2,
189 unsigned long old1, unsigned long old2,
190 unsigned long new1, unsigned long new2, int size)
191{
192 int ret;
193
194 smp_mb();
195 ret = __cmpxchg_double(ptr1, ptr2, old1, old2, new1, new2, size);
196 smp_mb();
197
198 return ret;
199}
200
155static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old, 201static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
156 unsigned long new, int size) 202 unsigned long new, int size)
157{ 203{
@@ -182,6 +228,33 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
182 __ret; \ 228 __ret; \
183}) 229})
184 230
231#define cmpxchg_double(ptr1, ptr2, o1, o2, n1, n2) \
232({\
233 int __ret;\
234 __ret = __cmpxchg_double_mb((ptr1), (ptr2), (unsigned long)(o1), \
235 (unsigned long)(o2), (unsigned long)(n1), \
236 (unsigned long)(n2), sizeof(*(ptr1)));\
237 __ret; \
238})
239
240#define cmpxchg_double_local(ptr1, ptr2, o1, o2, n1, n2) \
241({\
242 int __ret;\
243 __ret = __cmpxchg_double((ptr1), (ptr2), (unsigned long)(o1), \
244 (unsigned long)(o2), (unsigned long)(n1), \
245 (unsigned long)(n2), sizeof(*(ptr1)));\
246 __ret; \
247})
248
249#define this_cpu_cmpxchg_1(ptr, o, n) cmpxchg_local(raw_cpu_ptr(&(ptr)), o, n)
250#define this_cpu_cmpxchg_2(ptr, o, n) cmpxchg_local(raw_cpu_ptr(&(ptr)), o, n)
251#define this_cpu_cmpxchg_4(ptr, o, n) cmpxchg_local(raw_cpu_ptr(&(ptr)), o, n)
252#define this_cpu_cmpxchg_8(ptr, o, n) cmpxchg_local(raw_cpu_ptr(&(ptr)), o, n)
253
254#define this_cpu_cmpxchg_double_8(ptr1, ptr2, o1, o2, n1, n2) \
255 cmpxchg_double_local(raw_cpu_ptr(&(ptr1)), raw_cpu_ptr(&(ptr2)), \
256 o1, o2, n1, n2)
257
185#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) 258#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
186#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n)) 259#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n))
187 260
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index 56de5aadede2..3fb053fa6e98 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -205,6 +205,13 @@ typedef struct compat_siginfo {
205 compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 205 compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */
206 int _fd; 206 int _fd;
207 } _sigpoll; 207 } _sigpoll;
208
209 /* SIGSYS */
210 struct {
211 compat_uptr_t _call_addr; /* calling user insn */
212 int _syscall; /* triggering system call number */
213 compat_uint_t _arch; /* AUDIT_ARCH_* of syscall */
214 } _sigsys;
208 } _sifields; 215 } _sifields;
209} compat_siginfo_t; 216} compat_siginfo_t;
210 217
diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h
index 056443086019..ace70682499b 100644
--- a/arch/arm64/include/asm/cpu.h
+++ b/arch/arm64/include/asm/cpu.h
@@ -30,6 +30,8 @@ struct cpuinfo_arm64 {
30 u32 reg_dczid; 30 u32 reg_dczid;
31 u32 reg_midr; 31 u32 reg_midr;
32 32
33 u64 reg_id_aa64dfr0;
34 u64 reg_id_aa64dfr1;
33 u64 reg_id_aa64isar0; 35 u64 reg_id_aa64isar0;
34 u64 reg_id_aa64isar1; 36 u64 reg_id_aa64isar1;
35 u64 reg_id_aa64mmfr0; 37 u64 reg_id_aa64mmfr0;
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index cd4ac0516488..07547ccc1f2b 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -21,9 +21,38 @@
21#define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap)) 21#define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap))
22#define cpu_feature(x) ilog2(HWCAP_ ## x) 22#define cpu_feature(x) ilog2(HWCAP_ ## x)
23 23
24#define ARM64_WORKAROUND_CLEAN_CACHE 0
25#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1
26
27#define ARM64_NCAPS 2
28
29#ifndef __ASSEMBLY__
30
31extern DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);
32
24static inline bool cpu_have_feature(unsigned int num) 33static inline bool cpu_have_feature(unsigned int num)
25{ 34{
26 return elf_hwcap & (1UL << num); 35 return elf_hwcap & (1UL << num);
27} 36}
28 37
38static inline bool cpus_have_cap(unsigned int num)
39{
40 if (num >= ARM64_NCAPS)
41 return false;
42 return test_bit(num, cpu_hwcaps);
43}
44
45static inline void cpus_set_cap(unsigned int num)
46{
47 if (num >= ARM64_NCAPS)
48 pr_warn("Attempt to set an illegal CPU capability (%d >= %d)\n",
49 num, ARM64_NCAPS);
50 else
51 __set_bit(num, cpu_hwcaps);
52}
53
54void check_local_cpu_errata(void);
55
56#endif /* __ASSEMBLY__ */
57
29#endif 58#endif
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index 379d0b874328..8adb986a3086 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -57,6 +57,11 @@
57#define MIDR_IMPLEMENTOR(midr) \ 57#define MIDR_IMPLEMENTOR(midr) \
58 (((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT) 58 (((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT)
59 59
60#define MIDR_CPU_PART(imp, partnum) \
61 (((imp) << MIDR_IMPLEMENTOR_SHIFT) | \
62 (0xf << MIDR_ARCHITECTURE_SHIFT) | \
63 ((partnum) << MIDR_PARTNUM_SHIFT))
64
60#define ARM_CPU_IMP_ARM 0x41 65#define ARM_CPU_IMP_ARM 0x41
61#define ARM_CPU_IMP_APM 0x50 66#define ARM_CPU_IMP_APM 0x50
62 67
diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
new file mode 100644
index 000000000000..69d37d87b159
--- /dev/null
+++ b/arch/arm64/include/asm/dmi.h
@@ -0,0 +1,31 @@
1/*
2 * arch/arm64/include/asm/dmi.h
3 *
4 * Copyright (C) 2013 Linaro Limited.
5 * Written by: Yi Li (yi.li@linaro.org)
6 *
7 * based on arch/ia64/include/asm/dmi.h
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
14#ifndef __ASM_DMI_H
15#define __ASM_DMI_H
16
17#include <linux/io.h>
18#include <linux/slab.h>
19
20/*
21 * According to section 2.3.6 of the UEFI spec, the firmware should not
22 * request a virtual mapping for configuration tables such as SMBIOS.
23 * This means we have to map them before use.
24 */
25#define dmi_early_remap(x, l) ioremap_cache(x, l)
26#define dmi_early_unmap(x, l) iounmap(x)
27#define dmi_remap(x, l) ioremap_cache(x, l)
28#define dmi_unmap(x) iounmap(x)
29#define dmi_alloc(l) kzalloc(l, GFP_KERNEL)
30
31#endif
diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h
index 5f7bfe6df723..9ef6eca905ca 100644
--- a/arch/arm64/include/asm/fixmap.h
+++ b/arch/arm64/include/asm/fixmap.h
@@ -31,6 +31,7 @@
31 * 31 *
32 */ 32 */
33enum fixed_addresses { 33enum fixed_addresses {
34 FIX_HOLE,
34 FIX_EARLYCON_MEM_BASE, 35 FIX_EARLYCON_MEM_BASE,
35 __end_of_permanent_fixed_addresses, 36 __end_of_permanent_fixed_addresses,
36 37
@@ -56,10 +57,11 @@ enum fixed_addresses {
56 57
57#define FIXMAP_PAGE_IO __pgprot(PROT_DEVICE_nGnRE) 58#define FIXMAP_PAGE_IO __pgprot(PROT_DEVICE_nGnRE)
58 59
59extern void __early_set_fixmap(enum fixed_addresses idx, 60void __init early_fixmap_init(void);
60 phys_addr_t phys, pgprot_t flags);
61 61
62#define __set_fixmap __early_set_fixmap 62#define __early_set_fixmap __set_fixmap
63
64extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot);
63 65
64#include <asm-generic/fixmap.h> 66#include <asm-generic/fixmap.h>
65 67
diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h
index 024c46183c3c..0ad735166d9f 100644
--- a/arch/arm64/include/asm/hwcap.h
+++ b/arch/arm64/include/asm/hwcap.h
@@ -30,6 +30,7 @@
30#define COMPAT_HWCAP_IDIVA (1 << 17) 30#define COMPAT_HWCAP_IDIVA (1 << 17)
31#define COMPAT_HWCAP_IDIVT (1 << 18) 31#define COMPAT_HWCAP_IDIVT (1 << 18)
32#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) 32#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT)
33#define COMPAT_HWCAP_LPAE (1 << 20)
33#define COMPAT_HWCAP_EVTSTRM (1 << 21) 34#define COMPAT_HWCAP_EVTSTRM (1 << 21)
34 35
35#define COMPAT_HWCAP2_AES (1 << 0) 36#define COMPAT_HWCAP2_AES (1 << 0)
diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
index 56a9e63b6c33..e2ff32a93b5c 100644
--- a/arch/arm64/include/asm/insn.h
+++ b/arch/arm64/include/asm/insn.h
@@ -354,6 +354,16 @@ bool aarch64_insn_hotpatch_safe(u32 old_insn, u32 new_insn);
354int aarch64_insn_patch_text_nosync(void *addr, u32 insn); 354int aarch64_insn_patch_text_nosync(void *addr, u32 insn);
355int aarch64_insn_patch_text_sync(void *addrs[], u32 insns[], int cnt); 355int aarch64_insn_patch_text_sync(void *addrs[], u32 insns[], int cnt);
356int aarch64_insn_patch_text(void *addrs[], u32 insns[], int cnt); 356int aarch64_insn_patch_text(void *addrs[], u32 insns[], int cnt);
357
358bool aarch32_insn_is_wide(u32 insn);
359
360#define A32_RN_OFFSET 16
361#define A32_RT_OFFSET 12
362#define A32_RT2_OFFSET 0
363
364u32 aarch32_insn_extract_reg_num(u32 insn, int offset);
365u32 aarch32_insn_mcr_extract_opc2(u32 insn);
366u32 aarch32_insn_mcr_extract_crm(u32 insn);
357#endif /* __ASSEMBLY__ */ 367#endif /* __ASSEMBLY__ */
358 368
359#endif /* __ASM_INSN_H */ 369#endif /* __ASM_INSN_H */
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 79f1d519221f..949c406d4df4 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -28,57 +28,80 @@
28#include <asm/barrier.h> 28#include <asm/barrier.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/early_ioremap.h> 30#include <asm/early_ioremap.h>
31#include <asm/alternative.h>
32#include <asm/cpufeature.h>
31 33
32#include <xen/xen.h> 34#include <xen/xen.h>
33 35
34/* 36/*
35 * Generic IO read/write. These perform native-endian accesses. 37 * Generic IO read/write. These perform native-endian accesses.
36 */ 38 */
39#define __raw_writeb __raw_writeb
37static inline void __raw_writeb(u8 val, volatile void __iomem *addr) 40static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
38{ 41{
39 asm volatile("strb %w0, [%1]" : : "r" (val), "r" (addr)); 42 asm volatile("strb %w0, [%1]" : : "r" (val), "r" (addr));
40} 43}
41 44
45#define __raw_writew __raw_writew
42static inline void __raw_writew(u16 val, volatile void __iomem *addr) 46static inline void __raw_writew(u16 val, volatile void __iomem *addr)
43{ 47{
44 asm volatile("strh %w0, [%1]" : : "r" (val), "r" (addr)); 48 asm volatile("strh %w0, [%1]" : : "r" (val), "r" (addr));
45} 49}
46 50
51#define __raw_writel __raw_writel
47static inline void __raw_writel(u32 val, volatile void __iomem *addr) 52static inline void __raw_writel(u32 val, volatile void __iomem *addr)
48{ 53{
49 asm volatile("str %w0, [%1]" : : "r" (val), "r" (addr)); 54 asm volatile("str %w0, [%1]" : : "r" (val), "r" (addr));
50} 55}
51 56
57#define __raw_writeq __raw_writeq
52static inline void __raw_writeq(u64 val, volatile void __iomem *addr) 58static inline void __raw_writeq(u64 val, volatile void __iomem *addr)
53{ 59{
54 asm volatile("str %0, [%1]" : : "r" (val), "r" (addr)); 60 asm volatile("str %0, [%1]" : : "r" (val), "r" (addr));
55} 61}
56 62
63#define __raw_readb __raw_readb
57static inline u8 __raw_readb(const volatile void __iomem *addr) 64static inline u8 __raw_readb(const volatile void __iomem *addr)
58{ 65{
59 u8 val; 66 u8 val;
60 asm volatile("ldrb %w0, [%1]" : "=r" (val) : "r" (addr)); 67 asm volatile(ALTERNATIVE("ldrb %w0, [%1]",
68 "ldarb %w0, [%1]",
69 ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
70 : "=r" (val) : "r" (addr));
61 return val; 71 return val;
62} 72}
63 73
74#define __raw_readw __raw_readw
64static inline u16 __raw_readw(const volatile void __iomem *addr) 75static inline u16 __raw_readw(const volatile void __iomem *addr)
65{ 76{
66 u16 val; 77 u16 val;
67 asm volatile("ldrh %w0, [%1]" : "=r" (val) : "r" (addr)); 78
79 asm volatile(ALTERNATIVE("ldrh %w0, [%1]",
80 "ldarh %w0, [%1]",
81 ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
82 : "=r" (val) : "r" (addr));
68 return val; 83 return val;
69} 84}
70 85
86#define __raw_readl __raw_readl
71static inline u32 __raw_readl(const volatile void __iomem *addr) 87static inline u32 __raw_readl(const volatile void __iomem *addr)
72{ 88{
73 u32 val; 89 u32 val;
74 asm volatile("ldr %w0, [%1]" : "=r" (val) : "r" (addr)); 90 asm volatile(ALTERNATIVE("ldr %w0, [%1]",
91 "ldar %w0, [%1]",
92 ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
93 : "=r" (val) : "r" (addr));
75 return val; 94 return val;
76} 95}
77 96
97#define __raw_readq __raw_readq
78static inline u64 __raw_readq(const volatile void __iomem *addr) 98static inline u64 __raw_readq(const volatile void __iomem *addr)
79{ 99{
80 u64 val; 100 u64 val;
81 asm volatile("ldr %0, [%1]" : "=r" (val) : "r" (addr)); 101 asm volatile(ALTERNATIVE("ldr %0, [%1]",
102 "ldar %0, [%1]",
103 ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
104 : "=r" (val) : "r" (addr));
82 return val; 105 return val;
83} 106}
84 107
@@ -125,94 +148,6 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
125#define IO_SPACE_LIMIT (SZ_32M - 1) 148#define IO_SPACE_LIMIT (SZ_32M - 1)
126#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_32M)) 149#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_32M))
127 150
128static inline u8 inb(unsigned long addr)
129{
130 return readb(addr + PCI_IOBASE);
131}
132
133static inline u16 inw(unsigned long addr)
134{
135 return readw(addr + PCI_IOBASE);
136}
137
138static inline u32 inl(unsigned long addr)
139{
140 return readl(addr + PCI_IOBASE);
141}
142
143static inline void outb(u8 b, unsigned long addr)
144{
145 writeb(b, addr + PCI_IOBASE);
146}
147
148static inline void outw(u16 b, unsigned long addr)
149{
150 writew(b, addr + PCI_IOBASE);
151}
152
153static inline void outl(u32 b, unsigned long addr)
154{
155 writel(b, addr + PCI_IOBASE);
156}
157
158#define inb_p(addr) inb(addr)
159#define inw_p(addr) inw(addr)
160#define inl_p(addr) inl(addr)
161
162#define outb_p(x, addr) outb((x), (addr))
163#define outw_p(x, addr) outw((x), (addr))
164#define outl_p(x, addr) outl((x), (addr))
165
166static inline void insb(unsigned long addr, void *buffer, int count)
167{
168 u8 *buf = buffer;
169 while (count--)
170 *buf++ = __raw_readb(addr + PCI_IOBASE);
171}
172
173static inline void insw(unsigned long addr, void *buffer, int count)
174{
175 u16 *buf = buffer;
176 while (count--)
177 *buf++ = __raw_readw(addr + PCI_IOBASE);
178}
179
180static inline void insl(unsigned long addr, void *buffer, int count)
181{
182 u32 *buf = buffer;
183 while (count--)
184 *buf++ = __raw_readl(addr + PCI_IOBASE);
185}
186
187static inline void outsb(unsigned long addr, const void *buffer, int count)
188{
189 const u8 *buf = buffer;
190 while (count--)
191 __raw_writeb(*buf++, addr + PCI_IOBASE);
192}
193
194static inline void outsw(unsigned long addr, const void *buffer, int count)
195{
196 const u16 *buf = buffer;
197 while (count--)
198 __raw_writew(*buf++, addr + PCI_IOBASE);
199}
200
201static inline void outsl(unsigned long addr, const void *buffer, int count)
202{
203 const u32 *buf = buffer;
204 while (count--)
205 __raw_writel(*buf++, addr + PCI_IOBASE);
206}
207
208#define insb_p(port,to,len) insb(port,to,len)
209#define insw_p(port,to,len) insw(port,to,len)
210#define insl_p(port,to,len) insl(port,to,len)
211
212#define outsb_p(port,from,len) outsb(port,from,len)
213#define outsw_p(port,from,len) outsw(port,from,len)
214#define outsl_p(port,from,len) outsl(port,from,len)
215
216/* 151/*
217 * String version of I/O memory access operations. 152 * String version of I/O memory access operations.
218 */ 153 */
@@ -236,18 +171,14 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
236#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC)) 171#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
237#define iounmap __iounmap 172#define iounmap __iounmap
238 173
239#define ARCH_HAS_IOREMAP_WC
240#include <asm-generic/iomap.h>
241
242/* 174/*
243 * More restrictive address range checking than the default implementation 175 * io{read,write}{16,32}be() macros
244 * (PHYS_OFFSET and PHYS_MASK taken into account).
245 */ 176 */
246#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 177#define ioread16be(p) ({ __u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
247extern int valid_phys_addr_range(phys_addr_t addr, size_t size); 178#define ioread32be(p) ({ __u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
248extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
249 179
250extern int devmem_is_allowed(unsigned long pfn); 180#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); })
181#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); })
251 182
252/* 183/*
253 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 184 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
@@ -260,6 +191,18 @@ extern int devmem_is_allowed(unsigned long pfn);
260 */ 191 */
261#define xlate_dev_kmem_ptr(p) p 192#define xlate_dev_kmem_ptr(p) p
262 193
194#include <asm-generic/io.h>
195
196/*
197 * More restrictive address range checking than the default implementation
198 * (PHYS_OFFSET and PHYS_MASK taken into account).
199 */
200#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
201extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
202extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
203
204extern int devmem_is_allowed(unsigned long pfn);
205
263struct bio_vec; 206struct bio_vec;
264extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, 207extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
265 const struct bio_vec *vec2); 208 const struct bio_vec *vec2);
diff --git a/arch/arm64/include/asm/irq.h b/arch/arm64/include/asm/irq.h
index e1f7ecdde11f..94c53674a31d 100644
--- a/arch/arm64/include/asm/irq.h
+++ b/arch/arm64/include/asm/irq.h
@@ -3,7 +3,8 @@
3 3
4#include <asm-generic/irq.h> 4#include <asm-generic/irq.h>
5 5
6extern void (*handle_arch_irq)(struct pt_regs *); 6struct pt_regs;
7
7extern void migrate_irqs(void); 8extern void migrate_irqs(void);
8extern void set_handle_irq(void (*handle_irq)(struct pt_regs *)); 9extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
9 10
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index 7fd3e27e3ccc..8afb863f5a9e 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -18,6 +18,7 @@
18#ifndef __ARM64_KVM_ARM_H__ 18#ifndef __ARM64_KVM_ARM_H__
19#define __ARM64_KVM_ARM_H__ 19#define __ARM64_KVM_ARM_H__
20 20
21#include <asm/memory.h>
21#include <asm/types.h> 22#include <asm/types.h>
22 23
23/* Hyp Configuration Register (HCR) bits */ 24/* Hyp Configuration Register (HCR) bits */
@@ -160,9 +161,9 @@
160#endif 161#endif
161 162
162#define VTTBR_BADDR_SHIFT (VTTBR_X - 1) 163#define VTTBR_BADDR_SHIFT (VTTBR_X - 1)
163#define VTTBR_BADDR_MASK (((1LLU << (PHYS_MASK_SHIFT - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT) 164#define VTTBR_BADDR_MASK (((UL(1) << (PHYS_MASK_SHIFT - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT)
164#define VTTBR_VMID_SHIFT (48LLU) 165#define VTTBR_VMID_SHIFT (UL(48))
165#define VTTBR_VMID_MASK (0xffLLU << VTTBR_VMID_SHIFT) 166#define VTTBR_VMID_MASK (UL(0xFF) << VTTBR_VMID_SHIFT)
166 167
167/* Hyp System Trap Register */ 168/* Hyp System Trap Register */
168#define HSTR_EL2_TTEE (1 << 16) 169#define HSTR_EL2_TTEE (1 << 16)
@@ -185,13 +186,13 @@
185 186
186/* Exception Syndrome Register (ESR) bits */ 187/* Exception Syndrome Register (ESR) bits */
187#define ESR_EL2_EC_SHIFT (26) 188#define ESR_EL2_EC_SHIFT (26)
188#define ESR_EL2_EC (0x3fU << ESR_EL2_EC_SHIFT) 189#define ESR_EL2_EC (UL(0x3f) << ESR_EL2_EC_SHIFT)
189#define ESR_EL2_IL (1U << 25) 190#define ESR_EL2_IL (UL(1) << 25)
190#define ESR_EL2_ISS (ESR_EL2_IL - 1) 191#define ESR_EL2_ISS (ESR_EL2_IL - 1)
191#define ESR_EL2_ISV_SHIFT (24) 192#define ESR_EL2_ISV_SHIFT (24)
192#define ESR_EL2_ISV (1U << ESR_EL2_ISV_SHIFT) 193#define ESR_EL2_ISV (UL(1) << ESR_EL2_ISV_SHIFT)
193#define ESR_EL2_SAS_SHIFT (22) 194#define ESR_EL2_SAS_SHIFT (22)
194#define ESR_EL2_SAS (3U << ESR_EL2_SAS_SHIFT) 195#define ESR_EL2_SAS (UL(3) << ESR_EL2_SAS_SHIFT)
195#define ESR_EL2_SSE (1 << 21) 196#define ESR_EL2_SSE (1 << 21)
196#define ESR_EL2_SRT_SHIFT (16) 197#define ESR_EL2_SRT_SHIFT (16)
197#define ESR_EL2_SRT_MASK (0x1f << ESR_EL2_SRT_SHIFT) 198#define ESR_EL2_SRT_MASK (0x1f << ESR_EL2_SRT_SHIFT)
@@ -205,16 +206,16 @@
205#define ESR_EL2_FSC_TYPE (0x3c) 206#define ESR_EL2_FSC_TYPE (0x3c)
206 207
207#define ESR_EL2_CV_SHIFT (24) 208#define ESR_EL2_CV_SHIFT (24)
208#define ESR_EL2_CV (1U << ESR_EL2_CV_SHIFT) 209#define ESR_EL2_CV (UL(1) << ESR_EL2_CV_SHIFT)
209#define ESR_EL2_COND_SHIFT (20) 210#define ESR_EL2_COND_SHIFT (20)
210#define ESR_EL2_COND (0xfU << ESR_EL2_COND_SHIFT) 211#define ESR_EL2_COND (UL(0xf) << ESR_EL2_COND_SHIFT)
211 212
212 213
213#define FSC_FAULT (0x04) 214#define FSC_FAULT (0x04)
214#define FSC_PERM (0x0c) 215#define FSC_PERM (0x0c)
215 216
216/* Hyp Prefetch Fault Address Register (HPFAR/HDFAR) */ 217/* Hyp Prefetch Fault Address Register (HPFAR/HDFAR) */
217#define HPFAR_MASK (~0xFUL) 218#define HPFAR_MASK (~UL(0xf))
218 219
219#define ESR_EL2_EC_UNKNOWN (0x00) 220#define ESR_EL2_EC_UNKNOWN (0x00)
220#define ESR_EL2_EC_WFI (0x01) 221#define ESR_EL2_EC_WFI (0x01)
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index a62cd077457b..6486b2bfd562 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -120,11 +120,13 @@ extern phys_addr_t memstart_addr;
120 * translation for translating DMA addresses. Use the driver 120 * translation for translating DMA addresses. Use the driver
121 * DMA support - see dma-mapping.h. 121 * DMA support - see dma-mapping.h.
122 */ 122 */
123#define virt_to_phys virt_to_phys
123static inline phys_addr_t virt_to_phys(const volatile void *x) 124static inline phys_addr_t virt_to_phys(const volatile void *x)
124{ 125{
125 return __virt_to_phys((unsigned long)(x)); 126 return __virt_to_phys((unsigned long)(x));
126} 127}
127 128
129#define phys_to_virt phys_to_virt
128static inline void *phys_to_virt(phys_addr_t x) 130static inline void *phys_to_virt(phys_addr_t x)
129{ 131{
130 return (void *)(__phys_to_virt(x)); 132 return (void *)(__phys_to_virt(x));
diff --git a/arch/arm64/include/asm/opcodes.h b/arch/arm64/include/asm/opcodes.h
new file mode 100644
index 000000000000..4e603ea36ad3
--- /dev/null
+++ b/arch/arm64/include/asm/opcodes.h
@@ -0,0 +1 @@
#include <../../arm/include/asm/opcodes.h>
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h
index 5279e5733386..09da25bc596f 100644
--- a/arch/arm64/include/asm/percpu.h
+++ b/arch/arm64/include/asm/percpu.h
@@ -44,6 +44,221 @@ static inline unsigned long __my_cpu_offset(void)
44 44
45#endif /* CONFIG_SMP */ 45#endif /* CONFIG_SMP */
46 46
47#define PERCPU_OP(op, asm_op) \
48static inline unsigned long __percpu_##op(void *ptr, \
49 unsigned long val, int size) \
50{ \
51 unsigned long loop, ret; \
52 \
53 switch (size) { \
54 case 1: \
55 do { \
56 asm ("//__per_cpu_" #op "_1\n" \
57 "ldxrb %w[ret], %[ptr]\n" \
58 #asm_op " %w[ret], %w[ret], %w[val]\n" \
59 "stxrb %w[loop], %w[ret], %[ptr]\n" \
60 : [loop] "=&r" (loop), [ret] "=&r" (ret), \
61 [ptr] "+Q"(*(u8 *)ptr) \
62 : [val] "Ir" (val)); \
63 } while (loop); \
64 break; \
65 case 2: \
66 do { \
67 asm ("//__per_cpu_" #op "_2\n" \
68 "ldxrh %w[ret], %[ptr]\n" \
69 #asm_op " %w[ret], %w[ret], %w[val]\n" \
70 "stxrh %w[loop], %w[ret], %[ptr]\n" \
71 : [loop] "=&r" (loop), [ret] "=&r" (ret), \
72 [ptr] "+Q"(*(u16 *)ptr) \
73 : [val] "Ir" (val)); \
74 } while (loop); \
75 break; \
76 case 4: \
77 do { \
78 asm ("//__per_cpu_" #op "_4\n" \
79 "ldxr %w[ret], %[ptr]\n" \
80 #asm_op " %w[ret], %w[ret], %w[val]\n" \
81 "stxr %w[loop], %w[ret], %[ptr]\n" \
82 : [loop] "=&r" (loop), [ret] "=&r" (ret), \
83 [ptr] "+Q"(*(u32 *)ptr) \
84 : [val] "Ir" (val)); \
85 } while (loop); \
86 break; \
87 case 8: \
88 do { \
89 asm ("//__per_cpu_" #op "_8\n" \
90 "ldxr %[ret], %[ptr]\n" \
91 #asm_op " %[ret], %[ret], %[val]\n" \
92 "stxr %w[loop], %[ret], %[ptr]\n" \
93 : [loop] "=&r" (loop), [ret] "=&r" (ret), \
94 [ptr] "+Q"(*(u64 *)ptr) \
95 : [val] "Ir" (val)); \
96 } while (loop); \
97 break; \
98 default: \
99 BUILD_BUG(); \
100 } \
101 \
102 return ret; \
103}
104
105PERCPU_OP(add, add)
106PERCPU_OP(and, and)
107PERCPU_OP(or, orr)
108#undef PERCPU_OP
109
110static inline unsigned long __percpu_read(void *ptr, int size)
111{
112 unsigned long ret;
113
114 switch (size) {
115 case 1:
116 ret = ACCESS_ONCE(*(u8 *)ptr);
117 break;
118 case 2:
119 ret = ACCESS_ONCE(*(u16 *)ptr);
120 break;
121 case 4:
122 ret = ACCESS_ONCE(*(u32 *)ptr);
123 break;
124 case 8:
125 ret = ACCESS_ONCE(*(u64 *)ptr);
126 break;
127 default:
128 BUILD_BUG();
129 }
130
131 return ret;
132}
133
134static inline void __percpu_write(void *ptr, unsigned long val, int size)
135{
136 switch (size) {
137 case 1:
138 ACCESS_ONCE(*(u8 *)ptr) = (u8)val;
139 break;
140 case 2:
141 ACCESS_ONCE(*(u16 *)ptr) = (u16)val;
142 break;
143 case 4:
144 ACCESS_ONCE(*(u32 *)ptr) = (u32)val;
145 break;
146 case 8:
147 ACCESS_ONCE(*(u64 *)ptr) = (u64)val;
148 break;
149 default:
150 BUILD_BUG();
151 }
152}
153
154static inline unsigned long __percpu_xchg(void *ptr, unsigned long val,
155 int size)
156{
157 unsigned long ret, loop;
158
159 switch (size) {
160 case 1:
161 do {
162 asm ("//__percpu_xchg_1\n"
163 "ldxrb %w[ret], %[ptr]\n"
164 "stxrb %w[loop], %w[val], %[ptr]\n"
165 : [loop] "=&r"(loop), [ret] "=&r"(ret),
166 [ptr] "+Q"(*(u8 *)ptr)
167 : [val] "r" (val));
168 } while (loop);
169 break;
170 case 2:
171 do {
172 asm ("//__percpu_xchg_2\n"
173 "ldxrh %w[ret], %[ptr]\n"
174 "stxrh %w[loop], %w[val], %[ptr]\n"
175 : [loop] "=&r"(loop), [ret] "=&r"(ret),
176 [ptr] "+Q"(*(u16 *)ptr)
177 : [val] "r" (val));
178 } while (loop);
179 break;
180 case 4:
181 do {
182 asm ("//__percpu_xchg_4\n"
183 "ldxr %w[ret], %[ptr]\n"
184 "stxr %w[loop], %w[val], %[ptr]\n"
185 : [loop] "=&r"(loop), [ret] "=&r"(ret),
186 [ptr] "+Q"(*(u32 *)ptr)
187 : [val] "r" (val));
188 } while (loop);
189 break;
190 case 8:
191 do {
192 asm ("//__percpu_xchg_8\n"
193 "ldxr %[ret], %[ptr]\n"
194 "stxr %w[loop], %[val], %[ptr]\n"
195 : [loop] "=&r"(loop), [ret] "=&r"(ret),
196 [ptr] "+Q"(*(u64 *)ptr)
197 : [val] "r" (val));
198 } while (loop);
199 break;
200 default:
201 BUILD_BUG();
202 }
203
204 return ret;
205}
206
207#define _percpu_add(pcp, val) \
208 __percpu_add(raw_cpu_ptr(&(pcp)), val, sizeof(pcp))
209
210#define _percpu_add_return(pcp, val) (typeof(pcp)) (_percpu_add(pcp, val))
211
212#define _percpu_and(pcp, val) \
213 __percpu_and(raw_cpu_ptr(&(pcp)), val, sizeof(pcp))
214
215#define _percpu_or(pcp, val) \
216 __percpu_or(raw_cpu_ptr(&(pcp)), val, sizeof(pcp))
217
218#define _percpu_read(pcp) (typeof(pcp)) \
219 (__percpu_read(raw_cpu_ptr(&(pcp)), sizeof(pcp)))
220
221#define _percpu_write(pcp, val) \
222 __percpu_write(raw_cpu_ptr(&(pcp)), (unsigned long)(val), sizeof(pcp))
223
224#define _percpu_xchg(pcp, val) (typeof(pcp)) \
225 (__percpu_xchg(raw_cpu_ptr(&(pcp)), (unsigned long)(val), sizeof(pcp)))
226
227#define this_cpu_add_1(pcp, val) _percpu_add(pcp, val)
228#define this_cpu_add_2(pcp, val) _percpu_add(pcp, val)
229#define this_cpu_add_4(pcp, val) _percpu_add(pcp, val)
230#define this_cpu_add_8(pcp, val) _percpu_add(pcp, val)
231
232#define this_cpu_add_return_1(pcp, val) _percpu_add_return(pcp, val)
233#define this_cpu_add_return_2(pcp, val) _percpu_add_return(pcp, val)
234#define this_cpu_add_return_4(pcp, val) _percpu_add_return(pcp, val)
235#define this_cpu_add_return_8(pcp, val) _percpu_add_return(pcp, val)
236
237#define this_cpu_and_1(pcp, val) _percpu_and(pcp, val)
238#define this_cpu_and_2(pcp, val) _percpu_and(pcp, val)
239#define this_cpu_and_4(pcp, val) _percpu_and(pcp, val)
240#define this_cpu_and_8(pcp, val) _percpu_and(pcp, val)
241
242#define this_cpu_or_1(pcp, val) _percpu_or(pcp, val)
243#define this_cpu_or_2(pcp, val) _percpu_or(pcp, val)
244#define this_cpu_or_4(pcp, val) _percpu_or(pcp, val)
245#define this_cpu_or_8(pcp, val) _percpu_or(pcp, val)
246
247#define this_cpu_read_1(pcp) _percpu_read(pcp)
248#define this_cpu_read_2(pcp) _percpu_read(pcp)
249#define this_cpu_read_4(pcp) _percpu_read(pcp)
250#define this_cpu_read_8(pcp) _percpu_read(pcp)
251
252#define this_cpu_write_1(pcp, val) _percpu_write(pcp, val)
253#define this_cpu_write_2(pcp, val) _percpu_write(pcp, val)
254#define this_cpu_write_4(pcp, val) _percpu_write(pcp, val)
255#define this_cpu_write_8(pcp, val) _percpu_write(pcp, val)
256
257#define this_cpu_xchg_1(pcp, val) _percpu_xchg(pcp, val)
258#define this_cpu_xchg_2(pcp, val) _percpu_xchg(pcp, val)
259#define this_cpu_xchg_4(pcp, val) _percpu_xchg(pcp, val)
260#define this_cpu_xchg_8(pcp, val) _percpu_xchg(pcp, val)
261
47#include <asm-generic/percpu.h> 262#include <asm-generic/percpu.h>
48 263
49#endif /* __ASM_PERCPU_H */ 264#endif /* __ASM_PERCPU_H */
diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
index d5bed02073d6..e20df38a8ff3 100644
--- a/arch/arm64/include/asm/pgalloc.h
+++ b/arch/arm64/include/asm/pgalloc.h
@@ -26,11 +26,13 @@
26 26
27#define check_pgt_cache() do { } while (0) 27#define check_pgt_cache() do { } while (0)
28 28
29#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO)
30
29#if CONFIG_ARM64_PGTABLE_LEVELS > 2 31#if CONFIG_ARM64_PGTABLE_LEVELS > 2
30 32
31static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 33static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
32{ 34{
33 return (pmd_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT); 35 return (pmd_t *)__get_free_page(PGALLOC_GFP);
34} 36}
35 37
36static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 38static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
@@ -50,7 +52,7 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
50 52
51static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) 53static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
52{ 54{
53 return (pud_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT); 55 return (pud_t *)__get_free_page(PGALLOC_GFP);
54} 56}
55 57
56static inline void pud_free(struct mm_struct *mm, pud_t *pud) 58static inline void pud_free(struct mm_struct *mm, pud_t *pud)
@@ -69,8 +71,6 @@ static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
69extern pgd_t *pgd_alloc(struct mm_struct *mm); 71extern pgd_t *pgd_alloc(struct mm_struct *mm);
70extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); 72extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
71 73
72#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO)
73
74static inline pte_t * 74static inline pte_t *
75pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr) 75pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
76{ 76{
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 41a43bf26492..df22314f57cf 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -279,6 +279,7 @@ void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
279#endif /* CONFIG_HAVE_RCU_TABLE_FREE */ 279#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
280#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 280#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
281 281
282#define pmd_dirty(pmd) pte_dirty(pmd_pte(pmd))
282#define pmd_young(pmd) pte_young(pmd_pte(pmd)) 283#define pmd_young(pmd) pte_young(pmd_pte(pmd))
283#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd))) 284#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd)))
284#define pmd_mksplitting(pmd) pte_pmd(pte_mkspecial(pmd_pte(pmd))) 285#define pmd_mksplitting(pmd) pte_pmd(pte_mkspecial(pmd_pte(pmd)))
diff --git a/arch/arm64/include/asm/seccomp.h b/arch/arm64/include/asm/seccomp.h
new file mode 100644
index 000000000000..c76fac979629
--- /dev/null
+++ b/arch/arm64/include/asm/seccomp.h
@@ -0,0 +1,25 @@
1/*
2 * arch/arm64/include/asm/seccomp.h
3 *
4 * Copyright (C) 2014 Linaro Limited
5 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _ASM_SECCOMP_H
12#define _ASM_SECCOMP_H
13
14#include <asm/unistd.h>
15
16#ifdef CONFIG_COMPAT
17#define __NR_seccomp_read_32 __NR_compat_read
18#define __NR_seccomp_write_32 __NR_compat_write
19#define __NR_seccomp_exit_32 __NR_compat_exit
20#define __NR_seccomp_sigreturn_32 __NR_compat_rt_sigreturn
21#endif /* CONFIG_COMPAT */
22
23#include <asm-generic/seccomp.h>
24
25#endif /* _ASM_SECCOMP_H */
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
index a82c0c5c8b52..c028fe37456f 100644
--- a/arch/arm64/include/asm/tlb.h
+++ b/arch/arm64/include/asm/tlb.h
@@ -19,10 +19,6 @@
19#ifndef __ASM_TLB_H 19#ifndef __ASM_TLB_H
20#define __ASM_TLB_H 20#define __ASM_TLB_H
21 21
22#define __tlb_remove_pmd_tlb_entry __tlb_remove_pmd_tlb_entry
23
24#include <asm-generic/tlb.h>
25
26#include <linux/pagemap.h> 22#include <linux/pagemap.h>
27#include <linux/swap.h> 23#include <linux/swap.h>
28 24
@@ -37,71 +33,22 @@ static inline void __tlb_remove_table(void *_table)
37#define tlb_remove_entry(tlb, entry) tlb_remove_page(tlb, entry) 33#define tlb_remove_entry(tlb, entry) tlb_remove_page(tlb, entry)
38#endif /* CONFIG_HAVE_RCU_TABLE_FREE */ 34#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
39 35
40/* 36#include <asm-generic/tlb.h>
41 * There's three ways the TLB shootdown code is used: 37
42 * 1. Unmapping a range of vmas. See zap_page_range(), unmap_region().
43 * tlb->fullmm = 0, and tlb_start_vma/tlb_end_vma will be called.
44 * 2. Unmapping all vmas. See exit_mmap().
45 * tlb->fullmm = 1, and tlb_start_vma/tlb_end_vma will be called.
46 * Page tables will be freed.
47 * 3. Unmapping argument pages. See shift_arg_pages().
48 * tlb->fullmm = 0, but tlb_start_vma/tlb_end_vma will not be called.
49 */
50static inline void tlb_flush(struct mmu_gather *tlb) 38static inline void tlb_flush(struct mmu_gather *tlb)
51{ 39{
52 if (tlb->fullmm) { 40 if (tlb->fullmm) {
53 flush_tlb_mm(tlb->mm); 41 flush_tlb_mm(tlb->mm);
54 } else if (tlb->end > 0) { 42 } else {
55 struct vm_area_struct vma = { .vm_mm = tlb->mm, }; 43 struct vm_area_struct vma = { .vm_mm = tlb->mm, };
56 flush_tlb_range(&vma, tlb->start, tlb->end); 44 flush_tlb_range(&vma, tlb->start, tlb->end);
57 tlb->start = TASK_SIZE;
58 tlb->end = 0;
59 }
60}
61
62static inline void tlb_add_flush(struct mmu_gather *tlb, unsigned long addr)
63{
64 if (!tlb->fullmm) {
65 tlb->start = min(tlb->start, addr);
66 tlb->end = max(tlb->end, addr + PAGE_SIZE);
67 }
68}
69
70/*
71 * Memorize the range for the TLB flush.
72 */
73static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
74 unsigned long addr)
75{
76 tlb_add_flush(tlb, addr);
77}
78
79/*
80 * In the case of tlb vma handling, we can optimise these away in the
81 * case where we're doing a full MM flush. When we're doing a munmap,
82 * the vmas are adjusted to only cover the region to be torn down.
83 */
84static inline void tlb_start_vma(struct mmu_gather *tlb,
85 struct vm_area_struct *vma)
86{
87 if (!tlb->fullmm) {
88 tlb->start = TASK_SIZE;
89 tlb->end = 0;
90 } 45 }
91} 46}
92 47
93static inline void tlb_end_vma(struct mmu_gather *tlb,
94 struct vm_area_struct *vma)
95{
96 if (!tlb->fullmm)
97 tlb_flush(tlb);
98}
99
100static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, 48static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
101 unsigned long addr) 49 unsigned long addr)
102{ 50{
103 pgtable_page_dtor(pte); 51 pgtable_page_dtor(pte);
104 tlb_add_flush(tlb, addr);
105 tlb_remove_entry(tlb, pte); 52 tlb_remove_entry(tlb, pte);
106} 53}
107 54
@@ -109,7 +56,6 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
109static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, 56static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
110 unsigned long addr) 57 unsigned long addr)
111{ 58{
112 tlb_add_flush(tlb, addr);
113 tlb_remove_entry(tlb, virt_to_page(pmdp)); 59 tlb_remove_entry(tlb, virt_to_page(pmdp));
114} 60}
115#endif 61#endif
@@ -118,15 +64,8 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
118static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, 64static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp,
119 unsigned long addr) 65 unsigned long addr)
120{ 66{
121 tlb_add_flush(tlb, addr);
122 tlb_remove_entry(tlb, virt_to_page(pudp)); 67 tlb_remove_entry(tlb, virt_to_page(pudp));
123} 68}
124#endif 69#endif
125 70
126static inline void __tlb_remove_pmd_tlb_entry(struct mmu_gather *tlb, pmd_t *pmdp,
127 unsigned long address)
128{
129 tlb_add_flush(tlb, address);
130}
131
132#endif 71#endif
diff --git a/arch/arm64/include/asm/traps.h b/arch/arm64/include/asm/traps.h
index 10ca8ff93cc2..232e4ba5d314 100644
--- a/arch/arm64/include/asm/traps.h
+++ b/arch/arm64/include/asm/traps.h
@@ -18,6 +18,22 @@
18#ifndef __ASM_TRAP_H 18#ifndef __ASM_TRAP_H
19#define __ASM_TRAP_H 19#define __ASM_TRAP_H
20 20
21#include <linux/list.h>
22
23struct pt_regs;
24
25struct undef_hook {
26 struct list_head node;
27 u32 instr_mask;
28 u32 instr_val;
29 u64 pstate_mask;
30 u64 pstate_val;
31 int (*fn)(struct pt_regs *regs, u32 instr);
32};
33
34void register_undef_hook(struct undef_hook *hook);
35void unregister_undef_hook(struct undef_hook *hook);
36
21static inline int in_exception_text(unsigned long ptr) 37static inline int in_exception_text(unsigned long ptr)
22{ 38{
23 extern char __exception_text_start[]; 39 extern char __exception_text_start[];
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 6d2bf419431d..49c9aefd24a5 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -31,6 +31,9 @@
31 * Compat syscall numbers used by the AArch64 kernel. 31 * Compat syscall numbers used by the AArch64 kernel.
32 */ 32 */
33#define __NR_compat_restart_syscall 0 33#define __NR_compat_restart_syscall 0
34#define __NR_compat_exit 1
35#define __NR_compat_read 3
36#define __NR_compat_write 4
34#define __NR_compat_sigreturn 119 37#define __NR_compat_sigreturn 119
35#define __NR_compat_rt_sigreturn 173 38#define __NR_compat_rt_sigreturn 173
36 39
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index 9dfdac4a74a1..8893cebcea5b 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -787,7 +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 */ 790#define __NR_seccomp 383
791__SYSCALL(__NR_seccomp, sys_seccomp)
791#define __NR_getrandom 384 792#define __NR_getrandom 384
792__SYSCALL(__NR_getrandom, sys_getrandom) 793__SYSCALL(__NR_getrandom, sys_getrandom)
793#define __NR_memfd_create 385 794#define __NR_memfd_create 385
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 5bd029b43644..eaa77ed7766a 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -5,6 +5,7 @@
5CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) 5CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET)
6AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 6AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
7CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 7CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
8CFLAGS_armv8_deprecated.o := -I$(src)
8 9
9CFLAGS_REMOVE_ftrace.o = -pg 10CFLAGS_REMOVE_ftrace.o = -pg
10CFLAGS_REMOVE_insn.o = -pg 11CFLAGS_REMOVE_insn.o = -pg
@@ -15,10 +16,11 @@ arm64-obj-y := cputable.o debug-monitors.o entry.o irq.o fpsimd.o \
15 entry-fpsimd.o process.o ptrace.o setup.o signal.o \ 16 entry-fpsimd.o process.o ptrace.o setup.o signal.o \
16 sys.o stacktrace.o time.o traps.o io.o vdso.o \ 17 sys.o stacktrace.o time.o traps.o io.o vdso.o \
17 hyp-stub.o psci.o cpu_ops.o insn.o return_address.o \ 18 hyp-stub.o psci.o cpu_ops.o insn.o return_address.o \
18 cpuinfo.o 19 cpuinfo.o cpu_errata.o alternative.o
19 20
20arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ 21arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \
21 sys_compat.o 22 sys_compat.o \
23 ../../arm/kernel/opcodes.o
22arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o 24arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o
23arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o 25arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o
24arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o topology.o 26arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o topology.o
@@ -31,6 +33,7 @@ arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o
31arm64-obj-$(CONFIG_KGDB) += kgdb.o 33arm64-obj-$(CONFIG_KGDB) += kgdb.o
32arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o 34arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o
33arm64-obj-$(CONFIG_PCI) += pci.o 35arm64-obj-$(CONFIG_PCI) += pci.o
36arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o
34 37
35obj-y += $(arm64-obj-y) vdso/ 38obj-y += $(arm64-obj-y) vdso/
36obj-m += $(arm64-obj-m) 39obj-m += $(arm64-obj-m)
diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c
new file mode 100644
index 000000000000..ad7821d64a1d
--- /dev/null
+++ b/arch/arm64/kernel/alternative.c
@@ -0,0 +1,85 @@
1/*
2 * alternative runtime patching
3 * inspired by the x86 version
4 *
5 * Copyright (C) 2014 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#define pr_fmt(fmt) "alternatives: " fmt
21
22#include <linux/init.h>
23#include <linux/cpu.h>
24#include <asm/cacheflush.h>
25#include <asm/alternative.h>
26#include <asm/cpufeature.h>
27#include <linux/stop_machine.h>
28
29extern struct alt_instr __alt_instructions[], __alt_instructions_end[];
30
31struct alt_region {
32 struct alt_instr *begin;
33 struct alt_instr *end;
34};
35
36static int __apply_alternatives(void *alt_region)
37{
38 struct alt_instr *alt;
39 struct alt_region *region = alt_region;
40 u8 *origptr, *replptr;
41
42 for (alt = region->begin; alt < region->end; alt++) {
43 if (!cpus_have_cap(alt->cpufeature))
44 continue;
45
46 BUG_ON(alt->alt_len > alt->orig_len);
47
48 pr_info_once("patching kernel code\n");
49
50 origptr = (u8 *)&alt->orig_offset + alt->orig_offset;
51 replptr = (u8 *)&alt->alt_offset + alt->alt_offset;
52 memcpy(origptr, replptr, alt->alt_len);
53 flush_icache_range((uintptr_t)origptr,
54 (uintptr_t)(origptr + alt->alt_len));
55 }
56
57 return 0;
58}
59
60void apply_alternatives_all(void)
61{
62 struct alt_region region = {
63 .begin = __alt_instructions,
64 .end = __alt_instructions_end,
65 };
66
67 /* better not try code patching on a live SMP system */
68 stop_machine(__apply_alternatives, &region, NULL);
69}
70
71void apply_alternatives(void *start, size_t length)
72{
73 struct alt_region region = {
74 .begin = start,
75 .end = start + length,
76 };
77
78 __apply_alternatives(&region);
79}
80
81void free_alternatives_memory(void)
82{
83 free_reserved_area(__alt_instructions, __alt_instructions_end,
84 0, "alternatives");
85}
diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
new file mode 100644
index 000000000000..c363671d7509
--- /dev/null
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -0,0 +1,553 @@
1/*
2 * Copyright (C) 2014 ARM Limited
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/cpu.h>
10#include <linux/init.h>
11#include <linux/list.h>
12#include <linux/perf_event.h>
13#include <linux/sched.h>
14#include <linux/slab.h>
15#include <linux/sysctl.h>
16
17#include <asm/insn.h>
18#include <asm/opcodes.h>
19#include <asm/system_misc.h>
20#include <asm/traps.h>
21#include <asm/uaccess.h>
22
23#define CREATE_TRACE_POINTS
24#include "trace-events-emulation.h"
25
26/*
27 * The runtime support for deprecated instruction support can be in one of
28 * following three states -
29 *
30 * 0 = undef
31 * 1 = emulate (software emulation)
32 * 2 = hw (supported in hardware)
33 */
34enum insn_emulation_mode {
35 INSN_UNDEF,
36 INSN_EMULATE,
37 INSN_HW,
38};
39
40enum legacy_insn_status {
41 INSN_DEPRECATED,
42 INSN_OBSOLETE,
43};
44
45struct insn_emulation_ops {
46 const char *name;
47 enum legacy_insn_status status;
48 struct undef_hook *hooks;
49 int (*set_hw_mode)(bool enable);
50};
51
52struct insn_emulation {
53 struct list_head node;
54 struct insn_emulation_ops *ops;
55 int current_mode;
56 int min;
57 int max;
58};
59
60static LIST_HEAD(insn_emulation);
61static int nr_insn_emulated;
62static DEFINE_RAW_SPINLOCK(insn_emulation_lock);
63
64static void register_emulation_hooks(struct insn_emulation_ops *ops)
65{
66 struct undef_hook *hook;
67
68 BUG_ON(!ops->hooks);
69
70 for (hook = ops->hooks; hook->instr_mask; hook++)
71 register_undef_hook(hook);
72
73 pr_notice("Registered %s emulation handler\n", ops->name);
74}
75
76static void remove_emulation_hooks(struct insn_emulation_ops *ops)
77{
78 struct undef_hook *hook;
79
80 BUG_ON(!ops->hooks);
81
82 for (hook = ops->hooks; hook->instr_mask; hook++)
83 unregister_undef_hook(hook);
84
85 pr_notice("Removed %s emulation handler\n", ops->name);
86}
87
88static int update_insn_emulation_mode(struct insn_emulation *insn,
89 enum insn_emulation_mode prev)
90{
91 int ret = 0;
92
93 switch (prev) {
94 case INSN_UNDEF: /* Nothing to be done */
95 break;
96 case INSN_EMULATE:
97 remove_emulation_hooks(insn->ops);
98 break;
99 case INSN_HW:
100 if (insn->ops->set_hw_mode) {
101 insn->ops->set_hw_mode(false);
102 pr_notice("Disabled %s support\n", insn->ops->name);
103 }
104 break;
105 }
106
107 switch (insn->current_mode) {
108 case INSN_UNDEF:
109 break;
110 case INSN_EMULATE:
111 register_emulation_hooks(insn->ops);
112 break;
113 case INSN_HW:
114 if (insn->ops->set_hw_mode && insn->ops->set_hw_mode(true))
115 pr_notice("Enabled %s support\n", insn->ops->name);
116 else
117 ret = -EINVAL;
118 break;
119 }
120
121 return ret;
122}
123
124static void register_insn_emulation(struct insn_emulation_ops *ops)
125{
126 unsigned long flags;
127 struct insn_emulation *insn;
128
129 insn = kzalloc(sizeof(*insn), GFP_KERNEL);
130 insn->ops = ops;
131 insn->min = INSN_UNDEF;
132
133 switch (ops->status) {
134 case INSN_DEPRECATED:
135 insn->current_mode = INSN_EMULATE;
136 insn->max = INSN_HW;
137 break;
138 case INSN_OBSOLETE:
139 insn->current_mode = INSN_UNDEF;
140 insn->max = INSN_EMULATE;
141 break;
142 }
143
144 raw_spin_lock_irqsave(&insn_emulation_lock, flags);
145 list_add(&insn->node, &insn_emulation);
146 nr_insn_emulated++;
147 raw_spin_unlock_irqrestore(&insn_emulation_lock, flags);
148
149 /* Register any handlers if required */
150 update_insn_emulation_mode(insn, INSN_UNDEF);
151}
152
153static int emulation_proc_handler(struct ctl_table *table, int write,
154 void __user *buffer, size_t *lenp,
155 loff_t *ppos)
156{
157 int ret = 0;
158 struct insn_emulation *insn = (struct insn_emulation *) table->data;
159 enum insn_emulation_mode prev_mode = insn->current_mode;
160
161 table->data = &insn->current_mode;
162 ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
163
164 if (ret || !write || prev_mode == insn->current_mode)
165 goto ret;
166
167 ret = update_insn_emulation_mode(insn, prev_mode);
168 if (ret) {
169 /* Mode change failed, revert to previous mode. */
170 insn->current_mode = prev_mode;
171 update_insn_emulation_mode(insn, INSN_UNDEF);
172 }
173ret:
174 table->data = insn;
175 return ret;
176}
177
178static struct ctl_table ctl_abi[] = {
179 {
180 .procname = "abi",
181 .mode = 0555,
182 },
183 { }
184};
185
186static void register_insn_emulation_sysctl(struct ctl_table *table)
187{
188 unsigned long flags;
189 int i = 0;
190 struct insn_emulation *insn;
191 struct ctl_table *insns_sysctl, *sysctl;
192
193 insns_sysctl = kzalloc(sizeof(*sysctl) * (nr_insn_emulated + 1),
194 GFP_KERNEL);
195
196 raw_spin_lock_irqsave(&insn_emulation_lock, flags);
197 list_for_each_entry(insn, &insn_emulation, node) {
198 sysctl = &insns_sysctl[i];
199
200 sysctl->mode = 0644;
201 sysctl->maxlen = sizeof(int);
202
203 sysctl->procname = insn->ops->name;
204 sysctl->data = insn;
205 sysctl->extra1 = &insn->min;
206 sysctl->extra2 = &insn->max;
207 sysctl->proc_handler = emulation_proc_handler;
208 i++;
209 }
210 raw_spin_unlock_irqrestore(&insn_emulation_lock, flags);
211
212 table->child = insns_sysctl;
213 register_sysctl_table(table);
214}
215
216/*
217 * Implement emulation of the SWP/SWPB instructions using load-exclusive and
218 * store-exclusive.
219 *
220 * Syntax of SWP{B} instruction: SWP{B}<c> <Rt>, <Rt2>, [<Rn>]
221 * Where: Rt = destination
222 * Rt2 = source
223 * Rn = address
224 */
225
226/*
227 * Error-checking SWP macros implemented using ldxr{b}/stxr{b}
228 */
229#define __user_swpX_asm(data, addr, res, temp, B) \
230 __asm__ __volatile__( \
231 " mov %w2, %w1\n" \
232 "0: ldxr"B" %w1, [%3]\n" \
233 "1: stxr"B" %w0, %w2, [%3]\n" \
234 " cbz %w0, 2f\n" \
235 " mov %w0, %w4\n" \
236 "2:\n" \
237 " .pushsection .fixup,\"ax\"\n" \
238 " .align 2\n" \
239 "3: mov %w0, %w5\n" \
240 " b 2b\n" \
241 " .popsection" \
242 " .pushsection __ex_table,\"a\"\n" \
243 " .align 3\n" \
244 " .quad 0b, 3b\n" \
245 " .quad 1b, 3b\n" \
246 " .popsection" \
247 : "=&r" (res), "+r" (data), "=&r" (temp) \
248 : "r" (addr), "i" (-EAGAIN), "i" (-EFAULT) \
249 : "memory")
250
251#define __user_swp_asm(data, addr, res, temp) \
252 __user_swpX_asm(data, addr, res, temp, "")
253#define __user_swpb_asm(data, addr, res, temp) \
254 __user_swpX_asm(data, addr, res, temp, "b")
255
256/*
257 * Bit 22 of the instruction encoding distinguishes between
258 * the SWP and SWPB variants (bit set means SWPB).
259 */
260#define TYPE_SWPB (1 << 22)
261
262/*
263 * Set up process info to signal segmentation fault - called on access error.
264 */
265static void set_segfault(struct pt_regs *regs, unsigned long addr)
266{
267 siginfo_t info;
268
269 down_read(&current->mm->mmap_sem);
270 if (find_vma(current->mm, addr) == NULL)
271 info.si_code = SEGV_MAPERR;
272 else
273 info.si_code = SEGV_ACCERR;
274 up_read(&current->mm->mmap_sem);
275
276 info.si_signo = SIGSEGV;
277 info.si_errno = 0;
278 info.si_addr = (void *) instruction_pointer(regs);
279
280 pr_debug("SWP{B} emulation: access caused memory abort!\n");
281 arm64_notify_die("Illegal memory access", regs, &info, 0);
282}
283
284static int emulate_swpX(unsigned int address, unsigned int *data,
285 unsigned int type)
286{
287 unsigned int res = 0;
288
289 if ((type != TYPE_SWPB) && (address & 0x3)) {
290 /* SWP to unaligned address not permitted */
291 pr_debug("SWP instruction on unaligned pointer!\n");
292 return -EFAULT;
293 }
294
295 while (1) {
296 unsigned long temp;
297
298 if (type == TYPE_SWPB)
299 __user_swpb_asm(*data, address, res, temp);
300 else
301 __user_swp_asm(*data, address, res, temp);
302
303 if (likely(res != -EAGAIN) || signal_pending(current))
304 break;
305
306 cond_resched();
307 }
308
309 return res;
310}
311
312/*
313 * swp_handler logs the id of calling process, dissects the instruction, sanity
314 * checks the memory location, calls emulate_swpX for the actual operation and
315 * deals with fixup/error handling before returning
316 */
317static int swp_handler(struct pt_regs *regs, u32 instr)
318{
319 u32 destreg, data, type, address = 0;
320 int rn, rt2, res = 0;
321
322 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->pc);
323
324 type = instr & TYPE_SWPB;
325
326 switch (arm_check_condition(instr, regs->pstate)) {
327 case ARM_OPCODE_CONDTEST_PASS:
328 break;
329 case ARM_OPCODE_CONDTEST_FAIL:
330 /* Condition failed - return to next instruction */
331 goto ret;
332 case ARM_OPCODE_CONDTEST_UNCOND:
333 /* If unconditional encoding - not a SWP, undef */
334 return -EFAULT;
335 default:
336 return -EINVAL;
337 }
338
339 rn = aarch32_insn_extract_reg_num(instr, A32_RN_OFFSET);
340 rt2 = aarch32_insn_extract_reg_num(instr, A32_RT2_OFFSET);
341
342 address = (u32)regs->user_regs.regs[rn];
343 data = (u32)regs->user_regs.regs[rt2];
344 destreg = aarch32_insn_extract_reg_num(instr, A32_RT_OFFSET);
345
346 pr_debug("addr in r%d->0x%08x, dest is r%d, source in r%d->0x%08x)\n",
347 rn, address, destreg,
348 aarch32_insn_extract_reg_num(instr, A32_RT2_OFFSET), data);
349
350 /* Check access in reasonable access range for both SWP and SWPB */
351 if (!access_ok(VERIFY_WRITE, (address & ~3), 4)) {
352 pr_debug("SWP{B} emulation: access to 0x%08x not allowed!\n",
353 address);
354 goto fault;
355 }
356
357 res = emulate_swpX(address, &data, type);
358 if (res == -EFAULT)
359 goto fault;
360 else if (res == 0)
361 regs->user_regs.regs[destreg] = data;
362
363ret:
364 if (type == TYPE_SWPB)
365 trace_instruction_emulation("swpb", regs->pc);
366 else
367 trace_instruction_emulation("swp", regs->pc);
368
369 pr_warn_ratelimited("\"%s\" (%ld) uses obsolete SWP{B} instruction at 0x%llx\n",
370 current->comm, (unsigned long)current->pid, regs->pc);
371
372 regs->pc += 4;
373 return 0;
374
375fault:
376 set_segfault(regs, address);
377
378 return 0;
379}
380
381/*
382 * Only emulate SWP/SWPB executed in ARM state/User mode.
383 * The kernel must be SWP free and SWP{B} does not exist in Thumb.
384 */
385static struct undef_hook swp_hooks[] = {
386 {
387 .instr_mask = 0x0fb00ff0,
388 .instr_val = 0x01000090,
389 .pstate_mask = COMPAT_PSR_MODE_MASK,
390 .pstate_val = COMPAT_PSR_MODE_USR,
391 .fn = swp_handler
392 },
393 { }
394};
395
396static struct insn_emulation_ops swp_ops = {
397 .name = "swp",
398 .status = INSN_OBSOLETE,
399 .hooks = swp_hooks,
400 .set_hw_mode = NULL,
401};
402
403static int cp15barrier_handler(struct pt_regs *regs, u32 instr)
404{
405 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->pc);
406
407 switch (arm_check_condition(instr, regs->pstate)) {
408 case ARM_OPCODE_CONDTEST_PASS:
409 break;
410 case ARM_OPCODE_CONDTEST_FAIL:
411 /* Condition failed - return to next instruction */
412 goto ret;
413 case ARM_OPCODE_CONDTEST_UNCOND:
414 /* If unconditional encoding - not a barrier instruction */
415 return -EFAULT;
416 default:
417 return -EINVAL;
418 }
419
420 switch (aarch32_insn_mcr_extract_crm(instr)) {
421 case 10:
422 /*
423 * dmb - mcr p15, 0, Rt, c7, c10, 5
424 * dsb - mcr p15, 0, Rt, c7, c10, 4
425 */
426 if (aarch32_insn_mcr_extract_opc2(instr) == 5) {
427 dmb(sy);
428 trace_instruction_emulation(
429 "mcr p15, 0, Rt, c7, c10, 5 ; dmb", regs->pc);
430 } else {
431 dsb(sy);
432 trace_instruction_emulation(
433 "mcr p15, 0, Rt, c7, c10, 4 ; dsb", regs->pc);
434 }
435 break;
436 case 5:
437 /*
438 * isb - mcr p15, 0, Rt, c7, c5, 4
439 *
440 * Taking an exception or returning from one acts as an
441 * instruction barrier. So no explicit barrier needed here.
442 */
443 trace_instruction_emulation(
444 "mcr p15, 0, Rt, c7, c5, 4 ; isb", regs->pc);
445 break;
446 }
447
448ret:
449 pr_warn_ratelimited("\"%s\" (%ld) uses deprecated CP15 Barrier instruction at 0x%llx\n",
450 current->comm, (unsigned long)current->pid, regs->pc);
451
452 regs->pc += 4;
453 return 0;
454}
455
456#define SCTLR_EL1_CP15BEN (1 << 5)
457
458static inline void config_sctlr_el1(u32 clear, u32 set)
459{
460 u32 val;
461
462 asm volatile("mrs %0, sctlr_el1" : "=r" (val));
463 val &= ~clear;
464 val |= set;
465 asm volatile("msr sctlr_el1, %0" : : "r" (val));
466}
467
468static void enable_cp15_ben(void *info)
469{
470 config_sctlr_el1(0, SCTLR_EL1_CP15BEN);
471}
472
473static void disable_cp15_ben(void *info)
474{
475 config_sctlr_el1(SCTLR_EL1_CP15BEN, 0);
476}
477
478static int cpu_hotplug_notify(struct notifier_block *b,
479 unsigned long action, void *hcpu)
480{
481 switch (action) {
482 case CPU_STARTING:
483 case CPU_STARTING_FROZEN:
484 enable_cp15_ben(NULL);
485 return NOTIFY_DONE;
486 case CPU_DYING:
487 case CPU_DYING_FROZEN:
488 disable_cp15_ben(NULL);
489 return NOTIFY_DONE;
490 }
491
492 return NOTIFY_OK;
493}
494
495static struct notifier_block cpu_hotplug_notifier = {
496 .notifier_call = cpu_hotplug_notify,
497};
498
499static int cp15_barrier_set_hw_mode(bool enable)
500{
501 if (enable) {
502 register_cpu_notifier(&cpu_hotplug_notifier);
503 on_each_cpu(enable_cp15_ben, NULL, true);
504 } else {
505 unregister_cpu_notifier(&cpu_hotplug_notifier);
506 on_each_cpu(disable_cp15_ben, NULL, true);
507 }
508
509 return true;
510}
511
512static struct undef_hook cp15_barrier_hooks[] = {
513 {
514 .instr_mask = 0x0fff0fdf,
515 .instr_val = 0x0e070f9a,
516 .pstate_mask = COMPAT_PSR_MODE_MASK,
517 .pstate_val = COMPAT_PSR_MODE_USR,
518 .fn = cp15barrier_handler,
519 },
520 {
521 .instr_mask = 0x0fff0fff,
522 .instr_val = 0x0e070f95,
523 .pstate_mask = COMPAT_PSR_MODE_MASK,
524 .pstate_val = COMPAT_PSR_MODE_USR,
525 .fn = cp15barrier_handler,
526 },
527 { }
528};
529
530static struct insn_emulation_ops cp15_barrier_ops = {
531 .name = "cp15_barrier",
532 .status = INSN_DEPRECATED,
533 .hooks = cp15_barrier_hooks,
534 .set_hw_mode = cp15_barrier_set_hw_mode,
535};
536
537/*
538 * Invoked as late_initcall, since not needed before init spawned.
539 */
540static int __init armv8_deprecated_init(void)
541{
542 if (IS_ENABLED(CONFIG_SWP_EMULATION))
543 register_insn_emulation(&swp_ops);
544
545 if (IS_ENABLED(CONFIG_CP15_BARRIER_EMULATION))
546 register_insn_emulation(&cp15_barrier_ops);
547
548 register_insn_emulation_sysctl(ctl_abi);
549
550 return 0;
551}
552
553late_initcall(armv8_deprecated_init);
diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
new file mode 100644
index 000000000000..fa62637e63a8
--- /dev/null
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -0,0 +1,111 @@
1/*
2 * Contains CPU specific errata definitions
3 *
4 * Copyright (C) 2014 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#define pr_fmt(fmt) "alternatives: " fmt
20
21#include <linux/types.h>
22#include <asm/cpu.h>
23#include <asm/cputype.h>
24#include <asm/cpufeature.h>
25
26#define MIDR_CORTEX_A53 MIDR_CPU_PART(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)
27#define MIDR_CORTEX_A57 MIDR_CPU_PART(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)
28
29/*
30 * Add a struct or another datatype to the union below if you need
31 * different means to detect an affected CPU.
32 */
33struct arm64_cpu_capabilities {
34 const char *desc;
35 u16 capability;
36 bool (*is_affected)(struct arm64_cpu_capabilities *);
37 union {
38 struct {
39 u32 midr_model;
40 u32 midr_range_min, midr_range_max;
41 };
42 };
43};
44
45#define CPU_MODEL_MASK (MIDR_IMPLEMENTOR_MASK | MIDR_PARTNUM_MASK | \
46 MIDR_ARCHITECTURE_MASK)
47
48static bool __maybe_unused
49is_affected_midr_range(struct arm64_cpu_capabilities *entry)
50{
51 u32 midr = read_cpuid_id();
52
53 if ((midr & CPU_MODEL_MASK) != entry->midr_model)
54 return false;
55
56 midr &= MIDR_REVISION_MASK | MIDR_VARIANT_MASK;
57
58 return (midr >= entry->midr_range_min && midr <= entry->midr_range_max);
59}
60
61#define MIDR_RANGE(model, min, max) \
62 .is_affected = is_affected_midr_range, \
63 .midr_model = model, \
64 .midr_range_min = min, \
65 .midr_range_max = max
66
67struct arm64_cpu_capabilities arm64_errata[] = {
68#if defined(CONFIG_ARM64_ERRATUM_826319) || \
69 defined(CONFIG_ARM64_ERRATUM_827319) || \
70 defined(CONFIG_ARM64_ERRATUM_824069)
71 {
72 /* Cortex-A53 r0p[012] */
73 .desc = "ARM errata 826319, 827319, 824069",
74 .capability = ARM64_WORKAROUND_CLEAN_CACHE,
75 MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x02),
76 },
77#endif
78#ifdef CONFIG_ARM64_ERRATUM_819472
79 {
80 /* Cortex-A53 r0p[01] */
81 .desc = "ARM errata 819472",
82 .capability = ARM64_WORKAROUND_CLEAN_CACHE,
83 MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x01),
84 },
85#endif
86#ifdef CONFIG_ARM64_ERRATUM_832075
87 {
88 /* Cortex-A57 r0p0 - r1p2 */
89 .desc = "ARM erratum 832075",
90 .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
91 MIDR_RANGE(MIDR_CORTEX_A57, 0x00, 0x12),
92 },
93#endif
94 {
95 }
96};
97
98void check_local_cpu_errata(void)
99{
100 struct arm64_cpu_capabilities *cpus = arm64_errata;
101 int i;
102
103 for (i = 0; cpus[i].desc; i++) {
104 if (!cpus[i].is_affected(&cpus[i]))
105 continue;
106
107 if (!cpus_have_cap(cpus[i].capability))
108 pr_info("enabling workaround for %s\n", cpus[i].desc);
109 cpus_set_cap(cpus[i].capability);
110 }
111}
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 504fdaa8367e..57b641747534 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -18,6 +18,7 @@
18#include <asm/cachetype.h> 18#include <asm/cachetype.h>
19#include <asm/cpu.h> 19#include <asm/cpu.h>
20#include <asm/cputype.h> 20#include <asm/cputype.h>
21#include <asm/cpufeature.h>
21 22
22#include <linux/bitops.h> 23#include <linux/bitops.h>
23#include <linux/bug.h> 24#include <linux/bug.h>
@@ -111,6 +112,15 @@ static void cpuinfo_sanity_check(struct cpuinfo_arm64 *cur)
111 diff |= CHECK(cntfrq, boot, cur, cpu); 112 diff |= CHECK(cntfrq, boot, cur, cpu);
112 113
113 /* 114 /*
115 * The kernel uses self-hosted debug features and expects CPUs to
116 * support identical debug features. We presently need CTX_CMPs, WRPs,
117 * and BRPs to be identical.
118 * ID_AA64DFR1 is currently RES0.
119 */
120 diff |= CHECK(id_aa64dfr0, boot, cur, cpu);
121 diff |= CHECK(id_aa64dfr1, boot, cur, cpu);
122
123 /*
114 * Even in big.LITTLE, processors should be identical instruction-set 124 * Even in big.LITTLE, processors should be identical instruction-set
115 * wise. 125 * wise.
116 */ 126 */
@@ -143,7 +153,12 @@ static void cpuinfo_sanity_check(struct cpuinfo_arm64 *cur)
143 diff |= CHECK(id_isar3, boot, cur, cpu); 153 diff |= CHECK(id_isar3, boot, cur, cpu);
144 diff |= CHECK(id_isar4, boot, cur, cpu); 154 diff |= CHECK(id_isar4, boot, cur, cpu);
145 diff |= CHECK(id_isar5, boot, cur, cpu); 155 diff |= CHECK(id_isar5, boot, cur, cpu);
146 diff |= CHECK(id_mmfr0, boot, cur, cpu); 156 /*
157 * Regardless of the value of the AuxReg field, the AIFSR, ADFSR, and
158 * ACTLR formats could differ across CPUs and therefore would have to
159 * be trapped for virtualization anyway.
160 */
161 diff |= CHECK_MASK(id_mmfr0, 0xff0fffff, boot, cur, cpu);
147 diff |= CHECK(id_mmfr1, boot, cur, cpu); 162 diff |= CHECK(id_mmfr1, boot, cur, cpu);
148 diff |= CHECK(id_mmfr2, boot, cur, cpu); 163 diff |= CHECK(id_mmfr2, boot, cur, cpu);
149 diff |= CHECK(id_mmfr3, boot, cur, cpu); 164 diff |= CHECK(id_mmfr3, boot, cur, cpu);
@@ -155,7 +170,7 @@ static void cpuinfo_sanity_check(struct cpuinfo_arm64 *cur)
155 * pretend to support them. 170 * pretend to support them.
156 */ 171 */
157 WARN_TAINT_ONCE(diff, TAINT_CPU_OUT_OF_SPEC, 172 WARN_TAINT_ONCE(diff, TAINT_CPU_OUT_OF_SPEC,
158 "Unsupported CPU feature variation."); 173 "Unsupported CPU feature variation.\n");
159} 174}
160 175
161static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) 176static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
@@ -165,6 +180,8 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
165 info->reg_dczid = read_cpuid(DCZID_EL0); 180 info->reg_dczid = read_cpuid(DCZID_EL0);
166 info->reg_midr = read_cpuid_id(); 181 info->reg_midr = read_cpuid_id();
167 182
183 info->reg_id_aa64dfr0 = read_cpuid(ID_AA64DFR0_EL1);
184 info->reg_id_aa64dfr1 = read_cpuid(ID_AA64DFR1_EL1);
168 info->reg_id_aa64isar0 = read_cpuid(ID_AA64ISAR0_EL1); 185 info->reg_id_aa64isar0 = read_cpuid(ID_AA64ISAR0_EL1);
169 info->reg_id_aa64isar1 = read_cpuid(ID_AA64ISAR1_EL1); 186 info->reg_id_aa64isar1 = read_cpuid(ID_AA64ISAR1_EL1);
170 info->reg_id_aa64mmfr0 = read_cpuid(ID_AA64MMFR0_EL1); 187 info->reg_id_aa64mmfr0 = read_cpuid(ID_AA64MMFR0_EL1);
@@ -186,6 +203,8 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
186 info->reg_id_pfr1 = read_cpuid(ID_PFR1_EL1); 203 info->reg_id_pfr1 = read_cpuid(ID_PFR1_EL1);
187 204
188 cpuinfo_detect_icache_policy(info); 205 cpuinfo_detect_icache_policy(info);
206
207 check_local_cpu_errata();
189} 208}
190 209
191void cpuinfo_store_cpu(void) 210void cpuinfo_store_cpu(void)
diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S
index d18a44940968..8ce9b0577442 100644
--- a/arch/arm64/kernel/efi-entry.S
+++ b/arch/arm64/kernel/efi-entry.S
@@ -61,7 +61,8 @@ ENTRY(efi_stub_entry)
61 */ 61 */
62 mov x20, x0 // DTB address 62 mov x20, x0 // DTB address
63 ldr x0, [sp, #16] // relocated _text address 63 ldr x0, [sp, #16] // relocated _text address
64 mov x21, x0 64 ldr x21, =stext_offset
65 add x21, x0, x21
65 66
66 /* 67 /*
67 * Calculate size of the kernel Image (same for original and copy). 68 * Calculate size of the kernel Image (same for original and copy).
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 95c49ebc660d..6fac253bc783 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -11,6 +11,7 @@
11 * 11 *
12 */ 12 */
13 13
14#include <linux/dmi.h>
14#include <linux/efi.h> 15#include <linux/efi.h>
15#include <linux/export.h> 16#include <linux/export.h>
16#include <linux/memblock.h> 17#include <linux/memblock.h>
@@ -112,8 +113,6 @@ static int __init uefi_init(void)
112 efi.systab->hdr.revision & 0xffff, vendor); 113 efi.systab->hdr.revision & 0xffff, vendor);
113 114
114 retval = efi_config_init(NULL); 115 retval = efi_config_init(NULL);
115 if (retval == 0)
116 set_bit(EFI_CONFIG_TABLES, &efi.flags);
117 116
118out: 117out:
119 early_memunmap(efi.systab, sizeof(efi_system_table_t)); 118 early_memunmap(efi.systab, sizeof(efi_system_table_t));
@@ -125,17 +124,17 @@ out:
125 */ 124 */
126static __init int is_reserve_region(efi_memory_desc_t *md) 125static __init int is_reserve_region(efi_memory_desc_t *md)
127{ 126{
128 if (!is_normal_ram(md)) 127 switch (md->type) {
128 case EFI_LOADER_CODE:
129 case EFI_LOADER_DATA:
130 case EFI_BOOT_SERVICES_CODE:
131 case EFI_BOOT_SERVICES_DATA:
132 case EFI_CONVENTIONAL_MEMORY:
129 return 0; 133 return 0;
130 134 default:
131 if (md->attribute & EFI_MEMORY_RUNTIME) 135 break;
132 return 1; 136 }
133 137 return is_normal_ram(md);
134 if (md->type == EFI_ACPI_RECLAIM_MEMORY ||
135 md->type == EFI_RESERVED_TYPE)
136 return 1;
137
138 return 0;
139} 138}
140 139
141static __init void reserve_regions(void) 140static __init void reserve_regions(void)
@@ -471,3 +470,17 @@ err_unmap:
471 return -1; 470 return -1;
472} 471}
473early_initcall(arm64_enter_virtual_mode); 472early_initcall(arm64_enter_virtual_mode);
473
474static int __init arm64_dmi_init(void)
475{
476 /*
477 * On arm64, DMI depends on UEFI, and dmi_scan_machine() needs to
478 * be called early because dmi_id_init(), which is an arch_initcall
479 * itself, depends on dmi_scan_machine() having been called already.
480 */
481 dmi_scan_machine();
482 if (dmi_available)
483 dmi_set_dump_stack_arch_desc();
484 return 0;
485}
486core_initcall(arm64_dmi_init);
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index 38e704e597f7..08cafc518b9a 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -98,8 +98,8 @@
98ENTRY(_mcount) 98ENTRY(_mcount)
99 mcount_enter 99 mcount_enter
100 100
101 ldr x0, =ftrace_trace_function 101 adrp x0, ftrace_trace_function
102 ldr x2, [x0] 102 ldr x2, [x0, #:lo12:ftrace_trace_function]
103 adr x0, ftrace_stub 103 adr x0, ftrace_stub
104 cmp x0, x2 // if (ftrace_trace_function 104 cmp x0, x2 // if (ftrace_trace_function
105 b.eq skip_ftrace_call // != ftrace_stub) { 105 b.eq skip_ftrace_call // != ftrace_stub) {
@@ -115,14 +115,15 @@ skip_ftrace_call: // return;
115 mcount_exit // return; 115 mcount_exit // return;
116 // } 116 // }
117skip_ftrace_call: 117skip_ftrace_call:
118 ldr x1, =ftrace_graph_return 118 adrp x1, ftrace_graph_return
119 ldr x2, [x1] // if ((ftrace_graph_return 119 ldr x2, [x1, #:lo12:ftrace_graph_return]
120 cmp x0, x2 // != ftrace_stub) 120 cmp x0, x2 // if ((ftrace_graph_return
121 b.ne ftrace_graph_caller 121 b.ne ftrace_graph_caller // != ftrace_stub)
122 122
123 ldr x1, =ftrace_graph_entry // || (ftrace_graph_entry 123 adrp x1, ftrace_graph_entry // || (ftrace_graph_entry
124 ldr x2, [x1] // != ftrace_graph_entry_stub)) 124 adrp x0, ftrace_graph_entry_stub // != ftrace_graph_entry_stub))
125 ldr x0, =ftrace_graph_entry_stub 125 ldr x2, [x1, #:lo12:ftrace_graph_entry]
126 add x0, x0, #:lo12:ftrace_graph_entry_stub
126 cmp x0, x2 127 cmp x0, x2
127 b.ne ftrace_graph_caller // ftrace_graph_caller(); 128 b.ne ftrace_graph_caller // ftrace_graph_caller();
128 129
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 726b910fe6ec..fd4fa374e5d2 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -64,25 +64,26 @@
64#define BAD_ERROR 3 64#define BAD_ERROR 3
65 65
66 .macro kernel_entry, el, regsize = 64 66 .macro kernel_entry, el, regsize = 64
67 sub sp, sp, #S_FRAME_SIZE - S_LR // room for LR, SP, SPSR, ELR 67 sub sp, sp, #S_FRAME_SIZE
68 .if \regsize == 32 68 .if \regsize == 32
69 mov w0, w0 // zero upper 32 bits of x0 69 mov w0, w0 // zero upper 32 bits of x0
70 .endif 70 .endif
71 push x28, x29 71 stp x0, x1, [sp, #16 * 0]
72 push x26, x27 72 stp x2, x3, [sp, #16 * 1]
73 push x24, x25 73 stp x4, x5, [sp, #16 * 2]
74 push x22, x23 74 stp x6, x7, [sp, #16 * 3]
75 push x20, x21 75 stp x8, x9, [sp, #16 * 4]
76 push x18, x19 76 stp x10, x11, [sp, #16 * 5]
77 push x16, x17 77 stp x12, x13, [sp, #16 * 6]
78 push x14, x15 78 stp x14, x15, [sp, #16 * 7]
79 push x12, x13 79 stp x16, x17, [sp, #16 * 8]
80 push x10, x11 80 stp x18, x19, [sp, #16 * 9]
81 push x8, x9 81 stp x20, x21, [sp, #16 * 10]
82 push x6, x7 82 stp x22, x23, [sp, #16 * 11]
83 push x4, x5 83 stp x24, x25, [sp, #16 * 12]
84 push x2, x3 84 stp x26, x27, [sp, #16 * 13]
85 push x0, x1 85 stp x28, x29, [sp, #16 * 14]
86
86 .if \el == 0 87 .if \el == 0
87 mrs x21, sp_el0 88 mrs x21, sp_el0
88 get_thread_info tsk // Ensure MDSCR_EL1.SS is clear, 89 get_thread_info tsk // Ensure MDSCR_EL1.SS is clear,
@@ -118,33 +119,31 @@
118 .if \el == 0 119 .if \el == 0
119 ct_user_enter 120 ct_user_enter
120 ldr x23, [sp, #S_SP] // load return stack pointer 121 ldr x23, [sp, #S_SP] // load return stack pointer
122 msr sp_el0, x23
121 .endif 123 .endif
124 msr elr_el1, x21 // set up the return data
125 msr spsr_el1, x22
122 .if \ret 126 .if \ret
123 ldr x1, [sp, #S_X1] // preserve x0 (syscall return) 127 ldr x1, [sp, #S_X1] // preserve x0 (syscall return)
124 add sp, sp, S_X2
125 .else 128 .else
126 pop x0, x1 129 ldp x0, x1, [sp, #16 * 0]
127 .endif 130 .endif
128 pop x2, x3 // load the rest of the registers 131 ldp x2, x3, [sp, #16 * 1]
129 pop x4, x5 132 ldp x4, x5, [sp, #16 * 2]
130 pop x6, x7 133 ldp x6, x7, [sp, #16 * 3]
131 pop x8, x9 134 ldp x8, x9, [sp, #16 * 4]
132 msr elr_el1, x21 // set up the return data 135 ldp x10, x11, [sp, #16 * 5]
133 msr spsr_el1, x22 136 ldp x12, x13, [sp, #16 * 6]
134 .if \el == 0 137 ldp x14, x15, [sp, #16 * 7]
135 msr sp_el0, x23 138 ldp x16, x17, [sp, #16 * 8]
136 .endif 139 ldp x18, x19, [sp, #16 * 9]
137 pop x10, x11 140 ldp x20, x21, [sp, #16 * 10]
138 pop x12, x13 141 ldp x22, x23, [sp, #16 * 11]
139 pop x14, x15 142 ldp x24, x25, [sp, #16 * 12]
140 pop x16, x17 143 ldp x26, x27, [sp, #16 * 13]
141 pop x18, x19 144 ldp x28, x29, [sp, #16 * 14]
142 pop x20, x21 145 ldr lr, [sp, #S_LR]
143 pop x22, x23 146 add sp, sp, #S_FRAME_SIZE // restore sp
144 pop x24, x25
145 pop x26, x27
146 pop x28, x29
147 ldr lr, [sp], #S_FRAME_SIZE - S_LR // load LR and restore SP
148 eret // return to kernel 147 eret // return to kernel
149 .endm 148 .endm
150 149
@@ -168,7 +167,8 @@ tsk .req x28 // current thread_info
168 * Interrupt handling. 167 * Interrupt handling.
169 */ 168 */
170 .macro irq_handler 169 .macro irq_handler
171 ldr x1, handle_arch_irq 170 adrp x1, handle_arch_irq
171 ldr x1, [x1, #:lo12:handle_arch_irq]
172 mov x0, sp 172 mov x0, sp
173 blr x1 173 blr x1
174 .endm 174 .endm
@@ -455,8 +455,8 @@ el0_da:
455 bic x0, x26, #(0xff << 56) 455 bic x0, x26, #(0xff << 56)
456 mov x1, x25 456 mov x1, x25
457 mov x2, sp 457 mov x2, sp
458 adr lr, ret_to_user 458 bl do_mem_abort
459 b do_mem_abort 459 b ret_to_user
460el0_ia: 460el0_ia:
461 /* 461 /*
462 * Instruction abort handling 462 * Instruction abort handling
@@ -468,8 +468,8 @@ el0_ia:
468 mov x0, x26 468 mov x0, x26
469 orr x1, x25, #1 << 24 // use reserved ISS bit for instruction aborts 469 orr x1, x25, #1 << 24 // use reserved ISS bit for instruction aborts
470 mov x2, sp 470 mov x2, sp
471 adr lr, ret_to_user 471 bl do_mem_abort
472 b do_mem_abort 472 b ret_to_user
473el0_fpsimd_acc: 473el0_fpsimd_acc:
474 /* 474 /*
475 * Floating Point or Advanced SIMD access 475 * Floating Point or Advanced SIMD access
@@ -478,8 +478,8 @@ el0_fpsimd_acc:
478 ct_user_exit 478 ct_user_exit
479 mov x0, x25 479 mov x0, x25
480 mov x1, sp 480 mov x1, sp
481 adr lr, ret_to_user 481 bl do_fpsimd_acc
482 b do_fpsimd_acc 482 b ret_to_user
483el0_fpsimd_exc: 483el0_fpsimd_exc:
484 /* 484 /*
485 * Floating Point or Advanced SIMD exception 485 * Floating Point or Advanced SIMD exception
@@ -488,8 +488,8 @@ el0_fpsimd_exc:
488 ct_user_exit 488 ct_user_exit
489 mov x0, x25 489 mov x0, x25
490 mov x1, sp 490 mov x1, sp
491 adr lr, ret_to_user 491 bl do_fpsimd_exc
492 b do_fpsimd_exc 492 b ret_to_user
493el0_sp_pc: 493el0_sp_pc:
494 /* 494 /*
495 * Stack or PC alignment exception handling 495 * Stack or PC alignment exception handling
@@ -500,8 +500,8 @@ el0_sp_pc:
500 mov x0, x26 500 mov x0, x26
501 mov x1, x25 501 mov x1, x25
502 mov x2, sp 502 mov x2, sp
503 adr lr, ret_to_user 503 bl do_sp_pc_abort
504 b do_sp_pc_abort 504 b ret_to_user
505el0_undef: 505el0_undef:
506 /* 506 /*
507 * Undefined instruction 507 * Undefined instruction
@@ -510,8 +510,8 @@ el0_undef:
510 enable_dbg_and_irq 510 enable_dbg_and_irq
511 ct_user_exit 511 ct_user_exit
512 mov x0, sp 512 mov x0, sp
513 adr lr, ret_to_user 513 bl do_undefinstr
514 b do_undefinstr 514 b ret_to_user
515el0_dbg: 515el0_dbg:
516 /* 516 /*
517 * Debug exception handling 517 * Debug exception handling
@@ -530,8 +530,8 @@ el0_inv:
530 mov x0, sp 530 mov x0, sp
531 mov x1, #BAD_SYNC 531 mov x1, #BAD_SYNC
532 mrs x2, esr_el1 532 mrs x2, esr_el1
533 adr lr, ret_to_user 533 bl bad_mode
534 b bad_mode 534 b ret_to_user
535ENDPROC(el0_sync) 535ENDPROC(el0_sync)
536 536
537 .align 6 537 .align 6
@@ -653,14 +653,15 @@ el0_svc_naked: // compat entry point
653 ldr x16, [tsk, #TI_FLAGS] // check for syscall hooks 653 ldr x16, [tsk, #TI_FLAGS] // check for syscall hooks
654 tst x16, #_TIF_SYSCALL_WORK 654 tst x16, #_TIF_SYSCALL_WORK
655 b.ne __sys_trace 655 b.ne __sys_trace
656 adr lr, ret_fast_syscall // return address
657 cmp scno, sc_nr // check upper syscall limit 656 cmp scno, sc_nr // check upper syscall limit
658 b.hs ni_sys 657 b.hs ni_sys
659 ldr x16, [stbl, scno, lsl #3] // address in the syscall table 658 ldr x16, [stbl, scno, lsl #3] // address in the syscall table
660 br x16 // call sys_* routine 659 blr x16 // call sys_* routine
660 b ret_fast_syscall
661ni_sys: 661ni_sys:
662 mov x0, sp 662 mov x0, sp
663 b do_ni_syscall 663 bl do_ni_syscall
664 b ret_fast_syscall
664ENDPROC(el0_svc) 665ENDPROC(el0_svc)
665 666
666 /* 667 /*
@@ -668,26 +669,38 @@ ENDPROC(el0_svc)
668 * switches, and waiting for our parent to respond. 669 * switches, and waiting for our parent to respond.
669 */ 670 */
670__sys_trace: 671__sys_trace:
671 mov x0, sp 672 mov w0, #-1 // set default errno for
673 cmp scno, x0 // user-issued syscall(-1)
674 b.ne 1f
675 mov x0, #-ENOSYS
676 str x0, [sp, #S_X0]
6771: mov x0, sp
672 bl syscall_trace_enter 678 bl syscall_trace_enter
673 adr lr, __sys_trace_return // return address 679 cmp w0, #-1 // skip the syscall?
680 b.eq __sys_trace_return_skipped
674 uxtw scno, w0 // syscall number (possibly new) 681 uxtw scno, w0 // syscall number (possibly new)
675 mov x1, sp // pointer to regs 682 mov x1, sp // pointer to regs
676 cmp scno, sc_nr // check upper syscall limit 683 cmp scno, sc_nr // check upper syscall limit
677 b.hs ni_sys 684 b.hs __ni_sys_trace
678 ldp x0, x1, [sp] // restore the syscall args 685 ldp x0, x1, [sp] // restore the syscall args
679 ldp x2, x3, [sp, #S_X2] 686 ldp x2, x3, [sp, #S_X2]
680 ldp x4, x5, [sp, #S_X4] 687 ldp x4, x5, [sp, #S_X4]
681 ldp x6, x7, [sp, #S_X6] 688 ldp x6, x7, [sp, #S_X6]
682 ldr x16, [stbl, scno, lsl #3] // address in the syscall table 689 ldr x16, [stbl, scno, lsl #3] // address in the syscall table
683 br x16 // call sys_* routine 690 blr x16 // call sys_* routine
684 691
685__sys_trace_return: 692__sys_trace_return:
686 str x0, [sp] // save returned x0 693 str x0, [sp, #S_X0] // save returned x0
694__sys_trace_return_skipped:
687 mov x0, sp 695 mov x0, sp
688 bl syscall_trace_exit 696 bl syscall_trace_exit
689 b ret_to_user 697 b ret_to_user
690 698
699__ni_sys_trace:
700 mov x0, sp
701 bl do_ni_syscall
702 b __sys_trace_return
703
691/* 704/*
692 * Special system call wrappers. 705 * Special system call wrappers.
693 */ 706 */
@@ -695,6 +708,3 @@ ENTRY(sys_rt_sigreturn_wrapper)
695 mov x0, sp 708 mov x0, sp
696 b sys_rt_sigreturn 709 b sys_rt_sigreturn
697ENDPROC(sys_rt_sigreturn_wrapper) 710ENDPROC(sys_rt_sigreturn_wrapper)
698
699ENTRY(handle_arch_irq)
700 .quad 0
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 0a6e4f924df8..8ce88e08c030 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -132,6 +132,8 @@ efi_head:
132#endif 132#endif
133 133
134#ifdef CONFIG_EFI 134#ifdef CONFIG_EFI
135 .globl stext_offset
136 .set stext_offset, stext - efi_head
135 .align 3 137 .align 3
136pe_header: 138pe_header:
137 .ascii "PE" 139 .ascii "PE"
@@ -155,12 +157,12 @@ optional_header:
155 .long 0 // SizeOfInitializedData 157 .long 0 // SizeOfInitializedData
156 .long 0 // SizeOfUninitializedData 158 .long 0 // SizeOfUninitializedData
157 .long efi_stub_entry - efi_head // AddressOfEntryPoint 159 .long efi_stub_entry - efi_head // AddressOfEntryPoint
158 .long stext - efi_head // BaseOfCode 160 .long stext_offset // BaseOfCode
159 161
160extra_header_fields: 162extra_header_fields:
161 .quad 0 // ImageBase 163 .quad 0 // ImageBase
162 .long 0x20 // SectionAlignment 164 .long 0x1000 // SectionAlignment
163 .long 0x8 // FileAlignment 165 .long PECOFF_FILE_ALIGNMENT // FileAlignment
164 .short 0 // MajorOperatingSystemVersion 166 .short 0 // MajorOperatingSystemVersion
165 .short 0 // MinorOperatingSystemVersion 167 .short 0 // MinorOperatingSystemVersion
166 .short 0 // MajorImageVersion 168 .short 0 // MajorImageVersion
@@ -172,7 +174,7 @@ extra_header_fields:
172 .long _end - efi_head // SizeOfImage 174 .long _end - efi_head // SizeOfImage
173 175
174 // Everything before the kernel image is considered part of the header 176 // Everything before the kernel image is considered part of the header
175 .long stext - efi_head // SizeOfHeaders 177 .long stext_offset // SizeOfHeaders
176 .long 0 // CheckSum 178 .long 0 // CheckSum
177 .short 0xa // Subsystem (EFI application) 179 .short 0xa // Subsystem (EFI application)
178 .short 0 // DllCharacteristics 180 .short 0 // DllCharacteristics
@@ -217,16 +219,24 @@ section_table:
217 .byte 0 219 .byte 0
218 .byte 0 // end of 0 padding of section name 220 .byte 0 // end of 0 padding of section name
219 .long _end - stext // VirtualSize 221 .long _end - stext // VirtualSize
220 .long stext - efi_head // VirtualAddress 222 .long stext_offset // VirtualAddress
221 .long _edata - stext // SizeOfRawData 223 .long _edata - stext // SizeOfRawData
222 .long stext - efi_head // PointerToRawData 224 .long stext_offset // PointerToRawData
223 225
224 .long 0 // PointerToRelocations (0 for executables) 226 .long 0 // PointerToRelocations (0 for executables)
225 .long 0 // PointerToLineNumbers (0 for executables) 227 .long 0 // PointerToLineNumbers (0 for executables)
226 .short 0 // NumberOfRelocations (0 for executables) 228 .short 0 // NumberOfRelocations (0 for executables)
227 .short 0 // NumberOfLineNumbers (0 for executables) 229 .short 0 // NumberOfLineNumbers (0 for executables)
228 .long 0xe0500020 // Characteristics (section flags) 230 .long 0xe0500020 // Characteristics (section flags)
229 .align 5 231
232 /*
233 * EFI will load stext onwards at the 4k section alignment
234 * described in the PE/COFF header. To ensure that instruction
235 * sequences using an adrp and a :lo12: immediate will function
236 * correctly at this alignment, we must ensure that stext is
237 * placed at a 4k boundary in the Image to begin with.
238 */
239 .align 12
230#endif 240#endif
231 241
232ENTRY(stext) 242ENTRY(stext)
@@ -238,7 +248,13 @@ ENTRY(stext)
238 mov x0, x22 248 mov x0, x22
239 bl lookup_processor_type 249 bl lookup_processor_type
240 mov x23, x0 // x23=current cpu_table 250 mov x23, x0 // x23=current cpu_table
241 cbz x23, __error_p // invalid processor (x23=0)? 251 /*
252 * __error_p may end up out of range for cbz if text areas are
253 * aligned up to section sizes.
254 */
255 cbnz x23, 1f // invalid processor (x23=0)?
256 b __error_p
2571:
242 bl __vet_fdt 258 bl __vet_fdt
243 bl __create_page_tables // x25=TTBR0, x26=TTBR1 259 bl __create_page_tables // x25=TTBR0, x26=TTBR1
244 /* 260 /*
@@ -250,13 +266,214 @@ ENTRY(stext)
250 */ 266 */
251 ldr x27, __switch_data // address to jump to after 267 ldr x27, __switch_data // address to jump to after
252 // MMU has been enabled 268 // MMU has been enabled
253 adr lr, __enable_mmu // return (PIC) address 269 adrp lr, __enable_mmu // return (PIC) address
270 add lr, lr, #:lo12:__enable_mmu
254 ldr x12, [x23, #CPU_INFO_SETUP] 271 ldr x12, [x23, #CPU_INFO_SETUP]
255 add x12, x12, x28 // __virt_to_phys 272 add x12, x12, x28 // __virt_to_phys
256 br x12 // initialise processor 273 br x12 // initialise processor
257ENDPROC(stext) 274ENDPROC(stext)
258 275
259/* 276/*
277 * Determine validity of the x21 FDT pointer.
278 * The dtb must be 8-byte aligned and live in the first 512M of memory.
279 */
280__vet_fdt:
281 tst x21, #0x7
282 b.ne 1f
283 cmp x21, x24
284 b.lt 1f
285 mov x0, #(1 << 29)
286 add x0, x0, x24
287 cmp x21, x0
288 b.ge 1f
289 ret
2901:
291 mov x21, #0
292 ret
293ENDPROC(__vet_fdt)
294/*
295 * Macro to create a table entry to the next page.
296 *
297 * tbl: page table address
298 * virt: virtual address
299 * shift: #imm page table shift
300 * ptrs: #imm pointers per table page
301 *
302 * Preserves: virt
303 * Corrupts: tmp1, tmp2
304 * Returns: tbl -> next level table page address
305 */
306 .macro create_table_entry, tbl, virt, shift, ptrs, tmp1, tmp2
307 lsr \tmp1, \virt, #\shift
308 and \tmp1, \tmp1, #\ptrs - 1 // table index
309 add \tmp2, \tbl, #PAGE_SIZE
310 orr \tmp2, \tmp2, #PMD_TYPE_TABLE // address of next table and entry type
311 str \tmp2, [\tbl, \tmp1, lsl #3]
312 add \tbl, \tbl, #PAGE_SIZE // next level table page
313 .endm
314
315/*
316 * Macro to populate the PGD (and possibily PUD) for the corresponding
317 * block entry in the next level (tbl) for the given virtual address.
318 *
319 * Preserves: tbl, next, virt
320 * Corrupts: tmp1, tmp2
321 */
322 .macro create_pgd_entry, tbl, virt, tmp1, tmp2
323 create_table_entry \tbl, \virt, PGDIR_SHIFT, PTRS_PER_PGD, \tmp1, \tmp2
324#if SWAPPER_PGTABLE_LEVELS == 3
325 create_table_entry \tbl, \virt, TABLE_SHIFT, PTRS_PER_PTE, \tmp1, \tmp2
326#endif
327 .endm
328
329/*
330 * Macro to populate block entries in the page table for the start..end
331 * virtual range (inclusive).
332 *
333 * Preserves: tbl, flags
334 * Corrupts: phys, start, end, pstate
335 */
336 .macro create_block_map, tbl, flags, phys, start, end
337 lsr \phys, \phys, #BLOCK_SHIFT
338 lsr \start, \start, #BLOCK_SHIFT
339 and \start, \start, #PTRS_PER_PTE - 1 // table index
340 orr \phys, \flags, \phys, lsl #BLOCK_SHIFT // table entry
341 lsr \end, \end, #BLOCK_SHIFT
342 and \end, \end, #PTRS_PER_PTE - 1 // table end index
3439999: str \phys, [\tbl, \start, lsl #3] // store the entry
344 add \start, \start, #1 // next entry
345 add \phys, \phys, #BLOCK_SIZE // next block
346 cmp \start, \end
347 b.ls 9999b
348 .endm
349
350/*
351 * Setup the initial page tables. We only setup the barest amount which is
352 * required to get the kernel running. The following sections are required:
353 * - identity mapping to enable the MMU (low address, TTBR0)
354 * - first few MB of the kernel linear mapping to jump to once the MMU has
355 * been enabled, including the FDT blob (TTBR1)
356 * - pgd entry for fixed mappings (TTBR1)
357 */
358__create_page_tables:
359 pgtbl x25, x26, x28 // idmap_pg_dir and swapper_pg_dir addresses
360 mov x27, lr
361
362 /*
363 * Invalidate the idmap and swapper page tables to avoid potential
364 * dirty cache lines being evicted.
365 */
366 mov x0, x25
367 add x1, x26, #SWAPPER_DIR_SIZE
368 bl __inval_cache_range
369
370 /*
371 * Clear the idmap and swapper page tables.
372 */
373 mov x0, x25
374 add x6, x26, #SWAPPER_DIR_SIZE
3751: stp xzr, xzr, [x0], #16
376 stp xzr, xzr, [x0], #16
377 stp xzr, xzr, [x0], #16
378 stp xzr, xzr, [x0], #16
379 cmp x0, x6
380 b.lo 1b
381
382 ldr x7, =MM_MMUFLAGS
383
384 /*
385 * Create the identity mapping.
386 */
387 mov x0, x25 // idmap_pg_dir
388 ldr x3, =KERNEL_START
389 add x3, x3, x28 // __pa(KERNEL_START)
390 create_pgd_entry x0, x3, x5, x6
391 ldr x6, =KERNEL_END
392 mov x5, x3 // __pa(KERNEL_START)
393 add x6, x6, x28 // __pa(KERNEL_END)
394 create_block_map x0, x7, x3, x5, x6
395
396 /*
397 * Map the kernel image (starting with PHYS_OFFSET).
398 */
399 mov x0, x26 // swapper_pg_dir
400 mov x5, #PAGE_OFFSET
401 create_pgd_entry x0, x5, x3, x6
402 ldr x6, =KERNEL_END
403 mov x3, x24 // phys offset
404 create_block_map x0, x7, x3, x5, x6
405
406 /*
407 * Map the FDT blob (maximum 2MB; must be within 512MB of
408 * PHYS_OFFSET).
409 */
410 mov x3, x21 // FDT phys address
411 and x3, x3, #~((1 << 21) - 1) // 2MB aligned
412 mov x6, #PAGE_OFFSET
413 sub x5, x3, x24 // subtract PHYS_OFFSET
414 tst x5, #~((1 << 29) - 1) // within 512MB?
415 csel x21, xzr, x21, ne // zero the FDT pointer
416 b.ne 1f
417 add x5, x5, x6 // __va(FDT blob)
418 add x6, x5, #1 << 21 // 2MB for the FDT blob
419 sub x6, x6, #1 // inclusive range
420 create_block_map x0, x7, x3, x5, x6
4211:
422 /*
423 * Since the page tables have been populated with non-cacheable
424 * accesses (MMU disabled), invalidate the idmap and swapper page
425 * tables again to remove any speculatively loaded cache lines.
426 */
427 mov x0, x25
428 add x1, x26, #SWAPPER_DIR_SIZE
429 bl __inval_cache_range
430
431 mov lr, x27
432 ret
433ENDPROC(__create_page_tables)
434 .ltorg
435
436 .align 3
437 .type __switch_data, %object
438__switch_data:
439 .quad __mmap_switched
440 .quad __bss_start // x6
441 .quad __bss_stop // x7
442 .quad processor_id // x4
443 .quad __fdt_pointer // x5
444 .quad memstart_addr // x6
445 .quad init_thread_union + THREAD_START_SP // sp
446
447/*
448 * The following fragment of code is executed with the MMU on in MMU mode, and
449 * uses absolute addresses; this is not position independent.
450 */
451__mmap_switched:
452 adr x3, __switch_data + 8
453
454 ldp x6, x7, [x3], #16
4551: cmp x6, x7
456 b.hs 2f
457 str xzr, [x6], #8 // Clear BSS
458 b 1b
4592:
460 ldp x4, x5, [x3], #16
461 ldr x6, [x3], #8
462 ldr x16, [x3]
463 mov sp, x16
464 str x22, [x4] // Save processor ID
465 str x21, [x5] // Save FDT pointer
466 str x24, [x6] // Save PHYS_OFFSET
467 mov x29, #0
468 b start_kernel
469ENDPROC(__mmap_switched)
470
471/*
472 * end early head section, begin head code that is also used for
473 * hotplug and needs to have the same protections as the text region
474 */
475 .section ".text","ax"
476/*
260 * If we're fortunate enough to boot at EL2, ensure that the world is 477 * If we're fortunate enough to boot at EL2, ensure that the world is
261 * sane before dropping to EL1. 478 * sane before dropping to EL1.
262 * 479 *
@@ -331,7 +548,8 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems
331 msr vttbr_el2, xzr 548 msr vttbr_el2, xzr
332 549
333 /* Hypervisor stub */ 550 /* Hypervisor stub */
334 adr x0, __hyp_stub_vectors 551 adrp x0, __hyp_stub_vectors
552 add x0, x0, #:lo12:__hyp_stub_vectors
335 msr vbar_el2, x0 553 msr vbar_el2, x0
336 554
337 /* spsr */ 555 /* spsr */
@@ -492,183 +710,6 @@ ENDPROC(__calc_phys_offset)
492 .quad PAGE_OFFSET 710 .quad PAGE_OFFSET
493 711
494/* 712/*
495 * Macro to create a table entry to the next page.
496 *
497 * tbl: page table address
498 * virt: virtual address
499 * shift: #imm page table shift
500 * ptrs: #imm pointers per table page
501 *
502 * Preserves: virt
503 * Corrupts: tmp1, tmp2
504 * Returns: tbl -> next level table page address
505 */
506 .macro create_table_entry, tbl, virt, shift, ptrs, tmp1, tmp2
507 lsr \tmp1, \virt, #\shift
508 and \tmp1, \tmp1, #\ptrs - 1 // table index
509 add \tmp2, \tbl, #PAGE_SIZE
510 orr \tmp2, \tmp2, #PMD_TYPE_TABLE // address of next table and entry type
511 str \tmp2, [\tbl, \tmp1, lsl #3]
512 add \tbl, \tbl, #PAGE_SIZE // next level table page
513 .endm
514
515/*
516 * Macro to populate the PGD (and possibily PUD) for the corresponding
517 * block entry in the next level (tbl) for the given virtual address.
518 *
519 * Preserves: tbl, next, virt
520 * Corrupts: tmp1, tmp2
521 */
522 .macro create_pgd_entry, tbl, virt, tmp1, tmp2
523 create_table_entry \tbl, \virt, PGDIR_SHIFT, PTRS_PER_PGD, \tmp1, \tmp2
524#if SWAPPER_PGTABLE_LEVELS == 3
525 create_table_entry \tbl, \virt, TABLE_SHIFT, PTRS_PER_PTE, \tmp1, \tmp2
526#endif
527 .endm
528
529/*
530 * Macro to populate block entries in the page table for the start..end
531 * virtual range (inclusive).
532 *
533 * Preserves: tbl, flags
534 * Corrupts: phys, start, end, pstate
535 */
536 .macro create_block_map, tbl, flags, phys, start, end
537 lsr \phys, \phys, #BLOCK_SHIFT
538 lsr \start, \start, #BLOCK_SHIFT
539 and \start, \start, #PTRS_PER_PTE - 1 // table index
540 orr \phys, \flags, \phys, lsl #BLOCK_SHIFT // table entry
541 lsr \end, \end, #BLOCK_SHIFT
542 and \end, \end, #PTRS_PER_PTE - 1 // table end index
5439999: str \phys, [\tbl, \start, lsl #3] // store the entry
544 add \start, \start, #1 // next entry
545 add \phys, \phys, #BLOCK_SIZE // next block
546 cmp \start, \end
547 b.ls 9999b
548 .endm
549
550/*
551 * Setup the initial page tables. We only setup the barest amount which is
552 * required to get the kernel running. The following sections are required:
553 * - identity mapping to enable the MMU (low address, TTBR0)
554 * - first few MB of the kernel linear mapping to jump to once the MMU has
555 * been enabled, including the FDT blob (TTBR1)
556 * - pgd entry for fixed mappings (TTBR1)
557 */
558__create_page_tables:
559 pgtbl x25, x26, x28 // idmap_pg_dir and swapper_pg_dir addresses
560 mov x27, lr
561
562 /*
563 * Invalidate the idmap and swapper page tables to avoid potential
564 * dirty cache lines being evicted.
565 */
566 mov x0, x25
567 add x1, x26, #SWAPPER_DIR_SIZE
568 bl __inval_cache_range
569
570 /*
571 * Clear the idmap and swapper page tables.
572 */
573 mov x0, x25
574 add x6, x26, #SWAPPER_DIR_SIZE
5751: stp xzr, xzr, [x0], #16
576 stp xzr, xzr, [x0], #16
577 stp xzr, xzr, [x0], #16
578 stp xzr, xzr, [x0], #16
579 cmp x0, x6
580 b.lo 1b
581
582 ldr x7, =MM_MMUFLAGS
583
584 /*
585 * Create the identity mapping.
586 */
587 mov x0, x25 // idmap_pg_dir
588 ldr x3, =KERNEL_START
589 add x3, x3, x28 // __pa(KERNEL_START)
590 create_pgd_entry x0, x3, x5, x6
591 ldr x6, =KERNEL_END
592 mov x5, x3 // __pa(KERNEL_START)
593 add x6, x6, x28 // __pa(KERNEL_END)
594 create_block_map x0, x7, x3, x5, x6
595
596 /*
597 * Map the kernel image (starting with PHYS_OFFSET).
598 */
599 mov x0, x26 // swapper_pg_dir
600 mov x5, #PAGE_OFFSET
601 create_pgd_entry x0, x5, x3, x6
602 ldr x6, =KERNEL_END
603 mov x3, x24 // phys offset
604 create_block_map x0, x7, x3, x5, x6
605
606 /*
607 * Map the FDT blob (maximum 2MB; must be within 512MB of
608 * PHYS_OFFSET).
609 */
610 mov x3, x21 // FDT phys address
611 and x3, x3, #~((1 << 21) - 1) // 2MB aligned
612 mov x6, #PAGE_OFFSET
613 sub x5, x3, x24 // subtract PHYS_OFFSET
614 tst x5, #~((1 << 29) - 1) // within 512MB?
615 csel x21, xzr, x21, ne // zero the FDT pointer
616 b.ne 1f
617 add x5, x5, x6 // __va(FDT blob)
618 add x6, x5, #1 << 21 // 2MB for the FDT blob
619 sub x6, x6, #1 // inclusive range
620 create_block_map x0, x7, x3, x5, x6
6211:
622 /*
623 * Since the page tables have been populated with non-cacheable
624 * accesses (MMU disabled), invalidate the idmap and swapper page
625 * tables again to remove any speculatively loaded cache lines.
626 */
627 mov x0, x25
628 add x1, x26, #SWAPPER_DIR_SIZE
629 bl __inval_cache_range
630
631 mov lr, x27
632 ret
633ENDPROC(__create_page_tables)
634 .ltorg
635
636 .align 3
637 .type __switch_data, %object
638__switch_data:
639 .quad __mmap_switched
640 .quad __bss_start // x6
641 .quad __bss_stop // x7
642 .quad processor_id // x4
643 .quad __fdt_pointer // x5
644 .quad memstart_addr // x6
645 .quad init_thread_union + THREAD_START_SP // sp
646
647/*
648 * The following fragment of code is executed with the MMU on in MMU mode, and
649 * uses absolute addresses; this is not position independent.
650 */
651__mmap_switched:
652 adr x3, __switch_data + 8
653
654 ldp x6, x7, [x3], #16
6551: cmp x6, x7
656 b.hs 2f
657 str xzr, [x6], #8 // Clear BSS
658 b 1b
6592:
660 ldp x4, x5, [x3], #16
661 ldr x6, [x3], #8
662 ldr x16, [x3]
663 mov sp, x16
664 str x22, [x4] // Save processor ID
665 str x21, [x5] // Save FDT pointer
666 str x24, [x6] // Save PHYS_OFFSET
667 mov x29, #0
668 b start_kernel
669ENDPROC(__mmap_switched)
670
671/*
672 * Exception handling. Something went wrong and we can't proceed. We ought to 713 * Exception handling. Something went wrong and we can't proceed. We ought to
673 * tell the user, but since we don't have any guarantee that we're even 714 * tell the user, but since we don't have any guarantee that we're even
674 * running on the right architecture, we do virtually nothing. 715 * running on the right architecture, we do virtually nothing.
@@ -715,22 +756,3 @@ __lookup_processor_type_data:
715 .quad . 756 .quad .
716 .quad cpu_table 757 .quad cpu_table
717 .size __lookup_processor_type_data, . - __lookup_processor_type_data 758 .size __lookup_processor_type_data, . - __lookup_processor_type_data
718
719/*
720 * Determine validity of the x21 FDT pointer.
721 * The dtb must be 8-byte aligned and live in the first 512M of memory.
722 */
723__vet_fdt:
724 tst x21, #0x7
725 b.ne 1f
726 cmp x21, x24
727 b.lt 1f
728 mov x0, #(1 << 29)
729 add x0, x0, x24
730 cmp x21, x0
731 b.ge 1f
732 ret
7331:
734 mov x21, #0
735 ret
736ENDPROC(__vet_fdt)
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index 8cd27fedc8b6..7e9327a0986d 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -960,3 +960,29 @@ u32 aarch64_insn_gen_logical_shifted_reg(enum aarch64_insn_register dst,
960 960
961 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_6, insn, shift); 961 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_6, insn, shift);
962} 962}
963
964bool aarch32_insn_is_wide(u32 insn)
965{
966 return insn >= 0xe800;
967}
968
969/*
970 * Macros/defines for extracting register numbers from instruction.
971 */
972u32 aarch32_insn_extract_reg_num(u32 insn, int offset)
973{
974 return (insn & (0xf << offset)) >> offset;
975}
976
977#define OPC2_MASK 0x7
978#define OPC2_OFFSET 5
979u32 aarch32_insn_mcr_extract_opc2(u32 insn)
980{
981 return (insn & (OPC2_MASK << OPC2_OFFSET)) >> OPC2_OFFSET;
982}
983
984#define CRM_MASK 0xf
985u32 aarch32_insn_mcr_extract_crm(u32 insn)
986{
987 return insn & CRM_MASK;
988}
diff --git a/arch/arm64/kernel/io.c b/arch/arm64/kernel/io.c
index 7d37ead4d199..354be2a872ae 100644
--- a/arch/arm64/kernel/io.c
+++ b/arch/arm64/kernel/io.c
@@ -25,12 +25,26 @@
25 */ 25 */
26void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) 26void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
27{ 27{
28 unsigned char *t = to; 28 while (count && (!IS_ALIGNED((unsigned long)from, 8) ||
29 while (count) { 29 !IS_ALIGNED((unsigned long)to, 8))) {
30 *(u8 *)to = __raw_readb(from);
31 from++;
32 to++;
30 count--; 33 count--;
31 *t = readb(from); 34 }
32 t++; 35
36 while (count >= 8) {
37 *(u64 *)to = __raw_readq(from);
38 from += 8;
39 to += 8;
40 count -= 8;
41 }
42
43 while (count) {
44 *(u8 *)to = __raw_readb(from);
33 from++; 45 from++;
46 to++;
47 count--;
34 } 48 }
35} 49}
36EXPORT_SYMBOL(__memcpy_fromio); 50EXPORT_SYMBOL(__memcpy_fromio);
@@ -40,12 +54,26 @@ EXPORT_SYMBOL(__memcpy_fromio);
40 */ 54 */
41void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) 55void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
42{ 56{
43 const unsigned char *f = from; 57 while (count && (!IS_ALIGNED((unsigned long)to, 8) ||
44 while (count) { 58 !IS_ALIGNED((unsigned long)from, 8))) {
59 __raw_writeb(*(volatile u8 *)from, to);
60 from++;
61 to++;
45 count--; 62 count--;
46 writeb(*f, to); 63 }
47 f++; 64
65 while (count >= 8) {
66 __raw_writeq(*(volatile u64 *)from, to);
67 from += 8;
68 to += 8;
69 count -= 8;
70 }
71
72 while (count) {
73 __raw_writeb(*(volatile u8 *)from, to);
74 from++;
48 to++; 75 to++;
76 count--;
49 } 77 }
50} 78}
51EXPORT_SYMBOL(__memcpy_toio); 79EXPORT_SYMBOL(__memcpy_toio);
@@ -55,10 +83,28 @@ EXPORT_SYMBOL(__memcpy_toio);
55 */ 83 */
56void __memset_io(volatile void __iomem *dst, int c, size_t count) 84void __memset_io(volatile void __iomem *dst, int c, size_t count)
57{ 85{
58 while (count) { 86 u64 qc = (u8)c;
87
88 qc |= qc << 8;
89 qc |= qc << 16;
90 qc |= qc << 32;
91
92 while (count && !IS_ALIGNED((unsigned long)dst, 8)) {
93 __raw_writeb(c, dst);
94 dst++;
59 count--; 95 count--;
60 writeb(c, dst); 96 }
97
98 while (count >= 8) {
99 __raw_writeq(qc, dst);
100 dst += 8;
101 count -= 8;
102 }
103
104 while (count) {
105 __raw_writeb(c, dst);
61 dst++; 106 dst++;
107 count--;
62 } 108 }
63} 109}
64EXPORT_SYMBOL(__memset_io); 110EXPORT_SYMBOL(__memset_io);
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c
index 071a6ec13bd8..240b75c0e94f 100644
--- a/arch/arm64/kernel/irq.c
+++ b/arch/arm64/kernel/irq.c
@@ -40,6 +40,8 @@ int arch_show_interrupts(struct seq_file *p, int prec)
40 return 0; 40 return 0;
41} 41}
42 42
43void (*handle_arch_irq)(struct pt_regs *) = NULL;
44
43void __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) 45void __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
44{ 46{
45 if (handle_arch_irq) 47 if (handle_arch_irq)
diff --git a/arch/arm64/kernel/jump_label.c b/arch/arm64/kernel/jump_label.c
index 263a166291fb..4f1fec7a46db 100644
--- a/arch/arm64/kernel/jump_label.c
+++ b/arch/arm64/kernel/jump_label.c
@@ -22,9 +22,8 @@
22 22
23#ifdef HAVE_JUMP_LABEL 23#ifdef HAVE_JUMP_LABEL
24 24
25static void __arch_jump_label_transform(struct jump_entry *entry, 25void arch_jump_label_transform(struct jump_entry *entry,
26 enum jump_label_type type, 26 enum jump_label_type type)
27 bool is_static)
28{ 27{
29 void *addr = (void *)entry->code; 28 void *addr = (void *)entry->code;
30 u32 insn; 29 u32 insn;
@@ -37,22 +36,18 @@ static void __arch_jump_label_transform(struct jump_entry *entry,
37 insn = aarch64_insn_gen_nop(); 36 insn = aarch64_insn_gen_nop();
38 } 37 }
39 38
40 if (is_static) 39 aarch64_insn_patch_text(&addr, &insn, 1);
41 aarch64_insn_patch_text_nosync(addr, insn);
42 else
43 aarch64_insn_patch_text(&addr, &insn, 1);
44}
45
46void arch_jump_label_transform(struct jump_entry *entry,
47 enum jump_label_type type)
48{
49 __arch_jump_label_transform(entry, type, false);
50} 40}
51 41
52void arch_jump_label_transform_static(struct jump_entry *entry, 42void arch_jump_label_transform_static(struct jump_entry *entry,
53 enum jump_label_type type) 43 enum jump_label_type type)
54{ 44{
55 __arch_jump_label_transform(entry, type, true); 45 /*
46 * We use the architected A64 NOP in arch_static_branch, so there's no
47 * need to patch an identical A64 NOP over the top of it here. The core
48 * will call arch_jump_label_transform from a module notifier if the
49 * NOP needs to be replaced by a branch.
50 */
56} 51}
57 52
58#endif /* HAVE_JUMP_LABEL */ 53#endif /* HAVE_JUMP_LABEL */
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
index 1eb1cc955139..fd027b101de5 100644
--- a/arch/arm64/kernel/module.c
+++ b/arch/arm64/kernel/module.c
@@ -26,6 +26,7 @@
26#include <linux/moduleloader.h> 26#include <linux/moduleloader.h>
27#include <linux/vmalloc.h> 27#include <linux/vmalloc.h>
28#include <asm/insn.h> 28#include <asm/insn.h>
29#include <asm/sections.h>
29 30
30#define AARCH64_INSN_IMM_MOVNZ AARCH64_INSN_IMM_MAX 31#define AARCH64_INSN_IMM_MOVNZ AARCH64_INSN_IMM_MAX
31#define AARCH64_INSN_IMM_MOVK AARCH64_INSN_IMM_16 32#define AARCH64_INSN_IMM_MOVK AARCH64_INSN_IMM_16
@@ -394,3 +395,20 @@ overflow:
394 me->name, (int)ELF64_R_TYPE(rel[i].r_info), val); 395 me->name, (int)ELF64_R_TYPE(rel[i].r_info), val);
395 return -ENOEXEC; 396 return -ENOEXEC;
396} 397}
398
399int module_finalize(const Elf_Ehdr *hdr,
400 const Elf_Shdr *sechdrs,
401 struct module *me)
402{
403 const Elf_Shdr *s, *se;
404 const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
405
406 for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) {
407 if (strcmp(".altinstructions", secstrs + s->sh_name) == 0) {
408 apply_alternatives((void *)s->sh_addr, s->sh_size);
409 return 0;
410 }
411 }
412
413 return 0;
414}
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index aa29ecb4f800..25a5308744b1 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -169,8 +169,14 @@ armpmu_event_set_period(struct perf_event *event,
169 ret = 1; 169 ret = 1;
170 } 170 }
171 171
172 if (left > (s64)armpmu->max_period) 172 /*
173 left = armpmu->max_period; 173 * Limit the maximum period to prevent the counter value
174 * from overtaking the one we are about to program. In
175 * effect we are reducing max_period to account for
176 * interrupt latency (and we are being very conservative).
177 */
178 if (left > (armpmu->max_period >> 1))
179 left = armpmu->max_period >> 1;
174 180
175 local64_set(&hwc->prev_count, (u64)-left); 181 local64_set(&hwc->prev_count, (u64)-left);
176 182
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 8a4ae8e73213..d882b833dbdb 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -27,6 +27,7 @@
27#include <linux/smp.h> 27#include <linux/smp.h>
28#include <linux/ptrace.h> 28#include <linux/ptrace.h>
29#include <linux/user.h> 29#include <linux/user.h>
30#include <linux/seccomp.h>
30#include <linux/security.h> 31#include <linux/security.h>
31#include <linux/init.h> 32#include <linux/init.h>
32#include <linux/signal.h> 33#include <linux/signal.h>
@@ -551,6 +552,32 @@ static int tls_set(struct task_struct *target, const struct user_regset *regset,
551 return ret; 552 return ret;
552} 553}
553 554
555static int system_call_get(struct task_struct *target,
556 const struct user_regset *regset,
557 unsigned int pos, unsigned int count,
558 void *kbuf, void __user *ubuf)
559{
560 int syscallno = task_pt_regs(target)->syscallno;
561
562 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
563 &syscallno, 0, -1);
564}
565
566static int system_call_set(struct task_struct *target,
567 const struct user_regset *regset,
568 unsigned int pos, unsigned int count,
569 const void *kbuf, const void __user *ubuf)
570{
571 int syscallno, ret;
572
573 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &syscallno, 0, -1);
574 if (ret)
575 return ret;
576
577 task_pt_regs(target)->syscallno = syscallno;
578 return ret;
579}
580
554enum aarch64_regset { 581enum aarch64_regset {
555 REGSET_GPR, 582 REGSET_GPR,
556 REGSET_FPR, 583 REGSET_FPR,
@@ -559,6 +586,7 @@ enum aarch64_regset {
559 REGSET_HW_BREAK, 586 REGSET_HW_BREAK,
560 REGSET_HW_WATCH, 587 REGSET_HW_WATCH,
561#endif 588#endif
589 REGSET_SYSTEM_CALL,
562}; 590};
563 591
564static const struct user_regset aarch64_regsets[] = { 592static const struct user_regset aarch64_regsets[] = {
@@ -608,6 +636,14 @@ static const struct user_regset aarch64_regsets[] = {
608 .set = hw_break_set, 636 .set = hw_break_set,
609 }, 637 },
610#endif 638#endif
639 [REGSET_SYSTEM_CALL] = {
640 .core_note_type = NT_ARM_SYSTEM_CALL,
641 .n = 1,
642 .size = sizeof(int),
643 .align = sizeof(int),
644 .get = system_call_get,
645 .set = system_call_set,
646 },
611}; 647};
612 648
613static const struct user_regset_view user_aarch64_view = { 649static const struct user_regset_view user_aarch64_view = {
@@ -1114,6 +1150,10 @@ static void tracehook_report_syscall(struct pt_regs *regs,
1114 1150
1115asmlinkage int syscall_trace_enter(struct pt_regs *regs) 1151asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1116{ 1152{
1153 /* Do the secure computing check first; failures should be fast. */
1154 if (secure_computing() == -1)
1155 return -1;
1156
1117 if (test_thread_flag(TIF_SYSCALL_TRACE)) 1157 if (test_thread_flag(TIF_SYSCALL_TRACE))
1118 tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); 1158 tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
1119 1159
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 2437196cc5d4..b80991166754 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -43,12 +43,14 @@
43#include <linux/of_fdt.h> 43#include <linux/of_fdt.h>
44#include <linux/of_platform.h> 44#include <linux/of_platform.h>
45#include <linux/efi.h> 45#include <linux/efi.h>
46#include <linux/personality.h>
46 47
47#include <asm/fixmap.h> 48#include <asm/fixmap.h>
48#include <asm/cpu.h> 49#include <asm/cpu.h>
49#include <asm/cputype.h> 50#include <asm/cputype.h>
50#include <asm/elf.h> 51#include <asm/elf.h>
51#include <asm/cputable.h> 52#include <asm/cputable.h>
53#include <asm/cpufeature.h>
52#include <asm/cpu_ops.h> 54#include <asm/cpu_ops.h>
53#include <asm/sections.h> 55#include <asm/sections.h>
54#include <asm/setup.h> 56#include <asm/setup.h>
@@ -72,13 +74,15 @@ EXPORT_SYMBOL_GPL(elf_hwcap);
72 COMPAT_HWCAP_FAST_MULT|COMPAT_HWCAP_EDSP|\ 74 COMPAT_HWCAP_FAST_MULT|COMPAT_HWCAP_EDSP|\
73 COMPAT_HWCAP_TLS|COMPAT_HWCAP_VFP|\ 75 COMPAT_HWCAP_TLS|COMPAT_HWCAP_VFP|\
74 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\ 76 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\
75 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV) 77 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV|\
78 COMPAT_HWCAP_LPAE)
76unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT; 79unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT;
77unsigned int compat_elf_hwcap2 __read_mostly; 80unsigned int compat_elf_hwcap2 __read_mostly;
78#endif 81#endif
79 82
83DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);
84
80static const char *cpu_name; 85static const char *cpu_name;
81static const char *machine_name;
82phys_addr_t __fdt_pointer __initdata; 86phys_addr_t __fdt_pointer __initdata;
83 87
84/* 88/*
@@ -116,12 +120,16 @@ void __init early_print(const char *str, ...)
116 120
117void __init smp_setup_processor_id(void) 121void __init smp_setup_processor_id(void)
118{ 122{
123 u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
124 cpu_logical_map(0) = mpidr;
125
119 /* 126 /*
120 * clear __my_cpu_offset on boot CPU to avoid hang caused by 127 * clear __my_cpu_offset on boot CPU to avoid hang caused by
121 * using percpu variable early, for example, lockdep will 128 * using percpu variable early, for example, lockdep will
122 * access percpu variable inside lock_release 129 * access percpu variable inside lock_release
123 */ 130 */
124 set_my_cpu_offset(0); 131 set_my_cpu_offset(0);
132 pr_info("Booting Linux on physical CPU 0x%lx\n", (unsigned long)mpidr);
125} 133}
126 134
127bool arch_match_cpu_phys_id(int cpu, u64 phys_id) 135bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
@@ -311,7 +319,7 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
311 cpu_relax(); 319 cpu_relax();
312 } 320 }
313 321
314 machine_name = of_flat_dt_get_machine_name(); 322 dump_stack_set_arch_desc("%s (DT)", of_flat_dt_get_machine_name());
315} 323}
316 324
317/* 325/*
@@ -376,6 +384,7 @@ void __init setup_arch(char **cmdline_p)
376 384
377 *cmdline_p = boot_command_line; 385 *cmdline_p = boot_command_line;
378 386
387 early_fixmap_init();
379 early_ioremap_init(); 388 early_ioremap_init();
380 389
381 parse_early_param(); 390 parse_early_param();
@@ -398,7 +407,6 @@ void __init setup_arch(char **cmdline_p)
398 407
399 psci_init(); 408 psci_init();
400 409
401 cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
402 cpu_read_bootcpu_ops(); 410 cpu_read_bootcpu_ops();
403#ifdef CONFIG_SMP 411#ifdef CONFIG_SMP
404 smp_init_cpus(); 412 smp_init_cpus();
@@ -447,14 +455,50 @@ static const char *hwcap_str[] = {
447 NULL 455 NULL
448}; 456};
449 457
458#ifdef CONFIG_COMPAT
459static const char *compat_hwcap_str[] = {
460 "swp",
461 "half",
462 "thumb",
463 "26bit",
464 "fastmult",
465 "fpa",
466 "vfp",
467 "edsp",
468 "java",
469 "iwmmxt",
470 "crunch",
471 "thumbee",
472 "neon",
473 "vfpv3",
474 "vfpv3d16",
475 "tls",
476 "vfpv4",
477 "idiva",
478 "idivt",
479 "vfpd32",
480 "lpae",
481 "evtstrm"
482};
483
484static const char *compat_hwcap2_str[] = {
485 "aes",
486 "pmull",
487 "sha1",
488 "sha2",
489 "crc32",
490 NULL
491};
492#endif /* CONFIG_COMPAT */
493
450static int c_show(struct seq_file *m, void *v) 494static int c_show(struct seq_file *m, void *v)
451{ 495{
452 int i; 496 int i, j;
453
454 seq_printf(m, "Processor\t: %s rev %d (%s)\n",
455 cpu_name, read_cpuid_id() & 15, ELF_PLATFORM);
456 497
457 for_each_online_cpu(i) { 498 for_each_online_cpu(i) {
499 struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
500 u32 midr = cpuinfo->reg_midr;
501
458 /* 502 /*
459 * glibc reads /proc/cpuinfo to determine the number of 503 * glibc reads /proc/cpuinfo to determine the number of
460 * online processors, looking for lines beginning with 504 * online processors, looking for lines beginning with
@@ -463,24 +507,38 @@ static int c_show(struct seq_file *m, void *v)
463#ifdef CONFIG_SMP 507#ifdef CONFIG_SMP
464 seq_printf(m, "processor\t: %d\n", i); 508 seq_printf(m, "processor\t: %d\n", i);
465#endif 509#endif
466 }
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 510
481 seq_puts(m, "\n"); 511 /*
482 512 * Dump out the common processor features in a single line.
483 seq_printf(m, "Hardware\t: %s\n", machine_name); 513 * Userspace should read the hwcaps with getauxval(AT_HWCAP)
514 * rather than attempting to parse this, but there's a body of
515 * software which does already (at least for 32-bit).
516 */
517 seq_puts(m, "Features\t:");
518 if (personality(current->personality) == PER_LINUX32) {
519#ifdef CONFIG_COMPAT
520 for (j = 0; compat_hwcap_str[j]; j++)
521 if (compat_elf_hwcap & (1 << j))
522 seq_printf(m, " %s", compat_hwcap_str[j]);
523
524 for (j = 0; compat_hwcap2_str[j]; j++)
525 if (compat_elf_hwcap2 & (1 << j))
526 seq_printf(m, " %s", compat_hwcap2_str[j]);
527#endif /* CONFIG_COMPAT */
528 } else {
529 for (j = 0; hwcap_str[j]; j++)
530 if (elf_hwcap & (1 << j))
531 seq_printf(m, " %s", hwcap_str[j]);
532 }
533 seq_puts(m, "\n");
534
535 seq_printf(m, "CPU implementer\t: 0x%02x\n",
536 MIDR_IMPLEMENTOR(midr));
537 seq_printf(m, "CPU architecture: 8\n");
538 seq_printf(m, "CPU variant\t: 0x%x\n", MIDR_VARIANT(midr));
539 seq_printf(m, "CPU part\t: 0x%03x\n", MIDR_PARTNUM(midr));
540 seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
541 }
484 542
485 return 0; 543 return 0;
486} 544}
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index 1b9ad02837cf..5a1ba6e80d4e 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -186,6 +186,12 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
186 err |= __put_user(from->si_uid, &to->si_uid); 186 err |= __put_user(from->si_uid, &to->si_uid);
187 err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr); 187 err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr);
188 break; 188 break;
189 case __SI_SYS:
190 err |= __put_user((compat_uptr_t)(unsigned long)
191 from->si_call_addr, &to->si_call_addr);
192 err |= __put_user(from->si_syscall, &to->si_syscall);
193 err |= __put_user(from->si_arch, &to->si_arch);
194 break;
189 default: /* this is just in case for now ... */ 195 default: /* this is just in case for now ... */
190 err |= __put_user(from->si_pid, &to->si_pid); 196 err |= __put_user(from->si_pid, &to->si_pid);
191 err |= __put_user(from->si_uid, &to->si_uid); 197 err |= __put_user(from->si_uid, &to->si_uid);
diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
index a564b440416a..ede186cdd452 100644
--- a/arch/arm64/kernel/sleep.S
+++ b/arch/arm64/kernel/sleep.S
@@ -147,14 +147,12 @@ cpu_resume_after_mmu:
147 ret 147 ret
148ENDPROC(cpu_resume_after_mmu) 148ENDPROC(cpu_resume_after_mmu)
149 149
150 .data
151ENTRY(cpu_resume) 150ENTRY(cpu_resume)
152 bl el2_setup // if in EL2 drop to EL1 cleanly 151 bl el2_setup // if in EL2 drop to EL1 cleanly
153#ifdef CONFIG_SMP 152#ifdef CONFIG_SMP
154 mrs x1, mpidr_el1 153 mrs x1, mpidr_el1
155 adr x4, mpidr_hash_ptr 154 adrp x8, mpidr_hash
156 ldr x5, [x4] 155 add x8, x8, #:lo12:mpidr_hash // x8 = struct mpidr_hash phys address
157 add x8, x4, x5 // x8 = struct mpidr_hash phys address
158 /* retrieve mpidr_hash members to compute the hash */ 156 /* retrieve mpidr_hash members to compute the hash */
159 ldr x2, [x8, #MPIDR_HASH_MASK] 157 ldr x2, [x8, #MPIDR_HASH_MASK]
160 ldp w3, w4, [x8, #MPIDR_HASH_SHIFTS] 158 ldp w3, w4, [x8, #MPIDR_HASH_SHIFTS]
@@ -164,14 +162,15 @@ ENTRY(cpu_resume)
164#else 162#else
165 mov x7, xzr 163 mov x7, xzr
166#endif 164#endif
167 adr x0, sleep_save_sp 165 adrp x0, sleep_save_sp
166 add x0, x0, #:lo12:sleep_save_sp
168 ldr x0, [x0, #SLEEP_SAVE_SP_PHYS] 167 ldr x0, [x0, #SLEEP_SAVE_SP_PHYS]
169 ldr x0, [x0, x7, lsl #3] 168 ldr x0, [x0, x7, lsl #3]
170 /* load sp from context */ 169 /* load sp from context */
171 ldr x2, [x0, #CPU_CTX_SP] 170 ldr x2, [x0, #CPU_CTX_SP]
172 adr x1, sleep_idmap_phys 171 adrp x1, sleep_idmap_phys
173 /* load physical address of identity map page table in x1 */ 172 /* load physical address of identity map page table in x1 */
174 ldr x1, [x1] 173 ldr x1, [x1, #:lo12:sleep_idmap_phys]
175 mov sp, x2 174 mov sp, x2
176 /* 175 /*
177 * cpu_do_resume expects x0 to contain context physical address 176 * cpu_do_resume expects x0 to contain context physical address
@@ -180,26 +179,3 @@ ENTRY(cpu_resume)
180 bl cpu_do_resume // PC relative jump, MMU off 179 bl cpu_do_resume // PC relative jump, MMU off
181 b cpu_resume_mmu // Resume MMU, never returns 180 b cpu_resume_mmu // Resume MMU, never returns
182ENDPROC(cpu_resume) 181ENDPROC(cpu_resume)
183
184 .align 3
185mpidr_hash_ptr:
186 /*
187 * offset of mpidr_hash symbol from current location
188 * used to obtain run-time mpidr_hash address with MMU off
189 */
190 .quad mpidr_hash - .
191/*
192 * physical address of identity mapped page tables
193 */
194 .type sleep_idmap_phys, #object
195ENTRY(sleep_idmap_phys)
196 .quad 0
197/*
198 * struct sleep_save_sp {
199 * phys_addr_t *save_ptr_stash;
200 * phys_addr_t save_ptr_stash_phys;
201 * };
202 */
203 .type sleep_save_sp, #object
204ENTRY(sleep_save_sp)
205 .space SLEEP_SAVE_SP_SZ // struct sleep_save_sp
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index b06d1d90ee8c..7ae6ee085261 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -37,6 +37,7 @@
37#include <linux/of.h> 37#include <linux/of.h>
38#include <linux/irq_work.h> 38#include <linux/irq_work.h>
39 39
40#include <asm/alternative.h>
40#include <asm/atomic.h> 41#include <asm/atomic.h>
41#include <asm/cacheflush.h> 42#include <asm/cacheflush.h>
42#include <asm/cpu.h> 43#include <asm/cpu.h>
@@ -309,6 +310,7 @@ void cpu_die(void)
309void __init smp_cpus_done(unsigned int max_cpus) 310void __init smp_cpus_done(unsigned int max_cpus)
310{ 311{
311 pr_info("SMP: Total of %d processors activated.\n", num_online_cpus()); 312 pr_info("SMP: Total of %d processors activated.\n", num_online_cpus());
313 apply_alternatives_all();
312} 314}
313 315
314void __init smp_prepare_boot_cpu(void) 316void __init smp_prepare_boot_cpu(void)
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index 13ad4dbb1615..3771b72b6569 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -126,8 +126,8 @@ int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
126 return ret; 126 return ret;
127} 127}
128 128
129extern struct sleep_save_sp sleep_save_sp; 129struct sleep_save_sp sleep_save_sp;
130extern phys_addr_t sleep_idmap_phys; 130phys_addr_t sleep_idmap_phys;
131 131
132static int __init cpu_suspend_init(void) 132static int __init cpu_suspend_init(void)
133{ 133{
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c
index dc47e53e9e28..28c511b06edf 100644
--- a/arch/arm64/kernel/sys_compat.c
+++ b/arch/arm64/kernel/sys_compat.c
@@ -28,29 +28,39 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/unistd.h> 29#include <asm/unistd.h>
30 30
31static inline void 31static long
32do_compat_cache_op(unsigned long start, unsigned long end, int flags) 32__do_compat_cache_op(unsigned long start, unsigned long end)
33{ 33{
34 struct mm_struct *mm = current->active_mm; 34 long ret;
35 struct vm_area_struct *vma;
36 35
37 if (end < start || flags) 36 do {
38 return; 37 unsigned long chunk = min(PAGE_SIZE, end - start);
39 38
40 down_read(&mm->mmap_sem); 39 if (fatal_signal_pending(current))
41 vma = find_vma(mm, start); 40 return 0;
42 if (vma && vma->vm_start < end) { 41
43 if (start < vma->vm_start) 42 ret = __flush_cache_user_range(start, start + chunk);
44 start = vma->vm_start; 43 if (ret)
45 if (end > vma->vm_end) 44 return ret;
46 end = vma->vm_end; 45
47 up_read(&mm->mmap_sem); 46 cond_resched();
48 __flush_cache_user_range(start & PAGE_MASK, PAGE_ALIGN(end)); 47 start += chunk;
49 return; 48 } while (start < end);
50 } 49
51 up_read(&mm->mmap_sem); 50 return 0;
52} 51}
53 52
53static inline long
54do_compat_cache_op(unsigned long start, unsigned long end, int flags)
55{
56 if (end < start || flags)
57 return -EINVAL;
58
59 if (!access_ok(VERIFY_READ, start, end - start))
60 return -EFAULT;
61
62 return __do_compat_cache_op(start, end);
63}
54/* 64/*
55 * Handle all unrecognised system calls. 65 * Handle all unrecognised system calls.
56 */ 66 */
@@ -74,8 +84,7 @@ long compat_arm_syscall(struct pt_regs *regs)
74 * the specified region). 84 * the specified region).
75 */ 85 */
76 case __ARM_NR_compat_cacheflush: 86 case __ARM_NR_compat_cacheflush:
77 do_compat_cache_op(regs->regs[0], regs->regs[1], regs->regs[2]); 87 return do_compat_cache_op(regs->regs[0], regs->regs[1], regs->regs[2]);
78 return 0;
79 88
80 case __ARM_NR_compat_set_tls: 89 case __ARM_NR_compat_set_tls:
81 current->thread.tp_value = regs->regs[0]; 90 current->thread.tp_value = regs->regs[0];
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index b6ee26b0939a..fcb8f7b42271 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -255,12 +255,15 @@ void store_cpu_topology(unsigned int cpuid)
255 /* Multiprocessor system : Multi-threads per core */ 255 /* Multiprocessor system : Multi-threads per core */
256 cpuid_topo->thread_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); 256 cpuid_topo->thread_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
257 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 1); 257 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 1);
258 cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 2); 258 cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 2) |
259 MPIDR_AFFINITY_LEVEL(mpidr, 3) << 8;
259 } else { 260 } else {
260 /* Multiprocessor system : Single-thread per core */ 261 /* Multiprocessor system : Single-thread per core */
261 cpuid_topo->thread_id = -1; 262 cpuid_topo->thread_id = -1;
262 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); 263 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
263 cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 1); 264 cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL(mpidr, 1) |
265 MPIDR_AFFINITY_LEVEL(mpidr, 2) << 8 |
266 MPIDR_AFFINITY_LEVEL(mpidr, 3) << 16;
264 } 267 }
265 268
266 pr_debug("CPU%u: cluster %d core %d thread %d mpidr %#016llx\n", 269 pr_debug("CPU%u: cluster %d core %d thread %d mpidr %#016llx\n",
diff --git a/arch/arm64/kernel/trace-events-emulation.h b/arch/arm64/kernel/trace-events-emulation.h
new file mode 100644
index 000000000000..ae1dd598ea65
--- /dev/null
+++ b/arch/arm64/kernel/trace-events-emulation.h
@@ -0,0 +1,35 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM emulation
3
4#if !defined(_TRACE_EMULATION_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_EMULATION_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT(instruction_emulation,
10
11 TP_PROTO(const char *instr, u64 addr),
12 TP_ARGS(instr, addr),
13
14 TP_STRUCT__entry(
15 __string(instr, instr)
16 __field(u64, addr)
17 ),
18
19 TP_fast_assign(
20 __assign_str(instr, instr);
21 __entry->addr = addr;
22 ),
23
24 TP_printk("instr=\"%s\" addr=0x%llx", __get_str(instr), __entry->addr)
25);
26
27#endif /* _TRACE_EMULATION_H */
28
29/* This part must be outside protection */
30#undef TRACE_INCLUDE_PATH
31#undef TRACE_INCLUDE_FILE
32#define TRACE_INCLUDE_PATH .
33
34#define TRACE_INCLUDE_FILE trace-events-emulation
35#include <trace/define_trace.h>
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index de1b085e7963..0a801e3743d5 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -259,6 +259,69 @@ void arm64_notify_die(const char *str, struct pt_regs *regs,
259 } 259 }
260} 260}
261 261
262static LIST_HEAD(undef_hook);
263static DEFINE_RAW_SPINLOCK(undef_lock);
264
265void register_undef_hook(struct undef_hook *hook)
266{
267 unsigned long flags;
268
269 raw_spin_lock_irqsave(&undef_lock, flags);
270 list_add(&hook->node, &undef_hook);
271 raw_spin_unlock_irqrestore(&undef_lock, flags);
272}
273
274void unregister_undef_hook(struct undef_hook *hook)
275{
276 unsigned long flags;
277
278 raw_spin_lock_irqsave(&undef_lock, flags);
279 list_del(&hook->node);
280 raw_spin_unlock_irqrestore(&undef_lock, flags);
281}
282
283static int call_undef_hook(struct pt_regs *regs)
284{
285 struct undef_hook *hook;
286 unsigned long flags;
287 u32 instr;
288 int (*fn)(struct pt_regs *regs, u32 instr) = NULL;
289 void __user *pc = (void __user *)instruction_pointer(regs);
290
291 if (!user_mode(regs))
292 return 1;
293
294 if (compat_thumb_mode(regs)) {
295 /* 16-bit Thumb instruction */
296 if (get_user(instr, (u16 __user *)pc))
297 goto exit;
298 instr = le16_to_cpu(instr);
299 if (aarch32_insn_is_wide(instr)) {
300 u32 instr2;
301
302 if (get_user(instr2, (u16 __user *)(pc + 2)))
303 goto exit;
304 instr2 = le16_to_cpu(instr2);
305 instr = (instr << 16) | instr2;
306 }
307 } else {
308 /* 32-bit ARM instruction */
309 if (get_user(instr, (u32 __user *)pc))
310 goto exit;
311 instr = le32_to_cpu(instr);
312 }
313
314 raw_spin_lock_irqsave(&undef_lock, flags);
315 list_for_each_entry(hook, &undef_hook, node)
316 if ((instr & hook->instr_mask) == hook->instr_val &&
317 (regs->pstate & hook->pstate_mask) == hook->pstate_val)
318 fn = hook->fn;
319
320 raw_spin_unlock_irqrestore(&undef_lock, flags);
321exit:
322 return fn ? fn(regs, instr) : 1;
323}
324
262asmlinkage void __exception do_undefinstr(struct pt_regs *regs) 325asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
263{ 326{
264 siginfo_t info; 327 siginfo_t info;
@@ -268,6 +331,9 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
268 if (!aarch32_break_handler(regs)) 331 if (!aarch32_break_handler(regs))
269 return; 332 return;
270 333
334 if (call_undef_hook(regs) == 0)
335 return;
336
271 if (show_unhandled_signals && unhandled_signal(current, SIGILL) && 337 if (show_unhandled_signals && unhandled_signal(current, SIGILL) &&
272 printk_ratelimit()) { 338 printk_ratelimit()) {
273 pr_info("%s[%d]: undefined instruction: pc=%p\n", 339 pr_info("%s[%d]: undefined instruction: pc=%p\n",
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index edf8715ba39b..9965ec87cbec 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -11,8 +11,9 @@
11 11
12#include "image.h" 12#include "image.h"
13 13
14#define ARM_EXIT_KEEP(x) 14/* .exit.text needed in case of alternative patching */
15#define ARM_EXIT_DISCARD(x) x 15#define ARM_EXIT_KEEP(x) x
16#define ARM_EXIT_DISCARD(x)
16 17
17OUTPUT_ARCH(aarch64) 18OUTPUT_ARCH(aarch64)
18ENTRY(_text) 19ENTRY(_text)
@@ -32,6 +33,22 @@ jiffies = jiffies_64;
32 *(.hyp.text) \ 33 *(.hyp.text) \
33 VMLINUX_SYMBOL(__hyp_text_end) = .; 34 VMLINUX_SYMBOL(__hyp_text_end) = .;
34 35
36/*
37 * The size of the PE/COFF section that covers the kernel image, which
38 * runs from stext to _edata, must be a round multiple of the PE/COFF
39 * FileAlignment, which we set to its minimum value of 0x200. 'stext'
40 * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned
41 * boundary should be sufficient.
42 */
43PECOFF_FILE_ALIGNMENT = 0x200;
44
45#ifdef CONFIG_EFI
46#define PECOFF_EDATA_PADDING \
47 .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
48#else
49#define PECOFF_EDATA_PADDING
50#endif
51
35SECTIONS 52SECTIONS
36{ 53{
37 /* 54 /*
@@ -100,9 +117,21 @@ SECTIONS
100 . = ALIGN(PAGE_SIZE); 117 . = ALIGN(PAGE_SIZE);
101 __init_end = .; 118 __init_end = .;
102 119
120 . = ALIGN(4);
121 .altinstructions : {
122 __alt_instructions = .;
123 *(.altinstructions)
124 __alt_instructions_end = .;
125 }
126 .altinstr_replacement : {
127 *(.altinstr_replacement)
128 }
129
130 . = ALIGN(PAGE_SIZE);
103 _data = .; 131 _data = .;
104 _sdata = .; 132 _sdata = .;
105 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE) 133 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
134 PECOFF_EDATA_PADDING
106 _edata = .; 135 _edata = .;
107 136
108 BSS_SECTION(0, 0, 0) 137 BSS_SECTION(0, 0, 0)
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
index b72aa9f9215c..fbe909fb0a1a 100644
--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -761,10 +761,10 @@
761.macro activate_traps 761.macro activate_traps
762 ldr x2, [x0, #VCPU_HCR_EL2] 762 ldr x2, [x0, #VCPU_HCR_EL2]
763 msr hcr_el2, x2 763 msr hcr_el2, x2
764 ldr x2, =(CPTR_EL2_TTA) 764 mov x2, #CPTR_EL2_TTA
765 msr cptr_el2, x2 765 msr cptr_el2, x2
766 766
767 ldr x2, =(1 << 15) // Trap CP15 Cr=15 767 mov x2, #(1 << 15) // Trap CP15 Cr=15
768 msr hstr_el2, x2 768 msr hstr_el2, x2
769 769
770 mrs x2, mdcr_el2 770 mrs x2, mdcr_el2
diff --git a/arch/arm64/mm/Makefile b/arch/arm64/mm/Makefile
index c56179ed2c09..773d37a14039 100644
--- a/arch/arm64/mm/Makefile
+++ b/arch/arm64/mm/Makefile
@@ -3,3 +3,4 @@ obj-y := dma-mapping.o extable.o fault.o init.o \
3 ioremap.o mmap.o pgd.o mmu.o \ 3 ioremap.o mmap.o pgd.o mmu.o \
4 context.o proc.o pageattr.o 4 context.o proc.o pageattr.o
5obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 5obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
6obj-$(CONFIG_ARM64_PTDUMP) += dump.o
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index 23663837acff..2560e1e1562e 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -17,9 +17,12 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/errno.h>
20#include <linux/linkage.h> 21#include <linux/linkage.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <asm/assembler.h> 23#include <asm/assembler.h>
24#include <asm/cpufeature.h>
25#include <asm/alternative-asm.h>
23 26
24#include "proc-macros.S" 27#include "proc-macros.S"
25 28
@@ -138,9 +141,12 @@ USER(9f, ic ivau, x4 ) // invalidate I line PoU
138 add x4, x4, x2 141 add x4, x4, x2
139 cmp x4, x1 142 cmp x4, x1
140 b.lo 1b 143 b.lo 1b
1419: // ignore any faulting cache operation
142 dsb ish 144 dsb ish
143 isb 145 isb
146 mov x0, #0
147 ret
1489:
149 mov x0, #-EFAULT
144 ret 150 ret
145ENDPROC(flush_icache_range) 151ENDPROC(flush_icache_range)
146ENDPROC(__flush_cache_user_range) 152ENDPROC(__flush_cache_user_range)
@@ -210,7 +216,7 @@ __dma_clean_range:
210 dcache_line_size x2, x3 216 dcache_line_size x2, x3
211 sub x3, x2, #1 217 sub x3, x2, #1
212 bic x0, x0, x3 218 bic x0, x0, x3
2131: dc cvac, x0 // clean D / U line 2191: alternative_insn "dc cvac, x0", "dc civac, x0", ARM64_WORKAROUND_CLEAN_CACHE
214 add x0, x0, x2 220 add x0, x0, x2
215 cmp x0, x1 221 cmp x0, x1
216 b.lo 1b 222 b.lo 1b
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
new file mode 100644
index 000000000000..bf69601be546
--- /dev/null
+++ b/arch/arm64/mm/dump.c
@@ -0,0 +1,332 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 * Debug helper to dump the current kernel pagetables of the system
4 * so that we can see what the various memory ranges are set to.
5 *
6 * Derived from x86 and arm implementation:
7 * (C) Copyright 2008 Intel Corporation
8 *
9 * Author: Arjan van de Ven <arjan@linux.intel.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; version 2
14 * of the License.
15 */
16#include <linux/debugfs.h>
17#include <linux/fs.h>
18#include <linux/mm.h>
19#include <linux/sched.h>
20#include <linux/seq_file.h>
21
22#include <asm/fixmap.h>
23#include <asm/pgtable.h>
24
25#define LOWEST_ADDR (UL(0xffffffffffffffff) << VA_BITS)
26
27struct addr_marker {
28 unsigned long start_address;
29 const char *name;
30};
31
32enum address_markers_idx {
33 VMALLOC_START_NR = 0,
34 VMALLOC_END_NR,
35#ifdef CONFIG_SPARSEMEM_VMEMMAP
36 VMEMMAP_START_NR,
37 VMEMMAP_END_NR,
38#endif
39 PCI_START_NR,
40 PCI_END_NR,
41 FIXADDR_START_NR,
42 FIXADDR_END_NR,
43 MODULES_START_NR,
44 MODUELS_END_NR,
45 KERNEL_SPACE_NR,
46};
47
48static struct addr_marker address_markers[] = {
49 { VMALLOC_START, "vmalloc() Area" },
50 { VMALLOC_END, "vmalloc() End" },
51#ifdef CONFIG_SPARSEMEM_VMEMMAP
52 { 0, "vmemmap start" },
53 { 0, "vmemmap end" },
54#endif
55 { (unsigned long) PCI_IOBASE, "PCI I/O start" },
56 { (unsigned long) PCI_IOBASE + SZ_16M, "PCI I/O end" },
57 { FIXADDR_START, "Fixmap start" },
58 { FIXADDR_TOP, "Fixmap end" },
59 { MODULES_VADDR, "Modules start" },
60 { MODULES_END, "Modules end" },
61 { PAGE_OFFSET, "Kernel Mapping" },
62 { -1, NULL },
63};
64
65struct pg_state {
66 struct seq_file *seq;
67 const struct addr_marker *marker;
68 unsigned long start_address;
69 unsigned level;
70 u64 current_prot;
71};
72
73struct prot_bits {
74 u64 mask;
75 u64 val;
76 const char *set;
77 const char *clear;
78};
79
80static const struct prot_bits pte_bits[] = {
81 {
82 .mask = PTE_USER,
83 .val = PTE_USER,
84 .set = "USR",
85 .clear = " ",
86 }, {
87 .mask = PTE_RDONLY,
88 .val = PTE_RDONLY,
89 .set = "ro",
90 .clear = "RW",
91 }, {
92 .mask = PTE_PXN,
93 .val = PTE_PXN,
94 .set = "NX",
95 .clear = "x ",
96 }, {
97 .mask = PTE_SHARED,
98 .val = PTE_SHARED,
99 .set = "SHD",
100 .clear = " ",
101 }, {
102 .mask = PTE_AF,
103 .val = PTE_AF,
104 .set = "AF",
105 .clear = " ",
106 }, {
107 .mask = PTE_NG,
108 .val = PTE_NG,
109 .set = "NG",
110 .clear = " ",
111 }, {
112 .mask = PTE_UXN,
113 .val = PTE_UXN,
114 .set = "UXN",
115 }, {
116 .mask = PTE_ATTRINDX_MASK,
117 .val = PTE_ATTRINDX(MT_DEVICE_nGnRnE),
118 .set = "DEVICE/nGnRnE",
119 }, {
120 .mask = PTE_ATTRINDX_MASK,
121 .val = PTE_ATTRINDX(MT_DEVICE_nGnRE),
122 .set = "DEVICE/nGnRE",
123 }, {
124 .mask = PTE_ATTRINDX_MASK,
125 .val = PTE_ATTRINDX(MT_DEVICE_GRE),
126 .set = "DEVICE/GRE",
127 }, {
128 .mask = PTE_ATTRINDX_MASK,
129 .val = PTE_ATTRINDX(MT_NORMAL_NC),
130 .set = "MEM/NORMAL-NC",
131 }, {
132 .mask = PTE_ATTRINDX_MASK,
133 .val = PTE_ATTRINDX(MT_NORMAL),
134 .set = "MEM/NORMAL",
135 }
136};
137
138struct pg_level {
139 const struct prot_bits *bits;
140 size_t num;
141 u64 mask;
142};
143
144static struct pg_level pg_level[] = {
145 {
146 }, { /* pgd */
147 .bits = pte_bits,
148 .num = ARRAY_SIZE(pte_bits),
149 }, { /* pud */
150 .bits = pte_bits,
151 .num = ARRAY_SIZE(pte_bits),
152 }, { /* pmd */
153 .bits = pte_bits,
154 .num = ARRAY_SIZE(pte_bits),
155 }, { /* pte */
156 .bits = pte_bits,
157 .num = ARRAY_SIZE(pte_bits),
158 },
159};
160
161static void dump_prot(struct pg_state *st, const struct prot_bits *bits,
162 size_t num)
163{
164 unsigned i;
165
166 for (i = 0; i < num; i++, bits++) {
167 const char *s;
168
169 if ((st->current_prot & bits->mask) == bits->val)
170 s = bits->set;
171 else
172 s = bits->clear;
173
174 if (s)
175 seq_printf(st->seq, " %s", s);
176 }
177}
178
179static void note_page(struct pg_state *st, unsigned long addr, unsigned level,
180 u64 val)
181{
182 static const char units[] = "KMGTPE";
183 u64 prot = val & pg_level[level].mask;
184
185 if (addr < LOWEST_ADDR)
186 return;
187
188 if (!st->level) {
189 st->level = level;
190 st->current_prot = prot;
191 st->start_address = addr;
192 seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
193 } else if (prot != st->current_prot || level != st->level ||
194 addr >= st->marker[1].start_address) {
195 const char *unit = units;
196 unsigned long delta;
197
198 if (st->current_prot) {
199 seq_printf(st->seq, "0x%16lx-0x%16lx ",
200 st->start_address, addr);
201
202 delta = (addr - st->start_address) >> 10;
203 while (!(delta & 1023) && unit[1]) {
204 delta >>= 10;
205 unit++;
206 }
207 seq_printf(st->seq, "%9lu%c", delta, *unit);
208 if (pg_level[st->level].bits)
209 dump_prot(st, pg_level[st->level].bits,
210 pg_level[st->level].num);
211 seq_puts(st->seq, "\n");
212 }
213
214 if (addr >= st->marker[1].start_address) {
215 st->marker++;
216 seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
217 }
218
219 st->start_address = addr;
220 st->current_prot = prot;
221 st->level = level;
222 }
223
224 if (addr >= st->marker[1].start_address) {
225 st->marker++;
226 seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
227 }
228
229}
230
231static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start)
232{
233 pte_t *pte = pte_offset_kernel(pmd, 0);
234 unsigned long addr;
235 unsigned i;
236
237 for (i = 0; i < PTRS_PER_PTE; i++, pte++) {
238 addr = start + i * PAGE_SIZE;
239 note_page(st, addr, 4, pte_val(*pte));
240 }
241}
242
243static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
244{
245 pmd_t *pmd = pmd_offset(pud, 0);
246 unsigned long addr;
247 unsigned i;
248
249 for (i = 0; i < PTRS_PER_PMD; i++, pmd++) {
250 addr = start + i * PMD_SIZE;
251 if (pmd_none(*pmd) || pmd_sect(*pmd) || pmd_bad(*pmd))
252 note_page(st, addr, 3, pmd_val(*pmd));
253 else
254 walk_pte(st, pmd, addr);
255 }
256}
257
258static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start)
259{
260 pud_t *pud = pud_offset(pgd, 0);
261 unsigned long addr;
262 unsigned i;
263
264 for (i = 0; i < PTRS_PER_PUD; i++, pud++) {
265 addr = start + i * PUD_SIZE;
266 if (pud_none(*pud) || pud_sect(*pud) || pud_bad(*pud))
267 note_page(st, addr, 2, pud_val(*pud));
268 else
269 walk_pmd(st, pud, addr);
270 }
271}
272
273static void walk_pgd(struct pg_state *st, struct mm_struct *mm, unsigned long start)
274{
275 pgd_t *pgd = pgd_offset(mm, 0);
276 unsigned i;
277 unsigned long addr;
278
279 for (i = 0; i < PTRS_PER_PGD; i++, pgd++) {
280 addr = start + i * PGDIR_SIZE;
281 if (pgd_none(*pgd) || pgd_bad(*pgd))
282 note_page(st, addr, 1, pgd_val(*pgd));
283 else
284 walk_pud(st, pgd, addr);
285 }
286}
287
288static int ptdump_show(struct seq_file *m, void *v)
289{
290 struct pg_state st = {
291 .seq = m,
292 .marker = address_markers,
293 };
294
295 walk_pgd(&st, &init_mm, LOWEST_ADDR);
296
297 note_page(&st, 0, 0, 0);
298 return 0;
299}
300
301static int ptdump_open(struct inode *inode, struct file *file)
302{
303 return single_open(file, ptdump_show, NULL);
304}
305
306static const struct file_operations ptdump_fops = {
307 .open = ptdump_open,
308 .read = seq_read,
309 .llseek = seq_lseek,
310 .release = single_release,
311};
312
313static int ptdump_init(void)
314{
315 struct dentry *pe;
316 unsigned i, j;
317
318 for (i = 0; i < ARRAY_SIZE(pg_level); i++)
319 if (pg_level[i].bits)
320 for (j = 0; j < pg_level[i].num; j++)
321 pg_level[i].mask |= pg_level[i].bits[j].mask;
322
323 address_markers[VMEMMAP_START_NR].start_address =
324 (unsigned long)virt_to_page(PAGE_OFFSET);
325 address_markers[VMEMMAP_END_NR].start_address =
326 (unsigned long)virt_to_page(high_memory);
327
328 pe = debugfs_create_file("kernel_page_tables", 0400, NULL, NULL,
329 &ptdump_fops);
330 return pe ? 0 : -ENOMEM;
331}
332device_initcall(ptdump_init);
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 41cb6d3d6075..c11cd27ca8f5 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -380,7 +380,7 @@ static struct fault_info {
380 { do_bad, SIGBUS, 0, "level 1 address size fault" }, 380 { do_bad, SIGBUS, 0, "level 1 address size fault" },
381 { do_bad, SIGBUS, 0, "level 2 address size fault" }, 381 { do_bad, SIGBUS, 0, "level 2 address size fault" },
382 { do_bad, SIGBUS, 0, "level 3 address size fault" }, 382 { do_bad, SIGBUS, 0, "level 3 address size fault" },
383 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "input address range fault" }, 383 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 0 translation fault" },
384 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 1 translation fault" }, 384 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 1 translation fault" },
385 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" }, 385 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" },
386 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" }, 386 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" },
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 494297c698ca..bac492c12fcc 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -39,6 +39,7 @@
39#include <asm/setup.h> 39#include <asm/setup.h>
40#include <asm/sizes.h> 40#include <asm/sizes.h>
41#include <asm/tlb.h> 41#include <asm/tlb.h>
42#include <asm/alternative.h>
42 43
43#include "mm.h" 44#include "mm.h"
44 45
@@ -325,6 +326,7 @@ void __init mem_init(void)
325void free_initmem(void) 326void free_initmem(void)
326{ 327{
327 free_initmem_default(0); 328 free_initmem_default(0);
329 free_alternatives_memory();
328} 330}
329 331
330#ifdef CONFIG_BLK_DEV_INITRD 332#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index 4a07630a6616..cbb99c8f1e04 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -103,97 +103,10 @@ void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
103} 103}
104EXPORT_SYMBOL(ioremap_cache); 104EXPORT_SYMBOL(ioremap_cache);
105 105
106static pte_t bm_pte[PTRS_PER_PTE] __page_aligned_bss; 106/*
107#if CONFIG_ARM64_PGTABLE_LEVELS > 2 107 * Must be called after early_fixmap_init
108static pmd_t bm_pmd[PTRS_PER_PMD] __page_aligned_bss; 108 */
109#endif
110#if CONFIG_ARM64_PGTABLE_LEVELS > 3
111static pud_t bm_pud[PTRS_PER_PUD] __page_aligned_bss;
112#endif
113
114static inline pud_t * __init early_ioremap_pud(unsigned long addr)
115{
116 pgd_t *pgd;
117
118 pgd = pgd_offset_k(addr);
119 BUG_ON(pgd_none(*pgd) || pgd_bad(*pgd));
120
121 return pud_offset(pgd, addr);
122}
123
124static inline pmd_t * __init early_ioremap_pmd(unsigned long addr)
125{
126 pud_t *pud = early_ioremap_pud(addr);
127
128 BUG_ON(pud_none(*pud) || pud_bad(*pud));
129
130 return pmd_offset(pud, addr);
131}
132
133static inline pte_t * __init early_ioremap_pte(unsigned long addr)
134{
135 pmd_t *pmd = early_ioremap_pmd(addr);
136
137 BUG_ON(pmd_none(*pmd) || pmd_bad(*pmd));
138
139 return pte_offset_kernel(pmd, addr);
140}
141
142void __init early_ioremap_init(void) 109void __init early_ioremap_init(void)
143{ 110{
144 pgd_t *pgd;
145 pud_t *pud;
146 pmd_t *pmd;
147 unsigned long addr = fix_to_virt(FIX_BTMAP_BEGIN);
148
149 pgd = pgd_offset_k(addr);
150 pgd_populate(&init_mm, pgd, bm_pud);
151 pud = pud_offset(pgd, addr);
152 pud_populate(&init_mm, pud, bm_pmd);
153 pmd = pmd_offset(pud, addr);
154 pmd_populate_kernel(&init_mm, pmd, bm_pte);
155
156 /*
157 * The boot-ioremap range spans multiple pmds, for which
158 * we are not prepared:
159 */
160 BUILD_BUG_ON((__fix_to_virt(FIX_BTMAP_BEGIN) >> PMD_SHIFT)
161 != (__fix_to_virt(FIX_BTMAP_END) >> PMD_SHIFT));
162
163 if (pmd != early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END))) {
164 WARN_ON(1);
165 pr_warn("pmd %p != %p\n",
166 pmd, early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END)));
167 pr_warn("fix_to_virt(FIX_BTMAP_BEGIN): %08lx\n",
168 fix_to_virt(FIX_BTMAP_BEGIN));
169 pr_warn("fix_to_virt(FIX_BTMAP_END): %08lx\n",
170 fix_to_virt(FIX_BTMAP_END));
171
172 pr_warn("FIX_BTMAP_END: %d\n", FIX_BTMAP_END);
173 pr_warn("FIX_BTMAP_BEGIN: %d\n",
174 FIX_BTMAP_BEGIN);
175 }
176
177 early_ioremap_setup(); 111 early_ioremap_setup();
178} 112}
179
180void __init __early_set_fixmap(enum fixed_addresses idx,
181 phys_addr_t phys, pgprot_t flags)
182{
183 unsigned long addr = __fix_to_virt(idx);
184 pte_t *pte;
185
186 if (idx >= __end_of_fixed_addresses) {
187 BUG();
188 return;
189 }
190
191 pte = early_ioremap_pte(addr);
192
193 if (pgprot_val(flags))
194 set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
195 else {
196 pte_clear(&init_mm, addr, pte);
197 flush_tlb_kernel_range(addr, addr+PAGE_SIZE);
198 }
199}
diff --git a/arch/arm64/mm/mm.h b/arch/arm64/mm/mm.h
index d519f4f50c8c..50c3351df9c7 100644
--- a/arch/arm64/mm/mm.h
+++ b/arch/arm64/mm/mm.h
@@ -1,2 +1 @@
1extern void __init bootmem_init(void); extern void __init bootmem_init(void);
2extern void __init arm64_swiotlb_init(void);
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 1d73662f00ff..54922d1275b8 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -47,22 +47,14 @@ static int mmap_is_legacy(void)
47 return sysctl_legacy_va_layout; 47 return sysctl_legacy_va_layout;
48} 48}
49 49
50/*
51 * Since get_random_int() returns the same value within a 1 jiffy window, we
52 * will almost always get the same randomisation for the stack and mmap
53 * region. This will mean the relative distance between stack and mmap will be
54 * the same.
55 *
56 * To avoid this we can shift the randomness by 1 bit.
57 */
58static unsigned long mmap_rnd(void) 50static unsigned long mmap_rnd(void)
59{ 51{
60 unsigned long rnd = 0; 52 unsigned long rnd = 0;
61 53
62 if (current->flags & PF_RANDOMIZE) 54 if (current->flags & PF_RANDOMIZE)
63 rnd = (long)get_random_int() & (STACK_RND_MASK >> 1); 55 rnd = (long)get_random_int() & STACK_RND_MASK;
64 56
65 return rnd << (PAGE_SHIFT + 1); 57 return rnd << PAGE_SHIFT;
66} 58}
67 59
68static unsigned long mmap_base(void) 60static unsigned long mmap_base(void)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index f4f8b500f74c..6032f3e3056a 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -28,6 +28,7 @@
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <asm/cputype.h> 30#include <asm/cputype.h>
31#include <asm/fixmap.h>
31#include <asm/sections.h> 32#include <asm/sections.h>
32#include <asm/setup.h> 33#include <asm/setup.h>
33#include <asm/sizes.h> 34#include <asm/sizes.h>
@@ -463,3 +464,96 @@ void vmemmap_free(unsigned long start, unsigned long end)
463{ 464{
464} 465}
465#endif /* CONFIG_SPARSEMEM_VMEMMAP */ 466#endif /* CONFIG_SPARSEMEM_VMEMMAP */
467
468static pte_t bm_pte[PTRS_PER_PTE] __page_aligned_bss;
469#if CONFIG_ARM64_PGTABLE_LEVELS > 2
470static pmd_t bm_pmd[PTRS_PER_PMD] __page_aligned_bss;
471#endif
472#if CONFIG_ARM64_PGTABLE_LEVELS > 3
473static pud_t bm_pud[PTRS_PER_PUD] __page_aligned_bss;
474#endif
475
476static inline pud_t * fixmap_pud(unsigned long addr)
477{
478 pgd_t *pgd = pgd_offset_k(addr);
479
480 BUG_ON(pgd_none(*pgd) || pgd_bad(*pgd));
481
482 return pud_offset(pgd, addr);
483}
484
485static inline pmd_t * fixmap_pmd(unsigned long addr)
486{
487 pud_t *pud = fixmap_pud(addr);
488
489 BUG_ON(pud_none(*pud) || pud_bad(*pud));
490
491 return pmd_offset(pud, addr);
492}
493
494static inline pte_t * fixmap_pte(unsigned long addr)
495{
496 pmd_t *pmd = fixmap_pmd(addr);
497
498 BUG_ON(pmd_none(*pmd) || pmd_bad(*pmd));
499
500 return pte_offset_kernel(pmd, addr);
501}
502
503void __init early_fixmap_init(void)
504{
505 pgd_t *pgd;
506 pud_t *pud;
507 pmd_t *pmd;
508 unsigned long addr = FIXADDR_START;
509
510 pgd = pgd_offset_k(addr);
511 pgd_populate(&init_mm, pgd, bm_pud);
512 pud = pud_offset(pgd, addr);
513 pud_populate(&init_mm, pud, bm_pmd);
514 pmd = pmd_offset(pud, addr);
515 pmd_populate_kernel(&init_mm, pmd, bm_pte);
516
517 /*
518 * The boot-ioremap range spans multiple pmds, for which
519 * we are not preparted:
520 */
521 BUILD_BUG_ON((__fix_to_virt(FIX_BTMAP_BEGIN) >> PMD_SHIFT)
522 != (__fix_to_virt(FIX_BTMAP_END) >> PMD_SHIFT));
523
524 if ((pmd != fixmap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)))
525 || pmd != fixmap_pmd(fix_to_virt(FIX_BTMAP_END))) {
526 WARN_ON(1);
527 pr_warn("pmd %p != %p, %p\n",
528 pmd, fixmap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)),
529 fixmap_pmd(fix_to_virt(FIX_BTMAP_END)));
530 pr_warn("fix_to_virt(FIX_BTMAP_BEGIN): %08lx\n",
531 fix_to_virt(FIX_BTMAP_BEGIN));
532 pr_warn("fix_to_virt(FIX_BTMAP_END): %08lx\n",
533 fix_to_virt(FIX_BTMAP_END));
534
535 pr_warn("FIX_BTMAP_END: %d\n", FIX_BTMAP_END);
536 pr_warn("FIX_BTMAP_BEGIN: %d\n", FIX_BTMAP_BEGIN);
537 }
538}
539
540void __set_fixmap(enum fixed_addresses idx,
541 phys_addr_t phys, pgprot_t flags)
542{
543 unsigned long addr = __fix_to_virt(idx);
544 pte_t *pte;
545
546 if (idx >= __end_of_fixed_addresses) {
547 BUG();
548 return;
549 }
550
551 pte = fixmap_pte(addr);
552
553 if (pgprot_val(flags)) {
554 set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
555 } else {
556 pte_clear(&init_mm, addr, pte);
557 flush_tlb_kernel_range(addr, addr+PAGE_SIZE);
558 }
559}
diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
index 6682b361d3ac..71ca104f97bd 100644
--- a/arch/arm64/mm/pgd.c
+++ b/arch/arm64/mm/pgd.c
@@ -35,9 +35,9 @@ static struct kmem_cache *pgd_cache;
35pgd_t *pgd_alloc(struct mm_struct *mm) 35pgd_t *pgd_alloc(struct mm_struct *mm)
36{ 36{
37 if (PGD_SIZE == PAGE_SIZE) 37 if (PGD_SIZE == PAGE_SIZE)
38 return (pgd_t *)get_zeroed_page(GFP_KERNEL); 38 return (pgd_t *)__get_free_page(PGALLOC_GFP);
39 else 39 else
40 return kmem_cache_zalloc(pgd_cache, GFP_KERNEL); 40 return kmem_cache_alloc(pgd_cache, PGALLOC_GFP);
41} 41}
42 42
43void pgd_free(struct mm_struct *mm, pgd_t *pgd) 43void pgd_free(struct mm_struct *mm, pgd_t *pgd)
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 41f1e3e2ea24..edba042b2325 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -60,7 +60,7 @@ struct jit_ctx {
60 const struct bpf_prog *prog; 60 const struct bpf_prog *prog;
61 int idx; 61 int idx;
62 int tmp_used; 62 int tmp_used;
63 int body_offset; 63 int epilogue_offset;
64 int *offset; 64 int *offset;
65 u32 *image; 65 u32 *image;
66}; 66};
@@ -130,8 +130,8 @@ static void jit_fill_hole(void *area, unsigned int size)
130 130
131static inline int epilogue_offset(const struct jit_ctx *ctx) 131static inline int epilogue_offset(const struct jit_ctx *ctx)
132{ 132{
133 int to = ctx->offset[ctx->prog->len - 1]; 133 int to = ctx->epilogue_offset;
134 int from = ctx->idx - ctx->body_offset; 134 int from = ctx->idx;
135 135
136 return to - from; 136 return to - from;
137} 137}
@@ -463,6 +463,8 @@ emit_cond_jmp:
463 } 463 }
464 /* function return */ 464 /* function return */
465 case BPF_JMP | BPF_EXIT: 465 case BPF_JMP | BPF_EXIT:
466 /* Optimization: when last instruction is EXIT,
467 simply fallthrough to epilogue. */
466 if (i == ctx->prog->len - 1) 468 if (i == ctx->prog->len - 1)
467 break; 469 break;
468 jmp_offset = epilogue_offset(ctx); 470 jmp_offset = epilogue_offset(ctx);
@@ -685,11 +687,13 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
685 687
686 /* 1. Initial fake pass to compute ctx->idx. */ 688 /* 1. Initial fake pass to compute ctx->idx. */
687 689
688 /* Fake pass to fill in ctx->offset. */ 690 /* Fake pass to fill in ctx->offset and ctx->tmp_used. */
689 if (build_body(&ctx)) 691 if (build_body(&ctx))
690 goto out; 692 goto out;
691 693
692 build_prologue(&ctx); 694 build_prologue(&ctx);
695
696 ctx.epilogue_offset = ctx.idx;
693 build_epilogue(&ctx); 697 build_epilogue(&ctx);
694 698
695 /* Now we know the actual image size. */ 699 /* Now we know the actual image size. */
@@ -706,7 +710,6 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
706 710
707 build_prologue(&ctx); 711 build_prologue(&ctx);
708 712
709 ctx.body_offset = ctx.idx;
710 if (build_body(&ctx)) { 713 if (build_body(&ctx)) {
711 bpf_jit_binary_free(header); 714 bpf_jit_binary_free(header);
712 goto out; 715 goto out;
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 37b75602adf6..cc92cdb9994c 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -17,7 +17,7 @@
17#include <linux/spi/spi.h> 17#include <linux/spi/spi.h>
18#include <linux/usb/atmel_usba_udc.h> 18#include <linux/usb/atmel_usba_udc.h>
19 19
20#include <mach/atmel-mci.h> 20#include <linux/platform_data/mmc-atmel-mci.h>
21#include <linux/atmel-mci.h> 21#include <linux/atmel-mci.h>
22 22
23#include <asm/io.h> 23#include <asm/io.h>
diff --git a/arch/avr32/mach-at32ap/include/mach/atmel-mci.h b/arch/avr32/mach-at32ap/include/mach/atmel-mci.h
deleted file mode 100644
index 11d7f4b28dc8..000000000000
--- a/arch/avr32/mach-at32ap/include/mach/atmel-mci.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __MACH_ATMEL_MCI_H
2#define __MACH_ATMEL_MCI_H
3
4#include <linux/platform_data/dma-dw.h>
5
6/**
7 * struct mci_dma_data - DMA data for MCI interface
8 */
9struct mci_dma_data {
10 struct dw_dma_slave sdata;
11};
12
13/* accessor macros */
14#define slave_data_ptr(s) (&(s)->sdata)
15#define find_slave_dev(s) ((s)->sdata.dma_dev)
16
17#endif /* __MACH_ATMEL_MCI_H */
diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h
index e59dba12ce94..752a3f45df60 100644
--- a/arch/cris/include/asm/io.h
+++ b/arch/cris/include/asm/io.h
@@ -112,6 +112,9 @@ static inline void writel(unsigned int b, volatile void __iomem *addr)
112 else 112 else
113 *(volatile unsigned int __force *) addr = b; 113 *(volatile unsigned int __force *) addr = b;
114} 114}
115#define writeb_relaxed(b, addr) writeb(b, addr)
116#define writew_relaxed(b, addr) writew(b, addr)
117#define writel_relaxed(b, addr) writel(b, addr)
115#define __raw_writeb writeb 118#define __raw_writeb writeb
116#define __raw_writew writew 119#define __raw_writew writew
117#define __raw_writel writel 120#define __raw_writel writel
diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h
index 8cb50a2fbcb2..99bb7efaf9b7 100644
--- a/arch/frv/include/asm/io.h
+++ b/arch/frv/include/asm/io.h
@@ -243,6 +243,9 @@ static inline void writel(uint32_t datum, volatile void __iomem *addr)
243 __flush_PCI_writes(); 243 __flush_PCI_writes();
244} 244}
245 245
246#define writeb_relaxed writeb
247#define writew_relaxed writew
248#define writel_relaxed writel
246 249
247/* Values for nocacheflag and cmode */ 250/* Values for nocacheflag and cmode */
248#define IOMAP_FULL_CACHING 0 251#define IOMAP_FULL_CACHING 0
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index c84c88bbbbd7..536d13b0bea6 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -11,7 +11,6 @@ config IA64
11 select PCI if (!IA64_HP_SIM) 11 select PCI if (!IA64_HP_SIM)
12 select ACPI if (!IA64_HP_SIM) 12 select ACPI if (!IA64_HP_SIM)
13 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI 13 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
14 select PM if (!IA64_HP_SIM)
15 select HAVE_UNSTABLE_SCHED_CLOCK 14 select HAVE_UNSTABLE_SCHED_CLOCK
16 select HAVE_IDE 15 select HAVE_IDE
17 select HAVE_OPROFILE 16 select HAVE_OPROFILE
@@ -233,6 +232,7 @@ config IA64_SGI_UV
233config IA64_HP_SIM 232config IA64_HP_SIM
234 bool "Ski-simulator" 233 bool "Ski-simulator"
235 select SWIOTLB 234 select SWIOTLB
235 depends on !PM_RUNTIME
236 236
237endchoice 237endchoice
238 238
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index bee0acd52f7e..80a7e34be009 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -393,6 +393,10 @@ __writeq (unsigned long val, volatile void __iomem *addr)
393#define writew(v,a) __writew((v), (a)) 393#define writew(v,a) __writew((v), (a))
394#define writel(v,a) __writel((v), (a)) 394#define writel(v,a) __writel((v), (a))
395#define writeq(v,a) __writeq((v), (a)) 395#define writeq(v,a) __writeq((v), (a))
396#define writeb_relaxed(v,a) __writeb((v), (a))
397#define writew_relaxed(v,a) __writew((v), (a))
398#define writel_relaxed(v,a) __writel((v), (a))
399#define writeq_relaxed(v,a) __writeq((v), (a))
396#define __raw_writeb writeb 400#define __raw_writeb writeb
397#define __raw_writew writew 401#define __raw_writew writew
398#define __raw_writel writel 402#define __raw_writel writel
diff --git a/arch/ia64/include/asm/uaccess.h b/arch/ia64/include/asm/uaccess.h
index 449c8c0fa2bd..103bedc59644 100644
--- a/arch/ia64/include/asm/uaccess.h
+++ b/arch/ia64/include/asm/uaccess.h
@@ -365,15 +365,15 @@ ia64_done_with_exception (struct pt_regs *regs)
365} 365}
366 366
367#define ARCH_HAS_TRANSLATE_MEM_PTR 1 367#define ARCH_HAS_TRANSLATE_MEM_PTR 1
368static __inline__ char * 368static __inline__ void *
369xlate_dev_mem_ptr (unsigned long p) 369xlate_dev_mem_ptr(phys_addr_t p)
370{ 370{
371 struct page *page; 371 struct page *page;
372 char * ptr; 372 void *ptr;
373 373
374 page = pfn_to_page(p >> PAGE_SHIFT); 374 page = pfn_to_page(p >> PAGE_SHIFT);
375 if (PageUncached(page)) 375 if (PageUncached(page))
376 ptr = (char *)p + __IA64_UNCACHED_OFFSET; 376 ptr = (void *)p + __IA64_UNCACHED_OFFSET;
377 else 377 else
378 ptr = __va(p); 378 ptr = __va(p);
379 379
@@ -383,15 +383,15 @@ xlate_dev_mem_ptr (unsigned long p)
383/* 383/*
384 * Convert a virtual cached kernel memory pointer to an uncached pointer 384 * Convert a virtual cached kernel memory pointer to an uncached pointer
385 */ 385 */
386static __inline__ char * 386static __inline__ void *
387xlate_dev_kmem_ptr (char * p) 387xlate_dev_kmem_ptr(void *p)
388{ 388{
389 struct page *page; 389 struct page *page;
390 char * ptr; 390 void *ptr;
391 391
392 page = virt_to_page((unsigned long)p); 392 page = virt_to_page((unsigned long)p);
393 if (PageUncached(page)) 393 if (PageUncached(page))
394 ptr = (char *)__pa(p) + __IA64_UNCACHED_OFFSET; 394 ptr = (void *)__pa(p) + __IA64_UNCACHED_OFFSET;
395 else 395 else
396 ptr = p; 396 ptr = p;
397 397
diff --git a/arch/ia64/include/uapi/asm/siginfo.h b/arch/ia64/include/uapi/asm/siginfo.h
index 4ea6225196bb..bce9bc1a66c4 100644
--- a/arch/ia64/include/uapi/asm/siginfo.h
+++ b/arch/ia64/include/uapi/asm/siginfo.h
@@ -63,6 +63,10 @@ typedef struct siginfo {
63 unsigned int _flags; /* see below */ 63 unsigned int _flags; /* see below */
64 unsigned long _isr; /* isr */ 64 unsigned long _isr; /* isr */
65 short _addr_lsb; /* lsb of faulting address */ 65 short _addr_lsb; /* lsb of faulting address */
66 struct {
67 void __user *_lower;
68 void __user *_upper;
69 } _addr_bnd;
66 } _sigfault; 70 } _sigfault;
67 71
68 /* SIGPOLL */ 72 /* SIGPOLL */
@@ -110,9 +114,9 @@ typedef struct siginfo {
110/* 114/*
111 * SIGSEGV si_codes 115 * SIGSEGV si_codes
112 */ 116 */
113#define __SEGV_PSTKOVF (__SI_FAULT|3) /* paragraph stack overflow */ 117#define __SEGV_PSTKOVF (__SI_FAULT|4) /* paragraph stack overflow */
114#undef NSIGSEGV 118#undef NSIGSEGV
115#define NSIGSEGV 3 119#define NSIGSEGV 4
116 120
117#undef NSIGTRAP 121#undef NSIGTRAP
118#define NSIGTRAP 4 122#define NSIGTRAP 4
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 8c3730c3c63d..8ae36ea177d3 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -35,7 +35,7 @@ static int ia64_set_msi_irq_affinity(struct irq_data *idata,
35 data |= MSI_DATA_VECTOR(irq_to_vector(irq)); 35 data |= MSI_DATA_VECTOR(irq_to_vector(irq));
36 msg.data = data; 36 msg.data = data;
37 37
38 write_msi_msg(irq, &msg); 38 pci_write_msi_msg(irq, &msg);
39 cpumask_copy(idata->affinity, cpumask_of(cpu)); 39 cpumask_copy(idata->affinity, cpumask_of(cpu));
40 40
41 return 0; 41 return 0;
@@ -71,7 +71,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
71 MSI_DATA_DELIVERY_FIXED | 71 MSI_DATA_DELIVERY_FIXED |
72 MSI_DATA_VECTOR(vector); 72 MSI_DATA_VECTOR(vector);
73 73
74 write_msi_msg(irq, &msg); 74 pci_write_msi_msg(irq, &msg);
75 irq_set_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq); 75 irq_set_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq);
76 76
77 return 0; 77 return 0;
@@ -102,8 +102,8 @@ static int ia64_msi_retrigger_irq(struct irq_data *data)
102 */ 102 */
103static struct irq_chip ia64_msi_chip = { 103static struct irq_chip ia64_msi_chip = {
104 .name = "PCI-MSI", 104 .name = "PCI-MSI",
105 .irq_mask = mask_msi_irq, 105 .irq_mask = pci_msi_mask_irq,
106 .irq_unmask = unmask_msi_irq, 106 .irq_unmask = pci_msi_unmask_irq,
107 .irq_ack = ia64_ack_msi_irq, 107 .irq_ack = ia64_ack_msi_irq,
108#ifdef CONFIG_SMP 108#ifdef CONFIG_SMP
109 .irq_set_affinity = ia64_set_msi_irq_affinity, 109 .irq_set_affinity = ia64_set_msi_irq_affinity,
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 5845ffea67c3..dc063fe6646a 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2662,7 +2662,7 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
2662 2662
2663 ret = -ENOMEM; 2663 ret = -ENOMEM;
2664 2664
2665 fd = get_unused_fd(); 2665 fd = get_unused_fd_flags(0);
2666 if (fd < 0) 2666 if (fd < 0)
2667 return fd; 2667 return fd;
2668 2668
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index 446e7799928c..a0eb27b66d13 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -145,7 +145,7 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry)
145 msg.data = 0x100 + irq; 145 msg.data = 0x100 + irq;
146 146
147 irq_set_msi_desc(irq, entry); 147 irq_set_msi_desc(irq, entry);
148 write_msi_msg(irq, &msg); 148 pci_write_msi_msg(irq, &msg);
149 irq_set_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq); 149 irq_set_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq);
150 150
151 return 0; 151 return 0;
@@ -205,7 +205,7 @@ static int sn_set_msi_irq_affinity(struct irq_data *data,
205 msg.address_hi = (u32)(bus_addr >> 32); 205 msg.address_hi = (u32)(bus_addr >> 32);
206 msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff); 206 msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff);
207 207
208 write_msi_msg(irq, &msg); 208 pci_write_msi_msg(irq, &msg);
209 cpumask_copy(data->affinity, cpu_mask); 209 cpumask_copy(data->affinity, cpu_mask);
210 210
211 return 0; 211 return 0;
@@ -228,8 +228,8 @@ static int sn_msi_retrigger_irq(struct irq_data *data)
228 228
229static struct irq_chip sn_msi_chip = { 229static struct irq_chip sn_msi_chip = {
230 .name = "PCI-MSI", 230 .name = "PCI-MSI",
231 .irq_mask = mask_msi_irq, 231 .irq_mask = pci_msi_mask_irq,
232 .irq_unmask = unmask_msi_irq, 232 .irq_unmask = pci_msi_unmask_irq,
233 .irq_ack = sn_ack_msi_irq, 233 .irq_ack = sn_ack_msi_irq,
234#ifdef CONFIG_SMP 234#ifdef CONFIG_SMP
235 .irq_set_affinity = sn_set_msi_irq_affinity, 235 .irq_set_affinity = sn_set_msi_irq_affinity,
diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h
index 4010f1fc5b65..6e7787f3dac7 100644
--- a/arch/m32r/include/asm/io.h
+++ b/arch/m32r/include/asm/io.h
@@ -161,6 +161,9 @@ static inline void _writel(unsigned long l, unsigned long addr)
161#define __raw_writeb writeb 161#define __raw_writeb writeb
162#define __raw_writew writew 162#define __raw_writew writew
163#define __raw_writel writel 163#define __raw_writel writel
164#define writeb_relaxed writeb
165#define writew_relaxed writew
166#define writel_relaxed writel
164 167
165#define ioread8 read 168#define ioread8 read
166#define ioread16 readw 169#define ioread16 readw
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 01a62161b08a..192b00f098f4 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -858,6 +858,24 @@ static struct platform_device *atari_netusbee_devices[] __initdata = {
858}; 858};
859#endif /* CONFIG_ATARI_ETHERNEC */ 859#endif /* CONFIG_ATARI_ETHERNEC */
860 860
861#ifdef CONFIG_ATARI_SCSI
862static const struct resource atari_scsi_st_rsrc[] __initconst = {
863 {
864 .flags = IORESOURCE_IRQ,
865 .start = IRQ_MFP_FSCSI,
866 .end = IRQ_MFP_FSCSI,
867 },
868};
869
870static const struct resource atari_scsi_tt_rsrc[] __initconst = {
871 {
872 .flags = IORESOURCE_IRQ,
873 .start = IRQ_TT_MFP_SCSI,
874 .end = IRQ_TT_MFP_SCSI,
875 },
876};
877#endif
878
861int __init atari_platform_init(void) 879int __init atari_platform_init(void)
862{ 880{
863 int rv = 0; 881 int rv = 0;
@@ -892,6 +910,15 @@ int __init atari_platform_init(void)
892 } 910 }
893#endif 911#endif
894 912
913#ifdef CONFIG_ATARI_SCSI
914 if (ATARIHW_PRESENT(ST_SCSI))
915 platform_device_register_simple("atari_scsi", -1,
916 atari_scsi_st_rsrc, ARRAY_SIZE(atari_scsi_st_rsrc));
917 else if (ATARIHW_PRESENT(TT_SCSI))
918 platform_device_register_simple("atari_scsi", -1,
919 atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));
920#endif
921
895 return rv; 922 return rv;
896} 923}
897 924
diff --git a/arch/m68k/atari/stdma.c b/arch/m68k/atari/stdma.c
index ddbf43ca8858..e5a66596b116 100644
--- a/arch/m68k/atari/stdma.c
+++ b/arch/m68k/atari/stdma.c
@@ -59,6 +59,31 @@ static irqreturn_t stdma_int (int irq, void *dummy);
59/************************* End of Prototypes **************************/ 59/************************* End of Prototypes **************************/
60 60
61 61
62/**
63 * stdma_try_lock - attempt to acquire ST DMA interrupt "lock"
64 * @handler: interrupt handler to use after acquisition
65 *
66 * Returns !0 if lock was acquired; otherwise 0.
67 */
68
69int stdma_try_lock(irq_handler_t handler, void *data)
70{
71 unsigned long flags;
72
73 local_irq_save(flags);
74 if (stdma_locked) {
75 local_irq_restore(flags);
76 return 0;
77 }
78
79 stdma_locked = 1;
80 stdma_isr = handler;
81 stdma_isr_data = data;
82 local_irq_restore(flags);
83 return 1;
84}
85EXPORT_SYMBOL(stdma_try_lock);
86
62 87
63/* 88/*
64 * Function: void stdma_lock( isrfunc isr, void *data ) 89 * Function: void stdma_lock( isrfunc isr, void *data )
@@ -78,19 +103,10 @@ static irqreturn_t stdma_int (int irq, void *dummy);
78 103
79void stdma_lock(irq_handler_t handler, void *data) 104void stdma_lock(irq_handler_t handler, void *data)
80{ 105{
81 unsigned long flags;
82
83 local_irq_save(flags); /* protect lock */
84
85 /* Since the DMA is used for file system purposes, we 106 /* Since the DMA is used for file system purposes, we
86 have to sleep uninterruptible (there may be locked 107 have to sleep uninterruptible (there may be locked
87 buffers) */ 108 buffers) */
88 wait_event(stdma_wait, !stdma_locked); 109 wait_event(stdma_wait, stdma_try_lock(handler, data));
89
90 stdma_locked = 1;
91 stdma_isr = handler;
92 stdma_isr_data = data;
93 local_irq_restore(flags);
94} 110}
95EXPORT_SYMBOL(stdma_lock); 111EXPORT_SYMBOL(stdma_lock);
96 112
@@ -122,22 +138,25 @@ void stdma_release(void)
122EXPORT_SYMBOL(stdma_release); 138EXPORT_SYMBOL(stdma_release);
123 139
124 140
125/* 141/**
126 * Function: int stdma_others_waiting( void ) 142 * stdma_is_locked_by - allow lock holder to check whether it needs to release.
127 * 143 * @handler: interrupt handler previously used to acquire lock.
128 * Purpose: Check if someone waits for the ST-DMA lock.
129 *
130 * Inputs: none
131 *
132 * Returns: 0 if no one is waiting, != 0 otherwise
133 * 144 *
145 * Returns !0 if locked for the given handler; 0 otherwise.
134 */ 146 */
135 147
136int stdma_others_waiting(void) 148int stdma_is_locked_by(irq_handler_t handler)
137{ 149{
138 return waitqueue_active(&stdma_wait); 150 unsigned long flags;
151 int result;
152
153 local_irq_save(flags);
154 result = stdma_locked && (stdma_isr == handler);
155 local_irq_restore(flags);
156
157 return result;
139} 158}
140EXPORT_SYMBOL(stdma_others_waiting); 159EXPORT_SYMBOL(stdma_is_locked_by);
141 160
142 161
143/* 162/*
diff --git a/arch/m68k/include/asm/atari_stdma.h b/arch/m68k/include/asm/atari_stdma.h
index 8e389b7fa70c..d24e34d870dc 100644
--- a/arch/m68k/include/asm/atari_stdma.h
+++ b/arch/m68k/include/asm/atari_stdma.h
@@ -8,11 +8,11 @@
8 8
9/***************************** Prototypes *****************************/ 9/***************************** Prototypes *****************************/
10 10
11int stdma_try_lock(irq_handler_t, void *);
11void stdma_lock(irq_handler_t handler, void *data); 12void stdma_lock(irq_handler_t handler, void *data);
12void stdma_release( void ); 13void stdma_release( void );
13int stdma_others_waiting( void );
14int stdma_islocked( void ); 14int stdma_islocked( void );
15void *stdma_locked_by( void ); 15int stdma_is_locked_by(irq_handler_t);
16void stdma_init( void ); 16void stdma_init( void );
17 17
18/************************* End of Prototypes **************************/ 18/************************* End of Prototypes **************************/
diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h
index c70cc9155003..bccd5a914eb6 100644
--- a/arch/m68k/include/asm/io.h
+++ b/arch/m68k/include/asm/io.h
@@ -3,3 +3,11 @@
3#else 3#else
4#include <asm/io_mm.h> 4#include <asm/io_mm.h>
5#endif 5#endif
6
7#define readb_relaxed(addr) readb(addr)
8#define readw_relaxed(addr) readw(addr)
9#define readl_relaxed(addr) readl(addr)
10
11#define writeb_relaxed(b, addr) writeb(b, addr)
12#define writew_relaxed(b, addr) writew(b, addr)
13#define writel_relaxed(b, addr) writel(b, addr)
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index be4b5a813ad4..a93c8cde4d38 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -40,10 +40,6 @@ static inline unsigned int _swapl(volatile unsigned long v)
40#define readl(addr) \ 40#define readl(addr) \
41 ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; }) 41 ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
42 42
43#define readb_relaxed(addr) readb(addr)
44#define readw_relaxed(addr) readw(addr)
45#define readl_relaxed(addr) readl(addr)
46
47#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b)) 43#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b))
48#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b)) 44#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b))
49#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b)) 45#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
diff --git a/arch/m68k/include/asm/macintosh.h b/arch/m68k/include/asm/macintosh.h
index d323b2c2d07d..29c7c6c3a5f2 100644
--- a/arch/m68k/include/asm/macintosh.h
+++ b/arch/m68k/include/asm/macintosh.h
@@ -53,6 +53,10 @@ struct mac_model
53#define MAC_SCSI_QUADRA 2 53#define MAC_SCSI_QUADRA 2
54#define MAC_SCSI_QUADRA2 3 54#define MAC_SCSI_QUADRA2 3
55#define MAC_SCSI_QUADRA3 4 55#define MAC_SCSI_QUADRA3 4
56#define MAC_SCSI_IIFX 5
57#define MAC_SCSI_DUO 6
58#define MAC_SCSI_CCL 7
59#define MAC_SCSI_LATE 8
56 60
57#define MAC_IDE_NONE 0 61#define MAC_IDE_NONE 0
58#define MAC_IDE_QUADRA 1 62#define MAC_IDE_QUADRA 1
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index a471eab1a4dd..e9c3756139fc 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -278,7 +278,7 @@ static struct mac_model mac_data_table[] = {
278 .name = "IIfx", 278 .name = "IIfx",
279 .adb_type = MAC_ADB_IOP, 279 .adb_type = MAC_ADB_IOP,
280 .via_type = MAC_VIA_IICI, 280 .via_type = MAC_VIA_IICI,
281 .scsi_type = MAC_SCSI_OLD, 281 .scsi_type = MAC_SCSI_IIFX,
282 .scc_type = MAC_SCC_IOP, 282 .scc_type = MAC_SCC_IOP,
283 .nubus_type = MAC_NUBUS, 283 .nubus_type = MAC_NUBUS,
284 .floppy_type = MAC_FLOPPY_SWIM_IOP, 284 .floppy_type = MAC_FLOPPY_SWIM_IOP,
@@ -329,7 +329,7 @@ static struct mac_model mac_data_table[] = {
329 .name = "Color Classic", 329 .name = "Color Classic",
330 .adb_type = MAC_ADB_CUDA, 330 .adb_type = MAC_ADB_CUDA,
331 .via_type = MAC_VIA_IICI, 331 .via_type = MAC_VIA_IICI,
332 .scsi_type = MAC_SCSI_OLD, 332 .scsi_type = MAC_SCSI_CCL,
333 .scc_type = MAC_SCC_II, 333 .scc_type = MAC_SCC_II,
334 .nubus_type = MAC_NUBUS, 334 .nubus_type = MAC_NUBUS,
335 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 335 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -338,7 +338,7 @@ static struct mac_model mac_data_table[] = {
338 .name = "Color Classic II", 338 .name = "Color Classic II",
339 .adb_type = MAC_ADB_CUDA, 339 .adb_type = MAC_ADB_CUDA,
340 .via_type = MAC_VIA_IICI, 340 .via_type = MAC_VIA_IICI,
341 .scsi_type = MAC_SCSI_OLD, 341 .scsi_type = MAC_SCSI_CCL,
342 .scc_type = MAC_SCC_II, 342 .scc_type = MAC_SCC_II,
343 .nubus_type = MAC_NUBUS, 343 .nubus_type = MAC_NUBUS,
344 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 344 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -526,7 +526,7 @@ static struct mac_model mac_data_table[] = {
526 .name = "Performa 520", 526 .name = "Performa 520",
527 .adb_type = MAC_ADB_CUDA, 527 .adb_type = MAC_ADB_CUDA,
528 .via_type = MAC_VIA_IICI, 528 .via_type = MAC_VIA_IICI,
529 .scsi_type = MAC_SCSI_OLD, 529 .scsi_type = MAC_SCSI_CCL,
530 .scc_type = MAC_SCC_II, 530 .scc_type = MAC_SCC_II,
531 .nubus_type = MAC_NUBUS, 531 .nubus_type = MAC_NUBUS,
532 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 532 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -535,7 +535,7 @@ static struct mac_model mac_data_table[] = {
535 .name = "Performa 550", 535 .name = "Performa 550",
536 .adb_type = MAC_ADB_CUDA, 536 .adb_type = MAC_ADB_CUDA,
537 .via_type = MAC_VIA_IICI, 537 .via_type = MAC_VIA_IICI,
538 .scsi_type = MAC_SCSI_OLD, 538 .scsi_type = MAC_SCSI_CCL,
539 .scc_type = MAC_SCC_II, 539 .scc_type = MAC_SCC_II,
540 .nubus_type = MAC_NUBUS, 540 .nubus_type = MAC_NUBUS,
541 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 541 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -567,7 +567,7 @@ static struct mac_model mac_data_table[] = {
567 .name = "TV", 567 .name = "TV",
568 .adb_type = MAC_ADB_CUDA, 568 .adb_type = MAC_ADB_CUDA,
569 .via_type = MAC_VIA_IICI, 569 .via_type = MAC_VIA_IICI,
570 .scsi_type = MAC_SCSI_OLD, 570 .scsi_type = MAC_SCSI_CCL,
571 .scc_type = MAC_SCC_II, 571 .scc_type = MAC_SCC_II,
572 .nubus_type = MAC_NUBUS, 572 .nubus_type = MAC_NUBUS,
573 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 573 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -712,7 +712,7 @@ static struct mac_model mac_data_table[] = {
712 .name = "PowerBook 190", 712 .name = "PowerBook 190",
713 .adb_type = MAC_ADB_PB2, 713 .adb_type = MAC_ADB_PB2,
714 .via_type = MAC_VIA_QUADRA, 714 .via_type = MAC_VIA_QUADRA,
715 .scsi_type = MAC_SCSI_OLD, 715 .scsi_type = MAC_SCSI_LATE,
716 .ide_type = MAC_IDE_BABOON, 716 .ide_type = MAC_IDE_BABOON,
717 .scc_type = MAC_SCC_QUADRA, 717 .scc_type = MAC_SCC_QUADRA,
718 .nubus_type = MAC_NUBUS, 718 .nubus_type = MAC_NUBUS,
@@ -722,7 +722,7 @@ static struct mac_model mac_data_table[] = {
722 .name = "PowerBook 520", 722 .name = "PowerBook 520",
723 .adb_type = MAC_ADB_PB2, 723 .adb_type = MAC_ADB_PB2,
724 .via_type = MAC_VIA_QUADRA, 724 .via_type = MAC_VIA_QUADRA,
725 .scsi_type = MAC_SCSI_OLD, 725 .scsi_type = MAC_SCSI_LATE,
726 .scc_type = MAC_SCC_QUADRA, 726 .scc_type = MAC_SCC_QUADRA,
727 .ether_type = MAC_ETHER_SONIC, 727 .ether_type = MAC_ETHER_SONIC,
728 .nubus_type = MAC_NUBUS, 728 .nubus_type = MAC_NUBUS,
@@ -740,7 +740,7 @@ static struct mac_model mac_data_table[] = {
740 .name = "PowerBook Duo 210", 740 .name = "PowerBook Duo 210",
741 .adb_type = MAC_ADB_PB2, 741 .adb_type = MAC_ADB_PB2,
742 .via_type = MAC_VIA_IICI, 742 .via_type = MAC_VIA_IICI,
743 .scsi_type = MAC_SCSI_OLD, 743 .scsi_type = MAC_SCSI_DUO,
744 .scc_type = MAC_SCC_QUADRA, 744 .scc_type = MAC_SCC_QUADRA,
745 .nubus_type = MAC_NUBUS, 745 .nubus_type = MAC_NUBUS,
746 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 746 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -749,7 +749,7 @@ static struct mac_model mac_data_table[] = {
749 .name = "PowerBook Duo 230", 749 .name = "PowerBook Duo 230",
750 .adb_type = MAC_ADB_PB2, 750 .adb_type = MAC_ADB_PB2,
751 .via_type = MAC_VIA_IICI, 751 .via_type = MAC_VIA_IICI,
752 .scsi_type = MAC_SCSI_OLD, 752 .scsi_type = MAC_SCSI_DUO,
753 .scc_type = MAC_SCC_QUADRA, 753 .scc_type = MAC_SCC_QUADRA,
754 .nubus_type = MAC_NUBUS, 754 .nubus_type = MAC_NUBUS,
755 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 755 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -758,7 +758,7 @@ static struct mac_model mac_data_table[] = {
758 .name = "PowerBook Duo 250", 758 .name = "PowerBook Duo 250",
759 .adb_type = MAC_ADB_PB2, 759 .adb_type = MAC_ADB_PB2,
760 .via_type = MAC_VIA_IICI, 760 .via_type = MAC_VIA_IICI,
761 .scsi_type = MAC_SCSI_OLD, 761 .scsi_type = MAC_SCSI_DUO,
762 .scc_type = MAC_SCC_QUADRA, 762 .scc_type = MAC_SCC_QUADRA,
763 .nubus_type = MAC_NUBUS, 763 .nubus_type = MAC_NUBUS,
764 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 764 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -767,7 +767,7 @@ static struct mac_model mac_data_table[] = {
767 .name = "PowerBook Duo 270c", 767 .name = "PowerBook Duo 270c",
768 .adb_type = MAC_ADB_PB2, 768 .adb_type = MAC_ADB_PB2,
769 .via_type = MAC_VIA_IICI, 769 .via_type = MAC_VIA_IICI,
770 .scsi_type = MAC_SCSI_OLD, 770 .scsi_type = MAC_SCSI_DUO,
771 .scc_type = MAC_SCC_QUADRA, 771 .scc_type = MAC_SCC_QUADRA,
772 .nubus_type = MAC_NUBUS, 772 .nubus_type = MAC_NUBUS,
773 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 773 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -776,7 +776,7 @@ static struct mac_model mac_data_table[] = {
776 .name = "PowerBook Duo 280", 776 .name = "PowerBook Duo 280",
777 .adb_type = MAC_ADB_PB2, 777 .adb_type = MAC_ADB_PB2,
778 .via_type = MAC_VIA_IICI, 778 .via_type = MAC_VIA_IICI,
779 .scsi_type = MAC_SCSI_OLD, 779 .scsi_type = MAC_SCSI_DUO,
780 .scc_type = MAC_SCC_QUADRA, 780 .scc_type = MAC_SCC_QUADRA,
781 .nubus_type = MAC_NUBUS, 781 .nubus_type = MAC_NUBUS,
782 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 782 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -785,7 +785,7 @@ static struct mac_model mac_data_table[] = {
785 .name = "PowerBook Duo 280c", 785 .name = "PowerBook Duo 280c",
786 .adb_type = MAC_ADB_PB2, 786 .adb_type = MAC_ADB_PB2,
787 .via_type = MAC_VIA_IICI, 787 .via_type = MAC_VIA_IICI,
788 .scsi_type = MAC_SCSI_OLD, 788 .scsi_type = MAC_SCSI_DUO,
789 .scc_type = MAC_SCC_QUADRA, 789 .scc_type = MAC_SCC_QUADRA,
790 .nubus_type = MAC_NUBUS, 790 .nubus_type = MAC_NUBUS,
791 .floppy_type = MAC_FLOPPY_SWIM_ADDR2, 791 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
@@ -929,6 +929,70 @@ static struct platform_device swim_pdev = {
929 .resource = &swim_rsrc, 929 .resource = &swim_rsrc,
930}; 930};
931 931
932static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
933 {
934 .flags = IORESOURCE_IRQ,
935 .start = IRQ_MAC_SCSI,
936 .end = IRQ_MAC_SCSI,
937 }, {
938 .flags = IORESOURCE_MEM,
939 .start = 0x50008000,
940 .end = 0x50009FFF,
941 },
942};
943
944static const struct resource mac_scsi_duo_rsrc[] __initconst = {
945 {
946 .flags = IORESOURCE_MEM,
947 .start = 0xFEE02000,
948 .end = 0xFEE03FFF,
949 },
950};
951
952static const struct resource mac_scsi_old_rsrc[] __initconst = {
953 {
954 .flags = IORESOURCE_IRQ,
955 .start = IRQ_MAC_SCSI,
956 .end = IRQ_MAC_SCSI,
957 }, {
958 .flags = IORESOURCE_MEM,
959 .start = 0x50010000,
960 .end = 0x50011FFF,
961 }, {
962 .flags = IORESOURCE_MEM,
963 .start = 0x50006000,
964 .end = 0x50007FFF,
965 },
966};
967
968static const struct resource mac_scsi_late_rsrc[] __initconst = {
969 {
970 .flags = IORESOURCE_IRQ,
971 .start = IRQ_MAC_SCSI,
972 .end = IRQ_MAC_SCSI,
973 }, {
974 .flags = IORESOURCE_MEM,
975 .start = 0x50010000,
976 .end = 0x50011FFF,
977 },
978};
979
980static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
981 {
982 .flags = IORESOURCE_IRQ,
983 .start = IRQ_MAC_SCSI,
984 .end = IRQ_MAC_SCSI,
985 }, {
986 .flags = IORESOURCE_MEM,
987 .start = 0x50F10000,
988 .end = 0x50F11FFF,
989 }, {
990 .flags = IORESOURCE_MEM,
991 .start = 0x50F06000,
992 .end = 0x50F07FFF,
993 },
994};
995
932static struct platform_device esp_0_pdev = { 996static struct platform_device esp_0_pdev = {
933 .name = "mac_esp", 997 .name = "mac_esp",
934 .id = 0, 998 .id = 0,
@@ -1000,6 +1064,60 @@ int __init mac_platform_init(void)
1000 (macintosh_config->ident == MAC_MODEL_Q950)) 1064 (macintosh_config->ident == MAC_MODEL_Q950))
1001 platform_device_register(&esp_1_pdev); 1065 platform_device_register(&esp_1_pdev);
1002 break; 1066 break;
1067 case MAC_SCSI_IIFX:
1068 /* Addresses from The Guide to Mac Family Hardware.
1069 * $5000 8000 - $5000 9FFF: SCSI DMA
1070 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1071 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1072 * The SCSI DMA custom IC embeds the 53C80 core. mac_scsi does
1073 * not make use of its DMA or hardware handshaking logic.
1074 */
1075 platform_device_register_simple("mac_scsi", 0,
1076 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1077 break;
1078 case MAC_SCSI_DUO:
1079 /* Addresses from the Duo Dock II Developer Note.
1080 * $FEE0 2000 - $FEE0 3FFF: normal mode
1081 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1082 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1083 * The NetBSD code indicates that both 5380 chips share
1084 * an IRQ (?) which would need careful handling (see mac_esp).
1085 */
1086 platform_device_register_simple("mac_scsi", 1,
1087 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1088 /* fall through */
1089 case MAC_SCSI_OLD:
1090 /* Addresses from Developer Notes for Duo System,
1091 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1092 * and also from The Guide to Mac Family Hardware for
1093 * SE/30, II, IIx, IIcx, IIci.
1094 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1095 * $5001 0000 - $5001 1FFF: normal mode
1096 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1097 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1098 * $5000 0000 - $5001 FFFF eight times" (!)
1099 * mess.org says IIci and Color Classic do not alias
1100 * I/O address space.
1101 */
1102 platform_device_register_simple("mac_scsi", 0,
1103 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1104 break;
1105 case MAC_SCSI_LATE:
1106 /* PDMA logic in 68040 PowerBooks is somehow different to
1107 * '030 models. It's probably more like Quadras (see mac_esp).
1108 */
1109 platform_device_register_simple("mac_scsi", 0,
1110 mac_scsi_late_rsrc, ARRAY_SIZE(mac_scsi_late_rsrc));
1111 break;
1112 case MAC_SCSI_CCL:
1113 /* Addresses from the Color Classic Developer Note.
1114 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1115 * $50F1 0000 - $50F1 1FFF: SCSI
1116 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1117 */
1118 platform_device_register_simple("mac_scsi", 0,
1119 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1120 break;
1003 } 1121 }
1004 1122
1005 /* 1123 /*
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index acaff6a49e35..b09a3cb29b68 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -94,7 +94,6 @@ void __init paging_init(void)
94 high_memory = (void *) end_mem; 94 high_memory = (void *) end_mem;
95 95
96 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); 96 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
97 memset(empty_zero_page, 0, PAGE_SIZE);
98 97
99 /* 98 /*
100 * Set up SFC/DFC registers (user data space). 99 * Set up SFC/DFC registers (user data space).
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index f59ec58083f8..a8b942bf7163 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -16,6 +16,7 @@
16#include <linux/console.h> 16#include <linux/console.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/bootmem.h> 18#include <linux/bootmem.h>
19#include <linux/platform_device.h>
19 20
20#include <asm/oplib.h> 21#include <asm/oplib.h>
21#include <asm/setup.h> 22#include <asm/setup.h>
@@ -27,6 +28,7 @@
27#include <asm/sun3mmu.h> 28#include <asm/sun3mmu.h>
28#include <asm/rtc.h> 29#include <asm/rtc.h>
29#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/machines.h>
30#include <asm/idprom.h> 32#include <asm/idprom.h>
31#include <asm/intersil.h> 33#include <asm/intersil.h>
32#include <asm/irq.h> 34#include <asm/irq.h>
@@ -169,3 +171,61 @@ static void __init sun3_sched_init(irq_handler_t timer_routine)
169 intersil_clear(); 171 intersil_clear();
170} 172}
171 173
174#ifdef CONFIG_SUN3_SCSI
175
176static const struct resource sun3_scsi_vme_rsrc[] __initconst = {
177 {
178 .flags = IORESOURCE_IRQ,
179 .start = SUN3_VEC_VMESCSI0,
180 .end = SUN3_VEC_VMESCSI0,
181 }, {
182 .flags = IORESOURCE_MEM,
183 .start = 0xff200000,
184 .end = 0xff200021,
185 }, {
186 .flags = IORESOURCE_IRQ,
187 .start = SUN3_VEC_VMESCSI1,
188 .end = SUN3_VEC_VMESCSI1,
189 }, {
190 .flags = IORESOURCE_MEM,
191 .start = 0xff204000,
192 .end = 0xff204021,
193 },
194};
195
196/*
197 * Int: level 2 autovector
198 * IO: type 1, base 0x00140000, 5 bits phys space: A<4..0>
199 */
200static const struct resource sun3_scsi_rsrc[] __initconst = {
201 {
202 .flags = IORESOURCE_IRQ,
203 .start = 2,
204 .end = 2,
205 }, {
206 .flags = IORESOURCE_MEM,
207 .start = 0x00140000,
208 .end = 0x0014001f,
209 },
210};
211
212int __init sun3_platform_init(void)
213{
214 switch (idprom->id_machtype) {
215 case SM_SUN3 | SM_3_160:
216 case SM_SUN3 | SM_3_260:
217 platform_device_register_simple("sun3_scsi_vme", -1,
218 sun3_scsi_vme_rsrc, ARRAY_SIZE(sun3_scsi_vme_rsrc));
219 break;
220 case SM_SUN3 | SM_3_50:
221 case SM_SUN3 | SM_3_60:
222 platform_device_register_simple("sun3_scsi", -1,
223 sun3_scsi_rsrc, ARRAY_SIZE(sun3_scsi_rsrc));
224 break;
225 }
226 return 0;
227}
228
229arch_initcall(sun3_platform_init);
230
231#endif
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 433751b2a003..940f5fc1d1da 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -69,12 +69,4 @@ extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
69 69
70#include <asm-generic/io.h> 70#include <asm-generic/io.h>
71 71
72#define readb_relaxed readb
73#define readw_relaxed readw
74#define readl_relaxed readl
75
76#define writeb_relaxed writeb
77#define writew_relaxed writew
78#define writel_relaxed writel
79
80#endif /* _ASM_MICROBLAZE_IO_H */ 72#endif /* _ASM_MICROBLAZE_IO_H */
diff --git a/arch/microblaze/include/asm/tlb.h b/arch/microblaze/include/asm/tlb.h
index 8aa97817cc8c..99b6ded54849 100644
--- a/arch/microblaze/include/asm/tlb.h
+++ b/arch/microblaze/include/asm/tlb.h
@@ -14,7 +14,6 @@
14#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) 14#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
15 15
16#include <linux/pagemap.h> 16#include <linux/pagemap.h>
17#include <asm-generic/tlb.h>
18 17
19#ifdef CONFIG_MMU 18#ifdef CONFIG_MMU
20#define tlb_start_vma(tlb, vma) do { } while (0) 19#define tlb_start_vma(tlb, vma) do { } while (0)
@@ -22,4 +21,6 @@
22#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) 21#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
23#endif 22#endif
24 23
24#include <asm-generic/tlb.h>
25
25#endif /* _ASM_MICROBLAZE_TLB_H */ 26#endif /* _ASM_MICROBLAZE_TLB_H */
diff --git a/arch/mips/include/asm/idle.h b/arch/mips/include/asm/idle.h
index 1c967abd545c..a2d18ab57ac6 100644
--- a/arch/mips/include/asm/idle.h
+++ b/arch/mips/include/asm/idle.h
@@ -22,7 +22,6 @@ extern int mips_cpuidle_wait_enter(struct cpuidle_device *dev,
22 .exit_latency = 1,\ 22 .exit_latency = 1,\
23 .target_residency = 1,\ 23 .target_residency = 1,\
24 .power_usage = UINT_MAX,\ 24 .power_usage = UINT_MAX,\
25 .flags = CPUIDLE_FLAG_TIME_VALID,\
26 .name = "wait",\ 25 .name = "wait",\
27 .desc = "MIPS wait",\ 26 .desc = "MIPS wait",\
28} 27}
diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h
index e81174432bab..d08f83f19db5 100644
--- a/arch/mips/include/uapi/asm/siginfo.h
+++ b/arch/mips/include/uapi/asm/siginfo.h
@@ -92,6 +92,10 @@ typedef struct siginfo {
92 int _trapno; /* TRAP # which caused the signal */ 92 int _trapno; /* TRAP # which caused the signal */
93#endif 93#endif
94 short _addr_lsb; 94 short _addr_lsb;
95 struct {
96 void __user *_lower;
97 void __user *_upper;
98 } _addr_bnd;
95 } _sigfault; 99 } _sigfault;
96 100
97 /* SIGPOLL, SIGXFSZ (To do ...) */ 101 /* SIGPOLL, SIGXFSZ (To do ...) */
diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c
index 63bbe07a1ccd..cffaaf4aae3c 100644
--- a/arch/mips/pci/msi-octeon.c
+++ b/arch/mips/pci/msi-octeon.c
@@ -178,7 +178,7 @@ msi_irq_allocated:
178 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); 178 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
179 179
180 irq_set_msi_desc(irq, desc); 180 irq_set_msi_desc(irq, desc);
181 write_msi_msg(irq, &msg); 181 pci_write_msi_msg(irq, &msg);
182 return 0; 182 return 0;
183} 183}
184 184
diff --git a/arch/mips/pci/msi-xlp.c b/arch/mips/pci/msi-xlp.c
index f7ac3edda1b2..6a40f24c91b4 100644
--- a/arch/mips/pci/msi-xlp.c
+++ b/arch/mips/pci/msi-xlp.c
@@ -217,7 +217,7 @@ static void xlp_msix_mask_ack(struct irq_data *d)
217 217
218 msixvec = nlm_irq_msixvec(d->irq); 218 msixvec = nlm_irq_msixvec(d->irq);
219 link = nlm_irq_msixlink(msixvec); 219 link = nlm_irq_msixlink(msixvec);
220 mask_msi_irq(d); 220 pci_msi_mask_irq(d);
221 md = irq_data_get_irq_handler_data(d); 221 md = irq_data_get_irq_handler_data(d);
222 222
223 /* Ack MSI on bridge */ 223 /* Ack MSI on bridge */
@@ -239,10 +239,10 @@ static void xlp_msix_mask_ack(struct irq_data *d)
239 239
240static struct irq_chip xlp_msix_chip = { 240static struct irq_chip xlp_msix_chip = {
241 .name = "XLP-MSIX", 241 .name = "XLP-MSIX",
242 .irq_enable = unmask_msi_irq, 242 .irq_enable = pci_msi_unmask_irq,
243 .irq_disable = mask_msi_irq, 243 .irq_disable = pci_msi_mask_irq,
244 .irq_mask_ack = xlp_msix_mask_ack, 244 .irq_mask_ack = xlp_msix_mask_ack,
245 .irq_unmask = unmask_msi_irq, 245 .irq_unmask = pci_msi_unmask_irq,
246}; 246};
247 247
248void arch_teardown_msi_irq(unsigned int irq) 248void arch_teardown_msi_irq(unsigned int irq)
@@ -345,7 +345,7 @@ static int xlp_setup_msi(uint64_t lnkbase, int node, int link,
345 if (ret < 0) 345 if (ret < 0)
346 return ret; 346 return ret;
347 347
348 write_msi_msg(xirq, &msg); 348 pci_write_msi_msg(xirq, &msg);
349 return 0; 349 return 0;
350} 350}
351 351
@@ -446,7 +446,7 @@ static int xlp_setup_msix(uint64_t lnkbase, int node, int link,
446 if (ret < 0) 446 if (ret < 0)
447 return ret; 447 return ret;
448 448
449 write_msi_msg(xirq, &msg); 449 pci_write_msi_msg(xirq, &msg);
450 return 0; 450 return 0;
451} 451}
452 452
diff --git a/arch/mips/pci/pci-xlr.c b/arch/mips/pci/pci-xlr.c
index 0dde80332d3a..26d2dabef281 100644
--- a/arch/mips/pci/pci-xlr.c
+++ b/arch/mips/pci/pci-xlr.c
@@ -260,7 +260,7 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
260 if (ret < 0) 260 if (ret < 0)
261 return ret; 261 return ret;
262 262
263 write_msi_msg(irq, &msg); 263 pci_write_msi_msg(irq, &msg);
264 return 0; 264 return 0;
265} 265}
266#endif 266#endif
diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h
index e6ed0d897ccc..897ba3c12b32 100644
--- a/arch/mn10300/include/asm/io.h
+++ b/arch/mn10300/include/asm/io.h
@@ -67,6 +67,10 @@ static inline void writel(u32 b, volatile void __iomem *addr)
67#define __raw_writew writew 67#define __raw_writew writew
68#define __raw_writel writel 68#define __raw_writel writel
69 69
70#define writeb_relaxed writeb
71#define writew_relaxed writew
72#define writel_relaxed writel
73
70/*****************************************************************************/ 74/*****************************************************************************/
71/* 75/*
72 * traditional input/output functions 76 * traditional input/output functions
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
new file mode 100644
index 000000000000..2361acf6d2b1
--- /dev/null
+++ b/arch/nios2/Kconfig
@@ -0,0 +1,206 @@
1config NIOS2
2 def_bool y
3 select ARCH_WANT_OPTIONAL_GPIOLIB
4 select CLKSRC_OF
5 select GENERIC_ATOMIC64
6 select GENERIC_CLOCKEVENTS
7 select GENERIC_CPU_DEVICES
8 select GENERIC_IRQ_PROBE
9 select GENERIC_IRQ_SHOW
10 select HAVE_ARCH_TRACEHOOK
11 select IRQ_DOMAIN
12 select MODULES_USE_ELF_RELA
13 select OF
14 select OF_EARLY_FLATTREE
15 select SOC_BUS
16 select SPARSE_IRQ
17 select USB_ARCH_HAS_HCD if USB_SUPPORT
18
19config GENERIC_CSUM
20 def_bool y
21
22config GENERIC_HWEIGHT
23 def_bool y
24
25config GENERIC_CALIBRATE_DELAY
26 def_bool y
27
28config NO_IOPORT_MAP
29 def_bool y
30
31config HAS_DMA
32 def_bool y
33
34config FPU
35 def_bool n
36
37config SWAP
38 def_bool n
39
40config RWSEM_GENERIC_SPINLOCK
41 def_bool y
42
43config TRACE_IRQFLAGS_SUPPORT
44 def_bool n
45
46source "init/Kconfig"
47
48menu "Kernel features"
49
50source "kernel/Kconfig.preempt"
51
52source "kernel/Kconfig.freezer"
53
54source "kernel/Kconfig.hz"
55
56source "mm/Kconfig"
57
58config FORCE_MAX_ZONEORDER
59 int "Maximum zone order"
60 range 9 20
61 default "11"
62 help
63 The kernel memory allocator divides physically contiguous memory
64 blocks into "zones", where each zone is a power of two number of
65 pages. This option selects the largest power of two that the kernel
66 keeps in the memory allocator. If you need to allocate very large
67 blocks of physically contiguous memory, then you may need to
68 increase this value.
69
70 This config option is actually maximum order plus one. For example,
71 a value of 11 means that the largest free memory block is 2^10 pages.
72
73endmenu
74
75source "arch/nios2/platform/Kconfig.platform"
76
77menu "Processor type and features"
78
79config MMU
80 def_bool y
81
82config NR_CPUS
83 int
84 default "1"
85
86config NIOS2_ALIGNMENT_TRAP
87 bool "Catch alignment trap"
88 default y
89 help
90 Nios II CPUs cannot fetch/store data which is not bus aligned,
91 i.e., a 2 or 4 byte fetch must start at an address divisible by
92 2 or 4. Any non-aligned load/store instructions will be trapped and
93 emulated in software if you say Y here, which has a performance
94 impact.
95
96comment "Boot options"
97
98config CMDLINE_BOOL
99 bool "Default bootloader kernel arguments"
100 default y
101
102config CMDLINE
103 string "Default kernel command string"
104 default ""
105 depends on CMDLINE_BOOL
106 help
107 On some platforms, there is currently no way for the boot loader to
108 pass arguments to the kernel. For these platforms, you can supply
109 some command-line options at build time by entering them here. In
110 other cases you can specify kernel args so that you don't have
111 to set them up in board prom initialization routines.
112
113config CMDLINE_FORCE
114 bool "Force default kernel command string"
115 depends on CMDLINE_BOOL
116 help
117 Set this to have arguments from the default kernel command string
118 override those passed by the boot loader.
119
120config NIOS2_CMDLINE_IGNORE_DTB
121 bool "Ignore kernel command string from DTB"
122 depends on CMDLINE_BOOL
123 depends on !CMDLINE_FORCE
124 default y
125 help
126 Set this to ignore the bootargs property from the devicetree's
127 chosen node and fall back to CMDLINE if nothing is passed.
128
129config NIOS2_PASS_CMDLINE
130 bool "Passed kernel command line from u-boot"
131 default n
132 help
133 Use bootargs env variable from u-boot for kernel command line.
134 will override "Default kernel command string".
135 Say N if you are unsure.
136
137endmenu
138
139menu "Advanced setup"
140
141config ADVANCED_OPTIONS
142 bool "Prompt for advanced kernel configuration options"
143 help
144
145comment "Default settings for advanced configuration options are used"
146 depends on !ADVANCED_OPTIONS
147
148config NIOS2_KERNEL_MMU_REGION_BASE_BOOL
149 bool "Set custom kernel MMU region base address"
150 depends on ADVANCED_OPTIONS
151 help
152 This option allows you to set the virtual address of the kernel MMU region.
153
154 Say N here unless you know what you are doing.
155
156config NIOS2_KERNEL_MMU_REGION_BASE
157 hex "Virtual base address of the kernel MMU region " if NIOS2_KERNEL_MMU_REGION_BASE_BOOL
158 default "0x80000000"
159 help
160 This option allows you to set the virtual base address of the kernel MMU region.
161
162config NIOS2_KERNEL_REGION_BASE_BOOL
163 bool "Set custom kernel region base address"
164 depends on ADVANCED_OPTIONS
165 help
166 This option allows you to set the virtual address of the kernel region.
167
168 Say N here unless you know what you are doing.
169
170config NIOS2_KERNEL_REGION_BASE
171 hex "Virtual base address of the kernel region " if NIOS2_KERNEL_REGION_BASE_BOOL
172 default "0xc0000000"
173
174config NIOS2_IO_REGION_BASE_BOOL
175 bool "Set custom I/O region base address"
176 depends on ADVANCED_OPTIONS
177 help
178 This option allows you to set the virtual address of the I/O region.
179
180 Say N here unless you know what you are doing.
181
182config NIOS2_IO_REGION_BASE
183 hex "Virtual base address of the I/O region" if NIOS2_IO_REGION_BASE_BOOL
184 default "0xe0000000"
185
186endmenu
187
188menu "Executable file formats"
189
190source "fs/Kconfig.binfmt"
191
192endmenu
193
194source "net/Kconfig"
195
196source "drivers/Kconfig"
197
198source "fs/Kconfig"
199
200source "arch/nios2/Kconfig.debug"
201
202source "security/Kconfig"
203
204source "crypto/Kconfig"
205
206source "lib/Kconfig"
diff --git a/arch/nios2/Kconfig.debug b/arch/nios2/Kconfig.debug
new file mode 100644
index 000000000000..8d4e6bacd997
--- /dev/null
+++ b/arch/nios2/Kconfig.debug
@@ -0,0 +1,17 @@
1menu "Kernel hacking"
2
3config TRACE_IRQFLAGS_SUPPORT
4 def_bool y
5
6source "lib/Kconfig.debug"
7
8config DEBUG_STACK_USAGE
9 bool "Enable stack utilization instrumentation"
10 depends on DEBUG_KERNEL
11 help
12 Enables the display of the minimum amount of free stack which each
13 task has ever had available in the sysrq-T and sysrq-P debug output.
14
15 This option will slow down process creation somewhat.
16
17endmenu
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
new file mode 100644
index 000000000000..e142c9ee51fa
--- /dev/null
+++ b/arch/nios2/Makefile
@@ -0,0 +1,73 @@
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) 2013 Altera Corporation
7# Copyright (C) 1994, 95, 96, 2003 by Wind River Systems
8# Written by Fredrik Markstrom
9#
10# This file is included by the global makefile so that you can add your own
11# architecture-specific flags and dependencies. Remember to do have actions
12# for "archclean" cleaning up for this architecture.
13#
14# Nios2 port by Wind River Systems Inc trough:
15# fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
16
17UTS_SYSNAME = Linux
18
19export MMU
20
21LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
22
23KBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__
24KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul)
25KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx)
26KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div)
27KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,)
28
29KBUILD_CFLAGS += -fno-optimize-sibling-calls
30KBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\"
31KBUILD_CFLAGS += -fno-builtin
32KBUILD_CFLAGS += -G 0
33
34head-y := arch/nios2/kernel/head.o
35libs-y += arch/nios2/lib/ $(LIBGCC)
36core-y += arch/nios2/kernel/ arch/nios2/mm/
37core-y += arch/nios2/platform/
38
39INSTALL_PATH ?= /tftpboot
40nios2-boot := arch/$(ARCH)/boot
41BOOT_TARGETS = vmImage zImage
42PHONY += $(BOOT_TARGETS) install
43KBUILD_IMAGE := $(nios2-boot)/vmImage
44
45ifneq ($(CONFIG_NIOS2_DTB_SOURCE),"")
46 core-y += $(nios2-boot)/
47endif
48
49all: vmImage
50
51archclean:
52 $(Q)$(MAKE) $(clean)=$(nios2-boot)
53
54%.dtb:
55 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
56
57dtbs:
58 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
59
60$(BOOT_TARGETS): vmlinux
61 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
62
63install:
64 $(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install
65
66define archhelp
67 echo '* vmImage - Kernel-only image for U-Boot ($(KBUILD_IMAGE))'
68 echo ' install - Install kernel using'
69 echo ' (your) ~/bin/$(INSTALLKERNEL) or'
70 echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
71 echo ' install to $$(INSTALL_PATH)'
72 echo ' dtbs - Build device tree blobs for enabled boards'
73endef
diff --git a/arch/nios2/boot/Makefile b/arch/nios2/boot/Makefile
new file mode 100644
index 000000000000..59392dc0bdcb
--- /dev/null
+++ b/arch/nios2/boot/Makefile
@@ -0,0 +1,52 @@
1#
2# arch/nios2/boot/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8
9UIMAGE_LOADADDR = $(shell $(NM) vmlinux | awk '$$NF == "_stext" {print $$1}')
10UIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "_start" {print $$1}')
11UIMAGE_COMPRESSION = gzip
12
13OBJCOPYFLAGS_vmlinux.bin := -O binary
14
15targets += vmlinux.bin vmlinux.gz vmImage
16
17$(obj)/vmlinux.bin: vmlinux FORCE
18 $(call if_changed,objcopy)
19
20$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
21 $(call if_changed,gzip)
22
23$(obj)/vmImage: $(obj)/vmlinux.gz
24 $(call if_changed,uimage)
25 @$(kecho) 'Kernel: $@ is ready'
26
27# Rule to build device tree blobs
28DTB_SRC := $(patsubst "%",%,$(CONFIG_NIOS2_DTB_SOURCE))
29
30# Make sure the generated dtb gets removed during clean
31extra-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += system.dtb
32
33$(obj)/system.dtb: $(DTB_SRC) FORCE
34 $(call cmd,dtc)
35
36# Ensure system.dtb exists
37$(obj)/linked_dtb.o: $(obj)/system.dtb
38
39obj-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += linked_dtb.o
40
41targets += $(dtb-y)
42
43# Rule to build device tree blobs with make command
44$(obj)/%.dtb: $(src)/dts/%.dts FORCE
45 $(call if_changed_dep,dtc)
46
47$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
48
49clean-files := *.dtb
50
51install:
52 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff --git a/arch/nios2/boot/dts/3c120_devboard.dts b/arch/nios2/boot/dts/3c120_devboard.dts
new file mode 100644
index 000000000000..31c51f9a2f09
--- /dev/null
+++ b/arch/nios2/boot/dts/3c120_devboard.dts
@@ -0,0 +1,164 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * This file is generated by sopc2dts.
18 */
19
20/dts-v1/;
21
22/ {
23 model = "altr,qsys_ghrd_3c120";
24 compatible = "altr,qsys_ghrd_3c120";
25 #address-cells = <1>;
26 #size-cells = <1>;
27
28 cpus {
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 cpu: cpu@0x0 {
33 device_type = "cpu";
34 compatible = "altr,nios2-1.0";
35 reg = <0x00000000>;
36 interrupt-controller;
37 #interrupt-cells = <1>;
38 clock-frequency = <125000000>;
39 dcache-line-size = <32>;
40 icache-line-size = <32>;
41 dcache-size = <32768>;
42 icache-size = <32768>;
43 altr,implementation = "fast";
44 altr,pid-num-bits = <8>;
45 altr,tlb-num-ways = <16>;
46 altr,tlb-num-entries = <128>;
47 altr,tlb-ptr-sz = <7>;
48 altr,has-div = <1>;
49 altr,has-mul = <1>;
50 altr,reset-addr = <0xc2800000>;
51 altr,fast-tlb-miss-addr = <0xc7fff400>;
52 altr,exception-addr = <0xd0000020>;
53 altr,has-initda = <1>;
54 altr,has-mmu = <1>;
55 };
56 };
57
58 memory@0 {
59 device_type = "memory";
60 reg = <0x10000000 0x08000000>,
61 <0x07fff400 0x00000400>;
62 };
63
64 sopc@0 {
65 device_type = "soc";
66 ranges;
67 #address-cells = <1>;
68 #size-cells = <1>;
69 compatible = "altr,avalon", "simple-bus";
70 bus-frequency = <125000000>;
71
72 pb_cpu_to_io: bridge@0x8000000 {
73 compatible = "simple-bus";
74 reg = <0x08000000 0x00800000>;
75 #address-cells = <1>;
76 #size-cells = <1>;
77 ranges = <0x00002000 0x08002000 0x00002000>,
78 <0x00004000 0x08004000 0x00000400>,
79 <0x00004400 0x08004400 0x00000040>,
80 <0x00004800 0x08004800 0x00000040>,
81 <0x00004c80 0x08004c80 0x00000020>,
82 <0x00004d50 0x08004d50 0x00000008>,
83 <0x00008000 0x08008000 0x00000020>,
84 <0x00400000 0x08400000 0x00000020>;
85
86 timer_1ms: timer@0x400000 {
87 compatible = "altr,timer-1.0";
88 reg = <0x00400000 0x00000020>;
89 interrupt-parent = <&cpu>;
90 interrupts = <11>;
91 clock-frequency = <125000000>;
92 };
93
94 timer_0: timer@0x8000 {
95 compatible = "altr,timer-1.0";
96 reg = < 0x00008000 0x00000020 >;
97 interrupt-parent = < &cpu >;
98 interrupts = < 5 >;
99 clock-frequency = < 125000000 >;
100 };
101
102 jtag_uart: serial@0x4d50 {
103 compatible = "altr,juart-1.0";
104 reg = <0x00004d50 0x00000008>;
105 interrupt-parent = <&cpu>;
106 interrupts = <1>;
107 };
108
109 tse_mac: ethernet@0x4000 {
110 compatible = "altr,tse-1.0";
111 reg = <0x00004000 0x00000400>,
112 <0x00004400 0x00000040>,
113 <0x00004800 0x00000040>,
114 <0x00002000 0x00002000>;
115 reg-names = "control_port", "rx_csr", "tx_csr", "s1";
116 interrupt-parent = <&cpu>;
117 interrupts = <2 3>;
118 interrupt-names = "rx_irq", "tx_irq";
119 rx-fifo-depth = <8192>;
120 tx-fifo-depth = <8192>;
121 max-frame-size = <1518>;
122 local-mac-address = [ 00 00 00 00 00 00 ];
123 phy-mode = "rgmii-id";
124 phy-handle = <&phy0>;
125 tse_mac_mdio: mdio {
126 compatible = "altr,tse-mdio";
127 #address-cells = <1>;
128 #size-cells = <0>;
129 phy0: ethernet-phy@18 {
130 reg = <18>;
131 device_type = "ethernet-phy";
132 };
133 };
134 };
135
136 uart: serial@0x4c80 {
137 compatible = "altr,uart-1.0";
138 reg = <0x00004c80 0x00000020>;
139 interrupt-parent = <&cpu>;
140 interrupts = <10>;
141 current-speed = <115200>;
142 clock-frequency = <62500000>;
143 };
144 };
145
146 cfi_flash_64m: flash@0x0 {
147 compatible = "cfi-flash";
148 reg = <0x00000000 0x04000000>;
149 bank-width = <2>;
150 device-width = <1>;
151 #address-cells = <1>;
152 #size-cells = <1>;
153
154 partition@800000 {
155 reg = <0x00800000 0x01e00000>;
156 label = "JFFS2 Filesystem";
157 };
158 };
159 };
160
161 chosen {
162 bootargs = "debug console=ttyJ0,115200";
163 };
164};
diff --git a/arch/nios2/boot/install.sh b/arch/nios2/boot/install.sh
new file mode 100644
index 000000000000..3cb3f468bc51
--- /dev/null
+++ b/arch/nios2/boot/install.sh
@@ -0,0 +1,52 @@
1#!/bin/sh
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License. See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 1995 by Linus Torvalds
8#
9# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
10#
11# "make install" script for nios2 architecture
12#
13# Arguments:
14# $1 - kernel version
15# $2 - kernel image file
16# $3 - kernel map file
17# $4 - default install path (blank if root directory)
18#
19
20verify () {
21 if [ ! -f "$1" ]; then
22 echo "" 1>&2
23 echo " *** Missing file: $1" 1>&2
24 echo ' *** You need to run "make" before "make install".' 1>&2
25 echo "" 1>&2
26 exit 1
27 fi
28}
29
30# Make sure the files actually exist
31verify "$2"
32verify "$3"
33
34# User may have a custom install script
35
36if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
37if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
38
39# Default install - same as make zlilo
40
41if [ -f $4/vmlinuz ]; then
42 mv $4/vmlinuz $4/vmlinuz.old
43fi
44
45if [ -f $4/System.map ]; then
46 mv $4/System.map $4/System.old
47fi
48
49cat $2 > $4/vmlinuz
50cp $3 $4/System.map
51
52sync
diff --git a/arch/nios2/boot/linked_dtb.S b/arch/nios2/boot/linked_dtb.S
new file mode 100644
index 000000000000..071f922db338
--- /dev/null
+++ b/arch/nios2/boot/linked_dtb.S
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) 2011 Thomas Chou <thomas@wytron.com.tw>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18.section .dtb.init.rodata,"a"
19.incbin "arch/nios2/boot/system.dtb"
diff --git a/arch/nios2/configs/3c120_defconfig b/arch/nios2/configs/3c120_defconfig
new file mode 100644
index 000000000000..87541f0a5d6e
--- /dev/null
+++ b/arch/nios2/configs/3c120_defconfig
@@ -0,0 +1,77 @@
1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ_IDLE=y
3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSCTL_SYSCALL=y
6# CONFIG_ELF_CORE is not set
7# CONFIG_EPOLL is not set
8# CONFIG_SIGNALFD is not set
9# CONFIG_TIMERFD is not set
10# CONFIG_EVENTFD is not set
11# CONFIG_SHMEM is not set
12# CONFIG_AIO is not set
13CONFIG_EMBEDDED=y
14CONFIG_SLAB=y
15CONFIG_MODULES=y
16CONFIG_MODULE_UNLOAD=y
17CONFIG_NIOS2_MEM_BASE=0x10000000
18CONFIG_NIOS2_HW_MUL_SUPPORT=y
19CONFIG_NIOS2_HW_DIV_SUPPORT=y
20CONFIG_CUSTOM_CACHE_SETTINGS=y
21CONFIG_NIOS2_DCACHE_SIZE=0x8000
22CONFIG_NIOS2_ICACHE_SIZE=0x8000
23# CONFIG_NIOS2_CMDLINE_IGNORE_DTB is not set
24CONFIG_NIOS2_PASS_CMDLINE=y
25CONFIG_NET=y
26CONFIG_PACKET=y
27CONFIG_UNIX=y
28CONFIG_INET=y
29CONFIG_IP_MULTICAST=y
30CONFIG_IP_PNP=y
31CONFIG_IP_PNP_DHCP=y
32CONFIG_IP_PNP_BOOTP=y
33CONFIG_IP_PNP_RARP=y
34# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
35# CONFIG_INET_XFRM_MODE_TUNNEL is not set
36# CONFIG_INET_XFRM_MODE_BEET is not set
37# CONFIG_INET_LRO is not set
38# CONFIG_IPV6 is not set
39# CONFIG_WIRELESS is not set
40CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
41CONFIG_DEVTMPFS=y
42CONFIG_DEVTMPFS_MOUNT=y
43# CONFIG_FW_LOADER is not set
44CONFIG_MTD=y
45CONFIG_MTD_CMDLINE_PARTS=y
46CONFIG_MTD_BLOCK=y
47CONFIG_MTD_CFI=y
48CONFIG_MTD_CFI_INTELEXT=y
49CONFIG_MTD_CFI_AMDSTD=y
50CONFIG_MTD_PHYSMAP_OF=y
51CONFIG_BLK_DEV_LOOP=y
52CONFIG_NETDEVICES=y
53CONFIG_ALTERA_TSE=y
54CONFIG_MARVELL_PHY=y
55# CONFIG_WLAN is not set
56# CONFIG_INPUT_MOUSE is not set
57# CONFIG_SERIO_SERPORT is not set
58# CONFIG_VT is not set
59CONFIG_SERIAL_ALTERA_JTAGUART=y
60CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE=y
61CONFIG_SERIAL_ALTERA_UART=y
62# CONFIG_HW_RANDOM is not set
63# CONFIG_HWMON is not set
64# CONFIG_USB_SUPPORT is not set
65CONFIG_NEW_LEDS=y
66CONFIG_LEDS_CLASS=y
67CONFIG_LEDS_TRIGGERS=y
68CONFIG_LEDS_TRIGGER_HEARTBEAT=y
69# CONFIG_DNOTIFY is not set
70# CONFIG_INOTIFY_USER is not set
71CONFIG_JFFS2_FS=y
72CONFIG_NFS_FS=y
73CONFIG_NFS_V3_ACL=y
74CONFIG_ROOT_NFS=y
75CONFIG_SUNRPC_DEBUG=y
76CONFIG_DEBUG_INFO=y
77# CONFIG_ENABLE_WARN_DEPRECATED is not set
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
new file mode 100644
index 000000000000..01c75f36e8b3
--- /dev/null
+++ b/arch/nios2/include/asm/Kbuild
@@ -0,0 +1,65 @@
1generic-y += atomic.h
2generic-y += auxvec.h
3generic-y += barrier.h
4generic-y += bitops.h
5generic-y += bitsperlong.h
6generic-y += bug.h
7generic-y += bugs.h
8generic-y += clkdev.h
9generic-y += cputime.h
10generic-y += current.h
11generic-y += device.h
12generic-y += div64.h
13generic-y += dma.h
14generic-y += emergency-restart.h
15generic-y += errno.h
16generic-y += exec.h
17generic-y += fb.h
18generic-y += fcntl.h
19generic-y += ftrace.h
20generic-y += futex.h
21generic-y += hardirq.h
22generic-y += hw_irq.h
23generic-y += ioctl.h
24generic-y += ioctls.h
25generic-y += ipcbuf.h
26generic-y += irq_regs.h
27generic-y += irq_work.h
28generic-y += kdebug.h
29generic-y += kmap_types.h
30generic-y += kvm_para.h
31generic-y += local.h
32generic-y += mcs_spinlock.h
33generic-y += mman.h
34generic-y += module.h
35generic-y += msgbuf.h
36generic-y += param.h
37generic-y += pci.h
38generic-y += percpu.h
39generic-y += poll.h
40generic-y += posix_types.h
41generic-y += preempt.h
42generic-y += resource.h
43generic-y += scatterlist.h
44generic-y += sections.h
45generic-y += segment.h
46generic-y += sembuf.h
47generic-y += serial.h
48generic-y += shmbuf.h
49generic-y += shmparam.h
50generic-y += siginfo.h
51generic-y += signal.h
52generic-y += socket.h
53generic-y += sockios.h
54generic-y += spinlock.h
55generic-y += stat.h
56generic-y += statfs.h
57generic-y += termbits.h
58generic-y += termios.h
59generic-y += topology.h
60generic-y += trace_clock.h
61generic-y += types.h
62generic-y += unaligned.h
63generic-y += user.h
64generic-y += vga.h
65generic-y += xor.h
diff --git a/arch/nios2/include/asm/asm-macros.h b/arch/nios2/include/asm/asm-macros.h
new file mode 100644
index 000000000000..29fa2e4d7b00
--- /dev/null
+++ b/arch/nios2/include/asm/asm-macros.h
@@ -0,0 +1,309 @@
1/*
2 * Macro used to simplify coding multi-line assembler.
3 * Some of the bit test macro can simplify down to one line
4 * depending on the mask value.
5 *
6 * Copyright (C) 2004 Microtronix Datacom Ltd.
7 *
8 * All rights reserved.
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 * 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, GOOD TITLE or
18 * NON INFRINGEMENT. See the GNU General Public License for more
19 * details.
20 *
21 */
22#ifndef _ASM_NIOS2_ASMMACROS_H
23#define _ASM_NIOS2_ASMMACROS_H
24/*
25 * ANDs reg2 with mask and places the result in reg1.
26 *
27 * You cannnot use the same register for reg1 & reg2.
28 */
29
30.macro ANDI32 reg1, reg2, mask
31.if \mask & 0xffff
32 .if \mask & 0xffff0000
33 movhi \reg1, %hi(\mask)
34 movui \reg1, %lo(\mask)
35 and \reg1, \reg1, \reg2
36 .else
37 andi \reg1, \reg2, %lo(\mask)
38 .endif
39.else
40 andhi \reg1, \reg2, %hi(\mask)
41.endif
42.endm
43
44/*
45 * ORs reg2 with mask and places the result in reg1.
46 *
47 * It is safe to use the same register for reg1 & reg2.
48 */
49
50.macro ORI32 reg1, reg2, mask
51.if \mask & 0xffff
52 .if \mask & 0xffff0000
53 orhi \reg1, \reg2, %hi(\mask)
54 ori \reg1, \reg2, %lo(\mask)
55 .else
56 ori \reg1, \reg2, %lo(\mask)
57 .endif
58.else
59 orhi \reg1, \reg2, %hi(\mask)
60.endif
61.endm
62
63/*
64 * XORs reg2 with mask and places the result in reg1.
65 *
66 * It is safe to use the same register for reg1 & reg2.
67 */
68
69.macro XORI32 reg1, reg2, mask
70.if \mask & 0xffff
71 .if \mask & 0xffff0000
72 xorhi \reg1, \reg2, %hi(\mask)
73 xori \reg1, \reg1, %lo(\mask)
74 .else
75 xori \reg1, \reg2, %lo(\mask)
76 .endif
77.else
78 xorhi \reg1, \reg2, %hi(\mask)
79.endif
80.endm
81
82/*
83 * This is a support macro for BTBZ & BTBNZ. It checks
84 * the bit to make sure it is valid 32 value.
85 *
86 * It is safe to use the same register for reg1 & reg2.
87 */
88
89.macro BT reg1, reg2, bit
90.if \bit > 31
91 .err
92.else
93 .if \bit < 16
94 andi \reg1, \reg2, (1 << \bit)
95 .else
96 andhi \reg1, \reg2, (1 << (\bit - 16))
97 .endif
98.endif
99.endm
100
101/*
102 * Tests the bit in reg2 and branches to label if the
103 * bit is zero. The result of the bit test is stored in reg1.
104 *
105 * It is safe to use the same register for reg1 & reg2.
106 */
107
108.macro BTBZ reg1, reg2, bit, label
109 BT \reg1, \reg2, \bit
110 beq \reg1, r0, \label
111.endm
112
113/*
114 * Tests the bit in reg2 and branches to label if the
115 * bit is non-zero. The result of the bit test is stored in reg1.
116 *
117 * It is safe to use the same register for reg1 & reg2.
118 */
119
120.macro BTBNZ reg1, reg2, bit, label
121 BT \reg1, \reg2, \bit
122 bne \reg1, r0, \label
123.endm
124
125/*
126 * Tests the bit in reg2 and then compliments the bit in reg2.
127 * The result of the bit test is stored in reg1.
128 *
129 * It is NOT safe to use the same register for reg1 & reg2.
130 */
131
132.macro BTC reg1, reg2, bit
133.if \bit > 31
134 .err
135.else
136 .if \bit < 16
137 andi \reg1, \reg2, (1 << \bit)
138 xori \reg2, \reg2, (1 << \bit)
139 .else
140 andhi \reg1, \reg2, (1 << (\bit - 16))
141 xorhi \reg2, \reg2, (1 << (\bit - 16))
142 .endif
143.endif
144.endm
145
146/*
147 * Tests the bit in reg2 and then sets the bit in reg2.
148 * The result of the bit test is stored in reg1.
149 *
150 * It is NOT safe to use the same register for reg1 & reg2.
151 */
152
153.macro BTS reg1, reg2, bit
154.if \bit > 31
155 .err
156.else
157 .if \bit < 16
158 andi \reg1, \reg2, (1 << \bit)
159 ori \reg2, \reg2, (1 << \bit)
160 .else
161 andhi \reg1, \reg2, (1 << (\bit - 16))
162 orhi \reg2, \reg2, (1 << (\bit - 16))
163 .endif
164.endif
165.endm
166
167/*
168 * Tests the bit in reg2 and then resets the bit in reg2.
169 * The result of the bit test is stored in reg1.
170 *
171 * It is NOT safe to use the same register for reg1 & reg2.
172 */
173
174.macro BTR reg1, reg2, bit
175.if \bit > 31
176 .err
177.else
178 .if \bit < 16
179 andi \reg1, \reg2, (1 << \bit)
180 andi \reg2, \reg2, %lo(~(1 << \bit))
181 .else
182 andhi \reg1, \reg2, (1 << (\bit - 16))
183 andhi \reg2, \reg2, %lo(~(1 << (\bit - 16)))
184 .endif
185.endif
186.endm
187
188/*
189 * Tests the bit in reg2 and then compliments the bit in reg2.
190 * The result of the bit test is stored in reg1. If the
191 * original bit was zero it branches to label.
192 *
193 * It is NOT safe to use the same register for reg1 & reg2.
194 */
195
196.macro BTCBZ reg1, reg2, bit, label
197 BTC \reg1, \reg2, \bit
198 beq \reg1, r0, \label
199.endm
200
201/*
202 * Tests the bit in reg2 and then compliments the bit in reg2.
203 * The result of the bit test is stored in reg1. If the
204 * original bit was non-zero it branches to label.
205 *
206 * It is NOT safe to use the same register for reg1 & reg2.
207 */
208
209.macro BTCBNZ reg1, reg2, bit, label
210 BTC \reg1, \reg2, \bit
211 bne \reg1, r0, \label
212.endm
213
214/*
215 * Tests the bit in reg2 and then sets the bit in reg2.
216 * The result of the bit test is stored in reg1. If the
217 * original bit was zero it branches to label.
218 *
219 * It is NOT safe to use the same register for reg1 & reg2.
220 */
221
222.macro BTSBZ reg1, reg2, bit, label
223 BTS \reg1, \reg2, \bit
224 beq \reg1, r0, \label
225.endm
226
227/*
228 * Tests the bit in reg2 and then sets the bit in reg2.
229 * The result of the bit test is stored in reg1. If the
230 * original bit was non-zero it branches to label.
231 *
232 * It is NOT safe to use the same register for reg1 & reg2.
233 */
234
235.macro BTSBNZ reg1, reg2, bit, label
236 BTS \reg1, \reg2, \bit
237 bne \reg1, r0, \label
238.endm
239
240/*
241 * Tests the bit in reg2 and then resets the bit in reg2.
242 * The result of the bit test is stored in reg1. If the
243 * original bit was zero it branches to label.
244 *
245 * It is NOT safe to use the same register for reg1 & reg2.
246 */
247
248.macro BTRBZ reg1, reg2, bit, label
249 BTR \reg1, \reg2, \bit
250 bne \reg1, r0, \label
251.endm
252
253/*
254 * Tests the bit in reg2 and then resets the bit in reg2.
255 * The result of the bit test is stored in reg1. If the
256 * original bit was non-zero it branches to label.
257 *
258 * It is NOT safe to use the same register for reg1 & reg2.
259 */
260
261.macro BTRBNZ reg1, reg2, bit, label
262 BTR \reg1, \reg2, \bit
263 bne \reg1, r0, \label
264.endm
265
266/*
267 * Tests the bits in mask against reg2 stores the result in reg1.
268 * If the all the bits in the mask are zero it branches to label.
269 *
270 * It is safe to use the same register for reg1 & reg2.
271 */
272
273.macro TSTBZ reg1, reg2, mask, label
274 ANDI32 \reg1, \reg2, \mask
275 beq \reg1, r0, \label
276.endm
277
278/*
279 * Tests the bits in mask against reg2 stores the result in reg1.
280 * If the any of the bits in the mask are 1 it branches to label.
281 *
282 * It is safe to use the same register for reg1 & reg2.
283 */
284
285.macro TSTBNZ reg1, reg2, mask, label
286 ANDI32 \reg1, \reg2, \mask
287 bne \reg1, r0, \label
288.endm
289
290/*
291 * Pushes reg onto the stack.
292 */
293
294.macro PUSH reg
295 addi sp, sp, -4
296 stw \reg, 0(sp)
297.endm
298
299/*
300 * Pops the top of the stack into reg.
301 */
302
303.macro POP reg
304 ldw \reg, 0(sp)
305 addi sp, sp, 4
306.endm
307
308
309#endif /* _ASM_NIOS2_ASMMACROS_H */
diff --git a/arch/nios2/include/asm/asm-offsets.h b/arch/nios2/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..5b9f5e04a058
--- /dev/null
+++ b/arch/nios2/include/asm/asm-offsets.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#include <generated/asm-offsets.h>
diff --git a/arch/nios2/include/asm/cache.h b/arch/nios2/include/asm/cache.h
new file mode 100644
index 000000000000..2293cf57e307
--- /dev/null
+++ b/arch/nios2/include/asm/cache.h
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2004 Microtronix Datacom Ltd.
3 *
4 * 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, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 */
17
18#ifndef _ASM_NIOS2_CACHE_H
19#define _ASM_NIOS2_CACHE_H
20
21#define NIOS2_DCACHE_SIZE CONFIG_NIOS2_DCACHE_SIZE
22#define NIOS2_ICACHE_SIZE CONFIG_NIOS2_ICACHE_SIZE
23#define NIOS2_DCACHE_LINE_SIZE CONFIG_NIOS2_DCACHE_LINE_SIZE
24#define NIOS2_ICACHE_LINE_SHIFT 5
25#define NIOS2_ICACHE_LINE_SIZE (1 << NIOS2_ICACHE_LINE_SHIFT)
26
27/* bytes per L1 cache line */
28#define L1_CACHE_SHIFT NIOS2_ICACHE_LINE_SHIFT
29#define L1_CACHE_BYTES NIOS2_ICACHE_LINE_SIZE
30
31#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
32
33#define __cacheline_aligned
34#define ____cacheline_aligned
35
36#endif
diff --git a/arch/nios2/include/asm/cacheflush.h b/arch/nios2/include/asm/cacheflush.h
new file mode 100644
index 000000000000..52abba973dc2
--- /dev/null
+++ b/arch/nios2/include/asm/cacheflush.h
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2003 Microtronix Datacom Ltd.
3 * Copyright (C) 2000-2002 Greg Ungerer <gerg@snapgear.com>
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#ifndef _ASM_NIOS2_CACHEFLUSH_H
11#define _ASM_NIOS2_CACHEFLUSH_H
12
13#include <linux/mm_types.h>
14
15/*
16 * This flag is used to indicate that the page pointed to by a pte is clean
17 * and does not require cleaning before returning it to the user.
18 */
19#define PG_dcache_clean PG_arch_1
20
21struct mm_struct;
22
23extern void flush_cache_all(void);
24extern void flush_cache_mm(struct mm_struct *mm);
25extern void flush_cache_dup_mm(struct mm_struct *mm);
26extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
27 unsigned long end);
28extern void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr,
29 unsigned long pfn);
30#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
31extern void flush_dcache_page(struct page *page);
32
33extern void flush_icache_range(unsigned long start, unsigned long end);
34extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
35
36#define flush_cache_vmap(start, end) flush_dcache_range(start, end)
37#define flush_cache_vunmap(start, end) flush_dcache_range(start, end)
38
39extern void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
40 unsigned long user_vaddr,
41 void *dst, void *src, int len);
42extern void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
43 unsigned long user_vaddr,
44 void *dst, void *src, int len);
45
46extern void flush_dcache_range(unsigned long start, unsigned long end);
47extern void invalidate_dcache_range(unsigned long start, unsigned long end);
48
49#define flush_dcache_mmap_lock(mapping) do { } while (0)
50#define flush_dcache_mmap_unlock(mapping) do { } while (0)
51
52#endif /* _ASM_NIOS2_CACHEFLUSH_H */
diff --git a/arch/nios2/include/asm/checksum.h b/arch/nios2/include/asm/checksum.h
new file mode 100644
index 000000000000..6bc1f0d5df7b
--- /dev/null
+++ b/arch/nios2/include/asm/checksum.h
@@ -0,0 +1,78 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#ifndef _ASM_NIOS_CHECKSUM_H
11#define _ASM_NIOS_CHECKSUM_H
12
13/* Take these from lib/checksum.c */
14extern __wsum csum_partial(const void *buff, int len, __wsum sum);
15extern __wsum csum_partial_copy(const void *src, void *dst, int len,
16 __wsum sum);
17extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
18 int len, __wsum sum, int *csum_err);
19#define csum_partial_copy_nocheck(src, dst, len, sum) \
20 csum_partial_copy((src), (dst), (len), (sum))
21
22extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
23extern __sum16 ip_compute_csum(const void *buff, int len);
24
25/*
26 * Fold a partial checksum
27 */
28static inline __sum16 csum_fold(__wsum sum)
29{
30 __asm__ __volatile__(
31 "add %0, %1, %0\n"
32 "cmpltu r8, %0, %1\n"
33 "srli %0, %0, 16\n"
34 "add %0, %0, r8\n"
35 "nor %0, %0, %0\n"
36 : "=r" (sum)
37 : "r" (sum << 16), "0" (sum)
38 : "r8");
39 return (__force __sum16) sum;
40}
41
42/*
43 * computes the checksum of the TCP/UDP pseudo-header
44 * returns a 16-bit checksum, already complemented
45 */
46#define csum_tcpudp_nofold csum_tcpudp_nofold
47static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
48 unsigned short len,
49 unsigned short proto,
50 __wsum sum)
51{
52 __asm__ __volatile__(
53 "add %0, %1, %0\n"
54 "cmpltu r8, %0, %1\n"
55 "add %0, %0, r8\n" /* add carry */
56 "add %0, %2, %0\n"
57 "cmpltu r8, %0, %2\n"
58 "add %0, %0, r8\n" /* add carry */
59 "add %0, %3, %0\n"
60 "cmpltu r8, %0, %3\n"
61 "add %0, %0, r8\n" /* add carry */
62 : "=r" (sum), "=r" (saddr)
63 : "r" (daddr), "r" ((ntohs(len) << 16) + (proto * 256)),
64 "0" (sum),
65 "1" (saddr)
66 : "r8");
67
68 return sum;
69}
70
71static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
72 unsigned short len,
73 unsigned short proto, __wsum sum)
74{
75 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
76}
77
78#endif /* _ASM_NIOS_CHECKSUM_H */
diff --git a/arch/nios2/include/asm/cmpxchg.h b/arch/nios2/include/asm/cmpxchg.h
new file mode 100644
index 000000000000..85938711542d
--- /dev/null
+++ b/arch/nios2/include/asm/cmpxchg.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2004 Microtronix Datacom Ltd.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8
9#ifndef _ASM_NIOS2_CMPXCHG_H
10#define _ASM_NIOS2_CMPXCHG_H
11
12#include <linux/irqflags.h>
13
14#define xchg(ptr, x) \
15 ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
16
17struct __xchg_dummy { unsigned long a[100]; };
18#define __xg(x) ((volatile struct __xchg_dummy *)(x))
19
20static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
21 int size)
22{
23 unsigned long tmp, flags;
24
25 local_irq_save(flags);
26
27 switch (size) {
28 case 1:
29 __asm__ __volatile__(
30 "ldb %0, %2\n"
31 "stb %1, %2\n"
32 : "=&r" (tmp)
33 : "r" (x), "m" (*__xg(ptr))
34 : "memory");
35 break;
36 case 2:
37 __asm__ __volatile__(
38 "ldh %0, %2\n"
39 "sth %1, %2\n"
40 : "=&r" (tmp)
41 : "r" (x), "m" (*__xg(ptr))
42 : "memory");
43 break;
44 case 4:
45 __asm__ __volatile__(
46 "ldw %0, %2\n"
47 "stw %1, %2\n"
48 : "=&r" (tmp)
49 : "r" (x), "m" (*__xg(ptr))
50 : "memory");
51 break;
52 }
53
54 local_irq_restore(flags);
55 return tmp;
56}
57
58#include <asm-generic/cmpxchg.h>
59#include <asm-generic/cmpxchg-local.h>
60
61#endif /* _ASM_NIOS2_CMPXCHG_H */
diff --git a/arch/nios2/include/asm/cpuinfo.h b/arch/nios2/include/asm/cpuinfo.h
new file mode 100644
index 000000000000..e88fcae464d9
--- /dev/null
+++ b/arch/nios2/include/asm/cpuinfo.h
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19#ifndef _ASM_NIOS2_CPUINFO_H
20#define _ASM_NIOS2_CPUINFO_H
21
22#include <linux/types.h>
23
24struct cpuinfo {
25 /* Core CPU configuration */
26 char cpu_impl[12];
27 u32 cpu_clock_freq;
28 u32 mmu;
29 u32 has_div;
30 u32 has_mul;
31 u32 has_mulx;
32
33 /* CPU caches */
34 u32 icache_line_size;
35 u32 icache_size;
36 u32 dcache_line_size;
37 u32 dcache_size;
38
39 /* TLB */
40 u32 tlb_pid_num_bits; /* number of bits used for the PID in TLBMISC */
41 u32 tlb_num_ways;
42 u32 tlb_num_ways_log2;
43 u32 tlb_num_entries;
44 u32 tlb_num_lines;
45 u32 tlb_ptr_sz;
46
47 /* Addresses */
48 u32 reset_addr;
49 u32 exception_addr;
50 u32 fast_tlb_miss_exc_addr;
51};
52
53extern struct cpuinfo cpuinfo;
54
55extern void setup_cpuinfo(void);
56
57#endif /* _ASM_NIOS2_CPUINFO_H */
diff --git a/arch/nios2/include/asm/delay.h b/arch/nios2/include/asm/delay.h
new file mode 100644
index 000000000000..098e49bf3aa3
--- /dev/null
+++ b/arch/nios2/include/asm/delay.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2014 Altera Corporation
3 * Copyright (C) 2004 Microtronix Datacom Ltd
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#ifndef _ASM_NIOS2_DELAY_H
11#define _ASM_NIOS2_DELAY_H
12
13#include <asm-generic/delay.h>
14
15/* Undefined functions to get compile-time errors */
16extern void __bad_udelay(void);
17extern void __bad_ndelay(void);
18
19extern unsigned long loops_per_jiffy;
20
21#endif /* _ASM_NIOS2_DELAY_H */
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
new file mode 100644
index 000000000000..b5567233f7f1
--- /dev/null
+++ b/arch/nios2/include/asm/dma-mapping.h
@@ -0,0 +1,140 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2009 Wind River Systems Inc
4 *
5 * This file is subject to the terms and conditions of the GNU General
6 * Public License. See the file COPYING in the main directory of this
7 * archive for more details.
8 */
9
10#ifndef _ASM_NIOS2_DMA_MAPPING_H
11#define _ASM_NIOS2_DMA_MAPPING_H
12
13#include <linux/scatterlist.h>
14#include <linux/cache.h>
15#include <asm/cacheflush.h>
16
17static inline void __dma_sync_for_device(void *vaddr, size_t size,
18 enum dma_data_direction direction)
19{
20 switch (direction) {
21 case DMA_FROM_DEVICE:
22 invalidate_dcache_range((unsigned long)vaddr,
23 (unsigned long)(vaddr + size));
24 break;
25 case DMA_TO_DEVICE:
26 /*
27 * We just need to flush the caches here , but Nios2 flush
28 * instruction will do both writeback and invalidate.
29 */
30 case DMA_BIDIRECTIONAL: /* flush and invalidate */
31 flush_dcache_range((unsigned long)vaddr,
32 (unsigned long)(vaddr + size));
33 break;
34 default:
35 BUG();
36 }
37}
38
39static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
40 enum dma_data_direction direction)
41{
42 switch (direction) {
43 case DMA_BIDIRECTIONAL:
44 case DMA_FROM_DEVICE:
45 invalidate_dcache_range((unsigned long)vaddr,
46 (unsigned long)(vaddr + size));
47 break;
48 case DMA_TO_DEVICE:
49 break;
50 default:
51 BUG();
52 }
53}
54
55#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
56#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
57
58void *dma_alloc_coherent(struct device *dev, size_t size,
59 dma_addr_t *dma_handle, gfp_t flag);
60
61void dma_free_coherent(struct device *dev, size_t size,
62 void *vaddr, dma_addr_t dma_handle);
63
64static inline dma_addr_t dma_map_single(struct device *dev, void *ptr,
65 size_t size,
66 enum dma_data_direction direction)
67{
68 BUG_ON(!valid_dma_direction(direction));
69 __dma_sync_for_device(ptr, size, direction);
70 return virt_to_phys(ptr);
71}
72
73static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
74 size_t size, enum dma_data_direction direction)
75{
76}
77
78extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
79 enum dma_data_direction direction);
80extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
81 unsigned long offset, size_t size, enum dma_data_direction direction);
82extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
83 size_t size, enum dma_data_direction direction);
84extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
85 int nhwentries, enum dma_data_direction direction);
86extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
87 size_t size, enum dma_data_direction direction);
88extern void dma_sync_single_for_device(struct device *dev,
89 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction);
90extern void dma_sync_single_range_for_cpu(struct device *dev,
91 dma_addr_t dma_handle, unsigned long offset, size_t size,
92 enum dma_data_direction direction);
93extern void dma_sync_single_range_for_device(struct device *dev,
94 dma_addr_t dma_handle, unsigned long offset, size_t size,
95 enum dma_data_direction direction);
96extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
97 int nelems, enum dma_data_direction direction);
98extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
99 int nelems, enum dma_data_direction direction);
100
101static inline int dma_supported(struct device *dev, u64 mask)
102{
103 return 1;
104}
105
106static inline int dma_set_mask(struct device *dev, u64 mask)
107{
108 if (!dev->dma_mask || !dma_supported(dev, mask))
109 return -EIO;
110
111 *dev->dma_mask = mask;
112
113 return 0;
114}
115
116static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
117{
118 return 0;
119}
120
121/*
122* dma_alloc_noncoherent() returns non-cacheable memory, so there's no need to
123* do any flushing here.
124*/
125static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
126 enum dma_data_direction direction)
127{
128}
129
130/* drivers/base/dma-mapping.c */
131extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
132 void *cpu_addr, dma_addr_t dma_addr, size_t size);
133extern int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
134 void *cpu_addr, dma_addr_t dma_addr,
135 size_t size);
136
137#define dma_mmap_coherent(d, v, c, h, s) dma_common_mmap(d, v, c, h, s)
138#define dma_get_sgtable(d, t, v, h, s) dma_common_get_sgtable(d, t, v, h, s)
139
140#endif /* _ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/include/asm/elf.h b/arch/nios2/include/asm/elf.h
new file mode 100644
index 000000000000..b7d655dff731
--- /dev/null
+++ b/arch/nios2/include/asm/elf.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19#ifndef _ASM_NIOS2_ELF_H
20#define _ASM_NIOS2_ELF_H
21
22#include <uapi/asm/elf.h>
23
24/*
25 * This is used to ensure we don't load something for the wrong architecture.
26 */
27#define elf_check_arch(x) ((x)->e_machine == EM_ALTERA_NIOS2)
28
29#define ELF_PLAT_INIT(_r, load_addr)
30
31#define CORE_DUMP_USE_REGSET
32#define ELF_EXEC_PAGESIZE 4096
33
34/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
35 use of this is to invoke "./ld.so someprog" to test out a new version of
36 the loader. We need to make sure that it is out of the way of the program
37 that it will "exec", and that there is sufficient room for the brk. */
38
39#define ELF_ET_DYN_BASE 0xD0000000UL
40
41/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
42 now struct_user_regs, they are different) */
43
44#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
45struct linux_binprm;
46extern int arch_setup_additional_pages(struct linux_binprm *bprm,
47 int uses_interp);
48#define ELF_CORE_COPY_REGS(pr_reg, regs) \
49{ do { \
50 /* Bleech. */ \
51 pr_reg[0] = regs->r8; \
52 pr_reg[1] = regs->r9; \
53 pr_reg[2] = regs->r10; \
54 pr_reg[3] = regs->r11; \
55 pr_reg[4] = regs->r12; \
56 pr_reg[5] = regs->r13; \
57 pr_reg[6] = regs->r14; \
58 pr_reg[7] = regs->r15; \
59 pr_reg[8] = regs->r1; \
60 pr_reg[9] = regs->r2; \
61 pr_reg[10] = regs->r3; \
62 pr_reg[11] = regs->r4; \
63 pr_reg[12] = regs->r5; \
64 pr_reg[13] = regs->r6; \
65 pr_reg[14] = regs->r7; \
66 pr_reg[15] = regs->orig_r2; \
67 pr_reg[16] = regs->ra; \
68 pr_reg[17] = regs->fp; \
69 pr_reg[18] = regs->sp; \
70 pr_reg[19] = regs->gp; \
71 pr_reg[20] = regs->estatus; \
72 pr_reg[21] = regs->ea; \
73 pr_reg[22] = regs->orig_r7; \
74 { \
75 struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
76 pr_reg[23] = sw->r16; \
77 pr_reg[24] = sw->r17; \
78 pr_reg[25] = sw->r18; \
79 pr_reg[26] = sw->r19; \
80 pr_reg[27] = sw->r20; \
81 pr_reg[28] = sw->r21; \
82 pr_reg[29] = sw->r22; \
83 pr_reg[30] = sw->r23; \
84 pr_reg[31] = sw->fp; \
85 pr_reg[32] = sw->gp; \
86 pr_reg[33] = sw->ra; \
87 } \
88} while (0); }
89
90/* This yields a mask that user programs can use to figure out what
91 instruction set this cpu supports. */
92
93#define ELF_HWCAP (0)
94
95/* This yields a string that ld.so will use to load implementation
96 specific libraries for optimization. This is more specific in
97 intent than poking at uname or /proc/cpuinfo. */
98
99#define ELF_PLATFORM (NULL)
100
101#endif /* _ASM_NIOS2_ELF_H */
diff --git a/arch/nios2/include/asm/entry.h b/arch/nios2/include/asm/entry.h
new file mode 100644
index 000000000000..cf37f55efbc2
--- /dev/null
+++ b/arch/nios2/include/asm/entry.h
@@ -0,0 +1,120 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#ifndef _ASM_NIOS2_ENTRY_H
11#define _ASM_NIOS2_ENTRY_H
12
13#ifdef __ASSEMBLY__
14
15#include <asm/processor.h>
16#include <asm/registers.h>
17#include <asm/asm-offsets.h>
18
19/*
20 * Standard Nios2 interrupt entry and exit macros.
21 * Must be called with interrupts disabled.
22 */
23.macro SAVE_ALL
24 rdctl r24, estatus
25 andi r24, r24, ESTATUS_EU
26 beq r24, r0, 1f /* In supervisor mode, already on kernel stack */
27
28 movia r24, _current_thread /* Switch to current kernel stack */
29 ldw r24, 0(r24) /* using the thread_info */
30 addi r24, r24, THREAD_SIZE-PT_REGS_SIZE
31 stw sp, PT_SP(r24) /* Save user stack before changing */
32 mov sp, r24
33 br 2f
34
351 : mov r24, sp
36 addi sp, sp, -PT_REGS_SIZE /* Backup the kernel stack pointer */
37 stw r24, PT_SP(sp)
382 : stw r1, PT_R1(sp)
39 stw r2, PT_R2(sp)
40 stw r3, PT_R3(sp)
41 stw r4, PT_R4(sp)
42 stw r5, PT_R5(sp)
43 stw r6, PT_R6(sp)
44 stw r7, PT_R7(sp)
45 stw r8, PT_R8(sp)
46 stw r9, PT_R9(sp)
47 stw r10, PT_R10(sp)
48 stw r11, PT_R11(sp)
49 stw r12, PT_R12(sp)
50 stw r13, PT_R13(sp)
51 stw r14, PT_R14(sp)
52 stw r15, PT_R15(sp)
53 stw r2, PT_ORIG_R2(sp)
54 stw r7, PT_ORIG_R7(sp)
55
56 stw ra, PT_RA(sp)
57 stw fp, PT_FP(sp)
58 stw gp, PT_GP(sp)
59 rdctl r24, estatus
60 stw r24, PT_ESTATUS(sp)
61 stw ea, PT_EA(sp)
62.endm
63
64.macro RESTORE_ALL
65 ldw r1, PT_R1(sp) /* Restore registers */
66 ldw r2, PT_R2(sp)
67 ldw r3, PT_R3(sp)
68 ldw r4, PT_R4(sp)
69 ldw r5, PT_R5(sp)
70 ldw r6, PT_R6(sp)
71 ldw r7, PT_R7(sp)
72 ldw r8, PT_R8(sp)
73 ldw r9, PT_R9(sp)
74 ldw r10, PT_R10(sp)
75 ldw r11, PT_R11(sp)
76 ldw r12, PT_R12(sp)
77 ldw r13, PT_R13(sp)
78 ldw r14, PT_R14(sp)
79 ldw r15, PT_R15(sp)
80 ldw ra, PT_RA(sp)
81 ldw fp, PT_FP(sp)
82 ldw gp, PT_GP(sp)
83 ldw r24, PT_ESTATUS(sp)
84 wrctl estatus, r24
85 ldw ea, PT_EA(sp)
86 ldw sp, PT_SP(sp) /* Restore sp last */
87.endm
88
89.macro SAVE_SWITCH_STACK
90 addi sp, sp, -SWITCH_STACK_SIZE
91 stw r16, SW_R16(sp)
92 stw r17, SW_R17(sp)
93 stw r18, SW_R18(sp)
94 stw r19, SW_R19(sp)
95 stw r20, SW_R20(sp)
96 stw r21, SW_R21(sp)
97 stw r22, SW_R22(sp)
98 stw r23, SW_R23(sp)
99 stw fp, SW_FP(sp)
100 stw gp, SW_GP(sp)
101 stw ra, SW_RA(sp)
102.endm
103
104.macro RESTORE_SWITCH_STACK
105 ldw r16, SW_R16(sp)
106 ldw r17, SW_R17(sp)
107 ldw r18, SW_R18(sp)
108 ldw r19, SW_R19(sp)
109 ldw r20, SW_R20(sp)
110 ldw r21, SW_R21(sp)
111 ldw r22, SW_R22(sp)
112 ldw r23, SW_R23(sp)
113 ldw fp, SW_FP(sp)
114 ldw gp, SW_GP(sp)
115 ldw ra, SW_RA(sp)
116 addi sp, sp, SWITCH_STACK_SIZE
117.endm
118
119#endif /* __ASSEMBLY__ */
120#endif /* _ASM_NIOS2_ENTRY_H */
diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
new file mode 100644
index 000000000000..9102bfd3fa1c
--- /dev/null
+++ b/arch/nios2/include/asm/io.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2014 Altera Corporation
3 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _ASM_NIOS2_IO_H
12#define _ASM_NIOS2_IO_H
13
14#include <linux/types.h>
15#include <asm/pgtable-bits.h>
16
17/* PCI is not supported in nios2, set this to 0. */
18#define IO_SPACE_LIMIT 0
19
20#define readb_relaxed(addr) readb(addr)
21#define readw_relaxed(addr) readw(addr)
22#define readl_relaxed(addr) readl(addr)
23
24#define writeb_relaxed(x, addr) writeb(x, addr)
25#define writew_relaxed(x, addr) writew(x, addr)
26#define writel_relaxed(x, addr) writel(x, addr)
27
28extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
29 unsigned long cacheflag);
30extern void __iounmap(void __iomem *addr);
31
32static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
33{
34 return __ioremap(physaddr, size, 0);
35}
36
37static inline void __iomem *ioremap_nocache(unsigned long physaddr,
38 unsigned long size)
39{
40 return __ioremap(physaddr, size, 0);
41}
42
43static inline void iounmap(void __iomem *addr)
44{
45 __iounmap(addr);
46}
47
48/* Pages to physical address... */
49#define page_to_phys(page) virt_to_phys(page_to_virt(page))
50#define page_to_bus(page) page_to_virt(page)
51
52/* Macros used for converting between virtual and physical mappings. */
53#define phys_to_virt(vaddr) \
54 ((void *)((unsigned long)(vaddr) | CONFIG_NIOS2_KERNEL_REGION_BASE))
55/* Clear top 3 bits */
56#define virt_to_phys(vaddr) \
57 ((unsigned long)((unsigned long)(vaddr) & ~0xE0000000))
58
59#include <asm-generic/io.h>
60
61#endif /* _ASM_NIOS2_IO_H */
diff --git a/arch/nios2/include/asm/irq.h b/arch/nios2/include/asm/irq.h
new file mode 100644
index 000000000000..8e40fd94a36c
--- /dev/null
+++ b/arch/nios2/include/asm/irq.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#ifndef _ASM_NIOS2_IRQ_H
21#define _ASM_NIOS2_IRQ_H
22
23#define NIOS2_CPU_NR_IRQS 32
24
25#include <asm-generic/irq.h>
26#include <linux/irqdomain.h>
27
28#endif
diff --git a/arch/nios2/include/asm/irqflags.h b/arch/nios2/include/asm/irqflags.h
new file mode 100644
index 000000000000..75ab92e639f8
--- /dev/null
+++ b/arch/nios2/include/asm/irqflags.h
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18#ifndef _ASM_IRQFLAGS_H
19#define _ASM_IRQFLAGS_H
20
21#include <asm/registers.h>
22
23static inline unsigned long arch_local_save_flags(void)
24{
25 return RDCTL(CTL_STATUS);
26}
27
28/*
29 * This will restore ALL status register flags, not only the interrupt
30 * mask flag.
31 */
32static inline void arch_local_irq_restore(unsigned long flags)
33{
34 WRCTL(CTL_STATUS, flags);
35}
36
37static inline void arch_local_irq_disable(void)
38{
39 unsigned long flags;
40
41 flags = arch_local_save_flags();
42 arch_local_irq_restore(flags & ~STATUS_PIE);
43}
44
45static inline void arch_local_irq_enable(void)
46{
47 unsigned long flags;
48
49 flags = arch_local_save_flags();
50 arch_local_irq_restore(flags | STATUS_PIE);
51}
52
53static inline int arch_irqs_disabled_flags(unsigned long flags)
54{
55 return (flags & STATUS_PIE) == 0;
56}
57
58static inline int arch_irqs_disabled(void)
59{
60 return arch_irqs_disabled_flags(arch_local_save_flags());
61}
62
63static inline unsigned long arch_local_irq_save(void)
64{
65 unsigned long flags;
66
67 flags = arch_local_save_flags();
68 arch_local_irq_restore(flags & ~STATUS_PIE);
69 return flags;
70}
71
72#endif /* _ASM_IRQFLAGS_H */
diff --git a/arch/nios2/include/asm/linkage.h b/arch/nios2/include/asm/linkage.h
new file mode 100644
index 000000000000..e0c6decd7d58
--- /dev/null
+++ b/arch/nios2/include/asm/linkage.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
3 *
4 * 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, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 */
17
18#ifndef _ASM_NIOS2_LINKAGE_H
19#define _ASM_NIOS2_LINKAGE_H
20
21/* This file is required by include/linux/linkage.h */
22#define __ALIGN .align 4
23#define __ALIGN_STR ".align 4"
24
25#endif
diff --git a/arch/nios2/include/asm/mmu.h b/arch/nios2/include/asm/mmu.h
new file mode 100644
index 000000000000..d9c0b1010f26
--- /dev/null
+++ b/arch/nios2/include/asm/mmu.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#ifndef _ASM_NIOS2_MMU_H
11#define _ASM_NIOS2_MMU_H
12
13/* Default "unsigned long" context */
14typedef unsigned long mm_context_t;
15
16#endif /* _ASM_NIOS2_MMU_H */
diff --git a/arch/nios2/include/asm/mmu_context.h b/arch/nios2/include/asm/mmu_context.h
new file mode 100644
index 000000000000..294b4b1f81d4
--- /dev/null
+++ b/arch/nios2/include/asm/mmu_context.h
@@ -0,0 +1,66 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle
4 * Copyright (C) 1999 Silicon Graphics, Inc.
5 *
6 * based on MIPS asm/mmu_context.h
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#ifndef _ASM_NIOS2_MMU_CONTEXT_H
14#define _ASM_NIOS2_MMU_CONTEXT_H
15
16#include <asm-generic/mm_hooks.h>
17
18extern void mmu_context_init(void);
19extern unsigned long get_pid_from_context(mm_context_t *ctx);
20
21/*
22 * For the fast tlb miss handlers, we keep a pointer to the current pgd.
23 * processor.
24 */
25extern pgd_t *pgd_current;
26
27static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
28{
29}
30
31/*
32 * Initialize the context related info for a new mm_struct instance.
33 *
34 * Set all new contexts to 0, that way the generation will never match
35 * the currently running generation when this context is switched in.
36 */
37static inline int init_new_context(struct task_struct *tsk,
38 struct mm_struct *mm)
39{
40 mm->context = 0;
41 return 0;
42}
43
44/*
45 * Destroy context related info for an mm_struct that is about
46 * to be put to rest.
47 */
48static inline void destroy_context(struct mm_struct *mm)
49{
50}
51
52void switch_mm(struct mm_struct *prev, struct mm_struct *next,
53 struct task_struct *tsk);
54
55static inline void deactivate_mm(struct task_struct *tsk,
56 struct mm_struct *mm)
57{
58}
59
60/*
61 * After we have set current->mm to a new value, this activates
62 * the context for the new mm so we see the new mappings.
63 */
64void activate_mm(struct mm_struct *prev, struct mm_struct *next);
65
66#endif /* _ASM_NIOS2_MMU_CONTEXT_H */
diff --git a/arch/nios2/include/asm/mutex.h b/arch/nios2/include/asm/mutex.h
new file mode 100644
index 000000000000..ff6101aa2c71
--- /dev/null
+++ b/arch/nios2/include/asm/mutex.h
@@ -0,0 +1 @@
#include <asm-generic/mutex-dec.h>
diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h
new file mode 100644
index 000000000000..4b32d6fd9d98
--- /dev/null
+++ b/arch/nios2/include/asm/page.h
@@ -0,0 +1,109 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd.
4 *
5 * MMU support based on asm/page.h from mips which is:
6 *
7 * Copyright (C) 1994 - 1999, 2000, 03 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14
15#ifndef _ASM_NIOS2_PAGE_H
16#define _ASM_NIOS2_PAGE_H
17
18#include <linux/pfn.h>
19#include <linux/const.h>
20
21/*
22 * PAGE_SHIFT determines the page size
23 */
24#define PAGE_SHIFT 12
25#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
26#define PAGE_MASK (~(PAGE_SIZE - 1))
27
28/*
29 * PAGE_OFFSET -- the first address of the first page of memory.
30 */
31#define PAGE_OFFSET \
32 (CONFIG_NIOS2_MEM_BASE + CONFIG_NIOS2_KERNEL_REGION_BASE)
33
34#ifndef __ASSEMBLY__
35
36/*
37 * This gives the physical RAM offset.
38 */
39#define PHYS_OFFSET CONFIG_NIOS2_MEM_BASE
40
41/*
42 * It's normally defined only for FLATMEM config but it's
43 * used in our early mem init code for all memory models.
44 * So always define it.
45 */
46#define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET)
47
48#define clear_page(page) memset((page), 0, PAGE_SIZE)
49#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
50
51struct page;
52
53extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
54extern void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
55 struct page *to);
56
57/*
58 * These are used to make use of C type-checking.
59 */
60typedef struct page *pgtable_t;
61typedef struct { unsigned long pte; } pte_t;
62typedef struct { unsigned long pgd; } pgd_t;
63typedef struct { unsigned long pgprot; } pgprot_t;
64
65#define pte_val(x) ((x).pte)
66#define pgd_val(x) ((x).pgd)
67#define pgprot_val(x) ((x).pgprot)
68
69#define __pte(x) ((pte_t) { (x) })
70#define __pgd(x) ((pgd_t) { (x) })
71#define __pgprot(x) ((pgprot_t) { (x) })
72
73extern unsigned long memory_start;
74extern unsigned long memory_end;
75extern unsigned long memory_size;
76
77extern struct page *mem_map;
78
79#endif /* !__ASSEMBLY__ */
80
81# define __pa(x) \
82 ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
83# define __va(x) \
84 ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
85
86#define page_to_virt(page) \
87 ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
88
89# define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
90# define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && \
91 (pfn) < max_mapnr)
92
93# define virt_to_page(vaddr) pfn_to_page(PFN_DOWN(virt_to_phys(vaddr)))
94# define virt_addr_valid(vaddr) pfn_valid(PFN_DOWN(virt_to_phys(vaddr)))
95
96# define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
97 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
98
99# define UNCAC_ADDR(addr) \
100 ((void *)((unsigned)(addr) | CONFIG_NIOS2_IO_REGION_BASE))
101# define CAC_ADDR(addr) \
102 ((void *)(((unsigned)(addr) & ~CONFIG_NIOS2_IO_REGION_BASE) | \
103 CONFIG_NIOS2_KERNEL_REGION_BASE))
104
105#include <asm-generic/memory_model.h>
106
107#include <asm-generic/getorder.h>
108
109#endif /* _ASM_NIOS2_PAGE_H */
diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h
new file mode 100644
index 000000000000..6e2985e0a7b9
--- /dev/null
+++ b/arch/nios2/include/asm/pgalloc.h
@@ -0,0 +1,86 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 2001, 2003 by Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9
10#ifndef _ASM_NIOS2_PGALLOC_H
11#define _ASM_NIOS2_PGALLOC_H
12
13#include <linux/mm.h>
14
15static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
16 pte_t *pte)
17{
18 set_pmd(pmd, __pmd((unsigned long)pte));
19}
20
21static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
22 pgtable_t pte)
23{
24 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
25}
26#define pmd_pgtable(pmd) pmd_page(pmd)
27
28/*
29 * Initialize a new pmd table with invalid pointers.
30 */
31extern void pmd_init(unsigned long page, unsigned long pagetable);
32
33extern pgd_t *pgd_alloc(struct mm_struct *mm);
34
35static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
36{
37 free_pages((unsigned long)pgd, PGD_ORDER);
38}
39
40static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
41 unsigned long address)
42{
43 pte_t *pte;
44
45 pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO,
46 PTE_ORDER);
47
48 return pte;
49}
50
51static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
52 unsigned long address)
53{
54 struct page *pte;
55
56 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER);
57 if (pte) {
58 if (!pgtable_page_ctor(pte)) {
59 __free_page(pte);
60 return NULL;
61 }
62 clear_highpage(pte);
63 }
64 return pte;
65}
66
67static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
68{
69 free_pages((unsigned long)pte, PTE_ORDER);
70}
71
72static inline void pte_free(struct mm_struct *mm, struct page *pte)
73{
74 pgtable_page_dtor(pte);
75 __free_pages(pte, PTE_ORDER);
76}
77
78#define __pte_free_tlb(tlb, pte, addr) \
79 do { \
80 pgtable_page_dtor(pte); \
81 tlb_remove_page((tlb), (pte)); \
82 } while (0)
83
84#define check_pgt_cache() do { } while (0)
85
86#endif /* _ASM_NIOS2_PGALLOC_H */
diff --git a/arch/nios2/include/asm/pgtable-bits.h b/arch/nios2/include/asm/pgtable-bits.h
new file mode 100644
index 000000000000..ce9e7069aa96
--- /dev/null
+++ b/arch/nios2/include/asm/pgtable-bits.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2009 Wind River Systems Inc
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#ifndef _ASM_NIOS2_PGTABLE_BITS_H
11#define _ASM_NIOS2_PGTABLE_BITS_H
12
13/*
14 * These are actual hardware defined protection bits in the tlbacc register
15 * which looks like this:
16 *
17 * 31 30 ... 26 25 24 23 22 21 20 19 18 ... 1 0
18 * ignored........ C R W X G PFN............
19 */
20#define _PAGE_GLOBAL (1<<20)
21#define _PAGE_EXEC (1<<21)
22#define _PAGE_WRITE (1<<22)
23#define _PAGE_READ (1<<23)
24#define _PAGE_CACHED (1<<24) /* C: data access cacheable */
25
26/*
27 * Software defined bits. They are ignored by the hardware and always read back
28 * as zero, but can be written as non-zero.
29 */
30#define _PAGE_PRESENT (1<<25) /* PTE contains a translation */
31#define _PAGE_ACCESSED (1<<26) /* page referenced */
32#define _PAGE_DIRTY (1<<27) /* dirty page */
33#define _PAGE_FILE (1<<28) /* PTE used for file mapping or swap */
34
35#endif /* _ASM_NIOS2_PGTABLE_BITS_H */
diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h
new file mode 100644
index 000000000000..ccbaffd47671
--- /dev/null
+++ b/arch/nios2/include/asm/pgtable.h
@@ -0,0 +1,310 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2009 Wind River Systems Inc
4 *
5 * Based on asm/pgtable-32.h from mips which is:
6 *
7 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 2003 Ralf Baechle
8 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14
15#ifndef _ASM_NIOS2_PGTABLE_H
16#define _ASM_NIOS2_PGTABLE_H
17
18#include <linux/io.h>
19#include <linux/bug.h>
20#include <asm/page.h>
21#include <asm/cacheflush.h>
22#include <asm/tlbflush.h>
23
24#include <asm/pgtable-bits.h>
25#include <asm-generic/pgtable-nopmd.h>
26
27#define FIRST_USER_ADDRESS 0
28
29#define VMALLOC_START CONFIG_NIOS2_KERNEL_MMU_REGION_BASE
30#define VMALLOC_END (CONFIG_NIOS2_KERNEL_REGION_BASE - 1)
31
32struct mm_struct;
33
34/* Helper macro */
35#define MKP(x, w, r) __pgprot(_PAGE_PRESENT | _PAGE_CACHED | \
36 ((x) ? _PAGE_EXEC : 0) | \
37 ((r) ? _PAGE_READ : 0) | \
38 ((w) ? _PAGE_WRITE : 0))
39/*
40 * These are the macros that generic kernel code needs
41 * (to populate protection_map[])
42 */
43
44/* Remove W bit on private pages for COW support */
45#define __P000 MKP(0, 0, 0)
46#define __P001 MKP(0, 0, 1)
47#define __P010 MKP(0, 0, 0) /* COW */
48#define __P011 MKP(0, 0, 1) /* COW */
49#define __P100 MKP(1, 0, 0)
50#define __P101 MKP(1, 0, 1)
51#define __P110 MKP(1, 0, 0) /* COW */
52#define __P111 MKP(1, 0, 1) /* COW */
53
54/* Shared pages can have exact HW mapping */
55#define __S000 MKP(0, 0, 0)
56#define __S001 MKP(0, 0, 1)
57#define __S010 MKP(0, 1, 0)
58#define __S011 MKP(0, 1, 1)
59#define __S100 MKP(1, 0, 0)
60#define __S101 MKP(1, 0, 1)
61#define __S110 MKP(1, 1, 0)
62#define __S111 MKP(1, 1, 1)
63
64/* Used all over the kernel */
65#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHED | _PAGE_READ | \
66 _PAGE_WRITE | _PAGE_EXEC | _PAGE_GLOBAL)
67
68#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_CACHED | _PAGE_READ | \
69 _PAGE_WRITE | _PAGE_ACCESSED)
70
71#define PAGE_COPY MKP(0, 0, 1)
72
73#define PGD_ORDER 0
74#define PTE_ORDER 0
75
76#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
77#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
78
79#define USER_PTRS_PER_PGD \
80 (CONFIG_NIOS2_KERNEL_MMU_REGION_BASE / PGDIR_SIZE)
81
82#define PGDIR_SHIFT 22
83#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
84#define PGDIR_MASK (~(PGDIR_SIZE-1))
85
86/*
87 * ZERO_PAGE is a global shared page that is always zero: used
88 * for zero-mapped memory areas etc..
89 */
90extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
91#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
92
93extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
94extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)];
95
96/*
97 * (pmds are folded into puds so this doesn't get actually called,
98 * but the define is needed for a generic inline function.)
99 */
100static inline void set_pmd(pmd_t *pmdptr, pmd_t pmdval)
101{
102 pmdptr->pud.pgd.pgd = pmdval.pud.pgd.pgd;
103}
104
105/* to find an entry in a page-table-directory */
106#define pgd_index(addr) (((addr) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
107#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
108
109static inline int pte_write(pte_t pte) \
110 { return pte_val(pte) & _PAGE_WRITE; }
111static inline int pte_dirty(pte_t pte) \
112 { return pte_val(pte) & _PAGE_DIRTY; }
113static inline int pte_young(pte_t pte) \
114 { return pte_val(pte) & _PAGE_ACCESSED; }
115static inline int pte_file(pte_t pte) \
116 { return pte_val(pte) & _PAGE_FILE; }
117static inline int pte_special(pte_t pte) { return 0; }
118
119#define pgprot_noncached pgprot_noncached
120
121static inline pgprot_t pgprot_noncached(pgprot_t _prot)
122{
123 unsigned long prot = pgprot_val(_prot);
124
125 prot &= ~_PAGE_CACHED;
126
127 return __pgprot(prot);
128}
129
130static inline int pte_none(pte_t pte)
131{
132 return !(pte_val(pte) & ~(_PAGE_GLOBAL|0xf));
133}
134
135static inline int pte_present(pte_t pte) \
136 { return pte_val(pte) & _PAGE_PRESENT; }
137
138/*
139 * The following only work if pte_present() is true.
140 * Undefined behaviour if not..
141 */
142static inline pte_t pte_wrprotect(pte_t pte)
143{
144 pte_val(pte) &= ~_PAGE_WRITE;
145 return pte;
146}
147
148static inline pte_t pte_mkclean(pte_t pte)
149{
150 pte_val(pte) &= ~_PAGE_DIRTY;
151 return pte;
152}
153
154static inline pte_t pte_mkold(pte_t pte)
155{
156 pte_val(pte) &= ~_PAGE_ACCESSED;
157 return pte;
158}
159
160static inline pte_t pte_mkwrite(pte_t pte)
161{
162 pte_val(pte) |= _PAGE_WRITE;
163 return pte;
164}
165
166static inline pte_t pte_mkdirty(pte_t pte)
167{
168 pte_val(pte) |= _PAGE_DIRTY;
169 return pte;
170}
171
172static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
173
174static inline pte_t pte_mkyoung(pte_t pte)
175{
176 pte_val(pte) |= _PAGE_ACCESSED;
177 return pte;
178}
179
180static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
181{
182 const unsigned long mask = _PAGE_READ | _PAGE_WRITE | _PAGE_EXEC;
183
184 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
185 return pte;
186}
187
188static inline int pmd_present(pmd_t pmd)
189{
190 return (pmd_val(pmd) != (unsigned long) invalid_pte_table)
191 && (pmd_val(pmd) != 0UL);
192}
193
194static inline void pmd_clear(pmd_t *pmdp)
195{
196 pmd_val(*pmdp) = (unsigned long) invalid_pte_table;
197}
198
199#define pte_pfn(pte) (pte_val(pte) & 0xfffff)
200#define pfn_pte(pfn, prot) (__pte(pfn | pgprot_val(prot)))
201#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
202
203/*
204 * Store a linux PTE into the linux page table.
205 */
206static inline void set_pte(pte_t *ptep, pte_t pteval)
207{
208 *ptep = pteval;
209}
210
211static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
212 pte_t *ptep, pte_t pteval)
213{
214 unsigned long paddr = page_to_virt(pte_page(pteval));
215
216 flush_dcache_range(paddr, paddr + PAGE_SIZE);
217 set_pte(ptep, pteval);
218}
219
220static inline int pmd_none(pmd_t pmd)
221{
222 return (pmd_val(pmd) ==
223 (unsigned long) invalid_pte_table) || (pmd_val(pmd) == 0UL);
224}
225
226#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK)
227
228static inline void pte_clear(struct mm_struct *mm,
229 unsigned long addr, pte_t *ptep)
230{
231 pte_t null;
232
233 pte_val(null) = (addr >> PAGE_SHIFT) & 0xf;
234
235 set_pte_at(mm, addr, ptep, null);
236 flush_tlb_one(addr);
237}
238
239/*
240 * Conversion functions: convert a page and protection to a page entry,
241 * and a page entry and page directory to the page they refer to.
242 */
243#define mk_pte(page, prot) (pfn_pte(page_to_pfn(page), prot))
244
245#define pte_unmap(pte) do { } while (0)
246
247/*
248 * Conversion functions: convert a page and protection to a page entry,
249 * and a page entry and page directory to the page they refer to.
250 */
251#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
252#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
253#define pmd_page_vaddr(pmd) pmd_val(pmd)
254
255#define pte_offset_map(dir, addr) \
256 ((pte_t *) page_address(pmd_page(*dir)) + \
257 (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
258
259/* to find an entry in a kernel page-table-directory */
260#define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
261
262/* Get the address to the PTE for a vaddr in specific directory */
263#define pte_offset_kernel(dir, addr) \
264 ((pte_t *) pmd_page_vaddr(*(dir)) + \
265 (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
266
267#define pte_ERROR(e) \
268 pr_err("%s:%d: bad pte %08lx.\n", \
269 __FILE__, __LINE__, pte_val(e))
270#define pgd_ERROR(e) \
271 pr_err("%s:%d: bad pgd %08lx.\n", \
272 __FILE__, __LINE__, pgd_val(e))
273
274/*
275 * Encode and decode a swap entry (must be !pte_none(pte) && !pte_present(pte)
276 * && !pte_file(pte)):
277 *
278 * 31 30 29 28 27 26 25 24 23 22 21 20 19 18 ... 1 0
279 * 0 0 0 0 type. 0 0 0 0 0 0 offset.........
280 *
281 * This gives us up to 2**2 = 4 swap files and 2**20 * 4K = 4G per swap file.
282 *
283 * Note that the offset field is always non-zero, thus !pte_none(pte) is always
284 * true.
285 */
286#define __swp_type(swp) (((swp).val >> 26) & 0x3)
287#define __swp_offset(swp) ((swp).val & 0xfffff)
288#define __swp_entry(type, off) ((swp_entry_t) { (((type) & 0x3) << 26) \
289 | ((off) & 0xfffff) })
290#define __swp_entry_to_pte(swp) ((pte_t) { (swp).val })
291#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
292
293/* Encode and decode a nonlinear file mapping entry */
294#define PTE_FILE_MAX_BITS 25
295#define pte_to_pgoff(pte) (pte_val(pte) & 0x1ffffff)
296#define pgoff_to_pte(off) __pte(((off) & 0x1ffffff) | _PAGE_FILE)
297
298#define kern_addr_valid(addr) (1)
299
300#include <asm-generic/pgtable.h>
301
302#define pgtable_cache_init() do { } while (0)
303
304extern void __init paging_init(void);
305extern void __init mmu_init(void);
306
307extern void update_mmu_cache(struct vm_area_struct *vma,
308 unsigned long address, pte_t *pte);
309
310#endif /* _ASM_NIOS2_PGTABLE_H */
diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h
new file mode 100644
index 000000000000..3bd349473b06
--- /dev/null
+++ b/arch/nios2/include/asm/processor.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2004 Microtronix Datacom Ltd
5 * Copyright (C) 2001 Ken Hill (khill@microtronix.com)
6 * Vic Phillips (vic@microtronix.com)
7 *
8 * based on SPARC asm/processor_32.h which is:
9 *
10 * Copyright (C) 1994 David S. Miller
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file "COPYING" in the main directory of this archive
14 * for more details.
15 */
16
17#ifndef _ASM_NIOS2_PROCESSOR_H
18#define _ASM_NIOS2_PROCESSOR_H
19
20#include <asm/ptrace.h>
21#include <asm/registers.h>
22#include <asm/page.h>
23
24#define NIOS2_FLAG_KTHREAD 0x00000001 /* task is a kernel thread */
25
26#define NIOS2_OP_NOP 0x1883a
27#define NIOS2_OP_BREAK 0x3da03a
28
29#ifdef __KERNEL__
30
31#define STACK_TOP TASK_SIZE
32#define STACK_TOP_MAX STACK_TOP
33
34#endif /* __KERNEL__ */
35
36/* Kuser helpers is mapped to this user space address */
37#define KUSER_BASE 0x1000
38#define KUSER_SIZE (PAGE_SIZE)
39#ifndef __ASSEMBLY__
40
41/*
42 * Default implementation of macro that returns current
43 * instruction pointer ("program counter").
44 */
45#define current_text_addr() ({ __label__ _l; _l: &&_l; })
46
47# define TASK_SIZE 0x7FFF0000UL
48# define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
49
50/* The Nios processor specific thread struct. */
51struct thread_struct {
52 struct pt_regs *kregs;
53
54 /* Context switch saved kernel state. */
55 unsigned long ksp;
56 unsigned long kpsr;
57};
58
59#define INIT_MMAP \
60 { &init_mm, (0), (0), __pgprot(0x0), VM_READ | VM_WRITE | VM_EXEC }
61
62# define INIT_THREAD { \
63 .kregs = NULL, \
64 .ksp = 0, \
65 .kpsr = 0, \
66}
67
68extern void start_thread(struct pt_regs *regs, unsigned long pc,
69 unsigned long sp);
70
71struct task_struct;
72
73/* Free all resources held by a thread. */
74static inline void release_thread(struct task_struct *dead_task)
75{
76}
77
78/* Free current thread data structures etc.. */
79static inline void exit_thread(void)
80{
81}
82
83/* Return saved PC of a blocked thread. */
84#define thread_saved_pc(tsk) ((tsk)->thread.kregs->ea)
85
86extern unsigned long get_wchan(struct task_struct *p);
87
88/* Prepare to copy thread state - unlazy all lazy status */
89#define prepare_to_copy(tsk) do { } while (0)
90
91#define task_pt_regs(p) \
92 ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
93
94/* Used by procfs */
95#define KSTK_EIP(tsk) ((tsk)->thread.kregs->ea)
96#define KSTK_ESP(tsk) ((tsk)->thread.kregs->sp)
97
98#define cpu_relax() barrier()
99#define cpu_relax_lowlatency() cpu_relax()
100
101#endif /* __ASSEMBLY__ */
102
103#endif /* _ASM_NIOS2_PROCESSOR_H */
diff --git a/arch/nios2/include/asm/ptrace.h b/arch/nios2/include/asm/ptrace.h
new file mode 100644
index 000000000000..20fb1cf2dab6
--- /dev/null
+++ b/arch/nios2/include/asm/ptrace.h
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2004 Microtronix Datacom Ltd
5 *
6 * based on m68k asm/processor.h
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#ifndef _ASM_NIOS2_PTRACE_H
14#define _ASM_NIOS2_PTRACE_H
15
16#include <uapi/asm/ptrace.h>
17
18#ifndef __ASSEMBLY__
19#define user_mode(regs) (((regs)->estatus & ESTATUS_EU))
20
21#define instruction_pointer(regs) ((regs)->ra)
22#define profile_pc(regs) instruction_pointer(regs)
23#define user_stack_pointer(regs) ((regs)->sp)
24extern void show_regs(struct pt_regs *);
25
26#define current_pt_regs() \
27 ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE)\
28 - 1)
29
30int do_syscall_trace_enter(void);
31void do_syscall_trace_exit(void);
32#endif /* __ASSEMBLY__ */
33#endif /* _ASM_NIOS2_PTRACE_H */
diff --git a/arch/nios2/include/asm/registers.h b/arch/nios2/include/asm/registers.h
new file mode 100644
index 000000000000..615bce19b546
--- /dev/null
+++ b/arch/nios2/include/asm/registers.h
@@ -0,0 +1,71 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19#ifndef _ASM_NIOS2_REGISTERS_H
20#define _ASM_NIOS2_REGISTERS_H
21
22#ifndef __ASSEMBLY__
23#include <asm/cpuinfo.h>
24#endif
25
26/* control register numbers */
27#define CTL_STATUS 0
28#define CTL_ESTATUS 1
29#define CTL_BSTATUS 2
30#define CTL_IENABLE 3
31#define CTL_IPENDING 4
32#define CTL_CPUID 5
33#define CTL_RSV1 6
34#define CTL_EXCEPTION 7
35#define CTL_PTEADDR 8
36#define CTL_TLBACC 9
37#define CTL_TLBMISC 10
38#define CTL_RSV2 11
39#define CTL_BADADDR 12
40#define CTL_CONFIG 13
41#define CTL_MPUBASE 14
42#define CTL_MPUACC 15
43
44/* access control registers using GCC builtins */
45#define RDCTL(r) __builtin_rdctl(r)
46#define WRCTL(r, v) __builtin_wrctl(r, v)
47
48/* status register bits */
49#define STATUS_PIE (1 << 0) /* processor interrupt enable */
50#define STATUS_U (1 << 1) /* user mode */
51#define STATUS_EH (1 << 2) /* Exception mode */
52
53/* estatus register bits */
54#define ESTATUS_EPIE (1 << 0) /* processor interrupt enable */
55#define ESTATUS_EU (1 << 1) /* user mode */
56#define ESTATUS_EH (1 << 2) /* Exception mode */
57
58/* tlbmisc register bits */
59#define TLBMISC_PID_SHIFT 4
60#ifndef __ASSEMBLY__
61#define TLBMISC_PID_MASK ((1UL << cpuinfo.tlb_pid_num_bits) - 1)
62#endif
63#define TLBMISC_WAY_MASK 0xf
64#define TLBMISC_WAY_SHIFT 20
65
66#define TLBMISC_PID (TLBMISC_PID_MASK << TLBMISC_PID_SHIFT) /* TLB PID */
67#define TLBMISC_WE (1 << 18) /* TLB write enable */
68#define TLBMISC_RD (1 << 19) /* TLB read */
69#define TLBMISC_WAY (TLBMISC_WAY_MASK << TLBMISC_WAY_SHIFT) /* TLB way */
70
71#endif /* _ASM_NIOS2_REGISTERS_H */
diff --git a/arch/nios2/include/asm/setup.h b/arch/nios2/include/asm/setup.h
new file mode 100644
index 000000000000..dcbf8cf1a344
--- /dev/null
+++ b/arch/nios2/include/asm/setup.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19#ifndef _ASM_NIOS2_SETUP_H
20#define _ASM_NIOS2_SETUP_H
21
22#include <asm-generic/setup.h>
23
24#ifndef __ASSEMBLY__
25#ifdef __KERNEL__
26
27extern char exception_handler_hook[];
28extern char fast_handler[];
29extern char fast_handler_end[];
30
31extern void pagetable_init(void);
32
33extern void setup_early_printk(void);
34
35#endif/* __KERNEL__ */
36#endif /* __ASSEMBLY__ */
37
38#endif /* _ASM_NIOS2_SETUP_H */
diff --git a/arch/nios2/include/asm/signal.h b/arch/nios2/include/asm/signal.h
new file mode 100644
index 000000000000..bbcf11eecb01
--- /dev/null
+++ b/arch/nios2/include/asm/signal.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright Altera Corporation (C) 2013. All rights reserved
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17#ifndef _NIOS2_SIGNAL_H
18#define _NIOS2_SIGNAL_H
19
20#include <uapi/asm/signal.h>
21
22#endif /* _NIOS2_SIGNAL_H */
diff --git a/arch/nios2/include/asm/string.h b/arch/nios2/include/asm/string.h
new file mode 100644
index 000000000000..14dd570d64f7
--- /dev/null
+++ b/arch/nios2/include/asm/string.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2004 Microtronix Datacom Ltd
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8
9#ifndef _ASM_NIOS2_STRING_H
10#define _ASM_NIOS2_STRING_H
11
12#ifdef __KERNEL__
13
14#define __HAVE_ARCH_MEMSET
15#define __HAVE_ARCH_MEMCPY
16#define __HAVE_ARCH_MEMMOVE
17
18extern void *memset(void *s, int c, size_t count);
19extern void *memcpy(void *d, const void *s, size_t count);
20extern void *memmove(void *d, const void *s, size_t count);
21
22#endif /* __KERNEL__ */
23
24#endif /* _ASM_NIOS2_STRING_H */
diff --git a/arch/nios2/include/asm/switch_to.h b/arch/nios2/include/asm/switch_to.h
new file mode 100644
index 000000000000..c47b3f4afbcd
--- /dev/null
+++ b/arch/nios2/include/asm/switch_to.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2004 Microtronix Datacom Ltd.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8#ifndef _ASM_NIOS2_SWITCH_TO_H
9#define _ASM_NIOS2_SWITCH_TO_H
10
11/*
12 * switch_to(n) should switch tasks to task ptr, first checking that
13 * ptr isn't the current task, in which case it does nothing. This
14 * also clears the TS-flag if the task we switched to has used the
15 * math co-processor latest.
16 */
17#define switch_to(prev, next, last) \
18{ \
19 void *_last; \
20 __asm__ __volatile__ ( \
21 "mov r4, %1\n" \
22 "mov r5, %2\n" \
23 "call resume\n" \
24 "mov %0,r4\n" \
25 : "=r" (_last) \
26 : "r" (prev), "r" (next) \
27 : "r4", "r5", "r7", "r8", "ra"); \
28 (last) = _last; \
29}
30
31#endif /* _ASM_NIOS2_SWITCH_TO_H */
diff --git a/arch/nios2/include/asm/syscall.h b/arch/nios2/include/asm/syscall.h
new file mode 100644
index 000000000000..9de220854c4a
--- /dev/null
+++ b/arch/nios2/include/asm/syscall.h
@@ -0,0 +1,138 @@
1/*
2 * Copyright Altera Corporation (C) <2014>. All rights reserved
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __ASM_NIOS2_SYSCALL_H__
18#define __ASM_NIOS2_SYSCALL_H__
19
20#include <linux/err.h>
21#include <linux/sched.h>
22
23static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
24{
25 return regs->r2;
26}
27
28static inline void syscall_rollback(struct task_struct *task,
29 struct pt_regs *regs)
30{
31 regs->r2 = regs->orig_r2;
32 regs->r7 = regs->orig_r7;
33}
34
35static inline long syscall_get_error(struct task_struct *task,
36 struct pt_regs *regs)
37{
38 return regs->r7 ? regs->r2 : 0;
39}
40
41static inline long syscall_get_return_value(struct task_struct *task,
42 struct pt_regs *regs)
43{
44 return regs->r2;
45}
46
47static inline void syscall_set_return_value(struct task_struct *task,
48 struct pt_regs *regs, int error, long val)
49{
50 if (error) {
51 /* error < 0, but nios2 uses > 0 return value */
52 regs->r2 = -error;
53 regs->r7 = 1;
54 } else {
55 regs->r2 = val;
56 regs->r7 = 0;
57 }
58}
59
60static inline void syscall_get_arguments(struct task_struct *task,
61 struct pt_regs *regs, unsigned int i, unsigned int n,
62 unsigned long *args)
63{
64 BUG_ON(i + n > 6);
65
66 switch (i) {
67 case 0:
68 if (!n--)
69 break;
70 *args++ = regs->r4;
71 case 1:
72 if (!n--)
73 break;
74 *args++ = regs->r5;
75 case 2:
76 if (!n--)
77 break;
78 *args++ = regs->r6;
79 case 3:
80 if (!n--)
81 break;
82 *args++ = regs->r7;
83 case 4:
84 if (!n--)
85 break;
86 *args++ = regs->r8;
87 case 5:
88 if (!n--)
89 break;
90 *args++ = regs->r9;
91 case 6:
92 if (!n--)
93 break;
94 default:
95 BUG();
96 }
97}
98
99static inline void syscall_set_arguments(struct task_struct *task,
100 struct pt_regs *regs, unsigned int i, unsigned int n,
101 const unsigned long *args)
102{
103 BUG_ON(i + n > 6);
104
105 switch (i) {
106 case 0:
107 if (!n--)
108 break;
109 regs->r4 = *args++;
110 case 1:
111 if (!n--)
112 break;
113 regs->r5 = *args++;
114 case 2:
115 if (!n--)
116 break;
117 regs->r6 = *args++;
118 case 3:
119 if (!n--)
120 break;
121 regs->r7 = *args++;
122 case 4:
123 if (!n--)
124 break;
125 regs->r8 = *args++;
126 case 5:
127 if (!n--)
128 break;
129 regs->r9 = *args++;
130 case 6:
131 if (!n)
132 break;
133 default:
134 BUG();
135 }
136}
137
138#endif
diff --git a/arch/nios2/include/asm/syscalls.h b/arch/nios2/include/asm/syscalls.h
new file mode 100644
index 000000000000..0245d780351b
--- /dev/null
+++ b/arch/nios2/include/asm/syscalls.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright Altera Corporation (C) 2013. All rights reserved
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17#ifndef __ASM_NIOS2_SYSCALLS_H
18#define __ASM_NIOS2_SYSCALLS_H
19
20int sys_cacheflush(unsigned long addr, unsigned long len,
21 unsigned int op);
22
23#include <asm-generic/syscalls.h>
24
25#endif /* __ASM_NIOS2_SYSCALLS_H */
diff --git a/arch/nios2/include/asm/thread_info.h b/arch/nios2/include/asm/thread_info.h
new file mode 100644
index 000000000000..1f266575beb5
--- /dev/null
+++ b/arch/nios2/include/asm/thread_info.h
@@ -0,0 +1,120 @@
1/*
2 * NiosII low-level thread information
3 *
4 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
5 * Copyright (C) 2004 Microtronix Datacom Ltd.
6 *
7 * Based on asm/thread_info_no.h from m68k which is:
8 *
9 * Copyright (C) 2002 David Howells <dhowells@redhat.com>
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15
16#ifndef _ASM_NIOS2_THREAD_INFO_H
17#define _ASM_NIOS2_THREAD_INFO_H
18
19#ifdef __KERNEL__
20
21/*
22 * Size of the kernel stack for each process.
23 */
24#define THREAD_SIZE_ORDER 1
25#define THREAD_SIZE 8192 /* 2 * PAGE_SIZE */
26
27#ifndef __ASSEMBLY__
28
29typedef struct {
30 unsigned long seg;
31} mm_segment_t;
32
33/*
34 * low level task data that entry.S needs immediate access to
35 * - this struct should fit entirely inside of one cache line
36 * - this struct shares the supervisor stack pages
37 * - if the contents of this structure are changed, the assembly constants
38 * must also be changed
39 */
40struct thread_info {
41 struct task_struct *task; /* main task structure */
42 struct exec_domain *exec_domain; /* execution domain */
43 unsigned long flags; /* low level flags */
44 __u32 cpu; /* current CPU */
45 int preempt_count; /* 0 => preemptable,<0 => BUG */
46 mm_segment_t addr_limit; /* thread address space:
47 0-0x7FFFFFFF for user-thead
48 0-0xFFFFFFFF for kernel-thread
49 */
50 struct restart_block restart_block;
51 struct pt_regs *regs;
52};
53
54/*
55 * macros/functions for gaining access to the thread information structure
56 *
57 * preempt_count needs to be 1 initially, until the scheduler is functional.
58 */
59#define INIT_THREAD_INFO(tsk) \
60{ \
61 .task = &tsk, \
62 .exec_domain = &default_exec_domain, \
63 .flags = 0, \
64 .cpu = 0, \
65 .preempt_count = INIT_PREEMPT_COUNT, \
66 .addr_limit = KERNEL_DS, \
67 .restart_block = { \
68 .fn = do_no_restart_syscall, \
69 }, \
70}
71
72#define init_thread_info (init_thread_union.thread_info)
73#define init_stack (init_thread_union.stack)
74
75/* how to get the thread information struct from C */
76static inline struct thread_info *current_thread_info(void)
77{
78 register unsigned long sp asm("sp");
79
80 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
81}
82#endif /* !__ASSEMBLY__ */
83
84/*
85 * thread information flags
86 * - these are process state flags that various assembly files may need to
87 * access
88 * - pending work-to-be-done flags are in LSW
89 * - other flags in MSW
90 */
91#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
92#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
93#define TIF_SIGPENDING 2 /* signal pending */
94#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
95#define TIF_MEMDIE 4 /* is terminating due to OOM killer */
96#define TIF_SECCOMP 5 /* secure computing */
97#define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */
98#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
99
100#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling
101 TIF_NEED_RESCHED */
102
103#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
104#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
105#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
106#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
107#define _TIF_SECCOMP (1 << TIF_SECCOMP)
108#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
109#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
110#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
111
112/* work to do on interrupt/exception return */
113#define _TIF_WORK_MASK 0x0000FFFE
114
115/* work to do on any return to u-space */
116# define _TIF_ALLWORK_MASK 0x0000FFFF
117
118#endif /* __KERNEL__ */
119
120#endif /* _ASM_NIOS2_THREAD_INFO_H */
diff --git a/arch/nios2/include/asm/timex.h b/arch/nios2/include/asm/timex.h
new file mode 100644
index 000000000000..2f2abb28ec2f
--- /dev/null
+++ b/arch/nios2/include/asm/timex.h
@@ -0,0 +1,24 @@
1/* Copyright Altera Corporation (C) 2014. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License, version 2,
5 * as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *
15 */
16
17#ifndef _ASM_NIOS2_TIMEX_H
18#define _ASM_NIOS2_TIMEX_H
19
20typedef unsigned long cycles_t;
21
22extern cycles_t get_cycles(void);
23
24#endif
diff --git a/arch/nios2/include/asm/tlb.h b/arch/nios2/include/asm/tlb.h
new file mode 100644
index 000000000000..d3bc648e08b5
--- /dev/null
+++ b/arch/nios2/include/asm/tlb.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2009 Wind River Systems Inc
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _ASM_NIOS2_TLB_H
12#define _ASM_NIOS2_TLB_H
13
14#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
15
16extern void set_mmu_pid(unsigned long pid);
17
18/*
19 * NiosII doesn't need any special per-pte or per-vma handling, except
20 * we need to flush cache for the area to be unmapped.
21 */
22#define tlb_start_vma(tlb, vma) \
23 do { \
24 if (!tlb->fullmm) \
25 flush_cache_range(vma, vma->vm_start, vma->vm_end); \
26 } while (0)
27
28#define tlb_end_vma(tlb, vma) do { } while (0)
29#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
30
31#include <linux/pagemap.h>
32#include <asm-generic/tlb.h>
33
34#endif /* _ASM_NIOS2_TLB_H */
diff --git a/arch/nios2/include/asm/tlbflush.h b/arch/nios2/include/asm/tlbflush.h
new file mode 100644
index 000000000000..e19652fca1c6
--- /dev/null
+++ b/arch/nios2/include/asm/tlbflush.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19#ifndef _ASM_NIOS2_TLBFLUSH_H
20#define _ASM_NIOS2_TLBFLUSH_H
21
22struct mm_struct;
23
24/*
25 * TLB flushing:
26 *
27 * - flush_tlb_all() flushes all processes TLB entries
28 * - flush_tlb_mm(mm) flushes the specified mm context TLB entries
29 * - flush_tlb_page(vma, vmaddr) flushes one page
30 * - flush_tlb_range(vma, start, end) flushes a range of pages
31 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
32 */
33extern void flush_tlb_all(void);
34extern void flush_tlb_mm(struct mm_struct *mm);
35extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
36 unsigned long end);
37extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
38extern void flush_tlb_one(unsigned long vaddr);
39
40static inline void flush_tlb_page(struct vm_area_struct *vma,
41 unsigned long addr)
42{
43 flush_tlb_one(addr);
44}
45
46#endif /* _ASM_NIOS2_TLBFLUSH_H */
diff --git a/arch/nios2/include/asm/traps.h b/arch/nios2/include/asm/traps.h
new file mode 100644
index 000000000000..82a48473280d
--- /dev/null
+++ b/arch/nios2/include/asm/traps.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#ifndef _ASM_NIOS2_TRAPS_H
11#define _ASM_NIOS2_TRAPS_H
12
13#define TRAP_ID_SYSCALL 0
14
15#ifndef __ASSEMBLY__
16void _exception(int signo, struct pt_regs *regs, int code, unsigned long addr);
17#endif
18
19#endif /* _ASM_NIOS2_TRAPS_H */
diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h
new file mode 100644
index 000000000000..acedc0a2860e
--- /dev/null
+++ b/arch/nios2/include/asm/uaccess.h
@@ -0,0 +1,231 @@
1/*
2 * User space memory access functions for Nios II
3 *
4 * Copyright (C) 2010-2011, Tobias Klauser <tklauser@distanz.ch>
5 * Copyright (C) 2009, Wind River Systems Inc
6 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#ifndef _ASM_NIOS2_UACCESS_H
14#define _ASM_NIOS2_UACCESS_H
15
16#include <linux/errno.h>
17#include <linux/thread_info.h>
18#include <linux/string.h>
19
20#include <asm/page.h>
21
22#define VERIFY_READ 0
23#define VERIFY_WRITE 1
24
25/*
26 * The exception table consists of pairs of addresses: the first is the
27 * address of an instruction that is allowed to fault, and the second is
28 * the address at which the program should continue. No registers are
29 * modified, so it is entirely up to the continuation code to figure out
30 * what to do.
31 *
32 * All the routines below use bits of fixup code that are out of line
33 * with the main instruction path. This means when everything is well,
34 * we don't even have to jump over them. Further, they do not intrude
35 * on our cache or tlb entries.
36 */
37struct exception_table_entry {
38 unsigned long insn;
39 unsigned long fixup;
40};
41
42extern int fixup_exception(struct pt_regs *regs);
43
44/*
45 * Segment stuff
46 */
47#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
48#define USER_DS MAKE_MM_SEG(0x80000000UL)
49#define KERNEL_DS MAKE_MM_SEG(0)
50
51#define get_ds() (KERNEL_DS)
52
53#define get_fs() (current_thread_info()->addr_limit)
54#define set_fs(seg) (current_thread_info()->addr_limit = (seg))
55
56#define segment_eq(a, b) ((a).seg == (b).seg)
57
58#define __access_ok(addr, len) \
59 (((signed long)(((long)get_fs().seg) & \
60 ((long)(addr) | (((long)(addr)) + (len)) | (len)))) == 0)
61
62#define access_ok(type, addr, len) \
63 likely(__access_ok((unsigned long)(addr), (unsigned long)(len)))
64
65# define __EX_TABLE_SECTION ".section __ex_table,\"a\"\n"
66
67/*
68 * Zero Userspace
69 */
70
71static inline unsigned long __must_check __clear_user(void __user *to,
72 unsigned long n)
73{
74 __asm__ __volatile__ (
75 "1: stb zero, 0(%1)\n"
76 " addi %0, %0, -1\n"
77 " addi %1, %1, 1\n"
78 " bne %0, zero, 1b\n"
79 "2:\n"
80 __EX_TABLE_SECTION
81 ".word 1b, 2b\n"
82 ".previous\n"
83 : "=r" (n), "=r" (to)
84 : "0" (n), "1" (to)
85 );
86
87 return n;
88}
89
90static inline unsigned long __must_check clear_user(void __user *to,
91 unsigned long n)
92{
93 if (!access_ok(VERIFY_WRITE, to, n))
94 return n;
95 return __clear_user(to, n);
96}
97
98extern long __copy_from_user(void *to, const void __user *from,
99 unsigned long n);
100extern long __copy_to_user(void __user *to, const void *from, unsigned long n);
101
102static inline long copy_from_user(void *to, const void __user *from,
103 unsigned long n)
104{
105 if (!access_ok(VERIFY_READ, from, n))
106 return n;
107 return __copy_from_user(to, from, n);
108}
109
110static inline long copy_to_user(void __user *to, const void *from,
111 unsigned long n)
112{
113 if (!access_ok(VERIFY_WRITE, to, n))
114 return n;
115 return __copy_to_user(to, from, n);
116}
117
118extern long strncpy_from_user(char *__to, const char __user *__from,
119 long __len);
120extern long strnlen_user(const char __user *s, long n);
121
122#define __copy_from_user_inatomic __copy_from_user
123#define __copy_to_user_inatomic __copy_to_user
124
125/* Optimized macros */
126#define __get_user_asm(val, insn, addr, err) \
127{ \
128 __asm__ __volatile__( \
129 " movi %0, %3\n" \
130 "1: " insn " %1, 0(%2)\n" \
131 " movi %0, 0\n" \
132 "2:\n" \
133 " .section __ex_table,\"a\"\n" \
134 " .word 1b, 2b\n" \
135 " .previous" \
136 : "=&r" (err), "=r" (val) \
137 : "r" (addr), "i" (-EFAULT)); \
138}
139
140#define __get_user_unknown(val, size, ptr, err) do { \
141 err = 0; \
142 if (copy_from_user(&(val), ptr, size)) { \
143 err = -EFAULT; \
144 } \
145 } while (0)
146
147#define __get_user_common(val, size, ptr, err) \
148do { \
149 switch (size) { \
150 case 1: \
151 __get_user_asm(val, "ldbu", ptr, err); \
152 break; \
153 case 2: \
154 __get_user_asm(val, "ldhu", ptr, err); \
155 break; \
156 case 4: \
157 __get_user_asm(val, "ldw", ptr, err); \
158 break; \
159 default: \
160 __get_user_unknown(val, size, ptr, err); \
161 break; \
162 } \
163} while (0)
164
165#define __get_user(x, ptr) \
166 ({ \
167 long __gu_err = -EFAULT; \
168 const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \
169 unsigned long __gu_val; \
170 __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\
171 (x) = (__typeof__(x))__gu_val; \
172 __gu_err; \
173 })
174
175#define get_user(x, ptr) \
176({ \
177 long __gu_err = -EFAULT; \
178 const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \
179 unsigned long __gu_val = 0; \
180 if (access_ok(VERIFY_READ, __gu_ptr, sizeof(*__gu_ptr))) \
181 __get_user_common(__gu_val, sizeof(*__gu_ptr), \
182 __gu_ptr, __gu_err); \
183 (x) = (__typeof__(x))__gu_val; \
184 __gu_err; \
185})
186
187#define __put_user_asm(val, insn, ptr, err) \
188{ \
189 __asm__ __volatile__( \
190 " movi %0, %3\n" \
191 "1: " insn " %1, 0(%2)\n" \
192 " movi %0, 0\n" \
193 "2:\n" \
194 " .section __ex_table,\"a\"\n" \
195 " .word 1b, 2b\n" \
196 " .previous\n" \
197 : "=&r" (err) \
198 : "r" (val), "r" (ptr), "i" (-EFAULT)); \
199}
200
201#define put_user(x, ptr) \
202({ \
203 long __pu_err = -EFAULT; \
204 __typeof__(*(ptr)) __user *__pu_ptr = (ptr); \
205 __typeof__(*(ptr)) __pu_val = (__typeof(*ptr))(x); \
206 if (access_ok(VERIFY_WRITE, __pu_ptr, sizeof(*__pu_ptr))) { \
207 switch (sizeof(*__pu_ptr)) { \
208 case 1: \
209 __put_user_asm(__pu_val, "stb", __pu_ptr, __pu_err); \
210 break; \
211 case 2: \
212 __put_user_asm(__pu_val, "sth", __pu_ptr, __pu_err); \
213 break; \
214 case 4: \
215 __put_user_asm(__pu_val, "stw", __pu_ptr, __pu_err); \
216 break; \
217 default: \
218 /* XXX: This looks wrong... */ \
219 __pu_err = 0; \
220 if (copy_to_user(__pu_ptr, &(__pu_val), \
221 sizeof(*__pu_ptr))) \
222 __pu_err = -EFAULT; \
223 break; \
224 } \
225 } \
226 __pu_err; \
227})
228
229#define __put_user(x, ptr) put_user(x, ptr)
230
231#endif /* _ASM_NIOS2_UACCESS_H */
diff --git a/arch/nios2/include/asm/ucontext.h b/arch/nios2/include/asm/ucontext.h
new file mode 100644
index 000000000000..2c87614b0f6e
--- /dev/null
+++ b/arch/nios2/include/asm/ucontext.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#ifndef _ASM_NIOS2_UCONTEXT_H
11#define _ASM_NIOS2_UCONTEXT_H
12
13typedef int greg_t;
14#define NGREG 32
15typedef greg_t gregset_t[NGREG];
16
17struct mcontext {
18 int version;
19 gregset_t gregs;
20};
21
22#define MCONTEXT_VERSION 2
23
24struct ucontext {
25 unsigned long uc_flags;
26 struct ucontext *uc_link;
27 stack_t uc_stack;
28 struct mcontext uc_mcontext;
29 sigset_t uc_sigmask; /* mask last for extensibility */
30};
31
32#endif
diff --git a/arch/nios2/include/uapi/asm/Kbuild b/arch/nios2/include/uapi/asm/Kbuild
new file mode 100644
index 000000000000..4f07ca3f8d10
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -0,0 +1,4 @@
1include include/uapi/asm-generic/Kbuild.asm
2
3header-y += elf.h
4header-y += ucontext.h
diff --git a/arch/nios2/include/uapi/asm/byteorder.h b/arch/nios2/include/uapi/asm/byteorder.h
new file mode 100644
index 000000000000..3ab5dc20d757
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/byteorder.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
3 * Copyright (C) 2004 Microtronix Datacom Ltd
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _ASM_NIOS2_BYTEORDER_H
18#define _ASM_NIOS2_BYTEORDER_H
19
20#include <linux/byteorder/little_endian.h>
21
22#endif
diff --git a/arch/nios2/include/uapi/asm/elf.h b/arch/nios2/include/uapi/asm/elf.h
new file mode 100644
index 000000000000..a5b91ae5cf56
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/elf.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19
20#ifndef _UAPI_ASM_NIOS2_ELF_H
21#define _UAPI_ASM_NIOS2_ELF_H
22
23#include <linux/ptrace.h>
24
25/* Relocation types */
26#define R_NIOS2_NONE 0
27#define R_NIOS2_S16 1
28#define R_NIOS2_U16 2
29#define R_NIOS2_PCREL16 3
30#define R_NIOS2_CALL26 4
31#define R_NIOS2_IMM5 5
32#define R_NIOS2_CACHE_OPX 6
33#define R_NIOS2_IMM6 7
34#define R_NIOS2_IMM8 8
35#define R_NIOS2_HI16 9
36#define R_NIOS2_LO16 10
37#define R_NIOS2_HIADJ16 11
38#define R_NIOS2_BFD_RELOC_32 12
39#define R_NIOS2_BFD_RELOC_16 13
40#define R_NIOS2_BFD_RELOC_8 14
41#define R_NIOS2_GPREL 15
42#define R_NIOS2_GNU_VTINHERIT 16
43#define R_NIOS2_GNU_VTENTRY 17
44#define R_NIOS2_UJMP 18
45#define R_NIOS2_CJMP 19
46#define R_NIOS2_CALLR 20
47#define R_NIOS2_ALIGN 21
48/* Keep this the last entry. */
49#define R_NIOS2_NUM 22
50
51typedef unsigned long elf_greg_t;
52
53#define ELF_NGREG \
54 ((sizeof(struct pt_regs) + sizeof(struct switch_stack)) / \
55 sizeof(elf_greg_t))
56typedef elf_greg_t elf_gregset_t[ELF_NGREG];
57
58typedef unsigned long elf_fpregset_t;
59
60/*
61 * These are used to set parameters in the core dumps.
62 */
63#define ELF_CLASS ELFCLASS32
64#define ELF_DATA ELFDATA2LSB
65#define ELF_ARCH EM_ALTERA_NIOS2
66
67#endif /* _UAPI_ASM_NIOS2_ELF_H */
diff --git a/arch/nios2/include/uapi/asm/ptrace.h b/arch/nios2/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000000..e83a7c9d1c36
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/ptrace.h
@@ -0,0 +1,120 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd
4 *
5 * based on m68k asm/processor.h
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#ifndef _UAPI_ASM_NIOS2_PTRACE_H
13#define _UAPI_ASM_NIOS2_PTRACE_H
14
15#ifndef __ASSEMBLY__
16
17/*
18 * Register numbers used by 'ptrace' system call interface.
19 */
20
21/* GP registers */
22#define PTR_R0 0
23#define PTR_R1 1
24#define PTR_R2 2
25#define PTR_R3 3
26#define PTR_R4 4
27#define PTR_R5 5
28#define PTR_R6 6
29#define PTR_R7 7
30#define PTR_R8 8
31#define PTR_R9 9
32#define PTR_R10 10
33#define PTR_R11 11
34#define PTR_R12 12
35#define PTR_R13 13
36#define PTR_R14 14
37#define PTR_R15 15
38#define PTR_R16 16
39#define PTR_R17 17
40#define PTR_R18 18
41#define PTR_R19 19
42#define PTR_R20 20
43#define PTR_R21 21
44#define PTR_R22 22
45#define PTR_R23 23
46#define PTR_R24 24
47#define PTR_R25 25
48#define PTR_GP 26
49#define PTR_SP 27
50#define PTR_FP 28
51#define PTR_EA 29
52#define PTR_BA 30
53#define PTR_RA 31
54/* Control registers */
55#define PTR_PC 32
56#define PTR_STATUS 33
57#define PTR_ESTATUS 34
58#define PTR_BSTATUS 35
59#define PTR_IENABLE 36
60#define PTR_IPENDING 37
61#define PTR_CPUID 38
62#define PTR_CTL6 39
63#define PTR_CTL7 40
64#define PTR_PTEADDR 41
65#define PTR_TLBACC 42
66#define PTR_TLBMISC 43
67
68#define NUM_PTRACE_REG (PTR_TLBMISC + 1)
69
70/* this struct defines the way the registers are stored on the
71 stack during a system call.
72
73 There is a fake_regs in setup.c that has to match pt_regs.*/
74
75struct pt_regs {
76 unsigned long r8; /* r8-r15 Caller-saved GP registers */
77 unsigned long r9;
78 unsigned long r10;
79 unsigned long r11;
80 unsigned long r12;
81 unsigned long r13;
82 unsigned long r14;
83 unsigned long r15;
84 unsigned long r1; /* Assembler temporary */
85 unsigned long r2; /* Retval LS 32bits */
86 unsigned long r3; /* Retval MS 32bits */
87 unsigned long r4; /* r4-r7 Register arguments */
88 unsigned long r5;
89 unsigned long r6;
90 unsigned long r7;
91 unsigned long orig_r2; /* Copy of r2 ?? */
92 unsigned long ra; /* Return address */
93 unsigned long fp; /* Frame pointer */
94 unsigned long sp; /* Stack pointer */
95 unsigned long gp; /* Global pointer */
96 unsigned long estatus;
97 unsigned long ea; /* Exception return address (pc) */
98 unsigned long orig_r7;
99};
100
101/*
102 * This is the extended stack used by signal handlers and the context
103 * switcher: it's pushed after the normal "struct pt_regs".
104 */
105struct switch_stack {
106 unsigned long r16; /* r16-r23 Callee-saved GP registers */
107 unsigned long r17;
108 unsigned long r18;
109 unsigned long r19;
110 unsigned long r20;
111 unsigned long r21;
112 unsigned long r22;
113 unsigned long r23;
114 unsigned long fp;
115 unsigned long gp;
116 unsigned long ra;
117};
118
119#endif /* __ASSEMBLY__ */
120#endif /* _UAPI_ASM_NIOS2_PTRACE_H */
diff --git a/arch/nios2/include/uapi/asm/sigcontext.h b/arch/nios2/include/uapi/asm/sigcontext.h
new file mode 100644
index 000000000000..7b8bb41867d4
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/sigcontext.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2004, Microtronix Datacom Ltd.
3 *
4 * 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, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 */
17
18#ifndef _ASM_NIOS2_SIGCONTEXT_H
19#define _ASM_NIOS2_SIGCONTEXT_H
20
21#include <asm/ptrace.h>
22
23struct sigcontext {
24 struct pt_regs regs;
25 unsigned long sc_mask; /* old sigmask */
26};
27
28#endif
diff --git a/arch/nios2/include/uapi/asm/signal.h b/arch/nios2/include/uapi/asm/signal.h
new file mode 100644
index 000000000000..f29ee6314481
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/signal.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright Altera Corporation (C) 2013. All rights reserved
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17#ifndef _ASM_NIOS2_SIGNAL_H
18#define _ASM_NIOS2_SIGNAL_H
19
20#define SA_RESTORER 0x04000000
21#include <asm-generic/signal.h>
22
23#endif /* _ASM_NIOS2_SIGNAL_H */
diff --git a/arch/nios2/include/uapi/asm/swab.h b/arch/nios2/include/uapi/asm/swab.h
new file mode 100644
index 000000000000..b4e22ebaeb17
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/swab.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2012 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2011 Pyramid Technical Consultants, Inc.
4 *
5 * This file is subject to the terms and conditions of the GNU General
6 * Public License. See the file COPYING in the main directory of this
7 * archive for more details.
8 */
9
10#ifndef _ASM_NIOS2_SWAB_H
11#define _ASM_NIOS2_SWAB_H
12
13#include <linux/types.h>
14#include <asm-generic/swab.h>
15
16#ifdef CONFIG_NIOS2_CI_SWAB_SUPPORT
17#ifdef __GNUC__
18
19#define __nios2_swab(x) \
20 __builtin_custom_ini(CONFIG_NIOS2_CI_SWAB_NO, (x))
21
22static inline __attribute__((const)) __u16 __arch_swab16(__u16 x)
23{
24 return (__u16) __nios2_swab(((__u32) x) << 16);
25}
26#define __arch_swab16 __arch_swab16
27
28static inline __attribute__((const)) __u32 __arch_swab32(__u32 x)
29{
30 return (__u32) __nios2_swab(x);
31}
32#define __arch_swab32 __arch_swab32
33
34#endif /* __GNUC__ */
35#endif /* CONFIG_NIOS2_CI_SWAB_SUPPORT */
36
37#endif /* _ASM_NIOS2_SWAB_H */
diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h
new file mode 100644
index 000000000000..c4bf79510461
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/unistd.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18 #define sys_mmap2 sys_mmap_pgoff
19
20/* Use the standard ABI for syscalls */
21#include <asm-generic/unistd.h>
22
23/* Additional Nios II specific syscalls. */
24#define __NR_cacheflush (__NR_arch_specific_syscall)
25__SYSCALL(__NR_cacheflush, sys_cacheflush)
diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
new file mode 100644
index 000000000000..8ae76823ff93
--- /dev/null
+++ b/arch/nios2/kernel/Makefile
@@ -0,0 +1,24 @@
1#
2# Makefile for the nios2 linux kernel.
3#
4
5extra-y += head.o
6extra-y += vmlinux.lds
7
8obj-y += cpuinfo.o
9obj-y += entry.o
10obj-y += insnemu.o
11obj-y += irq.o
12obj-y += nios2_ksyms.o
13obj-y += process.o
14obj-y += prom.o
15obj-y += ptrace.o
16obj-y += setup.o
17obj-y += signal.o
18obj-y += sys_nios2.o
19obj-y += syscall_table.o
20obj-y += time.o
21obj-y += traps.o
22
23obj-$(CONFIG_MODULES) += module.o
24obj-$(CONFIG_NIOS2_ALIGNMENT_TRAP) += misaligned.o
diff --git a/arch/nios2/kernel/asm-offsets.c b/arch/nios2/kernel/asm-offsets.c
new file mode 100644
index 000000000000..c3ee73c18b71
--- /dev/null
+++ b/arch/nios2/kernel/asm-offsets.c
@@ -0,0 +1,87 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19#include <linux/stddef.h>
20#include <linux/sched.h>
21#include <linux/kernel_stat.h>
22#include <linux/ptrace.h>
23#include <linux/hardirq.h>
24#include <linux/thread_info.h>
25#include <linux/kbuild.h>
26
27int main(void)
28{
29 /* struct task_struct */
30 OFFSET(TASK_THREAD, task_struct, thread);
31 BLANK();
32
33 /* struct thread_struct */
34 OFFSET(THREAD_KSP, thread_struct, ksp);
35 OFFSET(THREAD_KPSR, thread_struct, kpsr);
36 BLANK();
37
38 /* struct pt_regs */
39 OFFSET(PT_ORIG_R2, pt_regs, orig_r2);
40 OFFSET(PT_ORIG_R7, pt_regs, orig_r7);
41
42 OFFSET(PT_R1, pt_regs, r1);
43 OFFSET(PT_R2, pt_regs, r2);
44 OFFSET(PT_R3, pt_regs, r3);
45 OFFSET(PT_R4, pt_regs, r4);
46 OFFSET(PT_R5, pt_regs, r5);
47 OFFSET(PT_R6, pt_regs, r6);
48 OFFSET(PT_R7, pt_regs, r7);
49 OFFSET(PT_R8, pt_regs, r8);
50 OFFSET(PT_R9, pt_regs, r9);
51 OFFSET(PT_R10, pt_regs, r10);
52 OFFSET(PT_R11, pt_regs, r11);
53 OFFSET(PT_R12, pt_regs, r12);
54 OFFSET(PT_R13, pt_regs, r13);
55 OFFSET(PT_R14, pt_regs, r14);
56 OFFSET(PT_R15, pt_regs, r15);
57 OFFSET(PT_EA, pt_regs, ea);
58 OFFSET(PT_RA, pt_regs, ra);
59 OFFSET(PT_FP, pt_regs, fp);
60 OFFSET(PT_SP, pt_regs, sp);
61 OFFSET(PT_GP, pt_regs, gp);
62 OFFSET(PT_ESTATUS, pt_regs, estatus);
63 DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
64 BLANK();
65
66 /* struct switch_stack */
67 OFFSET(SW_R16, switch_stack, r16);
68 OFFSET(SW_R17, switch_stack, r17);
69 OFFSET(SW_R18, switch_stack, r18);
70 OFFSET(SW_R19, switch_stack, r19);
71 OFFSET(SW_R20, switch_stack, r20);
72 OFFSET(SW_R21, switch_stack, r21);
73 OFFSET(SW_R22, switch_stack, r22);
74 OFFSET(SW_R23, switch_stack, r23);
75 OFFSET(SW_FP, switch_stack, fp);
76 OFFSET(SW_GP, switch_stack, gp);
77 OFFSET(SW_RA, switch_stack, ra);
78 DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack));
79 BLANK();
80
81 /* struct thread_info */
82 OFFSET(TI_FLAGS, thread_info, flags);
83 OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count);
84 BLANK();
85
86 return 0;
87}
diff --git a/arch/nios2/kernel/cpuinfo.c b/arch/nios2/kernel/cpuinfo.c
new file mode 100644
index 000000000000..51d5bb90d3e5
--- /dev/null
+++ b/arch/nios2/kernel/cpuinfo.c
@@ -0,0 +1,197 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
4 *
5 * Based on cpuinfo.c from microblaze
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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/delay.h>
25#include <linux/seq_file.h>
26#include <linux/string.h>
27#include <linux/of.h>
28#include <asm/cpuinfo.h>
29
30struct cpuinfo cpuinfo;
31
32#define err_cpu(x) \
33 pr_err("ERROR: Nios II " x " different for kernel and DTS\n")
34
35static inline u32 fcpu(struct device_node *cpu, const char *n)
36{
37 u32 val = 0;
38
39 of_property_read_u32(cpu, n, &val);
40
41 return val;
42}
43
44static inline u32 fcpu_has(struct device_node *cpu, const char *n)
45{
46 return of_get_property(cpu, n, NULL) ? 1 : 0;
47}
48
49void __init setup_cpuinfo(void)
50{
51 struct device_node *cpu;
52 const char *str;
53 int len;
54
55 cpu = of_find_node_by_type(NULL, "cpu");
56 if (!cpu)
57 panic("%s: No CPU found in devicetree!\n", __func__);
58
59 if (!fcpu_has(cpu, "altr,has-initda"))
60 panic("initda instruction is unimplemented. Please update your "
61 "hardware system to have more than 4-byte line data "
62 "cache\n");
63
64 cpuinfo.cpu_clock_freq = fcpu(cpu, "clock-frequency");
65
66 str = of_get_property(cpu, "altr,implementation", &len);
67 if (str)
68 strlcpy(cpuinfo.cpu_impl, str, sizeof(cpuinfo.cpu_impl));
69 else
70 strcpy(cpuinfo.cpu_impl, "<unknown>");
71
72 cpuinfo.has_div = fcpu_has(cpu, "altr,has-div");
73 cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul");
74 cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx");
75
76 if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div)
77 err_cpu("DIV");
78
79 if (IS_ENABLED(CONFIG_NIOS2_HW_MUL_SUPPORT) && !cpuinfo.has_mul)
80 err_cpu("MUL");
81
82 if (IS_ENABLED(CONFIG_NIOS2_HW_MULX_SUPPORT) && !cpuinfo.has_mulx)
83 err_cpu("MULX");
84
85 cpuinfo.tlb_num_ways = fcpu(cpu, "altr,tlb-num-ways");
86 if (!cpuinfo.tlb_num_ways)
87 panic("altr,tlb-num-ways can't be 0. Please check your hardware "
88 "system\n");
89 cpuinfo.icache_line_size = fcpu(cpu, "icache-line-size");
90 cpuinfo.icache_size = fcpu(cpu, "icache-size");
91 if (CONFIG_NIOS2_ICACHE_SIZE != cpuinfo.icache_size)
92 pr_warn("Warning: icache size configuration mismatch "
93 "(0x%x vs 0x%x) of CONFIG_NIOS2_ICACHE_SIZE vs "
94 "device tree icache-size\n",
95 CONFIG_NIOS2_ICACHE_SIZE, cpuinfo.icache_size);
96
97 cpuinfo.dcache_line_size = fcpu(cpu, "dcache-line-size");
98 if (CONFIG_NIOS2_DCACHE_LINE_SIZE != cpuinfo.dcache_line_size)
99 pr_warn("Warning: dcache line size configuration mismatch "
100 "(0x%x vs 0x%x) of CONFIG_NIOS2_DCACHE_LINE_SIZE vs "
101 "device tree dcache-line-size\n",
102 CONFIG_NIOS2_DCACHE_LINE_SIZE, cpuinfo.dcache_line_size);
103 cpuinfo.dcache_size = fcpu(cpu, "dcache-size");
104 if (CONFIG_NIOS2_DCACHE_SIZE != cpuinfo.dcache_size)
105 pr_warn("Warning: dcache size configuration mismatch "
106 "(0x%x vs 0x%x) of CONFIG_NIOS2_DCACHE_SIZE vs "
107 "device tree dcache-size\n",
108 CONFIG_NIOS2_DCACHE_SIZE, cpuinfo.dcache_size);
109
110 cpuinfo.tlb_pid_num_bits = fcpu(cpu, "altr,pid-num-bits");
111 cpuinfo.tlb_num_ways_log2 = ilog2(cpuinfo.tlb_num_ways);
112 cpuinfo.tlb_num_entries = fcpu(cpu, "altr,tlb-num-entries");
113 cpuinfo.tlb_num_lines = cpuinfo.tlb_num_entries / cpuinfo.tlb_num_ways;
114 cpuinfo.tlb_ptr_sz = fcpu(cpu, "altr,tlb-ptr-sz");
115
116 cpuinfo.reset_addr = fcpu(cpu, "altr,reset-addr");
117 cpuinfo.exception_addr = fcpu(cpu, "altr,exception-addr");
118 cpuinfo.fast_tlb_miss_exc_addr = fcpu(cpu, "altr,fast-tlb-miss-addr");
119}
120
121#ifdef CONFIG_PROC_FS
122
123/*
124 * Get CPU information for use by the procfs.
125 */
126static int show_cpuinfo(struct seq_file *m, void *v)
127{
128 int count = 0;
129 const u32 clockfreq = cpuinfo.cpu_clock_freq;
130
131 count = seq_printf(m,
132 "CPU:\t\tNios II/%s\n"
133 "MMU:\t\t%s\n"
134 "FPU:\t\tnone\n"
135 "Clocking:\t%u.%02u MHz\n"
136 "BogoMips:\t%lu.%02lu\n"
137 "Calibration:\t%lu loops\n",
138 cpuinfo.cpu_impl,
139 cpuinfo.mmu ? "present" : "none",
140 clockfreq / 1000000, (clockfreq / 100000) % 10,
141 (loops_per_jiffy * HZ) / 500000,
142 ((loops_per_jiffy * HZ) / 5000) % 100,
143 (loops_per_jiffy * HZ));
144
145 count += seq_printf(m,
146 "HW:\n"
147 " MUL:\t\t%s\n"
148 " MULX:\t\t%s\n"
149 " DIV:\t\t%s\n",
150 cpuinfo.has_mul ? "yes" : "no",
151 cpuinfo.has_mulx ? "yes" : "no",
152 cpuinfo.has_div ? "yes" : "no");
153
154 count += seq_printf(m,
155 "Icache:\t\t%ukB, line length: %u\n",
156 cpuinfo.icache_size >> 10,
157 cpuinfo.icache_line_size);
158
159 count += seq_printf(m,
160 "Dcache:\t\t%ukB, line length: %u\n",
161 cpuinfo.dcache_size >> 10,
162 cpuinfo.dcache_line_size);
163
164 count += seq_printf(m,
165 "TLB:\t\t%u ways, %u entries, %u PID bits\n",
166 cpuinfo.tlb_num_ways,
167 cpuinfo.tlb_num_entries,
168 cpuinfo.tlb_pid_num_bits);
169
170 return 0;
171}
172
173static void *cpuinfo_start(struct seq_file *m, loff_t *pos)
174{
175 unsigned long i = *pos;
176
177 return i < num_possible_cpus() ? (void *) (i + 1) : NULL;
178}
179
180static void *cpuinfo_next(struct seq_file *m, void *v, loff_t *pos)
181{
182 ++*pos;
183 return cpuinfo_start(m, pos);
184}
185
186static void cpuinfo_stop(struct seq_file *m, void *v)
187{
188}
189
190const struct seq_operations cpuinfo_op = {
191 .start = cpuinfo_start,
192 .next = cpuinfo_next,
193 .stop = cpuinfo_stop,
194 .show = show_cpuinfo
195};
196
197#endif /* CONFIG_PROC_FS */
diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
new file mode 100644
index 000000000000..83bca17d1008
--- /dev/null
+++ b/arch/nios2/kernel/entry.S
@@ -0,0 +1,555 @@
1/*
2 * linux/arch/nios2/kernel/entry.S
3 *
4 * Copyright (C) 2013-2014 Altera Corporation
5 * Copyright (C) 2009, Wind River Systems Inc
6 *
7 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
8 *
9 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
10 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
11 * Kenneth Albanowski <kjahds@kjahds.com>,
12 * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
13 * Copyright (C) 2004 Microtronix Datacom Ltd.
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 *
19 * Linux/m68k support by Hamish Macdonald
20 *
21 * 68060 fixes by Jesper Skov
22 * ColdFire support by Greg Ungerer (gerg@snapgear.com)
23 * 5307 fixes by David W. Miller
24 * linux 2.4 support David McCullough <davidm@snapgear.com>
25 */
26
27#include <linux/sys.h>
28#include <linux/linkage.h>
29#include <asm/asm-offsets.h>
30#include <asm/asm-macros.h>
31#include <asm/thread_info.h>
32#include <asm/errno.h>
33#include <asm/setup.h>
34#include <asm/entry.h>
35#include <asm/unistd.h>
36#include <asm/processor.h>
37
38.macro GET_THREAD_INFO reg
39.if THREAD_SIZE & 0xffff0000
40 andhi \reg, sp, %hi(~(THREAD_SIZE-1))
41.else
42 addi \reg, r0, %lo(~(THREAD_SIZE-1))
43 and \reg, \reg, sp
44.endif
45.endm
46
47.macro kuser_cmpxchg_check
48 /*
49 * Make sure our user space atomic helper is restarted if it was
50 * interrupted in a critical region.
51 * ea-4 = address of interrupted insn (ea must be preserved).
52 * sp = saved regs.
53 * cmpxchg_ldw = first critical insn, cmpxchg_stw = last critical insn.
54 * If ea <= cmpxchg_stw and ea > cmpxchg_ldw then saved EA is set to
55 * cmpxchg_ldw + 4.
56 */
57 /* et = cmpxchg_stw + 4 */
58 movui et, (KUSER_BASE + 4 + (cmpxchg_stw - __kuser_helper_start))
59 bgtu ea, et, 1f
60
61 subi et, et, (cmpxchg_stw - cmpxchg_ldw) /* et = cmpxchg_ldw + 4 */
62 bltu ea, et, 1f
63 stw et, PT_EA(sp) /* fix up EA */
64 mov ea, et
651:
66.endm
67
68.section .rodata
69.align 4
70exception_table:
71 .word unhandled_exception /* 0 - Reset */
72 .word unhandled_exception /* 1 - Processor-only Reset */
73 .word external_interrupt /* 2 - Interrupt */
74 .word handle_trap /* 3 - Trap Instruction */
75
76 .word instruction_trap /* 4 - Unimplemented instruction */
77 .word handle_illegal /* 5 - Illegal instruction */
78 .word handle_unaligned /* 6 - Misaligned data access */
79 .word handle_unaligned /* 7 - Misaligned destination address */
80
81 .word handle_diverror /* 8 - Division error */
82 .word protection_exception_ba /* 9 - Supervisor-only instr. address */
83 .word protection_exception_instr /* 10 - Supervisor only instruction */
84 .word protection_exception_ba /* 11 - Supervisor only data address */
85
86 .word unhandled_exception /* 12 - Double TLB miss (data) */
87 .word protection_exception_pte /* 13 - TLB permission violation (x) */
88 .word protection_exception_pte /* 14 - TLB permission violation (r) */
89 .word protection_exception_pte /* 15 - TLB permission violation (w) */
90
91 .word unhandled_exception /* 16 - MPU region violation */
92
93trap_table:
94 .word handle_system_call /* 0 */
95 .word instruction_trap /* 1 */
96 .word instruction_trap /* 2 */
97 .word instruction_trap /* 3 */
98 .word instruction_trap /* 4 */
99 .word instruction_trap /* 5 */
100 .word instruction_trap /* 6 */
101 .word instruction_trap /* 7 */
102 .word instruction_trap /* 8 */
103 .word instruction_trap /* 9 */
104 .word instruction_trap /* 10 */
105 .word instruction_trap /* 11 */
106 .word instruction_trap /* 12 */
107 .word instruction_trap /* 13 */
108 .word instruction_trap /* 14 */
109 .word instruction_trap /* 15 */
110 .word instruction_trap /* 16 */
111 .word instruction_trap /* 17 */
112 .word instruction_trap /* 18 */
113 .word instruction_trap /* 19 */
114 .word instruction_trap /* 20 */
115 .word instruction_trap /* 21 */
116 .word instruction_trap /* 22 */
117 .word instruction_trap /* 23 */
118 .word instruction_trap /* 24 */
119 .word instruction_trap /* 25 */
120 .word instruction_trap /* 26 */
121 .word instruction_trap /* 27 */
122 .word instruction_trap /* 28 */
123 .word instruction_trap /* 29 */
124 .word instruction_trap /* 30 */
125 .word handle_breakpoint /* 31 */
126
127.text
128.set noat
129.set nobreak
130
131ENTRY(inthandler)
132 SAVE_ALL
133
134 kuser_cmpxchg_check
135
136 /* Clear EH bit before we get a new excpetion in the kernel
137 * and after we have saved it to the exception frame. This is done
138 * whether it's trap, tlb-miss or interrupt. If we don't do this
139 * estatus is not updated the next exception.
140 */
141 rdctl r24, status
142 movi r9, %lo(~STATUS_EH)
143 and r24, r24, r9
144 wrctl status, r24
145
146 /* Read cause and vector and branch to the associated handler */
147 mov r4, sp
148 rdctl r5, exception
149 movia r9, exception_table
150 add r24, r9, r5
151 ldw r24, 0(r24)
152 jmp r24
153
154
155/***********************************************************************
156 * Handle traps
157 ***********************************************************************
158 */
159ENTRY(handle_trap)
160 ldw r24, -4(ea) /* instruction that caused the exception */
161 srli r24, r24, 4
162 andi r24, r24, 0x7c
163 movia r9,trap_table
164 add r24, r24, r9
165 ldw r24, 0(r24)
166 jmp r24
167
168
169/***********************************************************************
170 * Handle system calls
171 ***********************************************************************
172 */
173ENTRY(handle_system_call)
174 /* Enable interrupts */
175 rdctl r10, status
176 ori r10, r10, STATUS_PIE
177 wrctl status, r10
178
179 /* Reload registers destroyed by common code. */
180 ldw r4, PT_R4(sp)
181 ldw r5, PT_R5(sp)
182
183local_restart:
184 /* Check that the requested system call is within limits */
185 movui r1, __NR_syscalls
186 bgeu r2, r1, ret_invsyscall
187 slli r1, r2, 2
188 movhi r11, %hiadj(sys_call_table)
189 add r1, r1, r11
190 ldw r1, %lo(sys_call_table)(r1)
191 beq r1, r0, ret_invsyscall
192
193 /* Check if we are being traced */
194 GET_THREAD_INFO r11
195 ldw r11,TI_FLAGS(r11)
196 BTBNZ r11,r11,TIF_SYSCALL_TRACE,traced_system_call
197
198 /* Execute the system call */
199 callr r1
200
201 /* If the syscall returns a negative result:
202 * Set r7 to 1 to indicate error,
203 * Negate r2 to get a positive error code
204 * If the syscall returns zero or a positive value:
205 * Set r7 to 0.
206 * The sigreturn system calls will skip the code below by
207 * adding to register ra. To avoid destroying registers
208 */
209translate_rc_and_ret:
210 movi r1, 0
211 bge r2, zero, 3f
212 sub r2, zero, r2
213 movi r1, 1
2143:
215 stw r2, PT_R2(sp)
216 stw r1, PT_R7(sp)
217end_translate_rc_and_ret:
218
219ret_from_exception:
220 ldw r1, PT_ESTATUS(sp)
221 /* if so, skip resched, signals */
222 TSTBNZ r1, r1, ESTATUS_EU, Luser_return
223
224restore_all:
225 rdctl r10, status /* disable intrs */
226 andi r10, r10, %lo(~STATUS_PIE)
227 wrctl status, r10
228 RESTORE_ALL
229 eret
230
231 /* If the syscall number was invalid return ENOSYS */
232ret_invsyscall:
233 movi r2, -ENOSYS
234 br translate_rc_and_ret
235
236 /* This implements the same as above, except it calls
237 * do_syscall_trace_enter and do_syscall_trace_exit before and after the
238 * syscall in order for utilities like strace and gdb to work.
239 */
240traced_system_call:
241 SAVE_SWITCH_STACK
242 call do_syscall_trace_enter
243 RESTORE_SWITCH_STACK
244
245 /* Create system call register arguments. The 5th and 6th
246 arguments on stack are already in place at the beginning
247 of pt_regs. */
248 ldw r2, PT_R2(sp)
249 ldw r4, PT_R4(sp)
250 ldw r5, PT_R5(sp)
251 ldw r6, PT_R6(sp)
252 ldw r7, PT_R7(sp)
253
254 /* Fetch the syscall function, we don't need to check the boundaries
255 * since this is already done.
256 */
257 slli r1, r2, 2
258 movhi r11,%hiadj(sys_call_table)
259 add r1, r1, r11
260 ldw r1, %lo(sys_call_table)(r1)
261
262 callr r1
263
264 /* If the syscall returns a negative result:
265 * Set r7 to 1 to indicate error,
266 * Negate r2 to get a positive error code
267 * If the syscall returns zero or a positive value:
268 * Set r7 to 0.
269 * The sigreturn system calls will skip the code below by
270 * adding to register ra. To avoid destroying registers
271 */
272translate_rc_and_ret2:
273 movi r1, 0
274 bge r2, zero, 4f
275 sub r2, zero, r2
276 movi r1, 1
2774:
278 stw r2, PT_R2(sp)
279 stw r1, PT_R7(sp)
280end_translate_rc_and_ret2:
281 SAVE_SWITCH_STACK
282 call do_syscall_trace_exit
283 RESTORE_SWITCH_STACK
284 br ret_from_exception
285
286Luser_return:
287 GET_THREAD_INFO r11 /* get thread_info pointer */
288 ldw r10, TI_FLAGS(r11) /* get thread_info->flags */
289 ANDI32 r11, r10, _TIF_WORK_MASK
290 beq r11, r0, restore_all /* Nothing to do */
291 BTBZ r1, r10, TIF_NEED_RESCHED, Lsignal_return
292
293 /* Reschedule work */
294 call schedule
295 br ret_from_exception
296
297Lsignal_return:
298 ANDI32 r1, r10, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME
299 beq r1, r0, restore_all
300 mov r4, sp /* pt_regs */
301 SAVE_SWITCH_STACK
302 call do_notify_resume
303 beq r2, r0, no_work_pending
304 RESTORE_SWITCH_STACK
305 /* prepare restart syscall here without leaving kernel */
306 ldw r2, PT_R2(sp) /* reload syscall number in r2 */
307 ldw r4, PT_R4(sp) /* reload syscall arguments r4-r9 */
308 ldw r5, PT_R5(sp)
309 ldw r6, PT_R6(sp)
310 ldw r7, PT_R7(sp)
311 ldw r8, PT_R8(sp)
312 ldw r9, PT_R9(sp)
313 br local_restart /* restart syscall */
314
315no_work_pending:
316 RESTORE_SWITCH_STACK
317 br ret_from_exception
318
319/***********************************************************************
320 * Handle external interrupts.
321 ***********************************************************************
322 */
323/*
324 * This is the generic interrupt handler (for all hardware interrupt
325 * sources). It figures out the vector number and calls the appropriate
326 * interrupt service routine directly.
327 */
328external_interrupt:
329 rdctl r12, ipending
330 rdctl r9, ienable
331 and r12, r12, r9
332 /* skip if no interrupt is pending */
333 beq r12, r0, ret_from_interrupt
334
335 movi r24, -1
336 stw r24, PT_ORIG_R2(sp)
337
338 /*
339 * Process an external hardware interrupt.
340 */
341
342 addi ea, ea, -4 /* re-issue the interrupted instruction */
343 stw ea, PT_EA(sp)
3442: movi r4, %lo(-1) /* Start from bit position 0,
345 highest priority */
346 /* This is the IRQ # for handler call */
3471: andi r10, r12, 1 /* Isolate bit we are interested in */
348 srli r12, r12, 1 /* shift count is costly without hardware
349 multiplier */
350 addi r4, r4, 1
351 beq r10, r0, 1b
352 mov r5, sp /* Setup pt_regs pointer for handler call */
353 call do_IRQ
354 rdctl r12, ipending /* check again if irq still pending */
355 rdctl r9, ienable /* Isolate possible interrupts */
356 and r12, r12, r9
357 bne r12, r0, 2b
358 /* br ret_from_interrupt */ /* fall through to ret_from_interrupt */
359
360ENTRY(ret_from_interrupt)
361 ldw r1, PT_ESTATUS(sp) /* check if returning to kernel */
362 TSTBNZ r1, r1, ESTATUS_EU, Luser_return
363
364#ifdef CONFIG_PREEMPT
365 GET_THREAD_INFO r1
366 ldw r4, TI_PREEMPT_COUNT(r1)
367 bne r4, r0, restore_all
368
369need_resched:
370 ldw r4, TI_FLAGS(r1) /* ? Need resched set */
371 BTBZ r10, r4, TIF_NEED_RESCHED, restore_all
372 ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */
373 andi r10, r4, ESTATUS_EPIE
374 beq r10, r0, restore_all
375 movia r4, PREEMPT_ACTIVE
376 stw r4, TI_PREEMPT_COUNT(r1)
377 rdctl r10, status /* enable intrs again */
378 ori r10, r10 ,STATUS_PIE
379 wrctl status, r10
380 PUSH r1
381 call schedule
382 POP r1
383 mov r4, r0
384 stw r4, TI_PREEMPT_COUNT(r1)
385 rdctl r10, status /* disable intrs */
386 andi r10, r10, %lo(~STATUS_PIE)
387 wrctl status, r10
388 br need_resched
389#else
390 br restore_all
391#endif
392
393/***********************************************************************
394 * A few syscall wrappers
395 ***********************************************************************
396 */
397/*
398 * int clone(unsigned long clone_flags, unsigned long newsp,
399 * int __user * parent_tidptr, int __user * child_tidptr,
400 * int tls_val)
401 */
402ENTRY(sys_clone)
403 SAVE_SWITCH_STACK
404 addi sp, sp, -4
405 stw r7, 0(sp) /* Pass 5th arg thru stack */
406 mov r7, r6 /* 4th arg is 3rd of clone() */
407 mov r6, zero /* 3rd arg always 0 */
408 call do_fork
409 addi sp, sp, 4
410 RESTORE_SWITCH_STACK
411 ret
412
413ENTRY(sys_rt_sigreturn)
414 SAVE_SWITCH_STACK
415 mov r4, sp
416 call do_rt_sigreturn
417 RESTORE_SWITCH_STACK
418 addi ra, ra, (end_translate_rc_and_ret - translate_rc_and_ret)
419 ret
420
421/***********************************************************************
422 * A few other wrappers and stubs
423 ***********************************************************************
424 */
425protection_exception_pte:
426 rdctl r6, pteaddr
427 slli r6, r6, 10
428 call do_page_fault
429 br ret_from_exception
430
431protection_exception_ba:
432 rdctl r6, badaddr
433 call do_page_fault
434 br ret_from_exception
435
436protection_exception_instr:
437 call handle_supervisor_instr
438 br ret_from_exception
439
440handle_breakpoint:
441 call breakpoint_c
442 br ret_from_exception
443
444#ifdef CONFIG_NIOS2_ALIGNMENT_TRAP
445handle_unaligned:
446 SAVE_SWITCH_STACK
447 call handle_unaligned_c
448 RESTORE_SWITCH_STACK
449 br ret_from_exception
450#else
451handle_unaligned:
452 call handle_unaligned_c
453 br ret_from_exception
454#endif
455
456handle_illegal:
457 call handle_illegal_c
458 br ret_from_exception
459
460handle_diverror:
461 call handle_diverror_c
462 br ret_from_exception
463
464/*
465 * Beware - when entering resume, prev (the current task) is
466 * in r4, next (the new task) is in r5, don't change these
467 * registers.
468 */
469ENTRY(resume)
470
471 rdctl r7, status /* save thread status reg */
472 stw r7, TASK_THREAD + THREAD_KPSR(r4)
473
474 andi r7, r7, %lo(~STATUS_PIE) /* disable interrupts */
475 wrctl status, r7
476
477 SAVE_SWITCH_STACK
478 stw sp, TASK_THREAD + THREAD_KSP(r4)/* save kernel stack pointer */
479 ldw sp, TASK_THREAD + THREAD_KSP(r5)/* restore new thread stack */
480 movia r24, _current_thread /* save thread */
481 GET_THREAD_INFO r1
482 stw r1, 0(r24)
483 RESTORE_SWITCH_STACK
484
485 ldw r7, TASK_THREAD + THREAD_KPSR(r5)/* restore thread status reg */
486 wrctl status, r7
487 ret
488
489ENTRY(ret_from_fork)
490 call schedule_tail
491 br ret_from_exception
492
493ENTRY(ret_from_kernel_thread)
494 call schedule_tail
495 mov r4,r17 /* arg */
496 callr r16 /* function */
497 br ret_from_exception
498
499/*
500 * Kernel user helpers.
501 *
502 * Each segment is 64-byte aligned and will be mapped to the <User space>.
503 * New segments (if ever needed) must be added after the existing ones.
504 * This mechanism should be used only for things that are really small and
505 * justified, and not be abused freely.
506 *
507 */
508
509 /* Filling pads with undefined instructions. */
510.macro kuser_pad sym size
511 .if ((. - \sym) & 3)
512 .rept (4 - (. - \sym) & 3)
513 .byte 0
514 .endr
515 .endif
516 .rept ((\size - (. - \sym)) / 4)
517 .word 0xdeadbeef
518 .endr
519.endm
520
521 .align 6
522 .globl __kuser_helper_start
523__kuser_helper_start:
524
525__kuser_helper_version: /* @ 0x1000 */
526 .word ((__kuser_helper_end - __kuser_helper_start) >> 6)
527
528__kuser_cmpxchg: /* @ 0x1004 */
529 /*
530 * r4 pointer to exchange variable
531 * r5 old value
532 * r6 new value
533 */
534cmpxchg_ldw:
535 ldw r2, 0(r4) /* load current value */
536 sub r2, r2, r5 /* compare with old value */
537 bne r2, zero, cmpxchg_ret
538
539 /* We had a match, store the new value */
540cmpxchg_stw:
541 stw r6, 0(r4)
542cmpxchg_ret:
543 ret
544
545 kuser_pad __kuser_cmpxchg, 64
546
547 .globl __kuser_sigtramp
548__kuser_sigtramp:
549 movi r2, __NR_rt_sigreturn
550 trap
551
552 kuser_pad __kuser_sigtramp, 64
553
554 .globl __kuser_helper_end
555__kuser_helper_end:
diff --git a/arch/nios2/kernel/head.S b/arch/nios2/kernel/head.S
new file mode 100644
index 000000000000..372ce4a33018
--- /dev/null
+++ b/arch/nios2/kernel/head.S
@@ -0,0 +1,175 @@
1/*
2 * Copyright (C) 2009 Wind River Systems Inc
3 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
4 * Copyright (C) 2004 Microtronix Datacom Ltd
5 * Copyright (C) 2001 Vic Phillips, Microtronix Datacom Ltd.
6 *
7 * Based on head.S for Altera's Excalibur development board with nios processor
8 *
9 * Based on the following from the Excalibur sdk distribution:
10 * NA_MemoryMap.s, NR_JumpToStart.s, NR_Setup.s, NR_CWPManager.s
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file "COPYING" in the main directory of this archive
14 * for more details.
15 */
16
17#include <linux/init.h>
18#include <linux/linkage.h>
19#include <asm/thread_info.h>
20#include <asm/processor.h>
21#include <asm/cache.h>
22#include <asm/page.h>
23#include <asm/asm-offsets.h>
24#include <asm/asm-macros.h>
25
26/*
27 * ZERO_PAGE is a special page that is used for zero-initialized
28 * data and COW.
29 */
30.data
31.global empty_zero_page
32.align 12
33empty_zero_page:
34 .space PAGE_SIZE
35
36/*
37 * This global variable is used as an extension to the nios'
38 * STATUS register to emulate a user/supervisor mode.
39 */
40 .data
41 .align 2
42 .set noat
43
44 .global _current_thread
45_current_thread:
46 .long 0
47/*
48 * Input(s): passed from u-boot
49 * r4 - Optional pointer to a board information structure.
50 * r5 - Optional pointer to the physical starting address of the init RAM
51 * disk.
52 * r6 - Optional pointer to the physical ending address of the init RAM
53 * disk.
54 * r7 - Optional pointer to the physical starting address of any kernel
55 * command-line parameters.
56 */
57
58/*
59 * First executable code - detected and jumped to by the ROM bootstrap
60 * if the code resides in flash (looks for "Nios" at offset 0x0c from
61 * the potential executable image).
62 */
63 __HEAD
64ENTRY(_start)
65 wrctl status, r0 /* Disable interrupts */
66
67 /* Initialize all cache lines within the instruction cache */
68 movia r1, NIOS2_ICACHE_SIZE
69 movui r2, NIOS2_ICACHE_LINE_SIZE
70
71icache_init:
72 initi r1
73 sub r1, r1, r2
74 bgt r1, r0, icache_init
75 br 1f
76
77 /*
78 * This is the default location for the exception handler. Code in jump
79 * to our handler
80 */
81ENTRY(exception_handler_hook)
82 movia r24, inthandler
83 jmp r24
84
85ENTRY(fast_handler)
86 nextpc et
87helper:
88 stw r3, r3save - helper(et)
89
90 rdctl r3 , pteaddr
91 srli r3, r3, 12
92 slli r3, r3, 2
93 movia et, pgd_current
94
95 ldw et, 0(et)
96 add r3, et, r3
97 ldw et, 0(r3)
98
99 rdctl r3, pteaddr
100 andi r3, r3, 0xfff
101 add et, r3, et
102 ldw et, 0(et)
103 wrctl tlbacc, et
104 nextpc et
105helper2:
106 ldw r3, r3save - helper2(et)
107 subi ea, ea, 4
108 eret
109r3save:
110 .word 0x0
111ENTRY(fast_handler_end)
112
1131:
114 /*
115 * After the instruction cache is initialized, the data cache must
116 * also be initialized.
117 */
118 movia r1, NIOS2_DCACHE_SIZE
119 movui r2, NIOS2_DCACHE_LINE_SIZE
120
121dcache_init:
122 initd 0(r1)
123 sub r1, r1, r2
124 bgt r1, r0, dcache_init
125
126 nextpc r1 /* Find out where we are */
127chkadr:
128 movia r2, chkadr
129 beq r1, r2,finish_move /* We are running in RAM done */
130 addi r1, r1,(_start - chkadr) /* Source */
131 movia r2, _start /* Destination */
132 movia r3, __bss_start /* End of copy */
133
134loop_move: /* r1: src, r2: dest, r3: last dest */
135 ldw r8, 0(r1) /* load a word from [r1] */
136 stw r8, 0(r2) /* store a word to dest [r2] */
137 flushd 0(r2) /* Flush cache for safety */
138 addi r1, r1, 4 /* inc the src addr */
139 addi r2, r2, 4 /* inc the dest addr */
140 blt r2, r3, loop_move
141
142 movia r1, finish_move /* VMA(_start)->l1 */
143 jmp r1 /* jmp to _start */
144
145finish_move:
146
147 /* Mask off all possible interrupts */
148 wrctl ienable, r0
149
150 /* Clear .bss */
151 movia r2, __bss_start
152 movia r1, __bss_stop
1531:
154 stb r0, 0(r2)
155 addi r2, r2, 1
156 bne r1, r2, 1b
157
158 movia r1, init_thread_union /* set stack at top of the task union */
159 addi sp, r1, THREAD_SIZE
160 movia r2, _current_thread /* Remember current thread */
161 stw r1, 0(r2)
162
163 movia r1, nios2_boot_init /* save args r4-r7 passed from u-boot */
164 callr r1
165
166 movia r1, start_kernel /* call start_kernel as a subroutine */
167 callr r1
168
169 /* If we return from start_kernel, break to the oci debugger and
170 * buggered we are.
171 */
172 break
173
174 /* End of startup code */
175.set at
diff --git a/arch/nios2/kernel/insnemu.S b/arch/nios2/kernel/insnemu.S
new file mode 100644
index 000000000000..1c6b651e770d
--- /dev/null
+++ b/arch/nios2/kernel/insnemu.S
@@ -0,0 +1,592 @@
1/*
2 * Copyright (C) 2003-2013 Altera Corporation
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * 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
20#include <linux/linkage.h>
21#include <asm/entry.h>
22
23.set noat
24.set nobreak
25
26/*
27* Explicitly allow the use of r1 (the assembler temporary register)
28* within this code. This register is normally reserved for the use of
29* the compiler.
30*/
31
32ENTRY(instruction_trap)
33 ldw r1, PT_R1(sp) // Restore registers
34 ldw r2, PT_R2(sp)
35 ldw r3, PT_R3(sp)
36 ldw r4, PT_R4(sp)
37 ldw r5, PT_R5(sp)
38 ldw r6, PT_R6(sp)
39 ldw r7, PT_R7(sp)
40 ldw r8, PT_R8(sp)
41 ldw r9, PT_R9(sp)
42 ldw r10, PT_R10(sp)
43 ldw r11, PT_R11(sp)
44 ldw r12, PT_R12(sp)
45 ldw r13, PT_R13(sp)
46 ldw r14, PT_R14(sp)
47 ldw r15, PT_R15(sp)
48 ldw ra, PT_RA(sp)
49 ldw fp, PT_FP(sp)
50 ldw gp, PT_GP(sp)
51 ldw et, PT_ESTATUS(sp)
52 wrctl estatus, et
53 ldw ea, PT_EA(sp)
54 ldw et, PT_SP(sp) /* backup sp in et */
55
56 addi sp, sp, PT_REGS_SIZE
57
58 /* INSTRUCTION EMULATION
59 * ---------------------
60 *
61 * Nios II processors generate exceptions for unimplemented instructions.
62 * The routines below emulate these instructions. Depending on the
63 * processor core, the only instructions that might need to be emulated
64 * are div, divu, mul, muli, mulxss, mulxsu, and mulxuu.
65 *
66 * The emulations match the instructions, except for the following
67 * limitations:
68 *
69 * 1) The emulation routines do not emulate the use of the exception
70 * temporary register (et) as a source operand because the exception
71 * handler already has modified it.
72 *
73 * 2) The routines do not emulate the use of the stack pointer (sp) or
74 * the exception return address register (ea) as a destination because
75 * modifying these registers crashes the exception handler or the
76 * interrupted routine.
77 *
78 * Detailed Design
79 * ---------------
80 *
81 * The emulation routines expect the contents of integer registers r0-r31
82 * to be on the stack at addresses sp, 4(sp), 8(sp), ... 124(sp). The
83 * routines retrieve source operands from the stack and modify the
84 * destination register's value on the stack prior to the end of the
85 * exception handler. Then all registers except the destination register
86 * are restored to their previous values.
87 *
88 * The instruction that causes the exception is found at address -4(ea).
89 * The instruction's OP and OPX fields identify the operation to be
90 * performed.
91 *
92 * One instruction, muli, is an I-type instruction that is identified by
93 * an OP field of 0x24.
94 *
95 * muli AAAAA,BBBBB,IIIIIIIIIIIIIIII,-0x24-
96 * 27 22 6 0 <-- LSB of field
97 *
98 * The remaining emulated instructions are R-type and have an OP field
99 * of 0x3a. Their OPX fields identify them.
100 *
101 * R-type AAAAA,BBBBB,CCCCC,XXXXXX,NNNNN,-0x3a-
102 * 27 22 17 11 6 0 <-- LSB of field
103 *
104 *
105 * Opcode Encoding. muli is identified by its OP value. Then OPX & 0x02
106 * is used to differentiate between the division opcodes and the
107 * remaining multiplication opcodes.
108 *
109 * Instruction OP OPX OPX & 0x02
110 * ----------- ---- ---- ----------
111 * muli 0x24
112 * divu 0x3a 0x24 0
113 * div 0x3a 0x25 0
114 * mul 0x3a 0x27 != 0
115 * mulxuu 0x3a 0x07 != 0
116 * mulxsu 0x3a 0x17 != 0
117 * mulxss 0x3a 0x1f != 0
118 */
119
120
121 /*
122 * Save everything on the stack to make it easy for the emulation
123 * routines to retrieve the source register operands.
124 */
125
126 addi sp, sp, -128
127 stw zero, 0(sp) /* Save zero on stack to avoid special case for r0. */
128 stw r1, 4(sp)
129 stw r2, 8(sp)
130 stw r3, 12(sp)
131 stw r4, 16(sp)
132 stw r5, 20(sp)
133 stw r6, 24(sp)
134 stw r7, 28(sp)
135 stw r8, 32(sp)
136 stw r9, 36(sp)
137 stw r10, 40(sp)
138 stw r11, 44(sp)
139 stw r12, 48(sp)
140 stw r13, 52(sp)
141 stw r14, 56(sp)
142 stw r15, 60(sp)
143 stw r16, 64(sp)
144 stw r17, 68(sp)
145 stw r18, 72(sp)
146 stw r19, 76(sp)
147 stw r20, 80(sp)
148 stw r21, 84(sp)
149 stw r22, 88(sp)
150 stw r23, 92(sp)
151 /* Don't bother to save et. It's already been changed. */
152 rdctl r5, estatus
153 stw r5, 100(sp)
154
155 stw gp, 104(sp)
156 stw et, 108(sp) /* et contains previous sp value. */
157 stw fp, 112(sp)
158 stw ea, 116(sp)
159 stw ra, 120(sp)
160
161
162 /*
163 * Split the instruction into its fields. We need 4*A, 4*B, and 4*C as
164 * offsets to the stack pointer for access to the stored register values.
165 */
166 ldw r2,-4(ea) /* r2 = AAAAA,BBBBB,IIIIIIIIIIIIIIII,PPPPPP */
167 roli r3, r2, 7 /* r3 = BBB,IIIIIIIIIIIIIIII,PPPPPP,AAAAA,BB */
168 roli r4, r3, 3 /* r4 = IIIIIIIIIIIIIIII,PPPPPP,AAAAA,BBBBB */
169 roli r5, r4, 2 /* r5 = IIIIIIIIIIIIII,PPPPPP,AAAAA,BBBBB,II */
170 srai r4, r4, 16 /* r4 = (sign-extended) IMM16 */
171 roli r6, r5, 5 /* r6 = XXXX,NNNNN,PPPPPP,AAAAA,BBBBB,CCCCC,XX */
172 andi r2, r2, 0x3f /* r2 = 00000000000000000000000000,PPPPPP */
173 andi r3, r3, 0x7c /* r3 = 0000000000000000000000000,AAAAA,00 */
174 andi r5, r5, 0x7c /* r5 = 0000000000000000000000000,BBBBB,00 */
175 andi r6, r6, 0x7c /* r6 = 0000000000000000000000000,CCCCC,00 */
176
177 /* Now
178 * r2 = OP
179 * r3 = 4*A
180 * r4 = IMM16 (sign extended)
181 * r5 = 4*B
182 * r6 = 4*C
183 */
184
185 /*
186 * Get the operands.
187 *
188 * It is necessary to check for muli because it uses an I-type
189 * instruction format, while the other instructions are have an R-type
190 * format.
191 *
192 * Prepare for either multiplication or division loop.
193 * They both loop 32 times.
194 */
195 movi r14, 32
196
197 add r3, r3, sp /* r3 = address of A-operand. */
198 ldw r3, 0(r3) /* r3 = A-operand. */
199 movi r7, 0x24 /* muli opcode (I-type instruction format) */
200 beq r2, r7, mul_immed /* muli doesn't use the B register as a source */
201
202 add r5, r5, sp /* r5 = address of B-operand. */
203 ldw r5, 0(r5) /* r5 = B-operand. */
204 /* r4 = SSSSSSSSSSSSSSSS,-----IMM16------ */
205 /* IMM16 not needed, align OPX portion */
206 /* r4 = SSSSSSSSSSSSSSSS,CCCCC,-OPX--,00000 */
207 srli r4, r4, 5 /* r4 = 00000,SSSSSSSSSSSSSSSS,CCCCC,-OPX-- */
208 andi r4, r4, 0x3f /* r4 = 00000000000000000000000000,-OPX-- */
209
210 /* Now
211 * r2 = OP
212 * r3 = src1
213 * r5 = src2
214 * r4 = OPX (no longer can be muli)
215 * r6 = 4*C
216 */
217
218
219 /*
220 * Multiply or Divide?
221 */
222 andi r7, r4, 0x02 /* For R-type multiply instructions,
223 OPX & 0x02 != 0 */
224 bne r7, zero, multiply
225
226
227 /* DIVISION
228 *
229 * Divide an unsigned dividend by an unsigned divisor using
230 * a shift-and-subtract algorithm. The example below shows
231 * 43 div 7 = 6 for 8-bit integers. This classic algorithm uses a
232 * single register to store both the dividend and the quotient,
233 * allowing both values to be shifted with a single instruction.
234 *
235 * remainder dividend:quotient
236 * --------- -----------------
237 * initialize 00000000 00101011:
238 * shift 00000000 0101011:_
239 * remainder >= divisor? no 00000000 0101011:0
240 * shift 00000000 101011:0_
241 * remainder >= divisor? no 00000000 101011:00
242 * shift 00000001 01011:00_
243 * remainder >= divisor? no 00000001 01011:000
244 * shift 00000010 1011:000_
245 * remainder >= divisor? no 00000010 1011:0000
246 * shift 00000101 011:0000_
247 * remainder >= divisor? no 00000101 011:00000
248 * shift 00001010 11:00000_
249 * remainder >= divisor? yes 00001010 11:000001
250 * remainder -= divisor - 00000111
251 * ----------
252 * 00000011 11:000001
253 * shift 00000111 1:000001_
254 * remainder >= divisor? yes 00000111 1:0000011
255 * remainder -= divisor - 00000111
256 * ----------
257 * 00000000 1:0000011
258 * shift 00000001 :0000011_
259 * remainder >= divisor? no 00000001 :00000110
260 *
261 * The quotient is 00000110.
262 */
263
264divide:
265 /*
266 * Prepare for division by assuming the result
267 * is unsigned, and storing its "sign" as 0.
268 */
269 movi r17, 0
270
271
272 /* Which division opcode? */
273 xori r7, r4, 0x25 /* OPX of div */
274 bne r7, zero, unsigned_division
275
276
277 /*
278 * OPX is div. Determine and store the sign of the quotient.
279 * Then take the absolute value of both operands.
280 */
281 xor r17, r3, r5 /* MSB contains sign of quotient */
282 bge r3,zero,dividend_is_nonnegative
283 sub r3, zero, r3 /* -r3 */
284dividend_is_nonnegative:
285 bge r5, zero, divisor_is_nonnegative
286 sub r5, zero, r5 /* -r5 */
287divisor_is_nonnegative:
288
289
290unsigned_division:
291 /* Initialize the unsigned-division loop. */
292 movi r13, 0 /* remainder = 0 */
293
294 /* Now
295 * r3 = dividend : quotient
296 * r4 = 0x25 for div, 0x24 for divu
297 * r5 = divisor
298 * r13 = remainder
299 * r14 = loop counter (already initialized to 32)
300 * r17 = MSB contains sign of quotient
301 */
302
303
304 /*
305 * for (count = 32; count > 0; --count)
306 * {
307 */
308divide_loop:
309
310 /*
311 * Division:
312 *
313 * (remainder:dividend:quotient) <<= 1;
314 */
315 slli r13, r13, 1
316 cmplt r7, r3, zero /* r7 = MSB of r3 */
317 or r13, r13, r7
318 slli r3, r3, 1
319
320
321 /*
322 * if (remainder >= divisor)
323 * {
324 * set LSB of quotient
325 * remainder -= divisor;
326 * }
327 */
328 bltu r13, r5, div_skip
329 ori r3, r3, 1
330 sub r13, r13, r5
331div_skip:
332
333 /*
334 * }
335 */
336 subi r14, r14, 1
337 bne r14, zero, divide_loop
338
339
340 /* Now
341 * r3 = quotient
342 * r4 = 0x25 for div, 0x24 for divu
343 * r6 = 4*C
344 * r17 = MSB contains sign of quotient
345 */
346
347
348 /*
349 * Conditionally negate signed quotient. If quotient is unsigned,
350 * the sign already is initialized to 0.
351 */
352 bge r17, zero, quotient_is_nonnegative
353 sub r3, zero, r3 /* -r3 */
354 quotient_is_nonnegative:
355
356
357 /*
358 * Final quotient is in r3.
359 */
360 add r6, r6, sp
361 stw r3, 0(r6) /* write quotient to stack */
362 br restore_registers
363
364
365
366
367 /* MULTIPLICATION
368 *
369 * A "product" is the number that one gets by summing a "multiplicand"
370 * several times. The "multiplier" specifies the number of copies of the
371 * multiplicand that are summed.
372 *
373 * Actual multiplication algorithms don't use repeated addition, however.
374 * Shift-and-add algorithms get the same answer as repeated addition, and
375 * they are faster. To compute the lower half of a product (pppp below)
376 * one shifts the product left before adding in each of the partial
377 * products (a * mmmm) through (d * mmmm).
378 *
379 * To compute the upper half of a product (PPPP below), one adds in the
380 * partial products (d * mmmm) through (a * mmmm), each time following
381 * the add by a right shift of the product.
382 *
383 * mmmm
384 * * abcd
385 * ------
386 * #### = d * mmmm
387 * #### = c * mmmm
388 * #### = b * mmmm
389 * #### = a * mmmm
390 * --------
391 * PPPPpppp
392 *
393 * The example above shows 4 partial products. Computing actual Nios II
394 * products requires 32 partials.
395 *
396 * It is possible to compute the result of mulxsu from the result of
397 * mulxuu because the only difference between the results of these two
398 * opcodes is the value of the partial product associated with the sign
399 * bit of rA.
400 *
401 * mulxsu = mulxuu - (rA < 0) ? rB : 0;
402 *
403 * It is possible to compute the result of mulxss from the result of
404 * mulxsu because the only difference between the results of these two
405 * opcodes is the value of the partial product associated with the sign
406 * bit of rB.
407 *
408 * mulxss = mulxsu - (rB < 0) ? rA : 0;
409 *
410 */
411
412mul_immed:
413 /* Opcode is muli. Change it into mul for remainder of algorithm. */
414 mov r6, r5 /* Field B is dest register, not field C. */
415 mov r5, r4 /* Field IMM16 is src2, not field B. */
416 movi r4, 0x27 /* OPX of mul is 0x27 */
417
418multiply:
419 /* Initialize the multiplication loop. */
420 movi r9, 0 /* mul_product = 0 */
421 movi r10, 0 /* mulxuu_product = 0 */
422 mov r11, r5 /* save original multiplier for mulxsu and mulxss */
423 mov r12, r5 /* mulxuu_multiplier (will be shifted) */
424 movi r16, 1 /* used to create "rori B,A,1" from "ror B,A,r16" */
425
426 /* Now
427 * r3 = multiplicand
428 * r5 = mul_multiplier
429 * r6 = 4 * dest_register (used later as offset to sp)
430 * r7 = temp
431 * r9 = mul_product
432 * r10 = mulxuu_product
433 * r11 = original multiplier
434 * r12 = mulxuu_multiplier
435 * r14 = loop counter (already initialized)
436 * r16 = 1
437 */
438
439
440 /*
441 * for (count = 32; count > 0; --count)
442 * {
443 */
444multiply_loop:
445
446 /*
447 * mul_product <<= 1;
448 * lsb = multiplier & 1;
449 */
450 slli r9, r9, 1
451 andi r7, r12, 1
452
453 /*
454 * if (lsb == 1)
455 * {
456 * mulxuu_product += multiplicand;
457 * }
458 */
459 beq r7, zero, mulx_skip
460 add r10, r10, r3
461 cmpltu r7, r10, r3 /* Save the carry from the MSB of mulxuu_product. */
462 ror r7, r7, r16 /* r7 = 0x80000000 on carry, or else 0x00000000 */
463mulx_skip:
464
465 /*
466 * if (MSB of mul_multiplier == 1)
467 * {
468 * mul_product += multiplicand;
469 * }
470 */
471 bge r5, zero, mul_skip
472 add r9, r9, r3
473mul_skip:
474
475 /*
476 * mulxuu_product >>= 1; logical shift
477 * mul_multiplier <<= 1; done with MSB
478 * mulx_multiplier >>= 1; done with LSB
479 */
480 srli r10, r10, 1
481 or r10, r10, r7 /* OR in the saved carry bit. */
482 slli r5, r5, 1
483 srli r12, r12, 1
484
485
486 /*
487 * }
488 */
489 subi r14, r14, 1
490 bne r14, zero, multiply_loop
491
492
493 /*
494 * Multiply emulation loop done.
495 */
496
497 /* Now
498 * r3 = multiplicand
499 * r4 = OPX
500 * r6 = 4 * dest_register (used later as offset to sp)
501 * r7 = temp
502 * r9 = mul_product
503 * r10 = mulxuu_product
504 * r11 = original multiplier
505 */
506
507
508 /* Calculate address for result from 4 * dest_register */
509 add r6, r6, sp
510
511
512 /*
513 * Select/compute the result based on OPX.
514 */
515
516
517 /* OPX == mul? Then store. */
518 xori r7, r4, 0x27
519 beq r7, zero, store_product
520
521 /* It's one of the mulx.. opcodes. Move over the result. */
522 mov r9, r10
523
524 /* OPX == mulxuu? Then store. */
525 xori r7, r4, 0x07
526 beq r7, zero, store_product
527
528 /* Compute mulxsu
529 *
530 * mulxsu = mulxuu - (rA < 0) ? rB : 0;
531 */
532 bge r3, zero, mulxsu_skip
533 sub r9, r9, r11
534mulxsu_skip:
535
536 /* OPX == mulxsu? Then store. */
537 xori r7, r4, 0x17
538 beq r7, zero, store_product
539
540 /* Compute mulxss
541 *
542 * mulxss = mulxsu - (rB < 0) ? rA : 0;
543 */
544 bge r11,zero,mulxss_skip
545 sub r9, r9, r3
546mulxss_skip:
547 /* At this point, assume that OPX is mulxss, so store*/
548
549
550store_product:
551 stw r9, 0(r6)
552
553
554restore_registers:
555 /* No need to restore r0. */
556 ldw r5, 100(sp)
557 wrctl estatus, r5
558
559 ldw r1, 4(sp)
560 ldw r2, 8(sp)
561 ldw r3, 12(sp)
562 ldw r4, 16(sp)
563 ldw r5, 20(sp)
564 ldw r6, 24(sp)
565 ldw r7, 28(sp)
566 ldw r8, 32(sp)
567 ldw r9, 36(sp)
568 ldw r10, 40(sp)
569 ldw r11, 44(sp)
570 ldw r12, 48(sp)
571 ldw r13, 52(sp)
572 ldw r14, 56(sp)
573 ldw r15, 60(sp)
574 ldw r16, 64(sp)
575 ldw r17, 68(sp)
576 ldw r18, 72(sp)
577 ldw r19, 76(sp)
578 ldw r20, 80(sp)
579 ldw r21, 84(sp)
580 ldw r22, 88(sp)
581 ldw r23, 92(sp)
582 /* Does not need to restore et */
583 ldw gp, 104(sp)
584
585 ldw fp, 112(sp)
586 ldw ea, 116(sp)
587 ldw ra, 120(sp)
588 ldw sp, 108(sp) /* last restore sp */
589 eret
590
591.set at
592.set break
diff --git a/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
new file mode 100644
index 000000000000..f5b74ae69b5b
--- /dev/null
+++ b/arch/nios2/kernel/irq.c
@@ -0,0 +1,93 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2008 Thomas Chou <thomas@wytron.com.tw>
5 *
6 * based on irq.c from m68k which is:
7 *
8 * Copyright (C) 2007 Greg Ungerer <gerg@snapgear.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <linux/of.h>
28
29static u32 ienable;
30
31asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
32{
33 struct pt_regs *oldregs = set_irq_regs(regs);
34 int irq;
35
36 irq_enter();
37 irq = irq_find_mapping(NULL, hwirq);
38 generic_handle_irq(irq);
39 irq_exit();
40
41 set_irq_regs(oldregs);
42}
43
44static void chip_unmask(struct irq_data *d)
45{
46 ienable |= (1 << d->hwirq);
47 WRCTL(CTL_IENABLE, ienable);
48}
49
50static void chip_mask(struct irq_data *d)
51{
52 ienable &= ~(1 << d->hwirq);
53 WRCTL(CTL_IENABLE, ienable);
54}
55
56static struct irq_chip m_irq_chip = {
57 .name = "NIOS2-INTC",
58 .irq_unmask = chip_unmask,
59 .irq_mask = chip_mask,
60};
61
62static int irq_map(struct irq_domain *h, unsigned int virq,
63 irq_hw_number_t hw_irq_num)
64{
65 irq_set_chip_and_handler(virq, &m_irq_chip, handle_level_irq);
66
67 return 0;
68}
69
70static struct irq_domain_ops irq_ops = {
71 .map = irq_map,
72 .xlate = irq_domain_xlate_onecell,
73};
74
75void __init init_IRQ(void)
76{
77 struct irq_domain *domain;
78 struct device_node *node;
79
80 node = of_find_compatible_node(NULL, NULL, "altr,nios2-1.0");
81 if (!node)
82 node = of_find_compatible_node(NULL, NULL, "altr,nios2-1.1");
83
84 BUG_ON(!node);
85
86 domain = irq_domain_add_linear(node, NIOS2_CPU_NR_IRQS, &irq_ops, NULL);
87 BUG_ON(!domain);
88
89 irq_set_default_host(domain);
90 of_node_put(node);
91 /* Load the initial ienable value */
92 ienable = RDCTL(CTL_IENABLE);
93}
diff --git a/arch/nios2/kernel/misaligned.c b/arch/nios2/kernel/misaligned.c
new file mode 100644
index 000000000000..4e5907a0cabe
--- /dev/null
+++ b/arch/nios2/kernel/misaligned.c
@@ -0,0 +1,256 @@
1/*
2 * linux/arch/nios2/kernel/misaligned.c
3 *
4 * basic emulation for mis-aligned accesses on the NIOS II cpu
5 * modelled after the version for arm in arm/alignment.c
6 *
7 * Brad Parker <brad@heeltoe.com>
8 * Copyright (C) 2010 Ambient Corporation
9 * Copyright (c) 2010 Altera Corporation, San Jose, California, USA.
10 * Copyright (c) 2010 Arrow Electronics, Inc.
11 *
12 * This file is subject to the terms and conditions of the GNU General
13 * Public License. See the file COPYING in the main directory of
14 * this archive for more details.
15 */
16
17#include <linux/errno.h>
18#include <linux/string.h>
19#include <linux/proc_fs.h>
20#include <linux/init.h>
21#include <linux/sched.h>
22#include <linux/uaccess.h>
23#include <linux/seq_file.h>
24
25#include <asm/traps.h>
26#include <asm/unaligned.h>
27
28/* instructions we emulate */
29#define INST_LDHU 0x0b
30#define INST_STH 0x0d
31#define INST_LDH 0x0f
32#define INST_STW 0x15
33#define INST_LDW 0x17
34
35static unsigned long ma_user, ma_kern, ma_skipped, ma_half, ma_word;
36
37static unsigned int ma_usermode;
38#define UM_WARN 0x01
39#define UM_FIXUP 0x02
40#define UM_SIGNAL 0x04
41#define KM_WARN 0x08
42
43/* see arch/nios2/include/asm/ptrace.h */
44static u8 sys_stack_frame_reg_offset[] = {
45 /* struct pt_regs */
46 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 0,
47 /* struct switch_stack */
48 16, 17, 18, 19, 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0
49};
50
51static int reg_offsets[32];
52
53static inline u32 get_reg_val(struct pt_regs *fp, int reg)
54{
55 u8 *p = ((u8 *)fp) + reg_offsets[reg];
56
57 return *(u32 *)p;
58}
59
60static inline void put_reg_val(struct pt_regs *fp, int reg, u32 val)
61{
62 u8 *p = ((u8 *)fp) + reg_offsets[reg];
63 *(u32 *)p = val;
64}
65
66/*
67 * (mis)alignment handler
68 */
69asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
70{
71 u32 isn, addr, val;
72 int in_kernel;
73 u8 a, b, d0, d1, d2, d3;
74 u16 imm16;
75 unsigned int fault;
76
77 /* back up one instruction */
78 fp->ea -= 4;
79
80 if (fixup_exception(fp)) {
81 ma_skipped++;
82 return;
83 }
84
85 in_kernel = !user_mode(fp);
86
87 isn = *(unsigned long *)(fp->ea);
88
89 fault = 0;
90
91 /* do fixup if in kernel or mode turned on */
92 if (in_kernel || (ma_usermode & UM_FIXUP)) {
93 /* decompose instruction */
94 a = (isn >> 27) & 0x1f;
95 b = (isn >> 22) & 0x1f;
96 imm16 = (isn >> 6) & 0xffff;
97 addr = get_reg_val(fp, a) + imm16;
98
99 /* do fixup to saved registers */
100 switch (isn & 0x3f) {
101 case INST_LDHU:
102 fault |= __get_user(d0, (u8 *)(addr+0));
103 fault |= __get_user(d1, (u8 *)(addr+1));
104 val = (d1 << 8) | d0;
105 put_reg_val(fp, b, val);
106 ma_half++;
107 break;
108 case INST_STH:
109 val = get_reg_val(fp, b);
110 d1 = val >> 8;
111 d0 = val >> 0;
112
113 pr_debug("sth: ra=%d (%08x) rb=%d (%08x), imm16 %04x addr %08x val %08x\n",
114 a, get_reg_val(fp, a),
115 b, get_reg_val(fp, b),
116 imm16, addr, val);
117
118 if (in_kernel) {
119 *(u8 *)(addr+0) = d0;
120 *(u8 *)(addr+1) = d1;
121 } else {
122 fault |= __put_user(d0, (u8 *)(addr+0));
123 fault |= __put_user(d1, (u8 *)(addr+1));
124 }
125 ma_half++;
126 break;
127 case INST_LDH:
128 fault |= __get_user(d0, (u8 *)(addr+0));
129 fault |= __get_user(d1, (u8 *)(addr+1));
130 val = (short)((d1 << 8) | d0);
131 put_reg_val(fp, b, val);
132 ma_half++;
133 break;
134 case INST_STW:
135 val = get_reg_val(fp, b);
136 d3 = val >> 24;
137 d2 = val >> 16;
138 d1 = val >> 8;
139 d0 = val >> 0;
140 if (in_kernel) {
141 *(u8 *)(addr+0) = d0;
142 *(u8 *)(addr+1) = d1;
143 *(u8 *)(addr+2) = d2;
144 *(u8 *)(addr+3) = d3;
145 } else {
146 fault |= __put_user(d0, (u8 *)(addr+0));
147 fault |= __put_user(d1, (u8 *)(addr+1));
148 fault |= __put_user(d2, (u8 *)(addr+2));
149 fault |= __put_user(d3, (u8 *)(addr+3));
150 }
151 ma_word++;
152 break;
153 case INST_LDW:
154 fault |= __get_user(d0, (u8 *)(addr+0));
155 fault |= __get_user(d1, (u8 *)(addr+1));
156 fault |= __get_user(d2, (u8 *)(addr+2));
157 fault |= __get_user(d3, (u8 *)(addr+3));
158 val = (d3 << 24) | (d2 << 16) | (d1 << 8) | d0;
159 put_reg_val(fp, b, val);
160 ma_word++;
161 break;
162 }
163 }
164
165 addr = RDCTL(CTL_BADADDR);
166 cause >>= 2;
167
168 if (fault) {
169 if (in_kernel) {
170 pr_err("fault during kernel misaligned fixup @ %#lx; addr 0x%08x; isn=0x%08x\n",
171 fp->ea, (unsigned int)addr,
172 (unsigned int)isn);
173 } else {
174 pr_err("fault during user misaligned fixup @ %#lx; isn=%08x addr=0x%08x sp=0x%08lx pid=%d\n",
175 fp->ea,
176 (unsigned int)isn, addr, fp->sp,
177 current->pid);
178
179 _exception(SIGSEGV, fp, SEGV_MAPERR, fp->ea);
180 return;
181 }
182 }
183
184 /*
185 * kernel mode -
186 * note exception and skip bad instruction (return)
187 */
188 if (in_kernel) {
189 ma_kern++;
190 fp->ea += 4;
191
192 if (ma_usermode & KM_WARN) {
193 pr_err("kernel unaligned access @ %#lx; BADADDR 0x%08x; cause=%d, isn=0x%08x\n",
194 fp->ea,
195 (unsigned int)addr, cause,
196 (unsigned int)isn);
197 /* show_regs(fp); */
198 }
199
200 return;
201 }
202
203 ma_user++;
204
205 /*
206 * user mode -
207 * possibly warn,
208 * possibly send SIGBUS signal to process
209 */
210 if (ma_usermode & UM_WARN) {
211 pr_err("user unaligned access @ %#lx; isn=0x%08lx ea=0x%08lx ra=0x%08lx sp=0x%08lx\n",
212 (unsigned long)addr, (unsigned long)isn,
213 fp->ea, fp->ra, fp->sp);
214 }
215
216 if (ma_usermode & UM_SIGNAL)
217 _exception(SIGBUS, fp, BUS_ADRALN, fp->ea);
218 else
219 fp->ea += 4; /* else advance */
220}
221
222static void __init misaligned_calc_reg_offsets(void)
223{
224 int i, r, offset;
225
226 /* pre-calc offsets of registers on sys call stack frame */
227 offset = 0;
228
229 /* struct pt_regs */
230 for (i = 0; i < 16; i++) {
231 r = sys_stack_frame_reg_offset[i];
232 reg_offsets[r] = offset;
233 offset += 4;
234 }
235
236 /* struct switch_stack */
237 offset = -sizeof(struct switch_stack);
238 for (i = 16; i < 32; i++) {
239 r = sys_stack_frame_reg_offset[i];
240 reg_offsets[r] = offset;
241 offset += 4;
242 }
243}
244
245
246static int __init misaligned_init(void)
247{
248 /* default mode - silent fix */
249 ma_usermode = UM_FIXUP | KM_WARN;
250
251 misaligned_calc_reg_offsets();
252
253 return 0;
254}
255
256fs_initcall(misaligned_init);
diff --git a/arch/nios2/kernel/module.c b/arch/nios2/kernel/module.c
new file mode 100644
index 000000000000..cc924a38f22a
--- /dev/null
+++ b/arch/nios2/kernel/module.c
@@ -0,0 +1,138 @@
1/*
2 * Kernel module support for Nios II.
3 *
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
5 * Written by Wentao Xu <xuwentao@microtronix.com>
6 * Copyright (C) 2001, 2003 Rusty Russell
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of this
10 * archive for more details.
11 */
12
13#include <linux/moduleloader.h>
14#include <linux/elf.h>
15#include <linux/mm.h>
16#include <linux/vmalloc.h>
17#include <linux/slab.h>
18#include <linux/fs.h>
19#include <linux/string.h>
20#include <linux/kernel.h>
21
22#include <asm/pgtable.h>
23#include <asm/cacheflush.h>
24
25/*
26 * Modules should NOT be allocated with kmalloc for (obvious) reasons.
27 * But we do it for now to avoid relocation issues. CALL26/PCREL26 cannot reach
28 * from 0x80000000 (vmalloc area) to 0xc00000000 (kernel) (kmalloc returns
29 * addresses in 0xc0000000)
30 */
31void *module_alloc(unsigned long size)
32{
33 if (size == 0)
34 return NULL;
35 return kmalloc(size, GFP_KERNEL);
36}
37
38/* Free memory returned from module_alloc */
39void module_free(struct module *mod, void *module_region)
40{
41 kfree(module_region);
42}
43
44int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
45 unsigned int symindex, unsigned int relsec,
46 struct module *mod)
47{
48 unsigned int i;
49 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
50
51 pr_debug("Applying relocate section %u to %u\n", relsec,
52 sechdrs[relsec].sh_info);
53
54 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
55 /* This is where to make the change */
56 uint32_t word;
57 uint32_t *loc
58 = ((void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
59 + rela[i].r_offset);
60 /* This is the symbol it is referring to. Note that all
61 undefined symbols have been resolved. */
62 Elf32_Sym *sym
63 = ((Elf32_Sym *)sechdrs[symindex].sh_addr
64 + ELF32_R_SYM(rela[i].r_info));
65 uint32_t v = sym->st_value + rela[i].r_addend;
66
67 pr_debug("reltype %d 0x%x name:<%s>\n",
68 ELF32_R_TYPE(rela[i].r_info),
69 rela[i].r_offset, strtab + sym->st_name);
70
71 switch (ELF32_R_TYPE(rela[i].r_info)) {
72 case R_NIOS2_NONE:
73 break;
74 case R_NIOS2_BFD_RELOC_32:
75 *loc += v;
76 break;
77 case R_NIOS2_PCREL16:
78 v -= (uint32_t)loc + 4;
79 if ((int32_t)v > 0x7fff ||
80 (int32_t)v < -(int32_t)0x8000) {
81 pr_err("module %s: relocation overflow\n",
82 mod->name);
83 return -ENOEXEC;
84 }
85 word = *loc;
86 *loc = ((((word >> 22) << 16) | (v & 0xffff)) << 6) |
87 (word & 0x3f);
88 break;
89 case R_NIOS2_CALL26:
90 if (v & 3) {
91 pr_err("module %s: dangerous relocation\n",
92 mod->name);
93 return -ENOEXEC;
94 }
95 if ((v >> 28) != ((uint32_t)loc >> 28)) {
96 pr_err("module %s: relocation overflow\n",
97 mod->name);
98 return -ENOEXEC;
99 }
100 *loc = (*loc & 0x3f) | ((v >> 2) << 6);
101 break;
102 case R_NIOS2_HI16:
103 word = *loc;
104 *loc = ((((word >> 22) << 16) |
105 ((v >> 16) & 0xffff)) << 6) | (word & 0x3f);
106 break;
107 case R_NIOS2_LO16:
108 word = *loc;
109 *loc = ((((word >> 22) << 16) | (v & 0xffff)) << 6) |
110 (word & 0x3f);
111 break;
112 case R_NIOS2_HIADJ16:
113 {
114 Elf32_Addr word2;
115
116 word = *loc;
117 word2 = ((v >> 16) + ((v >> 15) & 1)) & 0xffff;
118 *loc = ((((word >> 22) << 16) | word2) << 6) |
119 (word & 0x3f);
120 }
121 break;
122
123 default:
124 pr_err("module %s: Unknown reloc: %u\n",
125 mod->name, ELF32_R_TYPE(rela[i].r_info));
126 return -ENOEXEC;
127 }
128 }
129
130 return 0;
131}
132
133int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
134 struct module *me)
135{
136 flush_cache_all();
137 return 0;
138}
diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c
new file mode 100644
index 000000000000..bf2f55d10a4d
--- /dev/null
+++ b/arch/nios2/kernel/nios2_ksyms.c
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 2004 Microtronix Datacom Ltd
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file COPYING in the main directory of this
6 * archive for more details.
7 */
8
9#include <linux/export.h>
10#include <linux/string.h>
11
12/* string functions */
13
14EXPORT_SYMBOL(memcpy);
15EXPORT_SYMBOL(memset);
16EXPORT_SYMBOL(memmove);
17
18/*
19 * libgcc functions - functions that are used internally by the
20 * compiler... (prototypes are not correct though, but that
21 * doesn't really matter since they're not versioned).
22 */
23#define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name)
24
25DECLARE_EXPORT(__gcc_bcmp);
26DECLARE_EXPORT(__divsi3);
27DECLARE_EXPORT(__moddi3);
28DECLARE_EXPORT(__modsi3);
29DECLARE_EXPORT(__udivmoddi4);
30DECLARE_EXPORT(__udivsi3);
31DECLARE_EXPORT(__umoddi3);
32DECLARE_EXPORT(__umodsi3);
33DECLARE_EXPORT(__muldi3);
diff --git a/arch/nios2/kernel/process.c b/arch/nios2/kernel/process.c
new file mode 100644
index 000000000000..0e075b5ad2a5
--- /dev/null
+++ b/arch/nios2/kernel/process.c
@@ -0,0 +1,258 @@
1/*
2 * Architecture-dependent parts of process handling.
3 *
4 * Copyright (C) 2013 Altera Corporation
5 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
6 * Copyright (C) 2009 Wind River Systems Inc
7 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
8 * Copyright (C) 2004 Microtronix Datacom Ltd
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14
15#include <linux/export.h>
16#include <linux/sched.h>
17#include <linux/tick.h>
18#include <linux/uaccess.h>
19
20#include <asm/unistd.h>
21#include <asm/traps.h>
22#include <asm/cpuinfo.h>
23
24asmlinkage void ret_from_fork(void);
25asmlinkage void ret_from_kernel_thread(void);
26
27void (*pm_power_off)(void) = NULL;
28EXPORT_SYMBOL(pm_power_off);
29
30void arch_cpu_idle(void)
31{
32 local_irq_enable();
33}
34
35/*
36 * The development boards have no way to pull a board reset. Just jump to the
37 * cpu reset address and let the boot loader or the code in head.S take care of
38 * resetting peripherals.
39 */
40void machine_restart(char *__unused)
41{
42 pr_notice("Machine restart (%08x)...\n", cpuinfo.reset_addr);
43 local_irq_disable();
44 __asm__ __volatile__ (
45 "jmp %0\n\t"
46 :
47 : "r" (cpuinfo.reset_addr)
48 : "r4");
49}
50
51void machine_halt(void)
52{
53 pr_notice("Machine halt...\n");
54 local_irq_disable();
55 for (;;)
56 ;
57}
58
59/*
60 * There is no way to power off the development boards. So just spin for now. If
61 * we ever have a way of resetting a board using a GPIO we should add that here.
62 */
63void machine_power_off(void)
64{
65 pr_notice("Machine power off...\n");
66 local_irq_disable();
67 for (;;)
68 ;
69}
70
71void show_regs(struct pt_regs *regs)
72{
73 pr_notice("\n");
74 show_regs_print_info(KERN_DEFAULT);
75
76 pr_notice("r1: %08lx r2: %08lx r3: %08lx r4: %08lx\n",
77 regs->r1, regs->r2, regs->r3, regs->r4);
78
79 pr_notice("r5: %08lx r6: %08lx r7: %08lx r8: %08lx\n",
80 regs->r5, regs->r6, regs->r7, regs->r8);
81
82 pr_notice("r9: %08lx r10: %08lx r11: %08lx r12: %08lx\n",
83 regs->r9, regs->r10, regs->r11, regs->r12);
84
85 pr_notice("r13: %08lx r14: %08lx r15: %08lx\n",
86 regs->r13, regs->r14, regs->r15);
87
88 pr_notice("ra: %08lx fp: %08lx sp: %08lx gp: %08lx\n",
89 regs->ra, regs->fp, regs->sp, regs->gp);
90
91 pr_notice("ea: %08lx estatus: %08lx\n",
92 regs->ea, regs->estatus);
93}
94
95void flush_thread(void)
96{
97 set_fs(USER_DS);
98}
99
100int copy_thread(unsigned long clone_flags,
101 unsigned long usp, unsigned long arg, struct task_struct *p)
102{
103 struct pt_regs *childregs = task_pt_regs(p);
104 struct pt_regs *regs;
105 struct switch_stack *stack;
106 struct switch_stack *childstack =
107 ((struct switch_stack *)childregs) - 1;
108
109 if (unlikely(p->flags & PF_KTHREAD)) {
110 memset(childstack, 0,
111 sizeof(struct switch_stack) + sizeof(struct pt_regs));
112
113 childstack->r16 = usp; /* fn */
114 childstack->r17 = arg;
115 childstack->ra = (unsigned long) ret_from_kernel_thread;
116 childregs->estatus = STATUS_PIE;
117 childregs->sp = (unsigned long) childstack;
118
119 p->thread.ksp = (unsigned long) childstack;
120 p->thread.kregs = childregs;
121 return 0;
122 }
123
124 regs = current_pt_regs();
125 *childregs = *regs;
126 childregs->r2 = 0; /* Set the return value for the child. */
127 childregs->r7 = 0;
128
129 stack = ((struct switch_stack *) regs) - 1;
130 *childstack = *stack;
131 childstack->ra = (unsigned long)ret_from_fork;
132 p->thread.kregs = childregs;
133 p->thread.ksp = (unsigned long) childstack;
134
135 if (usp)
136 childregs->sp = usp;
137
138 /* Initialize tls register. */
139 if (clone_flags & CLONE_SETTLS)
140 childstack->r23 = regs->r8;
141
142 return 0;
143}
144
145/*
146 * Generic dumping code. Used for panic and debug.
147 */
148void dump(struct pt_regs *fp)
149{
150 unsigned long *sp;
151 unsigned char *tp;
152 int i;
153
154 pr_emerg("\nCURRENT PROCESS:\n\n");
155 pr_emerg("COMM=%s PID=%d\n", current->comm, current->pid);
156
157 if (current->mm) {
158 pr_emerg("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
159 (int) current->mm->start_code,
160 (int) current->mm->end_code,
161 (int) current->mm->start_data,
162 (int) current->mm->end_data,
163 (int) current->mm->end_data,
164 (int) current->mm->brk);
165 pr_emerg("USER-STACK=%08x KERNEL-STACK=%08x\n\n",
166 (int) current->mm->start_stack,
167 (int)(((unsigned long) current) + THREAD_SIZE));
168 }
169
170 pr_emerg("PC: %08lx\n", fp->ea);
171 pr_emerg("SR: %08lx SP: %08lx\n",
172 (long) fp->estatus, (long) fp);
173
174 pr_emerg("r1: %08lx r2: %08lx r3: %08lx\n",
175 fp->r1, fp->r2, fp->r3);
176
177 pr_emerg("r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
178 fp->r4, fp->r5, fp->r6, fp->r7);
179 pr_emerg("r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
180 fp->r8, fp->r9, fp->r10, fp->r11);
181 pr_emerg("r12: %08lx r13: %08lx r14: %08lx r15: %08lx\n",
182 fp->r12, fp->r13, fp->r14, fp->r15);
183 pr_emerg("or2: %08lx ra: %08lx fp: %08lx sp: %08lx\n",
184 fp->orig_r2, fp->ra, fp->fp, fp->sp);
185 pr_emerg("\nUSP: %08x TRAPFRAME: %08x\n",
186 (unsigned int) fp->sp, (unsigned int) fp);
187
188 pr_emerg("\nCODE:");
189 tp = ((unsigned char *) fp->ea) - 0x20;
190 for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) {
191 if ((i % 0x10) == 0)
192 pr_emerg("\n%08x: ", (int) (tp + i));
193 pr_emerg("%08x ", (int) *sp++);
194 }
195 pr_emerg("\n");
196
197 pr_emerg("\nKERNEL STACK:");
198 tp = ((unsigned char *) fp) - 0x40;
199 for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {
200 if ((i % 0x10) == 0)
201 pr_emerg("\n%08x: ", (int) (tp + i));
202 pr_emerg("%08x ", (int) *sp++);
203 }
204 pr_emerg("\n");
205 pr_emerg("\n");
206
207 pr_emerg("\nUSER STACK:");
208 tp = (unsigned char *) (fp->sp - 0x10);
209 for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) {
210 if ((i % 0x10) == 0)
211 pr_emerg("\n%08x: ", (int) (tp + i));
212 pr_emerg("%08x ", (int) *sp++);
213 }
214 pr_emerg("\n\n");
215}
216
217unsigned long get_wchan(struct task_struct *p)
218{
219 unsigned long fp, pc;
220 unsigned long stack_page;
221 int count = 0;
222
223 if (!p || p == current || p->state == TASK_RUNNING)
224 return 0;
225
226 stack_page = (unsigned long)p;
227 fp = ((struct switch_stack *)p->thread.ksp)->fp; /* ;dgt2 */
228 do {
229 if (fp < stack_page+sizeof(struct task_struct) ||
230 fp >= 8184+stack_page) /* ;dgt2;tmp */
231 return 0;
232 pc = ((unsigned long *)fp)[1];
233 if (!in_sched_functions(pc))
234 return pc;
235 fp = *(unsigned long *) fp;
236 } while (count++ < 16); /* ;dgt2;tmp */
237 return 0;
238}
239
240/*
241 * Do necessary setup to start up a newly executed thread.
242 * Will startup in user mode (status_extension = 0).
243 */
244void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
245{
246 memset((void *) regs, 0, sizeof(struct pt_regs));
247 regs->estatus = ESTATUS_EPIE | ESTATUS_EU;
248 regs->ea = pc;
249 regs->sp = sp;
250}
251
252#include <linux/elfcore.h>
253
254/* Fill in the FPU structure for a core dump. */
255int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
256{
257 return 0; /* Nios2 has no FPU and thus no FPU registers */
258}
diff --git a/arch/nios2/kernel/prom.c b/arch/nios2/kernel/prom.c
new file mode 100644
index 000000000000..0522d3378e3f
--- /dev/null
+++ b/arch/nios2/kernel/prom.c
@@ -0,0 +1,65 @@
1/*
2 * Device tree support
3 *
4 * Copyright (C) 2013 Altera Corporation
5 * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
6 *
7 * Based on MIPS support for CONFIG_OF device tree support
8 *
9 * Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 *
24 */
25
26#include <linux/init.h>
27#include <linux/types.h>
28#include <linux/bootmem.h>
29#include <linux/of.h>
30#include <linux/of_fdt.h>
31#include <linux/io.h>
32
33#include <asm/sections.h>
34
35void __init early_init_dt_add_memory_arch(u64 base, u64 size)
36{
37 u64 kernel_start = (u64)virt_to_phys(_text);
38
39 if (!memory_size &&
40 (kernel_start >= base) && (kernel_start < (base + size)))
41 memory_size = size;
42
43}
44
45void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
46{
47 return alloc_bootmem_align(size, align);
48}
49
50void __init early_init_devtree(void *params)
51{
52 __be32 *dtb = (u32 *)__dtb_start;
53#if defined(CONFIG_NIOS2_DTB_AT_PHYS_ADDR)
54 if (be32_to_cpup((__be32 *)CONFIG_NIOS2_DTB_PHYS_ADDR) ==
55 OF_DT_HEADER) {
56 params = (void *)CONFIG_NIOS2_DTB_PHYS_ADDR;
57 early_init_dt_scan(params);
58 return;
59 }
60#endif
61 if (be32_to_cpu((__be32) *dtb) == OF_DT_HEADER)
62 params = (void *)__dtb_start;
63
64 early_init_dt_scan(params);
65}
diff --git a/arch/nios2/kernel/ptrace.c b/arch/nios2/kernel/ptrace.c
new file mode 100644
index 000000000000..681dda92eff1
--- /dev/null
+++ b/arch/nios2/kernel/ptrace.c
@@ -0,0 +1,166 @@
1/*
2 * Copyright (C) 2014 Altera Corporation
3 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
4 *
5 * This file is subject to the terms and conditions of the GNU General
6 * Public License. See the file COPYING in the main directory of this
7 * archive for more details.
8 */
9
10#include <linux/elf.h>
11#include <linux/errno.h>
12#include <linux/kernel.h>
13#include <linux/mm.h>
14#include <linux/ptrace.h>
15#include <linux/regset.h>
16#include <linux/sched.h>
17#include <linux/tracehook.h>
18#include <linux/uaccess.h>
19#include <linux/user.h>
20
21static int genregs_get(struct task_struct *target,
22 const struct user_regset *regset,
23 unsigned int pos, unsigned int count,
24 void *kbuf, void __user *ubuf)
25{
26 const struct pt_regs *regs = task_pt_regs(target);
27 const struct switch_stack *sw = (struct switch_stack *)regs - 1;
28 int ret = 0;
29
30#define REG_O_ZERO_RANGE(START, END) \
31 if (!ret) \
32 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, \
33 START * 4, (END * 4) + 4);
34
35#define REG_O_ONE(PTR, LOC) \
36 if (!ret) \
37 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, PTR, \
38 LOC * 4, (LOC * 4) + 4);
39
40#define REG_O_RANGE(PTR, START, END) \
41 if (!ret) \
42 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, PTR, \
43 START * 4, (END * 4) + 4);
44
45 REG_O_ZERO_RANGE(PTR_R0, PTR_R0);
46 REG_O_RANGE(&regs->r1, PTR_R1, PTR_R7);
47 REG_O_RANGE(&regs->r8, PTR_R8, PTR_R15);
48 REG_O_RANGE(sw, PTR_R16, PTR_R23);
49 REG_O_ZERO_RANGE(PTR_R24, PTR_R25); /* et and bt */
50 REG_O_ONE(&regs->gp, PTR_GP);
51 REG_O_ONE(&regs->sp, PTR_SP);
52 REG_O_ONE(&regs->fp, PTR_FP);
53 REG_O_ONE(&regs->ea, PTR_EA);
54 REG_O_ZERO_RANGE(PTR_BA, PTR_BA);
55 REG_O_ONE(&regs->ra, PTR_RA);
56 REG_O_ONE(&regs->ea, PTR_PC); /* use ea for PC */
57 if (!ret)
58 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
59 PTR_STATUS * 4, -1);
60
61 return ret;
62}
63
64/*
65 * Set the thread state from a regset passed in via ptrace
66 */
67static int genregs_set(struct task_struct *target,
68 const struct user_regset *regset,
69 unsigned int pos, unsigned int count,
70 const void *kbuf, const void __user *ubuf)
71{
72 struct pt_regs *regs = task_pt_regs(target);
73 const struct switch_stack *sw = (struct switch_stack *)regs - 1;
74 int ret = 0;
75
76#define REG_IGNORE_RANGE(START, END) \
77 if (!ret) \
78 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, \
79 START * 4, (END * 4) + 4);
80
81#define REG_IN_ONE(PTR, LOC) \
82 if (!ret) \
83 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, \
84 (void *)(PTR), LOC * 4, (LOC * 4) + 4);
85
86#define REG_IN_RANGE(PTR, START, END) \
87 if (!ret) \
88 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, \
89 (void *)(PTR), START * 4, (END * 4) + 4);
90
91 REG_IGNORE_RANGE(PTR_R0, PTR_R0);
92 REG_IN_RANGE(&regs->r1, PTR_R1, PTR_R7);
93 REG_IN_RANGE(&regs->r8, PTR_R8, PTR_R15);
94 REG_IN_RANGE(sw, PTR_R16, PTR_R23);
95 REG_IGNORE_RANGE(PTR_R24, PTR_R25); /* et and bt */
96 REG_IN_ONE(&regs->gp, PTR_GP);
97 REG_IN_ONE(&regs->sp, PTR_SP);
98 REG_IN_ONE(&regs->fp, PTR_FP);
99 REG_IN_ONE(&regs->ea, PTR_EA);
100 REG_IGNORE_RANGE(PTR_BA, PTR_BA);
101 REG_IN_ONE(&regs->ra, PTR_RA);
102 REG_IN_ONE(&regs->ea, PTR_PC); /* use ea for PC */
103 if (!ret)
104 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
105 PTR_STATUS * 4, -1);
106
107 return ret;
108}
109
110/*
111 * Define the register sets available on Nios2 under Linux
112 */
113enum nios2_regset {
114 REGSET_GENERAL,
115};
116
117static const struct user_regset nios2_regsets[] = {
118 [REGSET_GENERAL] = {
119 .core_note_type = NT_PRSTATUS,
120 .n = NUM_PTRACE_REG,
121 .size = sizeof(unsigned long),
122 .align = sizeof(unsigned long),
123 .get = genregs_get,
124 .set = genregs_set,
125 }
126};
127
128static const struct user_regset_view nios2_user_view = {
129 .name = "nios2",
130 .e_machine = ELF_ARCH,
131 .ei_osabi = ELF_OSABI,
132 .regsets = nios2_regsets,
133 .n = ARRAY_SIZE(nios2_regsets)
134};
135
136const struct user_regset_view *task_user_regset_view(struct task_struct *task)
137{
138 return &nios2_user_view;
139}
140
141void ptrace_disable(struct task_struct *child)
142{
143
144}
145
146long arch_ptrace(struct task_struct *child, long request, unsigned long addr,
147 unsigned long data)
148{
149 return ptrace_request(child, request, addr, data);
150}
151
152asmlinkage int do_syscall_trace_enter(void)
153{
154 int ret = 0;
155
156 if (test_thread_flag(TIF_SYSCALL_TRACE))
157 ret = tracehook_report_syscall_entry(task_pt_regs(current));
158
159 return ret;
160}
161
162asmlinkage void do_syscall_trace_exit(void)
163{
164 if (test_thread_flag(TIF_SYSCALL_TRACE))
165 tracehook_report_syscall_exit(task_pt_regs(current), 0);
166}
diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c
new file mode 100644
index 000000000000..cb3121f975d4
--- /dev/null
+++ b/arch/nios2/kernel/setup.c
@@ -0,0 +1,218 @@
1/*
2 * Nios2-specific parts of system setup
3 *
4 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
5 * Copyright (C) 2004 Microtronix Datacom Ltd.
6 * Copyright (C) 2001 Vic Phillips <vic@microtronix.com>
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#include <linux/export.h>
14#include <linux/kernel.h>
15#include <linux/mm.h>
16#include <linux/sched.h>
17#include <linux/console.h>
18#include <linux/bootmem.h>
19#include <linux/initrd.h>
20#include <linux/of_fdt.h>
21
22#include <asm/mmu_context.h>
23#include <asm/sections.h>
24#include <asm/setup.h>
25#include <asm/cpuinfo.h>
26
27unsigned long memory_start;
28EXPORT_SYMBOL(memory_start);
29
30unsigned long memory_end;
31EXPORT_SYMBOL(memory_end);
32
33unsigned long memory_size;
34
35static struct pt_regs fake_regs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
36 0, 0, 0, 0, 0, 0,
37 0};
38
39/* Copy a short hook instruction sequence to the exception address */
40static inline void copy_exception_handler(unsigned int addr)
41{
42 unsigned int start = (unsigned int) exception_handler_hook;
43 volatile unsigned int tmp = 0;
44
45 if (start == addr) {
46 /* The CPU exception address already points to the handler. */
47 return;
48 }
49
50 __asm__ __volatile__ (
51 "ldw %2,0(%0)\n"
52 "stw %2,0(%1)\n"
53 "ldw %2,4(%0)\n"
54 "stw %2,4(%1)\n"
55 "ldw %2,8(%0)\n"
56 "stw %2,8(%1)\n"
57 "flushd 0(%1)\n"
58 "flushd 4(%1)\n"
59 "flushd 8(%1)\n"
60 "flushi %1\n"
61 "addi %1,%1,4\n"
62 "flushi %1\n"
63 "addi %1,%1,4\n"
64 "flushi %1\n"
65 "flushp\n"
66 : /* no output registers */
67 : "r" (start), "r" (addr), "r" (tmp)
68 : "memory"
69 );
70}
71
72/* Copy the fast TLB miss handler */
73static inline void copy_fast_tlb_miss_handler(unsigned int addr)
74{
75 unsigned int start = (unsigned int) fast_handler;
76 unsigned int end = (unsigned int) fast_handler_end;
77 volatile unsigned int tmp = 0;
78
79 __asm__ __volatile__ (
80 "1:\n"
81 " ldw %3,0(%0)\n"
82 " stw %3,0(%1)\n"
83 " flushd 0(%1)\n"
84 " flushi %1\n"
85 " flushp\n"
86 " addi %0,%0,4\n"
87 " addi %1,%1,4\n"
88 " bne %0,%2,1b\n"
89 : /* no output registers */
90 : "r" (start), "r" (addr), "r" (end), "r" (tmp)
91 : "memory"
92 );
93}
94
95/*
96 * save args passed from u-boot, called from head.S
97 *
98 * @r4: NIOS magic
99 * @r5: initrd start
100 * @r6: initrd end or fdt
101 * @r7: kernel command line
102 */
103asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
104 unsigned r7)
105{
106 unsigned dtb_passed = 0;
107 char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
108
109#if defined(CONFIG_NIOS2_PASS_CMDLINE)
110 if (r4 == 0x534f494e) { /* r4 is magic NIOS */
111#if defined(CONFIG_BLK_DEV_INITRD)
112 if (r5) { /* initramfs */
113 initrd_start = r5;
114 initrd_end = r6;
115 }
116#endif /* CONFIG_BLK_DEV_INITRD */
117 dtb_passed = r6;
118
119 if (r7)
120 strncpy(cmdline_passed, (char *)r7, COMMAND_LINE_SIZE);
121 }
122#endif
123
124 early_init_devtree((void *)dtb_passed);
125
126#ifndef CONFIG_CMDLINE_FORCE
127 if (cmdline_passed[0])
128 strncpy(boot_command_line, cmdline_passed, COMMAND_LINE_SIZE);
129#ifdef CONFIG_NIOS2_CMDLINE_IGNORE_DTB
130 else
131 strncpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
132#endif
133#endif
134}
135
136void __init setup_arch(char **cmdline_p)
137{
138 int bootmap_size;
139
140 console_verbose();
141
142 memory_start = PAGE_ALIGN((unsigned long)__pa(_end));
143 memory_end = (unsigned long) CONFIG_NIOS2_MEM_BASE + memory_size;
144
145 init_mm.start_code = (unsigned long) _stext;
146 init_mm.end_code = (unsigned long) _etext;
147 init_mm.end_data = (unsigned long) _edata;
148 init_mm.brk = (unsigned long) _end;
149 init_task.thread.kregs = &fake_regs;
150
151 /* Keep a copy of command line */
152 *cmdline_p = boot_command_line;
153
154 min_low_pfn = PFN_UP(memory_start);
155 max_low_pfn = PFN_DOWN(memory_end);
156 max_mapnr = max_low_pfn;
157
158 /*
159 * give all the memory to the bootmap allocator, tell it to put the
160 * boot mem_map at the start of memory
161 */
162 pr_debug("init_bootmem_node(?,%#lx, %#x, %#lx)\n",
163 min_low_pfn, PFN_DOWN(PHYS_OFFSET), max_low_pfn);
164 bootmap_size = init_bootmem_node(NODE_DATA(0),
165 min_low_pfn, PFN_DOWN(PHYS_OFFSET),
166 max_low_pfn);
167
168 /*
169 * free the usable memory, we have to make sure we do not free
170 * the bootmem bitmap so we then reserve it after freeing it :-)
171 */
172 pr_debug("free_bootmem(%#lx, %#lx)\n",
173 memory_start, memory_end - memory_start);
174 free_bootmem(memory_start, memory_end - memory_start);
175
176 /*
177 * Reserve the bootmem bitmap itself as well. We do this in two
178 * steps (first step was init_bootmem()) because this catches
179 * the (very unlikely) case of us accidentally initializing the
180 * bootmem allocator with an invalid RAM area.
181 *
182 * Arguments are start, size
183 */
184 pr_debug("reserve_bootmem(%#lx, %#x)\n", memory_start, bootmap_size);
185 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
186
187#ifdef CONFIG_BLK_DEV_INITRD
188 if (initrd_start) {
189 reserve_bootmem(virt_to_phys((void *)initrd_start),
190 initrd_end - initrd_start, BOOTMEM_DEFAULT);
191 }
192#endif /* CONFIG_BLK_DEV_INITRD */
193
194 unflatten_and_copy_device_tree();
195
196 setup_cpuinfo();
197
198 copy_exception_handler(cpuinfo.exception_addr);
199
200 mmu_init();
201
202 copy_fast_tlb_miss_handler(cpuinfo.fast_tlb_miss_exc_addr);
203
204 /*
205 * Initialize MMU context handling here because data from cpuinfo is
206 * needed for this.
207 */
208 mmu_context_init();
209
210 /*
211 * get kmalloc into gear
212 */
213 paging_init();
214
215#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
216 conswitchp = &dummy_con;
217#endif
218}
diff --git a/arch/nios2/kernel/signal.c b/arch/nios2/kernel/signal.c
new file mode 100644
index 000000000000..f9d27883a714
--- /dev/null
+++ b/arch/nios2/kernel/signal.c
@@ -0,0 +1,323 @@
1/*
2 * Copyright (C) 2013-2014 Altera Corporation
3 * Copyright (C) 2011-2012 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2004 Microtronix Datacom Ltd
5 * Copyright (C) 1991, 1992 Linus Torvalds
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/signal.h>
13#include <linux/errno.h>
14#include <linux/ptrace.h>
15#include <linux/uaccess.h>
16#include <linux/unistd.h>
17#include <linux/personality.h>
18#include <linux/tracehook.h>
19
20#include <asm/ucontext.h>
21#include <asm/cacheflush.h>
22
23#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
24
25/*
26 * Do a signal return; undo the signal stack.
27 *
28 * Keep the return code on the stack quadword aligned!
29 * That makes the cache flush below easier.
30 */
31
32struct rt_sigframe {
33 struct siginfo info;
34 struct ucontext uc;
35};
36
37static inline int rt_restore_ucontext(struct pt_regs *regs,
38 struct switch_stack *sw,
39 struct ucontext *uc, int *pr2)
40{
41 int temp;
42 greg_t *gregs = uc->uc_mcontext.gregs;
43 int err;
44
45 /* Always make any pending restarted system calls return -EINTR */
46 current_thread_info()->restart_block.fn = do_no_restart_syscall;
47
48 err = __get_user(temp, &uc->uc_mcontext.version);
49 if (temp != MCONTEXT_VERSION)
50 goto badframe;
51 /* restore passed registers */
52 err |= __get_user(regs->r1, &gregs[0]);
53 err |= __get_user(regs->r2, &gregs[1]);
54 err |= __get_user(regs->r3, &gregs[2]);
55 err |= __get_user(regs->r4, &gregs[3]);
56 err |= __get_user(regs->r5, &gregs[4]);
57 err |= __get_user(regs->r6, &gregs[5]);
58 err |= __get_user(regs->r7, &gregs[6]);
59 err |= __get_user(regs->r8, &gregs[7]);
60 err |= __get_user(regs->r9, &gregs[8]);
61 err |= __get_user(regs->r10, &gregs[9]);
62 err |= __get_user(regs->r11, &gregs[10]);
63 err |= __get_user(regs->r12, &gregs[11]);
64 err |= __get_user(regs->r13, &gregs[12]);
65 err |= __get_user(regs->r14, &gregs[13]);
66 err |= __get_user(regs->r15, &gregs[14]);
67 err |= __get_user(sw->r16, &gregs[15]);
68 err |= __get_user(sw->r17, &gregs[16]);
69 err |= __get_user(sw->r18, &gregs[17]);
70 err |= __get_user(sw->r19, &gregs[18]);
71 err |= __get_user(sw->r20, &gregs[19]);
72 err |= __get_user(sw->r21, &gregs[20]);
73 err |= __get_user(sw->r22, &gregs[21]);
74 err |= __get_user(sw->r23, &gregs[22]);
75 /* gregs[23] is handled below */
76 err |= __get_user(sw->fp, &gregs[24]); /* Verify, should this be
77 settable */
78 err |= __get_user(sw->gp, &gregs[25]); /* Verify, should this be
79 settable */
80
81 err |= __get_user(temp, &gregs[26]); /* Not really necessary no user
82 settable bits */
83 err |= __get_user(regs->ea, &gregs[27]);
84
85 err |= __get_user(regs->ra, &gregs[23]);
86 err |= __get_user(regs->sp, &gregs[28]);
87
88 regs->orig_r2 = -1; /* disable syscall checks */
89
90 err |= restore_altstack(&uc->uc_stack);
91 if (err)
92 goto badframe;
93
94 *pr2 = regs->r2;
95 return err;
96
97badframe:
98 return 1;
99}
100
101asmlinkage int do_rt_sigreturn(struct switch_stack *sw)
102{
103 struct pt_regs *regs = (struct pt_regs *)(sw + 1);
104 /* Verify, can we follow the stack back */
105 struct rt_sigframe *frame = (struct rt_sigframe *) regs->sp;
106 sigset_t set;
107 int rval;
108
109 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
110 goto badframe;
111
112 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
113 goto badframe;
114
115 set_current_blocked(&set);
116
117 if (rt_restore_ucontext(regs, sw, &frame->uc, &rval))
118 goto badframe;
119
120 return rval;
121
122badframe:
123 force_sig(SIGSEGV, current);
124 return 0;
125}
126
127static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs)
128{
129 struct switch_stack *sw = (struct switch_stack *)regs - 1;
130 greg_t *gregs = uc->uc_mcontext.gregs;
131 int err = 0;
132
133 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
134 err |= __put_user(regs->r1, &gregs[0]);
135 err |= __put_user(regs->r2, &gregs[1]);
136 err |= __put_user(regs->r3, &gregs[2]);
137 err |= __put_user(regs->r4, &gregs[3]);
138 err |= __put_user(regs->r5, &gregs[4]);
139 err |= __put_user(regs->r6, &gregs[5]);
140 err |= __put_user(regs->r7, &gregs[6]);
141 err |= __put_user(regs->r8, &gregs[7]);
142 err |= __put_user(regs->r9, &gregs[8]);
143 err |= __put_user(regs->r10, &gregs[9]);
144 err |= __put_user(regs->r11, &gregs[10]);
145 err |= __put_user(regs->r12, &gregs[11]);
146 err |= __put_user(regs->r13, &gregs[12]);
147 err |= __put_user(regs->r14, &gregs[13]);
148 err |= __put_user(regs->r15, &gregs[14]);
149 err |= __put_user(sw->r16, &gregs[15]);
150 err |= __put_user(sw->r17, &gregs[16]);
151 err |= __put_user(sw->r18, &gregs[17]);
152 err |= __put_user(sw->r19, &gregs[18]);
153 err |= __put_user(sw->r20, &gregs[19]);
154 err |= __put_user(sw->r21, &gregs[20]);
155 err |= __put_user(sw->r22, &gregs[21]);
156 err |= __put_user(sw->r23, &gregs[22]);
157 err |= __put_user(regs->ra, &gregs[23]);
158 err |= __put_user(sw->fp, &gregs[24]);
159 err |= __put_user(sw->gp, &gregs[25]);
160 err |= __put_user(regs->ea, &gregs[27]);
161 err |= __put_user(regs->sp, &gregs[28]);
162 return err;
163}
164
165static inline void *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
166 size_t frame_size)
167{
168 unsigned long usp;
169
170 /* Default to using normal stack. */
171 usp = regs->sp;
172
173 /* This is the X/Open sanctioned signal stack switching. */
174 usp = sigsp(usp, ksig);
175
176 /* Verify, is it 32 or 64 bit aligned */
177 return (void *)((usp - frame_size) & -8UL);
178}
179
180static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
181 struct pt_regs *regs)
182{
183 struct rt_sigframe *frame;
184 int err = 0;
185
186 frame = get_sigframe(ksig, regs, sizeof(*frame));
187
188 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
189 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
190
191 /* Create the ucontext. */
192 err |= __put_user(0, &frame->uc.uc_flags);
193 err |= __put_user(0, &frame->uc.uc_link);
194 err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
195 err |= rt_setup_ucontext(&frame->uc, regs);
196 err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
197
198 if (err)
199 goto give_sigsegv;
200
201 /* Set up to return from userspace; jump to fixed address sigreturn
202 trampoline on kuser page. */
203 regs->ra = (unsigned long) (0x1040);
204
205 /* Set up registers for signal handler */
206 regs->sp = (unsigned long) frame;
207 regs->r4 = (unsigned long) ksig->sig;
208 regs->r5 = (unsigned long) &frame->info;
209 regs->r6 = (unsigned long) &frame->uc;
210 regs->ea = (unsigned long) ksig->ka.sa.sa_handler;
211 return 0;
212
213give_sigsegv:
214 force_sigsegv(ksig->sig, current);
215 return -EFAULT;
216}
217
218/*
219 * OK, we're invoking a handler
220 */
221static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
222{
223 int ret;
224 sigset_t *oldset = sigmask_to_save();
225
226 /* set up the stack frame */
227 ret = setup_rt_frame(ksig, oldset, regs);
228
229 signal_setup_done(ret, ksig, 0);
230}
231
232static int do_signal(struct pt_regs *regs)
233{
234 unsigned int retval = 0, continue_addr = 0, restart_addr = 0;
235 int restart = 0;
236 struct ksignal ksig;
237
238 current->thread.kregs = regs;
239
240 /*
241 * If we were from a system call, check for system call restarting...
242 */
243 if (regs->orig_r2 >= 0) {
244 continue_addr = regs->ea;
245 restart_addr = continue_addr - 4;
246 retval = regs->r2;
247
248 /*
249 * Prepare for system call restart. We do this here so that a
250 * debugger will see the already changed PC.
251 */
252 switch (retval) {
253 case ERESTART_RESTARTBLOCK:
254 restart = -2;
255 case ERESTARTNOHAND:
256 case ERESTARTSYS:
257 case ERESTARTNOINTR:
258 restart++;
259 regs->r2 = regs->orig_r2;
260 regs->r7 = regs->orig_r7;
261 regs->ea = restart_addr;
262 break;
263 }
264 }
265
266 if (get_signal(&ksig)) {
267 /* handler */
268 if (unlikely(restart && regs->ea == restart_addr)) {
269 if (retval == ERESTARTNOHAND ||
270 retval == ERESTART_RESTARTBLOCK ||
271 (retval == ERESTARTSYS
272 && !(ksig.ka.sa.sa_flags & SA_RESTART))) {
273 regs->r2 = EINTR;
274 regs->r7 = 1;
275 regs->ea = continue_addr;
276 }
277 }
278 handle_signal(&ksig, regs);
279 return 0;
280 }
281
282 /*
283 * No handler present
284 */
285 if (unlikely(restart) && regs->ea == restart_addr) {
286 regs->ea = continue_addr;
287 regs->r2 = __NR_restart_syscall;
288 }
289
290 /*
291 * If there's no signal to deliver, we just put the saved sigmask back.
292 */
293 restore_saved_sigmask();
294
295 return restart;
296}
297
298asmlinkage int do_notify_resume(struct pt_regs *regs)
299{
300 /*
301 * We want the common case to go fast, which is why we may in certain
302 * cases get here from kernel mode. Just return without doing anything
303 * if so.
304 */
305 if (!user_mode(regs))
306 return 0;
307
308 if (test_thread_flag(TIF_SIGPENDING)) {
309 int restart = do_signal(regs);
310
311 if (unlikely(restart)) {
312 /*
313 * Restart without handlers.
314 * Deal with it without leaving
315 * the kernel space.
316 */
317 return restart;
318 }
319 } else if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
320 tracehook_notify_resume(regs);
321
322 return 0;
323}
diff --git a/arch/nios2/kernel/sys_nios2.c b/arch/nios2/kernel/sys_nios2.c
new file mode 100644
index 000000000000..cd390ec4f88b
--- /dev/null
+++ b/arch/nios2/kernel/sys_nios2.c
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2011-2012 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/export.h>
12#include <linux/file.h>
13#include <linux/fs.h>
14#include <linux/slab.h>
15#include <linux/syscalls.h>
16
17#include <asm/cacheflush.h>
18#include <asm/traps.h>
19
20/* sys_cacheflush -- flush the processor cache. */
21asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len,
22 unsigned int op)
23{
24 struct vm_area_struct *vma;
25
26 if (len == 0)
27 return 0;
28
29 /* We only support op 0 now, return error if op is non-zero.*/
30 if (op)
31 return -EINVAL;
32
33 /* Check for overflow */
34 if (addr + len < addr)
35 return -EFAULT;
36
37 /*
38 * Verify that the specified address region actually belongs
39 * to this process.
40 */
41 vma = find_vma(current->mm, addr);
42 if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end)
43 return -EFAULT;
44
45 flush_cache_range(vma, addr, addr + len);
46
47 return 0;
48}
49
50asmlinkage int sys_getpagesize(void)
51{
52 return PAGE_SIZE;
53}
diff --git a/arch/nios2/kernel/syscall_table.c b/arch/nios2/kernel/syscall_table.c
new file mode 100644
index 000000000000..06e6ac1835b2
--- /dev/null
+++ b/arch/nios2/kernel/syscall_table.c
@@ -0,0 +1,29 @@
1/*
2 * Copyright Altera Corporation (C) 2013. All rights reserved
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#include <linux/syscalls.h>
19#include <linux/signal.h>
20#include <linux/unistd.h>
21
22#include <asm/syscalls.h>
23
24#undef __SYSCALL
25#define __SYSCALL(nr, call) [nr] = (call),
26
27void *sys_call_table[__NR_syscalls] = {
28#include <asm/unistd.h>
29};
diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c
new file mode 100644
index 000000000000..7f4547418ee1
--- /dev/null
+++ b/arch/nios2/kernel/time.c
@@ -0,0 +1,308 @@
1/*
2 * Copyright (C) 2013-2014 Altera Corporation
3 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/interrupt.h>
12#include <linux/clockchips.h>
13#include <linux/clocksource.h>
14#include <linux/delay.h>
15#include <linux/of.h>
16#include <linux/of_address.h>
17#include <linux/of_irq.h>
18#include <linux/io.h>
19#include <linux/slab.h>
20
21#define ALTERA_TIMER_STATUS_REG 0
22#define ALTERA_TIMER_CONTROL_REG 4
23#define ALTERA_TIMER_PERIODL_REG 8
24#define ALTERA_TIMER_PERIODH_REG 12
25#define ALTERA_TIMER_SNAPL_REG 16
26#define ALTERA_TIMER_SNAPH_REG 20
27
28#define ALTERA_TIMER_CONTROL_ITO_MSK (0x1)
29#define ALTERA_TIMER_CONTROL_CONT_MSK (0x2)
30#define ALTERA_TIMER_CONTROL_START_MSK (0x4)
31#define ALTERA_TIMER_CONTROL_STOP_MSK (0x8)
32
33struct nios2_timer {
34 void __iomem *base;
35 unsigned long freq;
36};
37
38struct nios2_clockevent_dev {
39 struct nios2_timer timer;
40 struct clock_event_device ced;
41};
42
43struct nios2_clocksource {
44 struct nios2_timer timer;
45 struct clocksource cs;
46};
47
48static inline struct nios2_clockevent_dev *
49 to_nios2_clkevent(struct clock_event_device *evt)
50{
51 return container_of(evt, struct nios2_clockevent_dev, ced);
52}
53
54static inline struct nios2_clocksource *
55 to_nios2_clksource(struct clocksource *cs)
56{
57 return container_of(cs, struct nios2_clocksource, cs);
58}
59
60static u16 timer_readw(struct nios2_timer *timer, u32 offs)
61{
62 return readw(timer->base + offs);
63}
64
65static void timer_writew(struct nios2_timer *timer, u16 val, u32 offs)
66{
67 writew(val, timer->base + offs);
68}
69
70static inline unsigned long read_timersnapshot(struct nios2_timer *timer)
71{
72 unsigned long count;
73
74 timer_writew(timer, 0, ALTERA_TIMER_SNAPL_REG);
75 count = timer_readw(timer, ALTERA_TIMER_SNAPH_REG) << 16 |
76 timer_readw(timer, ALTERA_TIMER_SNAPL_REG);
77
78 return count;
79}
80
81static cycle_t nios2_timer_read(struct clocksource *cs)
82{
83 struct nios2_clocksource *nios2_cs = to_nios2_clksource(cs);
84 unsigned long flags;
85 u32 count;
86
87 local_irq_save(flags);
88 count = read_timersnapshot(&nios2_cs->timer);
89 local_irq_restore(flags);
90
91 /* Counter is counting down */
92 return ~count;
93}
94
95static struct nios2_clocksource nios2_cs = {
96 .cs = {
97 .name = "nios2-clksrc",
98 .rating = 250,
99 .read = nios2_timer_read,
100 .mask = CLOCKSOURCE_MASK(32),
101 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
102 },
103};
104
105cycles_t get_cycles(void)
106{
107 return nios2_timer_read(&nios2_cs.cs);
108}
109
110static void nios2_timer_start(struct nios2_timer *timer)
111{
112 u16 ctrl;
113
114 ctrl = timer_readw(timer, ALTERA_TIMER_CONTROL_REG);
115 ctrl |= ALTERA_TIMER_CONTROL_START_MSK;
116 timer_writew(timer, ctrl, ALTERA_TIMER_CONTROL_REG);
117}
118
119static void nios2_timer_stop(struct nios2_timer *timer)
120{
121 u16 ctrl;
122
123 ctrl = timer_readw(timer, ALTERA_TIMER_CONTROL_REG);
124 ctrl |= ALTERA_TIMER_CONTROL_STOP_MSK;
125 timer_writew(timer, ctrl, ALTERA_TIMER_CONTROL_REG);
126}
127
128static void nios2_timer_config(struct nios2_timer *timer, unsigned long period,
129 enum clock_event_mode mode)
130{
131 u16 ctrl;
132
133 /* The timer's actual period is one cycle greater than the value
134 * stored in the period register. */
135 period--;
136
137 ctrl = timer_readw(timer, ALTERA_TIMER_CONTROL_REG);
138 /* stop counter */
139 timer_writew(timer, ctrl | ALTERA_TIMER_CONTROL_STOP_MSK,
140 ALTERA_TIMER_CONTROL_REG);
141
142 /* write new count */
143 timer_writew(timer, period, ALTERA_TIMER_PERIODL_REG);
144 timer_writew(timer, period >> 16, ALTERA_TIMER_PERIODH_REG);
145
146 ctrl |= ALTERA_TIMER_CONTROL_START_MSK | ALTERA_TIMER_CONTROL_ITO_MSK;
147 if (mode == CLOCK_EVT_MODE_PERIODIC)
148 ctrl |= ALTERA_TIMER_CONTROL_CONT_MSK;
149 else
150 ctrl &= ~ALTERA_TIMER_CONTROL_CONT_MSK;
151 timer_writew(timer, ctrl, ALTERA_TIMER_CONTROL_REG);
152}
153
154static int nios2_timer_set_next_event(unsigned long delta,
155 struct clock_event_device *evt)
156{
157 struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt);
158
159 nios2_timer_config(&nios2_ced->timer, delta, evt->mode);
160
161 return 0;
162}
163
164static void nios2_timer_set_mode(enum clock_event_mode mode,
165 struct clock_event_device *evt)
166{
167 unsigned long period;
168 struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt);
169 struct nios2_timer *timer = &nios2_ced->timer;
170
171 switch (mode) {
172 case CLOCK_EVT_MODE_PERIODIC:
173 period = DIV_ROUND_UP(timer->freq, HZ);
174 nios2_timer_config(timer, period, CLOCK_EVT_MODE_PERIODIC);
175 break;
176 case CLOCK_EVT_MODE_ONESHOT:
177 case CLOCK_EVT_MODE_UNUSED:
178 case CLOCK_EVT_MODE_SHUTDOWN:
179 nios2_timer_stop(timer);
180 break;
181 case CLOCK_EVT_MODE_RESUME:
182 nios2_timer_start(timer);
183 break;
184 }
185}
186
187irqreturn_t timer_interrupt(int irq, void *dev_id)
188{
189 struct clock_event_device *evt = (struct clock_event_device *) dev_id;
190 struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt);
191
192 /* Clear the interrupt condition */
193 timer_writew(&nios2_ced->timer, 0, ALTERA_TIMER_STATUS_REG);
194 evt->event_handler(evt);
195
196 return IRQ_HANDLED;
197}
198
199static void __init nios2_timer_get_base_and_freq(struct device_node *np,
200 void __iomem **base, u32 *freq)
201{
202 *base = of_iomap(np, 0);
203 if (!*base)
204 panic("Unable to map reg for %s\n", np->name);
205
206 if (of_property_read_u32(np, "clock-frequency", freq))
207 panic("Unable to get %s clock frequency\n", np->name);
208}
209
210static struct nios2_clockevent_dev nios2_ce = {
211 .ced = {
212 .name = "nios2-clkevent",
213 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
214 .rating = 250,
215 .shift = 32,
216 .set_next_event = nios2_timer_set_next_event,
217 .set_mode = nios2_timer_set_mode,
218 },
219};
220
221static __init void nios2_clockevent_init(struct device_node *timer)
222{
223 void __iomem *iobase;
224 u32 freq;
225 int irq;
226
227 nios2_timer_get_base_and_freq(timer, &iobase, &freq);
228
229 irq = irq_of_parse_and_map(timer, 0);
230 if (!irq)
231 panic("Unable to parse timer irq\n");
232
233 nios2_ce.timer.base = iobase;
234 nios2_ce.timer.freq = freq;
235
236 nios2_ce.ced.cpumask = cpumask_of(0);
237 nios2_ce.ced.irq = irq;
238
239 nios2_timer_stop(&nios2_ce.timer);
240 /* clear pending interrupt */
241 timer_writew(&nios2_ce.timer, 0, ALTERA_TIMER_STATUS_REG);
242
243 if (request_irq(irq, timer_interrupt, IRQF_TIMER, timer->name,
244 &nios2_ce.ced))
245 panic("Unable to setup timer irq\n");
246
247 clockevents_config_and_register(&nios2_ce.ced, freq, 1, ULONG_MAX);
248}
249
250static __init void nios2_clocksource_init(struct device_node *timer)
251{
252 unsigned int ctrl;
253 void __iomem *iobase;
254 u32 freq;
255
256 nios2_timer_get_base_and_freq(timer, &iobase, &freq);
257
258 nios2_cs.timer.base = iobase;
259 nios2_cs.timer.freq = freq;
260
261 clocksource_register_hz(&nios2_cs.cs, freq);
262
263 timer_writew(&nios2_cs.timer, USHRT_MAX, ALTERA_TIMER_PERIODL_REG);
264 timer_writew(&nios2_cs.timer, USHRT_MAX, ALTERA_TIMER_PERIODH_REG);
265
266 /* interrupt disable + continuous + start */
267 ctrl = ALTERA_TIMER_CONTROL_CONT_MSK | ALTERA_TIMER_CONTROL_START_MSK;
268 timer_writew(&nios2_cs.timer, ctrl, ALTERA_TIMER_CONTROL_REG);
269
270 /* Calibrate the delay loop directly */
271 lpj_fine = freq / HZ;
272}
273
274/*
275 * The first timer instance will use as a clockevent. If there are two or
276 * more instances, the second one gets used as clocksource and all
277 * others are unused.
278*/
279static void __init nios2_time_init(struct device_node *timer)
280{
281 static int num_called;
282
283 switch (num_called) {
284 case 0:
285 nios2_clockevent_init(timer);
286 break;
287 case 1:
288 nios2_clocksource_init(timer);
289 break;
290 default:
291 break;
292 }
293
294 num_called++;
295}
296
297void read_persistent_clock(struct timespec *ts)
298{
299 ts->tv_sec = mktime(2007, 1, 1, 0, 0, 0);
300 ts->tv_nsec = 0;
301}
302
303void __init time_init(void)
304{
305 clocksource_of_init();
306}
307
308CLOCKSOURCE_OF_DECLARE(nios2_timer, "altr,timer-1.0", nios2_time_init);
diff --git a/arch/nios2/kernel/traps.c b/arch/nios2/kernel/traps.c
new file mode 100644
index 000000000000..b7b97641a9a6
--- /dev/null
+++ b/arch/nios2/kernel/traps.c
@@ -0,0 +1,185 @@
1/*
2 * Hardware exception handling
3 *
4 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
5 * Copyright (C) 2004 Microtronix Datacom Ltd.
6 * Copyright (C) 2001 Vic Phillips
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of this
10 * archive for more details.
11 */
12
13#include <linux/sched.h>
14#include <linux/kernel.h>
15#include <linux/signal.h>
16#include <linux/export.h>
17#include <linux/mm.h>
18#include <linux/ptrace.h>
19
20#include <asm/traps.h>
21#include <asm/sections.h>
22#include <asm/uaccess.h>
23
24static DEFINE_SPINLOCK(die_lock);
25
26void die(const char *str, struct pt_regs *regs, long err)
27{
28 console_verbose();
29 spin_lock_irq(&die_lock);
30 pr_warn("Oops: %s, sig: %ld\n", str, err);
31 show_regs(regs);
32 spin_unlock_irq(&die_lock);
33 /*
34 * do_exit() should take care of panic'ing from an interrupt
35 * context so we don't handle it here
36 */
37 do_exit(err);
38}
39
40void _exception(int signo, struct pt_regs *regs, int code, unsigned long addr)
41{
42 siginfo_t info;
43
44 if (!user_mode(regs))
45 die("Exception in kernel mode", regs, signo);
46
47 info.si_signo = signo;
48 info.si_errno = 0;
49 info.si_code = code;
50 info.si_addr = (void __user *) addr;
51 force_sig_info(signo, &info, current);
52}
53
54/*
55 * The show_stack is an external API which we do not use ourselves.
56 */
57
58int kstack_depth_to_print = 48;
59
60void show_stack(struct task_struct *task, unsigned long *stack)
61{
62 unsigned long *endstack, addr;
63 int i;
64
65 if (!stack) {
66 if (task)
67 stack = (unsigned long *)task->thread.ksp;
68 else
69 stack = (unsigned long *)&stack;
70 }
71
72 addr = (unsigned long) stack;
73 endstack = (unsigned long *) PAGE_ALIGN(addr);
74
75 pr_emerg("Stack from %08lx:", (unsigned long)stack);
76 for (i = 0; i < kstack_depth_to_print; i++) {
77 if (stack + 1 > endstack)
78 break;
79 if (i % 8 == 0)
80 pr_emerg("\n ");
81 pr_emerg(" %08lx", *stack++);
82 }
83
84 pr_emerg("\nCall Trace:");
85 i = 0;
86 while (stack + 1 <= endstack) {
87 addr = *stack++;
88 /*
89 * If the address is either in the text segment of the
90 * kernel, or in the region which contains vmalloc'ed
91 * memory, it *may* be the address of a calling
92 * routine; if so, print it so that someone tracing
93 * down the cause of the crash will be able to figure
94 * out the call path that was taken.
95 */
96 if (((addr >= (unsigned long) _stext) &&
97 (addr <= (unsigned long) _etext))) {
98 if (i % 4 == 0)
99 pr_emerg("\n ");
100 pr_emerg(" [<%08lx>]", addr);
101 i++;
102 }
103 }
104 pr_emerg("\n");
105}
106
107void __init trap_init(void)
108{
109 /* Nothing to do here */
110}
111
112/* Breakpoint handler */
113asmlinkage void breakpoint_c(struct pt_regs *fp)
114{
115 /*
116 * The breakpoint entry code has moved the PC on by 4 bytes, so we must
117 * move it back. This could be done on the host but we do it here
118 * because monitor.S of JTAG gdbserver does it too.
119 */
120 fp->ea -= 4;
121 _exception(SIGTRAP, fp, TRAP_BRKPT, fp->ea);
122}
123
124#ifndef CONFIG_NIOS2_ALIGNMENT_TRAP
125/* Alignment exception handler */
126asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
127{
128 unsigned long addr = RDCTL(CTL_BADADDR);
129
130 cause >>= 2;
131 fp->ea -= 4;
132
133 if (fixup_exception(fp))
134 return;
135
136 if (!user_mode(fp)) {
137 pr_alert("Unaligned access from kernel mode, this might be a hardware\n");
138 pr_alert("problem, dump registers and restart the instruction\n");
139 pr_alert(" BADADDR 0x%08lx\n", addr);
140 pr_alert(" cause %d\n", cause);
141 pr_alert(" op-code 0x%08lx\n", *(unsigned long *)(fp->ea));
142 show_regs(fp);
143 return;
144 }
145
146 _exception(SIGBUS, fp, BUS_ADRALN, addr);
147}
148#endif /* CONFIG_NIOS2_ALIGNMENT_TRAP */
149
150/* Illegal instruction handler */
151asmlinkage void handle_illegal_c(struct pt_regs *fp)
152{
153 fp->ea -= 4;
154 _exception(SIGILL, fp, ILL_ILLOPC, fp->ea);
155}
156
157/* Supervisor instruction handler */
158asmlinkage void handle_supervisor_instr(struct pt_regs *fp)
159{
160 fp->ea -= 4;
161 _exception(SIGILL, fp, ILL_PRVOPC, fp->ea);
162}
163
164/* Division error handler */
165asmlinkage void handle_diverror_c(struct pt_regs *fp)
166{
167 fp->ea -= 4;
168 _exception(SIGFPE, fp, FPE_INTDIV, fp->ea);
169}
170
171/* Unhandled exception handler */
172asmlinkage void unhandled_exception(struct pt_regs *regs, int cause)
173{
174 unsigned long addr = RDCTL(CTL_BADADDR);
175
176 cause /= 4;
177
178 pr_emerg("Unhandled exception #%d in %s mode (badaddr=0x%08lx)\n",
179 cause, user_mode(regs) ? "user" : "kernel", addr);
180
181 regs->ea -= 4;
182 show_regs(regs);
183
184 pr_emerg("opcode: 0x%08lx\n", *(unsigned long *)(regs->ea));
185}
diff --git a/arch/nios2/kernel/vmlinux.lds.S b/arch/nios2/kernel/vmlinux.lds.S
new file mode 100644
index 000000000000..326fab40a9de
--- /dev/null
+++ b/arch/nios2/kernel/vmlinux.lds.S
@@ -0,0 +1,75 @@
1/*
2 * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18#include <asm/page.h>
19#include <asm-generic/vmlinux.lds.h>
20#include <asm/cache.h>
21#include <asm/thread_info.h>
22
23OUTPUT_FORMAT("elf32-littlenios2", "elf32-littlenios2", "elf32-littlenios2")
24
25OUTPUT_ARCH(nios)
26ENTRY(_start) /* Defined in head.S */
27
28jiffies = jiffies_64;
29
30SECTIONS
31{
32 . = CONFIG_NIOS2_MEM_BASE | CONFIG_NIOS2_KERNEL_REGION_BASE;
33
34 _text = .;
35 _stext = .;
36 HEAD_TEXT_SECTION
37 .text : {
38 TEXT_TEXT
39 SCHED_TEXT
40 LOCK_TEXT
41 IRQENTRY_TEXT
42 KPROBES_TEXT
43 } =0
44 _etext = .;
45
46 .got : {
47 *(.got.plt)
48 *(.igot.plt)
49 *(.got)
50 *(.igot)
51 }
52
53 EXCEPTION_TABLE(L1_CACHE_BYTES)
54
55 . = ALIGN(PAGE_SIZE);
56 __init_begin = .;
57 INIT_TEXT_SECTION(PAGE_SIZE)
58 INIT_DATA_SECTION(PAGE_SIZE)
59 PERCPU_SECTION(L1_CACHE_BYTES)
60 __init_end = .;
61
62 _sdata = .;
63 RO_DATA_SECTION(PAGE_SIZE)
64 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
65 _edata = .;
66
67 BSS_SECTION(0, 0, 0)
68 _end = .;
69
70 STABS_DEBUG
71 DWARF_DEBUG
72 NOTES
73
74 DISCARDS
75}
diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile
new file mode 100644
index 000000000000..557256628ecd
--- /dev/null
+++ b/arch/nios2/lib/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for Nios2-specific library files.
3#
4
5lib-y += delay.o
6lib-y += memcpy.o
7lib-y += memmove.o
8lib-y += memset.o
diff --git a/arch/nios2/lib/delay.c b/arch/nios2/lib/delay.c
new file mode 100644
index 000000000000..088119cd0cc5
--- /dev/null
+++ b/arch/nios2/lib/delay.c
@@ -0,0 +1,52 @@
1/* Copyright Altera Corporation (C) 2014. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License, version 2,
5 * as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *
15 */
16
17#include <linux/module.h>
18#include <asm/delay.h>
19#include <asm/param.h>
20#include <asm/processor.h>
21#include <asm/timex.h>
22
23void __delay(unsigned long cycles)
24{
25 cycles_t start = get_cycles();
26
27 while ((get_cycles() - start) < cycles)
28 cpu_relax();
29}
30EXPORT_SYMBOL(__delay);
31
32void __const_udelay(unsigned long xloops)
33{
34 u64 loops;
35
36 loops = (u64)xloops * loops_per_jiffy * HZ;
37
38 __delay(loops >> 32);
39}
40EXPORT_SYMBOL(__const_udelay);
41
42void __udelay(unsigned long usecs)
43{
44 __const_udelay(usecs * 0x10C7UL); /* 2**32 / 1000000 (rounded up) */
45}
46EXPORT_SYMBOL(__udelay);
47
48void __ndelay(unsigned long nsecs)
49{
50 __const_udelay(nsecs * 0x5UL); /* 2**32 / 1000000000 (rounded up) */
51}
52EXPORT_SYMBOL(__ndelay);
diff --git a/arch/nios2/lib/memcpy.c b/arch/nios2/lib/memcpy.c
new file mode 100644
index 000000000000..1715f5d28b11
--- /dev/null
+++ b/arch/nios2/lib/memcpy.c
@@ -0,0 +1,202 @@
1/* Extracted from GLIBC memcpy.c and memcopy.h, which is:
2 Copyright (C) 1991, 1992, 1993, 1997, 2004 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Torbjorn Granlund (tege@sics.se).
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library 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 GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20#include <linux/types.h>
21
22/* Type to use for aligned memory operations.
23 This should normally be the biggest type supported by a single load
24 and store. */
25#define op_t unsigned long int
26#define OPSIZ (sizeof(op_t))
27
28/* Optimal type for storing bytes in registers. */
29#define reg_char char
30
31#define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
32
33/* Copy exactly NBYTES bytes from SRC_BP to DST_BP,
34 without any assumptions about alignment of the pointers. */
35#define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \
36do { \
37 size_t __nbytes = (nbytes); \
38 while (__nbytes > 0) { \
39 unsigned char __x = ((unsigned char *) src_bp)[0]; \
40 src_bp += 1; \
41 __nbytes -= 1; \
42 ((unsigned char *) dst_bp)[0] = __x; \
43 dst_bp += 1; \
44 } \
45} while (0)
46
47/* Copy *up to* NBYTES bytes from SRC_BP to DST_BP, with
48 the assumption that DST_BP is aligned on an OPSIZ multiple. If
49 not all bytes could be easily copied, store remaining number of bytes
50 in NBYTES_LEFT, otherwise store 0. */
51/* extern void _wordcopy_fwd_aligned __P ((long int, long int, size_t)); */
52/* extern void _wordcopy_fwd_dest_aligned __P ((long int, long int, size_t)); */
53#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
54do { \
55 if (src_bp % OPSIZ == 0) \
56 _wordcopy_fwd_aligned(dst_bp, src_bp, (nbytes) / OPSIZ);\
57 else \
58 _wordcopy_fwd_dest_aligned(dst_bp, src_bp, (nbytes) / OPSIZ);\
59 src_bp += (nbytes) & -OPSIZ; \
60 dst_bp += (nbytes) & -OPSIZ; \
61 (nbytes_left) = (nbytes) % OPSIZ; \
62} while (0)
63
64
65/* Threshold value for when to enter the unrolled loops. */
66#define OP_T_THRES 16
67
68/* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to
69 block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
70 Both SRCP and DSTP should be aligned for memory operations on `op_t's. */
71/* stream-lined (read x8 + write x8) */
72static void _wordcopy_fwd_aligned(long int dstp, long int srcp, size_t len)
73{
74 while (len > 7) {
75 register op_t a0, a1, a2, a3, a4, a5, a6, a7;
76
77 a0 = ((op_t *) srcp)[0];
78 a1 = ((op_t *) srcp)[1];
79 a2 = ((op_t *) srcp)[2];
80 a3 = ((op_t *) srcp)[3];
81 a4 = ((op_t *) srcp)[4];
82 a5 = ((op_t *) srcp)[5];
83 a6 = ((op_t *) srcp)[6];
84 a7 = ((op_t *) srcp)[7];
85 ((op_t *) dstp)[0] = a0;
86 ((op_t *) dstp)[1] = a1;
87 ((op_t *) dstp)[2] = a2;
88 ((op_t *) dstp)[3] = a3;
89 ((op_t *) dstp)[4] = a4;
90 ((op_t *) dstp)[5] = a5;
91 ((op_t *) dstp)[6] = a6;
92 ((op_t *) dstp)[7] = a7;
93
94 srcp += 8 * OPSIZ;
95 dstp += 8 * OPSIZ;
96 len -= 8;
97 }
98 while (len > 0) {
99 *(op_t *)dstp = *(op_t *)srcp;
100
101 srcp += OPSIZ;
102 dstp += OPSIZ;
103 len -= 1;
104 }
105}
106
107/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
108 block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
109 DSTP should be aligned for memory operations on `op_t's, but SRCP must
110 *not* be aligned. */
111/* stream-lined (read x4 + write x4) */
112static void _wordcopy_fwd_dest_aligned(long int dstp, long int srcp,
113 size_t len)
114{
115 op_t ap;
116 int sh_1, sh_2;
117
118 /* Calculate how to shift a word read at the memory operation
119 aligned srcp to make it aligned for copy. */
120
121 sh_1 = 8 * (srcp % OPSIZ);
122 sh_2 = 8 * OPSIZ - sh_1;
123
124 /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
125 it points in the middle of. */
126 srcp &= -OPSIZ;
127 ap = ((op_t *) srcp)[0];
128 srcp += OPSIZ;
129
130 while (len > 3) {
131 op_t a0, a1, a2, a3;
132
133 a0 = ((op_t *) srcp)[0];
134 a1 = ((op_t *) srcp)[1];
135 a2 = ((op_t *) srcp)[2];
136 a3 = ((op_t *) srcp)[3];
137 ((op_t *) dstp)[0] = MERGE(ap, sh_1, a0, sh_2);
138 ((op_t *) dstp)[1] = MERGE(a0, sh_1, a1, sh_2);
139 ((op_t *) dstp)[2] = MERGE(a1, sh_1, a2, sh_2);
140 ((op_t *) dstp)[3] = MERGE(a2, sh_1, a3, sh_2);
141
142 ap = a3;
143 srcp += 4 * OPSIZ;
144 dstp += 4 * OPSIZ;
145 len -= 4;
146 }
147 while (len > 0) {
148 register op_t a0;
149
150 a0 = ((op_t *) srcp)[0];
151 ((op_t *) dstp)[0] = MERGE(ap, sh_1, a0, sh_2);
152
153 ap = a0;
154 srcp += OPSIZ;
155 dstp += OPSIZ;
156 len -= 1;
157 }
158}
159
160void *memcpy(void *dstpp, const void *srcpp, size_t len)
161{
162 unsigned long int dstp = (long int) dstpp;
163 unsigned long int srcp = (long int) srcpp;
164
165 /* Copy from the beginning to the end. */
166
167 /* If there not too few bytes to copy, use word copy. */
168 if (len >= OP_T_THRES) {
169 /* Copy just a few bytes to make DSTP aligned. */
170 len -= (-dstp) % OPSIZ;
171 BYTE_COPY_FWD(dstp, srcp, (-dstp) % OPSIZ);
172
173 /* Copy whole pages from SRCP to DSTP by virtual address
174 manipulation, as much as possible. */
175
176 /* PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len); */
177
178 /* Copy from SRCP to DSTP taking advantage of the known
179 alignment of DSTP. Number of bytes remaining is put in the
180 third argument, i.e. in LEN. This number may vary from
181 machine to machine. */
182
183 WORD_COPY_FWD(dstp, srcp, len, len);
184
185 /* Fall out and copy the tail. */
186 }
187
188 /* There are just a few bytes to copy. Use byte memory operations. */
189 BYTE_COPY_FWD(dstp, srcp, len);
190
191 return dstpp;
192}
193
194void *memcpyb(void *dstpp, const void *srcpp, unsigned len)
195{
196 unsigned long int dstp = (long int) dstpp;
197 unsigned long int srcp = (long int) srcpp;
198
199 BYTE_COPY_FWD(dstp, srcp, len);
200
201 return dstpp;
202}
diff --git a/arch/nios2/lib/memmove.c b/arch/nios2/lib/memmove.c
new file mode 100644
index 000000000000..c65ef517eb80
--- /dev/null
+++ b/arch/nios2/lib/memmove.c
@@ -0,0 +1,82 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#include <linux/types.h>
11#include <linux/string.h>
12
13#ifdef __HAVE_ARCH_MEMMOVE
14void *memmove(void *d, const void *s, size_t count)
15{
16 unsigned long dst, src;
17
18 if (!count)
19 return d;
20
21 if (d < s) {
22 dst = (unsigned long) d;
23 src = (unsigned long) s;
24
25 if ((count < 8) || ((dst ^ src) & 3))
26 goto restup;
27
28 if (dst & 1) {
29 *(char *)dst++ = *(char *)src++;
30 count--;
31 }
32 if (dst & 2) {
33 *(short *)dst = *(short *)src;
34 src += 2;
35 dst += 2;
36 count -= 2;
37 }
38 while (count > 3) {
39 *(long *)dst = *(long *)src;
40 src += 4;
41 dst += 4;
42 count -= 4;
43 }
44restup:
45 while (count--)
46 *(char *)dst++ = *(char *)src++;
47 } else {
48 dst = (unsigned long) d + count;
49 src = (unsigned long) s + count;
50
51 if ((count < 8) || ((dst ^ src) & 3))
52 goto restdown;
53
54 if (dst & 1) {
55 src--;
56 dst--;
57 count--;
58 *(char *)dst = *(char *)src;
59 }
60 if (dst & 2) {
61 src -= 2;
62 dst -= 2;
63 count -= 2;
64 *(short *)dst = *(short *)src;
65 }
66 while (count > 3) {
67 src -= 4;
68 dst -= 4;
69 count -= 4;
70 *(long *)dst = *(long *)src;
71 }
72restdown:
73 while (count--) {
74 src--;
75 dst--;
76 *(char *)dst = *(char *)src;
77 }
78 }
79
80 return d;
81}
82#endif /* __HAVE_ARCH_MEMMOVE */
diff --git a/arch/nios2/lib/memset.c b/arch/nios2/lib/memset.c
new file mode 100644
index 000000000000..65e97802f5cc
--- /dev/null
+++ b/arch/nios2/lib/memset.c
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2004 Microtronix Datacom Ltd
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#include <linux/types.h>
11#include <linux/string.h>
12
13#ifdef __HAVE_ARCH_MEMSET
14void *memset(void *s, int c, size_t count)
15{
16 int destptr, charcnt, dwordcnt, fill8reg, wrkrega;
17
18 if (!count)
19 return s;
20
21 c &= 0xFF;
22
23 if (count <= 8) {
24 char *xs = (char *) s;
25
26 while (count--)
27 *xs++ = c;
28 return s;
29 }
30
31 __asm__ __volatile__ (
32 /* fill8 %3, %5 (c & 0xff) */
33 " slli %4, %5, 8\n"
34 " or %4, %4, %5\n"
35 " slli %3, %4, 16\n"
36 " or %3, %3, %4\n"
37 /* Word-align %0 (s) if necessary */
38 " andi %4, %0, 0x01\n"
39 " beq %4, zero, 1f\n"
40 " addi %1, %1, -1\n"
41 " stb %3, 0(%0)\n"
42 " addi %0, %0, 1\n"
43 "1: mov %2, %1\n"
44 /* Dword-align %0 (s) if necessary */
45 " andi %4, %0, 0x02\n"
46 " beq %4, zero, 2f\n"
47 " addi %1, %1, -2\n"
48 " sth %3, 0(%0)\n"
49 " addi %0, %0, 2\n"
50 " mov %2, %1\n"
51 /* %1 and %2 are how many more bytes to set */
52 "2: srli %2, %2, 2\n"
53 /* %2 is how many dwords to set */
54 "3: stw %3, 0(%0)\n"
55 " addi %0, %0, 4\n"
56 " addi %2, %2, -1\n"
57 " bne %2, zero, 3b\n"
58 /* store residual word and/or byte if necessary */
59 " andi %4, %1, 0x02\n"
60 " beq %4, zero, 4f\n"
61 " sth %3, 0(%0)\n"
62 " addi %0, %0, 2\n"
63 /* store residual byte if necessary */
64 "4: andi %4, %1, 0x01\n"
65 " beq %4, zero, 5f\n"
66 " stb %3, 0(%0)\n"
67 "5:\n"
68 : "=r" (destptr), /* %0 Output */
69 "=r" (charcnt), /* %1 Output */
70 "=r" (dwordcnt), /* %2 Output */
71 "=r" (fill8reg), /* %3 Output */
72 "=r" (wrkrega) /* %4 Output */
73 : "r" (c), /* %5 Input */
74 "0" (s), /* %0 Input/Output */
75 "1" (count) /* %1 Input/Output */
76 : "memory" /* clobbered */
77 );
78
79 return s;
80}
81#endif /* __HAVE_ARCH_MEMSET */
diff --git a/arch/nios2/mm/Makefile b/arch/nios2/mm/Makefile
new file mode 100644
index 000000000000..3cbd0840873c
--- /dev/null
+++ b/arch/nios2/mm/Makefile
@@ -0,0 +1,14 @@
1#
2# Makefile for the Nios2-specific parts of the memory manager.
3#
4
5obj-y += cacheflush.o
6obj-y += dma-mapping.o
7obj-y += extable.o
8obj-y += fault.o
9obj-y += init.o
10obj-y += ioremap.o
11obj-y += mmu_context.o
12obj-y += pgtable.o
13obj-y += tlb.o
14obj-y += uaccess.o
diff --git a/arch/nios2/mm/cacheflush.c b/arch/nios2/mm/cacheflush.c
new file mode 100644
index 000000000000..2ae482b42669
--- /dev/null
+++ b/arch/nios2/mm/cacheflush.c
@@ -0,0 +1,271 @@
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) 2009, Wind River Systems Inc
7 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
8 */
9
10#include <linux/export.h>
11#include <linux/sched.h>
12#include <linux/mm.h>
13#include <linux/fs.h>
14
15#include <asm/cacheflush.h>
16#include <asm/cpuinfo.h>
17
18static void __flush_dcache(unsigned long start, unsigned long end)
19{
20 unsigned long addr;
21
22 start &= ~(cpuinfo.dcache_line_size - 1);
23 end += (cpuinfo.dcache_line_size - 1);
24 end &= ~(cpuinfo.dcache_line_size - 1);
25
26 if (end > start + cpuinfo.dcache_size)
27 end = start + cpuinfo.dcache_size;
28
29 for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) {
30 __asm__ __volatile__ (" flushda 0(%0)\n"
31 : /* Outputs */
32 : /* Inputs */ "r"(addr)
33 /* : No clobber */);
34 }
35}
36
37static void __flush_dcache_all(unsigned long start, unsigned long end)
38{
39 unsigned long addr;
40
41 start &= ~(cpuinfo.dcache_line_size - 1);
42 end += (cpuinfo.dcache_line_size - 1);
43 end &= ~(cpuinfo.dcache_line_size - 1);
44
45 if (end > start + cpuinfo.dcache_size)
46 end = start + cpuinfo.dcache_size;
47
48 for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) {
49 __asm__ __volatile__ (" flushd 0(%0)\n"
50 : /* Outputs */
51 : /* Inputs */ "r"(addr)
52 /* : No clobber */);
53 }
54}
55
56static void __invalidate_dcache(unsigned long start, unsigned long end)
57{
58 unsigned long addr;
59
60 start &= ~(cpuinfo.dcache_line_size - 1);
61 end += (cpuinfo.dcache_line_size - 1);
62 end &= ~(cpuinfo.dcache_line_size - 1);
63
64 if (end > start + cpuinfo.dcache_size)
65 end = start + cpuinfo.dcache_size;
66
67 for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) {
68 __asm__ __volatile__ (" initda 0(%0)\n"
69 : /* Outputs */
70 : /* Inputs */ "r"(addr)
71 /* : No clobber */);
72 }
73}
74
75static void __flush_icache(unsigned long start, unsigned long end)
76{
77 unsigned long addr;
78
79 start &= ~(cpuinfo.icache_line_size - 1);
80 end += (cpuinfo.icache_line_size - 1);
81 end &= ~(cpuinfo.icache_line_size - 1);
82
83 if (end > start + cpuinfo.icache_size)
84 end = start + cpuinfo.icache_size;
85
86 for (addr = start; addr < end; addr += cpuinfo.icache_line_size) {
87 __asm__ __volatile__ (" flushi %0\n"
88 : /* Outputs */
89 : /* Inputs */ "r"(addr)
90 /* : No clobber */);
91 }
92 __asm__ __volatile(" flushp\n");
93}
94
95static void flush_aliases(struct address_space *mapping, struct page *page)
96{
97 struct mm_struct *mm = current->active_mm;
98 struct vm_area_struct *mpnt;
99 pgoff_t pgoff;
100
101 pgoff = page->index;
102
103 flush_dcache_mmap_lock(mapping);
104 vma_interval_tree_foreach(mpnt, &mapping->i_mmap, pgoff, pgoff) {
105 unsigned long offset;
106
107 if (mpnt->vm_mm != mm)
108 continue;
109 if (!(mpnt->vm_flags & VM_MAYSHARE))
110 continue;
111
112 offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
113 flush_cache_page(mpnt, mpnt->vm_start + offset,
114 page_to_pfn(page));
115 }
116 flush_dcache_mmap_unlock(mapping);
117}
118
119void flush_cache_all(void)
120{
121 __flush_dcache_all(0, cpuinfo.dcache_size);
122 __flush_icache(0, cpuinfo.icache_size);
123}
124
125void flush_cache_mm(struct mm_struct *mm)
126{
127 flush_cache_all();
128}
129
130void flush_cache_dup_mm(struct mm_struct *mm)
131{
132 flush_cache_all();
133}
134
135void flush_icache_range(unsigned long start, unsigned long end)
136{
137 __flush_icache(start, end);
138}
139
140void flush_dcache_range(unsigned long start, unsigned long end)
141{
142 __flush_dcache(start, end);
143}
144EXPORT_SYMBOL(flush_dcache_range);
145
146void invalidate_dcache_range(unsigned long start, unsigned long end)
147{
148 __invalidate_dcache(start, end);
149}
150EXPORT_SYMBOL(invalidate_dcache_range);
151
152void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
153 unsigned long end)
154{
155 __flush_dcache(start, end);
156 if (vma == NULL || (vma->vm_flags & VM_EXEC))
157 __flush_icache(start, end);
158}
159
160void flush_icache_page(struct vm_area_struct *vma, struct page *page)
161{
162 unsigned long start = (unsigned long) page_address(page);
163 unsigned long end = start + PAGE_SIZE;
164
165 __flush_icache(start, end);
166}
167
168void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr,
169 unsigned long pfn)
170{
171 unsigned long start = vmaddr;
172 unsigned long end = start + PAGE_SIZE;
173
174 __flush_dcache(start, end);
175 if (vma->vm_flags & VM_EXEC)
176 __flush_icache(start, end);
177}
178
179void flush_dcache_page(struct page *page)
180{
181 struct address_space *mapping;
182
183 /*
184 * The zero page is never written to, so never has any dirty
185 * cache lines, and therefore never needs to be flushed.
186 */
187 if (page == ZERO_PAGE(0))
188 return;
189
190 mapping = page_mapping(page);
191
192 /* Flush this page if there are aliases. */
193 if (mapping && !mapping_mapped(mapping)) {
194 clear_bit(PG_dcache_clean, &page->flags);
195 } else {
196 unsigned long start = (unsigned long)page_address(page);
197
198 __flush_dcache_all(start, start + PAGE_SIZE);
199 if (mapping)
200 flush_aliases(mapping, page);
201 set_bit(PG_dcache_clean, &page->flags);
202 }
203}
204EXPORT_SYMBOL(flush_dcache_page);
205
206void update_mmu_cache(struct vm_area_struct *vma,
207 unsigned long address, pte_t *pte)
208{
209 unsigned long pfn = pte_pfn(*pte);
210 struct page *page;
211
212 if (!pfn_valid(pfn))
213 return;
214
215 /*
216 * The zero page is never written to, so never has any dirty
217 * cache lines, and therefore never needs to be flushed.
218 */
219 page = pfn_to_page(pfn);
220 if (page == ZERO_PAGE(0))
221 return;
222
223 if (!PageReserved(page) &&
224 !test_and_set_bit(PG_dcache_clean, &page->flags)) {
225 unsigned long start = page_to_virt(page);
226 struct address_space *mapping;
227
228 __flush_dcache(start, start + PAGE_SIZE);
229
230 mapping = page_mapping(page);
231 if (mapping)
232 flush_aliases(mapping, page);
233 }
234}
235
236void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
237 struct page *to)
238{
239 __flush_dcache(vaddr, vaddr + PAGE_SIZE);
240 copy_page(vto, vfrom);
241 __flush_dcache((unsigned long)vto, (unsigned long)vto + PAGE_SIZE);
242}
243
244void clear_user_page(void *addr, unsigned long vaddr, struct page *page)
245{
246 __flush_dcache(vaddr, vaddr + PAGE_SIZE);
247 clear_page(addr);
248 __flush_dcache((unsigned long)addr, (unsigned long)addr + PAGE_SIZE);
249}
250
251void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
252 unsigned long user_vaddr,
253 void *dst, void *src, int len)
254{
255 flush_cache_page(vma, user_vaddr, page_to_pfn(page));
256 memcpy(dst, src, len);
257 __flush_dcache((unsigned long)src, (unsigned long)src + len);
258 if (vma->vm_flags & VM_EXEC)
259 __flush_icache((unsigned long)src, (unsigned long)src + len);
260}
261
262void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
263 unsigned long user_vaddr,
264 void *dst, void *src, int len)
265{
266 flush_cache_page(vma, user_vaddr, page_to_pfn(page));
267 memcpy(dst, src, len);
268 __flush_dcache((unsigned long)dst, (unsigned long)dst + len);
269 if (vma->vm_flags & VM_EXEC)
270 __flush_icache((unsigned long)dst, (unsigned long)dst + len);
271}
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
new file mode 100644
index 000000000000..ac5da7594f0b
--- /dev/null
+++ b/arch/nios2/mm/dma-mapping.c
@@ -0,0 +1,186 @@
1/*
2 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2009 Wind River Systems Inc
4 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
5 *
6 * Based on DMA code from MIPS.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#include <linux/types.h>
14#include <linux/mm.h>
15#include <linux/export.h>
16#include <linux/string.h>
17#include <linux/scatterlist.h>
18#include <linux/dma-mapping.h>
19#include <linux/io.h>
20#include <linux/cache.h>
21#include <asm/cacheflush.h>
22
23
24void *dma_alloc_coherent(struct device *dev, size_t size,
25 dma_addr_t *dma_handle, gfp_t gfp)
26{
27 void *ret;
28
29 /* ignore region specifiers */
30 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
31
32 /* optimized page clearing */
33 gfp |= __GFP_ZERO;
34
35 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
36 gfp |= GFP_DMA;
37
38 ret = (void *) __get_free_pages(gfp, get_order(size));
39 if (ret != NULL) {
40 *dma_handle = virt_to_phys(ret);
41 flush_dcache_range((unsigned long) ret,
42 (unsigned long) ret + size);
43 ret = UNCAC_ADDR(ret);
44 }
45
46 return ret;
47}
48EXPORT_SYMBOL(dma_alloc_coherent);
49
50void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
51 dma_addr_t dma_handle)
52{
53 unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
54
55 free_pages(addr, get_order(size));
56}
57EXPORT_SYMBOL(dma_free_coherent);
58
59int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
60 enum dma_data_direction direction)
61{
62 int i;
63
64 BUG_ON(!valid_dma_direction(direction));
65
66 for_each_sg(sg, sg, nents, i) {
67 void *addr;
68
69 addr = sg_virt(sg);
70 if (addr) {
71 __dma_sync_for_device(addr, sg->length, direction);
72 sg->dma_address = sg_phys(sg);
73 }
74 }
75
76 return nents;
77}
78EXPORT_SYMBOL(dma_map_sg);
79
80dma_addr_t dma_map_page(struct device *dev, struct page *page,
81 unsigned long offset, size_t size,
82 enum dma_data_direction direction)
83{
84 void *addr;
85
86 BUG_ON(!valid_dma_direction(direction));
87
88 addr = page_address(page) + offset;
89 __dma_sync_for_device(addr, size, direction);
90
91 return page_to_phys(page) + offset;
92}
93EXPORT_SYMBOL(dma_map_page);
94
95void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
96 enum dma_data_direction direction)
97{
98 BUG_ON(!valid_dma_direction(direction));
99
100 __dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
101}
102EXPORT_SYMBOL(dma_unmap_page);
103
104void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
105 enum dma_data_direction direction)
106{
107 void *addr;
108 int i;
109
110 BUG_ON(!valid_dma_direction(direction));
111
112 if (direction == DMA_TO_DEVICE)
113 return;
114
115 for_each_sg(sg, sg, nhwentries, i) {
116 addr = sg_virt(sg);
117 if (addr)
118 __dma_sync_for_cpu(addr, sg->length, direction);
119 }
120}
121EXPORT_SYMBOL(dma_unmap_sg);
122
123void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
124 size_t size, enum dma_data_direction direction)
125{
126 BUG_ON(!valid_dma_direction(direction));
127
128 __dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
129}
130EXPORT_SYMBOL(dma_sync_single_for_cpu);
131
132void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
133 size_t size, enum dma_data_direction direction)
134{
135 BUG_ON(!valid_dma_direction(direction));
136
137 __dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
138}
139EXPORT_SYMBOL(dma_sync_single_for_device);
140
141void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
142 unsigned long offset, size_t size,
143 enum dma_data_direction direction)
144{
145 BUG_ON(!valid_dma_direction(direction));
146
147 __dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
148}
149EXPORT_SYMBOL(dma_sync_single_range_for_cpu);
150
151void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
152 unsigned long offset, size_t size,
153 enum dma_data_direction direction)
154{
155 BUG_ON(!valid_dma_direction(direction));
156
157 __dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
158}
159EXPORT_SYMBOL(dma_sync_single_range_for_device);
160
161void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
162 enum dma_data_direction direction)
163{
164 int i;
165
166 BUG_ON(!valid_dma_direction(direction));
167
168 /* Make sure that gcc doesn't leave the empty loop body. */
169 for_each_sg(sg, sg, nelems, i)
170 __dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
171}
172EXPORT_SYMBOL(dma_sync_sg_for_cpu);
173
174void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
175 int nelems, enum dma_data_direction direction)
176{
177 int i;
178
179 BUG_ON(!valid_dma_direction(direction));
180
181 /* Make sure that gcc doesn't leave the empty loop body. */
182 for_each_sg(sg, sg, nelems, i)
183 __dma_sync_for_device(sg_virt(sg), sg->length, direction);
184
185}
186EXPORT_SYMBOL(dma_sync_sg_for_device);
diff --git a/arch/nios2/mm/extable.c b/arch/nios2/mm/extable.c
new file mode 100644
index 000000000000..4d2fc5a589d0
--- /dev/null
+++ b/arch/nios2/mm/extable.c
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2010, Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2009, Wind River Systems Inc
4 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/module.h>
12#include <linux/uaccess.h>
13
14int fixup_exception(struct pt_regs *regs)
15{
16 const struct exception_table_entry *fixup;
17
18 fixup = search_exception_tables(regs->ea);
19 if (fixup) {
20 regs->ea = fixup->fixup;
21 return 1;
22 }
23
24 return 0;
25}
diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c
new file mode 100644
index 000000000000..15a0bb5fc06d
--- /dev/null
+++ b/arch/nios2/mm/fault.c
@@ -0,0 +1,251 @@
1/*
2 * Copyright (C) 2009 Wind River Systems Inc
3 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
4 *
5 * based on arch/mips/mm/fault.c which is:
6 *
7 * Copyright (C) 1995-2000 Ralf Baechle
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
14#include <linux/signal.h>
15#include <linux/sched.h>
16#include <linux/interrupt.h>
17#include <linux/kernel.h>
18#include <linux/errno.h>
19#include <linux/string.h>
20#include <linux/types.h>
21#include <linux/ptrace.h>
22#include <linux/mman.h>
23#include <linux/mm.h>
24#include <linux/module.h>
25#include <linux/uaccess.h>
26#include <linux/ptrace.h>
27
28#include <asm/mmu_context.h>
29#include <asm/traps.h>
30
31#define EXC_SUPERV_INSN_ACCESS 9 /* Supervisor only instruction address */
32#define EXC_SUPERV_DATA_ACCESS 11 /* Supervisor only data address */
33#define EXC_X_PROTECTION_FAULT 13 /* TLB permission violation (x) */
34#define EXC_R_PROTECTION_FAULT 14 /* TLB permission violation (r) */
35#define EXC_W_PROTECTION_FAULT 15 /* TLB permission violation (w) */
36
37/*
38 * This routine handles page faults. It determines the address,
39 * and the problem, and then passes it off to one of the appropriate
40 * routines.
41 */
42asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,
43 unsigned long address)
44{
45 struct vm_area_struct *vma = NULL;
46 struct task_struct *tsk = current;
47 struct mm_struct *mm = tsk->mm;
48 int code = SEGV_MAPERR;
49 int fault;
50 unsigned int flags = 0;
51
52 cause >>= 2;
53
54 /* Restart the instruction */
55 regs->ea -= 4;
56
57 /*
58 * We fault-in kernel-space virtual memory on-demand. The
59 * 'reference' page table is init_mm.pgd.
60 *
61 * NOTE! We MUST NOT take any locks for this case. We may
62 * be in an interrupt or a critical region, and should
63 * only copy the information from the master page table,
64 * nothing more.
65 */
66 if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END)) {
67 if (user_mode(regs))
68 goto bad_area_nosemaphore;
69 else
70 goto vmalloc_fault;
71 }
72
73 if (unlikely(address >= TASK_SIZE))
74 goto bad_area_nosemaphore;
75
76 /*
77 * If we're in an interrupt or have no user
78 * context, we must not take the fault..
79 */
80 if (in_atomic() || !mm)
81 goto bad_area_nosemaphore;
82
83 if (user_mode(regs))
84 flags |= FAULT_FLAG_USER;
85
86 if (!down_read_trylock(&mm->mmap_sem)) {
87 if (!user_mode(regs) && !search_exception_tables(regs->ea))
88 goto bad_area_nosemaphore;
89 down_read(&mm->mmap_sem);
90 }
91
92 vma = find_vma(mm, address);
93 if (!vma)
94 goto bad_area;
95 if (vma->vm_start <= address)
96 goto good_area;
97 if (!(vma->vm_flags & VM_GROWSDOWN))
98 goto bad_area;
99 if (expand_stack(vma, address))
100 goto bad_area;
101/*
102 * Ok, we have a good vm_area for this memory access, so
103 * we can handle it..
104 */
105good_area:
106 code = SEGV_ACCERR;
107
108 switch (cause) {
109 case EXC_SUPERV_INSN_ACCESS:
110 goto bad_area;
111 case EXC_SUPERV_DATA_ACCESS:
112 goto bad_area;
113 case EXC_X_PROTECTION_FAULT:
114 if (!(vma->vm_flags & VM_EXEC))
115 goto bad_area;
116 break;
117 case EXC_R_PROTECTION_FAULT:
118 if (!(vma->vm_flags & VM_READ))
119 goto bad_area;
120 break;
121 case EXC_W_PROTECTION_FAULT:
122 if (!(vma->vm_flags & VM_WRITE))
123 goto bad_area;
124 flags = FAULT_FLAG_WRITE;
125 break;
126 }
127
128survive:
129 /*
130 * If for any reason at all we couldn't handle the fault,
131 * make sure we exit gracefully rather than endlessly redo
132 * the fault.
133 */
134 fault = handle_mm_fault(mm, vma, address, flags);
135 if (unlikely(fault & VM_FAULT_ERROR)) {
136 if (fault & VM_FAULT_OOM)
137 goto out_of_memory;
138 else if (fault & VM_FAULT_SIGBUS)
139 goto do_sigbus;
140 BUG();
141 }
142 if (fault & VM_FAULT_MAJOR)
143 tsk->maj_flt++;
144 else
145 tsk->min_flt++;
146
147 up_read(&mm->mmap_sem);
148 return;
149
150/*
151 * Something tried to access memory that isn't in our memory map..
152 * Fix it, but check if it's kernel or user first..
153 */
154bad_area:
155 up_read(&mm->mmap_sem);
156
157bad_area_nosemaphore:
158 /* User mode accesses just cause a SIGSEGV */
159 if (user_mode(regs)) {
160 pr_alert("%s: unhandled page fault (%d) at 0x%08lx, "
161 "cause %ld\n", current->comm, SIGSEGV, address, cause);
162 show_regs(regs);
163 _exception(SIGSEGV, regs, code, address);
164 return;
165 }
166
167no_context:
168 /* Are we prepared to handle this kernel fault? */
169 if (fixup_exception(regs))
170 return;
171
172 /*
173 * Oops. The kernel tried to access some bad page. We'll have to
174 * terminate things with extreme prejudice.
175 */
176 bust_spinlocks(1);
177
178 pr_alert("Unable to handle kernel %s at virtual address %08lx",
179 address < PAGE_SIZE ? "NULL pointer dereference" :
180 "paging request", address);
181 pr_alert("ea = %08lx, ra = %08lx, cause = %ld\n", regs->ea, regs->ra,
182 cause);
183 panic("Oops");
184 return;
185
186/*
187 * We ran out of memory, or some other thing happened to us that made
188 * us unable to handle the page fault gracefully.
189 */
190out_of_memory:
191 up_read(&mm->mmap_sem);
192 if (is_global_init(tsk)) {
193 yield();
194 down_read(&mm->mmap_sem);
195 goto survive;
196 }
197 if (!user_mode(regs))
198 goto no_context;
199 pagefault_out_of_memory();
200 return;
201
202do_sigbus:
203 up_read(&mm->mmap_sem);
204
205 /* Kernel mode? Handle exceptions or die */
206 if (!user_mode(regs))
207 goto no_context;
208
209 _exception(SIGBUS, regs, BUS_ADRERR, address);
210 return;
211
212vmalloc_fault:
213 {
214 /*
215 * Synchronize this task's top level page-table
216 * with the 'reference' page table.
217 *
218 * Do _not_ use "tsk" here. We might be inside
219 * an interrupt in the middle of a task switch..
220 */
221 int offset = pgd_index(address);
222 pgd_t *pgd, *pgd_k;
223 pud_t *pud, *pud_k;
224 pmd_t *pmd, *pmd_k;
225 pte_t *pte_k;
226
227 pgd = pgd_current + offset;
228 pgd_k = init_mm.pgd + offset;
229
230 if (!pgd_present(*pgd_k))
231 goto no_context;
232 set_pgd(pgd, *pgd_k);
233
234 pud = pud_offset(pgd, address);
235 pud_k = pud_offset(pgd_k, address);
236 if (!pud_present(*pud_k))
237 goto no_context;
238 pmd = pmd_offset(pud, address);
239 pmd_k = pmd_offset(pud_k, address);
240 if (!pmd_present(*pmd_k))
241 goto no_context;
242 set_pmd(pmd, *pmd_k);
243
244 pte_k = pte_offset_kernel(pmd_k, address);
245 if (!pte_present(*pte_k))
246 goto no_context;
247
248 flush_tlb_one(address);
249 return;
250 }
251}
diff --git a/arch/nios2/mm/init.c b/arch/nios2/mm/init.c
new file mode 100644
index 000000000000..e75c75d249d6
--- /dev/null
+++ b/arch/nios2/mm/init.c
@@ -0,0 +1,142 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2009 Wind River Systems Inc
5 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
6 * Copyright (C) 2004 Microtronix Datacom Ltd
7 *
8 * based on arch/m68k/mm/init.c
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14
15#include <linux/signal.h>
16#include <linux/sched.h>
17#include <linux/kernel.h>
18#include <linux/errno.h>
19#include <linux/string.h>
20#include <linux/types.h>
21#include <linux/ptrace.h>
22#include <linux/mman.h>
23#include <linux/mm.h>
24#include <linux/init.h>
25#include <linux/pagemap.h>
26#include <linux/bootmem.h>
27#include <linux/slab.h>
28#include <linux/binfmts.h>
29
30#include <asm/setup.h>
31#include <asm/page.h>
32#include <asm/pgtable.h>
33#include <asm/sections.h>
34#include <asm/tlb.h>
35#include <asm/mmu_context.h>
36#include <asm/cpuinfo.h>
37#include <asm/processor.h>
38
39pgd_t *pgd_current;
40
41/*
42 * paging_init() continues the virtual memory environment setup which
43 * was begun by the code in arch/head.S.
44 * The parameters are pointers to where to stick the starting and ending
45 * addresses of available kernel virtual memory.
46 */
47void __init paging_init(void)
48{
49 unsigned long zones_size[MAX_NR_ZONES];
50
51 memset(zones_size, 0, sizeof(zones_size));
52
53 pagetable_init();
54 pgd_current = swapper_pg_dir;
55
56 zones_size[ZONE_NORMAL] = max_mapnr;
57
58 /* pass the memory from the bootmem allocator to the main allocator */
59 free_area_init(zones_size);
60
61 flush_dcache_range((unsigned long)empty_zero_page,
62 (unsigned long)empty_zero_page + PAGE_SIZE);
63}
64
65void __init mem_init(void)
66{
67 unsigned long end_mem = memory_end; /* this must not include
68 kernel stack at top */
69
70 pr_debug("mem_init: start=%lx, end=%lx\n", memory_start, memory_end);
71
72 end_mem &= PAGE_MASK;
73 high_memory = __va(end_mem);
74
75 /* this will put all memory onto the freelists */
76 free_all_bootmem();
77 mem_init_print_info(NULL);
78}
79
80void __init mmu_init(void)
81{
82 flush_tlb_all();
83}
84
85#ifdef CONFIG_BLK_DEV_INITRD
86void __init free_initrd_mem(unsigned long start, unsigned long end)
87{
88 free_reserved_area((void *)start, (void *)end, -1, "initrd");
89}
90#endif
91
92void __init_refok free_initmem(void)
93{
94 free_initmem_default(-1);
95}
96
97#define __page_aligned(order) __aligned(PAGE_SIZE << (order))
98pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned(PGD_ORDER);
99pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned(PTE_ORDER);
100static struct page *kuser_page[1];
101
102static int alloc_kuser_page(void)
103{
104 extern char __kuser_helper_start[], __kuser_helper_end[];
105 int kuser_sz = __kuser_helper_end - __kuser_helper_start;
106 unsigned long vpage;
107
108 vpage = get_zeroed_page(GFP_ATOMIC);
109 if (!vpage)
110 return -ENOMEM;
111
112 /* Copy kuser helpers */
113 memcpy((void *)vpage, __kuser_helper_start, kuser_sz);
114
115 flush_icache_range(vpage, vpage + KUSER_SIZE);
116 kuser_page[0] = virt_to_page(vpage);
117
118 return 0;
119}
120arch_initcall(alloc_kuser_page);
121
122int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
123{
124 struct mm_struct *mm = current->mm;
125 int ret;
126
127 down_write(&mm->mmap_sem);
128
129 /* Map kuser helpers to user space address */
130 ret = install_special_mapping(mm, KUSER_BASE, KUSER_SIZE,
131 VM_READ | VM_EXEC | VM_MAYREAD |
132 VM_MAYEXEC, kuser_page);
133
134 up_write(&mm->mmap_sem);
135
136 return ret;
137}
138
139const char *arch_vma_name(struct vm_area_struct *vma)
140{
141 return (vma->vm_start == KUSER_BASE) ? "[kuser]" : NULL;
142}
diff --git a/arch/nios2/mm/ioremap.c b/arch/nios2/mm/ioremap.c
new file mode 100644
index 000000000000..3a28177a01eb
--- /dev/null
+++ b/arch/nios2/mm/ioremap.c
@@ -0,0 +1,187 @@
1/*
2 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
3 * Copyright (C) 2009 Wind River Systems Inc
4 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
5 * Copyright (C) 2004 Microtronix Datacom Ltd.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/export.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15#include <linux/slab.h>
16#include <linux/vmalloc.h>
17#include <linux/io.h>
18
19#include <asm/cacheflush.h>
20#include <asm/tlbflush.h>
21
22static inline void remap_area_pte(pte_t *pte, unsigned long address,
23 unsigned long size, unsigned long phys_addr,
24 unsigned long flags)
25{
26 unsigned long end;
27 unsigned long pfn;
28 pgprot_t pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | _PAGE_READ
29 | _PAGE_WRITE | flags);
30
31 address &= ~PMD_MASK;
32 end = address + size;
33 if (end > PMD_SIZE)
34 end = PMD_SIZE;
35 if (address >= end)
36 BUG();
37 pfn = PFN_DOWN(phys_addr);
38 do {
39 if (!pte_none(*pte)) {
40 pr_err("remap_area_pte: page already exists\n");
41 BUG();
42 }
43 set_pte(pte, pfn_pte(pfn, pgprot));
44 address += PAGE_SIZE;
45 pfn++;
46 pte++;
47 } while (address && (address < end));
48}
49
50static inline int remap_area_pmd(pmd_t *pmd, unsigned long address,
51 unsigned long size, unsigned long phys_addr,
52 unsigned long flags)
53{
54 unsigned long end;
55
56 address &= ~PGDIR_MASK;
57 end = address + size;
58 if (end > PGDIR_SIZE)
59 end = PGDIR_SIZE;
60 phys_addr -= address;
61 if (address >= end)
62 BUG();
63 do {
64 pte_t *pte = pte_alloc_kernel(pmd, address);
65
66 if (!pte)
67 return -ENOMEM;
68 remap_area_pte(pte, address, end - address, address + phys_addr,
69 flags);
70 address = (address + PMD_SIZE) & PMD_MASK;
71 pmd++;
72 } while (address && (address < end));
73 return 0;
74}
75
76static int remap_area_pages(unsigned long address, unsigned long phys_addr,
77 unsigned long size, unsigned long flags)
78{
79 int error;
80 pgd_t *dir;
81 unsigned long end = address + size;
82
83 phys_addr -= address;
84 dir = pgd_offset(&init_mm, address);
85 flush_cache_all();
86 if (address >= end)
87 BUG();
88 do {
89 pud_t *pud;
90 pmd_t *pmd;
91
92 error = -ENOMEM;
93 pud = pud_alloc(&init_mm, dir, address);
94 if (!pud)
95 break;
96 pmd = pmd_alloc(&init_mm, pud, address);
97 if (!pmd)
98 break;
99 if (remap_area_pmd(pmd, address, end - address,
100 phys_addr + address, flags))
101 break;
102 error = 0;
103 address = (address + PGDIR_SIZE) & PGDIR_MASK;
104 dir++;
105 } while (address && (address < end));
106 flush_tlb_all();
107 return error;
108}
109
110#define IS_MAPPABLE_UNCACHEABLE(addr) (addr < 0x20000000UL)
111
112/*
113 * Map some physical address range into the kernel address space.
114 */
115void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
116 unsigned long cacheflag)
117{
118 struct vm_struct *area;
119 unsigned long offset;
120 unsigned long last_addr;
121 void *addr;
122
123 /* Don't allow wraparound or zero size */
124 last_addr = phys_addr + size - 1;
125
126 if (!size || last_addr < phys_addr)
127 return NULL;
128
129 /* Don't allow anybody to remap normal RAM that we're using */
130 if (phys_addr > PHYS_OFFSET && phys_addr < virt_to_phys(high_memory)) {
131 char *t_addr, *t_end;
132 struct page *page;
133
134 t_addr = __va(phys_addr);
135 t_end = t_addr + (size - 1);
136 for (page = virt_to_page(t_addr);
137 page <= virt_to_page(t_end); page++)
138 if (!PageReserved(page))
139 return NULL;
140 }
141
142 /*
143 * Map uncached objects in the low part of address space to
144 * CONFIG_NIOS2_IO_REGION_BASE
145 */
146 if (IS_MAPPABLE_UNCACHEABLE(phys_addr) &&
147 IS_MAPPABLE_UNCACHEABLE(last_addr) &&
148 !(cacheflag & _PAGE_CACHED))
149 return (void __iomem *)(CONFIG_NIOS2_IO_REGION_BASE + phys_addr);
150
151 /* Mappings have to be page-aligned */
152 offset = phys_addr & ~PAGE_MASK;
153 phys_addr &= PAGE_MASK;
154 size = PAGE_ALIGN(last_addr + 1) - phys_addr;
155
156 /* Ok, go for it */
157 area = get_vm_area(size, VM_IOREMAP);
158 if (!area)
159 return NULL;
160 addr = area->addr;
161 if (remap_area_pages((unsigned long) addr, phys_addr, size,
162 cacheflag)) {
163 vunmap(addr);
164 return NULL;
165 }
166 return (void __iomem *) (offset + (char *)addr);
167}
168EXPORT_SYMBOL(__ioremap);
169
170/*
171 * __iounmap unmaps nearly everything, so be careful
172 * it doesn't free currently pointer/page tables anymore but it
173 * wasn't used anyway and might be added later.
174 */
175void __iounmap(void __iomem *addr)
176{
177 struct vm_struct *p;
178
179 if ((unsigned long) addr > CONFIG_NIOS2_IO_REGION_BASE)
180 return;
181
182 p = remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr));
183 if (!p)
184 pr_err("iounmap: bad address %p\n", addr);
185 kfree(p);
186}
187EXPORT_SYMBOL(__iounmap);
diff --git a/arch/nios2/mm/mmu_context.c b/arch/nios2/mm/mmu_context.c
new file mode 100644
index 000000000000..45d6b9c58d67
--- /dev/null
+++ b/arch/nios2/mm/mmu_context.c
@@ -0,0 +1,116 @@
1/*
2 * MMU context handling.
3 *
4 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
5 * Copyright (C) 2009 Wind River Systems Inc
6 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#include <linux/mm.h>
14
15#include <asm/cpuinfo.h>
16#include <asm/mmu_context.h>
17#include <asm/tlb.h>
18
19/* The pids position and mask in context */
20#define PID_SHIFT 0
21#define PID_BITS (cpuinfo.tlb_pid_num_bits)
22#define PID_MASK ((1UL << PID_BITS) - 1)
23
24/* The versions position and mask in context */
25#define VERSION_BITS (32 - PID_BITS)
26#define VERSION_SHIFT (PID_SHIFT + PID_BITS)
27#define VERSION_MASK ((1UL << VERSION_BITS) - 1)
28
29/* Return the version part of a context */
30#define CTX_VERSION(c) (((c) >> VERSION_SHIFT) & VERSION_MASK)
31
32/* Return the pid part of a context */
33#define CTX_PID(c) (((c) >> PID_SHIFT) & PID_MASK)
34
35/* Value of the first context (version 1, pid 0) */
36#define FIRST_CTX ((1UL << VERSION_SHIFT) | (0 << PID_SHIFT))
37
38static mm_context_t next_mmu_context;
39
40/*
41 * Initialize MMU context management stuff.
42 */
43void __init mmu_context_init(void)
44{
45 /* We need to set this here because the value depends on runtime data
46 * from cpuinfo */
47 next_mmu_context = FIRST_CTX;
48}
49
50/*
51 * Set new context (pid), keep way
52 */
53static void set_context(mm_context_t context)
54{
55 set_mmu_pid(CTX_PID(context));
56}
57
58static mm_context_t get_new_context(void)
59{
60 /* Return the next pid */
61 next_mmu_context += (1UL << PID_SHIFT);
62
63 /* If the pid field wraps around we increase the version and
64 * flush the tlb */
65 if (unlikely(CTX_PID(next_mmu_context) == 0)) {
66 /* Version is incremented since the pid increment above
67 * overflows info version */
68 flush_cache_all();
69 flush_tlb_all();
70 }
71
72 /* If the version wraps we start over with the first generation, we do
73 * not need to flush the tlb here since it's always done above */
74 if (unlikely(CTX_VERSION(next_mmu_context) == 0))
75 next_mmu_context = FIRST_CTX;
76
77 return next_mmu_context;
78}
79
80void switch_mm(struct mm_struct *prev, struct mm_struct *next,
81 struct task_struct *tsk)
82{
83 unsigned long flags;
84
85 local_irq_save(flags);
86
87 /* If the process context we are swapping in has a different context
88 * generation then we have it should get a new generation/pid */
89 if (unlikely(CTX_VERSION(next->context) !=
90 CTX_VERSION(next_mmu_context)))
91 next->context = get_new_context();
92
93 /* Save the current pgd so the fast tlb handler can find it */
94 pgd_current = next->pgd;
95
96 /* Set the current context */
97 set_context(next->context);
98
99 local_irq_restore(flags);
100}
101
102/*
103 * After we have set current->mm to a new value, this activates
104 * the context for the new mm so we see the new mappings.
105 */
106void activate_mm(struct mm_struct *prev, struct mm_struct *next)
107{
108 next->context = get_new_context();
109 set_context(next->context);
110 pgd_current = next->pgd;
111}
112
113unsigned long get_pid_from_context(mm_context_t *context)
114{
115 return CTX_PID((*context));
116}
diff --git a/arch/nios2/mm/pgtable.c b/arch/nios2/mm/pgtable.c
new file mode 100644
index 000000000000..61e24a25f71a
--- /dev/null
+++ b/arch/nios2/mm/pgtable.c
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2009 Wind River Systems Inc
3 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#include <linux/mm.h>
11#include <linux/sched.h>
12
13#include <asm/pgtable.h>
14#include <asm/cpuinfo.h>
15
16/* pteaddr:
17 * ptbase | vpn* | zero
18 * 31-22 | 21-2 | 1-0
19 *
20 * *vpn is preserved on double fault
21 *
22 * tlbacc:
23 * IG |*flags| pfn
24 * 31-25|24-20 | 19-0
25 *
26 * *crwxg
27 *
28 * tlbmisc:
29 * resv |way |rd | we|pid |dbl|bad|perm|d
30 * 31-24 |23-20 |19 | 20|17-4|3 |2 |1 |0
31 *
32 */
33
34/*
35 * Initialize a new pgd / pmd table with invalid pointers.
36 */
37static void pgd_init(pgd_t *pgd)
38{
39 unsigned long *p = (unsigned long *) pgd;
40 int i;
41
42 for (i = 0; i < USER_PTRS_PER_PGD; i += 8) {
43 p[i + 0] = (unsigned long) invalid_pte_table;
44 p[i + 1] = (unsigned long) invalid_pte_table;
45 p[i + 2] = (unsigned long) invalid_pte_table;
46 p[i + 3] = (unsigned long) invalid_pte_table;
47 p[i + 4] = (unsigned long) invalid_pte_table;
48 p[i + 5] = (unsigned long) invalid_pte_table;
49 p[i + 6] = (unsigned long) invalid_pte_table;
50 p[i + 7] = (unsigned long) invalid_pte_table;
51 }
52}
53
54pgd_t *pgd_alloc(struct mm_struct *mm)
55{
56 pgd_t *ret, *init;
57
58 ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER);
59 if (ret) {
60 init = pgd_offset(&init_mm, 0UL);
61 pgd_init(ret);
62 memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
63 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
64 }
65
66 return ret;
67}
68
69void __init pagetable_init(void)
70{
71 /* Initialize the entire pgd. */
72 pgd_init(swapper_pg_dir);
73 pgd_init(swapper_pg_dir + USER_PTRS_PER_PGD);
74}
diff --git a/arch/nios2/mm/tlb.c b/arch/nios2/mm/tlb.c
new file mode 100644
index 000000000000..cf10326aab1c
--- /dev/null
+++ b/arch/nios2/mm/tlb.c
@@ -0,0 +1,275 @@
1/*
2 * Nios2 TLB handling
3 *
4 * Copyright (C) 2009, Wind River Systems Inc
5 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/init.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15#include <linux/pagemap.h>
16
17#include <asm/tlb.h>
18#include <asm/mmu_context.h>
19#include <asm/pgtable.h>
20#include <asm/cpuinfo.h>
21
22#define TLB_INDEX_MASK \
23 ((((1UL << (cpuinfo.tlb_ptr_sz - cpuinfo.tlb_num_ways_log2))) - 1) \
24 << PAGE_SHIFT)
25
26/* Used as illegal PHYS_ADDR for TLB mappings
27 */
28#define MAX_PHYS_ADDR 0
29
30static void get_misc_and_pid(unsigned long *misc, unsigned long *pid)
31{
32 *misc = RDCTL(CTL_TLBMISC);
33 *misc &= (TLBMISC_PID | TLBMISC_WAY);
34 *pid = *misc & TLBMISC_PID;
35}
36
37/*
38 * All entries common to a mm share an asid. To effectively flush these
39 * entries, we just bump the asid.
40 */
41void flush_tlb_mm(struct mm_struct *mm)
42{
43 if (current->mm == mm)
44 flush_tlb_all();
45 else
46 memset(&mm->context, 0, sizeof(mm_context_t));
47}
48
49/*
50 * This one is only used for pages with the global bit set so we don't care
51 * much about the ASID.
52 */
53void flush_tlb_one_pid(unsigned long addr, unsigned long mmu_pid)
54{
55 unsigned int way;
56 unsigned long org_misc, pid_misc;
57
58 pr_debug("Flush tlb-entry for vaddr=%#lx\n", addr);
59
60 /* remember pid/way until we return. */
61 get_misc_and_pid(&org_misc, &pid_misc);
62
63 WRCTL(CTL_PTEADDR, (addr >> PAGE_SHIFT) << 2);
64
65 for (way = 0; way < cpuinfo.tlb_num_ways; way++) {
66 unsigned long pteaddr;
67 unsigned long tlbmisc;
68 unsigned long pid;
69
70 tlbmisc = pid_misc | TLBMISC_RD | (way << TLBMISC_WAY_SHIFT);
71 WRCTL(CTL_TLBMISC, tlbmisc);
72 pteaddr = RDCTL(CTL_PTEADDR);
73 tlbmisc = RDCTL(CTL_TLBMISC);
74 pid = (tlbmisc >> TLBMISC_PID_SHIFT) & TLBMISC_PID_MASK;
75 if (((((pteaddr >> 2) & 0xfffff)) == (addr >> PAGE_SHIFT)) &&
76 pid == mmu_pid) {
77 unsigned long vaddr = CONFIG_NIOS2_IO_REGION_BASE +
78 ((PAGE_SIZE * cpuinfo.tlb_num_lines) * way) +
79 (addr & TLB_INDEX_MASK);
80 pr_debug("Flush entry by writing %#lx way=%dl pid=%ld\n",
81 vaddr, way, (pid_misc >> TLBMISC_PID_SHIFT));
82
83 WRCTL(CTL_PTEADDR, (vaddr >> 12) << 2);
84 tlbmisc = pid_misc | TLBMISC_WE |
85 (way << TLBMISC_WAY_SHIFT);
86 WRCTL(CTL_TLBMISC, tlbmisc);
87 WRCTL(CTL_TLBACC, (MAX_PHYS_ADDR >> PAGE_SHIFT));
88 }
89 }
90
91 WRCTL(CTL_TLBMISC, org_misc);
92}
93
94void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
95 unsigned long end)
96{
97 unsigned long mmu_pid = get_pid_from_context(&vma->vm_mm->context);
98
99 while (start < end) {
100 flush_tlb_one_pid(start, mmu_pid);
101 start += PAGE_SIZE;
102 }
103}
104
105void flush_tlb_kernel_range(unsigned long start, unsigned long end)
106{
107 while (start < end) {
108 flush_tlb_one(start);
109 start += PAGE_SIZE;
110 }
111}
112
113/*
114 * This one is only used for pages with the global bit set so we don't care
115 * much about the ASID.
116 */
117void flush_tlb_one(unsigned long addr)
118{
119 unsigned int way;
120 unsigned long org_misc, pid_misc;
121
122 pr_debug("Flush tlb-entry for vaddr=%#lx\n", addr);
123
124 /* remember pid/way until we return. */
125 get_misc_and_pid(&org_misc, &pid_misc);
126
127 WRCTL(CTL_PTEADDR, (addr >> PAGE_SHIFT) << 2);
128
129 for (way = 0; way < cpuinfo.tlb_num_ways; way++) {
130 unsigned long pteaddr;
131 unsigned long tlbmisc;
132
133 tlbmisc = pid_misc | TLBMISC_RD | (way << TLBMISC_WAY_SHIFT);
134 WRCTL(CTL_TLBMISC, tlbmisc);
135 pteaddr = RDCTL(CTL_PTEADDR);
136 tlbmisc = RDCTL(CTL_TLBMISC);
137
138 if ((((pteaddr >> 2) & 0xfffff)) == (addr >> PAGE_SHIFT)) {
139 unsigned long vaddr = CONFIG_NIOS2_IO_REGION_BASE +
140 ((PAGE_SIZE * cpuinfo.tlb_num_lines) * way) +
141 (addr & TLB_INDEX_MASK);
142
143 pr_debug("Flush entry by writing %#lx way=%dl pid=%ld\n",
144 vaddr, way, (pid_misc >> TLBMISC_PID_SHIFT));
145
146 tlbmisc = pid_misc | TLBMISC_WE |
147 (way << TLBMISC_WAY_SHIFT);
148 WRCTL(CTL_PTEADDR, (vaddr >> 12) << 2);
149 WRCTL(CTL_TLBMISC, tlbmisc);
150 WRCTL(CTL_TLBACC, (MAX_PHYS_ADDR >> PAGE_SHIFT));
151 }
152 }
153
154 WRCTL(CTL_TLBMISC, org_misc);
155}
156
157void dump_tlb_line(unsigned long line)
158{
159 unsigned int way;
160 unsigned long org_misc;
161
162 pr_debug("dump tlb-entries for line=%#lx (addr %08lx)\n", line,
163 line << (PAGE_SHIFT + cpuinfo.tlb_num_ways_log2));
164
165 /* remember pid/way until we return */
166 org_misc = (RDCTL(CTL_TLBMISC) & (TLBMISC_PID | TLBMISC_WAY));
167
168 WRCTL(CTL_PTEADDR, line << 2);
169
170 for (way = 0; way < cpuinfo.tlb_num_ways; way++) {
171 unsigned long pteaddr;
172 unsigned long tlbmisc;
173 unsigned long tlbacc;
174
175 WRCTL(CTL_TLBMISC, TLBMISC_RD | (way << TLBMISC_WAY_SHIFT));
176 pteaddr = RDCTL(CTL_PTEADDR);
177 tlbmisc = RDCTL(CTL_TLBMISC);
178 tlbacc = RDCTL(CTL_TLBACC);
179
180 if ((tlbacc << PAGE_SHIFT) != (MAX_PHYS_ADDR & PAGE_MASK)) {
181 pr_debug("-- way:%02x vpn:0x%08lx phys:0x%08lx pid:0x%02lx flags:%c%c%c%c%c\n",
182 way,
183 (pteaddr << (PAGE_SHIFT-2)),
184 (tlbacc << PAGE_SHIFT),
185 ((tlbmisc >> TLBMISC_PID_SHIFT) &
186 TLBMISC_PID_MASK),
187 (tlbacc & _PAGE_READ ? 'r' : '-'),
188 (tlbacc & _PAGE_WRITE ? 'w' : '-'),
189 (tlbacc & _PAGE_EXEC ? 'x' : '-'),
190 (tlbacc & _PAGE_GLOBAL ? 'g' : '-'),
191 (tlbacc & _PAGE_CACHED ? 'c' : '-'));
192 }
193 }
194
195 WRCTL(CTL_TLBMISC, org_misc);
196}
197
198void dump_tlb(void)
199{
200 unsigned int i;
201
202 for (i = 0; i < cpuinfo.tlb_num_lines; i++)
203 dump_tlb_line(i);
204}
205
206void flush_tlb_pid(unsigned long pid)
207{
208 unsigned int line;
209 unsigned int way;
210 unsigned long org_misc, pid_misc;
211
212 /* remember pid/way until we return */
213 get_misc_and_pid(&org_misc, &pid_misc);
214
215 for (line = 0; line < cpuinfo.tlb_num_lines; line++) {
216 WRCTL(CTL_PTEADDR, line << 2);
217
218 for (way = 0; way < cpuinfo.tlb_num_ways; way++) {
219 unsigned long pteaddr;
220 unsigned long tlbmisc;
221 unsigned long tlbacc;
222
223 tlbmisc = pid_misc | TLBMISC_RD |
224 (way << TLBMISC_WAY_SHIFT);
225 WRCTL(CTL_TLBMISC, tlbmisc);
226 pteaddr = RDCTL(CTL_PTEADDR);
227 tlbmisc = RDCTL(CTL_TLBMISC);
228 tlbacc = RDCTL(CTL_TLBACC);
229
230 if (((tlbmisc>>TLBMISC_PID_SHIFT) & TLBMISC_PID_MASK)
231 == pid) {
232 tlbmisc = pid_misc | TLBMISC_WE |
233 (way << TLBMISC_WAY_SHIFT);
234 WRCTL(CTL_TLBMISC, tlbmisc);
235 WRCTL(CTL_TLBACC,
236 (MAX_PHYS_ADDR >> PAGE_SHIFT));
237 }
238 }
239
240 WRCTL(CTL_TLBMISC, org_misc);
241 }
242}
243
244void flush_tlb_all(void)
245{
246 int i;
247 unsigned long vaddr = CONFIG_NIOS2_IO_REGION_BASE;
248 unsigned int way;
249 unsigned long org_misc, pid_misc, tlbmisc;
250
251 /* remember pid/way until we return */
252 get_misc_and_pid(&org_misc, &pid_misc);
253 pid_misc |= TLBMISC_WE;
254
255 /* Map each TLB entry to physcal address 0 with no-access and a
256 bad ptbase */
257 for (way = 0; way < cpuinfo.tlb_num_ways; way++) {
258 tlbmisc = pid_misc | (way << TLBMISC_WAY_SHIFT);
259 for (i = 0; i < cpuinfo.tlb_num_lines; i++) {
260 WRCTL(CTL_PTEADDR, ((vaddr) >> PAGE_SHIFT) << 2);
261 WRCTL(CTL_TLBMISC, tlbmisc);
262 WRCTL(CTL_TLBACC, (MAX_PHYS_ADDR >> PAGE_SHIFT));
263 vaddr += 1UL << 12;
264 }
265 }
266
267 /* restore pid/way */
268 WRCTL(CTL_TLBMISC, org_misc);
269}
270
271void set_mmu_pid(unsigned long pid)
272{
273 WRCTL(CTL_TLBMISC, (RDCTL(CTL_TLBMISC) & TLBMISC_WAY) |
274 ((pid & TLBMISC_PID_MASK) << TLBMISC_PID_SHIFT));
275}
diff --git a/arch/nios2/mm/uaccess.c b/arch/nios2/mm/uaccess.c
new file mode 100644
index 000000000000..7663e156ff4f
--- /dev/null
+++ b/arch/nios2/mm/uaccess.c
@@ -0,0 +1,163 @@
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) 2009, Wind River Systems Inc
7 * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
8 */
9
10#include <linux/export.h>
11#include <linux/uaccess.h>
12
13asm(".global __copy_from_user\n"
14 " .type __copy_from_user, @function\n"
15 "__copy_from_user:\n"
16 " movi r2,7\n"
17 " mov r3,r4\n"
18 " bge r2,r6,1f\n"
19 " xor r2,r4,r5\n"
20 " andi r2,r2,3\n"
21 " movi r7,3\n"
22 " beq r2,zero,4f\n"
23 "1: addi r6,r6,-1\n"
24 " movi r2,-1\n"
25 " beq r6,r2,3f\n"
26 " mov r7,r2\n"
27 "2: ldbu r2,0(r5)\n"
28 " addi r6,r6,-1\n"
29 " addi r5,r5,1\n"
30 " stb r2,0(r3)\n"
31 " addi r3,r3,1\n"
32 " bne r6,r7,2b\n"
33 "3:\n"
34 " addi r2,r6,1\n"
35 " ret\n"
36 "13:mov r2,r6\n"
37 " ret\n"
38 "4: andi r2,r4,1\n"
39 " cmpeq r2,r2,zero\n"
40 " beq r2,zero,7f\n"
41 "5: andi r2,r3,2\n"
42 " beq r2,zero,6f\n"
43 "9: ldhu r2,0(r5)\n"
44 " addi r6,r6,-2\n"
45 " addi r5,r5,2\n"
46 " sth r2,0(r3)\n"
47 " addi r3,r3,2\n"
48 "6: bge r7,r6,1b\n"
49 "10:ldw r2,0(r5)\n"
50 " addi r6,r6,-4\n"
51 " addi r5,r5,4\n"
52 " stw r2,0(r3)\n"
53 " addi r3,r3,4\n"
54 " br 6b\n"
55 "7: ldbu r2,0(r5)\n"
56 " addi r6,r6,-1\n"
57 " addi r5,r5,1\n"
58 " addi r3,r4,1\n"
59 " stb r2,0(r4)\n"
60 " br 5b\n"
61 ".section __ex_table,\"a\"\n"
62 ".word 2b,3b\n"
63 ".word 9b,13b\n"
64 ".word 10b,13b\n"
65 ".word 7b,13b\n"
66 ".previous\n"
67 );
68EXPORT_SYMBOL(__copy_from_user);
69
70asm(
71 " .global __copy_to_user\n"
72 " .type __copy_to_user, @function\n"
73 "__copy_to_user:\n"
74 " movi r2,7\n"
75 " mov r3,r4\n"
76 " bge r2,r6,1f\n"
77 " xor r2,r4,r5\n"
78 " andi r2,r2,3\n"
79 " movi r7,3\n"
80 " beq r2,zero,4f\n"
81 /* Bail if we try to copy zero bytes */
82 "1: addi r6,r6,-1\n"
83 " movi r2,-1\n"
84 " beq r6,r2,3f\n"
85 /* Copy byte by byte for small copies and if src^dst != 0 */
86 " mov r7,r2\n"
87 "2: ldbu r2,0(r5)\n"
88 " addi r5,r5,1\n"
89 "9: stb r2,0(r3)\n"
90 " addi r6,r6,-1\n"
91 " addi r3,r3,1\n"
92 " bne r6,r7,2b\n"
93 "3: addi r2,r6,1\n"
94 " ret\n"
95 "13:mov r2,r6\n"
96 " ret\n"
97 /* If 'to' is an odd address byte copy */
98 "4: andi r2,r4,1\n"
99 " cmpeq r2,r2,zero\n"
100 " beq r2,zero,7f\n"
101 /* If 'to' is not divideable by four copy halfwords */
102 "5: andi r2,r3,2\n"
103 " beq r2,zero,6f\n"
104 " ldhu r2,0(r5)\n"
105 " addi r5,r5,2\n"
106 "10:sth r2,0(r3)\n"
107 " addi r6,r6,-2\n"
108 " addi r3,r3,2\n"
109 /* Copy words */
110 "6: bge r7,r6,1b\n"
111 " ldw r2,0(r5)\n"
112 " addi r5,r5,4\n"
113 "11:stw r2,0(r3)\n"
114 " addi r6,r6,-4\n"
115 " addi r3,r3,4\n"
116 " br 6b\n"
117 /* Copy remaining bytes */
118 "7: ldbu r2,0(r5)\n"
119 " addi r5,r5,1\n"
120 " addi r3,r4,1\n"
121 "12: stb r2,0(r4)\n"
122 " addi r6,r6,-1\n"
123 " br 5b\n"
124 ".section __ex_table,\"a\"\n"
125 ".word 9b,3b\n"
126 ".word 10b,13b\n"
127 ".word 11b,13b\n"
128 ".word 12b,13b\n"
129 ".previous\n");
130EXPORT_SYMBOL(__copy_to_user);
131
132long strncpy_from_user(char *__to, const char __user *__from, long __len)
133{
134 int l = strnlen_user(__from, __len);
135 int is_zt = 1;
136
137 if (l > __len) {
138 is_zt = 0;
139 l = __len;
140 }
141
142 if (l == 0 || copy_from_user(__to, __from, l))
143 return -EFAULT;
144
145 if (is_zt)
146 l--;
147 return l;
148}
149
150long strnlen_user(const char __user *s, long n)
151{
152 long i;
153
154 for (i = 0; i < n; i++) {
155 char c;
156
157 if (get_user(c, s + i) == -EFAULT)
158 return 0;
159 if (c == 0)
160 return i + 1;
161 }
162 return n + 1;
163}
diff --git a/arch/nios2/platform/Kconfig.platform b/arch/nios2/platform/Kconfig.platform
new file mode 100644
index 000000000000..d3e5df9fb36b
--- /dev/null
+++ b/arch/nios2/platform/Kconfig.platform
@@ -0,0 +1,129 @@
1menu "Platform options"
2
3comment "Memory settings"
4
5config NIOS2_MEM_BASE
6 hex "Memory base address"
7 default "0x00000000"
8 help
9 This is the physical address of the memory that the kernel will run
10 from. This address is used to link the kernel and setup initial memory
11 management. You should take the raw memory address without any MMU
12 or cache bits set.
13 Please not that this address is used directly so you have to manually
14 do address translation if it's connected to a bridge.
15
16comment "Device tree"
17
18config NIOS2_DTB_AT_PHYS_ADDR
19 bool "DTB at physical address"
20 default n
21 help
22 When enabled you can select a physical address to load the dtb from.
23 Normally this address is passed by a bootloader such as u-boot but
24 using this you can use a devicetree without a bootloader.
25 This way you can store a devicetree in NOR flash or an onchip rom.
26 Please note that this address is used directly so you have to manually
27 do address translation if it's connected to a bridge. Also take into
28 account that when using an MMU you'd have to ad 0xC0000000 to your
29 address
30
31config NIOS2_DTB_PHYS_ADDR
32 hex "DTB Address"
33 depends on NIOS2_DTB_AT_PHYS_ADDR
34 default "0xC0000000"
35 help
36 Physical address of a dtb blob.
37
38config NIOS2_DTB_SOURCE_BOOL
39 bool "Compile and link device tree into kernel image"
40 default n
41 help
42 This allows you to specify a dts (device tree source) file
43 which will be compiled and linked into the kernel image.
44
45config NIOS2_DTB_SOURCE
46 string "Device tree source file"
47 depends on NIOS2_DTB_SOURCE_BOOL
48 default ""
49 help
50 Absolute path to the device tree source (dts) file describing your
51 system.
52
53comment "Nios II instructions"
54
55config NIOS2_HW_MUL_SUPPORT
56 bool "Enable MUL instruction"
57 default n
58 help
59 Set to true if you configured the Nios II to include the MUL
60 instruction. This will enable the -mhw-mul compiler flag.
61
62config NIOS2_HW_MULX_SUPPORT
63 bool "Enable MULX instruction"
64 default n
65 help
66 Set to true if you configured the Nios II to include the MULX
67 instruction. Enables the -mhw-mulx compiler flag.
68
69config NIOS2_HW_DIV_SUPPORT
70 bool "Enable DIV instruction"
71 default n
72 help
73 Set to true if you configured the Nios II to include the DIV
74 instruction. Enables the -mhw-div compiler flag.
75
76config NIOS2_FPU_SUPPORT
77 bool "Custom floating point instr support"
78 default n
79 help
80 Enables the -mcustom-fpu-cfg=60-1 compiler flag.
81
82config NIOS2_CI_SWAB_SUPPORT
83 bool "Byteswap custom instruction"
84 default n
85 help
86 Use the byteswap (endian converter) Nios II custom instruction provided
87 by Altera and which can be enabled in QSYS builder. This accelerates
88 endian conversions in the kernel (e.g. ntohs).
89
90config NIOS2_CI_SWAB_NO
91 int "Byteswap custom instruction number" if NIOS2_CI_SWAB_SUPPORT
92 default 0
93 help
94 Number of the instruction as configured in QSYS Builder.
95
96comment "Cache settings"
97
98config CUSTOM_CACHE_SETTINGS
99 bool "Custom cache settings"
100 help
101 This option allows you to tweak the cache settings used during early
102 boot (where the information from device tree is not yet available).
103 There should be no reason to change these values. Linux will work
104 perfectly fine, even if the Nios II is configured with smaller caches.
105
106 Say N here unless you know what you are doing.
107
108config NIOS2_DCACHE_SIZE
109 hex "D-Cache size" if CUSTOM_CACHE_SETTINGS
110 range 0x200 0x10000
111 default "0x800"
112 help
113 Maximum possible data cache size.
114
115config NIOS2_DCACHE_LINE_SIZE
116 hex "D-Cache line size" if CUSTOM_CACHE_SETTINGS
117 range 0x10 0x20
118 default "0x20"
119 help
120 Minimum possible data cache line size.
121
122config NIOS2_ICACHE_SIZE
123 hex "I-Cache size" if CUSTOM_CACHE_SETTINGS
124 range 0x200 0x10000
125 default "0x1000"
126 help
127 Maximum possible instruction cache size.
128
129endmenu
diff --git a/arch/nios2/platform/Makefile b/arch/nios2/platform/Makefile
new file mode 100644
index 000000000000..46364f1d9352
--- /dev/null
+++ b/arch/nios2/platform/Makefile
@@ -0,0 +1 @@
obj-y += platform.o
diff --git a/arch/nios2/platform/platform.c b/arch/nios2/platform/platform.c
new file mode 100644
index 000000000000..d478773f758a
--- /dev/null
+++ b/arch/nios2/platform/platform.c
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2013 Altera Corporation
3 * Copyright (C) 2011 Thomas Chou
4 * Copyright (C) 2011 Walter Goossens
5 *
6 * This file is subject to the terms and conditions of the GNU General
7 * Public License. See the file COPYING in the main directory of this
8 * archive for more details.
9 */
10
11#include <linux/init.h>
12#include <linux/of_platform.h>
13#include <linux/of_address.h>
14#include <linux/of_fdt.h>
15#include <linux/err.h>
16#include <linux/slab.h>
17#include <linux/sys_soc.h>
18#include <linux/io.h>
19
20static int __init nios2_soc_device_init(void)
21{
22 struct soc_device *soc_dev;
23 struct soc_device_attribute *soc_dev_attr;
24 const char *machine;
25
26 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
27 if (soc_dev_attr) {
28 machine = of_flat_dt_get_machine_name();
29 if (machine)
30 soc_dev_attr->machine = kasprintf(GFP_KERNEL, "%s",
31 machine);
32
33 soc_dev_attr->family = "Nios II";
34
35 soc_dev = soc_device_register(soc_dev_attr);
36 if (IS_ERR(soc_dev)) {
37 kfree(soc_dev_attr->machine);
38 kfree(soc_dev_attr);
39 }
40 }
41
42 return of_platform_populate(NULL, of_default_bus_match_table,
43 NULL, NULL);
44}
45
46device_initcall(nios2_soc_device_init);
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 2bedafea3d94..97a7bf8df348 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -56,11 +56,12 @@ struct getdents_callback {
56 56
57#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) 57#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
58 58
59static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 59static int filldir(struct dir_context *ctx, const char *name, int namlen,
60 u64 ino, unsigned d_type) 60 loff_t offset, u64 ino, unsigned d_type)
61{ 61{
62 struct hpux_dirent __user * dirent; 62 struct hpux_dirent __user * dirent;
63 struct getdents_callback * buf = (struct getdents_callback *) __buf; 63 struct getdents_callback *buf =
64 container_of(ctx, struct getdents_callback, ctx);
64 ino_t d_ino; 65 ino_t d_ino;
65 int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long)); 66 int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
66 67
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index 1f6d2ae7aba5..8cd0abf28ffb 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -217,10 +217,14 @@ static inline void writeq(unsigned long long q, volatile void __iomem *addr)
217#define writel writel 217#define writel writel
218#define writeq writeq 218#define writeq writeq
219 219
220#define readb_relaxed(addr) readb(addr) 220#define readb_relaxed(addr) readb(addr)
221#define readw_relaxed(addr) readw(addr) 221#define readw_relaxed(addr) readw(addr)
222#define readl_relaxed(addr) readl(addr) 222#define readl_relaxed(addr) readl(addr)
223#define readq_relaxed(addr) readq(addr) 223#define readq_relaxed(addr) readq(addr)
224#define writeb_relaxed(b, addr) writeb(b, addr)
225#define writew_relaxed(w, addr) writew(w, addr)
226#define writel_relaxed(l, addr) writel(l, addr)
227#define writeq_relaxed(q, addr) writeq(q, addr)
224 228
225#define mmiowb() do { } while (0) 229#define mmiowb() do { } while (0)
226 230
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 97d3869991ca..9eaf301ac952 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -617,10 +617,14 @@ static inline void name at \
617/* 617/*
618 * We don't do relaxed operations yet, at least not with this semantic 618 * We don't do relaxed operations yet, at least not with this semantic
619 */ 619 */
620#define readb_relaxed(addr) readb(addr) 620#define readb_relaxed(addr) readb(addr)
621#define readw_relaxed(addr) readw(addr) 621#define readw_relaxed(addr) readw(addr)
622#define readl_relaxed(addr) readl(addr) 622#define readl_relaxed(addr) readl(addr)
623#define readq_relaxed(addr) readq(addr) 623#define readq_relaxed(addr) readq(addr)
624#define writeb_relaxed(v, addr) writeb(v, addr)
625#define writew_relaxed(v, addr) writew(v, addr)
626#define writel_relaxed(v, addr) writel(v, addr)
627#define writeq_relaxed(v, addr) writeq(v, addr)
624 628
625#ifdef CONFIG_PPC32 629#ifdef CONFIG_PPC32
626#define mmiowb() 630#define mmiowb()
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index 42632c7a2a4e..9cfa3706a1b8 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -137,13 +137,16 @@ static inline void set_iommu_table_base_and_group(struct device *dev,
137 iommu_add_device(dev); 137 iommu_add_device(dev);
138} 138}
139 139
140extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 140extern int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
141 struct scatterlist *sglist, int nelems, 141 struct scatterlist *sglist, int nelems,
142 unsigned long mask, enum dma_data_direction direction, 142 unsigned long mask,
143 struct dma_attrs *attrs); 143 enum dma_data_direction direction,
144extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, 144 struct dma_attrs *attrs);
145 int nelems, enum dma_data_direction direction, 145extern void ppc_iommu_unmap_sg(struct iommu_table *tbl,
146 struct dma_attrs *attrs); 146 struct scatterlist *sglist,
147 int nelems,
148 enum dma_data_direction direction,
149 struct dma_attrs *attrs);
147 150
148extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl, 151extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
149 size_t size, dma_addr_t *dma_handle, 152 size_t size, dma_addr_t *dma_handle,
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h
index e9a9f60e596d..fc3ee06eab87 100644
--- a/arch/powerpc/include/asm/pgalloc.h
+++ b/arch/powerpc/include/asm/pgalloc.h
@@ -3,7 +3,6 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <asm-generic/tlb.h>
7 6
8#ifdef CONFIG_PPC_BOOK3E 7#ifdef CONFIG_PPC_BOOK3E
9extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address); 8extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address);
@@ -14,6 +13,8 @@ static inline void tlb_flush_pgtable(struct mmu_gather *tlb,
14} 13}
15#endif /* !CONFIG_PPC_BOOK3E */ 14#endif /* !CONFIG_PPC_BOOK3E */
16 15
16extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
17
17#ifdef CONFIG_PPC64 18#ifdef CONFIG_PPC64
18#include <asm/pgalloc-64.h> 19#include <asm/pgalloc-64.h>
19#else 20#else
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index ae153c40ab7c..9b4b1904efae 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -467,6 +467,7 @@ static inline pte_t *pmdp_ptep(pmd_t *pmd)
467} 467}
468 468
469#define pmd_pfn(pmd) pte_pfn(pmd_pte(pmd)) 469#define pmd_pfn(pmd) pte_pfn(pmd_pte(pmd))
470#define pmd_dirty(pmd) pte_dirty(pmd_pte(pmd))
470#define pmd_young(pmd) pte_young(pmd_pte(pmd)) 471#define pmd_young(pmd) pte_young(pmd_pte(pmd))
471#define pmd_mkold(pmd) pte_pmd(pte_mkold(pmd_pte(pmd))) 472#define pmd_mkold(pmd) pte_pmd(pte_mkold(pmd_pte(pmd)))
472#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd))) 473#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd)))
diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h
index e2b428b0f7ba..20733fa518ae 100644
--- a/arch/powerpc/include/asm/tlb.h
+++ b/arch/powerpc/include/asm/tlb.h
@@ -27,6 +27,7 @@
27 27
28#define tlb_start_vma(tlb, vma) do { } while (0) 28#define tlb_start_vma(tlb, vma) do { } while (0)
29#define tlb_end_vma(tlb, vma) do { } while (0) 29#define tlb_end_vma(tlb, vma) do { } while (0)
30#define __tlb_remove_tlb_entry __tlb_remove_tlb_entry
30 31
31extern void tlb_flush(struct mmu_gather *tlb); 32extern void tlb_flush(struct mmu_gather *tlb);
32 33
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 54d0116256f7..4c68bfe4108a 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -60,16 +60,16 @@ static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
60 int nelems, enum dma_data_direction direction, 60 int nelems, enum dma_data_direction direction,
61 struct dma_attrs *attrs) 61 struct dma_attrs *attrs)
62{ 62{
63 return iommu_map_sg(dev, get_iommu_table_base(dev), sglist, nelems, 63 return ppc_iommu_map_sg(dev, get_iommu_table_base(dev), sglist, nelems,
64 device_to_mask(dev), direction, attrs); 64 device_to_mask(dev), direction, attrs);
65} 65}
66 66
67static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist, 67static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
68 int nelems, enum dma_data_direction direction, 68 int nelems, enum dma_data_direction direction,
69 struct dma_attrs *attrs) 69 struct dma_attrs *attrs)
70{ 70{
71 iommu_unmap_sg(get_iommu_table_base(dev), sglist, nelems, direction, 71 ppc_iommu_unmap_sg(get_iommu_table_base(dev), sglist, nelems,
72 attrs); 72 direction, attrs);
73} 73}
74 74
75/* We support DMA to/from any memory page via the iommu */ 75/* We support DMA to/from any memory page via the iommu */
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 390311c0f03d..e66af6d265e8 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -449,7 +449,7 @@ void ftrace_replace_code(int enable)
449 rec = ftrace_rec_iter_record(iter); 449 rec = ftrace_rec_iter_record(iter);
450 ret = __ftrace_replace_code(rec, enable); 450 ret = __ftrace_replace_code(rec, enable);
451 if (ret) { 451 if (ret) {
452 ftrace_bug(ret, rec->ip); 452 ftrace_bug(ret, rec);
453 return; 453 return;
454 } 454 }
455 } 455 }
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index a10642a0d861..a83cf5ef6488 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -428,10 +428,10 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
428 ppc_md.tce_flush(tbl); 428 ppc_md.tce_flush(tbl);
429} 429}
430 430
431int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 431int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
432 struct scatterlist *sglist, int nelems, 432 struct scatterlist *sglist, int nelems,
433 unsigned long mask, enum dma_data_direction direction, 433 unsigned long mask, enum dma_data_direction direction,
434 struct dma_attrs *attrs) 434 struct dma_attrs *attrs)
435{ 435{
436 dma_addr_t dma_next = 0, dma_addr; 436 dma_addr_t dma_next = 0, dma_addr;
437 struct scatterlist *s, *outs, *segstart; 437 struct scatterlist *s, *outs, *segstart;
@@ -539,7 +539,7 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
539 539
540 DBG("mapped %d elements:\n", outcount); 540 DBG("mapped %d elements:\n", outcount);
541 541
542 /* For the sake of iommu_unmap_sg, we clear out the length in the 542 /* For the sake of ppc_iommu_unmap_sg, we clear out the length in the
543 * next entry of the sglist if we didn't fill the list completely 543 * next entry of the sglist if we didn't fill the list completely
544 */ 544 */
545 if (outcount < incount) { 545 if (outcount < incount) {
@@ -572,9 +572,9 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
572} 572}
573 573
574 574
575void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, 575void ppc_iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
576 int nelems, enum dma_data_direction direction, 576 int nelems, enum dma_data_direction direction,
577 struct dma_attrs *attrs) 577 struct dma_attrs *attrs)
578{ 578{
579 struct scatterlist *sg; 579 struct scatterlist *sg;
580 580
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 7e70ae968e5f..6a4a5fcb9730 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -517,8 +517,6 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif
517 for (i = 0; i < num_hugepd; i++, hpdp++) 517 for (i = 0; i < num_hugepd; i++, hpdp++)
518 hpdp->pd = 0; 518 hpdp->pd = 0;
519 519
520 tlb->need_flush = 1;
521
522#ifdef CONFIG_PPC_FSL_BOOK3E 520#ifdef CONFIG_PPC_FSL_BOOK3E
523 hugepd_free(tlb, hugepte); 521 hugepd_free(tlb, hugepte);
524#else 522#else
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b9d1dfdbe5bb..9fe6002c1d5a 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1711,12 +1711,11 @@ static void stage_topology_update(int core_id)
1711static int dt_update_callback(struct notifier_block *nb, 1711static int dt_update_callback(struct notifier_block *nb,
1712 unsigned long action, void *data) 1712 unsigned long action, void *data)
1713{ 1713{
1714 struct of_prop_reconfig *update; 1714 struct of_reconfig_data *update = data;
1715 int rc = NOTIFY_DONE; 1715 int rc = NOTIFY_DONE;
1716 1716
1717 switch (action) { 1717 switch (action) {
1718 case OF_RECONFIG_UPDATE_PROPERTY: 1718 case OF_RECONFIG_UPDATE_PROPERTY:
1719 update = (struct of_prop_reconfig *)data;
1720 if (!of_prop_cmp(update->dn->type, "cpu") && 1719 if (!of_prop_cmp(update->dn->type, "cpu") &&
1721 !of_prop_cmp(update->prop->name, "ibm,associativity")) { 1720 !of_prop_cmp(update->prop->name, "ibm,associativity")) {
1722 u32 core_id; 1721 u32 core_id;
diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c
index 28f1af2db1f5..1c27831df1ac 100644
--- a/arch/powerpc/oprofile/cell/spu_task_sync.c
+++ b/arch/powerpc/oprofile/cell/spu_task_sync.c
@@ -331,8 +331,7 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp,
331 331
332 if (mm->exe_file) { 332 if (mm->exe_file) {
333 app_cookie = fast_get_dcookie(&mm->exe_file->f_path); 333 app_cookie = fast_get_dcookie(&mm->exe_file->f_path);
334 pr_debug("got dcookie for %s\n", 334 pr_debug("got dcookie for %pD\n", mm->exe_file);
335 mm->exe_file->f_dentry->d_name.name);
336 } 335 }
337 336
338 for (vma = mm->mmap; vma; vma = vma->vm_next) { 337 for (vma = mm->mmap; vma; vma = vma->vm_next) {
@@ -342,15 +341,14 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp,
342 if (!vma->vm_file) 341 if (!vma->vm_file)
343 goto fail_no_image_cookie; 342 goto fail_no_image_cookie;
344 343
345 pr_debug("Found spu ELF at %X(object-id:%lx) for file %s\n", 344 pr_debug("Found spu ELF at %X(object-id:%lx) for file %pD\n",
346 my_offset, spu_ref, 345 my_offset, spu_ref, vma->vm_file);
347 vma->vm_file->f_dentry->d_name.name);
348 *offsetp = my_offset; 346 *offsetp = my_offset;
349 break; 347 break;
350 } 348 }
351 349
352 *spu_bin_dcookie = fast_get_dcookie(&vma->vm_file->f_path); 350 *spu_bin_dcookie = fast_get_dcookie(&vma->vm_file->f_path);
353 pr_debug("got dcookie for %s\n", vma->vm_file->f_dentry->d_name.name); 351 pr_debug("got dcookie for %pD\n", vma->vm_file);
354 352
355 up_read(&mm->mmap_sem); 353 up_read(&mm->mmap_sem);
356 354
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index 862b32702d29..0883994df384 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -279,7 +279,7 @@ static int axon_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
279 279
280 irq_set_msi_desc(virq, entry); 280 irq_set_msi_desc(virq, entry);
281 msg.data = virq; 281 msg.data = virq;
282 write_msi_msg(virq, &msg); 282 pci_write_msi_msg(virq, &msg);
283 } 283 }
284 284
285 return 0; 285 return 0;
@@ -301,9 +301,9 @@ static void axon_msi_teardown_msi_irqs(struct pci_dev *dev)
301} 301}
302 302
303static struct irq_chip msic_irq_chip = { 303static struct irq_chip msic_irq_chip = {
304 .irq_mask = mask_msi_irq, 304 .irq_mask = pci_msi_mask_irq,
305 .irq_unmask = unmask_msi_irq, 305 .irq_unmask = pci_msi_unmask_irq,
306 .irq_shutdown = mask_msi_irq, 306 .irq_shutdown = pci_msi_mask_irq,
307 .name = "AXON-MSI", 307 .name = "AXON-MSI",
308}; 308};
309 309
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 2b90ff8a93be..c7c8720aa39f 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -621,8 +621,9 @@ static int dma_fixed_map_sg(struct device *dev, struct scatterlist *sg,
621 if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) 621 if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs))
622 return dma_direct_ops.map_sg(dev, sg, nents, direction, attrs); 622 return dma_direct_ops.map_sg(dev, sg, nents, direction, attrs);
623 else 623 else
624 return iommu_map_sg(dev, cell_get_iommu_table(dev), sg, nents, 624 return ppc_iommu_map_sg(dev, cell_get_iommu_table(dev), sg,
625 device_to_mask(dev), direction, attrs); 625 nents, device_to_mask(dev),
626 direction, attrs);
626} 627}
627 628
628static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg, 629static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg,
@@ -632,8 +633,8 @@ static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg,
632 if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs)) 633 if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs))
633 dma_direct_ops.unmap_sg(dev, sg, nents, direction, attrs); 634 dma_direct_ops.unmap_sg(dev, sg, nents, direction, attrs);
634 else 635 else
635 iommu_unmap_sg(cell_get_iommu_table(dev), sg, nents, direction, 636 ppc_iommu_unmap_sg(cell_get_iommu_table(dev), sg, nents,
636 attrs); 637 direction, attrs);
637} 638}
638 639
639static int dma_fixed_dma_supported(struct device *dev, u64 mask) 640static int dma_fixed_dma_supported(struct device *dev, u64 mask)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 87ba7cf99cd7..1a3429e1ccb5 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -164,7 +164,7 @@ static void spufs_prune_dir(struct dentry *dir)
164 struct dentry *dentry, *tmp; 164 struct dentry *dentry, *tmp;
165 165
166 mutex_lock(&dir->d_inode->i_mutex); 166 mutex_lock(&dir->d_inode->i_mutex);
167 list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) { 167 list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
168 spin_lock(&dentry->d_lock); 168 spin_lock(&dentry->d_lock);
169 if (!(d_unhashed(dentry)) && dentry->d_inode) { 169 if (!(d_unhashed(dentry)) && dentry->d_inode) {
170 dget_dlock(dentry); 170 dget_dlock(dentry);
@@ -301,7 +301,7 @@ static int spufs_context_open(struct path *path)
301 int ret; 301 int ret;
302 struct file *filp; 302 struct file *filp;
303 303
304 ret = get_unused_fd(); 304 ret = get_unused_fd_flags(0);
305 if (ret < 0) 305 if (ret < 0)
306 return ret; 306 return ret;
307 307
@@ -518,7 +518,7 @@ static int spufs_gang_open(struct path *path)
518 int ret; 518 int ret;
519 struct file *filp; 519 struct file *filp;
520 520
521 ret = get_unused_fd(); 521 ret = get_unused_fd_flags(0);
522 if (ret < 0) 522 if (ret < 0)
523 return ret; 523 return ret;
524 524
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
index 10271ad1fac4..4ab67ef7abc9 100644
--- a/arch/powerpc/platforms/powernv/opal-sensor.c
+++ b/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -20,7 +20,9 @@
20 20
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/of_platform.h>
23#include <asm/opal.h> 24#include <asm/opal.h>
25#include <asm/machdep.h>
24 26
25static DEFINE_MUTEX(opal_sensor_mutex); 27static DEFINE_MUTEX(opal_sensor_mutex);
26 28
@@ -64,3 +66,21 @@ out:
64 return ret; 66 return ret;
65} 67}
66EXPORT_SYMBOL_GPL(opal_get_sensor_data); 68EXPORT_SYMBOL_GPL(opal_get_sensor_data);
69
70static __init int opal_sensor_init(void)
71{
72 struct platform_device *pdev;
73 struct device_node *sensor;
74
75 sensor = of_find_node_by_path("/ibm,opal/sensors");
76 if (!sensor) {
77 pr_err("Opal node 'sensors' not found\n");
78 return -ENODEV;
79 }
80
81 pdev = of_platform_device_create(sensor, "opal-sensor", NULL);
82 of_node_put(sensor);
83
84 return PTR_ERR_OR_ZERO(pdev);
85}
86machine_subsys_initcall(powernv, opal_sensor_init);
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 4b20f2c6b3b2..540fc6dd56b3 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -90,7 +90,7 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
90 return rc; 90 return rc;
91 } 91 }
92 irq_set_msi_desc(virq, entry); 92 irq_set_msi_desc(virq, entry);
93 write_msi_msg(virq, &msg); 93 pci_write_msi_msg(virq, &msg);
94 } 94 }
95 return 0; 95 return 0;
96} 96}
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 5c375f93c669..f30cf4d136a4 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -340,16 +340,17 @@ static void pseries_remove_processor(struct device_node *np)
340} 340}
341 341
342static int pseries_smp_notifier(struct notifier_block *nb, 342static int pseries_smp_notifier(struct notifier_block *nb,
343 unsigned long action, void *node) 343 unsigned long action, void *data)
344{ 344{
345 struct of_reconfig_data *rd = data;
345 int err = 0; 346 int err = 0;
346 347
347 switch (action) { 348 switch (action) {
348 case OF_RECONFIG_ATTACH_NODE: 349 case OF_RECONFIG_ATTACH_NODE:
349 err = pseries_add_processor(node); 350 err = pseries_add_processor(rd->dn);
350 break; 351 break;
351 case OF_RECONFIG_DETACH_NODE: 352 case OF_RECONFIG_DETACH_NODE:
352 pseries_remove_processor(node); 353 pseries_remove_processor(rd->dn);
353 break; 354 break;
354 } 355 }
355 return notifier_from_errno(err); 356 return notifier_from_errno(err);
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 3c4c0dcd90d3..1bbb78fab530 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -183,7 +183,7 @@ static int pseries_add_mem_node(struct device_node *np)
183 return (ret < 0) ? -EINVAL : 0; 183 return (ret < 0) ? -EINVAL : 0;
184} 184}
185 185
186static int pseries_update_drconf_memory(struct of_prop_reconfig *pr) 186static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
187{ 187{
188 struct of_drconf_cell *new_drmem, *old_drmem; 188 struct of_drconf_cell *new_drmem, *old_drmem;
189 unsigned long memblock_size; 189 unsigned long memblock_size;
@@ -232,22 +232,21 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
232} 232}
233 233
234static int pseries_memory_notifier(struct notifier_block *nb, 234static int pseries_memory_notifier(struct notifier_block *nb,
235 unsigned long action, void *node) 235 unsigned long action, void *data)
236{ 236{
237 struct of_prop_reconfig *pr; 237 struct of_reconfig_data *rd = data;
238 int err = 0; 238 int err = 0;
239 239
240 switch (action) { 240 switch (action) {
241 case OF_RECONFIG_ATTACH_NODE: 241 case OF_RECONFIG_ATTACH_NODE:
242 err = pseries_add_mem_node(node); 242 err = pseries_add_mem_node(rd->dn);
243 break; 243 break;
244 case OF_RECONFIG_DETACH_NODE: 244 case OF_RECONFIG_DETACH_NODE:
245 err = pseries_remove_mem_node(node); 245 err = pseries_remove_mem_node(rd->dn);
246 break; 246 break;
247 case OF_RECONFIG_UPDATE_PROPERTY: 247 case OF_RECONFIG_UPDATE_PROPERTY:
248 pr = (struct of_prop_reconfig *)node; 248 if (!strcmp(rd->prop->name, "ibm,dynamic-memory"))
249 if (!strcmp(pr->prop->name, "ibm,dynamic-memory")) 249 err = pseries_update_drconf_memory(rd);
250 err = pseries_update_drconf_memory(pr);
251 break; 250 break;
252 } 251 }
253 return notifier_from_errno(err); 252 return notifier_from_errno(err);
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index e32e00976a94..3e5bfdafee63 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -1251,10 +1251,11 @@ static struct notifier_block iommu_mem_nb = {
1251 .notifier_call = iommu_mem_notifier, 1251 .notifier_call = iommu_mem_notifier,
1252}; 1252};
1253 1253
1254static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) 1254static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *data)
1255{ 1255{
1256 int err = NOTIFY_OK; 1256 int err = NOTIFY_OK;
1257 struct device_node *np = node; 1257 struct of_reconfig_data *rd = data;
1258 struct device_node *np = rd->dn;
1258 struct pci_dn *pci = PCI_DN(np); 1259 struct pci_dn *pci = PCI_DN(np);
1259 struct direct_window *window; 1260 struct direct_window *window;
1260 1261
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 8b909e94fd9a..691a154c286d 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -476,7 +476,7 @@ again:
476 irq_set_msi_desc(virq, entry); 476 irq_set_msi_desc(virq, entry);
477 477
478 /* Read config space back so we can restore after reset */ 478 /* Read config space back so we can restore after reset */
479 __read_msi_msg(entry, &msg); 479 __pci_read_msi_msg(entry, &msg);
480 entry->msg = msg; 480 entry->msg = msg;
481 } 481 }
482 482
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 125c589eeef5..ed8a90022a3d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -251,9 +251,10 @@ static void __init pseries_discover_pic(void)
251 " interrupt-controller\n"); 251 " interrupt-controller\n");
252} 252}
253 253
254static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) 254static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *data)
255{ 255{
256 struct device_node *np = node; 256 struct of_reconfig_data *rd = data;
257 struct device_node *np = rd->dn;
257 struct pci_dn *pci = NULL; 258 struct pci_dn *pci = NULL;
258 int err = NOTIFY_OK; 259 int err = NOTIFY_OK;
259 260
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index da08ed088157..7aed8d0876b7 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -82,8 +82,8 @@ static void fsl_msi_print_chip(struct irq_data *irqd, struct seq_file *p)
82 82
83 83
84static struct irq_chip fsl_msi_chip = { 84static struct irq_chip fsl_msi_chip = {
85 .irq_mask = mask_msi_irq, 85 .irq_mask = pci_msi_mask_irq,
86 .irq_unmask = unmask_msi_irq, 86 .irq_unmask = pci_msi_unmask_irq,
87 .irq_ack = fsl_msi_end_irq, 87 .irq_ack = fsl_msi_end_irq,
88 .irq_print_chip = fsl_msi_print_chip, 88 .irq_print_chip = fsl_msi_print_chip,
89}; 89};
@@ -242,7 +242,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
242 irq_set_msi_desc(virq, entry); 242 irq_set_msi_desc(virq, entry);
243 243
244 fsl_compose_msi_msg(pdev, hwirq, &msg, msi_data); 244 fsl_compose_msi_msg(pdev, hwirq, &msg, msi_data);
245 write_msi_msg(virq, &msg); 245 pci_write_msi_msg(virq, &msg);
246 } 246 }
247 return 0; 247 return 0;
248 248
diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c
index 15dccd35fa11..45c114bc430b 100644
--- a/arch/powerpc/sysdev/mpic_pasemi_msi.c
+++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c
@@ -42,7 +42,7 @@ static struct mpic *msi_mpic;
42static void mpic_pasemi_msi_mask_irq(struct irq_data *data) 42static void mpic_pasemi_msi_mask_irq(struct irq_data *data)
43{ 43{
44 pr_debug("mpic_pasemi_msi_mask_irq %d\n", data->irq); 44 pr_debug("mpic_pasemi_msi_mask_irq %d\n", data->irq);
45 mask_msi_irq(data); 45 pci_msi_mask_irq(data);
46 mpic_mask_irq(data); 46 mpic_mask_irq(data);
47} 47}
48 48
@@ -50,7 +50,7 @@ static void mpic_pasemi_msi_unmask_irq(struct irq_data *data)
50{ 50{
51 pr_debug("mpic_pasemi_msi_unmask_irq %d\n", data->irq); 51 pr_debug("mpic_pasemi_msi_unmask_irq %d\n", data->irq);
52 mpic_unmask_irq(data); 52 mpic_unmask_irq(data);
53 unmask_msi_irq(data); 53 pci_msi_unmask_irq(data);
54} 54}
55 55
56static struct irq_chip mpic_pasemi_msi_chip = { 56static struct irq_chip mpic_pasemi_msi_chip = {
@@ -136,7 +136,7 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
136 * register to generate MSI [512...1023] 136 * register to generate MSI [512...1023]
137 */ 137 */
138 msg.data = hwirq-0x200; 138 msg.data = hwirq-0x200;
139 write_msi_msg(virq, &msg); 139 pci_write_msi_msg(virq, &msg);
140 } 140 }
141 141
142 return 0; 142 return 0;
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 623d7fba15b4..0dff1cd44481 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -25,14 +25,14 @@ static struct mpic *msi_mpic;
25 25
26static void mpic_u3msi_mask_irq(struct irq_data *data) 26static void mpic_u3msi_mask_irq(struct irq_data *data)
27{ 27{
28 mask_msi_irq(data); 28 pci_msi_mask_irq(data);
29 mpic_mask_irq(data); 29 mpic_mask_irq(data);
30} 30}
31 31
32static void mpic_u3msi_unmask_irq(struct irq_data *data) 32static void mpic_u3msi_unmask_irq(struct irq_data *data)
33{ 33{
34 mpic_unmask_irq(data); 34 mpic_unmask_irq(data);
35 unmask_msi_irq(data); 35 pci_msi_unmask_irq(data);
36} 36}
37 37
38static struct irq_chip mpic_u3msi_chip = { 38static struct irq_chip mpic_u3msi_chip = {
@@ -171,7 +171,7 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
171 printk("u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n", 171 printk("u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n",
172 virq, hwirq, (unsigned long)addr); 172 virq, hwirq, (unsigned long)addr);
173 msg.data = hwirq; 173 msg.data = hwirq;
174 write_msi_msg(virq, &msg); 174 pci_write_msi_msg(virq, &msg);
175 175
176 hwirq++; 176 hwirq++;
177 } 177 }
diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
index a6a4dbda9078..908105f835d1 100644
--- a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
@@ -85,7 +85,7 @@ static int hsta_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
85 msi_bitmap_free_hwirqs(&ppc4xx_hsta_msi.bmp, irq, 1); 85 msi_bitmap_free_hwirqs(&ppc4xx_hsta_msi.bmp, irq, 1);
86 return -EINVAL; 86 return -EINVAL;
87 } 87 }
88 write_msi_msg(hwirq, &msg); 88 pci_write_msi_msg(hwirq, &msg);
89 } 89 }
90 90
91 return 0; 91 return 0;
diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/sysdev/ppc4xx_msi.c
index 22b5200636e7..518eabbe0bdc 100644
--- a/arch/powerpc/sysdev/ppc4xx_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_msi.c
@@ -116,7 +116,7 @@ static int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
116 116
117 irq_set_msi_desc(virq, entry); 117 irq_set_msi_desc(virq, entry);
118 msg.data = int_no; 118 msg.data = int_no;
119 write_msi_msg(virq, &msg); 119 pci_write_msi_msg(virq, &msg);
120 } 120 }
121 return 0; 121 return 0;
122} 122}
diff --git a/arch/powerpc/sysdev/xics/ics-opal.c b/arch/powerpc/sysdev/xics/ics-opal.c
index 3c6ee1b64e5d..4ba554ec8eaf 100644
--- a/arch/powerpc/sysdev/xics/ics-opal.c
+++ b/arch/powerpc/sysdev/xics/ics-opal.c
@@ -73,7 +73,7 @@ static unsigned int ics_opal_startup(struct irq_data *d)
73 * at that level, so we do it here by hand. 73 * at that level, so we do it here by hand.
74 */ 74 */
75 if (d->msi_desc) 75 if (d->msi_desc)
76 unmask_msi_irq(d); 76 pci_msi_unmask_irq(d);
77#endif 77#endif
78 78
79 /* unmask it */ 79 /* unmask it */
diff --git a/arch/powerpc/sysdev/xics/ics-rtas.c b/arch/powerpc/sysdev/xics/ics-rtas.c
index 936575d99c5c..bc81335b2cbc 100644
--- a/arch/powerpc/sysdev/xics/ics-rtas.c
+++ b/arch/powerpc/sysdev/xics/ics-rtas.c
@@ -76,7 +76,7 @@ static unsigned int ics_rtas_startup(struct irq_data *d)
76 * at that level, so we do it here by hand. 76 * at that level, so we do it here by hand.
77 */ 77 */
78 if (d->msi_desc) 78 if (d->msi_desc)
79 unmask_msi_irq(d); 79 pci_msi_unmask_irq(d);
80#endif 80#endif
81 /* unmask it */ 81 /* unmask it */
82 ics_rtas_unmask_irq(d); 82 ics_rtas_unmask_irq(d);
diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c
index 2badf2bf9cd7..47fe1055c714 100644
--- a/arch/s390/hypfs/hypfs_dbfs.c
+++ b/arch/s390/hypfs/hypfs_dbfs.c
@@ -83,10 +83,9 @@ static ssize_t dbfs_read(struct file *file, char __user *buf,
83 83
84static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 84static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
85{ 85{
86 struct hypfs_dbfs_file *df; 86 struct hypfs_dbfs_file *df = file_inode(file)->i_private;
87 long rc; 87 long rc;
88 88
89 df = file->f_path.dentry->d_inode->i_private;
90 mutex_lock(&df->lock); 89 mutex_lock(&df->lock);
91 if (df->unlocked_ioctl) 90 if (df->unlocked_ioctl)
92 rc = df->unlocked_ioctl(file, cmd, arg); 91 rc = df->unlocked_ioctl(file, cmd, arg);
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index cd6b9ee7b69c..6ad9013c67e7 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -13,9 +13,10 @@
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/pci_io.h> 14#include <asm/pci_io.h>
15 15
16void *xlate_dev_mem_ptr(unsigned long phys);
17#define xlate_dev_mem_ptr xlate_dev_mem_ptr 16#define xlate_dev_mem_ptr xlate_dev_mem_ptr
18void unxlate_dev_mem_ptr(unsigned long phys, void *addr); 17void *xlate_dev_mem_ptr(phys_addr_t phys);
18#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr
19void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
19 20
20/* 21/*
21 * Convert a virtual cached pointer to an uncached pointer 22 * Convert a virtual cached pointer to an uncached pointer
@@ -60,11 +61,6 @@ static inline void iounmap(volatile void __iomem *addr)
60#define __raw_writel zpci_write_u32 61#define __raw_writel zpci_write_u32
61#define __raw_writeq zpci_write_u64 62#define __raw_writeq zpci_write_u64
62 63
63#define readb_relaxed readb
64#define readw_relaxed readw
65#define readl_relaxed readl
66#define readq_relaxed readq
67
68#endif /* CONFIG_PCI */ 64#endif /* CONFIG_PCI */
69 65
70#include <asm-generic/io.h> 66#include <asm-generic/io.h>
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index 3815bfea1b2d..f49b71954654 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -120,4 +120,15 @@ static inline void arch_exit_mmap(struct mm_struct *mm)
120{ 120{
121} 121}
122 122
123static inline void arch_unmap(struct mm_struct *mm,
124 struct vm_area_struct *vma,
125 unsigned long start, unsigned long end)
126{
127}
128
129static inline void arch_bprm_mm_init(struct mm_struct *mm,
130 struct vm_area_struct *vma)
131{
132}
133
123#endif /* __S390_MMU_CONTEXT_H */ 134#endif /* __S390_MMU_CONTEXT_H */
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index 2a2e35416d2f..2eb34bdfc613 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -176,7 +176,7 @@ static int is_swapped(unsigned long addr)
176 * For swapped prefix pages a new buffer is returned that contains a copy of 176 * For swapped prefix pages a new buffer is returned that contains a copy of
177 * the absolute memory. The buffer size is maximum one page large. 177 * the absolute memory. The buffer size is maximum one page large.
178 */ 178 */
179void *xlate_dev_mem_ptr(unsigned long addr) 179void *xlate_dev_mem_ptr(phys_addr_t addr)
180{ 180{
181 void *bounce = (void *) addr; 181 void *bounce = (void *) addr;
182 unsigned long size; 182 unsigned long size;
@@ -197,7 +197,7 @@ void *xlate_dev_mem_ptr(unsigned long addr)
197/* 197/*
198 * Free converted buffer for /dev/mem access (if necessary) 198 * Free converted buffer for /dev/mem access (if necessary)
199 */ 199 */
200void unxlate_dev_mem_ptr(unsigned long addr, void *buf) 200void unxlate_dev_mem_ptr(phys_addr_t addr, void *buf)
201{ 201{
202 if ((void *) addr != buf) 202 if ((void *) addr != buf)
203 free_page((unsigned long) buf); 203 free_page((unsigned long) buf);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 2fa7b14b9c08..d59c82569750 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -50,8 +50,8 @@ static DEFINE_SPINLOCK(zpci_list_lock);
50 50
51static struct irq_chip zpci_irq_chip = { 51static struct irq_chip zpci_irq_chip = {
52 .name = "zPCI", 52 .name = "zPCI",
53 .irq_unmask = unmask_msi_irq, 53 .irq_unmask = pci_msi_unmask_irq,
54 .irq_mask = mask_msi_irq, 54 .irq_mask = pci_msi_mask_irq,
55}; 55};
56 56
57static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES); 57static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES);
@@ -403,7 +403,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
403 msg.data = hwirq; 403 msg.data = hwirq;
404 msg.address_lo = zdev->msi_addr & 0xffffffff; 404 msg.address_lo = zdev->msi_addr & 0xffffffff;
405 msg.address_hi = zdev->msi_addr >> 32; 405 msg.address_hi = zdev->msi_addr >> 32;
406 write_msi_msg(irq, &msg); 406 pci_write_msi_msg(irq, &msg);
407 airq_iv_set_data(zdev->aibv, hwirq, irq); 407 airq_iv_set_data(zdev->aibv, hwirq, irq);
408 hwirq++; 408 hwirq++;
409 } 409 }
@@ -448,9 +448,9 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev)
448 /* Release MSI interrupts */ 448 /* Release MSI interrupts */
449 list_for_each_entry(msi, &pdev->msi_list, list) { 449 list_for_each_entry(msi, &pdev->msi_list, list) {
450 if (msi->msi_attrib.is_msix) 450 if (msi->msi_attrib.is_msix)
451 default_msix_mask_irq(msi, 1); 451 __pci_msix_desc_mask_irq(msi, 1);
452 else 452 else
453 default_msi_mask_irq(msi, 1, 1); 453 __pci_msi_desc_mask_irq(msi, 1, 1);
454 irq_set_msi_desc(msi->irq, NULL); 454 irq_set_msi_desc(msi->irq, NULL);
455 irq_free_desc(msi->irq); 455 irq_free_desc(msi->irq);
456 msi->msg.address_lo = 0; 456 msi->msg.address_lo = 0;
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 244fb4c81e25..a1403470f80e 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -222,7 +222,6 @@ config CPU_SHX3
222config ARCH_SHMOBILE 222config ARCH_SHMOBILE
223 bool 223 bool
224 select ARCH_SUSPEND_POSSIBLE 224 select ARCH_SUSPEND_POSSIBLE
225 select PM
226 select PM_RUNTIME 225 select PM_RUNTIME
227 226
228config CPU_HAS_PMU 227config CPU_HAS_PMU
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 5620e33c18a0..d4b01d4cc102 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -338,7 +338,7 @@ static struct soc_camera_platform_info camera_info = {
338 .format_name = "UYVY", 338 .format_name = "UYVY",
339 .format_depth = 16, 339 .format_depth = 16,
340 .format = { 340 .format = {
341 .code = V4L2_MBUS_FMT_UYVY8_2X8, 341 .code = MEDIA_BUS_FMT_UYVY8_2X8,
342 .colorspace = V4L2_COLORSPACE_SMPTE170M, 342 .colorspace = V4L2_COLORSPACE_SMPTE170M,
343 .field = V4L2_FIELD_NONE, 343 .field = V4L2_FIELD_NONE,
344 .width = 640, 344 .width = 640,
diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c
index e3abfd4277e2..53b8eeb1db20 100644
--- a/arch/sh/kernel/cpu/shmobile/cpuidle.c
+++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c
@@ -59,7 +59,6 @@ static struct cpuidle_driver cpuidle_driver = {
59 .exit_latency = 1, 59 .exit_latency = 1,
60 .target_residency = 1 * 2, 60 .target_residency = 1 * 2,
61 .power_usage = 3, 61 .power_usage = 3,
62 .flags = CPUIDLE_FLAG_TIME_VALID,
63 .enter = cpuidle_sleep_enter, 62 .enter = cpuidle_sleep_enter,
64 .name = "C1", 63 .name = "C1",
65 .desc = "SuperH Sleep Mode", 64 .desc = "SuperH Sleep Mode",
@@ -68,7 +67,6 @@ static struct cpuidle_driver cpuidle_driver = {
68 .exit_latency = 100, 67 .exit_latency = 100,
69 .target_residency = 1 * 2, 68 .target_residency = 1 * 2,
70 .power_usage = 1, 69 .power_usage = 1,
71 .flags = CPUIDLE_FLAG_TIME_VALID,
72 .enter = cpuidle_sleep_enter, 70 .enter = cpuidle_sleep_enter,
73 .name = "C2", 71 .name = "C2",
74 .desc = "SuperH Sleep Mode [SF]", 72 .desc = "SuperH Sleep Mode [SF]",
@@ -78,7 +76,6 @@ static struct cpuidle_driver cpuidle_driver = {
78 .exit_latency = 2300, 76 .exit_latency = 2300,
79 .target_residency = 1 * 2, 77 .target_residency = 1 * 2,
80 .power_usage = 1, 78 .power_usage = 1,
81 .flags = CPUIDLE_FLAG_TIME_VALID,
82 .enter = cpuidle_sleep_enter, 79 .enter = cpuidle_sleep_enter,
83 .name = "C3", 80 .name = "C3",
84 .desc = "SuperH Mobile Standby Mode [SF]", 81 .desc = "SuperH Mobile Standby Mode [SF]",
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c
index 3d85225b9e95..bce52ba66206 100644
--- a/arch/sh/mm/numa.c
+++ b/arch/sh/mm/numa.c
@@ -31,7 +31,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
31 unsigned long bootmem_paddr; 31 unsigned long bootmem_paddr;
32 32
33 /* Don't allow bogus node assignment */ 33 /* Don't allow bogus node assignment */
34 BUG_ON(nid > MAX_NUMNODES || nid <= 0); 34 BUG_ON(nid >= MAX_NUMNODES || nid <= 0);
35 35
36 start_pfn = start >> PAGE_SHIFT; 36 start_pfn = start >> PAGE_SHIFT;
37 end_pfn = end >> PAGE_SHIFT; 37 end_pfn = end >> PAGE_SHIFT;
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 9f532902627c..407ac14295f4 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -4,10 +4,6 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/ioport.h> /* struct resource */ 5#include <linux/ioport.h> /* struct resource */
6 6
7#define readb_relaxed(__addr) readb(__addr)
8#define readw_relaxed(__addr) readw(__addr)
9#define readl_relaxed(__addr) readl(__addr)
10
11#define IO_SPACE_LIMIT 0xffffffff 7#define IO_SPACE_LIMIT 0xffffffff
12 8
13#define memset_io(d,c,sz) _memset_io(d,c,sz) 9#define memset_io(d,c,sz) _memset_io(d,c,sz)
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 80b54b326d49..9b672be70dda 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -101,6 +101,7 @@ static inline void __raw_writeq(u64 q, const volatile void __iomem *addr)
101 * the cache by using ASI_PHYS_BYPASS_EC_E_L 101 * the cache by using ASI_PHYS_BYPASS_EC_E_L
102 */ 102 */
103#define readb readb 103#define readb readb
104#define readb_relaxed readb
104static inline u8 readb(const volatile void __iomem *addr) 105static inline u8 readb(const volatile void __iomem *addr)
105{ u8 ret; 106{ u8 ret;
106 107
@@ -112,6 +113,7 @@ static inline u8 readb(const volatile void __iomem *addr)
112} 113}
113 114
114#define readw readw 115#define readw readw
116#define readw_relaxed readw
115static inline u16 readw(const volatile void __iomem *addr) 117static inline u16 readw(const volatile void __iomem *addr)
116{ u16 ret; 118{ u16 ret;
117 119
@@ -124,6 +126,7 @@ static inline u16 readw(const volatile void __iomem *addr)
124} 126}
125 127
126#define readl readl 128#define readl readl
129#define readl_relaxed readl
127static inline u32 readl(const volatile void __iomem *addr) 130static inline u32 readl(const volatile void __iomem *addr)
128{ u32 ret; 131{ u32 ret;
129 132
@@ -136,6 +139,7 @@ static inline u32 readl(const volatile void __iomem *addr)
136} 139}
137 140
138#define readq readq 141#define readq readq
142#define readq_relaxed readq
139static inline u64 readq(const volatile void __iomem *addr) 143static inline u64 readq(const volatile void __iomem *addr)
140{ u64 ret; 144{ u64 ret;
141 145
@@ -148,6 +152,7 @@ static inline u64 readq(const volatile void __iomem *addr)
148} 152}
149 153
150#define writeb writeb 154#define writeb writeb
155#define writeb_relaxed writeb
151static inline void writeb(u8 b, volatile void __iomem *addr) 156static inline void writeb(u8 b, volatile void __iomem *addr)
152{ 157{
153 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */" 158 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */"
@@ -157,6 +162,7 @@ static inline void writeb(u8 b, volatile void __iomem *addr)
157} 162}
158 163
159#define writew writew 164#define writew writew
165#define writew_relaxed writew
160static inline void writew(u16 w, volatile void __iomem *addr) 166static inline void writew(u16 w, volatile void __iomem *addr)
161{ 167{
162 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */" 168 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */"
@@ -166,6 +172,7 @@ static inline void writew(u16 w, volatile void __iomem *addr)
166} 172}
167 173
168#define writel writel 174#define writel writel
175#define writel_relaxed writel
169static inline void writel(u32 l, volatile void __iomem *addr) 176static inline void writel(u32 l, volatile void __iomem *addr)
170{ 177{
171 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */" 178 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */"
@@ -175,6 +182,7 @@ static inline void writel(u32 l, volatile void __iomem *addr)
175} 182}
176 183
177#define writeq writeq 184#define writeq writeq
185#define writeq_relaxed writeq
178static inline void writeq(u64 q, volatile void __iomem *addr) 186static inline void writeq(u64 q, volatile void __iomem *addr)
179{ 187{
180 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */" 188 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */"
@@ -183,7 +191,6 @@ static inline void writeq(u64 q, volatile void __iomem *addr)
183 : "memory"); 191 : "memory");
184} 192}
185 193
186
187#define inb inb 194#define inb inb
188static inline u8 inb(unsigned long addr) 195static inline u8 inb(unsigned long addr)
189{ 196{
@@ -264,11 +271,6 @@ static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned l
264 outsl((unsigned long __force)port, buf, count); 271 outsl((unsigned long __force)port, buf, count);
265} 272}
266 273
267#define readb_relaxed(__addr) readb(__addr)
268#define readw_relaxed(__addr) readw(__addr)
269#define readl_relaxed(__addr) readl(__addr)
270#define readq_relaxed(__addr) readq(__addr)
271
272/* Valid I/O Space regions are anywhere, because each PCI bus supported 274/* Valid I/O Space regions are anywhere, because each PCI bus supported
273 * can live in an arbitrary area of the physical address range. 275 * can live in an arbitrary area of the physical address range.
274 */ 276 */
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index bfeb626085ac..1ff9e7864168 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -667,6 +667,13 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
667} 667}
668 668
669#ifdef CONFIG_TRANSPARENT_HUGEPAGE 669#ifdef CONFIG_TRANSPARENT_HUGEPAGE
670static inline unsigned long pmd_dirty(pmd_t pmd)
671{
672 pte_t pte = __pte(pmd_val(pmd));
673
674 return pte_dirty(pte);
675}
676
670static inline unsigned long pmd_young(pmd_t pmd) 677static inline unsigned long pmd_young(pmd_t pmd)
671{ 678{
672 pte_t pte = __pte(pmd_val(pmd)); 679 pte_t pte = __pte(pmd_val(pmd));
diff --git a/arch/sparc/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c
index 580651af73f2..84e16d81a6d8 100644
--- a/arch/sparc/kernel/pci_msi.c
+++ b/arch/sparc/kernel/pci_msi.c
@@ -111,10 +111,10 @@ static void free_msi(struct pci_pbm_info *pbm, int msi_num)
111 111
112static struct irq_chip msi_irq = { 112static struct irq_chip msi_irq = {
113 .name = "PCI-MSI", 113 .name = "PCI-MSI",
114 .irq_mask = mask_msi_irq, 114 .irq_mask = pci_msi_mask_irq,
115 .irq_unmask = unmask_msi_irq, 115 .irq_unmask = pci_msi_unmask_irq,
116 .irq_enable = unmask_msi_irq, 116 .irq_enable = pci_msi_unmask_irq,
117 .irq_disable = mask_msi_irq, 117 .irq_disable = pci_msi_mask_irq,
118 /* XXX affinity XXX */ 118 /* XXX affinity XXX */
119}; 119};
120 120
@@ -161,7 +161,7 @@ static int sparc64_setup_msi_irq(unsigned int *irq_p,
161 msg.data = msi; 161 msg.data = msi;
162 162
163 irq_set_msi_desc(*irq_p, entry); 163 irq_set_msi_desc(*irq_p, entry);
164 write_msi_msg(*irq_p, &msg); 164 pci_write_msi_msg(*irq_p, &msg);
165 165
166 return 0; 166 return 0;
167 167
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h
index 9fe434969fab..d372641054d9 100644
--- a/arch/tile/include/asm/io.h
+++ b/arch/tile/include/asm/io.h
@@ -241,6 +241,10 @@ static inline void writeq(u64 val, unsigned long addr)
241#define readw_relaxed readw 241#define readw_relaxed readw
242#define readl_relaxed readl 242#define readl_relaxed readl
243#define readq_relaxed readq 243#define readq_relaxed readq
244#define writeb_relaxed writeb
245#define writew_relaxed writew
246#define writel_relaxed writel
247#define writeq_relaxed writeq
244 248
245#define ioread8 readb 249#define ioread8 readb
246#define ioread16 readw 250#define ioread16 readw
diff --git a/arch/tile/kernel/early_printk.c b/arch/tile/kernel/early_printk.c
index b608e00e7f6d..aefb2c086726 100644
--- a/arch/tile/kernel/early_printk.c
+++ b/arch/tile/kernel/early_printk.c
@@ -43,13 +43,20 @@ static struct console early_hv_console = {
43 43
44void early_panic(const char *fmt, ...) 44void early_panic(const char *fmt, ...)
45{ 45{
46 va_list ap; 46 struct va_format vaf;
47 va_list args;
48
47 arch_local_irq_disable_all(); 49 arch_local_irq_disable_all();
48 va_start(ap, fmt); 50
49 early_printk("Kernel panic - not syncing: "); 51 va_start(args, fmt);
50 early_vprintk(fmt, ap); 52
51 early_printk("\n"); 53 vaf.fmt = fmt;
52 va_end(ap); 54 vaf.va = &args;
55
56 early_printk("Kernel panic - not syncing: %pV", &vaf);
57
58 va_end(args);
59
53 dump_stack(); 60 dump_stack();
54 hv_halt(); 61 hv_halt();
55} 62}
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index e39f9c542807..e717af20dada 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -1453,7 +1453,7 @@ static struct pci_ops tile_cfg_ops = {
1453static unsigned int tilegx_msi_startup(struct irq_data *d) 1453static unsigned int tilegx_msi_startup(struct irq_data *d)
1454{ 1454{
1455 if (d->msi_desc) 1455 if (d->msi_desc)
1456 unmask_msi_irq(d); 1456 pci_msi_unmask_irq(d);
1457 1457
1458 return 0; 1458 return 0;
1459} 1459}
@@ -1465,14 +1465,14 @@ static void tilegx_msi_ack(struct irq_data *d)
1465 1465
1466static void tilegx_msi_mask(struct irq_data *d) 1466static void tilegx_msi_mask(struct irq_data *d)
1467{ 1467{
1468 mask_msi_irq(d); 1468 pci_msi_mask_irq(d);
1469 __insn_mtspr(SPR_IPI_MASK_SET_K, 1UL << d->irq); 1469 __insn_mtspr(SPR_IPI_MASK_SET_K, 1UL << d->irq);
1470} 1470}
1471 1471
1472static void tilegx_msi_unmask(struct irq_data *d) 1472static void tilegx_msi_unmask(struct irq_data *d)
1473{ 1473{
1474 __insn_mtspr(SPR_IPI_MASK_RESET_K, 1UL << d->irq); 1474 __insn_mtspr(SPR_IPI_MASK_RESET_K, 1UL << d->irq);
1475 unmask_msi_irq(d); 1475 pci_msi_unmask_irq(d);
1476} 1476}
1477 1477
1478static struct irq_chip tilegx_msi_chip = { 1478static struct irq_chip tilegx_msi_chip = {
@@ -1590,7 +1590,7 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
1590 msg.address_hi = msi_addr >> 32; 1590 msg.address_hi = msi_addr >> 32;
1591 msg.address_lo = msi_addr & 0xffffffff; 1591 msg.address_lo = msi_addr & 0xffffffff;
1592 1592
1593 write_msi_msg(irq, &msg); 1593 pci_write_msi_msg(irq, &msg);
1594 irq_set_chip_and_handler(irq, &tilegx_msi_chip, handle_level_irq); 1594 irq_set_chip_and_handler(irq, &tilegx_msi_chip, handle_level_irq);
1595 irq_set_handler_data(irq, controller); 1595 irq_set_handler_data(irq, controller);
1596 1596
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index b9736ded06f2..7f079bbfdf4c 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -534,11 +534,10 @@ static void __init setup_memory(void)
534 } 534 }
535 } 535 }
536 physpages -= dropped_pages; 536 physpages -= dropped_pages;
537 pr_warning("Only using %ldMB memory;" 537 pr_warn("Only using %ldMB memory - ignoring %ldMB\n",
538 " ignoring %ldMB.\n", 538 physpages >> (20 - PAGE_SHIFT),
539 physpages >> (20 - PAGE_SHIFT), 539 dropped_pages >> (20 - PAGE_SHIFT));
540 dropped_pages >> (20 - PAGE_SHIFT)); 540 pr_warn("Consider using a larger page size\n");
541 pr_warning("Consider using a larger page size.\n");
542 } 541 }
543#endif 542#endif
544 543
@@ -566,9 +565,8 @@ static void __init setup_memory(void)
566 565
567#ifndef __tilegx__ 566#ifndef __tilegx__
568 if (node_end_pfn[0] > MAXMEM_PFN) { 567 if (node_end_pfn[0] > MAXMEM_PFN) {
569 pr_warning("Only using %ldMB LOWMEM.\n", 568 pr_warn("Only using %ldMB LOWMEM\n", MAXMEM >> 20);
570 MAXMEM>>20); 569 pr_warn("Use a HIGHMEM enabled kernel\n");
571 pr_warning("Use a HIGHMEM enabled kernel.\n");
572 max_low_pfn = MAXMEM_PFN; 570 max_low_pfn = MAXMEM_PFN;
573 max_pfn = MAXMEM_PFN; 571 max_pfn = MAXMEM_PFN;
574 node_end_pfn[0] = MAXMEM_PFN; 572 node_end_pfn[0] = MAXMEM_PFN;
@@ -1112,8 +1110,8 @@ static void __init load_hv_initrd(void)
1112 fd = hv_fs_findfile((HV_VirtAddr) initramfs_file); 1110 fd = hv_fs_findfile((HV_VirtAddr) initramfs_file);
1113 if (fd == HV_ENOENT) { 1111 if (fd == HV_ENOENT) {
1114 if (set_initramfs_file) { 1112 if (set_initramfs_file) {
1115 pr_warning("No such hvfs initramfs file '%s'\n", 1113 pr_warn("No such hvfs initramfs file '%s'\n",
1116 initramfs_file); 1114 initramfs_file);
1117 return; 1115 return;
1118 } else { 1116 } else {
1119 /* Try old backwards-compatible name. */ 1117 /* Try old backwards-compatible name. */
@@ -1126,8 +1124,8 @@ static void __init load_hv_initrd(void)
1126 stat = hv_fs_fstat(fd); 1124 stat = hv_fs_fstat(fd);
1127 BUG_ON(stat.size < 0); 1125 BUG_ON(stat.size < 0);
1128 if (stat.flags & HV_FS_ISDIR) { 1126 if (stat.flags & HV_FS_ISDIR) {
1129 pr_warning("Ignoring hvfs file '%s': it's a directory.\n", 1127 pr_warn("Ignoring hvfs file '%s': it's a directory\n",
1130 initramfs_file); 1128 initramfs_file);
1131 return; 1129 return;
1132 } 1130 }
1133 initrd = alloc_bootmem_pages(stat.size); 1131 initrd = alloc_bootmem_pages(stat.size);
@@ -1185,9 +1183,8 @@ static void __init validate_hv(void)
1185 HV_Topology topology = hv_inquire_topology(); 1183 HV_Topology topology = hv_inquire_topology();
1186 BUG_ON(topology.coord.x != 0 || topology.coord.y != 0); 1184 BUG_ON(topology.coord.x != 0 || topology.coord.y != 0);
1187 if (topology.width != 1 || topology.height != 1) { 1185 if (topology.width != 1 || topology.height != 1) {
1188 pr_warning("Warning: booting UP kernel on %dx%d grid;" 1186 pr_warn("Warning: booting UP kernel on %dx%d grid; will ignore all but first tile\n",
1189 " will ignore all but first tile.\n", 1187 topology.width, topology.height);
1190 topology.width, topology.height);
1191 } 1188 }
1192#endif 1189#endif
1193 1190
@@ -1208,9 +1205,8 @@ static void __init validate_hv(void)
1208 * We use a struct cpumask for this, so it must be big enough. 1205 * We use a struct cpumask for this, so it must be big enough.
1209 */ 1206 */
1210 if ((smp_height * smp_width) > nr_cpu_ids) 1207 if ((smp_height * smp_width) > nr_cpu_ids)
1211 early_panic("Hypervisor %d x %d grid too big for Linux" 1208 early_panic("Hypervisor %d x %d grid too big for Linux NR_CPUS %d\n",
1212 " NR_CPUS %d\n", smp_height, smp_width, 1209 smp_height, smp_width, nr_cpu_ids);
1213 nr_cpu_ids);
1214#endif 1210#endif
1215 1211
1216 /* 1212 /*
@@ -1265,10 +1261,9 @@ static void __init validate_va(void)
1265 1261
1266 /* Kernel PCs must have their high bit set; see intvec.S. */ 1262 /* Kernel PCs must have their high bit set; see intvec.S. */
1267 if ((long)VMALLOC_START >= 0) 1263 if ((long)VMALLOC_START >= 0)
1268 early_panic( 1264 early_panic("Linux VMALLOC region below the 2GB line (%#lx)!\n"
1269 "Linux VMALLOC region below the 2GB line (%#lx)!\n" 1265 "Reconfigure the kernel with smaller VMALLOC_RESERVE\n",
1270 "Reconfigure the kernel with smaller VMALLOC_RESERVE.\n", 1266 VMALLOC_START);
1271 VMALLOC_START);
1272#endif 1267#endif
1273} 1268}
1274 1269
@@ -1395,7 +1390,7 @@ static void __init setup_cpu_maps(void)
1395 1390
1396static int __init dataplane(char *str) 1391static int __init dataplane(char *str)
1397{ 1392{
1398 pr_warning("WARNING: dataplane support disabled in this kernel\n"); 1393 pr_warn("WARNING: dataplane support disabled in this kernel\n");
1399 return 0; 1394 return 0;
1400} 1395}
1401 1396
@@ -1413,8 +1408,8 @@ void __init setup_arch(char **cmdline_p)
1413 len = hv_get_command_line((HV_VirtAddr) boot_command_line, 1408 len = hv_get_command_line((HV_VirtAddr) boot_command_line,
1414 COMMAND_LINE_SIZE); 1409 COMMAND_LINE_SIZE);
1415 if (boot_command_line[0]) 1410 if (boot_command_line[0])
1416 pr_warning("WARNING: ignoring dynamic command line \"%s\"\n", 1411 pr_warn("WARNING: ignoring dynamic command line \"%s\"\n",
1417 boot_command_line); 1412 boot_command_line);
1418 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); 1413 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
1419#else 1414#else
1420 char *hv_cmdline; 1415 char *hv_cmdline;
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h
index aa4a743dc4ab..941527e507f7 100644
--- a/arch/um/include/asm/mmu_context.h
+++ b/arch/um/include/asm/mmu_context.h
@@ -10,7 +10,26 @@
10#include <asm/mmu.h> 10#include <asm/mmu.h>
11 11
12extern void uml_setup_stubs(struct mm_struct *mm); 12extern void uml_setup_stubs(struct mm_struct *mm);
13/*
14 * Needed since we do not use the asm-generic/mm_hooks.h:
15 */
16static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
17{
18 uml_setup_stubs(mm);
19}
13extern void arch_exit_mmap(struct mm_struct *mm); 20extern void arch_exit_mmap(struct mm_struct *mm);
21static inline void arch_unmap(struct mm_struct *mm,
22 struct vm_area_struct *vma,
23 unsigned long start, unsigned long end)
24{
25}
26static inline void arch_bprm_mm_init(struct mm_struct *mm,
27 struct vm_area_struct *vma)
28{
29}
30/*
31 * end asm-generic/mm_hooks.h functions
32 */
14 33
15#define deactivate_mm(tsk,mm) do { } while (0) 34#define deactivate_mm(tsk,mm) do { } while (0)
16 35
@@ -41,11 +60,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
41 } 60 }
42} 61}
43 62
44static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
45{
46 uml_setup_stubs(mm);
47}
48
49static inline void enter_lazy_tlb(struct mm_struct *mm, 63static inline void enter_lazy_tlb(struct mm_struct *mm,
50 struct task_struct *tsk) 64 struct task_struct *tsk)
51{ 65{
diff --git a/arch/unicore32/include/asm/mmu_context.h b/arch/unicore32/include/asm/mmu_context.h
index ef470a7a3d0f..1cb5220afaf9 100644
--- a/arch/unicore32/include/asm/mmu_context.h
+++ b/arch/unicore32/include/asm/mmu_context.h
@@ -86,4 +86,15 @@ static inline void arch_dup_mmap(struct mm_struct *oldmm,
86{ 86{
87} 87}
88 88
89static inline void arch_unmap(struct mm_struct *mm,
90 struct vm_area_struct *vma,
91 unsigned long start, unsigned long end)
92{
93}
94
95static inline void arch_bprm_mm_init(struct mm_struct *mm,
96 struct vm_area_struct *vma)
97{
98}
99
89#endif 100#endif
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 41a503c15862..bea3a0159496 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -248,6 +248,10 @@ config HAVE_INTEL_TXT
248 def_bool y 248 def_bool y
249 depends on INTEL_IOMMU && ACPI 249 depends on INTEL_IOMMU && ACPI
250 250
251config X86_INTEL_MPX
252 def_bool y
253 depends on CPU_SUP_INTEL
254
251config X86_32_SMP 255config X86_32_SMP
252 def_bool y 256 def_bool y
253 depends on X86_32 && SMP 257 depends on X86_32 && SMP
@@ -988,6 +992,24 @@ config X86_ESPFIX64
988 def_bool y 992 def_bool y
989 depends on X86_16BIT && X86_64 993 depends on X86_16BIT && X86_64
990 994
995config X86_VSYSCALL_EMULATION
996 bool "Enable vsyscall emulation" if EXPERT
997 default y
998 depends on X86_64
999 ---help---
1000 This enables emulation of the legacy vsyscall page. Disabling
1001 it is roughly equivalent to booting with vsyscall=none, except
1002 that it will also disable the helpful warning if a program
1003 tries to use a vsyscall. With this option set to N, offending
1004 programs will just segfault, citing addresses of the form
1005 0xffffffffff600?00.
1006
1007 This option is required by many programs built before 2013, and
1008 care should be used even with newer programs if set to N.
1009
1010 Disabling this option saves about 7K of kernel size and
1011 possibly 4K of additional runtime pagetable memory.
1012
991config TOSHIBA 1013config TOSHIBA
992 tristate "Toshiba Laptop support" 1014 tristate "Toshiba Laptop support"
993 depends on X86_32 1015 depends on X86_32
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index be1e07d4b596..d999398928bc 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -3,6 +3,18 @@
3# 3#
4# create a compressed vmlinux image from the original vmlinux 4# create a compressed vmlinux image from the original vmlinux
5# 5#
6# vmlinuz is:
7# decompression code (*.o)
8# asm globals (piggy.S), including:
9# vmlinux.bin.(gz|bz2|lzma|...)
10#
11# vmlinux.bin is:
12# vmlinux stripped of debugging and comments
13# vmlinux.bin.all is:
14# vmlinux.bin + vmlinux.relocs
15# vmlinux.bin.(gz|bz2|lzma|...) is:
16# (see scripts/Makefile.lib size_append)
17# compressed vmlinux.bin.all + u32 size of vmlinux.bin.all
6 18
7targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ 19targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
8 vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 20 vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
@@ -35,7 +47,8 @@ vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o
35 47
36$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 48$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
37 49
38vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o 50vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
51 $(objtree)/drivers/firmware/efi/libstub/lib.a
39 52
40$(obj)/vmlinux: $(vmlinux-objs-y) FORCE 53$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
41 $(call if_changed,ld) 54 $(call if_changed,ld)
@@ -76,7 +89,7 @@ suffix-$(CONFIG_KERNEL_XZ) := xz
76suffix-$(CONFIG_KERNEL_LZO) := lzo 89suffix-$(CONFIG_KERNEL_LZO) := lzo
77suffix-$(CONFIG_KERNEL_LZ4) := lz4 90suffix-$(CONFIG_KERNEL_LZ4) := lz4
78 91
79RUN_SIZE = $(shell objdump -h vmlinux | \ 92RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \
80 perl $(srctree)/arch/x86/tools/calc_run_size.pl) 93 perl $(srctree)/arch/x86/tools/calc_run_size.pl)
81quiet_cmd_mkpiggy = MKPIGGY $@ 94quiet_cmd_mkpiggy = MKPIGGY $@
82 cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) 95 cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false )
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 1acf605a646d..92b9a5f2aed6 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -21,8 +21,10 @@ static efi_system_table_t *sys_table;
21 21
22static struct efi_config *efi_early; 22static struct efi_config *efi_early;
23 23
24#define efi_call_early(f, ...) \ 24__pure const struct efi_config *__efi_early(void)
25 efi_early->call(efi_early->f, __VA_ARGS__); 25{
26 return efi_early;
27}
26 28
27#define BOOT_SERVICES(bits) \ 29#define BOOT_SERVICES(bits) \
28static void setup_boot_services##bits(struct efi_config *c) \ 30static void setup_boot_services##bits(struct efi_config *c) \
@@ -285,8 +287,6 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
285 } 287 }
286} 288}
287 289
288#include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c"
289
290static void find_bits(unsigned long mask, u8 *pos, u8 *size) 290static void find_bits(unsigned long mask, u8 *pos, u8 *size)
291{ 291{
292 u8 first, len; 292 u8 first, len;
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
index c88c31ecad12..d487e727f1ec 100644
--- a/arch/x86/boot/compressed/eboot.h
+++ b/arch/x86/boot/compressed/eboot.h
@@ -103,20 +103,4 @@ 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
122#endif /* BOOT_COMPRESSED_EBOOT_H */ 106#endif /* BOOT_COMPRESSED_EBOOT_H */
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 30dd59a9f0b4..dcc1c536cc21 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -260,7 +260,7 @@ static void handle_relocations(void *output, unsigned long output_len)
260 260
261 /* 261 /*
262 * Process relocations: 32 bit relocations first then 64 bit after. 262 * Process relocations: 32 bit relocations first then 64 bit after.
263 * Two sets of binary relocations are added to the end of the kernel 263 * Three sets of binary relocations are added to the end of the kernel
264 * before compression. Each relocation table entry is the kernel 264 * before compression. Each relocation table entry is the kernel
265 * address of the location which needs to be updated stored as a 265 * address of the location which needs to be updated stored as a
266 * 32-bit value which is sign extended to 64 bits. 266 * 32-bit value which is sign extended to 64 bits.
@@ -270,6 +270,8 @@ static void handle_relocations(void *output, unsigned long output_len)
270 * kernel bits... 270 * kernel bits...
271 * 0 - zero terminator for 64 bit relocations 271 * 0 - zero terminator for 64 bit relocations
272 * 64 bit relocation repeated 272 * 64 bit relocation repeated
273 * 0 - zero terminator for inverse 32 bit relocations
274 * 32 bit inverse relocation repeated
273 * 0 - zero terminator for 32 bit relocations 275 * 0 - zero terminator for 32 bit relocations
274 * 32 bit relocation repeated 276 * 32 bit relocation repeated
275 * 277 *
@@ -286,6 +288,16 @@ static void handle_relocations(void *output, unsigned long output_len)
286 *(uint32_t *)ptr += delta; 288 *(uint32_t *)ptr += delta;
287 } 289 }
288#ifdef CONFIG_X86_64 290#ifdef CONFIG_X86_64
291 while (*--reloc) {
292 long extended = *reloc;
293 extended += map;
294
295 ptr = (unsigned long)extended;
296 if (ptr < min_addr || ptr > max_addr)
297 error("inverse 32-bit relocation outside of kernel!\n");
298
299 *(int32_t *)ptr -= delta;
300 }
289 for (reloc--; *reloc; reloc--) { 301 for (reloc--; *reloc; reloc--) {
290 long extended = *reloc; 302 long extended = *reloc;
291 extended += map; 303 extended += map;
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 32d2e7056c87..419819d6dab3 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -8,6 +8,7 @@ CONFIG_TASKSTATS=y
8CONFIG_TASK_DELAY_ACCT=y 8CONFIG_TASK_DELAY_ACCT=y
9CONFIG_TASK_XACCT=y 9CONFIG_TASK_XACCT=y
10CONFIG_TASK_IO_ACCOUNTING=y 10CONFIG_TASK_IO_ACCOUNTING=y
11CONFIG_FHANDLE=y
11CONFIG_AUDIT=y 12CONFIG_AUDIT=y
12CONFIG_NO_HZ=y 13CONFIG_NO_HZ=y
13CONFIG_HIGH_RES_TIMERS=y 14CONFIG_HIGH_RES_TIMERS=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index a481dd4755d5..4c311ddd973b 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -7,6 +7,7 @@ CONFIG_TASKSTATS=y
7CONFIG_TASK_DELAY_ACCT=y 7CONFIG_TASK_DELAY_ACCT=y
8CONFIG_TASK_XACCT=y 8CONFIG_TASK_XACCT=y
9CONFIG_TASK_IO_ACCOUNTING=y 9CONFIG_TASK_IO_ACCOUNTING=y
10CONFIG_FHANDLE=y
10CONFIG_AUDIT=y 11CONFIG_AUDIT=y
11CONFIG_NO_HZ=y 12CONFIG_NO_HZ=y
12CONFIG_HIGH_RES_TIMERS=y 13CONFIG_HIGH_RES_TIMERS=y
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index df91466f973d..ae6aad1d24f7 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -342,8 +342,8 @@ static int load_aout_binary(struct linux_binprm *bprm)
342 time_after(jiffies, error_time + 5*HZ)) { 342 time_after(jiffies, error_time + 5*HZ)) {
343 printk(KERN_WARNING 343 printk(KERN_WARNING
344 "fd_offset is not page aligned. Please convert " 344 "fd_offset is not page aligned. Please convert "
345 "program: %s\n", 345 "program: %pD\n",
346 bprm->file->f_path.dentry->d_name.name); 346 bprm->file);
347 error_time = jiffies; 347 error_time = jiffies;
348 } 348 }
349#endif 349#endif
@@ -429,8 +429,8 @@ static int load_aout_library(struct file *file)
429 if (time_after(jiffies, error_time + 5*HZ)) { 429 if (time_after(jiffies, error_time + 5*HZ)) {
430 printk(KERN_WARNING 430 printk(KERN_WARNING
431 "N_TXTOFF is not page aligned. Please convert " 431 "N_TXTOFF is not page aligned. Please convert "
432 "library: %s\n", 432 "library: %pD\n",
433 file->f_path.dentry->d_name.name); 433 file);
434 error_time = jiffies; 434 error_time = jiffies;
435 } 435 }
436#endif 436#endif
diff --git a/arch/x86/include/asm/cacheflush.h b/arch/x86/include/asm/cacheflush.h
index 9863ee3747da..47c8e32f621a 100644
--- a/arch/x86/include/asm/cacheflush.h
+++ b/arch/x86/include/asm/cacheflush.h
@@ -5,65 +5,6 @@
5#include <asm-generic/cacheflush.h> 5#include <asm-generic/cacheflush.h>
6#include <asm/special_insns.h> 6#include <asm/special_insns.h>
7 7
8#ifdef CONFIG_X86_PAT
9/*
10 * X86 PAT uses page flags WC and Uncached together to keep track of
11 * memory type of pages that have backing page struct. X86 PAT supports 3
12 * different memory types, _PAGE_CACHE_WB, _PAGE_CACHE_WC and
13 * _PAGE_CACHE_UC_MINUS and fourth state where page's memory type has not
14 * been changed from its default (value of -1 used to denote this).
15 * Note we do not support _PAGE_CACHE_UC here.
16 */
17
18#define _PGMT_DEFAULT 0
19#define _PGMT_WC (1UL << PG_arch_1)
20#define _PGMT_UC_MINUS (1UL << PG_uncached)
21#define _PGMT_WB (1UL << PG_uncached | 1UL << PG_arch_1)
22#define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1)
23#define _PGMT_CLEAR_MASK (~_PGMT_MASK)
24
25static inline unsigned long get_page_memtype(struct page *pg)
26{
27 unsigned long pg_flags = pg->flags & _PGMT_MASK;
28
29 if (pg_flags == _PGMT_DEFAULT)
30 return -1;
31 else if (pg_flags == _PGMT_WC)
32 return _PAGE_CACHE_WC;
33 else if (pg_flags == _PGMT_UC_MINUS)
34 return _PAGE_CACHE_UC_MINUS;
35 else
36 return _PAGE_CACHE_WB;
37}
38
39static inline void set_page_memtype(struct page *pg, unsigned long memtype)
40{
41 unsigned long memtype_flags = _PGMT_DEFAULT;
42 unsigned long old_flags;
43 unsigned long new_flags;
44
45 switch (memtype) {
46 case _PAGE_CACHE_WC:
47 memtype_flags = _PGMT_WC;
48 break;
49 case _PAGE_CACHE_UC_MINUS:
50 memtype_flags = _PGMT_UC_MINUS;
51 break;
52 case _PAGE_CACHE_WB:
53 memtype_flags = _PGMT_WB;
54 break;
55 }
56
57 do {
58 old_flags = pg->flags;
59 new_flags = (old_flags & _PGMT_CLEAR_MASK) | memtype_flags;
60 } while (cmpxchg(&pg->flags, old_flags, new_flags) != old_flags);
61}
62#else
63static inline unsigned long get_page_memtype(struct page *pg) { return -1; }
64static inline void set_page_memtype(struct page *pg, unsigned long memtype) { }
65#endif
66
67/* 8/*
68 * The set_memory_* API can be used to change various attributes of a virtual 9 * The set_memory_* API can be used to change various attributes of a virtual
69 * address range. The attributes include: 10 * address range. The attributes include:
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 0bb1335313b2..aede2c347bde 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -189,6 +189,11 @@
189#define X86_FEATURE_DTHERM ( 7*32+ 7) /* Digital Thermal Sensor */ 189#define X86_FEATURE_DTHERM ( 7*32+ 7) /* Digital Thermal Sensor */
190#define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ 190#define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */
191#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ 191#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */
192#define X86_FEATURE_HWP ( 7*32+ 10) /* "hwp" Intel HWP */
193#define X86_FEATURE_HWP_NOITFY ( 7*32+ 11) /* Intel HWP_NOTIFY */
194#define X86_FEATURE_HWP_ACT_WINDOW ( 7*32+ 12) /* Intel HWP_ACT_WINDOW */
195#define X86_FEATURE_HWP_EPP ( 7*32+13) /* Intel HWP_EPP */
196#define X86_FEATURE_HWP_PKG_REQ ( 7*32+14) /* Intel HWP_PKG_REQ */
192 197
193/* Virtualization flags: Linux defined, word 8 */ 198/* Virtualization flags: Linux defined, word 8 */
194#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ 199#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */
diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h
index 97534a7d38e3..f226df064660 100644
--- a/arch/x86/include/asm/disabled-features.h
+++ b/arch/x86/include/asm/disabled-features.h
@@ -10,6 +10,12 @@
10 * cpu_feature_enabled(). 10 * cpu_feature_enabled().
11 */ 11 */
12 12
13#ifdef CONFIG_X86_INTEL_MPX
14# define DISABLE_MPX 0
15#else
16# define DISABLE_MPX (1<<(X86_FEATURE_MPX & 31))
17#endif
18
13#ifdef CONFIG_X86_64 19#ifdef CONFIG_X86_64
14# define DISABLE_VME (1<<(X86_FEATURE_VME & 31)) 20# define DISABLE_VME (1<<(X86_FEATURE_VME & 31))
15# define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31)) 21# define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31))
@@ -34,6 +40,6 @@
34#define DISABLED_MASK6 0 40#define DISABLED_MASK6 0
35#define DISABLED_MASK7 0 41#define DISABLED_MASK7 0
36#define DISABLED_MASK8 0 42#define DISABLED_MASK8 0
37#define DISABLED_MASK9 0 43#define DISABLED_MASK9 (DISABLE_MPX)
38 44
39#endif /* _ASM_X86_DISABLED_FEATURES_H */ 45#endif /* _ASM_X86_DISABLED_FEATURES_H */
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 9b11757975d0..25bce45c6fc4 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -158,6 +158,30 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
158} 158}
159#endif /* CONFIG_EFI_MIXED */ 159#endif /* CONFIG_EFI_MIXED */
160 160
161
162/* arch specific definitions used by the stub code */
163
164struct efi_config {
165 u64 image_handle;
166 u64 table;
167 u64 allocate_pool;
168 u64 allocate_pages;
169 u64 get_memory_map;
170 u64 free_pool;
171 u64 free_pages;
172 u64 locate_handle;
173 u64 handle_protocol;
174 u64 exit_boot_services;
175 u64 text_output;
176 efi_status_t (*call)(unsigned long, ...);
177 bool is64;
178} __packed;
179
180__pure const struct efi_config *__efi_early(void);
181
182#define efi_call_early(f, ...) \
183 __efi_early()->call(__efi_early()->f, __VA_ARGS__);
184
161extern bool efi_reboot_required(void); 185extern bool efi_reboot_required(void);
162 186
163#else 187#else
diff --git a/arch/x86/include/asm/fb.h b/arch/x86/include/asm/fb.h
index 2519d0679d99..c3dd5e71f439 100644
--- a/arch/x86/include/asm/fb.h
+++ b/arch/x86/include/asm/fb.h
@@ -8,8 +8,12 @@
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, 8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off) 9 unsigned long off)
10{ 10{
11 unsigned long prot;
12
13 prot = pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK;
11 if (boot_cpu_data.x86 > 3) 14 if (boot_cpu_data.x86 > 3)
12 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; 15 pgprot_val(vma->vm_page_prot) =
16 prot | cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
13} 17}
14 18
15extern int fb_is_primary_device(struct fb_info *info); 19extern int fb_is_primary_device(struct fb_info *info);
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index ffb1733ac91f..f80d70009ff8 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -69,7 +69,9 @@ enum fixed_addresses {
69#ifdef CONFIG_X86_32 69#ifdef CONFIG_X86_32
70 FIX_HOLE, 70 FIX_HOLE,
71#else 71#else
72#ifdef CONFIG_X86_VSYSCALL_EMULATION
72 VSYSCALL_PAGE = (FIXADDR_TOP - VSYSCALL_ADDR) >> PAGE_SHIFT, 73 VSYSCALL_PAGE = (FIXADDR_TOP - VSYSCALL_ADDR) >> PAGE_SHIFT,
74#endif
73#ifdef CONFIG_PARAVIRT_CLOCK 75#ifdef CONFIG_PARAVIRT_CLOCK
74 PVCLOCK_FIXMAP_BEGIN, 76 PVCLOCK_FIXMAP_BEGIN,
75 PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1, 77 PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1,
@@ -136,9 +138,7 @@ enum fixed_addresses {
136extern void reserve_top_address(unsigned long reserve); 138extern void reserve_top_address(unsigned long reserve);
137 139
138#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) 140#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
139#define FIXADDR_BOOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
140#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 141#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
141#define FIXADDR_BOOT_START (FIXADDR_TOP - FIXADDR_BOOT_SIZE)
142 142
143extern int fixmaps_set; 143extern int fixmaps_set;
144 144
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index e1f7fecaa7d6..f45acad3c4b6 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -1,39 +1,6 @@
1#ifndef _ASM_X86_FTRACE_H 1#ifndef _ASM_X86_FTRACE_H
2#define _ASM_X86_FTRACE_H 2#define _ASM_X86_FTRACE_H
3 3
4#ifdef __ASSEMBLY__
5
6 /* skip is set if the stack was already partially adjusted */
7 .macro MCOUNT_SAVE_FRAME skip=0
8 /*
9 * We add enough stack to save all regs.
10 */
11 subq $(SS+8-\skip), %rsp
12 movq %rax, RAX(%rsp)
13 movq %rcx, RCX(%rsp)
14 movq %rdx, RDX(%rsp)
15 movq %rsi, RSI(%rsp)
16 movq %rdi, RDI(%rsp)
17 movq %r8, R8(%rsp)
18 movq %r9, R9(%rsp)
19 /* Move RIP to its proper location */
20 movq SS+8(%rsp), %rdx
21 movq %rdx, RIP(%rsp)
22 .endm
23
24 .macro MCOUNT_RESTORE_FRAME skip=0
25 movq R9(%rsp), %r9
26 movq R8(%rsp), %r8
27 movq RDI(%rsp), %rdi
28 movq RSI(%rsp), %rsi
29 movq RDX(%rsp), %rdx
30 movq RCX(%rsp), %rcx
31 movq RAX(%rsp), %rax
32 addq $(SS+8-\skip), %rsp
33 .endm
34
35#endif
36
37#ifdef CONFIG_FUNCTION_TRACER 4#ifdef CONFIG_FUNCTION_TRACER
38#ifdef CC_USING_FENTRY 5#ifdef CC_USING_FENTRY
39# define MCOUNT_ADDR ((long)(__fentry__)) 6# define MCOUNT_ADDR ((long)(__fentry__))
diff --git a/arch/x86/include/asm/highmem.h b/arch/x86/include/asm/highmem.h
index 302a323b3f67..04e9d023168f 100644
--- a/arch/x86/include/asm/highmem.h
+++ b/arch/x86/include/asm/highmem.h
@@ -38,17 +38,20 @@ extern unsigned long highstart_pfn, highend_pfn;
38/* 38/*
39 * Ordering is: 39 * Ordering is:
40 * 40 *
41 * FIXADDR_TOP 41 * high memory on: high_memory off:
42 * fixed_addresses 42 * FIXADDR_TOP FIXADDR_TOP
43 * FIXADDR_START 43 * fixed addresses fixed addresses
44 * temp fixed addresses 44 * FIXADDR_START FIXADDR_START
45 * FIXADDR_BOOT_START 45 * temp fixed addresses/persistent kmap area VMALLOC_END
46 * Persistent kmap area 46 * PKMAP_BASE temp fixed addresses/vmalloc area
47 * PKMAP_BASE 47 * VMALLOC_END VMALLOC_START
48 * VMALLOC_END 48 * vmalloc area high_memory
49 * Vmalloc area 49 * VMALLOC_START
50 * VMALLOC_START 50 * high_memory
51 * high_memory 51 *
52 * The temp fixed area is only used during boot for early_ioremap(), and
53 * it is unused when the ioremap() is functional. vmalloc/pkmap area become
54 * available after early boot so the temp fixed area is available for re-use.
52 */ 55 */
53#define LAST_PKMAP_MASK (LAST_PKMAP-1) 56#define LAST_PKMAP_MASK (LAST_PKMAP-1)
54#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 57#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h
index 48eb30a86062..47f29b1d1846 100644
--- a/arch/x86/include/asm/insn.h
+++ b/arch/x86/include/asm/insn.h
@@ -65,6 +65,7 @@ struct insn {
65 unsigned char x86_64; 65 unsigned char x86_64;
66 66
67 const insn_byte_t *kaddr; /* kernel address of insn to analyze */ 67 const insn_byte_t *kaddr; /* kernel address of insn to analyze */
68 const insn_byte_t *end_kaddr; /* kernel address of last insn in buffer */
68 const insn_byte_t *next_byte; 69 const insn_byte_t *next_byte;
69}; 70};
70 71
@@ -96,7 +97,7 @@ struct insn {
96#define X86_VEX_P(vex) ((vex) & 0x03) /* VEX3 Byte2, VEX2 Byte1 */ 97#define X86_VEX_P(vex) ((vex) & 0x03) /* VEX3 Byte2, VEX2 Byte1 */
97#define X86_VEX_M_MAX 0x1f /* VEX3.M Maximum value */ 98#define X86_VEX_M_MAX 0x1f /* VEX3.M Maximum value */
98 99
99extern void insn_init(struct insn *insn, const void *kaddr, int x86_64); 100extern void insn_init(struct insn *insn, const void *kaddr, int buf_len, int x86_64);
100extern void insn_get_prefixes(struct insn *insn); 101extern void insn_get_prefixes(struct insn *insn);
101extern void insn_get_opcode(struct insn *insn); 102extern void insn_get_opcode(struct insn *insn);
102extern void insn_get_modrm(struct insn *insn); 103extern void insn_get_modrm(struct insn *insn);
@@ -115,12 +116,13 @@ static inline void insn_get_attribute(struct insn *insn)
115extern int insn_rip_relative(struct insn *insn); 116extern int insn_rip_relative(struct insn *insn);
116 117
117/* Init insn for kernel text */ 118/* Init insn for kernel text */
118static inline void kernel_insn_init(struct insn *insn, const void *kaddr) 119static inline void kernel_insn_init(struct insn *insn,
120 const void *kaddr, int buf_len)
119{ 121{
120#ifdef CONFIG_X86_64 122#ifdef CONFIG_X86_64
121 insn_init(insn, kaddr, 1); 123 insn_init(insn, kaddr, buf_len, 1);
122#else /* CONFIG_X86_32 */ 124#else /* CONFIG_X86_32 */
123 insn_init(insn, kaddr, 0); 125 insn_init(insn, kaddr, buf_len, 0);
124#endif 126#endif
125} 127}
126 128
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index b8237d8a1e0c..34a5b93704d3 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -74,6 +74,9 @@ build_mmio_write(__writel, "l", unsigned int, "r", )
74#define __raw_readw __readw 74#define __raw_readw __readw
75#define __raw_readl __readl 75#define __raw_readl __readl
76 76
77#define writeb_relaxed(v, a) __writeb(v, a)
78#define writew_relaxed(v, a) __writew(v, a)
79#define writel_relaxed(v, a) __writel(v, a)
77#define __raw_writeb __writeb 80#define __raw_writeb __writeb
78#define __raw_writew __writew 81#define __raw_writew __writew
79#define __raw_writel __writel 82#define __raw_writel __writel
@@ -86,6 +89,7 @@ build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
86build_mmio_write(writeq, "q", unsigned long, "r", :"memory") 89build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
87 90
88#define readq_relaxed(a) readq(a) 91#define readq_relaxed(a) readq(a)
92#define writeq_relaxed(v, a) writeq(v, a)
89 93
90#define __raw_readq(a) readq(a) 94#define __raw_readq(a) readq(a)
91#define __raw_writeq(val, addr) writeq(val, addr) 95#define __raw_writeq(val, addr) writeq(val, addr)
@@ -310,11 +314,11 @@ BUILDIO(b, b, char)
310BUILDIO(w, w, short) 314BUILDIO(w, w, short)
311BUILDIO(l, , int) 315BUILDIO(l, , int)
312 316
313extern void *xlate_dev_mem_ptr(unsigned long phys); 317extern void *xlate_dev_mem_ptr(phys_addr_t phys);
314extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr); 318extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
315 319
316extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, 320extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
317 unsigned long prot_val); 321 enum page_cache_mode pcm);
318extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size); 322extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size);
319 323
320extern bool is_early_ioremap_ptep(pte_t *ptep); 324extern bool is_early_ioremap_ptep(pte_t *ptep);
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 958b90f761e5..51b26e895933 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -34,6 +34,10 @@
34#define MCI_STATUS_S (1ULL<<56) /* Signaled machine check */ 34#define MCI_STATUS_S (1ULL<<56) /* Signaled machine check */
35#define MCI_STATUS_AR (1ULL<<55) /* Action required */ 35#define MCI_STATUS_AR (1ULL<<55) /* Action required */
36 36
37/* AMD-specific bits */
38#define MCI_STATUS_DEFERRED (1ULL<<44) /* declare an uncorrected error */
39#define MCI_STATUS_POISON (1ULL<<43) /* access poisonous data */
40
37/* 41/*
38 * Note that the full MCACOD field of IA32_MCi_STATUS MSR is 42 * Note that the full MCACOD field of IA32_MCi_STATUS MSR is
39 * bits 15:0. But bit 12 is the 'F' bit, defined for corrected 43 * bits 15:0. But bit 12 is the 'F' bit, defined for corrected
@@ -78,7 +82,6 @@
78/* Software defined banks */ 82/* Software defined banks */
79#define MCE_EXTENDED_BANK 128 83#define MCE_EXTENDED_BANK 128
80#define MCE_THERMAL_BANK (MCE_EXTENDED_BANK + 0) 84#define MCE_THERMAL_BANK (MCE_EXTENDED_BANK + 0)
81#define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1)
82 85
83#define MCE_LOG_LEN 32 86#define MCE_LOG_LEN 32
84#define MCE_LOG_SIGNATURE "MACHINECHECK" 87#define MCE_LOG_SIGNATURE "MACHINECHECK"
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index 64dc362506b7..201b520521ed 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -78,6 +78,7 @@ static inline void __exit exit_amd_microcode(void) {}
78extern void __init load_ucode_bsp(void); 78extern void __init load_ucode_bsp(void);
79extern void load_ucode_ap(void); 79extern void load_ucode_ap(void);
80extern int __init save_microcode_in_initrd(void); 80extern int __init save_microcode_in_initrd(void);
81void reload_early_microcode(void);
81#else 82#else
82static inline void __init load_ucode_bsp(void) {} 83static inline void __init load_ucode_bsp(void) {}
83static inline void load_ucode_ap(void) {} 84static inline void load_ucode_ap(void) {}
@@ -85,6 +86,7 @@ static inline int __init save_microcode_in_initrd(void)
85{ 86{
86 return 0; 87 return 0;
87} 88}
89static inline void reload_early_microcode(void) {}
88#endif 90#endif
89 91
90#endif /* _ASM_X86_MICROCODE_H */ 92#endif /* _ASM_X86_MICROCODE_H */
diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h
index b7b10b82d3e5..af935397e053 100644
--- a/arch/x86/include/asm/microcode_amd.h
+++ b/arch/x86/include/asm/microcode_amd.h
@@ -59,7 +59,7 @@ static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table,
59 59
60extern int __apply_microcode_amd(struct microcode_amd *mc_amd); 60extern int __apply_microcode_amd(struct microcode_amd *mc_amd);
61extern int apply_microcode_amd(int cpu); 61extern int apply_microcode_amd(int cpu);
62extern enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size); 62extern enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size);
63 63
64#define PATCH_MAX_SIZE PAGE_SIZE 64#define PATCH_MAX_SIZE PAGE_SIZE
65extern u8 amd_ucode_patch[PATCH_MAX_SIZE]; 65extern u8 amd_ucode_patch[PATCH_MAX_SIZE];
@@ -68,10 +68,12 @@ extern u8 amd_ucode_patch[PATCH_MAX_SIZE];
68extern void __init load_ucode_amd_bsp(void); 68extern void __init load_ucode_amd_bsp(void);
69extern void load_ucode_amd_ap(void); 69extern void load_ucode_amd_ap(void);
70extern int __init save_microcode_in_initrd_amd(void); 70extern int __init save_microcode_in_initrd_amd(void);
71void reload_ucode_amd(void);
71#else 72#else
72static inline void __init load_ucode_amd_bsp(void) {} 73static inline void __init load_ucode_amd_bsp(void) {}
73static inline void load_ucode_amd_ap(void) {} 74static inline void load_ucode_amd_ap(void) {}
74static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; } 75static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; }
76void reload_ucode_amd(void) {}
75#endif 77#endif
76 78
77#endif /* _ASM_X86_MICROCODE_AMD_H */ 79#endif /* _ASM_X86_MICROCODE_AMD_H */
diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h
index bbe296e0bce1..dd4c20043ce7 100644
--- a/arch/x86/include/asm/microcode_intel.h
+++ b/arch/x86/include/asm/microcode_intel.h
@@ -68,11 +68,13 @@ extern void __init load_ucode_intel_bsp(void);
68extern void load_ucode_intel_ap(void); 68extern void load_ucode_intel_ap(void);
69extern void show_ucode_info_early(void); 69extern void show_ucode_info_early(void);
70extern int __init save_microcode_in_initrd_intel(void); 70extern int __init save_microcode_in_initrd_intel(void);
71void reload_ucode_intel(void);
71#else 72#else
72static inline __init void load_ucode_intel_bsp(void) {} 73static inline __init void load_ucode_intel_bsp(void) {}
73static inline void load_ucode_intel_ap(void) {} 74static inline void load_ucode_intel_ap(void) {}
74static inline void show_ucode_info_early(void) {} 75static inline void show_ucode_info_early(void) {}
75static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL; } 76static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL; }
77static inline void reload_ucode_intel(void) {}
76#endif 78#endif
77 79
78#if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU) 80#if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU)
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 166af2a8e865..40269a2bf6f9 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -10,9 +10,8 @@
10#include <asm/pgalloc.h> 10#include <asm/pgalloc.h>
11#include <asm/tlbflush.h> 11#include <asm/tlbflush.h>
12#include <asm/paravirt.h> 12#include <asm/paravirt.h>
13#include <asm/mpx.h>
13#ifndef CONFIG_PARAVIRT 14#ifndef CONFIG_PARAVIRT
14#include <asm-generic/mm_hooks.h>
15
16static inline void paravirt_activate_mm(struct mm_struct *prev, 15static inline void paravirt_activate_mm(struct mm_struct *prev,
17 struct mm_struct *next) 16 struct mm_struct *next)
18{ 17{
@@ -53,7 +52,16 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
53 /* Stop flush ipis for the previous mm */ 52 /* Stop flush ipis for the previous mm */
54 cpumask_clear_cpu(cpu, mm_cpumask(prev)); 53 cpumask_clear_cpu(cpu, mm_cpumask(prev));
55 54
56 /* Load the LDT, if the LDT is different: */ 55 /*
56 * Load the LDT, if the LDT is different.
57 *
58 * It's possible leave_mm(prev) has been called. If so,
59 * then prev->context.ldt could be out of sync with the
60 * LDT descriptor or the LDT register. This can only happen
61 * if prev->context.ldt is non-null, since we never free
62 * an LDT. But LDTs can't be shared across mms, so
63 * prev->context.ldt won't be equal to next->context.ldt.
64 */
57 if (unlikely(prev->context.ldt != next->context.ldt)) 65 if (unlikely(prev->context.ldt != next->context.ldt))
58 load_LDT_nolock(&next->context); 66 load_LDT_nolock(&next->context);
59 } 67 }
@@ -102,4 +110,27 @@ do { \
102} while (0) 110} while (0)
103#endif 111#endif
104 112
113static inline void arch_dup_mmap(struct mm_struct *oldmm,
114 struct mm_struct *mm)
115{
116 paravirt_arch_dup_mmap(oldmm, mm);
117}
118
119static inline void arch_exit_mmap(struct mm_struct *mm)
120{
121 paravirt_arch_exit_mmap(mm);
122}
123
124static inline void arch_bprm_mm_init(struct mm_struct *mm,
125 struct vm_area_struct *vma)
126{
127 mpx_mm_init(mm);
128}
129
130static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
131 unsigned long start, unsigned long end)
132{
133 mpx_notify_unmap(mm, vma, start, end);
134}
135
105#endif /* _ASM_X86_MMU_CONTEXT_H */ 136#endif /* _ASM_X86_MMU_CONTEXT_H */
diff --git a/arch/x86/include/asm/mpx.h b/arch/x86/include/asm/mpx.h
new file mode 100644
index 000000000000..a952a13d59a7
--- /dev/null
+++ b/arch/x86/include/asm/mpx.h
@@ -0,0 +1,103 @@
1#ifndef _ASM_X86_MPX_H
2#define _ASM_X86_MPX_H
3
4#include <linux/types.h>
5#include <asm/ptrace.h>
6#include <asm/insn.h>
7
8/*
9 * NULL is theoretically a valid place to put the bounds
10 * directory, so point this at an invalid address.
11 */
12#define MPX_INVALID_BOUNDS_DIR ((void __user *)-1)
13#define MPX_BNDCFG_ENABLE_FLAG 0x1
14#define MPX_BD_ENTRY_VALID_FLAG 0x1
15
16#ifdef CONFIG_X86_64
17
18/* upper 28 bits [47:20] of the virtual address in 64-bit used to
19 * index into bounds directory (BD).
20 */
21#define MPX_BD_ENTRY_OFFSET 28
22#define MPX_BD_ENTRY_SHIFT 3
23/* bits [19:3] of the virtual address in 64-bit used to index into
24 * bounds table (BT).
25 */
26#define MPX_BT_ENTRY_OFFSET 17
27#define MPX_BT_ENTRY_SHIFT 5
28#define MPX_IGN_BITS 3
29#define MPX_BD_ENTRY_TAIL 3
30
31#else
32
33#define MPX_BD_ENTRY_OFFSET 20
34#define MPX_BD_ENTRY_SHIFT 2
35#define MPX_BT_ENTRY_OFFSET 10
36#define MPX_BT_ENTRY_SHIFT 4
37#define MPX_IGN_BITS 2
38#define MPX_BD_ENTRY_TAIL 2
39
40#endif
41
42#define MPX_BD_SIZE_BYTES (1UL<<(MPX_BD_ENTRY_OFFSET+MPX_BD_ENTRY_SHIFT))
43#define MPX_BT_SIZE_BYTES (1UL<<(MPX_BT_ENTRY_OFFSET+MPX_BT_ENTRY_SHIFT))
44
45#define MPX_BNDSTA_TAIL 2
46#define MPX_BNDCFG_TAIL 12
47#define MPX_BNDSTA_ADDR_MASK (~((1UL<<MPX_BNDSTA_TAIL)-1))
48#define MPX_BNDCFG_ADDR_MASK (~((1UL<<MPX_BNDCFG_TAIL)-1))
49#define MPX_BT_ADDR_MASK (~((1UL<<MPX_BD_ENTRY_TAIL)-1))
50
51#define MPX_BNDCFG_ADDR_MASK (~((1UL<<MPX_BNDCFG_TAIL)-1))
52#define MPX_BNDSTA_ERROR_CODE 0x3
53
54#define MPX_BD_ENTRY_MASK ((1<<MPX_BD_ENTRY_OFFSET)-1)
55#define MPX_BT_ENTRY_MASK ((1<<MPX_BT_ENTRY_OFFSET)-1)
56#define MPX_GET_BD_ENTRY_OFFSET(addr) ((((addr)>>(MPX_BT_ENTRY_OFFSET+ \
57 MPX_IGN_BITS)) & MPX_BD_ENTRY_MASK) << MPX_BD_ENTRY_SHIFT)
58#define MPX_GET_BT_ENTRY_OFFSET(addr) ((((addr)>>MPX_IGN_BITS) & \
59 MPX_BT_ENTRY_MASK) << MPX_BT_ENTRY_SHIFT)
60
61#ifdef CONFIG_X86_INTEL_MPX
62siginfo_t *mpx_generate_siginfo(struct pt_regs *regs,
63 struct xsave_struct *xsave_buf);
64int mpx_handle_bd_fault(struct xsave_struct *xsave_buf);
65static inline int kernel_managing_mpx_tables(struct mm_struct *mm)
66{
67 return (mm->bd_addr != MPX_INVALID_BOUNDS_DIR);
68}
69static inline void mpx_mm_init(struct mm_struct *mm)
70{
71 /*
72 * NULL is theoretically a valid place to put the bounds
73 * directory, so point this at an invalid address.
74 */
75 mm->bd_addr = MPX_INVALID_BOUNDS_DIR;
76}
77void mpx_notify_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
78 unsigned long start, unsigned long end);
79#else
80static inline siginfo_t *mpx_generate_siginfo(struct pt_regs *regs,
81 struct xsave_struct *xsave_buf)
82{
83 return NULL;
84}
85static inline int mpx_handle_bd_fault(struct xsave_struct *xsave_buf)
86{
87 return -EINVAL;
88}
89static inline int kernel_managing_mpx_tables(struct mm_struct *mm)
90{
91 return 0;
92}
93static inline void mpx_mm_init(struct mm_struct *mm)
94{
95}
96static inline void mpx_notify_unmap(struct mm_struct *mm,
97 struct vm_area_struct *vma,
98 unsigned long start, unsigned long end)
99{
100}
101#endif /* CONFIG_X86_INTEL_MPX */
102
103#endif /* _ASM_X86_MPX_H */
diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h
index f408caf73430..b3bebf9e5746 100644
--- a/arch/x86/include/asm/page_64.h
+++ b/arch/x86/include/asm/page_64.h
@@ -39,6 +39,8 @@ void copy_page(void *to, void *from);
39 39
40#endif /* !__ASSEMBLY__ */ 40#endif /* !__ASSEMBLY__ */
41 41
42#define __HAVE_ARCH_GATE_AREA 1 42#ifdef CONFIG_X86_VSYSCALL_EMULATION
43# define __HAVE_ARCH_GATE_AREA 1
44#endif
43 45
44#endif /* _ASM_X86_PAGE_64_H */ 46#endif /* _ASM_X86_PAGE_64_H */
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index cd6e1610e29e..32444ae939ca 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -330,13 +330,13 @@ static inline void paravirt_activate_mm(struct mm_struct *prev,
330 PVOP_VCALL2(pv_mmu_ops.activate_mm, prev, next); 330 PVOP_VCALL2(pv_mmu_ops.activate_mm, prev, next);
331} 331}
332 332
333static inline void arch_dup_mmap(struct mm_struct *oldmm, 333static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm,
334 struct mm_struct *mm) 334 struct mm_struct *mm)
335{ 335{
336 PVOP_VCALL2(pv_mmu_ops.dup_mmap, oldmm, mm); 336 PVOP_VCALL2(pv_mmu_ops.dup_mmap, oldmm, mm);
337} 337}
338 338
339static inline void arch_exit_mmap(struct mm_struct *mm) 339static inline void paravirt_arch_exit_mmap(struct mm_struct *mm)
340{ 340{
341 PVOP_VCALL1(pv_mmu_ops.exit_mmap, mm); 341 PVOP_VCALL1(pv_mmu_ops.exit_mmap, mm);
342} 342}
@@ -986,5 +986,15 @@ extern void default_banner(void);
986#endif /* __ASSEMBLY__ */ 986#endif /* __ASSEMBLY__ */
987#else /* CONFIG_PARAVIRT */ 987#else /* CONFIG_PARAVIRT */
988# define default_banner x86_init_noop 988# define default_banner x86_init_noop
989#ifndef __ASSEMBLY__
990static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm,
991 struct mm_struct *mm)
992{
993}
994
995static inline void paravirt_arch_exit_mmap(struct mm_struct *mm)
996{
997}
998#endif /* __ASSEMBLY__ */
989#endif /* !CONFIG_PARAVIRT */ 999#endif /* !CONFIG_PARAVIRT */
990#endif /* _ASM_X86_PARAVIRT_H */ 1000#endif /* _ASM_X86_PARAVIRT_H */
diff --git a/arch/x86/include/asm/pat.h b/arch/x86/include/asm/pat.h
index e2c1668dde7a..91bc4ba95f91 100644
--- a/arch/x86/include/asm/pat.h
+++ b/arch/x86/include/asm/pat.h
@@ -11,16 +11,17 @@ static const int pat_enabled;
11#endif 11#endif
12 12
13extern void pat_init(void); 13extern void pat_init(void);
14void pat_init_cache_modes(void);
14 15
15extern int reserve_memtype(u64 start, u64 end, 16extern int reserve_memtype(u64 start, u64 end,
16 unsigned long req_type, unsigned long *ret_type); 17 enum page_cache_mode req_pcm, enum page_cache_mode *ret_pcm);
17extern int free_memtype(u64 start, u64 end); 18extern int free_memtype(u64 start, u64 end);
18 19
19extern int kernel_map_sync_memtype(u64 base, unsigned long size, 20extern int kernel_map_sync_memtype(u64 base, unsigned long size,
20 unsigned long flag); 21 enum page_cache_mode pcm);
21 22
22int io_reserve_memtype(resource_size_t start, resource_size_t end, 23int io_reserve_memtype(resource_size_t start, resource_size_t end,
23 unsigned long *type); 24 enum page_cache_mode *pcm);
24 25
25void io_free_memtype(resource_size_t start, resource_size_t end); 26void io_free_memtype(resource_size_t start, resource_size_t end);
26 27
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index fd472181a1d0..e0ba66ca68c6 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -64,7 +64,7 @@
64#define __percpu_prefix "" 64#define __percpu_prefix ""
65#endif 65#endif
66 66
67#define __percpu_arg(x) __percpu_prefix "%P" #x 67#define __percpu_arg(x) __percpu_prefix "%" #x
68 68
69/* 69/*
70 * Initialized pointers to per-cpu variables needed for the boot 70 * Initialized pointers to per-cpu variables needed for the boot
@@ -179,29 +179,58 @@ do { \
179 } \ 179 } \
180} while (0) 180} while (0)
181 181
182#define percpu_from_op(op, var, constraint) \ 182#define percpu_from_op(op, var) \
183({ \ 183({ \
184 typeof(var) pfo_ret__; \ 184 typeof(var) pfo_ret__; \
185 switch (sizeof(var)) { \ 185 switch (sizeof(var)) { \
186 case 1: \ 186 case 1: \
187 asm(op "b "__percpu_arg(1)",%0" \ 187 asm(op "b "__percpu_arg(1)",%0" \
188 : "=q" (pfo_ret__) \ 188 : "=q" (pfo_ret__) \
189 : constraint); \ 189 : "m" (var)); \
190 break; \ 190 break; \
191 case 2: \ 191 case 2: \
192 asm(op "w "__percpu_arg(1)",%0" \ 192 asm(op "w "__percpu_arg(1)",%0" \
193 : "=r" (pfo_ret__) \ 193 : "=r" (pfo_ret__) \
194 : constraint); \ 194 : "m" (var)); \
195 break; \ 195 break; \
196 case 4: \ 196 case 4: \
197 asm(op "l "__percpu_arg(1)",%0" \ 197 asm(op "l "__percpu_arg(1)",%0" \
198 : "=r" (pfo_ret__) \ 198 : "=r" (pfo_ret__) \
199 : constraint); \ 199 : "m" (var)); \
200 break; \ 200 break; \
201 case 8: \ 201 case 8: \
202 asm(op "q "__percpu_arg(1)",%0" \ 202 asm(op "q "__percpu_arg(1)",%0" \
203 : "=r" (pfo_ret__) \ 203 : "=r" (pfo_ret__) \
204 : constraint); \ 204 : "m" (var)); \
205 break; \
206 default: __bad_percpu_size(); \
207 } \
208 pfo_ret__; \
209})
210
211#define percpu_stable_op(op, var) \
212({ \
213 typeof(var) pfo_ret__; \
214 switch (sizeof(var)) { \
215 case 1: \
216 asm(op "b "__percpu_arg(P1)",%0" \
217 : "=q" (pfo_ret__) \
218 : "p" (&(var))); \
219 break; \
220 case 2: \
221 asm(op "w "__percpu_arg(P1)",%0" \
222 : "=r" (pfo_ret__) \
223 : "p" (&(var))); \
224 break; \
225 case 4: \
226 asm(op "l "__percpu_arg(P1)",%0" \
227 : "=r" (pfo_ret__) \
228 : "p" (&(var))); \
229 break; \
230 case 8: \
231 asm(op "q "__percpu_arg(P1)",%0" \
232 : "=r" (pfo_ret__) \
233 : "p" (&(var))); \
205 break; \ 234 break; \
206 default: __bad_percpu_size(); \ 235 default: __bad_percpu_size(); \
207 } \ 236 } \
@@ -359,11 +388,11 @@ do { \
359 * per-thread variables implemented as per-cpu variables and thus 388 * per-thread variables implemented as per-cpu variables and thus
360 * stable for the duration of the respective task. 389 * stable for the duration of the respective task.
361 */ 390 */
362#define this_cpu_read_stable(var) percpu_from_op("mov", var, "p" (&(var))) 391#define this_cpu_read_stable(var) percpu_stable_op("mov", var)
363 392
364#define raw_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 393#define raw_cpu_read_1(pcp) percpu_from_op("mov", pcp)
365#define raw_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 394#define raw_cpu_read_2(pcp) percpu_from_op("mov", pcp)
366#define raw_cpu_read_4(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 395#define raw_cpu_read_4(pcp) percpu_from_op("mov", pcp)
367 396
368#define raw_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val) 397#define raw_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val)
369#define raw_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val) 398#define raw_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val)
@@ -381,9 +410,9 @@ do { \
381#define raw_cpu_xchg_2(pcp, val) percpu_xchg_op(pcp, val) 410#define raw_cpu_xchg_2(pcp, val) percpu_xchg_op(pcp, val)
382#define raw_cpu_xchg_4(pcp, val) percpu_xchg_op(pcp, val) 411#define raw_cpu_xchg_4(pcp, val) percpu_xchg_op(pcp, val)
383 412
384#define this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 413#define this_cpu_read_1(pcp) percpu_from_op("mov", pcp)
385#define this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 414#define this_cpu_read_2(pcp) percpu_from_op("mov", pcp)
386#define this_cpu_read_4(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 415#define this_cpu_read_4(pcp) percpu_from_op("mov", pcp)
387#define this_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val) 416#define this_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val)
388#define this_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val) 417#define this_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val)
389#define this_cpu_write_4(pcp, val) percpu_to_op("mov", (pcp), val) 418#define this_cpu_write_4(pcp, val) percpu_to_op("mov", (pcp), val)
@@ -435,7 +464,7 @@ do { \
435 * 32 bit must fall back to generic operations. 464 * 32 bit must fall back to generic operations.
436 */ 465 */
437#ifdef CONFIG_X86_64 466#ifdef CONFIG_X86_64
438#define raw_cpu_read_8(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 467#define raw_cpu_read_8(pcp) percpu_from_op("mov", pcp)
439#define raw_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val) 468#define raw_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val)
440#define raw_cpu_add_8(pcp, val) percpu_add_op((pcp), val) 469#define raw_cpu_add_8(pcp, val) percpu_add_op((pcp), val)
441#define raw_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) 470#define raw_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val)
@@ -444,7 +473,7 @@ do { \
444#define raw_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval) 473#define raw_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval)
445#define raw_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) 474#define raw_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
446 475
447#define this_cpu_read_8(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 476#define this_cpu_read_8(pcp) percpu_from_op("mov", pcp)
448#define this_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val) 477#define this_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val)
449#define this_cpu_add_8(pcp, val) percpu_add_op((pcp), val) 478#define this_cpu_add_8(pcp, val) percpu_add_op((pcp), val)
450#define this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) 479#define this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val)
@@ -522,7 +551,7 @@ static inline int x86_this_cpu_variable_test_bit(int nr,
522#include <asm-generic/percpu.h> 551#include <asm-generic/percpu.h>
523 552
524/* We can use this directly for local CPU (faster). */ 553/* We can use this directly for local CPU (faster). */
525DECLARE_PER_CPU(unsigned long, this_cpu_off); 554DECLARE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off);
526 555
527#endif /* !__ASSEMBLY__ */ 556#endif /* !__ASSEMBLY__ */
528 557
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 8dfc9fd094a3..dc0f6ed35b08 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -177,6 +177,9 @@ struct x86_pmu_capability {
177#define IBS_CAPS_BRNTRGT (1U<<5) 177#define IBS_CAPS_BRNTRGT (1U<<5)
178#define IBS_CAPS_OPCNTEXT (1U<<6) 178#define IBS_CAPS_OPCNTEXT (1U<<6)
179#define IBS_CAPS_RIPINVALIDCHK (1U<<7) 179#define IBS_CAPS_RIPINVALIDCHK (1U<<7)
180#define IBS_CAPS_OPBRNFUSE (1U<<8)
181#define IBS_CAPS_FETCHCTLEXTD (1U<<9)
182#define IBS_CAPS_OPDATA4 (1U<<10)
180 183
181#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \ 184#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \
182 | IBS_CAPS_FETCHSAM \ 185 | IBS_CAPS_FETCHSAM \
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index aa97a070f09f..e8a5454acc99 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -9,9 +9,10 @@
9/* 9/*
10 * Macro to mark a page protection value as UC- 10 * Macro to mark a page protection value as UC-
11 */ 11 */
12#define pgprot_noncached(prot) \ 12#define pgprot_noncached(prot) \
13 ((boot_cpu_data.x86 > 3) \ 13 ((boot_cpu_data.x86 > 3) \
14 ? (__pgprot(pgprot_val(prot) | _PAGE_CACHE_UC_MINUS)) \ 14 ? (__pgprot(pgprot_val(prot) | \
15 cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS))) \
15 : (prot)) 16 : (prot))
16 17
17#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
@@ -99,6 +100,11 @@ static inline int pte_young(pte_t pte)
99 return pte_flags(pte) & _PAGE_ACCESSED; 100 return pte_flags(pte) & _PAGE_ACCESSED;
100} 101}
101 102
103static inline int pmd_dirty(pmd_t pmd)
104{
105 return pmd_flags(pmd) & _PAGE_DIRTY;
106}
107
102static inline int pmd_young(pmd_t pmd) 108static inline int pmd_young(pmd_t pmd)
103{ 109{
104 return pmd_flags(pmd) & _PAGE_ACCESSED; 110 return pmd_flags(pmd) & _PAGE_ACCESSED;
@@ -404,8 +410,8 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
404#define canon_pgprot(p) __pgprot(massage_pgprot(p)) 410#define canon_pgprot(p) __pgprot(massage_pgprot(p))
405 411
406static inline int is_new_memtype_allowed(u64 paddr, unsigned long size, 412static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
407 unsigned long flags, 413 enum page_cache_mode pcm,
408 unsigned long new_flags) 414 enum page_cache_mode new_pcm)
409{ 415{
410 /* 416 /*
411 * PAT type is always WB for untracked ranges, so no need to check. 417 * PAT type is always WB for untracked ranges, so no need to check.
@@ -419,10 +425,10 @@ static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
419 * - request is uncached, return cannot be write-back 425 * - request is uncached, return cannot be write-back
420 * - request is write-combine, return cannot be write-back 426 * - request is write-combine, return cannot be write-back
421 */ 427 */
422 if ((flags == _PAGE_CACHE_UC_MINUS && 428 if ((pcm == _PAGE_CACHE_MODE_UC_MINUS &&
423 new_flags == _PAGE_CACHE_WB) || 429 new_pcm == _PAGE_CACHE_MODE_WB) ||
424 (flags == _PAGE_CACHE_WC && 430 (pcm == _PAGE_CACHE_MODE_WC &&
425 new_flags == _PAGE_CACHE_WB)) { 431 new_pcm == _PAGE_CACHE_MODE_WB)) {
426 return 0; 432 return 0;
427 } 433 }
428 434
diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h
index ed5903be26fe..9fb2f2bc8245 100644
--- a/arch/x86/include/asm/pgtable_32_types.h
+++ b/arch/x86/include/asm/pgtable_32_types.h
@@ -37,7 +37,7 @@ extern bool __vmalloc_start_set; /* set once high_memory is set */
37#define LAST_PKMAP 1024 37#define LAST_PKMAP 1024
38#endif 38#endif
39 39
40#define PKMAP_BASE ((FIXADDR_BOOT_START - PAGE_SIZE * (LAST_PKMAP + 1)) \ 40#define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE * (LAST_PKMAP + 1)) \
41 & PMD_MASK) 41 & PMD_MASK)
42 42
43#ifdef CONFIG_HIGHMEM 43#ifdef CONFIG_HIGHMEM
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h
index 7166e25ecb57..602b6028c5b6 100644
--- a/arch/x86/include/asm/pgtable_64_types.h
+++ b/arch/x86/include/asm/pgtable_64_types.h
@@ -63,6 +63,8 @@ typedef struct { pteval_t pte; } pte_t;
63#define MODULES_LEN (MODULES_END - MODULES_VADDR) 63#define MODULES_LEN (MODULES_END - MODULES_VADDR)
64#define ESPFIX_PGD_ENTRY _AC(-2, UL) 64#define ESPFIX_PGD_ENTRY _AC(-2, UL)
65#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT) 65#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT)
66#define EFI_VA_START ( -4 * (_AC(1, UL) << 30))
67#define EFI_VA_END (-68 * (_AC(1, UL) << 30))
66 68
67#define EARLY_DYNAMIC_PAGE_TABLES 64 69#define EARLY_DYNAMIC_PAGE_TABLES 64
68 70
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 07789647bf33..af447f95e3be 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -128,11 +128,28 @@
128 _PAGE_SOFT_DIRTY | _PAGE_NUMA) 128 _PAGE_SOFT_DIRTY | _PAGE_NUMA)
129#define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE | _PAGE_NUMA) 129#define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE | _PAGE_NUMA)
130 130
131#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT) 131/*
132#define _PAGE_CACHE_WB (0) 132 * The cache modes defined here are used to translate between pure SW usage
133#define _PAGE_CACHE_WC (_PAGE_PWT) 133 * and the HW defined cache mode bits and/or PAT entries.
134#define _PAGE_CACHE_UC_MINUS (_PAGE_PCD) 134 *
135#define _PAGE_CACHE_UC (_PAGE_PCD | _PAGE_PWT) 135 * The resulting bits for PWT, PCD and PAT should be chosen in a way
136 * to have the WB mode at index 0 (all bits clear). This is the default
137 * right now and likely would break too much if changed.
138 */
139#ifndef __ASSEMBLY__
140enum page_cache_mode {
141 _PAGE_CACHE_MODE_WB = 0,
142 _PAGE_CACHE_MODE_WC = 1,
143 _PAGE_CACHE_MODE_UC_MINUS = 2,
144 _PAGE_CACHE_MODE_UC = 3,
145 _PAGE_CACHE_MODE_WT = 4,
146 _PAGE_CACHE_MODE_WP = 5,
147 _PAGE_CACHE_MODE_NUM = 8
148};
149#endif
150
151#define _PAGE_CACHE_MASK (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)
152#define _PAGE_NOCACHE (cachemode2protval(_PAGE_CACHE_MODE_UC))
136 153
137#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) 154#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
138#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \ 155#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
@@ -156,41 +173,27 @@
156 173
157#define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW) 174#define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW)
158#define __PAGE_KERNEL_RX (__PAGE_KERNEL_EXEC & ~_PAGE_RW) 175#define __PAGE_KERNEL_RX (__PAGE_KERNEL_EXEC & ~_PAGE_RW)
159#define __PAGE_KERNEL_EXEC_NOCACHE (__PAGE_KERNEL_EXEC | _PAGE_PCD | _PAGE_PWT) 176#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_NOCACHE)
160#define __PAGE_KERNEL_WC (__PAGE_KERNEL | _PAGE_CACHE_WC)
161#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
162#define __PAGE_KERNEL_UC_MINUS (__PAGE_KERNEL | _PAGE_PCD)
163#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER) 177#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER)
164#define __PAGE_KERNEL_VVAR (__PAGE_KERNEL_RO | _PAGE_USER) 178#define __PAGE_KERNEL_VVAR (__PAGE_KERNEL_RO | _PAGE_USER)
165#define __PAGE_KERNEL_VVAR_NOCACHE (__PAGE_KERNEL_VVAR | _PAGE_PCD | _PAGE_PWT)
166#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE) 179#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
167#define __PAGE_KERNEL_LARGE_NOCACHE (__PAGE_KERNEL | _PAGE_CACHE_UC | _PAGE_PSE)
168#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE) 180#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
169 181
170#define __PAGE_KERNEL_IO (__PAGE_KERNEL) 182#define __PAGE_KERNEL_IO (__PAGE_KERNEL)
171#define __PAGE_KERNEL_IO_NOCACHE (__PAGE_KERNEL_NOCACHE) 183#define __PAGE_KERNEL_IO_NOCACHE (__PAGE_KERNEL_NOCACHE)
172#define __PAGE_KERNEL_IO_UC_MINUS (__PAGE_KERNEL_UC_MINUS)
173#define __PAGE_KERNEL_IO_WC (__PAGE_KERNEL_WC)
174 184
175#define PAGE_KERNEL __pgprot(__PAGE_KERNEL) 185#define PAGE_KERNEL __pgprot(__PAGE_KERNEL)
176#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO) 186#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
177#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) 187#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
178#define PAGE_KERNEL_RX __pgprot(__PAGE_KERNEL_RX) 188#define PAGE_KERNEL_RX __pgprot(__PAGE_KERNEL_RX)
179#define PAGE_KERNEL_WC __pgprot(__PAGE_KERNEL_WC)
180#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE) 189#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE)
181#define PAGE_KERNEL_UC_MINUS __pgprot(__PAGE_KERNEL_UC_MINUS)
182#define PAGE_KERNEL_EXEC_NOCACHE __pgprot(__PAGE_KERNEL_EXEC_NOCACHE)
183#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE) 190#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE)
184#define PAGE_KERNEL_LARGE_NOCACHE __pgprot(__PAGE_KERNEL_LARGE_NOCACHE)
185#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC) 191#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC)
186#define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL) 192#define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL)
187#define PAGE_KERNEL_VVAR __pgprot(__PAGE_KERNEL_VVAR) 193#define PAGE_KERNEL_VVAR __pgprot(__PAGE_KERNEL_VVAR)
188#define PAGE_KERNEL_VVAR_NOCACHE __pgprot(__PAGE_KERNEL_VVAR_NOCACHE)
189 194
190#define PAGE_KERNEL_IO __pgprot(__PAGE_KERNEL_IO) 195#define PAGE_KERNEL_IO __pgprot(__PAGE_KERNEL_IO)
191#define PAGE_KERNEL_IO_NOCACHE __pgprot(__PAGE_KERNEL_IO_NOCACHE) 196#define PAGE_KERNEL_IO_NOCACHE __pgprot(__PAGE_KERNEL_IO_NOCACHE)
192#define PAGE_KERNEL_IO_UC_MINUS __pgprot(__PAGE_KERNEL_IO_UC_MINUS)
193#define PAGE_KERNEL_IO_WC __pgprot(__PAGE_KERNEL_IO_WC)
194 197
195/* xwr */ 198/* xwr */
196#define __P000 PAGE_NONE 199#define __P000 PAGE_NONE
@@ -341,6 +344,59 @@ static inline pmdval_t pmdnuma_flags(pmd_t pmd)
341#define pgprot_val(x) ((x).pgprot) 344#define pgprot_val(x) ((x).pgprot)
342#define __pgprot(x) ((pgprot_t) { (x) } ) 345#define __pgprot(x) ((pgprot_t) { (x) } )
343 346
347extern uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM];
348extern uint8_t __pte2cachemode_tbl[8];
349
350#define __pte2cm_idx(cb) \
351 ((((cb) >> (_PAGE_BIT_PAT - 2)) & 4) | \
352 (((cb) >> (_PAGE_BIT_PCD - 1)) & 2) | \
353 (((cb) >> _PAGE_BIT_PWT) & 1))
354#define __cm_idx2pte(i) \
355 ((((i) & 4) << (_PAGE_BIT_PAT - 2)) | \
356 (((i) & 2) << (_PAGE_BIT_PCD - 1)) | \
357 (((i) & 1) << _PAGE_BIT_PWT))
358
359static inline unsigned long cachemode2protval(enum page_cache_mode pcm)
360{
361 if (likely(pcm == 0))
362 return 0;
363 return __cachemode2pte_tbl[pcm];
364}
365static inline pgprot_t cachemode2pgprot(enum page_cache_mode pcm)
366{
367 return __pgprot(cachemode2protval(pcm));
368}
369static inline enum page_cache_mode pgprot2cachemode(pgprot_t pgprot)
370{
371 unsigned long masked;
372
373 masked = pgprot_val(pgprot) & _PAGE_CACHE_MASK;
374 if (likely(masked == 0))
375 return 0;
376 return __pte2cachemode_tbl[__pte2cm_idx(masked)];
377}
378static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot)
379{
380 pgprot_t new;
381 unsigned long val;
382
383 val = pgprot_val(pgprot);
384 pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) |
385 ((val & _PAGE_PAT) << (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));
386 return new;
387}
388static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot)
389{
390 pgprot_t new;
391 unsigned long val;
392
393 val = pgprot_val(pgprot);
394 pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) |
395 ((val & _PAGE_PAT_LARGE) >>
396 (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT));
397 return new;
398}
399
344 400
345typedef struct page *pgtable_t; 401typedef struct page *pgtable_t;
346 402
diff --git a/arch/x86/include/asm/platform_sst_audio.h b/arch/x86/include/asm/platform_sst_audio.h
index 0a4e140315b6..7249e6d0902d 100644
--- a/arch/x86/include/asm/platform_sst_audio.h
+++ b/arch/x86/include/asm/platform_sst_audio.h
@@ -16,6 +16,9 @@
16 16
17#include <linux/sfi.h> 17#include <linux/sfi.h>
18 18
19#define MAX_NUM_STREAMS_MRFLD 25
20#define MAX_NUM_STREAMS MAX_NUM_STREAMS_MRFLD
21
19enum sst_audio_task_id_mrfld { 22enum sst_audio_task_id_mrfld {
20 SST_TASK_ID_NONE = 0, 23 SST_TASK_ID_NONE = 0,
21 SST_TASK_ID_SBA = 1, 24 SST_TASK_ID_SBA = 1,
@@ -73,6 +76,65 @@ struct sst_platform_data {
73 unsigned int strm_map_size; 76 unsigned int strm_map_size;
74}; 77};
75 78
79struct sst_info {
80 u32 iram_start;
81 u32 iram_end;
82 bool iram_use;
83 u32 dram_start;
84 u32 dram_end;
85 bool dram_use;
86 u32 imr_start;
87 u32 imr_end;
88 bool imr_use;
89 u32 mailbox_start;
90 bool use_elf;
91 bool lpe_viewpt_rqd;
92 unsigned int max_streams;
93 u32 dma_max_len;
94 u8 num_probes;
95};
96
97struct sst_lib_dnld_info {
98 unsigned int mod_base;
99 unsigned int mod_end;
100 unsigned int mod_table_offset;
101 unsigned int mod_table_size;
102 bool mod_ddr_dnld;
103};
104
105struct sst_res_info {
106 unsigned int shim_offset;
107 unsigned int shim_size;
108 unsigned int shim_phy_addr;
109 unsigned int ssp0_offset;
110 unsigned int ssp0_size;
111 unsigned int dma0_offset;
112 unsigned int dma0_size;
113 unsigned int dma1_offset;
114 unsigned int dma1_size;
115 unsigned int iram_offset;
116 unsigned int iram_size;
117 unsigned int dram_offset;
118 unsigned int dram_size;
119 unsigned int mbox_offset;
120 unsigned int mbox_size;
121 unsigned int acpi_lpe_res_index;
122 unsigned int acpi_ddr_index;
123 unsigned int acpi_ipc_irq_index;
124};
125
126struct sst_ipc_info {
127 int ipc_offset;
128 unsigned int mbox_recv_off;
129};
130
131struct sst_platform_info {
132 const struct sst_info *probe_data;
133 const struct sst_ipc_info *ipc_info;
134 const struct sst_res_info *res_info;
135 const struct sst_lib_dnld_info *lib_info;
136 const char *platform;
137};
76int add_sst_platform_device(void); 138int add_sst_platform_device(void);
77#endif 139#endif
78 140
diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h
index 400873450e33..8f3271842533 100644
--- a/arch/x86/include/asm/preempt.h
+++ b/arch/x86/include/asm/preempt.h
@@ -30,9 +30,6 @@ static __always_inline void preempt_count_set(int pc)
30/* 30/*
31 * must be macros to avoid header recursion hell 31 * must be macros to avoid header recursion hell
32 */ 32 */
33#define task_preempt_count(p) \
34 (task_thread_info(p)->saved_preempt_count & ~PREEMPT_NEED_RESCHED)
35
36#define init_task_preempt_count(p) do { \ 33#define init_task_preempt_count(p) do { \
37 task_thread_info(p)->saved_preempt_count = PREEMPT_DISABLED; \ 34 task_thread_info(p)->saved_preempt_count = PREEMPT_DISABLED; \
38} while (0) 35} while (0)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index eb71ec794732..a092a0cce0b7 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -127,7 +127,7 @@ struct cpuinfo_x86 {
127 /* Index into per_cpu list: */ 127 /* Index into per_cpu list: */
128 u16 cpu_index; 128 u16 cpu_index;
129 u32 microcode; 129 u32 microcode;
130} __attribute__((__aligned__(SMP_CACHE_BYTES))); 130};
131 131
132#define X86_VENDOR_INTEL 0 132#define X86_VENDOR_INTEL 0
133#define X86_VENDOR_CYRIX 1 133#define X86_VENDOR_CYRIX 1
@@ -151,7 +151,7 @@ extern __u32 cpu_caps_cleared[NCAPINTS];
151extern __u32 cpu_caps_set[NCAPINTS]; 151extern __u32 cpu_caps_set[NCAPINTS];
152 152
153#ifdef CONFIG_SMP 153#ifdef CONFIG_SMP
154DECLARE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); 154DECLARE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
155#define cpu_data(cpu) per_cpu(cpu_info, cpu) 155#define cpu_data(cpu) per_cpu(cpu_info, cpu)
156#else 156#else
157#define cpu_info boot_cpu_data 157#define cpu_info boot_cpu_data
@@ -374,13 +374,14 @@ struct lwp_struct {
374 u8 reserved[128]; 374 u8 reserved[128];
375}; 375};
376 376
377struct bndregs_struct { 377struct bndreg {
378 u64 bndregs[8]; 378 u64 lower_bound;
379 u64 upper_bound;
379} __packed; 380} __packed;
380 381
381struct bndcsr_struct { 382struct bndcsr {
382 u64 cfg_reg_u; 383 u64 bndcfgu;
383 u64 status_reg; 384 u64 bndstatus;
384} __packed; 385} __packed;
385 386
386struct xsave_hdr_struct { 387struct xsave_hdr_struct {
@@ -394,8 +395,8 @@ struct xsave_struct {
394 struct xsave_hdr_struct xsave_hdr; 395 struct xsave_hdr_struct xsave_hdr;
395 struct ymmh_struct ymmh; 396 struct ymmh_struct ymmh;
396 struct lwp_struct lwp; 397 struct lwp_struct lwp;
397 struct bndregs_struct bndregs; 398 struct bndreg bndreg[4];
398 struct bndcsr_struct bndcsr; 399 struct bndcsr bndcsr;
399 /* new processor state extensions will go here */ 400 /* new processor state extensions will go here */
400} __attribute__ ((packed, aligned (64))); 401} __attribute__ ((packed, aligned (64)));
401 402
@@ -893,7 +894,13 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
893 894
894#else 895#else
895/* 896/*
896 * User space process size. 47bits minus one guard page. 897 * User space process size. 47bits minus one guard page. The guard
898 * page is necessary on Intel CPUs: if a SYSCALL instruction is at
899 * the highest possible canonical userspace address, then that
900 * syscall will enter the kernel with a non-canonical return
901 * address, and SYSRET will explode dangerously. We avoid this
902 * particular problem by preventing anything from being mapped
903 * at the maximum canonical address.
897 */ 904 */
898#define TASK_SIZE_MAX ((1UL << 47) - PAGE_SIZE) 905#define TASK_SIZE_MAX ((1UL << 47) - PAGE_SIZE)
899 906
@@ -953,6 +960,24 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
953extern int get_tsc_mode(unsigned long adr); 960extern int get_tsc_mode(unsigned long adr);
954extern int set_tsc_mode(unsigned int val); 961extern int set_tsc_mode(unsigned int val);
955 962
963/* Register/unregister a process' MPX related resource */
964#define MPX_ENABLE_MANAGEMENT(tsk) mpx_enable_management((tsk))
965#define MPX_DISABLE_MANAGEMENT(tsk) mpx_disable_management((tsk))
966
967#ifdef CONFIG_X86_INTEL_MPX
968extern int mpx_enable_management(struct task_struct *tsk);
969extern int mpx_disable_management(struct task_struct *tsk);
970#else
971static inline int mpx_enable_management(struct task_struct *tsk)
972{
973 return -EINVAL;
974}
975static inline int mpx_disable_management(struct task_struct *tsk)
976{
977 return -EINVAL;
978}
979#endif /* CONFIG_X86_INTEL_MPX */
980
956extern u16 amd_get_nb_id(int cpu); 981extern u16 amd_get_nb_id(int cpu);
957 982
958static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t leaves) 983static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t leaves)
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index 9295016485c9..a4efe477ceab 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -183,8 +183,20 @@ static __always_inline void arch_spin_lock_flags(arch_spinlock_t *lock,
183 183
184static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) 184static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
185{ 185{
186 while (arch_spin_is_locked(lock)) 186 __ticket_t head = ACCESS_ONCE(lock->tickets.head);
187
188 for (;;) {
189 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
190 /*
191 * We need to check "unlocked" in a loop, tmp.head == head
192 * can be false positive because of overflow.
193 */
194 if (tmp.head == (tmp.tail & ~TICKET_SLOWPATH_FLAG) ||
195 tmp.head != head)
196 break;
197
187 cpu_relax(); 198 cpu_relax();
199 }
188} 200}
189 201
190/* 202/*
diff --git a/arch/x86/include/asm/switch_to.h b/arch/x86/include/asm/switch_to.h
index d7f3b3b78ac3..751bf4b7bf11 100644
--- a/arch/x86/include/asm/switch_to.h
+++ b/arch/x86/include/asm/switch_to.h
@@ -79,12 +79,12 @@ do { \
79#else /* CONFIG_X86_32 */ 79#else /* CONFIG_X86_32 */
80 80
81/* frame pointer must be last for get_wchan */ 81/* frame pointer must be last for get_wchan */
82#define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" 82#define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t"
83#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t" 83#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\t"
84 84
85#define __EXTRA_CLOBBER \ 85#define __EXTRA_CLOBBER \
86 , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \ 86 , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \
87 "r12", "r13", "r14", "r15" 87 "r12", "r13", "r14", "r15", "flags"
88 88
89#ifdef CONFIG_CC_STACKPROTECTOR 89#ifdef CONFIG_CC_STACKPROTECTOR
90#define __switch_canary \ 90#define __switch_canary \
@@ -100,7 +100,11 @@ do { \
100#define __switch_canary_iparam 100#define __switch_canary_iparam
101#endif /* CC_STACKPROTECTOR */ 101#endif /* CC_STACKPROTECTOR */
102 102
103/* Save restore flags to clear handle leaking NT */ 103/*
104 * There is no need to save or restore flags, because flags are always
105 * clean in kernel mode, with the possible exception of IOPL. Kernel IOPL
106 * has no effect.
107 */
104#define switch_to(prev, next, last) \ 108#define switch_to(prev, next, last) \
105 asm volatile(SAVE_CONTEXT \ 109 asm volatile(SAVE_CONTEXT \
106 "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ 110 "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
index 2d60a7813dfe..fc808b83fccb 100644
--- a/arch/x86/include/asm/uv/uv_bau.h
+++ b/arch/x86/include/asm/uv/uv_bau.h
@@ -33,8 +33,8 @@
33 * Each of the descriptors is 64 bytes in size (8*64 = 512 bytes in a set). 33 * Each of the descriptors is 64 bytes in size (8*64 = 512 bytes in a set).
34 */ 34 */
35 35
36#define MAX_CPUS_PER_UVHUB 64 36#define MAX_CPUS_PER_UVHUB 128
37#define MAX_CPUS_PER_SOCKET 32 37#define MAX_CPUS_PER_SOCKET 64
38#define ADP_SZ 64 /* hardware-provided max. */ 38#define ADP_SZ 64 /* hardware-provided max. */
39#define UV_CPUS_PER_AS 32 /* hardware-provided max. */ 39#define UV_CPUS_PER_AS 32 /* hardware-provided max. */
40#define ITEMS_PER_DESC 8 40#define ITEMS_PER_DESC 8
diff --git a/arch/x86/include/asm/vgtod.h b/arch/x86/include/asm/vgtod.h
index 3c3366c2e37f..e7e9682a33e9 100644
--- a/arch/x86/include/asm/vgtod.h
+++ b/arch/x86/include/asm/vgtod.h
@@ -70,4 +70,23 @@ static inline void gtod_write_end(struct vsyscall_gtod_data *s)
70 ++s->seq; 70 ++s->seq;
71} 71}
72 72
73#ifdef CONFIG_X86_64
74
75#define VGETCPU_CPU_MASK 0xfff
76
77static inline unsigned int __getcpu(void)
78{
79 unsigned int p;
80
81 /*
82 * Load per CPU data from GDT. LSL is faster than RDTSCP and
83 * works on all CPUs.
84 */
85 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
86
87 return p;
88}
89
90#endif /* CONFIG_X86_64 */
91
73#endif /* _ASM_X86_VGTOD_H */ 92#endif /* _ASM_X86_VGTOD_H */
diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h
index 2a46ca720afc..6ba66ee79710 100644
--- a/arch/x86/include/asm/vsyscall.h
+++ b/arch/x86/include/asm/vsyscall.h
@@ -4,15 +4,7 @@
4#include <linux/seqlock.h> 4#include <linux/seqlock.h>
5#include <uapi/asm/vsyscall.h> 5#include <uapi/asm/vsyscall.h>
6 6
7#define VGETCPU_RDTSCP 1 7#ifdef CONFIG_X86_VSYSCALL_EMULATION
8#define VGETCPU_LSL 2
9
10/* kernel space (writeable) */
11extern int vgetcpu_mode;
12extern struct timezone sys_tz;
13
14#include <asm/vvar.h>
15
16extern void map_vsyscall(void); 8extern void map_vsyscall(void);
17 9
18/* 10/*
@@ -20,25 +12,12 @@ extern void map_vsyscall(void);
20 * Returns true if handled. 12 * Returns true if handled.
21 */ 13 */
22extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address); 14extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
23 15#else
24#ifdef CONFIG_X86_64 16static inline void map_vsyscall(void) {}
25 17static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
26#define VGETCPU_CPU_MASK 0xfff
27
28static inline unsigned int __getcpu(void)
29{ 18{
30 unsigned int p; 19 return false;
31
32 if (VVAR(vgetcpu_mode) == VGETCPU_RDTSCP) {
33 /* Load per CPU data from RDTSCP */
34 native_read_tscp(&p);
35 } else {
36 /* Load per CPU data from GDT */
37 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
38 }
39
40 return p;
41} 20}
42#endif /* CONFIG_X86_64 */ 21#endif
43 22
44#endif /* _ASM_X86_VSYSCALL_H */ 23#endif /* _ASM_X86_VSYSCALL_H */
diff --git a/arch/x86/include/asm/vvar.h b/arch/x86/include/asm/vvar.h
index 5d2b9ad2c6d2..3f32dfc2ab73 100644
--- a/arch/x86/include/asm/vvar.h
+++ b/arch/x86/include/asm/vvar.h
@@ -44,8 +44,6 @@ extern char __vvar_page;
44 44
45/* DECLARE_VVAR(offset, type, name) */ 45/* DECLARE_VVAR(offset, type, name) */
46 46
47DECLARE_VVAR(0, volatile unsigned long, jiffies)
48DECLARE_VVAR(16, int, vgetcpu_mode)
49DECLARE_VVAR(128, struct vsyscall_gtod_data, vsyscall_gtod_data) 47DECLARE_VVAR(128, struct vsyscall_gtod_data, vsyscall_gtod_data)
50 48
51#undef DECLARE_VVAR 49#undef DECLARE_VVAR
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index e45e4da96bf1..f58a9c7a3c86 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -172,7 +172,6 @@ struct x86_platform_ops {
172 172
173struct pci_dev; 173struct pci_dev;
174struct msi_msg; 174struct msi_msg;
175struct msi_desc;
176 175
177struct x86_msi_ops { 176struct x86_msi_ops {
178 int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type); 177 int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type);
@@ -183,8 +182,6 @@ struct x86_msi_ops {
183 void (*teardown_msi_irqs)(struct pci_dev *dev); 182 void (*teardown_msi_irqs)(struct pci_dev *dev);
184 void (*restore_msi_irqs)(struct pci_dev *dev); 183 void (*restore_msi_irqs)(struct pci_dev *dev);
185 int (*setup_hpet_msi)(unsigned int irq, unsigned int id); 184 int (*setup_hpet_msi)(unsigned int irq, unsigned int id);
186 u32 (*msi_mask_irq)(struct msi_desc *desc, u32 mask, u32 flag);
187 u32 (*msix_mask_irq)(struct msi_desc *desc, u32 flag);
188}; 185};
189 186
190struct IO_APIC_route_entry; 187struct IO_APIC_route_entry;
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index e21331ce368f..c8aa65d56027 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -152,6 +152,45 @@
152#define MSR_CC6_DEMOTION_POLICY_CONFIG 0x00000668 152#define MSR_CC6_DEMOTION_POLICY_CONFIG 0x00000668
153#define MSR_MC6_DEMOTION_POLICY_CONFIG 0x00000669 153#define MSR_MC6_DEMOTION_POLICY_CONFIG 0x00000669
154 154
155/* Hardware P state interface */
156#define MSR_PPERF 0x0000064e
157#define MSR_PERF_LIMIT_REASONS 0x0000064f
158#define MSR_PM_ENABLE 0x00000770
159#define MSR_HWP_CAPABILITIES 0x00000771
160#define MSR_HWP_REQUEST_PKG 0x00000772
161#define MSR_HWP_INTERRUPT 0x00000773
162#define MSR_HWP_REQUEST 0x00000774
163#define MSR_HWP_STATUS 0x00000777
164
165/* CPUID.6.EAX */
166#define HWP_BASE_BIT (1<<7)
167#define HWP_NOTIFICATIONS_BIT (1<<8)
168#define HWP_ACTIVITY_WINDOW_BIT (1<<9)
169#define HWP_ENERGY_PERF_PREFERENCE_BIT (1<<10)
170#define HWP_PACKAGE_LEVEL_REQUEST_BIT (1<<11)
171
172/* IA32_HWP_CAPABILITIES */
173#define HWP_HIGHEST_PERF(x) (x & 0xff)
174#define HWP_GUARANTEED_PERF(x) ((x & (0xff << 8)) >>8)
175#define HWP_MOSTEFFICIENT_PERF(x) ((x & (0xff << 16)) >>16)
176#define HWP_LOWEST_PERF(x) ((x & (0xff << 24)) >>24)
177
178/* IA32_HWP_REQUEST */
179#define HWP_MIN_PERF(x) (x & 0xff)
180#define HWP_MAX_PERF(x) ((x & 0xff) << 8)
181#define HWP_DESIRED_PERF(x) ((x & 0xff) << 16)
182#define HWP_ENERGY_PERF_PREFERENCE(x) ((x & 0xff) << 24)
183#define HWP_ACTIVITY_WINDOW(x) ((x & 0xff3) << 32)
184#define HWP_PACKAGE_CONTROL(x) ((x & 0x1) << 42)
185
186/* IA32_HWP_STATUS */
187#define HWP_GUARANTEED_CHANGE(x) (x & 0x1)
188#define HWP_EXCURSION_TO_MINIMUM(x) (x & 0x4)
189
190/* IA32_HWP_INTERRUPT */
191#define HWP_CHANGE_TO_GUARANTEED_INT(x) (x & 0x1)
192#define HWP_EXCURSION_TO_MINIMUM_INT(x) (x & 0x2)
193
155#define MSR_AMD64_MC0_MASK 0xc0010044 194#define MSR_AMD64_MC0_MASK 0xc0010044
156 195
157#define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x)) 196#define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x))
@@ -206,6 +245,7 @@
206#define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1) 245#define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)
207#define MSR_AMD64_IBSCTL 0xc001103a 246#define MSR_AMD64_IBSCTL 0xc001103a
208#define MSR_AMD64_IBSBRTARGET 0xc001103b 247#define MSR_AMD64_IBSBRTARGET 0xc001103b
248#define MSR_AMD64_IBSOPDATA4 0xc001103d
209#define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */ 249#define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
210 250
211/* Fam 16h MSRs */ 251/* Fam 16h MSRs */
@@ -345,6 +385,8 @@
345 385
346#define MSR_IA32_TEMPERATURE_TARGET 0x000001a2 386#define MSR_IA32_TEMPERATURE_TARGET 0x000001a2
347 387
388#define MSR_MISC_PWR_MGMT 0x000001aa
389
348#define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0 390#define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0
349#define ENERGY_PERF_BIAS_PERFORMANCE 0 391#define ENERGY_PERF_BIAS_PERFORMANCE 0
350#define ENERGY_PERF_BIAS_NORMAL 6 392#define ENERGY_PERF_BIAS_NORMAL 6
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 8f1e77440b2b..5d4502c8b983 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -28,8 +28,7 @@ obj-$(CONFIG_X86_32) += i386_ksyms_32.o
28obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o 28obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o
29obj-$(CONFIG_X86_64) += mcount_64.o 29obj-$(CONFIG_X86_64) += mcount_64.o
30obj-y += syscall_$(BITS).o vsyscall_gtod.o 30obj-y += syscall_$(BITS).o vsyscall_gtod.o
31obj-$(CONFIG_X86_64) += vsyscall_64.o 31obj-$(CONFIG_X86_VSYSCALL_EMULATION) += vsyscall_64.o vsyscall_emu_64.o
32obj-$(CONFIG_X86_64) += vsyscall_emu_64.o
33obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o 32obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o
34obj-$(CONFIG_SYSFS) += ksysfs.o 33obj-$(CONFIG_SYSFS) += ksysfs.o
35obj-y += bootflag.o e820.o 34obj-y += bootflag.o e820.o
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index f04dbb3069b8..5caed1dd7ccf 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -21,6 +21,7 @@ const struct pci_device_id amd_nb_misc_ids[] = {
21 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, 21 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) },
22 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, 22 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) },
23 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) }, 23 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) },
24 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M60H_NB_F3) },
24 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, 25 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) },
25 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, 26 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) },
26 {} 27 {}
@@ -30,6 +31,7 @@ EXPORT_SYMBOL(amd_nb_misc_ids);
30static const struct pci_device_id amd_nb_link_ids[] = { 31static const struct pci_device_id amd_nb_link_ids[] = {
31 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, 32 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
32 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, 33 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) },
34 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M60H_NB_F4) },
33 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, 35 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) },
34 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, 36 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) },
35 {} 37 {}
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index 4128b5fcb559..c2fd21fed002 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -40,7 +40,7 @@ static unsigned int get_apic_id(unsigned long x)
40 unsigned int id; 40 unsigned int id;
41 41
42 rdmsrl(MSR_FAM10H_NODE_ID, value); 42 rdmsrl(MSR_FAM10H_NODE_ID, value);
43 id = ((x >> 24) & 0xffU) | ((value << 2) & 0x3f00U); 43 id = ((x >> 24) & 0xffU) | ((value << 2) & 0xff00U);
44 44
45 return id; 45 return id;
46} 46}
@@ -145,7 +145,7 @@ static void numachip_send_IPI_all(int vector)
145 145
146static void numachip_send_IPI_self(int vector) 146static void numachip_send_IPI_self(int vector)
147{ 147{
148 __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); 148 apic_write(APIC_SELF_IPI, vector);
149} 149}
150 150
151static int __init numachip_probe(void) 151static int __init numachip_probe(void)
@@ -153,20 +153,8 @@ static int __init numachip_probe(void)
153 return apic == &apic_numachip; 153 return apic == &apic_numachip;
154} 154}
155 155
156static void __init map_csrs(void)
157{
158 printk(KERN_INFO "NumaChip: Mapping local CSR space (%016llx - %016llx)\n",
159 NUMACHIP_LCSR_BASE, NUMACHIP_LCSR_BASE + NUMACHIP_LCSR_SIZE - 1);
160 init_extra_mapping_uc(NUMACHIP_LCSR_BASE, NUMACHIP_LCSR_SIZE);
161
162 printk(KERN_INFO "NumaChip: Mapping global CSR space (%016llx - %016llx)\n",
163 NUMACHIP_GCSR_BASE, NUMACHIP_GCSR_BASE + NUMACHIP_GCSR_SIZE - 1);
164 init_extra_mapping_uc(NUMACHIP_GCSR_BASE, NUMACHIP_GCSR_SIZE);
165}
166
167static void fixup_cpu_id(struct cpuinfo_x86 *c, int node) 156static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)
168{ 157{
169
170 if (c->phys_proc_id != node) { 158 if (c->phys_proc_id != node) {
171 c->phys_proc_id = node; 159 c->phys_proc_id = node;
172 per_cpu(cpu_llc_id, smp_processor_id()) = node; 160 per_cpu(cpu_llc_id, smp_processor_id()) = node;
@@ -175,19 +163,15 @@ static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)
175 163
176static int __init numachip_system_init(void) 164static int __init numachip_system_init(void)
177{ 165{
178 unsigned int val;
179
180 if (!numachip_system) 166 if (!numachip_system)
181 return 0; 167 return 0;
182 168
169 init_extra_mapping_uc(NUMACHIP_LCSR_BASE, NUMACHIP_LCSR_SIZE);
170 init_extra_mapping_uc(NUMACHIP_GCSR_BASE, NUMACHIP_GCSR_SIZE);
171
183 x86_cpuinit.fixup_cpu_id = fixup_cpu_id; 172 x86_cpuinit.fixup_cpu_id = fixup_cpu_id;
184 x86_init.pci.arch_init = pci_numachip_init; 173 x86_init.pci.arch_init = pci_numachip_init;
185 174
186 map_csrs();
187
188 val = read_lcsr(CSR_G0_NODE_IDS);
189 printk(KERN_INFO "NumaChip: Local NodeID = %08x\n", val);
190
191 return 0; 175 return 0;
192} 176}
193early_initcall(numachip_system_init); 177early_initcall(numachip_system_init);
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index 6a1e71bde323..6873ab925d00 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -18,6 +18,7 @@
18#include <linux/nmi.h> 18#include <linux/nmi.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/seq_buf.h>
21 22
22#ifdef CONFIG_HARDLOCKUP_DETECTOR 23#ifdef CONFIG_HARDLOCKUP_DETECTOR
23u64 hw_nmi_get_sample_period(int watchdog_thresh) 24u64 hw_nmi_get_sample_period(int watchdog_thresh)
@@ -29,14 +30,35 @@ u64 hw_nmi_get_sample_period(int watchdog_thresh)
29#ifdef arch_trigger_all_cpu_backtrace 30#ifdef arch_trigger_all_cpu_backtrace
30/* For reliability, we're prepared to waste bits here. */ 31/* For reliability, we're prepared to waste bits here. */
31static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly; 32static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
33static cpumask_t printtrace_mask;
34
35#define NMI_BUF_SIZE 4096
36
37struct nmi_seq_buf {
38 unsigned char buffer[NMI_BUF_SIZE];
39 struct seq_buf seq;
40};
41
42/* Safe printing in NMI context */
43static DEFINE_PER_CPU(struct nmi_seq_buf, nmi_print_seq);
32 44
33/* "in progress" flag of arch_trigger_all_cpu_backtrace */ 45/* "in progress" flag of arch_trigger_all_cpu_backtrace */
34static unsigned long backtrace_flag; 46static unsigned long backtrace_flag;
35 47
48static void print_seq_line(struct nmi_seq_buf *s, int start, int end)
49{
50 const char *buf = s->buffer + start;
51
52 printk("%.*s", (end - start) + 1, buf);
53}
54
36void arch_trigger_all_cpu_backtrace(bool include_self) 55void arch_trigger_all_cpu_backtrace(bool include_self)
37{ 56{
57 struct nmi_seq_buf *s;
58 int len;
59 int cpu;
38 int i; 60 int i;
39 int cpu = get_cpu(); 61 int this_cpu = get_cpu();
40 62
41 if (test_and_set_bit(0, &backtrace_flag)) { 63 if (test_and_set_bit(0, &backtrace_flag)) {
42 /* 64 /*
@@ -49,7 +71,17 @@ void arch_trigger_all_cpu_backtrace(bool include_self)
49 71
50 cpumask_copy(to_cpumask(backtrace_mask), cpu_online_mask); 72 cpumask_copy(to_cpumask(backtrace_mask), cpu_online_mask);
51 if (!include_self) 73 if (!include_self)
52 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask)); 74 cpumask_clear_cpu(this_cpu, to_cpumask(backtrace_mask));
75
76 cpumask_copy(&printtrace_mask, to_cpumask(backtrace_mask));
77 /*
78 * Set up per_cpu seq_buf buffers that the NMIs running on the other
79 * CPUs will write to.
80 */
81 for_each_cpu(cpu, to_cpumask(backtrace_mask)) {
82 s = &per_cpu(nmi_print_seq, cpu);
83 seq_buf_init(&s->seq, s->buffer, NMI_BUF_SIZE);
84 }
53 85
54 if (!cpumask_empty(to_cpumask(backtrace_mask))) { 86 if (!cpumask_empty(to_cpumask(backtrace_mask))) {
55 pr_info("sending NMI to %s CPUs:\n", 87 pr_info("sending NMI to %s CPUs:\n",
@@ -65,11 +97,58 @@ void arch_trigger_all_cpu_backtrace(bool include_self)
65 touch_softlockup_watchdog(); 97 touch_softlockup_watchdog();
66 } 98 }
67 99
100 /*
101 * Now that all the NMIs have triggered, we can dump out their
102 * back traces safely to the console.
103 */
104 for_each_cpu(cpu, &printtrace_mask) {
105 int last_i = 0;
106
107 s = &per_cpu(nmi_print_seq, cpu);
108 len = seq_buf_used(&s->seq);
109 if (!len)
110 continue;
111
112 /* Print line by line. */
113 for (i = 0; i < len; i++) {
114 if (s->buffer[i] == '\n') {
115 print_seq_line(s, last_i, i);
116 last_i = i + 1;
117 }
118 }
119 /* Check if there was a partial line. */
120 if (last_i < len) {
121 print_seq_line(s, last_i, len - 1);
122 pr_cont("\n");
123 }
124 }
125
68 clear_bit(0, &backtrace_flag); 126 clear_bit(0, &backtrace_flag);
69 smp_mb__after_atomic(); 127 smp_mb__after_atomic();
70 put_cpu(); 128 put_cpu();
71} 129}
72 130
131/*
132 * It is not safe to call printk() directly from NMI handlers.
133 * It may be fine if the NMI detected a lock up and we have no choice
134 * but to do so, but doing a NMI on all other CPUs to get a back trace
135 * can be done with a sysrq-l. We don't want that to lock up, which
136 * can happen if the NMI interrupts a printk in progress.
137 *
138 * Instead, we redirect the vprintk() to this nmi_vprintk() that writes
139 * the content into a per cpu seq_buf buffer. Then when the NMIs are
140 * all done, we can safely dump the contents of the seq_buf to a printk()
141 * from a non NMI context.
142 */
143static int nmi_vprintk(const char *fmt, va_list args)
144{
145 struct nmi_seq_buf *s = this_cpu_ptr(&nmi_print_seq);
146 unsigned int len = seq_buf_used(&s->seq);
147
148 seq_buf_vprintf(&s->seq, fmt, args);
149 return seq_buf_used(&s->seq) - len;
150}
151
73static int 152static int
74arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs) 153arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
75{ 154{
@@ -78,12 +157,14 @@ arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
78 cpu = smp_processor_id(); 157 cpu = smp_processor_id();
79 158
80 if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) { 159 if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
81 static arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED; 160 printk_func_t printk_func_save = this_cpu_read(printk_func);
82 161
83 arch_spin_lock(&lock); 162 /* Replace printk to write into the NMI seq */
163 this_cpu_write(printk_func, nmi_vprintk);
84 printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu); 164 printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu);
85 show_regs(regs); 165 show_regs(regs);
86 arch_spin_unlock(&lock); 166 this_cpu_write(printk_func, printk_func_save);
167
87 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask)); 168 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
88 return NMI_HANDLED; 169 return NMI_HANDLED;
89 } 170 }
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 1183d545da1e..7ffe0a2b870f 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3158,7 +3158,7 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)
3158 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; 3158 msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
3159 msg.address_lo |= MSI_ADDR_DEST_ID(dest); 3159 msg.address_lo |= MSI_ADDR_DEST_ID(dest);
3160 3160
3161 __write_msi_msg(data->msi_desc, &msg); 3161 __pci_write_msi_msg(data->msi_desc, &msg);
3162 3162
3163 return IRQ_SET_MASK_OK_NOCOPY; 3163 return IRQ_SET_MASK_OK_NOCOPY;
3164} 3164}
@@ -3169,8 +3169,8 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)
3169 */ 3169 */
3170static struct irq_chip msi_chip = { 3170static struct irq_chip msi_chip = {
3171 .name = "PCI-MSI", 3171 .name = "PCI-MSI",
3172 .irq_unmask = unmask_msi_irq, 3172 .irq_unmask = pci_msi_unmask_irq,
3173 .irq_mask = mask_msi_irq, 3173 .irq_mask = pci_msi_mask_irq,
3174 .irq_ack = ack_apic_edge, 3174 .irq_ack = ack_apic_edge,
3175 .irq_set_affinity = msi_set_affinity, 3175 .irq_set_affinity = msi_set_affinity,
3176 .irq_retrigger = ioapic_retrigger_irq, 3176 .irq_retrigger = ioapic_retrigger_irq,
@@ -3196,7 +3196,7 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
3196 * MSI message denotes a contiguous group of IRQs, written for 0th IRQ. 3196 * MSI message denotes a contiguous group of IRQs, written for 0th IRQ.
3197 */ 3197 */
3198 if (!irq_offset) 3198 if (!irq_offset)
3199 write_msi_msg(irq, &msg); 3199 pci_write_msi_msg(irq, &msg);
3200 3200
3201 setup_remapped_irq(irq, irq_cfg(irq), chip); 3201 setup_remapped_irq(irq, irq_cfg(irq), chip);
3202 3202
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 584874451414..927ec9235947 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -378,7 +378,6 @@ static struct cpuidle_driver apm_idle_driver = {
378 { /* entry 1 is for APM idle */ 378 { /* entry 1 is for APM idle */
379 .name = "APM", 379 .name = "APM",
380 .desc = "APM idle", 380 .desc = "APM idle",
381 .flags = CPUIDLE_FLAG_TIME_VALID,
382 .exit_latency = 250, /* WAG */ 381 .exit_latency = 250, /* WAG */
383 .target_residency = 500, /* WAG */ 382 .target_residency = 500, /* WAG */
384 .enter = &apm_cpu_idle 383 .enter = &apm_cpu_idle
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index e7c798b354fa..4f9359f36bb7 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -48,7 +48,6 @@ int main(void)
48 48
49#define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry) 49#define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
50 ENTRY(bx); 50 ENTRY(bx);
51 ENTRY(bx);
52 ENTRY(cx); 51 ENTRY(cx);
53 ENTRY(dx); 52 ENTRY(dx);
54 ENTRY(sp); 53 ENTRY(sp);
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 813d29d00a17..15c5df92f74e 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -566,6 +566,17 @@ static void init_amd_k8(struct cpuinfo_x86 *c)
566 566
567 if (!c->x86_model_id[0]) 567 if (!c->x86_model_id[0])
568 strcpy(c->x86_model_id, "Hammer"); 568 strcpy(c->x86_model_id, "Hammer");
569
570#ifdef CONFIG_SMP
571 /*
572 * Disable TLB flush filter by setting HWCR.FFDIS on K8
573 * bit 6 of msr C001_0015
574 *
575 * Errata 63 for SH-B3 steppings
576 * Errata 122 for all steppings (F+ have it disabled by default)
577 */
578 msr_set_bit(MSR_K7_HWCR, 6);
579#endif
569} 580}
570 581
571static void init_amd_gh(struct cpuinfo_x86 *c) 582static void init_amd_gh(struct cpuinfo_x86 *c)
@@ -636,18 +647,6 @@ static void init_amd(struct cpuinfo_x86 *c)
636{ 647{
637 u32 dummy; 648 u32 dummy;
638 649
639#ifdef CONFIG_SMP
640 /*
641 * Disable TLB flush filter by setting HWCR.FFDIS on K8
642 * bit 6 of msr C001_0015
643 *
644 * Errata 63 for SH-B3 steppings
645 * Errata 122 for all steppings (F+ have it disabled by default)
646 */
647 if (c->x86 == 0xf)
648 msr_set_bit(MSR_K7_HWCR, 6);
649#endif
650
651 early_init_amd(c); 650 early_init_amd(c);
652 651
653 /* 652 /*
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index cfa9b5b2c27a..c6049650c093 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -958,14 +958,6 @@ static void identify_cpu(struct cpuinfo_x86 *c)
958} 958}
959 959
960#ifdef CONFIG_X86_64 960#ifdef CONFIG_X86_64
961static void vgetcpu_set_mode(void)
962{
963 if (cpu_has(&boot_cpu_data, X86_FEATURE_RDTSCP))
964 vgetcpu_mode = VGETCPU_RDTSCP;
965 else
966 vgetcpu_mode = VGETCPU_LSL;
967}
968
969#ifdef CONFIG_IA32_EMULATION 961#ifdef CONFIG_IA32_EMULATION
970/* May not be __init: called during resume */ 962/* May not be __init: called during resume */
971static void syscall32_cpu_init(void) 963static void syscall32_cpu_init(void)
@@ -1008,8 +1000,6 @@ void __init identify_boot_cpu(void)
1008#ifdef CONFIG_X86_32 1000#ifdef CONFIG_X86_32
1009 sysenter_setup(); 1001 sysenter_setup();
1010 enable_sep_cpu(); 1002 enable_sep_cpu();
1011#else
1012 vgetcpu_set_mode();
1013#endif 1003#endif
1014 cpu_detect_tlb(&boot_cpu_data); 1004 cpu_detect_tlb(&boot_cpu_data);
1015} 1005}
diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
index 09edd0b65fef..10b46906767f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -3,6 +3,8 @@
3 3
4enum severity_level { 4enum severity_level {
5 MCE_NO_SEVERITY, 5 MCE_NO_SEVERITY,
6 MCE_DEFERRED_SEVERITY,
7 MCE_UCNA_SEVERITY = MCE_DEFERRED_SEVERITY,
6 MCE_KEEP_SEVERITY, 8 MCE_KEEP_SEVERITY,
7 MCE_SOME_SEVERITY, 9 MCE_SOME_SEVERITY,
8 MCE_AO_SEVERITY, 10 MCE_AO_SEVERITY,
@@ -21,7 +23,7 @@ struct mce_bank {
21 char attrname[ATTR_LEN]; /* attribute name */ 23 char attrname[ATTR_LEN]; /* attribute name */
22}; 24};
23 25
24int mce_severity(struct mce *a, int tolerant, char **msg); 26int mce_severity(struct mce *a, int tolerant, char **msg, bool is_excp);
25struct dentry *mce_get_debugfs_dir(void); 27struct dentry *mce_get_debugfs_dir(void);
26 28
27extern struct mce_bank *mce_banks; 29extern struct mce_bank *mce_banks;
diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
index c370e1c4468b..8bb433043a7f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
@@ -31,6 +31,7 @@
31 31
32enum context { IN_KERNEL = 1, IN_USER = 2 }; 32enum context { IN_KERNEL = 1, IN_USER = 2 };
33enum ser { SER_REQUIRED = 1, NO_SER = 2 }; 33enum ser { SER_REQUIRED = 1, NO_SER = 2 };
34enum exception { EXCP_CONTEXT = 1, NO_EXCP = 2 };
34 35
35static struct severity { 36static struct severity {
36 u64 mask; 37 u64 mask;
@@ -40,6 +41,7 @@ static struct severity {
40 unsigned char mcgres; 41 unsigned char mcgres;
41 unsigned char ser; 42 unsigned char ser;
42 unsigned char context; 43 unsigned char context;
44 unsigned char excp;
43 unsigned char covered; 45 unsigned char covered;
44 char *msg; 46 char *msg;
45} severities[] = { 47} severities[] = {
@@ -48,6 +50,8 @@ static struct severity {
48#define USER .context = IN_USER 50#define USER .context = IN_USER
49#define SER .ser = SER_REQUIRED 51#define SER .ser = SER_REQUIRED
50#define NOSER .ser = NO_SER 52#define NOSER .ser = NO_SER
53#define EXCP .excp = EXCP_CONTEXT
54#define NOEXCP .excp = NO_EXCP
51#define BITCLR(x) .mask = x, .result = 0 55#define BITCLR(x) .mask = x, .result = 0
52#define BITSET(x) .mask = x, .result = x 56#define BITSET(x) .mask = x, .result = x
53#define MCGMASK(x, y) .mcgmask = x, .mcgres = y 57#define MCGMASK(x, y) .mcgmask = x, .mcgres = y
@@ -62,7 +66,7 @@ static struct severity {
62 ), 66 ),
63 MCESEV( 67 MCESEV(
64 NO, "Not enabled", 68 NO, "Not enabled",
65 BITCLR(MCI_STATUS_EN) 69 EXCP, BITCLR(MCI_STATUS_EN)
66 ), 70 ),
67 MCESEV( 71 MCESEV(
68 PANIC, "Processor context corrupt", 72 PANIC, "Processor context corrupt",
@@ -71,16 +75,20 @@ static struct severity {
71 /* When MCIP is not set something is very confused */ 75 /* When MCIP is not set something is very confused */
72 MCESEV( 76 MCESEV(
73 PANIC, "MCIP not set in MCA handler", 77 PANIC, "MCIP not set in MCA handler",
74 MCGMASK(MCG_STATUS_MCIP, 0) 78 EXCP, MCGMASK(MCG_STATUS_MCIP, 0)
75 ), 79 ),
76 /* Neither return not error IP -- no chance to recover -> PANIC */ 80 /* Neither return not error IP -- no chance to recover -> PANIC */
77 MCESEV( 81 MCESEV(
78 PANIC, "Neither restart nor error IP", 82 PANIC, "Neither restart nor error IP",
79 MCGMASK(MCG_STATUS_RIPV|MCG_STATUS_EIPV, 0) 83 EXCP, MCGMASK(MCG_STATUS_RIPV|MCG_STATUS_EIPV, 0)
80 ), 84 ),
81 MCESEV( 85 MCESEV(
82 PANIC, "In kernel and no restart IP", 86 PANIC, "In kernel and no restart IP",
83 KERNEL, MCGMASK(MCG_STATUS_RIPV, 0) 87 EXCP, KERNEL, MCGMASK(MCG_STATUS_RIPV, 0)
88 ),
89 MCESEV(
90 DEFERRED, "Deferred error",
91 NOSER, MASK(MCI_STATUS_UC|MCI_STATUS_DEFERRED|MCI_STATUS_POISON, MCI_STATUS_DEFERRED)
84 ), 92 ),
85 MCESEV( 93 MCESEV(
86 KEEP, "Corrected error", 94 KEEP, "Corrected error",
@@ -89,7 +97,7 @@ static struct severity {
89 97
90 /* ignore OVER for UCNA */ 98 /* ignore OVER for UCNA */
91 MCESEV( 99 MCESEV(
92 KEEP, "Uncorrected no action required", 100 UCNA, "Uncorrected no action required",
93 SER, MASK(MCI_UC_SAR, MCI_STATUS_UC) 101 SER, MASK(MCI_UC_SAR, MCI_STATUS_UC)
94 ), 102 ),
95 MCESEV( 103 MCESEV(
@@ -178,8 +186,9 @@ static int error_context(struct mce *m)
178 return ((m->cs & 3) == 3) ? IN_USER : IN_KERNEL; 186 return ((m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
179} 187}
180 188
181int mce_severity(struct mce *m, int tolerant, char **msg) 189int mce_severity(struct mce *m, int tolerant, char **msg, bool is_excp)
182{ 190{
191 enum exception excp = (is_excp ? EXCP_CONTEXT : NO_EXCP);
183 enum context ctx = error_context(m); 192 enum context ctx = error_context(m);
184 struct severity *s; 193 struct severity *s;
185 194
@@ -194,6 +203,8 @@ int mce_severity(struct mce *m, int tolerant, char **msg)
194 continue; 203 continue;
195 if (s->context && ctx != s->context) 204 if (s->context && ctx != s->context)
196 continue; 205 continue;
206 if (s->excp && excp != s->excp)
207 continue;
197 if (msg) 208 if (msg)
198 *msg = s->msg; 209 *msg = s->msg;
199 s->covered = 1; 210 s->covered = 1;
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 61a9668cebfd..d2c611699cd9 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -292,10 +292,10 @@ static void print_mce(struct mce *m)
292 292
293#define PANIC_TIMEOUT 5 /* 5 seconds */ 293#define PANIC_TIMEOUT 5 /* 5 seconds */
294 294
295static atomic_t mce_paniced; 295static atomic_t mce_panicked;
296 296
297static int fake_panic; 297static int fake_panic;
298static atomic_t mce_fake_paniced; 298static atomic_t mce_fake_panicked;
299 299
300/* Panic in progress. Enable interrupts and wait for final IPI */ 300/* Panic in progress. Enable interrupts and wait for final IPI */
301static void wait_for_panic(void) 301static void wait_for_panic(void)
@@ -319,7 +319,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
319 /* 319 /*
320 * Make sure only one CPU runs in machine check panic 320 * Make sure only one CPU runs in machine check panic
321 */ 321 */
322 if (atomic_inc_return(&mce_paniced) > 1) 322 if (atomic_inc_return(&mce_panicked) > 1)
323 wait_for_panic(); 323 wait_for_panic();
324 barrier(); 324 barrier();
325 325
@@ -327,7 +327,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
327 console_verbose(); 327 console_verbose();
328 } else { 328 } else {
329 /* Don't log too much for fake panic */ 329 /* Don't log too much for fake panic */
330 if (atomic_inc_return(&mce_fake_paniced) > 1) 330 if (atomic_inc_return(&mce_fake_panicked) > 1)
331 return; 331 return;
332 } 332 }
333 /* First print corrected ones that are still unlogged */ 333 /* First print corrected ones that are still unlogged */
@@ -575,6 +575,37 @@ static void mce_read_aux(struct mce *m, int i)
575 } 575 }
576} 576}
577 577
578static bool memory_error(struct mce *m)
579{
580 struct cpuinfo_x86 *c = &boot_cpu_data;
581
582 if (c->x86_vendor == X86_VENDOR_AMD) {
583 /*
584 * coming soon
585 */
586 return false;
587 } else if (c->x86_vendor == X86_VENDOR_INTEL) {
588 /*
589 * Intel SDM Volume 3B - 15.9.2 Compound Error Codes
590 *
591 * Bit 7 of the MCACOD field of IA32_MCi_STATUS is used for
592 * indicating a memory error. Bit 8 is used for indicating a
593 * cache hierarchy error. The combination of bit 2 and bit 3
594 * is used for indicating a `generic' cache hierarchy error
595 * But we can't just blindly check the above bits, because if
596 * bit 11 is set, then it is a bus/interconnect error - and
597 * either way the above bits just gives more detail on what
598 * bus/interconnect error happened. Note that bit 12 can be
599 * ignored, as it's the "filter" bit.
600 */
601 return (m->status & 0xef80) == BIT(7) ||
602 (m->status & 0xef00) == BIT(8) ||
603 (m->status & 0xeffc) == 0xc;
604 }
605
606 return false;
607}
608
578DEFINE_PER_CPU(unsigned, mce_poll_count); 609DEFINE_PER_CPU(unsigned, mce_poll_count);
579 610
580/* 611/*
@@ -595,6 +626,7 @@ DEFINE_PER_CPU(unsigned, mce_poll_count);
595void machine_check_poll(enum mcp_flags flags, mce_banks_t *b) 626void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
596{ 627{
597 struct mce m; 628 struct mce m;
629 int severity;
598 int i; 630 int i;
599 631
600 this_cpu_inc(mce_poll_count); 632 this_cpu_inc(mce_poll_count);
@@ -630,6 +662,20 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
630 662
631 if (!(flags & MCP_TIMESTAMP)) 663 if (!(flags & MCP_TIMESTAMP))
632 m.tsc = 0; 664 m.tsc = 0;
665
666 severity = mce_severity(&m, mca_cfg.tolerant, NULL, false);
667
668 /*
669 * In the cases where we don't have a valid address after all,
670 * do not add it into the ring buffer.
671 */
672 if (severity == MCE_DEFERRED_SEVERITY && memory_error(&m)) {
673 if (m.status & MCI_STATUS_ADDRV) {
674 mce_ring_add(m.addr >> PAGE_SHIFT);
675 mce_schedule_work();
676 }
677 }
678
633 /* 679 /*
634 * Don't get the IP here because it's unlikely to 680 * Don't get the IP here because it's unlikely to
635 * have anything to do with the actual error location. 681 * have anything to do with the actual error location.
@@ -668,7 +714,8 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
668 if (quirk_no_way_out) 714 if (quirk_no_way_out)
669 quirk_no_way_out(i, m, regs); 715 quirk_no_way_out(i, m, regs);
670 } 716 }
671 if (mce_severity(m, mca_cfg.tolerant, msg) >= MCE_PANIC_SEVERITY) 717 if (mce_severity(m, mca_cfg.tolerant, msg, true) >=
718 MCE_PANIC_SEVERITY)
672 ret = 1; 719 ret = 1;
673 } 720 }
674 return ret; 721 return ret;
@@ -697,7 +744,7 @@ static int mce_timed_out(u64 *t)
697 * might have been modified by someone else. 744 * might have been modified by someone else.
698 */ 745 */
699 rmb(); 746 rmb();
700 if (atomic_read(&mce_paniced)) 747 if (atomic_read(&mce_panicked))
701 wait_for_panic(); 748 wait_for_panic();
702 if (!mca_cfg.monarch_timeout) 749 if (!mca_cfg.monarch_timeout)
703 goto out; 750 goto out;
@@ -754,7 +801,7 @@ static void mce_reign(void)
754 for_each_possible_cpu(cpu) { 801 for_each_possible_cpu(cpu) {
755 int severity = mce_severity(&per_cpu(mces_seen, cpu), 802 int severity = mce_severity(&per_cpu(mces_seen, cpu),
756 mca_cfg.tolerant, 803 mca_cfg.tolerant,
757 &nmsg); 804 &nmsg, true);
758 if (severity > global_worst) { 805 if (severity > global_worst) {
759 msg = nmsg; 806 msg = nmsg;
760 global_worst = severity; 807 global_worst = severity;
@@ -1095,13 +1142,14 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1095 */ 1142 */
1096 add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE); 1143 add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
1097 1144
1098 severity = mce_severity(&m, cfg->tolerant, NULL); 1145 severity = mce_severity(&m, cfg->tolerant, NULL, true);
1099 1146
1100 /* 1147 /*
1101 * When machine check was for corrected handler don't touch, 1148 * When machine check was for corrected/deferred handler don't
1102 * unless we're panicing. 1149 * touch, unless we're panicing.
1103 */ 1150 */
1104 if (severity == MCE_KEEP_SEVERITY && !no_way_out) 1151 if ((severity == MCE_KEEP_SEVERITY ||
1152 severity == MCE_UCNA_SEVERITY) && !no_way_out)
1105 continue; 1153 continue;
1106 __set_bit(i, toclear); 1154 __set_bit(i, toclear);
1107 if (severity == MCE_NO_SEVERITY) { 1155 if (severity == MCE_NO_SEVERITY) {
@@ -2520,7 +2568,7 @@ struct dentry *mce_get_debugfs_dir(void)
2520static void mce_reset(void) 2568static void mce_reset(void)
2521{ 2569{
2522 cpu_missing = 0; 2570 cpu_missing = 0;
2523 atomic_set(&mce_fake_paniced, 0); 2571 atomic_set(&mce_fake_panicked, 0);
2524 atomic_set(&mce_executing, 0); 2572 atomic_set(&mce_executing, 0);
2525 atomic_set(&mce_callin, 0); 2573 atomic_set(&mce_callin, 0);
2526 atomic_set(&global_nwo, 0); 2574 atomic_set(&global_nwo, 0);
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 5d4999f95aec..f1c3769bbd64 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -212,12 +212,12 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
212 unsigned int cpu = smp_processor_id(); 212 unsigned int cpu = smp_processor_id();
213 u32 low = 0, high = 0, address = 0; 213 u32 low = 0, high = 0, address = 0;
214 unsigned int bank, block; 214 unsigned int bank, block;
215 int offset = -1; 215 int offset = -1, new;
216 216
217 for (bank = 0; bank < mca_cfg.banks; ++bank) { 217 for (bank = 0; bank < mca_cfg.banks; ++bank) {
218 for (block = 0; block < NR_BLOCKS; ++block) { 218 for (block = 0; block < NR_BLOCKS; ++block) {
219 if (block == 0) 219 if (block == 0)
220 address = MSR_IA32_MC0_MISC + bank * 4; 220 address = MSR_IA32_MCx_MISC(bank);
221 else if (block == 1) { 221 else if (block == 1) {
222 address = (low & MASK_BLKPTR_LO) >> 21; 222 address = (low & MASK_BLKPTR_LO) >> 21;
223 if (!address) 223 if (!address)
@@ -247,13 +247,18 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
247 b.address = address; 247 b.address = address;
248 b.interrupt_capable = lvt_interrupt_supported(bank, high); 248 b.interrupt_capable = lvt_interrupt_supported(bank, high);
249 249
250 if (b.interrupt_capable) { 250 if (!b.interrupt_capable)
251 int new = (high & MASK_LVTOFF_HI) >> 20; 251 goto init;
252 offset = setup_APIC_mce(offset, new); 252
253 } 253 new = (high & MASK_LVTOFF_HI) >> 20;
254 offset = setup_APIC_mce(offset, new);
255
256 if ((offset == new) &&
257 (mce_threshold_vector != amd_threshold_interrupt))
258 mce_threshold_vector = amd_threshold_interrupt;
254 259
260init:
255 mce_threshold_block_init(&b, offset); 261 mce_threshold_block_init(&b, offset);
256 mce_threshold_vector = amd_threshold_interrupt;
257 } 262 }
258 } 263 }
259} 264}
@@ -270,18 +275,17 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
270static void amd_threshold_interrupt(void) 275static void amd_threshold_interrupt(void)
271{ 276{
272 u32 low = 0, high = 0, address = 0; 277 u32 low = 0, high = 0, address = 0;
278 int cpu = smp_processor_id();
273 unsigned int bank, block; 279 unsigned int bank, block;
274 struct mce m; 280 struct mce m;
275 281
276 mce_setup(&m);
277
278 /* assume first bank caused it */ 282 /* assume first bank caused it */
279 for (bank = 0; bank < mca_cfg.banks; ++bank) { 283 for (bank = 0; bank < mca_cfg.banks; ++bank) {
280 if (!(per_cpu(bank_map, m.cpu) & (1 << bank))) 284 if (!(per_cpu(bank_map, cpu) & (1 << bank)))
281 continue; 285 continue;
282 for (block = 0; block < NR_BLOCKS; ++block) { 286 for (block = 0; block < NR_BLOCKS; ++block) {
283 if (block == 0) { 287 if (block == 0) {
284 address = MSR_IA32_MC0_MISC + bank * 4; 288 address = MSR_IA32_MCx_MISC(bank);
285 } else if (block == 1) { 289 } else if (block == 1) {
286 address = (low & MASK_BLKPTR_LO) >> 21; 290 address = (low & MASK_BLKPTR_LO) >> 21;
287 if (!address) 291 if (!address)
@@ -309,21 +313,20 @@ static void amd_threshold_interrupt(void)
309 * Log the machine check that caused the threshold 313 * Log the machine check that caused the threshold
310 * event. 314 * event.
311 */ 315 */
312 machine_check_poll(MCP_TIMESTAMP, 316 if (high & MASK_OVERFLOW_HI)
313 this_cpu_ptr(&mce_poll_banks)); 317 goto log;
314
315 if (high & MASK_OVERFLOW_HI) {
316 rdmsrl(address, m.misc);
317 rdmsrl(MSR_IA32_MC0_STATUS + bank * 4,
318 m.status);
319 m.bank = K8_MCE_THRESHOLD_BASE
320 + bank * NR_BLOCKS
321 + block;
322 mce_log(&m);
323 return;
324 }
325 } 318 }
326 } 319 }
320 return;
321
322log:
323 mce_setup(&m);
324 rdmsrl(MSR_IA32_MCx_STATUS(bank), m.status);
325 m.misc = ((u64)high << 32) | low;
326 m.bank = bank;
327 mce_log(&m);
328
329 wrmsrl(MSR_IA32_MCx_STATUS(bank), 0);
327} 330}
328 331
329/* 332/*
@@ -617,8 +620,7 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank)
617 } 620 }
618 } 621 }
619 622
620 err = allocate_threshold_blocks(cpu, bank, 0, 623 err = allocate_threshold_blocks(cpu, bank, 0, MSR_IA32_MCx_MISC(bank));
621 MSR_IA32_MC0_MISC + bank * 4);
622 if (!err) 624 if (!err)
623 goto out; 625 goto out;
624 626
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 8fffd845e22b..bfbbe6195e2d 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -376,7 +376,7 @@ static enum ucode_state __load_microcode_amd(u8 family, const u8 *data,
376 return UCODE_OK; 376 return UCODE_OK;
377} 377}
378 378
379enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size) 379enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size)
380{ 380{
381 enum ucode_state ret; 381 enum ucode_state ret;
382 382
@@ -390,8 +390,8 @@ enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size)
390 390
391#if defined(CONFIG_MICROCODE_AMD_EARLY) && defined(CONFIG_X86_32) 391#if defined(CONFIG_MICROCODE_AMD_EARLY) && defined(CONFIG_X86_32)
392 /* save BSP's matching patch for early load */ 392 /* save BSP's matching patch for early load */
393 if (cpu_data(smp_processor_id()).cpu_index == boot_cpu_data.cpu_index) { 393 if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) {
394 struct ucode_patch *p = find_patch(smp_processor_id()); 394 struct ucode_patch *p = find_patch(cpu);
395 if (p) { 395 if (p) {
396 memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); 396 memset(amd_ucode_patch, 0, PATCH_MAX_SIZE);
397 memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), 397 memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data),
@@ -444,7 +444,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
444 goto fw_release; 444 goto fw_release;
445 } 445 }
446 446
447 ret = load_microcode_amd(c->x86, fw->data, fw->size); 447 ret = load_microcode_amd(cpu, c->x86, fw->data, fw->size);
448 448
449 fw_release: 449 fw_release:
450 release_firmware(fw); 450 release_firmware(fw);
diff --git a/arch/x86/kernel/cpu/microcode/amd_early.c b/arch/x86/kernel/cpu/microcode/amd_early.c
index 06674473b0e6..737737edbd1e 100644
--- a/arch/x86/kernel/cpu/microcode/amd_early.c
+++ b/arch/x86/kernel/cpu/microcode/amd_early.c
@@ -389,7 +389,7 @@ int __init save_microcode_in_initrd_amd(void)
389 eax = cpuid_eax(0x00000001); 389 eax = cpuid_eax(0x00000001);
390 eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); 390 eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
391 391
392 ret = load_microcode_amd(eax, container, container_size); 392 ret = load_microcode_amd(smp_processor_id(), eax, container, container_size);
393 if (ret != UCODE_OK) 393 if (ret != UCODE_OK)
394 retval = -EINVAL; 394 retval = -EINVAL;
395 395
@@ -402,3 +402,21 @@ int __init save_microcode_in_initrd_amd(void)
402 402
403 return retval; 403 return retval;
404} 404}
405
406void reload_ucode_amd(void)
407{
408 struct microcode_amd *mc;
409 u32 rev, eax;
410
411 rdmsr(MSR_AMD64_PATCH_LEVEL, rev, eax);
412
413 mc = (struct microcode_amd *)amd_ucode_patch;
414
415 if (mc && rev < mc->hdr.patch_id) {
416 if (!__apply_microcode_amd(mc)) {
417 ucode_new_rev = mc->hdr.patch_id;
418 pr_info("microcode: reload patch_level=0x%08x\n",
419 ucode_new_rev);
420 }
421 }
422}
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 2ce9051174e6..15c29096136b 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -466,13 +466,7 @@ static void mc_bp_resume(void)
466 if (uci->valid && uci->mc) 466 if (uci->valid && uci->mc)
467 microcode_ops->apply_microcode(cpu); 467 microcode_ops->apply_microcode(cpu);
468 else if (!uci->mc) 468 else if (!uci->mc)
469 /* 469 reload_early_microcode();
470 * We might resume and not have applied late microcode but still
471 * have a newer patch stashed from the early loader. We don't
472 * have it in uci->mc so we have to load it the same way we're
473 * applying patches early on the APs.
474 */
475 load_ucode_ap();
476} 470}
477 471
478static struct syscore_ops mc_syscore_ops = { 472static struct syscore_ops mc_syscore_ops = {
@@ -557,7 +551,7 @@ static int __init microcode_init(void)
557 struct cpuinfo_x86 *c = &cpu_data(0); 551 struct cpuinfo_x86 *c = &cpu_data(0);
558 int error; 552 int error;
559 553
560 if (dis_ucode_ldr) 554 if (paravirt_enabled() || dis_ucode_ldr)
561 return 0; 555 return 0;
562 556
563 if (c->x86_vendor == X86_VENDOR_INTEL) 557 if (c->x86_vendor == X86_VENDOR_INTEL)
diff --git a/arch/x86/kernel/cpu/microcode/core_early.c b/arch/x86/kernel/cpu/microcode/core_early.c
index 2c017f242a78..d45df4bd16ab 100644
--- a/arch/x86/kernel/cpu/microcode/core_early.c
+++ b/arch/x86/kernel/cpu/microcode/core_early.c
@@ -176,3 +176,24 @@ int __init save_microcode_in_initrd(void)
176 176
177 return 0; 177 return 0;
178} 178}
179
180void reload_early_microcode(void)
181{
182 int vendor, x86;
183
184 vendor = x86_vendor();
185 x86 = x86_family();
186
187 switch (vendor) {
188 case X86_VENDOR_INTEL:
189 if (x86 >= 6)
190 reload_ucode_intel();
191 break;
192 case X86_VENDOR_AMD:
193 if (x86 >= 0x10)
194 reload_ucode_amd();
195 break;
196 default:
197 break;
198 }
199}
diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c b/arch/x86/kernel/cpu/microcode/intel_early.c
index b88343f7a3b3..ec9df6f9cd47 100644
--- a/arch/x86/kernel/cpu/microcode/intel_early.c
+++ b/arch/x86/kernel/cpu/microcode/intel_early.c
@@ -650,8 +650,7 @@ static inline void print_ucode(struct ucode_cpu_info *uci)
650} 650}
651#endif 651#endif
652 652
653static int apply_microcode_early(struct mc_saved_data *mc_saved_data, 653static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
654 struct ucode_cpu_info *uci)
655{ 654{
656 struct microcode_intel *mc_intel; 655 struct microcode_intel *mc_intel;
657 unsigned int val[2]; 656 unsigned int val[2];
@@ -680,7 +679,10 @@ static int apply_microcode_early(struct mc_saved_data *mc_saved_data,
680#endif 679#endif
681 uci->cpu_sig.rev = val[1]; 680 uci->cpu_sig.rev = val[1];
682 681
683 print_ucode(uci); 682 if (early)
683 print_ucode(uci);
684 else
685 print_ucode_info(uci, mc_intel->hdr.date);
684 686
685 return 0; 687 return 0;
686} 688}
@@ -715,12 +717,17 @@ _load_ucode_intel_bsp(struct mc_saved_data *mc_saved_data,
715 unsigned long initrd_end_early, 717 unsigned long initrd_end_early,
716 struct ucode_cpu_info *uci) 718 struct ucode_cpu_info *uci)
717{ 719{
720 enum ucode_state ret;
721
718 collect_cpu_info_early(uci); 722 collect_cpu_info_early(uci);
719 scan_microcode(initrd_start_early, initrd_end_early, mc_saved_data, 723 scan_microcode(initrd_start_early, initrd_end_early, mc_saved_data,
720 mc_saved_in_initrd, uci); 724 mc_saved_in_initrd, uci);
721 load_microcode(mc_saved_data, mc_saved_in_initrd, 725
722 initrd_start_early, uci); 726 ret = load_microcode(mc_saved_data, mc_saved_in_initrd,
723 apply_microcode_early(mc_saved_data, uci); 727 initrd_start_early, uci);
728
729 if (ret == UCODE_OK)
730 apply_microcode_early(uci, true);
724} 731}
725 732
726void __init 733void __init
@@ -749,7 +756,8 @@ load_ucode_intel_bsp(void)
749 initrd_end_early = initrd_start_early + ramdisk_size; 756 initrd_end_early = initrd_start_early + ramdisk_size;
750 757
751 _load_ucode_intel_bsp(&mc_saved_data, mc_saved_in_initrd, 758 _load_ucode_intel_bsp(&mc_saved_data, mc_saved_in_initrd,
752 initrd_start_early, initrd_end_early, &uci); 759 initrd_start_early, initrd_end_early,
760 &uci);
753#endif 761#endif
754} 762}
755 763
@@ -783,5 +791,23 @@ void load_ucode_intel_ap(void)
783 collect_cpu_info_early(&uci); 791 collect_cpu_info_early(&uci);
784 load_microcode(mc_saved_data_p, mc_saved_in_initrd_p, 792 load_microcode(mc_saved_data_p, mc_saved_in_initrd_p,
785 initrd_start_addr, &uci); 793 initrd_start_addr, &uci);
786 apply_microcode_early(mc_saved_data_p, &uci); 794 apply_microcode_early(&uci, true);
795}
796
797void reload_ucode_intel(void)
798{
799 struct ucode_cpu_info uci;
800 enum ucode_state ret;
801
802 if (!mc_saved_data.mc_saved_count)
803 return;
804
805 collect_cpu_info_early(&uci);
806
807 ret = generic_load_microcode_early(mc_saved_data.mc_saved,
808 mc_saved_data.mc_saved_count, &uci);
809 if (ret != UCODE_OK)
810 return;
811
812 apply_microcode_early(&uci, false);
787} 813}
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index fc5eb390b368..4e6cdb0ddc70 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -253,6 +253,10 @@ struct cpu_hw_events {
253#define INTEL_UEVENT_CONSTRAINT(c, n) \ 253#define INTEL_UEVENT_CONSTRAINT(c, n) \
254 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK) 254 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
255 255
256/* Like UEVENT_CONSTRAINT, but match flags too */
257#define INTEL_FLAGS_UEVENT_CONSTRAINT(c, n) \
258 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS)
259
256#define INTEL_PLD_CONSTRAINT(c, n) \ 260#define INTEL_PLD_CONSTRAINT(c, n) \
257 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \ 261 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \
258 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_LDLAT) 262 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_LDLAT)
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
index cbb1be3ed9e4..a61f5c6911da 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
@@ -565,6 +565,21 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
565 perf_ibs->offset_max, 565 perf_ibs->offset_max,
566 offset + 1); 566 offset + 1);
567 } while (offset < offset_max); 567 } while (offset < offset_max);
568 if (event->attr.sample_type & PERF_SAMPLE_RAW) {
569 /*
570 * Read IbsBrTarget and IbsOpData4 separately
571 * depending on their availability.
572 * Can't add to offset_max as they are staggered
573 */
574 if (ibs_caps & IBS_CAPS_BRNTRGT) {
575 rdmsrl(MSR_AMD64_IBSBRTARGET, *buf++);
576 size++;
577 }
578 if (ibs_caps & IBS_CAPS_OPDATA4) {
579 rdmsrl(MSR_AMD64_IBSOPDATA4, *buf++);
580 size++;
581 }
582 }
568 ibs_data.size = sizeof(u64) * size; 583 ibs_data.size = sizeof(u64) * size;
569 584
570 regs = *iregs; 585 regs = *iregs;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 46211bcc813e..3c895d480cd7 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -552,18 +552,18 @@ int intel_pmu_drain_bts_buffer(void)
552 * PEBS 552 * PEBS
553 */ 553 */
554struct event_constraint intel_core2_pebs_event_constraints[] = { 554struct event_constraint intel_core2_pebs_event_constraints[] = {
555 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */ 555 INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */
556 INTEL_UEVENT_CONSTRAINT(0xfec1, 0x1), /* X87_OPS_RETIRED.ANY */ 556 INTEL_FLAGS_UEVENT_CONSTRAINT(0xfec1, 0x1), /* X87_OPS_RETIRED.ANY */
557 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */ 557 INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */
558 INTEL_UEVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */ 558 INTEL_FLAGS_UEVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */
559 INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */ 559 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
560 EVENT_CONSTRAINT_END 560 EVENT_CONSTRAINT_END
561}; 561};
562 562
563struct event_constraint intel_atom_pebs_event_constraints[] = { 563struct event_constraint intel_atom_pebs_event_constraints[] = {
564 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */ 564 INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */
565 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */ 565 INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */
566 INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */ 566 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
567 EVENT_CONSTRAINT_END 567 EVENT_CONSTRAINT_END
568}; 568};
569 569
@@ -577,36 +577,36 @@ struct event_constraint intel_slm_pebs_event_constraints[] = {
577 577
578struct event_constraint intel_nehalem_pebs_event_constraints[] = { 578struct event_constraint intel_nehalem_pebs_event_constraints[] = {
579 INTEL_PLD_CONSTRAINT(0x100b, 0xf), /* MEM_INST_RETIRED.* */ 579 INTEL_PLD_CONSTRAINT(0x100b, 0xf), /* MEM_INST_RETIRED.* */
580 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 580 INTEL_FLAGS_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
581 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */ 581 INTEL_FLAGS_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */
582 INTEL_EVENT_CONSTRAINT(0xc0, 0xf), /* INST_RETIRED.ANY */ 582 INTEL_FLAGS_EVENT_CONSTRAINT(0xc0, 0xf), /* INST_RETIRED.ANY */
583 INTEL_EVENT_CONSTRAINT(0xc2, 0xf), /* UOPS_RETIRED.* */ 583 INTEL_EVENT_CONSTRAINT(0xc2, 0xf), /* UOPS_RETIRED.* */
584 INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ 584 INTEL_FLAGS_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */
585 INTEL_UEVENT_CONSTRAINT(0x02c5, 0xf), /* BR_MISP_RETIRED.NEAR_CALL */ 585 INTEL_FLAGS_UEVENT_CONSTRAINT(0x02c5, 0xf), /* BR_MISP_RETIRED.NEAR_CALL */
586 INTEL_EVENT_CONSTRAINT(0xc7, 0xf), /* SSEX_UOPS_RETIRED.* */ 586 INTEL_FLAGS_EVENT_CONSTRAINT(0xc7, 0xf), /* SSEX_UOPS_RETIRED.* */
587 INTEL_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */ 587 INTEL_FLAGS_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */
588 INTEL_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */ 588 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */
589 INTEL_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */ 589 INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */
590 EVENT_CONSTRAINT_END 590 EVENT_CONSTRAINT_END
591}; 591};
592 592
593struct event_constraint intel_westmere_pebs_event_constraints[] = { 593struct event_constraint intel_westmere_pebs_event_constraints[] = {
594 INTEL_PLD_CONSTRAINT(0x100b, 0xf), /* MEM_INST_RETIRED.* */ 594 INTEL_PLD_CONSTRAINT(0x100b, 0xf), /* MEM_INST_RETIRED.* */
595 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 595 INTEL_FLAGS_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
596 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */ 596 INTEL_FLAGS_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */
597 INTEL_EVENT_CONSTRAINT(0xc0, 0xf), /* INSTR_RETIRED.* */ 597 INTEL_FLAGS_EVENT_CONSTRAINT(0xc0, 0xf), /* INSTR_RETIRED.* */
598 INTEL_EVENT_CONSTRAINT(0xc2, 0xf), /* UOPS_RETIRED.* */ 598 INTEL_EVENT_CONSTRAINT(0xc2, 0xf), /* UOPS_RETIRED.* */
599 INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ 599 INTEL_FLAGS_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */
600 INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */ 600 INTEL_FLAGS_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */
601 INTEL_EVENT_CONSTRAINT(0xc7, 0xf), /* SSEX_UOPS_RETIRED.* */ 601 INTEL_FLAGS_EVENT_CONSTRAINT(0xc7, 0xf), /* SSEX_UOPS_RETIRED.* */
602 INTEL_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */ 602 INTEL_FLAGS_UEVENT_CONSTRAINT(0x20c8, 0xf), /* ITLB_MISS_RETIRED */
603 INTEL_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */ 603 INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */
604 INTEL_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */ 604 INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */
605 EVENT_CONSTRAINT_END 605 EVENT_CONSTRAINT_END
606}; 606};
607 607
608struct event_constraint intel_snb_pebs_event_constraints[] = { 608struct event_constraint intel_snb_pebs_event_constraints[] = {
609 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ 609 INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */
610 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ 610 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */
611 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */ 611 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */
612 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ 612 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
@@ -617,7 +617,7 @@ struct event_constraint intel_snb_pebs_event_constraints[] = {
617}; 617};
618 618
619struct event_constraint intel_ivb_pebs_event_constraints[] = { 619struct event_constraint intel_ivb_pebs_event_constraints[] = {
620 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ 620 INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */
621 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ 621 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */
622 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */ 622 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */
623 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ 623 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
@@ -628,7 +628,7 @@ struct event_constraint intel_ivb_pebs_event_constraints[] = {
628}; 628};
629 629
630struct event_constraint intel_hsw_pebs_event_constraints[] = { 630struct event_constraint intel_hsw_pebs_event_constraints[] = {
631 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ 631 INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */
632 INTEL_PLD_CONSTRAINT(0x01cd, 0xf), /* MEM_TRANS_RETIRED.* */ 632 INTEL_PLD_CONSTRAINT(0x01cd, 0xf), /* MEM_TRANS_RETIRED.* */
633 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ 633 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */
634 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), 634 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf),
@@ -724,6 +724,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
724 unsigned long ip = regs->ip; 724 unsigned long ip = regs->ip;
725 int is_64bit = 0; 725 int is_64bit = 0;
726 void *kaddr; 726 void *kaddr;
727 int size;
727 728
728 /* 729 /*
729 * We don't need to fixup if the PEBS assist is fault like 730 * We don't need to fixup if the PEBS assist is fault like
@@ -758,11 +759,12 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
758 return 1; 759 return 1;
759 } 760 }
760 761
762 size = ip - to;
761 if (!kernel_ip(ip)) { 763 if (!kernel_ip(ip)) {
762 int size, bytes; 764 int bytes;
763 u8 *buf = this_cpu_read(insn_buffer); 765 u8 *buf = this_cpu_read(insn_buffer);
764 766
765 size = ip - to; /* Must fit our buffer, see above */ 767 /* 'size' must fit our buffer, see above */
766 bytes = copy_from_user_nmi(buf, (void __user *)to, size); 768 bytes = copy_from_user_nmi(buf, (void __user *)to, size);
767 if (bytes != 0) 769 if (bytes != 0)
768 return 0; 770 return 0;
@@ -780,11 +782,20 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
780#ifdef CONFIG_X86_64 782#ifdef CONFIG_X86_64
781 is_64bit = kernel_ip(to) || !test_thread_flag(TIF_IA32); 783 is_64bit = kernel_ip(to) || !test_thread_flag(TIF_IA32);
782#endif 784#endif
783 insn_init(&insn, kaddr, is_64bit); 785 insn_init(&insn, kaddr, size, is_64bit);
784 insn_get_length(&insn); 786 insn_get_length(&insn);
787 /*
788 * Make sure there was not a problem decoding the
789 * instruction and getting the length. This is
790 * doubly important because we have an infinite
791 * loop if insn.length=0.
792 */
793 if (!insn.length)
794 break;
785 795
786 to += insn.length; 796 to += insn.length;
787 kaddr += insn.length; 797 kaddr += insn.length;
798 size -= insn.length;
788 } while (to < ip); 799 } while (to < ip);
789 800
790 if (to == ip) { 801 if (to == ip) {
@@ -886,6 +897,29 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
886 regs.bp = pebs->bp; 897 regs.bp = pebs->bp;
887 regs.sp = pebs->sp; 898 regs.sp = pebs->sp;
888 899
900 if (sample_type & PERF_SAMPLE_REGS_INTR) {
901 regs.ax = pebs->ax;
902 regs.bx = pebs->bx;
903 regs.cx = pebs->cx;
904 regs.dx = pebs->dx;
905 regs.si = pebs->si;
906 regs.di = pebs->di;
907 regs.bp = pebs->bp;
908 regs.sp = pebs->sp;
909
910 regs.flags = pebs->flags;
911#ifndef CONFIG_X86_32
912 regs.r8 = pebs->r8;
913 regs.r9 = pebs->r9;
914 regs.r10 = pebs->r10;
915 regs.r11 = pebs->r11;
916 regs.r12 = pebs->r12;
917 regs.r13 = pebs->r13;
918 regs.r14 = pebs->r14;
919 regs.r15 = pebs->r15;
920#endif
921 }
922
889 if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) { 923 if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) {
890 regs.ip = pebs->real_ip; 924 regs.ip = pebs->real_ip;
891 regs.flags |= PERF_EFLAGS_EXACT; 925 regs.flags |= PERF_EFLAGS_EXACT;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index 45fa730a5283..58f1a94beaf0 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -465,7 +465,7 @@ static int branch_type(unsigned long from, unsigned long to, int abort)
465{ 465{
466 struct insn insn; 466 struct insn insn;
467 void *addr; 467 void *addr;
468 int bytes, size = MAX_INSN_SIZE; 468 int bytes_read, bytes_left;
469 int ret = X86_BR_NONE; 469 int ret = X86_BR_NONE;
470 int ext, to_plm, from_plm; 470 int ext, to_plm, from_plm;
471 u8 buf[MAX_INSN_SIZE]; 471 u8 buf[MAX_INSN_SIZE];
@@ -493,8 +493,10 @@ static int branch_type(unsigned long from, unsigned long to, int abort)
493 return X86_BR_NONE; 493 return X86_BR_NONE;
494 494
495 /* may fail if text not present */ 495 /* may fail if text not present */
496 bytes = copy_from_user_nmi(buf, (void __user *)from, size); 496 bytes_left = copy_from_user_nmi(buf, (void __user *)from,
497 if (bytes != 0) 497 MAX_INSN_SIZE);
498 bytes_read = MAX_INSN_SIZE - bytes_left;
499 if (!bytes_read)
498 return X86_BR_NONE; 500 return X86_BR_NONE;
499 501
500 addr = buf; 502 addr = buf;
@@ -505,10 +507,19 @@ static int branch_type(unsigned long from, unsigned long to, int abort)
505 * Ensure we don't blindy read any address by validating it is 507 * Ensure we don't blindy read any address by validating it is
506 * a known text address. 508 * a known text address.
507 */ 509 */
508 if (kernel_text_address(from)) 510 if (kernel_text_address(from)) {
509 addr = (void *)from; 511 addr = (void *)from;
510 else 512 /*
513 * Assume we can get the maximum possible size
514 * when grabbing kernel data. This is not
515 * _strictly_ true since we could possibly be
516 * executing up next to a memory hole, but
517 * it is very unlikely to be a problem.
518 */
519 bytes_read = MAX_INSN_SIZE;
520 } else {
511 return X86_BR_NONE; 521 return X86_BR_NONE;
522 }
512 } 523 }
513 524
514 /* 525 /*
@@ -518,8 +529,10 @@ static int branch_type(unsigned long from, unsigned long to, int abort)
518#ifdef CONFIG_X86_64 529#ifdef CONFIG_X86_64
519 is64 = kernel_ip((unsigned long)addr) || !test_thread_flag(TIF_IA32); 530 is64 = kernel_ip((unsigned long)addr) || !test_thread_flag(TIF_IA32);
520#endif 531#endif
521 insn_init(&insn, addr, is64); 532 insn_init(&insn, addr, bytes_read, is64);
522 insn_get_opcode(&insn); 533 insn_get_opcode(&insn);
534 if (!insn.opcode.got)
535 return X86_BR_ABORT;
523 536
524 switch (insn.opcode.bytes[0]) { 537 switch (insn.opcode.bytes[0]) {
525 case 0xf: 538 case 0xf:
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
index f9ed429d6e4f..745b158e9a65 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
@@ -449,7 +449,11 @@ static struct attribute *snbep_uncore_qpi_formats_attr[] = {
449static struct uncore_event_desc snbep_uncore_imc_events[] = { 449static struct uncore_event_desc snbep_uncore_imc_events[] = {
450 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0xff,umask=0x00"), 450 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0xff,umask=0x00"),
451 INTEL_UNCORE_EVENT_DESC(cas_count_read, "event=0x04,umask=0x03"), 451 INTEL_UNCORE_EVENT_DESC(cas_count_read, "event=0x04,umask=0x03"),
452 INTEL_UNCORE_EVENT_DESC(cas_count_read.scale, "6.103515625e-5"),
453 INTEL_UNCORE_EVENT_DESC(cas_count_read.unit, "MiB"),
452 INTEL_UNCORE_EVENT_DESC(cas_count_write, "event=0x04,umask=0x0c"), 454 INTEL_UNCORE_EVENT_DESC(cas_count_write, "event=0x04,umask=0x0c"),
455 INTEL_UNCORE_EVENT_DESC(cas_count_write.scale, "6.103515625e-5"),
456 INTEL_UNCORE_EVENT_DESC(cas_count_write.unit, "MiB"),
453 { /* end: all zeroes */ }, 457 { /* end: all zeroes */ },
454}; 458};
455 459
@@ -2036,7 +2040,11 @@ static struct intel_uncore_type hswep_uncore_ha = {
2036static struct uncore_event_desc hswep_uncore_imc_events[] = { 2040static struct uncore_event_desc hswep_uncore_imc_events[] = {
2037 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0x00,umask=0x00"), 2041 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0x00,umask=0x00"),
2038 INTEL_UNCORE_EVENT_DESC(cas_count_read, "event=0x04,umask=0x03"), 2042 INTEL_UNCORE_EVENT_DESC(cas_count_read, "event=0x04,umask=0x03"),
2043 INTEL_UNCORE_EVENT_DESC(cas_count_read.scale, "6.103515625e-5"),
2044 INTEL_UNCORE_EVENT_DESC(cas_count_read.unit, "MiB"),
2039 INTEL_UNCORE_EVENT_DESC(cas_count_write, "event=0x04,umask=0x0c"), 2045 INTEL_UNCORE_EVENT_DESC(cas_count_write, "event=0x04,umask=0x0c"),
2046 INTEL_UNCORE_EVENT_DESC(cas_count_write.scale, "6.103515625e-5"),
2047 INTEL_UNCORE_EVENT_DESC(cas_count_write.unit, "MiB"),
2040 { /* end: all zeroes */ }, 2048 { /* end: all zeroes */ },
2041}; 2049};
2042 2050
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 5433658e598d..e7d8c7608471 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -72,7 +72,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
72 if (c->x86_mask || c->cpuid_level >= 0) 72 if (c->x86_mask || c->cpuid_level >= 0)
73 seq_printf(m, "stepping\t: %d\n", c->x86_mask); 73 seq_printf(m, "stepping\t: %d\n", c->x86_mask);
74 else 74 else
75 seq_printf(m, "stepping\t: unknown\n"); 75 seq_puts(m, "stepping\t: unknown\n");
76 if (c->microcode) 76 if (c->microcode)
77 seq_printf(m, "microcode\t: 0x%x\n", c->microcode); 77 seq_printf(m, "microcode\t: 0x%x\n", c->microcode);
78 78
@@ -92,12 +92,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
92 show_cpuinfo_core(m, c, cpu); 92 show_cpuinfo_core(m, c, cpu);
93 show_cpuinfo_misc(m, c); 93 show_cpuinfo_misc(m, c);
94 94
95 seq_printf(m, "flags\t\t:"); 95 seq_puts(m, "flags\t\t:");
96 for (i = 0; i < 32*NCAPINTS; i++) 96 for (i = 0; i < 32*NCAPINTS; i++)
97 if (cpu_has(c, i) && x86_cap_flags[i] != NULL) 97 if (cpu_has(c, i) && x86_cap_flags[i] != NULL)
98 seq_printf(m, " %s", x86_cap_flags[i]); 98 seq_printf(m, " %s", x86_cap_flags[i]);
99 99
100 seq_printf(m, "\nbugs\t\t:"); 100 seq_puts(m, "\nbugs\t\t:");
101 for (i = 0; i < 32*NBUGINTS; i++) { 101 for (i = 0; i < 32*NBUGINTS; i++) {
102 unsigned int bug_bit = 32*NCAPINTS + i; 102 unsigned int bug_bit = 32*NCAPINTS + i;
103 103
@@ -118,7 +118,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
118 seq_printf(m, "address sizes\t: %u bits physical, %u bits virtual\n", 118 seq_printf(m, "address sizes\t: %u bits physical, %u bits virtual\n",
119 c->x86_phys_bits, c->x86_virt_bits); 119 c->x86_phys_bits, c->x86_virt_bits);
120 120
121 seq_printf(m, "power management:"); 121 seq_puts(m, "power management:");
122 for (i = 0; i < 32; i++) { 122 for (i = 0; i < 32; i++) {
123 if (c->x86_power & (1 << i)) { 123 if (c->x86_power & (1 << i)) {
124 if (i < ARRAY_SIZE(x86_power_flags) && 124 if (i < ARRAY_SIZE(x86_power_flags) &&
@@ -131,7 +131,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
131 } 131 }
132 } 132 }
133 133
134 seq_printf(m, "\n\n"); 134 seq_puts(m, "\n\n");
135 135
136 return 0; 136 return 0;
137} 137}
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
index 4a8013d55947..60639093d536 100644
--- a/arch/x86/kernel/cpu/scattered.c
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -36,6 +36,11 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c)
36 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, 36 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 },
37 { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, 37 { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 },
38 { X86_FEATURE_PTS, CR_EAX, 6, 0x00000006, 0 }, 38 { X86_FEATURE_PTS, CR_EAX, 6, 0x00000006, 0 },
39 { X86_FEATURE_HWP, CR_EAX, 7, 0x00000006, 0 },
40 { X86_FEATURE_HWP_NOITFY, CR_EAX, 8, 0x00000006, 0 },
41 { X86_FEATURE_HWP_ACT_WINDOW, CR_EAX, 9, 0x00000006, 0 },
42 { X86_FEATURE_HWP_EPP, CR_EAX,10, 0x00000006, 0 },
43 { X86_FEATURE_HWP_PKG_REQ, CR_EAX,11, 0x00000006, 0 },
39 { X86_FEATURE_APERFMPERF, CR_ECX, 0, 0x00000006, 0 }, 44 { X86_FEATURE_APERFMPERF, CR_ECX, 0, 0x00000006, 0 },
40 { X86_FEATURE_EPB, CR_ECX, 3, 0x00000006, 0 }, 45 { X86_FEATURE_EPB, CR_ECX, 3, 0x00000006, 0 },
41 { X86_FEATURE_HW_PSTATE, CR_EDX, 7, 0x80000007, 0 }, 46 { X86_FEATURE_HW_PSTATE, CR_EDX, 7, 0x80000007, 0 },
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 3225ae6c5180..83741a71558f 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -143,7 +143,7 @@ static int cpuid_device_create(int cpu)
143 143
144 dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu), NULL, 144 dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu), NULL,
145 "cpu%d", cpu); 145 "cpu%d", cpu);
146 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 146 return PTR_ERR_OR_ZERO(dev);
147} 147}
148 148
149static void cpuid_device_destroy(int cpu) 149static void cpuid_device_destroy(int cpu)
diff --git a/arch/x86/kernel/espfix_64.c b/arch/x86/kernel/espfix_64.c
index 94d857fb1033..f5d0730e7b08 100644
--- a/arch/x86/kernel/espfix_64.c
+++ b/arch/x86/kernel/espfix_64.c
@@ -122,9 +122,6 @@ static void init_espfix_random(void)
122void __init init_espfix_bsp(void) 122void __init init_espfix_bsp(void)
123{ 123{
124 pgd_t *pgd_p; 124 pgd_t *pgd_p;
125 pteval_t ptemask;
126
127 ptemask = __supported_pte_mask;
128 125
129 /* Install the espfix pud into the kernel page directory */ 126 /* Install the espfix pud into the kernel page directory */
130 pgd_p = &init_level4_pgt[pgd_index(ESPFIX_BASE_ADDR)]; 127 pgd_p = &init_level4_pgt[pgd_index(ESPFIX_BASE_ADDR)];
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 3386dc9aa333..2142376dc8c6 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -17,6 +17,7 @@
17#include <linux/ftrace.h> 17#include <linux/ftrace.h>
18#include <linux/percpu.h> 18#include <linux/percpu.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/slab.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/list.h> 22#include <linux/list.h>
22#include <linux/module.h> 23#include <linux/module.h>
@@ -47,7 +48,7 @@ int ftrace_arch_code_modify_post_process(void)
47union ftrace_code_union { 48union ftrace_code_union {
48 char code[MCOUNT_INSN_SIZE]; 49 char code[MCOUNT_INSN_SIZE];
49 struct { 50 struct {
50 char e8; 51 unsigned char e8;
51 int offset; 52 int offset;
52 } __attribute__((packed)); 53 } __attribute__((packed));
53}; 54};
@@ -582,7 +583,7 @@ void ftrace_replace_code(int enable)
582 583
583 remove_breakpoints: 584 remove_breakpoints:
584 pr_warn("Failed on %s (%d):\n", report, count); 585 pr_warn("Failed on %s (%d):\n", report, count);
585 ftrace_bug(ret, rec ? rec->ip : 0); 586 ftrace_bug(ret, rec);
586 for_ftrace_rec_iter(iter) { 587 for_ftrace_rec_iter(iter) {
587 rec = ftrace_rec_iter_record(iter); 588 rec = ftrace_rec_iter_record(iter);
588 /* 589 /*
@@ -644,13 +645,8 @@ int __init ftrace_dyn_arch_init(void)
644{ 645{
645 return 0; 646 return 0;
646} 647}
647#endif
648
649#ifdef CONFIG_FUNCTION_GRAPH_TRACER
650
651#ifdef CONFIG_DYNAMIC_FTRACE
652extern void ftrace_graph_call(void);
653 648
649#if defined(CONFIG_X86_64) || defined(CONFIG_FUNCTION_GRAPH_TRACER)
654static unsigned char *ftrace_jmp_replace(unsigned long ip, unsigned long addr) 650static unsigned char *ftrace_jmp_replace(unsigned long ip, unsigned long addr)
655{ 651{
656 static union ftrace_code_union calc; 652 static union ftrace_code_union calc;
@@ -664,6 +660,280 @@ static unsigned char *ftrace_jmp_replace(unsigned long ip, unsigned long addr)
664 */ 660 */
665 return calc.code; 661 return calc.code;
666} 662}
663#endif
664
665/* Currently only x86_64 supports dynamic trampolines */
666#ifdef CONFIG_X86_64
667
668#ifdef CONFIG_MODULES
669#include <linux/moduleloader.h>
670/* Module allocation simplifies allocating memory for code */
671static inline void *alloc_tramp(unsigned long size)
672{
673 return module_alloc(size);
674}
675static inline void tramp_free(void *tramp)
676{
677 module_free(NULL, tramp);
678}
679#else
680/* Trampolines can only be created if modules are supported */
681static inline void *alloc_tramp(unsigned long size)
682{
683 return NULL;
684}
685static inline void tramp_free(void *tramp) { }
686#endif
687
688/* Defined as markers to the end of the ftrace default trampolines */
689extern void ftrace_caller_end(void);
690extern void ftrace_regs_caller_end(void);
691extern void ftrace_return(void);
692extern void ftrace_caller_op_ptr(void);
693extern void ftrace_regs_caller_op_ptr(void);
694
695/* movq function_trace_op(%rip), %rdx */
696/* 0x48 0x8b 0x15 <offset-to-ftrace_trace_op (4 bytes)> */
697#define OP_REF_SIZE 7
698
699/*
700 * The ftrace_ops is passed to the function callback. Since the
701 * trampoline only services a single ftrace_ops, we can pass in
702 * that ops directly.
703 *
704 * The ftrace_op_code_union is used to create a pointer to the
705 * ftrace_ops that will be passed to the callback function.
706 */
707union ftrace_op_code_union {
708 char code[OP_REF_SIZE];
709 struct {
710 char op[3];
711 int offset;
712 } __attribute__((packed));
713};
714
715static unsigned long
716create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
717{
718 unsigned const char *jmp;
719 unsigned long start_offset;
720 unsigned long end_offset;
721 unsigned long op_offset;
722 unsigned long offset;
723 unsigned long size;
724 unsigned long ip;
725 unsigned long *ptr;
726 void *trampoline;
727 /* 48 8b 15 <offset> is movq <offset>(%rip), %rdx */
728 unsigned const char op_ref[] = { 0x48, 0x8b, 0x15 };
729 union ftrace_op_code_union op_ptr;
730 int ret;
731
732 if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
733 start_offset = (unsigned long)ftrace_regs_caller;
734 end_offset = (unsigned long)ftrace_regs_caller_end;
735 op_offset = (unsigned long)ftrace_regs_caller_op_ptr;
736 } else {
737 start_offset = (unsigned long)ftrace_caller;
738 end_offset = (unsigned long)ftrace_caller_end;
739 op_offset = (unsigned long)ftrace_caller_op_ptr;
740 }
741
742 size = end_offset - start_offset;
743
744 /*
745 * Allocate enough size to store the ftrace_caller code,
746 * the jmp to ftrace_return, as well as the address of
747 * the ftrace_ops this trampoline is used for.
748 */
749 trampoline = alloc_tramp(size + MCOUNT_INSN_SIZE + sizeof(void *));
750 if (!trampoline)
751 return 0;
752
753 *tramp_size = size + MCOUNT_INSN_SIZE + sizeof(void *);
754
755 /* Copy ftrace_caller onto the trampoline memory */
756 ret = probe_kernel_read(trampoline, (void *)start_offset, size);
757 if (WARN_ON(ret < 0)) {
758 tramp_free(trampoline);
759 return 0;
760 }
761
762 ip = (unsigned long)trampoline + size;
763
764 /* The trampoline ends with a jmp to ftrace_return */
765 jmp = ftrace_jmp_replace(ip, (unsigned long)ftrace_return);
766 memcpy(trampoline + size, jmp, MCOUNT_INSN_SIZE);
767
768 /*
769 * The address of the ftrace_ops that is used for this trampoline
770 * is stored at the end of the trampoline. This will be used to
771 * load the third parameter for the callback. Basically, that
772 * location at the end of the trampoline takes the place of
773 * the global function_trace_op variable.
774 */
775
776 ptr = (unsigned long *)(trampoline + size + MCOUNT_INSN_SIZE);
777 *ptr = (unsigned long)ops;
778
779 op_offset -= start_offset;
780 memcpy(&op_ptr, trampoline + op_offset, OP_REF_SIZE);
781
782 /* Are we pointing to the reference? */
783 if (WARN_ON(memcmp(op_ptr.op, op_ref, 3) != 0)) {
784 tramp_free(trampoline);
785 return 0;
786 }
787
788 /* Load the contents of ptr into the callback parameter */
789 offset = (unsigned long)ptr;
790 offset -= (unsigned long)trampoline + op_offset + OP_REF_SIZE;
791
792 op_ptr.offset = offset;
793
794 /* put in the new offset to the ftrace_ops */
795 memcpy(trampoline + op_offset, &op_ptr, OP_REF_SIZE);
796
797 /* ALLOC_TRAMP flags lets us know we created it */
798 ops->flags |= FTRACE_OPS_FL_ALLOC_TRAMP;
799
800 return (unsigned long)trampoline;
801}
802
803static unsigned long calc_trampoline_call_offset(bool save_regs)
804{
805 unsigned long start_offset;
806 unsigned long call_offset;
807
808 if (save_regs) {
809 start_offset = (unsigned long)ftrace_regs_caller;
810 call_offset = (unsigned long)ftrace_regs_call;
811 } else {
812 start_offset = (unsigned long)ftrace_caller;
813 call_offset = (unsigned long)ftrace_call;
814 }
815
816 return call_offset - start_offset;
817}
818
819void arch_ftrace_update_trampoline(struct ftrace_ops *ops)
820{
821 ftrace_func_t func;
822 unsigned char *new;
823 unsigned long offset;
824 unsigned long ip;
825 unsigned int size;
826 int ret;
827
828 if (ops->trampoline) {
829 /*
830 * The ftrace_ops caller may set up its own trampoline.
831 * In such a case, this code must not modify it.
832 */
833 if (!(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
834 return;
835 } else {
836 ops->trampoline = create_trampoline(ops, &size);
837 if (!ops->trampoline)
838 return;
839 ops->trampoline_size = size;
840 }
841
842 offset = calc_trampoline_call_offset(ops->flags & FTRACE_OPS_FL_SAVE_REGS);
843 ip = ops->trampoline + offset;
844
845 func = ftrace_ops_get_func(ops);
846
847 /* Do a safe modify in case the trampoline is executing */
848 new = ftrace_call_replace(ip, (unsigned long)func);
849 ret = update_ftrace_func(ip, new);
850
851 /* The update should never fail */
852 WARN_ON(ret);
853}
854
855/* Return the address of the function the trampoline calls */
856static void *addr_from_call(void *ptr)
857{
858 union ftrace_code_union calc;
859 int ret;
860
861 ret = probe_kernel_read(&calc, ptr, MCOUNT_INSN_SIZE);
862 if (WARN_ON_ONCE(ret < 0))
863 return NULL;
864
865 /* Make sure this is a call */
866 if (WARN_ON_ONCE(calc.e8 != 0xe8)) {
867 pr_warn("Expected e8, got %x\n", calc.e8);
868 return NULL;
869 }
870
871 return ptr + MCOUNT_INSN_SIZE + calc.offset;
872}
873
874void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
875 unsigned long frame_pointer);
876
877/*
878 * If the ops->trampoline was not allocated, then it probably
879 * has a static trampoline func, or is the ftrace caller itself.
880 */
881static void *static_tramp_func(struct ftrace_ops *ops, struct dyn_ftrace *rec)
882{
883 unsigned long offset;
884 bool save_regs = rec->flags & FTRACE_FL_REGS_EN;
885 void *ptr;
886
887 if (ops && ops->trampoline) {
888#ifdef CONFIG_FUNCTION_GRAPH_TRACER
889 /*
890 * We only know about function graph tracer setting as static
891 * trampoline.
892 */
893 if (ops->trampoline == FTRACE_GRAPH_ADDR)
894 return (void *)prepare_ftrace_return;
895#endif
896 return NULL;
897 }
898
899 offset = calc_trampoline_call_offset(save_regs);
900
901 if (save_regs)
902 ptr = (void *)FTRACE_REGS_ADDR + offset;
903 else
904 ptr = (void *)FTRACE_ADDR + offset;
905
906 return addr_from_call(ptr);
907}
908
909void *arch_ftrace_trampoline_func(struct ftrace_ops *ops, struct dyn_ftrace *rec)
910{
911 unsigned long offset;
912
913 /* If we didn't allocate this trampoline, consider it static */
914 if (!ops || !(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
915 return static_tramp_func(ops, rec);
916
917 offset = calc_trampoline_call_offset(ops->flags & FTRACE_OPS_FL_SAVE_REGS);
918 return addr_from_call((void *)ops->trampoline + offset);
919}
920
921void arch_ftrace_trampoline_free(struct ftrace_ops *ops)
922{
923 if (!ops || !(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
924 return;
925
926 tramp_free((void *)ops->trampoline);
927 ops->trampoline = 0;
928}
929
930#endif /* CONFIG_X86_64 */
931#endif /* CONFIG_DYNAMIC_FTRACE */
932
933#ifdef CONFIG_FUNCTION_GRAPH_TRACER
934
935#ifdef CONFIG_DYNAMIC_FTRACE
936extern void ftrace_graph_call(void);
667 937
668static int ftrace_mod_jmp(unsigned long ip, void *func) 938static int ftrace_mod_jmp(unsigned long ip, void *func)
669{ 939{
@@ -694,7 +964,7 @@ int ftrace_disable_ftrace_graph_caller(void)
694 * Hook the return address and push it in the stack of return addrs 964 * Hook the return address and push it in the stack of return addrs
695 * in current thread info. 965 * in current thread info.
696 */ 966 */
697void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, 967void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
698 unsigned long frame_pointer) 968 unsigned long frame_pointer)
699{ 969{
700 unsigned long old; 970 unsigned long old;
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 922d28581024..6307a0f0cf17 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -59,78 +59,78 @@ int arch_show_interrupts(struct seq_file *p, int prec)
59 seq_printf(p, "%*s: ", prec, "NMI"); 59 seq_printf(p, "%*s: ", prec, "NMI");
60 for_each_online_cpu(j) 60 for_each_online_cpu(j)
61 seq_printf(p, "%10u ", irq_stats(j)->__nmi_count); 61 seq_printf(p, "%10u ", irq_stats(j)->__nmi_count);
62 seq_printf(p, " Non-maskable interrupts\n"); 62 seq_puts(p, " Non-maskable interrupts\n");
63#ifdef CONFIG_X86_LOCAL_APIC 63#ifdef CONFIG_X86_LOCAL_APIC
64 seq_printf(p, "%*s: ", prec, "LOC"); 64 seq_printf(p, "%*s: ", prec, "LOC");
65 for_each_online_cpu(j) 65 for_each_online_cpu(j)
66 seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs); 66 seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs);
67 seq_printf(p, " Local timer interrupts\n"); 67 seq_puts(p, " Local timer interrupts\n");
68 68
69 seq_printf(p, "%*s: ", prec, "SPU"); 69 seq_printf(p, "%*s: ", prec, "SPU");
70 for_each_online_cpu(j) 70 for_each_online_cpu(j)
71 seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count); 71 seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count);
72 seq_printf(p, " Spurious interrupts\n"); 72 seq_puts(p, " Spurious interrupts\n");
73 seq_printf(p, "%*s: ", prec, "PMI"); 73 seq_printf(p, "%*s: ", prec, "PMI");
74 for_each_online_cpu(j) 74 for_each_online_cpu(j)
75 seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs); 75 seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs);
76 seq_printf(p, " Performance monitoring interrupts\n"); 76 seq_puts(p, " Performance monitoring interrupts\n");
77 seq_printf(p, "%*s: ", prec, "IWI"); 77 seq_printf(p, "%*s: ", prec, "IWI");
78 for_each_online_cpu(j) 78 for_each_online_cpu(j)
79 seq_printf(p, "%10u ", irq_stats(j)->apic_irq_work_irqs); 79 seq_printf(p, "%10u ", irq_stats(j)->apic_irq_work_irqs);
80 seq_printf(p, " IRQ work interrupts\n"); 80 seq_puts(p, " IRQ work interrupts\n");
81 seq_printf(p, "%*s: ", prec, "RTR"); 81 seq_printf(p, "%*s: ", prec, "RTR");
82 for_each_online_cpu(j) 82 for_each_online_cpu(j)
83 seq_printf(p, "%10u ", irq_stats(j)->icr_read_retry_count); 83 seq_printf(p, "%10u ", irq_stats(j)->icr_read_retry_count);
84 seq_printf(p, " APIC ICR read retries\n"); 84 seq_puts(p, " APIC ICR read retries\n");
85#endif 85#endif
86 if (x86_platform_ipi_callback) { 86 if (x86_platform_ipi_callback) {
87 seq_printf(p, "%*s: ", prec, "PLT"); 87 seq_printf(p, "%*s: ", prec, "PLT");
88 for_each_online_cpu(j) 88 for_each_online_cpu(j)
89 seq_printf(p, "%10u ", irq_stats(j)->x86_platform_ipis); 89 seq_printf(p, "%10u ", irq_stats(j)->x86_platform_ipis);
90 seq_printf(p, " Platform interrupts\n"); 90 seq_puts(p, " Platform interrupts\n");
91 } 91 }
92#ifdef CONFIG_SMP 92#ifdef CONFIG_SMP
93 seq_printf(p, "%*s: ", prec, "RES"); 93 seq_printf(p, "%*s: ", prec, "RES");
94 for_each_online_cpu(j) 94 for_each_online_cpu(j)
95 seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count); 95 seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count);
96 seq_printf(p, " Rescheduling interrupts\n"); 96 seq_puts(p, " Rescheduling interrupts\n");
97 seq_printf(p, "%*s: ", prec, "CAL"); 97 seq_printf(p, "%*s: ", prec, "CAL");
98 for_each_online_cpu(j) 98 for_each_online_cpu(j)
99 seq_printf(p, "%10u ", irq_stats(j)->irq_call_count - 99 seq_printf(p, "%10u ", irq_stats(j)->irq_call_count -
100 irq_stats(j)->irq_tlb_count); 100 irq_stats(j)->irq_tlb_count);
101 seq_printf(p, " Function call interrupts\n"); 101 seq_puts(p, " Function call interrupts\n");
102 seq_printf(p, "%*s: ", prec, "TLB"); 102 seq_printf(p, "%*s: ", prec, "TLB");
103 for_each_online_cpu(j) 103 for_each_online_cpu(j)
104 seq_printf(p, "%10u ", irq_stats(j)->irq_tlb_count); 104 seq_printf(p, "%10u ", irq_stats(j)->irq_tlb_count);
105 seq_printf(p, " TLB shootdowns\n"); 105 seq_puts(p, " TLB shootdowns\n");
106#endif 106#endif
107#ifdef CONFIG_X86_THERMAL_VECTOR 107#ifdef CONFIG_X86_THERMAL_VECTOR
108 seq_printf(p, "%*s: ", prec, "TRM"); 108 seq_printf(p, "%*s: ", prec, "TRM");
109 for_each_online_cpu(j) 109 for_each_online_cpu(j)
110 seq_printf(p, "%10u ", irq_stats(j)->irq_thermal_count); 110 seq_printf(p, "%10u ", irq_stats(j)->irq_thermal_count);
111 seq_printf(p, " Thermal event interrupts\n"); 111 seq_puts(p, " Thermal event interrupts\n");
112#endif 112#endif
113#ifdef CONFIG_X86_MCE_THRESHOLD 113#ifdef CONFIG_X86_MCE_THRESHOLD
114 seq_printf(p, "%*s: ", prec, "THR"); 114 seq_printf(p, "%*s: ", prec, "THR");
115 for_each_online_cpu(j) 115 for_each_online_cpu(j)
116 seq_printf(p, "%10u ", irq_stats(j)->irq_threshold_count); 116 seq_printf(p, "%10u ", irq_stats(j)->irq_threshold_count);
117 seq_printf(p, " Threshold APIC interrupts\n"); 117 seq_puts(p, " Threshold APIC interrupts\n");
118#endif 118#endif
119#ifdef CONFIG_X86_MCE 119#ifdef CONFIG_X86_MCE
120 seq_printf(p, "%*s: ", prec, "MCE"); 120 seq_printf(p, "%*s: ", prec, "MCE");
121 for_each_online_cpu(j) 121 for_each_online_cpu(j)
122 seq_printf(p, "%10u ", per_cpu(mce_exception_count, j)); 122 seq_printf(p, "%10u ", per_cpu(mce_exception_count, j));
123 seq_printf(p, " Machine check exceptions\n"); 123 seq_puts(p, " Machine check exceptions\n");
124 seq_printf(p, "%*s: ", prec, "MCP"); 124 seq_printf(p, "%*s: ", prec, "MCP");
125 for_each_online_cpu(j) 125 for_each_online_cpu(j)
126 seq_printf(p, "%10u ", per_cpu(mce_poll_count, j)); 126 seq_printf(p, "%10u ", per_cpu(mce_poll_count, j));
127 seq_printf(p, " Machine check polls\n"); 127 seq_puts(p, " Machine check polls\n");
128#endif 128#endif
129#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN) 129#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
130 seq_printf(p, "%*s: ", prec, "THR"); 130 seq_printf(p, "%*s: ", prec, "THR");
131 for_each_online_cpu(j) 131 for_each_online_cpu(j)
132 seq_printf(p, "%10u ", irq_stats(j)->irq_hv_callback_count); 132 seq_printf(p, "%10u ", irq_stats(j)->irq_hv_callback_count);
133 seq_printf(p, " Hypervisor callback interrupts\n"); 133 seq_puts(p, " Hypervisor callback interrupts\n");
134#endif 134#endif
135 seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count)); 135 seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
136#if defined(CONFIG_X86_IO_APIC) 136#if defined(CONFIG_X86_IO_APIC)
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 67e6d19ef1be..f7e3cd50ece0 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -285,7 +285,7 @@ static int can_probe(unsigned long paddr)
285 * normally used, we just go through if there is no kprobe. 285 * normally used, we just go through if there is no kprobe.
286 */ 286 */
287 __addr = recover_probed_instruction(buf, addr); 287 __addr = recover_probed_instruction(buf, addr);
288 kernel_insn_init(&insn, (void *)__addr); 288 kernel_insn_init(&insn, (void *)__addr, MAX_INSN_SIZE);
289 insn_get_length(&insn); 289 insn_get_length(&insn);
290 290
291 /* 291 /*
@@ -330,8 +330,10 @@ int __copy_instruction(u8 *dest, u8 *src)
330{ 330{
331 struct insn insn; 331 struct insn insn;
332 kprobe_opcode_t buf[MAX_INSN_SIZE]; 332 kprobe_opcode_t buf[MAX_INSN_SIZE];
333 unsigned long recovered_insn =
334 recover_probed_instruction(buf, (unsigned long)src);
333 335
334 kernel_insn_init(&insn, (void *)recover_probed_instruction(buf, (unsigned long)src)); 336 kernel_insn_init(&insn, (void *)recovered_insn, MAX_INSN_SIZE);
335 insn_get_length(&insn); 337 insn_get_length(&insn);
336 /* Another subsystem puts a breakpoint, failed to recover */ 338 /* Another subsystem puts a breakpoint, failed to recover */
337 if (insn.opcode.bytes[0] == BREAKPOINT_INSTRUCTION) 339 if (insn.opcode.bytes[0] == BREAKPOINT_INSTRUCTION)
@@ -342,7 +344,7 @@ int __copy_instruction(u8 *dest, u8 *src)
342 if (insn_rip_relative(&insn)) { 344 if (insn_rip_relative(&insn)) {
343 s64 newdisp; 345 s64 newdisp;
344 u8 *disp; 346 u8 *disp;
345 kernel_insn_init(&insn, dest); 347 kernel_insn_init(&insn, dest, insn.length);
346 insn_get_displacement(&insn); 348 insn_get_displacement(&insn);
347 /* 349 /*
348 * The copied instruction uses the %rip-relative addressing 350 * The copied instruction uses the %rip-relative addressing
diff --git a/arch/x86/kernel/kprobes/ftrace.c b/arch/x86/kernel/kprobes/ftrace.c
index 717b02a22e67..5f8f0b3cc674 100644
--- a/arch/x86/kernel/kprobes/ftrace.c
+++ b/arch/x86/kernel/kprobes/ftrace.c
@@ -27,7 +27,7 @@
27 27
28static nokprobe_inline 28static nokprobe_inline
29int __skip_singlestep(struct kprobe *p, struct pt_regs *regs, 29int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
30 struct kprobe_ctlblk *kcb) 30 struct kprobe_ctlblk *kcb, unsigned long orig_ip)
31{ 31{
32 /* 32 /*
33 * Emulate singlestep (and also recover regs->ip) 33 * Emulate singlestep (and also recover regs->ip)
@@ -39,6 +39,8 @@ int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
39 p->post_handler(p, regs, 0); 39 p->post_handler(p, regs, 0);
40 } 40 }
41 __this_cpu_write(current_kprobe, NULL); 41 __this_cpu_write(current_kprobe, NULL);
42 if (orig_ip)
43 regs->ip = orig_ip;
42 return 1; 44 return 1;
43} 45}
44 46
@@ -46,7 +48,7 @@ int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
46 struct kprobe_ctlblk *kcb) 48 struct kprobe_ctlblk *kcb)
47{ 49{
48 if (kprobe_ftrace(p)) 50 if (kprobe_ftrace(p))
49 return __skip_singlestep(p, regs, kcb); 51 return __skip_singlestep(p, regs, kcb, 0);
50 else 52 else
51 return 0; 53 return 0;
52} 54}
@@ -71,13 +73,14 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
71 if (kprobe_running()) { 73 if (kprobe_running()) {
72 kprobes_inc_nmissed_count(p); 74 kprobes_inc_nmissed_count(p);
73 } else { 75 } else {
76 unsigned long orig_ip = regs->ip;
74 /* Kprobe handler expects regs->ip = ip + 1 as breakpoint hit */ 77 /* Kprobe handler expects regs->ip = ip + 1 as breakpoint hit */
75 regs->ip = ip + sizeof(kprobe_opcode_t); 78 regs->ip = ip + sizeof(kprobe_opcode_t);
76 79
77 __this_cpu_write(current_kprobe, p); 80 __this_cpu_write(current_kprobe, p);
78 kcb->kprobe_status = KPROBE_HIT_ACTIVE; 81 kcb->kprobe_status = KPROBE_HIT_ACTIVE;
79 if (!p->pre_handler || !p->pre_handler(p, regs)) 82 if (!p->pre_handler || !p->pre_handler(p, regs))
80 __skip_singlestep(p, regs, kcb); 83 __skip_singlestep(p, regs, kcb, orig_ip);
81 /* 84 /*
82 * If pre_handler returns !0, it sets regs->ip and 85 * If pre_handler returns !0, it sets regs->ip and
83 * resets current kprobe. 86 * resets current kprobe.
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index f1314d0bcf0a..7c523bbf3dc8 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -251,13 +251,15 @@ static int can_optimize(unsigned long paddr)
251 /* Decode instructions */ 251 /* Decode instructions */
252 addr = paddr - offset; 252 addr = paddr - offset;
253 while (addr < paddr - offset + size) { /* Decode until function end */ 253 while (addr < paddr - offset + size) { /* Decode until function end */
254 unsigned long recovered_insn;
254 if (search_exception_tables(addr)) 255 if (search_exception_tables(addr))
255 /* 256 /*
256 * Since some fixup code will jumps into this function, 257 * Since some fixup code will jumps into this function,
257 * we can't optimize kprobe in this function. 258 * we can't optimize kprobe in this function.
258 */ 259 */
259 return 0; 260 return 0;
260 kernel_insn_init(&insn, (void *)recover_probed_instruction(buf, addr)); 261 recovered_insn = recover_probed_instruction(buf, addr);
262 kernel_insn_init(&insn, (void *)recovered_insn, MAX_INSN_SIZE);
261 insn_get_length(&insn); 263 insn_get_length(&insn);
262 /* Another subsystem puts a breakpoint */ 264 /* Another subsystem puts a breakpoint */
263 if (insn.opcode.bytes[0] == BREAKPOINT_INSTRUCTION) 265 if (insn.opcode.bytes[0] == BREAKPOINT_INSTRUCTION)
diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
index c73aecf10d34..94ea120fa21f 100644
--- a/arch/x86/kernel/mcount_64.S
+++ b/arch/x86/kernel/mcount_64.S
@@ -21,40 +21,159 @@
21# define function_hook mcount 21# define function_hook mcount
22#endif 22#endif
23 23
24/* All cases save the original rbp (8 bytes) */
25#ifdef CONFIG_FRAME_POINTER
26# ifdef CC_USING_FENTRY
27/* Save parent and function stack frames (rip and rbp) */
28# define MCOUNT_FRAME_SIZE (8+16*2)
29# else
30/* Save just function stack frame (rip and rbp) */
31# define MCOUNT_FRAME_SIZE (8+16)
32# endif
33#else
34/* No need to save a stack frame */
35# define MCOUNT_FRAME_SIZE 8
36#endif /* CONFIG_FRAME_POINTER */
37
38/* Size of stack used to save mcount regs in save_mcount_regs */
39#define MCOUNT_REG_SIZE (SS+8 + MCOUNT_FRAME_SIZE)
40
41/*
42 * gcc -pg option adds a call to 'mcount' in most functions.
43 * When -mfentry is used, the call is to 'fentry' and not 'mcount'
44 * and is done before the function's stack frame is set up.
45 * They both require a set of regs to be saved before calling
46 * any C code and restored before returning back to the function.
47 *
48 * On boot up, all these calls are converted into nops. When tracing
49 * is enabled, the call can jump to either ftrace_caller or
50 * ftrace_regs_caller. Callbacks (tracing functions) that require
51 * ftrace_regs_caller (like kprobes) need to have pt_regs passed to
52 * it. For this reason, the size of the pt_regs structure will be
53 * allocated on the stack and the required mcount registers will
54 * be saved in the locations that pt_regs has them in.
55 */
56
57/*
58 * @added: the amount of stack added before calling this
59 *
60 * After this is called, the following registers contain:
61 *
62 * %rdi - holds the address that called the trampoline
63 * %rsi - holds the parent function (traced function's return address)
64 * %rdx - holds the original %rbp
65 */
66.macro save_mcount_regs added=0
67
68 /* Always save the original rbp */
69 pushq %rbp
70
71#ifdef CONFIG_FRAME_POINTER
72 /*
73 * Stack traces will stop at the ftrace trampoline if the frame pointer
74 * is not set up properly. If fentry is used, we need to save a frame
75 * pointer for the parent as well as the function traced, because the
76 * fentry is called before the stack frame is set up, where as mcount
77 * is called afterward.
78 */
79#ifdef CC_USING_FENTRY
80 /* Save the parent pointer (skip orig rbp and our return address) */
81 pushq \added+8*2(%rsp)
82 pushq %rbp
83 movq %rsp, %rbp
84 /* Save the return address (now skip orig rbp, rbp and parent) */
85 pushq \added+8*3(%rsp)
86#else
87 /* Can't assume that rip is before this (unless added was zero) */
88 pushq \added+8(%rsp)
89#endif
90 pushq %rbp
91 movq %rsp, %rbp
92#endif /* CONFIG_FRAME_POINTER */
93
94 /*
95 * We add enough stack to save all regs.
96 */
97 subq $(MCOUNT_REG_SIZE - MCOUNT_FRAME_SIZE), %rsp
98 movq %rax, RAX(%rsp)
99 movq %rcx, RCX(%rsp)
100 movq %rdx, RDX(%rsp)
101 movq %rsi, RSI(%rsp)
102 movq %rdi, RDI(%rsp)
103 movq %r8, R8(%rsp)
104 movq %r9, R9(%rsp)
105 /*
106 * Save the original RBP. Even though the mcount ABI does not
107 * require this, it helps out callers.
108 */
109 movq MCOUNT_REG_SIZE-8(%rsp), %rdx
110 movq %rdx, RBP(%rsp)
111
112 /* Copy the parent address into %rsi (second parameter) */
113#ifdef CC_USING_FENTRY
114 movq MCOUNT_REG_SIZE+8+\added(%rsp), %rsi
115#else
116 /* %rdx contains original %rbp */
117 movq 8(%rdx), %rsi
118#endif
119
120 /* Move RIP to its proper location */
121 movq MCOUNT_REG_SIZE+\added(%rsp), %rdi
122 movq %rdi, RIP(%rsp)
123
124 /*
125 * Now %rdi (the first parameter) has the return address of
126 * where ftrace_call returns. But the callbacks expect the
127 * address of the call itself.
128 */
129 subq $MCOUNT_INSN_SIZE, %rdi
130 .endm
131
132.macro restore_mcount_regs
133 movq R9(%rsp), %r9
134 movq R8(%rsp), %r8
135 movq RDI(%rsp), %rdi
136 movq RSI(%rsp), %rsi
137 movq RDX(%rsp), %rdx
138 movq RCX(%rsp), %rcx
139 movq RAX(%rsp), %rax
140
141 /* ftrace_regs_caller can modify %rbp */
142 movq RBP(%rsp), %rbp
143
144 addq $MCOUNT_REG_SIZE, %rsp
145
146 .endm
147
24#ifdef CONFIG_DYNAMIC_FTRACE 148#ifdef CONFIG_DYNAMIC_FTRACE
25 149
26ENTRY(function_hook) 150ENTRY(function_hook)
27 retq 151 retq
28END(function_hook) 152END(function_hook)
29 153
30/* skip is set if stack has been adjusted */ 154ENTRY(ftrace_caller)
31.macro ftrace_caller_setup skip=0 155 /* save_mcount_regs fills in first two parameters */
32 MCOUNT_SAVE_FRAME \skip 156 save_mcount_regs
33 157
158GLOBAL(ftrace_caller_op_ptr)
34 /* Load the ftrace_ops into the 3rd parameter */ 159 /* Load the ftrace_ops into the 3rd parameter */
35 movq function_trace_op(%rip), %rdx 160 movq function_trace_op(%rip), %rdx
36 161
37 /* Load ip into the first parameter */
38 movq RIP(%rsp), %rdi
39 subq $MCOUNT_INSN_SIZE, %rdi
40 /* Load the parent_ip into the second parameter */
41#ifdef CC_USING_FENTRY
42 movq SS+16(%rsp), %rsi
43#else
44 movq 8(%rbp), %rsi
45#endif
46.endm
47
48ENTRY(ftrace_caller)
49 ftrace_caller_setup
50 /* regs go into 4th parameter (but make it NULL) */ 162 /* regs go into 4th parameter (but make it NULL) */
51 movq $0, %rcx 163 movq $0, %rcx
52 164
53GLOBAL(ftrace_call) 165GLOBAL(ftrace_call)
54 call ftrace_stub 166 call ftrace_stub
55 167
56 MCOUNT_RESTORE_FRAME 168 restore_mcount_regs
57ftrace_return: 169
170 /*
171 * The copied trampoline must call ftrace_return as it
172 * still may need to call the function graph tracer.
173 */
174GLOBAL(ftrace_caller_end)
175
176GLOBAL(ftrace_return)
58 177
59#ifdef CONFIG_FUNCTION_GRAPH_TRACER 178#ifdef CONFIG_FUNCTION_GRAPH_TRACER
60GLOBAL(ftrace_graph_call) 179GLOBAL(ftrace_graph_call)
@@ -66,11 +185,16 @@ GLOBAL(ftrace_stub)
66END(ftrace_caller) 185END(ftrace_caller)
67 186
68ENTRY(ftrace_regs_caller) 187ENTRY(ftrace_regs_caller)
69 /* Save the current flags before compare (in SS location)*/ 188 /* Save the current flags before any operations that can change them */
70 pushfq 189 pushfq
71 190
72 /* skip=8 to skip flags saved in SS */ 191 /* added 8 bytes to save flags */
73 ftrace_caller_setup 8 192 save_mcount_regs 8
193 /* save_mcount_regs fills in first two parameters */
194
195GLOBAL(ftrace_regs_caller_op_ptr)
196 /* Load the ftrace_ops into the 3rd parameter */
197 movq function_trace_op(%rip), %rdx
74 198
75 /* Save the rest of pt_regs */ 199 /* Save the rest of pt_regs */
76 movq %r15, R15(%rsp) 200 movq %r15, R15(%rsp)
@@ -79,18 +203,17 @@ ENTRY(ftrace_regs_caller)
79 movq %r12, R12(%rsp) 203 movq %r12, R12(%rsp)
80 movq %r11, R11(%rsp) 204 movq %r11, R11(%rsp)
81 movq %r10, R10(%rsp) 205 movq %r10, R10(%rsp)
82 movq %rbp, RBP(%rsp)
83 movq %rbx, RBX(%rsp) 206 movq %rbx, RBX(%rsp)
84 /* Copy saved flags */ 207 /* Copy saved flags */
85 movq SS(%rsp), %rcx 208 movq MCOUNT_REG_SIZE(%rsp), %rcx
86 movq %rcx, EFLAGS(%rsp) 209 movq %rcx, EFLAGS(%rsp)
87 /* Kernel segments */ 210 /* Kernel segments */
88 movq $__KERNEL_DS, %rcx 211 movq $__KERNEL_DS, %rcx
89 movq %rcx, SS(%rsp) 212 movq %rcx, SS(%rsp)
90 movq $__KERNEL_CS, %rcx 213 movq $__KERNEL_CS, %rcx
91 movq %rcx, CS(%rsp) 214 movq %rcx, CS(%rsp)
92 /* Stack - skipping return address */ 215 /* Stack - skipping return address and flags */
93 leaq SS+16(%rsp), %rcx 216 leaq MCOUNT_REG_SIZE+8*2(%rsp), %rcx
94 movq %rcx, RSP(%rsp) 217 movq %rcx, RSP(%rsp)
95 218
96 /* regs go into 4th parameter */ 219 /* regs go into 4th parameter */
@@ -101,11 +224,11 @@ GLOBAL(ftrace_regs_call)
101 224
102 /* Copy flags back to SS, to restore them */ 225 /* Copy flags back to SS, to restore them */
103 movq EFLAGS(%rsp), %rax 226 movq EFLAGS(%rsp), %rax
104 movq %rax, SS(%rsp) 227 movq %rax, MCOUNT_REG_SIZE(%rsp)
105 228
106 /* Handlers can change the RIP */ 229 /* Handlers can change the RIP */
107 movq RIP(%rsp), %rax 230 movq RIP(%rsp), %rax
108 movq %rax, SS+8(%rsp) 231 movq %rax, MCOUNT_REG_SIZE+8(%rsp)
109 232
110 /* restore the rest of pt_regs */ 233 /* restore the rest of pt_regs */
111 movq R15(%rsp), %r15 234 movq R15(%rsp), %r15
@@ -113,19 +236,22 @@ GLOBAL(ftrace_regs_call)
113 movq R13(%rsp), %r13 236 movq R13(%rsp), %r13
114 movq R12(%rsp), %r12 237 movq R12(%rsp), %r12
115 movq R10(%rsp), %r10 238 movq R10(%rsp), %r10
116 movq RBP(%rsp), %rbp
117 movq RBX(%rsp), %rbx 239 movq RBX(%rsp), %rbx
118 240
119 /* skip=8 to skip flags saved in SS */ 241 restore_mcount_regs
120 MCOUNT_RESTORE_FRAME 8
121 242
122 /* Restore flags */ 243 /* Restore flags */
123 popfq 244 popfq
124 245
125 jmp ftrace_return 246 /*
247 * As this jmp to ftrace_return can be a short jump
248 * it must not be copied into the trampoline.
249 * The trampoline will add the code to jump
250 * to the return.
251 */
252GLOBAL(ftrace_regs_caller_end)
126 253
127 popfq 254 jmp ftrace_return
128 jmp ftrace_stub
129 255
130END(ftrace_regs_caller) 256END(ftrace_regs_caller)
131 257
@@ -136,6 +262,7 @@ ENTRY(function_hook)
136 cmpq $ftrace_stub, ftrace_trace_function 262 cmpq $ftrace_stub, ftrace_trace_function
137 jnz trace 263 jnz trace
138 264
265fgraph_trace:
139#ifdef CONFIG_FUNCTION_GRAPH_TRACER 266#ifdef CONFIG_FUNCTION_GRAPH_TRACER
140 cmpq $ftrace_stub, ftrace_graph_return 267 cmpq $ftrace_stub, ftrace_graph_return
141 jnz ftrace_graph_caller 268 jnz ftrace_graph_caller
@@ -148,42 +275,35 @@ GLOBAL(ftrace_stub)
148 retq 275 retq
149 276
150trace: 277trace:
151 MCOUNT_SAVE_FRAME 278 /* save_mcount_regs fills in first two parameters */
152 279 save_mcount_regs
153 movq RIP(%rsp), %rdi
154#ifdef CC_USING_FENTRY
155 movq SS+16(%rsp), %rsi
156#else
157 movq 8(%rbp), %rsi
158#endif
159 subq $MCOUNT_INSN_SIZE, %rdi
160 280
161 call *ftrace_trace_function 281 call *ftrace_trace_function
162 282
163 MCOUNT_RESTORE_FRAME 283 restore_mcount_regs
164 284
165 jmp ftrace_stub 285 jmp fgraph_trace
166END(function_hook) 286END(function_hook)
167#endif /* CONFIG_DYNAMIC_FTRACE */ 287#endif /* CONFIG_DYNAMIC_FTRACE */
168#endif /* CONFIG_FUNCTION_TRACER */ 288#endif /* CONFIG_FUNCTION_TRACER */
169 289
170#ifdef CONFIG_FUNCTION_GRAPH_TRACER 290#ifdef CONFIG_FUNCTION_GRAPH_TRACER
171ENTRY(ftrace_graph_caller) 291ENTRY(ftrace_graph_caller)
172 MCOUNT_SAVE_FRAME 292 /* Saves rbp into %rdx and fills first parameter */
293 save_mcount_regs
173 294
174#ifdef CC_USING_FENTRY 295#ifdef CC_USING_FENTRY
175 leaq SS+16(%rsp), %rdi 296 leaq MCOUNT_REG_SIZE+8(%rsp), %rsi
176 movq $0, %rdx /* No framepointers needed */ 297 movq $0, %rdx /* No framepointers needed */
177#else 298#else
178 leaq 8(%rbp), %rdi 299 /* Save address of the return address of traced function */
179 movq (%rbp), %rdx 300 leaq 8(%rdx), %rsi
301 /* ftrace does sanity checks against frame pointers */
302 movq (%rdx), %rdx
180#endif 303#endif
181 movq RIP(%rsp), %rsi
182 subq $MCOUNT_INSN_SIZE, %rsi
183
184 call prepare_ftrace_return 304 call prepare_ftrace_return
185 305
186 MCOUNT_RESTORE_FRAME 306 restore_mcount_regs
187 307
188 retq 308 retq
189END(ftrace_graph_caller) 309END(ftrace_graph_caller)
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index c9603ac80de5..113e70784854 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -22,6 +22,8 @@
22 * an SMP box will direct the access to CPU %d. 22 * an SMP box will direct the access to CPU %d.
23 */ 23 */
24 24
25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26
25#include <linux/module.h> 27#include <linux/module.h>
26 28
27#include <linux/types.h> 29#include <linux/types.h>
@@ -50,11 +52,11 @@ static loff_t msr_seek(struct file *file, loff_t offset, int orig)
50 52
51 mutex_lock(&inode->i_mutex); 53 mutex_lock(&inode->i_mutex);
52 switch (orig) { 54 switch (orig) {
53 case 0: 55 case SEEK_SET:
54 file->f_pos = offset; 56 file->f_pos = offset;
55 ret = file->f_pos; 57 ret = file->f_pos;
56 break; 58 break;
57 case 1: 59 case SEEK_CUR:
58 file->f_pos += offset; 60 file->f_pos += offset;
59 ret = file->f_pos; 61 ret = file->f_pos;
60 break; 62 break;
@@ -206,7 +208,7 @@ static int msr_device_create(int cpu)
206 208
207 dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, cpu), NULL, 209 dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, cpu), NULL,
208 "msr%d", cpu); 210 "msr%d", cpu);
209 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 211 return PTR_ERR_OR_ZERO(dev);
210} 212}
211 213
212static void msr_device_destroy(int cpu) 214static void msr_device_destroy(int cpu)
@@ -248,8 +250,7 @@ static int __init msr_init(void)
248 i = 0; 250 i = 0;
249 251
250 if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) { 252 if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) {
251 printk(KERN_ERR "msr: unable to get major %d for msr\n", 253 pr_err("unable to get major %d for msr\n", MSR_MAJOR);
252 MSR_MAJOR);
253 err = -EBUSY; 254 err = -EBUSY;
254 goto out; 255 goto out;
255 } 256 }
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index ab08aa2276fb..ab4734e5411d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -960,6 +960,8 @@ void __init setup_arch(char **cmdline_p)
960 init_mm.end_data = (unsigned long) _edata; 960 init_mm.end_data = (unsigned long) _edata;
961 init_mm.brk = _brk_end; 961 init_mm.brk = _brk_end;
962 962
963 mpx_mm_init(&init_mm);
964
963 code_resource.start = __pa_symbol(_text); 965 code_resource.start = __pa_symbol(_text);
964 code_resource.end = __pa_symbol(_etext)-1; 966 code_resource.end = __pa_symbol(_etext)-1;
965 data_resource.start = __pa_symbol(_etext); 967 data_resource.start = __pa_symbol(_etext);
@@ -1190,9 +1192,7 @@ void __init setup_arch(char **cmdline_p)
1190 1192
1191 tboot_probe(); 1193 tboot_probe();
1192 1194
1193#ifdef CONFIG_X86_64
1194 map_vsyscall(); 1195 map_vsyscall();
1195#endif
1196 1196
1197 generic_apic_probe(); 1197 generic_apic_probe();
1198 1198
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 5cdff0357746..e4fcb87ba7a6 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -30,7 +30,7 @@ EXPORT_PER_CPU_SYMBOL(cpu_number);
30#define BOOT_PERCPU_OFFSET 0 30#define BOOT_PERCPU_OFFSET 0
31#endif 31#endif
32 32
33DEFINE_PER_CPU(unsigned long, this_cpu_off) = BOOT_PERCPU_OFFSET; 33DEFINE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off) = BOOT_PERCPU_OFFSET;
34EXPORT_PER_CPU_SYMBOL(this_cpu_off); 34EXPORT_PER_CPU_SYMBOL(this_cpu_off);
35 35
36unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = { 36unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = {
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 668d8f2a8781..7a8f5845e8eb 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -99,7 +99,7 @@ EXPORT_PER_CPU_SYMBOL(cpu_core_map);
99DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map); 99DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map);
100 100
101/* Per CPU bogomips and other parameters */ 101/* Per CPU bogomips and other parameters */
102DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); 102DEFINE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
103EXPORT_PER_CPU_SYMBOL(cpu_info); 103EXPORT_PER_CPU_SYMBOL(cpu_info);
104 104
105atomic_t init_deasserted; 105atomic_t init_deasserted;
diff --git a/arch/x86/kernel/sysfb.c b/arch/x86/kernel/sysfb.c
index 193ec2ce46c7..160386e9fc17 100644
--- a/arch/x86/kernel/sysfb.c
+++ b/arch/x86/kernel/sysfb.c
@@ -67,7 +67,7 @@ static __init int sysfb_init(void)
67 67
68 pd = platform_device_register_resndata(NULL, name, 0, 68 pd = platform_device_register_resndata(NULL, name, 0,
69 NULL, 0, si, sizeof(*si)); 69 NULL, 0, si, sizeof(*si));
70 return IS_ERR(pd) ? PTR_ERR(pd) : 0; 70 return PTR_ERR_OR_ZERO(pd);
71} 71}
72 72
73/* must execute after PCI subsystem for EFI quirks */ 73/* must execute after PCI subsystem for EFI quirks */
diff --git a/arch/x86/kernel/sysfb_simplefb.c b/arch/x86/kernel/sysfb_simplefb.c
index 86179d409893..764a29f84de7 100644
--- a/arch/x86/kernel/sysfb_simplefb.c
+++ b/arch/x86/kernel/sysfb_simplefb.c
@@ -88,8 +88,5 @@ __init int create_simplefb(const struct screen_info *si,
88 88
89 pd = platform_device_register_resndata(NULL, "simple-framebuffer", 0, 89 pd = platform_device_register_resndata(NULL, "simple-framebuffer", 0,
90 &res, 1, mode, sizeof(*mode)); 90 &res, 1, mode, sizeof(*mode));
91 if (IS_ERR(pd)) 91 return PTR_ERR_OR_ZERO(pd);
92 return PTR_ERR(pd);
93
94 return 0;
95} 92}
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index 0fa29609b2c4..25adc0e16eaa 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -23,7 +23,7 @@
23#include <asm/time.h> 23#include <asm/time.h>
24 24
25#ifdef CONFIG_X86_64 25#ifdef CONFIG_X86_64
26__visible DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES; 26__visible volatile unsigned long jiffies __cacheline_aligned = INITIAL_JIFFIES;
27#endif 27#endif
28 28
29unsigned long profile_pc(struct pt_regs *regs) 29unsigned long profile_pc(struct pt_regs *regs)
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index de801f22128a..a9ae20579895 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -60,6 +60,7 @@
60#include <asm/fixmap.h> 60#include <asm/fixmap.h>
61#include <asm/mach_traps.h> 61#include <asm/mach_traps.h>
62#include <asm/alternative.h> 62#include <asm/alternative.h>
63#include <asm/mpx.h>
63 64
64#ifdef CONFIG_X86_64 65#ifdef CONFIG_X86_64
65#include <asm/x86_init.h> 66#include <asm/x86_init.h>
@@ -228,7 +229,6 @@ dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \
228 229
229DO_ERROR(X86_TRAP_DE, SIGFPE, "divide error", divide_error) 230DO_ERROR(X86_TRAP_DE, SIGFPE, "divide error", divide_error)
230DO_ERROR(X86_TRAP_OF, SIGSEGV, "overflow", overflow) 231DO_ERROR(X86_TRAP_OF, SIGSEGV, "overflow", overflow)
231DO_ERROR(X86_TRAP_BR, SIGSEGV, "bounds", bounds)
232DO_ERROR(X86_TRAP_UD, SIGILL, "invalid opcode", invalid_op) 232DO_ERROR(X86_TRAP_UD, SIGILL, "invalid opcode", invalid_op)
233DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun) 233DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun)
234DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS) 234DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS)
@@ -286,6 +286,89 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
286} 286}
287#endif 287#endif
288 288
289dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
290{
291 struct task_struct *tsk = current;
292 struct xsave_struct *xsave_buf;
293 enum ctx_state prev_state;
294 struct bndcsr *bndcsr;
295 siginfo_t *info;
296
297 prev_state = exception_enter();
298 if (notify_die(DIE_TRAP, "bounds", regs, error_code,
299 X86_TRAP_BR, SIGSEGV) == NOTIFY_STOP)
300 goto exit;
301 conditional_sti(regs);
302
303 if (!user_mode(regs))
304 die("bounds", regs, error_code);
305
306 if (!cpu_feature_enabled(X86_FEATURE_MPX)) {
307 /* The exception is not from Intel MPX */
308 goto exit_trap;
309 }
310
311 /*
312 * We need to look at BNDSTATUS to resolve this exception.
313 * It is not directly accessible, though, so we need to
314 * do an xsave and then pull it out of the xsave buffer.
315 */
316 fpu_save_init(&tsk->thread.fpu);
317 xsave_buf = &(tsk->thread.fpu.state->xsave);
318 bndcsr = get_xsave_addr(xsave_buf, XSTATE_BNDCSR);
319 if (!bndcsr)
320 goto exit_trap;
321
322 /*
323 * The error code field of the BNDSTATUS register communicates status
324 * information of a bound range exception #BR or operation involving
325 * bound directory.
326 */
327 switch (bndcsr->bndstatus & MPX_BNDSTA_ERROR_CODE) {
328 case 2: /* Bound directory has invalid entry. */
329 if (mpx_handle_bd_fault(xsave_buf))
330 goto exit_trap;
331 break; /* Success, it was handled */
332 case 1: /* Bound violation. */
333 info = mpx_generate_siginfo(regs, xsave_buf);
334 if (PTR_ERR(info)) {
335 /*
336 * We failed to decode the MPX instruction. Act as if
337 * the exception was not caused by MPX.
338 */
339 goto exit_trap;
340 }
341 /*
342 * Success, we decoded the instruction and retrieved
343 * an 'info' containing the address being accessed
344 * which caused the exception. This information
345 * allows and application to possibly handle the
346 * #BR exception itself.
347 */
348 do_trap(X86_TRAP_BR, SIGSEGV, "bounds", regs, error_code, info);
349 kfree(info);
350 break;
351 case 0: /* No exception caused by Intel MPX operations. */
352 goto exit_trap;
353 default:
354 die("bounds", regs, error_code);
355 }
356
357exit:
358 exception_exit(prev_state);
359 return;
360exit_trap:
361 /*
362 * This path out is for all the cases where we could not
363 * handle the exception in some way (like allocating a
364 * table or telling userspace about it. We will also end
365 * up here if the kernel has MPX turned off at compile
366 * time..
367 */
368 do_trap(X86_TRAP_BR, SIGSEGV, "bounds", regs, error_code, NULL);
369 exception_exit(prev_state);
370}
371
289dotraplinkage void 372dotraplinkage void
290do_general_protection(struct pt_regs *regs, long error_code) 373do_general_protection(struct pt_regs *regs, long error_code)
291{ 374{
@@ -387,7 +470,7 @@ NOKPROBE_SYMBOL(do_int3);
387 * for scheduling or signal handling. The actual stack switch is done in 470 * for scheduling or signal handling. The actual stack switch is done in
388 * entry.S 471 * entry.S
389 */ 472 */
390asmlinkage __visible struct pt_regs *sync_regs(struct pt_regs *eregs) 473asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs)
391{ 474{
392 struct pt_regs *regs = eregs; 475 struct pt_regs *regs = eregs;
393 /* Did already sync */ 476 /* Did already sync */
@@ -413,7 +496,7 @@ struct bad_iret_stack {
413 struct pt_regs regs; 496 struct pt_regs regs;
414}; 497};
415 498
416asmlinkage __visible 499asmlinkage __visible notrace
417struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s) 500struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
418{ 501{
419 /* 502 /*
@@ -436,6 +519,7 @@ struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
436 BUG_ON(!user_mode_vm(&new_stack->regs)); 519 BUG_ON(!user_mode_vm(&new_stack->regs));
437 return new_stack; 520 return new_stack;
438} 521}
522NOKPROBE_SYMBOL(fixup_bad_iret);
439#endif 523#endif
440 524
441/* 525/*
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index 5d1cbfe4ae58..8b96a947021f 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -219,7 +219,7 @@ static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool
219{ 219{
220 u32 volatile *good_insns; 220 u32 volatile *good_insns;
221 221
222 insn_init(insn, auprobe->insn, x86_64); 222 insn_init(insn, auprobe->insn, sizeof(auprobe->insn), x86_64);
223 /* has the side-effect of processing the entire instruction */ 223 /* has the side-effect of processing the entire instruction */
224 insn_get_length(insn); 224 insn_get_length(insn);
225 if (WARN_ON_ONCE(!insn_complete(insn))) 225 if (WARN_ON_ONCE(!insn_complete(insn)))
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 49edf2dd3613..00bf300fd846 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -186,6 +186,8 @@ SECTIONS
186 * start another segment - init. 186 * start another segment - init.
187 */ 187 */
188 PERCPU_VADDR(INTERNODE_CACHE_BYTES, 0, :percpu) 188 PERCPU_VADDR(INTERNODE_CACHE_BYTES, 0, :percpu)
189 ASSERT(SIZEOF(.data..percpu) < CONFIG_PHYSICAL_START,
190 "per-CPU data too large - increase CONFIG_PHYSICAL_START")
189#endif 191#endif
190 192
191 INIT_TEXT_SECTION(PAGE_SIZE) 193 INIT_TEXT_SECTION(PAGE_SIZE)
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 957779f4eb40..2dcc6ff6fdcc 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -1,59 +1,43 @@
1/* 1/*
2 * Copyright (c) 2012-2014 Andy Lutomirski <luto@amacapital.net>
3 *
4 * Based on the original implementation which is:
2 * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE 5 * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE
3 * Copyright 2003 Andi Kleen, SuSE Labs. 6 * Copyright 2003 Andi Kleen, SuSE Labs.
4 * 7 *
5 * [ NOTE: this mechanism is now deprecated in favor of the vDSO. ] 8 * Parts of the original code have been moved to arch/x86/vdso/vma.c
9 *
10 * This file implements vsyscall emulation. vsyscalls are a legacy ABI:
11 * Userspace can request certain kernel services by calling fixed
12 * addresses. This concept is problematic:
6 * 13 *
7 * Thanks to hpa@transmeta.com for some useful hint. 14 * - It interferes with ASLR.
8 * Special thanks to Ingo Molnar for his early experience with 15 * - It's awkward to write code that lives in kernel addresses but is
9 * a different vsyscall implementation for Linux/IA32 and for the name. 16 * callable by userspace at fixed addresses.
17 * - The whole concept is impossible for 32-bit compat userspace.
18 * - UML cannot easily virtualize a vsyscall.
10 * 19 *
11 * vsyscall 1 is located at -10Mbyte, vsyscall 2 is located 20 * As of mid-2014, I believe that there is no new userspace code that
12 * at virtual address -10Mbyte+1024bytes etc... There are at max 4 21 * will use a vsyscall if the vDSO is present. I hope that there will
13 * vsyscalls. One vsyscall can reserve more than 1 slot to avoid 22 * soon be no new userspace code that will ever use a vsyscall.
14 * jumping out of line if necessary. We cannot add more with this
15 * mechanism because older kernels won't return -ENOSYS.
16 * 23 *
17 * Note: the concept clashes with user mode linux. UML users should 24 * The code in this file emulates vsyscalls when notified of a page
18 * use the vDSO. 25 * fault to a vsyscall address.
19 */ 26 */
20 27
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
23#include <linux/time.h>
24#include <linux/init.h>
25#include <linux/kernel.h> 28#include <linux/kernel.h>
26#include <linux/timer.h> 29#include <linux/timer.h>
27#include <linux/seqlock.h>
28#include <linux/jiffies.h>
29#include <linux/sysctl.h>
30#include <linux/topology.h>
31#include <linux/timekeeper_internal.h>
32#include <linux/getcpu.h>
33#include <linux/cpu.h>
34#include <linux/smp.h>
35#include <linux/notifier.h>
36#include <linux/syscalls.h> 30#include <linux/syscalls.h>
37#include <linux/ratelimit.h> 31#include <linux/ratelimit.h>
38 32
39#include <asm/vsyscall.h> 33#include <asm/vsyscall.h>
40#include <asm/pgtable.h>
41#include <asm/compat.h>
42#include <asm/page.h>
43#include <asm/unistd.h> 34#include <asm/unistd.h>
44#include <asm/fixmap.h> 35#include <asm/fixmap.h>
45#include <asm/errno.h>
46#include <asm/io.h>
47#include <asm/segment.h>
48#include <asm/desc.h>
49#include <asm/topology.h>
50#include <asm/traps.h> 36#include <asm/traps.h>
51 37
52#define CREATE_TRACE_POINTS 38#define CREATE_TRACE_POINTS
53#include "vsyscall_trace.h" 39#include "vsyscall_trace.h"
54 40
55DEFINE_VVAR(int, vgetcpu_mode);
56
57static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE; 41static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE;
58 42
59static int __init vsyscall_setup(char *str) 43static int __init vsyscall_setup(char *str)
@@ -222,6 +206,7 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
222 "seccomp tried to change syscall nr or ip"); 206 "seccomp tried to change syscall nr or ip");
223 do_exit(SIGSYS); 207 do_exit(SIGSYS);
224 } 208 }
209 regs->orig_ax = -1;
225 if (tmp) 210 if (tmp)
226 goto do_ret; /* skip requested */ 211 goto do_ret; /* skip requested */
227 212
@@ -284,46 +269,54 @@ sigsegv:
284} 269}
285 270
286/* 271/*
287 * Assume __initcall executes before all user space. Hopefully kmod 272 * A pseudo VMA to allow ptrace access for the vsyscall page. This only
288 * doesn't violate that. We'll find out if it does. 273 * covers the 64bit vsyscall page now. 32bit has a real VMA now and does
274 * not need special handling anymore:
289 */ 275 */
290static void vsyscall_set_cpu(int cpu) 276static const char *gate_vma_name(struct vm_area_struct *vma)
291{ 277{
292 unsigned long d; 278 return "[vsyscall]";
293 unsigned long node = 0;
294#ifdef CONFIG_NUMA
295 node = cpu_to_node(cpu);
296#endif
297 if (cpu_has(&cpu_data(cpu), X86_FEATURE_RDTSCP))
298 write_rdtscp_aux((node << 12) | cpu);
299
300 /*
301 * Store cpu number in limit so that it can be loaded quickly
302 * in user space in vgetcpu. (12 bits for the CPU and 8 bits for the node)
303 */
304 d = 0x0f40000000000ULL;
305 d |= cpu;
306 d |= (node & 0xf) << 12;
307 d |= (node >> 4) << 48;
308
309 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
310} 279}
311 280static struct vm_operations_struct gate_vma_ops = {
312static void cpu_vsyscall_init(void *arg) 281 .name = gate_vma_name,
282};
283static struct vm_area_struct gate_vma = {
284 .vm_start = VSYSCALL_ADDR,
285 .vm_end = VSYSCALL_ADDR + PAGE_SIZE,
286 .vm_page_prot = PAGE_READONLY_EXEC,
287 .vm_flags = VM_READ | VM_EXEC,
288 .vm_ops = &gate_vma_ops,
289};
290
291struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
313{ 292{
314 /* preemption should be already off */ 293#ifdef CONFIG_IA32_EMULATION
315 vsyscall_set_cpu(raw_smp_processor_id()); 294 if (!mm || mm->context.ia32_compat)
295 return NULL;
296#endif
297 if (vsyscall_mode == NONE)
298 return NULL;
299 return &gate_vma;
316} 300}
317 301
318static int 302int in_gate_area(struct mm_struct *mm, unsigned long addr)
319cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg)
320{ 303{
321 long cpu = (long)arg; 304 struct vm_area_struct *vma = get_gate_vma(mm);
305
306 if (!vma)
307 return 0;
322 308
323 if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN) 309 return (addr >= vma->vm_start) && (addr < vma->vm_end);
324 smp_call_function_single(cpu, cpu_vsyscall_init, NULL, 1); 310}
325 311
326 return NOTIFY_DONE; 312/*
313 * Use this when you have no reliable mm, typically from interrupt
314 * context. It is less reliable than using a task's mm and may give
315 * false positives.
316 */
317int in_gate_area_no_mm(unsigned long addr)
318{
319 return vsyscall_mode != NONE && (addr & PAGE_MASK) == VSYSCALL_ADDR;
327} 320}
328 321
329void __init map_vsyscall(void) 322void __init map_vsyscall(void)
@@ -331,24 +324,12 @@ void __init map_vsyscall(void)
331 extern char __vsyscall_page; 324 extern char __vsyscall_page;
332 unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page); 325 unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page);
333 326
334 __set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall, 327 if (vsyscall_mode != NONE)
335 vsyscall_mode == NATIVE 328 __set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall,
336 ? PAGE_KERNEL_VSYSCALL 329 vsyscall_mode == NATIVE
337 : PAGE_KERNEL_VVAR); 330 ? PAGE_KERNEL_VSYSCALL
331 : PAGE_KERNEL_VVAR);
332
338 BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_PAGE) != 333 BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_PAGE) !=
339 (unsigned long)VSYSCALL_ADDR); 334 (unsigned long)VSYSCALL_ADDR);
340} 335}
341
342static int __init vsyscall_init(void)
343{
344 cpu_notifier_register_begin();
345
346 on_each_cpu(cpu_vsyscall_init, NULL, 1);
347 /* notifier priority > KVM */
348 __hotcpu_notifier(cpu_vsyscall_notifier, 30);
349
350 cpu_notifier_register_done();
351
352 return 0;
353}
354__initcall(vsyscall_init);
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index e48b674639cc..234b0722de53 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -116,8 +116,6 @@ struct x86_msi_ops x86_msi = {
116 .teardown_msi_irqs = default_teardown_msi_irqs, 116 .teardown_msi_irqs = default_teardown_msi_irqs,
117 .restore_msi_irqs = default_restore_msi_irqs, 117 .restore_msi_irqs = default_restore_msi_irqs,
118 .setup_hpet_msi = default_setup_hpet_msi, 118 .setup_hpet_msi = default_setup_hpet_msi,
119 .msi_mask_irq = default_msi_mask_irq,
120 .msix_mask_irq = default_msix_mask_irq,
121}; 119};
122 120
123/* MSI arch specific hooks */ 121/* MSI arch specific hooks */
@@ -140,14 +138,6 @@ void arch_restore_msi_irqs(struct pci_dev *dev)
140{ 138{
141 x86_msi.restore_msi_irqs(dev); 139 x86_msi.restore_msi_irqs(dev);
142} 140}
143u32 arch_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag)
144{
145 return x86_msi.msi_mask_irq(desc, mask, flag);
146}
147u32 arch_msix_mask_irq(struct msi_desc *desc, u32 flag)
148{
149 return x86_msi.msix_mask_irq(desc, flag);
150}
151#endif 141#endif
152 142
153struct x86_io_apic_ops x86_io_apic_ops = { 143struct x86_io_apic_ops x86_io_apic_ops = {
diff --git a/arch/x86/kvm/mmutrace.h b/arch/x86/kvm/mmutrace.h
index 5aaf35641768..ce463a9cc8fb 100644
--- a/arch/x86/kvm/mmutrace.h
+++ b/arch/x86/kvm/mmutrace.h
@@ -22,7 +22,7 @@
22 __entry->unsync = sp->unsync; 22 __entry->unsync = sp->unsync;
23 23
24#define KVM_MMU_PAGE_PRINTK() ({ \ 24#define KVM_MMU_PAGE_PRINTK() ({ \
25 const u32 saved_len = p->len; \ 25 const char *saved_ptr = trace_seq_buffer_ptr(p); \
26 static const char *access_str[] = { \ 26 static const char *access_str[] = { \
27 "---", "--x", "w--", "w-x", "-u-", "-ux", "wu-", "wux" \ 27 "---", "--x", "w--", "w-x", "-u-", "-ux", "wu-", "wux" \
28 }; \ 28 }; \
@@ -41,7 +41,7 @@
41 role.nxe ? "" : "!", \ 41 role.nxe ? "" : "!", \
42 __entry->root_count, \ 42 __entry->root_count, \
43 __entry->unsync ? "unsync" : "sync", 0); \ 43 __entry->unsync ? "unsync" : "sync", 0); \
44 p->buffer + saved_len; \ 44 saved_ptr; \
45 }) 45 })
46 46
47#define kvm_mmu_trace_pferr_flags \ 47#define kvm_mmu_trace_pferr_flags \
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
index 54fcffed28ed..2480978b31cc 100644
--- a/arch/x86/lib/insn.c
+++ b/arch/x86/lib/insn.c
@@ -28,7 +28,7 @@
28 28
29/* Verify next sizeof(t) bytes can be on the same instruction */ 29/* Verify next sizeof(t) bytes can be on the same instruction */
30#define validate_next(t, insn, n) \ 30#define validate_next(t, insn, n) \
31 ((insn)->next_byte + sizeof(t) + n - (insn)->kaddr <= MAX_INSN_SIZE) 31 ((insn)->next_byte + sizeof(t) + n < (insn)->end_kaddr)
32 32
33#define __get_next(t, insn) \ 33#define __get_next(t, insn) \
34 ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; }) 34 ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; })
@@ -50,10 +50,11 @@
50 * @kaddr: address (in kernel memory) of instruction (or copy thereof) 50 * @kaddr: address (in kernel memory) of instruction (or copy thereof)
51 * @x86_64: !0 for 64-bit kernel or 64-bit app 51 * @x86_64: !0 for 64-bit kernel or 64-bit app
52 */ 52 */
53void insn_init(struct insn *insn, const void *kaddr, int x86_64) 53void insn_init(struct insn *insn, const void *kaddr, int buf_len, int x86_64)
54{ 54{
55 memset(insn, 0, sizeof(*insn)); 55 memset(insn, 0, sizeof(*insn));
56 insn->kaddr = kaddr; 56 insn->kaddr = kaddr;
57 insn->end_kaddr = kaddr + buf_len;
57 insn->next_byte = kaddr; 58 insn->next_byte = kaddr;
58 insn->x86_64 = x86_64 ? 1 : 0; 59 insn->x86_64 = x86_64 ? 1 : 0;
59 insn->opnd_bytes = 4; 60 insn->opnd_bytes = 4;
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index 6a19ad9f370d..ecfdc46a024a 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -30,3 +30,5 @@ obj-$(CONFIG_ACPI_NUMA) += srat.o
30obj-$(CONFIG_NUMA_EMU) += numa_emulation.o 30obj-$(CONFIG_NUMA_EMU) += numa_emulation.o
31 31
32obj-$(CONFIG_MEMTEST) += memtest.o 32obj-$(CONFIG_MEMTEST) += memtest.o
33
34obj-$(CONFIG_X86_INTEL_MPX) += mpx.o
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 95a427e57887..f0cedf3395af 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -76,6 +76,9 @@ static struct addr_marker address_markers[] = {
76# ifdef CONFIG_X86_ESPFIX64 76# ifdef CONFIG_X86_ESPFIX64
77 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, 77 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 },
78# endif 78# endif
79# ifdef CONFIG_EFI
80 { EFI_VA_END, "EFI Runtime Services" },
81# endif
79 { __START_KERNEL_map, "High Kernel Mapping" }, 82 { __START_KERNEL_map, "High Kernel Mapping" },
80 { MODULES_VADDR, "Modules" }, 83 { MODULES_VADDR, "Modules" },
81 { MODULES_END, "End Modules" }, 84 { MODULES_END, "End Modules" },
@@ -126,7 +129,7 @@ static void printk_prot(struct seq_file *m, pgprot_t prot, int level, bool dmsg)
126 129
127 if (!pgprot_val(prot)) { 130 if (!pgprot_val(prot)) {
128 /* Not present */ 131 /* Not present */
129 pt_dump_cont_printf(m, dmsg, " "); 132 pt_dump_cont_printf(m, dmsg, " ");
130 } else { 133 } else {
131 if (pr & _PAGE_USER) 134 if (pr & _PAGE_USER)
132 pt_dump_cont_printf(m, dmsg, "USR "); 135 pt_dump_cont_printf(m, dmsg, "USR ");
@@ -145,18 +148,16 @@ static void printk_prot(struct seq_file *m, pgprot_t prot, int level, bool dmsg)
145 else 148 else
146 pt_dump_cont_printf(m, dmsg, " "); 149 pt_dump_cont_printf(m, dmsg, " ");
147 150
148 /* Bit 9 has a different meaning on level 3 vs 4 */ 151 /* Bit 7 has a different meaning on level 3 vs 4 */
149 if (level <= 3) { 152 if (level <= 3 && pr & _PAGE_PSE)
150 if (pr & _PAGE_PSE) 153 pt_dump_cont_printf(m, dmsg, "PSE ");
151 pt_dump_cont_printf(m, dmsg, "PSE "); 154 else
152 else 155 pt_dump_cont_printf(m, dmsg, " ");
153 pt_dump_cont_printf(m, dmsg, " "); 156 if ((level == 4 && pr & _PAGE_PAT) ||
154 } else { 157 ((level == 3 || level == 2) && pr & _PAGE_PAT_LARGE))
155 if (pr & _PAGE_PAT) 158 pt_dump_cont_printf(m, dmsg, "pat ");
156 pt_dump_cont_printf(m, dmsg, "pat "); 159 else
157 else 160 pt_dump_cont_printf(m, dmsg, " ");
158 pt_dump_cont_printf(m, dmsg, " ");
159 }
160 if (pr & _PAGE_GLOBAL) 161 if (pr & _PAGE_GLOBAL)
161 pt_dump_cont_printf(m, dmsg, "GLB "); 162 pt_dump_cont_printf(m, dmsg, "GLB ");
162 else 163 else
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 66dba36f2343..82b41d56bb98 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -27,6 +27,35 @@
27 27
28#include "mm_internal.h" 28#include "mm_internal.h"
29 29
30/*
31 * Tables translating between page_cache_type_t and pte encoding.
32 * Minimal supported modes are defined statically, modified if more supported
33 * cache modes are available.
34 * Index into __cachemode2pte_tbl is the cachemode.
35 * Index into __pte2cachemode_tbl are the caching attribute bits of the pte
36 * (_PAGE_PWT, _PAGE_PCD, _PAGE_PAT) at index bit positions 0, 1, 2.
37 */
38uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM] = {
39 [_PAGE_CACHE_MODE_WB] = 0,
40 [_PAGE_CACHE_MODE_WC] = _PAGE_PWT,
41 [_PAGE_CACHE_MODE_UC_MINUS] = _PAGE_PCD,
42 [_PAGE_CACHE_MODE_UC] = _PAGE_PCD | _PAGE_PWT,
43 [_PAGE_CACHE_MODE_WT] = _PAGE_PCD,
44 [_PAGE_CACHE_MODE_WP] = _PAGE_PCD,
45};
46EXPORT_SYMBOL_GPL(__cachemode2pte_tbl);
47uint8_t __pte2cachemode_tbl[8] = {
48 [__pte2cm_idx(0)] = _PAGE_CACHE_MODE_WB,
49 [__pte2cm_idx(_PAGE_PWT)] = _PAGE_CACHE_MODE_WC,
50 [__pte2cm_idx(_PAGE_PCD)] = _PAGE_CACHE_MODE_UC_MINUS,
51 [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD)] = _PAGE_CACHE_MODE_UC,
52 [__pte2cm_idx(_PAGE_PAT)] = _PAGE_CACHE_MODE_WB,
53 [__pte2cm_idx(_PAGE_PWT | _PAGE_PAT)] = _PAGE_CACHE_MODE_WC,
54 [__pte2cm_idx(_PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
55 [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
56};
57EXPORT_SYMBOL_GPL(__pte2cachemode_tbl);
58
30static unsigned long __initdata pgt_buf_start; 59static unsigned long __initdata pgt_buf_start;
31static unsigned long __initdata pgt_buf_end; 60static unsigned long __initdata pgt_buf_end;
32static unsigned long __initdata pgt_buf_top; 61static unsigned long __initdata pgt_buf_top;
@@ -687,3 +716,11 @@ void __init zone_sizes_init(void)
687 free_area_init_nodes(max_zone_pfns); 716 free_area_init_nodes(max_zone_pfns);
688} 717}
689 718
719void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache)
720{
721 /* entry 0 MUST be WB (hardwired to speed up translations) */
722 BUG_ON(!entry && cache != _PAGE_CACHE_MODE_WB);
723
724 __cachemode2pte_tbl[cache] = __cm_idx2pte(entry);
725 __pte2cachemode_tbl[entry] = cache;
726}
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 4e5dfec750fc..30eb05ae7061 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -52,7 +52,6 @@
52#include <asm/numa.h> 52#include <asm/numa.h>
53#include <asm/cacheflush.h> 53#include <asm/cacheflush.h>
54#include <asm/init.h> 54#include <asm/init.h>
55#include <asm/uv/uv.h>
56#include <asm/setup.h> 55#include <asm/setup.h>
57 56
58#include "mm_internal.h" 57#include "mm_internal.h"
@@ -338,12 +337,15 @@ pte_t * __init populate_extra_pte(unsigned long vaddr)
338 * Create large page table mappings for a range of physical addresses. 337 * Create large page table mappings for a range of physical addresses.
339 */ 338 */
340static void __init __init_extra_mapping(unsigned long phys, unsigned long size, 339static void __init __init_extra_mapping(unsigned long phys, unsigned long size,
341 pgprot_t prot) 340 enum page_cache_mode cache)
342{ 341{
343 pgd_t *pgd; 342 pgd_t *pgd;
344 pud_t *pud; 343 pud_t *pud;
345 pmd_t *pmd; 344 pmd_t *pmd;
345 pgprot_t prot;
346 346
347 pgprot_val(prot) = pgprot_val(PAGE_KERNEL_LARGE) |
348 pgprot_val(pgprot_4k_2_large(cachemode2pgprot(cache)));
347 BUG_ON((phys & ~PMD_MASK) || (size & ~PMD_MASK)); 349 BUG_ON((phys & ~PMD_MASK) || (size & ~PMD_MASK));
348 for (; size; phys += PMD_SIZE, size -= PMD_SIZE) { 350 for (; size; phys += PMD_SIZE, size -= PMD_SIZE) {
349 pgd = pgd_offset_k((unsigned long)__va(phys)); 351 pgd = pgd_offset_k((unsigned long)__va(phys));
@@ -366,12 +368,12 @@ static void __init __init_extra_mapping(unsigned long phys, unsigned long size,
366 368
367void __init init_extra_mapping_wb(unsigned long phys, unsigned long size) 369void __init init_extra_mapping_wb(unsigned long phys, unsigned long size)
368{ 370{
369 __init_extra_mapping(phys, size, PAGE_KERNEL_LARGE); 371 __init_extra_mapping(phys, size, _PAGE_CACHE_MODE_WB);
370} 372}
371 373
372void __init init_extra_mapping_uc(unsigned long phys, unsigned long size) 374void __init init_extra_mapping_uc(unsigned long phys, unsigned long size)
373{ 375{
374 __init_extra_mapping(phys, size, PAGE_KERNEL_LARGE_NOCACHE); 376 __init_extra_mapping(phys, size, _PAGE_CACHE_MODE_UC);
375} 377}
376 378
377/* 379/*
@@ -1202,66 +1204,15 @@ int kern_addr_valid(unsigned long addr)
1202 return pfn_valid(pte_pfn(*pte)); 1204 return pfn_valid(pte_pfn(*pte));
1203} 1205}
1204 1206
1205/*
1206 * A pseudo VMA to allow ptrace access for the vsyscall page. This only
1207 * covers the 64bit vsyscall page now. 32bit has a real VMA now and does
1208 * not need special handling anymore:
1209 */
1210static const char *gate_vma_name(struct vm_area_struct *vma)
1211{
1212 return "[vsyscall]";
1213}
1214static struct vm_operations_struct gate_vma_ops = {
1215 .name = gate_vma_name,
1216};
1217static struct vm_area_struct gate_vma = {
1218 .vm_start = VSYSCALL_ADDR,
1219 .vm_end = VSYSCALL_ADDR + PAGE_SIZE,
1220 .vm_page_prot = PAGE_READONLY_EXEC,
1221 .vm_flags = VM_READ | VM_EXEC,
1222 .vm_ops = &gate_vma_ops,
1223};
1224
1225struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
1226{
1227#ifdef CONFIG_IA32_EMULATION
1228 if (!mm || mm->context.ia32_compat)
1229 return NULL;
1230#endif
1231 return &gate_vma;
1232}
1233
1234int in_gate_area(struct mm_struct *mm, unsigned long addr)
1235{
1236 struct vm_area_struct *vma = get_gate_vma(mm);
1237
1238 if (!vma)
1239 return 0;
1240
1241 return (addr >= vma->vm_start) && (addr < vma->vm_end);
1242}
1243
1244/*
1245 * Use this when you have no reliable mm, typically from interrupt
1246 * context. It is less reliable than using a task's mm and may give
1247 * false positives.
1248 */
1249int in_gate_area_no_mm(unsigned long addr)
1250{
1251 return (addr & PAGE_MASK) == VSYSCALL_ADDR;
1252}
1253
1254static unsigned long probe_memory_block_size(void) 1207static unsigned long probe_memory_block_size(void)
1255{ 1208{
1256 /* start from 2g */ 1209 /* start from 2g */
1257 unsigned long bz = 1UL<<31; 1210 unsigned long bz = 1UL<<31;
1258 1211
1259#ifdef CONFIG_X86_UV 1212 if (totalram_pages >= (64ULL << (30 - PAGE_SHIFT))) {
1260 if (is_uv_system()) { 1213 pr_info("Using 2GB memory block size for large-memory system\n");
1261 printk(KERN_INFO "UV: memory block size 2GB\n");
1262 return 2UL * 1024 * 1024 * 1024; 1214 return 2UL * 1024 * 1024 * 1024;
1263 } 1215 }
1264#endif
1265 1216
1266 /* less than 64g installed */ 1217 /* less than 64g installed */
1267 if ((max_pfn << PAGE_SHIFT) < (16UL << 32)) 1218 if ((max_pfn << PAGE_SHIFT) < (16UL << 32))
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
index 7b179b499fa3..9ca35fc60cfe 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -33,17 +33,17 @@ static int is_io_mapping_possible(resource_size_t base, unsigned long size)
33 33
34int iomap_create_wc(resource_size_t base, unsigned long size, pgprot_t *prot) 34int iomap_create_wc(resource_size_t base, unsigned long size, pgprot_t *prot)
35{ 35{
36 unsigned long flag = _PAGE_CACHE_WC; 36 enum page_cache_mode pcm = _PAGE_CACHE_MODE_WC;
37 int ret; 37 int ret;
38 38
39 if (!is_io_mapping_possible(base, size)) 39 if (!is_io_mapping_possible(base, size))
40 return -EINVAL; 40 return -EINVAL;
41 41
42 ret = io_reserve_memtype(base, base + size, &flag); 42 ret = io_reserve_memtype(base, base + size, &pcm);
43 if (ret) 43 if (ret)
44 return ret; 44 return ret;
45 45
46 *prot = __pgprot(__PAGE_KERNEL | flag); 46 *prot = __pgprot(__PAGE_KERNEL | cachemode2protval(pcm));
47 return 0; 47 return 0;
48} 48}
49EXPORT_SYMBOL_GPL(iomap_create_wc); 49EXPORT_SYMBOL_GPL(iomap_create_wc);
@@ -82,8 +82,10 @@ iomap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot)
82 * MTRR is UC or WC. UC_MINUS gets the real intention, of the 82 * MTRR is UC or WC. UC_MINUS gets the real intention, of the
83 * user, which is "WC if the MTRR is WC, UC if you can't do that." 83 * user, which is "WC if the MTRR is WC, UC if you can't do that."
84 */ 84 */
85 if (!pat_enabled && pgprot_val(prot) == pgprot_val(PAGE_KERNEL_WC)) 85 if (!pat_enabled && pgprot_val(prot) ==
86 prot = PAGE_KERNEL_UC_MINUS; 86 (__PAGE_KERNEL | cachemode2protval(_PAGE_CACHE_MODE_WC)))
87 prot = __pgprot(__PAGE_KERNEL |
88 cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS));
87 89
88 return (void __force __iomem *) kmap_atomic_prot_pfn(pfn, prot); 90 return (void __force __iomem *) kmap_atomic_prot_pfn(pfn, prot);
89} 91}
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index af78e50ca6ce..fdf617c00e2f 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -29,20 +29,20 @@
29 * conflicts. 29 * conflicts.
30 */ 30 */
31int ioremap_change_attr(unsigned long vaddr, unsigned long size, 31int ioremap_change_attr(unsigned long vaddr, unsigned long size,
32 unsigned long prot_val) 32 enum page_cache_mode pcm)
33{ 33{
34 unsigned long nrpages = size >> PAGE_SHIFT; 34 unsigned long nrpages = size >> PAGE_SHIFT;
35 int err; 35 int err;
36 36
37 switch (prot_val) { 37 switch (pcm) {
38 case _PAGE_CACHE_UC: 38 case _PAGE_CACHE_MODE_UC:
39 default: 39 default:
40 err = _set_memory_uc(vaddr, nrpages); 40 err = _set_memory_uc(vaddr, nrpages);
41 break; 41 break;
42 case _PAGE_CACHE_WC: 42 case _PAGE_CACHE_MODE_WC:
43 err = _set_memory_wc(vaddr, nrpages); 43 err = _set_memory_wc(vaddr, nrpages);
44 break; 44 break;
45 case _PAGE_CACHE_WB: 45 case _PAGE_CACHE_MODE_WB:
46 err = _set_memory_wb(vaddr, nrpages); 46 err = _set_memory_wb(vaddr, nrpages);
47 break; 47 break;
48 } 48 }
@@ -75,14 +75,14 @@ static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages,
75 * caller shouldn't need to know that small detail. 75 * caller shouldn't need to know that small detail.
76 */ 76 */
77static void __iomem *__ioremap_caller(resource_size_t phys_addr, 77static void __iomem *__ioremap_caller(resource_size_t phys_addr,
78 unsigned long size, unsigned long prot_val, void *caller) 78 unsigned long size, enum page_cache_mode pcm, void *caller)
79{ 79{
80 unsigned long offset, vaddr; 80 unsigned long offset, vaddr;
81 resource_size_t pfn, last_pfn, last_addr; 81 resource_size_t pfn, last_pfn, last_addr;
82 const resource_size_t unaligned_phys_addr = phys_addr; 82 const resource_size_t unaligned_phys_addr = phys_addr;
83 const unsigned long unaligned_size = size; 83 const unsigned long unaligned_size = size;
84 struct vm_struct *area; 84 struct vm_struct *area;
85 unsigned long new_prot_val; 85 enum page_cache_mode new_pcm;
86 pgprot_t prot; 86 pgprot_t prot;
87 int retval; 87 int retval;
88 void __iomem *ret_addr; 88 void __iomem *ret_addr;
@@ -134,38 +134,40 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
134 size = PAGE_ALIGN(last_addr+1) - phys_addr; 134 size = PAGE_ALIGN(last_addr+1) - phys_addr;
135 135
136 retval = reserve_memtype(phys_addr, (u64)phys_addr + size, 136 retval = reserve_memtype(phys_addr, (u64)phys_addr + size,
137 prot_val, &new_prot_val); 137 pcm, &new_pcm);
138 if (retval) { 138 if (retval) {
139 printk(KERN_ERR "ioremap reserve_memtype failed %d\n", retval); 139 printk(KERN_ERR "ioremap reserve_memtype failed %d\n", retval);
140 return NULL; 140 return NULL;
141 } 141 }
142 142
143 if (prot_val != new_prot_val) { 143 if (pcm != new_pcm) {
144 if (!is_new_memtype_allowed(phys_addr, size, 144 if (!is_new_memtype_allowed(phys_addr, size, pcm, new_pcm)) {
145 prot_val, new_prot_val)) {
146 printk(KERN_ERR 145 printk(KERN_ERR
147 "ioremap error for 0x%llx-0x%llx, requested 0x%lx, got 0x%lx\n", 146 "ioremap error for 0x%llx-0x%llx, requested 0x%x, got 0x%x\n",
148 (unsigned long long)phys_addr, 147 (unsigned long long)phys_addr,
149 (unsigned long long)(phys_addr + size), 148 (unsigned long long)(phys_addr + size),
150 prot_val, new_prot_val); 149 pcm, new_pcm);
151 goto err_free_memtype; 150 goto err_free_memtype;
152 } 151 }
153 prot_val = new_prot_val; 152 pcm = new_pcm;
154 } 153 }
155 154
156 switch (prot_val) { 155 prot = PAGE_KERNEL_IO;
157 case _PAGE_CACHE_UC: 156 switch (pcm) {
157 case _PAGE_CACHE_MODE_UC:
158 default: 158 default:
159 prot = PAGE_KERNEL_IO_NOCACHE; 159 prot = __pgprot(pgprot_val(prot) |
160 cachemode2protval(_PAGE_CACHE_MODE_UC));
160 break; 161 break;
161 case _PAGE_CACHE_UC_MINUS: 162 case _PAGE_CACHE_MODE_UC_MINUS:
162 prot = PAGE_KERNEL_IO_UC_MINUS; 163 prot = __pgprot(pgprot_val(prot) |
164 cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS));
163 break; 165 break;
164 case _PAGE_CACHE_WC: 166 case _PAGE_CACHE_MODE_WC:
165 prot = PAGE_KERNEL_IO_WC; 167 prot = __pgprot(pgprot_val(prot) |
168 cachemode2protval(_PAGE_CACHE_MODE_WC));
166 break; 169 break;
167 case _PAGE_CACHE_WB: 170 case _PAGE_CACHE_MODE_WB:
168 prot = PAGE_KERNEL_IO;
169 break; 171 break;
170 } 172 }
171 173
@@ -178,7 +180,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
178 area->phys_addr = phys_addr; 180 area->phys_addr = phys_addr;
179 vaddr = (unsigned long) area->addr; 181 vaddr = (unsigned long) area->addr;
180 182
181 if (kernel_map_sync_memtype(phys_addr, size, prot_val)) 183 if (kernel_map_sync_memtype(phys_addr, size, pcm))
182 goto err_free_area; 184 goto err_free_area;
183 185
184 if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) 186 if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot))
@@ -227,14 +229,14 @@ void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size)
227{ 229{
228 /* 230 /*
229 * Ideally, this should be: 231 * Ideally, this should be:
230 * pat_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS; 232 * pat_enabled ? _PAGE_CACHE_MODE_UC : _PAGE_CACHE_MODE_UC_MINUS;
231 * 233 *
232 * Till we fix all X drivers to use ioremap_wc(), we will use 234 * Till we fix all X drivers to use ioremap_wc(), we will use
233 * UC MINUS. 235 * UC MINUS.
234 */ 236 */
235 unsigned long val = _PAGE_CACHE_UC_MINUS; 237 enum page_cache_mode pcm = _PAGE_CACHE_MODE_UC_MINUS;
236 238
237 return __ioremap_caller(phys_addr, size, val, 239 return __ioremap_caller(phys_addr, size, pcm,
238 __builtin_return_address(0)); 240 __builtin_return_address(0));
239} 241}
240EXPORT_SYMBOL(ioremap_nocache); 242EXPORT_SYMBOL(ioremap_nocache);
@@ -252,7 +254,7 @@ EXPORT_SYMBOL(ioremap_nocache);
252void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size) 254void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size)
253{ 255{
254 if (pat_enabled) 256 if (pat_enabled)
255 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC, 257 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_MODE_WC,
256 __builtin_return_address(0)); 258 __builtin_return_address(0));
257 else 259 else
258 return ioremap_nocache(phys_addr, size); 260 return ioremap_nocache(phys_addr, size);
@@ -261,7 +263,7 @@ EXPORT_SYMBOL(ioremap_wc);
261 263
262void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size) 264void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
263{ 265{
264 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WB, 266 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_MODE_WB,
265 __builtin_return_address(0)); 267 __builtin_return_address(0));
266} 268}
267EXPORT_SYMBOL(ioremap_cache); 269EXPORT_SYMBOL(ioremap_cache);
@@ -269,7 +271,8 @@ EXPORT_SYMBOL(ioremap_cache);
269void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size, 271void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size,
270 unsigned long prot_val) 272 unsigned long prot_val)
271{ 273{
272 return __ioremap_caller(phys_addr, size, (prot_val & _PAGE_CACHE_MASK), 274 return __ioremap_caller(phys_addr, size,
275 pgprot2cachemode(__pgprot(prot_val)),
273 __builtin_return_address(0)); 276 __builtin_return_address(0));
274} 277}
275EXPORT_SYMBOL(ioremap_prot); 278EXPORT_SYMBOL(ioremap_prot);
@@ -327,7 +330,7 @@ EXPORT_SYMBOL(iounmap);
327 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 330 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
328 * access 331 * access
329 */ 332 */
330void *xlate_dev_mem_ptr(unsigned long phys) 333void *xlate_dev_mem_ptr(phys_addr_t phys)
331{ 334{
332 void *addr; 335 void *addr;
333 unsigned long start = phys & PAGE_MASK; 336 unsigned long start = phys & PAGE_MASK;
@@ -343,7 +346,7 @@ void *xlate_dev_mem_ptr(unsigned long phys)
343 return addr; 346 return addr;
344} 347}
345 348
346void unxlate_dev_mem_ptr(unsigned long phys, void *addr) 349void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
347{ 350{
348 if (page_is_ram(phys >> PAGE_SHIFT)) 351 if (page_is_ram(phys >> PAGE_SHIFT))
349 return; 352 return;
diff --git a/arch/x86/mm/mm_internal.h b/arch/x86/mm/mm_internal.h
index 6b563a118891..62474ba66c8e 100644
--- a/arch/x86/mm/mm_internal.h
+++ b/arch/x86/mm/mm_internal.h
@@ -16,4 +16,6 @@ void zone_sizes_init(void);
16 16
17extern int after_bootmem; 17extern int after_bootmem;
18 18
19void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache);
20
19#endif /* __X86_MM_INTERNAL_H */ 21#endif /* __X86_MM_INTERNAL_H */
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
new file mode 100644
index 000000000000..67ebf5751222
--- /dev/null
+++ b/arch/x86/mm/mpx.c
@@ -0,0 +1,928 @@
1/*
2 * mpx.c - Memory Protection eXtensions
3 *
4 * Copyright (c) 2014, Intel Corporation.
5 * Qiaowei Ren <qiaowei.ren@intel.com>
6 * Dave Hansen <dave.hansen@intel.com>
7 */
8#include <linux/kernel.h>
9#include <linux/slab.h>
10#include <linux/syscalls.h>
11#include <linux/sched/sysctl.h>
12
13#include <asm/i387.h>
14#include <asm/insn.h>
15#include <asm/mman.h>
16#include <asm/mmu_context.h>
17#include <asm/mpx.h>
18#include <asm/processor.h>
19#include <asm/fpu-internal.h>
20
21static const char *mpx_mapping_name(struct vm_area_struct *vma)
22{
23 return "[mpx]";
24}
25
26static struct vm_operations_struct mpx_vma_ops = {
27 .name = mpx_mapping_name,
28};
29
30static int is_mpx_vma(struct vm_area_struct *vma)
31{
32 return (vma->vm_ops == &mpx_vma_ops);
33}
34
35/*
36 * This is really a simplified "vm_mmap". it only handles MPX
37 * bounds tables (the bounds directory is user-allocated).
38 *
39 * Later on, we use the vma->vm_ops to uniquely identify these
40 * VMAs.
41 */
42static unsigned long mpx_mmap(unsigned long len)
43{
44 unsigned long ret;
45 unsigned long addr, pgoff;
46 struct mm_struct *mm = current->mm;
47 vm_flags_t vm_flags;
48 struct vm_area_struct *vma;
49
50 /* Only bounds table and bounds directory can be allocated here */
51 if (len != MPX_BD_SIZE_BYTES && len != MPX_BT_SIZE_BYTES)
52 return -EINVAL;
53
54 down_write(&mm->mmap_sem);
55
56 /* Too many mappings? */
57 if (mm->map_count > sysctl_max_map_count) {
58 ret = -ENOMEM;
59 goto out;
60 }
61
62 /* Obtain the address to map to. we verify (or select) it and ensure
63 * that it represents a valid section of the address space.
64 */
65 addr = get_unmapped_area(NULL, 0, len, 0, MAP_ANONYMOUS | MAP_PRIVATE);
66 if (addr & ~PAGE_MASK) {
67 ret = addr;
68 goto out;
69 }
70
71 vm_flags = VM_READ | VM_WRITE | VM_MPX |
72 mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
73
74 /* Set pgoff according to addr for anon_vma */
75 pgoff = addr >> PAGE_SHIFT;
76
77 ret = mmap_region(NULL, addr, len, vm_flags, pgoff);
78 if (IS_ERR_VALUE(ret))
79 goto out;
80
81 vma = find_vma(mm, ret);
82 if (!vma) {
83 ret = -ENOMEM;
84 goto out;
85 }
86 vma->vm_ops = &mpx_vma_ops;
87
88 if (vm_flags & VM_LOCKED) {
89 up_write(&mm->mmap_sem);
90 mm_populate(ret, len);
91 return ret;
92 }
93
94out:
95 up_write(&mm->mmap_sem);
96 return ret;
97}
98
99enum reg_type {
100 REG_TYPE_RM = 0,
101 REG_TYPE_INDEX,
102 REG_TYPE_BASE,
103};
104
105static int get_reg_offset(struct insn *insn, struct pt_regs *regs,
106 enum reg_type type)
107{
108 int regno = 0;
109
110 static const int regoff[] = {
111 offsetof(struct pt_regs, ax),
112 offsetof(struct pt_regs, cx),
113 offsetof(struct pt_regs, dx),
114 offsetof(struct pt_regs, bx),
115 offsetof(struct pt_regs, sp),
116 offsetof(struct pt_regs, bp),
117 offsetof(struct pt_regs, si),
118 offsetof(struct pt_regs, di),
119#ifdef CONFIG_X86_64
120 offsetof(struct pt_regs, r8),
121 offsetof(struct pt_regs, r9),
122 offsetof(struct pt_regs, r10),
123 offsetof(struct pt_regs, r11),
124 offsetof(struct pt_regs, r12),
125 offsetof(struct pt_regs, r13),
126 offsetof(struct pt_regs, r14),
127 offsetof(struct pt_regs, r15),
128#endif
129 };
130 int nr_registers = ARRAY_SIZE(regoff);
131 /*
132 * Don't possibly decode a 32-bit instructions as
133 * reading a 64-bit-only register.
134 */
135 if (IS_ENABLED(CONFIG_X86_64) && !insn->x86_64)
136 nr_registers -= 8;
137
138 switch (type) {
139 case REG_TYPE_RM:
140 regno = X86_MODRM_RM(insn->modrm.value);
141 if (X86_REX_B(insn->rex_prefix.value) == 1)
142 regno += 8;
143 break;
144
145 case REG_TYPE_INDEX:
146 regno = X86_SIB_INDEX(insn->sib.value);
147 if (X86_REX_X(insn->rex_prefix.value) == 1)
148 regno += 8;
149 break;
150
151 case REG_TYPE_BASE:
152 regno = X86_SIB_BASE(insn->sib.value);
153 if (X86_REX_B(insn->rex_prefix.value) == 1)
154 regno += 8;
155 break;
156
157 default:
158 pr_err("invalid register type");
159 BUG();
160 break;
161 }
162
163 if (regno > nr_registers) {
164 WARN_ONCE(1, "decoded an instruction with an invalid register");
165 return -EINVAL;
166 }
167 return regoff[regno];
168}
169
170/*
171 * return the address being referenced be instruction
172 * for rm=3 returning the content of the rm reg
173 * for rm!=3 calculates the address using SIB and Disp
174 */
175static void __user *mpx_get_addr_ref(struct insn *insn, struct pt_regs *regs)
176{
177 unsigned long addr, base, indx;
178 int addr_offset, base_offset, indx_offset;
179 insn_byte_t sib;
180
181 insn_get_modrm(insn);
182 insn_get_sib(insn);
183 sib = insn->sib.value;
184
185 if (X86_MODRM_MOD(insn->modrm.value) == 3) {
186 addr_offset = get_reg_offset(insn, regs, REG_TYPE_RM);
187 if (addr_offset < 0)
188 goto out_err;
189 addr = regs_get_register(regs, addr_offset);
190 } else {
191 if (insn->sib.nbytes) {
192 base_offset = get_reg_offset(insn, regs, REG_TYPE_BASE);
193 if (base_offset < 0)
194 goto out_err;
195
196 indx_offset = get_reg_offset(insn, regs, REG_TYPE_INDEX);
197 if (indx_offset < 0)
198 goto out_err;
199
200 base = regs_get_register(regs, base_offset);
201 indx = regs_get_register(regs, indx_offset);
202 addr = base + indx * (1 << X86_SIB_SCALE(sib));
203 } else {
204 addr_offset = get_reg_offset(insn, regs, REG_TYPE_RM);
205 if (addr_offset < 0)
206 goto out_err;
207 addr = regs_get_register(regs, addr_offset);
208 }
209 addr += insn->displacement.value;
210 }
211 return (void __user *)addr;
212out_err:
213 return (void __user *)-1;
214}
215
216static int mpx_insn_decode(struct insn *insn,
217 struct pt_regs *regs)
218{
219 unsigned char buf[MAX_INSN_SIZE];
220 int x86_64 = !test_thread_flag(TIF_IA32);
221 int not_copied;
222 int nr_copied;
223
224 not_copied = copy_from_user(buf, (void __user *)regs->ip, sizeof(buf));
225 nr_copied = sizeof(buf) - not_copied;
226 /*
227 * The decoder _should_ fail nicely if we pass it a short buffer.
228 * But, let's not depend on that implementation detail. If we
229 * did not get anything, just error out now.
230 */
231 if (!nr_copied)
232 return -EFAULT;
233 insn_init(insn, buf, nr_copied, x86_64);
234 insn_get_length(insn);
235 /*
236 * copy_from_user() tries to get as many bytes as we could see in
237 * the largest possible instruction. If the instruction we are
238 * after is shorter than that _and_ we attempt to copy from
239 * something unreadable, we might get a short read. This is OK
240 * as long as the read did not stop in the middle of the
241 * instruction. Check to see if we got a partial instruction.
242 */
243 if (nr_copied < insn->length)
244 return -EFAULT;
245
246 insn_get_opcode(insn);
247 /*
248 * We only _really_ need to decode bndcl/bndcn/bndcu
249 * Error out on anything else.
250 */
251 if (insn->opcode.bytes[0] != 0x0f)
252 goto bad_opcode;
253 if ((insn->opcode.bytes[1] != 0x1a) &&
254 (insn->opcode.bytes[1] != 0x1b))
255 goto bad_opcode;
256
257 return 0;
258bad_opcode:
259 return -EINVAL;
260}
261
262/*
263 * If a bounds overflow occurs then a #BR is generated. This
264 * function decodes MPX instructions to get violation address
265 * and set this address into extended struct siginfo.
266 *
267 * Note that this is not a super precise way of doing this.
268 * Userspace could have, by the time we get here, written
269 * anything it wants in to the instructions. We can not
270 * trust anything about it. They might not be valid
271 * instructions or might encode invalid registers, etc...
272 *
273 * The caller is expected to kfree() the returned siginfo_t.
274 */
275siginfo_t *mpx_generate_siginfo(struct pt_regs *regs,
276 struct xsave_struct *xsave_buf)
277{
278 struct bndreg *bndregs, *bndreg;
279 siginfo_t *info = NULL;
280 struct insn insn;
281 uint8_t bndregno;
282 int err;
283
284 err = mpx_insn_decode(&insn, regs);
285 if (err)
286 goto err_out;
287
288 /*
289 * We know at this point that we are only dealing with
290 * MPX instructions.
291 */
292 insn_get_modrm(&insn);
293 bndregno = X86_MODRM_REG(insn.modrm.value);
294 if (bndregno > 3) {
295 err = -EINVAL;
296 goto err_out;
297 }
298 /* get the bndregs _area_ of the xsave structure */
299 bndregs = get_xsave_addr(xsave_buf, XSTATE_BNDREGS);
300 if (!bndregs) {
301 err = -EINVAL;
302 goto err_out;
303 }
304 /* now go select the individual register in the set of 4 */
305 bndreg = &bndregs[bndregno];
306
307 info = kzalloc(sizeof(*info), GFP_KERNEL);
308 if (!info) {
309 err = -ENOMEM;
310 goto err_out;
311 }
312 /*
313 * The registers are always 64-bit, but the upper 32
314 * bits are ignored in 32-bit mode. Also, note that the
315 * upper bounds are architecturally represented in 1's
316 * complement form.
317 *
318 * The 'unsigned long' cast is because the compiler
319 * complains when casting from integers to different-size
320 * pointers.
321 */
322 info->si_lower = (void __user *)(unsigned long)bndreg->lower_bound;
323 info->si_upper = (void __user *)(unsigned long)~bndreg->upper_bound;
324 info->si_addr_lsb = 0;
325 info->si_signo = SIGSEGV;
326 info->si_errno = 0;
327 info->si_code = SEGV_BNDERR;
328 info->si_addr = mpx_get_addr_ref(&insn, regs);
329 /*
330 * We were not able to extract an address from the instruction,
331 * probably because there was something invalid in it.
332 */
333 if (info->si_addr == (void *)-1) {
334 err = -EINVAL;
335 goto err_out;
336 }
337 return info;
338err_out:
339 /* info might be NULL, but kfree() handles that */
340 kfree(info);
341 return ERR_PTR(err);
342}
343
344static __user void *task_get_bounds_dir(struct task_struct *tsk)
345{
346 struct bndcsr *bndcsr;
347
348 if (!cpu_feature_enabled(X86_FEATURE_MPX))
349 return MPX_INVALID_BOUNDS_DIR;
350
351 /*
352 * The bounds directory pointer is stored in a register
353 * only accessible if we first do an xsave.
354 */
355 fpu_save_init(&tsk->thread.fpu);
356 bndcsr = get_xsave_addr(&tsk->thread.fpu.state->xsave, XSTATE_BNDCSR);
357 if (!bndcsr)
358 return MPX_INVALID_BOUNDS_DIR;
359
360 /*
361 * Make sure the register looks valid by checking the
362 * enable bit.
363 */
364 if (!(bndcsr->bndcfgu & MPX_BNDCFG_ENABLE_FLAG))
365 return MPX_INVALID_BOUNDS_DIR;
366
367 /*
368 * Lastly, mask off the low bits used for configuration
369 * flags, and return the address of the bounds table.
370 */
371 return (void __user *)(unsigned long)
372 (bndcsr->bndcfgu & MPX_BNDCFG_ADDR_MASK);
373}
374
375int mpx_enable_management(struct task_struct *tsk)
376{
377 void __user *bd_base = MPX_INVALID_BOUNDS_DIR;
378 struct mm_struct *mm = tsk->mm;
379 int ret = 0;
380
381 /*
382 * runtime in the userspace will be responsible for allocation of
383 * the bounds directory. Then, it will save the base of the bounds
384 * directory into XSAVE/XRSTOR Save Area and enable MPX through
385 * XRSTOR instruction.
386 *
387 * fpu_xsave() is expected to be very expensive. Storing the bounds
388 * directory here means that we do not have to do xsave in the unmap
389 * path; we can just use mm->bd_addr instead.
390 */
391 bd_base = task_get_bounds_dir(tsk);
392 down_write(&mm->mmap_sem);
393 mm->bd_addr = bd_base;
394 if (mm->bd_addr == MPX_INVALID_BOUNDS_DIR)
395 ret = -ENXIO;
396
397 up_write(&mm->mmap_sem);
398 return ret;
399}
400
401int mpx_disable_management(struct task_struct *tsk)
402{
403 struct mm_struct *mm = current->mm;
404
405 if (!cpu_feature_enabled(X86_FEATURE_MPX))
406 return -ENXIO;
407
408 down_write(&mm->mmap_sem);
409 mm->bd_addr = MPX_INVALID_BOUNDS_DIR;
410 up_write(&mm->mmap_sem);
411 return 0;
412}
413
414/*
415 * With 32-bit mode, MPX_BT_SIZE_BYTES is 4MB, and the size of each
416 * bounds table is 16KB. With 64-bit mode, MPX_BT_SIZE_BYTES is 2GB,
417 * and the size of each bounds table is 4MB.
418 */
419static int allocate_bt(long __user *bd_entry)
420{
421 unsigned long expected_old_val = 0;
422 unsigned long actual_old_val = 0;
423 unsigned long bt_addr;
424 int ret = 0;
425
426 /*
427 * Carve the virtual space out of userspace for the new
428 * bounds table:
429 */
430 bt_addr = mpx_mmap(MPX_BT_SIZE_BYTES);
431 if (IS_ERR((void *)bt_addr))
432 return PTR_ERR((void *)bt_addr);
433 /*
434 * Set the valid flag (kinda like _PAGE_PRESENT in a pte)
435 */
436 bt_addr = bt_addr | MPX_BD_ENTRY_VALID_FLAG;
437
438 /*
439 * Go poke the address of the new bounds table in to the
440 * bounds directory entry out in userspace memory. Note:
441 * we may race with another CPU instantiating the same table.
442 * In that case the cmpxchg will see an unexpected
443 * 'actual_old_val'.
444 *
445 * This can fault, but that's OK because we do not hold
446 * mmap_sem at this point, unlike some of the other part
447 * of the MPX code that have to pagefault_disable().
448 */
449 ret = user_atomic_cmpxchg_inatomic(&actual_old_val, bd_entry,
450 expected_old_val, bt_addr);
451 if (ret)
452 goto out_unmap;
453
454 /*
455 * The user_atomic_cmpxchg_inatomic() will only return nonzero
456 * for faults, *not* if the cmpxchg itself fails. Now we must
457 * verify that the cmpxchg itself completed successfully.
458 */
459 /*
460 * We expected an empty 'expected_old_val', but instead found
461 * an apparently valid entry. Assume we raced with another
462 * thread to instantiate this table and desclare succecss.
463 */
464 if (actual_old_val & MPX_BD_ENTRY_VALID_FLAG) {
465 ret = 0;
466 goto out_unmap;
467 }
468 /*
469 * We found a non-empty bd_entry but it did not have the
470 * VALID_FLAG set. Return an error which will result in
471 * a SEGV since this probably means that somebody scribbled
472 * some invalid data in to a bounds table.
473 */
474 if (expected_old_val != actual_old_val) {
475 ret = -EINVAL;
476 goto out_unmap;
477 }
478 return 0;
479out_unmap:
480 vm_munmap(bt_addr & MPX_BT_ADDR_MASK, MPX_BT_SIZE_BYTES);
481 return ret;
482}
483
484/*
485 * When a BNDSTX instruction attempts to save bounds to a bounds
486 * table, it will first attempt to look up the table in the
487 * first-level bounds directory. If it does not find a table in
488 * the directory, a #BR is generated and we get here in order to
489 * allocate a new table.
490 *
491 * With 32-bit mode, the size of BD is 4MB, and the size of each
492 * bound table is 16KB. With 64-bit mode, the size of BD is 2GB,
493 * and the size of each bound table is 4MB.
494 */
495static int do_mpx_bt_fault(struct xsave_struct *xsave_buf)
496{
497 unsigned long bd_entry, bd_base;
498 struct bndcsr *bndcsr;
499
500 bndcsr = get_xsave_addr(xsave_buf, XSTATE_BNDCSR);
501 if (!bndcsr)
502 return -EINVAL;
503 /*
504 * Mask off the preserve and enable bits
505 */
506 bd_base = bndcsr->bndcfgu & MPX_BNDCFG_ADDR_MASK;
507 /*
508 * The hardware provides the address of the missing or invalid
509 * entry via BNDSTATUS, so we don't have to go look it up.
510 */
511 bd_entry = bndcsr->bndstatus & MPX_BNDSTA_ADDR_MASK;
512 /*
513 * Make sure the directory entry is within where we think
514 * the directory is.
515 */
516 if ((bd_entry < bd_base) ||
517 (bd_entry >= bd_base + MPX_BD_SIZE_BYTES))
518 return -EINVAL;
519
520 return allocate_bt((long __user *)bd_entry);
521}
522
523int mpx_handle_bd_fault(struct xsave_struct *xsave_buf)
524{
525 /*
526 * Userspace never asked us to manage the bounds tables,
527 * so refuse to help.
528 */
529 if (!kernel_managing_mpx_tables(current->mm))
530 return -EINVAL;
531
532 if (do_mpx_bt_fault(xsave_buf)) {
533 force_sig(SIGSEGV, current);
534 /*
535 * The force_sig() is essentially "handling" this
536 * exception, so we do not pass up the error
537 * from do_mpx_bt_fault().
538 */
539 }
540 return 0;
541}
542
543/*
544 * A thin wrapper around get_user_pages(). Returns 0 if the
545 * fault was resolved or -errno if not.
546 */
547static int mpx_resolve_fault(long __user *addr, int write)
548{
549 long gup_ret;
550 int nr_pages = 1;
551 int force = 0;
552
553 gup_ret = get_user_pages(current, current->mm, (unsigned long)addr,
554 nr_pages, write, force, NULL, NULL);
555 /*
556 * get_user_pages() returns number of pages gotten.
557 * 0 means we failed to fault in and get anything,
558 * probably because 'addr' is bad.
559 */
560 if (!gup_ret)
561 return -EFAULT;
562 /* Other error, return it */
563 if (gup_ret < 0)
564 return gup_ret;
565 /* must have gup'd a page and gup_ret>0, success */
566 return 0;
567}
568
569/*
570 * Get the base of bounds tables pointed by specific bounds
571 * directory entry.
572 */
573static int get_bt_addr(struct mm_struct *mm,
574 long __user *bd_entry, unsigned long *bt_addr)
575{
576 int ret;
577 int valid_bit;
578
579 if (!access_ok(VERIFY_READ, (bd_entry), sizeof(*bd_entry)))
580 return -EFAULT;
581
582 while (1) {
583 int need_write = 0;
584
585 pagefault_disable();
586 ret = get_user(*bt_addr, bd_entry);
587 pagefault_enable();
588 if (!ret)
589 break;
590 if (ret == -EFAULT)
591 ret = mpx_resolve_fault(bd_entry, need_write);
592 /*
593 * If we could not resolve the fault, consider it
594 * userspace's fault and error out.
595 */
596 if (ret)
597 return ret;
598 }
599
600 valid_bit = *bt_addr & MPX_BD_ENTRY_VALID_FLAG;
601 *bt_addr &= MPX_BT_ADDR_MASK;
602
603 /*
604 * When the kernel is managing bounds tables, a bounds directory
605 * entry will either have a valid address (plus the valid bit)
606 * *OR* be completely empty. If we see a !valid entry *and* some
607 * data in the address field, we know something is wrong. This
608 * -EINVAL return will cause a SIGSEGV.
609 */
610 if (!valid_bit && *bt_addr)
611 return -EINVAL;
612 /*
613 * Do we have an completely zeroed bt entry? That is OK. It
614 * just means there was no bounds table for this memory. Make
615 * sure to distinguish this from -EINVAL, which will cause
616 * a SEGV.
617 */
618 if (!valid_bit)
619 return -ENOENT;
620
621 return 0;
622}
623
624/*
625 * Free the backing physical pages of bounds table 'bt_addr'.
626 * Assume start...end is within that bounds table.
627 */
628static int zap_bt_entries(struct mm_struct *mm,
629 unsigned long bt_addr,
630 unsigned long start, unsigned long end)
631{
632 struct vm_area_struct *vma;
633 unsigned long addr, len;
634
635 /*
636 * Find the first overlapping vma. If vma->vm_start > start, there
637 * will be a hole in the bounds table. This -EINVAL return will
638 * cause a SIGSEGV.
639 */
640 vma = find_vma(mm, start);
641 if (!vma || vma->vm_start > start)
642 return -EINVAL;
643
644 /*
645 * A NUMA policy on a VM_MPX VMA could cause this bouds table to
646 * be split. So we need to look across the entire 'start -> end'
647 * range of this bounds table, find all of the VM_MPX VMAs, and
648 * zap only those.
649 */
650 addr = start;
651 while (vma && vma->vm_start < end) {
652 /*
653 * We followed a bounds directory entry down
654 * here. If we find a non-MPX VMA, that's bad,
655 * so stop immediately and return an error. This
656 * probably results in a SIGSEGV.
657 */
658 if (!is_mpx_vma(vma))
659 return -EINVAL;
660
661 len = min(vma->vm_end, end) - addr;
662 zap_page_range(vma, addr, len, NULL);
663
664 vma = vma->vm_next;
665 addr = vma->vm_start;
666 }
667
668 return 0;
669}
670
671static int unmap_single_bt(struct mm_struct *mm,
672 long __user *bd_entry, unsigned long bt_addr)
673{
674 unsigned long expected_old_val = bt_addr | MPX_BD_ENTRY_VALID_FLAG;
675 unsigned long actual_old_val = 0;
676 int ret;
677
678 while (1) {
679 int need_write = 1;
680
681 pagefault_disable();
682 ret = user_atomic_cmpxchg_inatomic(&actual_old_val, bd_entry,
683 expected_old_val, 0);
684 pagefault_enable();
685 if (!ret)
686 break;
687 if (ret == -EFAULT)
688 ret = mpx_resolve_fault(bd_entry, need_write);
689 /*
690 * If we could not resolve the fault, consider it
691 * userspace's fault and error out.
692 */
693 if (ret)
694 return ret;
695 }
696 /*
697 * The cmpxchg was performed, check the results.
698 */
699 if (actual_old_val != expected_old_val) {
700 /*
701 * Someone else raced with us to unmap the table.
702 * There was no bounds table pointed to by the
703 * directory, so declare success. Somebody freed
704 * it.
705 */
706 if (!actual_old_val)
707 return 0;
708 /*
709 * Something messed with the bounds directory
710 * entry. We hold mmap_sem for read or write
711 * here, so it could not be a _new_ bounds table
712 * that someone just allocated. Something is
713 * wrong, so pass up the error and SIGSEGV.
714 */
715 return -EINVAL;
716 }
717
718 /*
719 * Note, we are likely being called under do_munmap() already. To
720 * avoid recursion, do_munmap() will check whether it comes
721 * from one bounds table through VM_MPX flag.
722 */
723 return do_munmap(mm, bt_addr, MPX_BT_SIZE_BYTES);
724}
725
726/*
727 * If the bounds table pointed by bounds directory 'bd_entry' is
728 * not shared, unmap this whole bounds table. Otherwise, only free
729 * those backing physical pages of bounds table entries covered
730 * in this virtual address region start...end.
731 */
732static int unmap_shared_bt(struct mm_struct *mm,
733 long __user *bd_entry, unsigned long start,
734 unsigned long end, bool prev_shared, bool next_shared)
735{
736 unsigned long bt_addr;
737 int ret;
738
739 ret = get_bt_addr(mm, bd_entry, &bt_addr);
740 /*
741 * We could see an "error" ret for not-present bounds
742 * tables (not really an error), or actual errors, but
743 * stop unmapping either way.
744 */
745 if (ret)
746 return ret;
747
748 if (prev_shared && next_shared)
749 ret = zap_bt_entries(mm, bt_addr,
750 bt_addr+MPX_GET_BT_ENTRY_OFFSET(start),
751 bt_addr+MPX_GET_BT_ENTRY_OFFSET(end));
752 else if (prev_shared)
753 ret = zap_bt_entries(mm, bt_addr,
754 bt_addr+MPX_GET_BT_ENTRY_OFFSET(start),
755 bt_addr+MPX_BT_SIZE_BYTES);
756 else if (next_shared)
757 ret = zap_bt_entries(mm, bt_addr, bt_addr,
758 bt_addr+MPX_GET_BT_ENTRY_OFFSET(end));
759 else
760 ret = unmap_single_bt(mm, bd_entry, bt_addr);
761
762 return ret;
763}
764
765/*
766 * A virtual address region being munmap()ed might share bounds table
767 * with adjacent VMAs. We only need to free the backing physical
768 * memory of these shared bounds tables entries covered in this virtual
769 * address region.
770 */
771static int unmap_edge_bts(struct mm_struct *mm,
772 unsigned long start, unsigned long end)
773{
774 int ret;
775 long __user *bde_start, *bde_end;
776 struct vm_area_struct *prev, *next;
777 bool prev_shared = false, next_shared = false;
778
779 bde_start = mm->bd_addr + MPX_GET_BD_ENTRY_OFFSET(start);
780 bde_end = mm->bd_addr + MPX_GET_BD_ENTRY_OFFSET(end-1);
781
782 /*
783 * Check whether bde_start and bde_end are shared with adjacent
784 * VMAs.
785 *
786 * We already unliked the VMAs from the mm's rbtree so 'start'
787 * is guaranteed to be in a hole. This gets us the first VMA
788 * before the hole in to 'prev' and the next VMA after the hole
789 * in to 'next'.
790 */
791 next = find_vma_prev(mm, start, &prev);
792 if (prev && (mm->bd_addr + MPX_GET_BD_ENTRY_OFFSET(prev->vm_end-1))
793 == bde_start)
794 prev_shared = true;
795 if (next && (mm->bd_addr + MPX_GET_BD_ENTRY_OFFSET(next->vm_start))
796 == bde_end)
797 next_shared = true;
798
799 /*
800 * This virtual address region being munmap()ed is only
801 * covered by one bounds table.
802 *
803 * In this case, if this table is also shared with adjacent
804 * VMAs, only part of the backing physical memory of the bounds
805 * table need be freeed. Otherwise the whole bounds table need
806 * be unmapped.
807 */
808 if (bde_start == bde_end) {
809 return unmap_shared_bt(mm, bde_start, start, end,
810 prev_shared, next_shared);
811 }
812
813 /*
814 * If more than one bounds tables are covered in this virtual
815 * address region being munmap()ed, we need to separately check
816 * whether bde_start and bde_end are shared with adjacent VMAs.
817 */
818 ret = unmap_shared_bt(mm, bde_start, start, end, prev_shared, false);
819 if (ret)
820 return ret;
821 ret = unmap_shared_bt(mm, bde_end, start, end, false, next_shared);
822 if (ret)
823 return ret;
824
825 return 0;
826}
827
828static int mpx_unmap_tables(struct mm_struct *mm,
829 unsigned long start, unsigned long end)
830{
831 int ret;
832 long __user *bd_entry, *bde_start, *bde_end;
833 unsigned long bt_addr;
834
835 /*
836 * "Edge" bounds tables are those which are being used by the region
837 * (start -> end), but that may be shared with adjacent areas. If they
838 * turn out to be completely unshared, they will be freed. If they are
839 * shared, we will free the backing store (like an MADV_DONTNEED) for
840 * areas used by this region.
841 */
842 ret = unmap_edge_bts(mm, start, end);
843 switch (ret) {
844 /* non-present tables are OK */
845 case 0:
846 case -ENOENT:
847 /* Success, or no tables to unmap */
848 break;
849 case -EINVAL:
850 case -EFAULT:
851 default:
852 return ret;
853 }
854
855 /*
856 * Only unmap the bounds table that are
857 * 1. fully covered
858 * 2. not at the edges of the mapping, even if full aligned
859 */
860 bde_start = mm->bd_addr + MPX_GET_BD_ENTRY_OFFSET(start);
861 bde_end = mm->bd_addr + MPX_GET_BD_ENTRY_OFFSET(end-1);
862 for (bd_entry = bde_start + 1; bd_entry < bde_end; bd_entry++) {
863 ret = get_bt_addr(mm, bd_entry, &bt_addr);
864 switch (ret) {
865 case 0:
866 break;
867 case -ENOENT:
868 /* No table here, try the next one */
869 continue;
870 case -EINVAL:
871 case -EFAULT:
872 default:
873 /*
874 * Note: we are being strict here.
875 * Any time we run in to an issue
876 * unmapping tables, we stop and
877 * SIGSEGV.
878 */
879 return ret;
880 }
881
882 ret = unmap_single_bt(mm, bd_entry, bt_addr);
883 if (ret)
884 return ret;
885 }
886
887 return 0;
888}
889
890/*
891 * Free unused bounds tables covered in a virtual address region being
892 * munmap()ed. Assume end > start.
893 *
894 * This function will be called by do_munmap(), and the VMAs covering
895 * the virtual address region start...end have already been split if
896 * necessary, and the 'vma' is the first vma in this range (start -> end).
897 */
898void mpx_notify_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
899 unsigned long start, unsigned long end)
900{
901 int ret;
902
903 /*
904 * Refuse to do anything unless userspace has asked
905 * the kernel to help manage the bounds tables,
906 */
907 if (!kernel_managing_mpx_tables(current->mm))
908 return;
909 /*
910 * This will look across the entire 'start -> end' range,
911 * and find all of the non-VM_MPX VMAs.
912 *
913 * To avoid recursion, if a VM_MPX vma is found in the range
914 * (start->end), we will not continue follow-up work. This
915 * recursion represents having bounds tables for bounds tables,
916 * which should not occur normally. Being strict about it here
917 * helps ensure that we do not have an exploitable stack overflow.
918 */
919 do {
920 if (vma->vm_flags & VM_MPX)
921 return;
922 vma = vma->vm_next;
923 } while (vma && vma->vm_start < end);
924
925 ret = mpx_unmap_tables(mm, start, end);
926 if (ret)
927 force_sig(SIGSEGV, current);
928}
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 36de293caf25..a3a5d46605d2 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -485,14 +485,23 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
485 485
486 /* 486 /*
487 * We are safe now. Check whether the new pgprot is the same: 487 * We are safe now. Check whether the new pgprot is the same:
488 * Convert protection attributes to 4k-format, as cpa->mask* are set
489 * up accordingly.
488 */ 490 */
489 old_pte = *kpte; 491 old_pte = *kpte;
490 old_prot = req_prot = pte_pgprot(old_pte); 492 old_prot = req_prot = pgprot_large_2_4k(pte_pgprot(old_pte));
491 493
492 pgprot_val(req_prot) &= ~pgprot_val(cpa->mask_clr); 494 pgprot_val(req_prot) &= ~pgprot_val(cpa->mask_clr);
493 pgprot_val(req_prot) |= pgprot_val(cpa->mask_set); 495 pgprot_val(req_prot) |= pgprot_val(cpa->mask_set);
494 496
495 /* 497 /*
498 * req_prot is in format of 4k pages. It must be converted to large
499 * page format: the caching mode includes the PAT bit located at
500 * different bit positions in the two formats.
501 */
502 req_prot = pgprot_4k_2_large(req_prot);
503
504 /*
496 * Set the PSE and GLOBAL flags only if the PRESENT flag is 505 * Set the PSE and GLOBAL flags only if the PRESENT flag is
497 * set otherwise pmd_present/pmd_huge will return true even on 506 * set otherwise pmd_present/pmd_huge will return true even on
498 * a non present pmd. The canon_pgprot will clear _PAGE_GLOBAL 507 * a non present pmd. The canon_pgprot will clear _PAGE_GLOBAL
@@ -585,13 +594,10 @@ __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address,
585 594
586 paravirt_alloc_pte(&init_mm, page_to_pfn(base)); 595 paravirt_alloc_pte(&init_mm, page_to_pfn(base));
587 ref_prot = pte_pgprot(pte_clrhuge(*kpte)); 596 ref_prot = pte_pgprot(pte_clrhuge(*kpte));
588 /* 597
589 * If we ever want to utilize the PAT bit, we need to 598 /* promote PAT bit to correct position */
590 * update this function to make sure it's converted from 599 if (level == PG_LEVEL_2M)
591 * bit 12 to bit 7 when we cross from the 2MB level to 600 ref_prot = pgprot_large_2_4k(ref_prot);
592 * the 4K level:
593 */
594 WARN_ON_ONCE(pgprot_val(ref_prot) & _PAGE_PAT_LARGE);
595 601
596#ifdef CONFIG_X86_64 602#ifdef CONFIG_X86_64
597 if (level == PG_LEVEL_1G) { 603 if (level == PG_LEVEL_1G) {
@@ -879,6 +885,7 @@ static int populate_pmd(struct cpa_data *cpa,
879{ 885{
880 unsigned int cur_pages = 0; 886 unsigned int cur_pages = 0;
881 pmd_t *pmd; 887 pmd_t *pmd;
888 pgprot_t pmd_pgprot;
882 889
883 /* 890 /*
884 * Not on a 2M boundary? 891 * Not on a 2M boundary?
@@ -910,6 +917,8 @@ static int populate_pmd(struct cpa_data *cpa,
910 if (num_pages == cur_pages) 917 if (num_pages == cur_pages)
911 return cur_pages; 918 return cur_pages;
912 919
920 pmd_pgprot = pgprot_4k_2_large(pgprot);
921
913 while (end - start >= PMD_SIZE) { 922 while (end - start >= PMD_SIZE) {
914 923
915 /* 924 /*
@@ -921,7 +930,8 @@ static int populate_pmd(struct cpa_data *cpa,
921 930
922 pmd = pmd_offset(pud, start); 931 pmd = pmd_offset(pud, start);
923 932
924 set_pmd(pmd, __pmd(cpa->pfn | _PAGE_PSE | massage_pgprot(pgprot))); 933 set_pmd(pmd, __pmd(cpa->pfn | _PAGE_PSE |
934 massage_pgprot(pmd_pgprot)));
925 935
926 start += PMD_SIZE; 936 start += PMD_SIZE;
927 cpa->pfn += PMD_SIZE; 937 cpa->pfn += PMD_SIZE;
@@ -949,6 +959,7 @@ static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd,
949 pud_t *pud; 959 pud_t *pud;
950 unsigned long end; 960 unsigned long end;
951 int cur_pages = 0; 961 int cur_pages = 0;
962 pgprot_t pud_pgprot;
952 963
953 end = start + (cpa->numpages << PAGE_SHIFT); 964 end = start + (cpa->numpages << PAGE_SHIFT);
954 965
@@ -986,12 +997,14 @@ static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd,
986 return cur_pages; 997 return cur_pages;
987 998
988 pud = pud_offset(pgd, start); 999 pud = pud_offset(pgd, start);
1000 pud_pgprot = pgprot_4k_2_large(pgprot);
989 1001
990 /* 1002 /*
991 * Map everything starting from the Gb boundary, possibly with 1G pages 1003 * Map everything starting from the Gb boundary, possibly with 1G pages
992 */ 1004 */
993 while (end - start >= PUD_SIZE) { 1005 while (end - start >= PUD_SIZE) {
994 set_pud(pud, __pud(cpa->pfn | _PAGE_PSE | massage_pgprot(pgprot))); 1006 set_pud(pud, __pud(cpa->pfn | _PAGE_PSE |
1007 massage_pgprot(pud_pgprot)));
995 1008
996 start += PUD_SIZE; 1009 start += PUD_SIZE;
997 cpa->pfn += PUD_SIZE; 1010 cpa->pfn += PUD_SIZE;
@@ -1304,12 +1317,6 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
1304 return 0; 1317 return 0;
1305} 1318}
1306 1319
1307static inline int cache_attr(pgprot_t attr)
1308{
1309 return pgprot_val(attr) &
1310 (_PAGE_PAT | _PAGE_PAT_LARGE | _PAGE_PWT | _PAGE_PCD);
1311}
1312
1313static int change_page_attr_set_clr(unsigned long *addr, int numpages, 1320static int change_page_attr_set_clr(unsigned long *addr, int numpages,
1314 pgprot_t mask_set, pgprot_t mask_clr, 1321 pgprot_t mask_set, pgprot_t mask_clr,
1315 int force_split, int in_flag, 1322 int force_split, int in_flag,
@@ -1390,7 +1397,7 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
1390 * No need to flush, when we did not set any of the caching 1397 * No need to flush, when we did not set any of the caching
1391 * attributes: 1398 * attributes:
1392 */ 1399 */
1393 cache = cache_attr(mask_set); 1400 cache = !!pgprot2cachemode(mask_set);
1394 1401
1395 /* 1402 /*
1396 * On success we use CLFLUSH, when the CPU supports it to 1403 * On success we use CLFLUSH, when the CPU supports it to
@@ -1445,7 +1452,8 @@ int _set_memory_uc(unsigned long addr, int numpages)
1445 * for now UC MINUS. see comments in ioremap_nocache() 1452 * for now UC MINUS. see comments in ioremap_nocache()
1446 */ 1453 */
1447 return change_page_attr_set(&addr, numpages, 1454 return change_page_attr_set(&addr, numpages,
1448 __pgprot(_PAGE_CACHE_UC_MINUS), 0); 1455 cachemode2pgprot(_PAGE_CACHE_MODE_UC_MINUS),
1456 0);
1449} 1457}
1450 1458
1451int set_memory_uc(unsigned long addr, int numpages) 1459int set_memory_uc(unsigned long addr, int numpages)
@@ -1456,7 +1464,7 @@ int set_memory_uc(unsigned long addr, int numpages)
1456 * for now UC MINUS. see comments in ioremap_nocache() 1464 * for now UC MINUS. see comments in ioremap_nocache()
1457 */ 1465 */
1458 ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE, 1466 ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
1459 _PAGE_CACHE_UC_MINUS, NULL); 1467 _PAGE_CACHE_MODE_UC_MINUS, NULL);
1460 if (ret) 1468 if (ret)
1461 goto out_err; 1469 goto out_err;
1462 1470
@@ -1474,7 +1482,7 @@ out_err:
1474EXPORT_SYMBOL(set_memory_uc); 1482EXPORT_SYMBOL(set_memory_uc);
1475 1483
1476static int _set_memory_array(unsigned long *addr, int addrinarray, 1484static int _set_memory_array(unsigned long *addr, int addrinarray,
1477 unsigned long new_type) 1485 enum page_cache_mode new_type)
1478{ 1486{
1479 int i, j; 1487 int i, j;
1480 int ret; 1488 int ret;
@@ -1490,11 +1498,13 @@ static int _set_memory_array(unsigned long *addr, int addrinarray,
1490 } 1498 }
1491 1499
1492 ret = change_page_attr_set(addr, addrinarray, 1500 ret = change_page_attr_set(addr, addrinarray,
1493 __pgprot(_PAGE_CACHE_UC_MINUS), 1); 1501 cachemode2pgprot(_PAGE_CACHE_MODE_UC_MINUS),
1502 1);
1494 1503
1495 if (!ret && new_type == _PAGE_CACHE_WC) 1504 if (!ret && new_type == _PAGE_CACHE_MODE_WC)
1496 ret = change_page_attr_set_clr(addr, addrinarray, 1505 ret = change_page_attr_set_clr(addr, addrinarray,
1497 __pgprot(_PAGE_CACHE_WC), 1506 cachemode2pgprot(
1507 _PAGE_CACHE_MODE_WC),
1498 __pgprot(_PAGE_CACHE_MASK), 1508 __pgprot(_PAGE_CACHE_MASK),
1499 0, CPA_ARRAY, NULL); 1509 0, CPA_ARRAY, NULL);
1500 if (ret) 1510 if (ret)
@@ -1511,13 +1521,13 @@ out_free:
1511 1521
1512int set_memory_array_uc(unsigned long *addr, int addrinarray) 1522int set_memory_array_uc(unsigned long *addr, int addrinarray)
1513{ 1523{
1514 return _set_memory_array(addr, addrinarray, _PAGE_CACHE_UC_MINUS); 1524 return _set_memory_array(addr, addrinarray, _PAGE_CACHE_MODE_UC_MINUS);
1515} 1525}
1516EXPORT_SYMBOL(set_memory_array_uc); 1526EXPORT_SYMBOL(set_memory_array_uc);
1517 1527
1518int set_memory_array_wc(unsigned long *addr, int addrinarray) 1528int set_memory_array_wc(unsigned long *addr, int addrinarray)
1519{ 1529{
1520 return _set_memory_array(addr, addrinarray, _PAGE_CACHE_WC); 1530 return _set_memory_array(addr, addrinarray, _PAGE_CACHE_MODE_WC);
1521} 1531}
1522EXPORT_SYMBOL(set_memory_array_wc); 1532EXPORT_SYMBOL(set_memory_array_wc);
1523 1533
@@ -1527,10 +1537,12 @@ int _set_memory_wc(unsigned long addr, int numpages)
1527 unsigned long addr_copy = addr; 1537 unsigned long addr_copy = addr;
1528 1538
1529 ret = change_page_attr_set(&addr, numpages, 1539 ret = change_page_attr_set(&addr, numpages,
1530 __pgprot(_PAGE_CACHE_UC_MINUS), 0); 1540 cachemode2pgprot(_PAGE_CACHE_MODE_UC_MINUS),
1541 0);
1531 if (!ret) { 1542 if (!ret) {
1532 ret = change_page_attr_set_clr(&addr_copy, numpages, 1543 ret = change_page_attr_set_clr(&addr_copy, numpages,
1533 __pgprot(_PAGE_CACHE_WC), 1544 cachemode2pgprot(
1545 _PAGE_CACHE_MODE_WC),
1534 __pgprot(_PAGE_CACHE_MASK), 1546 __pgprot(_PAGE_CACHE_MASK),
1535 0, 0, NULL); 1547 0, 0, NULL);
1536 } 1548 }
@@ -1545,7 +1557,7 @@ int set_memory_wc(unsigned long addr, int numpages)
1545 return set_memory_uc(addr, numpages); 1557 return set_memory_uc(addr, numpages);
1546 1558
1547 ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE, 1559 ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
1548 _PAGE_CACHE_WC, NULL); 1560 _PAGE_CACHE_MODE_WC, NULL);
1549 if (ret) 1561 if (ret)
1550 goto out_err; 1562 goto out_err;
1551 1563
@@ -1564,6 +1576,7 @@ EXPORT_SYMBOL(set_memory_wc);
1564 1576
1565int _set_memory_wb(unsigned long addr, int numpages) 1577int _set_memory_wb(unsigned long addr, int numpages)
1566{ 1578{
1579 /* WB cache mode is hard wired to all cache attribute bits being 0 */
1567 return change_page_attr_clear(&addr, numpages, 1580 return change_page_attr_clear(&addr, numpages,
1568 __pgprot(_PAGE_CACHE_MASK), 0); 1581 __pgprot(_PAGE_CACHE_MASK), 0);
1569} 1582}
@@ -1586,6 +1599,7 @@ int set_memory_array_wb(unsigned long *addr, int addrinarray)
1586 int i; 1599 int i;
1587 int ret; 1600 int ret;
1588 1601
1602 /* WB cache mode is hard wired to all cache attribute bits being 0 */
1589 ret = change_page_attr_clear(addr, addrinarray, 1603 ret = change_page_attr_clear(addr, addrinarray,
1590 __pgprot(_PAGE_CACHE_MASK), 1); 1604 __pgprot(_PAGE_CACHE_MASK), 1);
1591 if (ret) 1605 if (ret)
@@ -1648,7 +1662,7 @@ int set_pages_uc(struct page *page, int numpages)
1648EXPORT_SYMBOL(set_pages_uc); 1662EXPORT_SYMBOL(set_pages_uc);
1649 1663
1650static int _set_pages_array(struct page **pages, int addrinarray, 1664static int _set_pages_array(struct page **pages, int addrinarray,
1651 unsigned long new_type) 1665 enum page_cache_mode new_type)
1652{ 1666{
1653 unsigned long start; 1667 unsigned long start;
1654 unsigned long end; 1668 unsigned long end;
@@ -1666,10 +1680,11 @@ static int _set_pages_array(struct page **pages, int addrinarray,
1666 } 1680 }
1667 1681
1668 ret = cpa_set_pages_array(pages, addrinarray, 1682 ret = cpa_set_pages_array(pages, addrinarray,
1669 __pgprot(_PAGE_CACHE_UC_MINUS)); 1683 cachemode2pgprot(_PAGE_CACHE_MODE_UC_MINUS));
1670 if (!ret && new_type == _PAGE_CACHE_WC) 1684 if (!ret && new_type == _PAGE_CACHE_MODE_WC)
1671 ret = change_page_attr_set_clr(NULL, addrinarray, 1685 ret = change_page_attr_set_clr(NULL, addrinarray,
1672 __pgprot(_PAGE_CACHE_WC), 1686 cachemode2pgprot(
1687 _PAGE_CACHE_MODE_WC),
1673 __pgprot(_PAGE_CACHE_MASK), 1688 __pgprot(_PAGE_CACHE_MASK),
1674 0, CPA_PAGES_ARRAY, pages); 1689 0, CPA_PAGES_ARRAY, pages);
1675 if (ret) 1690 if (ret)
@@ -1689,13 +1704,13 @@ err_out:
1689 1704
1690int set_pages_array_uc(struct page **pages, int addrinarray) 1705int set_pages_array_uc(struct page **pages, int addrinarray)
1691{ 1706{
1692 return _set_pages_array(pages, addrinarray, _PAGE_CACHE_UC_MINUS); 1707 return _set_pages_array(pages, addrinarray, _PAGE_CACHE_MODE_UC_MINUS);
1693} 1708}
1694EXPORT_SYMBOL(set_pages_array_uc); 1709EXPORT_SYMBOL(set_pages_array_uc);
1695 1710
1696int set_pages_array_wc(struct page **pages, int addrinarray) 1711int set_pages_array_wc(struct page **pages, int addrinarray)
1697{ 1712{
1698 return _set_pages_array(pages, addrinarray, _PAGE_CACHE_WC); 1713 return _set_pages_array(pages, addrinarray, _PAGE_CACHE_MODE_WC);
1699} 1714}
1700EXPORT_SYMBOL(set_pages_array_wc); 1715EXPORT_SYMBOL(set_pages_array_wc);
1701 1716
@@ -1714,6 +1729,7 @@ int set_pages_array_wb(struct page **pages, int addrinarray)
1714 unsigned long end; 1729 unsigned long end;
1715 int i; 1730 int i;
1716 1731
1732 /* WB cache mode is hard wired to all cache attribute bits being 0 */
1717 retval = cpa_clear_pages_array(pages, addrinarray, 1733 retval = cpa_clear_pages_array(pages, addrinarray,
1718 __pgprot(_PAGE_CACHE_MASK)); 1734 __pgprot(_PAGE_CACHE_MASK));
1719 if (retval) 1735 if (retval)
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 657438858e83..edf299c8ff6c 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -31,6 +31,7 @@
31#include <asm/io.h> 31#include <asm/io.h>
32 32
33#include "pat_internal.h" 33#include "pat_internal.h"
34#include "mm_internal.h"
34 35
35#ifdef CONFIG_X86_PAT 36#ifdef CONFIG_X86_PAT
36int __read_mostly pat_enabled = 1; 37int __read_mostly pat_enabled = 1;
@@ -66,6 +67,75 @@ __setup("debugpat", pat_debug_setup);
66 67
67static u64 __read_mostly boot_pat_state; 68static u64 __read_mostly boot_pat_state;
68 69
70#ifdef CONFIG_X86_PAT
71/*
72 * X86 PAT uses page flags WC and Uncached together to keep track of
73 * memory type of pages that have backing page struct. X86 PAT supports 3
74 * different memory types, _PAGE_CACHE_MODE_WB, _PAGE_CACHE_MODE_WC and
75 * _PAGE_CACHE_MODE_UC_MINUS and fourth state where page's memory type has not
76 * been changed from its default (value of -1 used to denote this).
77 * Note we do not support _PAGE_CACHE_MODE_UC here.
78 */
79
80#define _PGMT_DEFAULT 0
81#define _PGMT_WC (1UL << PG_arch_1)
82#define _PGMT_UC_MINUS (1UL << PG_uncached)
83#define _PGMT_WB (1UL << PG_uncached | 1UL << PG_arch_1)
84#define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1)
85#define _PGMT_CLEAR_MASK (~_PGMT_MASK)
86
87static inline enum page_cache_mode get_page_memtype(struct page *pg)
88{
89 unsigned long pg_flags = pg->flags & _PGMT_MASK;
90
91 if (pg_flags == _PGMT_DEFAULT)
92 return -1;
93 else if (pg_flags == _PGMT_WC)
94 return _PAGE_CACHE_MODE_WC;
95 else if (pg_flags == _PGMT_UC_MINUS)
96 return _PAGE_CACHE_MODE_UC_MINUS;
97 else
98 return _PAGE_CACHE_MODE_WB;
99}
100
101static inline void set_page_memtype(struct page *pg,
102 enum page_cache_mode memtype)
103{
104 unsigned long memtype_flags;
105 unsigned long old_flags;
106 unsigned long new_flags;
107
108 switch (memtype) {
109 case _PAGE_CACHE_MODE_WC:
110 memtype_flags = _PGMT_WC;
111 break;
112 case _PAGE_CACHE_MODE_UC_MINUS:
113 memtype_flags = _PGMT_UC_MINUS;
114 break;
115 case _PAGE_CACHE_MODE_WB:
116 memtype_flags = _PGMT_WB;
117 break;
118 default:
119 memtype_flags = _PGMT_DEFAULT;
120 break;
121 }
122
123 do {
124 old_flags = pg->flags;
125 new_flags = (old_flags & _PGMT_CLEAR_MASK) | memtype_flags;
126 } while (cmpxchg(&pg->flags, old_flags, new_flags) != old_flags);
127}
128#else
129static inline enum page_cache_mode get_page_memtype(struct page *pg)
130{
131 return -1;
132}
133static inline void set_page_memtype(struct page *pg,
134 enum page_cache_mode memtype)
135{
136}
137#endif
138
69enum { 139enum {
70 PAT_UC = 0, /* uncached */ 140 PAT_UC = 0, /* uncached */
71 PAT_WC = 1, /* Write combining */ 141 PAT_WC = 1, /* Write combining */
@@ -75,6 +145,52 @@ enum {
75 PAT_UC_MINUS = 7, /* UC, but can be overriden by MTRR */ 145 PAT_UC_MINUS = 7, /* UC, but can be overriden by MTRR */
76}; 146};
77 147
148#define CM(c) (_PAGE_CACHE_MODE_ ## c)
149
150static enum page_cache_mode pat_get_cache_mode(unsigned pat_val, char *msg)
151{
152 enum page_cache_mode cache;
153 char *cache_mode;
154
155 switch (pat_val) {
156 case PAT_UC: cache = CM(UC); cache_mode = "UC "; break;
157 case PAT_WC: cache = CM(WC); cache_mode = "WC "; break;
158 case PAT_WT: cache = CM(WT); cache_mode = "WT "; break;
159 case PAT_WP: cache = CM(WP); cache_mode = "WP "; break;
160 case PAT_WB: cache = CM(WB); cache_mode = "WB "; break;
161 case PAT_UC_MINUS: cache = CM(UC_MINUS); cache_mode = "UC- "; break;
162 default: cache = CM(WB); cache_mode = "WB "; break;
163 }
164
165 memcpy(msg, cache_mode, 4);
166
167 return cache;
168}
169
170#undef CM
171
172/*
173 * Update the cache mode to pgprot translation tables according to PAT
174 * configuration.
175 * Using lower indices is preferred, so we start with highest index.
176 */
177void pat_init_cache_modes(void)
178{
179 int i;
180 enum page_cache_mode cache;
181 char pat_msg[33];
182 u64 pat;
183
184 rdmsrl(MSR_IA32_CR_PAT, pat);
185 pat_msg[32] = 0;
186 for (i = 7; i >= 0; i--) {
187 cache = pat_get_cache_mode((pat >> (i * 8)) & 7,
188 pat_msg + 4 * i);
189 update_cache_mode_entry(i, cache);
190 }
191 pr_info("PAT configuration [0-7]: %s\n", pat_msg);
192}
193
78#define PAT(x, y) ((u64)PAT_ ## y << ((x)*8)) 194#define PAT(x, y) ((u64)PAT_ ## y << ((x)*8))
79 195
80void pat_init(void) 196void pat_init(void)
@@ -124,8 +240,7 @@ void pat_init(void)
124 wrmsrl(MSR_IA32_CR_PAT, pat); 240 wrmsrl(MSR_IA32_CR_PAT, pat);
125 241
126 if (boot_cpu) 242 if (boot_cpu)
127 printk(KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n", 243 pat_init_cache_modes();
128 smp_processor_id(), boot_pat_state, pat);
129} 244}
130 245
131#undef PAT 246#undef PAT
@@ -139,20 +254,21 @@ static DEFINE_SPINLOCK(memtype_lock); /* protects memtype accesses */
139 * The intersection is based on "Effective Memory Type" tables in IA-32 254 * The intersection is based on "Effective Memory Type" tables in IA-32
140 * SDM vol 3a 255 * SDM vol 3a
141 */ 256 */
142static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type) 257static unsigned long pat_x_mtrr_type(u64 start, u64 end,
258 enum page_cache_mode req_type)
143{ 259{
144 /* 260 /*
145 * Look for MTRR hint to get the effective type in case where PAT 261 * Look for MTRR hint to get the effective type in case where PAT
146 * request is for WB. 262 * request is for WB.
147 */ 263 */
148 if (req_type == _PAGE_CACHE_WB) { 264 if (req_type == _PAGE_CACHE_MODE_WB) {
149 u8 mtrr_type; 265 u8 mtrr_type;
150 266
151 mtrr_type = mtrr_type_lookup(start, end); 267 mtrr_type = mtrr_type_lookup(start, end);
152 if (mtrr_type != MTRR_TYPE_WRBACK) 268 if (mtrr_type != MTRR_TYPE_WRBACK)
153 return _PAGE_CACHE_UC_MINUS; 269 return _PAGE_CACHE_MODE_UC_MINUS;
154 270
155 return _PAGE_CACHE_WB; 271 return _PAGE_CACHE_MODE_WB;
156 } 272 }
157 273
158 return req_type; 274 return req_type;
@@ -207,25 +323,26 @@ static int pat_pagerange_is_ram(resource_size_t start, resource_size_t end)
207 * - Find the memtype of all the pages in the range, look for any conflicts 323 * - Find the memtype of all the pages in the range, look for any conflicts
208 * - In case of no conflicts, set the new memtype for pages in the range 324 * - In case of no conflicts, set the new memtype for pages in the range
209 */ 325 */
210static int reserve_ram_pages_type(u64 start, u64 end, unsigned long req_type, 326static int reserve_ram_pages_type(u64 start, u64 end,
211 unsigned long *new_type) 327 enum page_cache_mode req_type,
328 enum page_cache_mode *new_type)
212{ 329{
213 struct page *page; 330 struct page *page;
214 u64 pfn; 331 u64 pfn;
215 332
216 if (req_type == _PAGE_CACHE_UC) { 333 if (req_type == _PAGE_CACHE_MODE_UC) {
217 /* We do not support strong UC */ 334 /* We do not support strong UC */
218 WARN_ON_ONCE(1); 335 WARN_ON_ONCE(1);
219 req_type = _PAGE_CACHE_UC_MINUS; 336 req_type = _PAGE_CACHE_MODE_UC_MINUS;
220 } 337 }
221 338
222 for (pfn = (start >> PAGE_SHIFT); pfn < (end >> PAGE_SHIFT); ++pfn) { 339 for (pfn = (start >> PAGE_SHIFT); pfn < (end >> PAGE_SHIFT); ++pfn) {
223 unsigned long type; 340 enum page_cache_mode type;
224 341
225 page = pfn_to_page(pfn); 342 page = pfn_to_page(pfn);
226 type = get_page_memtype(page); 343 type = get_page_memtype(page);
227 if (type != -1) { 344 if (type != -1) {
228 printk(KERN_INFO "reserve_ram_pages_type failed [mem %#010Lx-%#010Lx], track 0x%lx, req 0x%lx\n", 345 pr_info("reserve_ram_pages_type failed [mem %#010Lx-%#010Lx], track 0x%x, req 0x%x\n",
229 start, end - 1, type, req_type); 346 start, end - 1, type, req_type);
230 if (new_type) 347 if (new_type)
231 *new_type = type; 348 *new_type = type;
@@ -258,21 +375,21 @@ static int free_ram_pages_type(u64 start, u64 end)
258 375
259/* 376/*
260 * req_type typically has one of the: 377 * req_type typically has one of the:
261 * - _PAGE_CACHE_WB 378 * - _PAGE_CACHE_MODE_WB
262 * - _PAGE_CACHE_WC 379 * - _PAGE_CACHE_MODE_WC
263 * - _PAGE_CACHE_UC_MINUS 380 * - _PAGE_CACHE_MODE_UC_MINUS
264 * - _PAGE_CACHE_UC 381 * - _PAGE_CACHE_MODE_UC
265 * 382 *
266 * If new_type is NULL, function will return an error if it cannot reserve the 383 * If new_type is NULL, function will return an error if it cannot reserve the
267 * region with req_type. If new_type is non-NULL, function will return 384 * region with req_type. If new_type is non-NULL, function will return
268 * available type in new_type in case of no error. In case of any error 385 * available type in new_type in case of no error. In case of any error
269 * it will return a negative return value. 386 * it will return a negative return value.
270 */ 387 */
271int reserve_memtype(u64 start, u64 end, unsigned long req_type, 388int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type,
272 unsigned long *new_type) 389 enum page_cache_mode *new_type)
273{ 390{
274 struct memtype *new; 391 struct memtype *new;
275 unsigned long actual_type; 392 enum page_cache_mode actual_type;
276 int is_range_ram; 393 int is_range_ram;
277 int err = 0; 394 int err = 0;
278 395
@@ -281,10 +398,10 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
281 if (!pat_enabled) { 398 if (!pat_enabled) {
282 /* This is identical to page table setting without PAT */ 399 /* This is identical to page table setting without PAT */
283 if (new_type) { 400 if (new_type) {
284 if (req_type == _PAGE_CACHE_WC) 401 if (req_type == _PAGE_CACHE_MODE_WC)
285 *new_type = _PAGE_CACHE_UC_MINUS; 402 *new_type = _PAGE_CACHE_MODE_UC_MINUS;
286 else 403 else
287 *new_type = req_type & _PAGE_CACHE_MASK; 404 *new_type = req_type;
288 } 405 }
289 return 0; 406 return 0;
290 } 407 }
@@ -292,7 +409,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
292 /* Low ISA region is always mapped WB in page table. No need to track */ 409 /* Low ISA region is always mapped WB in page table. No need to track */
293 if (x86_platform.is_untracked_pat_range(start, end)) { 410 if (x86_platform.is_untracked_pat_range(start, end)) {
294 if (new_type) 411 if (new_type)
295 *new_type = _PAGE_CACHE_WB; 412 *new_type = _PAGE_CACHE_MODE_WB;
296 return 0; 413 return 0;
297 } 414 }
298 415
@@ -302,7 +419,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
302 * tools and ACPI tools). Use WB request for WB memory and use 419 * tools and ACPI tools). Use WB request for WB memory and use
303 * UC_MINUS otherwise. 420 * UC_MINUS otherwise.
304 */ 421 */
305 actual_type = pat_x_mtrr_type(start, end, req_type & _PAGE_CACHE_MASK); 422 actual_type = pat_x_mtrr_type(start, end, req_type);
306 423
307 if (new_type) 424 if (new_type)
308 *new_type = actual_type; 425 *new_type = actual_type;
@@ -394,12 +511,12 @@ int free_memtype(u64 start, u64 end)
394 * 511 *
395 * Only to be called when PAT is enabled 512 * Only to be called when PAT is enabled
396 * 513 *
397 * Returns _PAGE_CACHE_WB, _PAGE_CACHE_WC, _PAGE_CACHE_UC_MINUS or 514 * Returns _PAGE_CACHE_MODE_WB, _PAGE_CACHE_MODE_WC, _PAGE_CACHE_MODE_UC_MINUS
398 * _PAGE_CACHE_UC 515 * or _PAGE_CACHE_MODE_UC
399 */ 516 */
400static unsigned long lookup_memtype(u64 paddr) 517static enum page_cache_mode lookup_memtype(u64 paddr)
401{ 518{
402 int rettype = _PAGE_CACHE_WB; 519 enum page_cache_mode rettype = _PAGE_CACHE_MODE_WB;
403 struct memtype *entry; 520 struct memtype *entry;
404 521
405 if (x86_platform.is_untracked_pat_range(paddr, paddr + PAGE_SIZE)) 522 if (x86_platform.is_untracked_pat_range(paddr, paddr + PAGE_SIZE))
@@ -414,7 +531,7 @@ static unsigned long lookup_memtype(u64 paddr)
414 * default state and not reserved, and hence of type WB 531 * default state and not reserved, and hence of type WB
415 */ 532 */
416 if (rettype == -1) 533 if (rettype == -1)
417 rettype = _PAGE_CACHE_WB; 534 rettype = _PAGE_CACHE_MODE_WB;
418 535
419 return rettype; 536 return rettype;
420 } 537 }
@@ -425,7 +542,7 @@ static unsigned long lookup_memtype(u64 paddr)
425 if (entry != NULL) 542 if (entry != NULL)
426 rettype = entry->type; 543 rettype = entry->type;
427 else 544 else
428 rettype = _PAGE_CACHE_UC_MINUS; 545 rettype = _PAGE_CACHE_MODE_UC_MINUS;
429 546
430 spin_unlock(&memtype_lock); 547 spin_unlock(&memtype_lock);
431 return rettype; 548 return rettype;
@@ -442,11 +559,11 @@ static unsigned long lookup_memtype(u64 paddr)
442 * On failure, returns non-zero 559 * On failure, returns non-zero
443 */ 560 */
444int io_reserve_memtype(resource_size_t start, resource_size_t end, 561int io_reserve_memtype(resource_size_t start, resource_size_t end,
445 unsigned long *type) 562 enum page_cache_mode *type)
446{ 563{
447 resource_size_t size = end - start; 564 resource_size_t size = end - start;
448 unsigned long req_type = *type; 565 enum page_cache_mode req_type = *type;
449 unsigned long new_type; 566 enum page_cache_mode new_type;
450 int ret; 567 int ret;
451 568
452 WARN_ON_ONCE(iomem_map_sanity_check(start, size)); 569 WARN_ON_ONCE(iomem_map_sanity_check(start, size));
@@ -520,13 +637,13 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
520int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, 637int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
521 unsigned long size, pgprot_t *vma_prot) 638 unsigned long size, pgprot_t *vma_prot)
522{ 639{
523 unsigned long flags = _PAGE_CACHE_WB; 640 enum page_cache_mode pcm = _PAGE_CACHE_MODE_WB;
524 641
525 if (!range_is_allowed(pfn, size)) 642 if (!range_is_allowed(pfn, size))
526 return 0; 643 return 0;
527 644
528 if (file->f_flags & O_DSYNC) 645 if (file->f_flags & O_DSYNC)
529 flags = _PAGE_CACHE_UC_MINUS; 646 pcm = _PAGE_CACHE_MODE_UC_MINUS;
530 647
531#ifdef CONFIG_X86_32 648#ifdef CONFIG_X86_32
532 /* 649 /*
@@ -543,12 +660,12 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
543 boot_cpu_has(X86_FEATURE_CYRIX_ARR) || 660 boot_cpu_has(X86_FEATURE_CYRIX_ARR) ||
544 boot_cpu_has(X86_FEATURE_CENTAUR_MCR)) && 661 boot_cpu_has(X86_FEATURE_CENTAUR_MCR)) &&
545 (pfn << PAGE_SHIFT) >= __pa(high_memory)) { 662 (pfn << PAGE_SHIFT) >= __pa(high_memory)) {
546 flags = _PAGE_CACHE_UC; 663 pcm = _PAGE_CACHE_MODE_UC;
547 } 664 }
548#endif 665#endif
549 666
550 *vma_prot = __pgprot((pgprot_val(*vma_prot) & ~_PAGE_CACHE_MASK) | 667 *vma_prot = __pgprot((pgprot_val(*vma_prot) & ~_PAGE_CACHE_MASK) |
551 flags); 668 cachemode2protval(pcm));
552 return 1; 669 return 1;
553} 670}
554 671
@@ -556,7 +673,8 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
556 * Change the memory type for the physial address range in kernel identity 673 * Change the memory type for the physial address range in kernel identity
557 * mapping space if that range is a part of identity map. 674 * mapping space if that range is a part of identity map.
558 */ 675 */
559int kernel_map_sync_memtype(u64 base, unsigned long size, unsigned long flags) 676int kernel_map_sync_memtype(u64 base, unsigned long size,
677 enum page_cache_mode pcm)
560{ 678{
561 unsigned long id_sz; 679 unsigned long id_sz;
562 680
@@ -574,11 +692,11 @@ int kernel_map_sync_memtype(u64 base, unsigned long size, unsigned long flags)
574 __pa(high_memory) - base : 692 __pa(high_memory) - base :
575 size; 693 size;
576 694
577 if (ioremap_change_attr((unsigned long)__va(base), id_sz, flags) < 0) { 695 if (ioremap_change_attr((unsigned long)__va(base), id_sz, pcm) < 0) {
578 printk(KERN_INFO "%s:%d ioremap_change_attr failed %s " 696 printk(KERN_INFO "%s:%d ioremap_change_attr failed %s "
579 "for [mem %#010Lx-%#010Lx]\n", 697 "for [mem %#010Lx-%#010Lx]\n",
580 current->comm, current->pid, 698 current->comm, current->pid,
581 cattr_name(flags), 699 cattr_name(pcm),
582 base, (unsigned long long)(base + size-1)); 700 base, (unsigned long long)(base + size-1));
583 return -EINVAL; 701 return -EINVAL;
584 } 702 }
@@ -595,8 +713,8 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
595{ 713{
596 int is_ram = 0; 714 int is_ram = 0;
597 int ret; 715 int ret;
598 unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK); 716 enum page_cache_mode want_pcm = pgprot2cachemode(*vma_prot);
599 unsigned long flags = want_flags; 717 enum page_cache_mode pcm = want_pcm;
600 718
601 is_ram = pat_pagerange_is_ram(paddr, paddr + size); 719 is_ram = pat_pagerange_is_ram(paddr, paddr + size);
602 720
@@ -609,36 +727,36 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
609 if (!pat_enabled) 727 if (!pat_enabled)
610 return 0; 728 return 0;
611 729
612 flags = lookup_memtype(paddr); 730 pcm = lookup_memtype(paddr);
613 if (want_flags != flags) { 731 if (want_pcm != pcm) {
614 printk(KERN_WARNING "%s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n", 732 printk(KERN_WARNING "%s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n",
615 current->comm, current->pid, 733 current->comm, current->pid,
616 cattr_name(want_flags), 734 cattr_name(want_pcm),
617 (unsigned long long)paddr, 735 (unsigned long long)paddr,
618 (unsigned long long)(paddr + size - 1), 736 (unsigned long long)(paddr + size - 1),
619 cattr_name(flags)); 737 cattr_name(pcm));
620 *vma_prot = __pgprot((pgprot_val(*vma_prot) & 738 *vma_prot = __pgprot((pgprot_val(*vma_prot) &
621 (~_PAGE_CACHE_MASK)) | 739 (~_PAGE_CACHE_MASK)) |
622 flags); 740 cachemode2protval(pcm));
623 } 741 }
624 return 0; 742 return 0;
625 } 743 }
626 744
627 ret = reserve_memtype(paddr, paddr + size, want_flags, &flags); 745 ret = reserve_memtype(paddr, paddr + size, want_pcm, &pcm);
628 if (ret) 746 if (ret)
629 return ret; 747 return ret;
630 748
631 if (flags != want_flags) { 749 if (pcm != want_pcm) {
632 if (strict_prot || 750 if (strict_prot ||
633 !is_new_memtype_allowed(paddr, size, want_flags, flags)) { 751 !is_new_memtype_allowed(paddr, size, want_pcm, pcm)) {
634 free_memtype(paddr, paddr + size); 752 free_memtype(paddr, paddr + size);
635 printk(KERN_ERR "%s:%d map pfn expected mapping type %s" 753 printk(KERN_ERR "%s:%d map pfn expected mapping type %s"
636 " for [mem %#010Lx-%#010Lx], got %s\n", 754 " for [mem %#010Lx-%#010Lx], got %s\n",
637 current->comm, current->pid, 755 current->comm, current->pid,
638 cattr_name(want_flags), 756 cattr_name(want_pcm),
639 (unsigned long long)paddr, 757 (unsigned long long)paddr,
640 (unsigned long long)(paddr + size - 1), 758 (unsigned long long)(paddr + size - 1),
641 cattr_name(flags)); 759 cattr_name(pcm));
642 return -EINVAL; 760 return -EINVAL;
643 } 761 }
644 /* 762 /*
@@ -647,10 +765,10 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
647 */ 765 */
648 *vma_prot = __pgprot((pgprot_val(*vma_prot) & 766 *vma_prot = __pgprot((pgprot_val(*vma_prot) &
649 (~_PAGE_CACHE_MASK)) | 767 (~_PAGE_CACHE_MASK)) |
650 flags); 768 cachemode2protval(pcm));
651 } 769 }
652 770
653 if (kernel_map_sync_memtype(paddr, size, flags) < 0) { 771 if (kernel_map_sync_memtype(paddr, size, pcm) < 0) {
654 free_memtype(paddr, paddr + size); 772 free_memtype(paddr, paddr + size);
655 return -EINVAL; 773 return -EINVAL;
656 } 774 }
@@ -709,7 +827,7 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
709 unsigned long pfn, unsigned long addr, unsigned long size) 827 unsigned long pfn, unsigned long addr, unsigned long size)
710{ 828{
711 resource_size_t paddr = (resource_size_t)pfn << PAGE_SHIFT; 829 resource_size_t paddr = (resource_size_t)pfn << PAGE_SHIFT;
712 unsigned long flags; 830 enum page_cache_mode pcm;
713 831
714 /* reserve the whole chunk starting from paddr */ 832 /* reserve the whole chunk starting from paddr */
715 if (addr == vma->vm_start && size == (vma->vm_end - vma->vm_start)) { 833 if (addr == vma->vm_start && size == (vma->vm_end - vma->vm_start)) {
@@ -728,18 +846,18 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
728 * For anything smaller than the vma size we set prot based on the 846 * For anything smaller than the vma size we set prot based on the
729 * lookup. 847 * lookup.
730 */ 848 */
731 flags = lookup_memtype(paddr); 849 pcm = lookup_memtype(paddr);
732 850
733 /* Check memtype for the remaining pages */ 851 /* Check memtype for the remaining pages */
734 while (size > PAGE_SIZE) { 852 while (size > PAGE_SIZE) {
735 size -= PAGE_SIZE; 853 size -= PAGE_SIZE;
736 paddr += PAGE_SIZE; 854 paddr += PAGE_SIZE;
737 if (flags != lookup_memtype(paddr)) 855 if (pcm != lookup_memtype(paddr))
738 return -EINVAL; 856 return -EINVAL;
739 } 857 }
740 858
741 *prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) | 859 *prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) |
742 flags); 860 cachemode2protval(pcm));
743 861
744 return 0; 862 return 0;
745} 863}
@@ -747,15 +865,15 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
747int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot, 865int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
748 unsigned long pfn) 866 unsigned long pfn)
749{ 867{
750 unsigned long flags; 868 enum page_cache_mode pcm;
751 869
752 if (!pat_enabled) 870 if (!pat_enabled)
753 return 0; 871 return 0;
754 872
755 /* Set prot based on lookup */ 873 /* Set prot based on lookup */
756 flags = lookup_memtype((resource_size_t)pfn << PAGE_SHIFT); 874 pcm = lookup_memtype((resource_size_t)pfn << PAGE_SHIFT);
757 *prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) | 875 *prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) |
758 flags); 876 cachemode2protval(pcm));
759 877
760 return 0; 878 return 0;
761} 879}
@@ -791,7 +909,8 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
791pgprot_t pgprot_writecombine(pgprot_t prot) 909pgprot_t pgprot_writecombine(pgprot_t prot)
792{ 910{
793 if (pat_enabled) 911 if (pat_enabled)
794 return __pgprot(pgprot_val(prot) | _PAGE_CACHE_WC); 912 return __pgprot(pgprot_val(prot) |
913 cachemode2protval(_PAGE_CACHE_MODE_WC));
795 else 914 else
796 return pgprot_noncached(prot); 915 return pgprot_noncached(prot);
797} 916}
@@ -824,7 +943,7 @@ static void *memtype_seq_start(struct seq_file *seq, loff_t *pos)
824{ 943{
825 if (*pos == 0) { 944 if (*pos == 0) {
826 ++*pos; 945 ++*pos;
827 seq_printf(seq, "PAT memtype list:\n"); 946 seq_puts(seq, "PAT memtype list:\n");
828 } 947 }
829 948
830 return memtype_get_idx(*pos); 949 return memtype_get_idx(*pos);
diff --git a/arch/x86/mm/pat_internal.h b/arch/x86/mm/pat_internal.h
index 77e5ba153fac..f6411620305d 100644
--- a/arch/x86/mm/pat_internal.h
+++ b/arch/x86/mm/pat_internal.h
@@ -10,30 +10,32 @@ struct memtype {
10 u64 start; 10 u64 start;
11 u64 end; 11 u64 end;
12 u64 subtree_max_end; 12 u64 subtree_max_end;
13 unsigned long type; 13 enum page_cache_mode type;
14 struct rb_node rb; 14 struct rb_node rb;
15}; 15};
16 16
17static inline char *cattr_name(unsigned long flags) 17static inline char *cattr_name(enum page_cache_mode pcm)
18{ 18{
19 switch (flags & _PAGE_CACHE_MASK) { 19 switch (pcm) {
20 case _PAGE_CACHE_UC: return "uncached"; 20 case _PAGE_CACHE_MODE_UC: return "uncached";
21 case _PAGE_CACHE_UC_MINUS: return "uncached-minus"; 21 case _PAGE_CACHE_MODE_UC_MINUS: return "uncached-minus";
22 case _PAGE_CACHE_WB: return "write-back"; 22 case _PAGE_CACHE_MODE_WB: return "write-back";
23 case _PAGE_CACHE_WC: return "write-combining"; 23 case _PAGE_CACHE_MODE_WC: return "write-combining";
24 default: return "broken"; 24 case _PAGE_CACHE_MODE_WT: return "write-through";
25 case _PAGE_CACHE_MODE_WP: return "write-protected";
26 default: return "broken";
25 } 27 }
26} 28}
27 29
28#ifdef CONFIG_X86_PAT 30#ifdef CONFIG_X86_PAT
29extern int rbt_memtype_check_insert(struct memtype *new, 31extern int rbt_memtype_check_insert(struct memtype *new,
30 unsigned long *new_type); 32 enum page_cache_mode *new_type);
31extern struct memtype *rbt_memtype_erase(u64 start, u64 end); 33extern struct memtype *rbt_memtype_erase(u64 start, u64 end);
32extern struct memtype *rbt_memtype_lookup(u64 addr); 34extern struct memtype *rbt_memtype_lookup(u64 addr);
33extern int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos); 35extern int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos);
34#else 36#else
35static inline int rbt_memtype_check_insert(struct memtype *new, 37static inline int rbt_memtype_check_insert(struct memtype *new,
36 unsigned long *new_type) 38 enum page_cache_mode *new_type)
37{ return 0; } 39{ return 0; }
38static inline struct memtype *rbt_memtype_erase(u64 start, u64 end) 40static inline struct memtype *rbt_memtype_erase(u64 start, u64 end)
39{ return NULL; } 41{ return NULL; }
diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c
index 415f6c4ced36..6582adcc8bd9 100644
--- a/arch/x86/mm/pat_rbtree.c
+++ b/arch/x86/mm/pat_rbtree.c
@@ -122,11 +122,12 @@ static struct memtype *memtype_rb_exact_match(struct rb_root *root,
122 122
123static int memtype_rb_check_conflict(struct rb_root *root, 123static int memtype_rb_check_conflict(struct rb_root *root,
124 u64 start, u64 end, 124 u64 start, u64 end,
125 unsigned long reqtype, unsigned long *newtype) 125 enum page_cache_mode reqtype,
126 enum page_cache_mode *newtype)
126{ 127{
127 struct rb_node *node; 128 struct rb_node *node;
128 struct memtype *match; 129 struct memtype *match;
129 int found_type = reqtype; 130 enum page_cache_mode found_type = reqtype;
130 131
131 match = memtype_rb_lowest_match(&memtype_rbroot, start, end); 132 match = memtype_rb_lowest_match(&memtype_rbroot, start, end);
132 if (match == NULL) 133 if (match == NULL)
@@ -187,7 +188,8 @@ static void memtype_rb_insert(struct rb_root *root, struct memtype *newdata)
187 rb_insert_augmented(&newdata->rb, root, &memtype_rb_augment_cb); 188 rb_insert_augmented(&newdata->rb, root, &memtype_rb_augment_cb);
188} 189}
189 190
190int rbt_memtype_check_insert(struct memtype *new, unsigned long *ret_type) 191int rbt_memtype_check_insert(struct memtype *new,
192 enum page_cache_mode *ret_type)
191{ 193{
192 int err = 0; 194 int err = 0;
193 195
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 37c1435889ce..9b18ef315a55 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -433,14 +433,14 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
433 return -EINVAL; 433 return -EINVAL;
434 434
435 if (pat_enabled && write_combine) 435 if (pat_enabled && write_combine)
436 prot |= _PAGE_CACHE_WC; 436 prot |= cachemode2protval(_PAGE_CACHE_MODE_WC);
437 else if (pat_enabled || boot_cpu_data.x86 > 3) 437 else if (pat_enabled || boot_cpu_data.x86 > 3)
438 /* 438 /*
439 * ioremap() and ioremap_nocache() defaults to UC MINUS for now. 439 * ioremap() and ioremap_nocache() defaults to UC MINUS for now.
440 * To avoid attribute conflicts, request UC MINUS here 440 * To avoid attribute conflicts, request UC MINUS here
441 * as well. 441 * as well.
442 */ 442 */
443 prot |= _PAGE_CACHE_UC_MINUS; 443 prot |= cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
444 444
445 vma->vm_page_prot = __pgprot(prot); 445 vma->vm_page_prot = __pgprot(prot);
446 446
diff --git a/arch/x86/pci/numachip.c b/arch/x86/pci/numachip.c
index 7307d9d12d15..2e565e65c893 100644
--- a/arch/x86/pci/numachip.c
+++ b/arch/x86/pci/numachip.c
@@ -103,7 +103,7 @@ static int pci_mmcfg_write_numachip(unsigned int seg, unsigned int bus,
103 return 0; 103 return 0;
104} 104}
105 105
106const struct pci_raw_ops pci_mmcfg_numachip = { 106static const struct pci_raw_ops pci_mmcfg_numachip = {
107 .read = pci_mmcfg_read_numachip, 107 .read = pci_mmcfg_read_numachip,
108 .write = pci_mmcfg_write_numachip, 108 .write = pci_mmcfg_write_numachip,
109}; 109};
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 093f5f4272d3..1819a91bbb9f 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -229,7 +229,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
229 return 1; 229 return 1;
230 230
231 list_for_each_entry(msidesc, &dev->msi_list, list) { 231 list_for_each_entry(msidesc, &dev->msi_list, list) {
232 __read_msi_msg(msidesc, &msg); 232 __pci_read_msi_msg(msidesc, &msg);
233 pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) | 233 pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
234 ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff); 234 ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff);
235 if (msg.data != XEN_PIRQ_MSI_DATA || 235 if (msg.data != XEN_PIRQ_MSI_DATA ||
@@ -240,7 +240,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
240 goto error; 240 goto error;
241 } 241 }
242 xen_msi_compose_msg(dev, pirq, &msg); 242 xen_msi_compose_msg(dev, pirq, &msg);
243 __write_msi_msg(msidesc, &msg); 243 __pci_write_msi_msg(msidesc, &msg);
244 dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq); 244 dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
245 } else { 245 } else {
246 dev_dbg(&dev->dev, 246 dev_dbg(&dev->dev,
@@ -394,14 +394,7 @@ static void xen_teardown_msi_irq(unsigned int irq)
394{ 394{
395 xen_destroy_irq(irq); 395 xen_destroy_irq(irq);
396} 396}
397static u32 xen_nop_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) 397
398{
399 return 0;
400}
401static u32 xen_nop_msix_mask_irq(struct msi_desc *desc, u32 flag)
402{
403 return 0;
404}
405#endif 398#endif
406 399
407int __init pci_xen_init(void) 400int __init pci_xen_init(void)
@@ -425,8 +418,7 @@ int __init pci_xen_init(void)
425 x86_msi.setup_msi_irqs = xen_setup_msi_irqs; 418 x86_msi.setup_msi_irqs = xen_setup_msi_irqs;
426 x86_msi.teardown_msi_irq = xen_teardown_msi_irq; 419 x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
427 x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs; 420 x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs;
428 x86_msi.msi_mask_irq = xen_nop_msi_mask_irq; 421 pci_msi_ignore_mask = 1;
429 x86_msi.msix_mask_irq = xen_nop_msix_mask_irq;
430#endif 422#endif
431 return 0; 423 return 0;
432} 424}
@@ -506,8 +498,7 @@ int __init pci_xen_initial_domain(void)
506 x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs; 498 x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs;
507 x86_msi.teardown_msi_irq = xen_teardown_msi_irq; 499 x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
508 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs; 500 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs;
509 x86_msi.msi_mask_irq = xen_nop_msi_mask_irq; 501 pci_msi_ignore_mask = 1;
510 x86_msi.msix_mask_irq = xen_nop_msix_mask_irq;
511#endif 502#endif
512 xen_setup_acpi_sci(); 503 xen_setup_acpi_sci();
513 __acpi_register_gsi = acpi_register_gsi_xen; 504 __acpi_register_gsi = acpi_register_gsi_xen;
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 35aecb6042fb..17e80d829df0 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -48,8 +48,7 @@ static unsigned long efi_flags __initdata;
48 * We allocate runtime services regions bottom-up, starting from -4G, i.e. 48 * We allocate runtime services regions bottom-up, starting from -4G, i.e.
49 * 0xffff_ffff_0000_0000 and limit EFI VA mapping space to 64G. 49 * 0xffff_ffff_0000_0000 and limit EFI VA mapping space to 64G.
50 */ 50 */
51static u64 efi_va = -4 * (1UL << 30); 51static u64 efi_va = EFI_VA_START;
52#define EFI_VA_END (-68 * (1UL << 30))
53 52
54/* 53/*
55 * Scratch space used for switching the pagetable in the EFI stub 54 * Scratch space used for switching the pagetable in the EFI stub
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index 3968d67d366b..994798548b1a 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -1367,23 +1367,25 @@ static int ptc_seq_show(struct seq_file *file, void *data)
1367 1367
1368 cpu = *(loff_t *)data; 1368 cpu = *(loff_t *)data;
1369 if (!cpu) { 1369 if (!cpu) {
1370 seq_printf(file, 1370 seq_puts(file,
1371 "# cpu bauoff sent stime self locals remotes ncpus localhub "); 1371 "# cpu bauoff sent stime self locals remotes ncpus localhub ");
1372 seq_printf(file, 1372 seq_puts(file, "remotehub numuvhubs numuvhubs16 numuvhubs8 ");
1373 "remotehub numuvhubs numuvhubs16 numuvhubs8 "); 1373 seq_puts(file,
1374 seq_printf(file, 1374 "numuvhubs4 numuvhubs2 numuvhubs1 dto snacks retries ");
1375 "numuvhubs4 numuvhubs2 numuvhubs1 dto snacks retries "); 1375 seq_puts(file,
1376 seq_printf(file, 1376 "rok resetp resett giveup sto bz throt disable ");
1377 "rok resetp resett giveup sto bz throt disable "); 1377 seq_puts(file,
1378 seq_printf(file, 1378 "enable wars warshw warwaits enters ipidis plugged ");
1379 "enable wars warshw warwaits enters ipidis plugged "); 1379 seq_puts(file,
1380 seq_printf(file, 1380 "ipiover glim cong swack recv rtime all one mult ");
1381 "ipiover glim cong swack recv rtime all one mult "); 1381 seq_puts(file, "none retry canc nocan reset rcan\n");
1382 seq_printf(file,
1383 "none retry canc nocan reset rcan\n");
1384 } 1382 }
1385 if (cpu < num_possible_cpus() && cpu_online(cpu)) { 1383 if (cpu < num_possible_cpus() && cpu_online(cpu)) {
1386 bcp = &per_cpu(bau_control, cpu); 1384 bcp = &per_cpu(bau_control, cpu);
1385 if (bcp->nobau) {
1386 seq_printf(file, "cpu %d bau disabled\n", cpu);
1387 return 0;
1388 }
1387 stat = bcp->statp; 1389 stat = bcp->statp;
1388 /* source side statistics */ 1390 /* source side statistics */
1389 seq_printf(file, 1391 seq_printf(file,
diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index f52e033557c9..2c835e356349 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -24,6 +24,7 @@ quiet_cmd_bin2c = BIN2C $@
24 24
25$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE 25$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
26 $(call if_changed,bin2c) 26 $(call if_changed,bin2c)
27 @:
27 28
28 29
29obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o 30obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o
diff --git a/arch/x86/tools/insn_sanity.c b/arch/x86/tools/insn_sanity.c
index 872eb60e7806..ba70ff232917 100644
--- a/arch/x86/tools/insn_sanity.c
+++ b/arch/x86/tools/insn_sanity.c
@@ -254,7 +254,7 @@ int main(int argc, char **argv)
254 continue; 254 continue;
255 255
256 /* Decode an instruction */ 256 /* Decode an instruction */
257 insn_init(&insn, insn_buf, x86_64); 257 insn_init(&insn, insn_buf, sizeof(insn_buf), x86_64);
258 insn_get_length(&insn); 258 insn_get_length(&insn);
259 259
260 if (insn.next_byte <= insn.kaddr || 260 if (insn.next_byte <= insn.kaddr ||
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index a5efb21d5228..0c2fae8d929d 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -20,7 +20,10 @@ struct relocs {
20 20
21static struct relocs relocs16; 21static struct relocs relocs16;
22static struct relocs relocs32; 22static struct relocs relocs32;
23#if ELF_BITS == 64
24static struct relocs relocs32neg;
23static struct relocs relocs64; 25static struct relocs relocs64;
26#endif
24 27
25struct section { 28struct section {
26 Elf_Shdr shdr; 29 Elf_Shdr shdr;
@@ -762,11 +765,16 @@ static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
762 765
763 switch (r_type) { 766 switch (r_type) {
764 case R_X86_64_NONE: 767 case R_X86_64_NONE:
768 /* NONE can be ignored. */
769 break;
770
765 case R_X86_64_PC32: 771 case R_X86_64_PC32:
766 /* 772 /*
767 * NONE can be ignored and PC relative relocations don't 773 * PC relative relocations don't need to be adjusted unless
768 * need to be adjusted. 774 * referencing a percpu symbol.
769 */ 775 */
776 if (is_percpu_sym(sym, symname))
777 add_reloc(&relocs32neg, offset);
770 break; 778 break;
771 779
772 case R_X86_64_32: 780 case R_X86_64_32:
@@ -986,7 +994,10 @@ static void emit_relocs(int as_text, int use_real_mode)
986 /* Order the relocations for more efficient processing */ 994 /* Order the relocations for more efficient processing */
987 sort_relocs(&relocs16); 995 sort_relocs(&relocs16);
988 sort_relocs(&relocs32); 996 sort_relocs(&relocs32);
997#if ELF_BITS == 64
998 sort_relocs(&relocs32neg);
989 sort_relocs(&relocs64); 999 sort_relocs(&relocs64);
1000#endif
990 1001
991 /* Print the relocations */ 1002 /* Print the relocations */
992 if (as_text) { 1003 if (as_text) {
@@ -1007,14 +1018,21 @@ static void emit_relocs(int as_text, int use_real_mode)
1007 for (i = 0; i < relocs32.count; i++) 1018 for (i = 0; i < relocs32.count; i++)
1008 write_reloc(relocs32.offset[i], stdout); 1019 write_reloc(relocs32.offset[i], stdout);
1009 } else { 1020 } else {
1010 if (ELF_BITS == 64) { 1021#if ELF_BITS == 64
1011 /* Print a stop */ 1022 /* Print a stop */
1012 write_reloc(0, stdout); 1023 write_reloc(0, stdout);
1013 1024
1014 /* Now print each relocation */ 1025 /* Now print each relocation */
1015 for (i = 0; i < relocs64.count; i++) 1026 for (i = 0; i < relocs64.count; i++)
1016 write_reloc(relocs64.offset[i], stdout); 1027 write_reloc(relocs64.offset[i], stdout);
1017 } 1028
1029 /* Print a stop */
1030 write_reloc(0, stdout);
1031
1032 /* Now print each inverse 32-bit relocation */
1033 for (i = 0; i < relocs32neg.count; i++)
1034 write_reloc(relocs32neg.offset[i], stdout);
1035#endif
1018 1036
1019 /* Print a stop */ 1037 /* Print a stop */
1020 write_reloc(0, stdout); 1038 write_reloc(0, stdout);
diff --git a/arch/x86/tools/test_get_len.c b/arch/x86/tools/test_get_len.c
index 13403fc95a96..56f04db0c9c0 100644
--- a/arch/x86/tools/test_get_len.c
+++ b/arch/x86/tools/test_get_len.c
@@ -149,7 +149,7 @@ int main(int argc, char **argv)
149 break; 149 break;
150 } 150 }
151 /* Decode an instruction */ 151 /* Decode an instruction */
152 insn_init(&insn, insn_buf, x86_64); 152 insn_init(&insn, insn_buf, sizeof(insn_buf), x86_64);
153 insn_get_length(&insn); 153 insn_get_length(&insn);
154 if (insn.length != nb) { 154 if (insn.length != nb) {
155 warnings++; 155 warnings++;
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c
index 2f94b039e55b..8ec3d1f4ce9a 100644
--- a/arch/x86/vdso/vgetcpu.c
+++ b/arch/x86/vdso/vgetcpu.c
@@ -7,9 +7,7 @@
7 7
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/getcpu.h> 9#include <linux/getcpu.h>
10#include <linux/jiffies.h>
11#include <linux/time.h> 10#include <linux/time.h>
12#include <asm/vsyscall.h>
13#include <asm/vgtod.h> 11#include <asm/vgtod.h>
14 12
15notrace long 13notrace long
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 970463b566cf..009495b9ab4b 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * Set up the VMAs to tell the VM about the vDSO.
3 * Copyright 2007 Andi Kleen, SUSE Labs. 2 * Copyright 2007 Andi Kleen, SUSE Labs.
4 * Subject to the GPL, v.2 3 * Subject to the GPL, v.2
4 *
5 * This contains most of the x86 vDSO kernel-side code.
5 */ 6 */
6#include <linux/mm.h> 7#include <linux/mm.h>
7#include <linux/err.h> 8#include <linux/err.h>
@@ -10,17 +11,17 @@
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/random.h> 12#include <linux/random.h>
12#include <linux/elf.h> 13#include <linux/elf.h>
13#include <asm/vsyscall.h> 14#include <linux/cpu.h>
14#include <asm/vgtod.h> 15#include <asm/vgtod.h>
15#include <asm/proto.h> 16#include <asm/proto.h>
16#include <asm/vdso.h> 17#include <asm/vdso.h>
18#include <asm/vvar.h>
17#include <asm/page.h> 19#include <asm/page.h>
18#include <asm/hpet.h> 20#include <asm/hpet.h>
21#include <asm/desc.h>
19 22
20#if defined(CONFIG_X86_64) 23#if defined(CONFIG_X86_64)
21unsigned int __read_mostly vdso64_enabled = 1; 24unsigned int __read_mostly vdso64_enabled = 1;
22
23extern unsigned short vdso_sync_cpuid;
24#endif 25#endif
25 26
26void __init init_vdso_image(const struct vdso_image *image) 27void __init init_vdso_image(const struct vdso_image *image)
@@ -38,20 +39,6 @@ void __init init_vdso_image(const struct vdso_image *image)
38 image->alt_len)); 39 image->alt_len));
39} 40}
40 41
41#if defined(CONFIG_X86_64)
42static int __init init_vdso(void)
43{
44 init_vdso_image(&vdso_image_64);
45
46#ifdef CONFIG_X86_X32_ABI
47 init_vdso_image(&vdso_image_x32);
48#endif
49
50 return 0;
51}
52subsys_initcall(init_vdso);
53#endif
54
55struct linux_binprm; 42struct linux_binprm;
56 43
57/* Put the vdso above the (randomized) stack with another randomized offset. 44/* Put the vdso above the (randomized) stack with another randomized offset.
@@ -238,3 +225,63 @@ static __init int vdso_setup(char *s)
238} 225}
239__setup("vdso=", vdso_setup); 226__setup("vdso=", vdso_setup);
240#endif 227#endif
228
229#ifdef CONFIG_X86_64
230static void vgetcpu_cpu_init(void *arg)
231{
232 int cpu = smp_processor_id();
233 struct desc_struct d = { };
234 unsigned long node = 0;
235#ifdef CONFIG_NUMA
236 node = cpu_to_node(cpu);
237#endif
238 if (cpu_has(&cpu_data(cpu), X86_FEATURE_RDTSCP))
239 write_rdtscp_aux((node << 12) | cpu);
240
241 /*
242 * Store cpu number in limit so that it can be loaded
243 * quickly in user space in vgetcpu. (12 bits for the CPU
244 * and 8 bits for the node)
245 */
246 d.limit0 = cpu | ((node & 0xf) << 12);
247 d.limit = node >> 4;
248 d.type = 5; /* RO data, expand down, accessed */
249 d.dpl = 3; /* Visible to user code */
250 d.s = 1; /* Not a system segment */
251 d.p = 1; /* Present */
252 d.d = 1; /* 32-bit */
253
254 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
255}
256
257static int
258vgetcpu_cpu_notifier(struct notifier_block *n, unsigned long action, void *arg)
259{
260 long cpu = (long)arg;
261
262 if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN)
263 smp_call_function_single(cpu, vgetcpu_cpu_init, NULL, 1);
264
265 return NOTIFY_DONE;
266}
267
268static int __init init_vdso(void)
269{
270 init_vdso_image(&vdso_image_64);
271
272#ifdef CONFIG_X86_X32_ABI
273 init_vdso_image(&vdso_image_x32);
274#endif
275
276 cpu_notifier_register_begin();
277
278 on_each_cpu(vgetcpu_cpu_init, NULL, 1);
279 /* notifier priority > KVM */
280 __hotcpu_notifier(vgetcpu_cpu_notifier, 30);
281
282 cpu_notifier_register_done();
283
284 return 0;
285}
286subsys_initcall(init_vdso);
287#endif /* CONFIG_X86_64 */
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fac5e4f9607c..6bf3a13e3e0f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1100,12 +1100,6 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
1100 /* Fast syscall setup is all done in hypercalls, so 1100 /* Fast syscall setup is all done in hypercalls, so
1101 these are all ignored. Stub them out here to stop 1101 these are all ignored. Stub them out here to stop
1102 Xen console noise. */ 1102 Xen console noise. */
1103 break;
1104
1105 case MSR_IA32_CR_PAT:
1106 if (smp_processor_id() == 0)
1107 xen_set_pat(((u64)high << 32) | low);
1108 break;
1109 1103
1110 default: 1104 default:
1111 ret = native_write_msr_safe(msr, low, high); 1105 ret = native_write_msr_safe(msr, low, high);
@@ -1561,10 +1555,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
1561 1555
1562 /* Prevent unwanted bits from being set in PTEs. */ 1556 /* Prevent unwanted bits from being set in PTEs. */
1563 __supported_pte_mask &= ~_PAGE_GLOBAL; 1557 __supported_pte_mask &= ~_PAGE_GLOBAL;
1564#if 0
1565 if (!xen_initial_domain())
1566#endif
1567 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
1568 1558
1569 /* 1559 /*
1570 * Prevent page tables from being allocated in highmem, even 1560 * Prevent page tables from being allocated in highmem, even
@@ -1618,14 +1608,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
1618 */ 1608 */
1619 acpi_numa = -1; 1609 acpi_numa = -1;
1620#endif 1610#endif
1621#ifdef CONFIG_X86_PAT
1622 /*
1623 * For right now disable the PAT. We should remove this once
1624 * git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1
1625 * (xen/pat: Disable PAT support for now) is reverted.
1626 */
1627 pat_enabled = 0;
1628#endif
1629 /* Don't do the full vcpu_info placement stuff until we have a 1611 /* Don't do the full vcpu_info placement stuff until we have a
1630 possible map and a non-dummy shared_info. */ 1612 possible map and a non-dummy shared_info. */
1631 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; 1613 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
@@ -1636,6 +1618,13 @@ asmlinkage __visible void __init xen_start_kernel(void)
1636 xen_raw_console_write("mapping kernel into physical memory\n"); 1618 xen_raw_console_write("mapping kernel into physical memory\n");
1637 xen_setup_kernel_pagetable((pgd_t *)xen_start_info->pt_base, xen_start_info->nr_pages); 1619 xen_setup_kernel_pagetable((pgd_t *)xen_start_info->pt_base, xen_start_info->nr_pages);
1638 1620
1621 /*
1622 * Modify the cache mode translation tables to match Xen's PAT
1623 * configuration.
1624 */
1625
1626 pat_init_cache_modes();
1627
1639 /* keep using Xen gdt for now; no urgent need to change it */ 1628 /* keep using Xen gdt for now; no urgent need to change it */
1640 1629
1641#ifdef CONFIG_X86_32 1630#ifdef CONFIG_X86_32
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index a8a1a3d08d4d..8c8298d78185 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -410,13 +410,7 @@ static pteval_t pte_pfn_to_mfn(pteval_t val)
410__visible pteval_t xen_pte_val(pte_t pte) 410__visible pteval_t xen_pte_val(pte_t pte)
411{ 411{
412 pteval_t pteval = pte.pte; 412 pteval_t pteval = pte.pte;
413#if 0 413
414 /* If this is a WC pte, convert back from Xen WC to Linux WC */
415 if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) {
416 WARN_ON(!pat_enabled);
417 pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT;
418 }
419#endif
420 return pte_mfn_to_pfn(pteval); 414 return pte_mfn_to_pfn(pteval);
421} 415}
422PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val); 416PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val);
@@ -427,47 +421,8 @@ __visible pgdval_t xen_pgd_val(pgd_t pgd)
427} 421}
428PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val); 422PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val);
429 423
430/*
431 * Xen's PAT setup is part of its ABI, though I assume entries 6 & 7
432 * are reserved for now, to correspond to the Intel-reserved PAT
433 * types.
434 *
435 * We expect Linux's PAT set as follows:
436 *
437 * Idx PTE flags Linux Xen Default
438 * 0 WB WB WB
439 * 1 PWT WC WT WT
440 * 2 PCD UC- UC- UC-
441 * 3 PCD PWT UC UC UC
442 * 4 PAT WB WC WB
443 * 5 PAT PWT WC WP WT
444 * 6 PAT PCD UC- rsv UC-
445 * 7 PAT PCD PWT UC rsv UC
446 */
447
448void xen_set_pat(u64 pat)
449{
450 /* We expect Linux to use a PAT setting of
451 * UC UC- WC WB (ignoring the PAT flag) */
452 WARN_ON(pat != 0x0007010600070106ull);
453}
454
455__visible pte_t xen_make_pte(pteval_t pte) 424__visible pte_t xen_make_pte(pteval_t pte)
456{ 425{
457#if 0
458 /* If Linux is trying to set a WC pte, then map to the Xen WC.
459 * If _PAGE_PAT is set, then it probably means it is really
460 * _PAGE_PSE, so avoid fiddling with the PAT mapping and hope
461 * things work out OK...
462 *
463 * (We should never see kernel mappings with _PAGE_PSE set,
464 * but we could see hugetlbfs mappings, I think.).
465 */
466 if (pat_enabled && !WARN_ON(pte & _PAGE_PAT)) {
467 if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT)
468 pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT;
469 }
470#endif
471 pte = pte_pfn_to_mfn(pte); 426 pte = pte_pfn_to_mfn(pte);
472 427
473 return native_make_pte(pte); 428 return native_make_pte(pte);
@@ -1457,8 +1412,10 @@ static int xen_pgd_alloc(struct mm_struct *mm)
1457 page->private = (unsigned long)user_pgd; 1412 page->private = (unsigned long)user_pgd;
1458 1413
1459 if (user_pgd != NULL) { 1414 if (user_pgd != NULL) {
1415#ifdef CONFIG_X86_VSYSCALL_EMULATION
1460 user_pgd[pgd_index(VSYSCALL_ADDR)] = 1416 user_pgd[pgd_index(VSYSCALL_ADDR)] =
1461 __pgd(__pa(level3_user_vsyscall) | _PAGE_TABLE); 1417 __pgd(__pa(level3_user_vsyscall) | _PAGE_TABLE);
1418#endif
1462 ret = 0; 1419 ret = 0;
1463 } 1420 }
1464 1421
@@ -2021,7 +1978,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2021# ifdef CONFIG_HIGHMEM 1978# ifdef CONFIG_HIGHMEM
2022 case FIX_KMAP_BEGIN ... FIX_KMAP_END: 1979 case FIX_KMAP_BEGIN ... FIX_KMAP_END:
2023# endif 1980# endif
2024#else 1981#elif defined(CONFIG_X86_VSYSCALL_EMULATION)
2025 case VSYSCALL_PAGE: 1982 case VSYSCALL_PAGE:
2026#endif 1983#endif
2027 case FIX_TEXT_POKE0: 1984 case FIX_TEXT_POKE0:
@@ -2060,7 +2017,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2060 2017
2061 __native_set_fixmap(idx, pte); 2018 __native_set_fixmap(idx, pte);
2062 2019
2063#ifdef CONFIG_X86_64 2020#ifdef CONFIG_X86_VSYSCALL_EMULATION
2064 /* Replicate changes to map the vsyscall page into the user 2021 /* Replicate changes to map the vsyscall page into the user
2065 pagetable vsyscall mapping. */ 2022 pagetable vsyscall mapping. */
2066 if (idx == VSYSCALL_PAGE) { 2023 if (idx == VSYSCALL_PAGE) {
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 28c7e0be56e4..4ab9298c5e17 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -33,7 +33,6 @@ extern unsigned long xen_max_p2m_pfn;
33 33
34void xen_mm_pin_all(void); 34void xen_mm_pin_all(void);
35void xen_mm_unpin_all(void); 35void xen_mm_unpin_all(void);
36void xen_set_pat(u64);
37 36
38char * __init xen_memory_setup(void); 37char * __init xen_memory_setup(void);
39char * xen_auto_xlated_memory_setup(void); 38char * xen_auto_xlated_memory_setup(void);
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 74944207167e..fe1600a09438 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -74,13 +74,6 @@ static inline void iounmap(volatile void __iomem *addr)
74 74
75#endif /* CONFIG_MMU */ 75#endif /* CONFIG_MMU */
76 76
77/*
78 * Generic I/O
79 */
80#define readb_relaxed readb
81#define readw_relaxed readw
82#define readl_relaxed readl
83
84#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
85 78
86#include <asm-generic/io.h> 79#include <asm-generic/io.h>